From a1a78bf8b01bbaca8e752211bddde5fd04d8b98d Mon Sep 17 00:00:00 2001 From: hondacrx Date: Tue, 6 Feb 2024 15:32:46 -0500 Subject: [PATCH] Core/Loot: implemented a custom server config setting to enable or disable AE loot Port From (https://github.com/TrinityCore/TrinityCore/commit/ccc083593af16f505263f889712f46f9382bb588) --- Source/Framework/Constants/SharedConst.cs | 1 + Source/Game/Handlers/LootHandler.cs | 8 ++++++-- Source/Game/Server/WorldConfig.cs | 3 +++ Source/WorldServer/WorldServer.conf.dist | 8 ++++++++ 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Source/Framework/Constants/SharedConst.cs b/Source/Framework/Constants/SharedConst.cs index be6f1a467..0f59ad47b 100644 --- a/Source/Framework/Constants/SharedConst.cs +++ b/Source/Framework/Constants/SharedConst.cs @@ -1611,6 +1611,7 @@ namespace Framework.Constants DieCommandMode, DisableBreathing, DurabilityLossInPvp, + EnableAeLoot, EnableMmaps, EnableSinfoLogin, EventAnnounce, diff --git a/Source/Game/Handlers/LootHandler.cs b/Source/Game/Handlers/LootHandler.cs index 9590b13f9..81000cd63 100644 --- a/Source/Game/Handlers/LootHandler.cs +++ b/Source/Game/Handlers/LootHandler.cs @@ -217,8 +217,12 @@ namespace Game GetPlayer().RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.Looting); List corpses = new(); - CreatureListSearcher searcher = new(_player, corpses, check); - Cell.VisitGridObjects(_player, searcher, AELootCreatureCheck.LootDistance); + bool aeLootEnabled = WorldConfig.GetBoolValue(WorldCfg.EnableAeLoot); + if (aeLootEnabled) + { + CreatureListSearcher searcher = new(_player, corpses, check); + Cell.VisitGridObjects(_player, searcher, AELootCreatureCheck.LootDistance); + } if (!corpses.Empty()) SendPacket(new AELootTargets((uint)corpses.Count + 1)); diff --git a/Source/Game/Server/WorldConfig.cs b/Source/Game/Server/WorldConfig.cs index f854582d9..8f353cad8 100644 --- a/Source/Game/Server/WorldConfig.cs +++ b/Source/Game/Server/WorldConfig.cs @@ -1011,6 +1011,9 @@ namespace Game // Specifies if IP addresses can be logged to the database Values[WorldCfg.AllowLogginIpAddressesInDatabase] = GetDefaultValue("AllowLoggingIPAddressesInDatabase", true); + // Enable AE loot + Values[WorldCfg.EnableAeLoot] = GetDefaultValue("Loot.EnableAELoot", true); + // call ScriptMgr if we're reloading the configuration if (reload) Global.ScriptMgr.OnConfigLoad(reload); diff --git a/Source/WorldServer/WorldServer.conf.dist b/Source/WorldServer/WorldServer.conf.dist index c48e9fa42..171b7ce87 100644 --- a/Source/WorldServer/WorldServer.conf.dist +++ b/Source/WorldServer/WorldServer.conf.dist @@ -3404,6 +3404,14 @@ Creature.CheckInvalidPosition = 0 GameObject.CheckInvalidPosition = 0 +# +# Loot.EnableAELoot +# Description: Enables AE loot which will allow looting all creatures within a 30 yards radius at once +# Default: 1 - (AE loot enabled) +# 0 - (AE loot disabled) + +Loot.EnableAELoot = 1 + # ###################################################################################################