Пример #1
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);
        }
Пример #2
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);
        }
Пример #3
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);
            }
        }
Пример #4
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.");          
        }
Пример #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);
        }
Пример #6
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);
        }