feat(tooltip): add GameTooltip:GetUnit

GetUnit() returns (name, unitToken). The engine drops the token after
SetUnit resolves it to a GUID, so it is kept where it enters:

- SetUnit is re-registered in front of the engine method and stages
  the token; it binds in the unit-builder co-hook that SetEvents
  already owns, before OnTooltipSetUnit fires.
- A build with no staged token is the world mouseover ("mouseover");
  the in-place refresh keeps the bound token.
- Unit-frame hover (Frame::Attributes) stages the frame's unit, since
  the engine resolves "mouseover" only for a live object and an
  offline or far group member has none.

The name follows Script_UnitName's order (live object, group roster
slot, name cache), so offline members resolve for GetUnit and
GetUnitGUID alike.
This commit is contained in:
Brues
2026-09-26 22:33:13 -05:00
parent 7707127d5f
commit 46dc198505
8 changed files with 309 additions and 55 deletions
+2
View File
@@ -42,6 +42,7 @@
#include "Game.h"
#include "Offsets.h"
#include "unit/Tooltip.h"
#include <cstdint>
@@ -200,6 +201,7 @@ using BuildUnit_t = int(__fastcall *)(void *self, void *edx, const void *guid);
BuildUnit_t g_buildUnitOriginal = nullptr;
int __fastcall BuildUnit_h(void *self, void *edx, const void *guid) {
Unit::Tooltip::BeforeBuild(self, static_cast<const uint32_t *>(guid));
const int ret = g_buildUnitOriginal(self, edx, guid);
FireScript(self, SK_UNIT);
return ret;