Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve: context logging from ConfigManager functions #1897

Merged
merged 3 commits into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion data/libs/functions/player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ function Player:calculateLootFactor(monster)

local participants = { self }
local factor = 1
if configManager.getBoolean(PARTY_SHARE_LOOT_BOOSTS) then
if configManager.getBoolean(configKeys.PARTY_SHARE_LOOT_BOOSTS) then
local party = self:getParty()
if party and party:isSharedExperienceEnabled() then
participants = party:getMembers()
Expand Down
2 changes: 1 addition & 1 deletion data/libs/loyalty_lib.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local loyaltySystem = {
enable = configManager.getBoolean(LOYALTY_ENABLED),
enable = configManager.getBoolean(configKeys.LOYALTY_ENABLED),
titles = {
[1] = { name = "Scout of Tibia", points = 50 },
[2] = { name = "Sentinel of Tibia", points = 100 },
Expand Down
2 changes: 1 addition & 1 deletion data/scripts/eventcallbacks/monster/ondroploot_hazard.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function callback.monsterOnDropLoot(monster, corpse)
rolls = math.floor(rolls)
end

if configManager.getBoolean(PARTY_SHARE_LOOT_BOOSTS) and rolls > 1 then
if configManager.getBoolean(configKeys.PARTY_SHARE_LOOT_BOOSTS) and rolls > 1 then
msgSuffix = msgSuffix .. " (hazard system, " .. rolls .. " extra rolls)"
elseif rolls == 1 then
msgSuffix = msgSuffix .. " (hazard system)"
Expand Down
2 changes: 1 addition & 1 deletion data/scripts/eventcallbacks/monster/ondroploot_prey.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function callback.monsterOnDropLoot(monster, corpse)
local factor = 1.0
local msgSuffix = ""
local participants = { player }
if configManager.getBoolean(PARTY_SHARE_LOOT_BOOSTS) then
if configManager.getBoolean(configKeys.PARTY_SHARE_LOOT_BOOSTS) then
local party = player:getParty()
if party and party:isSharedExperienceEnabled() then
participants = party:getMembers()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function callback.monsterOnDropLoot(monster, corpse)
local factor = 1.0
local msgSuffix = ""
local participants = { player }
if configManager.getBoolean(PARTY_SHARE_LOOT_BOOSTS) then
if configManager.getBoolean(configKeys.PARTY_SHARE_LOOT_BOOSTS) then
local party = player:getParty()
if party and party:isSharedExperienceEnabled() then
participants = party:getMembers()
Expand Down Expand Up @@ -57,7 +57,7 @@ function callback.monsterOnDropLoot(monster, corpse)
return
end

if configManager.getBoolean(PARTY_SHARE_LOOT_BOOSTS) and rolls > 1 then
if configManager.getBoolean(configKeys.PARTY_SHARE_LOOT_BOOSTS) and rolls > 1 then
msgSuffix = msgSuffix .. " (active wealth duplex, " .. rolls .. " extra rolls)"
else
msgSuffix = msgSuffix .. " (active wealth duplex)"
Expand Down
34 changes: 17 additions & 17 deletions src/canary_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ int CanaryServer::run() {
try {
loadConfigLua();

logger.info("Server protocol: {}.{}{}", CLIENT_VERSION_UPPER, CLIENT_VERSION_LOWER, g_configManager().getBoolean(OLD_PROTOCOL) ? " and 10x allowed!" : "");
logger.info("Server protocol: {}.{}{}", CLIENT_VERSION_UPPER, CLIENT_VERSION_LOWER, g_configManager().getBoolean(OLD_PROTOCOL, __FUNCTION__) ? " and 10x allowed!" : "");

rsa.start();
initializeDatabase();
Expand Down Expand Up @@ -89,7 +89,7 @@ int CanaryServer::run() {

g_game().start(&serviceManager);
g_game().setGameState(GAME_STATE_NORMAL);
if (g_configManager().getBoolean(TOGGLE_MAINTAIN_MODE)) {
if (g_configManager().getBoolean(TOGGLE_MAINTAIN_MODE, __FUNCTION__)) {
g_game().setGameState(GAME_STATE_CLOSED);
g_logger().warn("Initialized in maintain mode!");
g_webhook().sendMessage("Server is now online", "The server is now online. Access is currently restricted to administrators only.", WEBHOOK_COLOR_ONLINE);
Expand Down Expand Up @@ -123,7 +123,7 @@ int CanaryServer::run() {
return EXIT_FAILURE;
}

logger.info("{} {}", g_configManager().getString(SERVER_NAME), "server online!");
logger.info("{} {}", g_configManager().getString(SERVER_NAME, __FUNCTION__), "server online!");

serviceManager.run();

Expand All @@ -132,7 +132,7 @@ int CanaryServer::run() {
}

void CanaryServer::setWorldType() {
std::string worldType = asLowerCaseString(g_configManager().getString(WORLD_TYPE));
const std::string worldType = asLowerCaseString(g_configManager().getString(WORLD_TYPE, __FUNCTION__));
if (worldType == "pvp") {
g_game().setWorldType(WORLD_TYPE_PVP);
} else if (worldType == "no-pvp") {
Expand All @@ -143,7 +143,7 @@ void CanaryServer::setWorldType() {
throw FailedToInitializeCanary(
fmt::format(
"Unknown world type: {}, valid world types are: pvp, no-pvp and pvp-enforced",
g_configManager().getString(WORLD_TYPE)
g_configManager().getString(WORLD_TYPE, __FUNCTION__)
)
);
}
Expand All @@ -153,11 +153,11 @@ void CanaryServer::setWorldType() {

void CanaryServer::loadMaps() const {
try {
g_game().loadMainMap(g_configManager().getString(MAP_NAME));
g_game().loadMainMap(g_configManager().getString(MAP_NAME, __FUNCTION__));

// If "mapCustomEnabled" is true on config.lua, then load the custom map
if (g_configManager().getBoolean(TOGGLE_MAP_CUSTOM)) {
g_game().loadCustomMaps(g_configManager().getString(DATA_DIRECTORY) + "/world/custom/");
if (g_configManager().getBoolean(TOGGLE_MAP_CUSTOM, __FUNCTION__)) {
g_game().loadCustomMaps(g_configManager().getString(DATA_DIRECTORY, __FUNCTION__) + "/world/custom/");
}
Zone::refreshAll();
} catch (const std::exception &err) {
Expand All @@ -167,7 +167,7 @@ void CanaryServer::loadMaps() const {

void CanaryServer::setupHousesRent() {
RentPeriod_t rentPeriod;
std::string strRentPeriod = asLowerCaseString(g_configManager().getString(HOUSE_RENT_PERIOD));
std::string strRentPeriod = asLowerCaseString(g_configManager().getString(HOUSE_RENT_PERIOD, __FUNCTION__));

if (strRentPeriod == "yearly") {
rentPeriod = RENTPERIOD_YEARLY;
Expand Down Expand Up @@ -214,8 +214,8 @@ void CanaryServer::logInfos() {
*/
void CanaryServer::toggleForceCloseButton() {
#ifdef OS_WINDOWS
HWND hwnd = GetConsoleWindow();
HMENU hmenu = GetSystemMenu(hwnd, FALSE);
const HWND hwnd = GetConsoleWindow();
const HMENU hmenu = GetSystemMenu(hwnd, FALSE);
EnableMenuItem(hmenu, SC_CLOSE, MF_GRAYED);
#endif
}
Expand Down Expand Up @@ -280,7 +280,7 @@ void CanaryServer::loadConfigLua() {
modulesLoadHelper(g_configManager().load(), g_configManager().getConfigFileLua());

#ifdef _WIN32
const std::string &defaultPriority = g_configManager().getString(DEFAULT_PRIORITY);
const std::string &defaultPriority = g_configManager().getString(DEFAULT_PRIORITY, __FUNCTION__);
if (strcasecmp(defaultPriority.c_str(), "high") == 0) {
SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS);
} else if (strcasecmp(defaultPriority.c_str(), "above-normal") == 0) {
Expand All @@ -306,16 +306,16 @@ void CanaryServer::initializeDatabase() {

DatabaseManager::updateDatabase();

if (g_configManager().getBoolean(OPTIMIZE_DATABASE)
if (g_configManager().getBoolean(OPTIMIZE_DATABASE, __FUNCTION__)
&& !DatabaseManager::optimizeTables()) {
logger.debug("No tables were optimized");
}
}

void CanaryServer::loadModules() {
// If "USE_ANY_DATAPACK_FOLDER" is set to true then you can choose any datapack folder for your server
auto useAnyDatapack = g_configManager().getBoolean(USE_ANY_DATAPACK_FOLDER);
auto datapackName = g_configManager().getString(DATA_DIRECTORY);
const auto useAnyDatapack = g_configManager().getBoolean(USE_ANY_DATAPACK_FOLDER, __FUNCTION__);
auto datapackName = g_configManager().getString(DATA_DIRECTORY, __FUNCTION__);
if (!useAnyDatapack && (datapackName != "data-canary" && datapackName != "data-otservbr-global" || datapackName != "data-otservbr-global" && datapackName != "data-canary")) {
throw FailedToInitializeCanary(fmt::format(
"The datapack folder name '{}' is wrong, please select valid "
Expand All @@ -330,12 +330,12 @@ void CanaryServer::loadModules() {
g_luaEnvironment().initState();
}

auto coreFolder = g_configManager().getString(CORE_DIRECTORY);
auto coreFolder = g_configManager().getString(CORE_DIRECTORY, __FUNCTION__);
// Load items dependencies
modulesLoadHelper((g_game().loadAppearanceProtobuf(coreFolder + "/items/appearances.dat") == ERROR_NONE), "appearances.dat");
modulesLoadHelper(Item::items.loadFromXml(), "items.xml");

auto datapackFolder = g_configManager().getString(DATA_DIRECTORY);
const auto datapackFolder = g_configManager().getString(DATA_DIRECTORY, __FUNCTION__);
logger.debug("Loading core scripts on folder: {}/", coreFolder);
// Load first core Lua libs
modulesLoadHelper((g_luaEnvironment().loadFile(coreFolder + "/core.lua", "core.lua") == 0), "core.lua");
Expand Down
18 changes: 9 additions & 9 deletions src/config/configmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ bool ConfigManager::load() {

bool ConfigManager::reload() {
const bool result = load();
if (transformToSHA1(getString(SERVER_MOTD)) != g_game().getMotdHash()) {
if (transformToSHA1(getString(SERVER_MOTD, __FUNCTION__)) != g_game().getMotdHash()) {
g_game().incrementMotdNum();
}
return result;
Expand Down Expand Up @@ -404,35 +404,35 @@ float ConfigManager::loadFloatConfig(lua_State* L, const ConfigKey_t &key, const
return value;
}

const std::string &ConfigManager::getString(const ConfigKey_t &key) const {
const std::string &ConfigManager::getString(const ConfigKey_t &key, std::string_view context) const {
static const std::string dummyStr;
if (configs.contains(key) && std::holds_alternative<std::string>(configs.at(key))) {
return std::get<std::string>(configs.at(key));
}
g_logger().warn("[ConfigManager::getString] - Accessing invalid or wrong type index: {}", fmt::underlying(key));
g_logger().warn("[ConfigManager::getString] - Accessing invalid or wrong type index: {}[{}], Function: {}", magic_enum::enum_name(key), fmt::underlying(key), context);
return dummyStr;
}

int32_t ConfigManager::getNumber(const ConfigKey_t &key) const {
int32_t ConfigManager::getNumber(const ConfigKey_t &key, std::string_view context) const {
if (configs.contains(key) && std::holds_alternative<int32_t>(configs.at(key))) {
return std::get<int32_t>(configs.at(key));
}
g_logger().warn("[ConfigManager::getNumber] - Accessing invalid or wrong type index: {}", fmt::underlying(key));
g_logger().warn("[ConfigManager::getNumber] - Accessing invalid or wrong type index: {}[{}], Function: {}", magic_enum::enum_name(key), fmt::underlying(key), context);
return 0;
}

bool ConfigManager::getBoolean(const ConfigKey_t &key) const {
bool ConfigManager::getBoolean(const ConfigKey_t &key, std::string_view context) const {
if (configs.contains(key) && std::holds_alternative<bool>(configs.at(key))) {
return std::get<bool>(configs.at(key));
}
g_logger().warn("[ConfigManager::getBoolean] - Accessing invalid or wrong type index: {}", fmt::underlying(key));
g_logger().warn("[ConfigManager::getBoolean] - Accessing invalid or wrong type index: {}[{}], Function: {}", magic_enum::enum_name(key), fmt::underlying(key), context);
return false;
}

float ConfigManager::getFloat(const ConfigKey_t &key) const {
float ConfigManager::getFloat(const ConfigKey_t &key, std::string_view context) const {
if (configs.contains(key) && std::holds_alternative<float>(configs.at(key))) {
return std::get<float>(configs.at(key));
}
g_logger().warn("[ConfigManager::getFloat] - Accessing invalid or wrong type index: {}", fmt::underlying(key));
g_logger().warn("[ConfigManager::getFloat] - Accessing invalid or wrong type index: {}[{}], Function: {}", magic_enum::enum_name(key), fmt::underlying(key), context);
return 0.0f;
}
8 changes: 4 additions & 4 deletions src/config/configmanager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ class ConfigManager {
return configFileLua;
};

[[nodiscard]] const std::string &getString(const ConfigKey_t &key) const;
[[nodiscard]] int32_t getNumber(const ConfigKey_t &key) const;
[[nodiscard]] bool getBoolean(const ConfigKey_t &key) const;
[[nodiscard]] float getFloat(const ConfigKey_t &key) const;
[[nodiscard]] const std::string &getString(const ConfigKey_t &key, std::string_view context) const;
[[nodiscard]] int32_t getNumber(const ConfigKey_t &key, std::string_view context) const;
[[nodiscard]] bool getBoolean(const ConfigKey_t &key, std::string_view context) const;
[[nodiscard]] float getFloat(const ConfigKey_t &key, std::string_view context) const;

private:
phmap::flat_hash_map<ConfigKey_t, ConfigValue> configs;
Expand Down
4 changes: 2 additions & 2 deletions src/creatures/appearance/mounts/mounts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ bool Mounts::reload() {

bool Mounts::loadFromXml() {
pugi::xml_document doc;
auto folder = g_configManager().getString(CORE_DIRECTORY) + "/XML/mounts.xml";
auto folder = g_configManager().getString(CORE_DIRECTORY, __FUNCTION__) + "/XML/mounts.xml";
pugi::xml_parse_result result = doc.load_file(folder.c_str());
if (!result) {
printXMLError(__FUNCTION__, folder, result);
Expand All @@ -30,7 +30,7 @@ bool Mounts::loadFromXml() {

for (auto mountNode : doc.child("mounts").children()) {
uint16_t lookType = pugi::cast<uint16_t>(mountNode.attribute("clientid").value());
if (g_configManager().getBoolean(WARN_UNSAFE_SCRIPTS) && lookType != 0 && !g_game().isLookTypeRegistered(lookType)) {
if (g_configManager().getBoolean(WARN_UNSAFE_SCRIPTS, __FUNCTION__) && lookType != 0 && !g_game().isLookTypeRegistered(lookType)) {
g_logger().warn("{} - An unregistered creature looktype type with id '{}' was blocked to prevent client crash.", __FUNCTION__, lookType);
continue;
}
Expand Down
4 changes: 2 additions & 2 deletions src/creatures/appearance/outfit/outfit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

bool Outfits::loadFromXml() {
pugi::xml_document doc;
auto folder = g_configManager().getString(CORE_DIRECTORY) + "/XML/outfits.xml";
auto folder = g_configManager().getString(CORE_DIRECTORY, __FUNCTION__) + "/XML/outfits.xml";
pugi::xml_parse_result result = doc.load_file(folder.c_str());
if (!result) {
printXMLError(__FUNCTION__, folder, result);
Expand Down Expand Up @@ -47,7 +47,7 @@ bool Outfits::loadFromXml() {
}

if (uint16_t lookType = pugi::cast<uint16_t>(lookTypeAttribute.value());
g_configManager().getBoolean(WARN_UNSAFE_SCRIPTS) && lookType != 0
g_configManager().getBoolean(WARN_UNSAFE_SCRIPTS, __FUNCTION__) && lookType != 0
&& !g_game().isLookTypeRegistered(lookType)) {
g_logger().warn("[Outfits::loadFromXml] An unregistered creature looktype type with id '{}' was blocked to prevent client crash.", lookType);
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/creatures/combat/combat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ bool Combat::isInPvpZone(std::shared_ptr<Creature> attacker, std::shared_ptr<Cre
}

bool Combat::isProtected(std::shared_ptr<Player> attacker, std::shared_ptr<Player> target) {
uint32_t protectionLevel = g_configManager().getNumber(PROTECTION_LEVEL);
uint32_t protectionLevel = g_configManager().getNumber(PROTECTION_LEVEL, __FUNCTION__);
if (target->getLevel() < protectionLevel || attacker->getLevel() < protectionLevel) {
return true;
}
Expand Down
8 changes: 4 additions & 4 deletions src/creatures/combat/condition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1248,7 +1248,7 @@ uint32_t ConditionRegeneration::getHealthTicks(std::shared_ptr<Creature> creatur
std::shared_ptr<Player> player = creature->getPlayer();

if (player != nullptr && isBuff) {
return healthTicks / g_configManager().getFloat(RATE_SPELL_COOLDOWN);
return healthTicks / g_configManager().getFloat(RATE_SPELL_COOLDOWN, __FUNCTION__);
}

return healthTicks;
Expand All @@ -1258,7 +1258,7 @@ uint32_t ConditionRegeneration::getManaTicks(std::shared_ptr<Creature> creature)
std::shared_ptr<Player> player = creature->getPlayer();

if (player != nullptr && isBuff) {
return manaTicks / g_configManager().getFloat(RATE_SPELL_COOLDOWN);
return manaTicks / g_configManager().getFloat(RATE_SPELL_COOLDOWN, __FUNCTION__);
}

return manaTicks;
Expand Down Expand Up @@ -2257,7 +2257,7 @@ void ConditionOutfit::serialize(PropWriteStream &propWriteStream) {
}

bool ConditionOutfit::startCondition(std::shared_ptr<Creature> creature) {
if (g_configManager().getBoolean(WARN_UNSAFE_SCRIPTS) && outfit.lookType != 0 && !g_game().isLookTypeRegistered(outfit.lookType)) {
if (g_configManager().getBoolean(WARN_UNSAFE_SCRIPTS, __FUNCTION__) && outfit.lookType != 0 && !g_game().isLookTypeRegistered(outfit.lookType)) {
g_logger().warn("[ConditionOutfit::startCondition] An unregistered creature looktype type with id '{}' was blocked to prevent client crash.", outfit.lookType);
return false;
}
Expand Down Expand Up @@ -2289,7 +2289,7 @@ void ConditionOutfit::endCondition(std::shared_ptr<Creature> creature) {
}

void ConditionOutfit::addCondition(std::shared_ptr<Creature> creature, const std::shared_ptr<Condition> addCondition) {
if (g_configManager().getBoolean(WARN_UNSAFE_SCRIPTS) && outfit.lookType != 0 && !g_game().isLookTypeRegistered(outfit.lookType)) {
if (g_configManager().getBoolean(WARN_UNSAFE_SCRIPTS, __FUNCTION__) && outfit.lookType != 0 && !g_game().isLookTypeRegistered(outfit.lookType)) {
g_logger().warn("[ConditionOutfit::addCondition] An unregistered creature looktype type with id '{}' was blocked to prevent client crash.", outfit.lookType);
return;
}
Expand Down
4 changes: 2 additions & 2 deletions src/creatures/combat/spells.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ void Spell::setWheelOfDestinyBoost(WheelSpellBoost_t boost, WheelSpellGrade_t gr
void Spell::applyCooldownConditions(std::shared_ptr<Player> player) const {
WheelSpellGrade_t spellGrade = player->wheel()->getSpellUpgrade(getName());
bool isUpgraded = getWheelOfDestinyUpgraded() && static_cast<uint8_t>(spellGrade) > 0;
auto rate_cooldown = (int32_t)g_configManager().getFloat(RATE_SPELL_COOLDOWN);
auto rate_cooldown = (int32_t)g_configManager().getFloat(RATE_SPELL_COOLDOWN, __FUNCTION__);
if (cooldown > 0) {
int32_t spellCooldown = cooldown;
if (isUpgraded) {
Expand Down Expand Up @@ -981,7 +981,7 @@ bool RuneSpell::executeUse(std::shared_ptr<Player> player, std::shared_ptr<Item>
}

postCastSpell(player);
if (hasCharges && item && g_configManager().getBoolean(REMOVE_RUNE_CHARGES)) {
if (hasCharges && item && g_configManager().getBoolean(REMOVE_RUNE_CHARGES, __FUNCTION__)) {
int32_t newCount = std::max<int32_t>(0, item->getItemCount() - 1);
g_game().transformItem(item, item->getID(), newCount);
player->updateSupplyTracker(item);
Expand Down
6 changes: 3 additions & 3 deletions src/creatures/creature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ void Creature::onCreatureMove(const std::shared_ptr<Creature> &creature, const s
stopEventWalk();
}

bool configTeleportSummons = g_configManager().getBoolean(TELEPORT_SUMMONS);
bool configTeleportSummons = g_configManager().getBoolean(TELEPORT_SUMMONS, __FUNCTION__);
checkSummonMove(newPos, configTeleportSummons);
if (isLostSummon()) {
handleLostSummon(configTeleportSummons);
Expand Down Expand Up @@ -630,7 +630,7 @@ void Creature::onDeath() {
std::shared_ptr<Creature> mostDamageCreature = nullptr;

const int64_t timeNow = OTSYS_TIME();
const uint32_t inFightTicks = g_configManager().getNumber(PZ_LOCKED);
const uint32_t inFightTicks = g_configManager().getNumber(PZ_LOCKED, __FUNCTION__);
int32_t mostDamage = 0;
std::map<std::shared_ptr<Creature>, uint64_t> experienceMap;
std::unordered_set<std::shared_ptr<Player>> killers;
Expand Down Expand Up @@ -788,7 +788,7 @@ bool Creature::hasBeenAttacked(uint32_t attackerId) {
if (it == damageMap.end()) {
return false;
}
return (OTSYS_TIME() - it->second.ticks) <= g_configManager().getNumber(PZ_LOCKED);
return (OTSYS_TIME() - it->second.ticks) <= g_configManager().getNumber(PZ_LOCKED, __FUNCTION__);
}

std::shared_ptr<Item> Creature::getCorpse(std::shared_ptr<Creature>, std::shared_ptr<Creature>) {
Expand Down
2 changes: 1 addition & 1 deletion src/creatures/interactions/chat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ Chat::Chat() :

bool Chat::load() {
pugi::xml_document doc;
auto coreFolder = g_configManager().getString(CORE_DIRECTORY);
auto coreFolder = g_configManager().getString(CORE_DIRECTORY, __FUNCTION__);
auto folder = coreFolder + "/chatchannels/chatchannels.xml";
pugi::xml_parse_result result = doc.load_file(folder.c_str());
if (!result) {
Expand Down
6 changes: 3 additions & 3 deletions src/creatures/monsters/monster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1953,8 +1953,8 @@ void Monster::dropLoot(std::shared_ptr<Container> corpse, std::shared_ptr<Creatu
if (ForgeClassifications_t classification = getMonsterForgeClassification();
// Condition
classification == ForgeClassifications_t::FORGE_FIENDISH_MONSTER) {
auto minSlivers = g_configManager().getNumber(FORGE_MIN_SLIVERS);
auto maxSlivers = g_configManager().getNumber(FORGE_MAX_SLIVERS);
auto minSlivers = g_configManager().getNumber(FORGE_MIN_SLIVERS, __FUNCTION__);
auto maxSlivers = g_configManager().getNumber(FORGE_MAX_SLIVERS, __FUNCTION__);

auto sliverCount = static_cast<uint16_t>(uniform_random(minSlivers, maxSlivers));

Expand All @@ -1963,7 +1963,7 @@ void Monster::dropLoot(std::shared_ptr<Container> corpse, std::shared_ptr<Creatu
corpse->internalAddThing(sliver);
}
}
if (!this->isRewardBoss() && g_configManager().getNumber(RATE_LOOT) > 0) {
if (!this->isRewardBoss() && g_configManager().getNumber(RATE_LOOT, __FUNCTION__) > 0) {
g_callbacks().executeCallback(EventCallback_t::monsterOnDropLoot, &EventCallback::monsterOnDropLoot, getMonster(), corpse);
g_callbacks().executeCallback(EventCallback_t::monsterPostDropLoot, &EventCallback::monsterPostDropLoot, getMonster(), corpse);
}
Expand Down
Loading