Exemple #1
0
        public void RegisterMission(Session p, PacketRead r)
        {
            int missionID = r.Int();

            r.Jump(4);
            int missionUID = r.Int();
            int progress   = 0;

            PacketWrite pw = new PacketWrite();

            pw.Int(0);
            pw.Int(missionID);
            pw.Int(1);
            pw.Int(missionUID);
            pw.Int(missionID);
            pw.Int(0);//Progress
            pw.HexArray("59 21 9E A1 59 20 4D 21 00 00 00 00");

            p.SendPacket(pw, 174);
            DataSet Query0 = new DataSet();

            GameServer.Sql.Exec(Query0, "INSERT INTO Missions (  LoginUID,  MissionID,  MissionUID,  Progress) VALUES  (    '{0}',    '{1}',    '{2}',    '{3}'  )", p.PInfo.m_dwUserUID, missionID, missionUID, progress);

            DataSet Query = new DataSet();

            GameServer.Sql.Exec(Query, "DELETE FROM  GoodsObjectlist WHERE OwnerLogin = '******'   AND ItemID = '{1}'", p.PInfo.m_strLogin, missionID);
            p.PInventory.InventoryItens(p);
        }
Exemple #2
0
        public void BundleSellItens(Session p, PacketRead r)
        {
            PacketWrite pw = new PacketWrite();

            r.Int();
            int m_dwDeleteCount = r.Int();

            pw.Int(m_dwDeleteCount);
            for (int i = 0; i < m_dwDeleteCount; i += 1)
            {
                int unk = r.Int();
                pw.Int(unk);
                uint m_dwUID = r.UInt();
                pw.UInt(m_dwUID);
                p.PInfo.m_iGamePoint += SelectPrice(m_dwUID);
                RemoveItem(p.PInfo.m_strLogin, m_dwUID);
            }
            int unk2 = r.Int();

            pw.Int(unk2);

            PacketWrite ks = new PacketWrite();

            ks.Int(0);//dwOK
            ks.Int(p.PInfo.m_iGamePoint);
            ks.Long(0);
            ks.ArrayBytes(pw.Get_Packet());
            p.SendPacket(ks, 867);
        }
Exemple #3
0
        public void packageInfoDetail(Session p, PacketRead r)
        {
            PacketWrite ks  = new PacketWrite();
            int         id1 = r.Int();
            int         id2 = r.Int();

            ks.Int(id1);
            ks.Int(id2);
            ks.Int(0);
            p.SendPacket(ks, 1600);
        }
Exemple #4
0
        public void GachaRewardList(Session p, PacketRead r)
        {
            int unkvalue = r.Int();
            int account  = r.Int();
            //Log.Write("GachaRewardList, value:{0}", unkvalue);
            //Log.Write("GachaRewardList, value:{0}", account);
            PacketWrite pw = new PacketWrite();

            pw.Int(unkvalue);
            pw.Int(account);
            pw.HexArray("01 00 00 00 02 00 00 00 00 00 00 00 06 00 0B F3 C4 00 0B F3 CE 00 0B F3 D8 00 0B F3 E2 00 0B F3 EC 00 0B F3 F6 00 00 00 01 00 00 00 05 00 0B F8 10 00 0B F8 1A 00 0B F8 24 00 0B F8 2E 00 0B F8 E2 00 00 00 06 00 00 00 1E 00 00 00 02 00 00 00 28 00 00 00 02 00 00 00 32 00 00 00 03 00 00 00 3C 00 00 00 03 00 00 00 46 00 00 00 04 00 00 00 50 00 00 00 05 00 00 00 00");
            p.SendPacket(pw, 454);
        }
Exemple #5
0
        public void GachaSetReward(Session p, PacketRead r)
        {
            int unkvalue = r.Int();
            int account  = r.Int();
            //Log.Write("GachaSetReward, value:{0}", unkvalue);
            //Log.Write("GachaSetReward, value:{0}", account);
            PacketWrite pw = new PacketWrite();

            pw.Int(unkvalue);
            pw.Int(account);
            pw.HexArray("00 00 00 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 01 00 0B F5 F4 00 00 00 01 00 00 00 01 00 0C 22 CC");
            p.SendPacket(pw, 456);
        }
Exemple #6
0
        public void RemoveMission(Session p, PacketRead r)
        {
            int         missionUID = r.Int();
            int         missionID  = r.Int();
            PacketWrite pw         = new PacketWrite();

            pw.Int(0);
            pw.Int(missionID);

            p.SendPacket(pw, 178);
            DataSet Query = new DataSet();

            GameServer.Sql.Exec(Query, "DELETE FROM  missions WHERE LoginUID = '{0}'   AND MissionID = '{1}'", p.PInfo.m_dwUserUID, missionID);
        }
        public static void KUserInfo(Session right, PacketRead rs)
        {
            string m_strLogin    = rs.String();
            int    m_dwID        = rs.Int();
            string m_strNickName = rs.String();

            rs.Int();
            byte m_cStatus = rs.Byte();

            rs.Jump(22);
            int m_iGamePoint = rs.Int();

            rs.Short();

            right.PInfo.m_ucCharType = m_cStatus;
        }
Exemple #8
0
        private void SESSION_RECEIVE(byte[] _buffer, int _size)
        {
            int        pos       = 0;
            PacketRead RB_BUFFER = new PacketRead(_buffer, 0);
            ushort     size      = RB_BUFFER.UShort();

            while (pos < _size)
            {
                if (C_Running == false)
                {
                    return;
                }
                if (pos >= _size)
                {
                    return;
                }
                try
                {
                    byte[] n_buffer = new byte[size];
                    Array.Copy(_buffer, pos, n_buffer, 0, size);

                    PacketRead r0 = new PacketRead(n_buffer, 0);

                    pos += (ushort)((_buffer[pos + 1] << 8) | (_buffer[pos]));
                    ushort new_size = r0.UShort();
                    r0.Short();
                    r0.Int();

                    byte[] iv          = r0.Buffer_Array_Bytes(8);
                    byte[] content     = r0.Buffer_Array_Bytes(new_size - 16 - 10);
                    byte[] get_payload = Cryptography.DECRYPT(content, iv);

                    PacketRead rb       = new PacketRead(get_payload, 0, true);
                    ushort     packetId = (ushort)((get_payload[0] << 8) | (get_payload[1]));

                    if (HRecv.HANDLER.ContainsKey(packetId))
                    {
                        Log.Write("clog : KTRUser::KSkTRUser::OnRecvCompleted({6}), {0}-{1}-{2}. {3}:{4}:{5}", DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Second, DateTime.Now.Minute, DateTime.Now.Hour, packetId);

                        Type type = Type.GetType(HRecv.TYPE_HANDLER[packetId].ToString());

                        object classInstance = Activator.CreateInstance(type, null);

                        HRecv.HANDLER[packetId].Invoke(classInstance, new object[] { this, rb });
                    }
                    else
                    {
                        Log.Write("clog : KTRUser::KSkTRUser::OnRecvFailed,Packet unknown {6}! {0}-{1}-{2}. {3}:{4}:{5}", DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Second, DateTime.Now.Minute, DateTime.Now.Hour, packetId);
                        Log.Write("\nclog : KTRUser::KSkTRUser::OnRecvFailed, Payload: \n{0}", BitConverter.ToString(get_payload).Replace("-", " "));
                        PacketWrite p = new PacketWrite();
                        p.Int(0);
                        SendPacket(p, (short)(packetId + 1));
                    }
                }
                catch (Exception ex)
                {
                    Log.Write("{0} \n {1}", ex.Message, ex.StackTrace);
                }
            }
        }
Exemple #9
0
        public void CheckItem(Session p, PacketRead r)
        {
            int         ItemID = r.Int();
            PacketWrite pw     = new PacketWrite();

            pw.Int(1);
            pw.Int(ItemID);
            p.SendPacket(pw, 677);
        }
Exemple #10
0
        public void EnterChannel(Session s, PacketRead r)
        {
            s.PInfo.m_dwChannelUID = r.Int();
            PacketWrite p = new PacketWrite();

            p.HexArray("00 00 00 00 03");
            p.Int(Serializables.m_timeStamp());
            p.Int(Serializables.m_timeStamp());
            s.SendPacket(p, 45);
            GameServer.UsersList.Add(s);
            s.PInfo.m_cStatus = "LOBBY";
        }
Exemple #11
0
        public static void KRoomInfo(Session right, PacketRead rs)
        {
            libcomservice.REQUEST.Room room = new libcomservice.REQUEST.Room();

            ushort m_usRoomID = rs.UShort();

            room.m_strRoomName   = rs.UnicodeString();
            room.m_bPublic       = rs.Bool();
            room.m_bGuild        = rs.Bool();
            room.m_strRoomPasswd = rs.UnicodeString();
            short m_usUsers = rs.Short();

            room.m_usMaxUsers     = rs.Get_Short();
            room.m_bPlaying       = rs.Bool();
            room.m_cGrade         = rs.Byte();
            room.m_cGameCategory  = rs.Byte();
            room.m_iGameMode      = rs.Int();
            room.m_iSubGameMode   = rs.Int();
            room.m_bRandomableMap = rs.Bool();
            room.m_iMapID         = rs.Int();
            room.m_iP2PVersion    = rs.Int();
            byte[] m_abSlotOpen = rs.Buffer_Array_Bytes(6);
            room.m_vecMonsterSlot = rs.Int();
            room.m_cDifficulty    = rs.Int();
            rs.Jump(17);

            ushort index_room = 0;

            for (ushort i = 1; i < GameServer.m_usMaxUsers; i++)
            {
                if (GameServer.List_Rooms.ContainsKey(i))
                {
                    continue;
                }
                index_room = i;
                break;
            }
            room.m_usRoomID = index_room;

            room.m_dwSlots[0].Active = true;
            room.m_dwSlots[0].usr    = right;
            room.m_dwSlots[0].Leader = true;
            room.m_dwSlots[0].Open   = false;
            room.m_dwSlots[0].Status = 0;
            room.m_dwSlots[0].AFK    = false;
            room.m_dwSlots[0].Team   = 0;

            for (int i = 1; i < room.m_usMaxUsers; i++)
            {
                room.m_dwSlots[i].Active = false;
                room.m_dwSlots[i].usr    = null;
                room.m_dwSlots[i].Leader = false;
                room.m_dwSlots[i].Open   = true;
                room.m_dwSlots[i].Status = 0;
                room.m_dwSlots[i].AFK    = false;
                room.m_dwSlots[i].Team   = 0;
            }
            right.PInfo.CurRoom = room;
        }
Exemple #12
0
        public void Kairos(Session p, PacketRead r)
        {
            r.Jump(4);
            int         itemuid = r.Int();
            PacketWrite pw      = new PacketWrite();

            pw.Int(0);
            pw.Int(0);
            pw.HexArray("00 01 5E 28");
            pw.Int(0);
            pw.Int(itemuid);
            pw.HexArray("00 00 00 00 00 00 00 01 00 00 00 00 00 00 FF FF FF FF 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 00 00 00 00 00 FF FF FF FF 01 58 73 0D 0B CE 52 38 00 00 0B 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 22 B0 00 00 00 00 00 D9 9F 1D 00 00 00 01 00 00 00 01 00 00 FF FF 00 00 FF FF FF FF 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 00 00 00 00 00 FF FF FF FF 01 58 73 0D 0A 96 51 A8 00 00 0B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF FF FF FF FF FF FF FF 00 00 00 00 00 00 FF FF FF FF 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 00 00 00 00 00 0D 85 01 98 FF F9 FD 78 73 E5 F6 9D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF FF FF FF FF FF FF FF 00 00 00 00 00 00 FF FF FF FF 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 00 00 00 00 00 00 40 47 50 0D 85 01 98 0D 85 01 98 00 00 00 00 00 00 00 00 00 00 00 00");
            p.SendPacket(pw, 113);
        }
Exemple #13
0
        public void CompleteMission(Session p, PacketRead r)
        {
            int missionID = r.Int();

            PacketWrite pw = new PacketWrite();

            pw.Int(0);
            pw.Int(missionID);
            pw.HexArray("00 00 01 F8 00 00 00 11 00 00 00 01 00 00 22 B0 00 00 00 01 30 B2 5C A2 00 00 00 09 00 00 00 09 00 00 00 00 00 00 FF FF FF FF 00 00 00 00 57 AD 34 74 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF 00 00 00 00 00 00 00 00 00 00 00 00 0D 00 FF 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 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 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 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 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 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 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4E 00 00 00 07 00 00 00 01 01 01 00 00 00 00 00 00 00 00 00 08 00 00 00 01 01 01 00 00 00 00 00 00 00 00 00 09 00 00 00 01 01 01 00 00 00 00 00 00 00 00 00 0A 00 00 00 01 01 01 00 00 00 00 00 00 00 00 00 0B 00 00 00 01 01 01 00 00 00 00 00 00 00 00 00 0C 00 00 00 01 01 01 00 00 00 00 00 00 00 00 00 0D 00 00 00 01 01 01 00 00 00 00 00 00 00 00 00 0E 00 00 00 01 01 01 00 00 00 00 00 00 00 00 00 0F 00 00 00 01 01 01 00 00 00 00 00 00 00 00 00 10 00 00 00 01 01 01 00 00 00 00 00 00 00 00 00 11 00 00 00 01 01 01 00 00 00 00 00 00 00 00 00 12 00 00 00 01 01 01 00 00 00 00 00 00 00 00 00 13 00 00 00 00 00 00 00 00 00 00 00 00 00 00 14 00 00 00 00 00 00 00 00 00 00 00 00 00 00 15 00 00 00 00 00 00 00 00 00 00 00 00 00 00 16 00 00 00 00 00 00 00 00 00 00 00 00 00 00 17 00 00 00 00 00 00 00 00 00 00 00 00 00 00 18 00 00 00 00 00 00 00 00 00 00 00 00 00 00 19 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 24 00 00 00 00 00 00 00 00 00 00 00 00 00 00 27 00 00 00 01 01 00 00 00 00 00 00 00 00 00 00 28 00 00 00 01 01 00 00 00 00 00 00 00 00 00 00 29 00 00 00 01 01 00 00 00 00 00 00 00 00 00 00 2A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 31 00 00 00 00 00 00 00 00 00 00 00 00 00 00 32 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 00 00 00 00 00 00 00 00 00 00 00 00 00 00 34 00 00 00 00 00 00 00 00 00 00 00 00 00 00 35 00 00 00 00 00 00 00 00 00 00 00 00 00 00 36 00 00 00 00 00 00 00 00 00 00 00 00 00 00 37 00 00 00 00 00 00 00 00 00 00 00 00 00 00 38 00 00 00 00 00 00 00 00 00 00 00 00 00 00 39 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 43 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 45 00 00 00 00 00 00 00 00 00 00 00 00 00 00 46 00 00 00 00 00 00 00 00 00 00 00 00 00 00 47 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 51 00 00 00 00 00 00 00 00 00 00 00 00 00 00 52 00 00 00 00 00 00 00 00 00 00 00 00 00 00 53 00 00 00 00 00 00 00 00 00 00 00 00 00 00 54 00 00 00 01 01 00 00 00 00 00 00 00 00 00 00 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00 56 00 00 00 00 00 00 00 00 00 00 00 00 00 00 57 00 00 00 00 00 00 00 00 00 00 00 00 00 00 58 00 00 00 00 00 00 00 00 00 00 00 00 00 00 59 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5A 00 00 00 01 01 00 00 00 00 00 00 00 00 00 00 5B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 14 00 00 00 A0");

            p.SendPacket(pw, 177);
            DataSet Query = new DataSet();

            GameServer.Sql.Exec(Query, "DELETE FROM  Missions WHERE LoginUID = '{0}'   AND MissionID = '{1}'", p.PInfo.m_dwUserUID, missionID);
        }
Exemple #14
0
        public void ReceiveExp(Session player, PacketRead r)
        {
            int exp = r.Int();

            if (exp < 203081358 && exp > 0)
            {
                PacketWrite write = new PacketWrite();
                write.Int(player.PInfo.CurRoom.m_usUsers());
                for (int i = 0; i < player.PInfo.CurRoom.m_usMaxUsers; i++)
                {
                    if (player.PInfo.CurRoom.m_dwSlots[i].Active == true)
                    {
                        int characterPosition = player.PCharacters.PositionCharacter(player.PInfo.m_ucCharType, player);
                        if (player.PInfo.CurRoom.m_dwSlots[i].usr.PCharacters.CharInfo[characterPosition].Exp < 2147483647)
                        {
                            libcomservice.Request.Server.EXPReward ExpManager = new libcomservice.Request.Server.EXPReward();
                            ExpManager.getExp(((int)player.PCharacters.CharInfo[characterPosition].Exp) + exp, player, player.PInfo.m_ucCharType, player.PInfo.CurRoom.m_dwSlots[i].usr.PCharacters.CharInfo[characterPosition].Level);

                            write.Int(player.PInfo.CurRoom.m_dwSlots[i].usr.PInfo.m_dwUserUID);
                            write.Byte(0);
                            write.Long(player.PInfo.CurRoom.m_dwSlots[i].usr.PCharacters.CharInfo[characterPosition].Exp * 2);
                            write.Long(player.PInfo.CurRoom.m_dwSlots[i].usr.PCharacters.CharInfo[characterPosition].Exp * 2);
                            if (ExpManager.isLevelUP == true)
                            {
                                write.Int(player.PInfo.CurRoom.m_dwSlots[i].usr.PCharacters.CharInfo[characterPosition].Level - 1);
                            }
                            else
                            {
                                write.Int(player.PInfo.CurRoom.m_dwSlots[i].usr.PCharacters.CharInfo[characterPosition].Level);
                            }

                            write.Int(player.PInfo.CurRoom.m_dwSlots[i].usr.PCharacters.CharInfo[characterPosition].Level);
                            write.HexArray("41 30 00 00 00 00 00 0C 00 00 00 A0");
                            for (int j = 0; j < player.PInfo.CurRoom.m_usMaxUsers; j++)
                            {
                                if (player.PInfo.CurRoom.m_dwSlots[j].Active == true)
                                {
                                    player.PInfo.CurRoom.m_dwSlots[j].usr.SendPacket(write, 921);
                                }
                            }
                            player.PInfo.CurRoom.m_dwSlots[i].usr.PCharacters.CharInfo[characterPosition].Exp += exp;
                            ExpManager.updateExp(((int)player.PInfo.CurRoom.m_dwSlots[i].usr.PCharacters.CharInfo[characterPosition].Exp), player.PInfo.CurRoom.m_dwSlots[i].usr.PInfo.m_strLogin, player.PInfo.CurRoom.m_dwSlots[i].usr.PCharacters.CharInfo[characterPosition].CharType);
                        }
                    }
                }
            }
        }
Exemple #15
0
 public void BuyVC(Session p, PacketRead r)
 {
     try
     {
         r.Jump(13);
         uint itemid = r.UInt();
         r.Jump(8);
         int  quantity   = r.Int();
         uint itemuid    = 0;
         int  valuePrice = SelectPrice(itemid);
         if (CheckItemExists(itemid, p) && quantity != -1)
         {
             sItem currentItem = ItemExists(itemid, p);
             itemuid   = currentItem.ItemUID;
             quantity += currentItem.Quantity;
             p.PInventory.UpdateItem(p.PInfo.m_strLogin, itemid, quantity, itemuid);
             p.PInventory.InventoryList.Remove(currentItem);
         }
         else
         {
             itemuid = GetUID();
             p.PInventory.AddItem(p.PInfo.m_strLogin, itemid, quantity, itemuid);
         }
         PacketWrite pw = new PacketWrite();
         pw.Int(BuyException(valuePrice, p));
         pw.Int(1);
         pw.UInt(itemid);
         pw.Int(1);
         pw.UInt(itemuid);
         pw.Int(quantity);
         pw.Int(quantity);
         pw.Short(0);//Epic
         pw.HexArray("00 00 00 00 FF FF FF FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00");
         pw.Byte(LoadItemType(itemid));
         pw.HexArray("00 00 00 00 00 00 00 00 00 00 00 00 00 04 FC F7 70 04 FC FF 78 00 00 0D 00 00 00 00 00 00 00 00 00 FF FF FF 9D");
         pw.Int(p.PInfo.m_iVirtualPoint);
         pw.HexArray("00 00 00 00 00 00 01 5E 1C 00 40 47 00 00 00 00");
         p.SendPacket(pw, 396);
     }
     catch
     {
         PacketWrite pw = new PacketWrite();
         pw.Int(1);
         pw.Int(0);
         p.SendPacket(pw, 396);
     }
 }
Exemple #16
0
 public void BuyGP(Session p, PacketRead r)
 {
     try
     {
         uint itemid     = r.UInt();
         int  quantity   = r.Int();
         uint itemuid    = 0;
         int  valuePrice = SelectPrice(itemid);
         if (CheckItemExists(itemid, p) && quantity != -1)
         {
             sItem currentItem = ItemExists(itemid, p);
             itemuid   = currentItem.ItemUID;
             quantity += currentItem.Quantity;
             p.PInventory.UpdateItem(p.PInfo.m_strLogin, itemid, quantity, itemuid);
             p.PInventory.InventoryList.Remove(currentItem);
         }
         else
         {
             itemuid = GetUID();
             p.PInventory.AddItem(p.PInfo.m_strLogin, itemid, quantity, itemuid);
         }
         PacketWrite pw = new PacketWrite();
         pw.Int(BuyExceptionGP(valuePrice, p));
         pw.Int(p.PInfo.m_iGamePoint);
         pw.Int(1);
         pw.UInt(itemid);
         pw.Int(1);
         pw.UInt(itemuid);
         pw.Int(quantity);
         pw.Int(quantity);
         pw.Short(0);
         pw.HexArray("00 00 00 00 FF FF FF FF 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 00 00 00 00 00 0C 0C 53 6C A5 B9 73 A2 00 40 37 CC 00 00 0B 00 00 00 00 00 00 00 00 00");
         p.SendPacket(pw, 85);
     }
     catch (Exception ex)
     {
         Log.Write("\n{0}\n{1}\n", ex.Message, ex.StackTrace);
         PacketWrite pw = new PacketWrite();
         pw.Int(1);
         pw.Int(0);
         p.SendPacket(pw, 85);
     }
 }
Exemple #17
0
        public void Login(Session p, PacketRead r)
        {
            //33 = +1
            //1249 - normal
            try
            {
                byte[] Crc32  = new byte[] { 0x43, 0x7D, 0x7A, 0x7A };
                int    m_dwOK = 0;
                p.PInfo.m_strLogin  = r.String();
                p.PInfo.m_strPasswd = r.String();
                p.PInfo.m_bMale     = r.Bool();
                p.PInfo.m_iVersion  = r.Int();
                r.Int();
                byte[] checksum = r.Buffer_Array_Bytes(4);
                //Log.WriteHex("Checksum:",checksum);

                PacketWrite pw = new PacketWrite();

                Log.Write("clog : KTRUser::KSkTRUser::CheckLogin::User {0} and Passwd {1}", p.PInfo.m_strLogin, p.PInfo.m_strPasswd);
                int Login_Acess = Querys.Execute_VerifyAccount(p, p.PInfo.m_strLogin, p.PInfo.m_strPasswd);
                if (Login_Acess == 0)
                {
                    p.Req.ExpTable(p);
                    p.Req.ServerTime(p);
                    p.Req.NewCharChoice(p);
                    p.PCharacters.LoadCharacters(p.PInfo.m_strLogin, p.PInfo.m_dwUserUID);
                    p.PStages.LoadStages(p);
                    p.PInventory.InventoryItens(p);
                    p.PLetter.LoadLetter(p.PInfo.m_dwUserUID);
                    Log.Write("clog : KTRUser::KSkTRUser::OnClientLoginOK(), {0}-{1}-{2}.", DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
                }
                else if (Login_Acess == 14)
                {
                    m_dwOK = 7;
                }
                if (checksum != Crc32)
                {
                    m_dwOK = 10;
                }
                pw.UnicodeStr(p.PInfo.m_strLogin);
                pw.UnicodeStr(p.PInfo.m_strNickName);
                pw.Int(0);
                pw.Str(p.PInfo.m_strPasswd);
                pw.HexArray("00 2E 00 37 00 32 00 31 00 00 C8 72 D1 BF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF 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 00 00 00 00 00 00 00 00 00");
                pw.Byte(0);     //m_cAuthLevel
                pw.Int(100);    //m_iAge
                pw.Bool(false); //m_bAgreePrivateInfo
                pw.Byte(0);     //m_cPCBangType
                Serializables.m_mapCharacterInfo(p, pw);
                pw.UShort(GameServer.m_usUdpPort);
                pw.Int(p.PInfo.m_dwUserUID);
                pw.UnicodeStr(GameServer.m_strServerName);
                pw.Int(GameServer.m_iSessionInfo);
                pw.HexArray("00 00 00 00");
                Serializables.SerializeStages(p, pw);
                pw.UInt(3222798336);//C0 18 00 00 //m_nConnectType
                Serializables.m_vecMissionSlot(p, pw);
                pw.Int(0);
                pw.HexArray("29 E1 85 22 02 00 74 85 00 00 00 01 00 00 00 00 00 00 00 00");
                pw.UnicodeStr("MsgServer_02");
                pw.Str(GameServer.m_dwIP);
                pw.UShort(GameServer.m_usMsgPort);
                pw.HexArray("00 00 02 9D 00 00 00 00 00 00 00 00 FF FF FF FF FF FF FF FF");
                pw.Str(GameServer.m_dwIP);
                pw.HexArray("00 00 00 00 00 00 00 00 03 5A 35 55 C0 5A 35 55 C0 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 01 00 00 00 01 61 D0 5E 60 00 D0 FF F9 3D AC 0C F9 74 00 5A 35 55 00 00 00 00 00 73 E6 5F 5A 33 2C A0 00 00 00 00");
                //Chars
                pw.HexArray("00 00 00 15 00 00 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 00 00 00 00 00 00 00 00 00 00 02 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 03 00 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00 04 00 00 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 05 00 00 00 05 00 00 00 00 00 00 00 00 00 00 00 00 00 06 00 00 00 06 00 00 00 00 00 00 00 00 00 00 00 00 00 07 00 00 00 07 00 00 00 00 00 00 00 00 00 00 00 00 00 08 00 00 00 08 00 00 00 00 00 00 00 00 00 00 00 00 00 09 00 00 00 09 00 00 00 00 00 00 00 00 00 00 00 00 00 0A 00 00 00 0A 00 00 00 00 00 00 00 00 00 00 00 00 00 0B 00 00 00 0B 00 00 00 00 00 00 00 00 00 00 00 00 00 0C 00 00 00 0C 00 00 00 00 00 00 00 00 00 00 00 00 00 0D 00 00 00 0D 00 00 00 00 00 00 00 00 00 00 00 00 00 0E 00 00 00 0E 00 00 00 00 00 00 00 00 00 00 00 00 00 0F 00 00 00 0F 00 00 00 00 00 00 00 00 00 00 00 00 00 10 00 00 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 11 00 00 00 11 00 00 00 00 00 00 00 00 00 00 00 00 00 12 00 00 00 12 00 00 00 00 00 00 00 00 00 00 00 00 00 13 00 00 00 13 00 00 00 00 00 00 00 00 00 00 00 00 00 14 00 00 00 14 00 00 00 00 00 00 00 00 00 00");
                pw.HexArray("00 00 00 03 00 00 00 C6 00 0C 22 CC 00 00 00 00 00 00 00 C7 00 0C F1 FC 00 00 00 00 00 00 00 C9 00 15 6D 0A 00 00 00 01");
                pw.Int(p.PInfo.m_dwSlots);
                pw.Byte(255);
                pw.Byte(0);
                pw.Byte(0);
                p.SendPacket(pw, 34);
                p.Shop.SendMyVirtualCash(p);
                p.HeroDugeons.HeroDungeonInfo(p);
                UdpPort(p);
                sends(p);
            }
            catch (Exception Ex)
            {
                Log.Write("{0} \n\n {1}", Ex.Message, Ex.StackTrace);
            }
        }
Exemple #18
0
        public static void KEquipItemInfo(Session right, PacketRead rs, int m_vecCharInfo)
        {
            for (int i = 0; i < m_vecCharInfo; i += 1)
            {
                byte m_cCharIndex     = rs.Byte();
                int  m_vecEquipInfo   = rs.Int();
                int  m_dwCharPosition = right.PCharacters.PositionCharacter(m_cCharIndex, right);
                for (int x = 0; x < m_vecEquipInfo; x += 1)
                {
                    int    m_dwID      = rs.Int();
                    int    m_dwUnk     = rs.Int();
                    int    m_dwUID     = rs.Int();
                    byte   m_cUpgrade  = rs.Byte();
                    byte   m_cGrade    = rs.Byte();
                    int    m_dwLevel   = rs.Int();
                    byte[] test        = rs.Buffer_Array_Bytes(9);
                    int    m_dwAtrribs = rs.Int();
                    for (int x2 = 0; x2 < m_dwAtrribs; x2++)
                    {
                        rs.Jump(7);
                    }
                    right.PCharacters.AddEquipment(m_dwID, m_dwUID, m_dwCharPosition, right);
                    //Log.Write("Character:{0} Equips: {1} Current Item:{2} Atribbs:{3}", m_cCharIndex, m_vecEquipInfo, m_dwID, m_dwAtrribs);
                }
                int m_vecDelInfo = rs.Int();
                for (int x = 0; x < m_vecDelInfo; x += 1)
                {
                    int    m_dwID      = rs.Int();
                    int    m_dwUnk     = rs.Int();
                    int    m_dwUID     = rs.Int();
                    byte   m_cUpgrade  = rs.Byte();
                    byte   m_cGrade    = rs.Byte();
                    int    m_dwLevel   = rs.Int();
                    byte[] test        = rs.Buffer_Array_Bytes(9);
                    int    m_dwAtrribs = rs.Int();
                    for (int x2 = 0; x2 < m_dwAtrribs; x2++)
                    {
                        rs.Jump(7);
                    }
                    right.PCharacters.RemoveEquipment(m_dwID, m_dwCharPosition, right);
                }
                int    m_dwPetIsNew = rs.Int();
                int    m_dwPetUID   = rs.Int();
                int    m_dwPetID    = rs.Int();
                string m_strPetName = rs.String();
                int    m_mapInitExp = rs.Int();
                for (int x = 0; x < m_mapInitExp; x++)
                {
                    rs.Byte();
                    rs.Int();
                }
                uint m_dwExp          = rs.UInt();
                int  m_iLevel         = rs.Int();
                byte m_cPromotion     = rs.Byte();
                int  m_nHatchingID    = rs.Int();
                int  m_iInitSatiation = rs.Int();
                int  m_iSatiation     = rs.Int();
                uint m_vecEquipItem   = rs.UInt();
                right.PCharacters.CharInfo[m_dwCharPosition].Pets[0].Slot1.Clear();
                for (uint x = 0; x < m_vecEquipItem; x++)
                {
                    uint m_dwPetAtkId = rs.UInt();
                    rs.Jump(4);
                    uint m_dwPetAtkUID = rs.UInt();
                    rs.Byte();
                    right.PCharacters.AddAtkPetSlot1((int)m_dwPetAtkId, m_dwPetAtkUID, m_dwCharPosition, right);
                }
                uint m_vecEquipItem2 = rs.UInt();
                right.PCharacters.CharInfo[m_dwCharPosition].Pets[0].Slot2.Clear();
                for (uint x = 0; x < m_vecEquipItem2; x++)
                {
                    uint m_dwPetAtkId = rs.UInt();
                    rs.Jump(4);
                    uint m_dwPetAtkUID = rs.UInt();
                    rs.Byte();
                    right.PCharacters.AddAtkPetSlot2((int)m_dwPetAtkId, m_dwPetAtkUID, m_dwCharPosition, right);
                }
                byte[] restantPet = rs.Buffer_Array_Bytes(14);
                right.PCharacters.CharInfo[m_dwCharPosition].Pets[0].m_dwUID          = m_dwPetUID;
                right.PCharacters.CharInfo[m_dwCharPosition].Pets[0].m_dwID           = m_dwPetID;
                right.PCharacters.CharInfo[m_dwCharPosition].Pets[0].m_strName        = m_strPetName;
                right.PCharacters.CharInfo[m_dwCharPosition].Pets[0].m_cPromotion     = m_cPromotion;
                right.PCharacters.CharInfo[m_dwCharPosition].Pets[0].m_dwEXP          = m_dwExp;
                right.PCharacters.CharInfo[m_dwCharPosition].Pets[0].m_iInitSatiation = m_iInitSatiation;
                right.PCharacters.CharInfo[m_dwCharPosition].Pets[0].m_iLevel         = m_iLevel;
                right.PCharacters.CharInfo[m_dwCharPosition].Pets[0].m_iSatiation     = m_iSatiation;
                right.PCharacters.CharInfo[m_dwCharPosition].Pets[0].m_mapInitExp     = m_mapInitExp;
                right.PCharacters.CharInfo[m_dwCharPosition].Pets[0].m_nHatchingID    = m_nHatchingID;
                //Log.Write("Character:{0} PetID: {1} PetName:{2} Equips:{3}", m_cCharIndex, m_dwPetID, m_strPetName, m_vecEquipItem);

                rs.Jump(41);
            }
        }