Skip to content

Commit

Permalink
Merge branch 'main' into hotfix/fix-scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
elsongabriel authored Nov 15, 2023
2 parents df24bd8 + 9dc47c0 commit 83766e3
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 37 deletions.
2 changes: 0 additions & 2 deletions config.lua.dist
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ onlyPremiumAccount = false
-- NOTE: buyBlessCommandFee will add fee when player buy bless by command (!bless), active changing value between 1 and 100 (fee percent. ex: 3 = 3%, 30 = 30%)
-- NOTE: teleportPlayerToVocationRoom will enable oressa to teleport player to his/her room vocation
-- NOTE: toggleReceiveReward = true, will enable players to choose one of reward exercise weapon by command !reward
-- NOTE: randomMonsterSpawn = true, will enable monsters from the same spawn to be randomized between them, thus making a variable hunt
weatherRain = false
thunderEffect = false
allConsoleLog = false
Expand All @@ -219,7 +218,6 @@ buyAolCommandFee = 0
buyBlessCommandFee = 0
teleportPlayerToVocationRoom = true
toggleReceiveReward = false
randomMonsterSpawn = false

-- Teleport summon
-- Set to true will never remove the summon
Expand Down
3 changes: 0 additions & 3 deletions data/modules/scripts/gamestore/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,6 @@ local function queueSendStoreAlertToUser(message, delay, playerId, storeErrorCod
end

function onRecvbyte(player, msg, byte)
if not configManager.getBoolean(STOREMODULES) then
return true
end
if player:getVocation():getId() == 0 and not GameStore.haveCategoryRook() then
return player:sendCancelMessage("Store don't have offers for rookgaard citizen.")
end
Expand Down
1 change: 0 additions & 1 deletion src/config/config_definitions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ enum booleanConfig_t {
PARTY_AUTO_SHARE_EXPERIENCE,
PARTY_SHARE_LOOT_BOOSTS,
RESET_SESSIONS_ON_STARTUP,
RANDOM_MONSTER_SPAWN,
TOGGLE_WHEELSYSTEM,
TOGGLE_ATTACK_SPEED_ONFIST,
VIP_SYSTEM_ENABLED,
Expand Down
1 change: 0 additions & 1 deletion src/config/configmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ bool ConfigManager::load() {
boolean[OPTIMIZE_DATABASE] = getGlobalBoolean(L, "startupDatabaseOptimization", true);
boolean[TOGGLE_MAP_CUSTOM] = getGlobalBoolean(L, "toggleMapCustom", true);
boolean[TOGGLE_MAINTAIN_MODE] = getGlobalBoolean(L, "toggleMaintainMode", false);
boolean[RANDOM_MONSTER_SPAWN] = getGlobalBoolean(L, "randomMonsterSpawn", false);
string[MAINTAIN_MODE_MESSAGE] = getGlobalString(L, "maintainModeMessage", "");

string[IP] = getGlobalString(L, "ip", "127.0.0.1");
Expand Down
45 changes: 16 additions & 29 deletions src/creatures/monsters/spawns/spawn_monster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,7 @@ void SpawnMonster::startup() {
for (const auto &it : spawnMonsterMap) {
uint32_t spawnMonsterId = it.first;
const spawnBlock_t &sb = it.second;
if (g_configManager().getBoolean(RANDOM_MONSTER_SPAWN)) {
const spawnBlock_t &randSb = std::next(spawnMonsterMap.begin(), uniform_random(0, spawnMonsterMap.size() - 1))->second;
spawnMonster(spawnMonsterId, randSb.monsterType, sb.pos, sb.direction, true);
} else {
spawnMonster(spawnMonsterId, sb.monsterType, sb.pos, sb.direction, true);
}
spawnMonster(spawnMonsterId, sb.monsterType, sb.pos, sb.direction, true);
}
}

Expand All @@ -220,35 +215,27 @@ void SpawnMonster::checkSpawnMonster() {
continue;
}

const spawnBlock_t &sb = it.second;

spawnBlock_t &sb = it.second;
if (!sb.monsterType->canSpawn(sb.pos)) {
spawnMonsterMap[spawnMonsterId].lastSpawn = OTSYS_TIME();
continue;
}

if (sb.monsterType->info.isBlockable && findPlayer(sb.pos)) {
spawnMonsterMap[spawnMonsterId].lastSpawn = OTSYS_TIME();
sb.lastSpawn = OTSYS_TIME();
continue;
}

spawnBlock_t currentSb;
if (g_configManager().getBoolean(RANDOM_MONSTER_SPAWN)) {
currentSb = std::next(spawnMonsterMap.begin(), uniform_random(0, spawnMonsterMap.size() - 1))->second;
currentSb.pos = sb.pos;
currentSb.direction = sb.direction;
} else {
currentSb = sb;
}
if (OTSYS_TIME() >= sb.lastSpawn + sb.interval) {
if (sb.monsterType->info.isBlockable && findPlayer(sb.pos)) {
sb.lastSpawn = OTSYS_TIME();
continue;
}

if (currentSb.monsterType->info.isBlockable) {
spawnMonster(spawnMonsterId, currentSb.monsterType, currentSb.pos, currentSb.direction, true);
} else {
scheduleSpawn(spawnMonsterId, currentSb, 3 * NONBLOCKABLE_SPAWN_MONSTER_INTERVAL);
}
if (sb.monsterType->info.isBlockable) {
spawnMonster(spawnMonsterId, sb.monsterType, sb.pos, sb.direction);
} else {
scheduleSpawn(spawnMonsterId, sb, 3 * NONBLOCKABLE_SPAWN_MONSTER_INTERVAL);
}

if (++spawnMonsterCount >= static_cast<uint32_t>(g_configManager().getNumber(RATE_SPAWN))) {
break;
if (++spawnMonsterCount >= static_cast<uint32_t>(g_configManager().getNumber(RATE_SPAWN))) {
break;
}
}
}

Expand Down
1 change: 0 additions & 1 deletion src/lua/functions/core/game/config_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ void ConfigFunctions::init(lua_State* L) {
registerEnumIn(L, "configKeys", RED_SKULL_DURATION);
registerEnumIn(L, "configKeys", BLACK_SKULL_DURATION);
registerEnumIn(L, "configKeys", ORANGE_SKULL_DURATION);
registerEnumIn(L, "configKeys", RANDOM_MONSTER_SPAWN);
registerEnumIn(L, "configKeys", RATE_MONSTER_HEALTH);
registerEnumIn(L, "configKeys", RATE_MONSTER_ATTACK);
registerEnumIn(L, "configKeys", RATE_MONSTER_DEFENSE);
Expand Down

0 comments on commit 83766e3

Please sign in to comment.