예제 #1
0
        public static void InvenUseSpendStart_Req(InPacket lea, Client c)
        {
            short PositionX = lea.ReadShort();
            short PositionY = lea.ReadShort();
            int   Slot      = lea.ReadInt();
            var   chr       = c.Character;
            Map   map       = MapFactory.GetMap(chr.MapX, chr.MapY);
            Item  Item      = chr.Items.getItem((byte)InventoryType.ItemType.Spend3, (byte)Slot);

            foreach (Character All in map.Characters)
            {
                InventoryPacket.UseSpendStart(All.Client, chr, PositionX, PositionY, Item.ItemID, (byte)InventoryType.ItemType.Spend3, Slot);
            }
            chr.Items.Remove((byte)InventoryType.ItemType.Spend3, (byte)Slot, 1);
            UpdateInventory(c, (byte)InventoryType.ItemType.Spend3);
        }
예제 #2
0
        public static void UseSpend_Req(InPacket lea, Client gc)
        {
            var  chr  = gc.Character;
            byte Type = lea.ReadByte();
            byte Slot = lea.ReadByte();
            Item Item = chr.Items.getItem(Type, Slot);
            Map  map  = MapFactory.GetMap(chr.MapX, chr.MapY);
            var  use  = ItemFactory.useData[Item.ItemID];

            // 使用回復HP 跟 MP 的物品
            switch (Item.ItemID)
            {
            case 8841006:     // 全部還原本
                int Recover = 0;
                Recover           = Recover + (chr.Str - 3);
                Recover           = Recover + (chr.Dex - 3);
                Recover           = Recover + (chr.Vit - 3);
                Recover           = Recover + (chr.Int - 3);
                chr.Str           = 3;
                chr.Dex           = 3;
                chr.Vit           = 3;
                chr.Int           = 3;
                chr.AbilityBonus += (short)Recover;
                StatusPacket.getStatusInfo(gc);
                break;

            case 8850011:     // 回城符
                switch (chr.MapX)
                {
                case 1:
                case 2:
                case 3:
                case 4:
                case 5:
                case 6:
                case 22:
                case 23:
                    chr.MapX = 1;
                    chr.MapY = 1;
                    break;

                case 7:
                case 8:
                case 9:
                    chr.MapX = 16;
                    chr.MapY = 1;
                    break;

                case 10:
                case 11:
                case 20:
                    chr.MapX = 10;
                    chr.MapY = 1;
                    break;

                case 12:
                case 13:
                    chr.MapX = 12;
                    chr.MapY = 1;
                    break;

                case 14:
                case 15:
                case 17:
                case 18:
                case 19:
                case 21:
                    chr.MapX = 15;
                    chr.MapY = 1;
                    break;

                case 16:
                    chr.MapX = 16;
                    chr.MapY = 1;
                    break;

                case 24:
                case 25:
                case 26:
                case 31:
                case 32:
                case 33:
                    chr.MapX = 25;
                    chr.MapY = 1;
                    break;

                case 27:
                case 28:
                    chr.MapX = 27;
                    chr.MapY = 1;
                    break;

                default:
                    chr.MapX = 1;
                    chr.MapY = 1;
                    break;
                }
                chr.PlayerX = 0;
                chr.PlayerY = 0;
                MapPacket.warpToMapAuth(gc, true, chr.MapX, chr.MapY, chr.PlayerX, chr.PlayerY);
                break;

            case 8850021:     // 清陰符
                chr.MapX    = 1;
                chr.MapY    = 2;
                chr.PlayerX = 2955;
                chr.PlayerY = 1116;
                MapPacket.warpToMapAuth(gc, true, chr.MapX, chr.MapY, chr.PlayerX, chr.PlayerY);
                break;

            case 8850031:     // 龍林符(龍林城)
                chr.MapX    = 15;
                chr.MapY    = 2;
                chr.PlayerX = 3600;
                chr.PlayerY = 1041;
                MapPacket.warpToMapAuth(gc, true, chr.MapX, chr.MapY, chr.PlayerX, chr.PlayerY);
                break;

            case 8850041:     // 冥珠符
                chr.MapX    = 10;
                chr.MapY    = 3;
                chr.PlayerX = 1645;
                chr.PlayerY = 899;
                MapPacket.warpToMapAuth(gc, true, chr.MapX, chr.MapY, chr.PlayerX, chr.PlayerY);
                break;

            case 8850051:     // 古樂符
                chr.MapX    = 25;
                chr.MapY    = 1;
                chr.PlayerX = 4237;
                chr.PlayerY = 1230;
                MapPacket.warpToMapAuth(gc, true, chr.MapX, chr.MapY, chr.PlayerX, chr.PlayerY);
                break;

            case 8850061:     // 無名符
                chr.MapX    = 16;
                chr.MapY    = 1;
                chr.PlayerX = 2005;
                chr.PlayerY = 1101;
                MapPacket.warpToMapAuth(gc, true, chr.MapX, chr.MapY, chr.PlayerX, chr.PlayerY);
                break;

            case 8850071:     // 龍林符(龍林客棧)
                chr.MapX    = 12;
                chr.MapY    = 1;
                chr.PlayerX = 1040;
                chr.PlayerY = 782;
                MapPacket.warpToMapAuth(gc, true, chr.MapX, chr.MapY, chr.PlayerX, chr.PlayerY);
                break;

            case 8890011:     // 蠟燭
            case 8890021:     // 火把
                InventoryPacket.UseSpendStart(gc, chr, chr.PlayerX, chr.PlayerY, Item.ItemID, (byte)InventoryType.ItemType.Spend3, Slot);
                break;

            case 8899017:     // 逮巴符
                chr.MapX    = 27;
                chr.MapY    = 1;
                chr.PlayerX = 2070;
                chr.PlayerY = 1330;
                MapPacket.warpToMapAuth(gc, true, chr.MapX, chr.MapY, chr.PlayerX, chr.PlayerY);
                break;

            default:
                switch (use.Type)
                {
                case 0:         // 恢復鬼力
                    if ((chr.MaxMp > chr.Mp + use.Recover))
                    {
                        chr.Mp += (short)use.Recover;
                        StatusPacket.UpdateHpMp(gc, chr.Hp, chr.Mp, chr.Fury, chr.MaxFury);
                    }
                    else if (chr.MaxMp - chr.Mp < use.Recover)
                    {
                        chr.Mp = chr.MaxMp;
                        StatusPacket.UpdateHpMp(gc, chr.Hp, chr.Mp, chr.Fury, chr.MaxFury);
                    }
                    break;

                case 1:         // 恢復鬼力(%)
                    if ((chr.MaxMp > chr.Mp + chr.MaxMp * use.Recover / 100))
                    {
                        chr.Mp += (short)(chr.MaxMp * use.Recover / 100);
                        StatusPacket.UpdateHpMp(gc, chr.Hp, chr.Mp, chr.Fury, chr.MaxFury);
                    }
                    else if (chr.MaxMp - chr.Mp < chr.MaxMp * use.Recover / 100)
                    {
                        chr.Mp = chr.MaxMp;
                        StatusPacket.UpdateHpMp(gc, chr.Hp, chr.Mp, chr.Fury, chr.MaxFury);
                    }
                    break;

                case 2:         // 恢復體力
                    if ((chr.MaxHp > chr.Hp + use.Recover))
                    {
                        chr.Hp += (short)use.Recover;
                        StatusPacket.UpdateHpMp(gc, chr.Hp, chr.Mp, chr.Fury, chr.MaxFury);
                    }
                    else if (chr.MaxHp - chr.Hp < use.Recover)
                    {
                        chr.Hp = chr.MaxHp;
                        StatusPacket.UpdateHpMp(gc, chr.Hp, chr.Mp, chr.Fury, chr.MaxFury);
                    }
                    break;

                case 3:         // 恢復體力(%)
                    if ((chr.MaxHp > chr.Hp + chr.MaxHp * use.Recover / 100))
                    {
                        chr.Hp += (short)(chr.MaxHp * use.Recover / 100);
                        StatusPacket.UpdateHpMp(gc, chr.Hp, chr.Mp, chr.Fury, chr.MaxFury);
                    }
                    else if (chr.MaxHp - chr.Hp < chr.MaxHp * use.Recover / 100)
                    {
                        chr.Hp = chr.MaxHp;
                        StatusPacket.UpdateHpMp(gc, chr.Hp, chr.Mp, chr.Fury, chr.MaxFury);
                    }
                    break;

                default:
                    break;
                }
                break;
            }
            chr.Items.Remove(Type, Slot, 1);
            UpdateInventory(gc, Type);
        }