Exemplo n.º 1
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);
                    }
                }
            }
        }
Exemplo n.º 2
0
        internal void UserInOutForMe(User pSendUser)
        {
            Packet result = new Packet(WIZ_REQ_USERIN);
            short  user_count = 0;
            Packet temp = new Packet();
            short  rx = pSendUser.GetRegionX(), rz = pSendUser.GetRegionZ();

            for (int x = -3; x <= 3; x++)
            {
                for (int z = -3; z <= 3; z++)
                {
                    GetRegionUserList(rx + x, rz + z, ref temp, ref user_count, pSendUser.GetEventRoom(), pSendUser);
                }
            }


            result.SetShort(user_count);
            result.append(temp.send_byte, temp.send_index);
            pSendUser.Send(result);
        }
Exemplo n.º 3
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.");          
        }
Exemplo n.º 4
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);
                    }
                }
            }
            
        }