mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 10:37:03 +00:00
[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:
parent
1c5f99f4b8
commit
f153193a02
5 changed files with 16 additions and 15 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -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); }
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "11950"
|
||||
#define REVISION_NR "11951"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue