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 void AddGameObjectEntity(gameobject gameObject) { var guid = new ObjectGUID((ulong)gameObject.guid, TypeID.TYPEID_GAMEOBJECT); var template = vanillaWorld.WorldDatabase.GetRepository<gameobject_template>().SingleOrDefault(t => t.entry == gameObject.id); var gameObjectEntity = new GameObjectEntity(guid, gameObject, template); GameObjectEntities.Add(gameObjectEntity); gameObjectEntity.Setup(); }