Beispiel #1
0
        internal static void Initalize()
        {
            PlayerGuid        = StyxWoW.Me.Guid;
            IsAlliance        = StyxWoW.Me.IsAlliance;
            Level             = StyxWoW.Me.Level;
            Location          = StyxWoW.Me.Location;
            Rotation          = StyxWoW.Me.Rotation;
            Class             = StyxWoW.Me.Class;
            CurrentTargetGuid = StyxWoW.Me.CurrentTargetGuid;
            Combat            = StyxWoW.Me.Combat;
            ActuallyInCombat  = StyxWoW.Me.IsActuallyInCombat;
            TraceLinePosition = StyxWoW.Me.GetTraceLinePos();
            Inventory         = new PlayerInventory();
            Professions       = new PlayerProfessions();

            MinimapZoneText = new CachedValue <string>(() => StyxWoW.Me.MinimapZoneText);
            MapId           = new CachedValue <uint>(() => StyxWoW.Me.CurrentMap.MapId);
            ParentMapId     = new CachedValue <int>(() => StyxWoW.Me.CurrentMap.ParentMapId);
            MapExpansionId  = new CachedValue <uint>(() => StyxWoW.Me.CurrentMap.ExpansionId);
            MapIsContinent  = new CachedValue <bool>(() => StyxWoW.Me.CurrentMap.IsContinent);
            ZoneId          = new CachedValue <uint>(() => StyxWoW.Me.ZoneId);
            //
            GarrisonResource            = new CachedValue <int>(() => LuaCommands.GetCurrencyCount(824));
            CurrentPendingCursorSpellId = new CachedValue <int>(_updateCurrentPendingCursorSpellId);
            LastErrorMessage            = new CachedValue <string>(GetLastErrorMessage);

            LuaEvents.OnZoneChangedNewArea += () =>
            {
                MapId.Reset();
                ParentMapId.Reset();
                MapExpansionId.Reset();
                MapIsContinent.Reset();
                MinimapZoneText.Reset();
                ZoneId.Reset();
            };

            LuaEvents.OnZoneChanged             += () => MinimapZoneText.Reset();
            LuaEvents.OnCurrencyDisplayUpdate   += () => GarrisonResource.Reset();
            LuaEvents.OnCurrentSpellCastChanged += () => CurrentPendingCursorSpellId.Reset();
            LuaEvents.OnUiErrorMessage          += () => LastErrorMessage.Reset();

            Update();
        }