Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with character creation skills bonuses #2973

Merged
merged 19 commits into from
Jun 1, 2020
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 79 additions & 3 deletions Source/ACE.Server/Command/Handlers/DeveloperFixCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public static void HandleVerifySkills(Session session, params string[] parameter
{
if (skill.Value.PP > 0 || skill.Value.LevelFromPP > 0)
{
Console.WriteLine($"{player.Name} has {sac} skill {skill.Key} with {skill.Value.PP:N0} xp (rank {skill.Value.LevelFromPP})");
Console.WriteLine($"{player.Name} has {sac} skill {skill.Key} with {skill.Value.PP:N0} xp (rank {skill.Value.LevelFromPP}){fixStr}");
foundIssues = true;

if (fix)
Expand All @@ -250,6 +250,80 @@ public static void HandleVerifySkills(Session session, params string[] parameter
continue;
}

if (sac != SkillAdvancementClass.Specialized)
{
if (skill.Value.InitLevel > 0)
{
Console.WriteLine($"{player.Name} has {sac} skill {skill.Key} with {skill.Value.InitLevel:N0} InitLevel{fixStr}");
foundIssues = true;

if (fix)
{
skill.Value.InitLevel = 0;

updated = true;
}
}
}
else
{
var augProp = 0;
var augType = AugmentationType.None;
switch (skill.Key)
{

case Skill.ArmorTinkering:
augType = AugmentationType.ArmorTinkering;
augProp = player.GetProperty(PropertyInt.AugmentationSpecializeArmorTinkering) ?? 0;
break;

case Skill.ItemTinkering:
augType = AugmentationType.ItemTinkering;
augProp = player.GetProperty(PropertyInt.AugmentationSpecializeItemTinkering) ?? 0;
break;

case Skill.MagicItemTinkering:
augType = AugmentationType.MagicItemTinkering;
augProp = player.GetProperty(PropertyInt.AugmentationSpecializeMagicItemTinkering) ?? 0;
break;

case Skill.WeaponTinkering:
augType = AugmentationType.WeaponTinkering;
augProp = player.GetProperty(PropertyInt.AugmentationSpecializeWeaponTinkering) ?? 0;
break;

case Skill.Salvaging:
augType = AugmentationType.Salvage;
augProp = player.GetProperty(PropertyInt.AugmentationSpecializeSalvaging) ?? 0;
break;
}

if (skill.Value.InitLevel != 10 && augProp == 0)
{
Console.WriteLine($"{player.Name} has {sac} skill {skill.Key} with {skill.Value.InitLevel:N0} InitLevel{fixStr}");
foundIssues = true;

if (fix)
{
skill.Value.InitLevel = 10;

updated = true;
}
}
else if (skill.Value.InitLevel == 10 && augProp == 1)
{
Console.WriteLine($"{player.Name} has {sac} skill {skill.Key} with {skill.Value.InitLevel:N0} InitLevel as a result of {augType} augmentation{fixStr}");
foundIssues = true;

if (fix)
{
skill.Value.InitLevel = 0;

updated = true;
}
}
}

// verify skill rank
var correctRank = Player.CalcSkillRank(sac, skill.Value.PP);
if (rank != correctRank)
Expand Down Expand Up @@ -498,7 +572,7 @@ private static void UntrainSkills(OfflinePlayer player, int targetCredits)
refundXP += skill.Value.PP;

skill.Value.SAC = SkillAdvancementClass.Untrained;
skill.Value.InitLevel -= 5;
skill.Value.InitLevel = 0;
skill.Value.PP = 0;
skill.Value.LevelFromPP = 0;

Expand Down Expand Up @@ -756,7 +830,9 @@ public static void HandleVerifyExperience(Session session, params string[] param

var currentSpent = totalXP - unassignedXP;

if (calculatedSpent != currentSpent)
var bonusXp = (currentSpent - calculatedSpent) % 526;

if (calculatedSpent != currentSpent && bonusXp != 0)
{
// the results for this data set can be large,
// especially due to an earlier ace bug where it wasn't calculating the Proficiency Points correctly
Expand Down
2 changes: 1 addition & 1 deletion Source/ACE.Server/Factories/PlayerFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public static CreateResult Create(CharacterCreateInfo characterCreateInfo, Weeni
}
else if (sac == SkillAdvancementClass.Trained)
{
if (!player.TrainSkill((Skill)i, trainedCost))
if (!player.TrainSkill((Skill)i, trainedCost, true))
return CreateResult.FailedToTrainSkill;
}
else if (sac == SkillAdvancementClass.Untrained)
Expand Down
2 changes: 1 addition & 1 deletion Source/ACE.Server/WorldObjects/AugmentationDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public void DoAugmentation(Player player)
{
var playerSkill = player.GetCreatureSkill(AugTypeHelper.GetSkill(type));
playerSkill.AdvancementClass = SkillAdvancementClass.Specialized;
playerSkill.InitLevel += 5;
//playerSkill.InitLevel = 10;
// adjust rank?
// handle overages?
// if trained skill is maxed, there will be a ~103m xp overage...
Expand Down
25 changes: 16 additions & 9 deletions Source/ACE.Server/WorldObjects/Player_Skills.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public bool TrainSkill(Skill skill)
/// <summary>
/// Sets the skill to trained status for a character
/// </summary>
public bool TrainSkill(Skill skill, int creditsSpent)
public bool TrainSkill(Skill skill, int creditsSpent, bool applyCreationBonusXP = false)
{
var creatureSkill = GetCreatureSkill(skill);

Expand All @@ -177,8 +177,15 @@ public bool TrainSkill(Skill skill, int creditsSpent)

creatureSkill.AdvancementClass = SkillAdvancementClass.Trained;
creatureSkill.Ranks = 0;
creatureSkill.ExperienceSpent = 0;
creatureSkill.InitLevel += 5;
creatureSkill.InitLevel = 0;

if (applyCreationBonusXP)
{
creatureSkill.ExperienceSpent = 526;
gmriggs marked this conversation as resolved.
Show resolved Hide resolved
creatureSkill.Ranks = 5;
}
else
creatureSkill.ExperienceSpent = 0;

AvailableSkillCredits -= creditsSpent;

Expand Down Expand Up @@ -222,7 +229,7 @@ public bool SpecializeSkill(Skill skill, int creditsSpent, bool resetSkill = tru
creatureSkill.Ranks = (ushort)CalcSkillRank(SkillAdvancementClass.Specialized, creatureSkill.ExperienceSpent);
}

creatureSkill.InitLevel += 5;
creatureSkill.InitLevel = 10;
creatureSkill.AdvancementClass = SkillAdvancementClass.Specialized;

AvailableSkillCredits -= creditsSpent;
Expand Down Expand Up @@ -258,7 +265,7 @@ public bool UntrainSkill(Skill skill, int creditsSpent)
if (IsSkillUntrainable(skill))
{
creatureSkill.AdvancementClass = SkillAdvancementClass.Untrained;
creatureSkill.InitLevel -= 5;
creatureSkill.InitLevel = 0;
AvailableSkillCredits += creditsSpent;
}

Expand All @@ -284,7 +291,7 @@ public bool UnspecializeSkill(Skill skill, int creditsSpent)
AvailableSkillCredits += creditsSpent;

creatureSkill.AdvancementClass = SkillAdvancementClass.Trained;
creatureSkill.InitLevel -= 5;
creatureSkill.InitLevel = 0;
creatureSkill.ExperienceSpent = 0;
creatureSkill.Ranks = 0;

Expand Down Expand Up @@ -761,7 +768,7 @@ public bool ResetSkill(Skill skill)
if (creatureSkill.AdvancementClass == SkillAdvancementClass.Specialized)
{
creatureSkill.AdvancementClass = SkillAdvancementClass.Trained;
creatureSkill.InitLevel -= 5;
creatureSkill.InitLevel = 0;
AvailableSkillCredits += skillBase.UpgradeCostFromTrainedToSpecialized;
}

Expand All @@ -770,7 +777,7 @@ public bool ResetSkill(Skill skill)
if (untrainable)
{
creatureSkill.AdvancementClass = SkillAdvancementClass.Untrained;
creatureSkill.InitLevel -= 5;
creatureSkill.InitLevel = 0;
AvailableSkillCredits += skillBase.TrainedCost;
}

Expand All @@ -782,7 +789,7 @@ public bool ResetSkill(Skill skill)
var updateSkill = new GameMessagePrivateUpdateSkill(this, creatureSkill);
var availableSkillCredits = new GameMessagePrivateUpdatePropertyInt(this, PropertyInt.AvailableSkillCredits, AvailableSkillCredits ?? 0);

var msg = $"Your {typeOfSkill} {skill.ToSentence()} skill has been {(untrainable ? "removed" : "reset")}. ";
var msg = $"Your {(untrainable ? $"{typeOfSkill}" : "")}{skill.ToSentence()} skill has been {(untrainable ? "removed" : "reset")}. ";
msg += $"All the experience {(creditRefund ? "and skill credits " : "")}that you spent on this skill have been refunded to you.";

Session.Network.EnqueueSend(updateSkill, availableSkillCredits, new GameMessageSystemChat(msg, ChatMessageType.Broadcast));
Expand Down