Exemplo n.º 1
0
        /// <summary>
        /// Serializes an object that implements ICommander and places it into the packet.
        /// </summary>
        /// <param name="packet"></param>
        /// <param name="commander"></param>
        public static void AddCommander(this Packet packet, ICommander commander)
        {
            packet.PutInt(commander.Handle);
            packet.PutInt(0);
            packet.AddAppearancePc(commander);
            packet.PutFloat(commander.Position.X);
            packet.PutFloat(commander.Position.Y);
            packet.PutFloat(commander.Position.Z);
            packet.PutInt(commander.Exp);
            packet.PutInt(commander.MaxExp);
            packet.PutInt(commander.TotalExp);

            packet.PutLong(commander.Id);

            // TODO: Assign new IDs to characters such that the social ID does not conflict.
            packet.PutLong(commander.Id + 1);               // SocialInfoId

            packet.PutInt(commander.Hp);
            packet.PutInt(commander.MaxHp);
            packet.PutShort(commander.Sp);
            packet.PutShort(commander.MaxSp);
            packet.PutInt(commander.Stamina);
            packet.PutInt(commander.MaxStamina);
            packet.PutShort(0);             // Shield
            packet.PutShort(0);             // MaxShield
        }
Exemplo n.º 2
0
        public static void AddAppearanceBarrackPc(this Packet packet, IAppearanceBarrackPc pc)
        {
            packet.AddAppearancePc(pc);
            packet.PutLong(pc.Id);

            // [i11025 (2016-02-26)]
            // Index was previously stored as a short, now there seem
            // to be two byte, with the first being the index.
            {
                packet.PutByte(pc.Index);
                packet.PutByte(181);
            }

            packet.PutShort(pc.MapId);
            packet.PutShort(pc.Channel);
            packet.PutShort(0);
            packet.PutInt(0);
            packet.PutInt(0);             // maxXP
            packet.PutInt(0);             // currentExp
            packet.PutInt(0);
            packet.PutInt(0);

            // Position?
            packet.PutFloat(pc.BarrackPosition.X);
            packet.PutFloat(pc.BarrackPosition.Y);
            packet.PutFloat(pc.BarrackPosition.Z);
            packet.PutFloat(0);             // Vector direction
            packet.PutFloat(0);             // Vector direction

            // ?
            packet.PutFloat(pc.BarrackPosition.X);
            packet.PutFloat(pc.BarrackPosition.Y);
            packet.PutFloat(pc.BarrackPosition.Z);
            packet.PutFloat(0);             // Vector direction
            packet.PutFloat(0);             // Vector direction

            packet.PutInt(0);
        }