Core/GameObject: regenerate GO loot if respawn time passed since last loot generation time and not all items were taken (#19101)
This commit is contained in:
1 parent
9d021fce21
commit
206fddf129
3 files changed
+10
No files matched your search
@@ -60,6 +60,7 @@ GameObject::GameObject() : WorldObject(false), MapObject(),
|
||||
m_lootRecipientGroup = 0;
|
||||
m_groupLootTimer = 0;
|
||||
lootingGroupLowGUID = 0;
|
||||
m_lootGenerationTime = 0;
|
||||
|
||||
ResetLootMode(); // restore default loot mode
|
||||
m_stationaryPosition.Relocate(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
@@ -801,6 +801,8 @@ class TC_GAME_API GameObject : public WorldObject, public GridObject<GameObject>
|
||||
void AddLootMode(uint16 lootMode) { m_LootMode |= lootMode; }
|
||||
void RemoveLootMode(uint16 lootMode) { m_LootMode &= ~lootMode; }
|
||||
void ResetLootMode() { m_LootMode = LOOT_MODE_DEFAULT; }
|
||||
void SetLootGenerationTime() { m_lootGenerationTime = time(nullptr); }
|
||||
uint32 GetLootGenerationTime() const { return m_lootGenerationTime; }
|
||||
|
||||
void AddToSkillupList(ObjectGuid::LowType PlayerGuidLow) { m_SkillupList.push_back(PlayerGuidLow); }
|
||||
bool IsInSkillupList(ObjectGuid::LowType PlayerGuidLow) const
|
||||
@@ -941,6 +943,7 @@ class TC_GAME_API GameObject : public WorldObject, public GridObject<GameObject>
|
||||
ObjectGuid m_lootRecipient;
|
||||
uint32 m_lootRecipientGroup;
|
||||
uint16 m_LootMode; // bitmask, default LOOT_MODE_DEFAULT, determines what loot will be lootable
|
||||
uint32 m_lootGenerationTime;
|
||||
|
||||
ObjectGuid m_linkedTrap;
|
||||
|
||||
|
||||
@@ -8580,6 +8580,11 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type)
|
||||
|
||||
loot = &go->loot;
|
||||
|
||||
// loot was generated and respawntime has passed since then, allow to recreate loot
|
||||
// to avoid bugs, this rule covers spawned gameobjects only
|
||||
if (go->isSpawnedByDefault() && go->getLootState() == GO_ACTIVATED && !go->loot.isLooted() && go->GetLootGenerationTime() + go->GetRespawnDelay() < time(nullptr))
|
||||
go->SetLootState(GO_READY);
|
||||
|
||||
if (go->getLootState() == GO_READY)
|
||||
{
|
||||
uint32 lootid = go->GetGOInfo()->GetLootId();
|
||||
@@ -8602,6 +8607,7 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type)
|
||||
group->UpdateLooterGuid(go, true);
|
||||
|
||||
loot->FillLoot(lootid, LootTemplates_Gameobject, this, !groupRules, false, go->GetLootMode());
|
||||
go->SetLootGenerationTime();
|
||||
|
||||
// get next RR player (for next loot)
|
||||
if (groupRules && !go->loot.empty())
|
||||
|
||||
Reference in new issue
Block a user