From 9910b07a4e9744444654443b7c895adaab6f6e59 Mon Sep 17 00:00:00 2001 From: Uleat Date: Tue, 3 Dec 2019 23:39:46 -0500 Subject: [PATCH] Changed `Bots:AAExpansion` to `Bots:BotExpansionSettings` and converted it bitmask use; Fix for bots not honoring aa expansion setting --- common/ruletypes.h | 2 +- zone/aa.cpp | 16 ++++++++++++---- zone/bot.cpp | 8 +++++--- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/common/ruletypes.h b/common/ruletypes.h index 6dafb82c2..82eddca7f 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -572,7 +572,7 @@ RULE_CATEGORY_END() #ifdef BOTS RULE_CATEGORY(Bots) -RULE_INT(Bots, AAExpansion, 8, "Bots get AAs through this expansion") +RULE_INT(Bots, BotExpansionSettings, 16383, "Sets the expansion settings for bot use. Defaults to all expansions enabled up to TSS") RULE_BOOL(Bots, AllowCamelCaseNames, false, "Allows the use of 'MyBot' type names") RULE_INT(Bots, CommandSpellRank, 1, "Filters bot command spells by rank (1, 2 and 3 are valid filters - any other number allows all ranks)") RULE_INT(Bots, CreationLimit, 150, "Number of bots that each account can create") diff --git a/zone/aa.cpp b/zone/aa.cpp index 09a954331..1383ad2f9 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -1467,12 +1467,20 @@ bool Mob::CanUseAlternateAdvancementRank(AA::Rank *rank) { } } - if(IsClient()) { - if(rank->expansion && !(CastToClient()->GetPP().expansions & (1 << (rank->expansion - 1)))) { + if (IsClient()) { + if (rank->expansion && !(CastToClient()->GetPP().expansions & (1 << (rank->expansion - 1)))) { return false; } - } else { - if(rank->expansion && !(RuleI(World, ExpansionSettings) & (1 << (rank->expansion - 1)))) { + } +#ifdef BOTS + else if (IsBot()) { + if (rank->expansion && !(RuleI(Bots, BotExpansionSettings) & (1 << (rank->expansion - 1)))) { + return false; + } + } +#endif + else { + if (rank->expansion && !(RuleI(World, ExpansionSettings) & (1 << (rank->expansion - 1)))) { return false; } } diff --git a/zone/bot.cpp b/zone/bot.cpp index 50620cdd5..5f16cc15b 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -1606,7 +1606,7 @@ int32 Bot::GenerateBaseHitPoints() { } void Bot::LoadAAs() { - int maxAAExpansion = RuleI(Bots, AAExpansion); //get expansion to get AAs up to + aa_ranks.clear(); int id = 0; @@ -8852,15 +8852,17 @@ void Bot::CalcBotStats(bool showtext) { GetBotOwner()->Message(Chat::Yellow, "Updating %s...", GetCleanName()); } - if(!IsValidRaceClassCombo()) { + // this code is annoying since many classes change their name and illusions change the race id + /*if(!IsValidRaceClassCombo()) { GetBotOwner()->Message(Chat::Yellow, "A %s - %s bot was detected. Is this Race/Class combination allowed?.", GetRaceIDName(GetRace()), GetClassIDName(GetClass(), GetLevel())); GetBotOwner()->Message(Chat::Yellow, "Previous Bots Code releases did not check Race/Class combinations during create."); GetBotOwner()->Message(Chat::Yellow, "Unless you are experiencing heavy lag, you should delete and remake this bot."); - } + }*/ if(GetBotOwner()->GetLevel() != GetLevel()) SetLevel(GetBotOwner()->GetLevel()); + LoadAAs(); GenerateSpecialAttacks(); if(showtext) {