Core/Misc: Misc Fixes
This commit is contained in:
@@ -32,11 +32,17 @@ namespace Framework.Collections
|
|||||||
|
|
||||||
public StringArray(string str, params string[] separator)
|
public StringArray(string str, params string[] separator)
|
||||||
{
|
{
|
||||||
|
if (str.IsEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
_str = str.Split(separator, StringSplitOptions.RemoveEmptyEntries);
|
_str = str.Split(separator, StringSplitOptions.RemoveEmptyEntries);
|
||||||
}
|
}
|
||||||
|
|
||||||
public StringArray(string str, params char[] separator)
|
public StringArray(string str, params char[] separator)
|
||||||
{
|
{
|
||||||
|
if (str.IsEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
_str = str.Split(separator, StringSplitOptions.RemoveEmptyEntries);
|
_str = str.Split(separator, StringSplitOptions.RemoveEmptyEntries);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,7 +57,12 @@ namespace Framework.Collections
|
|||||||
return _str.GetEnumerator();
|
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;
|
string[] _str;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,8 +80,6 @@ namespace Framework.Database
|
|||||||
// Populate and update only if updates are enabled for this pool
|
// Populate and update only if updates are enabled for this pool
|
||||||
_populate.Add(() =>
|
_populate.Add(() =>
|
||||||
{
|
{
|
||||||
//Hack used to allow big querys
|
|
||||||
database.Apply("SET GLOBAL max_allowed_packet=1073741824;");
|
|
||||||
if (!database.GetUpdater().Populate())
|
if (!database.GetUpdater().Populate())
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.ServerLoading, $"Could not populate the {database.GetDatabaseName()} database, see log for details.");
|
Log.outError(LogFilter.ServerLoading, $"Could not populate the {database.GetDatabaseName()} database, see log for details.");
|
||||||
@@ -92,8 +90,6 @@ namespace Framework.Database
|
|||||||
|
|
||||||
_update.Add(() =>
|
_update.Add(() =>
|
||||||
{
|
{
|
||||||
//Hack used to allow big querys
|
|
||||||
database.Apply("SET GLOBAL max_allowed_packet=1073741824;");
|
|
||||||
if (!database.GetUpdater().Update())
|
if (!database.GetUpdater().Update())
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.ServerLoading, $"Could not update the {database.GetDatabaseName()} database, see log for details.");
|
Log.outError(LogFilter.ServerLoading, $"Could not update the {database.GetDatabaseName()} database, see log for details.");
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ namespace Framework.Database
|
|||||||
public bool Populate()
|
public bool Populate()
|
||||||
{
|
{
|
||||||
SQLResult result = _database.Query("SHOW TABLES");
|
SQLResult result = _database.Query("SHOW TABLES");
|
||||||
if (!result.IsEmpty() && result.GetRowCount() > 0)
|
if (!result.IsEmpty() && !result.IsEmpty())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
Log.outInfo(LogFilter.SqlUpdates, $"Database {_database.GetDatabaseName()} is empty, auto populating it...");
|
Log.outInfo(LogFilter.SqlUpdates, $"Database {_database.GetDatabaseName()} is empty, auto populating it...");
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ namespace Framework.Database
|
|||||||
if (!hasNext)
|
if (!hasNext)
|
||||||
return QueryCallbackStatus.Completed;
|
return QueryCallbackStatus.Completed;
|
||||||
|
|
||||||
callback = _callbacks.Dequeue();
|
callback = _callbacks.Peek();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return QueryCallbackStatus.NotReady;
|
return QueryCallbackStatus.NotReady;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.CSharp" Version="4.4.1" />
|
<PackageReference Include="Microsoft.CSharp" Version="4.4.1" />
|
||||||
<PackageReference Include="MySql.Data" Version="6.10.6" />
|
<PackageReference Include="MySqlConnector" Version="0.40.4" />
|
||||||
<PackageReference Include="System.Reflection.Emit.Lightweight" Version="4.3.0" />
|
<PackageReference Include="System.Reflection.Emit.Lightweight" Version="4.3.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -452,7 +452,7 @@ namespace Game.Achievements
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
value -= timeDiff;
|
_timeCriteriaTrees[key] -= timeDiff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -539,7 +539,7 @@ namespace Game.Chat.Commands
|
|||||||
string accountName;
|
string accountName;
|
||||||
|
|
||||||
// "account" case, name can be get in same query
|
// "account" case, name can be get in same query
|
||||||
if (result.GetRowCount() > 1)
|
if (result.GetFieldCount() > 1)
|
||||||
accountName = result.Read<string>(1);
|
accountName = result.Read<string>(1);
|
||||||
// "character" case, name need extract from another DB
|
// "character" case, name need extract from another DB
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -71,8 +71,6 @@ namespace Game.Chat.Commands
|
|||||||
handler.SendSysMessage(CypherStrings.CommandGocreatnotfound);
|
handler.SendSysMessage(CypherStrings.CommandGocreatnotfound);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (result.GetRowCount() > 1)
|
|
||||||
handler.SendSysMessage(CypherStrings.CommandGocreatmultiple);
|
|
||||||
|
|
||||||
float x = result.Read<float>(0);
|
float x = result.Read<float>(0);
|
||||||
float y = result.Read<float>(1);
|
float y = result.Read<float>(1);
|
||||||
@@ -80,6 +78,9 @@ namespace Game.Chat.Commands
|
|||||||
float o = result.Read<float>(3);
|
float o = result.Read<float>(3);
|
||||||
uint mapId = result.Read<ushort>(4);
|
uint mapId = result.Read<ushort>(4);
|
||||||
|
|
||||||
|
if (result.NextRow())
|
||||||
|
handler.SendSysMessage(CypherStrings.CommandGocreatmultiple);
|
||||||
|
|
||||||
if (!GridDefines.IsValidMapCoord(mapId, x, y, z, o) || Global.ObjectMgr.IsTransportMap(mapId))
|
if (!GridDefines.IsValidMapCoord(mapId, x, y, z, o) || Global.ObjectMgr.IsTransportMap(mapId))
|
||||||
{
|
{
|
||||||
handler.SendSysMessage(CypherStrings.InvalidTargetCoord, x, y, mapId);
|
handler.SendSysMessage(CypherStrings.InvalidTargetCoord, x, y, mapId);
|
||||||
|
|||||||
@@ -210,15 +210,10 @@ namespace Game.Chat.Commands
|
|||||||
itemPos = "";
|
itemPos = "";
|
||||||
|
|
||||||
handler.SendSysMessage(CypherStrings.ItemlistSlot, itemGuid.ToString(), ownerName, ownerGuid.ToString(), ownerAccountId, itemPos);
|
handler.SendSysMessage(CypherStrings.ItemlistSlot, itemGuid.ToString(), ownerName, ownerGuid.ToString(), ownerAccountId, itemPos);
|
||||||
|
|
||||||
|
count--;
|
||||||
}
|
}
|
||||||
while (result.NextRow());
|
while (result.NextRow());
|
||||||
|
|
||||||
uint resultCount = (uint)result.GetRowCount();
|
|
||||||
|
|
||||||
if (count > resultCount)
|
|
||||||
count -= resultCount;
|
|
||||||
else if (count != 0)
|
|
||||||
count = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// mail case
|
// mail case
|
||||||
@@ -256,15 +251,10 @@ namespace Game.Chat.Commands
|
|||||||
string itemPos = "[in mail]";
|
string itemPos = "[in mail]";
|
||||||
|
|
||||||
handler.SendSysMessage(CypherStrings.ItemlistMail, itemGuid, itemSenderName, itemSender, itemSenderAccountId, itemReceiverName, itemReceiver, itemReceiverAccount, itemPos);
|
handler.SendSysMessage(CypherStrings.ItemlistMail, itemGuid, itemSenderName, itemSender, itemSenderAccountId, itemReceiverName, itemReceiver, itemReceiverAccount, itemPos);
|
||||||
|
|
||||||
|
count--;
|
||||||
}
|
}
|
||||||
while (result.NextRow());
|
while (result.NextRow());
|
||||||
|
|
||||||
uint resultCount = (uint)result.GetRowCount();
|
|
||||||
|
|
||||||
if (count > resultCount)
|
|
||||||
count -= resultCount;
|
|
||||||
else if (count != 0)
|
|
||||||
count = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// auction case
|
// auction case
|
||||||
@@ -329,15 +319,10 @@ namespace Game.Chat.Commands
|
|||||||
string itemPos = "[in guild bank]";
|
string itemPos = "[in guild bank]";
|
||||||
|
|
||||||
handler.SendSysMessage(CypherStrings.ItemlistGuild, itemGuid.ToString(), guildName, guildGuid.ToString(), itemPos);
|
handler.SendSysMessage(CypherStrings.ItemlistGuild, itemGuid.ToString(), guildName, guildGuid.ToString(), itemPos);
|
||||||
|
|
||||||
|
count--;
|
||||||
}
|
}
|
||||||
while (result.NextRow());
|
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)
|
if (inventoryCount + mailCount + auctionCount + guildCount == 0)
|
||||||
|
|||||||
@@ -2134,7 +2134,7 @@ namespace Game.Entities
|
|||||||
if (cainfo.path_id != 0)
|
if (cainfo.path_id != 0)
|
||||||
m_path_id = cainfo.path_id;
|
m_path_id = cainfo.path_id;
|
||||||
|
|
||||||
if (!cainfo.auras.Empty())
|
if (cainfo.auras != null)
|
||||||
{
|
{
|
||||||
foreach (var id in cainfo.auras)
|
foreach (var id in cainfo.auras)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4038,12 +4038,14 @@ namespace Game.Entities
|
|||||||
|
|
||||||
if (!result.IsEmpty())
|
if (!result.IsEmpty())
|
||||||
{
|
{
|
||||||
Log.outDebug(LogFilter.Player, "Player:DeleteOldChars: Found {0} character(s) to delete", result.GetRowCount());
|
int count = 0;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
DeleteFromDB(ObjectGuid.Create(HighGuid.Player, result.Read<ulong>(0)), result.Read<uint>(1), true, true);
|
DeleteFromDB(ObjectGuid.Create(HighGuid.Player, result.Read<ulong>(0)), result.Read<uint>(1), true, true);
|
||||||
|
count++;
|
||||||
}
|
}
|
||||||
while (result.NextRow());
|
while (result.NextRow());
|
||||||
|
Log.outDebug(LogFilter.Player, "Player:DeleteOldChars: Deleted {0} character(s)", count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -211,7 +211,7 @@ namespace Game
|
|||||||
{
|
{
|
||||||
{
|
{
|
||||||
uint oldMSTime = Time.GetMSTime();
|
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");
|
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())
|
if (result.IsEmpty())
|
||||||
{
|
{
|
||||||
@@ -267,7 +267,6 @@ namespace Game
|
|||||||
while (result.NextRow());
|
while (result.NextRow());
|
||||||
|
|
||||||
Log.outInfo(LogFilter.ServerLoading, "Loaded {0} game events in {1} ms", count, Time.GetMSTimeDiffToNow(oldMSTime));
|
Log.outInfo(LogFilter.ServerLoading, "Loaded {0} game events in {1} ms", count, Time.GetMSTimeDiffToNow(oldMSTime));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.outInfo(LogFilter.ServerLoading, "Loading Game Event Saves Data...");
|
Log.outInfo(LogFilter.ServerLoading, "Loading Game Event Saves Data...");
|
||||||
@@ -276,7 +275,6 @@ namespace Game
|
|||||||
|
|
||||||
// 0 1 2
|
// 0 1 2
|
||||||
SQLResult result = DB.Characters.Query("SELECT eventEntry, state, next_start FROM game_event_save");
|
SQLResult result = DB.Characters.Query("SELECT eventEntry, state, next_start FROM game_event_save");
|
||||||
|
|
||||||
if (result.IsEmpty())
|
if (result.IsEmpty())
|
||||||
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 game event saves in game events. DB table `game_event_save` is empty.");
|
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 game event saves in game events. DB table `game_event_save` is empty.");
|
||||||
else
|
else
|
||||||
@@ -354,7 +352,6 @@ namespace Game
|
|||||||
while (result.NextRow());
|
while (result.NextRow());
|
||||||
|
|
||||||
Log.outInfo(LogFilter.ServerLoading, "Loaded {0} game event prerequisites in game events in {1} ms", count, Time.GetMSTimeDiffToNow(oldMSTime));
|
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
|
// 0 1
|
||||||
SQLResult result = DB.World.Query("SELECT guid, eventEntry FROM game_event_creature");
|
SQLResult result = DB.World.Query("SELECT guid, eventEntry FROM game_event_creature");
|
||||||
|
|
||||||
if (result.IsEmpty())
|
if (result.IsEmpty())
|
||||||
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 creatures in game events. DB table `game_event_creature` is empty");
|
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 creatures in game events. DB table `game_event_creature` is empty");
|
||||||
else
|
else
|
||||||
@@ -395,7 +391,6 @@ namespace Game
|
|||||||
while (result.NextRow());
|
while (result.NextRow());
|
||||||
|
|
||||||
Log.outInfo(LogFilter.ServerLoading, "Loaded {0} creatures in game events in {1} ms", count, Time.GetMSTimeDiffToNow(oldMSTime));
|
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
|
// 0 1
|
||||||
SQLResult result = DB.World.Query("SELECT guid, eventEntry FROM game_event_gameobject");
|
SQLResult result = DB.World.Query("SELECT guid, eventEntry FROM game_event_gameobject");
|
||||||
|
|
||||||
if (result.IsEmpty())
|
if (result.IsEmpty())
|
||||||
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 gameobjects in game events. DB table `game_event_gameobject` is empty.");
|
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 gameobjects in game events. DB table `game_event_gameobject` is empty.");
|
||||||
else
|
else
|
||||||
@@ -446,8 +440,7 @@ namespace Game
|
|||||||
|
|
||||||
// 0 1 2 3 4
|
// 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 " +
|
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())
|
if (result.IsEmpty())
|
||||||
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 model/equipment changes in game events. DB table `game_event_model_equip` is empty.");
|
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 model/equipment changes in game events. DB table `game_event_model_equip` is empty.");
|
||||||
else
|
else
|
||||||
@@ -498,7 +491,6 @@ namespace Game
|
|||||||
|
|
||||||
// 0 1 2
|
// 0 1 2
|
||||||
SQLResult result = DB.World.Query("SELECT id, quest, eventEntry FROM game_event_creature_quest");
|
SQLResult result = DB.World.Query("SELECT id, quest, eventEntry FROM game_event_creature_quest");
|
||||||
|
|
||||||
if (result.IsEmpty())
|
if (result.IsEmpty())
|
||||||
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 quests additions in game events. DB table `game_event_creature_quest` is empty.");
|
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 quests additions in game events. DB table `game_event_creature_quest` is empty.");
|
||||||
else
|
else
|
||||||
@@ -532,7 +524,6 @@ namespace Game
|
|||||||
|
|
||||||
// 0 1 2
|
// 0 1 2
|
||||||
SQLResult result = DB.World.Query("SELECT id, quest, eventEntry FROM game_event_gameobject_quest");
|
SQLResult result = DB.World.Query("SELECT id, quest, eventEntry FROM game_event_gameobject_quest");
|
||||||
|
|
||||||
if (result.IsEmpty())
|
if (result.IsEmpty())
|
||||||
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 go quests additions in game events. DB table `game_event_gameobject_quest` is empty.");
|
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 go quests additions in game events. DB table `game_event_gameobject_quest` is empty.");
|
||||||
else
|
else
|
||||||
@@ -566,7 +557,6 @@ namespace Game
|
|||||||
|
|
||||||
// 0 1 2 3
|
// 0 1 2 3
|
||||||
SQLResult result = DB.World.Query("SELECT quest, eventEntry, condition_id, num FROM game_event_quest_condition");
|
SQLResult result = DB.World.Query("SELECT quest, eventEntry, condition_id, num FROM game_event_quest_condition");
|
||||||
|
|
||||||
if (result.IsEmpty())
|
if (result.IsEmpty())
|
||||||
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 quest event conditions in game events. DB table `game_event_quest_condition` is empty.");
|
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 quest event conditions in game events. DB table `game_event_quest_condition` is empty.");
|
||||||
else
|
else
|
||||||
@@ -606,7 +596,6 @@ namespace Game
|
|||||||
|
|
||||||
// 0 1 2 3 4
|
// 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");
|
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())
|
if (result.IsEmpty())
|
||||||
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 conditions in game events. DB table `game_event_condition` is empty.");
|
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 conditions in game events. DB table `game_event_condition` is empty.");
|
||||||
else
|
else
|
||||||
@@ -642,7 +631,6 @@ namespace Game
|
|||||||
|
|
||||||
// 0 1 2
|
// 0 1 2
|
||||||
SQLResult result = DB.Characters.Query("SELECT eventEntry, condition_id, done FROM game_event_condition_save");
|
SQLResult result = DB.Characters.Query("SELECT eventEntry, condition_id, done FROM game_event_condition_save");
|
||||||
|
|
||||||
if (result.IsEmpty())
|
if (result.IsEmpty())
|
||||||
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 condition saves in game events. DB table `game_event_condition_save` is empty.");
|
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 condition saves in game events. DB table `game_event_condition_save` is empty.");
|
||||||
else
|
else
|
||||||
@@ -683,7 +671,6 @@ namespace Game
|
|||||||
|
|
||||||
// 0 1 2
|
// 0 1 2
|
||||||
SQLResult result = DB.World.Query("SELECT guid, eventEntry, npcflag FROM game_event_npcflag");
|
SQLResult result = DB.World.Query("SELECT guid, eventEntry, npcflag FROM game_event_npcflag");
|
||||||
|
|
||||||
if (result.IsEmpty())
|
if (result.IsEmpty())
|
||||||
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 npcflags in game events. DB table `game_event_npcflag` is empty.");
|
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 npcflags in game events. DB table `game_event_npcflag` is empty.");
|
||||||
else
|
else
|
||||||
@@ -717,7 +704,6 @@ namespace Game
|
|||||||
|
|
||||||
// 0 1
|
// 0 1
|
||||||
SQLResult result = DB.World.Query("SELECT questId, eventEntry FROM game_event_seasonal_questrelation");
|
SQLResult result = DB.World.Query("SELECT questId, eventEntry FROM game_event_seasonal_questrelation");
|
||||||
|
|
||||||
if (result.IsEmpty())
|
if (result.IsEmpty())
|
||||||
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 seasonal quests additions in game events. DB table `game_event_seasonal_questrelation` is empty.");
|
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 seasonal quests additions in game events. DB table `game_event_seasonal_questrelation` is empty.");
|
||||||
else
|
else
|
||||||
@@ -753,9 +739,8 @@ namespace Game
|
|||||||
{
|
{
|
||||||
uint oldMSTime = Time.GetMSTime();
|
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");
|
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())
|
if (result.IsEmpty())
|
||||||
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 vendor additions in game events. DB table `game_event_npc_vendor` is empty.");
|
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 vendor additions in game events. DB table `game_event_npc_vendor` is empty.");
|
||||||
else
|
else
|
||||||
@@ -799,8 +784,9 @@ namespace Game
|
|||||||
vItem.IgnoreFiltering = result.Read<bool>(9);
|
vItem.IgnoreFiltering = result.Read<bool>(9);
|
||||||
|
|
||||||
var bonusListIDsTok = new StringArray(result.Read<string>(7), ' ');
|
var bonusListIDsTok = new StringArray(result.Read<string>(7), ' ');
|
||||||
foreach (uint token in bonusListIDsTok)
|
if (!bonusListIDsTok.IsEmpty())
|
||||||
vItem.BonusListIDs.Add(token);
|
foreach (uint token in bonusListIDsTok)
|
||||||
|
vItem.BonusListIDs.Add(token);
|
||||||
|
|
||||||
// check validity with event's npcflag
|
// check validity with event's npcflag
|
||||||
if (!Global.ObjectMgr.IsVendorItemValid(entry, vItem, null, null, event_npc_flag))
|
if (!Global.ObjectMgr.IsVendorItemValid(entry, vItem, null, null, event_npc_flag))
|
||||||
@@ -822,7 +808,6 @@ namespace Game
|
|||||||
|
|
||||||
// 0 1
|
// 0 1
|
||||||
SQLResult result = DB.World.Query("SELECT eventEntry, bgflag FROM game_event_battleground_holiday");
|
SQLResult result = DB.World.Query("SELECT eventEntry, bgflag FROM game_event_battleground_holiday");
|
||||||
|
|
||||||
if (result.IsEmpty())
|
if (result.IsEmpty())
|
||||||
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 Battlegroundholidays in game events. DB table `game_event_battleground_holiday` is empty.");
|
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 Battlegroundholidays in game events. DB table `game_event_battleground_holiday` is empty.");
|
||||||
else
|
else
|
||||||
@@ -854,8 +839,7 @@ namespace Game
|
|||||||
|
|
||||||
// 0 1
|
// 0 1
|
||||||
SQLResult result = DB.World.Query("SELECT pool_template.entry, game_event_pool.eventEntry FROM pool_template" +
|
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())
|
if (result.IsEmpty())
|
||||||
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 pools for game events. DB table `game_event_pool` is empty.");
|
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 pools for game events. DB table `game_event_pool` is empty.");
|
||||||
else
|
else
|
||||||
@@ -958,7 +942,6 @@ namespace Game
|
|||||||
{
|
{
|
||||||
int season = WorldConfig.GetIntValue(WorldCfg.ArenaSeasonId);
|
int season = WorldConfig.GetIntValue(WorldCfg.ArenaSeasonId);
|
||||||
SQLResult result = DB.World.Query("SELECT eventEntry FROM game_event_arena_seasons WHERE season = '{0}'", season);
|
SQLResult result = DB.World.Query("SELECT eventEntry FROM game_event_arena_seasons WHERE season = '{0}'", season);
|
||||||
|
|
||||||
if (result.IsEmpty())
|
if (result.IsEmpty())
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Gameevent, "ArenaSeason ({0}) must be an existant Arena Season", season);
|
Log.outError(LogFilter.Gameevent, "ArenaSeason ({0}) must be an existant Arena Season", season);
|
||||||
@@ -975,7 +958,6 @@ namespace Game
|
|||||||
|
|
||||||
StartEvent(eventId, true);
|
StartEvent(eventId, true);
|
||||||
Log.outInfo(LogFilter.Gameevent, "Arena Season {0} started...", season);
|
Log.outInfo(LogFilter.Gameevent, "Arena Season {0} started...", season);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public uint Update() // return the next event delay in ms
|
public uint Update() // return the next event delay in ms
|
||||||
|
|||||||
@@ -9186,7 +9186,7 @@ namespace Game
|
|||||||
_equipmentSetGuid = result.Read<ulong>(0) + 1;
|
_equipmentSetGuid = result.Read<ulong>(0) + 1;
|
||||||
|
|
||||||
result = DB.Characters.Query("SELECT MAX(guildId) FROM guild");
|
result = DB.Characters.Query("SELECT MAX(guildId) FROM guild");
|
||||||
if (result.GetRowCount() == 1)
|
if (!result.IsEmpty())
|
||||||
Global.GuildMgr.SetNextGuildId(result.Read<uint>(0) + 1);
|
Global.GuildMgr.SetNextGuildId(result.Read<uint>(0) + 1);
|
||||||
|
|
||||||
result = DB.Characters.Query("SELECT MAX(itemId) from character_void_storage");
|
result = DB.Characters.Query("SELECT MAX(itemId) from character_void_storage");
|
||||||
|
|||||||
@@ -401,30 +401,20 @@ namespace Game
|
|||||||
{
|
{
|
||||||
uint oldMSTime = Time.GetMSTime();
|
uint oldMSTime = Time.GetMSTime();
|
||||||
|
|
||||||
long achievementCount = 0;
|
|
||||||
long criteriaCount = 0;
|
|
||||||
|
|
||||||
SQLResult achievementResult;
|
|
||||||
SQLResult criteriaResult;
|
|
||||||
foreach (var pair in GuildStore)
|
foreach (var pair in GuildStore)
|
||||||
{
|
{
|
||||||
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_GUILD_ACHIEVEMENT);
|
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_GUILD_ACHIEVEMENT);
|
||||||
stmt.AddValue(0, pair.Key);
|
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 = DB.Characters.GetPreparedStatement(CharStatements.SEL_GUILD_ACHIEVEMENT_CRITERIA);
|
||||||
stmt.AddValue(0, pair.Key);
|
stmt.AddValue(0, pair.Key);
|
||||||
criteriaResult = DB.Characters.Query(stmt);
|
SQLResult criteriaResult = DB.Characters.Query(stmt);
|
||||||
|
|
||||||
if (!achievementResult.IsEmpty())
|
|
||||||
achievementCount += achievementResult.GetRowCount();
|
|
||||||
if (!criteriaResult.IsEmpty())
|
|
||||||
criteriaCount += criteriaResult.GetRowCount();
|
|
||||||
|
|
||||||
pair.Value.GetAchievementMgr().LoadFromDB(achievementResult, criteriaResult);
|
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
|
// 11. Validate loaded guild data
|
||||||
|
|||||||
@@ -143,17 +143,13 @@ namespace Game
|
|||||||
stmt.AddValue(0, packet.Item.GetCounter());
|
stmt.AddValue(0, packet.Item.GetCounter());
|
||||||
SQLResult result = DB.Characters.Query(stmt);
|
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();
|
ServerPetitionShowSignatures signaturesPacket = new ServerPetitionShowSignatures();
|
||||||
signaturesPacket.Item = packet.Item;
|
signaturesPacket.Item = packet.Item;
|
||||||
signaturesPacket.Owner = GetPlayer().GetGUID();
|
signaturesPacket.Owner = GetPlayer().GetGUID();
|
||||||
signaturesPacket.OwnerAccountID = ObjectGuid.Create(HighGuid.WowAccount, ObjectManager.GetPlayerAccountIdByGUID(GetPlayer().GetGUID()));
|
signaturesPacket.OwnerAccountID = ObjectGuid.Create(HighGuid.WowAccount, ObjectManager.GetPlayerAccountIdByGUID(GetPlayer().GetGUID()));
|
||||||
signaturesPacket.PetitionID = (int)packet.Item.GetCounter(); // @todo verify that...
|
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<ulong>(0));
|
ObjectGuid signerGUID = ObjectGuid.Create(HighGuid.Player, result.Read<ulong>(0));
|
||||||
|
|
||||||
@@ -161,9 +157,9 @@ namespace Game
|
|||||||
signature.Signer = signerGUID;
|
signature.Signer = signerGUID;
|
||||||
signature.Choice = 0;
|
signature.Choice = 0;
|
||||||
signaturesPacket.Signatures.Add(signature);
|
signaturesPacket.Signatures.Add(signature);
|
||||||
|
|
||||||
result.NextRow();
|
|
||||||
}
|
}
|
||||||
|
while (result.NextRow());
|
||||||
|
|
||||||
SendPacket(signaturesPacket);
|
SendPacket(signaturesPacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -371,18 +367,13 @@ namespace Game
|
|||||||
stmt.AddValue(0, packet.ItemGUID.GetCounter());
|
stmt.AddValue(0, packet.ItemGUID.GetCounter());
|
||||||
SQLResult result = DB.Characters.Query(stmt);
|
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();
|
ServerPetitionShowSignatures signaturesPacket = new ServerPetitionShowSignatures();
|
||||||
signaturesPacket.Item = packet.ItemGUID;
|
signaturesPacket.Item = packet.ItemGUID;
|
||||||
signaturesPacket.Owner = GetPlayer().GetGUID();
|
signaturesPacket.Owner = GetPlayer().GetGUID();
|
||||||
signaturesPacket.OwnerAccountID = ObjectGuid.Create(HighGuid.WowAccount, player.GetSession().GetAccountId());
|
signaturesPacket.OwnerAccountID = ObjectGuid.Create(HighGuid.WowAccount, player.GetSession().GetAccountId());
|
||||||
signaturesPacket.PetitionID = (int)packet.ItemGUID.GetCounter(); // @todo verify that...
|
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<ulong>(0));
|
ObjectGuid signerGUID = ObjectGuid.Create(HighGuid.Player, result.Read<ulong>(0));
|
||||||
|
|
||||||
@@ -390,9 +381,8 @@ namespace Game
|
|||||||
signature.Signer = signerGUID;
|
signature.Signer = signerGUID;
|
||||||
signature.Choice = 0;
|
signature.Choice = 0;
|
||||||
signaturesPacket.Signatures.Add(signature);
|
signaturesPacket.Signatures.Add(signature);
|
||||||
|
|
||||||
result.NextRow();
|
|
||||||
}
|
}
|
||||||
|
while (result.NextRow());
|
||||||
|
|
||||||
player.SendPacket(signaturesPacket);
|
player.SendPacket(signaturesPacket);
|
||||||
}
|
}
|
||||||
@@ -452,15 +442,20 @@ namespace Game
|
|||||||
stmt.AddValue(0, packet.Item.GetCounter());
|
stmt.AddValue(0, packet.Item.GetCounter());
|
||||||
result = DB.Characters.Query(stmt);
|
result = DB.Characters.Query(stmt);
|
||||||
|
|
||||||
|
List<ObjectGuid> guids = new List<ObjectGuid>();
|
||||||
if (!result.IsEmpty())
|
if (!result.IsEmpty())
|
||||||
signatures = (byte)result.GetRowCount();
|
{
|
||||||
else
|
do
|
||||||
signatures = 0;
|
{
|
||||||
|
guids.Add(ObjectGuid.Create(HighGuid.Player, result.Read<ulong>(0)));
|
||||||
|
}
|
||||||
|
while (result.NextRow());
|
||||||
|
}
|
||||||
|
|
||||||
uint requiredSignatures = WorldConfig.GetUIntValue(WorldCfg.MinPetitionSigns);
|
uint requiredSignatures = WorldConfig.GetUIntValue(WorldCfg.MinPetitionSigns);
|
||||||
|
|
||||||
// Notify player if signatures are missing
|
// Notify player if signatures are missing
|
||||||
if (signatures < requiredSignatures)
|
if (guids.Count < requiredSignatures)
|
||||||
{
|
{
|
||||||
resultPacket.Result = PetitionTurns.NeedMoreSignatures;
|
resultPacket.Result = PetitionTurns.NeedMoreSignatures;
|
||||||
SendPacket(resultPacket);
|
SendPacket(resultPacket);
|
||||||
@@ -484,14 +479,8 @@ namespace Game
|
|||||||
SQLTransaction trans = new SQLTransaction();
|
SQLTransaction trans = new SQLTransaction();
|
||||||
|
|
||||||
// Add members from signatures
|
// Add members from signatures
|
||||||
for (byte i = 0; i < signatures; ++i)
|
foreach (var guid in guids)
|
||||||
{
|
guild.AddMember(trans, guid);
|
||||||
guild.AddMember(trans, ObjectGuid.Create(HighGuid.Player, result.Read<ulong>(0)));
|
|
||||||
|
|
||||||
// Checking the return value just to be double safe
|
|
||||||
if (!result.NextRow())
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_PETITION_BY_GUID);
|
stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_PETITION_BY_GUID);
|
||||||
stmt.AddValue(0, packet.Item.GetCounter());
|
stmt.AddValue(0, packet.Item.GetCounter());
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ namespace Game.Maps
|
|||||||
gridInfo.UpdateTimeTracker(diff);
|
gridInfo.UpdateTimeTracker(diff);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update(Map m, uint diff)
|
public void Update(Map map, uint diff)
|
||||||
{
|
{
|
||||||
switch (GetGridState())
|
switch (GetGridState())
|
||||||
{
|
{
|
||||||
@@ -207,24 +207,24 @@ namespace Game.Maps
|
|||||||
getGridInfoRef().UpdateTimeTracker(diff);
|
getGridInfoRef().UpdateTimeTracker(diff);
|
||||||
if (getGridInfoRef().getTimeTracker().Passed())
|
if (getGridInfoRef().getTimeTracker().Passed())
|
||||||
{
|
{
|
||||||
if (GetWorldObjectCountInNGrid<Player>() == 0 && !m.ActiveObjectsNearGrid(this))
|
if (GetWorldObjectCountInNGrid<Player>() == 0 && !map.ActiveObjectsNearGrid(this))
|
||||||
{
|
{
|
||||||
ObjectGridStoper worker = new ObjectGridStoper();
|
ObjectGridStoper worker = new ObjectGridStoper();
|
||||||
var visitor = new Visitor(worker, GridMapTypeMask.AllGrid);
|
var visitor = new Visitor(worker, GridMapTypeMask.AllGrid);
|
||||||
VisitAllGrids(visitor);
|
VisitAllGrids(visitor);
|
||||||
SetGridState(GridState.Idle);
|
SetGridState(GridState.Idle);
|
||||||
Log.outDebug(LogFilter.Maps, "Grid[{0}, {1}] on map {2} moved to IDLE state", getX(), getY(),
|
Log.outDebug(LogFilter.Maps, "Grid[{0}, {1}] on map {2} moved to IDLE state", getX(), getY(),
|
||||||
m.GetId());
|
map.GetId());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m.ResetGridExpiry(this, 0.1f);
|
map.ResetGridExpiry(this, 0.1f);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GridState.Idle:
|
case GridState.Idle:
|
||||||
m.ResetGridExpiry(this);
|
map.ResetGridExpiry(this);
|
||||||
SetGridState(GridState.Removal);
|
SetGridState(GridState.Removal);
|
||||||
Log.outDebug(LogFilter.Maps, "Grid[{0}, {1}] on map {2} moved to REMOVAL state", getX(), getY(),
|
Log.outDebug(LogFilter.Maps, "Grid[{0}, {1}] on map {2} moved to REMOVAL state", getX(), getY(),
|
||||||
m.GetId());
|
map.GetId());
|
||||||
break;
|
break;
|
||||||
case GridState.Removal:
|
case GridState.Removal:
|
||||||
if (!getGridInfoRef().getUnloadLock())
|
if (!getGridInfoRef().getUnloadLock())
|
||||||
@@ -232,12 +232,12 @@ namespace Game.Maps
|
|||||||
getGridInfoRef().UpdateTimeTracker(diff);
|
getGridInfoRef().UpdateTimeTracker(diff);
|
||||||
if (getGridInfoRef().getTimeTracker().Passed())
|
if (getGridInfoRef().getTimeTracker().Passed())
|
||||||
{
|
{
|
||||||
if (!m.UnloadGrid(this, false))
|
if (!map.UnloadGrid(this, false))
|
||||||
{
|
{
|
||||||
Log.outDebug(LogFilter.Maps,
|
Log.outDebug(LogFilter.Maps,
|
||||||
"Grid[{0}, {1}] for map {2} differed unloading due to players or active objects nearby",
|
"Grid[{0}, {1}] for map {2} differed unloading due to players or active objects nearby",
|
||||||
getX(), getY(), m.GetId());
|
getX(), getY(), map.GetId());
|
||||||
m.ResetGridExpiry(this);
|
map.ResetGridExpiry(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -477,8 +477,9 @@ namespace Game.Maps
|
|||||||
|
|
||||||
public override void Visit(IList<WorldObject> objs)
|
public override void Visit(IList<WorldObject> 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))
|
if (obj.IsTypeId(TypeId.Player) || obj.IsTypeId(TypeId.Corpse))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|||||||
@@ -79,10 +79,9 @@ namespace Game.Maps
|
|||||||
|
|
||||||
void LoadHelper<T>(SortedSet<ulong> guid_set, CellCoord cell, ref uint count, Map map) where T : WorldObject, new()
|
void LoadHelper<T>(SortedSet<ulong> 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();
|
T obj = new T();
|
||||||
ulong guid = i_guid;
|
|
||||||
if (!obj.LoadFromDB(guid, map))
|
if (!obj.LoadFromDB(guid, map))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -162,8 +161,9 @@ namespace Game.Maps
|
|||||||
public override void Visit(IList<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
|
// 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.RemoveAllDynObjects();
|
||||||
creature.RemoveAllAreaTriggers();
|
creature.RemoveAllAreaTriggers();
|
||||||
|
|
||||||
|
|||||||
@@ -709,7 +709,7 @@ namespace Game.Spells
|
|||||||
else
|
else
|
||||||
recoveryStart = charges.LastOrDefault().RechargeEnd;
|
recoveryStart = charges.LastOrDefault().RechargeEnd;
|
||||||
|
|
||||||
charges.Add(new ChargeEntry(recoveryStart, TimeSpan.FromMilliseconds(chargeRecovery)));
|
_categoryCharges.Add(chargeCategoryId, new ChargeEntry(recoveryStart, TimeSpan.FromMilliseconds(chargeRecovery)));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user