[Bots] Cleanup and remove preprocessors. (#2757)

* [Bots] Cleanup and remove preprocessors.

- Removes every `#ifdef BOTS` we have and locks bots behind `Bots:AllowBots` rule.
- Bot updates are now done by default similar to regular database updates.
- Modify `CMakeLists.txt`, `.drone.yml`, and `BUILD.md` to match the removal of `EQEMU_ENABLE_BOTS`.

* Cleanup

- Add SQL for enabling bots for servers with bots.
- Add message that tells players/operators bots are disabled.

* Suggested changes.

* Bot injection stuff

* Change SQL to bot SQL.

* Tweaks

* Remove `is_bot`

* Update version.h

* Update main.cpp

* Update database.cpp

* Fix name availability crash

* Remove bots from update script

Co-authored-by: Akkadius <akkadius1@gmail.com>
This commit is contained in:
Alex King
2023-01-20 13:35:33 -05:00
committed by GitHub
parent 1f0b2a8991
commit 3335cacac1
91 changed files with 263 additions and 1150 deletions
+4 -16
View File
@@ -2,9 +2,7 @@
#include "../../common/http/httplib.h"
#include "../../common/content/world_content_service.h"
#ifdef BOTS
#include "../bot.h"
#endif
void command_gearup(Client *c, const Seperator *sep)
{
@@ -12,10 +10,8 @@ void command_gearup(Client *c, const Seperator *sep)
if (
c->GetTarget() &&
(
(c->GetTarget()->IsClient() && c->GetGM())
#ifdef BOTS
|| c->GetTarget()->IsBot()
#endif
(c->GetTarget()->IsClient() && c->GetGM()) ||
c->GetTarget()->IsBot()
)
) {
t = c->GetTarget();
@@ -119,19 +115,15 @@ void command_gearup(Client *c, const Seperator *sep)
bool has_item = false;
if (t->IsClient()) {
has_item = t->CastToClient()->GetInv().HasItem(item_id, 1, invWhereWorn) != INVALID_INDEX;
#ifdef BOTS
} else if (t->IsBot()) {
has_item = t->CastToBot()->HasBotItem(item_id);
#endif
}
bool can_wear_item = false;
if (t->IsClient()) {
can_wear_item = !t->CastToClient()->CheckLoreConflict(item) && !has_item;
#ifdef BOTS
} else if (t->IsBot()) {
can_wear_item = !t->CastToBot()->CheckLoreConflict(item) && !has_item;
#endif
}
if (!can_wear_item) {
@@ -142,10 +134,8 @@ void command_gearup(Client *c, const Seperator *sep)
can_wear_item &&
t->CanClassEquipItem(item_id) &&
(
t->CanRaceEquipItem(item_id)
#ifdef BOTS
|| (t->IsBot() && !t->CanRaceEquipItem(item_id) && RuleB(Bots, AllowBotEquipAnyRaceGear))
#endif
t->CanRaceEquipItem(item_id) ||
(t->IsBot() && !t->CanRaceEquipItem(item_id) && RuleB(Bots, AllowBotEquipAnyRaceGear))
)
) {
equipped.insert(slot_id);
@@ -156,10 +146,8 @@ void command_gearup(Client *c, const Seperator *sep)
0, 0, 0, 0, 0, 0, 0, 0,
slot_id
);
#ifdef BOTS
} else if (t->IsBot()) {
t->CastToBot()->AddBotItem(slot_id, item_id);
#endif
}
items_equipped++;
+3 -6
View File
@@ -13,7 +13,7 @@ void command_level(Client *c, const Seperator *sep)
c->Message(Chat::White, "You must have a target to use this command.");
return;
}
auto level = static_cast<uint8>(std::stoul(sep->arg[1]));
auto max_level = static_cast<uint8>(RuleI(Character, MaxLevel));
@@ -41,11 +41,8 @@ void command_level(Client *c, const Seperator *sep)
if (target->IsClient()) {
target->CastToClient()->SendLevelAppearance();
#ifdef BOTS
if (RuleB(Bots, BotLevelsWithOwner)) {
if (RuleB(Bots, Enabled) && RuleB(Bots, BotLevelsWithOwner)) {
Bot::LevelBotWithClient(target->CastToClient(), level, true);
}
#endif
}
}
}
+1 -3
View File
@@ -53,12 +53,10 @@ void command_zone(Client *c, const Seperator *sep)
return;
}
#ifdef BOTS
// This block is necessary to clean up any bot objects owned by a Client
if (zone_id != c->GetZoneID()) {
if (RuleB(Bots, Enabled) && zone_id != c->GetZoneID()) {
Bot::ProcessClientZoneChange(c);
}
#endif
// fetch zone data
auto zd = GetZoneVersionWithFallback(zone_id, 0);