public void Register(Session p, PacketRead r) { string userNickname = r.UnicodeString(); DataSet Query = new DataSet(); GameServer.Sql.Exec(Query, "SELECT * FROM NickNames WHERE nick = '{0}'", userNickname); if (Query.Tables[0].Rows.Count == 0) { p.PInfo.m_strNickName = userNickname; PacketWrite pw = new PacketWrite(); pw.Int(0); pw.Str(userNickname); p.SendPacket(pw, 136); DataSet DBAcess = new DataSet(); GameServer.Sql.Exec(DBAcess, "INSERT INTO NickNames(Login,nick) VALUES('{0}','{1}')", p.PInfo.m_strLogin, userNickname); } else { PacketWrite pw = new PacketWrite(); pw.HexArray("FF FF FF FD 00 00 00 00"); p.SendPacket(pw, 136); } }
public void Send_List(Session p) { PacketWrite pw = new PacketWrite(); pw.Int(List.Length); for (int i = 0; i < List.Length; i++) { pw.Int(i + 1); pw.Int(i + 1); pw.UnicodeStr(List[i].ServerName); pw.Str(List[i].ServerIP); pw.UShort(List[i].ServerPort); pw.Int(0); pw.Int(500); pw.Int(327); pw.Int(-1); pw.Int(-1); pw.Str(List[i].ServerIP); pw.Int(0); pw.Int(0); } p.SESSION_SEND(pw.Get_Packet(), 4); }
public void SendList(Session right, PacketRead rs) { PacketWrite ks = new PacketWrite(); ks.Int(List.Length); for (int i = 0; i < List.Length; i++) { ks.Int(i + 1); ks.Int(i + 1); ks.UnicodeStr(List[i].ServerName); ks.Str(List[i].ServerIP); ks.UShort(List[i].ServerPort); ks.Int(0); ks.Int(500); ks.Int(327); ks.Int(-1); ks.Int(-1); ks.Str(List[i].ServerIP); ks.Int(0); ks.Int(0); } right.SendPacket(ks, 156); }
public static void KPetInfo(Session right, PacketWrite ks, int obj) { ks.Int(0);//Pet is New ks.Int(right.PCharacters.CharInfo[obj].Pets[0].m_dwUID); ks.Int(right.PCharacters.CharInfo[obj].Pets[0].m_dwID); ks.Str(right.PCharacters.CharInfo[obj].Pets[0].m_strName); ks.Int(right.PCharacters.CharInfo[obj].Pets[0].m_mapInitExp); for (byte y = 0; y < right.PCharacters.CharInfo[obj].Pets[0].m_mapInitExp; y += 1) { ks.Byte(y); ks.Int(100); } ks.UInt(right.PCharacters.CharInfo[obj].Pets[0].m_dwEXP); ks.Int(right.PCharacters.CharInfo[obj].Pets[0].m_iLevel); ks.Byte(right.PCharacters.CharInfo[obj].Pets[0].m_cPromotion); ks.Int(right.PCharacters.CharInfo[obj].Pets[0].m_nHatchingID); ks.Int(right.PCharacters.CharInfo[obj].Pets[0].m_iInitSatiation); ks.Int(right.PCharacters.CharInfo[obj].Pets[0].m_iSatiation); ks.Int(right.PCharacters.CharInfo[obj].Pets[0].Slot1.Count);//00 00 00 01 for (int y = 0; y < right.PCharacters.CharInfo[obj].Pets[0].Slot1.Count; y += 1) { ks.Int(right.PCharacters.CharInfo[obj].Pets[0].Slot1[y].AtkID); ks.Int(1); ks.UInt(right.PCharacters.CharInfo[obj].Pets[0].Slot1[y].AtkUID); ks.Byte(0); } ks.Int(right.PCharacters.CharInfo[obj].Pets[0].Slot2.Count);//00 00 00 01 for (int y = 0; y < right.PCharacters.CharInfo[obj].Pets[0].Slot2.Count; y += 1) { ks.Int(right.PCharacters.CharInfo[obj].Pets[0].Slot2[y].AtkID); ks.Int(1); ks.UInt(right.PCharacters.CharInfo[obj].Pets[0].Slot2[y].AtkUID); ks.Byte(0); } ks.HexArray("00 00 00 00 00 00 00 00 00 00 00 00 FF"); ks.Byte(right.PCharacters.CharInfo[obj].CharType); }
public void Login(Session p, Read_Buffer r) { try { r.Int(); p.PInfo.Username = r.String(); p.PInfo.Passwd = r.String(); PacketWrite WB = new PacketWrite(); Log.Write("clog : KTRUser::KSkTRUser::CheckLogin::User {0} and Passwd {1}", p.PInfo.Username, p.PInfo.Passwd); int Login_Acess = Querys.Execute_VerifyAccount(p, p.PInfo.Username, p.PInfo.Passwd); if (Login_Acess == 0) { SERVER_LIST Servers = new SERVER_LIST(); Servers.Send_List(p); p.Req.HandlerNewsFromChannel(p, r); p.Req.HandlerClientContents(p, r); p.Req.HandlerSocketTablesInfo(p, r); p.Req.HandlerCashBack(p, r); Log.Write("clog : KTRUser::KSkTRUser::OnClientLoginOK(), {0}-{1}-{2}.", DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day); } WB.Int(Login_Acess); WB.UnicodeStr(p.PInfo.Username); WB.Str(p.PInfo.Passwd); WB.HexArray("00 00 00 00 14 0F 03 F7 4C 00 00 00 00 00 00 00 02 5A 5A 00 00 C9 8E 00 00 C9 8E"); WB.UnicodeStr(MarksURL); WB.HexArray("00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 03 00 00 00 00 00 00 00 00 64 01 00 00 00 00 00 00 00 64 02 00 00 00 00 00 00 00 64 01 BF 80 00 00 FC 04 97 FF 00 00 00 00 00 00 00 00 00 00 00 00 00"); WB.UnicodeStr(p.PInfo.Username); WB.UnicodeStr(p.PInfo.UserNick); WB.HexArray("00 00 00 04 01 00"); WB.Int(p.PInfo.Guild_Contribution); WB.HexArray("00 00 00 00 00 00 00 00"); WB.UnicodeStr(p.PInfo.Guild_Who); WB.HexArray("07 E1 06 12 00 00 00 07 E1 07 09 00 00 00 00 00 00 00 00 00 04"); WB.UnicodeStr(p.PInfo.Guild_Name); WB.HexArray("01 00 00 00 01"); WB.UnicodeStr(p.PInfo.Guild_mark); WB.UnicodeStr(p.PInfo.Guild_desc); WB.HexArray("02 07 E1 05 15 00 00 00 00 02 E0 C2"); WB.UnicodeStr(MarksURL); WB.Int(0); WB.Int(500000); WB.HexArray("00 00 00 C7 00 00 00 00 00 00 00 00 00 00 00 00 03 00 00 03 E8 00 00 00 03"); WB.Int(1); WB.UnicodeStr(p.PInfo.Guild_desc); WB.Int(2); WB.UnicodeStr(p.PInfo.Guild_notice1); WB.Int(3); WB.UnicodeStr(p.PInfo.Guild_notice1); WB.Int(0); WB.UnicodeStr(MarksURL); WB.HexArray("00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 07 00 00 00 00 00 0C 1A C6 8E 02 00 00 00 00 0C 1A C6 8E 08 00 00 00 00 0C 1A C6 8E 09 00 00 00 00 0C 1A C6 8E 10 00 00 00 00 00 00 09 D3 11 00 00 00 00 0C 1A C6 8E 12 00 00 00 00 00 00 02 21 01 BF 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00"); p.SESSION_SEND(WB.Get_Packet(), 3); } catch (Exception Ex) { Log.Write("{0} \n\n {1}", Ex.Message, Ex.StackTrace); } }
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); } }