From 76437ce9737a294f72ae590cc2d51947a88ac463 Mon Sep 17 00:00:00 2001 From: Barbz Date: Fri, 9 Mar 2018 19:07:15 +0100 Subject: [PATCH] Config is now read on linux + Warning about Null fixed Config fixes thanks to @Nefertum and @Talamortis --- src/mod_moneyforkills.cpp | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/src/mod_moneyforkills.cpp b/src/mod_moneyforkills.cpp index 4b9671e..4491ce7 100644 --- a/src/mod_moneyforkills.cpp +++ b/src/mod_moneyforkills.cpp @@ -125,7 +125,7 @@ public: victim->ModifyMoney(-VictimLoot); // Inform the player of the corpse loot - Notify(player, victim, NULL, "Loot", NULL, VictimLoot); + Notify(player, victim, NULL, "Loot", 0, VictimLoot); // Pay the player the additional PVP bounty player->ModifyMoney(BountyAmount); @@ -218,7 +218,7 @@ public: player->ModifyMoney(bounty); // Inform the player of the bounty amount - Notify(player, NULL, killed, KillType, bounty, NULL); + Notify(player, NULL, killed, KillType, bounty, 0); } else { @@ -238,7 +238,7 @@ public: playerInGroup->ModifyMoney(bounty); // Inform the player of the bounty amount - Notify(playerInGroup, NULL, killed, KillType, bounty, NULL); + Notify(playerInGroup, NULL, killed, KillType, bounty, 0); } else { @@ -249,7 +249,7 @@ public: playerInGroup->ModifyMoney(bounty); // Inform the player of the bounty amount - Notify(playerInGroup, NULL, killed, KillType, bounty, NULL); + Notify(playerInGroup, NULL, killed, KillType, bounty, 0); } } } @@ -391,7 +391,30 @@ public: } }; +class MoneyForKillsWorld : public WorldScript +{ +public: + MoneyForKillsWorld() : WorldScript("MoneyForKillsWorld") { } + + void OnBeforeConfigLoad(bool reload) override + { + if (!reload) { + std::string conf_path = _CONF_DIR; + std::string cfg_file = conf_path + "/mod_moneyforkills.conf"; + + #ifdef WIN32 + cfg_file = "mod_moneyforkills.conf"; + #endif + + std::string cfg_def_file = cfg_file + ".dist"; + sConfigMgr->LoadMore(cfg_def_file.c_str()); + sConfigMgr->LoadMore(cfg_file.c_str()); + } + } +}; + void AddMoneyForKillsScripts() { new MoneyForKills(); -} \ No newline at end of file + new MoneyForKillsWorld(); +}