Exemple #1
0
        private static void WriteItemPetData(this IPacketWriter p, ItemSlotPet i)
        {
            p.WriteByte(3);

            p.WriteItemBase(i);

            p.WriteString(i.PetName, 13);
            p.WriteByte(i.Level);
            p.WriteShort(i.Tameness);
            p.WriteByte(i.Repleteness);

            if (i.DateDead == null)
            {
                p.WriteLong(0);
            }
            else
            {
                p.WriteDateTime(i.DateDead.Value);
            }

            p.WriteShort(i.PetAttribute);
            p.WriteShort(i.PetSkill);
            p.WriteInt(i.RemainLife);
            p.WriteShort(i.Attribute);
        }
        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);
        }
Exemple #3
0
        public FieldUserPet(IFieldUser owner, ItemSlotPet item, byte idx)
        {
            Owner = owner;
            Item  = item;
            IDx   = idx;

            Field    = owner.Field;
            Position = owner.Position;
            Foothold = owner.Foothold;
        }
        private static ItemSlotPet ToItemSlot(this PetItemTemplate template)
        {
            var i = new ItemSlotPet
            {
                TemplateID = template.ID
            };

            if (template.Life > 0)
            {
                i.DateDead = DateTime.Now.AddDays(template.Life);
            }

            return(i);
        }