diff --git a/Source/Framework/Collections/StringArray.cs b/Source/Framework/Collections/StringArray.cs
index 711b23373..9a9b9ce3e 100644
--- a/Source/Framework/Collections/StringArray.cs
+++ b/Source/Framework/Collections/StringArray.cs
@@ -32,11 +32,17 @@ namespace Framework.Collections
public StringArray(string str, params string[] separator)
{
+ if (str.IsEmpty())
+ return;
+
_str = str.Split(separator, StringSplitOptions.RemoveEmptyEntries);
}
public StringArray(string str, params char[] separator)
{
+ if (str.IsEmpty())
+ return;
+
_str = str.Split(separator, StringSplitOptions.RemoveEmptyEntries);
}
@@ -51,7 +57,12 @@ namespace Framework.Collections
return _str.GetEnumerator();
}
- public int Length { get { return _str.Length; } }
+ public bool IsEmpty()
+ {
+ return _str == null || _str.Length == 0;
+ }
+
+ public int Length => _str.Length;
string[] _str;
}
diff --git a/Source/Framework/Database/DatabaseLoader.cs b/Source/Framework/Database/DatabaseLoader.cs
index 150da5bc5..843a74af4 100644
--- a/Source/Framework/Database/DatabaseLoader.cs
+++ b/Source/Framework/Database/DatabaseLoader.cs
@@ -80,8 +80,6 @@ namespace Framework.Database
// Populate and update only if updates are enabled for this pool
_populate.Add(() =>
{
- //Hack used to allow big querys
- database.Apply("SET GLOBAL max_allowed_packet=1073741824;");
if (!database.GetUpdater().Populate())
{
Log.outError(LogFilter.ServerLoading, $"Could not populate the {database.GetDatabaseName()} database, see log for details.");
@@ -92,8 +90,6 @@ namespace Framework.Database
_update.Add(() =>
{
- //Hack used to allow big querys
- database.Apply("SET GLOBAL max_allowed_packet=1073741824;");
if (!database.GetUpdater().Update())
{
Log.outError(LogFilter.ServerLoading, $"Could not update the {database.GetDatabaseName()} database, see log for details.");
diff --git a/Source/Framework/Database/DatabaseUpdater.cs b/Source/Framework/Database/DatabaseUpdater.cs
index e8b6474f5..ebf3b5bf5 100644
--- a/Source/Framework/Database/DatabaseUpdater.cs
+++ b/Source/Framework/Database/DatabaseUpdater.cs
@@ -35,7 +35,7 @@ namespace Framework.Database
public bool Populate()
{
SQLResult result = _database.Query("SHOW TABLES");
- if (!result.IsEmpty() && result.GetRowCount() > 0)
+ if (!result.IsEmpty() && !result.IsEmpty())
return true;
Log.outInfo(LogFilter.SqlUpdates, $"Database {_database.GetDatabaseName()} is empty, auto populating it...");
diff --git a/Source/Framework/Database/QueryCallback.cs b/Source/Framework/Database/QueryCallback.cs
index f6d0eca36..bce9dddb2 100644
--- a/Source/Framework/Database/QueryCallback.cs
+++ b/Source/Framework/Database/QueryCallback.cs
@@ -76,7 +76,7 @@ namespace Framework.Database
if (!hasNext)
return QueryCallbackStatus.Completed;
- callback = _callbacks.Dequeue();
+ callback = _callbacks.Peek();
}
else
return QueryCallbackStatus.NotReady;
diff --git a/Source/Framework/Framework.csproj b/Source/Framework/Framework.csproj
index 4ef1ba773..fe1f72e23 100644
--- a/Source/Framework/Framework.csproj
+++ b/Source/Framework/Framework.csproj
@@ -12,7 +12,7 @@
-
+
diff --git a/Source/Game/Achievements/CriteriaHandler.cs b/Source/Game/Achievements/CriteriaHandler.cs
index 5ee67a8fb..035328123 100644
--- a/Source/Game/Achievements/CriteriaHandler.cs
+++ b/Source/Game/Achievements/CriteriaHandler.cs
@@ -452,7 +452,7 @@ namespace Game.Achievements
}
else
{
- value -= timeDiff;
+ _timeCriteriaTrees[key] -= timeDiff;
}
}
}
diff --git a/Source/Game/Chat/Commands/BanCommands.cs b/Source/Game/Chat/Commands/BanCommands.cs
index c4ed161d6..c267faf2d 100644
--- a/Source/Game/Chat/Commands/BanCommands.cs
+++ b/Source/Game/Chat/Commands/BanCommands.cs
@@ -539,7 +539,7 @@ namespace Game.Chat.Commands
string accountName;
// "account" case, name can be get in same query
- if (result.GetRowCount() > 1)
+ if (result.GetFieldCount() > 1)
accountName = result.Read(1);
// "character" case, name need extract from another DB
else
diff --git a/Source/Game/Chat/Commands/GoCommands.cs b/Source/Game/Chat/Commands/GoCommands.cs
index 1e5d4e86b..fe74f8010 100644
--- a/Source/Game/Chat/Commands/GoCommands.cs
+++ b/Source/Game/Chat/Commands/GoCommands.cs
@@ -71,8 +71,6 @@ namespace Game.Chat.Commands
handler.SendSysMessage(CypherStrings.CommandGocreatnotfound);
return false;
}
- if (result.GetRowCount() > 1)
- handler.SendSysMessage(CypherStrings.CommandGocreatmultiple);
float x = result.Read(0);
float y = result.Read(1);
@@ -80,6 +78,9 @@ namespace Game.Chat.Commands
float o = result.Read(3);
uint mapId = result.Read(4);
+ if (result.NextRow())
+ handler.SendSysMessage(CypherStrings.CommandGocreatmultiple);
+
if (!GridDefines.IsValidMapCoord(mapId, x, y, z, o) || Global.ObjectMgr.IsTransportMap(mapId))
{
handler.SendSysMessage(CypherStrings.InvalidTargetCoord, x, y, mapId);
diff --git a/Source/Game/Chat/Commands/ListCommands.cs b/Source/Game/Chat/Commands/ListCommands.cs
index 48c7743a9..f90a5aab5 100644
--- a/Source/Game/Chat/Commands/ListCommands.cs
+++ b/Source/Game/Chat/Commands/ListCommands.cs
@@ -210,15 +210,10 @@ namespace Game.Chat.Commands
itemPos = "";
handler.SendSysMessage(CypherStrings.ItemlistSlot, itemGuid.ToString(), ownerName, ownerGuid.ToString(), ownerAccountId, itemPos);
+
+ count--;
}
while (result.NextRow());
-
- uint resultCount = (uint)result.GetRowCount();
-
- if (count > resultCount)
- count -= resultCount;
- else if (count != 0)
- count = 0;
}
// mail case
@@ -256,15 +251,10 @@ namespace Game.Chat.Commands
string itemPos = "[in mail]";
handler.SendSysMessage(CypherStrings.ItemlistMail, itemGuid, itemSenderName, itemSender, itemSenderAccountId, itemReceiverName, itemReceiver, itemReceiverAccount, itemPos);
+
+ count--;
}
while (result.NextRow());
-
- uint resultCount = (uint)result.GetRowCount();
-
- if (count > resultCount)
- count -= resultCount;
- else if (count != 0)
- count = 0;
}
// auction case
@@ -329,15 +319,10 @@ namespace Game.Chat.Commands
string itemPos = "[in guild bank]";
handler.SendSysMessage(CypherStrings.ItemlistGuild, itemGuid.ToString(), guildName, guildGuid.ToString(), itemPos);
+
+ count--;
}
while (result.NextRow());
-
- uint resultCount = (uint)result.GetRowCount();
-
- if (count > resultCount)
- count -= resultCount;
- else if (count != 0)
- count = 0;
}
if (inventoryCount + mailCount + auctionCount + guildCount == 0)
diff --git a/Source/Game/Entities/Creature/Creature.cs b/Source/Game/Entities/Creature/Creature.cs
index d29cbc2b5..75c0e0379 100644
--- a/Source/Game/Entities/Creature/Creature.cs
+++ b/Source/Game/Entities/Creature/Creature.cs
@@ -2134,7 +2134,7 @@ namespace Game.Entities
if (cainfo.path_id != 0)
m_path_id = cainfo.path_id;
- if (!cainfo.auras.Empty())
+ if (cainfo.auras != null)
{
foreach (var id in cainfo.auras)
{
diff --git a/Source/Game/Entities/Player/Player.DB.cs b/Source/Game/Entities/Player/Player.DB.cs
index c143258d9..e0e96abc8 100644
--- a/Source/Game/Entities/Player/Player.DB.cs
+++ b/Source/Game/Entities/Player/Player.DB.cs
@@ -4038,12 +4038,14 @@ namespace Game.Entities
if (!result.IsEmpty())
{
- Log.outDebug(LogFilter.Player, "Player:DeleteOldChars: Found {0} character(s) to delete", result.GetRowCount());
+ int count = 0;
do
{
DeleteFromDB(ObjectGuid.Create(HighGuid.Player, result.Read(0)), result.Read(1), true, true);
+ count++;
}
while (result.NextRow());
+ Log.outDebug(LogFilter.Player, "Player:DeleteOldChars: Deleted {0} character(s)", count);
}
}
diff --git a/Source/Game/Events/GameEventManager.cs b/Source/Game/Events/GameEventManager.cs
index 180771c1b..5d323a5fd 100644
--- a/Source/Game/Events/GameEventManager.cs
+++ b/Source/Game/Events/GameEventManager.cs
@@ -211,7 +211,7 @@ namespace Game
{
{
uint oldMSTime = Time.GetMSTime();
- // 0 1 2 3 4 5 6 7 8
+ // 0 1 2 3 4 5 6 7 8
SQLResult result = DB.World.Query("SELECT eventEntry, UNIX_TIMESTAMP(start_time), UNIX_TIMESTAMP(end_time), occurence, length, holiday, description, world_event, announce FROM game_event");
if (result.IsEmpty())
{
@@ -267,7 +267,6 @@ namespace Game
while (result.NextRow());
Log.outInfo(LogFilter.ServerLoading, "Loaded {0} game events in {1} ms", count, Time.GetMSTimeDiffToNow(oldMSTime));
-
}
Log.outInfo(LogFilter.ServerLoading, "Loading Game Event Saves Data...");
@@ -276,7 +275,6 @@ namespace Game
// 0 1 2
SQLResult result = DB.Characters.Query("SELECT eventEntry, state, next_start FROM game_event_save");
-
if (result.IsEmpty())
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 game event saves in game events. DB table `game_event_save` is empty.");
else
@@ -354,7 +352,6 @@ namespace Game
while (result.NextRow());
Log.outInfo(LogFilter.ServerLoading, "Loaded {0} game event prerequisites in game events in {1} ms", count, Time.GetMSTimeDiffToNow(oldMSTime));
-
}
}
@@ -364,7 +361,6 @@ namespace Game
// 0 1
SQLResult result = DB.World.Query("SELECT guid, eventEntry FROM game_event_creature");
-
if (result.IsEmpty())
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 creatures in game events. DB table `game_event_creature` is empty");
else
@@ -395,7 +391,6 @@ namespace Game
while (result.NextRow());
Log.outInfo(LogFilter.ServerLoading, "Loaded {0} creatures in game events in {1} ms", count, Time.GetMSTimeDiffToNow(oldMSTime));
-
}
}
@@ -405,7 +400,6 @@ namespace Game
// 0 1
SQLResult result = DB.World.Query("SELECT guid, eventEntry FROM game_event_gameobject");
-
if (result.IsEmpty())
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 gameobjects in game events. DB table `game_event_gameobject` is empty.");
else
@@ -446,8 +440,7 @@ namespace Game
// 0 1 2 3 4
SQLResult result = DB.World.Query("SELECT creature.guid, creature.id, game_event_model_equip.eventEntry, game_event_model_equip.modelid, game_event_model_equip.equipment_id " +
- "FROM creature JOIN game_event_model_equip ON creature.guid=game_event_model_equip.guid");
-
+ "FROM creature JOIN game_event_model_equip ON creature.guid=game_event_model_equip.guid");
if (result.IsEmpty())
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 model/equipment changes in game events. DB table `game_event_model_equip` is empty.");
else
@@ -498,7 +491,6 @@ namespace Game
// 0 1 2
SQLResult result = DB.World.Query("SELECT id, quest, eventEntry FROM game_event_creature_quest");
-
if (result.IsEmpty())
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 quests additions in game events. DB table `game_event_creature_quest` is empty.");
else
@@ -532,7 +524,6 @@ namespace Game
// 0 1 2
SQLResult result = DB.World.Query("SELECT id, quest, eventEntry FROM game_event_gameobject_quest");
-
if (result.IsEmpty())
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 go quests additions in game events. DB table `game_event_gameobject_quest` is empty.");
else
@@ -566,7 +557,6 @@ namespace Game
// 0 1 2 3
SQLResult result = DB.World.Query("SELECT quest, eventEntry, condition_id, num FROM game_event_quest_condition");
-
if (result.IsEmpty())
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 quest event conditions in game events. DB table `game_event_quest_condition` is empty.");
else
@@ -606,7 +596,6 @@ namespace Game
// 0 1 2 3 4
SQLResult result = DB.World.Query("SELECT eventEntry, condition_id, req_num, max_world_state_field, done_world_state_field FROM game_event_condition");
-
if (result.IsEmpty())
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 conditions in game events. DB table `game_event_condition` is empty.");
else
@@ -642,7 +631,6 @@ namespace Game
// 0 1 2
SQLResult result = DB.Characters.Query("SELECT eventEntry, condition_id, done FROM game_event_condition_save");
-
if (result.IsEmpty())
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 condition saves in game events. DB table `game_event_condition_save` is empty.");
else
@@ -683,7 +671,6 @@ namespace Game
// 0 1 2
SQLResult result = DB.World.Query("SELECT guid, eventEntry, npcflag FROM game_event_npcflag");
-
if (result.IsEmpty())
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 npcflags in game events. DB table `game_event_npcflag` is empty.");
else
@@ -717,7 +704,6 @@ namespace Game
// 0 1
SQLResult result = DB.World.Query("SELECT questId, eventEntry FROM game_event_seasonal_questrelation");
-
if (result.IsEmpty())
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 seasonal quests additions in game events. DB table `game_event_seasonal_questrelation` is empty.");
else
@@ -753,9 +739,8 @@ namespace Game
{
uint oldMSTime = Time.GetMSTime();
- // 0 1 2 3 4 5 6 7 8 9
+ // 0 1 2 3 4 5 6 7 8 9
SQLResult result = DB.World.Query("SELECT eventEntry, guid, item, maxcount, incrtime, ExtendedCost, type, BonusListIDs, PlayerConditionId, IgnoreFiltering FROM game_event_npc_vendor ORDER BY guid, slot ASC");
-
if (result.IsEmpty())
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 vendor additions in game events. DB table `game_event_npc_vendor` is empty.");
else
@@ -799,8 +784,9 @@ namespace Game
vItem.IgnoreFiltering = result.Read(9);
var bonusListIDsTok = new StringArray(result.Read(7), ' ');
- foreach (uint token in bonusListIDsTok)
- vItem.BonusListIDs.Add(token);
+ if (!bonusListIDsTok.IsEmpty())
+ foreach (uint token in bonusListIDsTok)
+ vItem.BonusListIDs.Add(token);
// check validity with event's npcflag
if (!Global.ObjectMgr.IsVendorItemValid(entry, vItem, null, null, event_npc_flag))
@@ -822,7 +808,6 @@ namespace Game
// 0 1
SQLResult result = DB.World.Query("SELECT eventEntry, bgflag FROM game_event_battleground_holiday");
-
if (result.IsEmpty())
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 Battlegroundholidays in game events. DB table `game_event_battleground_holiday` is empty.");
else
@@ -854,8 +839,7 @@ namespace Game
// 0 1
SQLResult result = DB.World.Query("SELECT pool_template.entry, game_event_pool.eventEntry FROM pool_template" +
- " JOIN game_event_pool ON pool_template.entry = game_event_pool.pool_entry");
-
+ " JOIN game_event_pool ON pool_template.entry = game_event_pool.pool_entry");
if (result.IsEmpty())
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 pools for game events. DB table `game_event_pool` is empty.");
else
@@ -958,7 +942,6 @@ namespace Game
{
int season = WorldConfig.GetIntValue(WorldCfg.ArenaSeasonId);
SQLResult result = DB.World.Query("SELECT eventEntry FROM game_event_arena_seasons WHERE season = '{0}'", season);
-
if (result.IsEmpty())
{
Log.outError(LogFilter.Gameevent, "ArenaSeason ({0}) must be an existant Arena Season", season);
@@ -975,7 +958,6 @@ namespace Game
StartEvent(eventId, true);
Log.outInfo(LogFilter.Gameevent, "Arena Season {0} started...", season);
-
}
public uint Update() // return the next event delay in ms
diff --git a/Source/Game/Globals/ObjectManager.cs b/Source/Game/Globals/ObjectManager.cs
index c27b11a5e..9fb6a50e5 100644
--- a/Source/Game/Globals/ObjectManager.cs
+++ b/Source/Game/Globals/ObjectManager.cs
@@ -9186,7 +9186,7 @@ namespace Game
_equipmentSetGuid = result.Read(0) + 1;
result = DB.Characters.Query("SELECT MAX(guildId) FROM guild");
- if (result.GetRowCount() == 1)
+ if (!result.IsEmpty())
Global.GuildMgr.SetNextGuildId(result.Read(0) + 1);
result = DB.Characters.Query("SELECT MAX(itemId) from character_void_storage");
diff --git a/Source/Game/Guilds/GuildManager.cs b/Source/Game/Guilds/GuildManager.cs
index 4728c8d61..8e825a759 100644
--- a/Source/Game/Guilds/GuildManager.cs
+++ b/Source/Game/Guilds/GuildManager.cs
@@ -401,30 +401,20 @@ namespace Game
{
uint oldMSTime = Time.GetMSTime();
- long achievementCount = 0;
- long criteriaCount = 0;
-
- SQLResult achievementResult;
- SQLResult criteriaResult;
foreach (var pair in GuildStore)
{
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_GUILD_ACHIEVEMENT);
stmt.AddValue(0, pair.Key);
- achievementResult = DB.Characters.Query(stmt);
+ SQLResult achievementResult = DB.Characters.Query(stmt);
stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_GUILD_ACHIEVEMENT_CRITERIA);
stmt.AddValue(0, pair.Key);
- criteriaResult = DB.Characters.Query(stmt);
-
- if (!achievementResult.IsEmpty())
- achievementCount += achievementResult.GetRowCount();
- if (!criteriaResult.IsEmpty())
- criteriaCount += criteriaResult.GetRowCount();
+ SQLResult criteriaResult = DB.Characters.Query(stmt);
pair.Value.GetAchievementMgr().LoadFromDB(achievementResult, criteriaResult);
}
- Log.outInfo(LogFilter.ServerLoading, "Loaded {0} guild achievements and {1} criterias in {2} ms", achievementCount, criteriaCount, Time.GetMSTimeDiffToNow(oldMSTime));
+ Log.outInfo(LogFilter.ServerLoading, "Loaded guild achievements and criterias in {1} ms", Time.GetMSTimeDiffToNow(oldMSTime));
}
// 11. Validate loaded guild data
diff --git a/Source/Game/Handlers/PetitionsHandler.cs b/Source/Game/Handlers/PetitionsHandler.cs
index 0eeb951ee..f30c9cadf 100644
--- a/Source/Game/Handlers/PetitionsHandler.cs
+++ b/Source/Game/Handlers/PetitionsHandler.cs
@@ -143,17 +143,13 @@ namespace Game
stmt.AddValue(0, packet.Item.GetCounter());
SQLResult result = DB.Characters.Query(stmt);
- // result == NULL also correct in case no sign yet
- if (!result.IsEmpty())
- signs = (byte)result.GetRowCount();
-
ServerPetitionShowSignatures signaturesPacket = new ServerPetitionShowSignatures();
signaturesPacket.Item = packet.Item;
signaturesPacket.Owner = GetPlayer().GetGUID();
signaturesPacket.OwnerAccountID = ObjectGuid.Create(HighGuid.WowAccount, ObjectManager.GetPlayerAccountIdByGUID(GetPlayer().GetGUID()));
signaturesPacket.PetitionID = (int)packet.Item.GetCounter(); // @todo verify that...
- for (byte i = 1; i <= signs; ++i)
+ do
{
ObjectGuid signerGUID = ObjectGuid.Create(HighGuid.Player, result.Read(0));
@@ -161,9 +157,9 @@ namespace Game
signature.Signer = signerGUID;
signature.Choice = 0;
signaturesPacket.Signatures.Add(signature);
-
- result.NextRow();
}
+ while (result.NextRow());
+
SendPacket(signaturesPacket);
}
@@ -371,18 +367,13 @@ namespace Game
stmt.AddValue(0, packet.ItemGUID.GetCounter());
SQLResult result = DB.Characters.Query(stmt);
- byte signs = 0;
- // result == NULL also correct charter without signs
- if (!result.IsEmpty())
- signs = (byte)result.GetRowCount();
-
ServerPetitionShowSignatures signaturesPacket = new ServerPetitionShowSignatures();
signaturesPacket.Item = packet.ItemGUID;
signaturesPacket.Owner = GetPlayer().GetGUID();
signaturesPacket.OwnerAccountID = ObjectGuid.Create(HighGuid.WowAccount, player.GetSession().GetAccountId());
signaturesPacket.PetitionID = (int)packet.ItemGUID.GetCounter(); // @todo verify that...
- for (byte i = 1; i <= signs; ++i)
+ do
{
ObjectGuid signerGUID = ObjectGuid.Create(HighGuid.Player, result.Read(0));
@@ -390,9 +381,8 @@ namespace Game
signature.Signer = signerGUID;
signature.Choice = 0;
signaturesPacket.Signatures.Add(signature);
-
- result.NextRow();
}
+ while (result.NextRow());
player.SendPacket(signaturesPacket);
}
@@ -452,15 +442,20 @@ namespace Game
stmt.AddValue(0, packet.Item.GetCounter());
result = DB.Characters.Query(stmt);
+ List guids = new List();
if (!result.IsEmpty())
- signatures = (byte)result.GetRowCount();
- else
- signatures = 0;
+ {
+ do
+ {
+ guids.Add(ObjectGuid.Create(HighGuid.Player, result.Read(0)));
+ }
+ while (result.NextRow());
+ }
uint requiredSignatures = WorldConfig.GetUIntValue(WorldCfg.MinPetitionSigns);
// Notify player if signatures are missing
- if (signatures < requiredSignatures)
+ if (guids.Count < requiredSignatures)
{
resultPacket.Result = PetitionTurns.NeedMoreSignatures;
SendPacket(resultPacket);
@@ -484,14 +479,8 @@ namespace Game
SQLTransaction trans = new SQLTransaction();
// Add members from signatures
- for (byte i = 0; i < signatures; ++i)
- {
- guild.AddMember(trans, ObjectGuid.Create(HighGuid.Player, result.Read(0)));
-
- // Checking the return value just to be double safe
- if (!result.NextRow())
- break;
- }
+ foreach (var guid in guids)
+ guild.AddMember(trans, guid);
stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_PETITION_BY_GUID);
stmt.AddValue(0, packet.Item.GetCounter());
diff --git a/Source/Game/Maps/Grid.cs b/Source/Game/Maps/Grid.cs
index 50b92f84a..c1612ebaf 100644
--- a/Source/Game/Maps/Grid.cs
+++ b/Source/Game/Maps/Grid.cs
@@ -198,7 +198,7 @@ namespace Game.Maps
gridInfo.UpdateTimeTracker(diff);
}
- public void Update(Map m, uint diff)
+ public void Update(Map map, uint diff)
{
switch (GetGridState())
{
@@ -207,24 +207,24 @@ namespace Game.Maps
getGridInfoRef().UpdateTimeTracker(diff);
if (getGridInfoRef().getTimeTracker().Passed())
{
- if (GetWorldObjectCountInNGrid() == 0 && !m.ActiveObjectsNearGrid(this))
+ if (GetWorldObjectCountInNGrid() == 0 && !map.ActiveObjectsNearGrid(this))
{
ObjectGridStoper worker = new ObjectGridStoper();
var visitor = new Visitor(worker, GridMapTypeMask.AllGrid);
VisitAllGrids(visitor);
SetGridState(GridState.Idle);
Log.outDebug(LogFilter.Maps, "Grid[{0}, {1}] on map {2} moved to IDLE state", getX(), getY(),
- m.GetId());
+ map.GetId());
}
else
- m.ResetGridExpiry(this, 0.1f);
+ map.ResetGridExpiry(this, 0.1f);
}
break;
case GridState.Idle:
- m.ResetGridExpiry(this);
+ map.ResetGridExpiry(this);
SetGridState(GridState.Removal);
Log.outDebug(LogFilter.Maps, "Grid[{0}, {1}] on map {2} moved to REMOVAL state", getX(), getY(),
- m.GetId());
+ map.GetId());
break;
case GridState.Removal:
if (!getGridInfoRef().getUnloadLock())
@@ -232,12 +232,12 @@ namespace Game.Maps
getGridInfoRef().UpdateTimeTracker(diff);
if (getGridInfoRef().getTimeTracker().Passed())
{
- if (!m.UnloadGrid(this, false))
+ if (!map.UnloadGrid(this, false))
{
Log.outDebug(LogFilter.Maps,
"Grid[{0}, {1}] for map {2} differed unloading due to players or active objects nearby",
- getX(), getY(), m.GetId());
- m.ResetGridExpiry(this);
+ getX(), getY(), map.GetId());
+ map.ResetGridExpiry(this);
}
}
}
diff --git a/Source/Game/Maps/GridNotifiers.cs b/Source/Game/Maps/GridNotifiers.cs
index 271585714..37a61ca28 100644
--- a/Source/Game/Maps/GridNotifiers.cs
+++ b/Source/Game/Maps/GridNotifiers.cs
@@ -477,8 +477,9 @@ namespace Game.Maps
public override void Visit(IList objs)
{
- foreach (var obj in objs)
+ for (var i = 0; i < objs.Count; ++i)
{
+ var obj = objs[i];
if (obj.IsTypeId(TypeId.Player) || obj.IsTypeId(TypeId.Corpse))
continue;
diff --git a/Source/Game/Maps/ObjectGridLoader.cs b/Source/Game/Maps/ObjectGridLoader.cs
index a84152044..cd9e00063 100644
--- a/Source/Game/Maps/ObjectGridLoader.cs
+++ b/Source/Game/Maps/ObjectGridLoader.cs
@@ -79,10 +79,9 @@ namespace Game.Maps
void LoadHelper(SortedSet guid_set, CellCoord cell, ref uint count, Map map) where T : WorldObject, new()
{
- foreach (var i_guid in guid_set)
+ foreach (var guid in guid_set)
{
T obj = new T();
- ulong guid = i_guid;
if (!obj.LoadFromDB(guid, map))
continue;
@@ -162,8 +161,9 @@ namespace Game.Maps
public override void Visit(IList objs)
{
// stop any fights at grid de-activation and remove dynobjects/areatriggers created at cast by creatures
- foreach (var creature in objs)
+ for (var i = 0; i < objs.Count; ++i)
{
+ Creature creature = objs[i];
creature.RemoveAllDynObjects();
creature.RemoveAllAreaTriggers();
diff --git a/Source/Game/Spells/SpellHistory.cs b/Source/Game/Spells/SpellHistory.cs
index 4d3c27f88..4afa6d054 100644
--- a/Source/Game/Spells/SpellHistory.cs
+++ b/Source/Game/Spells/SpellHistory.cs
@@ -709,7 +709,7 @@ namespace Game.Spells
else
recoveryStart = charges.LastOrDefault().RechargeEnd;
- charges.Add(new ChargeEntry(recoveryStart, TimeSpan.FromMilliseconds(chargeRecovery)));
+ _categoryCharges.Add(chargeCategoryId, new ChargeEntry(recoveryStart, TimeSpan.FromMilliseconds(chargeRecovery)));
return true;
}