Пример #1
0
        /// <inheritdoc />
        public void Serialize(INetPacketStream packet)
        {
            foreach (int itemIndex in _itemsMask)
            {
                packet.Write(itemIndex);
            }

            packet.Write((byte)_items.Count(x => x != null));

            for (int i = 0; i < MaxCapacity; i++)
            {
                Item item = _items.ElementAt(i);

                if (item != null)
                {
                    packet.Write((byte)i);
                    item.Serialize(packet);
                }
            }

            for (int i = 0; i < MaxCapacity; i++)
            {
                packet.Write(_items[i]?.Slot ?? -1);
            }
        }
Пример #2
0
 public void Serialize(INetPacketStream packet)
 {
     packet.Write(Count);
     for (int level = 0; level < TaskbarSystem.MaxTaskbarItemLevels; level++)
     {
         for (int slot = 0; slot < TaskbarSystem.MaxTaskbarItems; slot++)
         {
             if (Shortcuts[level][slot] != null && Shortcuts[level][slot].Type != ShortcutType.None)
             {
                 packet.Write(level);
                 Shortcuts[level][slot].Serialize(packet);
             }
         }
     }
 }
Пример #3
0
        /// <inheritdoc />
        public override void Serialize(INetPacketStream packet)
        {
            packet.Write(Count);

            for (int level = 0; level < MaxCapacity; level++)
            {
                for (int slot = 0; slot < MaxLevelCapacity; slot++)
                {
                    if (Objects[level][slot] != null && Objects[level][slot].Type != ShortcutType.None)
                    {
                        packet.Write(level);
                        Objects[level][slot].Serialize(packet);
                    }
                }
            }
        }
Пример #4
0
        /// <inheritdoc />
        public void Serialize(INetPacketStream packet)
        {
            int skillCount      = Skills.Count();
            int otherSkillCount = (int)DefineJob.JobMax.MAX_SKILLS - skillCount;

            for (int i = 0; i < skillCount; i++)
            {
                Skills.ElementAt(i).Serialize(packet);
            }

            for (int i = 0; i < otherSkillCount; i++)
            {
                packet.Write(-1);
                packet.Write(0);
            }
        }
Пример #5
0
 public void Serialize(INetPacketStream packet)
 {
     Applets.Serialize(packet);
     Items.Serialize(packet);
     Queue.Serialize(packet);
     packet.Write(ActionPoints);
 }
 public void Serialize(INetPacketStream packet)
 {
     packet.Write(Count);
     for (int i = 0; i < MaxCapacity; i++)
     {
         if (Shortcuts[i] != null && Shortcuts[i].Type != ShortcutType.None)
         {
             Shortcuts[i].Serialize(packet);
         }
     }
 }
Пример #7
0
        /// <summary>
        /// Serialize the quest diary.
        /// </summary>
        /// <param name="packet">Packet stream.</param>
        public void Serialize(INetPacketStream packet)
        {
            packet.Write((byte)ActiveQuests.Count());
            foreach (QuestInfo quest in ActiveQuests)
            {
                quest.Serialize(packet);
            }

            packet.Write((byte)CompletedQuests.Count());
            foreach (QuestInfo quest in CompletedQuests)
            {
                packet.Write((short)quest.QuestId);
            }

            packet.Write((byte)CheckedQuests.Count());
            foreach (QuestInfo quest in CheckedQuests)
            {
                packet.Write((short)quest.QuestId);
            }
        }
Пример #8
0
        public void Serialize(INetPacketStream packet)
        {
            packet.Write <short>((short)State); // state
            packet.Write <short>(0);            // time limit
            packet.Write((short)QuestId);

            packet.Write <short>(Monsters?.ElementAtOrDefault(0).Value ?? 0); // monster 1 killed
            packet.Write <short>(Monsters?.ElementAtOrDefault(1).Value ?? 0); // monster 2 killed
            packet.Write <byte>(Convert.ToByte(IsPatrolDone));                // patrol done
            packet.Write <byte>(0);                                           // dialog done
        }
Пример #9
0
        public void Serialize(INetPacketStream packet)
        {
            packet.Write(SlotIndex);
            packet.Write((uint)Type);
            packet.Write(ObjectId);
            packet.Write((uint)ObjectType);
            packet.Write(ObjectIndex);
            packet.Write(UserId);
            packet.Write(ObjectData);

            if (Type == ShortcutType.Chat)
            {
                packet.Write(Text);
            }
        }
 public NetServerClientTests()
 {
     _randomizer          = new Randomizer((int)DateTime.UtcNow.Ticks);
     _serverConfiguration = new NetServerConfiguration("127.0.0.1", 4444);
     _serverMock          = new NetServerMock <CustomClient>(_serverConfiguration);
     _customClient        = new CustomClient(null)
     {
         Server = _serverMock.Object
     };
     _otherClient       = new CustomClient(null);
     _customClientsList = Enumerable.Repeat(new CustomClient(null), _randomizer.Byte());
     _packet            = new NetPacket();
     _packet.Write(_randomizer.String(_randomizer.Byte()));
 }
Пример #11
0
 /// <summary>
 /// Serialize the item into the packet.
 /// </summary>
 /// <param name="packet"></param>
 public void Serialize(INetPacketStream packet)
 {
     packet.Write(UniqueId);
     packet.Write(Id);
     packet.Write(0); // Serial number
     packet.Write(Data?.Name.TakeCharacters(32) ?? "[undefined]");
     packet.Write((short)Quantity);
     packet.Write <byte>(0); // Repair number
     packet.Write(0);        // Hp
     packet.Write(0);        // Repair
     packet.Write <byte>(0); // flag ?
     packet.Write((int)Refine);
     packet.Write(0);        // guild id (cloaks?)
     packet.Write((byte)Element);
     packet.Write((int)ElementRefine);
     packet.Write(0);        // m_nResistSMItemId
     packet.Write(0);        // Piercing size
     packet.Write(0);        // Ultimate piercing size
     packet.Write(0);        // Pet vis
     packet.Write(0);        // charged
     packet.Write <long>(0); // m_iRandomOptItemId
     packet.Write(0);        // m_dwKeepTime
     packet.Write <byte>(0); // pet
     packet.Write(0);        // m_bTranformVisPet
 }
Пример #12
0
        /// <summary>
        /// Serializes the party to the packet.
        /// </summary>
        /// <param name="packet"></param>
        public void Serialize(INetPacketStream packet)
        {
            packet.Write(Members.Count);

            packet.Write(Id);
            packet.Write(Convert.ToInt32(IsAdvanced));
            packet.Write(Members.Count);
            packet.Write(Level);
            packet.Write(Experience);
            packet.Write(Points);
            packet.Write((int)ExperienceShareMode);
            packet.Write((int)ItemShareMode);
            packet.Write(0);            // id Duell party?

            for (int i = 0; i < 5; i++) // i < MAX_PARTYMODE wtf?
            {
                packet.Write(0);        // m_nModeTime[i]
            }
            if (IsAdvanced)
            {
                packet.Write(Name);
            }

            foreach (var member in Members)
            {
                packet.Write(member.PlayerData.Id);
                packet.Write(0); // bRemove
            }
        }
Пример #13
0
 /// <inheritdoc />
 public void Serialize(INetPacketStream packet)
 {
     packet.Write(SkillId);
     packet.Write(Level);
 }
Пример #14
0
        /// <summary>
        /// Serialize the item into the packet.
        /// </summary>
        /// <param name="packet"></param>
        public void Serialize(INetPacketStream packet)
        {
            packet.Write(this.UniqueId);
            packet.Write(this.Id);

            packet.Write(0); // Serial number

            if (this.Data != null)
            {
                packet.Write(this.Data.Name.Substring(0, this.Data.Name.Length > 31 ? 31 : this.Data.Name.Length));
            }
            else
            {
                packet.Write("Unknown");
            }

            packet.Write((short)this.Quantity);
            packet.Write <byte>(0); // Repair number
            packet.Write(0);        // Hp
            packet.Write(0);        // Repair
            packet.Write <byte>(0); // flag ?
            packet.Write((int)this.Refine);
            packet.Write(0);        // guild id (cloaks?)
            packet.Write(this.Element);
            packet.Write((int)this.ElementRefine);
            packet.Write(0);        // m_nResistSMItemId
            packet.Write(0);        // Piercing size
            packet.Write(0);        // Ultimate piercing size
            packet.Write(0);        // Pet vis
            packet.Write(0);        // charged
            packet.Write <long>(0); // m_iRandomOptItemId
            packet.Write(0);        // m_dwKeepTime
            packet.Write <byte>(0); // pet
            packet.Write(0);        // m_bTranformVisPet
        }