Example #1
0
 public void AddSetTypes(XElement root)
 {
     foreach (XElement elem in root.XPathSelectElements("//EquipmentSet"))
     {
         string     id = elem.Attribute("id").Value;
         ushort     type;
         XAttribute typeAttr = elem.Attribute("type");
         if (typeAttr == null)
         {
             type = (ushort)assign.Assign(id, elem);
         }
         else
         {
             type = (ushort)Utils.FromString(typeAttr.Value);
         }
         setTypeSkins[type] = new SetTypeSkin(elem, type);
         XAttribute extAttr = elem.Attribute("ext");
         bool       ext;
         if (extAttr != null && bool.TryParse(extAttr.Value, out ext) && ext)
         {
             addition.Add(elem);
             updateCount++;
         }
     }
 }
        private void CheckSetTypeSkin()
        {
            try
            {
                if (Inventory[0]?.SetType == Inventory[1]?.SetType &&
                    Inventory[1]?.SetType == Inventory[2]?.SetType &&
                    Inventory[2]?.SetType == Inventory[3]?.SetType &&
                    Inventory[3]?.SetType == Inventory[0]?.SetType)
                {
                    SetTypeSkin setType = null;

                    var item = Inventory[0];

                    if (item != null && !GameServer.Manager.GameData.SetTypeSkins.TryGetValue((ushort)item.SetType, out setType))
                    {
                        return;
                    }

                    setTypeSkin = setType;

                    if (setTypeBoosts != null || setTypeSkin == null)
                    {
                        return;
                    }

                    setTypeBoosts = new int[8];

                    foreach (var i in setTypeSkin.StatsBoost)
                    {
                        var idx = -1;

                        if (i.Key == StatsType.MAX_HP_STAT)
                        {
                            idx = 0;
                        }
                        else if (i.Key == StatsType.MAX_MP_STAT)
                        {
                            idx = 1;
                        }
                        else if (i.Key == StatsType.ATTACK_STAT)
                        {
                            idx = 2;
                        }
                        else if (i.Key == StatsType.DEFENSE_STAT)
                        {
                            idx = 3;
                        }
                        else if (i.Key == StatsType.SPEED_STAT)
                        {
                            idx = 4;
                        }
                        else if (i.Key == StatsType.VITALITY_STAT)
                        {
                            idx = 5;
                        }
                        else if (i.Key == StatsType.WISDOM_STAT)
                        {
                            idx = 6;
                        }
                        else if (i.Key == StatsType.DEXTERITY_STAT)
                        {
                            idx = 7;
                        }
                        if (idx == -1)
                        {
                            continue;
                        }
                        setTypeBoosts[idx] = i.Value;
                    }
                    return;
                }

                if (setTypeSkin == null)
                {
                    return;
                }

                setTypeSkin   = null;
                setTypeBoosts = null;
            }
            catch { }
        }
Example #3
0
        private void CheckSetTypeSkin()
        {
            if (Inventory[0]?.SetType == Inventory[1]?.SetType &&
                Inventory[1]?.SetType == Inventory[2]?.SetType &&
                Inventory[2]?.SetType == Inventory[3]?.SetType &&
                Inventory[3]?.SetType == Inventory[0]?.SetType)
            {
                SetTypeSkin setType = null;
                var         item    = Inventory[0];
                if (item != null && !Manager.GameData.SetTypeSkins.TryGetValue((ushort)item.SetType, out setType))
                {
                    return;
                }

                setTypeSkin = setType;
                if (setTypeBoosts != null || setTypeSkin == null)
                {
                    return;
                }
                setTypeBoosts = new int[8];

                foreach (var i in setTypeSkin.StatsBoost)
                {
                    var idx = -1;

                    if (i.Key == StatsType.MaximumHP)
                    {
                        idx = 0;
                    }
                    else if (i.Key == StatsType.MaximumMP)
                    {
                        idx = 1;
                    }
                    else if (i.Key == StatsType.Attack)
                    {
                        idx = 2;
                    }
                    else if (i.Key == StatsType.Defense)
                    {
                        idx = 3;
                    }
                    else if (i.Key == StatsType.Speed)
                    {
                        idx = 4;
                    }
                    else if (i.Key == StatsType.Vitality)
                    {
                        idx = 5;
                    }
                    else if (i.Key == StatsType.Wisdom)
                    {
                        idx = 6;
                    }
                    else if (i.Key == StatsType.Dexterity)
                    {
                        idx = 7;
                    }
                    if (idx == -1)
                    {
                        continue;
                    }
                    setTypeBoosts[idx] = i.Value;
                }
                return;
            }
            if (setTypeSkin == null)
            {
                return;
            }
            setTypeSkin   = null;
            setTypeBoosts = null;
        }
 public void AddSetTypes(XElement root)
 {
     foreach (XElement elem in root.XPathSelectElements("//EquipmentSet"))
     {
         string id = elem.Attribute("id").Value;
         ushort type;
         XAttribute typeAttr = elem.Attribute("type");
         if (typeAttr == null)
             type = (ushort)assign.Assign(id, elem);
         else
             type = (ushort)Utils.FromString(typeAttr.Value);
         setTypeSkins[type] = new SetTypeSkin(elem, type);
         XAttribute extAttr = elem.Attribute("ext");
         bool ext;
         if (extAttr != null && bool.TryParse(extAttr.Value, out ext) && ext)
         {
             addition.Add(elem);
             updateCount++;
         }
     }
 }