Compare commits

..

No commits in common. "bc737ecc68dfe7b46694f18d3a2c682c79536f5e" and "2dad8bf01df1d65f0a57639d67db94ff93ee293b" have entirely different histories.

9 changed files with 28 additions and 36 deletions

View File

@ -174,6 +174,10 @@ AiPlayerbot.SummonWhenGroup = 1
# Selfbot permission level (0 = disabled, 1 = GM only (default), 2 = all players, 3 = activate on login)
AiPlayerbot.SelfBotLevel = 1
# Give free food to bots
# Default: 1 (enabled)
AiPlayerbot.FreeFood = 1
# Non-GM player can only use init=auto to initialize bots based on their own level and gearscore
# Default: 0 (non-GM player can use any intialization commands)
AiPlayerbot.AutoInitOnly = 0
@ -492,7 +496,6 @@ AiPlayerbot.AutoGearQualityLimit = 3
AiPlayerbot.AutoGearScoreLimit = 0
# Enable/Disable cheats for bots
# "food" (bots use cheat when eat or drink)
# "gold" (bots have infinite gold)
# "health" (bots have infinite health)
# "mana" (bots have infinite mana)
@ -501,7 +504,7 @@ AiPlayerbot.AutoGearScoreLimit = 0
# "raid" (bots use cheats implemented into raid strategies)
# To use multiple cheats, separate them by commas below (e.g., to enable all, use "gold,health,mana,power,raid,taxi")
# Default: taxi and raid are enabled
AiPlayerbot.BotCheats = "food,taxi,raid"
AiPlayerbot.BotCheats = "taxi,raid"
#
#
@ -1117,7 +1120,7 @@ AiPlayerbot.DeleteRandomBotArenaTeams = 0
AiPlayerbot.PvpProhibitedZoneIds = "2255,656,2361,2362,2363,976,35,2268,3425,392,541,1446,3828,3712,3738,3565,3539,3623,4152,3988,4658,4284,4418,4436,4275,4323,4395,3703,4298,3951"
# PvP Restricted Areas (bots don't pvp)
AiPlayerbot.PvpProhibitedAreaIds = "976,35,392,2268,4161,4010,4317,4312,3649,3887,3958,3724,4080,3938,3754"
AiPlayerbot.PvpProhibitedAreaIds = "976,35,392,2268,4161,4010,4317,4312,3649,3887,3958,3724,4080"
# Improve reaction speeds in battlegrounds and arenas (may cause lag)
AiPlayerbot.FastReactInBG = 1

View File

@ -150,10 +150,8 @@ bool PlayerbotAIConfig::Initialize()
"2255,656,2361,2362,2363,976,35,2268,3425,392,541,1446,3828,3712,3738,3565,"
"3539,3623,4152,3988,4658,4284,4418,4436,4275,4323,4395,3703,4298,3951"),
pvpProhibitedZoneIds);
LoadList<std::vector<uint32>>(
sConfigMgr->GetOption<std::string>("AiPlayerbot.PvpProhibitedAreaIds",
"976,35,392,2268,4161,4010,4317,4312,3649,3887,3958,3724,4080,3938,3754"),
pvpProhibitedAreaIds);
LoadList<std::vector<uint32>>(sConfigMgr->GetOption<std::string>("AiPlayerbot.PvpProhibitedAreaIds", "976,35"),
pvpProhibitedAreaIds);
fastReactInBG = sConfigMgr->GetOption<bool>("AiPlayerbot.FastReactInBG", true);
LoadList<std::vector<uint32>>(
sConfigMgr->GetOption<std::string>("AiPlayerbot.RandomBotQuestIds", "7848,3802,5505,6502,7761"),
@ -462,13 +460,11 @@ bool PlayerbotAIConfig::Initialize()
}
botCheats.clear();
LoadListString<std::vector<std::string>>(sConfigMgr->GetOption<std::string>("AiPlayerbot.BotCheats", "food,taxi,raid"),
LoadListString<std::vector<std::string>>(sConfigMgr->GetOption<std::string>("AiPlayerbot.BotCheats", "taxi,raid"),
botCheats);
botCheatMask = 0;
if (std::find(botCheats.begin(), botCheats.end(), "food") != botCheats.end())
botCheatMask |= (uint32)BotCheatMask::food;
if (std::find(botCheats.begin(), botCheats.end(), "taxi") != botCheats.end())
botCheatMask |= (uint32)BotCheatMask::taxi;
if (std::find(botCheats.begin(), botCheats.end(), "gold") != botCheats.end())
@ -600,6 +596,7 @@ bool PlayerbotAIConfig::Initialize()
RpgStatusProbWeight[RPG_REST] = sConfigMgr->GetOption<int32>("AiPlayerbot.RpgStatusProbWeight.Rest", 5);
syncLevelWithPlayers = sConfigMgr->GetOption<bool>("AiPlayerbot.SyncLevelWithPlayers", false);
freeFood = sConfigMgr->GetOption<bool>("AiPlayerbot.FreeFood", true);
randomBotGroupNearby = sConfigMgr->GetOption<bool>("AiPlayerbot.RandomBotGroupNearby", true);
// arena

View File

@ -23,8 +23,7 @@ enum class BotCheatMask : uint32
mana = 8,
power = 16,
raid = 32,
food = 64,
maxMask = 128
maxMask = 64
};
enum class HealingManaEfficiency : uint8
@ -341,6 +340,7 @@ public:
bool enableNewRpgStrategy;
std::unordered_map<NewRpgStatus, uint32> RpgStatusProbWeight;
bool syncLevelWithPlayers;
bool freeFood;
bool autoLearnQuestSpells;
bool autoTeleportForLevel;
bool randomBotGroupNearby;

View File

@ -3244,7 +3244,7 @@ std::vector<uint32> PlayerbotFactory::GetCurrentGemsCount()
void PlayerbotFactory::InitFood()
{
if (!botAI->HasCheat(BotCheatMask::food))
if (sPlayerbotAIConfig->freeFood)
{
return;
}

View File

@ -76,7 +76,7 @@ bool GiveFoodAction::isUseful()
bool isRandomBot = GetTarget()->IsPlayer() && sRandomPlayerbotMgr->IsRandomBot((Player*)GetTarget());
return !isRandomBot || (isRandomBot && !botAI->HasCheat(BotCheatMask::food));
return !isRandomBot || (isRandomBot && !sPlayerbotAIConfig->freeFood);
}
Unit* GiveWaterAction::GetTarget() { return AI_VALUE(Unit*, "party member without water"); }
@ -88,5 +88,5 @@ bool GiveWaterAction::isUseful()
bool isRandomBot = GetTarget()->IsPlayer() && sRandomPlayerbotMgr->IsRandomBot((Player*)GetTarget());
return !isRandomBot || (isRandomBot && !botAI->HasCheat(BotCheatMask::food));
return !isRandomBot || (isRandomBot && !sPlayerbotAIConfig->freeFood);
}

View File

@ -17,7 +17,7 @@ bool DrinkAction::Execute(Event event)
if (!hasMana)
return false;
if (botAI->HasCheat(BotCheatMask::food))
if (sPlayerbotAIConfig->freeFood)
{
// if (bot->IsNonMeleeSpellCast(true))
// return false;
@ -54,11 +54,11 @@ bool DrinkAction::Execute(Event event)
return UseItemAction::Execute(event);
}
bool DrinkAction::isUseful() { return UseItemAction::isUseful() && AI_VALUE2(uint8, "mana", "self target") < 100; }
bool DrinkAction::isUseful() { return UseItemAction::isUseful() && AI_VALUE2(uint8, "mana", "self target") < 85; }
bool DrinkAction::isPossible()
{
return !bot->IsInCombat() && (botAI->HasCheat(BotCheatMask::food) || UseItemAction::isPossible());
return !bot->IsInCombat() && (sPlayerbotAIConfig->freeFood || UseItemAction::isPossible());
}
bool EatAction::Execute(Event event)
@ -66,7 +66,7 @@ bool EatAction::Execute(Event event)
if (bot->IsInCombat())
return false;
if (botAI->HasCheat(BotCheatMask::food))
if (sPlayerbotAIConfig->freeFood)
{
// if (bot->IsNonMeleeSpellCast(true))
// return false;
@ -107,5 +107,5 @@ bool EatAction::isUseful() { return UseItemAction::isUseful() && AI_VALUE2(uint8
bool EatAction::isPossible()
{
return !bot->IsInCombat() && (botAI->HasCheat(BotCheatMask::food) || UseItemAction::isPossible());
return !bot->IsInCombat() && (sPlayerbotAIConfig->freeFood || UseItemAction::isPossible());
}

View File

@ -11,14 +11,13 @@
void UseFoodStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
{
Strategy::InitTriggers(triggers);
if (botAI->HasCheat(BotCheatMask::food))
{
if (sPlayerbotAIConfig->freeFood)
triggers.push_back(new TriggerNode("medium health", NextAction::array(0, new NextAction("food", 3.0f), nullptr)));
triggers.push_back(new TriggerNode("high mana", NextAction::array(0, new NextAction("drink", 3.0f), nullptr)));
}
else
{
triggers.push_back(new TriggerNode("low health", NextAction::array(0, new NextAction("food", 3.0f), nullptr)));
if (sPlayerbotAIConfig->freeFood)
triggers.push_back(new TriggerNode("high mana", NextAction::array(0, new NextAction("drink", 3.0f), nullptr)));
else
triggers.push_back(new TriggerNode("low mana", NextAction::array(0, new NextAction("drink", 3.0f), nullptr)));
}
}

View File

@ -1060,13 +1060,6 @@ bool NewRpgBaseAction::RandomChangeStatus(std::vector<NewRpgStatus> candidateSta
probSum += sPlayerbotAIConfig->RpgStatusProbWeight[status];
}
}
// Safety check. Default to "rest" if all RPG weights = 0
if (availableStatus.empty() || probSum == 0)
{
botAI->rpgInfo.ChangeToRest();
bot->SetStandState(UNIT_STAND_STATE_SIT);
return true;
}
uint32 rand = urand(1, probSum);
uint32 accumulate = 0;
NewRpgStatus chosenStatus = RPG_STATUS_END;

View File

@ -249,7 +249,7 @@ bool AoeTrigger::IsActive()
bool NoFoodTrigger::IsActive()
{
bool isRandomBot = sRandomPlayerbotMgr->IsRandomBot(bot);
if (isRandomBot && botAI->HasCheat(BotCheatMask::food))
if (isRandomBot && sPlayerbotAIConfig->freeFood)
return false;
return AI_VALUE2(std::vector<Item*>, "inventory items", "conjured food").empty();
@ -258,7 +258,7 @@ bool NoFoodTrigger::IsActive()
bool NoDrinkTrigger::IsActive()
{
bool isRandomBot = sRandomPlayerbotMgr->IsRandomBot(bot);
if (isRandomBot && botAI->HasCheat(BotCheatMask::food))
if (isRandomBot && sPlayerbotAIConfig->freeFood)
return false;
return AI_VALUE2(std::vector<Item*>, "inventory items", "conjured water").empty();