Esempio n. 1
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);
        }
Esempio n. 2
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);            
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
 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);
 }
Esempio n. 5
0
        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);
        }