diff --git a/Source/Game/Chat/Commands/ListCommands.cs b/Source/Game/Chat/Commands/ListCommands.cs index ca7ea998f..62aeb087f 100644 --- a/Source/Game/Chat/Commands/ListCommands.cs +++ b/Source/Game/Chat/Commands/ListCommands.cs @@ -342,7 +342,6 @@ namespace Game.Chat.Commands Player target; ObjectGuid targetGuid; string targetName; - PreparedStatement stmt = null; ObjectGuid parseGUID = ObjectGuid.Create(HighGuid.Player, args.NextUInt64()); if (Global.CharacterCacheStorage.GetCharacterNameByGuid(parseGUID, out targetName)) @@ -353,7 +352,7 @@ namespace Game.Chat.Commands else if (!handler.ExtractPlayerTarget(args, out target, out targetGuid, out targetName)) return false; - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_MAIL_LIST_COUNT); + PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_MAIL_LIST_COUNT); stmt.AddValue(0, targetGuid.GetCounter()); SQLResult result = DB.Characters.Query(stmt); if (!result.IsEmpty()) @@ -408,18 +407,19 @@ namespace Game.Chat.Commands { uint item_entry = result3.Read(0); uint item_count = result3.Read(1); - SQLResult result4 = DB.World.Query("SELECT name, quality FROM item_template WHERE entry = '{0}'", item_entry); - string item_name = result4.Read(0); - int item_quality = result4.Read(1); + ItemTemplate itemTemplate = Global.ObjectMgr.GetItemTemplate(item_entry); + if (itemTemplate == null) + continue; + if (handler.GetSession() != null) { - uint color = ItemConst.ItemQualityColors[item_quality]; - string itemStr = "|c" + color + "|Hitem:" + item_entry + ":0:0:0:0:0:0:0:0:0|h[" + item_name + "]|h|r"; + uint color = ItemConst.ItemQualityColors[(int)itemTemplate.GetQuality()]; + string itemStr = $"|c{color}|Hitem:{item_entry}:0:0:0:0:0:0:0:{handler.GetSession().GetPlayer().GetLevel()}:0:0:0:0:0|h[{itemTemplate.GetName(handler.GetSessionDbcLocale())}]|h|r"; handler.SendSysMessage(CypherStrings.ListMailInfoItem, itemStr, item_entry, item_guid, item_count); } else - handler.SendSysMessage(CypherStrings.ListMailInfoItem, item_name, item_entry, item_guid, item_count); + handler.SendSysMessage(CypherStrings.ListMailInfoItem, itemTemplate.GetName(handler.GetSessionDbcLocale()), item_entry, item_guid, item_count); } while (result3.NextRow()); } diff --git a/Source/Game/Chat/Commands/LookupCommands.cs b/Source/Game/Chat/Commands/LookupCommands.cs index 763b28b16..9d9cbec04 100644 --- a/Source/Game/Chat/Commands/LookupCommands.cs +++ b/Source/Game/Chat/Commands/LookupCommands.cs @@ -319,7 +319,7 @@ namespace Game.Chat bool found = false; uint count = 0; - // Search in `item_template` + // Search in ItemSparse var its = Global.ObjectMgr.GetItemTemplates(); foreach (var template in its.Values) { diff --git a/Source/Game/Conditions/ConditionManager.cs b/Source/Game/Conditions/ConditionManager.cs index aa8001e10..3db7878bc 100644 --- a/Source/Game/Conditions/ConditionManager.cs +++ b/Source/Game/Conditions/ConditionManager.cs @@ -735,7 +735,7 @@ namespace Game ItemTemplate pItemProto = Global.ObjectMgr.GetItemTemplate((uint)cond.SourceEntry); if (pItemProto == null && !loot.IsReference((uint)cond.SourceEntry)) { - Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, does not exist in `item_template`, ignoring.", cond.ToString()); + Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, Item does not exist, ignoring.", cond.ToString()); return false; } break; @@ -752,7 +752,7 @@ namespace Game ItemTemplate pItemProto = Global.ObjectMgr.GetItemTemplate((uint)cond.SourceEntry); if (pItemProto == null && !loot.IsReference((uint)cond.SourceEntry)) { - Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, does not exist in `item_template`, ignoring.", cond.ToString()); + Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, item does not exist, ignoring.", cond.ToString()); return false; } break; @@ -769,7 +769,7 @@ namespace Game ItemTemplate pItemProto = Global.ObjectMgr.GetItemTemplate((uint)cond.SourceEntry); if (pItemProto == null && !loot.IsReference((uint)cond.SourceEntry)) { - Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, does not exist in `item_template`, ignoring.", cond.ToString()); + Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, item does not exist, ignoring.", cond.ToString()); return false; } break; @@ -786,7 +786,7 @@ namespace Game ItemTemplate pItemProto = Global.ObjectMgr.GetItemTemplate((uint)cond.SourceEntry); if (pItemProto == null && !loot.IsReference((uint)cond.SourceEntry)) { - Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, does not exist in `item_template`, ignoring.", cond.ToString()); + Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, item does not exist, ignoring.", cond.ToString()); return false; } break; @@ -803,7 +803,7 @@ namespace Game ItemTemplate pItemProto = Global.ObjectMgr.GetItemTemplate((uint)cond.SourceEntry); if (pItemProto == null && !loot.IsReference((uint)cond.SourceEntry)) { - Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, does not exist in `item_template`, ignoring.", cond.ToString()); + Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, item does not exist, ignoring.", cond.ToString()); return false; } break; @@ -820,7 +820,7 @@ namespace Game ItemTemplate pItemProto = Global.ObjectMgr.GetItemTemplate((uint)cond.SourceEntry); if (pItemProto == null && !loot.IsReference((uint)cond.SourceEntry)) { - Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, does not exist in `item_template`, ignoring.", cond.ToString()); + Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, item does not exist, ignoring.", cond.ToString()); return false; } break; @@ -837,7 +837,7 @@ namespace Game ItemTemplate pItemProto = Global.ObjectMgr.GetItemTemplate((uint)cond.SourceEntry); if (pItemProto == null && !loot.IsReference((uint)cond.SourceEntry)) { - Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, does not exist in `item_template`, ignoring.", cond.ToString()); + Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, item does not exist, ignoring.", cond.ToString()); return false; } break; @@ -854,7 +854,7 @@ namespace Game ItemTemplate pItemProto = Global.ObjectMgr.GetItemTemplate((uint)cond.SourceEntry); if (pItemProto == null && !loot.IsReference((uint)cond.SourceEntry)) { - Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, does not exist in `item_template`, ignoring.", cond.ToString()); + Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, item does not exist, ignoring.", cond.ToString()); return false; } break; @@ -871,7 +871,7 @@ namespace Game ItemTemplate pItemProto = Global.ObjectMgr.GetItemTemplate((uint)cond.SourceEntry); if (pItemProto == null && !loot.IsReference((uint)cond.SourceEntry)) { - Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, does not exist in `item_template`, ignoring.", cond.ToString()); + Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, item does not exist, ignoring.", cond.ToString()); return false; } break; @@ -888,7 +888,7 @@ namespace Game ItemTemplate pItemProto = Global.ObjectMgr.GetItemTemplate((uint)cond.SourceEntry); if (pItemProto == null && !loot.IsReference((uint)cond.SourceEntry)) { - Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, does not exist in `item_template`, ignoring.", cond.ToString()); + Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, item does not exist, ignoring.", cond.ToString()); return false; } break; @@ -905,7 +905,7 @@ namespace Game ItemTemplate pItemProto = Global.ObjectMgr.GetItemTemplate((uint)cond.SourceEntry); if (pItemProto == null && !loot.IsReference((uint)cond.SourceEntry)) { - Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, does not exist in `item_template`, ignoring.", cond.ToString()); + Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, item does not exist, ignoring.", cond.ToString()); return false; } break; @@ -922,7 +922,7 @@ namespace Game ItemTemplate pItemProto = Global.ObjectMgr.GetItemTemplate((uint)cond.SourceEntry); if (pItemProto == null && !loot.IsReference((uint)cond.SourceEntry)) { - Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, does not exist in `item_template`, ignoring.", cond.ToString()); + Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, item does not exist, ignoring.", cond.ToString()); return false; } break; @@ -1049,7 +1049,7 @@ namespace Game ItemTemplate itemTemplate = Global.ObjectMgr.GetItemTemplate((uint)cond.SourceEntry); if (itemTemplate == null) { - Log.outError(LogFilter.Sql, "{0} SourceEntry in `condition` table does not exist in `item_template`, ignoring.", cond.ToString()); + Log.outError(LogFilter.Sql, "{0} SourceEntry in `condition` table item does not exist, ignoring.", cond.ToString()); return false; } break; diff --git a/Source/Game/Entities/Player/Player.DB.cs b/Source/Game/Entities/Player/Player.DB.cs index a7e627a09..3e8e79991 100644 --- a/Source/Game/Entities/Player/Player.DB.cs +++ b/Source/Game/Entities/Player/Player.DB.cs @@ -1235,7 +1235,7 @@ namespace Game.Entities ItemTemplate proto = Global.ObjectMgr.GetItemTemplate(itemEntry); if (proto == null) { - Log.outError(LogFilter.Player, $"Player {(player != null ? player.GetName() : "")} ({playerGuid.ToString()}) has unknown item_template (ProtoType) in mailed items(GUID: {itemGuid} template: {itemEntry}) in mail ({mailId}), deleted."); + Log.outError(LogFilter.Player, $"Player {(player != null ? player.GetName() : "")} ({playerGuid.ToString()}) has unknown item in mailed items (GUID: {itemGuid} template: {itemEntry}) in mail ({mailId}), deleted."); SQLTransaction trans = new SQLTransaction(); diff --git a/Source/Game/Globals/ObjectManager.cs b/Source/Game/Globals/ObjectManager.cs index 32e853922..493c35ccd 100644 --- a/Source/Game/Globals/ObjectManager.cs +++ b/Source/Game/Globals/ObjectManager.cs @@ -4596,7 +4596,7 @@ namespace Game } foreach (var id in notFoundOutfit) - Log.outError(LogFilter.Sql, "Item (Entry: {0}) does not exist in `item_template` but is referenced in `CharStartOutfit.dbc`", id); + Log.outError(LogFilter.Sql, "Item (Entry: {0}) item does not exist but is referenced in `CharStartOutfit.dbc`", id); Log.outInfo(LogFilter.ServerLoading, "Loaded {0} item templates in {1} ms", sparseCount, Time.GetMSTimeDiffToNow(oldMSTime)); } diff --git a/Source/Game/Loot/LootManager.cs b/Source/Game/Loot/LootManager.cs index 6b85c042b..8ccb75da6 100644 --- a/Source/Game/Loot/LootManager.cs +++ b/Source/Game/Loot/LootManager.cs @@ -487,7 +487,7 @@ namespace Game.Loots ItemTemplate proto = Global.ObjectMgr.GetItemTemplate(itemid); if (proto == null) { - Log.outError(LogFilter.Sql, "Table '{0}' entry {1} item {2}: item entry not listed in `item_template` - skipped", store.GetName(), entry, itemid); + Log.outError(LogFilter.Sql, "Table '{0}' entry {1} item {2}: item does not exist - skipped", store.GetName(), entry, itemid); return false; }