Core/GameObject: regenerate GO loot if respawn time passed since last loot generation time and not all items were taken
Port From (https://github.com/TrinityCore/TrinityCore/commit/98180ecdc179386270e93b80c0db8344b659557f)
This commit is contained in:
@@ -2655,6 +2655,8 @@ namespace Game.Entities
|
||||
void AddLootMode(LootModes lootMode) { m_LootMode |= lootMode; }
|
||||
void RemoveLootMode(LootModes lootMode) { m_LootMode &= ~lootMode; }
|
||||
void ResetLootMode() { m_LootMode = LootModes.Default; }
|
||||
public void SetLootGenerationTime() { m_lootGenerationTime = (uint)Time.UnixTime; }
|
||||
public uint GetLootGenerationTime() { return m_lootGenerationTime; }
|
||||
|
||||
public void AddToSkillupList(ObjectGuid PlayerGuid) { m_SkillupList.Add(PlayerGuid); }
|
||||
public bool IsInSkillupList(ObjectGuid PlayerGuid)
|
||||
@@ -2741,6 +2743,7 @@ namespace Game.Entities
|
||||
ObjectGuid m_lootRecipient;
|
||||
ObjectGuid m_lootRecipientGroup;
|
||||
LootModes m_LootMode; // bitmask, default LOOT_MODE_DEFAULT, determines what loot will be lootable
|
||||
uint m_lootGenerationTime;
|
||||
public uint m_groupLootTimer; // (msecs)timer used for group loot
|
||||
public ObjectGuid lootingGroupLowGUID; // used to find group which is looting
|
||||
long m_packedRotation;
|
||||
|
||||
@@ -6233,6 +6233,11 @@ namespace Game.Entities
|
||||
|
||||
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() == LootState.Activated && !go.loot.isLooted() && go.GetLootGenerationTime() + go.GetRespawnDelay() < Time.UnixTime)
|
||||
go.SetLootState(LootState.Ready);
|
||||
|
||||
if (go.getLootState() == LootState.Ready)
|
||||
{
|
||||
uint lootid = go.GetGoInfo().GetLootId();
|
||||
@@ -6258,6 +6263,7 @@ namespace Game.Entities
|
||||
group.UpdateLooterGuid(go, true);
|
||||
|
||||
loot.FillLoot(lootid, LootStorage.Gameobject, this, !groupRules, false, go.GetLootMode());
|
||||
go.SetLootGenerationTime();
|
||||
|
||||
// get next RR player (for next loot)
|
||||
if (groupRules)
|
||||
|
||||
Reference in New Issue
Block a user