Add "Hide in Cities" toggle to minimap icons dropdown
Reads zone ID from 0xB4E314 and suppresses NPC/GO tracking in capital cities (SW, IF, Darn, Org, TB, UC, Alah'Thalas) when enabled. Castle icon converted from WC3-style PNG via png2blp.
This commit is contained in:
@@ -96,6 +96,7 @@ fn registerLuaFunctions() void {
|
||||
if (build_opts.minimapicons and minimapicons.isActive()) {
|
||||
const lib = [_]lua.LuaReg{
|
||||
.{ .name = "SetObjectTypeBlip", .func = @intFromPtr(&minimapicons.luaSetObjectTypeBlip) },
|
||||
.{ .name = "SetMinimapCityToggle", .func = @intFromPtr(&minimapicons.luaSetCityToggle) },
|
||||
.{ .name = null, .func = 0 },
|
||||
};
|
||||
lua.openlib(lua.getContext(), "WeirdUtils", &lib, 0);
|
||||
|
||||
@@ -121,6 +121,9 @@ local activeNpcCategories = {} -- name -> 1/nil, loaded from WeirdUtils_MinimapI
|
||||
-- that take priority over unfiltered catch-all entries.
|
||||
local function updateDllTracking()
|
||||
if not WeirdUtils.SetObjectTypeBlip then return end
|
||||
if WeirdUtils.SetMinimapCityToggle then
|
||||
WeirdUtils.SetMinimapCityToggle(activeNpcCategories["City Toggle"] and 1 or 0)
|
||||
end
|
||||
for _, cat in ipairs(NPC_CATEGORIES) do
|
||||
local inc = cat.getFilter and cat.getFilter() or nil
|
||||
local exc = cat.getExclude and cat.getExclude() or nil
|
||||
@@ -220,6 +223,23 @@ UIDropDownMenu_Initialize(dropdown, function()
|
||||
npcTitle.notCheckable = 1
|
||||
UIDropDownMenu_AddButton(npcTitle)
|
||||
|
||||
-- City Toggle: suppress NPC/GO tracking in capital cities
|
||||
local cityInfo = {}
|
||||
cityInfo.text = "Hide in Cities"
|
||||
cityInfo.icon = "Interface\\Minimap\\Tracking\\City"
|
||||
cityInfo.checked = activeNpcCategories["City Toggle"]
|
||||
cityInfo.keepShownOnClick = 1
|
||||
cityInfo.func = function()
|
||||
if activeNpcCategories["City Toggle"] then
|
||||
activeNpcCategories["City Toggle"] = nil
|
||||
else
|
||||
activeNpcCategories["City Toggle"] = 1
|
||||
end
|
||||
WeirdUtils_MinimapIconsSettings = activeNpcCategories
|
||||
updateDllTracking()
|
||||
end
|
||||
UIDropDownMenu_AddButton(cityInfo)
|
||||
|
||||
for _, cat in ipairs(NPC_CATEGORIES) do
|
||||
local catName = cat.name
|
||||
local info = {}
|
||||
|
||||
Binary file not shown.
@@ -268,6 +268,19 @@ var g_go_id_tracking: [MAX_GO_ID_ENTRIES]GoEntryEntry = .{GoEntryEntry{}} ** MAX
|
||||
var g_blips: [MAX_BLIPS]TrackedBlip = undefined;
|
||||
var g_blip_count: u32 = 0;
|
||||
var g_has_active_tracking: bool = false;
|
||||
var g_city_toggle: bool = false; // when true, suppress tracking in cities
|
||||
|
||||
// Capital city zone IDs
|
||||
const CITY_ZONES = [_]u32{
|
||||
1519, // Stormwind City
|
||||
1537, // Ironforge
|
||||
1657, // Darnassus
|
||||
1637, // Orgrimmar
|
||||
1638, // Thunder Bluff
|
||||
1497, // Undercity
|
||||
2040, // Alah'Thalas
|
||||
};
|
||||
const ZONE_AREA_ID: usize = 0x00B4E314;
|
||||
var g_has_active_unit_tracking: bool = false;
|
||||
var g_has_active_go_tracking: bool = false;
|
||||
var g_has_any_filters: bool = false;
|
||||
@@ -985,8 +998,16 @@ fn refreshActiveTrackingCache() void {
|
||||
const EnumProcFn = fn (u32, u32, u32, u32) callconv(fc) i32;
|
||||
var enum_proc_hook: hook.Detour(EnumProcFn) = .{};
|
||||
|
||||
fn isInCity() bool {
|
||||
const zone = hook.readMem(u32, ZONE_AREA_ID);
|
||||
for (CITY_ZONES) |city| {
|
||||
if (zone == city) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
fn objectEnumProcDetour(info: u32, _edx: u32, guid_lo: u32, guid_hi: u32) callconv(fc) i32 {
|
||||
if (g_has_active_tracking) {
|
||||
if (g_has_active_tracking and !(g_city_toggle and isInCity())) {
|
||||
if (checkObject(info, guid_lo, guid_hi)) {
|
||||
return 1; // Skip original — we draw our own icon
|
||||
}
|
||||
@@ -1198,6 +1219,12 @@ pub fn luaSetObjectTypeBlip(L: lua.State) callconv(fc) i32 {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// SetMinimapCityToggle(enabled) — suppress NPC/GO tracking in capital cities
|
||||
pub fn luaSetCityToggle(L: lua.State) callconv(fc) i32 {
|
||||
g_city_toggle = lua.isnumber(L, 1) and lua.tonumber(L, 1) != 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
const TypeMapping = struct {
|
||||
kind: enum { npc_flag, go_type, go_entry } = .npc_flag,
|
||||
value: u32,
|
||||
|
||||
Reference in New Issue
Block a user