Core/Creatures: Added possibility to automatically despawn personal summons on quest remove
Port From (https://github.com/TrinityCore/TrinityCore/commit/b3dce0ac08d4f740505037aff2cad7685444db15)
This commit is contained in:
@@ -343,6 +343,7 @@ namespace Game.Entities
|
||||
public uint? CreatureIDVisibleToSummoner;
|
||||
public uint? GroundMountDisplayID;
|
||||
public uint? FlyingMountDisplayID;
|
||||
public List<uint> DespawnOnQuestsRemoved;
|
||||
}
|
||||
|
||||
public class CreatureAddon
|
||||
|
||||
@@ -184,6 +184,7 @@ namespace Game.Entities
|
||||
SetQuestSlot(slot, 0);
|
||||
AbandonQuest(questId);
|
||||
RemoveActiveQuest(questId);
|
||||
DespawnPersonalSummonsForQuest(questId);
|
||||
|
||||
if (quest.LimitTime != 0)
|
||||
RemoveTimedQuest(questId);
|
||||
@@ -226,6 +227,7 @@ namespace Game.Entities
|
||||
SetQuestSlot(slot, 0);
|
||||
AbandonQuest(questId);
|
||||
RemoveActiveQuest(questId);
|
||||
DespawnPersonalSummonsForQuest(questId);
|
||||
|
||||
if (quest.LimitTime != 0)
|
||||
RemoveTimedQuest(questId);
|
||||
@@ -2190,6 +2192,23 @@ namespace Game.Entities
|
||||
UpdateObjectVisibility();
|
||||
}
|
||||
|
||||
public void DespawnPersonalSummonsForQuest(uint questId)
|
||||
{
|
||||
List<Creature> creatureList = GetCreatureListWithOptionsInGrid(100.0f, new FindCreatureOptions() { IgnorePhases = true, PrivateObjectOwnerGuid = GetGUID() }); // we might want to replace this with SummonList in Player at some point
|
||||
|
||||
foreach (Creature creature in creatureList)
|
||||
{
|
||||
CreatureSummonedData summonedData = Global.ObjectMgr.GetCreatureSummonedData(creature.GetEntry());
|
||||
if (summonedData == null)
|
||||
continue;
|
||||
|
||||
if (summonedData.DespawnOnQuestsRemoved != null)
|
||||
{
|
||||
if (summonedData.DespawnOnQuestsRemoved.Contains(questId))
|
||||
creature.DespawnOrUnsummon();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ushort GetReqKillOrCastCurrentCount(uint quest_id, int entry)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user