internal static void LoadCharInfoReq(User user, Packet pkt) { string strChar1 = String.Empty, strChar2 = String.Empty, strChar3 = String.Empty, strChar4 = String.Empty; Packet result = new Packet(WIZ_ALLCHAR_INFO_REQ); result.SetByte(1); if (__VERSION >= 1920) result.SetByte(1); KODatabase db = new KODatabase(); Debug.WriteLine("Char bilgleri istendi {0}", user.strAccountID); var AllCharID = db.ACCOUNT_CHAR.Where(u => u.strAccountID == user.strAccountID).FirstOrDefault(); if (AllCharID != null) { Debug.WriteLine("Char bilgileri alındı."); LoadCharInfo(AllCharID.strCharID1.TrimEnd(' ', '/'), ref result); LoadCharInfo(AllCharID.strCharID2.TrimEnd(' ', '/'), ref result); LoadCharInfo(AllCharID.strCharID3.TrimEnd(' ', '/'), ref result); } else Debug.WriteLine("Char bilgileri alınamadı."); user.Send(result); }
internal static void VersionCheck(User user) { Packet resut = new Packet(15); resut.SetByte(WIZ_VERSION_CHECK); resut.SetByte(0); resut.SetShort(__VERSION); resut.SetInt64(0); user.Send(resut); }
internal static void AccountLogin(User user, Packet pkt) { KODatabase db = new KODatabase(); // Login işlemleri. string AccountID = pkt.GetString(); string strPassword = pkt.GetString(); Packet result = new Packet(WIZ_LOGIN); result.SetByte(DBAgent.GameLogin(AccountID, strPassword,ref result)); Thread thd = new Thread(() => { user.sSid = user.g_pMain.GetNewSocketID(); }); thd.Start(); user.Send(result); user.strAccountID = AccountID; }
internal static void CreateNewChar(User user, Packet pkt) { Packet result = new Packet(WIZ_NEW_CHAR); byte nHair; short sClass; byte bCharIndex, bRace, bFace, str, sta, dex, intel, cha, errorCode = 0; string strUserID; bCharIndex = pkt.GetByte(); strUserID = pkt.GetString(); bRace = pkt.GetByte(); sClass = pkt.GetShort(); bFace = pkt.GetByte(); nHair = pkt.GetByte(); str = pkt.GetByte(); sta = pkt.GetByte(); dex = pkt.GetByte(); intel = pkt.GetByte(); cha = pkt.GetByte(); COEFFICIENT p_TableCoefficient = user.g_pMain.GetCoefficientData(sClass); if (bCharIndex > 2) errorCode = NEWCHAR_NO_MORE; else if (p_TableCoefficient == null || (str + sta + dex + intel + cha) > 300) errorCode = NEWCHAR_INVALID_DETAILS; else if (str < 50 || sta < 50 || dex < 50 || intel < 50 || cha < 50) errorCode = NEWCHAR_STAT_TOO_LOW; if (errorCode != 0) { result.SetByte(errorCode); user.Send(result); return; } int nRet = new KODatabase().CREATE_NEW_CHAR(user.GetAccountID(), bCharIndex, strUserID, bRace, sClass, nHair, bFace, str, sta, dex, intel, cha); result.SetByte((byte)nRet); user.Send(result); }
internal static void SelectNation(User user, Packet pkt) { Packet result = new Packet(WIZ_SEL_NATION); byte nation = pkt.GetByte(); DBAgent.SelectNation(ref result,nation,user.strAccountID); user.Send(result); }
private static void ReqLetterSend(Packet pkt, User pUser) { Packet result = new Packet(WIZ_SHOPPING_MALL, STORE_LETTER); User ptUser = null; String strRecipient = String.Empty, strSubject = String.Empty, strMessage = String.Empty; _ITEM_DATA pItem = null; Int32 nItemID = 0, nCoins = 0, nCoinRequirement = 1000; Byte bType, bSrcPos; SByte bResult = 1; Int64 Serial = 0; //if(pUser.isTrading() || pUser.isMerchanting()) //{ // bResult = -1; // goto send_packet; //} pkt.SByte(); strRecipient = pkt.GetString(); strSubject = pkt.GetString(); bType = pkt.GetByte(); // invalid recipient name lenght if (strRecipient == String.Empty || strRecipient.Length > MAX_ID_SIZE // Invalid subject lenght || strSubject == String.Empty || strSubject.Length > 31 // Invalid type (as far we're concerned) || bType == 0 || bType > 2) bResult = -1; else if (STRCMP(strRecipient, pUser.strCharID)) bResult = -6; if (bResult != 1) goto send_packet; if(bType == 2) { if (nItemID != 0) nCoinRequirement = 10000; else nCoinRequirement = 5000; // Item alma fonksiyonu eklenecek } send_packet: result.SetByte(LETTER_SEND).SetByte(bResult); pUser.Send(result); }
private static void ReqLetterUnread(User pUser) { Packet result = new Packet(WIZ_SHOPPING_MALL, STORE_LETTER); result.SetByte(LETTER_UNREAD).SetByte(DBAgent.GetUnreadLetter(pUser.GetAccountID())); pUser.Send(result); }
private static void ReqLetterList(bool IsHistory, User pUser) { Packet result = new Packet(WIZ_SHOPPING_MALL, STORE_LETTER); result.SetByte(IsHistory ? LETTER_LIST : LETTER_HISTORY); if (!DBAgent.GetLetterList(pUser.GetAccountID(), ref result, IsHistory)) result.SetByte(-1); pUser.Send(result); }
private static void ReqLetterRead(Packet pkt, User pUser) { Packet result = new Packet(WIZ_SHOPPING_MALL, STORE_LETTER); Int32 nLetterID = pkt.GetDWORD(); String strMessage = String.Empty; result.SetByte(LETTER_READ); if (!DBAgent.ReadLetter(pUser.GetAccountID(), nLetterID, strMessage)) result.SetByte(0); else { result.SByte(); result.SetByte(1).SetDword(nLetterID).SetString(strMessage); } pUser.Send(result); }