public static void AddCharacterTemplate(CustomCharacter template, Sprite thumbnail) { CustomCharacters.Add(template); LoadedCharactersDict.Add(template.GetCharacter(NewCharacterID, thumbnail), template); foreach (EquipmentPool pool in template.EquipmentPools) { EquipmentPoolDictionary.Add(pool.GetPoolEntry(), pool); } NewCharacterID += 1; TNHTweakerLogger.Log("TNHTweaker -- Character added successfuly : " + template.DisplayName, TNHTweakerLogger.LogType.Character); }
/// <summary> /// Performs a delayed init on the sent list of custom characters, and removes any characters that failed to init /// </summary> /// <param name="characters"></param> /// <param name="isCustom"></param> private static void InitCharacters(List <CustomCharacter> characters, bool isCustom) { for (int i = 0; i < characters.Count; i++) { CustomCharacter character = characters[i]; try { character.DelayedInit(isCustom); } catch (Exception e) { TNHTweakerLogger.LogError("TNHTweaker -- Failed to load character: " + character.DisplayName + ". Error Output:\n" + e.ToString()); characters.RemoveAt(i); LoadedTemplateManager.LoadedCharactersDict.Remove(character.GetCharacter()); i -= 1; } } }