From eaba8c1a43dab26f51ac10e603ab641981942df8 Mon Sep 17 00:00:00 2001 From: tegstewart Date: Tue, 16 Jul 2019 14:46:41 -0600 Subject: [PATCH] Added FREE_RESPEC server property (#174) * Added support for FREE_RESPEC server property * Added FREE_RESPEC server property * Added support for FREE_RESPEC server property * Added FREE_RESPEC server property * Added FREE_RESPEC server property --- GameServer/commands/playercommands/respec.cs | 41 +++++++++++++++++-- GameServer/gameobjects/GamePlayer.cs | 7 ++-- GameServer/serverproperty/ServerProperties.cs | 6 +++ 3 files changed, 47 insertions(+), 7 deletions(-) diff --git a/GameServer/commands/playercommands/respec.cs b/GameServer/commands/playercommands/respec.cs index 27acdee500..f1b915c016 100644 --- a/GameServer/commands/playercommands/respec.cs +++ b/GameServer/commands/playercommands/respec.cs @@ -52,11 +52,22 @@ public class RespecCommandHandler : AbstractCommandHandler, ICommandHandler const string LINE_RESPEC = "line_respec"; const string DOL_RESPEC = "dol_respec"; const string BUY_RESPEC = "buy_respec"; + const string CHAMP_RESPEC = "champion_respec"; public void OnCommand(GameClient client, string[] args) { if (args.Length < 2) { + if (ServerProperties.Properties.FREE_RESPEC) + { + DisplayMessage(client, "Target any trainer and use:"); + DisplayMessage(client, "/respec ALL or /respec DOL to respec all skills"); + DisplayMessage(client, "/respec to respec a single skill line"); + DisplayMessage(client, "/respec REALM to respec realm abilities"); + DisplayMessage(client, "/respec CHAMPION to respec champion abilities"); + return; + } + // Check for respecs. if (client.Player.RespecAmountAllSkill < 1 && client.Player.RespecAmountSingleSkill < 1 @@ -104,6 +115,9 @@ public void OnCommand(GameClient client, string[] args) { case "buy": { + if (ServerProperties.Properties.FREE_RESPEC) + return; + // Buy respec if (client.Player.CanBuyRespec == false || client.Player.RespecCost < 0) { @@ -124,7 +138,8 @@ public void OnCommand(GameClient client, string[] args) case "all": { // Check for full respecs. - if (client.Player.RespecAmountAllSkill < 1) + if (client.Player.RespecAmountAllSkill < 1 + && !ServerProperties.Properties.FREE_RESPEC) { DisplayMessage(client, "You don't seem to have any full skill respecs available."); return; @@ -137,7 +152,8 @@ public void OnCommand(GameClient client, string[] args) case "dol": { // Check for DOL respecs. - if (client.Player.RespecAmountDOL < 1) + if (client.Player.RespecAmountDOL < 1 + && !ServerProperties.Properties.FREE_RESPEC) { DisplayMessage(client, "You don't seem to have any DOL respecs available."); return; @@ -149,7 +165,8 @@ public void OnCommand(GameClient client, string[] args) } case "realm": { - if (client.Player.RespecAmountRealmSkill < 1) + if (client.Player.RespecAmountRealmSkill < 1 + && !ServerProperties.Properties.FREE_RESPEC) { DisplayMessage(client, "You don't seem to have any realm skill respecs available."); return; @@ -159,10 +176,21 @@ public void OnCommand(GameClient client, string[] args) client.Player.TempProperties.setProperty(RA_RESPEC, true); break; } + case "champion": + { + if (ServerProperties.Properties.FREE_RESPEC) + { + client.Out.SendCustomDialog("CAUTION: All respec changes are final with no second chance. Proceed carefully!", new CustomDialogResponse(RespecDialogResponse)); + client.Player.TempProperties.setProperty(CHAMP_RESPEC, true); + break; + } + return; + } default: { // Check for single-line respecs. - if (client.Player.RespecAmountSingleSkill < 1) + if (client.Player.RespecAmountSingleSkill < 1 + && !ServerProperties.Properties.FREE_RESPEC) { DisplayMessage(client, "You don't seem to have any single-line respecs available."); return; @@ -212,6 +240,11 @@ protected void RespecDialogResponse(GamePlayer player, byte response) player.RespecRealm(); player.TempProperties.removeProperty(RA_RESPEC); } + if (player.TempProperties.getProperty(CHAMP_RESPEC, false)) + { + player.RespecChampionSkills(); + player.TempProperties.removeProperty(CHAMP_RESPEC); + } if (player.TempProperties.getProperty(LINE_RESPEC, null) != null) { Specialization specLine = (Specialization)player.TempProperties.getProperty(LINE_RESPEC, null); diff --git a/GameServer/gameobjects/GamePlayer.cs b/GameServer/gameobjects/GamePlayer.cs index 6a7f76dd75..bf9815c707 100644 --- a/GameServer/gameobjects/GamePlayer.cs +++ b/GameServer/gameobjects/GamePlayer.cs @@ -3175,7 +3175,8 @@ public virtual bool RespecDOL() public virtual int RespecSingle(Specialization specLine) { int specPoints = RespecSingleLine(specLine); // Wipe skills and styles. - RespecAmountSingleSkill--; // Decriment players respecs available. + if (!ServerProperties.Properties.FREE_RESPEC) + RespecAmountSingleSkill--; // Decriment players respecs available. if (Level == 20 || Level == 40) { IsLevelRespecUsed = true; @@ -3191,8 +3192,8 @@ public virtual bool RespecRealm() RemoveAbility(ab.KeyName); m_realmAbilities.Clear(); - - RespecAmountRealmSkill--; + if (!ServerProperties.Properties.FREE_RESPEC) + RespecAmountRealmSkill--; return any; } diff --git a/GameServer/serverproperty/ServerProperties.cs b/GameServer/serverproperty/ServerProperties.cs index 258ab0965c..90152b8550 100644 --- a/GameServer/serverproperty/ServerProperties.cs +++ b/GameServer/serverproperty/ServerProperties.cs @@ -552,6 +552,12 @@ public static void InitProperties() /// [ServerProperty("server", "enable_albion_advanced_weapon_spec", "Set to true to determine damage variance for polearms and 2H weapons on 1H crush/slash/thrust spec.", true)] public static bool ENABLE_ALBION_ADVANCED_WEAPON_SPEC; + + /// + /// Property to enable free respecs + /// + [ServerProperty("server", "free_respec", "Set to true to always allow respecs", false)] + public static bool FREE_RESPEC; #endregion #region WORLD