예제 #1
0
        public static void Pet_Name_Req(InPacket lea, Client c)
        {
            string Name = lea.ReadString(20);
            int    Slot = lea.ReadInt();
            var    chr  = c.Character;
            Pet    Pet  = chr.Pets.Pet((byte)InventoryType.ItemType.Equip, (byte)InventoryType.EquipType.Pet);
            Pet    Item = chr.Pets.Pet((byte)InventoryType.ItemType.Pet5, (byte)Slot);

            Pet.Name = Name;
            Pet.Save();
            chr.Pets.Remove((byte)InventoryType.ItemType.Pet5, (byte)Slot);
            //PetPacket.PetName(c, Name);
            MapPacket.warpToMap(c, chr, chr.CharacterID, chr.MapX, chr.MapY, chr.PlayerX, chr.PlayerY);             // 先以此代替
            InventoryHandler.UpdateInventory(c, (byte)InventoryType.ItemType.Pet5);
        }
예제 #2
0
        public static void WarpToMap_Req(InPacket lea, Client gc)
        {
            int   CharacterID = lea.ReadInt();
            short MapX        = lea.ReadShort();
            short MapY        = lea.ReadShort();
            short PositionX   = lea.ReadShort();
            short PositionY   = lea.ReadShort();
            var   chr         = gc.Character;

            chr.MapX    = MapX;
            chr.MapY    = MapY;
            chr.PlayerX = PositionX;
            chr.PlayerY = PositionY;

            if (MapX == 77 && MapY == 1)
            {
                CashShopPacket.CashShopList1(gc); // 人物
                CashShopPacket.CashShopList2(gc); // 裝備
                CashShopPacket.CashShopList3(gc); // 能力
                CashShopPacket.CashShopList4(gc); // 靈物
                CashShopPacket.CashShopList5(gc); // 寶牌
                CashShopPacket.CashShopList6(gc);
                CashShopPacket.CashShopList7(gc); // 紅利積點
                CashShopPacket.CashShopList8(gc);
                CashShopPacket.CashShopList9(gc);
                CashShopPacket.MgameCash(gc);
                CashShopPacket.GuiHonCash(gc);

                // 接收禮物
                List <int> Gifts = new List <int>();

                foreach (dynamic datum in new Datums("Gifts").Populate())
                {
                    if (chr.Name.Equals(datum.name) && datum.receive == 0)
                    {
                        Gifts.Add(datum.itemID);
                        datum.receive = 1;
                        datum.Update("id = '{0}'", datum.id);
                    }
                }
                foreach (int ItemID in Gifts)
                {
                    chr.Items.Add(new Item(ItemID, true, 0, -1, (byte)InventoryType.ItemType.Cash, chr.Items.GetNextFreeSlot(InventoryType.ItemType.Cash)));
                    chr.Items.Save();
                }
                InventoryPacket.getInvenCash(gc);
                MapPacket.warpToMap(gc, chr, CharacterID, MapX, MapY, PositionX, PositionY);
                return;
            }

            Map Map = MapFactory.GetMap(MapX, MapY);

            MapPacket.warpToMap(gc, chr, CharacterID, MapX, MapY, PositionX, PositionY);

            if (Map.GetMapCharactersTotal() > 0)
            {
                foreach (Character All in Map.Characters)
                {
                    MapPacket.warpToMap(All.Client, chr, CharacterID, MapX, MapY, PositionX, PositionY);
                }

                MapPacket.createUser(gc, Map);
            }

            Map.Characters.Add(chr);

            //if ((MapX == 1 && MapY == 53) || (MapX == 1 && MapY == 54) || (MapX == 1 && MapY == 55))
            //    return;

            //if ((MapX == 10 && MapY == 63) || (MapX == 10 && MapY == 64))
            //{
            //    Monster Monster = new Monster(0, 1020001, 200, 10000, 10000, 0, 0, 1, 0xFF, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1408, 659, true);
            //    Map.Monster.Add(Monster);
            //}

            MonsterPacket.createAllMonster(gc, Map, Map.Monster);

            int j = 0;

            for (int i = 0; i < 50; i++)
            {
                if (Map.Monster[i] != null)
                {
                    j++;
                }
            }

            //for (int i = 0; i < j; i++)
            //{
            //    foreach (Character All in map.Characters)
            //    {
            //        if (map.Monster[i].IsAlive == true)
            //            MonsterPacket.spawnMonster(All.Client, map.Monster[i], 0, 0, 0, 0);
            //    }
            //}

            //if (map.GetMapCharactersTotal() < 1)
            //{
            Map.ControlMonster(gc, j);
            //}

            //if (chr.IsFuring == true)
            //{
            //    foreach (Character All in Map.Characters)
            //    {
            //        StatusPacket.Fury(All.Client, chr, chr.FuringType);
            //    }
            //}
        }