From db5e3383d7df1e89e3221c2e98d76870f9066ae5 Mon Sep 17 00:00:00 2001 From: Hondacrx Date: Thu, 26 Sep 2024 17:49:49 -0400 Subject: [PATCH] Core/Conditions: Remove unneccessary duplicate condition startup checks - item existance is checked by loot loading and if that fails, condition loading will fail to find related item inside loot Port From (https://github.com/TrinityCore/TrinityCore/commit/6d3be9cca62ec3149af490b8f6dbbd4f3127d531) --- Source/Game/Conditions/ConditionManager.cs | 96 ---------------------- Source/Game/Loot/LootManager.cs | 9 -- 2 files changed, 105 deletions(-) diff --git a/Source/Game/Conditions/ConditionManager.cs b/Source/Game/Conditions/ConditionManager.cs index acb2d4e82..1fc2deb93 100644 --- a/Source/Game/Conditions/ConditionManager.cs +++ b/Source/Game/Conditions/ConditionManager.cs @@ -768,14 +768,6 @@ namespace Game Log.outError(LogFilter.Sql, "{0} SourceGroup in `condition` table, does not exist in `creature_loot_template`, ignoring.", cond.ToString()); return false; } - - LootTemplate loot = LootStorage.Creature.GetLootForConditionFill(cond.SourceGroup); - 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, Item does not exist, ignoring.", cond.ToString()); - return false; - } break; } case ConditionSourceType.DisenchantLootTemplate: @@ -785,14 +777,6 @@ namespace Game Log.outError(LogFilter.Sql, "{0} SourceGroup in `condition` table, does not exist in `disenchant_loot_template`, ignoring.", cond.ToString()); return false; } - - LootTemplate loot = LootStorage.Disenchant.GetLootForConditionFill(cond.SourceGroup); - 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, item does not exist, ignoring.", cond.ToString()); - return false; - } break; } case ConditionSourceType.FishingLootTemplate: @@ -802,14 +786,6 @@ namespace Game Log.outError(LogFilter.Sql, "{0} SourceGroup in `condition` table, does not exist in `fishing_loot_template`, ignoring.", cond.ToString()); return false; } - - LootTemplate loot = LootStorage.Fishing.GetLootForConditionFill(cond.SourceGroup); - 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, item does not exist, ignoring.", cond.ToString()); - return false; - } break; } case ConditionSourceType.GameobjectLootTemplate: @@ -819,14 +795,6 @@ namespace Game Log.outError(LogFilter.Sql, "{0} SourceGroup in `condition` table, does not exist in `gameobject_loot_template`, ignoring.", cond.ToString()); return false; } - - LootTemplate loot = LootStorage.Gameobject.GetLootForConditionFill(cond.SourceGroup); - 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, item does not exist, ignoring.", cond.ToString()); - return false; - } break; } case ConditionSourceType.ItemLootTemplate: @@ -836,14 +804,6 @@ namespace Game Log.outError(LogFilter.Sql, "{0} SourceGroup in `condition` table, does not exist in `item_loot_template`, ignoring.", cond.ToString()); return false; } - - LootTemplate loot = LootStorage.Items.GetLootForConditionFill(cond.SourceGroup); - 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, item does not exist, ignoring.", cond.ToString()); - return false; - } break; } case ConditionSourceType.MailLootTemplate: @@ -853,14 +813,6 @@ namespace Game Log.outError(LogFilter.Sql, "{0} SourceGroup in `condition` table, does not exist in `mail_loot_template`, ignoring.", cond.ToString()); return false; } - - LootTemplate loot = LootStorage.Mail.GetLootForConditionFill(cond.SourceGroup); - 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, item does not exist, ignoring.", cond.ToString()); - return false; - } break; } case ConditionSourceType.MillingLootTemplate: @@ -870,14 +822,6 @@ namespace Game Log.outError(LogFilter.Sql, "{0} SourceGroup in `condition` table, does not exist in `milling_loot_template`, ignoring.", cond.ToString()); return false; } - - LootTemplate loot = LootStorage.Milling.GetLootForConditionFill(cond.SourceGroup); - 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, item does not exist, ignoring.", cond.ToString()); - return false; - } break; } case ConditionSourceType.PickpocketingLootTemplate: @@ -887,14 +831,6 @@ namespace Game Log.outError(LogFilter.Sql, "{0} SourceGroup in `condition` table, does not exist in `pickpocketing_loot_template`, ignoring.", cond.ToString()); return false; } - - LootTemplate loot = LootStorage.Pickpocketing.GetLootForConditionFill(cond.SourceGroup); - 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, item does not exist, ignoring.", cond.ToString()); - return false; - } break; } case ConditionSourceType.ProspectingLootTemplate: @@ -904,14 +840,6 @@ namespace Game Log.outError(LogFilter.Sql, "{0} SourceGroup in `condition` table, does not exist in `prospecting_loot_template`, ignoring.", cond.ToString()); return false; } - - LootTemplate loot = LootStorage.Prospecting.GetLootForConditionFill(cond.SourceGroup); - 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, item does not exist, ignoring.", cond.ToString()); - return false; - } break; } case ConditionSourceType.ReferenceLootTemplate: @@ -921,14 +849,6 @@ namespace Game Log.outError(LogFilter.Sql, "{0} SourceGroup in `condition` table, does not exist in `reference_loot_template`, ignoring.", cond.ToString()); return false; } - - LootTemplate loot = LootStorage.Reference.GetLootForConditionFill(cond.SourceGroup); - 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, item does not exist, ignoring.", cond.ToString()); - return false; - } break; } case ConditionSourceType.SkinningLootTemplate: @@ -938,14 +858,6 @@ namespace Game Log.outError(LogFilter.Sql, "{0} SourceGroup in `condition` table, does not exist in `skinning_loot_template`, ignoring.", cond.ToString()); return false; } - - LootTemplate loot = LootStorage.Skinning.GetLootForConditionFill(cond.SourceGroup); - 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, item does not exist, ignoring.", cond.ToString()); - return false; - } break; } case ConditionSourceType.SpellLootTemplate: @@ -955,14 +867,6 @@ namespace Game Log.outError(LogFilter.Sql, "{0} SourceGroup in `condition` table, does not exist in `spell_loot_template`, ignoring.", cond.ToString()); return false; } - - LootTemplate loot = LootStorage.Spell.GetLootForConditionFill(cond.SourceGroup); - 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, item does not exist, ignoring.", cond.ToString()); - return false; - } break; } case ConditionSourceType.SpellImplicitTarget: diff --git a/Source/Game/Loot/LootManager.cs b/Source/Game/Loot/LootManager.cs index dbbe7f7f2..c5a684eb2 100644 --- a/Source/Game/Loot/LootManager.cs +++ b/Source/Game/Loot/LootManager.cs @@ -1064,15 +1064,6 @@ namespace Game.Loots return false; } - public bool IsReference(uint id) - { - foreach (var storeItem in Entries) - if (storeItem.itemid == id && storeItem.reference > 0) - return true; - - return false;//not found or not reference - } - LootStoreItemList Entries = new(); // not grouped only Dictionary Groups = new(); // groups have own (optimised) processing, grouped entries go there