mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 10:37:03 +00:00
[9917] Fixes in loot roll timer work and related cleanups.
* Changes include (in fact as part cleanup) fix got NeedBeforeGreed locked item after expire roll timer suggested by somedruid@mangos.lighthouseapp.com. * Added cancel rolling at creatuer corpse remove. * For NeedBeforeGreed and GroupLoot sued common code for prepare item roll.
This commit is contained in:
parent
0b7f090a37
commit
96d50bf55a
6 changed files with 112 additions and 127 deletions
|
|
@ -168,6 +168,10 @@ void Creature::RemoveCorpse()
|
|||
m_deathTimer = 0;
|
||||
setDeathState(DEAD);
|
||||
UpdateObjectVisibility();
|
||||
|
||||
// stop loot rolling before loot clear and for close client dialogs
|
||||
StopGroupLoot();
|
||||
|
||||
loot.clear();
|
||||
uint32 respawnDelay = m_respawnDelay;
|
||||
if (AI())
|
||||
|
|
@ -413,19 +417,12 @@ void Creature::Update(uint32 diff)
|
|||
else
|
||||
{
|
||||
m_deathTimer -= diff;
|
||||
if (m_groupLootTimer && m_groupLootId)
|
||||
if (m_groupLootId)
|
||||
{
|
||||
if(diff <= m_groupLootTimer)
|
||||
{
|
||||
if(diff < m_groupLootTimer)
|
||||
m_groupLootTimer -= diff;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Group* group = sObjectMgr.GetGroupById(m_groupLootId))
|
||||
group->EndRoll();
|
||||
m_groupLootTimer = 0;
|
||||
m_groupLootId = 0;
|
||||
}
|
||||
StopGroupLoot();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -504,6 +501,25 @@ void Creature::Update(uint32 diff)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void Creature::StartGroupLoot( Group* group, uint32 timer )
|
||||
{
|
||||
m_groupLootId = group->GetId();
|
||||
m_groupLootTimer = timer;
|
||||
}
|
||||
|
||||
void Creature::StopGroupLoot()
|
||||
{
|
||||
if (!m_groupLootId)
|
||||
return;
|
||||
|
||||
if (Group* group = sObjectMgr.GetGroupById(m_groupLootId))
|
||||
group->EndRoll();
|
||||
|
||||
m_groupLootTimer = 0;
|
||||
m_groupLootId = 0;
|
||||
}
|
||||
|
||||
void Creature::RegenerateMana()
|
||||
{
|
||||
uint32 curValue = GetPower(POWER_MANA);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue