diff --git a/conf/mod_aoe_loot.conf.dist b/conf/mod_aoe_loot.conf.dist index 056ab2d..3564f16 100644 --- a/conf/mod_aoe_loot.conf.dist +++ b/conf/mod_aoe_loot.conf.dist @@ -17,14 +17,6 @@ AoeLoot.EnableMod = 1 AoeLoot.EnableAOELoot = 2 -# AoeLoot.Message -# Description: Enable module notification message on login -# Values: 0 = Disable message -# 1 = Enable message -# Default: 1 (Enabled) - -AoeLoot.Message = 1 - # AoeLoot.Range # Description: Radius for AoE looting area # Default: 55.0 diff --git a/src/aoe_loot.cpp b/src/aoe_loot.cpp index dfeccc8..112a6c8 100644 --- a/src/aoe_loot.cpp +++ b/src/aoe_loot.cpp @@ -10,7 +10,7 @@ #include "ChatCommandArgs.h" #include "Creature.h" #include "Config.h" -#include "Log.h" + #include "Map.h" #include "Corpse.h" #include "Group.h" @@ -34,20 +34,10 @@ bool IsAoeLootModuleEnabled() bool IsPlayerEligibleForQuestItem(Player* player, LootItem const& item) { ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(item.itemid); - LOG_INFO("module.aoe_loot", "[AOE LOOT] Eligibility check: player={} item={} class={} startQuest={} maxCount={} questStatus={} hasItem={} flags={} isQuestStarter={}", - player->GetName(), - item.itemid, - itemTemplate ? itemTemplate->Class : -1, - itemTemplate ? itemTemplate->StartQuest : 0, - itemTemplate ? itemTemplate->MaxCount : 0, - itemTemplate ? player->GetQuestStatus(itemTemplate->StartQuest) : -1, - itemTemplate ? player->HasItemCount(item.itemid, itemTemplate->MaxCount) : false, - itemTemplate ? itemTemplate->Flags : 0, - itemTemplate ? itemTemplate->StartQuest != 0 : false); if (!itemTemplate || itemTemplate->Class != ITEM_CLASS_QUEST) { - LOG_INFO("module.aoe_loot", "[AOE LOOT] Not a quest item or missing template: item={}", item.itemid); + return false; } @@ -58,14 +48,6 @@ bool IsPlayerEligibleForQuestItem(Player* player, LootItem const& item) if (Quest const* startQuest = sObjectMgr->GetQuestTemplate(itemTemplate->StartQuest)) prevQuestId = startQuest->GetPrevQuestId(); - LOG_INFO("module.aoe_loot", "[AOE LOOT] Quest starter item: player={} item={} questStatus={} hasItem={} prevQuestId={} prevQuestReward={}", - player->GetName(), - item.itemid, - player->GetQuestStatus(itemTemplate->StartQuest), - player->HasItemCount(item.itemid, itemTemplate->MaxCount), - prevQuestId, - prevQuestId ? player->GetQuestRewardStatus(prevQuestId) : 1); - // Already completed the quest if (player->GetQuestStatus(itemTemplate->StartQuest) != QUEST_STATUS_NONE) return false; @@ -99,11 +81,9 @@ bool IsPlayerEligibleForQuestItem(Player* player, LootItem const& item) } } - LOG_INFO("module.aoe_loot", "Objective quest item: player={} item={} foundQuests={}", player->GetName(), item.itemid, questIds.size()); - for (uint32 questId : questIds) { - LOG_INFO("module.aoe_loot", "Checking quest status: player={} item={} questId={} status={}", player->GetName(), item.itemid, questId, player->GetQuestStatus(questId)); + if (player->GetQuestStatus(questId) == QUEST_STATUS_INCOMPLETE) { uint32 requiredCount = 1; @@ -119,13 +99,12 @@ bool IsPlayerEligibleForQuestItem(Player* player, LootItem const& item) } } } - LOG_INFO("module.aoe_loot", "Item count check: player={} item={} have={} required={}", player->GetName(), item.itemid, player->GetItemCount(item.itemid, true), requiredCount); + if (player->GetItemCount(item.itemid, true) < requiredCount) return true; } } - LOG_INFO("module.aoe_loot", "Player not eligible for quest item: player={} item={}", player->GetName(), item.itemid); return false; } @@ -562,6 +541,7 @@ bool AoeLootCommandScript::ProcessSingleLootSlot(Player* player, ObjectGuid lgui } loot = &go->loot; } + else if (lguid.IsItem()) { Item* pItem = player->GetItemByGuid(lguid); @@ -572,6 +552,7 @@ bool AoeLootCommandScript::ProcessSingleLootSlot(Player* player, ObjectGuid lgui } loot = &pItem->loot; } + else if (lguid.IsCorpse()) { Corpse* bones = ObjectAccessor::GetCorpse(*player, lguid); @@ -582,6 +563,7 @@ bool AoeLootCommandScript::ProcessSingleLootSlot(Player* player, ObjectGuid lgui } loot = &bones->loot; } + else { Creature* creature = player->GetMap()->GetCreature(lguid); @@ -614,12 +596,13 @@ bool AoeLootCommandScript::ProcessSingleLootSlot(Player* player, ObjectGuid lgui LootItem& li = loot->quest_items[qitem.index]; player->AddItem(li.itemid, li.count); const_cast(qitem).is_looted = true; - LOG_INFO("module.aoe_loot", "[AOE LOOT] Player looted quest item: player={} item={} count={} slot={}", player->GetName(), li.itemid, uint32(li.count), uint32(questIndex)); + return true; } } } } + // FFA quest items const QuestItemMap& ffaItems = loot->GetPlayerFFAItems(); auto ffa_itr = ffaItems.find(player->GetGUID()); @@ -638,7 +621,7 @@ bool AoeLootCommandScript::ProcessSingleLootSlot(Player* player, ObjectGuid lgui LootItem& li = loot->quest_items[fitem.index]; player->AddItem(li.itemid, li.count); const_cast(fitem).is_looted = true; - LOG_INFO("module.aoe_loot", "[AOE LOOT] Player looted FFA quest item: player={} item={} count={} slot={}", player->GetName(), li.itemid, uint32(li.count), uint32(ffaIndex)); + return true; } } @@ -711,23 +694,11 @@ bool AoeLootCommandScript::ProcessSingleLootSlot(Player* player, ObjectGuid lgui return false; bool isLootedBefore = loot->items[lootSlot].is_looted; - LOG_INFO("module.aoe_loot", "Before StoreLootItem: player={} item={} slot={} itemCount={} is_looted={}", - player->GetName(), - loot->items[lootSlot].itemid, - lootSlot, - player->GetItemCount(loot->items[lootSlot].itemid, true), - isLootedBefore); lootItem = player->StoreLootItem(lootSlot, loot, msg); bool isLootedAfter = loot->items[lootSlot].is_looted; - LOG_INFO("module.aoe_loot", "After StoreLootItem: player={} item={} slot={} itemCount={} is_looted={} result={}", - player->GetName(), - loot->items[lootSlot].itemid, - lootSlot, - player->GetItemCount(loot->items[lootSlot].itemid, true), - isLootedAfter, - msg); + if (msg != EQUIP_ERR_OK && lguid.IsItem() && loot->loot_type != LOOT_CORPSE) { lootItem->is_looted = true; @@ -746,7 +717,7 @@ bool AoeLootCommandScript::ProcessSingleLootSlot(Player* player, ObjectGuid lgui bool AoeLootCommandScript::TriggerAoeLootCommand(ChatHandler* handler, Optional /*args*/) { Player* player = handler->GetSession()->GetPlayer(); - LOG_INFO("module.aoe_loot", "[AOE LOOT] TriggerAoeLootCommand: player={} starting AoE loot", player ? player->GetName() : "null"); + if (!IsAoeLootModuleEnabled()) return true; if (!player) @@ -825,7 +796,7 @@ bool AoeLootCommandScript::TriggerAoeLootCommand(ChatHandler* handler, Optional< } player->SetLootGUID(lguid); - LOG_INFO("module.aoe_loot", "[AOE LOOT] SetLootGUID: player={} corpse={} loot window should open", player->GetName(), creature->GetName()); + // Process all normal loot items for (uint8 lootSlot = 0; lootSlot < loot->items.size(); ++lootSlot) @@ -844,7 +815,7 @@ bool AoeLootCommandScript::TriggerAoeLootCommand(ChatHandler* handler, Optional< // Quest item slots follow after normal loot slots uint8 questSlot = loot->items.size() + i; ProcessSingleLootSlot(player, lguid, questSlot); - LOG_INFO("module.aoe_loot", "[AOE LOOT] Processed quest item in slot {}", questSlot); + } } @@ -859,7 +830,7 @@ bool AoeLootCommandScript::TriggerAoeLootCommand(ChatHandler* handler, Optional< // FFA item slots follow after normal loot slots and quest item slots uint8 ffaSlot = loot->items.size() + (q_itr != questItems.end() ? q_itr->second->size() : 0) + i; ProcessSingleLootSlot(player, lguid, ffaSlot); - LOG_INFO("module.aoe_loot", "[AOE LOOT] Processed FFA quest item in slot {}", ffaSlot); + } } @@ -887,7 +858,6 @@ bool AoeLootCommandScript::TriggerAoeLootCommand(ChatHandler* handler, Optional< ++lootableCount; } } - LOG_INFO("module.aoe_loot", "[AOE LOOT] After processing: player={} corpse={} lootable_items={}", player->GetName(), creature->GetName(), lootableCount); // Handle money if (loot->gold > 0) @@ -899,7 +869,7 @@ bool AoeLootCommandScript::TriggerAoeLootCommand(ChatHandler* handler, Optional< if (loot->isLooted()) { ReleaseAndCleanupLoot(lguid, player, loot); - LOG_INFO("module.aoe_loot", "[AOE LOOT] ReleaseAndCleanupLoot: player={} corpse={} loot released", player->GetName(), creature->GetName()); + } } return true; @@ -918,22 +888,6 @@ void AoeLootPlayer::OnPlayerLogin(Player* player) uint32 AoeLootMode = sConfigMgr->GetOption("AoeLoot.EnableAOELoot", 2); - if (AoeLootMode > 0 && sConfigMgr->GetOption("AoeLoot.Message", true)) - { - std::string message = "AOE looting has been enabled for your character"; - - switch (AoeLootMode) - { - case 1: - message += " (solo play only)"; - break; - case 2: - message += " (solo and group play)"; - break; - } - - message += ". Type: '.AoeLoot off' to turn AoE Looting Off."; - } } void AoeLootGroupScript::OnCreate(Group* group, Player* leader)