Misc updates/fixes
This commit is contained in:
@@ -109,33 +109,32 @@ namespace Game.AI
|
||||
|
||||
public class CasterAI : CombatAI
|
||||
{
|
||||
float _attackDist;
|
||||
float _attackDistance;
|
||||
|
||||
public CasterAI(Creature c)
|
||||
: base(c)
|
||||
public CasterAI(Creature creature) : base(creature)
|
||||
{
|
||||
_attackDist = SharedConst.MeleeRange;
|
||||
_attackDistance = SharedConst.MeleeRange;
|
||||
}
|
||||
|
||||
public override void InitializeAI()
|
||||
{
|
||||
base.InitializeAI();
|
||||
|
||||
_attackDist = 30.0f;
|
||||
_attackDistance = 30.0f;
|
||||
foreach (var id in Spells)
|
||||
{
|
||||
AISpellInfoType info = GetAISpellInfo(id, me.GetMap().GetDifficultyID());
|
||||
if (info != null && info.condition == AICondition.Combat && _attackDist > info.maxRange)
|
||||
_attackDist = info.maxRange;
|
||||
if (info != null && info.condition == AICondition.Combat && _attackDistance > info.maxRange)
|
||||
_attackDistance = info.maxRange;
|
||||
}
|
||||
|
||||
if (_attackDist == 30.0f)
|
||||
_attackDist = SharedConst.MeleeRange;
|
||||
if (_attackDistance == 30.0f)
|
||||
_attackDistance = SharedConst.MeleeRange;
|
||||
}
|
||||
|
||||
public override void AttackStart(Unit victim)
|
||||
{
|
||||
AttackStartCaster(victim, _attackDist);
|
||||
AttackStartCaster(victim, _attackDistance);
|
||||
}
|
||||
|
||||
public override void JustEngagedWith(Unit victim)
|
||||
@@ -198,18 +197,19 @@ namespace Game.AI
|
||||
{
|
||||
float _minRange;
|
||||
|
||||
public ArcherAI(Creature c) : base(c)
|
||||
public ArcherAI(Creature creature) : base(creature)
|
||||
{
|
||||
if (me.m_spells[0] == 0)
|
||||
Log.outError(LogFilter.ScriptsAi, "ArcherAI set for creature (entry = {0}) with spell1=0. AI will do nothing", me.GetEntry());
|
||||
if (creature.m_spells[0] == 0)
|
||||
Log.outError(LogFilter.ScriptsAi, $"ArcherAI set for creature with spell1=0. AI will do nothing ({me.GetGUID()})");
|
||||
|
||||
var spellInfo = Global.SpellMgr.GetSpellInfo(me.m_spells[0], me.GetMap().GetDifficultyID());
|
||||
var spellInfo = Global.SpellMgr.GetSpellInfo(creature.m_spells[0], creature.GetMap().GetDifficultyID());
|
||||
_minRange = spellInfo != null ? spellInfo.GetMinRange(false) : 0;
|
||||
|
||||
if (_minRange == 0)
|
||||
_minRange = SharedConst.MeleeRange;
|
||||
me.m_CombatDistance = spellInfo != null ? spellInfo.GetMaxRange(false) : 0;
|
||||
me.m_SightDistance = me.m_CombatDistance;
|
||||
|
||||
creature.m_CombatDistance = spellInfo != null ? spellInfo.GetMaxRange(false) : 0;
|
||||
creature.m_SightDistance = creature.m_CombatDistance;
|
||||
}
|
||||
|
||||
public override void AttackStart(Unit who)
|
||||
@@ -248,23 +248,21 @@ namespace Game.AI
|
||||
{
|
||||
float _minRange;
|
||||
|
||||
public TurretAI(Creature c)
|
||||
: base(c)
|
||||
public TurretAI(Creature creature) : base(creature)
|
||||
{
|
||||
if (me.m_spells[0] == 0)
|
||||
Log.outError(LogFilter.Server, "TurretAI set for creature (entry = {0}) with spell1=0. AI will do nothing", me.GetEntry());
|
||||
if (creature.m_spells[0] == 0)
|
||||
Log.outError(LogFilter.Server, $"TurretAI set for creature with spell1=0. AI will do nothing ({creature.GetGUID()})");
|
||||
|
||||
var spellInfo = Global.SpellMgr.GetSpellInfo(me.m_spells[0], me.GetMap().GetDifficultyID());
|
||||
var spellInfo = Global.SpellMgr.GetSpellInfo(creature.m_spells[0], creature.GetMap().GetDifficultyID());
|
||||
_minRange = spellInfo != null ? spellInfo.GetMinRange(false) : 0;
|
||||
me.m_CombatDistance = spellInfo != null ? spellInfo.GetMaxRange(false) : 0;
|
||||
me.m_SightDistance = me.m_CombatDistance;
|
||||
creature.m_CombatDistance = spellInfo != null ? spellInfo.GetMaxRange(false) : 0;
|
||||
creature.m_SightDistance = creature.m_CombatDistance;
|
||||
}
|
||||
|
||||
public override bool CanAIAttack(Unit victim)
|
||||
{
|
||||
// todo use one function to replace it
|
||||
if (!me.IsWithinCombatRange(victim, me.m_CombatDistance)
|
||||
|| (_minRange != 0 && me.IsWithinCombatRange(victim, _minRange)))
|
||||
if (!me.IsWithinCombatRange(victim, me.m_CombatDistance) || (_minRange != 0 && me.IsWithinCombatRange(victim, _minRange)))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -46,6 +46,11 @@ namespace Game.AI
|
||||
_moveInLOSLocked = false;
|
||||
}
|
||||
|
||||
public void Talk(uint id, WorldObject whisperTarget = null)
|
||||
{
|
||||
Global.CreatureTextMgr.SendChat(me, (byte)id, whisperTarget);
|
||||
}
|
||||
|
||||
public override void OnCharmed(bool isNew)
|
||||
{
|
||||
if (isNew && !me.IsCharmed() && !me.LastCharmerGUID.IsEmpty())
|
||||
@@ -56,27 +61,20 @@ namespace Game.AI
|
||||
if (lastCharmer != null)
|
||||
me.EngageWithTarget(lastCharmer);
|
||||
}
|
||||
me.LastCharmerGUID.Clear();
|
||||
|
||||
if (!me.IsInCombat())
|
||||
EnterEvadeMode(EvadeReason.NoHostiles);
|
||||
me.LastCharmerGUID.Clear();
|
||||
}
|
||||
|
||||
base.OnCharmed(isNew);
|
||||
}
|
||||
|
||||
public void Talk(uint id, WorldObject whisperTarget = null)
|
||||
{
|
||||
Global.CreatureTextMgr.SendChat(me, (byte)id, whisperTarget);
|
||||
}
|
||||
|
||||
public void DoZoneInCombat(Creature creature = null)
|
||||
{
|
||||
if (!creature)
|
||||
creature = me;
|
||||
|
||||
Map map = creature.GetMap();
|
||||
if (!map.IsDungeon()) //use IsDungeon instead of Instanceable, in case Battlegrounds will be instantiated
|
||||
if (!map.IsDungeon()) // use IsDungeon instead of Instanceable, in case Battlegrounds will be instantiated
|
||||
{
|
||||
Log.outError(LogFilter.Server, "DoZoneInCombat call for map that isn't an instance (creature entry = {0})", creature.IsTypeId(TypeId.Unit) ? creature.ToCreature().GetEntry() : 0);
|
||||
return;
|
||||
@@ -219,7 +217,7 @@ namespace Game.AI
|
||||
if (!_EnterEvadeMode(why))
|
||||
return;
|
||||
|
||||
Log.outDebug(LogFilter.Unit, "Creature {0} enters evade mode.", me.GetEntry());
|
||||
Log.outDebug(LogFilter.Unit, $"CreatureAI::EnterEvadeMode: entering evade mode (why: {why}) ({me.GetGUID()})");
|
||||
|
||||
if (me.GetVehicle() == null) // otherwise me will be in evade mode forever
|
||||
{
|
||||
@@ -374,12 +372,10 @@ namespace Game.AI
|
||||
}
|
||||
alreadyChecked.Add(next);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (outOfBounds.Contains(next))
|
||||
hasOutOfBoundsNeighbor = true;
|
||||
}
|
||||
else if (outOfBounds.Contains(next))
|
||||
hasOutOfBoundsNeighbor = true;
|
||||
}
|
||||
|
||||
if (fill || hasOutOfBoundsNeighbor)
|
||||
{
|
||||
var pos = new Position(startPosition.GetPositionX() + front.Key * SharedConst.BoundaryVisualizeStepSize, startPosition.GetPositionY() + front.Value * SharedConst.BoundaryVisualizeStepSize, spawnZ);
|
||||
|
||||
@@ -29,9 +29,9 @@ namespace Game.AI
|
||||
|
||||
public GameObject me;
|
||||
|
||||
public GameObjectAI(GameObject gameObject)
|
||||
public GameObjectAI(GameObject go)
|
||||
{
|
||||
me = gameObject;
|
||||
me = go;
|
||||
_scheduler = new TaskScheduler();
|
||||
_events = new EventMap();
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace Game.AI
|
||||
return;
|
||||
}
|
||||
|
||||
Log.outDebug(LogFilter.Unit, "Guard entry: {0} enters evade mode.", me.GetEntry());
|
||||
Log.outTrace(LogFilter.ScriptsAi, $"GuardAI::EnterEvadeMode: {me.GetGUID()} enters evade mode.");
|
||||
|
||||
me.RemoveAllAuras();
|
||||
me.CombatStop(true);
|
||||
|
||||
@@ -23,9 +23,9 @@ namespace Game.AI
|
||||
{
|
||||
public class PassiveAI : CreatureAI
|
||||
{
|
||||
public PassiveAI(Creature c) : base(c)
|
||||
public PassiveAI(Creature creature) : base(creature)
|
||||
{
|
||||
me.SetReactState(ReactStates.Passive);
|
||||
creature.SetReactState(ReactStates.Passive);
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff)
|
||||
@@ -41,9 +41,9 @@ namespace Game.AI
|
||||
|
||||
public class PossessedAI : CreatureAI
|
||||
{
|
||||
public PossessedAI(Creature c) : base(c)
|
||||
public PossessedAI(Creature creature) : base(creature)
|
||||
{
|
||||
me.SetReactState(ReactStates.Passive);
|
||||
creature.SetReactState(ReactStates.Passive);
|
||||
}
|
||||
|
||||
public override void AttackStart(Unit target)
|
||||
@@ -99,7 +99,7 @@ namespace Game.AI
|
||||
{
|
||||
public NullCreatureAI(Creature creature) : base(creature)
|
||||
{
|
||||
me.SetReactState(ReactStates.Passive);
|
||||
creature.SetReactState(ReactStates.Passive);
|
||||
}
|
||||
|
||||
public override void MoveInLineOfSight(Unit unit) { }
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Game.AI
|
||||
List<ObjectGuid> _allySet = new();
|
||||
uint _updateAlliesTimer;
|
||||
|
||||
public PetAI(Creature c) : base(c)
|
||||
public PetAI(Creature creature) : base(creature)
|
||||
{
|
||||
UpdateAllies();
|
||||
}
|
||||
@@ -60,7 +60,7 @@ namespace Game.AI
|
||||
|
||||
if (NeedToStop())
|
||||
{
|
||||
Log.outDebug(LogFilter.Server, "Pet AI stopped attacking [{0}]", me.GetGUID().ToString());
|
||||
Log.outTrace(LogFilter.ScriptsAi, $"PetAI::UpdateAI: AI stopped attacking {me.GetGUID()}");
|
||||
StopAttack();
|
||||
return;
|
||||
}
|
||||
@@ -528,26 +528,28 @@ namespace Game.AI
|
||||
|
||||
public override void ReceiveEmote(Player player, TextEmotes emoteId)
|
||||
{
|
||||
if (!me.GetOwnerGUID().IsEmpty() && me.GetOwnerGUID() == player.GetGUID())
|
||||
switch (emoteId)
|
||||
{
|
||||
case TextEmotes.Cower:
|
||||
if (me.IsPet() && me.ToPet().IsPetGhoul())
|
||||
me.HandleEmoteCommand(Emote.OneshotOmnicastGhoul);
|
||||
break;
|
||||
case TextEmotes.Angry:
|
||||
if (me.IsPet() && me.ToPet().IsPetGhoul())
|
||||
me.HandleEmoteCommand(Emote.StateStun);
|
||||
break;
|
||||
case TextEmotes.Glare:
|
||||
if (me.IsPet() && me.ToPet().IsPetGhoul())
|
||||
me.HandleEmoteCommand(Emote.StateStun);
|
||||
break;
|
||||
case TextEmotes.Soothe:
|
||||
if (me.IsPet() && me.ToPet().IsPetGhoul())
|
||||
me.HandleEmoteCommand(Emote.OneshotOmnicastGhoul);
|
||||
break;
|
||||
}
|
||||
if (me.GetOwnerGUID() != player.GetGUID())
|
||||
return;
|
||||
|
||||
switch (emoteId)
|
||||
{
|
||||
case TextEmotes.Cower:
|
||||
if (me.IsPet() && me.ToPet().IsPetGhoul())
|
||||
me.HandleEmoteCommand(Emote.OneshotOmnicastGhoul);
|
||||
break;
|
||||
case TextEmotes.Angry:
|
||||
if (me.IsPet() && me.ToPet().IsPetGhoul())
|
||||
me.HandleEmoteCommand(Emote.StateStun);
|
||||
break;
|
||||
case TextEmotes.Glare:
|
||||
if (me.IsPet() && me.ToPet().IsPetGhoul())
|
||||
me.HandleEmoteCommand(Emote.StateStun);
|
||||
break;
|
||||
case TextEmotes.Soothe:
|
||||
if (me.IsPet() && me.ToPet().IsPetGhoul())
|
||||
me.HandleEmoteCommand(Emote.OneshotOmnicastGhoul);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool NeedToStop()
|
||||
@@ -595,17 +597,17 @@ namespace Game.AI
|
||||
if (player)
|
||||
group = player.GetGroup();
|
||||
|
||||
//only pet and owner/not in group.ok
|
||||
// only pet and owner/not in group.ok
|
||||
if (_allySet.Count == 2 && !group)
|
||||
return;
|
||||
|
||||
//owner is in group; group members filled in already (no raid . subgroupcount = whole count)
|
||||
// owner is in group; group members filled in already (no raid . subgroupcount = whole count)
|
||||
if (group && !group.IsRaidGroup() && _allySet.Count == (group.GetMembersCount() + 2))
|
||||
return;
|
||||
|
||||
_allySet.Clear();
|
||||
_allySet.Add(me.GetGUID());
|
||||
if (group) //add group
|
||||
if (group) // add group
|
||||
{
|
||||
for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.Next())
|
||||
{
|
||||
@@ -619,7 +621,7 @@ namespace Game.AI
|
||||
_allySet.Add(target.GetGUID());
|
||||
}
|
||||
}
|
||||
else //remove group
|
||||
else // remove group
|
||||
_allySet.Add(owner.GetGUID());
|
||||
}
|
||||
|
||||
@@ -631,12 +633,12 @@ namespace Game.AI
|
||||
base.OnCharmed(isNew);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Quick access to set all flags to FALSE
|
||||
/// </summary>
|
||||
void ClearCharmInfoFlags()
|
||||
{
|
||||
// Quick access to set all flags to FALSE
|
||||
|
||||
CharmInfo ci = me.GetCharmInfo();
|
||||
|
||||
if (ci != null)
|
||||
{
|
||||
ci.SetIsAtStay(false);
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace Game.AI
|
||||
|
||||
public TotemAI(Creature creature) : base(creature)
|
||||
{
|
||||
Cypher.Assert(creature.IsTotem(), $"TotemAI: AI assigned to a no-totem creature ({creature.GetGUID()})!");
|
||||
_victimGuid = ObjectGuid.Empty;
|
||||
}
|
||||
|
||||
@@ -51,8 +52,7 @@ namespace Game.AI
|
||||
Unit victim = !_victimGuid.IsEmpty() ? Global.ObjAccessor.GetUnit(me, _victimGuid) : null;
|
||||
|
||||
// Search victim if no, not attackable, or out of range, or friendly (possible in case duel end)
|
||||
if (victim == null || !victim.IsTargetableForAttack() || !me.IsWithinDistInMap(victim, max_range) ||
|
||||
me.IsFriendlyTo(victim) || !me.CanSeeOrDetect(victim))
|
||||
if (victim == null || !victim.IsTargetableForAttack() || !me.IsWithinDistInMap(victim, max_range) || me.IsFriendlyTo(victim) || !me.CanSeeOrDetect(victim))
|
||||
{
|
||||
var u_check = new NearestAttackableUnitInObjectRangeCheck(me, me.GetCharmerOrOwnerOrSelf(), max_range);
|
||||
var checker = new UnitLastSearcher(me, u_check);
|
||||
|
||||
@@ -1317,8 +1317,8 @@ namespace Game.AI
|
||||
_castCheckTimer = 0;
|
||||
else
|
||||
{
|
||||
if (IsRangedAttacker())
|
||||
{ // chase to zero if the target isn't in line of sight
|
||||
if (IsRangedAttacker()) // chase to zero if the target isn't in line of sight
|
||||
{
|
||||
bool inLOS = me.IsWithinLOSInMap(target);
|
||||
if (_chaseCloser != !inLOS)
|
||||
{
|
||||
|
||||
@@ -108,7 +108,7 @@ namespace Game.AI
|
||||
|
||||
if (!CliDB.SoundKitStorage.ContainsKey(soundId))
|
||||
{
|
||||
Log.outError(LogFilter.Scripts, "Invalid soundId {0} used in DoPlaySoundToSet (Source: TypeId {1}, GUID {2})", soundId, source.GetTypeId(), source.GetGUID().ToString());
|
||||
Log.outError(LogFilter.ScriptsAi, $"ScriptedAI::DoPlaySoundToSet: Invalid soundId {soundId} used in DoPlaySoundToSet (Source: {source.GetGUID()})");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -307,9 +307,24 @@ namespace Game.AI
|
||||
if (mechanic != 0 && tempSpell.Mechanic != mechanic)
|
||||
continue;
|
||||
|
||||
// Continue if we don't have the mana to actually cast this spell
|
||||
bool hasPower = true;
|
||||
foreach (SpellPowerCost cost in tempSpell.CalcPowerCost(me, tempSpell.GetSchoolMask()))
|
||||
{
|
||||
if (cost.Amount > me.GetPower(cost.Power))
|
||||
{
|
||||
hasPower = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasPower)
|
||||
continue;
|
||||
|
||||
//Check if the spell meets our range requirements
|
||||
if (rangeMin != 0 && me.GetSpellMinRangeForTarget(target, tempSpell) < rangeMin)
|
||||
continue;
|
||||
|
||||
if (rangeMax != 0 && me.GetSpellMaxRangeForTarget(target, tempSpell) > rangeMax)
|
||||
continue;
|
||||
|
||||
@@ -350,8 +365,7 @@ namespace Game.AI
|
||||
if (player != null)
|
||||
player.TeleportTo(unit.GetMapId(), x, y, z, o, TeleportToOptions.NotLeaveCombat);
|
||||
else
|
||||
Log.outError(LogFilter.Scripts, "Creature {0} (Entry: {1}) Tried to teleport non-player unit (Type: {2} GUID: {3}) to X: {4} Y: {5} Z: {6} O: {7}. Aborted.",
|
||||
me.GetGUID(), me.GetEntry(), unit.GetTypeId(), unit.GetGUID(), x, y, z, o);
|
||||
Log.outError(LogFilter.ScriptsAi, $"ScriptedAI::DoTeleportPlayer: Creature {me.GetGUID()} Tried to teleport non-player unit ({unit.GetGUID()}) to X: {x} Y: {y} Z: {z} O: {o}. Aborted.");
|
||||
}
|
||||
|
||||
public void DoTeleportAll(float x, float y, float z, float o)
|
||||
@@ -631,7 +645,7 @@ namespace Game.AI
|
||||
{
|
||||
if (delayToRespawn < TimeSpan.FromSeconds(2))
|
||||
{
|
||||
Log.outError(LogFilter.Scripts, "_DespawnAtEvade called with delay of {0} seconds, defaulting to 2.", delayToRespawn);
|
||||
Log.outError(LogFilter.ScriptsAi, $"BossAI::_DespawnAtEvade: called with delay of {delayToRespawn} seconds, defaulting to 2 (me: {me.GetGUID()})");
|
||||
delayToRespawn = TimeSpan.FromSeconds(2);
|
||||
}
|
||||
|
||||
@@ -641,7 +655,7 @@ namespace Game.AI
|
||||
TempSummon whoSummon = who.ToTempSummon();
|
||||
if (whoSummon)
|
||||
{
|
||||
Log.outWarn(LogFilter.ScriptsAi, "_DespawnAtEvade called on a temporary summon.");
|
||||
Log.outWarn(LogFilter.ScriptsAi, $"BossAI::_DespawnAtEvade: called on a temporary summon (who: {who.GetGUID()})");
|
||||
whoSummon.UnSummon();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ namespace Game.AI
|
||||
{
|
||||
AddEscortState(EscortState.Returning);
|
||||
ReturnToLastPoint();
|
||||
Log.outDebug(LogFilter.Scripts, "EscortAI.EnterEvadeMode has left combat and is now returning to last point");
|
||||
Log.outDebug(LogFilter.ScriptsAi, $"EscortAI.EnterEvadeMode has left combat and is now returning to last point {me.GetGUID()}");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -195,7 +195,7 @@ namespace Game.AI
|
||||
|
||||
if (_despawnAtEnd)
|
||||
{
|
||||
Log.outDebug(LogFilter.Scripts, "EscortAI.UpdateAI: reached end of waypoints, despawning at end");
|
||||
Log.outDebug(LogFilter.ScriptsAi, $"EscortAI::UpdateAI: reached end of waypoints, despawning at end ({me.GetGUID()})");
|
||||
if (_returnToStart)
|
||||
{
|
||||
Position respawnPosition = new();
|
||||
@@ -203,7 +203,7 @@ namespace Game.AI
|
||||
me.GetRespawnPosition(out respawnPosition.posX, out respawnPosition.posY, out respawnPosition.posZ, out orientation);
|
||||
respawnPosition.SetOrientation(orientation);
|
||||
me.GetMotionMaster().MovePoint(EscortPointIds.Home, respawnPosition);
|
||||
Log.outDebug(LogFilter.Scripts, $"EscortAI.UpdateAI: returning to spawn location: {respawnPosition}");
|
||||
Log.outDebug(LogFilter.ScriptsAi, $"EscortAI::UpdateAI: returning to spawn location: {respawnPosition} ({me.GetGUID()})");
|
||||
}
|
||||
else if (_instantRespawn)
|
||||
me.Respawn();
|
||||
@@ -211,7 +211,7 @@ namespace Game.AI
|
||||
me.DespawnOrUnsummon();
|
||||
}
|
||||
|
||||
Log.outDebug(LogFilter.Scripts, "EscortAI.UpdateAI: reached end of waypoints");
|
||||
Log.outDebug(LogFilter.ScriptsAi, $"EscortAI::UpdateAI: reached end of waypoints ({me.GetGUID()})");
|
||||
RemoveEscortState(EscortState.Escorting);
|
||||
return;
|
||||
}
|
||||
@@ -242,7 +242,7 @@ namespace Game.AI
|
||||
{
|
||||
if (!IsPlayerOrGroupInRange())
|
||||
{
|
||||
Log.outDebug(LogFilter.Scripts, "EscortAI failed because player/group was to far away or not found");
|
||||
Log.outDebug(LogFilter.ScriptsAi, $"EscortAI::UpdateAI: failed because player/group was to far away or not found ({me.GetGUID()})");
|
||||
|
||||
bool isEscort = false;
|
||||
CreatureData creatureData = me.GetCreatureData();
|
||||
@@ -293,7 +293,7 @@ namespace Game.AI
|
||||
|
||||
if (Id == EscortPointIds.LastPoint)
|
||||
{
|
||||
Log.outDebug(LogFilter.Scripts, "EscortAI.MovementInform has returned to original position before combat");
|
||||
Log.outDebug(LogFilter.ScriptsAi, $"EscortAI::MovementInform has returned to original position before combat ({me.GetGUID()})");
|
||||
|
||||
me.SetWalk(!_running);
|
||||
RemoveEscortState(EscortState.Returning);
|
||||
@@ -301,16 +301,16 @@ namespace Game.AI
|
||||
}
|
||||
else if (Id == EscortPointIds.Home)
|
||||
{
|
||||
Log.outDebug(LogFilter.Scripts, "EscortAI.MovementInform: returned to home location and restarting waypoint path");
|
||||
Log.outDebug(LogFilter.ScriptsAi, $"EscortAI::MovementInform: returned to home location and restarting waypoint path ({me.GetGUID()})");
|
||||
_started = false;
|
||||
}
|
||||
}
|
||||
else if (moveType == MovementGeneratorType.Waypoint)
|
||||
{
|
||||
Cypher.Assert(Id < _path.nodes.Count, $"EscortAI.MovementInform: referenced movement id ({Id}) points to non-existing node in loaded path");
|
||||
Cypher.Assert(Id < _path.nodes.Count, $"EscortAI::MovementInform: referenced movement id ({Id}) points to non-existing node in loaded path ({me.GetGUID()})");
|
||||
WaypointNode waypoint = _path.nodes[(int)Id];
|
||||
|
||||
Log.outDebug(LogFilter.Scripts, $"EscortAI.MovementInform: waypoint node {waypoint.id} reached");
|
||||
Log.outDebug(LogFilter.ScriptsAi, $"EscortAI::MovementInform: waypoint node {waypoint.id} reached ({me.GetGUID()})");
|
||||
|
||||
// last point
|
||||
if (Id == _path.nodes.Count - 1)
|
||||
@@ -387,15 +387,15 @@ namespace Game.AI
|
||||
}
|
||||
}
|
||||
|
||||
if (me.GetVictim())
|
||||
if (me.IsEngaged())
|
||||
{
|
||||
Log.outError(LogFilter.Scripts, $"EscortAI.Start: (script: {me.GetScriptName()}, creature entry: {me.GetEntry()}) attempts to Start while in combat");
|
||||
Log.outError(LogFilter.ScriptsAi, $"EscortAI::Start: (script: {me.GetScriptName()} attempts to Start while in combat ({me.GetGUID()})");
|
||||
return;
|
||||
}
|
||||
|
||||
if (HasEscortState(EscortState.Escorting))
|
||||
{
|
||||
Log.outError(LogFilter.Scripts, $"EscortAI.Start: (script: {me.GetScriptName()}, creature entry: {me.GetEntry()}) attempts to Start while already escorting");
|
||||
Log.outError(LogFilter.ScriptsAi, $"EscortAI::Start: (script: {me.GetScriptName()} attempts to Start while already escorting ({me.GetGUID()})");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -406,7 +406,7 @@ namespace Game.AI
|
||||
|
||||
if (_path.nodes.Empty())
|
||||
{
|
||||
Log.outError(LogFilter.Scripts, $"EscortAI.Start: (script: {me.GetScriptName()}, creature entry: {me.GetEntry()}) starts with 0 waypoints (possible missing entry in script_waypoint. Quest: {(quest != null ? quest.Id : 0)}).");
|
||||
Log.outError(LogFilter.ScriptsAi, $"EscortAI::Start: (script: {me.GetScriptName()} starts with 0 waypoints (possible missing entry in script_waypoint. Quest: {(quest != null ? quest.Id : 0)} ({me.GetGUID()})");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -418,7 +418,7 @@ namespace Game.AI
|
||||
_returnToStart = canLoopPath;
|
||||
|
||||
if (_returnToStart && _instantRespawn)
|
||||
Log.outError(LogFilter.Scripts, $"EscortAI.Start: (script: {me.GetScriptName()}, creature entry: {me.GetEntry()}) is set to return home after waypoint end and instant respawn at waypoint end. Creature will never despawn.");
|
||||
Log.outError(LogFilter.ScriptsAi, $"EscortAI::Start: (script: {me.GetScriptName()} is set to return home after waypoint end and instant respawn at waypoint end. Creature will never despawn ({me.GetGUID()})");
|
||||
|
||||
me.GetMotionMaster().MoveIdle();
|
||||
me.GetMotionMaster().Clear(MovementGeneratorPriority.Normal);
|
||||
@@ -432,7 +432,7 @@ namespace Game.AI
|
||||
me.SetImmuneToNPC(false);
|
||||
}
|
||||
|
||||
Log.outDebug(LogFilter.Scripts, $"EscortAI.Start: (script: {me.GetScriptName()}, creature entry: {me.GetEntry()}) started with {_path.nodes.Count} waypoints. ActiveAttacker = {_activeAttacker}, Run = {_running}, Player = {_playerGUID}");
|
||||
Log.outDebug(LogFilter.ScriptsAi, $"EscortAI::Start: (script: {me.GetScriptName()}, started with {_path.nodes.Count} waypoints. ActiveAttacker = {_activeAttacker}, Run = {_running}, Player = {_playerGUID} ({me.GetGUID()})");
|
||||
|
||||
// set initial speed
|
||||
me.SetWalk(!_running);
|
||||
|
||||
@@ -109,7 +109,7 @@ namespace Game.AI
|
||||
{
|
||||
if (HasFollowState(FollowState.Complete) && !HasFollowState(FollowState.PostEvent))
|
||||
{
|
||||
Log.outDebug(LogFilter.Scripts, "FollowerAI is set completed, despawns.");
|
||||
Log.outDebug(LogFilter.ScriptsAi, $"FollowerAI::UpdateAI: is set completed, despawns. ({me.GetGUID()})");
|
||||
me.DespawnOrUnsummon();
|
||||
return;
|
||||
}
|
||||
@@ -156,7 +156,7 @@ namespace Game.AI
|
||||
|
||||
if (maxRangeExceeded || questAbandoned)
|
||||
{
|
||||
Log.outDebug(LogFilter.Scripts, $"FollowerAI::UpdateAI: failed because player/group was to far away or not found ({me.GetGUID()})");
|
||||
Log.outDebug(LogFilter.ScriptsAi, $"FollowerAI::UpdateAI: failed because player/group was to far away or not found ({me.GetGUID()})");
|
||||
me.DespawnOrUnsummon();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1079,9 +1079,9 @@ namespace Game.AI
|
||||
GetScript().OnReset();
|
||||
}
|
||||
|
||||
public bool HasEscortState(SmartEscortState uiEscortState) { return (_escortState & uiEscortState) != 0; }
|
||||
public void AddEscortState(SmartEscortState uiEscortState) { _escortState |= uiEscortState; }
|
||||
public void RemoveEscortState(SmartEscortState uiEscortState) { _escortState &= ~uiEscortState; }
|
||||
public bool HasEscortState(SmartEscortState escortState) { return (_escortState & escortState) != 0; }
|
||||
public void AddEscortState(SmartEscortState escortState) { _escortState |= escortState; }
|
||||
public void RemoveEscortState(SmartEscortState escortState) { _escortState &= ~escortState; }
|
||||
public void SetAutoAttack(bool on) { _canAutoAttack = on; }
|
||||
|
||||
public bool CanCombatMove() { return _canCombatMove; }
|
||||
@@ -1110,7 +1110,7 @@ namespace Game.AI
|
||||
// Gossip
|
||||
bool _gossipReturn;
|
||||
|
||||
public SmartGameObjectAI(GameObject g) : base(g) { }
|
||||
public SmartGameObjectAI(GameObject go) : base(go) { }
|
||||
|
||||
public override void UpdateAI(uint diff)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user