public static void FixBackerNames(bool state) { // finding all objects GameObject[] allObjects = GameObject.FindObjectsOfType <GameObject>(); // finding all backer npcs List <GameObject> allBackers = new List <GameObject>(); for (int i = allObjects.Length - 1; i > 0; i--) { if ((allObjects[i].name.StartsWith("NPC_BACKER") || allObjects[i].name.StartsWith("NPC_Visceris")) && allObjects[i].GetComponent <CharacterStats>() != null) { allBackers.Add(allObjects[i]); } } if (state) { string humanMalesPath = Path.Combine(Path.Combine(Application.dataPath, "Managed/iemod/names"), "human-males.txt"); string humanFemalesPath = Path.Combine(Path.Combine(Application.dataPath, "Managed/iemod/names"), "human-females.txt"); string dwarfMalesPath = Path.Combine(Path.Combine(Application.dataPath, "Managed/iemod/names"), "dwarf-males.txt"); string dwarfFemalesPath = Path.Combine(Path.Combine(Application.dataPath, "Managed/iemod/names"), "dwarf-females.txt"); string elfMalesPath = Path.Combine(Path.Combine(Application.dataPath, "Managed/iemod/names"), "elf-males.txt"); string elfFemalesPath = Path.Combine(Path.Combine(Application.dataPath, "Managed/iemod/names"), "elf-females.txt"); string orlanMalesPath = Path.Combine(Path.Combine(Application.dataPath, "Managed/iemod/names"), "orlan-males.txt"); string orlanFemalesPath = Path.Combine(Path.Combine(Application.dataPath, "Managed/iemod/names"), "orlan-females.txt"); string aumauaMalesPath = Path.Combine(Path.Combine(Application.dataPath, "Managed/iemod/names"), "aumaua-males.txt"); string aumauaFemalesPath = Path.Combine(Path.Combine(Application.dataPath, "Managed/iemod/names"), "aumaua-females.txt"); string[] humanMaleNames; string[] humanFemaleNames; string[] dwarfMaleNames; string[] dwarfFemaleNames; string[] elfMaleNames; string[] elfFemaleNames; string[] orlanMaleNames; string[] orlanFemaleNames; string[] aumauaMaleNames; string[] aumauaFemaleNames; if (File.Exists(humanMalesPath) && File.Exists(humanFemalesPath) && File.Exists(dwarfMalesPath) && File.Exists(dwarfFemalesPath) && File.Exists(elfMalesPath) && File.Exists(elfFemalesPath) && File.Exists(orlanMalesPath) && File.Exists(orlanFemalesPath) && File.Exists(aumauaMalesPath) && File.Exists(aumauaFemalesPath)) { humanMaleNames = File.ReadAllLines(humanMalesPath); humanFemaleNames = File.ReadAllLines(humanFemalesPath); dwarfMaleNames = File.ReadAllLines(dwarfMalesPath); dwarfFemaleNames = File.ReadAllLines(dwarfFemalesPath); elfMaleNames = File.ReadAllLines(elfMalesPath); elfFemaleNames = File.ReadAllLines(elfFemalesPath); orlanMaleNames = File.ReadAllLines(orlanMalesPath); orlanFemaleNames = File.ReadAllLines(orlanFemalesPath); aumauaMaleNames = File.ReadAllLines(aumauaMalesPath); aumauaFemaleNames = File.ReadAllLines(aumauaFemalesPath); for (int z = 0; z < allBackers.Count; z++) { // disabling dialogues for backers if (IEModOptions.DisableBackerDialogs) { GameUtilities.Destroy(allBackers[z].GetComponent <NPCDialogue>()); } CharacterStats backer = allBackers[z].GetComponent <CharacterStats>(); if (backer != null) { string originalName = backer.DisplayName.ToString(); int seedForThisNpc = originalName.GetHashCode(); if (backer.RacialBodyType == CharacterStats.Race.Human) { if (backer.Gender == Gender.Male) { AssignRandomName(seedForThisNpc, ref humanMaleNames, backer); } else if (backer.Gender == Gender.Female) { AssignRandomName(seedForThisNpc, ref humanFemaleNames, backer); } } else if (backer.RacialBodyType == CharacterStats.Race.Dwarf) { if (backer.Gender == Gender.Male) { AssignRandomName(seedForThisNpc, ref dwarfMaleNames, backer); } else if (backer.Gender == Gender.Female) { AssignRandomName(seedForThisNpc, ref dwarfFemaleNames, backer); } } else if (backer.RacialBodyType == CharacterStats.Race.Elf) { if (backer.Gender == Gender.Male) { AssignRandomName(seedForThisNpc, ref elfMaleNames, backer); } else if (backer.Gender == Gender.Female) { AssignRandomName(seedForThisNpc, ref elfFemaleNames, backer); } } else if (backer.RacialBodyType == CharacterStats.Race.Aumaua) { if (backer.Gender == Gender.Male) { AssignRandomName(seedForThisNpc, ref aumauaMaleNames, backer); } else if (backer.Gender == Gender.Female) { AssignRandomName(seedForThisNpc, ref aumauaFemaleNames, backer); } } else if (backer.RacialBodyType == CharacterStats.Race.Orlan) { if (backer.Gender == Gender.Male) { AssignRandomName(seedForThisNpc, ref orlanMaleNames, backer); } else if (backer.Gender == Gender.Female) { AssignRandomName(seedForThisNpc, ref orlanFemaleNames, backer); } } } } } else { Console.AddMessage( "IEMod: At least one of the .txt files with backer names is missing at path: " + Path.Combine(Application.dataPath, "Managed/iemod/names"), Color.red); } } else { for (int z = 0; z < allBackers.Count; z++) { GameObject npc = allBackers[z]; CharacterStats backer = npc.GetComponent <CharacterStats>(); if (backer != null) { string originalName = backer.DisplayName.ToString(); if (backer.OverrideName != "" && backer.OverrideName != originalName) { backer.OverrideName = originalName; } } } } }
public void AttachCapeNew(Transform skeleton) { if (!IEModOptions.CapesHidden) // Only inserted line really... { Equipment component = base.GetComponent <Equipment>(); if (component == null) { return; } Equippable neck = null; if (component.CurrentItems != null) { if (component.CurrentItems.Neck != null && component.CurrentItems.Neck.Appearance.bodyPiece == AppearancePiece.BodyPiece.Cape) { neck = component.CurrentItems.Neck; } } else if (component.DefaultEquippedItems != null && component.DefaultEquippedItems.Neck != null && component.DefaultEquippedItems.Neck.Appearance.bodyPiece == AppearancePiece.BodyPiece.Cape) { neck = component.DefaultEquippedItems.Neck; } if (neck == null) { if (this.m_capeMeshObject != null) { GameUtilities.Destroy(this.m_capeMeshObject); this.m_capeMeshObject = null; } this.m_capeCachedEquippable = null; return; } if (this.m_capeCachedEquippable == neck) { return; } if (this.m_capeMeshObject != null) { GameUtilities.Destroy(this.m_capeMeshObject); this.m_capeMeshObject = null; } this.m_capeCachedEquippable = neck; if (this.FindBone(skeleton, "bn_cloth_01") == null) { this.AddCapeBone(this.FindBone(skeleton, "Neck")); } string capePrefabPath = this.GetCapePrefabPath(); NPCAppearance.s_loader.LoadBundle <GameObject>(capePrefabPath, false); if (NPCAppearance.s_loader.obj) { this.m_capeMeshObject = Object.Instantiate(NPCAppearance.s_loader.obj) as GameObject; this.m_capeMeshObject.name = "Cape Mesh"; this.m_capeMeshObject.transform.parent = base.transform; this.m_capeMeshObject.transform.localPosition = Vector3.zero; this.m_capeMeshObject.transform.localRotation = Quaternion.identity; if (base.gameObject.layer != PE_Paperdoll.PaperdollLayer) { this.m_capeMeshObject.layer = LayerUtility.FindLayerValue("Dynamics"); } else { this.m_capeMeshObject.layer = PE_Paperdoll.PaperdollLayer; } ClothMesh clothMesh = this.m_capeMeshObject.GetComponent <ClothMesh>(); if (clothMesh != null) { clothMesh.SkeletonObject = skeleton.gameObject; clothMesh.SkinnedMeshes = new SkinnedMeshRenderer[1]; SkinnedMeshRenderer sLoader = this.m_capeMeshObject.GetComponent <SkinnedMeshRenderer>(); string str = "Art/Character/Textures/Cape/m_Cape01_V"; str = (neck.Appearance.materialVariation >= 10 ? string.Concat(str, neck.Appearance.materialVariation, string.Empty) : string.Concat(str, "0", neck.Appearance.materialVariation)); NPCAppearance.s_loader.LoadBundle <GameObject>(str, false); if (!NPCAppearance.s_loader.obj) { Debug.LogError(string.Concat("Cape Material Asset could not be found! Searched for at: '", str, "'")); } else { sLoader.material = NPCAppearance.s_loader.obj as Material; } clothMesh.SkinnedMeshes[0] = sLoader; } } } }