Core/SAI: Change SmartScript.GetTargets to return an ObjectList

Port From (https://github.com/TrinityCore/TrinityCore/commit/259bde591444980c27a17524c140f078c4159f55)
This commit is contained in:
hondacrx
2020-07-21 15:13:51 -04:00
parent 0c2096b7c2
commit 2ec6d06950
5 changed files with 683 additions and 1100 deletions
+1 -1
View File
@@ -161,7 +161,7 @@ namespace Framework.Constants
public const int MaxVehicleSeats = 8;
public const int AttackDisplayDelay = 200;
public const float MaxPlayerStealthDetectRange = 30.0f; // max distance for detection targets by player
public const uint MaxEquipmentItems = 3;
public const int MaxEquipmentItems = 3;
/// <summary>
/// Creature Const
+2 -2
View File
@@ -220,7 +220,7 @@ namespace Game.AI
else
GetScript().SetPathId(0);
List<WorldObject> targets = GetScript().GetTargetList(SharedConst.SmartEscortTargets);
List<WorldObject> targets = GetScript().GetStoredTargetList(SharedConst.SmartEscortTargets, me);
if (targets != null && mEscortQuestID != 0)
{
if (targets.Count == 1 && GetScript().IsPlayer(targets.First()))
@@ -386,7 +386,7 @@ namespace Game.AI
bool IsEscortInvokerInRange()
{
var targets = GetScript().GetTargetList(SharedConst.SmartEscortTargets);
var targets = GetScript().GetStoredTargetList(SharedConst.SmartEscortTargets, me);
if (targets != null)
{
float checkDist = me.GetInstanceScript() != null ? SMART_ESCORT_MAX_PLAYER_DIST * 2 : SMART_ESCORT_MAX_PLAYER_DIST;
+10 -9
View File
@@ -993,11 +993,12 @@ namespace Game.AI
e.Action.randomPhase.phase5 >= (uint)SmartPhase.Max ||
e.Action.randomPhase.phase6 >= (uint)SmartPhase.Max)
{
Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} attempts to set invalid phase, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
Log.outError(LogFilter.Sql, $"SmartAIMgr: Entry {e.entryOrGuid} SourceType {e.GetScriptType()} Event {e.event_id} Action {e.GetActionType()} attempts to set invalid phase, skipped.");
return false;
}
break;
}
break;
case SmartActions.RandomPhaseRange: //PhaseMin, PhaseMax
{
if (e.Action.randomPhaseRange.phaseMin >= (uint)SmartPhase.Max ||
@@ -1114,7 +1115,7 @@ namespace Game.AI
}
case SmartActions.CallRandomRangeTimedActionlist:
{
if (!IsMinMaxValid(e, e.Action.randTimedActionList.entry1, e.Action.randTimedActionList.entry2))
if (!IsMinMaxValid(e, e.Action.randTimedActionList.actionList1, e.Action.randTimedActionList.actionList2))
return false;
break;
}
@@ -2701,12 +2702,12 @@ namespace Game.AI
}
public struct RandTimedActionList
{
public uint entry1;
public uint entry2;
public uint entry3;
public uint entry4;
public uint entry5;
public uint entry6;
public uint actionList1;
public uint actionList2;
public uint actionList3;
public uint actionList4;
public uint actionList5;
public uint actionList6;
}
public struct InterruptSpellCasting
{
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -379,7 +379,7 @@ namespace Game
}
while (result.NextRow());
Log.outDebug(LogFilter.Pool, "Pool handling system initialized, {0} pools spawned in {1} ms", count, Time.GetMSTimeDiffToNow(oldMSTime));
Log.outInfo(LogFilter.ServerLoading, "Pool handling system initialized, {0} pools spawned in {1} ms", count, Time.GetMSTimeDiffToNow(oldMSTime));
}
}