Skip to content

Commit

Permalink
fix: some changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dudantas committed Nov 13, 2024
1 parent 17eb693 commit c2e7443
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/game/scheduling/events_scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ bool EventsScheduler::loadScheduleEventFromJson() {
g_kv().scoped("eventscheduler")->remove("double-bestiary");
g_kv().scoped("eventscheduler")->remove("double-bosstiary");
g_kv().scoped("eventscheduler")->remove("fast-exercise");
g_kv().scoped("eventscheduler")->remove("boss-cooldown");

using json = nlohmann::json;
auto coreFolder = g_configManager().getString(CORE_DIRECTORY);
Expand Down Expand Up @@ -106,20 +107,26 @@ bool EventsScheduler::loadScheduleEventFromJson() {

if (rates.exprate != 100 && currentEventRates.exprate != 100 && rates.exprate == currentEventRates.exprate) {
modifiedRates.emplace_back("exprate");
g_eventsScheduler().setExpSchedule(rates.exprate);
}
if (rates.lootrate != 100 && currentEventRates.lootrate != 100 && rates.lootrate == currentEventRates.lootrate) {
modifiedRates.emplace_back("lootrate");
g_eventsScheduler().setLootSchedule(rates.lootrate);
}
if (rates.bosslootrate != 100 && currentEventRates.bosslootrate != 100 && rates.bosslootrate == currentEventRates.bosslootrate) {
modifiedRates.emplace_back("bosslootrate");
g_eventsScheduler().setBossLootSchedule(rates.bosslootrate);
}
if (rates.spawnrate != 100 && currentEventRates.spawnrate != 100 && rates.spawnrate == currentEventRates.spawnrate) {
modifiedRates.emplace_back("spawnrate");
g_eventsScheduler().setSpawnMonsterSchedule(rates.spawnrate);
}
if (rates.skillrate != 100 && currentEventRates.skillrate != 100 && rates.skillrate == currentEventRates.skillrate) {
modifiedRates.emplace_back("skillrate");
g_eventsScheduler().setSkillSchedule(rates.skillrate);
}

// KV changes
if (rates.forgeChance != 100 && currentEventRates.forgeChance != 100 && rates.forgeChance == currentEventRates.forgeChance) {
modifiedRates.emplace_back("forge-chance");
g_kv().scoped("eventscheduler")->set("forge-chance", rates.forgeChance - 100);
Expand All @@ -142,7 +149,7 @@ bool EventsScheduler::loadScheduleEventFromJson() {

if (rates.bosscooldown != 100 && currentEventRates.bosscooldown != 100 && rates.bosscooldown == currentEventRates.bosscooldown) {
modifiedRates.emplace_back("bosscooldown");
g_kv().scoped("eventscheduler")->set("bosscooldown", rates.bosscooldown - 100);
g_kv().scoped("eventscheduler")->set("boss-cooldown", rates.bosscooldown - 100);
}

if (!modifiedRates.empty()) {
Expand Down
2 changes: 1 addition & 1 deletion src/server/network/protocol/protocolgame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9132,7 +9132,7 @@ void ProtocolGame::sendBosstiaryCooldownTimer() {
continue;
}

auto scheduleTimerOpt = g_kv().scoped("eventscheduler")->get("bosscooldown");
auto scheduleTimerOpt = g_kv().scoped("eventscheduler")->get("boss-cooldown");
uint8_t schedulePercentage = 0;
if (scheduleTimerOpt) {
schedulePercentage = static_cast<uint8_t>(scheduleTimerOpt->getNumber());
Expand Down

0 comments on commit c2e7443

Please sign in to comment.