static void Postfix(ref CollectableRelicData __result, ref string relicID) { if (Managers.CustomCollectableRelicManager.CustomRelicData.ContainsKey(relicID)) { __result = Managers.CustomCollectableRelicManager.CustomRelicData[relicID]; } }
/// <summary> /// Add the relic to the relic pools with given IDs. /// </summary> /// <param name="relicData">CollectableRelicData to be added to the pools</param> /// <param name="relicPoolIDs">List of relic pool IDs to add the relic to</param> public static void AddRelicToPools(CollectableRelicData relicData, List <string> relicPoolIDs) { foreach (string relicPoolID in relicPoolIDs) { if (!CustomRelicPoolData.ContainsKey(relicPoolID)) { CustomRelicPoolData[relicPoolID] = new List <CollectableRelicData>(); } CustomRelicPoolData[relicPoolID].Add(relicData); } }
/// <summary> /// Register a custom relic with the manager, allowing it to show up in game. /// </summary> /// <param name="relicData">The custom relic data to register</param> /// <param name="relicPoolData">The pools to insert the custom relic data into</param> public static void RegisterCustomRelic(CollectableRelicData relicData, List <string> relicPoolData) { if (!CustomRelicData.ContainsKey(relicData.GetID())) { CustomRelicData.Add(relicData.GetID(), relicData); CustomRelicPoolManager.AddRelicToPools(relicData, relicPoolData); ProviderManager.SaveManager.GetAllGameData().GetAllCollectableRelicData().Add(relicData); } else { Trainworks.Log(LogLevel.Warning, "Attempted to register duplicate relic data with name: " + relicData.name); } }