Пример #1
0
        /// <summary>
        /// Gets a list of all reward nodes added to the given map node pool by mods,
        /// then adds them to the list passed in.
        /// Reward nodes which naturally appear in the pool will not be returned.
        /// </summary>
        /// <param name="mapNodePoolID">ID of the map node pool to get nodes for</param>
        /// <param name="mapNodes">List of map nodes to add the nodes to</param>
        /// <param name="classTypeOverride">Whether or not only nodes matching the main/subclass should be added</param>
        /// <returns>A list of reward nodes added to the map node pool with given ID by mods</returns>
        public static void AddRewardNodesForPool(string mapNodePoolID, List <MapNodeData> mapNodes, RunState.ClassType classTypeOverride)
        {
            if (CustomRewardNodeData.ContainsKey(mapNodePoolID))
            {
                var validMapNodes    = new List <MapNodeData>();
                var possibleMapNodes = CustomRewardNodeData[mapNodePoolID];

                foreach (MapNodeData mapNodeData in possibleMapNodes)
                {
                    RewardNodeData rewardNodeData;
                    if ((rewardNodeData = (mapNodeData as RewardNodeData)) != null && rewardNodeData.RequiredClass != null)
                    {
                        if (classTypeOverride == RunState.ClassType.MainClass && ProviderManager.SaveManager.GetMainClass() != rewardNodeData.RequiredClass)
                        {
                            continue;
                        }
                        else if (classTypeOverride == RunState.ClassType.SubClass && ProviderManager.SaveManager.GetSubClass() != rewardNodeData.RequiredClass)
                        {
                            continue;
                        }
                    }
                    validMapNodes.Add(mapNodeData);
                }

                mapNodes.AddRange(validMapNodes);
            }
        }
 static void Postfix(RandomMapDataContainer __instance, RunState.ClassType ____classTypeOverride, List <MapNodeData> __result)
 {
     CustomMapNodePoolManager.AddRewardNodesForPool(__instance.name, __result, ____classTypeOverride);
 }