Example #1
0
        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);
        }
Example #2
0
        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);
        }
Example #3
0
 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);
 }
Example #4
0
 public void ConstructClanNoticePacket(ref Packet result)
 {
     result = new Packet();
     result.SetByte(WIZ_NOTICE);
     result.DByte();
     result.SetByte(4);               // type
     result.SetByte(1);               // total blocks
     result.SetString("Clan Notice"); // header
     result.SetString(m_strClanNotice);
 }
Example #5
0
        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);
        }
Example #6
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);
        }
Example #7
0
        internal static void SelectNation(ref Packet result, byte nation, string strUserID)
        {
            KODatabase db = new KODatabase();

            ACCOUNT_CHAR aChar = db.ACCOUNT_CHAR.Where(acc => acc.strAccountID == strUserID).FirstOrDefault();
            WAREHOUSE wHouse = db.WAREHOUSE.Where(wh => wh.strAccountID == strUserID).FirstOrDefault();

            if (wHouse == null)
            {
                wHouse = new WAREHOUSE();
                wHouse.strAccountID = strUserID;
                wHouse.nMoney = 0;
                wHouse.dwTime = 0;
                wHouse.WarehouseData = new byte[1536];
                wHouse.strSerial = new byte[1536];
                wHouse.WarehouseDataTime = new byte[1536];

                db.WAREHOUSE.Add(wHouse);
                
                Debug.WriteLine("WAREHOUSE hesabı bulunamadığından yeni WAREHOUSE eklendi.");
            }

            if (aChar == null)
            {
                aChar = new ACCOUNT_CHAR();
                aChar.strAccountID = strUserID;
                aChar.bNation = nation;
                aChar.strCharID1 = null;
                aChar.strCharID2 = null;
                aChar.strCharID3 = null;
                db.ACCOUNT_CHAR.Add(aChar);
                Debug.WriteLine("Hesap bulunamadığından yeni account eklendi.");
            }
            else
            {
                nation = aChar.bNation;
                Debug.WriteLine("Hesap bilgileri alındı. Seçilen ırk {0}", nation);
            }

            db.SaveChanges();

            if (nation != KARUS && nation != ELMORAD)
            {
                result.SetByte(0);
                return;
            }

            result.SetByte(nation);
            
        }
Example #8
0
        private static void LoadCharInfo(string charID, ref Packet result)
        {
            KODatabase db = new KODatabase();

            var user = db.USERDATA.Where(u => u.strUserID == charID).First();

            int    nHair = 0;
            short  sClass = 0;
            byte   bRace = 0, bLevel = 0, bFace = 0, bZone = 0;
            string strItem = String.Empty;

            byte[] ItemArray = new byte[INVENTORY_TOTAL * 8];// = ToBytes(strItem);

            if (user != null)
            {
                result.SetString(user.strUserID);
                result.SetByte(user.Race);
                result.SetShort(user.Class);
                result.SetByte(user.Level);
                result.SetByte(user.Face);
                result.SetDword(user.HairRGB);
                result.SetByte(user.Zone);

                Packet item = new Packet();
                item.append(user.strItem, user.strItem.Length);

                for (int i = 0; i < SLOT_MAX; i++)
                {
                    int   nItemID;
                    short sDurability, sCount;
                    nItemID     = item.GetDWORD();
                    sDurability = item.GetShort();
                    sCount      = item.GetShort();
                    if (i == HEAD || i == BREAST || i == SHOULDER || i == LEG || i == GLOVE || i == FOOT || i == RIGHTHAND || i == LEFTHAND)
                    {
                        result.SetDword(nItemID);
                        result.SetShort(sDurability);
                    }
                }
            }
            else
            {
                result.SetString(charID);
                result.SetByte(bRace);
                result.SetShort(sClass);
                result.SetByte(bLevel);
                result.SetByte(bFace);
                result.SetDword(nHair);
                result.SetByte(bZone);

                for (int i = 0; i < SLOT_MAX; i++)
                {
                    if (i == HEAD || i == BREAST || i == SHOULDER || i == LEG || i == GLOVE || i == FOOT || i == RIGHTHAND || i == LEFTHAND)
                    {
                        result.SetDword(0);
                        result.SetShort(0);
                    }
                }
            }
        }
Example #9
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);
        }
Example #10
0
        internal static void SelectNation(ref Packet result, byte nation, string strUserID)
        {
            KODatabase db = new KODatabase();

            ACCOUNT_CHAR aChar  = db.ACCOUNT_CHAR.Where(acc => acc.strAccountID == strUserID).FirstOrDefault();
            WAREHOUSE    wHouse = db.WAREHOUSE.Where(wh => wh.strAccountID == strUserID).FirstOrDefault();

            if (wHouse == null)
            {
                wHouse = new WAREHOUSE();
                wHouse.strAccountID      = strUserID;
                wHouse.nMoney            = 0;
                wHouse.dwTime            = 0;
                wHouse.WarehouseData     = new byte[1536];
                wHouse.strSerial         = new byte[1536];
                wHouse.WarehouseDataTime = new byte[1536];

                db.WAREHOUSE.Add(wHouse);

                Debug.WriteLine("WAREHOUSE hesabı bulunamadığından yeni WAREHOUSE eklendi.");
            }

            if (aChar == null)
            {
                aChar = new ACCOUNT_CHAR();
                aChar.strAccountID = strUserID;
                aChar.bNation      = nation;
                aChar.strCharID1   = null;
                aChar.strCharID2   = null;
                aChar.strCharID3   = null;
                db.ACCOUNT_CHAR.Add(aChar);
                Debug.WriteLine("Hesap bulunamadığından yeni account eklendi.");
            }
            else
            {
                nation = aChar.bNation;
                Debug.WriteLine("Hesap bilgileri alındı. Seçilen ırk {0}", nation);
            }

            db.SaveChanges();

            if (nation != KARUS && nation != ELMORAD)
            {
                result.SetByte(0);
                return;
            }

            result.SetByte(nation);
        }
Example #11
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);
        }
Example #12
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);
        }
Example #13
0
        public void GetRegionUserList(int x, int z, ref Packet result, ref short user_count, short nEventRoom, User pSendUser)
        {
            foreach (Pair <short, User, int> itr in m_arUserList)
            {
                User pUser = itr.Second;

                //if (pUser == null && !pUser.isInGame())
                //	continue;

                // if (pUser.GetRegionX() != x || pUser.GetRegionZ() != z) continue;

                if (nEventRoom > 0 && nEventRoom != pUser.GetEventRoom())
                {
                    continue;
                }

                // Regionlar kontrol edilecek

                result.SetByte(0);
                result.SetShort(pUser.GetSocketID());
                pUser.GetUserInfo(ref result);

                user_count++;
            }
        }
Example #14
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);
        }
Example #15
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);
        }
Example #16
0
        internal void GetServerList(ref Packet result)
        {
            KODatabase db = new KODatabase();
            short      CurrentUserCount = (short)db.CURRENTUSER.Count();

            result.SetByte((byte)ServerList.Count);

            foreach (SERVER_INFO server in ServerList)
            {
                result.SetString(server.strServerIP);
                result.SetString(server.strLanIP);
                result.SetString(server.strServerName);

                if (CurrentUserCount <= server.sPlayerCap)
                {
                    result.SetShort(CurrentUserCount);
                }
                else
                {
                    result.SetShort(-1);
                }

                result.SetShort(server.sServerID);
                result.SetShort(server.sGroupID);

                result.SetShort(server.sPlayerCap);
                result.SetShort(server.sFreePlayerCap);

                result.SetByte(0);

                result.SetString(server.strKarusKingName);
                result.SetString(server.strKarusNotice);
                result.SetString(server.strElMoradKingName);
                result.SetString(server.strElMoradNotice);
            }
        }
Example #17
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;
        }
Example #18
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;
        }
Example #19
0
        internal static bool GetLetterList(string strAccountID, ref Packet result, bool isHistory)
        {
            try {
                KODatabase db = new KODatabase();

                byte bType = isHistory ? (byte)2 : (byte)1;

                var  letterlist = db.MAIL_BOX.Where(i => i.strRecipientID == strAccountID && i.bStatus == bType && !i.bDeleted).Take(10);
                byte Count      = (byte)letterlist.Count();

                result.SetByte(1).SetByte(bType);

                foreach (MAIL_BOX letter in letterlist)
                {
                    result.SetDword(letter.nLetterID)
                    .SetByte(letter.bStatus)
                    .SetString(letter.strSubject)
                    .SetString(letter.strSenderID)
                    .SetByte(letter.bType);

                    if (letter.bType == 2)
                    {
                        result.SetDword(letter.nItemID).SetShort(letter.sCount).SetDword(letter.nCoins);
                    }

                    int DayDiff = (Int32)UNIXTIME - (Int32)(letter.dtSendDate.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;

                    byte RemainDays = (byte)(DayDiff / 60 / 60 / 24);
                    result.SetDword((int)UNIXTIME).SetByte(RemainDays);
                }
            }
            catch
            {
                return(false);
            }
            return(true);
        }
Example #20
0
        public void SendMyInfo()
        {

            SetUserAbility(false);

            Packet result = new Packet(WIZ_MYINFO);

            result.SByte();
            result.SetShort(sSid);
            result.SetString(GetName());

            result.SetShort(Convert.ToInt16(m_curx * 10)); result.SetShort(Convert.ToInt16(m_curz * 10)); result.SetShort(Convert.ToInt16(m_cury * 10));

            result.SetByte(m_bNation);
            result.SetByte(m_bRace); result.SetShort(m_sClass); result.SetByte(m_bFace);

            result.SetDword(m_nHair);

            result.SetByte(m_bRank); result.SetByte(m_bTitle);

            result.SetShort(0);

            result.SetByte(GetLevel());
            result.SetShort(m_sPoints);

            result.SetInt64(1/*SetMaxExp()*/); result.SetInt64(m_iExp);

            result.SetDword(m_iLoyalty); result.SetDword(m_iLoyaltyMonthly);

            result.SetShort(GetClanID()); result.SetByte(GetFame());

            Knights pKnights = g_pMain.GetClanPtr(GetClanID());

            if (pKnights == null)
            {
                result.SetInt64(0);
                result.SetShort(-1);
                result.SetDword(0);
            }
            else
            {
                pKnights.OnLogin(this);
                Knights pAllyClan = null;
                if (pKnights.GetAllianceID() > 0)
                    pAllyClan = g_pMain.GetClanPtr(pKnights.GetAllianceID());

                result.SetShort(pKnights.GetAllianceID());
                result.SetByte(pKnights.m_byFlag);
                result.SetString(pKnights.m_strName);
                result.SetByte(pKnights.m_byGrade);
                result.SetByte(pKnights.m_byRanking);

                result.SetShort(pKnights.m_sMarkVersion);
                if (pAllyClan == null)
                    result.SetShort(pKnights.m_sCape);
                else
                    result.SetShort(pAllyClan.m_sCape);

                result.SetByte(pKnights.m_bCapeR);
                result.SetByte(pKnights.m_bCapeG);
                result.SetByte(pKnights.m_bCapeB);
                result.SetByte(0);
            }

            result.SetByte(2);
            result.SetByte(3);
            result.SetByte(4);
            result.SetByte(5);

            result.SetShort(m_iMaxHp); result.SetShort(m_sHp);
            result.SetShort(m_iMaxMp); result.SetShort(m_sMp);

            result.SetDword(m_sMaxWeight); result.SetDword(m_sItemWeight);

            result.SetByte(m_bStats[(int)StatType.STAT_STR]); result.SetByte((byte)GetStatItemBonus(StatType.STAT_STR));
            result.SetByte(m_bStats[(int)StatType.STAT_STA]); result.SetByte((byte)GetStatItemBonus(StatType.STAT_STA));
            result.SetByte(m_bStats[(int)StatType.STAT_DEX]); result.SetByte((byte)GetStatItemBonus(StatType.STAT_DEX));
            result.SetByte(m_bStats[(int)StatType.STAT_INT]); result.SetByte((byte)GetStatItemBonus(StatType.STAT_INT));
            result.SetByte(m_bStats[(int)StatType.STAT_CHA]); result.SetByte((byte)GetStatItemBonus(StatType.STAT_CHA));

            result.SetShort(m_sTotalHit); result.SetShort(m_sTotalAc);

            result.SetByte((byte)m_sFireR);
            result.SetByte((byte)m_sColdR);
            result.SetByte((byte)m_sLightningR);
            result.SetByte((byte)m_sMagicR);
            result.SetByte((byte)m_sDiseaseR);
            result.SetByte((byte)m_sPoisonR);

            result.SetDword(m_iGold);
            result.SetByte(m_bAuthority);
            result.SetByte(m_bKnightsRank); result.SetByte(m_bPersonalRank);

            result.append(m_bstrSkill, 9);

            for (int i = 0; i < INVENTORY_TOTAL; i++)
            {
                _ITEM_DATA pItem = GetItem(i);
                if (pItem == null)
                {
                    pItem = new _ITEM_DATA();
                }

                if (pItem.sRemainingRentalTime < UNIXTIME)
                    pItem.sRemainingRentalTime = 0;

                if (pItem.nExpirationTime < UNIXTIME)
                    pItem.nExpirationTime = 0;

                result.SetDword(pItem.nNum);
                result.SetShort(pItem.sDuration); result.SetShort(pItem.sCount);
                result.SetByte(pItem.bFlag);	// item type flag (e.g. rented)
                result.SetShort(pItem.sRemainingRentalTime);	// remaining time
                result.SetDword(0); // unknown
                result.SetDword(pItem.nExpirationTime); // expiration date in unix time
            }

            result.SetByte(m_bAccountStatus);
            result.SetByte(m_bPremiumType);
            result.SetShort(m_sPremiumTime);
            result.SetByte(m_bIsChicken); // Yumurta
            result.SetDword(m_iMannerPoint);
            result.SetShort(0);
            result.SetDword(0); // Military Camp
            result.SetShort(m_sGenieTime);// Genie
           

            Send(result);

            if (!g_pMain.AddUserInGame(GetID(), this))
                OnDisconnect();
            else
                bGameStart = true;

            Console.WriteLine("Send My info Gönderildi.");          
        }
Example #21
0
        public void SelectCharacter(byte bResult, byte bInit)
        {
            Packet result = new Packet(WIZ_SEL_CHAR);

            if (m_bAuthority == 255) // Bannet 
            {
                OnDisconnect();
                return;
            }

            result.SetByte(bResult);

            if (bResult == 0 || m_bZone <= 0)
                goto fail_return;

            result.SetByte(m_bZone);
            result.SetShort(Convert.ToInt16(m_curx));
            result.SetShort(Convert.ToInt16(m_curz));
            result.SetShort(Convert.ToInt16(m_cury));
            result.SetByte(KARUS);
            bSelectChar = true;

            Send(result);

            return;
            fail_return:
            Send(result);
        }
Example #22
0
 public void SendWeather()
 {
     Packet result = new Packet(WIZ_WEATHER);
     result.SetByte(1);
     result.SetShort(10 * 60);
     Send(result);
 }
Example #23
0
        public void TopSendNotice()
        {
            Packet result = new Packet(WIZ_NOTICE);
            byte count = 0;//uint8

            result.SetByte(1); // Old-style notices (top-right of screen)
            result.SetByte(count); // placeholder the 
            Send(result);
        }
Example #24
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);
        }
Example #25
0
        public void StateChangeServerDirect(byte type, int buff)
        {
            if (type == 5 && m_bAuthority != 0) return;	//  Operators only!!!

            if (type == 1)
            {
                m_bResHpType = Convert.ToByte(buff);
            }
            else if (type == 2)
            {
                m_bNeedParty = Convert.ToByte(buff);
            }
            else if (type == 3)
            {
                m_bAbnormalType = buff;
            }
            else if (type == 6)
            {
                m_bPartyLeader = Convert.ToBoolean(buff);
            }

            Packet result = new Packet(WIZ_STATE_CHANGE);
            result.SetShort(GetSocketID());
            result.SetByte(type);

            if (type == 1)
            {
                result.SetDword(m_bResHpType);
            }
            else if (type == 2)
            {
                result.SetDword(m_bNeedParty);
            }
            //
            else if (type == 3)
            {
                result.SetDword(m_bAbnormalType);
            }

            else
            {		// Just plain echo :)
                result.SetDword(buff);
                //		N3_SP_STATE_CHANGE_ACTION = 0x04,			// 1 - 인사, 11 - 도발
                //		N3_SP_STATE_CHANGE_VISIBLE = 0x05 };		// 투명 0 ~ 255
            }

            g_pMain.Send_All(result);
            /*
            switch (bType)
            {
                case 1:
                    m_bResHpType = buff;
                    break;

                case 2:
                    m_bNeedParty = buff;
                    break;

                case 3:
                    m_nOldAbnormalType = m_bAbnormalType;

                    // If we're a GM, we need to show ourselves before transforming.
                    // Otherwise the visibility state is completely desynced.
                    if (isGM())
                        StateChangeServerDirect(5, 1);

                    m_bAbnormalType = buff;
                    break;

                case 5:
                    m_bAbnormalType = buff;
                    break;

                case 6:
                    buff = Convert.ToByte(m_bPartyLeader); // we don't set this here.
                    break;

                case 7:
                    UpdateVisibility((InvisibilityType)buff);
                    break;

                case 8: // beginner quest
                    break;
            }

            Packet result = new Packet(WIZ_STATE_CHANGE);
            result.SetShort(GetSocketID());
            result.SetByte(bType); result.SetByte(buff);
            SendToRegion(result);*/
        }
Example #26
0
        internal void GetServerList(ref Packet result)
        {
            KODatabase db = new KODatabase();
            short CurrentUserCount = (short)db.CURRENTUSER.Count();
            result.SetByte((byte)ServerList.Count);

            foreach(SERVER_INFO server in ServerList)
            {
                result.SetString(server.strServerIP);
                result.SetString(server.strLanIP);
                result.SetString(server.strServerName);

                if (CurrentUserCount <= server.sPlayerCap)
                    result.SetShort(CurrentUserCount);
                else
                    result.SetShort(-1);

                result.SetShort(server.sServerID);
                result.SetShort(server.sGroupID);

                result.SetShort(server.sPlayerCap);
                result.SetShort(server.sFreePlayerCap);

                result.SetByte(0);

                result.SetString(server.strKarusKingName);
                result.SetString(server.strKarusNotice);
                result.SetString(server.strElMoradKingName);
                result.SetString(server.strElMoradNotice);
            }
        }
Example #27
0
        public void GameStart(Packet pkt)
        {
            if (IsInGame())
                return;

            byte opcode = pkt.GetByte();
            Console.WriteLine("Game Start Opcode : " + opcode);
            if (opcode == 1)
            {
                SendMyInfo();

                g_pMain.UserInOutForMe(this);
                g_pMain.MerchantUserInOutForMe(this);
                g_pMain.NpcInOutForMe(this);

                SendNotice();
                TopSendNotice();
                SendTime();
                SendWeather();

                Packet result = new Packet(2);
                result.SetByte(WIZ_GAMESTART);
                Send(result);

                m_State = GameState.GAME_STATE_INGAME;
                UserInOut(InOutType.INOUT_RESPAWN, this);
                bGameStart = true;

                SetUserAbility();

                if (isDead())
                    SendDeathAnimation();

                // m_tGameStartTimeSavedMagic = UNIXTIME;

                m_LastX = GetX();
                m_LastZ = GetZ();
            }

            BlinkStart();

            m_tHPLastTimeNormal = UNIXTIME;
        }
Example #28
0
        internal static bool GetLetterList(string strAccountID, ref Packet result, bool isHistory)
        {
            try {
                KODatabase db = new KODatabase();

                byte bType = isHistory ? (byte)2 : (byte)1;

                var letterlist = db.MAIL_BOX.Where(i => i.strRecipientID == strAccountID && i.bStatus == bType && !i.bDeleted).Take(10);
                byte Count = (byte)letterlist.Count();

                result.SetByte(1).SetByte(bType);

                foreach (MAIL_BOX letter in letterlist)
                {
                    result.SetDword(letter.nLetterID)
                        .SetByte(letter.bStatus)
                        .SetString(letter.strSubject)
                        .SetString(letter.strSenderID)
                        .SetByte(letter.bType);

                    if (letter.bType == 2)
                        result.SetDword(letter.nItemID).SetShort(letter.sCount).SetDword(letter.nCoins);

                    int DayDiff = (Int32)UNIXTIME - (Int32)(letter.dtSendDate.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;

                    byte RemainDays = (byte)(DayDiff / 60 / 60 / 24);
                    result.SetDword((int)UNIXTIME).SetByte(RemainDays);
                }
            }
            catch
            {
                return false;
            }
            return true;
        }
Example #29
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);
        }
Example #30
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);
        }
Example #31
0
        private static void LoadCharInfo(string charID, ref Packet result)
        {
            KODatabase db = new KODatabase();

            var user = db.USERDATA.Where(u => u.strUserID == charID).First();

            int nHair = 0;
            short sClass = 0;
            byte bRace = 0, bLevel = 0, bFace = 0, bZone = 0;
            string strItem = String.Empty;
            byte[] ItemArray = new byte[INVENTORY_TOTAL * 8];// = ToBytes(strItem);

            if (user != null)
            {
                result.SetString(user.strUserID);
                result.SetByte(user.Race);
                result.SetShort(user.Class);
                result.SetByte(user.Level);
                result.SetByte(user.Face);
                result.SetDword(user.HairRGB);
                result.SetByte(user.Zone);

                Packet item = new Packet();
                item.append(user.strItem, user.strItem.Length);

                for (int i = 0; i < SLOT_MAX; i++)
                {
                    int nItemID;
                    short sDurability, sCount;
                    nItemID = item.GetDWORD();
                    sDurability = item.GetShort();
                    sCount = item.GetShort();
                    if (i == HEAD || i == BREAST || i == SHOULDER || i == LEG || i == GLOVE || i == FOOT || i == RIGHTHAND || i == LEFTHAND)
                    {
                        result.SetDword(nItemID);
                        result.SetShort(sDurability);
                    }
                }
            }
            else
            {
                result.SetString(charID);
                result.SetByte(bRace);
                result.SetShort(sClass);
                result.SetByte(bLevel);
                result.SetByte(bFace);
                result.SetDword(nHair);
                result.SetByte(bZone);

                for (int i = 0; i < SLOT_MAX; i++)
                {
                    if (i == HEAD || i == BREAST || i == SHOULDER || i == LEG || i == GLOVE || i == FOOT || i == RIGHTHAND || i == LEFTHAND)
                    {
                        result.SetDword(0);
                        result.SetShort(0);
                    }
                }
            }
            
        }
Example #32
0
 public void ConstructClanNoticePacket(ref Packet result)
 {
     result = new Packet();
     result.SetByte(WIZ_NOTICE);
     result.DByte();
     result.SetByte(4);		// type
     result.SetByte(1);			// total blocks
     result.SetString("Clan Notice");	// header
     result.SetString(m_strClanNotice);
 }
Example #33
0
        internal void GetUserInfo(ref Packet result)
        {            
            Knights pKnights = null;

            result.SByte();
            result.SetString(GetName());
            result.SetShort(GetNation());
            result.SetShort(m_bKnights);
            result.SetByte(GetFame());

            pKnights = g_pMain.GetClanPtr(m_bKnights);

            if (pKnights == null)
            {
                result.SetDword(0);
                result.SetShort(0);
                result.SetByte(0);
                result.SetShort(-1);
                result.SetDword(0);
                result.SetByte(0);
            }
            else
            {
                result.SetShort(pKnights.GetAllianceID());

                result.SetString(pKnights.m_strName);

                result.SetByte(pKnights.m_byGrade);
                result.SetByte(pKnights.m_byRanking);

                result.SetShort(pKnights.m_sMarkVersion);
                result.SetShort(pKnights.m_sCape);

                result.SetByte(pKnights.m_bCapeR);
                result.SetByte(pKnights.m_bCapeG);
                result.SetByte(pKnights.m_bCapeB);
                result.SetByte(0);
                result.SetByte(1);
            }

            InvisibilityType bInvisibilityType = (InvisibilityType)m_bInvisibilityType;
            if (bInvisibilityType != InvisibilityType.INVIS_NONE)
                bInvisibilityType = InvisibilityType.INVIS_DISPEL_ON_MOVE;

            result.SetByte(GetLevel()); result.SetByte(m_bRace); result.SetShort(m_sClass);
            result.SetShort(GetSPosX()); result.SetShort(GetSPosZ()); result.SetShort(GetSPosY());
            result.SetByte(m_bFace); result.SetDword(m_nHair);
            result.SetByte(m_bResHpType); result.SetDword(m_bAbnormalType);
            result.SetByte(m_bNeedParty);
            result.SetByte(m_bAuthority);
            result.SetByte(m_bPartyLeader);
            result.SetByte((byte)bInvisibilityType);
            result.SetByte(m_teamColour);
            result.SetByte(m_bIsHidingHelmet);
            result.SetByte((byte)bInvisibilityType);
            result.SetShort(m_sDirection);
            result.SetByte(m_bIsChicken);
            result.SetByte(m_bRank);
            result.SetShort(0);
            result.SetByte(m_bKnightsRank);
            result.SetByte(m_bPersonalRank);

            byte[] equippedItems =
            {
                BREAST, LEG, HEAD, GLOVE, FOOT, SHOULDER, RIGHTHAND, LEFTHAND,
                CWING, CHELMET, CRIGHT, CLEFT, CTOP, CFAIRY
            };

            foreach (byte i in equippedItems)
            {

                _ITEM_DATA pItem = GetItem(i);

                if (pItem == null)
                    continue;

                result.SetDword(pItem.nNum);
                result.SetShort(pItem.sDuration);
                result.SetByte(pItem.bFlag);
            }

            result.SetByte(GetZoneID());
            result.SetShort(-1);
            result.SetDword(0); result.SetShort(0); result.SetByte(0); result.SetByte(isGenieActive());

            if (__VERSION > 2000)
            {
                result.SetByte(isRebirth());
                result.SetShort(GetAchieveTitle());
                result.SetShort(0);
                result.SetByte(0);
                result.SetByte(1);
            }
        }
Example #34
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);
 }
Example #35
0
 public void Parsing(Packet pkt)
 {
     byte command = pkt.GetByte();
     Console.WriteLine("Client Received : 0x" + command.ToString("X2"));
     if (!bSelectChar)
     {
         switch (command)
         {
             case WIZ_VERSION_CHECK:
                 VersionCheck(this);
                 break;
             case WIZ_LOGIN:
                 AccountLogin(this, pkt);
                 break;
             case WIZ_ALLCHAR_INFO_REQ:
                 LoadCharInfoReq(this, pkt);
                 break;
             case WIZ_SEL_NATION:
                 SelectNation(this, pkt);
                 break;
             case WIZ_SEL_CHAR:
                 SelCharToAgent(this, pkt);
                 break;
             case WIZ_NEW_CHAR:
                 CreateNewChar(this, pkt);
                 break;
             case WIZ_LOGINCHECKFORV2:
                 {
                     Packet result = new Packet(WIZ_LOGINCHECKFORV2);
                     result.SetByte(1);
                     Send(result);
                 }
                 break;
         }
     }
     else
     {
         switch (command)
         {
             case WIZ_MOVE: break;
             case WIZ_USER_INOUT: break;
             case WIZ_ATTACK: break;
             case WIZ_ROTATE: break;
             case WIZ_NPC_INOUT: break;
             case WIZ_NPC_MOVE: break;
             case WIZ_ALLCHAR_INFO_REQ: break;
             case WIZ_GAMESTART:
                 GameStart(pkt);
                 break;
             case WIZ_MYINFO: break;
             case WIZ_LOGOUT: break;
             case WIZ_CHAT: break;
             case WIZ_DEAD: break;
             case WIZ_REGENE: break;
             case WIZ_TIME: break;
             case WIZ_WEATHER: break;
             case WIZ_REGIONCHANGE: break;
             case WIZ_REQ_USERIN: break;
             case WIZ_HP_CHANGE: break;
             case WIZ_MSP_CHANGE: break;
             case WIZ_ITEM_LOG: break;
             case WIZ_EXP_CHANGE: break;
             case WIZ_LEVEL_CHANGE: break;
             case WIZ_NPC_REGION: break;
             case WIZ_REQ_NPCIN: break;
             case WIZ_WARP: break;
             case WIZ_ITEM_MOVE: break;
             case WIZ_NPC_EVENT: break;
             case WIZ_ITEM_TRADE: break;
             case WIZ_TARGET_HP: break;
             case WIZ_ITEM_DROP: break;
             case WIZ_BUNDLE_OPEN_REQ: break;
             case WIZ_TRADE_NPC: break;
             case WIZ_ITEM_GET: break;
             case WIZ_ZONE_CHANGE: break;
             case WIZ_POINT_CHANGE: break;
             case WIZ_STATE_CHANGE: break;
             case WIZ_LOYALTY_CHANGE: break;
             case WIZ_CRYPTION: break;
             case WIZ_USERLOOK_CHANGE: break;
             case WIZ_NOTICE: break;
             case WIZ_PARTY: break;
             case WIZ_EXCHANGE: break;
             case WIZ_MAGIC_PROCESS: break;
             case WIZ_SKILLPT_CHANGE: break;
             case WIZ_OBJECT_EVENT: break;
             case WIZ_CLASS_CHANGE: break;
             case WIZ_CHAT_TARGET: break;
             case WIZ_CONCURRENTUSER: break;
             case WIZ_DATASAVE: break;
             case WIZ_DURATION: break;
             case WIZ_TIMENOTIFY: break;
             case WIZ_REPAIR_NPC: break;
             case WIZ_ITEM_REPAIR: break;
             case WIZ_KNIGHTS_PROCESS: break;
             case WIZ_ITEM_COUNT_CHANGE: break;
             case WIZ_KNIGHTS_LIST: break;
             case WIZ_ITEM_REMOVE: break;
             case WIZ_OPERATOR: break;
             case WIZ_SPEEDHACK_CHECK: break;
             case WIZ_COMPRESS_PACKET: break;
             case WIZ_SERVER_CHECK: break;
             case WIZ_CONTINOUS_PACKET: break;
             case WIZ_WAREHOUSE: break;
             case WIZ_SERVER_CHANGE: break;
             case WIZ_REPORT_BUG: break;
             case WIZ_HOME: break;
             case WIZ_FRIEND_PROCESS: break;
             case WIZ_GOLD_CHANGE: break;
             case WIZ_WARP_LIST: break;
             case WIZ_VIRTUAL_SERVER: break;
             case WIZ_ZONE_CONCURRENT: break;
             case WIZ_CORPSE: break;
             case WIZ_PARTY_BBS: break;
             case WIZ_MARKET_BBS: break;
             case WIZ_KICKOUT: break;
             case WIZ_CLIENT_EVENT: break;
             case WIZ_MAP_EVENT: break;
             case WIZ_WEIGHT_CHANGE: break;
             case WIZ_SELECT_MSG: break;
             case WIZ_NPC_SAY: break;
             case WIZ_BATTLE_EVENT: break;
             case WIZ_AUTHORITY_CHANGE: break;
             case WIZ_EDIT_BOX: break;
             case WIZ_SANTA: break;
             case WIZ_ITEM_UPGRADE: break;
             case WIZ_PACKET1: break;
             case WIZ_PACKET2: break;
             case WIZ_ZONEABILITY: break;
             case WIZ_EVENT: break;
             case WIZ_STEALTH: break;
             case WIZ_ROOM_PACKETPROCESS: break;
             case WIZ_ROOM: break;
             case WIZ_PACKET3: break;
             case WIZ_QUEST: break;
             case WIZ_PACKET4: break;
             case WIZ_KISS: break;
             case WIZ_RECOMMEND_USER: break;
             case WIZ_MERCHANT: break;
             case WIZ_MERCHANT_INOUT: break;
             case WIZ_SHOPPING_MALL:
                 HandleShoppingMall(pkt, this);
                 break;
             case WIZ_SERVER_INDEX:
                 ServerIndex(pkt);
                 break;
             case WIZ_EFFECT: break;
             case WIZ_SIEGE: break;
             case WIZ_NAME_CHANGE: break;
             case WIZ_WEBPAGE: break;
             case WIZ_CAPE: break;
             case WIZ_PREMIUM: break;
             case WIZ_HACKTOOL: break;
             case WIZ_RENTAL:
                 Packet result = new Packet(20);
                 result.SetByte(WIZ_RENTAL);
                 result.SetByte(1);
                 Send(result);
                 break;
             case WIZ_PACKET5: break;
             case WIZ_CHALLENGE: break;
             case WIZ_PET: break;
             case WIZ_CHINA: break;
             case WIZ_KING: break;
             case WIZ_SKILLDATA: break;
             case WIZ_PROGRAMCHECK: break;
             case WIZ_BIFROST: break;
             case WIZ_REPORT: break;
             case WIZ_LOGOSSHOUT: break;
             case WIZ_PACKET6: break;
             case WIZ_PACKET7: break;
             case WIZ_RANK: break;
             case WIZ_STORY: break;
             case WIZ_PACKET8: break;
             case WIZ_PACKET9: break;
             case WIZ_PACKET10: break;
             case WIZ_PACKET11: break;
             case WIZ_MINING: break;
             case WIZ_HELMET: break;
             case WIZ_PVP: break;
             case WIZ_CHANGE_HAIR: break;
             case WIZ_PACKET12: break;
             case WIZ_PACKET13: break;
             case WIZ_PACKET14: break;
             case WIZ_PACKET15: break;
             case WIZ_PACKET16: break;
             case WIZ_PACKET17: break;
             case WIZ_DEATH_LIST: break;
             case WIZ_CLANPOINTS_BATTLE: break;
             case WIZ_TEST_PACKET: break;
             case WIZ_GENIE: break;
             case WIZ_USER_INFORMATIN: break;
             case WIZ_ACHIEVE: break;
             case WIZ_EXP_SEAL: break;
             case WIZ_SP_CHANGE: break;
         }
     }
 }
Example #36
0
 public void SendItemMove(byte subcommand)
 {
     Packet result = new Packet(WIZ_ITEM_MOVE, 0x01);
     result.SetByte(subcommand);
     if (m_bAttackAmount == 0)
         m_bAttackAmount = 100;
     // If the subcommand is not error, send the stats.
     if (subcommand != 0)
     {
         result.SetShort((short)(m_sTotalHit * m_bAttackAmount / 100));
         result.SetShort((short)(m_sTotalAc + m_sACAmount));
         result.SetDword(m_sMaxWeight);
         result.SetShort(m_iMaxHp); result.SetShort(m_iMaxMp);
         result.SetShort(GetStatBonusTotal(StatType.STAT_STR)); result.SetShort(GetStatBonusTotal(StatType.STAT_STA));
         result.SetShort(GetStatBonusTotal(StatType.STAT_DEX)); result.SetShort(GetStatBonusTotal(StatType.STAT_INT));
         result.SetShort(GetStatBonusTotal(StatType.STAT_CHA));
         result.SetShort((short)(((m_sFireR + m_bAddFireR) * m_bPctFireR / 100) + m_bResistanceBonus));
         result.SetShort((short)(((m_sColdR + m_bAddColdR) * m_bPctColdR / 100) + m_bResistanceBonus));
         result.SetShort((short)(((m_sLightningR + m_bAddLightningR) * m_bPctLightningR / 100) + m_bResistanceBonus));
         result.SetShort((short)(((m_sMagicR + m_bAddMagicR) * m_bPctMagicR / 100) + m_bResistanceBonus));
         result.SetShort((short)(((m_sDiseaseR + m_bAddDiseaseR) * m_bPctDiseaseR / 100) + m_bResistanceBonus));
         result.SetShort((short)(((m_sPoisonR + m_bAddPoisonR) * m_bPctPoisonR / 100) + m_bResistanceBonus));
     }
     Send(result);
 }
Example #37
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);
        }
Example #38
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);
        }