Esempio n. 1
0
        public static void SkillLevelUp_Req(InPacket lea, Client gc)
        {
            byte Type = lea.ReadByte();
            byte Slot = lea.ReadByte();

            var chr = gc.Character;

            if (chr.SkillBonus < 1)
            {
                return;
            }

            List <Skill> s  = chr.Skills.getSkills();
            Skill        sl = null;

            foreach (Skill skill in s)
            {
                if (skill.Type == Type && skill.Slot == Slot)
                {
                    sl = skill;
                    break;
                }
            }

            if (sl == null || (sl.SkillID == 1 && sl.SkillLevel + 1 > 5) || (sl.SkillID == 2 && sl.SkillLevel + 1 > 10) || (sl.SkillID == 3 && sl.SkillLevel + 1 > 20) || (sl.SkillID == 4 && sl.SkillLevel + 1 > 20) || sl.SkillLevel + 1 > 20)
            {
                return;
            }

            chr.SkillBonus--;
            sl.SkillLevel++;

            if (sl.SkillID == 10101 || sl.SkillID == 10201 || sl.SkillID == 10301 || sl.SkillID == 10401 || sl.SkillID == 10501 || sl.SkillID == 10102 || sl.SkillID == 10202 || sl.SkillID == 10302 || sl.SkillID == 10402 || sl.SkillID == 10502)
            {
                if (chr.Items[InventoryType.ItemType.Equip, (byte)InventoryType.EquipType.Weapon] != null)
                {
                    int ItemID    = chr.Items[InventoryType.ItemType.Equip, (byte)InventoryType.EquipType.Weapon].ItemID;
                    int MaxAttack = 5;
                    int Attack    = 3;
                    int MaxMagic  = 4;
                    int Magic     = 4;
                    MaxAttack += ((chr.Str - 3) * 2 + chr.Str / 5);
                    MaxAttack += ((chr.Dex - 3) * 2 + chr.Dex / 5);
                    Attack    += ((chr.Dex - 3) * 1 + chr.Dex / 5);
                    MaxMagic  += ((chr.Int - 3) * 2 + chr.Int / 5);
                    Magic     += ((chr.Int - 3) * 2 + chr.Int / 5);

                    // 技能攻擊力+、魔攻力+
                    if (InventoryType.Is劍(ItemID) && sl.SkillID == 10101)
                    {
                        chr.MaxAttack -= (short)(MaxAttack * 0.02 * (sl.SkillLevel - 1));
                        chr.Attack    -= (short)(Attack * 0.02 * (sl.SkillLevel - 1));
                        chr.MaxAttack += (short)(MaxAttack * 0.02 * sl.SkillLevel);
                        chr.Attack    += (short)(Attack * 0.02 * sl.SkillLevel);
                    }
                    if (InventoryType.Is刀(ItemID) && sl.SkillID == 10102)
                    {
                        chr.MaxAttack -= (short)(MaxAttack * 0.03 * (sl.SkillLevel - 1));
                        chr.Attack    -= (short)(Attack * 0.03 * (sl.SkillLevel - 1));
                        chr.MaxAttack += (short)(MaxAttack * 0.03 * sl.SkillLevel);
                        chr.Attack    += (short)(Attack * 0.03 * sl.SkillLevel);
                    }
                    if (InventoryType.Is手套(ItemID) && sl.SkillID == 10201)
                    {
                        chr.MaxAttack -= (short)(MaxAttack * 0.02 * (sl.SkillLevel - 1));
                        chr.Attack    -= (short)(Attack * 0.02 * (sl.SkillLevel - 1));
                        chr.MaxAttack += (short)(MaxAttack * 0.02 * sl.SkillLevel);
                        chr.Attack    += (short)(Attack * 0.02 * sl.SkillLevel);
                    }
                    if (InventoryType.Is爪(ItemID) && sl.SkillID == 10202)
                    {
                        chr.MaxAttack -= (short)(MaxAttack * 0.03 * (sl.SkillLevel - 1));
                        chr.Attack    -= (short)(Attack * 0.03 * (sl.SkillLevel - 1));
                        chr.MaxAttack += (short)(MaxAttack * 0.03 * sl.SkillLevel);
                        chr.Attack    += (short)(Attack * 0.03 * sl.SkillLevel);
                    }
                    if (InventoryType.Is扇(ItemID) && sl.SkillID == 10301)
                    {
                        chr.MaxMagic -= (short)(MaxMagic * 0.02 * (sl.SkillLevel - 1));
                        chr.Magic    -= (short)(Magic * 0.02 * (sl.SkillLevel - 1));
                        chr.MaxMagic += (short)(MaxMagic * 0.02 * sl.SkillLevel);
                        chr.Magic    += (short)(Magic * 0.02 * sl.SkillLevel);
                    }
                    if (InventoryType.Is杖(ItemID) && sl.SkillID == 10302)
                    {
                        chr.MaxMagic -= (short)(MaxMagic * 0.03 * (sl.SkillLevel - 1));
                        chr.Magic    -= (short)(Magic * 0.03 * (sl.SkillLevel - 1));
                        chr.MaxMagic += (short)(MaxMagic * 0.03 * sl.SkillLevel);
                        chr.Magic    += (short)(Magic * 0.03 * sl.SkillLevel);
                    }
                    if (InventoryType.Is斧(ItemID) && sl.SkillID == 10401)
                    {
                        chr.MaxAttack -= (short)(MaxAttack * 0.02 * (sl.SkillLevel - 1));
                        chr.Attack    -= (short)(Attack * 0.02 * (sl.SkillLevel - 1));
                        chr.MaxAttack += (short)(MaxAttack * 0.02 * sl.SkillLevel);
                        chr.Attack    += (short)(Attack * 0.02 * sl.SkillLevel);
                    }
                    if (InventoryType.Is輪(ItemID) && sl.SkillID == 10402)
                    {
                        chr.MaxAttack -= (short)(MaxAttack * 0.03 * (sl.SkillLevel - 1));
                        chr.Attack    -= (short)(Attack * 0.03 * (sl.SkillLevel - 1));
                        chr.MaxAttack += (short)(MaxAttack * 0.03 * sl.SkillLevel);
                        chr.Attack    += (short)(Attack * 0.03 * sl.SkillLevel);
                    }
                    //if (Skill.ContainsKey(10501) && InventoryType.Is(chr.Items[InventoryType.ItemType.Equip, (byte)InventoryType.EquipType.Weapon].ItemID))
                    //{

                    //}
                    //if (Skill.ContainsKey(10502) && InventoryType.Is(chr.Items[InventoryType.ItemType.Equip, (byte)InventoryType.EquipType.Weapon].ItemID))
                    //{

                    //}
                    StatusPacket.UpdateStat(gc);
                }
            }

            SkillPacket.updateSkillLevel(gc, chr.SkillBonus, Type, Slot, sl.SkillLevel);
        }