Core/DB: Fixes sometimes wrong values added to DB, also fixes errors when trying to convert updatefield to object.

This commit is contained in:
hondacrx
2021-04-21 18:06:46 -04:00
parent 897ca11273
commit ba064327b0
30 changed files with 149 additions and 89 deletions
+4 -4
View File
@@ -65,7 +65,7 @@ namespace Game.Chat
{
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHANNEL);
stmt.AddValue(0, _channelName);
stmt.AddValue(1, _channelTeam);
stmt.AddValue(1, (uint)_channelTeam);
SQLResult result = DB.Characters.Query(stmt);
if (!result.IsEmpty()) //load
@@ -97,7 +97,7 @@ namespace Game.Chat
{
stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHANNEL);
stmt.AddValue(0, _channelName);
stmt.AddValue(1, _channelTeam);
stmt.AddValue(1, (uint)_channelTeam);
DB.Characters.Execute(stmt);
Log.outDebug(LogFilter.ChatSystem, "Channel({0}) saved in database", _channelName);
}
@@ -145,7 +145,7 @@ namespace Game.Chat
stmt.AddValue(2, _channelPassword);
stmt.AddValue(3, banlist);
stmt.AddValue(4, _channelName);
stmt.AddValue(5, _channelTeam);
stmt.AddValue(5, (uint)_channelTeam);
DB.Characters.Execute(stmt);
Log.outDebug(LogFilter.ChatSystem, "Channel({0}) updated in database", _channelName);
@@ -156,7 +156,7 @@ namespace Game.Chat
{
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHANNEL_USAGE);
stmt.AddValue(0, _channelName);
stmt.AddValue(1, _channelTeam);
stmt.AddValue(1, (uint)_channelTeam);
DB.Characters.Execute(stmt);
}
@@ -185,7 +185,7 @@ namespace Game.Chat
handler.SendSysMessage(CypherStrings.RenamePlayerGuid, oldNameLink, targetGuid.ToString());
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_ADD_AT_LOGIN_FLAG);
stmt.AddValue(0, AtLoginFlags.Rename);
stmt.AddValue(0, (ushort)AtLoginFlags.Rename);
stmt.AddValue(1, targetGuid.GetCounter());
DB.Characters.Execute(stmt);
}
@@ -248,7 +248,7 @@ namespace Game.Chat
return false;
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_ADD_AT_LOGIN_FLAG);
stmt.AddValue(0, AtLoginFlags.Customize);
stmt.AddValue(0, (ushort)AtLoginFlags.Customize);
if (target)
{
handler.SendSysMessage(CypherStrings.CustomizePlayer, handler.GetNameLink(target));
@@ -350,7 +350,7 @@ namespace Game.Chat
return false;
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_ADD_AT_LOGIN_FLAG);
stmt.AddValue(0, AtLoginFlags.ChangeFaction);
stmt.AddValue(0, (ushort)AtLoginFlags.ChangeFaction);
if (target)
{
handler.SendSysMessage(CypherStrings.CustomizePlayer, handler.GetNameLink(target));
@@ -378,7 +378,7 @@ namespace Game.Chat
return false;
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_ADD_AT_LOGIN_FLAG);
stmt.AddValue(0, AtLoginFlags.ChangeRace);
stmt.AddValue(0, (ushort)AtLoginFlags.ChangeRace);
if (target)
{
// @todo add text into database
+4 -4
View File
@@ -129,7 +129,7 @@ namespace Game.Chat.Commands
PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.SEL_DISABLES);
stmt.AddValue(0, entry);
stmt.AddValue(1, disableType);
stmt.AddValue(1, (byte)disableType);
SQLResult result = DB.World.Query(stmt);
if (!result.IsEmpty())
{
@@ -139,7 +139,7 @@ namespace Game.Chat.Commands
stmt = DB.World.GetPreparedStatement(WorldStatements.INS_DISABLES);
stmt.AddValue(0, entry);
stmt.AddValue(1, disableType);
stmt.AddValue(1, (byte)disableType);
stmt.AddValue(2, flags);
stmt.AddValue(3, disableComment);
DB.World.Execute(stmt);
@@ -261,7 +261,7 @@ namespace Game.Chat.Commands
PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.SEL_DISABLES);
stmt.AddValue(0, entry);
stmt.AddValue(1, disableType);
stmt.AddValue(1, (byte)disableType);
SQLResult result = DB.World.Query(stmt);
if (result.IsEmpty())
{
@@ -271,7 +271,7 @@ namespace Game.Chat.Commands
stmt = DB.World.GetPreparedStatement(WorldStatements.DEL_DISABLES);
stmt.AddValue(0, entry);
stmt.AddValue(1, disableType);
stmt.AddValue(1, (byte)disableType);
DB.World.Execute(stmt);
handler.SendSysMessage("Remove Disabled {0} (Id: {1})", disableTypeStr, entry);
+1 -1
View File
@@ -169,7 +169,7 @@ namespace Game.Chat
{
// Get the accounts with GM Level >0
PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_GM_ACCOUNTS);
stmt.AddValue(0, AccountTypes.Moderator);
stmt.AddValue(0, (byte)AccountTypes.Moderator);
stmt.AddValue(1, Global.WorldMgr.GetRealm().Id.Index);
SQLResult result = DB.Login.Query(stmt);
+2 -2
View File
@@ -772,7 +772,7 @@ namespace Game.Chat
// Update movement type
PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.UPD_CREATURE_MOVEMENT_TYPE);
stmt.AddValue(0, MovementGeneratorType.Waypoint);
stmt.AddValue(0, (byte)MovementGeneratorType.Waypoint);
stmt.AddValue(1, lowGuid);
DB.World.Execute(stmt);
@@ -1435,7 +1435,7 @@ namespace Game.Chat
PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.UPD_CREATURE_SPAWN_DISTANCE);
stmt.AddValue(0, option);
stmt.AddValue(1, mtype);
stmt.AddValue(1, (byte)mtype);
stmt.AddValue(2, guidLow);
DB.World.Execute(stmt);