rename UnitGUID -> GetUnitGUID to avoid breaking AI voiceover

This commit is contained in:
avitasia
2026-02-27 12:56:08 -08:00
parent 18045d602f
commit 3ea6edfb0f
7 changed files with 5852 additions and 5848 deletions
+6 -6
View File
@@ -142,7 +142,7 @@ Examples:
/run print(GetSpellTexture("Fireball")) -- name search
```
### Unit Token Extensions (`UnitGUID` + all `unitToken`/`target` string params)
### Unit Token Extensions (`GetUnitGUID` + all `unitToken`/`target` string params)
All functions taking a unit string like "player", "target", "raid1", etc now uses the same extended unit-token parser used by Superwow.
Supported formats:
@@ -159,11 +159,11 @@ How base resolution works:
Examples:
```
/run print(UnitGUID("mark1"))
/run print(UnitGUID("mark1target"))
/run print(UnitGUID("targetowner"))
/run print(UnitGUID("party1pet"))
/run print(UnitGUID("0xF5300000000000A5target"))
/run print(GetUnitGUID("mark1"))
/run print(GetUnitGUID("mark1target"))
/run print(GetUnitGUID("targetowner"))
/run print(GetUnitGUID("party1pet"))
/run print(GetUnitGUID("0xF5300000000000A5target"))
```
+13 -13
View File
@@ -57,7 +57,7 @@ For custom events, see [EVENTS.md](EVENTS.md). For installation, configuration,
- [PlayerIsRooted](#playerisrooted)
- [PlayerIsSwimming](#playerisswimming)
- [Utility Functions](#utility-functions)
- [UnitGUID](#unitguidunittoken)
- [GetUnitGUID](#getunitguidunittoken)
- [DisenchantAll](#disenchantallitemidorname-includesoulbound-or-disenchantallquality-includesoulbound)
---
@@ -536,11 +536,11 @@ An aura is considered hidden if it has the `SPELL_ATTR_HIDDEN_CLIENTSIDE` attrib
**Returns:**
- `1` if the aura is hidden from Lua
- `0` if the aura is visible to Lua
- `nil` if the aura is visible to Lua
**Examples:**
```lua
if IsAuraHidden(2458) == 1 then
if IsAuraHidden(2458) then
print("Aura is hidden")
end
```
@@ -1209,10 +1209,10 @@ end
### Utility Functions
#### UnitGUID(unitToken)
#### GetUnitGUID(unitToken)
Returns the GUID of the unit identified by the given unit token.
This function replaces the vanilla client's `UnitGUID` with an extended version that supports Nampower's additional unit-token formats (see [Unit Token Extensions](README.md#unit-token-extensions-unitguid--all-unittokentarget-string-params)).
Supports Nampower's extended unit-token formats (see [Unit Token Extensions](README.md#unit-token-extensions-getunitguid--all-unittokentarget-string-params)).
**Parameters:**
- `unitToken` (string): A unit token or extended unit token string.
@@ -1229,20 +1229,20 @@ This function replaces the vanilla client's `UnitGUID` with an extended version
**Examples:**
```lua
-- Standard tokens
print(UnitGUID("player"))
print(UnitGUID("target"))
print(UnitGUID("party1"))
print(GetUnitGUID("player"))
print(GetUnitGUID("target"))
print(GetUnitGUID("party1"))
-- Raid target marks
print(UnitGUID("mark1"))
print(GetUnitGUID("mark1"))
-- Suffix forms
print(UnitGUID("mark1target")) -- target of the unit marked with mark 1
print(UnitGUID("targetowner")) -- owner of the current target
print(UnitGUID("party1pet")) -- pet of party member 1
print(GetUnitGUID("mark1target")) -- target of the unit marked with mark 1
print(GetUnitGUID("targetowner")) -- owner of the current target
print(GetUnitGUID("party1pet")) -- pet of party member 1
-- Raw hex GUID with suffix
print(UnitGUID("0xF5300000000000A5target"))
print(GetUnitGUID("0xF5300000000000A5target"))
```
---
+5822 -5822
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -1834,8 +1834,8 @@ namespace Nampower {
char setMouseoverUnit[] = "SetMouseoverUnit";
RegisterLuaFunction(setMouseoverUnit, reinterpret_cast<uintptr_t *>(Script_SetMouseoverUnit));
char unitGUID[] = "UnitGUID";
RegisterLuaFunction(unitGUID, reinterpret_cast<uintptr_t *>(Script_UnitGUID));
char getUnitGUID[] = "GetUnitGUID";
RegisterLuaFunction(getUnitGUID, reinterpret_cast<uintptr_t *>(Script_GetUnitGUID));
char isAuraHidden[] = "IsAuraHidden";
RegisterLuaFunction(isAuraHidden, reinterpret_cast<uintptr_t *>(Script_IsAuraHidden));
+1 -1
View File
@@ -25,7 +25,7 @@ namespace Nampower {
constexpr uint32_t DISENCHANT_QUALITY_PURPLE = 0x04; // Epic
constexpr uint32_t MAJOR_VERSION = 2;
constexpr uint32_t MINOR_VERSION = 42;
constexpr uint32_t MINOR_VERSION = 43;
constexpr uint32_t PATCH_VERSION = 0;
constexpr int32_t LUA_REGISTRYINDEX = -10000;
+7 -3
View File
@@ -920,11 +920,11 @@ namespace Nampower {
return 1;
}
uint32_t Script_UnitGUID(uintptr_t *luaState) {
uint32_t Script_GetUnitGUID(uintptr_t *luaState) {
luaState = GetLuaStatePtr();
if (!lua_isstring(luaState, 1)) {
lua_error(luaState, "Usage: UnitGUID(unitToken)");
lua_error(luaState, "Usage: GetUnitGUID(unitToken)");
return 0;
}
@@ -954,7 +954,11 @@ namespace Nampower {
}
auto const spellId = static_cast<uint32_t>(lua_tonumber(luaState, 1));
lua_pushnumber(luaState, IsAuraHiddenForLua(spellId) ? 1 : 0);
if (IsAuraHiddenForLua(spellId)) {
lua_pushnumber(luaState, 1);
} else {
lua_pushnil(luaState);
}
return 1;
}
+1 -1
View File
@@ -38,7 +38,7 @@ namespace Nampower {
uint32_t Script_CancelPlayerAuraSpellId(uintptr_t *luaState);
uint32_t Script_SetMouseoverUnit(uintptr_t *luaState);
uint32_t Script_UnitGUID(uintptr_t *luaState);
uint32_t Script_GetUnitGUID(uintptr_t *luaState);
uint32_t Script_IsAuraHidden(uintptr_t *luaState);
uint32_t CSimpleFrame_GetNameHook(hadesmem::PatchDetourBase *detour, uintptr_t *luaState);