/// <summary> /// Register a custom class with the manager, allowing it to show up in game. /// </summary> /// <param name="classData">The custom class data to register</param> public static void RegisterCustomClass(ClassData classData) { if (!CustomClassData.ContainsKey(classData.GetID())) { CustomClassData.Add(classData.GetID(), classData); ProviderManager.SaveManager.GetAllGameData().GetAllClassDatas().Add(classData); ProviderManager.SaveManager.GetAllGameData().GetBalanceData().GetClassDatas().Add(classData); } else { Trainworks.Log(LogLevel.Warning, "Attempted to register duplicate class data with name: " + classData.name); } }
/// <summary> /// Get the class data corresponding to the given ID. /// </summary> /// <param name="classID">ID of the class to get</param> /// <returns>The class data for the given ID</returns> public static ClassData GetClassDataByID(string classID) { // Search for custom clan matching ID var guid = GUIDGenerator.GenerateDeterministicGUID(classID); if (CustomClassData.ContainsKey(guid)) { return(CustomClassData[guid]); } // No custom clan found; search for vanilla clan matching ID var vanillaClan = ProviderManager.SaveManager.GetAllGameData().FindClassData(classID); if (vanillaClan == null) { Trainworks.Log(LogLevel.All, "Couldn't find clan: " + classID + " - This will cause crashes."); } return(vanillaClan); }