Beispiel #1
0
        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;
        }
Beispiel #2
0
        private void HandleLogin(Packet pkt)
        {
            KODatabase db = new KODatabase();
            string AccountID = pkt.GetString(), Passwd = pkt.GetString();
            short resultCode = 1;

            if (AccountID == string.Empty || AccountID.Length >= Define.MAX_ID_SIZE ||
                Passwd == string.Empty || Passwd.Length >= Define.MAX_PW_SIZE)
                resultCode = 2;
            else
                resultCode = db.TB_USER.Where(u=> u.strAccountID == AccountID && u.strPasswd == Passwd).Count() > 0 ? (short)1 : (short)2 ;

            Packet result = new Packet((byte)LogonOpcodes.LS_LOGIN_REQ);
            result.SetByte((byte)resultCode);
            if (resultCode == 1)
            {
                result.SetShort((short)db.ACCOUNT_PREMIUM(AccountID));
                result.SetString(AccountID);
            }

            Send(result);

            Debug.WriteLine("Kullanıcı girişi : {1} - {0}", resultCode, AccountID);
        }
Beispiel #3
0
        internal static void SelCharToAgent(User user, Packet pkt)
        {
            Packet result = new Packet(WIZ_SEL_CHAR);

            byte bInit, bResult = 0;
            string strCharID = string.Empty, strAccountID = string.Empty;

            strAccountID = pkt.GetString();
            user.strCharID = strCharID = pkt.GetString();
            bInit = pkt.GetByte();


            if (user.GetAccountID() == String.Empty || user.GetName() == String.Empty ||
                !DBAgent.LoadUserData(user.GetAccountID(), strCharID, ref user) ||
                !DBAgent.LoadWarehouseData(user.GetAccountID(), user) ||
                !DBAgent.LoadPremiumServiceUser(user.GetAccountID(), user) ||
                !DBAgent.LoadSavedMagic(user))
            {
                Debug.WriteLine("Kullanıcı girişi sırasında hata oluştu");
                bResult = 0;
                goto fail_return;
            }

            bResult = 1;

            fail_return:
            user.SelectCharacter(bResult, bInit);            
        }
Beispiel #4
0
        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);
        }
Beispiel #5
0
        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);
        }