From e71c6062bc70049e2329e53717dd929da72033b9 Mon Sep 17 00:00:00 2001 From: Sdyess Date: Mon, 10 Jun 2019 19:11:59 -0500 Subject: [PATCH] Add config options for other features https://github.com/azerothcore/mod-money-for-kills/issues/2 --- conf/mod_moneyforkills.conf.dist | 20 ++++++++ src/mod_moneyforkills.cpp | 82 ++++++++++++++++++-------------- 2 files changed, 67 insertions(+), 35 deletions(-) diff --git a/conf/mod_moneyforkills.conf.dist b/conf/mod_moneyforkills.conf.dist index 44fd908..f2cae27 100644 --- a/conf/mod_moneyforkills.conf.dist +++ b/conf/mod_moneyforkills.conf.dist @@ -14,6 +14,26 @@ MFK.Enable = 1 MFK.Announce = 1 +# Enable announcements to notify the server of a world boss kill +# Default 1 + +MFK.WorldBossAnnounce = 1 + +# Enable player suicide announcements +# Default 1 + +MFK.SuicideAnnounce = 1 + +# Enable PvP announcements +# Default 1 + +MFK.PvPAnnounce = 1 + +# Enable Group announcements for killing a dungeon boss +# Default 1 + +MFK.DungeonBossAnnounce = 1 + # Only allow the player with the killing blow to claim the bounty? # Default: 0 (All players receive the bounty) diff --git a/src/mod_moneyforkills.cpp b/src/mod_moneyforkills.cpp index c64558f..7efc6cb 100644 --- a/src/mod_moneyforkills.cpp +++ b/src/mod_moneyforkills.cpp @@ -31,12 +31,12 @@ reward range of the group and an option to only reward the player that got the k - Type: Server/Player - Script: MoneyForKills - Config: Yes - - Enable/Disable Module - - Enable Module Announce - - Enable Killing Blow Only Bounty - - Enable Bounty for Players Outside Reward Area - - Set % of Gold Looted from victim on PVP kill - - Set Bounty Multipliers for each type of kill +- Enable/Disable Module +- Enable Module Announce +- Enable Killing Blow Only Bounty +- Enable Bounty for Players Outside Reward Area +- Set % of Gold Looted from victim on PVP kill +- Set Bounty Multipliers for each type of kill - SQL: No @@ -112,12 +112,16 @@ public: // No reward for killing yourself if (killer->GetGUID() == victim->GetGUID()) { - // Inform the world - std::string message = "|cff676767[ |cffFFFF00World |cff676767]|r:|cff4CFF00 "; - message.append(killer->GetName()); - message.append(" met an untimely demise!"); + if (sConfigMgr->GetBoolDefault("MFK.SuicideAnnounce", true)) + { + // Inform the world + std::string message = "|cff676767[ |cffFFFF00World |cff676767]|r:|cff4CFF00 "; + message.append(killer->GetName()); + message.append(" met an untimely demise!"); - sWorld->SendServerMessage(SERVER_MSG_STRING, message.c_str()); + sWorld->SendServerMessage(SERVER_MSG_STRING, message.c_str()); + } + return; } @@ -143,7 +147,6 @@ public: // Inform the player of the bounty amount Notify(killer, victim, nullptr, KILLTYPE_PVP, BountyAmount); - return; } } @@ -277,37 +280,46 @@ public: { case KILLTYPE_LOOT: rewardMsg.append("You loot").append(rewardVal).append(" from the corpse."); - victimMsg.append(killer->GetName()).append(" rifles through your corpse and takes").append(rewardVal); - victimMsg.append("."); + victimMsg.append(killer->GetName()).append(" rifles through your corpse and takes").append(rewardVal).append("."); ChatHandler(victim->GetSession()).SendSysMessage(victimMsg.c_str()); - break; + ChatHandler(killer->GetSession()).SendSysMessage(rewardMsg.c_str()); + break; case KILLTYPE_PVP: - rewardMsg.append("|cff676767[ |cffFFFF00World |cff676767]|r:|cff4CFF00 ").append(killer->GetName()).append(" |cffFF0000has slain "); - rewardMsg.append(victim->GetName()).append(" earning a bounty of").append(rewardVal).append("."); - sWorld->SendServerMessage(SERVER_MSG_STRING, rewardMsg.c_str()); + if (sConfigMgr->GetBoolDefault("MFK.PvPAnnounce", true)) + { + rewardMsg.append("|cff676767[ |cffFFFF00World |cff676767]|r:|cff4CFF00 ").append(killer->GetName()).append(" |cffFF0000has slain "); + rewardMsg.append(victim->GetName()).append(" earning a bounty of").append(rewardVal).append("."); + sWorld->SendServerMessage(SERVER_MSG_STRING, rewardMsg.c_str()); + } break; case KILLTYPE_DUNGEONBOSS: - rewardMsg.append("|cffFF8000Your group has defeated |cffFF0000").append(killed->GetName()).append("|cffFF8000."); - ChatHandler(killer->GetSession()).SendSysMessage(rewardMsg.c_str()); - rewardMsg.clear(); + if (sConfigMgr->GetBoolDefault("MFK.DungeonBossAnnounce", true)) + { + rewardMsg.append("|cffFF8000Your group has defeated |cffFF0000").append(killed->GetName()).append("|cffFF8000."); + ChatHandler(killer->GetSession()).SendSysMessage(rewardMsg.c_str()); + rewardMsg.clear(); + } break; case KILLTYPE_WORLDBOSS: - rewardMsg.append("|cffFF0000[ |cffFFFF00World |cffFF0000]|r:|cff4CFF00 ").append(killer->GetName()); - rewardMsg.append("'s|r group triumphed victoriously over |CFF18BE00[").append(killed->GetName()).append("]|r !"); - sWorld->SendServerMessage(SERVER_MSG_STRING, rewardMsg.c_str()); - rewardMsg.clear(); + if (sConfigMgr->GetBoolDefault("MFK.WorldBossAnnounce", true)) + { + rewardMsg.append("|cffFF0000[ |cffFFFF00World |cffFF0000]|r:|cff4CFF00 ").append(killer->GetName()); + rewardMsg.append("'s|r group triumphed victoriously over |CFF18BE00[").append(killed->GetName()).append("]|r !"); + sWorld->SendServerMessage(SERVER_MSG_STRING, rewardMsg.c_str()); + rewardMsg.clear(); + } break; case KILLTYPE_MOB: break; } - if (kType != KILLTYPE_PVP) + if (kType != KILLTYPE_LOOT) { - + rewardMsg.clear(); rewardMsg.append(" You receive a bounty of"); rewardMsg.append(rewardVal); - ChatHandler(killer->GetSession()).SendSysMessage(rewardMsg.c_str()); rewardMsg.append(" for the kill."); + ChatHandler(killer->GetSession()).SendSysMessage(rewardMsg.c_str()); } } @@ -338,12 +350,12 @@ public: 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"; + +#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()); } @@ -353,5 +365,5 @@ public: void AddMoneyForKillsScripts() { new MoneyForKills(); - new MoneyForKillsWorld(); + new MoneyForKillsWorld(); }