mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-13 09:07:19 +00:00
fix warning & misc
This commit is contained in:
@@ -98,7 +98,7 @@ void PlayerbotFactory::Prepare()
|
||||
|
||||
if (!sPlayerbotAIConfig->disableRandomLevels)
|
||||
{
|
||||
bot->SetLevel(level);
|
||||
bot->GiveLevel(level);
|
||||
}
|
||||
else if (bot->getLevel() < sPlayerbotAIConfig->randombotStartingLevel)
|
||||
{
|
||||
@@ -125,7 +125,7 @@ void PlayerbotFactory::Randomize(bool incremental)
|
||||
|
||||
LOG_INFO("playerbots", "Preparing to {} randomize...", (incremental ? "incremental" : "full"));
|
||||
Prepare();
|
||||
|
||||
bot->SaveToDB(false, false);
|
||||
LOG_INFO("playerbots", "Resetting player...");
|
||||
PerformanceMonitorOperation* pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Reset");
|
||||
bot->resetTalents(true);
|
||||
@@ -143,6 +143,8 @@ void PlayerbotFactory::Randomize(bool incremental)
|
||||
if (pmo)
|
||||
pmo->finish();
|
||||
|
||||
bot->resetTalents(true);
|
||||
bot->SaveToDB(false, false);
|
||||
/*
|
||||
pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Immersive");
|
||||
LOG_INFO("playerbots", "Initializing immersive...");
|
||||
@@ -178,7 +180,7 @@ void PlayerbotFactory::Randomize(bool incremental)
|
||||
|
||||
pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Spells1");
|
||||
LOG_INFO("playerbots", "Initializing spells (step 1)...");
|
||||
// InitClassSpells();
|
||||
InitClassSpells();
|
||||
InitAvailableSpells();
|
||||
if (pmo)
|
||||
pmo->finish();
|
||||
@@ -1344,44 +1346,19 @@ void PlayerbotFactory::InitSecondEquipmentSet()
|
||||
|
||||
void PlayerbotFactory::InitBags()
|
||||
{
|
||||
std::vector<uint32> ids;
|
||||
|
||||
ItemTemplateContainer const* itemTemplates = sObjectMgr->GetItemTemplateStore();
|
||||
for (auto const& itr : *itemTemplates)
|
||||
{
|
||||
ItemTemplate const* proto = &itr.second;
|
||||
if (!proto || proto->Class != ITEM_CLASS_CONTAINER)
|
||||
continue;
|
||||
|
||||
if (!CanEquipItem(proto, ITEM_QUALITY_NORMAL))
|
||||
continue;
|
||||
|
||||
ids.push_back(itr.first);
|
||||
}
|
||||
|
||||
if (ids.empty())
|
||||
{
|
||||
LOG_ERROR("playerbots", "{}: no bags found", bot->GetName().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint8 slot = INVENTORY_SLOT_BAG_START; slot < INVENTORY_SLOT_BAG_END; ++slot)
|
||||
{
|
||||
for (uint32 attempts = 0; attempts < 15; attempts++)
|
||||
uint32 newItemId = 23162;
|
||||
|
||||
uint16 dest;
|
||||
if (!CanEquipUnseenItem(slot, dest, newItemId))
|
||||
continue;
|
||||
|
||||
Item* newItem = bot->EquipNewItem(dest, newItemId, true);
|
||||
if (newItem)
|
||||
{
|
||||
uint32 index = urand(0, ids.size() - 1);
|
||||
uint32 newItemId = ids[index];
|
||||
|
||||
uint16 dest;
|
||||
if (!CanEquipUnseenItem(slot, dest, newItemId))
|
||||
continue;
|
||||
|
||||
if (Item* newItem = bot->EquipNewItem(dest, newItemId, true))
|
||||
{
|
||||
newItem->AddToWorld();
|
||||
newItem->AddToUpdateQueueOf(bot);
|
||||
break;
|
||||
}
|
||||
newItem->AddToWorld();
|
||||
newItem->AddToUpdateQueueOf(bot);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1791,8 +1768,8 @@ void PlayerbotFactory::InitAvailableSpells()
|
||||
bot->learnSpell(tSpell->spell);
|
||||
}
|
||||
}
|
||||
if (bot->IsSpellFitByClassAndRace(20271) && !bot->HasSpell(20271)) // judgement missing
|
||||
bot->learnSpell(20271, false);
|
||||
// if (bot->IsSpellFitByClassAndRace(20271) && !bot->HasSpell(20271)) // judgement missing
|
||||
// bot->learnSpell(20271, false);
|
||||
}
|
||||
|
||||
void PlayerbotFactory::InitClassSpells()
|
||||
|
||||
@@ -1525,7 +1525,7 @@ std::string const RandomPlayerbotMgr::GetEventData(uint32 bot, std::string const
|
||||
data = e.data;
|
||||
}
|
||||
|
||||
return std::move(data);
|
||||
return data;
|
||||
}
|
||||
|
||||
uint32 RandomPlayerbotMgr::SetEventValue(uint32 bot, std::string const event, uint32 value, uint32 validIn, std::string const data)
|
||||
|
||||
@@ -32,6 +32,7 @@ class TalentSpec
|
||||
};
|
||||
|
||||
TalentSpec() { };
|
||||
virtual ~TalentSpec() { }
|
||||
TalentSpec(uint32 classMask);
|
||||
TalentSpec(TalentSpec* base, std::string const link);
|
||||
TalentSpec(Player* bot);
|
||||
|
||||
@@ -85,3 +85,8 @@ bool FindItemUsageVisitor::Accept(ItemTemplate const* proto)
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FindUsableNamedItemVisitor::Accept(ItemTemplate const* proto)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -411,4 +411,12 @@ class FindItemUsageVisitor : public FindUsableItemVisitor
|
||||
ItemUsage usage;
|
||||
};
|
||||
|
||||
class FindUsableNamedItemVisitor : public FindUsableItemVisitor
|
||||
{
|
||||
public:
|
||||
FindUsableNamedItemVisitor(Player* bot): FindUsableItemVisitor(bot) {}
|
||||
|
||||
bool Accept(ItemTemplate const* proto) override;
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -20,6 +20,7 @@ class UntypedValue : public AiNamedObject
|
||||
{
|
||||
public:
|
||||
UntypedValue(PlayerbotAI* botAI, std::string const name) : AiNamedObject(botAI, name) { }
|
||||
virtual ~UntypedValue() { }
|
||||
virtual void Update() { }
|
||||
virtual void Reset() { }
|
||||
virtual std::string const Format() { return "?"; }
|
||||
|
||||
@@ -43,7 +43,7 @@ class FreeBGJoinAction : public BGJoinAction
|
||||
class BGLeaveAction : public Action
|
||||
{
|
||||
public:
|
||||
BGLeaveAction(PlayerbotAI* botAI, std::string const name = "bg leave") : Action(botAI) { }
|
||||
BGLeaveAction(PlayerbotAI* botAI, std::string const name = "bg leave") : Action(botAI, name) { }
|
||||
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
@@ -282,6 +282,10 @@ std::vector<Item*> InventoryAction::parseItems(std::string const text, IterateIt
|
||||
IterateItems(&visitor, ITERATE_ITEMS_IN_BAGS);
|
||||
found.insert(visitor.GetResult().begin(), visitor.GetResult().end());
|
||||
}
|
||||
|
||||
FindUsableNamedItemVisitor visitor(bot);
|
||||
IterateItems(&visitor, ITERATE_ITEMS_IN_BAGS);
|
||||
found.insert(visitor.GetResult().begin(), visitor.GetResult().end());
|
||||
|
||||
uint32 quality = chat->parseItemQuality(text);
|
||||
if (quality != MAX_ITEM_QUALITY)
|
||||
|
||||
@@ -16,7 +16,7 @@ class GrindingStrategy : public NonCombatStrategy
|
||||
|
||||
std::string const getName() override { return "grind"; }
|
||||
uint32 GetType() const override { return STRATEGY_TYPE_DPS; }
|
||||
NextAction** getDefaultActions();
|
||||
NextAction** getDefaultActions() override;
|
||||
void InitTriggers(std::vector<TriggerNode*>& triggers) override;
|
||||
};
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ class GuardStrategy : public NonCombatStrategy
|
||||
GuardStrategy(PlayerbotAI* botAI) : NonCombatStrategy(botAI) { }
|
||||
|
||||
std::string const getName() override { return "guard"; }
|
||||
NextAction** getDefaultActions();
|
||||
NextAction** getDefaultActions() override;
|
||||
void InitTriggers(std::vector<TriggerNode*>& triggers) override;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user