[11951] Unify loot related code and fix engrish.

Also readd the m_groupLootId check in case the StopGroupLoot will be called from other places

Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
This commit is contained in:
stfx 2012-04-12 17:06:48 +02:00 committed by Schmoozerd
parent 1c5f99f4b8
commit f153193a02
5 changed files with 16 additions and 15 deletions

View file

@ -601,7 +601,7 @@ void Group::GroupLoot(WorldObject* pSource, Loot* loot)
//roll for over-threshold item if it's one-player loot
if (itemProto->Quality >= uint32(m_lootThreshold) && !lootItem.freeforall)
StartLootRool(pSource, GROUP_LOOT, loot, itemSlot, maxEnchantingSkill);
StartLootRoll(pSource, GROUP_LOOT, loot, itemSlot, maxEnchantingSkill);
else
lootItem.is_underthreshold = 1;
}
@ -623,7 +623,7 @@ void Group::NeedBeforeGreed(WorldObject* pSource, Loot* loot)
//only roll for one-player items, not for ones everyone can get
if (itemProto->Quality >= uint32(m_lootThreshold) && !lootItem.freeforall)
StartLootRool(pSource, NEED_BEFORE_GREED, loot, itemSlot, maxEnchantingSkill);
StartLootRoll(pSource, NEED_BEFORE_GREED, loot, itemSlot, maxEnchantingSkill);
else
lootItem.is_underthreshold = 1;
}
@ -743,20 +743,20 @@ bool Group::CountRollVote(ObjectGuid const& playerGUID, Rolls::iterator& rollI,
return false;
}
void Group::StartLootRool(WorldObject* lootTarget, LootMethod method, Loot* loot, uint8 itemSlot, uint32 maxEnchantingSkill)
void Group::StartLootRoll(WorldObject* lootTarget, LootMethod method, Loot* loot, uint8 itemSlot, uint32 maxEnchantingSkill)
{
if (itemSlot >= loot->items.size())
return;
LootItem const& lootItem = loot->items[itemSlot];
LootItem const& lootItem = loot->items[itemSlot];
Roll* r = new Roll(lootTarget->GetObjectGuid(), method, lootItem);
//a vector is filled with only near party members
for(GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next())
for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next())
{
Player *playerToRoll = itr->getSource();
if(!playerToRoll || !playerToRoll->GetSession())
Player* playerToRoll = itr->getSource();
if (!playerToRoll || !playerToRoll->GetSession())
continue;
if (lootItem.AllowedForPlayer(playerToRoll))