Add zero check for bot spawn limits

If the spawn limit rule is set to 0 and spawn limit is set by bucket, if no class buckets are set, it defaults to the rule of 0 and renders the player unable to spawn bots.

This adds a check where if the rule and class bucket are 0, it will check for the spawn limit bucket
This commit is contained in:
nytmyr
2025-01-08 00:28:33 -06:00
parent 85bd031992
commit de053ce8f3
2 changed files with 24 additions and 3 deletions
+15
View File
@@ -88,8 +88,22 @@ int Client::GetBotSpawnLimit(uint8 class_id)
);
auto bucket_value = GetBucket(bucket_name);
if (class_id && !bot_spawn_limit && bucket_value.empty()) {
const auto new_bucket_name = "bot_spawn_limit";
bucket_value = GetBucket(new_bucket_name);
if (!bucket_value.empty() && Strings::IsNumber(bucket_value)) {
bot_spawn_limit = Strings::ToInt(bucket_value);
return bot_spawn_limit;
}
}
if (!bucket_value.empty() && Strings::IsNumber(bucket_value)) {
bot_spawn_limit = Strings::ToInt(bucket_value);
return bot_spawn_limit;
}
@@ -101,6 +115,7 @@ int Client::GetBotSpawnLimit(uint8 class_id)
);
auto results = database.QueryDatabase(query); // use 'database' for non-bot table calls
if (!results.Success() || !results.RowCount()) {
return bot_spawn_limit;
}