Пример #1
0
        public static void Encode(this ItemSlotPet i, IPacket p)
        {
            p.Encode <byte>(3);

            i.EncodeBase(p);

            p.EncodeFixedString(i.PetName, 13);
            p.Encode <byte>(i.Level);
            p.Encode <short>(i.Tameness);
            p.Encode <byte>(i.Repleteness);

            if (i.DateDead == null)
            {
                p.Encode <long>(0);
            }
            else
            {
                p.Encode <DateTime>(i.DateDead.Value);
            }

            p.Encode <short>(i.PetAttribute);
            p.Encode <short>(i.PetSkill);
            p.Encode <int>(i.RemainLife);
            p.Encode <short>(i.Attribute);
        }
Пример #2
0
        public static void Encode(this PartyData data, IPacket p)
        {
            var members = new PartyMemberData[6];

            for (var i = 0; i < 6; i++)
            {
                members[i] = i < data.Members.Count
                    ? data.Members[i]
                    : new PartyMemberData();
            }

            foreach (var member in members)
            {
                p.Encode <int>(member.CharacterID);
            }
            foreach (var member in members)
            {
                p.EncodeFixedString(member.Name, 13);
            }
            foreach (var member in members)
            {
                p.Encode <int>(member.Job);
            }
            foreach (var member in members)
            {
                p.Encode <int>(member.Level);
            }
            foreach (var member in members)
            {
                p.Encode <int>(member.ChannelID);
            }

            p.Encode <int>(data.BossCharacterID);

            foreach (var member in members)
            {
                p.Encode <int>(member.FieldID);
            }

            // TODO: town portal
            foreach (var member in members)
            {
                p.Encode <int>(999999999); // m_dwTownID
                p.Encode <int>(999999999); // m_dwFieldID
                p.Encode <int>(0);         // m_nSKillID
                p.Encode <int>(0);         // m_ptFieldPortal x
                p.Encode <int>(0);         // m_ptFieldPortal y
            }

            foreach (var member in members)
            {
                p.Encode <int>(0); // aPQReward
            }
            foreach (var member in members)
            {
                p.Encode <int>(0); // aPQRewardType
            }
            p.Encode <int>(0);     // dwPQRewardMobTemplateID
            p.Encode <int>(0);     // bPQReward
        }
Пример #3
0
 public static void Encode(this CoupleRecord c, IPacket p)
 {
     p.Encode <int>(c.PairCharacterID);
     p.EncodeFixedString(c.PairCharacterName, 13);
     p.Encode <long>(c.SN);
     p.Encode <long>(c.PairSN);
 }
Пример #4
0
 public static void Encode(this FriendRecord f, IPacket p)
 {
     p.Encode <int>(f.PairCharacterID);
     p.EncodeFixedString(f.PairCharacterName, 13);
     p.Encode <long>(f.SN);
     p.Encode <long>(f.PairSN);
     p.Encode <int>(f.FriendItemID);
 }
Пример #5
0
 public static void EncodeLocker(this ItemSlot i, IPacket p)
 {
     p.Encode <long>(i.CashItemSN ?? 0);
     p.Encode <int>(0);
     p.Encode <int>(0);
     p.Encode <int>(i.TemplateID);
     p.Encode <int>(0);
     p.Encode <short>((short)(i is ItemSlotBundle bundle
         ? bundle.Number
         : 1));
     p.EncodeFixedString(string.Empty, 13);
     p.Encode <DateTime>((i is ItemSlotPet pet
                            ? pet.DateDead
                            : i.DateExpire
                          ) ?? ItemConstants.Permanent);
     p.Encode <int>(0);
     p.Encode <int>(0);
 }
Пример #6
0
 public static void Encode(this ItemLockerSlot i, IPacket p)
 {
     p.Encode <long>(i.Item.CashItemSN ?? 0);
     p.Encode <int>(i.AccountID);
     p.Encode <int>(i.CharacterID);
     p.Encode <int>(i.Item.TemplateID);
     p.Encode <int>(i.CommodityID);
     p.Encode <short>((short)(i.Item is ItemSlotBundle bundle
         ? bundle.Number
         : 1));
     p.EncodeFixedString(i.BuyCharacterName, 13);
     p.Encode <DateTime>((i.Item is ItemSlotPet pet
                            ? pet.DateDead
                            : i.Item.DateExpire
                          ) ?? ItemConstants.Permanent);
     p.Encode <int>(i.PaybackRate);
     p.Encode <int>(i.DiscountRate);
 }
Пример #7
0
        public static void EncodeStats(this Character c, IPacket p)
        {
            p.Encode <int>(c.ID);
            p.EncodeFixedString(c.Name, 13);

            p.Encode <byte>(c.Gender);
            p.Encode <byte>(c.Skin);
            p.Encode <int>(c.Face);
            p.Encode <int>(c.Hair);

            for (var i = 0; i < 3; i++)
            {
                p.Encode <long>(0); // Pet stuff.
            }
            p.Encode <byte>(c.Level);
            p.Encode(c.Job);
            p.Encode <short>(c.STR);
            p.Encode <short>(c.DEX);
            p.Encode <short>(c.INT);
            p.Encode <short>(c.LUK);
            p.Encode <int>(c.HP);
            p.Encode <int>(c.MaxHP);
            p.Encode <int>(c.MP);
            p.Encode <int>(c.MaxMP);

            p.Encode <short>(c.AP);
            if (c.Job / 1000 != 3 && c.Job / 100 != 22 && c.Job != 2001)
            {
                p.Encode <short>(c.SP);
            }
            else
            {
                p.Encode <byte>(0); // TODO: extendedSP
            }
            p.Encode <int>(c.EXP);
            p.Encode <short>(c.POP);

            p.Encode <int>(c.TempEXP);
            p.Encode <int>(c.FieldID);
            p.Encode <byte>(c.FieldPortal);
            p.Encode <int>(c.PlayTime);
            p.Encode <short>(c.SubJob);
        }
Пример #8
0
        public static void EncodeStats(this Character c, IPacket p)
        {
            p.Encode <int>(c.ID);
            p.EncodeFixedString(c.Name, 13);

            p.Encode <byte>(c.Gender);
            p.Encode <byte>(c.Skin);
            p.Encode <int>(c.Face);
            p.Encode <int>(c.Hair);

            c.Pets.ForEach(sn => p.Encode <long>(sn));

            p.Encode <byte>(c.Level);
            p.Encode(c.Job);
            p.Encode <short>(c.STR);
            p.Encode <short>(c.DEX);
            p.Encode <short>(c.INT);
            p.Encode <short>(c.LUK);
            p.Encode <int>(c.HP);
            p.Encode <int>(c.MaxHP);
            p.Encode <int>(c.MP);
            p.Encode <int>(c.MaxMP);

            p.Encode <short>(c.AP);
            if (SkillConstants.IsExtendSPJob(c.Job))
            {
                c.EncodeExtendSP(p);
            }
            else
            {
                p.Encode <short>(c.SP);
            }

            p.Encode <int>(c.EXP);
            p.Encode <short>(c.POP);

            p.Encode <int>(c.TempEXP);
            p.Encode <int>(c.FieldID);
            p.Encode <byte>(c.FieldPortal);
            p.Encode <int>(c.PlayTime);
            p.Encode <short>(c.SubJob);
        }