mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-15 01:49:09 +00:00
Run clang-format
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license, you may redistribute it and/or modify it under version 2 of the License, or (at your option), any later version.
|
||||
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license, you may redistribute it
|
||||
* and/or modify it under version 2 of the License, or (at your option), any later version.
|
||||
*/
|
||||
|
||||
#include "TrainerAction.h"
|
||||
|
||||
#include "BudgetValues.h"
|
||||
#include "Event.h"
|
||||
#include "PlayerbotFactory.h"
|
||||
@@ -47,10 +49,11 @@ void TrainerAction::Iterate(Creature* creature, TrainerSpellAction action, Spell
|
||||
TellHeader(creature);
|
||||
|
||||
TrainerSpellData const* trainer_spells = creature->GetTrainerSpells();
|
||||
float fDiscountMod = bot->GetReputationPriceDiscount(creature);
|
||||
float fDiscountMod = bot->GetReputationPriceDiscount(creature);
|
||||
uint32 totalCost = 0;
|
||||
|
||||
for (TrainerSpellMap::const_iterator itr = trainer_spells->spellList.begin(); itr != trainer_spells->spellList.end(); ++itr)
|
||||
for (TrainerSpellMap::const_iterator itr = trainer_spells->spellList.begin();
|
||||
itr != trainer_spells->spellList.end(); ++itr)
|
||||
{
|
||||
TrainerSpell const* tSpell = &itr->second;
|
||||
if (!tSpell)
|
||||
@@ -68,7 +71,7 @@ void TrainerAction::Iterate(Creature* creature, TrainerSpellAction action, Spell
|
||||
if (!spells.empty() && spells.find(tSpell->spell) == spells.end())
|
||||
continue;
|
||||
|
||||
uint32 cost = uint32(floor(tSpell->spellCost * fDiscountMod));
|
||||
uint32 cost = uint32(floor(tSpell->spellCost * fDiscountMod));
|
||||
totalCost += cost;
|
||||
|
||||
std::ostringstream out;
|
||||
@@ -91,7 +94,8 @@ bool TrainerAction::Execute(Event event)
|
||||
|
||||
Creature* creature = botAI->GetCreature(bot->GetTarget());
|
||||
|
||||
if (master) {
|
||||
if (master)
|
||||
{
|
||||
creature = master->GetSelectedUnit() ? master->GetSelectedUnit()->ToCreature() : nullptr;
|
||||
}
|
||||
// if (AI_VALUE(GuidPosition, "rpg target") != bot->GetTarget())
|
||||
@@ -122,8 +126,11 @@ bool TrainerAction::Execute(Event event)
|
||||
if (spell)
|
||||
spells.insert(spell);
|
||||
|
||||
if (text.find("learn") != std::string::npos || sRandomPlayerbotMgr->IsRandomBot(bot) || (sPlayerbotAIConfig->autoTrainSpells != "no" &&
|
||||
(creature->GetCreatureTemplate()->trainer_type != TRAINER_TYPE_TRADESKILLS || !botAI->HasActivePlayerMaster()))) //Todo rewrite to only exclude start primary profession skills and make config dependent.
|
||||
if (text.find("learn") != std::string::npos || sRandomPlayerbotMgr->IsRandomBot(bot) ||
|
||||
(sPlayerbotAIConfig->autoTrainSpells != "no" &&
|
||||
(creature->GetCreatureTemplate()->trainer_type != TRAINER_TYPE_TRADESKILLS ||
|
||||
!botAI->HasActivePlayerMaster()))) // Todo rewrite to only exclude start primary profession skills and make
|
||||
// config dependent.
|
||||
Iterate(creature, &TrainerAction::Learn, spells);
|
||||
else
|
||||
Iterate(creature, nullptr, spells);
|
||||
@@ -150,7 +157,8 @@ void TrainerAction::TellFooter(uint32 totalCost)
|
||||
|
||||
bool MaintenanceAction::Execute(Event event)
|
||||
{
|
||||
if (!sPlayerbotAIConfig->maintenanceCommand) {
|
||||
if (!sPlayerbotAIConfig->maintenanceCommand)
|
||||
{
|
||||
botAI->TellError("maintenance command is not allowed, please check the configuration.");
|
||||
return false;
|
||||
}
|
||||
@@ -168,7 +176,8 @@ bool MaintenanceAction::Execute(Event event)
|
||||
factory.InitSkills();
|
||||
factory.InitMounts();
|
||||
factory.InitGlyphs(true);
|
||||
if (bot->GetLevel() >= sPlayerbotAIConfig->minEnchantingBotLevel) {
|
||||
if (bot->GetLevel() >= sPlayerbotAIConfig->minEnchantingBotLevel)
|
||||
{
|
||||
factory.ApplyEnchantAndGemsNew();
|
||||
}
|
||||
bot->DurabilityRepairAll(false, 1.0f, false);
|
||||
@@ -188,20 +197,21 @@ bool RemoveGlyphAction::Execute(Event event)
|
||||
|
||||
bool AutoGearAction::Execute(Event event)
|
||||
{
|
||||
if (!sPlayerbotAIConfig->autoGearCommand) {
|
||||
if (!sPlayerbotAIConfig->autoGearCommand)
|
||||
{
|
||||
botAI->TellError("autogear command is not allowed, please check the configuration.");
|
||||
return false;
|
||||
}
|
||||
botAI->TellMaster("I'm auto gearing");
|
||||
uint32 gs = sPlayerbotAIConfig->autoGearScoreLimit == 0 ? 0 :
|
||||
PlayerbotFactory::CalcMixedGearScore(sPlayerbotAIConfig->autoGearScoreLimit, sPlayerbotAIConfig->autoGearQualityLimit);
|
||||
PlayerbotFactory factory(bot,
|
||||
bot->GetLevel(),
|
||||
sPlayerbotAIConfig->autoGearQualityLimit,
|
||||
gs);
|
||||
uint32 gs = sPlayerbotAIConfig->autoGearScoreLimit == 0
|
||||
? 0
|
||||
: PlayerbotFactory::CalcMixedGearScore(sPlayerbotAIConfig->autoGearScoreLimit,
|
||||
sPlayerbotAIConfig->autoGearQualityLimit);
|
||||
PlayerbotFactory factory(bot, bot->GetLevel(), sPlayerbotAIConfig->autoGearQualityLimit, gs);
|
||||
factory.InitEquipment(true);
|
||||
factory.InitAmmo();
|
||||
if (bot->GetLevel() >= sPlayerbotAIConfig->minEnchantingBotLevel) {
|
||||
if (bot->GetLevel() >= sPlayerbotAIConfig->minEnchantingBotLevel)
|
||||
{
|
||||
factory.ApplyEnchantAndGemsNew();
|
||||
}
|
||||
bot->DurabilityRepairAll(false, 1.0f, false);
|
||||
|
||||
Reference in New Issue
Block a user