Core/SAI: Added support for StringIds to creature and gameobject targets
Port From (https://github.com/TrinityCore/TrinityCore/commit/2ce40684595a0e49a7b2355012c2806952698ce4)
This commit is contained in:
@@ -609,8 +609,10 @@ namespace Game.Entities
|
||||
var check = new AnyUnitInObjectRangeCheck(this, radius, check3D);
|
||||
if (IsStaticSpawn())
|
||||
{
|
||||
var searcher = new PlayerListSearcher(this, targetList, check);
|
||||
List<Player> temp = new List<Player>();
|
||||
var searcher = new PlayerListSearcher(this, temp, check);
|
||||
Cell.VisitWorldObjects(this, searcher, GetMaxSearchRadius());
|
||||
targetList.AddRange(temp);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -2943,7 +2943,6 @@ namespace Game.Entities
|
||||
}
|
||||
}
|
||||
|
||||
public string[] GetStringIds() { return m_stringIds; }
|
||||
public string GetStringId(StringIdType type) { return m_stringIds[(int)type]; }
|
||||
|
||||
public VendorItemData GetVendorItems()
|
||||
|
||||
@@ -2693,7 +2693,6 @@ namespace Game.Entities
|
||||
}
|
||||
}
|
||||
|
||||
public string[] GetStringIds() { return m_stringIds; }
|
||||
public string GetStringId(StringIdType type) { return m_stringIds[(int)type]; }
|
||||
|
||||
public override string GetName(Locale locale = Locale.enUS)
|
||||
@@ -4592,7 +4591,7 @@ namespace Game.Entities
|
||||
void HandleHeartbeat()
|
||||
{
|
||||
// update player list inside control zone
|
||||
List<Unit> targetList = new();
|
||||
List<Player> targetList = new();
|
||||
SearchTargets(targetList);
|
||||
|
||||
int oldControllingTeam = GetControllingTeam();
|
||||
@@ -4641,7 +4640,7 @@ namespace Game.Entities
|
||||
player.SendUpdateWorldState(_owner.GetGoInfo().ControlZone.worldstate2, (uint)roundedValue);
|
||||
}
|
||||
|
||||
void SearchTargets(List<Unit> targetList)
|
||||
void SearchTargets(List<Player> targetList)
|
||||
{
|
||||
AnyUnitInObjectRangeCheck check = new(_owner, _owner.GetGoInfo().ControlZone.radius, true);
|
||||
PlayerListSearcher searcher = new(_owner, targetList, check);
|
||||
@@ -4649,7 +4648,7 @@ namespace Game.Entities
|
||||
HandleUnitEnterExit(targetList);
|
||||
}
|
||||
|
||||
float CalculatePointsPerSecond(List<Unit> targetList)
|
||||
float CalculatePointsPerSecond(List<Player> targetList)
|
||||
{
|
||||
int delta = 0;
|
||||
|
||||
@@ -4683,7 +4682,7 @@ namespace Game.Entities
|
||||
return percentageIncrease;
|
||||
}
|
||||
|
||||
void HandleUnitEnterExit(List<Unit> newTargetList)
|
||||
void HandleUnitEnterExit(List<Player> newTargetList)
|
||||
{
|
||||
List<ObjectGuid> exitPlayers = new(_insidePlayers);
|
||||
|
||||
|
||||
@@ -2887,15 +2887,17 @@ namespace Game.Entities
|
||||
return gameobjectList;
|
||||
}
|
||||
|
||||
void GetGameObjectListWithOptionsInGrid(List<GameObject> gameObjectContainer, float maxSearchRange, FindGameObjectOptions options)
|
||||
public List<GameObject> GetGameObjectListWithOptionsInGrid(float maxSearchRange, FindGameObjectOptions options)
|
||||
{
|
||||
List<GameObject> gameobjectList = new();
|
||||
InRangeCheckCustomizer checkCustomizer = new(this, maxSearchRange);
|
||||
GameObjectWithOptionsInObjectRangeCheck<InRangeCheckCustomizer> check = new(this, checkCustomizer, options);
|
||||
GameObjectListSearcher searcher = new(this, gameObjectContainer, check);
|
||||
GameObjectListSearcher searcher = new(this, gameobjectList, check);
|
||||
if (options.IgnorePhases)
|
||||
searcher.i_phaseShift = PhasingHandler.GetAlwaysVisiblePhaseShift();
|
||||
|
||||
Cell.VisitGridObjects(this, searcher, maxSearchRange);
|
||||
return gameobjectList;
|
||||
}
|
||||
|
||||
public List<Creature> GetCreatureListWithEntryInGrid(uint entry = 0, float maxSearchRange = 250.0f)
|
||||
@@ -2921,9 +2923,9 @@ namespace Game.Entities
|
||||
return creatureList;
|
||||
}
|
||||
|
||||
public List<Unit> GetPlayerListInGrid(float maxSearchRange, bool alive = true)
|
||||
public List<Player> GetPlayerListInGrid(float maxSearchRange, bool alive = true)
|
||||
{
|
||||
List<Unit> playerList = new();
|
||||
List<Player> playerList = new();
|
||||
var checker = new AnyPlayerInObjectRangeCheck(this, maxSearchRange, alive);
|
||||
var searcher = new PlayerListSearcher(this, playerList, checker);
|
||||
|
||||
@@ -3015,7 +3017,7 @@ namespace Game.Entities
|
||||
if (!IsInWorld)
|
||||
return;
|
||||
|
||||
List<Unit> targets = new();
|
||||
List<Player> targets = new();
|
||||
var check = new AnyPlayerInObjectRangeCheck(this, GetVisibilityRange(), false);
|
||||
var searcher = new PlayerListSearcher(this, targets, check);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user