move minRateSpawn and maxRateSpawn to config.lua

This commit is contained in:
ErikasKontenis 2020-11-15 12:34:54 +02:00
parent 2546d1a0a5
commit 7c8949e444
6 changed files with 11 additions and 2 deletions

View File

@ -1,6 +1,9 @@
-- Custom
knightCloseAttackDamageIncreasePercent = 20
paladinRangeAttackDamageIncreasePercent = 15
-- Min/Max rate spawn is a multiplication of the map spawntime in spawns.xml Regular monster spawn time is 600. The formula would be randomValue = random(600*100, 600*200) which varies between 60s and 120s
minRateSpawn = 100
maxRateSpawn = 200
-- Combat settings
-- NOTE: valid values for worldType are: "pvp", "no-pvp" and "pvp-enforced"

View File

@ -1208,7 +1208,7 @@
<monster name="Wyvern" x="0" y="1" z="5" spawntime="600" />
</spawn>
<spawn centerx="33213" centery="31763" centerz="5" radius="1">
<monster name="Wyvern" x="0" y="0" z="5" spawntime="120" />
<monster name="Wyvern" x="0" y="0" z="5" spawntime="600" />
</spawn>
<spawn centerx="33233" centery="31764" centerz="5" radius="1">
<monster name="Wyvern" x="0" y="1" z="5" spawntime="600" />

View File

@ -101,6 +101,8 @@ bool ConfigManager::load()
integer[RATE_LOOT] = getGlobalNumber(L, "rateLoot", 2);
integer[RATE_MAGIC] = getGlobalNumber(L, "rateMagic", 3);
integer[RATE_SPAWN] = getGlobalNumber(L, "rateSpawn", 1);
integer[MIN_RATE_SPAWN] = getGlobalNumber(L, "minRateSpawn", 100);
integer[MAX_RATE_SPAWN] = getGlobalNumber(L, "maxRateSpawn", 200);
integer[BAN_LENGTH] = getGlobalNumber(L, "banLength", 30 * 24 * 60 * 60);
integer[ACTIONS_DELAY_INTERVAL] = getGlobalNumber(L, "timeBetweenActions", 200);
integer[EX_ACTIONS_DELAY_INTERVAL] = getGlobalNumber(L, "timeBetweenExActions", 1000);

View File

@ -87,6 +87,8 @@ class ConfigManager
RATE_LOOT,
RATE_MAGIC,
RATE_SPAWN,
MIN_RATE_SPAWN,
MAX_RATE_SPAWN,
BAN_LENGTH,
MAX_MESSAGEBUFFER,
ACTIONS_DELAY_INTERVAL,

View File

@ -1662,6 +1662,8 @@ void LuaScriptInterface::registerFunctions()
registerEnumIn("configKeys", ConfigManager::RATE_LOOT)
registerEnumIn("configKeys", ConfigManager::RATE_MAGIC)
registerEnumIn("configKeys", ConfigManager::RATE_SPAWN)
registerEnumIn("configKeys", ConfigManager::MIN_RATE_SPAWN)
registerEnumIn("configKeys", ConfigManager::MAX_RATE_SPAWN)
registerEnumIn("configKeys", ConfigManager::MAX_MESSAGEBUFFER)
registerEnumIn("configKeys", ConfigManager::ACTIONS_DELAY_INTERVAL)
registerEnumIn("configKeys", ConfigManager::EX_ACTIONS_DELAY_INTERVAL)

View File

@ -89,7 +89,7 @@ bool Spawns::loadFromXml(const std::string& filename)
spawnList.emplace_front(pos, radius);
Spawn& spawn = spawnList.front();
uint32_t interval = uniform_random(pugi::cast<uint32_t>(childNode.attribute("spawntime").value()) * 250, pugi::cast<uint32_t>(childNode.attribute("spawntime").value()) * 500);
uint32_t interval = uniform_random(pugi::cast<uint32_t>(childNode.attribute("spawntime").value()) * g_config.getNumber(ConfigManager::MIN_RATE_SPAWN), pugi::cast<uint32_t>(childNode.attribute("spawntime").value()) * g_config.getNumber(ConfigManager::MAX_RATE_SPAWN));
if (interval > MINSPAWN_INTERVAL) {
uint32_t exInterval = g_config.getNumber(ConfigManager::RATE_SPAWN);
if (exInterval) {