Skip to content

Commit

Permalink
Add option to configure default reaction and dead strategies from alt…
Browse files Browse the repository at this point in the history
… bots and random bots
  • Loading branch information
davidonete committed Oct 15, 2023
1 parent 899314b commit b74c181
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 5 deletions.
18 changes: 18 additions & 0 deletions playerbot/AiFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1113,6 +1113,15 @@ void AiFactory::AddDefaultDeadStrategies(Player* player, PlayerbotAI* const faca
break;
}
}

if (facade->IsRealPlayer() || sRandomPlayerbotMgr.IsFreeBot(player))
{
deadEngine->ChangeStrategy(sPlayerbotAIConfig.randomBotDeadStrategies);
}
else
{
deadEngine->ChangeStrategy(sPlayerbotAIConfig.deadStrategies);
}
}

Engine* AiFactory::createDeadEngine(Player* player, PlayerbotAI* const facade, AiObjectContext* AiObjectContext)
Expand Down Expand Up @@ -1255,6 +1264,15 @@ void AiFactory::AddDefaultReactionStrategies(Player* player, PlayerbotAI* const
break;
}
}

if (facade->IsRealPlayer() || sRandomPlayerbotMgr.IsFreeBot(player))
{
reactionEngine->ChangeStrategy(sPlayerbotAIConfig.randomBotReactStrategies);
}
else
{
reactionEngine->ChangeStrategy(sPlayerbotAIConfig.reactStrategies);
}
}

ReactionEngine* AiFactory::createReactionEngine(Player* player, PlayerbotAI* const facade, AiObjectContext* AiObjectContext)
Expand Down
4 changes: 4 additions & 0 deletions playerbot/PlayerbotAIConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,12 @@ bool PlayerbotAIConfig::Initialize()

randomBotCombatStrategies = config.GetStringDefault("AiPlayerbot.RandomBotCombatStrategies", "-threat,+custom::say");
randomBotNonCombatStrategies = config.GetStringDefault("AiPlayerbot.RandomBotNonCombatStrategies", "+custom::say");
randomBotReactStrategies = config.GetStringDefault("AiPlayerbot.RandomBotReactStrategies", "");
randomBotDeadStrategies = config.GetStringDefault("AiPlayerbot.RandomBotDeadStrategies", "");
combatStrategies = config.GetStringDefault("AiPlayerbot.CombatStrategies", "");
nonCombatStrategies = config.GetStringDefault("AiPlayerbot.NonCombatStrategies", "+return,+delayed roll");
reactStrategies = config.GetStringDefault("AiPlayerbot.ReactStrategies", "");
deadStrategies = config.GetStringDefault("AiPlayerbot.DeadStrategies", "");

commandPrefix = config.GetStringDefault("AiPlayerbot.CommandPrefix", "");
commandSeparator = config.GetStringDefault("AiPlayerbot.CommandSeparator", "\\\\");
Expand Down
4 changes: 2 additions & 2 deletions playerbot/PlayerbotAIConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ class PlayerbotAIConfig
bool logInGroupOnly, logValuesPerTick;
bool fleeingEnabled;
bool summonAtInnkeepersEnabled;
std::string combatStrategies, nonCombatStrategies;
std::string randomBotCombatStrategies, randomBotNonCombatStrategies;
std::string combatStrategies, nonCombatStrategies, reactStrategies, deadStrategies;
std::string randomBotCombatStrategies, randomBotNonCombatStrategies, randomBotReactStrategies, randomBotDeadStrategies;
uint32 randomBotMinLevel, randomBotMaxLevel;
float randomChangeMultiplier;
uint32 specProbability[MAX_CLASSES][10];
Expand Down
5 changes: 4 additions & 1 deletion playerbot/aiplayerbot.conf.dist.in
Original file line number Diff line number Diff line change
Expand Up @@ -627,9 +627,12 @@ AiPlayerbot.FleeingEnabled = 1
# Random bot default strategies (applied after defaults)
#AiPlayerbot.RandomBotCombatStrategies = +dps,+dps assist,-threat
#AiPlayerbot.RandomBotNonCombatStrategies = +grind,+loot,+rpg,+custom::say
#AiPlayerbot.RandomBotReactStrategies =
#AiPlayerbot.RandomBotDeadStrategies =
#AiPlayerbot.CombatStrategies = +custom::say
#AiPlayerbot.NonCombatStrategies = +custom::say,+return,+delayed roll

#AiPlayerbot.ReactStrategies =
#AiPlayerbot.DeadStrategies =

# How often tasks are changed
#AiPlayerbot.MinGuildTaskChangeTime = 172800
Expand Down
5 changes: 4 additions & 1 deletion playerbot/aiplayerbot.conf.dist.in.tbc
Original file line number Diff line number Diff line change
Expand Up @@ -686,9 +686,12 @@ AiPlayerbot.FleeingEnabled = 1
# Random bot default strategies (applied after defaults)
#AiPlayerbot.RandomBotCombatStrategies = +dps,+dps assist,-threat
#AiPlayerbot.RandomBotNonCombatStrategies = +grind,+loot,+rpg,+custom::say
#AiPlayerbot.RandomBotReactStrategies =
#AiPlayerbot.RandomBotDeadStrategies =
#AiPlayerbot.CombatStrategies = +custom::say
#AiPlayerbot.NonCombatStrategies = +custom::say,+return,+delayed roll

#AiPlayerbot.ReactStrategies =
#AiPlayerbot.DeadStrategies =

# How often tasks are changed
#AiPlayerbot.MinGuildTaskChangeTime = 172800
Expand Down
5 changes: 4 additions & 1 deletion playerbot/aiplayerbot.conf.dist.in.wotlk
Original file line number Diff line number Diff line change
Expand Up @@ -627,9 +627,12 @@ AiPlayerbot.FleeingEnabled = 1
# Random bot default strategies (applied after defaults)
#AiPlayerbot.RandomBotCombatStrategies = +dps,+dps assist,-threat
#AiPlayerbot.RandomBotNonCombatStrategies = +grind,+loot,+rpg,+custom::say
#AiPlayerbot.RandomBotReactStrategies =
#AiPlayerbot.RandomBotDeadStrategies =
#AiPlayerbot.CombatStrategies = +custom::say
#AiPlayerbot.NonCombatStrategies = +custom::say,+return,+delayed roll

#AiPlayerbot.ReactStrategies =
#AiPlayerbot.DeadStrategies =

# How often tasks are changed
#AiPlayerbot.MinGuildTaskChangeTime = 172800
Expand Down

0 comments on commit b74c181

Please sign in to comment.