コード例 #1
0
        public override bool Initialise()
        {
            Force = true;
            GetComponentMethod = typeof(Entity).GetMethod("GetComponent");

            try
            {
                InitObjects();
            }
            catch (Exception e)
            {
                LogError($"{e}");
            }

            ColorSwaper = new TimeCache <Color>(() =>
            {
                return(Color.Yellow);
            }, 25);

            Input.RegisterKey(Settings.ToggleWindowKey);
            Input.RegisterKey(Settings.DebugHoverItem);
            Settings.DebugHoverItem.OnValueChanged  += () => { Input.RegisterKey(Settings.DebugHoverItem); };
            Settings.ToggleWindowKey.OnValueChanged += () => { Input.RegisterKey(Settings.ToggleWindowKey); };
            Name = "Dev Tree";
            return(true);
        }
コード例 #2
0
        public TheGame(IMemory m, Cache cache)
        {
            pM               = m;
            pCache           = cache;
            pTheGame         = this;
            Instance         = this;
            Address          = m.Read <long>(m.BaseOffsets[OffsetsName.GameStateOffset] + m.AddressOfProcess);
            _AreaChangeCount = new TimeCache <int>(() => M.Read <int>(M.AddressOfProcess + M.BaseOffsets[OffsetsName.AreaChangeCount]), 50);

            AllGameStates = ReadHashMap(Address + 0x48);

            PreGameStatePtr         = AllGameStates["PreGameState"].Address;
            LoginStatePtr           = AllGameStates["LoginState"].Address;
            SelectCharacterStatePtr = AllGameStates["SelectCharacterState"].Address;
            WaitingStatePtr         = AllGameStates["WaitingState"].Address;
            InGameStatePtr          = AllGameStates["InGameState"].Address;
            LoadingStatePtr         = AllGameStates["LoadingState"].Address;
            EscapeStatePtr          = AllGameStates["EscapeState"].Address;
            LoadingState            = AllGameStates["AreaLoadingState"].AsObject <AreaLoadingState>();
            IngameState             = AllGameStates["InGameState"].AsObject <IngameState>();
            _inGame = new FrameCache <bool>(
                () => IngameState.Address != 0 && IngameState.Data.Address != 0 && IngameState.ServerData.Address != 0 && !IsLoading /*&&
                                                                                                                                      * IngameState.ServerData.IsInGame*/);

            Files = new FilesContainer(m);

            var IngameStateOffsetsNameOf = new IngameStateOffsets();
            var IngameDataOffsetsNameOf  = new IngameDataOffsets();

            DataOff            = Extensions.GetOffset <IngameStateOffsets>(nameof(IngameStateOffsetsNameOf.Data));
            CurrentAreaHashOff = Extensions.GetOffset <IngameDataOffsets>(nameof(IngameDataOffsetsNameOf.CurrentAreaHash));
        }
コード例 #3
0
ファイル: VotingRepository.cs プロジェクト: yepeek/tzkt
 public VotingRepository(StateCache state, TimeCache time, AccountsCache accounts, ProposalMetadataService proposalMetadata, IConfiguration config) : base(config)
 {
     State            = state;
     Time             = time;
     Accounts         = accounts;
     ProposalMetadata = proposalMetadata;
 }
コード例 #4
0
        public override bool Initialise()
        {
            Force = true;
            GetComponentMethod = typeof(Entity).GetMethod("GetComponent");

            try
            {
                InitObjects();
            }
            catch (Exception e)
            {
                LogError($"{e}");
            }

            ColorSwaper = new TimeCache <Color>(() =>
            {
                return(Color.Yellow);

                return(new Color(_rnd.Next(255), _rnd.Next(255), _rnd.Next(255), 255));

                ;
            }, 25);

            Input.RegisterKey(Settings.ToggleWindowKey);
            Name = "Dev Tree";
            return(true);
        }
コード例 #5
0
 public BalanceHistoryRepository(StateCache state, AccountsCache accounts, QuotesCache quotes, TimeCache time, IConfiguration config) : base(config)
 {
     State    = state;
     Accounts = accounts;
     Quotes   = quotes;
     Time     = time;
 }
コード例 #6
0
 public BakingRightsRepository(AccountsCache accounts, ProtocolsCache protocols, TimeCache time, StateCache state, IConfiguration config) : base(config)
 {
     Accounts  = accounts;
     Protocols = protocols;
     Time      = time;
     State     = state;
 }
コード例 #7
0
 public override void OnLoad()
 {
     mySummons = new TimeCache <IEnumerable <Entity> >(UpdateDeployedObjects, 125);
     chatUi    = new TimeCache <Element>(UpdateChatUi, 3000);
     Core.MainRunner.Run(new Coroutine(MainCoroutine(), this, "DankPact1"));
     base.OnLoad();
 }
コード例 #8
0
ファイル: HealthBar.cs プロジェクト: snowhawk04/HealthBars
        public HealthBar(Entity entity, HealthBarsSettings settings)
        {
            Entity    = entity;
            _distance = new TimeCache <float>(() => entity.DistancePlayer, 200);

            // If ignored entity found, skip
            foreach (var _entity in IgnoreEntitiesList)
            {
                if (entity.Path.Contains(_entity))
                {
                    return;
                }
            }

            Update(entity, settings);

            //CanNotDie = entity.GetComponent<Stats>().StatDictionary.ContainsKey(GameStat.CannotDie);
            CanNotDie = entity.Path.StartsWith("Metadata/Monsters/Totems/Labyrinth");

            if (entity.HasComponent <ObjectMagicProperties>() && entity.GetComponent <ObjectMagicProperties>().Mods.Contains("MonsterConvertsOnDeath_"))
            {
                OnHostileChange = () =>
                {
                    if (_init)
                    {
                        Update(Entity, settings);
                    }
                };
            }
        }
コード例 #9
0
ファイル: Enemies.cs プロジェクト: bjornwilliam/ExileApi
 public Enemies(GameController GameController)
 {
     this.GameController    = GameController;
     this._killableMonsters = new TimeCache <List <Entity> >(GetKillableMonsters, 200);
     this._uniqueMonsters   = new TimeCache <List <Entity> >(GetUniqueMonsters, 280);
     this._nearbyMonsters   = new TimeCache <List <Entity> >(GetNearbyMonsters, 180);
     this._nearbyCorpses    = new TimeCache <List <Entity> >(GetNearbyCorpses, 300);
 }
コード例 #10
0
        public override bool Initialise()
        {
            Input.RegisterKey(Keys.F10);

            Input.ReleaseKey += (sender, keys) =>
            {
                if (keys == Keys.F10)
                {
                    Settings.Enable.Value = !Settings.Enable;
                }
            };

            GameController.LeftPanel.WantUse(() => Settings.Enable);
            CalcXp = new TimeCache <bool>(() =>
            {
                partytime += time;
                time       = 0;
                CalculateXp();
                var areaCurrentArea = GameController.Area.CurrentArea;

                if (areaCurrentArea == null)
                {
                    return(false);
                }

                timeSpan = DateTime.UtcNow - areaCurrentArea.TimeEntered;

                // Time = $"{timeSpan.TotalMinutes:00}:{timeSpan.Seconds:00}";
                Time            = AreaInstance.GetTimeString(timeSpan);
                xpReceivingText = $"{xpRate}  *{levelXpPenalty * partyXpPenalty:p0}";

                xpGetLeft =
                    $"Got: {ConvertHelper.ToShorten(getXp, "0.00")} ({percentGot:P3})  Left: {ConvertHelper.ToShorten(xpLeftQ, "0.00")}";

                maxX = MathHepler.Max(Graphics.MeasureText(fps).X, Graphics.MeasureText(ping).X, Graphics.MeasureText(latency).X,
                                      Graphics.MeasureText(areaName).X, Graphics.MeasureText(xpReceivingText).X) * 1.5f;

                if (partytime > 4900)
                {
                    var levelPenaltyValue = LevelPenalty.Value;
                }

                return(true);
            }, 1000);

            LevelPenalty = new TimeCache <bool>(() =>
            {
                partyXpPenalty = PartyXpPenalty();
                levelXpPenalty = LevelXpPenalty();
                return(true);
            }, 5000);

            GameController.EntityListWrapper.PlayerUpdate += OnEntityListWrapperOnPlayerUpdate;
            OnEntityListWrapperOnPlayerUpdate(this, GameController.Player);

            debugInformation = new DebugInformation("Game FPS", "Collect game fps", false);
            return(true);
        }
コード例 #11
0
 public SyncWorker(AccountsCache accounts, StateCache state, TimeCache times, IConfiguration config, ILogger <SyncWorker> logger)
 {
     Config           = config.GetSyncConfig();
     ConnectionString = config.GetConnectionString("DefaultConnection");
     Accounts         = accounts;
     State            = state;
     Times            = times;
     Logger           = logger;
 }
コード例 #12
0
 public override void OnLoad()
 {
     Input.RegisterKey(Keys.LControlKey);
     Settings.UpdateInterval.OnValueChanged += (sender, i) =>
     {
         _cachedValue.NewTime(i);
     };
     _cachedValue = new TimeCache <bool>(SkillDPSLogic, Settings.UpdateInterval);
 }
コード例 #13
0
 public override void OnLoad()
 {
     VaalDActorVaalSkill     = new TimeCache <ActorVaalSkill>(UpdateVaalD, 5000);
     VmsActorVaalSkill       = new TimeCache <ActorVaalSkill>(UpdateVms, 5000);
     VaalHasteActorVaalSkill = new TimeCache <ActorVaalSkill>(UpdateVaalHaste, 5000);
     VaalGraceActorVaalSkill = new TimeCache <ActorVaalSkill>(UpdateVaalGrace, 5000);
     PlayerLifeComponent     = new TimeCache <Life>(UpdateLifeComponent, 66);
     PlayerBuffsComponent    = new TimeCache <Buffs>(UpdateBuffsComponent, 66);
     chatUi = new TimeCache <Element>(GetChatUi, 5000);
     Core.MainRunner.Run(new Coroutine(MainCoroutine(), this, "VmsHelperMain"));
     base.OnLoad();
 }
コード例 #14
0
ファイル: HealthBar.cs プロジェクト: IlliumIv/HealthBars
        public HealthBar(Entity entity, HealthBarsSettings settings)
        {
            if (entity == null)
            {
                return;
            }

            Entity    = entity;
            _distance = new TimeCache <float>(() => entity.DistancePlayer, 200);

            // If ignored entity found, skip
            foreach (var _entity in IgnoreEntitiesList)
            {
                if (entity.Path.Contains(_entity))
                {
                    return;
                }
            }

            if (Entity.Path.StartsWith("Metadata/Monsters/AtlasExiles/BasiliskInfluenceMonsters/BasiliskBurrowingViper") &&
                (Entity.Rarity != MonsterRarity.Unique))
            {
                return;
            }

            Update(entity, settings);

            var _canNotDie = entity?.GetComponent <Stats>()?.StatDictionary?.ContainsKey(GameStat.CannotDie);

            if (_canNotDie == null)
            {
                CanNotDie = entity.Path.StartsWith("Metadata/Monsters/Totems/Labyrinth");
            }
            else
            {
                CanNotDie = (bool)_canNotDie;
            }

            var mods = entity?.GetComponent <ObjectMagicProperties>()?.Mods;

            if (mods != null && mods.Contains("MonsterConvertsOnDeath_"))
            {
                OnHostileChange = () =>
                {
                    if (_init)
                    {
                        Update(Entity, settings);
                    }
                };
            }
        }
コード例 #15
0
 public override bool Initialise()
 {
     Controller      = this;
     pickItCoroutine = new Coroutine(MainWorkCoroutine(), this, "Pick It");
     Core.ParallelRunner.Run(pickItCoroutine);
     pickItCoroutine.Pause();
     DebugTimer.Reset();
     Settings.MouseSpeed.OnValueChanged += (sender, f) => { Mouse.speedMouse = Settings.MouseSpeed.Value; };
     _workCoroutine = new WaitTime(Settings.ExtraDelay);
     Settings.ExtraDelay.OnValueChanged += (sender, i) => _workCoroutine = new WaitTime(i);
     UpdateCacheList = new TimeCache <List <CustomItem> >(UpdateLabelComponent, 200);
     LoadRuleFiles();
     //LoadCustomItems();
     return(true);
 }
コード例 #16
0
        public SoftwareMetadataService(TimeCache time, IConfiguration config, ILogger <SoftwareMetadataService> logger) : base(config)
        {
            Logger = logger;
            Time   = time;

            Logger.LogDebug("Loading software metadata...");

            using var db = GetConnection();
            var rows = db.Query(@"SELECT ""Id"", ""FirstLevel"", ""Version"", ""CommitDate"" FROM ""Software""");

            Aliases = rows.ToDictionary(row => (int)row.Id, row => new SoftwareAlias
            {
                Version = row.Version,
                Date    = row.CommitDate ?? Time[row.FirstLevel]
            });

            Logger.LogDebug($"Loaded {Aliases.Count} software metadata");
        }
コード例 #17
0
        public override bool Initialise()
        {
            _currentLabels = new TimeCache <List <CustomItem> >(UpdateCurrentLabels, 500);

            #region Register keys

            Settings.PickUpKey.OnValueChanged += () => Input.RegisterKey(Settings.PickUpKey);
            Input.RegisterKey(Settings.PickUpKey);
            Input.RegisterKey(Keys.Escape);

            #endregion

            _pickItCoroutine = new Coroutine(MainWorkCoroutine(), this, "Pick It");
            Core.ParallelRunner.Run(_pickItCoroutine);
            _pickItCoroutine.Pause();
            _debugTimer.Reset();
            _workCoroutine = new WaitTime(Settings.ExtraDelay);
            Settings.ExtraDelay.OnValueChanged += (sender, i) => _workCoroutine = new WaitTime(i);
            return(true);
        }
コード例 #18
0
ファイル: HealthBars.cs プロジェクト: Celuni/HealthBars
        public override bool Initialise()
        {
            Player    = GameController.Player;
            ingameUI  = GameController.IngameState.IngameUi;
            PlayerBar = new HealthBar(Player, Settings);
            GameController.EntityListWrapper.PlayerUpdate += (sender, args) =>
            {
                Player = GameController.Player;

                PlayerBar = new HealthBar(Player, Settings);
            };
            ingameUICheckVisible = new TimeCache <bool>(() =>
            {
                windowRectangle = GameController.Window.GetWindowRectangleReal();
                windowSize      = new Size2F(windowRectangle.Width / 2560, windowRectangle.Height / 1600);
                camera          = GameController.Game.IngameState.Camera;
                return(ingameUI.BetrayalWindow.IsVisibleLocal || ingameUI.SellWindow.IsVisibleLocal ||
                       ingameUI.DelveWindow.IsVisibleLocal || ingameUI.IncursionWindow.IsVisibleLocal ||
                       ingameUI.UnveilWindow.IsVisibleLocal || ingameUI.TreePanel.IsVisibleLocal || ingameUI.AtlasPanel.IsVisibleLocal ||
                       ingameUI.CraftBench.IsVisibleLocal);
            }, 250);
            return(true);
        }
コード例 #19
0
ファイル: SoftwareRepository.cs プロジェクト: yepeek/tzkt
 public SoftwareRepository(TimeCache time, IConfiguration config) : base(config)
 {
     Time = time;
 }
コード例 #20
0
ファイル: QuotesRepository.cs プロジェクト: baking-bad/tzkt
 public QuotesRepository(StateCache state, TimeCache time, QuotesCache quotes, IConfiguration config) : base(config)
 {
     Quotes = quotes;
     State  = state;
     Time   = time;
 }
コード例 #21
0
 private NativeThreadsMeterCache()
 {
     sync              = new object();
     cachedBuffer      = new ResizeableBuffer();
     threadsCountCache = new TimeCache <Dictionary <int, int> >(BuildCache, () => TimeSpan.FromSeconds(1));
 }
コード例 #22
0
 private ActiveNetworkInterfaceCache()
 {
     cache = new TimeCache <HashSet <string> >(() => BuildCache(), () => TimeSpan.FromSeconds(10));
 }
コード例 #23
0
 public CommitmentRepository(AccountsCache accounts, TimeCache time, IConfiguration config) : base(config)
 {
     Accounts = accounts;
     Time     = time;
 }
コード例 #24
0
 public CyclesRepository(QuotesCache quotes, TimeCache times, IConfiguration config) : base(config)
 {
     Quotes = quotes;
     Times  = times;
 }
コード例 #25
0
ファイル: GameController.cs プロジェクト: zaafar/ExileApi
        public GameController(Memory memory, SoundController soundController, SettingsContainer settings,
                              MultiThreadManager multiThreadManager)
        {
            _settings          = settings.CoreSettings;
            Memory             = memory;
            SoundController    = soundController;
            Settings           = settings;
            MultiThreadManager = multiThreadManager;

            try
            {
                Cache             = new Cache();
                Game              = new TheGame(memory, Cache);
                Area              = new AreaController(Game);
                Window            = new GameWindow(memory.Process);
                Files             = Game.Files;
                EntityListWrapper = new EntityListWrapper(this, _settings, multiThreadManager);
            }
            catch (Exception e)
            {
                DebugWindow.LogError(e.ToString());
            }

            PluginBridge = new PluginBridge();

            IsForeGroundCache = WinApi.IsForegroundWindow(Window.Process.MainWindowHandle);
            var values = Enum.GetValues(typeof(IconPriority));

            LeftPanel  = new PluginPanel(GetLeftCornerMap());
            UnderPanel = new PluginPanel(GetUnderCornerMap());

            var debParseFile = new DebugInformation("Parse files", false);

            debClearCache = new DebugInformation("Clear cache", false);

            // Core.DebugInformations.Add(debParseFile);

            /*Area.OnAreaChange += controller =>
             * {
             *
             *  debParseFile.TickAction(() =>
             *  {
             *      Files.LoadFiles();
             *  });
             * };*/

            debDeltaTime = Core.DebugInformations.FirstOrDefault(x => x.Name == "Delta Time");

            NativeMethods.LogError = _settings.LogReadMemoryError;

            _settings.LogReadMemoryError.OnValueChanged +=
                (obj, b) => NativeMethods.LogError       = _settings.LogReadMemoryError;

            LeftCornerMap  = new TimeCache <Vector2>(GetLeftCornerMap, 500);
            UnderCornerMap = new TimeCache <Vector2>(GetUnderCornerMap, 500);

            eIsForegroundChanged += b =>
            {
                if (b)
                {
                    Core.MainRunner.ResumeCoroutines(Core.MainRunner.Coroutines);
                    Core.ParallelRunner.ResumeCoroutines(Core.ParallelRunner.Coroutines);
                }
                else
                {
                    Core.MainRunner.PauseCoroutines(Core.MainRunner.Coroutines);
                    Core.ParallelRunner.PauseCoroutines(Core.ParallelRunner.Coroutines);
                }

                // DebugWindow.LogMsg($"Foreground: {b}");
            };

            _settings.RefreshArea.OnPressed += () => { Area.ForceRefreshArea(_settings.AreaChangeMultiThread); };
            Area.RefreshState();
            EntityListWrapper.StartWork();
            Initialized = true;
        }
コード例 #26
0
ファイル: TimestampParameter.cs プロジェクト: yepeek/tzkt
        public static Int32Parameter FromDateTimeParameter(DateTimeParameter timestamp, TimeCache time)
        {
            if (timestamp == null)
            {
                return(null);
            }

            var res = new Int32Parameter();

            if (timestamp.Eq != null)
            {
                res.Eq = time.FindLevel((DateTime)timestamp.Eq, SearchMode.Exact);
            }

            if (timestamp.Ne != null)
            {
                res.Ne = time.FindLevel((DateTime)timestamp.Ne, SearchMode.Exact);
            }

            if (timestamp.Gt != null)
            {
                res.Gt = time.FindLevel((DateTime)timestamp.Gt, SearchMode.ExactOrLower);
            }

            if (timestamp.Ge != null)
            {
                res.Ge = time.FindLevel((DateTime)timestamp.Ge, SearchMode.ExactOrLower);
            }

            return(res);
        }
コード例 #27
0
ファイル: TimestampBinder.cs プロジェクト: baking-bad/tzkt
 public TimestampBinder(TimeCache time)
 {
     Time = time;
 }
コード例 #28
0
 public GameWindow(Process process)
 {
     Process             = process;
     handle              = process.MainWindowHandle;
     _getWindowRectangle = new TimeCache <RectangleF>(GetWindowRectangleReal, 200);
 }
コード例 #29
0
 public StatisticsRepository(TimeCache time, QuotesCache quotes, IConfiguration config) : base(config)
 {
     Time   = time;
     Quotes = quotes;
 }
コード例 #30
0
ファイル: VotingRepository.cs プロジェクト: baking-bad/tzkt
 public VotingRepository(StateCache state, TimeCache time, AccountsCache accounts, IConfiguration config) : base(config)
 {
     State    = state;
     Time     = time;
     Accounts = accounts;
 }