mirror of
https://github.com/brighton-chi/mod-aoe-loot.git
synced 2026-01-13 00:58:34 +00:00
remove logging
This commit is contained in:
@@ -17,14 +17,6 @@ AoeLoot.EnableMod = 1
|
|||||||
|
|
||||||
AoeLoot.EnableAOELoot = 2
|
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
|
# AoeLoot.Range
|
||||||
# Description: Radius for AoE looting area
|
# Description: Radius for AoE looting area
|
||||||
# Default: 55.0
|
# Default: 55.0
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#include "ChatCommandArgs.h"
|
#include "ChatCommandArgs.h"
|
||||||
#include "Creature.h"
|
#include "Creature.h"
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "Log.h"
|
|
||||||
#include "Map.h"
|
#include "Map.h"
|
||||||
#include "Corpse.h"
|
#include "Corpse.h"
|
||||||
#include "Group.h"
|
#include "Group.h"
|
||||||
@@ -34,20 +34,10 @@ bool IsAoeLootModuleEnabled()
|
|||||||
bool IsPlayerEligibleForQuestItem(Player* player, LootItem const& item)
|
bool IsPlayerEligibleForQuestItem(Player* player, LootItem const& item)
|
||||||
{
|
{
|
||||||
ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(item.itemid);
|
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)
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,14 +48,6 @@ bool IsPlayerEligibleForQuestItem(Player* player, LootItem const& item)
|
|||||||
if (Quest const* startQuest = sObjectMgr->GetQuestTemplate(itemTemplate->StartQuest))
|
if (Quest const* startQuest = sObjectMgr->GetQuestTemplate(itemTemplate->StartQuest))
|
||||||
prevQuestId = startQuest->GetPrevQuestId();
|
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
|
// Already completed the quest
|
||||||
if (player->GetQuestStatus(itemTemplate->StartQuest) != QUEST_STATUS_NONE)
|
if (player->GetQuestStatus(itemTemplate->StartQuest) != QUEST_STATUS_NONE)
|
||||||
return false;
|
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)
|
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)
|
if (player->GetQuestStatus(questId) == QUEST_STATUS_INCOMPLETE)
|
||||||
{
|
{
|
||||||
uint32 requiredCount = 1;
|
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)
|
if (player->GetItemCount(item.itemid, true) < requiredCount)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_INFO("module.aoe_loot", "Player not eligible for quest item: player={} item={}", player->GetName(), item.itemid);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -562,6 +541,7 @@ bool AoeLootCommandScript::ProcessSingleLootSlot(Player* player, ObjectGuid lgui
|
|||||||
}
|
}
|
||||||
loot = &go->loot;
|
loot = &go->loot;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (lguid.IsItem())
|
else if (lguid.IsItem())
|
||||||
{
|
{
|
||||||
Item* pItem = player->GetItemByGuid(lguid);
|
Item* pItem = player->GetItemByGuid(lguid);
|
||||||
@@ -572,6 +552,7 @@ bool AoeLootCommandScript::ProcessSingleLootSlot(Player* player, ObjectGuid lgui
|
|||||||
}
|
}
|
||||||
loot = &pItem->loot;
|
loot = &pItem->loot;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (lguid.IsCorpse())
|
else if (lguid.IsCorpse())
|
||||||
{
|
{
|
||||||
Corpse* bones = ObjectAccessor::GetCorpse(*player, lguid);
|
Corpse* bones = ObjectAccessor::GetCorpse(*player, lguid);
|
||||||
@@ -582,6 +563,7 @@ bool AoeLootCommandScript::ProcessSingleLootSlot(Player* player, ObjectGuid lgui
|
|||||||
}
|
}
|
||||||
loot = &bones->loot;
|
loot = &bones->loot;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Creature* creature = player->GetMap()->GetCreature(lguid);
|
Creature* creature = player->GetMap()->GetCreature(lguid);
|
||||||
@@ -614,12 +596,13 @@ bool AoeLootCommandScript::ProcessSingleLootSlot(Player* player, ObjectGuid lgui
|
|||||||
LootItem& li = loot->quest_items[qitem.index];
|
LootItem& li = loot->quest_items[qitem.index];
|
||||||
player->AddItem(li.itemid, li.count);
|
player->AddItem(li.itemid, li.count);
|
||||||
const_cast<QuestItem&>(qitem).is_looted = true;
|
const_cast<QuestItem&>(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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FFA quest items
|
// FFA quest items
|
||||||
const QuestItemMap& ffaItems = loot->GetPlayerFFAItems();
|
const QuestItemMap& ffaItems = loot->GetPlayerFFAItems();
|
||||||
auto ffa_itr = ffaItems.find(player->GetGUID());
|
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];
|
LootItem& li = loot->quest_items[fitem.index];
|
||||||
player->AddItem(li.itemid, li.count);
|
player->AddItem(li.itemid, li.count);
|
||||||
const_cast<QuestItem&>(fitem).is_looted = true;
|
const_cast<QuestItem&>(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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -711,23 +694,11 @@ bool AoeLootCommandScript::ProcessSingleLootSlot(Player* player, ObjectGuid lgui
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool isLootedBefore = loot->items[lootSlot].is_looted;
|
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);
|
lootItem = player->StoreLootItem(lootSlot, loot, msg);
|
||||||
|
|
||||||
bool isLootedAfter = loot->items[lootSlot].is_looted;
|
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)
|
if (msg != EQUIP_ERR_OK && lguid.IsItem() && loot->loot_type != LOOT_CORPSE)
|
||||||
{
|
{
|
||||||
lootItem->is_looted = true;
|
lootItem->is_looted = true;
|
||||||
@@ -746,7 +717,7 @@ bool AoeLootCommandScript::ProcessSingleLootSlot(Player* player, ObjectGuid lgui
|
|||||||
bool AoeLootCommandScript::TriggerAoeLootCommand(ChatHandler* handler, Optional<std::string> /*args*/)
|
bool AoeLootCommandScript::TriggerAoeLootCommand(ChatHandler* handler, Optional<std::string> /*args*/)
|
||||||
{
|
{
|
||||||
Player* player = handler->GetSession()->GetPlayer();
|
Player* player = handler->GetSession()->GetPlayer();
|
||||||
LOG_INFO("module.aoe_loot", "[AOE LOOT] TriggerAoeLootCommand: player={} starting AoE loot", player ? player->GetName() : "null");
|
|
||||||
if (!IsAoeLootModuleEnabled())
|
if (!IsAoeLootModuleEnabled())
|
||||||
return true;
|
return true;
|
||||||
if (!player)
|
if (!player)
|
||||||
@@ -825,7 +796,7 @@ bool AoeLootCommandScript::TriggerAoeLootCommand(ChatHandler* handler, Optional<
|
|||||||
}
|
}
|
||||||
|
|
||||||
player->SetLootGUID(lguid);
|
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
|
// Process all normal loot items
|
||||||
for (uint8 lootSlot = 0; lootSlot < loot->items.size(); ++lootSlot)
|
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
|
// Quest item slots follow after normal loot slots
|
||||||
uint8 questSlot = loot->items.size() + i;
|
uint8 questSlot = loot->items.size() + i;
|
||||||
ProcessSingleLootSlot(player, lguid, questSlot);
|
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
|
// 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;
|
uint8 ffaSlot = loot->items.size() + (q_itr != questItems.end() ? q_itr->second->size() : 0) + i;
|
||||||
ProcessSingleLootSlot(player, lguid, ffaSlot);
|
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;
|
++lootableCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOG_INFO("module.aoe_loot", "[AOE LOOT] After processing: player={} corpse={} lootable_items={}", player->GetName(), creature->GetName(), lootableCount);
|
|
||||||
|
|
||||||
// Handle money
|
// Handle money
|
||||||
if (loot->gold > 0)
|
if (loot->gold > 0)
|
||||||
@@ -899,7 +869,7 @@ bool AoeLootCommandScript::TriggerAoeLootCommand(ChatHandler* handler, Optional<
|
|||||||
if (loot->isLooted())
|
if (loot->isLooted())
|
||||||
{
|
{
|
||||||
ReleaseAndCleanupLoot(lguid, player, loot);
|
ReleaseAndCleanupLoot(lguid, player, loot);
|
||||||
LOG_INFO("module.aoe_loot", "[AOE LOOT] ReleaseAndCleanupLoot: player={} corpse={} loot released", player->GetName(), creature->GetName());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -918,22 +888,6 @@ void AoeLootPlayer::OnPlayerLogin(Player* player)
|
|||||||
|
|
||||||
uint32 AoeLootMode = sConfigMgr->GetOption<uint32>("AoeLoot.EnableAOELoot", 2);
|
uint32 AoeLootMode = sConfigMgr->GetOption<uint32>("AoeLoot.EnableAOELoot", 2);
|
||||||
|
|
||||||
if (AoeLootMode > 0 && sConfigMgr->GetOption<bool>("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)
|
void AoeLootGroupScript::OnCreate(Group* group, Player* leader)
|
||||||
|
|||||||
Reference in New Issue
Block a user