Skip to content

Commit

Permalink
Added FREE_RESPEC server property (#174)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
tegstewart authored and Graveen committed Jul 16, 2019
1 parent f610b07 commit eaba8c1
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 7 deletions.
41 changes: 37 additions & 4 deletions GameServer/commands/playercommands/respec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 <line name> 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
Expand Down Expand Up @@ -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)
{
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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<object>(LINE_RESPEC, null) != null)
{
Specialization specLine = (Specialization)player.TempProperties.getProperty<object>(LINE_RESPEC, null);
Expand Down
7 changes: 4 additions & 3 deletions GameServer/gameobjects/GamePlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -3191,8 +3192,8 @@ public virtual bool RespecRealm()
RemoveAbility(ab.KeyName);

m_realmAbilities.Clear();

RespecAmountRealmSkill--;
if (!ServerProperties.Properties.FREE_RESPEC)
RespecAmountRealmSkill--;
return any;
}

Expand Down
6 changes: 6 additions & 0 deletions GameServer/serverproperty/ServerProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,12 @@ public static void InitProperties()
/// </summary>
[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;

/// <summary>
/// Property to enable free respecs
/// </summary>
[ServerProperty("server", "free_respec", "Set to true to always allow respecs", false)]
public static bool FREE_RESPEC;
#endregion

#region WORLD
Expand Down

0 comments on commit eaba8c1

Please sign in to comment.