mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-10 15:00:25 +00:00
Add zone specific spawn limits and zone specific forced spawn limits
This commit is contained in:
@@ -895,6 +895,10 @@ RULE_INT(Bots, CampTimer, 25, "Number of seconds after /camp has begun before bo
|
||||
RULE_BOOL(Bots, SendClassRaceOnHelp, true, "If enabled a reminder of how to check class/race IDs will be sent when using compatible commands.")
|
||||
RULE_BOOL(Bots, AllowCrossGroupRaidAssist, true, "If enabled bots will autodefend group or raid members set as main assist.")
|
||||
RULE_BOOL(Bots, AllowBotBlockedBuffs, true, "If enabled, you can create blocked buffs for each bot and for their pets.")
|
||||
RULE_STRING(Bots, ZonesWithSpawnLimits, "", "Comma-delimited list of zones where different bot spawn limits apply. This is the max a zone allows.")
|
||||
RULE_STRING(Bots, ZoneSpawnLimits, "", "Comma-delimited list of spawn limits for zones.")
|
||||
RULE_STRING(Bots, ZonesWithForcedSpawnLimits, "", "Comma-delimited list of zones where bot spawn limits are forced. This will take priority over any other type of spawn limits.")
|
||||
RULE_STRING(Bots, ZoneForcedSpawnLimits, "", "Comma-delimited list of forced spawn limits for zones.")
|
||||
RULE_CATEGORY_END()
|
||||
|
||||
RULE_CATEGORY(Chat)
|
||||
|
||||
+46
-2
@@ -103,8 +103,6 @@ int Client::GetBotSpawnLimit(uint8 class_id)
|
||||
|
||||
if (!bucket_value.empty() && Strings::IsNumber(bucket_value)) {
|
||||
bot_spawn_limit = Strings::ToInt(bucket_value);
|
||||
|
||||
return bot_spawn_limit;
|
||||
}
|
||||
|
||||
if (RuleB(Bots, QuestableSpawnLimit)) {
|
||||
@@ -124,6 +122,52 @@ int Client::GetBotSpawnLimit(uint8 class_id)
|
||||
bot_spawn_limit = Strings::ToInt(row[0]);
|
||||
}
|
||||
|
||||
const auto& zones_list = Strings::Split(RuleS(Bots, ZonesWithSpawnLimits), ",");
|
||||
const auto& zones_limits_list = Strings::Split(RuleS(Bots, ZoneSpawnLimits), ",");
|
||||
int i = 0;
|
||||
|
||||
for (const auto& result : zones_list) {
|
||||
try {
|
||||
if (
|
||||
std::stoul(result) == zone->GetZoneID() &&
|
||||
std::stoul(zones_limits_list[i]) < bot_spawn_limit
|
||||
) {
|
||||
bot_spawn_limit = std::stoul(zones_limits_list[i]);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
++i;
|
||||
}
|
||||
|
||||
catch (const std::exception& e) {
|
||||
LogInfo("Invalid entry in Rule VegasScaling:SpecialScalingZones or SpecialScalingZonesVersions: [{}]", e.what());
|
||||
}
|
||||
}
|
||||
|
||||
const auto& zones_forced_list = Strings::Split(RuleS(Bots, ZonesWithForcedSpawnLimits), ",");
|
||||
const auto& zones_forced_limits_list = Strings::Split(RuleS(Bots, ZoneForcedSpawnLimits), ",");
|
||||
i = 0;
|
||||
|
||||
for (const auto& result : zones_forced_list) {
|
||||
try {
|
||||
if (
|
||||
std::stoul(result) == zone->GetZoneID() &&
|
||||
std::stoul(zones_forced_limits_list[i]) != bot_spawn_limit
|
||||
) {
|
||||
bot_spawn_limit = std::stoul(zones_forced_limits_list[i]);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
++i;
|
||||
}
|
||||
|
||||
catch (const std::exception& e) {
|
||||
LogInfo("Invalid entry in Rule VegasScaling:SpecialScalingZones or SpecialScalingZonesVersions: [{}]", e.what());
|
||||
}
|
||||
}
|
||||
|
||||
return bot_spawn_limit;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user