From 97bf90202a41bf6de4ea9cf8daacd2d217dd8fe1 Mon Sep 17 00:00:00 2001 From: DrReaganRidley <137726736+DrReaganRidley@users.noreply.github.com> Date: Mon, 11 Mar 2024 09:53:46 -0400 Subject: [PATCH] Add configuration options: FixedXP, FixedXPRate (#38) * Add SoloLFG.FixedXP to encourage group play * Add option: SoloLFG.FixedXPRate * Correct a comment * Match existing styling a little better * Respecting convections, nothing serious * fix build. Adding missing parameter --------- Co-authored-by: Pagani Walter --- conf/SoloLfg.conf.dist | 13 +++++++++++++ src/Lfg_Solo.cpp | 15 ++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/conf/SoloLfg.conf.dist b/conf/SoloLfg.conf.dist index 569abc1..42ed51a 100644 --- a/conf/SoloLfg.conf.dist +++ b/conf/SoloLfg.conf.dist @@ -19,4 +19,17 @@ SoloLFG.Enable = 1 SoloLFG.Announce = 1 +# SoloLFG.FixedXP +# Description: Set the XP rate in dungeons to FixedXPRate +# Default: 1 - (Enabled) +# 0 - (Disabled) + +SoloLFG.FixedXP = 1 + +# SoloLFG.FixedXPRate +# Description: Set the fixed XP rate used in dungeons +# Default: 0.2 (The same XP gained in a full party of 5) + +SoloLFG.FixedXPRate = 0.2 + ################################################################################################### diff --git a/src/Lfg_Solo.cpp b/src/Lfg_Solo.cpp index 4a3132b..da80591 100644 --- a/src/Lfg_Solo.cpp +++ b/src/Lfg_Solo.cpp @@ -18,7 +18,7 @@ class lfg_solo_announce : public PlayerScript public: lfg_solo_announce() : PlayerScript("lfg_solo_announce") {} - void OnLogin(Player* player) + void OnLogin(Player* player) override { // Announce Module if (sConfigMgr->GetOption("SoloLFG.Announce", true)) @@ -26,6 +26,19 @@ public: ChatHandler(player->GetSession()).SendSysMessage("This server is running the |cff4CFF00Solo Dungeon Finder |rmodule."); } } + + void OnRewardKillRewarder(Player* /*player*/, KillRewarder* /*rewarder*/, bool isDungeon, float& rate) override + { + if (!isDungeon + || !sConfigMgr->GetOption("SoloLFG.Enable", true) + || !sConfigMgr->GetOption("SoloLFG.FixedXP", true)) + { + return; + } + + // Force the rate to FixedXPRate regardless of group size, to encourage group play + rate = sConfigMgr->GetOption("SoloLFG.FixedXPRate", 0.2); + } }; class lfg_solo : public WorldScript