From 80a287910f3f77519c8243ba5f53d9c877fbddcb Mon Sep 17 00:00:00 2001 From: salmonik Date: Wed, 4 Nov 2026 23:32:00 +0100 Subject: Charger juice: resolve per-class offsets CWallHealth derives CBaseToggle and CNewRecharge derives CBaseAnimating, so m_iJuice is at different offsets (0x3c8 and 0x47c here). Collect every m_iJuice datamap match, derive the suit offset from m_iMaxJuice-20, and pick by the server class name. Also detect health brushes via wallhealth/recharge rather than the ESP label. Verified the offsets resolve distinctly on :99. --- src/esp.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/esp.cpp') diff --git a/src/esp.cpp b/src/esp.cpp index 594a8fa..dbe0051 100644 --- a/src/esp.cpp +++ b/src/esp.cpp @@ -2655,6 +2655,16 @@ static bool item_kind_enabled(int kind) { } } +// Health chargers are brushes (func_healthcharger/CWallHealth) and suit +// chargers are item_suitcharger/CNewRecharge. Both expose m_iJuice. +static bool item_is_charger(const char *model, const char *cls) { + return item_icontains(model, "charger") || + item_icontains(model, "suit_charger") || + item_icontains(cls, "charger") || + item_icontains(cls, "wallhealth") || + item_icontains(cls, "recharge"); +} + static void items_collect(int local_idx) { static double last_scan = 0.0; double now = esp_now(); @@ -2784,7 +2794,7 @@ static void items_collect(int local_idx) { // Health/suit chargers are dispensers that stay useful after a refill, but // an empty one cannot give anything. m_iJuice is 0 when depleted (until it // recharges); only hide the tag once the server value is readable. - if (strcasestr(label, "charger") && server_item_juice(idx) == 0) + if (item_is_charger(model, cls) && server_item_juice(idx) == 0) continue; Vector origin{*(float *)((uintptr_t)ent + g_net.origin), -- cgit v1.2.3