// modified copy from assembly internal static void ForceResetCharacter(SGBarracksAdvancementPanel panel) { var sim = UnityGameInstance.BattleTechGame.Simulation; var traverse = Traverse.Create(panel); var orderedDictionary = traverse.Field("upgradedSkills").GetValue <OrderedDictionary>(); panel.SetPilot(traverse.Field("basePilot").GetValue <Pilot>(), true); foreach (var obj in orderedDictionary.Values) { var keyValuePair = (KeyValuePair <string, int>)obj; Trace($"Resetting {keyValuePair.Key} {keyValuePair.Value}"); // this is the only change - calling internal implementation SetTempPilotSkill(keyValuePair.Key, keyValuePair.Value, sim.GetLevelCost(keyValuePair.Value)); } var callback = traverse.Field("OnValueChangeCB").GetValue <UnityAction <Pilot> >(); callback?.Invoke(traverse.Field("curPilot").GetValue <Pilot>()); }
internal static void ForceResetCharacter(SGBarracksAdvancementPanel panel) { var sim = UnityGameInstance.BattleTechGame.Simulation; var traverse = Traverse.Create(panel); var orderedDictionary = traverse.Field("upgradedSkills").GetValue <OrderedDictionary>(); var upgradedPrimarySkills = traverse.Field("upgradedPrimarySkills").GetValue <List <AbilityDef> >(); var upgradedAbilities = new List <AbilityDef>(); upgradedAbilities.AddRange(upgradedPrimarySkills); panel.SetPilot(traverse.Field("basePilot").GetValue <Pilot>(), true); foreach (var obj in orderedDictionary.Values) { var keyValuePair = (KeyValuePair <string, int>)obj; var abilityDef = upgradedAbilities.FindAll(x => x.ReqSkill.ToString() == keyValuePair.Key && x.ReqSkillLevel == keyValuePair.Value + 1); if (abilityDef.Count > 0) { Trace($"Resetting {keyValuePair.Key} {keyValuePair.Value}"); // this is the only change - calling internal implementation SetTempPilotSkill(keyValuePair.Key, keyValuePair.Value, sim.GetLevelCost(keyValuePair.Value), abilityDef[0]); } else { Trace($"Resetting {keyValuePair.Key} {keyValuePair.Value}"); // this is the only change - calling internal implementation SetTempPilotSkill(keyValuePair.Key, keyValuePair.Value, sim.GetLevelCost(keyValuePair.Value)); } } var callback = traverse.Field("OnValueChangeCB").GetValue <UnityAction <Pilot> >(); callback?.Invoke(traverse.Field("curPilot").GetValue <Pilot>()); }