diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 1ef59c937..83848239d 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -538,10 +538,10 @@ void Creature::Update(uint32 update_diff, uint32 diff) m_corpseDecayTimer -= update_diff; if (m_groupLootId) { - if(update_diff < m_groupLootTimer) - m_groupLootTimer -= update_diff; - else + if (m_groupLootTimer <= update_diff) StopGroupLoot(); + else + m_groupLootTimer -= update_diff; } } diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index 7ac57e08f..c13bb761e 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -1820,13 +1820,14 @@ void GameObject::SetDisplayId(uint32 modelId) void GameObject::StartGroupLoot(Group* group, uint32 timer) { m_groupLootId = group->GetId(); - - if (m_groupLootId) - m_groupLootTimer = timer; + m_groupLootTimer = timer; } void GameObject::StopGroupLoot() { + if (!m_groupLootId) + return; + if (Group* group = sObjectMgr.GetGroupById(m_groupLootId)) group->EndRoll(); diff --git a/src/game/Group.cpp b/src/game/Group.cpp index a8993b802..dfa22d35a 100644 --- a/src/game/Group.cpp +++ b/src/game/Group.cpp @@ -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)) diff --git a/src/game/Group.h b/src/game/Group.h index 678eef07e..e916ab18e 100644 --- a/src/game/Group.h +++ b/src/game/Group.h @@ -353,7 +353,7 @@ class MANGOS_DLL_SPEC Group void NeedBeforeGreed(WorldObject* pSource, Loot* loot); void MasterLoot(WorldObject* pSource, Loot* loot); bool CountRollVote(Player* player, ObjectGuid const& lootedTarget, uint32 itemSlot, RollVote vote); - void StartLootRool(WorldObject* lootTarget, LootMethod method, Loot* loot, uint8 itemSlot, uint32 maxEnchantingSkill); + void StartLootRoll(WorldObject* lootTarget, LootMethod method, Loot* loot, uint8 itemSlot, uint32 maxEnchantingSkill); void EndRoll(); void LinkMember(GroupReference *pRef) { m_memberMgr.insertFirst(pRef); } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 81834f14e..d9df2c319 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "11950" + #define REVISION_NR "11951" #endif // __REVISION_NR_H__