Ejemplo n.º 1
0
        public static List <Cost> GetCosts(List <IncreaseCost> increaseCosts, int step)
        {
            IncreaseCost cost = null;

            foreach (IncreaseCost cost2 in increaseCosts)
            {
                if (((cost == null) || (cost._fromStep <= cost2._fromStep)) && (step >= cost2._fromStep))
                {
                    cost = cost2;
                }
            }
            List <Cost> list = new List <Cost>();

            if (cost != null)
            {
                foreach (Cost cost3 in cost.costs)
                {
                    Cost item = new Cost {
                        id    = cost3.id,
                        count = cost3.count + ((step - cost.fromStep) * cost3.increase)
                    };
                    list.Add(item);
                }
            }
            return(list);
        }
Ejemplo n.º 2
0
        public static IncreaseCost LoadFromXml(SecurityElement element)
        {
            IncreaseCost cost = new IncreaseCost {
                _fromStep = StrParser.ParseDecInt(element.Attribute("FromStep"), 0)
            };

            if (element.Children != null)
            {
                foreach (SecurityElement element2 in element.Children)
                {
                    string str;
                    if (((str = element2.Tag) != null) && (str == "Cost"))
                    {
                        cost._costs.Add(Cost.LoadFromXml(element2));
                    }
                }
            }
            return(cost);
        }
Ejemplo n.º 3
0
        private Meridian LoadMeridianFromXml(SecurityElement element)
        {
            Meridian meridian = new Meridian {
                id            = StrParser.ParseHexInt(element.Attribute("Id"), 0),
                name          = StrParser.ParseStr(element.Attribute("Name"), ""),
                level         = StrParser.ParseDecInt(element.Attribute("Level"), 1),
                preMeridianId = StrParser.ParseHexInt(element.Attribute("PreMeridianId"), 0),
                buffAddition  = StrParser.ParseFloat(element.Attribute("BuffAddition"), 0f)
            };

            if (element.Children != null)
            {
                foreach (SecurityElement element2 in element.Children)
                {
                    MeridianBuff buff;
                    string       tag = element2.Tag;
                    if (tag != null)
                    {
                        if (tag == "IncreaseCost")
                        {
                            meridian.increaseCosts.Add(IncreaseCost.LoadFromXml(element2));
                        }
                        else if (tag == "Buff")
                        {
                            goto Label_00E5;
                        }
                    }
                    continue;
Label_00E5:
                    buff        = new MeridianBuff();
                    buff.id     = StrParser.ParseHexInt(element2.Attribute("BuffId"), 0);
                    buff.weight = StrParser.ParseDecInt(element2.Attribute("Weight"), 1);
                    meridian.meridianBuffs.Add(buff);
                }
            }
            return(meridian);
        }
Ejemplo n.º 4
0
 public List <Cost> GetCostsByMeridianTimes(int times)
 {
     return(IncreaseCost.GetCosts(this._increaseCosts, times));
 }