Beispiel #1
0
        public virtual void RawEncode(COutPacket p, bool bFromCS = false)
        {
            p.Encode4(nItemID);

            var bCashItem = liCashItemSN != 0;

            p.Encode1(bCashItem);

            // ring equips have to have their unique ID sent instead of the cash ID
            // but not during the locker -> storage transaction in the cash shop
            // not pretty but it works ok
            if (!bFromCS &&
                (ItemConstants.is_friendship_equip_item(nItemID) ||
                 ItemConstants.is_couple_equip_item(nItemID) ||
                 ItemConstants.is_wedding_ring_item(nItemID)))
            {
                p.Encode8(liSN);
            }
            else
            {
                if (bCashItem)
                {
                    p.Encode8(liCashItemSN);
                }
            }

            p.EncodeDateTime(tDateExpire);
        }
Beispiel #2
0
            public static COutPacket CheckPasswordResult(int accId, byte gender, byte nGradeCode, short nSubGradeCode, string accountName)
            {
                var p = new COutPacket(SendOps.LP_CheckPasswordResult);

                p.Encode1(0);                 //nRet
                p.Encode1(0);                 //nRegStatID
                p.Encode4(0);                 //nUseDay

                //if (nRet == 2)
                //{
                //    COutPacket::Encode1((COutPacket*)&oPacket, v2->m_nBlockReason);
                //    COutPacket::EncodeBuffer((COutPacket*)&oPacket, &v2->m_dtUnblockDate, 8u);
                //}

                p.Encode4(accId);             // dwAccountId
                p.Encode1(gender);            // nGender
                p.Encode1(nGradeCode);        // nGradeCode
                p.Encode2(nSubGradeCode);     // nSubGradeCode
                p.Encode1(0);                 // nCountryID
                p.EncodeString(accountName);  // sNexonClubID
                p.Encode1(0);                 // nPurchaseExp
                p.Encode1(0);                 // nChatBlockReason
                p.Encode8(0);                 // dtChatUnblockDate
                p.Encode8(0);                 // dtRegisterDate
                p.Encode4(4);                 // flag that affects character creation

                p.Encode1(true);              //If true client will send CP_WorldRequest
                //If false it check nGameStartMode and returns or sends CP_CheckPinCode

                p.Encode1(1);                 //sMsg._m_pStr[432] = CInPacket::Decode1(iPacket);
                p.Encode8(0);                 // dwHighDateTime
                return(p);
            }
        public override void RawEncode(COutPacket p, bool bFromCS = false)
        {
            p.Encode1(3);

            p.Encode4(nItemID);

            var bCashItem = liCashItemSN != 0;

            p.Encode1(bCashItem);

            if (bCashItem)             // arent all pets cash items?? o__o
            {
                p.Encode8(liCashItemSN);
            }

            p.EncodeDateTime(tDateExpire);

            p.EncodeStringFixed(sPetName, 13);
            p.Encode1(nLevel);
            p.Encode2(nTameness);
            p.Encode1(nRepleteness);
            if (tDateDead == DateTime.MaxValue)
            {
                p.Encode8(0);
            }
            else
            {
                p.EncodeDateTime(tDateDead);
            }
            p.Encode2(nPetAttribute);
            p.Encode2(usPetSkill);
            p.Encode4(nRemainLife);
            p.Encode2(nAttribute);
        }
Beispiel #4
0
 public void Encode(COutPacket p)
 {
     p.Encode4(dwPairCharacterID);
     p.EncodeStringFixed(sPairCharacterName, 13);
     p.Encode8(liSN);
     p.Encode8(liPairSN);
     p.Encode4(dwFriendItemID);
 }
Beispiel #5
0
        public virtual void RawEncode(COutPacket p)
        {
            p.Encode4(nItemID);

            var v3 = liCashItemSN != 0;

            p.Encode1(v3);

            if (v3)
            {
                p.Encode8(liCashItemSN);
            }

            p.Encode8(dateExpire);
        }
Beispiel #6
0
        public void EncodeEquippedRings(COutPacket p)
        {
            #region COUPLE_RING

            p.Encode1(0);             // TODO

            #endregion

            #region FRIENDSHIP_RING

            GW_FriendRecord pFriendshipRing   = null;
            var             nFriendshipRingID = 0;
            long            nFriendShipSN     = 0;

            for (var bp = BodyPart.BP_RING1; bp < BodyPart.BP_RING4; bp++)
            {
                var item = InventoryManipulator.GetItem(Parent, bp, true);

                if (item is null)
                {
                    continue;
                }

                if (ItemConstants.is_friendship_equip_item(item.nItemID))
                {
                    pFriendshipRing = lFriendRecord.FirstOrDefault(ring => ring.liSN == item.liSN);
                    break;
                }
            }

            p.Encode1(pFriendshipRing != null);

            if (pFriendshipRing != null)
            {
                p.Encode8(pFriendshipRing.liSN);
                p.Encode8(pFriendshipRing.liPairSN);
                p.Encode4(pFriendshipRing.dwFriendItemID);
            }

            #endregion

            #region MARRIAGE_RING

            p.Encode1(0);             // TODO

            #endregion
        }
Beispiel #7
0
        public override void RawEncode(COutPacket p)
        {
            p.Encode1(1);

            base.RawEncode(p);

            p.Encode1(nRUC);
            p.Encode1(nCUC);
            p.Encode2(niSTR);
            p.Encode2(niDEX);
            p.Encode2(niINT);
            p.Encode2(niLUK);
            p.Encode2(niMaxHP);
            p.Encode2(niMaxMP);
            p.Encode2(niPAD);
            p.Encode2(niMAD);
            p.Encode2(niPDD);
            p.Encode2(niMDD);
            p.Encode2(niACC);
            p.Encode2(niEVA);
            p.Encode2(niCraft);
            p.Encode2(niSpeed);
            p.Encode2(niJump);
            p.EncodeString(sTitle);
            p.Encode2(nAttribute);

            p.Encode1(nLevelUpType);
            p.Encode1(nLevel);
            p.Encode4(nEXP);
            p.Encode4(nDurability);
            p.Encode4(nIUC);
            p.Encode1(nGrade);
            p.Encode1(nCHUC);
            p.Encode2(nOption1);
            p.Encode2(nOption2);
            p.Encode2(nOption3);
            p.Encode2(nSocket1);
            p.Encode2(nSocket2);

            if (liCashItemSN == 0)
            {
                p.Encode8(liSN);
            }

            p.Encode8(ftEquipped);
            p.Encode4(nPrevBonusExpRate);
        }
Beispiel #8
0
        public override void RawEncode(COutPacket p, bool bFromCS = false)
        {
            p.Encode1(1);

            base.RawEncode(p, bFromCS);

            p.Encode1(RemainingUpgradeCount);           // RUC
            p.Encode1(CurrentUpgradeCount);             // CUC(K)
            p.Encode2(niSTR);
            p.Encode2(niDEX);
            p.Encode2(niINT);
            p.Encode2(niLUK);
            p.Encode2(niMaxHP);
            p.Encode2(niMaxMP);
            p.Encode2(niPAD);
            p.Encode2(niMAD);
            p.Encode2(niPDD);
            p.Encode2(niMDD);
            p.Encode2(niACC);
            p.Encode2(niEVA);
            p.Encode2(niCraft);             // hands? i think
            p.Encode2(niSpeed);
            p.Encode2(niJump);
            p.EncodeString(sTitle);
            p.Encode2((short)nAttribute);

            p.Encode1(nLevelUpType);
            p.Encode1(nLevel);
            p.Encode4(nEXP);
            p.Encode4(nDurability);
            p.Encode4(HammerUpgradeCount);           // IUC
            p.Encode1((byte)nGrade);
            p.Encode1(StarUpgradeCount);             // CHUC
            p.Encode2(nOption1);
            p.Encode2(nOption2);
            p.Encode2(nOption3);
            p.Encode2(nSocket1);
            p.Encode2(nSocket2);

            if (liCashItemSN == 0)
            {
                p.Encode8(liSN);
            }

            p.Encode8(ftEquipped);
            p.Encode4(nPrevBonusExpRate);
        }
Beispiel #9
0
        public COutPacket NameChanged()         // todo move this elsewhere
        {
            var p = new COutPacket(SendOps.LP_PetNameChanged);

            p.Encode8(liPetLockerSN);
            p.EncodeString(sName);
            p.Encode1(1);             // test, this is a boolean

            return(p);
        }
Beispiel #10
0
 public void Encode(COutPacket p)
 {
     p.Encode4(dwTemplateID);
     p.EncodeString(sName ?? "Nameless Pet");
     p.Encode8(liPetLockerSN);
     p.Encode2(Position.X);
     p.Encode2(Position.Y);
     p.Encode1(Position.MoveAction);
     p.Encode2(Position.Foothold);
     p.Encode1(nNameTag);
     p.Encode1(nChatBalloon);
 }
Beispiel #11
0
 public void EncodeItem(CashItemInfo i, COutPacket p)
 {
     p.Encode8(i.SN);
     p.Encode4(i.dwAccountID);
     p.Encode4(i.dwCharacterID);
     p.Encode4(i.nItemID);
     p.Encode4(i.CommodityID);
     p.Encode2(i.Count);
     p.EncodeStringFixed(i.BuyerCharName, 13);
     p.EncodeDateTime(i.Item.tDateExpire);
     p.Encode4(i.nPaybackRate);
     p.Encode4(i.nDiscountRate);
 }
 public void Encode(COutPacket p)
 {
     p.Encode8(SN);
     p.Encode4(dwAccountID);
     p.Encode4(dwCharacterID);             // dwCharacterID
     p.Encode4(nItemID);
     p.Encode4(CommodityID);
     p.Encode2(Item.nNumber);
     p.EncodeStringFixed(BuyerCharName, 13);             // sender
     p.EncodeDateTime(Item.tDateExpire);
     p.Encode4(nPaybackRate);
     p.Encode4(nDiscountRate);
 }
Beispiel #13
0
            public static COutPacket CashItemGachaponSuccess(long liItemSN, int nCountLeft, CashItemInfo item, bool bJackpot)
            {
                var p = new COutPacket(SendOps.LP_CashShopCashItemGachaponResult);

                p.Encode1((byte)CashItemOps.CashItemRes_CashItemGachapon_Done);
                p.Encode8(liItemSN);
                p.Encode4(nCountLeft);
                item.Encode(p);
                p.Encode4(item.nItemID);
                p.Encode1((byte)nCountLeft);
                p.Encode1(bJackpot);
                return(p);
            }
        public override void RawEncode(COutPacket p, bool bFromCS = false)
        {
            p.Encode1(2);

            base.RawEncode(p, bFromCS);

            p.Encode2(nNumber);
            p.EncodeString(sTitle);
            p.Encode2(nAttribute);

            if (ItemConstants.IsRechargeableItem(nItemID))
            {
                p.Encode8(liSN);
            }
        }
Beispiel #15
0
        public string sTitle = string.Empty; //char sTitle[13];

        public override void RawEncode(COutPacket p)
        {
            p.Encode1(2);

            base.RawEncode(p);

            p.Encode2(nNumber);
            p.EncodeString(sTitle);
            p.Encode2(nAttribute);

            if (nItemID / 10000 == 207)
            {
                p.Encode8(liSN);
            }
        }
Beispiel #16
0
            public static COutPacket MobDamaged(int dwMobID, byte nType, int decHP)
            {
                var p = new COutPacket(SendOps.LP_MobDamaged);

                p.Encode4(dwMobID);
                p.Encode1(nType);
                p.Encode4(decHP);
                p.Encode8(0);                // TODO
                //if (template.isDamagedByMob()) // replace with enc8
                //{
                //	packet.encodeInt(getHP());
                //	packet.encodeInt(template.getMaxHP());
                //}
                return(p);
            }
Beispiel #17
0
        public override void RawEncode(COutPacket p)
        {
            p.Encode1(3);

            base.RawEncode(p);

            p.EncodeFixedString(sPetName, 13);
            p.Encode1(nLevel);
            p.Encode2(nTameness);
            p.Encode1(nRepleteness);
            p.Encode8(dateDead);
            p.Encode2(nPetAttribute);
            p.Encode2(usPetSkill);
            p.Encode4(nRemainLife);
            p.Encode2(nAttribute);
        }
        public void Encode(COutPacket p)
        {
            p.Encode4(dwCharacterID);
            p.EncodeFixedString(sCharacterName, 13);
            p.Encode1(nGender);
            p.Encode1(nSkin);
            p.Encode4(nFace);
            p.Encode4(nHair);

            for (int i = 0; i < aliPetLockerSN.Length; i++)
            {
                p.Encode8(aliPetLockerSN[i]);
            }

            p.Encode1(nLevel);
            p.Encode2(nJob);
            p.Encode2(nSTR);
            p.Encode2(nDEX);
            p.Encode2(nINT);
            p.Encode2(nLUK);
            p.Encode4(nHP);
            p.Encode4(nMHP);
            p.Encode4(nMP);
            p.Encode4(nMMP);
            p.Encode2(nAP);

            if (Constants.IsNotExtendedSp(nJob))
            {
                p.Encode2(nSP);
            }
            else
            {
                extendSP.Encode(p);
            }

            p.Encode4(nEXP);
            p.Encode2(nPOP);
            p.Encode4(nTempEXP); //Gachapon
            p.Encode4(dwPosMap);
            p.Encode1(nPortal);
            p.Encode4(nPlaytime);
            p.Encode2(nSubJob); //Here for dual blade?
        }
Beispiel #19
0
        //CharacterData::Decode
        public void Encode(COutPacket p)
        {
            //TODO: Clean this packet up and make it
            //cool with the flags at bottom of file
            const long dbcharFlag = -1; //DBCHAR_FLAGS.ALL

            p.Encode8(dbcharFlag);
            p.Encode1((byte)nCombatOrders);
            p.Encode1(0); //Some Loop.

            //if ((dbcharFlag & 1) > 0)
            //{
            Stats.Encode(p);             //addCharStats(mplew, chr);
            p.Encode1((byte)nFriendMax); //chr.getBuddylist().getCapacity()

            bool linkedChar = false;     //string.IsNullOrWhiteSpace(sLinkedCharacter);

            p.Encode1(linkedChar);

            if (linkedChar)
            {
                p.EncodeString(sLinkedCharacter);
            }
            //}

            //if ((dbcharFlag & 2) > 0)
            //{
            Stats.EncodeMoney(p);
            //}

            EncodeInventoryInfo(p);
            EncodeSkillInfo(p);
            EncodeQuestInfo(p);
            EncodeMiniGameInfo(p);
            EncodeRingInfo(p);
            EncodeTeleportInfo(p);
            EncodeMonsterBookInfo(p);
            EncodeNewYearInfo(p); // Short
            EncodeAreaInfo(p);    // Short
            p.Encode2(0);
            p.Encode2(0);         //m_mVisitorQuestLog
        }
Beispiel #20
0
        public void Encode(COutPacket p)
        {
            p.Encode4(nItemID);
            p.Encode4(nPrice);
            p.Encode1(nDiscountRate);
            p.Encode4(nTokenItemID);
            p.Encode4(nTokenPrice);
            p.Encode4(nItemPeriod);
            p.Encode4(nLevelLimited);

            if (ItemConstants.IsRechargeableItem(nItemID))
            {
                p.Encode8(dUnitPrice);
            }
            else
            {
                p.Encode2(nQuantity);
            }
            p.Encode2(nMaxPerSlot);
        }
Beispiel #21
0
        /// <summary>
        /// If char is in another channel, put channel id
        /// If char is in same channel, put map id
        /// </summary>
        private static COutPacket FindResult(string sName, FindResult nFindResult, int nFieldOrChannel = -1)
        {
            var p = new COutPacket(SendOps.LP_Whisper);

            p.Encode1(0x9); // todo enum
            p.EncodeString(sName);
            p.Encode1((byte)nFindResult);

            switch (nFindResult)
            {
            case Actions.FindResult.ITC:
            case Actions.FindResult.CS:
                p.Encode4(-1);
                break;

            case Actions.FindResult.DifferentChannel:

                if (nFieldOrChannel > 20)
                {
                    nFieldOrChannel = 0;
                }

                p.Encode4(nFieldOrChannel);
                break;

            case Actions.FindResult.SameChannel:
                p.Encode4(nFieldOrChannel);
                break;
            }

            if (nFindResult == Actions.FindResult.SameChannel)
            {
                p.Encode8(0); // idk
            }

            return(p);
        }
Beispiel #22
0
 public static void EncodeDateTime(this COutPacket packet, DateTime dt)
 {
     packet.Encode8(dt.ToFileTime());
 }
Beispiel #23
0
        private void EncodeInventoryInfo(COutPacket p)
        {
            p.Encode1(aInvEquip.SlotLimit);
            p.Encode1(aInvConsume.SlotLimit);
            p.Encode1(aInvInstall.SlotLimit);
            p.Encode1(aInvEtc.SlotLimit);
            p.Encode1(aInvCash.SlotLimit);

            p.Encode8(Constants.PERMANENT); //EQUIPEXTEXPIRE

            foreach (var i in aInvEquippedNormal)
            {
                p.Encode2(Math.Abs(i.Key));
                i.Value.RawEncode(p);
            }
            p.Encode2(0);

            foreach (var i in aInvEquippedCash)
            {
                p.Encode2(Math.Abs(i.Key));
                i.Value.RawEncode(p);
            }
            p.Encode2(0);

            foreach (var i in aInvEquip)
            {
                p.Encode2(Math.Abs(i.Key));
                i.Value.RawEncode(p);
            }
            p.Encode2(0);

            foreach (var i in aInvEquippedExt)
            {
                p.Encode2(Math.Abs(i.Key));
                i.Value.RawEncode(p);
            }
            p.Encode2(0);

            foreach (var i in aInvEquippedUnk)
            {
                p.Encode2(Math.Abs(i.Key));
                i.Value.RawEncode(p);
            }
            p.Encode2(0);

            foreach (var i in aInvConsume)
            {
                p.Encode1(i.Key);
                i.Value.RawEncode(p);
            }
            p.Encode1(0);

            foreach (var i in aInvInstall)
            {
                p.Encode1(i.Key);
                i.Value.RawEncode(p);
            }
            p.Encode1(0);

            foreach (var i in aInvEtc)
            {
                p.Encode1(i.Key);
                i.Value.RawEncode(p);
            }
            p.Encode1(0);

            foreach (var i in aInvCash)
            {
                p.Encode1(i.Key);
                i.Value.RawEncode(p);
            }
            p.Encode1(0);
        }
Beispiel #24
0
        // --------------------------------------------------- packet stuff


        public COutPacket GetMiniRoomPacket(Character c)
        {
            var p = new COutPacket(SendOps.LP_MiniRoom);

            // CMiniRoomBaseDlg::OnPacketBase
            p.Encode1((byte)MR_Action.MRP_EnterResult);

            // CMiniRoomBaseDlg::OnEnterResultStatic
            p.Encode1((byte)nMiniRoomType); // nMiniRoomType

            // CMiniRoomBaseDlg::OnEnterResultBase
            p.Encode1(nMaxUsers);

            var nIndex = GetVisitorIndex(c.dwId);

            Log.Debug("Index: " + nIndex);

            p.Encode2(nIndex);

            p.Encode4(nTemplateId);
            p.EncodeString(sTitle);

            for (int i = 0; i < nMaxUsers; i++)
            {
                var pVisitor = MasterManager.CharacterPool.Get(aCurVisitors[i]);

                Log.Debug("ID: " + aCurVisitors[i]);

                if (pVisitor is object)
                {
                    EncodeAvatar(p, pVisitor, (byte)(i + 1));
                    Log.Debug("visitor is object");
                }
            }

            // CEntrustedShopDlg::OnEnterResult

            p.Encode1(0xFF); // indicates visitorlist is over

            Parent.SendMessage($"{OwnerID} : {c.dwId}");

            if (OwnerID == c.dwId) // send history if person entering is owner, otherwise no chat history
            {
                p.Encode2((short)aChatText.Count);
                foreach (var(key, value) in aChatText)
                {
                    p.EncodeString(key); // message
                    p.Encode1(value);    // slot
                }
            }
            else
            {
                p.Encode2(0);
            }

            p.EncodeString(OwnerName);

            if (OwnerID == c.dwId)
            {
                p.Encode4(24 * 60 * 60); // time left seconds
                p.Encode1(FirstTime);

                EncodeSoldItemList(p);

                p.Encode8(Parent.Stats.MerchantMesos);
            }

            //////// --->

            p.EncodeString(sTitle);
            p.Encode1(nItemMaxCount);
            p.Encode4(c.Stats.nMoney);

            EncodeItems(p);
            return(p);
        }