[Bots] Fix creation limit, spawn limit, level requirement checks (#4868)

* [Bots] Fix creation limit, spawn limit, level requirement checks

- Previously if buckets were being used to control any of these values and the appropriate rule was set to 0, unset class specific buckets would override the main limit buckets.
- For example, if `Bots:SpawnLimit` is set to `0` and a player has their `bot_spawn_limit` set to `5` but they don't have a class bucket set for the class they're attempting to spawn a Cleric, the unset `bot_spawn_limit_Cleric` would return 0 and prevent Clerics from being spawned.
- This affected spawn limits, creation limits and level requirements to use bots if controlled by buckets.
- `#gm on` is required to be on for those beyond the ruled min status requirements to bypass the limits.

Rewrote checks and tested every scenario of set unset rules/buckets.

* Cleanup, fix bot count

- Fixes QueryBotCount to not account for soft deleted bots (`-deleted-`)
This commit is contained in:
nytmyr
2025-05-14 20:13:50 -05:00
committed by GitHub
parent 780120036d
commit 4de8fbbd56
7 changed files with 181 additions and 255 deletions
+2 -2
View File
@@ -207,7 +207,7 @@ bool BotDatabase::QueryBotCount(const uint32 owner_id, int class_id, uint32& bot
bot_count = BotDataRepository::Count(
database,
fmt::format(
"`owner_id` = {}",
"`owner_id` = {} AND `name` NOT LIKE '%-deleted-%'",
owner_id
)
);
@@ -216,7 +216,7 @@ bool BotDatabase::QueryBotCount(const uint32 owner_id, int class_id, uint32& bot
bot_class_count = BotDataRepository::Count(
database,
fmt::format(
"`owner_id` = {} AND `class` = {}",
"`owner_id` = {} AND `class` = {} AND `name` NOT LIKE '%-deleted-%'",
owner_id,
class_id
)