From e4d519c21558aa1702443c1e09ac04d42a12d52a Mon Sep 17 00:00:00 2001 From: Eduardo Dantas Date: Wed, 20 Nov 2024 18:25:32 -0300 Subject: [PATCH 1/3] fix: boss lever check god access --- data/libs/functions/boss_lever.lua | 4 ++-- src/utils/pugicast.hpp | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/data/libs/functions/boss_lever.lua b/data/libs/functions/boss_lever.lua index 40bc8e0b4b0..ca3c5b1efec 100644 --- a/data/libs/functions/boss_lever.lua +++ b/data/libs/functions/boss_lever.lua @@ -177,8 +177,8 @@ function BossLever:onUse(player) return true end - local isAccountNormal = creature:getAccountType() == ACCOUNT_TYPE_NORMAL - if isAccountNormal and creature:getLevel() < self.requiredLevel then + local isAccountGod = creature:getAccountType() < ACCOUNT_TYPE_GAMEMASTER + if not isAccountGod and creature:getLevel() < self.requiredLevel then local message = "All players need to be level " .. self.requiredLevel .. " or higher." creature:sendTextMessage(MESSAGE_EVENT_ADVANCE, message) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, message) diff --git a/src/utils/pugicast.hpp b/src/utils/pugicast.hpp index b59e95d37ab..91043596605 100644 --- a/src/utils/pugicast.hpp +++ b/src/utils/pugicast.hpp @@ -38,14 +38,12 @@ namespace pugi { // If the string could not be parsed as the specified type if (errorCode == std::errc::invalid_argument) { // Throw an exception indicating that the argument is invalid - logError(fmt::format("Invalid argument {}", str)); - throw std::invalid_argument("Invalid argument: " + std::string(str)); + logError(fmt::format("[{}] Invalid argument {}", __FUNCTION__, str)); } // If the parsed value is out of range for the specified type else if (errorCode == std::errc::result_out_of_range) { // Throw an exception indicating that the result is out of range - logError(fmt::format("Result out of range: {}", str)); - throw std::out_of_range("Result out of range: " + std::string(str)); + logError(fmt::format("[{}] Result out of range: {}", __FUNCTION__, str)); } // Return a default value if no exception is thrown From 5687d8edd8e96e65703d547eaee78de5bd7a6279 Mon Sep 17 00:00:00 2001 From: Eduardo Dantas Date: Wed, 20 Nov 2024 18:27:39 -0300 Subject: [PATCH 2/3] fix: rename --- data/libs/functions/boss_lever.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/libs/functions/boss_lever.lua b/data/libs/functions/boss_lever.lua index ca3c5b1efec..45c75594ac9 100644 --- a/data/libs/functions/boss_lever.lua +++ b/data/libs/functions/boss_lever.lua @@ -177,8 +177,8 @@ function BossLever:onUse(player) return true end - local isAccountGod = creature:getAccountType() < ACCOUNT_TYPE_GAMEMASTER - if not isAccountGod and creature:getLevel() < self.requiredLevel then + local isBelowGameMaster = creature:getAccountType() < ACCOUNT_TYPE_GAMEMASTER + if isBelowGameMaster and creature:getLevel() < self.requiredLevel then local message = "All players need to be level " .. self.requiredLevel .. " or higher." creature:sendTextMessage(MESSAGE_EVENT_ADVANCE, message) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, message) From c7288c2d000ea43a865965c4c4a318bca039a663 Mon Sep 17 00:00:00 2001 From: Eduardo Dantas Date: Thu, 21 Nov 2024 14:41:27 -0300 Subject: [PATCH 3/3] fix: rename --- data/libs/functions/boss_lever.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/libs/functions/boss_lever.lua b/data/libs/functions/boss_lever.lua index 45c75594ac9..ae8a89d0e54 100644 --- a/data/libs/functions/boss_lever.lua +++ b/data/libs/functions/boss_lever.lua @@ -177,8 +177,8 @@ function BossLever:onUse(player) return true end - local isBelowGameMaster = creature:getAccountType() < ACCOUNT_TYPE_GAMEMASTER - if isBelowGameMaster and creature:getLevel() < self.requiredLevel then + local isAccountNormal = creature:getAccountType() < ACCOUNT_TYPE_GAMEMASTER + if isAccountNormal and creature:getLevel() < self.requiredLevel then local message = "All players need to be level " .. self.requiredLevel .. " or higher." creature:sendTextMessage(MESSAGE_EVENT_ADVANCE, message) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, message)