public override void Render() { try { if (!holdKey && WinApi.IsKeyDown(Keys.F12)) { holdKey = true; Settings.Enable.Value = !Settings.Enable.Value; SettingsHub.Save(settingsHub); } else if (holdKey && !WinApi.IsKeyDown(Keys.F12)) { holdKey = false; } if (Settings.Enable) { root.Render(Graphics, Settings); } } catch { // do nothing } }
public override void Render() { if (!holdKey && WinApi.IsKeyDown(Keys.F9)) { holdKey = true; Settings.ItemMods.Enable.Value = !Settings.ItemMods.Enable.Value; if (!Settings.ItemMods.Enable.Value) { SettingsHub.Save(settingsHub); } } else if (holdKey && !WinApi.IsKeyDown(Keys.F9)) { holdKey = false; } Element uiHover = GameController.Game.IngameState.UIHover; var inventoryItemIcon = uiHover.AsObject <InventoryItemIcon>(); Element tooltip = GetTooltip(inventoryItemIcon); Entity poeEntity = inventoryItemIcon.Item; if (tooltip == null || poeEntity.Address == 0 || !poeEntity.IsValid) { return; } RectangleF tooltipRect = tooltip.GetClientRect(); var modsComponent = poeEntity.GetComponent <Mods>(); if (itemEntity == null || itemEntity.Id != poeEntity.Id) { List <ItemMod> itemMods = modsComponent.ItemMods; mods = itemMods.Select(item => new ModValue(item, GameController.Files, modsComponent.ItemLevel)).ToList(); itemEntity = poeEntity; } if (Settings.ItemLevel.Enable) { string itemLevel = Convert.ToString(modsComponent.ItemLevel); Graphics.DrawText(itemLevel, Settings.ItemLevel.TextSize, tooltipRect.TopLeft.Translate(1, -3), Color.Yellow); } if (Settings.ItemMods.Enable) { float bottomTooltip = tooltipRect.Bottom + 5; var modPosition = new Vector2(tooltipRect.X + 50, bottomTooltip + 4); float height = mods.Aggregate(modPosition, (position, item) => DrawMod(item, position)).Y - bottomTooltip; if (height > 4) { var modsRect = new RectangleF(tooltipRect.X + 1, bottomTooltip, tooltipRect.Width, height); Graphics.DrawBox(modsRect, Settings.ItemMods.BackgroundColor); } } if (Settings.WeaponDps.Enable && poeEntity.HasComponent <Weapon>()) { DrawWeaponDps(tooltipRect); } }
public override void Dispose() { SettingsHub.Save(settingsHub); KeyboardMouseEvents.MouseWheelExt -= KeyboardMouseEvents_MouseWheelExt; KeyboardMouseEvents.KeyDown -= KeyboardMouseEvents_KeyDown; KeyboardMouseEvents.KeyUp -= KeyboardMouseEvents_KeyUp; KeyboardMouseEvents.KeyPress -= KeyboardMouseEvents_KeyPress; KeyboardMouseEvents.MouseDownExt -= KeyboardMouseEvents_MouseDownExt; KeyboardMouseEvents.MouseUpExt -= KeyboardMouseEvents_MouseUpExt; KeyboardMouseEvents.MouseMove -= KeyboardMouseEvents_MouseMove; KeyboardMouseEvents.Dispose(); }
public override void Render() { if (WinApi.IsKeyDown(Keys.F5)) // do a full refresh if F5 is hit { ResetArea(); Parse(); } if (!holdKey && WinApi.IsKeyDown(Keys.F10)) { holdKey = true; Settings.Enable.Value = !Settings.Enable.Value; SettingsHub.Save(settingsHub); } else if (holdKey && !WinApi.IsKeyDown(Keys.F10)) { holdKey = false; } if (!Settings.Enable || GameController.Area.CurrentArea.IsTown) { Size = new Size2F(); return; } if (alerts.Count <= 0) { Size = new Size2F(); return; } Vector2 startPosition = StartDrawPointFunc(); Vector2 position = startPosition; int maxWidth = 0; foreach (Size2 size in alerts .Select(preloadConfigLine => Graphics .DrawText(preloadConfigLine.Text, Settings.TextSize, position, preloadConfigLine.FastColor? .Invoke() ?? preloadConfigLine.Color ?? Settings.DefaultTextColor, FontDrawFlags.Right))) { maxWidth = Math.Max(size.Width, maxWidth); position.Y += size.Height; } if (maxWidth <= 0) { return; } var bounds = new RectangleF(startPosition.X - maxWidth - 45, startPosition.Y - 5, maxWidth + 50, position.Y - startPosition.Y + 10); Graphics.DrawImage("preload-start.png", bounds, Settings.BackgroundColor); Graphics.DrawImage("preload-end.png", bounds, Settings.BackgroundColor); Size = bounds.Size; Margin = new Vector2(0, 5); }
public override void Render() { if (!holdKey && WinApi.IsKeyDown(Keys.F10)) { holdKey = true; Settings.Enable.Value = !Settings.Enable.Value; SettingsHub.Save(settingsHub); } else if (holdKey && !WinApi.IsKeyDown(Keys.F10)) { holdKey = false; } if (!Settings.Enable) { return; } if (Settings.Enable) { Positioned pos = GameController.Player.GetComponent <Positioned>(); if (pos == null) { return; } Vector2 playerPos = pos.GridPos; Vector2 position = StartDrawPointFunc(); const int BOTTOM_MARGIN = 2; bool shouldUpdate = false; if (Settings.BorderSettings.Enable) { Dictionary <EntityWrapper, AlertDrawStyle> tempCopy = new Dictionary <EntityWrapper, AlertDrawStyle>(currentAlerts); var keyValuePairs = tempCopy.AsParallel().Where(x => x.Key != null && x.Key.Address != 0 && x.Key.IsValid).ToList(); foreach (var kv in keyValuePairs) { if (DrawBorder(kv.Key.Address) && !shouldUpdate) { shouldUpdate = true; } } } foreach (KeyValuePair <EntityWrapper, AlertDrawStyle> kv in currentAlerts.Where(x => x.Key != null && x.Key.Address != 0 && x.Key.IsValid)) { string text = GetItemName(kv); if (text == null) { continue; } ItemsOnGroundLabelElement entityLabel; if (!currentLabels.TryGetValue(kv.Key.Address, out entityLabel)) { shouldUpdate = true; } else { if (Settings.ShowText && (!Settings.HideOthers || entityLabel.CanPickUp || entityLabel.MaxTimeForPickUp.TotalSeconds == 0)) { position = DrawText(playerPos, position, BOTTOM_MARGIN, kv, text); } } } Size = new Size2F(0, position.Y); //bug absent width if (shouldUpdate) { currentLabels = GameController.Game.IngameState.IngameUi.ItemsOnGroundLabels .GroupBy(y => y.ItemOnGround.Address).ToDictionary(y => y.Key, y => y.First()); } } }
private void OnClosing(object sender, FormClosingEventArgs e) { SettingsHub.Save(settings); plugins.ForEach(plugin => plugin.Dispose()); graphics.Dispose(); }
public override void Render() { if (GameController.Game.IngameState.IngameUi.InventoryPanel.IsVisible) { return; } try { var UIHover = GameController.Game.IngameState.UIHover; var miniMap = GameController.Game.IngameState.IngameUi.Map.SmallMinimap; if (Settings.Enable.Value && UIHover.Address != 0x00 && UIHover.Tooltip.Address != 0x00 && UIHover.Tooltip.IsVisible && UIHover.Tooltip.GetClientRect().Intersects(miniMap.GetClientRect())) { autoHide = true; Settings.Enable.Value = false; } if (autoHide && (UIHover.Address == 0x00 || UIHover.Tooltip.Address == 0x00 || !UIHover.Tooltip.IsVisible)) { autoHide = false; Settings.Enable.Value = true; } if (!holdKey && WinApi.IsKeyDown(Keys.F10)) { holdKey = true; Settings.Enable.Value = !Settings.Enable.Value; SettingsHub.Save(settingsHub); } else if (holdKey && !WinApi.IsKeyDown(Keys.F10)) { holdKey = false; } if (!Settings.Enable) { return; } DateTime nowTime = DateTime.Now; TimeSpan elapsedTime = nowTime - lastTime; if (elapsedTime.TotalSeconds > 1) { CalculateXp(nowTime); partyXpPenalty = PartyXpPenalty(); lastTime = nowTime; } bool showInTown = !Settings.ShowInTown && GameController.Area.CurrentArea.IsTown || !Settings.ShowInTown && GameController.Area.CurrentArea.IsHideout; Vector2 position = StartDrawPointFunc(); string fps = $"fps:({GameController.Game.IngameState.CurFps})"; string areaName = $"{GameController.Area.CurrentArea.DisplayName}"; Color AreaNameColor = PreloadAlertPlugin.AreaNameColor; if (Settings.OnlyAreaName) { if (!showInTown) { var areaNameSize = Graphics.MeasureText(areaName, Settings.TextSize); float boxHeight = areaNameSize.Height; float boxWidth = MathHepler.Max(areaNameSize.Width); var bounds = new RectangleF(position.X - 84 - boxWidth, position.Y - 5, boxWidth + 90, boxHeight + 12); string latency = $"({GameController.Game.IngameState.CurLatency})"; Graphics.DrawText(areaName, Settings.TextSize, new Vector2(bounds.X + 84, position.Y), AreaNameColor); Graphics.DrawImage("preload-start.png", bounds, Settings.BackgroundColor); Graphics.DrawImage("preload-end.png", bounds, Settings.BackgroundColor); if (Settings.ShowLatency) { Graphics.DrawText(latency, Settings.TextSize, new Vector2(bounds.X + 35, position.Y), Settings.LatencyTextColor); } Size = bounds.Size; Margin = new Vector2(0, 5); } } if (!Settings.OnlyAreaName) { if (!showInTown) { var xpReceiving = levelXpPenalty * partyXpPenalty; var xpReceivingText = $"{xpRate} *{xpReceiving:p0}"; var xpGetLeft = $"Got: {ConvertHelper.ToShorten(getXp, "0.00")} Left: {ConvertHelper.ToShorten(xpLeftQ, "0.00")}"; string ping = $"ping:({GameController.Game.IngameState.CurLatency})"; Size2 areaNameSize = Graphics.DrawText(areaName, Settings.TextSize, position - 1, AreaNameColor, FontDrawFlags.Right); Vector2 secondLine = position.Translate(-1, areaNameSize.Height + 2); Size2 xpRateSize = Graphics.DrawText(timeLeft, Settings.TextSize, secondLine, Settings.XphTextColor, FontDrawFlags.Right); Vector2 thirdLine = secondLine.Translate(-1, xpRateSize.Height + 2); Size2 xpLeftSize = Graphics.DrawText(xpReceivingText, Settings.TextSize, thirdLine, Settings.TimeLeftColor, FontDrawFlags.Right); Vector2 fourLine = thirdLine.Translate(-1, xpLeftSize.Height + 2); Size2 xpGetLeftSize = Graphics.DrawText(xpGetLeft, Settings.TextSize, fourLine, Settings.XphTextColor, FontDrawFlags.Right); Size2 delveInfoSize = Size2.Zero; if (GameController.Player.GetComponent <Stats>().StatDictionary.TryGetValue(DelveSulphiteCapacityID, out var sulphiteCapacity)) { if (sulphiteCapacity > 0) { string sulphite = $"Sulphite: {GameController.Game.IngameState.ServerData.CurrentSulphiteAmount}/{sulphiteCapacity}"; string azurite = $"Azurite: {GameController.Game.IngameState.ServerData.CurrentAzuriteAmount}"; Vector2 fifthLine = fourLine.Translate(-1, xpGetLeftSize.Height + 2); delveInfoSize = Graphics.DrawText($"{sulphite} {azurite}", Settings.TextSize, fifthLine, Settings.DelveInfoTextcolor, FontDrawFlags.Right); delveInfoSize.Width += 40; } } string timer = AreaInstance.GetTimeString(nowTime - GameController.Area.CurrentArea.TimeEntered); Size2 timerSize = Graphics.MeasureText(timer, Settings.TextSize); float boxWidth = MathHepler.Max(xpRateSize.Width + 40, xpLeftSize.Width + 40, areaNameSize.Width + 20, timerSize.Width, delveInfoSize.Width); float boxHeight = xpRateSize.Height + xpLeftSize.Height + areaNameSize.Height + delveInfoSize.Height; var bounds = new RectangleF(position.X - boxWidth - 104, position.Y - 7, boxWidth + 110, boxHeight + 40); Size2 timeFpsSize = Graphics.MeasureText(fps, Settings.TextSize); var dif = bounds.Width - (12 + timeFpsSize.Width + xpRateSize.Width); if (dif < 0) { bounds.X += dif; bounds.Width -= dif; } Graphics.DrawText(timer, Settings.TextSize, new Vector2(bounds.X + 70, position.Y), Settings.TimerTextColor); if (Settings.ShowFps) { Graphics.DrawText(fps, Settings.TextSize, new Vector2(bounds.X + 70, secondLine.Y), Settings.FpsTextColor); } if (Settings.ShowLatency) { Graphics.DrawText(ping, Settings.TextSize, new Vector2(bounds.X + 70, thirdLine.Y), Settings.LatencyTextColor); } Graphics.DrawImage("preload-start.png", bounds, Settings.BackgroundColor); Graphics.DrawImage("preload-end.png", bounds, Settings.BackgroundColor); Size = bounds.Size; Margin = new Vector2(0, 5); } } } catch { // do nothing } }
public override void Render() { if (!holdKey && WinApi.IsKeyDown(Keys.F10)) { holdKey = true; Settings.Enable.Value = !Settings.Enable.Value; SettingsHub.Save(settingsHub); } else if (holdKey && !WinApi.IsKeyDown(Keys.F10)) { holdKey = false; } if (!Settings.Enable) { return; } if (Settings.Enable) { var pos = GameController.Player.GetComponent <Positioned>(); var playerPos = pos.GridPos; var position = StartDrawPointFunc(); const int BOTTOM_MARGIN = 2; var shouldUpdate = false; var validAlerts = currentAlerts.ToList().Where( x => x.Key != null && x.Key.Address != 0 && x.Key.IsValid); foreach (KeyValuePair <EntityWrapper, AlertDrawStyle> kv in validAlerts) { if (string.IsNullOrEmpty(kv.Value.Text)) { continue; } LabelOnGround entityLabel; if (!currentLabels.TryGetValue(kv.Key.Address, out entityLabel)) { shouldUpdate = true; } else { if (Settings.BorderSettings.Enable) { DrawBorder(entityLabel); } if (Settings.ShowText) { if (entityLabel.CanPickUp || entityLabel.MaxTimeForPickUp.TotalSeconds == 0) { position = DrawText(playerPos, position, BOTTOM_MARGIN, kv, kv.Value.Text); } else if (!Settings.HideOthers) { // get current values Color TextColor = kv.Value.TextColor; Color BorderColor = kv.Value.BorderColor; Color BackgroundColor = kv.Value.BackgroundColor; if (Settings.DimOtherByPercentToggle) { // edit values to new ones double ReduceByPercent = (double)Settings.DimOtherByPercent / 100; TextColor = ReduceNumbers(TextColor, ReduceByPercent); BorderColor = ReduceNumbers(BorderColor, ReduceByPercent); BackgroundColor = ReduceNumbers(BackgroundColor, ReduceByPercent); // backgrounds with low alpha start to look a little strange when dark so im adding an alpha threshold if (BackgroundColor.A < 210) { BackgroundColor.A = 210; } } // Complete new KeyValuePair with new stuff AlertDrawStyle ModifiedDrawStyle = new AlertDrawStyle(kv.Value.Text, TextColor, kv.Value.BorderWidth, BorderColor, BackgroundColor, kv.Value.IconIndex); KeyValuePair <EntityWrapper, AlertDrawStyle> NewKV = new KeyValuePair <EntityWrapper, AlertDrawStyle>(kv.Key, ModifiedDrawStyle); position = DrawText(playerPos, position, BOTTOM_MARGIN, NewKV, kv.Value.Text); } } } } Size = new Size2F(0, position.Y); //bug absent width if (shouldUpdate) { currentLabels = GameController.Game.IngameState.IngameUi.ItemsOnGroundLabels .GroupBy(y => y.ItemOnGround.Address).ToDictionary(y => y.Key, y => y.First()); } } }
public override void Render() { try { if (!holdKey && WinApi.IsKeyDown(Keys.F10)) { holdKey = true; Settings.Enable.Value = !Settings.Enable.Value; SettingsHub.Save(settingsHub); } else if (holdKey && !WinApi.IsKeyDown(Keys.F10)) { holdKey = false; } if (!Settings.Enable) { return; } DateTime nowTime = DateTime.Now; TimeSpan elapsedTime = nowTime - lastTime; if (elapsedTime.TotalSeconds > 1) { CalculateXp(nowTime); partyXpPenalty = PartyXpPenalty(); lastTime = nowTime; } bool showInTown = !Settings.ShowInTown && GameController.Area.CurrentArea.IsTown || !Settings.ShowInTown && GameController.Area.CurrentArea.IsHideout; Vector2 position = StartDrawPointFunc(); string fps = $"fps:({GameController.Game.IngameState.CurFps})"; string areaName = $"{GameController.Area.CurrentArea.DisplayName}"; Color AreaNameColor = PreloadAlertPlugin.AreaNameColor; if (Settings.OnlyAreaName) { if (!showInTown) { var areaNameSize = Graphics.MeasureText(areaName, Settings.TextSize); float boxHeight = areaNameSize.Height; float boxWidth = MathHepler.Max(areaNameSize.Width); var bounds = new RectangleF(position.X - 84 - boxWidth, position.Y - 5, boxWidth + 90, boxHeight + 12); string latency = $"({GameController.Game.IngameState.CurLatency})"; Graphics.DrawText(areaName, Settings.TextSize, new Vector2(bounds.X + 84, position.Y), AreaNameColor); Graphics.DrawImage("preload-start.png", bounds, Settings.BackgroundColor); Graphics.DrawImage("preload-end.png", bounds, Settings.BackgroundColor); if (Settings.ShowLatency) { Graphics.DrawText(latency, Settings.TextSize, new Vector2(bounds.X + 35, position.Y), Settings.LatencyTextColor); } Size = bounds.Size; Margin = new Vector2(0, 5); } } if (!Settings.OnlyAreaName) { if (!showInTown) { var xpReceiving = levelXpPenalty * partyXpPenalty; var xpReceivingText = $"{xpRate} *{xpReceiving:p0}"; string ping = $"ping:({GameController.Game.IngameState.CurLatency})"; Size2 areaNameSize = Graphics.DrawText(areaName, Settings.TextSize, position - 1, AreaNameColor, FontDrawFlags.Right); Vector2 secondLine = position.Translate(-1, areaNameSize.Height + 2); Size2 xpRateSize = Graphics.DrawText(timeLeft, Settings.TextSize, secondLine, Settings.TimeLeftColor, FontDrawFlags.Right); Vector2 thirdLine = secondLine.Translate(-1, xpRateSize.Height + 2); Size2 xpLeftSize = Graphics.DrawText(xpReceivingText, Settings.TextSize, thirdLine, Settings.TimeLeftColor, FontDrawFlags.Right); string timer = AreaInstance.GetTimeString(nowTime - GameController.Area.CurrentArea.TimeEntered); Size2 timerSize = Graphics.MeasureText(timer, Settings.TextSize); float boxWidth = MathHepler.Max(xpRateSize.Width + 40, xpLeftSize.Width + 40, areaNameSize.Width + 20, timerSize.Width); float boxHeight = xpRateSize.Height + xpLeftSize.Height + areaNameSize.Height; var bounds = new RectangleF(position.X - boxWidth - 104, position.Y - 7, boxWidth + 110, boxHeight + 18); Size2 timeFpsSize = Graphics.MeasureText(fps, Settings.TextSize); var dif = bounds.Width - (12 + timeFpsSize.Width + xpRateSize.Width); if (dif < 0) { bounds.X += dif; bounds.Width -= dif; } Graphics.DrawText(timer, Settings.TextSize, new Vector2(bounds.X + 70, position.Y), Settings.TimerTextColor); Graphics.DrawText(fps, Settings.TextSize, new Vector2(bounds.X + 70, secondLine.Y), Settings.FpsTextColor); Graphics.DrawText(ping, Settings.TextSize, new Vector2(bounds.X + 70, thirdLine.Y), Settings.LatencyTextColor); Graphics.DrawImage("preload-start.png", bounds, Settings.BackgroundColor); Graphics.DrawImage("preload-end.png", bounds, Settings.BackgroundColor); Size = bounds.Size; Margin = new Vector2(0, 5); } } } catch { // do nothing } }
public override void Render() { try { if (!holdKey && WinApi.IsKeyDown(Keys.F9)) { holdKey = true; Settings.ItemMods.Enable.Value = !Settings.ItemMods.Enable.Value; if (!Settings.ItemMods.Enable.Value) { SettingsHub.Save(settingsHub); } } else if (holdKey && !WinApi.IsKeyDown(Keys.F9)) { holdKey = false; } Element uiHover = GameController.Game.IngameState.UIHover; var inventoryItemIcon = uiHover.AsObject <HoverItemIcon>(); Element tooltip = inventoryItemIcon.Tooltip; Entity poeEntity = inventoryItemIcon.Item; if (tooltip == null || poeEntity.Address == 0 || !poeEntity.IsValid) { return; } RectangleF tooltipRect = tooltip.GetClientRect(); var modsComponent = poeEntity.GetComponent <Mods>(); long id = 0; if (inventoryItemIcon.ToolTipType == ToolTipType.InventoryItem) { id = poeEntity.InventoryId; } else { id = poeEntity.Id; } if (itemEntity == null || itemEntity.Id != id) { List <ItemMod> itemMods = modsComponent.ItemMods; mods = itemMods.Select(item => new ModValue(item, GameController.Files, modsComponent.ItemLevel, GameController.Files.BaseItemTypes.Translate(poeEntity.Path))).ToList(); itemEntity = poeEntity; } int t1 = 0; foreach (string tier in from item in mods where item.CouldHaveTiers() && item.Tier == 1 select " \u2605 ") { Graphics.DrawText(tier, 18, tooltipRect.TopLeft.Translate(0 + 14 * t1++, 56), Settings.ItemMods.T1Color); } int t2 = 0; foreach (string tier in from item in mods where item.CouldHaveTiers() && item.Tier == 2 select " \u2605 ") { Graphics.DrawText(tier, 18, tooltipRect.TopLeft.Translate(t1 * 14 + 14 * t2++, 56), Settings.ItemMods.T2Color); } if (Settings.ItemLevel.Enable) { string itemLevel = Convert.ToString(modsComponent.ItemLevel); var imageSize = Settings.ItemLevel.TextSize + 10; Graphics.DrawText(itemLevel, Settings.ItemLevel.TextSize, tooltipRect.TopLeft.Translate(2, 2), Settings.ItemLevel.TextColor); Graphics.DrawImage("menu-colors.png", new RectangleF(tooltipRect.TopLeft.X - 2, tooltipRect.TopLeft.Y - 2, imageSize, imageSize), Settings.ItemLevel.BackgroundColor); } if (Settings.ItemMods.Enable) { float bottomTooltip = tooltipRect.Bottom + 5; var modPosition = new Vector2(tooltipRect.X + 50, bottomTooltip + 4); float height = mods.Aggregate(modPosition, (position, item) => DrawMod(item, position)).Y - bottomTooltip; if (height > 4) { var modsRect = new RectangleF(tooltipRect.X + 1, bottomTooltip, tooltipRect.Width, height); Graphics.DrawBox(modsRect, Settings.ItemMods.BackgroundColor); } } if (Settings.WeaponDps.Enable && poeEntity.HasComponent <Weapon>()) { DrawWeaponDps(tooltipRect); } } catch { } }
public override void Render() { if (Settings.ReloadButton.PressedOnce()) // do a full refresh if F5 is hit { DebugPlug.DebugPlugin.LogMsg("Looking for new preloads.", 1); ResetArea(); Parse(); } var UIHover = GameController.Game.IngameState.UIHover; var miniMap = GameController.Game.IngameState.IngameUi.Map.SmallMinimap; if (Settings.Enable.Value && UIHover.Address != 0x00 && UIHover.Tooltip.Address != 0x00 && UIHover.Tooltip.IsVisible && UIHover.Tooltip.GetClientRect().Intersects(miniMap.GetClientRect())) { autoHide = true; Settings.Enable.Value = false; } if (autoHide && (UIHover.Address == 0x00 || UIHover.Tooltip.Address == 0x00 || !UIHover.Tooltip.IsVisible)) { autoHide = false; Settings.Enable.Value = true; } if (!holdKey && WinApi.IsKeyDown(Keys.F10)) { holdKey = true; Settings.Enable.Value = !Settings.Enable.Value; SettingsHub.Save(settingsHub); } else if (holdKey && !WinApi.IsKeyDown(Keys.F10)) { holdKey = false; } if (!Settings.Enable || GameController.Area.CurrentArea.IsTown) { Size = new Size2F(); return; } if (alerts.Count <= 0) { Size = new Size2F(); return; } /* if (isAreaChanged) * { * ResetArea(); * Parse(); * isAreaChanged = false; * }*/ Vector2 startPosition = StartDrawPointFunc(); Vector2 position = startPosition; int maxWidth = 0; foreach (Size2 size in alerts .Select(preloadConfigLine => Graphics .DrawText(preloadConfigLine.Text, Settings.TextSize, position, preloadConfigLine.FastColor? .Invoke() ?? preloadConfigLine.Color ?? Settings.DefaultTextColor, FontDrawFlags.Right))) { maxWidth = Math.Max(size.Width, maxWidth); position.Y += size.Height; } if (maxWidth <= 0) { return; } var bounds = new RectangleF(startPosition.X - maxWidth - 45, startPosition.Y - 5, maxWidth + 50, position.Y - startPosition.Y + 10); Graphics.DrawImage("preload-start.png", bounds, Settings.BackgroundColor); Graphics.DrawImage("preload-end.png", bounds, Settings.BackgroundColor); Size = bounds.Size; Margin = new Vector2(0, 5); }
private void KeyboardMouseEvents_KeyDown(object sender, KeyEventArgs e) { if (isPoeGameVisible) { if (HandleForKeySelector) { HandledForKeySelectorKey = e.KeyCode; e.Handled = true; HandleForKeySelector = false; return; } if (e.KeyCode == Settings.MainMenuKeyToggle) { Settings.Enable.Value = !Settings.Enable.Value; SettingsHub.Save(settingsHub); e.Handled = true; } if (Settings.Enable.Value) { if (Settings.CloseOnEsc.Value && e.KeyCode == Keys.Escape) { Settings.Enable.Value = !Settings.Enable.Value; e.Handled = true; return; } if (Settings.CloseOnSpace.Value && e.KeyCode == Keys.Space) { Settings.Enable.Value = !Settings.Enable.Value; e.Handled = true; return; } } } var io = ImGui.GetIO(); io.CtrlPressed = e.Control || e.KeyCode == Keys.LControlKey || e.KeyCode == Keys.RControlKey; // Don't know why but Alt is LMenu/RMenu io.AltPressed = e.Alt || e.KeyCode == Keys.LMenu || e.KeyCode == Keys.RMenu; io.ShiftPressed = e.Shift || e.KeyCode == Keys.LShiftKey || e.KeyCode == Keys.RShiftKey; if (io.AltPressed) { return; } unsafe { if (ImGuiWantTextInput(io)) { io.KeysDown[e.KeyValue] = true; if (e.KeyCode != Keys.Capital && e.KeyCode != Keys.LShiftKey && e.KeyCode != Keys.RShiftKey && e.KeyCode != Keys.LControlKey && e.KeyCode != Keys.RControlKey && e.KeyCode != Keys.LWin && e.KeyCode != Keys.Apps) { e.Handled = true; } } } }