public int HandlePacket(GameClient client, GSPacketIn packet)
 {
     int val = packet.ReadInt();
     GSPacketIn pkg = new GSPacketIn(0xd4);
     pkg.WriteInt(val);
     client.SendTCP(pkg);
     return 0;
 }
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client.Player.CurrentHotSpringRoom != null)
            {
                int iD = client.Player.CurrentHotSpringRoom.Info.RoomID;
                HotSpringRoom room = client.Player.CurrentHotSpringRoom;
                using (PlayerBussiness db = new PlayerBussiness())
                {
                    db.UpdateHotSpringRoomInfo(room.Info);
                }

                GSPacketIn pkg = new GSPacketIn(0xa9);
                pkg.WriteString("Bạn đã thoát khỏi phòng");
                client.SendTCP(pkg);
            }
            return 0;
        }
 public int HandlePacket(GameClient client, GSPacketIn packet)
 {
     int num = packet.ReadInt();
     try
     {
         TankHotSpringLogicProcessor processor = new TankHotSpringLogicProcessor();
         HotSpringRoomInfo info = new HotSpringRoomInfo {
             RoomID = num
         };
         client.Player.CurrentHotSpringRoom = new HotSpringRoom(info, processor);
     }
     catch
     {
         Console.WriteLine("System Error!");
     }
     HotSpringRoom room = client.Player.CurrentHotSpringRoom;
     using (PlayerBussiness db = new PlayerBussiness())
     {
         db.UpdateHotSpringRoomInfo(room.Info);
     }
     string str = packet.ReadString();
     GSPacketIn pkg = new GSPacketIn(0xca);
     pkg.WriteInt(num);
     pkg.WriteInt(num);
     pkg.WriteString(room.Info.RoomName);
     pkg.WriteString(room.Info.Pwd);
     pkg.WriteInt(1);
     pkg.WriteInt(1);
     pkg.WriteInt(client.Player.PlayerCharacter.ID);
     pkg.WriteString(client.Player.PlayerCharacter.NickName);
     pkg.WriteDateTime(room.Info.BeginTime);
     pkg.WriteString(room.Info.RoomIntroduction);
     pkg.WriteInt(1);
     pkg.WriteInt(10);
     pkg.WriteDateTime(DateTime.Now);
     pkg.WriteInt(10);
     client.SendTCP(pkg);
     return 0;
 }
 public int HandlePacket(GameClient client, GSPacketIn packet)
 {
     int Lottery = client.Lottery;
     int[] numArray = listRandomitem[Lottery];
     PlayerInventory caddyBag = client.Player.CaddyBag;
     PlayerInventory propBag = client.Player.PropBag;
     SqlDataProvider.Data.ItemInfo itemByTemplateID = propBag.GetItemByTemplateID(0, 11444);
     try
     {
         ThreadSafeRandom random = new ThreadSafeRandom();
         int num2 = random.Next(100) * random.Next(100);
         int index = 0;
         string[] strArray = client.tempData.Split(new char[] { ',' });
         List<int> list = new List<int>();
         if (client.tempData != "start")
         {
             foreach (string str in strArray)
             {
                 if (!string.IsNullOrEmpty(str))
                 {
                     list.Add(int.Parse(str));
                 }
             }
         }
         IOrderedEnumerable<int> enumerable = from s in list
             orderby s
             select s;
         foreach (int num4 in RandomForGetItem)
         {
             if (num2 < (num4 * num4))
             {
                 foreach (int num5 in enumerable)
                 {
                     if (index == num5)
                     {
                         index++;
                     }
                 }
                 break;
             }
             index++;
         }
         if (itemByTemplateID.Count > strArray.Length)
         {
             itemByTemplateID.Count -= strArray.Length;
             propBag.UpdateItem(itemByTemplateID);
         }
         else if (itemByTemplateID.Count == strArray.Length)
         {
             propBag.RemoveItem(itemByTemplateID);
         }
         if (client.tempData == "start")
         {
             client.tempData = index + ",";
         }
         else
         {
             client.tempData = client.tempData + index + ",";
         }
         if (index >= numArray.Length)
         {
             index = 0;
         }
         SqlDataProvider.Data.ItemInfo item = SqlDataProvider.Data.ItemInfo.CreateFromTemplate(ItemMgr.FindItemTemplate(numArray[index]), 1, 105);
         item.BeginDate = DateTime.Now;
         item.ValidDate = 7;
         item.RemoveDate = DateTime.Now.AddDays(7.0);
         caddyBag.AddItem(item);
         GSPacketIn pkg = new GSPacketIn(30, client.Player.PlayerId);
         pkg.WriteInt(numArray[index]);
         pkg.WriteInt(0);
         pkg.WriteInt(0);
         pkg.WriteInt(0);
         pkg.WriteInt(0);
         pkg.WriteInt(0);
         pkg.WriteInt(0);
         pkg.WriteBoolean(false);
         pkg.WriteInt(7);
         pkg.WriteByte(1);
         client.SendTCP(pkg);
     }
     catch
     {
         Console.WriteLine("Error ");
     }
     return 1;
 }