Example #1
0
        /*
         * /// <summary>
         * /// Wraps a mob to place in packet 42
         * /// for adding to screen
         * /// </summary>
         * /// <param name="mob"></param>
         * /// <returns></returns>
         * public static byte[] WrappedMob(Mobile mob)
         * {
         *  PacketWriter e = new PacketWriter();
         *
         *  // if(mob is NPC) e.WriteBytes(mob.Serialize());
         *
         *  //else
         *  e.WriteBytes(mob.AppearInRoom());
         *
         *  byte[] ew = e.GetRawPacket();
         *  PacketWriter wrap = new PacketWriter();
         *  wrap.WriteShort((short)ew.Length);
         *  wrap.WriteUInt32(mob.GameID);
         *  wrap.WriteBytes(ew);
         *  return wrap.GetRawPacket();
         * }
         */
        /// <summary>
        /// Wraps a mob to place in packet 42
        /// for adding to screen
        /// </summary>
        /// <param name="mob"></param>
        /// <returns></returns>
        public static byte[] WrappedMob(Mobile mob)
        {
            PacketWriter e = new PacketWriter();

            if (mob is NPC)
            {
                NPC n = mob as NPC;
                e.WriteBytes(n.Serialize());
            }

            else
            {
                e.WriteBytes(mob.AppearInRoom());
            }

            byte[]       ew   = e.GetRawPacket();
            PacketWriter wrap = new PacketWriter();

            wrap.WriteShort((short)ew.Length);
            wrap.WriteUInt32(mob.GameID);
            wrap.WriteBytes(ew);
            return(wrap.GetRawPacket());
        }