public static void AdAb() { CharacterStats firstparam = GameState.s_playerCharacter.GetComponent <CharacterStats>(); AbilityProgressionTable wizardsProgressionTable = AbilityProgressionTable.LoadAbilityProgressionTable("Wizard"); global::Console.AddMessage("Wizard abilities in game: " + wizardsProgressionTable.AbilityUnlocks.Length); global::Console.AddMessage("This wizard has abilities: " + GameState.s_playerCharacter.GetComponent <CharacterStats>().GetCopyOfCoreData().KnownSkills.Count()); foreach (var abil in wizardsProgressionTable.AbilityUnlocks) { bool hasSpell = false; foreach (var spell in firstparam.GetCopyOfCoreData().KnownSkills) { if (abil.Ability.name == spell.name.Replace("(Clone)", "")) { hasSpell = true; } } if (hasSpell) { global::Console.AddMessage("The wizard already knows: " + abil.Ability.name); } else { AbilityProgressionTable.AddAbilityToCharacter(abil.Ability.name, firstparam, false); } } }
public static void FixSagani(string guid) { GameObject sagani = UnityEngine.GameObject.Find(guid); if (sagani != null) { for (int i = sagani.GetComponent <CharacterStats>().ActiveAbilities.Count - 1; i > -1; i--) { if (sagani.GetComponent <CharacterStats>().ActiveAbilities[i].gameObject.name.Contains("SummonCompanion") && !sagani.GetComponent <CharacterStats>().ActiveAbilities[i].gameObject.name.Contains("ArcticFox")) { sagani.GetComponent <CharacterStats>().ActiveAbilities[i].ForceDeactivate(sagani); AbilityProgressionTable.RemoveAbilityFromCharacter(sagani.GetComponent <CharacterStats>().ActiveAbilities[i].gameObject, sagani.GetComponent <CharacterStats>()); } } } else { global::Console.AddMessage("Character not found."); } }
public static void ChangeClass(string guid, string charclass) { GameObject npc = null; string charname = guid.Replace("_", " "); foreach (var partymember in PartyMemberAI.PartyMembers) { if (partymember != null && RemoveDiacritics(partymember.gameObject.GetComponent <CharacterStats>().Name()).Contains(charname)) { npc = partymember.gameObject; } } if (npc == null) { npc = UnityEngine.GameObject.Find(guid); } if (npc != null) { bool goOn = false; try { if (Enum.Parse(typeof(CharacterStats.Class), charclass) != null) { goOn = true; } } catch { global::Console.AddMessage(charclass + " - not found as a class."); } if (goOn) { object newclassobj = Enum.Parse(typeof(CharacterStats.Class), charclass); int newclassId = Convert.ToInt32(newclassobj); List <string> Innates = new List <string>(); //Put all innate non-racial talents and abilities here (case insensitive): Innates.Add("crucible_of_the_soul"); Innates.Add("armed_to_the_teeth"); Innates.Add("speaker_to_the_restless"); Innates.Add("dominion_of_the_sleepers"); Innates.Add("steps_to_the_wheel"); Innates.Add("Beraths_Boon"); Innates.Add("Hyleas_Boon"); Innates.Add("Waels_Boon"); Innates.Add("Galawains_Boon"); Innates.Add("Rymrgands_Boon"); Innates.Add("Skaens_Boon"); Innates.Add("Second_Skin"); Innates.Add("The_Merciless_Hand"); Innates.Add("Mob_Justice"); Innates.Add("Mob Justice"); //the ability has a space in place of an underscore... Innates.Add("Blooded_Hunter"); Innates.Add("Song_of_the_Heavens"); Innates.Add("Wild_Running"); Innates.Add("Dungeon_Delver"); Innates.Add("Scale-Breaker"); Innates.Add("Gift_from_the_Machine"); Innates.Add("Effigys_Resentment"); //should work for all types if (npc.GetComponent <CharacterStats>().name.Contains("Sagani")) { Innates.Add("SummonCompanionArcticFox"); } //========================================================================== //REMOVE TALENTS //========================================================================== List <GenericTalent> talentRemoveList = new List <GenericTalent>(); foreach (GenericTalent activeTalent in npc.GetComponent <CharacterStats>().ActiveTalents) { bool saveMe = false; foreach (string innate in Innates) { if (activeTalent.gameObject.name.IndexOf(innate, StringComparison.OrdinalIgnoreCase) >= 0) //look for substring { saveMe = true; break; } } if (!saveMe) { talentRemoveList.Add(activeTalent); } } foreach (GenericTalent talentToRemove in talentRemoveList) { AbilityProgressionTable.RemoveAbilityFromCharacter(talentToRemove.gameObject, npc.GetComponent <CharacterStats>()); } talentRemoveList.Clear(); foreach (GenericTalent talent in npc.GetComponent <CharacterStats>().Talents) { bool saveMe = false; foreach (string innate in Innates) { if (talent.gameObject.name.IndexOf(innate, StringComparison.OrdinalIgnoreCase) >= 0) //look for substring { saveMe = true; break; } } if (!saveMe) { talentRemoveList.Add(talent); } } foreach (GenericTalent talentToRemove in talentRemoveList) { AbilityProgressionTable.RemoveAbilityFromCharacter(talentToRemove.gameObject, npc.GetComponent <CharacterStats>()); } //========================================================================== //========================================================================== //REMOVE ABILITIES //========================================================================== List <GenericAbility> abilRemoveList = new List <GenericAbility>(); foreach (GenericAbility activeAbility in npc.GetComponent <CharacterStats>().ActiveAbilities) { if (activeAbility.EffectType == GenericAbility.AbilityType.Racial) { continue; } bool saveMe = false; foreach (string innate in Innates) { if (activeAbility.gameObject.name.IndexOf(innate, StringComparison.OrdinalIgnoreCase) >= 0) //look for substring { saveMe = true; break; } } if (!saveMe) { abilRemoveList.Add(activeAbility); } } foreach (GenericAbility abilToRemove in abilRemoveList) { abilToRemove.ForceDeactivate(npc); AbilityProgressionTable.RemoveAbilityFromCharacter(abilToRemove.gameObject, npc.GetComponent <CharacterStats>()); } abilRemoveList.Clear(); foreach (GenericAbility ability in npc.GetComponent <CharacterStats>().Abilities) { if (ability.EffectType == GenericAbility.AbilityType.Racial) { continue; } bool saveMe = false; foreach (string innate in Innates) { if (ability.gameObject.name.IndexOf(innate, StringComparison.OrdinalIgnoreCase) >= 0) //look for substring { saveMe = true; break; } } if (!saveMe) { abilRemoveList.Add(ability); } } foreach (GenericAbility abilToRemove in abilRemoveList) { abilToRemove.ForceDeactivate(npc); AbilityProgressionTable.RemoveAbilityFromCharacter(abilToRemove.gameObject, npc.GetComponent <CharacterStats>()); } //========================================================================== // remove ranger's pet if (npc.GetComponent <CharacterStats>().CharacterClass == CharacterStats.Class.Ranger && !npc.GetComponent <CharacterStats>().name.Contains("Sagani")) { foreach (var cre in npc.GetComponent <AIController>().SummonedCreatureList) { if (GameUtilities.IsAnimalCompanion(cre.gameObject)) { PartyMemberAI.RemoveFromActiveParty(cre.GetComponent <PartyMemberAI>(), true); cre.GetComponent <Persistence>().UnloadsBetweenLevels = true; cre.GetComponent <Health>().m_isAnimalCompanion = false; cre.GetComponent <Health>().ApplyDamageDirectly(1000); cre.GetComponent <Health>().ApplyDamageDirectly(1000); global::Console.AddMessage(cre.GetComponent <CharacterStats>().Name() + " is free from its bonds and returns to the wilds to be with its own kind.", Color.green); cre.SetActive(false); } } //npc.GetComponent<AIController> ().SummonedCreatureList.Clear (); } // remove or give grimoire if (npc.GetComponent <CharacterStats>().CharacterClass != (CharacterStats.Class)newclassId) { if (npc.GetComponent <CharacterStats>().CharacterClass == CharacterStats.Class.Wizard) { npc.GetComponent <Equipment>().UnEquip(Equippable.EquipmentSlot.Grimoire); } npc.GetComponent <CharacterStats>().CharacterClass = (CharacterStats.Class)newclassId; if (npc.GetComponent <CharacterStats>().CharacterClass == CharacterStats.Class.Wizard) { // equip an empty grimoire...? Equippable grim = GameResources.LoadPrefab <Equippable>("empty_grimoire_01", true); if (grim != null) { grim.GetComponent <Grimoire>().PrimaryOwnerName = npc.GetComponent <CharacterStats>().Name(); npc.GetComponent <Equipment>().Equip(grim); } } } //BaseDeflection,BaseFortitude,BaseReflexes,BaseWill,MeleeAccuracyBonus,RangedAccuracyBonus,MaxHealth,MaxStamina,HealthStaminaPerLevel,ClassHealthMultiplier object comp = (object)npc.GetComponent <CharacterStats>(); DataManager.AdjustFromData(ref comp); npc.GetComponent <CharacterStats>().Level = 0; npc.GetComponent <CharacterStats>().StealthSkill = 0; npc.GetComponent <CharacterStats>().StealthBonus = 0; npc.GetComponent <CharacterStats>().AthleticsSkill = 0; npc.GetComponent <CharacterStats>().AthleticsBonus = 0; npc.GetComponent <CharacterStats>().LoreSkill = 0; npc.GetComponent <CharacterStats>().LoreBonus = 0; npc.GetComponent <CharacterStats>().MechanicsSkill = 0; npc.GetComponent <CharacterStats>().MechanicsBonus = 0; npc.GetComponent <CharacterStats>().SurvivalSkill = 0; npc.GetComponent <CharacterStats>().SurvivalBonus = 0; npc.GetComponent <CharacterStats>().RemainingSkillPoints = 0; string HeOrShe = npc.GetComponent <CharacterStats>().Gender.ToString(); global::Console.AddMessage(npc.GetComponent <CharacterStats>().Name() + " has reformed into a " + charclass + ". " + (HeOrShe == "Male" ? "He" : "She") + " lost all " + (HeOrShe == "Male" ? "his" : "her") + " previous abilities and talents.", Color.green); } } else { global::Console.AddMessage("Couldn't find: " + guid, Color.yellow); } }
public static void IERemove(string charname, string abilname) { charname = charname.Replace("_", " "); GameObject npc = null; foreach (var partymember in PartyMemberAI.PartyMembers) { if (partymember != null && RemoveDiacritics(partymember.gameObject.GetComponent <CharacterStats>().Name()).Contains(charname)) { npc = partymember.gameObject; } } if (npc != null) { bool removedSomething = false; CharacterStats stats = npc.GetComponent <CharacterStats>(); for (int i = stats.ActiveTalents.Count - 1; i > -1; i--) { if (stats.ActiveTalents[i].gameObject.name.Contains(abilname)) { global::Console.AddMessage("Removed active talent: " + stats.ActiveTalents[i].gameObject.name); AbilityProgressionTable.RemoveAbilityFromCharacter(stats.ActiveTalents[i].gameObject, stats); removedSomething = true; break; } } for (int i = stats.Talents.Count - 1; i > -1; i--) { if (stats.Talents[i].gameObject.name.Contains(abilname)) { global::Console.AddMessage("Removed talent: " + stats.Talents[i].gameObject.name); AbilityProgressionTable.RemoveAbilityFromCharacter(stats.Talents[i].gameObject, stats); removedSomething = true; break; } } for (int i = stats.ActiveAbilities.Count - 1; i > -1; i--) { if (stats.ActiveAbilities[i].gameObject.name.Contains(abilname)) { global::Console.AddMessage("Removed active ability: " + stats.ActiveAbilities[i].gameObject.name); stats.ActiveAbilities[i].ForceDeactivate(npc); AbilityProgressionTable.RemoveAbilityFromCharacter(stats.ActiveAbilities[i].gameObject, stats); removedSomething = true; break; } } for (int i = stats.Abilities.Count - 1; i > -1; i--) { if (stats.Abilities[i].gameObject.name.Contains(abilname)) { global::Console.AddMessage("Removed ability: " + stats.Abilities[i].gameObject.name); stats.Abilities[i].ForceDeactivate(npc); AbilityProgressionTable.RemoveAbilityFromCharacter(stats.Abilities[i].gameObject, stats); removedSomething = true; break; } } if (!removedSomething) { global::Console.AddMessage("Nothing was removed. Talent wasn't found."); } } else { global::Console.AddMessage("Party memeber not found."); } }