This commit is contained in:
Yunfan Li
2023-08-28 17:29:14 +08:00
parent 1136b7bfdc
commit 9efec9b325
8 changed files with 39 additions and 30 deletions

View File

@@ -9,6 +9,7 @@
#include "LootStrategyValue.h"
#include "LootObjectStack.h"
#include "GuildTaskMgr.h"
#include "PlayerbotAIConfig.h"
#include "Playerbots.h"
#include "ServerFacade.h"
@@ -31,6 +32,10 @@ bool LootAction::Execute(Event event)
return true;
}
bool LootAction::isUseful() {
return sPlayerbotAIConfig->freeMethodLoot || !bot->GetGroup() || bot->GetGroup()->GetLootMethod() != FREE_FOR_ALL;
}
enum ProfessionSpells
{
ALCHEMY = 2259,
@@ -406,9 +411,9 @@ bool StoreLootAction::Execute(Event event)
if (proto->Quality >= ITEM_QUALITY_RARE && !urand(0, 1) && botAI->HasStrategy("emote", BOT_STATE_NON_COMBAT))
botAI->PlayEmote(TEXT_EMOTE_CHEER);
std::ostringstream out;
out << "Looting " << chat->FormatItem(proto);
botAI->TellMasterNoFacing(out.str());
// std::ostringstream out;
// out << "Looting " << chat->FormatItem(proto);
// botAI->TellMasterNoFacing(out.str());
//ItemUsage usage = AI_VALUE2(ItemUsage, "item usage", proto->ItemId);
//LOG_ERROR("playerbots", "Bot {} is looting {} {} for usage {}.", bot->GetName().c_str(), itemcount, proto->Name1.c_str(), usage);
@@ -442,10 +447,7 @@ bool StoreLootAction::IsLootAllowed(uint32 itemid, PlayerbotAI* botAI)
if (proto->StartQuest)
{
if (sPlayerbotAIConfig->syncQuestWithPlayer)
return false; //Quest is autocomplete for the bot so no item needed.
else
return true;
return true;
}
for (uint8 slot = 0; slot < MAX_QUEST_LOG_SIZE; ++slot)
@@ -459,14 +461,13 @@ bool StoreLootAction::IsLootAllowed(uint32 itemid, PlayerbotAI* botAI)
{
if (quest->RequiredItemId[i] == itemid)
{
if (quest->RequiredItemId[i] == itemid && AI_VALUE2(uint32, "item count", proto->Name1) < quest->RequiredItemCount[i])
if (AI_VALUE2(uint32, "item count", proto->Name1) < quest->RequiredItemCount[i])
{
if (botAI->GetMaster() && sPlayerbotAIConfig->syncQuestWithPlayer)
return false; //Quest is autocomplete for the bot so no item needed.
}
if (AI_VALUE2(uint32, "item count", proto->Name1) < quest->RequiredItemCount[i])
return false;
return true;
}
}
}