Esempio n. 1
0
        public GameObjectInfo(ObjectGUID guid, gameobject gameObject, gameobject_template template)
            : base(guid)
        {
            DisplayID = template.displayId;
            Flags = (int)template.flags;
            TypeID = template.type;
            State = gameObject.state;
            X = gameObject.position_x;
            Y = gameObject.position_y;
            Z = gameObject.position_z;
            Rotation0 = gameObject.rotation0;
            Rotation1 = gameObject.rotation1;
            Orientation = gameObject.orientation;

            if (gameObject.rotation2 == 0 && gameObject.rotation3 == 0)
            {
                gameObject.rotation2 = (float)Math.Sin(gameObject.orientation / 2);
                gameObject.rotation3 = (float)Math.Cos(gameObject.orientation / 2);
            }

            Rotation2 = gameObject.rotation2;
            Rotation3 = gameObject.rotation3;

            Type |= (int)TypeMask.TYPEMASK_GAMEOBJECT;
        }
        public PSGameObjectQueryResponse(gameobject_template gameObjectTemplate)
            : base(WorldOpcodes.SMSG_GAMEOBJECT_QUERY_RESPONSE)
        {
            this.Write((uint)gameObjectTemplate.entry);
            this.Write((uint)gameObjectTemplate.type);
            this.Write((uint)gameObjectTemplate.displayId);
            this.Write(Encoding.UTF8.GetBytes(gameObjectTemplate.name));
            this.Write((ushort)0);
            this.Write((byte)0);
            this.Write((byte)0);

            // 24 byte clear
            this.Write((short)0);
        }