Core/Misc: Misc cleanups and changing of fields

This commit is contained in:
hondacrx
2018-05-13 20:26:05 -04:00
parent 868c67c8f0
commit 7d4c0b7634
38 changed files with 269 additions and 244 deletions
@@ -74,9 +74,9 @@ namespace Framework.Configuration
return (T)Convert.ChangeType(temp, type);
}
public static List<string> GetKeysByString(string name)
public static IEnumerable<string> GetKeysByString(string name)
{
return _configList.Where(p => p.Key.Contains(name)).Select(p => p.Key).ToList();
return _configList.Where(p => p.Key.Contains(name)).Select(p => p.Key);
}
static Dictionary<string, string> _configList = new Dictionary<string, string>();
+6 -6
View File
@@ -201,6 +201,8 @@ namespace Framework.Database
}
public async Task<SQLQueryHolder<R>> DelayQueryHolder<R>(SQLQueryHolder<R> holder)
{
return await Task.Run(() =>
{
string query = "";
@@ -208,7 +210,7 @@ namespace Framework.Database
{
using (var Connection = _connectionInfo.GetConnection())
{
await Connection.OpenAsync();
Connection.OpenAsync();
foreach (var pair in holder.m_queries)
{
@@ -220,11 +222,11 @@ namespace Framework.Database
cmd.Parameters.AddWithValue("@" + parameter.Key, parameter.Value);
query = cmd.CommandText;
using (var reader = await cmd.ExecuteReaderAsync())
using (var reader = cmd.ExecuteReader())
{
if (reader.HasRows)
{
while (await reader.ReadAsync())
while (reader.Read())
{
var row = new object[reader.FieldCount];
@@ -246,6 +248,7 @@ namespace Framework.Database
HandleMySQLException(ex, query);
return holder;
}
});
}
public void LoadPreparedStatements()
@@ -359,11 +362,8 @@ namespace Framework.Database
MySqlErrorCode HandleMySQLException(MySqlException ex, string query = "")
{
MySqlErrorCode code = (MySqlErrorCode)ex.Number;
if (ex.InnerException != null)
{
if (ex.InnerException is MySqlException)
code = (MySqlErrorCode)((MySqlException)ex.InnerException).Number;
}
switch (code)
{
+2 -1
View File
@@ -86,8 +86,9 @@ namespace Framework.Networking
AddNewSockets();
foreach (var socket in _Sockets.ToList())
for (var i =0; i < _Sockets.Count; ++i)
{
TSocketType socket = _Sockets[i];
if (!socket.Update())
{
if (socket.IsOpen())
+1 -1
View File
@@ -310,7 +310,7 @@ public class RealmManager : Singleton<RealmManager>
return BattlenetRpcErrorCode.UtilServerUnknownRealm;
}
public List<Realm> GetRealms() { return _realms.Values.ToList(); }
public ICollection<Realm> GetRealms() { return _realms.Values; }
List<string> GetSubRegions() { return _subRegions; }
ConcurrentDictionary<RealmHandle, Realm> _realms = new ConcurrentDictionary<RealmHandle, Realm>();
+1 -1
View File
@@ -711,7 +711,7 @@ namespace Game.AI
public void RemoveNotExisting()
{
foreach (var id in this.ToList())
foreach (var id in this)
{
if (!ObjectAccessor.GetCreature(me, id))
Remove(id);
+1 -1
View File
@@ -3832,7 +3832,7 @@ namespace Game.AI
if (mTimedActionList.Empty())
return;
int i = 0;
foreach (var holder in mTimedActionList)
foreach (var holder in mTimedActionList.ToList())
{
if (i++ == 0)
{
+1 -1
View File
@@ -1147,7 +1147,7 @@ namespace Game.BattleFields
for (byte team = 0; team < SharedConst.BGTeamsCount; ++team)
{
foreach (var guid in m_activePlayers[team].ToList())
foreach (var guid in m_activePlayers[team])
{
Player player = Global.ObjAccessor.FindPlayer(guid);
if (player)
@@ -59,7 +59,7 @@ namespace Game.BattleGrounds
var bgs = data.m_Battlegrounds;
// first one is template and should not be deleted
foreach (var pair in bgs.ToList())
foreach (var pair in bgs)
{
Battleground bg = pair.Value;
bg.Update(m_UpdateTimer);
@@ -834,7 +834,7 @@ namespace Game.BattleGrounds
public void RemoveFromBGFreeSlotQueue(BattlegroundTypeId bgTypeId, uint instanceId)
{
var queues = bgDataStore[bgTypeId].BGFreeSlotQueue;
foreach (var bg in queues.ToList())
foreach (var bg in queues)
{
if (bg.GetInstanceID() == instanceId)
{
+1 -1
View File
@@ -195,7 +195,7 @@ namespace Game.BattlePets
{
PreparedStatement stmt;
foreach (var pair in _pets.ToList())
foreach (var pair in _pets)
{
switch (pair.Value.SaveInfo)
{
@@ -121,7 +121,7 @@ namespace Game.BlackMarket
{
SQLTransaction trans = new SQLTransaction();
// Delete completed auctions
foreach (var pair in _auctions.ToList())
foreach (var pair in _auctions)
{
if (!pair.Value.IsCompleted())
continue;
+3 -3
View File
@@ -71,7 +71,7 @@ namespace Game.Chat
return true;
}
public bool ExecuteCommandInTable(List<ChatCommand> table, string text, string fullcmd)
public bool ExecuteCommandInTable(ICollection<ChatCommand> table, string text, string fullcmd)
{
StringArguments args = new StringArguments(text);
string cmd = args.NextString();
@@ -168,7 +168,7 @@ namespace Game.Chat
return false;
}
public bool ShowHelpForCommand(List<ChatCommand> table, string text)
public bool ShowHelpForCommand(ICollection<ChatCommand> table, string text)
{
StringArguments args = new StringArguments(text);
if (!args.Empty())
@@ -226,7 +226,7 @@ namespace Game.Chat
return ShowHelpForSubCommands(table, "", text);
}
public bool ShowHelpForSubCommands(List<ChatCommand> table, string cmd, string subcmd)
public bool ShowHelpForSubCommands(ICollection<ChatCommand> table, string cmd, string subcmd)
{
string list = "";
foreach (var command in table)
+3 -3
View File
@@ -69,7 +69,7 @@ namespace Game.Chat
}
}
static bool SetDataForCommandInTable(List<ChatCommand> table, string text, uint permission, string help, string fullcommand)
static bool SetDataForCommandInTable(ICollection<ChatCommand> table, string text, uint permission, string help, string fullcommand)
{
StringArguments args = new StringArguments(text);
string cmd = args.NextString().ToLower();
@@ -135,9 +135,9 @@ namespace Game.Chat
}
}
public static List<ChatCommand> GetCommands()
public static ICollection<ChatCommand> GetCommands()
{
return _commands.Values.ToList();
return _commands.Values;
}
static SortedDictionary<string, ChatCommand> _commands = new SortedDictionary<string, ChatCommand>();
+8 -8
View File
@@ -23,9 +23,9 @@ namespace Game.DataStorage
{
public class AchievementRecord
{
public LocalizedString Title;
public LocalizedString Description;
public LocalizedString Reward;
public string Title;
public string Description;
public string Reward;
public AchievementFlags Flags;
public short InstanceID;
public ushort Supercedes;
@@ -123,7 +123,7 @@ namespace Game.DataStorage
public sealed class ArtifactRecord
{
public uint Id;
public LocalizedString Name;
public string Name;
public uint UiBarOverlayColor;
public uint UiBarBackgroundColor;
public uint UiNameColor;
@@ -137,7 +137,7 @@ namespace Game.DataStorage
public sealed class ArtifactAppearanceRecord
{
public LocalizedString Name;
public string Name;
public uint UiSwatchColor;
public float UiModelSaturation;
public float UiModelOpacity;
@@ -156,8 +156,8 @@ namespace Game.DataStorage
public sealed class ArtifactAppearanceSetRecord
{
public LocalizedString Name;
public LocalizedString Description;
public string Name;
public string Description;
public ushort UiCameraID;
public ushort AltHandUICameraID;
public byte DisplayIndex;
@@ -217,7 +217,7 @@ namespace Game.DataStorage
public sealed class AuctionHouseRecord
{
public uint Id;
public LocalizedString Name;
public string Name;
public ushort FactionID;
public byte DepositRate;
public byte ConsignmentRate;
+7 -7
View File
@@ -33,8 +33,8 @@ namespace Game.DataStorage
public sealed class BarberShopStyleRecord
{
public LocalizedString DisplayName;
public LocalizedString Description;
public string DisplayName;
public string Description;
public float CostModifier;
public byte Type;
public byte Race;
@@ -60,8 +60,8 @@ namespace Game.DataStorage
public sealed class BattlePetSpeciesRecord
{
public LocalizedString SourceText;
public LocalizedString Description;
public string SourceText;
public string Description;
public uint CreatureID;
public uint IconFileDataID;
public uint SummonSpellID;
@@ -85,9 +85,9 @@ namespace Game.DataStorage
{
public uint Id;
public LocalizedString Name;
public LocalizedString GameType;
public LocalizedString ShortDescription;
public LocalizedString LongDescription;
public string GameType;
public string ShortDescription;
public string LongDescription;
public int IconFileDataID;
public short[] MapId = new short[16];
public ushort HolidayWorldState;
+4 -4
View File
@@ -74,7 +74,7 @@ namespace Game.DataStorage
{
public uint Id;
public LocalizedString Name;
public LocalizedString Shortcut;
public string Shortcut;
public ChannelDBCFlags Flags;
public sbyte FactionGroup;
}
@@ -83,8 +83,8 @@ namespace Game.DataStorage
{
public string PetNameToken;
public LocalizedString Name;
public LocalizedString NameFemale;
public LocalizedString NameMale;
public string NameFemale;
public string NameMale;
public uint FileName;
public uint CreateScreenFileDataID;
public uint SelectScreenFileDataID;
@@ -297,7 +297,7 @@ namespace Game.DataStorage
public sealed class CreatureTypeRecord
{
public uint Id;
public LocalizedString Name;
public string Name;
public byte Flags;
}
+1 -1
View File
@@ -49,7 +49,7 @@ namespace Game.DataStorage
public sealed class DifficultyRecord
{
public uint Id;
public LocalizedString Name;
public string Name;
public ushort GroupSizeHealthCurveID;
public ushort GroupSizeDmgCurveID;
public ushort GroupSizeSpellPointsCurveID;
+6 -6
View File
@@ -49,8 +49,8 @@ namespace Game.DataStorage
public sealed class GarrAbilityRecord
{
public LocalizedString Name;
public LocalizedString Description;
public string Name;
public string Description;
public uint IconFileDataID;
public GarrisonAbilityFlags Flags;
public ushort FactionChangeGarrAbilityID;
@@ -99,9 +99,9 @@ namespace Game.DataStorage
public sealed class GarrClassSpecRecord
{
public LocalizedString ClassSpec;
public LocalizedString ClassSpecMale;
public LocalizedString ClassSpecFemale;
public string ClassSpec;
public string ClassSpecMale;
public string ClassSpecFemale;
public ushort UiTextureAtlasMemberID; // UiTextureAtlasMember.db2 ref
public ushort GarrFollItemSetID;
public byte FollowerClassLimit;
@@ -156,7 +156,7 @@ namespace Game.DataStorage
public sealed class GarrPlotRecord
{
public uint Id;
public LocalizedString Name;
public string Name;
public uint AllianceConstructObjID;
public uint HordeConstructObjID;
public byte UiCategoryID;
+2 -2
View File
@@ -228,7 +228,7 @@ namespace Game.DataStorage
public sealed class ItemLimitCategoryRecord
{
public uint Id;
public LocalizedString Name;
public string Name;
public byte Quantity;
public byte Flags;
}
@@ -277,7 +277,7 @@ namespace Game.DataStorage
public sealed class ItemSearchNameRecord
{
public ulong AllowableRace;
public LocalizedString Display;
public string Display;
public uint Id;
public uint[] Flags = new uint[3];
public ushort ItemLevel;
+1 -1
View File
@@ -29,7 +29,7 @@ namespace Game.DataStorage
public sealed class MapRecord
{
public uint Id;
public uint Directory;
public string Directory;
public LocalizedString MapName;
public string MapDescription0; // Horde
public string MapDescription1; // Alliance
+1 -1
View File
@@ -186,7 +186,7 @@ namespace Game.DataStorage
public sealed class PvpTalentRecord
{
public uint Id;
public LocalizedString Description;
public string Description;
public uint SpellID;
public uint OverridesSpellID;
public int ActionBarSpellID;
+1 -1
View File
@@ -43,7 +43,7 @@ namespace Game.DataStorage
public sealed class QuestSortRecord
{
public uint Id;
public LocalizedString SortName;
public string SortName;
public byte UiOrderIndex;
}
+8 -8
View File
@@ -40,7 +40,7 @@ namespace Game.DataStorage
public sealed class ScenarioRecord
{
public uint Id;
public LocalizedString Name;
public string Name;
public ushort AreaTableID;
public byte Flags;
public byte Type;
@@ -49,8 +49,8 @@ namespace Game.DataStorage
public sealed class ScenarioStepRecord
{
public uint Id;
public LocalizedString Description;
public LocalizedString Title;
public string Description;
public string Title;
public ushort ScenarioID;
public ushort Supersedes; // Used in conjunction with Proving Grounds scenarios, when sequencing steps (Not using step order?)
public ushort RewardQuestID;
@@ -97,8 +97,8 @@ namespace Game.DataStorage
{
public uint Id;
public LocalizedString DisplayName;
public LocalizedString Description;
public LocalizedString AlternateVerb;
public string Description;
public string AlternateVerb;
public ushort Flags;
public SkillCategory CategoryID;
public byte CanLink;
@@ -240,7 +240,7 @@ namespace Game.DataStorage
public sealed class SpellCategoryRecord
{
public uint Id;
public LocalizedString Name;
public string Name;
public int ChargeRecoveryTime;
public SpellCategoryFlags Flags;
public byte UsesPerWeek;
@@ -321,7 +321,7 @@ namespace Game.DataStorage
public sealed class SpellFocusObjectRecord
{
public uint Id;
public LocalizedString Name;
public string Name;
}
public sealed class SpellInterruptsRecord
@@ -495,7 +495,7 @@ namespace Game.DataStorage
public sealed class SpellShapeshiftFormRecord
{
public uint Id;
public LocalizedString Name;
public string Name;
public float DamageVariance;
public SpellShapeshiftFormFlags Flags;
public ushort CombatRoundTime;
+4 -4
View File
@@ -81,14 +81,14 @@ namespace Game.DataStorage
public sealed class TotemCategoryRecord
{
public uint Id;
public LocalizedString Name;
public string Name;
public uint TotemCategoryMask;
public byte TotemCategoryType;
}
public sealed class ToyRecord
{
public LocalizedString SourceText;
public string SourceText;
public uint ItemID;
public byte Flags;
public byte SourceTypeEnum;
@@ -103,7 +103,7 @@ namespace Game.DataStorage
public sealed class TransmogSetRecord
{
public LocalizedString Name;
public string Name;
public ushort ParentTransmogSetID;
public ushort UIOrder;
public byte ExpansionID;
@@ -117,7 +117,7 @@ namespace Game.DataStorage
public sealed class TransmogSetGroupRecord
{
public LocalizedString Name;
public string Name;
public uint Id;
}
@@ -109,7 +109,6 @@ namespace Game.DataStorage
public uint EnterUISoundID;
public ushort ExitUISoundID;
public bool CanEnterOrExit()
{
return (Flags.HasAnyFlag(VehicleSeatFlags.CanEnterOrExit) ||
+2 -3
View File
@@ -1972,10 +1972,9 @@ namespace Game.Entities
stmt.AddValue(0, GetGUID().GetCounter());
trans.Append(stmt);
Dictionary<uint, PlayerSpellState> talents;
for (byte group = 0; group < PlayerConst.MaxSpecializations; ++group)
{
talents = GetTalentMap(group);
Dictionary<uint, PlayerSpellState> talents = GetTalentMap(group);
foreach (var pair in talents.ToList())
{
if (pair.Value == PlayerSpellState.Removed)
@@ -1998,7 +1997,7 @@ namespace Game.Entities
for (byte group = 0; group < PlayerConst.MaxSpecializations; ++group)
{
talents = GetPvpTalentMap(group);
Dictionary<uint, PlayerSpellState> talents = GetPvpTalentMap(group);
foreach (var pair in talents.ToList())
{
if (pair.Value == PlayerSpellState.Removed)
+2 -1
View File
@@ -2338,8 +2338,9 @@ namespace Game.Entities
vSchoolAbsorbCopy.Sort(new AbsorbAuraOrderPred());
// absorb without mana cost
foreach (var absorbAurEff in vSchoolAbsorbCopy.ToList())
for (var i = 0; i < vSchoolAbsorbCopy.Count; ++i )
{
var absorbAurEff = vSchoolAbsorbCopy[i];
if (damageInfo.GetDamage() == 0)
break;
+3 -3
View File
@@ -578,7 +578,7 @@ namespace Game.Entities
return obj.GetExactDist2dSq(i_source) <= i_distSq;
}
public override void Visit(ICollection<Player> objs)
public override void Visit(IList<Player> objs)
{
foreach (var target in objs)
{
@@ -598,7 +598,7 @@ namespace Game.Entities
}
}
public override void Visit(ICollection<Creature> objs)
public override void Visit(IList<Creature> objs)
{
foreach (var target in objs)
{
@@ -614,7 +614,7 @@ namespace Game.Entities
}
}
}
public override void Visit(ICollection<DynamicObject> objs)
public override void Visit(IList<DynamicObject> objs)
{
foreach (var target in objs)
{
+4 -2
View File
@@ -566,8 +566,9 @@ namespace Game.Entities
public void GetAllMinionsByEntry(List<TempSummon> Minions, uint entry)
{
foreach (var unit in m_Controlled)
for (var i = 0; i < m_Controlled.Count; ++i)
{
Unit unit = m_Controlled[i];
if (unit.GetEntry() == entry && unit.IsSummon()) // minion, actually
Minions.Add(unit.ToTempSummon());
}
@@ -575,8 +576,9 @@ namespace Game.Entities
void RemoveAllMinionsByEntry(uint entry)
{
foreach (var unit in m_Controlled.ToList())
for (var i = 0; i < m_Controlled.Count; ++i)
{
Unit unit = m_Controlled[i];
if (unit.GetEntry() == entry && unit.IsTypeId(TypeId.Unit)
&& unit.ToCreature().IsSummon()) // minion, actually
unit.ToTempSummon().UnSummon();
+48 -39
View File
@@ -2290,11 +2290,11 @@ namespace Game.Entities
public void RemoveAllGroupBuffsFromCaster(ObjectGuid casterGUID)
{
foreach (var iter in m_ownedAuras.KeyValueList)
foreach (var pair in GetOwnedAuras())
{
Aura aura = iter.Value;
Aura aura = pair.Value;
if (aura.GetCasterGUID() == casterGUID && aura.GetSpellInfo().IsGroupBuff())
RemoveOwnedAura(iter);
RemoveOwnedAura(pair);
}
}
@@ -3345,20 +3345,19 @@ namespace Game.Entities
// Such situation occurs when player is logging in inside an instance and fails the entry check for any reason.
// The aura that was loaded from db (indirectly, via linked casts) gets removed before it has a chance
// to register in m_appliedAuras
var list = GetOwnedAuras().ToList();
for (var i = 0; i < list.Count; i++)
foreach (var pair in GetOwnedAuras())
{
Aura aura = list[i].Value;
Aura aura = pair.Value;
if (aura.GetCasterGUID() != GetGUID() && aura.IsSingleTarget())
{
if (onPhaseChange)
RemoveOwnedAura(list[i]);
RemoveOwnedAura(pair);
else
{
Unit caster = aura.GetCaster();
if (!caster || !caster.IsInPhase(this))
RemoveOwnedAura(list[i]);
RemoveOwnedAura(pair);
}
}
}
@@ -3372,12 +3371,13 @@ namespace Game.Entities
}
}
// All aura base removes should go threw this function!
public void RemoveOwnedAura(KeyValuePair<uint, Aura> pair, AuraRemoveMode removeMode = AuraRemoveMode.Default)
public void RemoveOwnedAura(KeyValuePair<uint, Aura> keyValuePair, AuraRemoveMode removeMode = AuraRemoveMode.Default)
{
Aura aura = pair.Value;
Aura aura = keyValuePair.Value;
Contract.Assert(!aura.IsRemoved());
m_ownedAuras.Remove(pair);
m_ownedAuras.Remove(keyValuePair);
m_removedAuras.Add(aura);
// Unregister single target aura
@@ -3388,32 +3388,37 @@ namespace Game.Entities
}
public void RemoveOwnedAura(uint spellId, ObjectGuid casterGUID = default(ObjectGuid), uint reqEffMask = 0, AuraRemoveMode removeMode = AuraRemoveMode.Default)
{
var list = m_ownedAuras.Where(p => p.Key == spellId);
foreach (var pair in list.ToList())
foreach (var pair in GetOwnedAuras())
{
if (pair.Key != spellId)
continue;
if (((pair.Value.GetEffectMask() & reqEffMask) == reqEffMask) && (casterGUID.IsEmpty() || pair.Value.GetCasterGUID() == casterGUID))
RemoveOwnedAura(pair, removeMode);
}
}
public void RemoveOwnedAura(Aura aura, AuraRemoveMode removeMode = AuraRemoveMode.Default)
public void RemoveOwnedAura(Aura auraToRemove, AuraRemoveMode removeMode = AuraRemoveMode.Default)
{
if (aura.IsRemoved())
if (auraToRemove.IsRemoved())
return;
Contract.Assert(aura.GetOwner() == this);
Contract.Assert(auraToRemove.GetOwner() == this);
if (removeMode == AuraRemoveMode.None)
{
Log.outError(LogFilter.Spells, "Unit.RemoveOwnedAura() called with unallowed removeMode AURA_REMOVE_NONE, spellId {0}", aura.GetId());
Log.outError(LogFilter.Spells, "Unit.RemoveOwnedAura() called with unallowed removeMode AURA_REMOVE_NONE, spellId {0}", auraToRemove.GetId());
return;
}
uint spellId = aura.GetId();
uint spellId = auraToRemove.GetId();
var range = m_ownedAuras.Where(p => p.Key == spellId);
foreach (var pair in range.ToList())
var range = m_ownedAuras.LookupByKey(spellId);
foreach (var pair in GetOwnedAuras())
{
if (pair.Value == aura)
if (pair.Key != spellId)
continue;
if (pair.Value == auraToRemove)
{
RemoveOwnedAura(pair, removeMode);
return;
@@ -3425,25 +3430,27 @@ namespace Game.Entities
public void RemoveAurasDueToSpell(uint spellId, ObjectGuid casterGUID = default(ObjectGuid), uint reqEffMask = 0, AuraRemoveMode removeMode = AuraRemoveMode.Default)
{
var list = m_appliedAuras.LookupByKey(spellId);
if (list.Empty())
return;
foreach (var pair in GetAppliedAuras())
{
if (pair.Key != spellId)
continue;
foreach (var spell in list.ToList())
Aura aura = pair.Value.GetBase();
if (((aura.GetEffectMask() & reqEffMask) == reqEffMask) && (casterGUID.IsEmpty() || aura.GetCasterGUID() == casterGUID))
{
Aura aura = spell.GetBase();
if (((aura.GetEffectMask() & reqEffMask) == reqEffMask)
&& (casterGUID.IsEmpty() || aura.GetCasterGUID() == casterGUID))
{
RemoveAura(spell, removeMode);
RemoveAura(pair, removeMode);
}
}
}
public void RemoveAurasDueToSpellByDispel(uint spellId, uint dispellerSpellId, ObjectGuid casterGUID, Unit dispeller, byte chargesRemoved = 1)
{
var range = m_ownedAuras.LookupByKey(spellId);
foreach (var aura in range)
foreach (var pair in GetOwnedAuras())
{
if (pair.Key != spellId)
continue;
Aura aura = pair.Value;
if (aura.GetCasterGUID() == casterGUID)
{
DispelInfo dispelInfo = new DispelInfo(dispeller, dispellerSpellId, chargesRemoved);
@@ -3458,7 +3465,6 @@ namespace Game.Entities
// Call AfterDispel hook on AuraScript
aura.CallScriptAfterDispel(dispelInfo);
return;
}
}
@@ -3523,7 +3529,7 @@ namespace Game.Entities
uint spellId = aurApp.GetBase().GetId();
var range = m_appliedAuras.Where(p => p.Key == spellId);
foreach (var pair in range.ToList())
foreach (var pair in range)
{
if (aurApp == pair.Value)
{
@@ -3568,7 +3574,7 @@ namespace Game.Entities
public void RemoveAppliedAuras(Func<AuraApplication, bool> check)
{
foreach (var pair in m_appliedAuras.KeyValueList)
foreach (var pair in GetAppliedAuras())
{
if (check(pair.Value))
RemoveAura(pair);
@@ -3577,7 +3583,7 @@ namespace Game.Entities
public void RemoveOwnedAuras(Func<Aura, bool> check)
{
foreach (var pair in m_ownedAuras)
foreach (var pair in GetOwnedAuras())
{
if (check(pair.Value))
RemoveOwnedAura(pair);
@@ -3627,7 +3633,7 @@ namespace Game.Entities
foreach (var pair in GetOwnedAuras())
{
var appMap = pair.Value.GetApplicationMap();
foreach (var aurApp in appMap.Values.ToList())
foreach (var aurApp in appMap.Values)
{
Unit target = aurApp.GetTarget();
if (target == this)
@@ -3681,6 +3687,7 @@ namespace Game.Entities
{
if (pair.Value == null)
continue;
Aura aura = pair.Value;
if (!aura.GetSpellInfo().HasAura(GetMap().GetDifficultyID(), type))
RemoveOwnedAura(pair, AuraRemoveMode.Default);
@@ -4174,9 +4181,10 @@ namespace Game.Entities
}
bool remove = false;
for (var i = 0; i < m_appliedAuras.KeyValueList.Count; i++)
var appliedAuraList = GetAppliedAuras();
for (var i = 0; i < appliedAuraList.Count; i++)
{
var app = m_appliedAuras.KeyValueList[i];
var app = appliedAuraList[i];
if (remove)
{
remove = false;
@@ -4187,8 +4195,9 @@ namespace Game.Entities
continue;
RemoveAura(app, AuraRemoveMode.Default);
if (i == m_appliedAuras.KeyValueList.Count - 1)
if (i == appliedAuraList.Count - 1)
break;
remove = true;
}
}
+11 -6
View File
@@ -202,14 +202,15 @@ namespace Game.Entities
Aura i_aura = app.Value;
if (i_aura == null)
continue;
i_aura.UpdateOwner(diff, this);
}
// remove expired auras - do that after updates(used in scripts?)
foreach (var aura in GetOwnedAuras())
foreach (var pair in GetOwnedAuras())
{
if (aura.Value != null && aura.Value.IsExpired())
RemoveOwnedAura(aura, AuraRemoveMode.Expire);
if (pair.Value != null && pair.Value.IsExpired())
RemoveOwnedAura(pair, AuraRemoveMode.Expire);
}
foreach (var aura in m_visibleAurasToUpdate)
@@ -221,8 +222,9 @@ namespace Game.Entities
if (!m_gameObj.Empty())
{
foreach (var go in m_gameObj.ToList())
for (var i = 0; i < m_gameObj.Count; ++i)
{
GameObject go = m_gameObj[i];
if (!go.isSpawned())
{
go.SetOwnerGUID(ObjectGuid.Empty);
@@ -547,8 +549,9 @@ namespace Game.Entities
public void RemoveDynObject(uint spellId)
{
foreach (var dynObj in m_dynObj.ToList())
for (var i = 0; i < m_dynObj.Count; ++i)
{
var dynObj = m_dynObj[i];
if (dynObj.GetSpellId() == spellId)
dynObj.Remove();
}
@@ -699,8 +702,9 @@ namespace Game.Entities
if (m_areaTrigger.Empty())
return;
foreach (var areaTrigger in m_areaTrigger.ToList())
for (var i = 0; i < m_areaTrigger.Count; ++i)
{
AreaTrigger areaTrigger = m_areaTrigger[i];
if (areaTrigger.GetSpellId() == spellId)
areaTrigger.Remove();
}
@@ -710,6 +714,7 @@ namespace Game.Entities
{
if (m_areaTrigger.Empty())
return;
foreach (AreaTrigger areaTrigger in m_areaTrigger)
{
if (areaTrigger.GetAuraEffect() == aurEff)
+10 -8
View File
@@ -476,24 +476,26 @@ namespace Game.Entities
public void RemovePendingEventsForSeat(sbyte seatId)
{
foreach (var Event in _pendingJoinEvents.ToList())
for (var i = 0; i < _pendingJoinEvents.Count; ++i)
{
if (Event.Seat.Key == seatId)
var joinEvent = _pendingJoinEvents[i];
if (joinEvent.Seat.Key == seatId)
{
Event.ScheduleAbort();
_pendingJoinEvents.Remove(Event);
joinEvent.ScheduleAbort();
_pendingJoinEvents.Remove(joinEvent);
}
}
}
public void RemovePendingEventsForPassenger(Unit passenger)
{
foreach (var Event in _pendingJoinEvents.ToList())
for (var i = 0; i< _pendingJoinEvents.Count; ++i)
{
if (Event.Passenger == passenger)
var joinEvent = _pendingJoinEvents[i];
if (joinEvent.Passenger == passenger)
{
Event.ScheduleAbort();
_pendingJoinEvents.Remove(Event);
joinEvent.ScheduleAbort();
_pendingJoinEvents.Remove(joinEvent);
}
}
}
+2 -2
View File
@@ -1687,13 +1687,13 @@ namespace Game
_activate = activate;
}
public override void Visit(ICollection<Creature> objs)
public override void Visit(IList<Creature> objs)
{
foreach (var creature in objs)
if (creature.IsInWorld && creature.IsAIEnabled)
creature.GetAI().sOnGameEvent(_activate, _eventId);
}
public override void Visit(ICollection<GameObject> objs)
public override void Visit(IList<GameObject> objs)
{
foreach (var gameobject in objs)
if (gameobject.IsInWorld)
+1 -1
View File
@@ -245,7 +245,7 @@ namespace Game.Garrisons
if (slots[0] > forcedAbilities.Count + abilityList.Count)
{
List<GarrAbilityRecord> classSpecAbilities = GetClassSpecAbilities(follower, faction);
List<GarrAbilityRecord> classSpecAbilitiesTemp = classSpecAbilities.Except(forcedAbilities).ToList();
IEnumerable<GarrAbilityRecord> classSpecAbilitiesTemp = classSpecAbilities.Except(forcedAbilities);
abilityList = classSpecAbilitiesTemp.Union(abilityList).ToList();
abilityList.RandomResize((uint)Math.Max(0, slots[0] - forcedAbilities.Count));
+2 -2
View File
@@ -108,9 +108,9 @@ namespace Game.Garrisons
Log.outDebug(LogFilter.Maps, "{0} GameObjects and {1} Creatures loaded for grid {2} on map {3}", i_gameObjects, i_creatures, i_grid.GetGridId(), i_map.GetId());
}
public override void Visit(ICollection<WorldObject> objs)
public override void Visit(IList<WorldObject> objs)
{
List<Garrison.Plot> plots = i_garrison.GetPlots().ToList();
ICollection<Garrison.Plot> plots = i_garrison.GetPlots();
if (!plots.Empty())
{
CellCoord cellCoord = i_cell.GetCellCoord();
+64 -63
View File
@@ -24,19 +24,20 @@ using Game.Spells;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Collections.Concurrent;
namespace Game.Maps
{
public abstract class Notifier
{
public virtual void Visit(ICollection<WorldObject> objs) { }
public virtual void Visit(ICollection<Creature> objs) { }
public virtual void Visit(ICollection<AreaTrigger> objs) { }
public virtual void Visit(ICollection<Conversation> objs) { }
public virtual void Visit(ICollection<GameObject> objs) { }
public virtual void Visit(ICollection<DynamicObject> objs) { }
public virtual void Visit(ICollection<Corpse> objs) { }
public virtual void Visit(ICollection<Player> objs) { }
public virtual void Visit(IList<WorldObject> objs) { }
public virtual void Visit(IList<Creature> objs) { }
public virtual void Visit(IList<AreaTrigger> objs) { }
public virtual void Visit(IList<Conversation> objs) { }
public virtual void Visit(IList<GameObject> objs) { }
public virtual void Visit(IList<DynamicObject> objs) { }
public virtual void Visit(IList<Corpse> objs) { }
public virtual void Visit(IList<Player> objs) { }
public void CreatureUnitRelocationWorker(Creature c, Unit u)
{
@@ -64,16 +65,16 @@ namespace Game.Maps
_mask = mask;
}
public void Visit(ICollection<WorldObject> collection) { _notifier.Visit(collection); }
public void Visit(ICollection<Creature> creatures) { _notifier.Visit(creatures); }
public void Visit(ICollection<AreaTrigger> areatriggers) { _notifier.Visit(areatriggers); }
public void Visit(ICollection<Conversation> conversations) { _notifier.Visit(conversations); }
public void Visit(ICollection<GameObject> gameobjects) { _notifier.Visit(gameobjects); }
public void Visit(ICollection<DynamicObject> dynamicobjects) { _notifier.Visit(dynamicobjects); }
public void Visit(ICollection<Corpse> corpses) { _notifier.Visit(corpses); }
public void Visit(ICollection<Player> players) { _notifier.Visit(players); }
public void Visit(IList<WorldObject> collection) { _notifier.Visit(collection); }
public void Visit(IList<Creature> creatures) { _notifier.Visit(creatures); }
public void Visit(IList<AreaTrigger> areatriggers) { _notifier.Visit(areatriggers); }
public void Visit(IList<Conversation> conversations) { _notifier.Visit(conversations); }
public void Visit(IList<GameObject> gameobjects) { _notifier.Visit(gameobjects); }
public void Visit(IList<DynamicObject> dynamicobjects) { _notifier.Visit(dynamicobjects); }
public void Visit(IList<Corpse> corpses) { _notifier.Visit(corpses); }
public void Visit(IList<Player> players) { _notifier.Visit(players); }
public void Visit(Dictionary<ObjectGuid, WorldObject> dict) { Visit(dict.Values); }
public void Visit(Dictionary<ObjectGuid, WorldObject> dict) { Visit(dict.Values.ToList()); }
Notifier _notifier;
internal GridMapTypeMask _mask;
@@ -89,7 +90,7 @@ namespace Game.Maps
i_visibleNow = new List<Unit>();
}
public override void Visit(ICollection<WorldObject> objs)
public override void Visit(IList<WorldObject> objs)
{
foreach (var obj in objs)
{
@@ -171,7 +172,7 @@ namespace Game.Maps
i_object = obj;
}
public override void Visit(ICollection<Player> objs)
public override void Visit(IList<Player> objs)
{
foreach (var player in objs)
{
@@ -191,7 +192,7 @@ namespace Game.Maps
}
}
public override void Visit(ICollection<Creature> objs)
public override void Visit(IList<Creature> objs)
{
foreach (var creature in objs)
{
@@ -204,7 +205,7 @@ namespace Game.Maps
}
}
public override void Visit(ICollection<DynamicObject> objs)
public override void Visit(IList<DynamicObject> objs)
{
foreach (var dynamicObj in objs)
{
@@ -225,7 +226,7 @@ namespace Game.Maps
{
public PlayerRelocationNotifier(Player player) : base(player) { }
public override void Visit(ICollection<Player> objs)
public override void Visit(IList<Player> objs)
{
base.Visit(objs);
@@ -242,13 +243,13 @@ namespace Game.Maps
}
}
public override void Visit(ICollection<Creature> objs)
public override void Visit(IList<Creature> objs)
{
base.Visit(objs);
bool relocated_for_ai = (i_player == i_player.seerView);
foreach (var creature in objs.ToList())
foreach (var creature in objs)
{
vis_guids.Remove(creature.GetGUID());
@@ -267,7 +268,7 @@ namespace Game.Maps
i_creature = c;
}
public override void Visit(ICollection<Player> objs)
public override void Visit(IList<Player> objs)
{
foreach (var player in objs)
{
@@ -278,7 +279,7 @@ namespace Game.Maps
}
}
public override void Visit(ICollection<Creature> objs)
public override void Visit(IList<Creature> objs)
{
if (!i_creature.IsAlive())
return;
@@ -305,7 +306,7 @@ namespace Game.Maps
i_radius = radius;
}
public override void Visit(ICollection<Player> objs)
public override void Visit(IList<Player> objs)
{
foreach (var player in objs)
{
@@ -324,7 +325,7 @@ namespace Game.Maps
}
}
public override void Visit(ICollection<Creature> objs)
public override void Visit(IList<Creature> objs)
{
foreach (var creature in objs)
{
@@ -355,7 +356,7 @@ namespace Game.Maps
isCreature = unit.IsTypeId(TypeId.Unit);
}
public override void Visit(ICollection<Creature> objs)
public override void Visit(IList<Creature> objs)
{
foreach (var creature in objs)
{
@@ -380,9 +381,9 @@ namespace Game.Maps
skipped_receiver = skipped;
}
public override void Visit(ICollection<Player> objs)
public override void Visit(IList<Player> objs)
{
foreach (var player in objs.ToList())
foreach (var player in objs)
{
if (!player.IsInPhase(i_source))
continue;
@@ -403,7 +404,7 @@ namespace Game.Maps
}
}
public override void Visit(ICollection<Creature> objs)
public override void Visit(IList<Creature> objs)
{
foreach (var creature in objs)
{
@@ -427,7 +428,7 @@ namespace Game.Maps
}
}
public override void Visit(ICollection<DynamicObject> objs)
public override void Visit(IList<DynamicObject> objs)
{
foreach (var obj in objs)
{
@@ -474,9 +475,9 @@ namespace Game.Maps
i_timeDiff = diff;
}
public override void Visit(ICollection<WorldObject> objs)
public override void Visit(IList<WorldObject> objs)
{
foreach (var obj in objs.ToList())
foreach (var obj in objs)
{
if (obj.IsTypeId(TypeId.Player) || obj.IsTypeId(TypeId.Corpse))
continue;
@@ -497,7 +498,7 @@ namespace Game.Maps
action = _action;
}
public override void Visit(ICollection<Player> objs)
public override void Visit(IList<Player> objs)
{
foreach (var player in objs)
if (player.IsInPhase(_searcher))
@@ -516,7 +517,7 @@ namespace Game.Maps
Do = _Do;
}
public override void Visit(ICollection<Creature> objs)
public override void Visit(IList<Creature> objs)
{
foreach (var creature in objs)
{
@@ -537,7 +538,7 @@ namespace Game.Maps
_searcher = searcher;
}
public override void Visit(ICollection<GameObject> objs)
public override void Visit(IList<GameObject> objs)
{
foreach (var obj in objs)
if (obj.IsInPhase(_searcher))
@@ -557,7 +558,7 @@ namespace Game.Maps
i_do = _do;
}
public override void Visit(ICollection<WorldObject> objs)
public override void Visit(IList<WorldObject> objs)
{
foreach (var obj in objs)
{
@@ -605,12 +606,12 @@ namespace Game.Maps
public class ResetNotifier : Notifier
{
public override void Visit(ICollection<Player> objs)
public override void Visit(IList<Player> objs)
{
foreach (var player in objs)
player.ResetAllNotifies();
}
public override void Visit(ICollection<Creature> objs)
public override void Visit(IList<Creature> objs)
{
foreach (var creature in objs)
creature.ResetAllNotifies();
@@ -625,7 +626,7 @@ namespace Game.Maps
worldObject = obj;
}
public override void Visit(ICollection<Player> objs)
public override void Visit(IList<Player> objs)
{
foreach (var player in objs)
{
@@ -639,7 +640,7 @@ namespace Game.Maps
}
}
public override void Visit(ICollection<Creature> objs)
public override void Visit(IList<Creature> objs)
{
foreach (var creature in objs)
{
@@ -650,7 +651,7 @@ namespace Game.Maps
}
}
}
public override void Visit(ICollection<DynamicObject> objs)
public override void Visit(IList<DynamicObject> objs)
{
foreach (var obj in objs)
{
@@ -691,7 +692,7 @@ namespace Game.Maps
Do = _Do;
}
public override void Visit(ICollection<Player> objs)
public override void Visit(IList<Player> objs)
{
foreach (var player in objs)
{
@@ -830,7 +831,7 @@ namespace Game.Maps
i_check = check;
}
public override void Visit(ICollection<WorldObject> objs)
public override void Visit(IList<WorldObject> objs)
{
// already found
if (i_object)
@@ -898,7 +899,7 @@ namespace Game.Maps
i_check = check;
}
public override void Visit(ICollection<WorldObject> objs)
public override void Visit(IList<WorldObject> objs)
{
foreach (var obj in objs)
{
@@ -959,7 +960,7 @@ namespace Game.Maps
i_check = check;
}
public override void Visit(ICollection<WorldObject> objs)
public override void Visit(IList<WorldObject> objs)
{
foreach (var obj in objs)
{
@@ -1014,7 +1015,7 @@ namespace Game.Maps
i_check = check;
}
public override void Visit(ICollection<GameObject> objs)
public override void Visit(IList<GameObject> objs)
{
// already found
if (i_object)
@@ -1047,7 +1048,7 @@ namespace Game.Maps
i_check = check;
}
public override void Visit(ICollection<GameObject> objs)
public override void Visit(IList<GameObject> objs)
{
foreach (var go in objs)
{
@@ -1074,7 +1075,7 @@ namespace Game.Maps
i_check = check;
}
public override void Visit(ICollection<GameObject> objs)
public override void Visit(IList<GameObject> objs)
{
foreach (var obj in objs)
{
@@ -1097,7 +1098,7 @@ namespace Game.Maps
i_check = check;
}
public override void Visit(ICollection<Player> objs)
public override void Visit(IList<Player> objs)
{
foreach (var player in objs)
{
@@ -1112,7 +1113,7 @@ namespace Game.Maps
}
}
public override void Visit(ICollection<Creature> objs)
public override void Visit(IList<Creature> objs)
{
foreach (var creature in objs)
{
@@ -1141,7 +1142,7 @@ namespace Game.Maps
i_check = check;
}
public override void Visit(ICollection<Player> objs)
public override void Visit(IList<Player> objs)
{
foreach (var player in objs)
{
@@ -1153,7 +1154,7 @@ namespace Game.Maps
}
}
public override void Visit(ICollection<Creature> objs)
public override void Visit(IList<Creature> objs)
{
foreach (var creature in objs)
{
@@ -1180,7 +1181,7 @@ namespace Game.Maps
i_check = check;
}
public override void Visit(ICollection<Player> objs)
public override void Visit(IList<Player> objs)
{
foreach (var player in objs)
{
@@ -1189,7 +1190,7 @@ namespace Game.Maps
i_objects.Add(player);
}
}
public override void Visit(ICollection<Creature> objs)
public override void Visit(IList<Creature> objs)
{
foreach (var creature in objs)
{
@@ -1212,7 +1213,7 @@ namespace Game.Maps
i_check = check;
}
public override void Visit(ICollection<Creature> objs)
public override void Visit(IList<Creature> objs)
{
// already found
if (i_object)
@@ -1245,7 +1246,7 @@ namespace Game.Maps
i_check = check;
}
public override void Visit(ICollection<Creature> objs)
public override void Visit(IList<Creature> objs)
{
foreach (var creature in objs)
{
@@ -1272,7 +1273,7 @@ namespace Game.Maps
i_check = check;
}
public override void Visit(ICollection<Creature> objs)
public override void Visit(IList<Creature> objs)
{
foreach (var creature in objs)
if (creature.IsInPhase(_searcher))
@@ -1293,7 +1294,7 @@ namespace Game.Maps
i_check = check;
}
public override void Visit(ICollection<Player> objs)
public override void Visit(IList<Player> objs)
{
// already found
if (i_object)
@@ -1326,7 +1327,7 @@ namespace Game.Maps
i_check = check;
}
public override void Visit(ICollection<Player> objs)
public override void Visit(IList<Player> objs)
{
foreach (var player in objs)
{
@@ -1353,7 +1354,7 @@ namespace Game.Maps
i_check = check;
}
public override void Visit(ICollection<Player> objs)
public override void Visit(IList<Player> objs)
{
foreach (var player in objs)
if (player.IsInPhase(_searcher))
+4 -3
View File
@@ -1632,8 +1632,8 @@ namespace Game.Maps
}
}
foreach (Transport transport in _transports.ToList())
RemoveFromMap(transport, true);
for (var i = 0; i < _transports.Count; ++i)
RemoveFromMap(_transports[i], true);
_transports.Clear();
@@ -1650,8 +1650,9 @@ namespace Game.Maps
Global.ScriptMgr.OnDestroyMap(this);
foreach (WorldObject obj in i_worldObjects.ToList())
for (var i = 0; i < i_worldObjects.Count; ++i)
{
WorldObject obj = i_worldObjects[i];
Contract.Assert(obj.IsWorldObject());
obj.RemoveFromWorld();
obj.ResetMap();
+14 -10
View File
@@ -19,6 +19,7 @@ using Framework.Constants;
using Game.Entities;
using System.Collections.Generic;
using System.Linq;
using System.Collections.Concurrent;
namespace Game.Maps
{
@@ -56,7 +57,7 @@ namespace Game.Maps
Log.outDebug(LogFilter.Maps, "{0} GameObjects, {1} Creatures, and {2} Corpses/Bones loaded for grid {3} on map {4}", i_gameObjects, i_creatures, i_corpses, i_grid.GetGridId(), i_map.GetId());
}
public override void Visit(ICollection<GameObject> objs)
public override void Visit(IList<GameObject> objs)
{
CellCoord cellCoord = i_cell.GetCellCoord();
CellObjectGuids cellguids = Global.ObjectMgr.GetCellObjectGuids(i_map.GetId(), (byte)i_map.GetSpawnMode(), cellCoord.GetId());
@@ -66,7 +67,7 @@ namespace Game.Maps
LoadHelper<GameObject>(cellguids.gameobjects, cellCoord, ref i_gameObjects, i_map);
}
public override void Visit(ICollection<Creature> objs)
public override void Visit(IList<Creature> objs)
{
CellCoord cellCoord = i_cell.GetCellCoord();
CellObjectGuids cellguids = Global.ObjectMgr.GetCellObjectGuids(i_map.GetId(), (byte)i_map.GetSpawnMode(), cellCoord.GetId());
@@ -125,7 +126,7 @@ namespace Game.Maps
i_corpses = gloader.i_corpses;
}
public override void Visit(ICollection<Corpse> objs)
public override void Visit(IList<Corpse> objs)
{
CellCoord cellCoord = i_cell.GetCellCoord();
var corpses = i_map.GetCorpsesInCell(cellCoord.GetId());
@@ -158,7 +159,7 @@ namespace Game.Maps
//Stop the creatures before unloading the NGrid
class ObjectGridStoper : Notifier
{
public override void Visit(ICollection<Creature> objs)
public override void Visit(IList<Creature> objs)
{
// stop any fights at grid de-activation and remove dynobjects/areatriggers created at cast by creatures
foreach (var creature in objs)
@@ -180,20 +181,23 @@ namespace Game.Maps
//Move the foreign creatures back to respawn positions before unloading the NGrid
class ObjectGridEvacuator : Notifier
{
public override void Visit(ICollection<Creature> objs)
public override void Visit(IList<Creature> objs)
{
foreach (var creature in objs.ToList())
for (var i = 0; i < objs.Count; ++i)
{
Creature creature = objs[i];
// creature in unloading grid can have respawn point in another grid
// if it will be unloaded then it will not respawn in original grid until unload/load original grid
// move to respawn point to prevent this case. For player view in respawn grid this will be normal respawn.
creature.GetMap().CreatureRespawnRelocation(creature, true);
}
}
public override void Visit(ICollection<GameObject> objs)
public override void Visit(IList<GameObject> objs)
{
foreach (var go in objs.ToList())
for (var i = 0; i < objs.Count; ++i)
{
GameObject go = objs[i];
// gameobject in unloading grid can have respawn point in another grid
// if it will be unloaded then it will not respawn in original grid until unload/load original grid
// move to respawn point to prevent this case. For player view in respawn grid this will be normal respawn.
@@ -205,7 +209,7 @@ namespace Game.Maps
//Clean up and remove from world
class ObjectGridCleaner : Notifier
{
public override void Visit(ICollection<WorldObject> objs)
public override void Visit(IList<WorldObject> objs)
{
foreach (var obj in objs)
{
@@ -220,7 +224,7 @@ namespace Game.Maps
//Delete objects before deleting NGrid
class ObjectGridUnloader : Notifier
{
public override void Visit(ICollection<WorldObject> objs)
public override void Visit(IList<WorldObject> objs)
{
foreach (var obj in objs)
{
+4 -3
View File
@@ -112,8 +112,8 @@ namespace Game.Spells
public virtual void Dispose()
{
// unload scripts
foreach (var script in m_loadedScripts.ToList())
script._Unload();
for (var i = 0; i < m_loadedScripts.Count; ++i)
m_loadedScripts[i]._Unload();
if (m_referencedFromCurrentSpell && m_selfContainer && m_selfContainer == this)
{
@@ -1460,8 +1460,9 @@ namespace Game.Spells
// for some spells allow only chain targets in front of caster (swipe for example)
if (!isBouncingFar)
{
foreach (var obj in tempTargets.ToList())
for (var i = 0; i < tempTargets.Count; ++i)
{
var obj = tempTargets[i];
if (!m_caster.HasInArc(MathFunctions.PI, obj))
tempTargets.Remove(obj);
}