Core/Creatures: Allow disabling loot for creatures
Port From (https://github.com/TrinityCore/TrinityCore/commit/ebf799c0f696ec88be66795d4ad0a20fa5ce5e92)
This commit is contained in:
@@ -1270,6 +1270,10 @@ namespace Game.Entities
|
|||||||
public void SetTapList(HashSet<ObjectGuid> tapList) { m_tapList = tapList; }
|
public void SetTapList(HashSet<ObjectGuid> tapList) { m_tapList = tapList; }
|
||||||
public bool HasLootRecipient() { return !m_tapList.Empty(); }
|
public bool HasLootRecipient() { return !m_tapList.Empty(); }
|
||||||
|
|
||||||
|
public bool CanHaveLoot() { return !_staticFlags.HasFlag(CreatureStaticFlags.NoLoot); }
|
||||||
|
|
||||||
|
public void SetCanHaveLoot(bool canHaveLoot) { _staticFlags.ApplyFlag(CreatureStaticFlags.NoLoot, !canHaveLoot); }
|
||||||
|
|
||||||
public void SaveToDB()
|
public void SaveToDB()
|
||||||
{
|
{
|
||||||
// this should only be used when the creature has already been loaded
|
// this should only be used when the creature has already been loaded
|
||||||
|
|||||||
@@ -703,6 +703,9 @@ namespace Game.Entities
|
|||||||
if (tapper != null)
|
if (tapper != null)
|
||||||
tappers.Add(tapper);
|
tappers.Add(tapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!creature.CanHaveLoot())
|
||||||
|
isRewardAllowed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exploit fix
|
// Exploit fix
|
||||||
@@ -900,7 +903,7 @@ namespace Game.Entities
|
|||||||
else
|
else
|
||||||
creature.AllLootRemovedFromCorpse();
|
creature.AllLootRemovedFromCorpse();
|
||||||
|
|
||||||
if (LootStorage.Skinning.HaveLootFor(creature.GetCreatureTemplate().SkinLootId))
|
if (creature.CanHaveLoot() && LootStorage.Skinning.HaveLootFor(creature.GetCreatureTemplate().SkinLootId))
|
||||||
{
|
{
|
||||||
creature.SetDynamicFlag(UnitDynFlags.CanSkin);
|
creature.SetDynamicFlag(UnitDynFlags.CanSkin);
|
||||||
creature.SetUnitFlag(UnitFlags.Skinnable);
|
creature.SetUnitFlag(UnitFlags.Skinnable);
|
||||||
|
|||||||
@@ -1034,7 +1034,7 @@ namespace Game.Spells
|
|||||||
if (targetCreature == null)
|
if (targetCreature == null)
|
||||||
return SpellCastResult.BadTargets;
|
return SpellCastResult.BadTargets;
|
||||||
|
|
||||||
if (!Loots.LootStorage.Pickpocketing.HaveLootFor(targetCreature.GetCreatureTemplate().PickPocketId))
|
if (!targetCreature.CanHaveLoot() || !Loots.LootStorage.Pickpocketing.HaveLootFor(targetCreature.GetCreatureTemplate().PickPocketId))
|
||||||
return SpellCastResult.TargetNoPockets;
|
return SpellCastResult.TargetNoPockets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user