Core/Misc: Fixed player corpse looting, added player corpse loot and some more

Port From (https://github.com/TrinityCore/TrinityCore/commit/89f728cd5b6ae3041fdae3c853ac4b0ac5f0a848)
This commit is contained in:
hondacrx
2019-08-17 11:42:16 -04:00
parent 2d2a72ce3e
commit 0a29281557
13 changed files with 121 additions and 35 deletions
@@ -93,7 +93,6 @@ namespace Game.Entities
public ObjectGuid lootingGroupLowGUID; // used to find group which is looting corpse
ObjectGuid m_lootRecipient;
ObjectGuid m_lootRecipientGroup;
ObjectGuid _skinner;
}
public enum ObjectCellMoveState
+10 -6
View File
@@ -940,8 +940,7 @@ namespace Game.Entities
}
public void ResetPickPocketRefillTimer() { _pickpocketLootRestore = 0; }
public bool CanGeneratePickPocketLoot() { return _pickpocketLootRestore <= Time.UnixTime; }
public void SetSkinner(ObjectGuid guid) { _skinner = guid; }
public ObjectGuid GetSkinner() { return _skinner; } // Returns the player who skinned this creature
public ObjectGuid GetLootRecipientGUID() { return m_lootRecipient; }
public Player GetLootRecipient()
{
@@ -958,7 +957,7 @@ namespace Game.Entities
return Global.GroupMgr.GetGroupByGUID(m_lootRecipientGroup);
}
public void SetLootRecipient(Unit unit)
public void SetLootRecipient(Unit unit, bool withGroup = true)
{
// set the player whose group should receive the right
// to loot the creature after it dies
@@ -980,9 +979,14 @@ namespace Game.Entities
return;
m_lootRecipient = player.GetGUID();
Group group = player.GetGroup();
if (group)
m_lootRecipientGroup = group.GetGUID();
if (withGroup)
{
Group group = player.GetGroup();
if (group)
m_lootRecipientGroup = group.GetGUID();
}
else
m_lootRecipientGroup = ObjectGuid.Empty;
AddDynamicFlag(UnitDynFlags.Tapped);
}