/// <summary>
        /// Get a producer rule for a given producer name and input.
        /// </summary>
        /// <param name="producerName">Name of the producer</param>
        /// <param name="input">Input object of a rule</param>
        /// <returns>The producer config</returns>
        public static ProducerRule GetProducerItem(string producerName, Object input)
        {
            ProducerRule value;

            if (input == null)
            {
                RulesRepository.TryGetValue(new Tuple <string, object>(producerName, null), out value);
            }
            else
            {
                RulesRepository.TryGetValue(new Tuple <string, object>(producerName, input.ParentSheetIndex), out value);
                if (value == null)
                {
                    foreach (string tag in input.GetContextTagList())
                    {
                        if (RulesRepository.TryGetValue(new Tuple <string, object>(producerName, tag), out value))
                        {
                            break;
                        }
                    }
                }
                if (value == null)
                {
                    RulesRepository.TryGetValue(new Tuple <string, object>(producerName, input.Category), out value);
                }
            }

            return(value);
        }
示例#2
0
        /// <summary>
        /// Gets the info on an input.
        /// </summary>
        /// <param name="inputObject"></param>
        /// <param name="baseQuantityRequired"></param>
        /// <returns></returns>
        public static InputInfo ConvertInput(SObject inputObject, int baseQuantityRequired)
        {
            if (inputObject == null)
            {
                return(null);
            }

            return(new InputInfo()
            {
                ID = inputObject.ParentSheetIndex,
                Name = inputObject.name,
                Quality = inputObject.Quality,
                BaseQuantity = baseQuantityRequired,
                IsFuel = false,
                ContextTags = inputObject.GetContextTagList().ToArray()
            });
        }
示例#3
0
        /// <summary>
        /// Gets all fuels required as InputInfo objects.
        /// </summary>
        /// <param name="fuelList"></param>
        /// <returns></returns>
        private static List <InputInfo> GetFromFuelList(IEnumerable <Tuple <int, int> > fuelList)
        {
            List <InputInfo> fuels = new List <InputInfo>();

            Dictionary <int, string> objects = ModEntry.Instance.Helper.Content.Load <Dictionary <int, string> >("Data\\ObjectInformation", ContentSource.GameContent);

            foreach (Tuple <int, int> fuel in fuelList)
            {
                SObject sample = new SObject(fuel.Item1, 1);

                fuels.Add(new InputInfo()
                {
                    ID           = fuel.Item1,
                    Name         = sample.name,
                    Quality      = 0, //TOREVIEW: should we poll for fuel quality here?
                    BaseQuantity = fuel.Item2,
                    IsFuel       = true,
                    ContextTags  = sample.GetContextTagList().ToArray()
                });
            }

            return(fuels);
        }