Example #1
0
        public void RoomMyInfoDivide(Session p, PacketRead r)
        {
            r.Jump(6);
            ushort roomid    = (ushort)r.Get_Short();
            Room   room      = RoomExists(roomid);
            int    TempCount = -1;

            for (int i = 0; i < room.m_usMaxUsers; i++)
            {
                if (room.m_dwSlots[i].Active == false)
                {
                    continue;
                }
                TempCount++;
                if (room.m_dwSlots[i].usr == p)
                {
                    PacketWrite pw = new PacketWrite();
                    pw.Int(0);
                    pw.Int(room.m_usUsers());
                    pw.Int(TempCount);
                    pw.UnicodeStr(room.m_dwSlots[i].usr.PInfo.m_strLogin);
                    pw.Int(room.m_dwSlots[i].usr.PInfo.m_dwUserUID);
                    pw.UnicodeStr(room.m_dwSlots[i].usr.PInfo.m_strNickName);
                    pw.Int(i);
                    pw.Byte(room.m_dwSlots[i].usr.PInfo.m_ucCharType);
                    pw.Int(0);
                    pw.HexArray("00 FF 00 FF 00 FF 00 00 00 00");
                    pw.Byte((byte)room.GetTeam(room.m_dwSlots[i].usr));
                    pw.HexArray("00 00 00 00 64 00 00");
                    pw.Int(room.m_dwSlots[i].usr.PInfo.m_iGamePoint);
                    pw.Short(0);
                    Serializables.SerializeStages(room.m_dwSlots[i].usr, pw);
                    if (room.m_sSearchLeader() == room.m_dwSlots[i].usr)
                    {
                        pw.Bool(true);
                    }
                    else
                    {
                        pw.Bool(false);
                    }
                    pw.HexArray("01 00 00 00 00 00 00 00 00 00 00 00 00");
                    Serializables.m_roomCharacterInfo(room.m_dwSlots[i].usr, pw);
                    pw.HexArray("00 00 00 02 76 19 A8 C0 10 0C D6 BA 00 00 00 01 7F 39 00 00 00 00 00 00 00 00 00 00 00");
                    pw.Byte(room.m_dwSlots[i].Status);
                    pw.HexArray("00 00 00 00 00 12 C8 F2 00 00 00 00 00 D6 D9 BE 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 42 00 52 00 0B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 00 00 00 00 D2 F0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 D2 F0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 01 00 00 00 00 00 06 11 16 00 00 00 00 00 00 00 00 46 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 97 D8 00 00 01 A0 04 7B 00 00 00 00 00 00 00 00");

                    p.SendPacket(pw, 1472);
                    break;
                }
            }
        }
Example #2
0
        public void CreateRoom(Session p, PacketRead r)
        {
            //===================
            // 0; OK..
            // 1; 현재 채널에 더이상의 방을 만들 수 없음.
            // 2; 존재하지 않는 캐릭터가 선택되었습니다.
            // 3; 입장할수 있는 올바른 레벨이 아닙니다.
            try
            {
                int m_dwOK = 0;
                Serializables.KRoomInfo(p, r);
                byte[] restant = r.Buffer_Array_Bytes(78);
                Serializables.KUserInfo(p, r);

                PacketWrite pw = new PacketWrite();
                pw.Int(m_dwOK);
                Serializables.KUserInfo(p, pw);
                Serializables.SerializeStages(p, pw);
                pw.HexArray("01 01 00 00 00 00 00 00 00 00 00 00 00 00");
                Serializables.m_roomCharacterInfo(p, pw);
                pw.HexArray("00 00 00 02 6B 00 A8 C0 E4 02 2D B1 00 00 00 01 7F 1A 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 E5 6A 00 00 00 00 00 D9 92 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 5A 00 5A 00 0B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 00 00 00 00 D2 F0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 D2 F0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 01 00 00 00 00 85 89 82 21 00 00 00 00 00 00 00 00 01 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00");
                Serializables.KRoomInfo(p, pw);
                pw.ArrayBytes(restant);

                p.SendPacket(pw, 57);
                GameServer.List_Rooms.Add(p.PInfo.CurRoom.m_usRoomID, p.PInfo.CurRoom);
                GameServer.UsersList.Remove(p);
                p.PInfo.m_cStatus = "ROOM";
            }
            catch (Exception ex)
            {
                Log.Write("\n===========:Error:===========\n{0}\n{1}\n=============================n", ex.Message, ex.StackTrace);
                PacketWrite pw = new PacketWrite();
                pw.Int(1);
                pw.UnicodeStr(p.PInfo.m_strLogin);
                pw.Int(p.PInfo.m_dwUserUID);
                pw.UnicodeStr(p.PInfo.m_strNickName);
                p.SendPacket(pw, 57);
            }
        }
Example #3
0
        public void EnterRoom(Session p, PacketRead r)
        {
            try
            {
                r.Jump(4);
                ushort roomID   = (ushort)r.Get_Short();
                string Password = r.UnicodeString();
                r.Jump(5);
                string userLogin = r.UnicodeString();
                r.Jump(4);
                string userNick = r.UnicodeString();
                r.Jump(4);
                p.PInfo.m_ucCharType = r.Byte();

                Room room = RoomExists(roomID);

                if (room == null)
                {
                    PacketWrite pw2 = new PacketWrite();
                    pw2.Int(1);
                    p.SendPacket(pw2, 54);
                    return;
                }
                else if (room.m_abTotalSlotsOpen() == 0)
                {
                    PacketWrite pw2 = new PacketWrite();
                    pw2.Int(1);
                    p.SendPacket(pw2, 54);
                    return;
                }
                else if (room.m_bPlaying == true)
                {
                    PacketWrite pw2 = new PacketWrite();
                    pw2.Int(1);
                    p.SendPacket(pw2, 54);
                    return;
                }
                else if (room.m_strRoomPasswd != Password)
                {
                    PacketWrite pw2 = new PacketWrite();
                    pw2.Int(1);
                    p.SendPacket(pw2, 54);
                    return;
                }
                int pos = 0;
                if (room.m_cGameCategory == 2)
                {
                    pos = room.m_abSlotOpen();
                }
                else
                {
                    byte Team1 = 0, Team2 = 0;
                    int  EmptyPos1 = -1, EmptyPos2 = -1;
                    for (int i = 0; i < 3; i++)
                    {
                        if (room.m_dwSlots[i].Active == true)
                        {
                            Team1++;
                        }
                        if (EmptyPos1 == -1 && room.m_dwSlots[i].Open == true)
                        {
                            EmptyPos1 = i;
                        }
                    }
                    for (int i = 3; i < 6; i++)
                    {
                        if (room.m_dwSlots[i].Active == true)
                        {
                            Team2++;
                        }
                        if (EmptyPos2 == -1 && room.m_dwSlots[i].Open == true)
                        {
                            EmptyPos2 = i;
                        }
                    }

                    pos = EmptyPos1;
                    if (Team1 >= Team2)
                    {
                        pos = EmptyPos2;
                    }
                }
                room.m_dwSlots[pos].Active       = true;
                room.m_dwSlots[pos].usr          = p;
                room.m_dwSlots[pos].Open         = false;
                room.m_dwSlots[pos].AFK          = false;
                room.m_dwSlots[pos].Deaths       = 0;
                room.m_dwSlots[pos].Kills        = 0;
                room.m_dwSlots[pos].Win          = 0;
                room.m_dwSlots[pos].PositionSlot = pos;
                room.m_dwSlots[pos].Leader       = false;

                p.PInfo.CurRoom   = room;
                p.PInfo.m_cStatus = "ROOM";
                GameServer.UsersList.Remove(p);

                PacketWrite pw = new PacketWrite();
                pw.UnicodeStr(p.PInfo.m_strLogin);
                pw.Int(p.PInfo.m_dwUserUID);
                pw.UnicodeStr(p.PInfo.m_strNickName);
                pw.Int(pos);
                pw.Byte(p.PInfo.m_ucCharType);
                pw.Int(0);
                pw.HexArray("00 FF 00 FF 00 FF 00 00 00 00");
                pw.Byte((byte)(pos / 3));
                pw.HexArray("01 00 00 00 64 00 00");
                pw.Int(p.PInfo.m_iGamePoint);
                pw.Short(0);
                Serializables.SerializeStages(p, pw);
                if (room.m_sSearchLeader() == p)
                {
                    pw.Bool(true);
                }
                else
                {
                    pw.Bool(false);
                }
                pw.HexArray("01 00 00 00 00 00 00 00 00 00 00 00 00");
                Serializables.m_roomCharacterInfo(p, pw);
                pw.HexArray("00 00 00 02 76 19 A8 C0 10 0C D6 BA 00 00 00 01 7F 39 00 00 00 00 00 00 00 00 00 00 00");
                pw.Byte(room.m_dwSlots[pos].Status);
                pw.HexArray("00 00 00 00 00 12 C8 F2 00 00 00 00 00 D6 D9 BE 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 42 00 52 00 0B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 00 00 00 00 D2 F0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 D2 F0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 01 00 00 00 00 00 06 11 16 00 00 00 00 00 00 00 00 46 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 97 D8 00 00 01 A0 04 7B 00 00 00 00 00 00 00 00");

                room.SendForAllPlayersInRoom(pw, 54);
                RoomInfo(p, room);
                RoomInfoDivide(p, room);
            }
            catch (Exception ex)
            {
                Log.Write("{0}", ex.StackTrace);
                PacketWrite pw = new PacketWrite();
                pw.Int(1);
                p.SendPacket(pw, 54);
                p.PInfo.CurRoom   = null;
                p.PInfo.m_cStatus = "LOBBY";
                GameServer.UsersList.Add(p);
            }
        }