Пример #1
0
 public static void AddItem(IEventArgs args, string rule, FreeItem item)
 {
     item = item.Clone();
     if (!map.ContainsKey(rule))
     {
         map[rule] = new MyDictionary <string, FreeItem>();
     }
     map[rule][item.GetKey()] = item;
 }
Пример #2
0
        public static FreeItem GetItem(FreeRuleEventArgs args, string key, int count)
        {
            string rule = args.Rule.FreeType;

            if (map.ContainsKey(rule) && map[rule].ContainsKey(key))
            {
                FreeItem fi = map[rule][key];
                fi = fi.Clone();
                fi.SetCount(count);
                if (fi.GetId() == 0)
                {
                    fi.SetId();
                }
                return(fi);
            }
            else
            {
                throw new GameConfigExpception("item '" + key + "' is not defined.");
            }
        }