public CharacterTalent(TalentPrefab talentPrefab, Character character) { Character = character; Prefab = talentPrefab; XElement element = talentPrefab.ConfigElement; DebugIdentifier = talentPrefab.OriginalName; foreach (XElement subElement in element.Elements()) { switch (subElement.Name.ToString().ToLowerInvariant()) { case "abilitygroupeffect": LoadAbilityGroupEffect(subElement); break; case "abilitygroupinterval": LoadAbilityGroupInterval(subElement); break; case "addedrecipe": if (subElement.GetAttributeString("itemidentifier", string.Empty) is string recipeIdentifier && recipeIdentifier != string.Empty) { UnlockedRecipes.Add(recipeIdentifier); } else { DebugConsole.ThrowError("No recipe identifier defined for talent " + DebugIdentifier); } break; } }
public void Init() { NPCSet.LoadSets(); FactionPrefab.LoadFactions(); CharacterPrefab.LoadAll(); MissionPrefab.Init(); TraitorMissionPrefab.Init(); MapEntityPrefab.Init(); MapGenerationParams.Init(); LevelGenerationParams.LoadPresets(); CaveGenerationParams.LoadPresets(); OutpostGenerationParams.LoadPresets(); EventSet.LoadPrefabs(); Order.Init(); EventManagerSettings.Init(); ItemPrefab.LoadAll(GetFilesOfType(ContentType.Item)); AfflictionPrefab.LoadAll(GetFilesOfType(ContentType.Afflictions)); SkillSettings.Load(GetFilesOfType(ContentType.SkillSettings)); StructurePrefab.LoadAll(GetFilesOfType(ContentType.Structure)); UpgradePrefab.LoadAll(GetFilesOfType(ContentType.UpgradeModules)); JobPrefab.LoadAll(GetFilesOfType(ContentType.Jobs)); CorpsePrefab.LoadAll(GetFilesOfType(ContentType.Corpses)); NPCConversation.LoadAll(GetFilesOfType(ContentType.NPCConversations)); ItemAssemblyPrefab.LoadAll(); LevelObjectPrefab.LoadAll(); BallastFloraPrefab.LoadAll(GetFilesOfType(ContentType.MapCreature)); TalentPrefab.LoadAll(GetFilesOfType(ContentType.Talents)); TalentTree.LoadAll(GetFilesOfType(ContentType.TalentTrees)); GameModePreset.Init(); DecalManager = new DecalManager(); LocationType.Init(); SubmarineInfo.RefreshSavedSubs(); Screen.SelectNull(); NetLobbyScreen = new NetLobbyScreen(); CheckContentPackage(); }
public TalentTree(XElement element, string filePath) { ConfigElement = element; string jobIdentifier = element.GetAttributeString("jobidentifier", "").ToLowerInvariant(); if (string.IsNullOrEmpty(jobIdentifier)) { DebugConsole.ThrowError($"No job defined for talent tree in \"{filePath}\"!"); return; } foreach (XElement subTreeElement in element.GetChildElements("subtree")) { TalentSubTrees.Add(new TalentSubTree(subTreeElement)); } // talents found and unlocked using the identifier wihin the talent tree, so no duplicates may occur HashSet <string> duplicateSet = new HashSet <string>(); foreach (string talent in TalentSubTrees.SelectMany(s => s.TalentOptionStages.SelectMany(o => o.Talents.Select(t => t.Identifier)))) { TalentPrefab talentPrefab = TalentPrefab.TalentPrefabs.Find(c => c.Identifier.Equals(talent, StringComparison.OrdinalIgnoreCase)); if (talentPrefab == null) { DebugConsole.AddWarning($"Talent tree for job {jobIdentifier} contains non-existent talent {talent}! Talent tree not added."); return; } if (!duplicateSet.Add(talent)) { DebugConsole.ThrowError($"Talent tree for job {jobIdentifier} contains duplicate talent {talent}! Talent tree not added."); return; } } if (!JobTalentTrees.TryAdd(jobIdentifier, this)) { DebugConsole.ThrowError($"Could not add talent tree for job {jobIdentifier}! A talent tree for this job is already likely defined"); } }