Fixed a bug where the pickpocket spell would share picked up money with the caster's group. Fixes #2.

This commit is contained in:
Tristan Cormier 2017-01-28 02:10:01 -05:00 committed by Antz
parent 06d9945fd9
commit d6e44477ba

View File

@ -270,8 +270,13 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket& /*recv_data*/)
if (pLoot) if (pLoot)
{ {
pLoot->NotifyMoneyRemoved(); pLoot->NotifyMoneyRemoved();
// Items/objects can ONLY be looted by a single player
if (!guid.IsItem() && player->GetGroup()) // item can be looted only single player if (!guid.IsItem() && player->GetGroup())
{
// Pickpocket case
if (player->getClass() == CLASS_ROGUE && GetPlayer()->GetMap()->GetCreature(guid)->lootForPickPocketed)
player->ModifyMoney(pLoot->gold);
else
{ {
Group* group = player->GetGroup(); Group* group = player->GetGroup();
@ -280,9 +285,9 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket& /*recv_data*/)
{ {
Player* playerGroup = itr->getSource(); Player* playerGroup = itr->getSource();
if (!playerGroup) if (!playerGroup)
{ continue; } continue;
if (player->IsWithinDistInMap(playerGroup, sWorld.getConfig(CONFIG_FLOAT_GROUP_XP_DISTANCE), false)) if (player->IsWithinDistInMap(playerGroup, sWorld.getConfig(CONFIG_FLOAT_GROUP_XP_DISTANCE), false))
{ playersNear.push_back(playerGroup); } playersNear.push_back(playerGroup);
} }
uint32 money_per_player = uint32((pLoot->gold) / (playersNear.size())); uint32 money_per_player = uint32((pLoot->gold) / (playersNear.size()));
@ -297,8 +302,9 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket& /*recv_data*/)
(*i)->GetSession()->SendPacket(&data); (*i)->GetSession()->SendPacket(&data);
} }
} }
}
else else
{ player->ModifyMoney(pLoot->gold); } player->ModifyMoney(pLoot->gold);
// Used by Eluna // Used by Eluna
#ifdef ENABLE_ELUNA #ifdef ENABLE_ELUNA
@ -308,7 +314,7 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket& /*recv_data*/)
pLoot->gold = 0; pLoot->gold = 0;
if (pItem) if (pItem)
{ pItem->SetLootState(ITEM_LOOT_CHANGED); } pItem->SetLootState(ITEM_LOOT_CHANGED);
} }
} }