Skip to content

Instantly share code, notes, and snippets.

@Schroedi
Schroedi / main.js
Created May 24, 2023 19:25 — forked from kdzwinel/main.js
List all undefined CSS classes
/*
This script attempts to identify all CSS classes mentioned in HTML but not defined in the stylesheets.
In order to use it, just run it in the DevTools console (or add it to DevTools Snippets and run it from there).
Note that this script requires browser to support `fetch` and some ES6 features (fat arrow, Promises, Array.from, Set). You can transpile it to ES5 here: https://babeljs.io/repl/ .
Known limitations:
- it won't be able to take into account some external stylesheets (if CORS isn't set up)
- it will produce false negatives for classes that are mentioned in the comments.
@Schroedi
Schroedi / MapDevice.cs
Last active September 25, 2024 16:49
private static async Task<bool> FastMoveFromDevice(int itemId)
{
// get the generic control, regardless of whether we have a 4 or 5 slot device
var inventoryControlWrapper = MapDevice.InventoryControl;
// accessing the items works on both
var itemCount = inventoryControlWrapper.Inventory.Items.Count;
var item = inventoryControlWrapper.Inventory.FindItemById(itemId);
if (item == null)
{
GlobalLog.Error($"[FastMoveFromDevice] Fail to find item {itemId} in Map Device.");
@Schroedi
Schroedi / ElementFromPath.cs
Created September 13, 2022 10:19
Get the element from the string produced by DumpFrameUnderCursor
public static Element ElementFromPath(string path)
{
if (!path.StartsWith("root"))
{
Log.Error("[ElementFromPath] Path must start with root: root.Children[1].Children[102]");
return null;
}
path = path.Substring("root.".Length);
// remove tailing .
if (path.EndsWith("."))
@Schroedi
Schroedi / Gui.xaml
Created August 3, 2022 06:43
Theme the Property grid from http://www.codeproject.com/KB/grid/WpfPropertyGrid.aspx for use in DPB settings
<wpg:WpfPropertyGrid HelpVisible="False" Margin="5, 0, 0, 0" x:Name="PropertyGrid1" Width="350" Height="400"/>
@Schroedi
Schroedi / Patch.cs
Last active July 29, 2022 12:54
Time all Run methods in dpb and print if they take more than 100ms. Uses https://github.com/pardeike/Harmony
using System;
using System.Linq;
using DreamPoeBot.Loki.Bot;
using DreamPoeBot.Loki.Common;
using HarmonyLib;
namespace kekslib
{
public static partial class KeksTools
{
@Schroedi
Schroedi / TerrainToPng.cs
Created July 20, 2022 05:24
Save PoE map to png
/// <summary>
///
/// </summary>
/// <param name="filename"></param>
/// <param name="data">LokiPoe.TerrainData.Layer0</param>
/// <param name="terrainSize">LokiPoe.TerrainData.Size</param>
/// <param name="bpr">LokiPoe.TerrainData.BytesPerRow</param>
public static void GeneratePng(string filename, ref byte[] data, Vector2i terrainSize, int bpr)
{
Color TerrainColor(int v)
@Schroedi
Schroedi / FreezePoe.cs
Created July 14, 2022 10:07
Freeze and unfreeze PoE to use DPB's ObjectExplorer without hurry.
public static partial class KeksTools
{
[DllImport("kernel32.dll", SetLastError = true)]
static extern bool DebugActiveProcess(uint dwProcessId);
[DllImport("kernel32.dll", SetLastError = true)]
static extern bool DebugActiveProcessStop(uint dwProcessId);
private static bool WasHooked = false;
@Schroedi
Schroedi / DPBFastMoveFromInvNoAffinity.cs
Created July 7, 2022 10:57
Fast move an item from the inventory holding shift to ignore tab affinity
public static FastMoveResult FastMoveFromInvNoAffinity(int itemLocalId)
{
if (!LokiPoe.ProcessHookManager.IsEnabled)
{
return FastMoveResult.ProcessHookManagerNotEnabled;
}
LokiPoe.ProcessHookManager.ClearAllKeyStates();
var inventorySlotUiElement = LokiPoe.InGameState.InventoryUi.InventoryControl_Main.InventorySlotUiElement;
// Automate the settings window for debugging
// e.a. automatically expand the Plugins section and select the plugin you are currently working on
public void Initialize()
{
LokiPoe.OnGuiTick += OnGuiTickEvent;
}
private static void OnGuiTickEvent(object sender, GuiTickEventArgs e)
{
@Schroedi
Schroedi / passiveDump.patch
Created February 10, 2022 15:59
PoB dump passives
diff --git a/runtime-win32.zip b/runtime-win32.zip
deleted file mode 100644
index 2fd1fff6..00000000
Binary files a/runtime-win32.zip and /dev/null differ
diff --git a/src/Classes/PassiveSpec.lua b/src/Classes/PassiveSpec.lua
index e34f723d..e4c8cce2 100644
--- a/src/Classes/PassiveSpec.lua
+++ b/src/Classes/PassiveSpec.lua
@@ -13,6 +13,18 @@ local m_max = math.max
local m_floor = math.floor