aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/scripts')
-rw-r--r--src/server/scripts/Commands/cs_debug.cpp49
-rw-r--r--src/server/scripts/Spells/spell_generic.cpp31
2 files changed, 80 insertions, 0 deletions
diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp
index 952f5a316c9..6de82fcd0eb 100644
--- a/src/server/scripts/Commands/cs_debug.cpp
+++ b/src/server/scripts/Commands/cs_debug.cpp
@@ -88,6 +88,10 @@ public:
{ "spellfail", rbac::RBAC_PERM_COMMAND_DEBUG_SEND_SPELLFAIL, false, &HandleDebugSendSpellFailCommand, "" },
{ "playerchoice", rbac::RBAC_PERM_COMMAND_DEBUG_SEND_PLAYER_CHOICE, false, &HandleDebugSendPlayerChoiceCommand, "" },
};
+ static std::vector<ChatCommand> debugPvpCommandTable =
+ {
+ { "warmode", rbac::RBAC_PERM_COMMAND_DEBUG, false, &HandleDebugWarModeFactionBalanceCommand, "" },
+ };
static std::vector<ChatCommand> debugAsanCommandTable =
{
{ "memoryleak", rbac::RBAC_PERM_COMMAND_DEBUG_ASAN, true, &HandleDebugMemoryLeak, "" },
@@ -124,6 +128,7 @@ public:
{ "conversation" , rbac::RBAC_PERM_COMMAND_DEBUG_CONVERSATION, false, &HandleDebugConversationCommand, "" },
{ "worldstate" , rbac::RBAC_PERM_COMMAND_DEBUG, false, &HandleDebugWorldStateCommand, "" },
{ "wsexpression" , rbac::RBAC_PERM_COMMAND_DEBUG, false, &HandleDebugWSExpressionCommand, "" },
+ { "pvp", rbac::RBAC_PERM_COMMAND_DEBUG, false, nullptr, "", debugPvpCommandTable },
{ "dummy", rbac::RBAC_PERM_COMMAND_DEBUG_DUMMY, false, &HandleDebugDummyCommand, "" },
{ "asan", rbac::RBAC_PERM_COMMAND_DEBUG_ASAN, true, nullptr, "", debugAsanCommandTable },
{ "guidlimits", rbac::RBAC_PERM_COMMAND_DEBUG, true, &HandleDebugGuidLimitsCommand, "" },
@@ -137,6 +142,50 @@ public:
return commandTable;
}
+ static bool TryExtractTeamId(std::string const &args, TeamId &outFaction)
+ {
+ if ("a" == args || "alliance" == args)
+ outFaction = TEAM_ALLIANCE;
+ else if ("h" == args || "horde" == args)
+ outFaction = TEAM_HORDE;
+ else if ("n" == args || "neutral" == args)
+ outFaction = TEAM_NEUTRAL;
+ else
+ return false;
+
+ return true;
+ }
+
+ static bool HandleDebugWarModeFactionBalanceCommand(ChatHandler* handler, Variant<uint32, ExactSequence<'a','l','l','i','a','n','c','e'>, ExactSequence<'h','o','r','d','e'>, ExactSequence<'n','e','u','t','r','a','l'>, ExactSequence<'o','f','f'>> command, Optional<int32> rewardValue)
+ {
+ // USAGE: .debug pvp fb <alliance|horde|neutral|off> [pct]
+ // neutral Sets faction balance off.
+ // alliance Set faction balance to alliance.
+ // horde Set faction balance to horde.
+ // off Reset the faction balance and use the calculated value of it
+ switch (command.which())
+ {
+ case 0: // workaround for Variant of only ExactSequences not being supported
+ handler->SendSysMessage(LANG_BAD_VALUE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ case 1:
+ sWorld->SetForcedWarModeFactionBalanceState(TEAM_ALLIANCE, rewardValue.get_value_or(0));
+ break;
+ case 2:
+ sWorld->SetForcedWarModeFactionBalanceState(TEAM_HORDE, rewardValue.get_value_or(0));
+ break;
+ case 3:
+ sWorld->SetForcedWarModeFactionBalanceState(TEAM_NEUTRAL);
+ break;
+ case 4:
+ sWorld->DisableForcedWarModeFactionBalanceState();
+ break;
+ }
+
+ return true;
+ }
+
static bool HandleDebugPlayCinematicCommand(ChatHandler* handler, char const* args)
{
// USAGE: .debug play cinematic #cinematicId
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp
index b0d1593e4f3..212717fbd14 100644
--- a/src/server/scripts/Spells/spell_generic.cpp
+++ b/src/server/scripts/Spells/spell_generic.cpp
@@ -44,6 +44,7 @@
#include "SpellPackets.h"
#include "SpellScript.h"
#include "Vehicle.h"
+#include "World.h"
class spell_gen_absorb0_hitlimit1 : public AuraScript
{
@@ -4497,6 +4498,35 @@ class spell_gen_impatient_mind : public AuraScript
}
};
+// 269083 - Enlisted
+// 282559 - Enlisted
+class spell_gen_war_mode_enlisted : public AuraScript
+{
+ PrepareAuraScript(spell_gen_war_mode_enlisted);
+
+ void CalcWarModeBonus(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ Player* target = GetUnitOwner()->ToPlayer();
+ if (!target)
+ return;
+
+ if (target->GetTeamId() == sWorld->GetWarModeDominantFaction())
+ return;
+
+ amount += sWorld->GetWarModeOutnumberedFactionReward();
+ }
+
+ void Register() override
+ {
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_war_mode_enlisted::CalcWarModeBonus, EFFECT_ALL, SPELL_AURA_MOD_XP_PCT);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_war_mode_enlisted::CalcWarModeBonus, EFFECT_ALL, SPELL_AURA_MOD_XP_QUEST_PCT);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_war_mode_enlisted::CalcWarModeBonus, EFFECT_ALL, SPELL_AURA_MOD_CURRENCY_GAIN_FROM_SOURCE);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_war_mode_enlisted::CalcWarModeBonus, EFFECT_ALL, SPELL_AURA_MOD_MONEY_GAIN);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_war_mode_enlisted::CalcWarModeBonus, EFFECT_ALL, SPELL_AURA_MOD_ANIMA_GAIN);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_war_mode_enlisted::CalcWarModeBonus, EFFECT_ALL, SPELL_AURA_DUMMY);
+ }
+};
+
enum DefenderOfAzerothData
{
SPELL_DEATH_GATE_TELEPORT_STORMWIND = 316999,
@@ -4749,6 +4779,7 @@ void AddSC_generic_spell_scripts()
RegisterSpellScript(spell_gen_azgalor_rain_of_fire_hellfire_citadel);
RegisterAuraScript(spell_gen_face_rage);
RegisterAuraScript(spell_gen_impatient_mind);
+ RegisterAuraScript(spell_gen_war_mode_enlisted);
RegisterSpellScript(spell_defender_of_azeroth_death_gate_selector);
RegisterSpellScript(spell_defender_of_azeroth_speak_with_mograine);
RegisterSpellScript(spell_summon_battle_pet);