library Interface initializer Init uses FpCall, Utils
globals
constant integer ANCHOR_TOPLEFT = 0
constant integer ANCHOR_TOP = 1
constant integer ANCHOR_TOPRIGHT = 2
constant integer ANCHOR_LEFT = 3
constant integer ANCHOR_CENTER = 4
constant integer ANCHOR_RIGHT = 5
constant integer ANCHOR_BOTTOMLEFT = 6
constant integer ANCHOR_BOTTOM = 7
constant integer ANCHOR_BOTTOMRIGHT = 8
constant integer FRAME_WorldFrameWar3 = 239
constant integer FRAME_Minimap = 240
constant integer FRAME_InfoBar = 241
constant integer FRAME_CommandBar = 242
constant integer FRAME_ResourceBarFrame = 243
constant integer FRAME_UpperButtonBarFrame = 244
constant integer FRAME_Unknown1 = 245 // ?
constant integer FRAME_ClickableBlock = 246
constant integer FRAME_HeroBar = 247
constant integer FRAME_PeonBar = 248
constant integer FRAME_Message = 249
constant integer FRAME_UnitMessage = 250
constant integer FRAME_ChatMessage = 251
constant integer FRAME_TopMessage = 252
constant integer FRAME_Portrait = 253
constant integer FRAME_TimeOfDayIndicator = 254
constant integer FRAME_ChatEditBar = 255
constant integer FRAME_CinematicPanel = 256
constant integer FRAME_Unknown2 = 257 // ?
constant integer FRAME_MinimapButton1 = 258
constant integer FRAME_MinimapButton2 = 259
constant integer FRAME_MinimapButton3 = 260
constant integer FRAME_MinimapButton4 = 261
constant integer FRAME_MinimapButton5 = 262
constant integer FRAME_FrameB = 263
constant integer FRAME_MouseBorders = 264
constant integer FRAME_FrameA = 265
constant integer FRAME_SimpleConsole = 266
integer address_GetGameUI = 0
integer address_SetFramePoint = 0
integer address_SetFramePoint2 = 0
integer address_SetFrameWidth = 0
integer address_SetFrameHeight = 0
integer address_GetFrameTextAddress = 0
integer address_GetFrameItemAddress = 0
integer address_GetFrameSkinAddress = 0
integer address_UpdateFrameText = 0
integer pGameUI = 0
endglobals
// =================================================
function GetGameUI takes integer a1, integer a2 returns integer
return fast_call2(address_GetGameUI, a1, a2)
endfunction
function ReadGameUIStruct takes integer element returns integer
return Memory[pGameUI/4 + element]
endfunction
function GetRootFrame takes nothing returns integer
return pGameUI + 180
endfunction
function SetFramePoint takes integer pFrame, integer point, integer pParentFrame, integer relativePoint, real offsetX, real offsetY returns nothing
call this_call7(address_SetFramePoint, pFrame, point, pParentFrame, relativePoint, SetRealIntoMemory(offsetX), SetRealIntoMemory(offsetY), 1)
endfunction
function SetFramePoint2 takes integer pFrame, integer point, real offsetX, real offsetY returns nothing
call this_call5(address_SetFramePoint2, pFrame, point, SetRealIntoMemory(offsetX), SetRealIntoMemory(offsetY), 1)
endfunction
function SetFrameWidth takes integer pFrame, real width returns nothing
call this_call2(address_SetFrameWidth, pFrame, SetRealIntoMemory(width))
endfunction
function SetFrameHeight takes integer pFrame, real height returns nothing
call this_call2(address_SetFrameHeight, pFrame, SetRealIntoMemory(height))
endfunction
function GetFrameWidth takes integer pFrame returns real
return GetRealFromMemory(Memory[pFrame/4 + 22])
endfunction
function GetFrameHeight takes integer pFrame returns real
return GetRealFromMemory(Memory[pFrame/4 + 23])
endfunction
function GetFramePointParent takes integer pFrame, integer point returns integer
return Memory[Memory[pFrame/4 + point + 2]/4 + 1]
endfunction
function GetFramePointRelativePoint takes integer pFrame, integer point returns integer
return Memory[Memory[pFrame/4 + point + 2]/4 + 2]
endfunction
function GetFramePointX takes integer pFrame, integer point returns real
return GetRealFromMemory(Memory[Memory[pFrame/4 + point + 2]/4 + 3])
endfunction
function GetFramePointY takes integer pFrame, integer point returns real
return GetRealFromMemory(Memory[Memory[pFrame/4 + point + 2]/4 + 4])
endfunction
function GetFrameTextAddress takes string name, integer id returns integer
return fast_call2(address_GetFrameTextAddress, GetStringAddress(name), id)
endfunction
function GetFrameItemAddress takes string name, integer id returns integer
return fast_call2(address_GetFrameItemAddress, GetStringAddress(name), id)
endfunction
function GetFrameSkinAddress takes string name, integer id returns integer
return fast_call2(address_GetFrameSkinAddress, GetStringAddress(name), id)
endfunction
function GetFrameTextString takes string name, integer id returns string
local integer FrameAddr = GetFrameTextAddress(name, id)
if FrameAddr == 0 then
return ""
endif
return ConvertNullTerminatedStringToString(ReadRealMemory(FrameAddr + 0x9C))
endfunction
function SetFrameTextAddress takes integer addr, string str returns nothing
call this_call2(address_UpdateFrameText, addr, GetStringAddress(str))
endfunction
// =================================================
function GetPanelButton takes integer pFrame, integer row, integer column returns integer
return Memory[Memory[4 * row + Memory[pFrame/4 + 85]/4 + 2]/4 + column]
endfunction
function GetMinimapButton takes integer id returns integer // id = [0; 4]
return ReadGameUIStruct(FRAME_MinimapButton1 + id)
endfunction
function GetUpperButtonBarButton takes integer id returns integer // id = [0; 3]
local integer pUpperButtonBar = ReadGameUIStruct(FRAME_UpperButtonBarFrame)
if (id == 0) then
return Memory[pUpperButtonBar/4 + 78]
elseif (id == 1) then
return Memory[pUpperButtonBar/4 + 76]
elseif (id == 2) then
return Memory[pUpperButtonBar/4 + 77]
elseif (id == 3) then
return Memory[pUpperButtonBar/4 + 88]
endif
return 0
endfunction
function GetCommandBarButton takes integer row, integer column returns integer // row = [0; 2] column = [0; 3]
local integer pCommandBar = ReadGameUIStruct(FRAME_CommandBar)
return GetPanelButton(pCommandBar, row, column)
endfunction
function GetItemBarButton takes integer id returns integer // id = [0; 5]
local integer pInfoBar = ReadGameUIStruct(FRAME_InfoBar)
local integer pItemBar = Memory[pInfoBar/4 + 82]
return Memory[Memory[pItemBar/4 + 76]/4 + 2 * id + 1]
endfunction
function GetHeroBarButton takes integer id returns integer // id = [0; 6]
local integer pHeroBar = ReadGameUIStruct(FRAME_HeroBar)
return GetPanelButton(pHeroBar, id, 0)
endfunction
// =================================================
function HideInterface takes nothing returns nothing
local integer pRootFrame = GetRootFrame()
call SetFramePoint(ReadGameUIStruct(FRAME_UpperButtonBarFrame), ANCHOR_TOPLEFT, pRootFrame, ANCHOR_TOPLEFT, 0.0, 1.0)
call SetFramePoint(ReadGameUIStruct(FRAME_ResourceBarFrame), ANCHOR_TOPRIGHT, pRootFrame, ANCHOR_TOPRIGHT, 0.0, 1.0)
call SetFramePoint(ReadGameUIStruct(FRAME_SimpleConsole), ANCHOR_TOPLEFT, pRootFrame, ANCHOR_TOPLEFT, 10.0, 0.0)
call SetFramePoint(ReadGameUIStruct(FRAME_SimpleConsole), ANCHOR_TOPRIGHT, pRootFrame, ANCHOR_TOPRIGHT, -10.0, 0.0)
call SetFramePoint(ReadGameUIStruct(FRAME_Portrait) + 180, ANCHOR_BOTTOMLEFT, pRootFrame, ANCHOR_BOTTOMLEFT, 1.0, 1.0)
call SetFramePoint(ReadGameUIStruct(FRAME_Minimap) + 180, ANCHOR_BOTTOMLEFT, pRootFrame, ANCHOR_BOTTOMLEFT, 1.0, 1.0)
call SetFramePoint(ReadGameUIStruct(FRAME_PeonBar), ANCHOR_BOTTOMLEFT, pRootFrame, ANCHOR_BOTTOMLEFT, 1.0, 1.0)
call SetFramePoint(ReadGameUIStruct(FRAME_HeroBar), ANCHOR_TOPLEFT, pRootFrame, ANCHOR_TOPLEFT, 0.0, 1.0)
call SetFramePoint(ReadGameUIStruct(FRAME_TimeOfDayIndicator) + 180, ANCHOR_BOTTOMLEFT, pRootFrame, ANCHOR_BOTTOMLEFT, 1.0, 1.0)
call SetFramePoint(Memory[ReadGameUIStruct(FRAME_TimeOfDayIndicator)/4 + 108] + 180, ANCHOR_TOP, pRootFrame, ANCHOR_TOP, 1.0, 0.0) // TimeOfDayIndicator UBERTIP
call SetFramePoint(Memory[ReadGameUIStruct(FRAME_InfoBar)/4 + 83], ANCHOR_BOTTOMRIGHT, pRootFrame, ANCHOR_TOPLEFT, 1.0, 0.0) // ConsoleInventoryCoverTexture
endfunction
function EditBlackBorders takes real upperHeight, real bottomHeight returns nothing
local integer pWorldFrameWar3 = ReadGameUIStruct(FRAME_WorldFrameWar3) + 180
local integer pRootFrame = GetRootFrame()
call SetFramePoint(pWorldFrameWar3, ANCHOR_TOPRIGHT, pRootFrame, ANCHOR_TOPRIGHT, 0.0, -upperHeight)
call SetFramePoint(pWorldFrameWar3, ANCHOR_BOTTOMLEFT, pRootFrame, ANCHOR_BOTTOMLEFT, 0.0, bottomHeight)
endfunction
function EditPortrait takes integer anchor, real offsetX, real offsetY, real width, real height returns nothing
local integer pPortraitFrame = ReadGameUIStruct(FRAME_Portrait) + 180
local integer pRootFrame = GetRootFrame()
if (width >= 0) then
call SetFrameWidth(pPortraitFrame, width)
endif
if (height >= 0) then
call SetFrameHeight(pPortraitFrame, height)
endif
call SetFramePoint(pPortraitFrame, ANCHOR_BOTTOMLEFT, pRootFrame, anchor, offsetX, -(offsetY + GetFrameHeight(pPortraitFrame)))
endfunction
function EditMinimap takes integer anchor, real offsetX, real offsetY, real width, real height returns nothing
local integer pMinimapFrame = ReadGameUIStruct(FRAME_Minimap) + 180
local integer pRootFrame = GetRootFrame()
call SetFramePoint(pMinimapFrame, ANCHOR_BOTTOMLEFT, pRootFrame, anchor, offsetX, -(offsetY + height))
call SetFramePoint(pMinimapFrame, ANCHOR_TOPRIGHT, pRootFrame, anchor, offsetX + width, -offsetY)
endfunction
function EditCommandBarButton takes integer row, integer column, integer anchor, real offsetX, real offsetY, real width, real height returns nothing
local integer pButtonFrame = GetCommandBarButton(row, column)
local integer pRootFrame = GetRootFrame()
if (width >= 0) then
call SetFrameWidth(pButtonFrame, width)
endif
if (height >= 0) then
call SetFrameHeight(pButtonFrame, height)
endif
call SetFramePoint(pButtonFrame, ANCHOR_TOPLEFT, pRootFrame, anchor, offsetX, -offsetY)
endfunction
function EditItemBarButton takes integer buttonId, integer anchor, real offsetX, real offsetY, real width, real height returns nothing
local integer pButtonFrame = GetItemBarButton(buttonId)
local integer pRootFrame = GetRootFrame()
if (width >= 0) then
call SetFrameWidth(pButtonFrame, width)
endif
if (height >= 0) then
call SetFrameHeight(pButtonFrame, height)
endif
call SetFramePoint(pButtonFrame, ANCHOR_TOPLEFT, pRootFrame, anchor, offsetX, -offsetY)
endfunction
function EditMinimapButton takes integer buttonId, integer anchor, real offsetX, real offsetY, real width, real height returns nothing
local integer pButtonFrame = GetMinimapButton(buttonId)
local integer pRootFrame = GetRootFrame()
if (width >= 0) then
call SetFrameWidth(pButtonFrame, width)
endif
if (height >= 0) then
call SetFrameHeight(pButtonFrame, height)
endif
call SetFramePoint(pButtonFrame, ANCHOR_TOPLEFT, pRootFrame, anchor, offsetX, -offsetY)
endfunction
function EditUpperButtonBarButton takes integer buttonId, integer anchor, real offsetX, real offsetY, real width, real height returns nothing
local integer pButtonFrame = GetUpperButtonBarButton(buttonId)
local integer pRootFrame = GetRootFrame()
if (width >= 0) then
call SetFrameWidth(pButtonFrame, width)
endif
if (height >= 0) then
call SetFrameHeight(pButtonFrame, height)
endif
if (buttonId == 0) then
call SetFramePoint(pButtonFrame, ANCHOR_TOPLEFT, pRootFrame, anchor, offsetX, -offsetY)
else
call SetFramePoint(pButtonFrame, ANCHOR_LEFT, pRootFrame, anchor, offsetX, -(offsetY + GetFrameHeight(pButtonFrame)/2))
endif
endfunction
function EditHeroBarButton takes integer buttonId, integer anchor, real offsetX, real offsetY, real width, real height returns nothing
local integer pButtonFrame = GetHeroBarButton(buttonId)
local integer pRootFrame = GetRootFrame()
if (width >= 0) then
call SetFrameWidth(pButtonFrame, width)
endif
if (height >= 0) then
call SetFrameHeight(pButtonFrame, height)
endif
call SetFramePoint(pButtonFrame, ANCHOR_TOPLEFT, pRootFrame, anchor, offsetX, -offsetY)
endfunction
function EditHeroBarHealthBar takes integer buttonId, integer anchor, real offsetX, real offsetY, real width, real height returns nothing
local integer pHealthFrame = Memory[GetHeroBarButton(buttonId)/4 + 115]
local integer pRootFrame = GetRootFrame()
if (width >= 0) then
call SetFrameWidth(pHealthFrame, width)
endif
if (height >= 0) then
call SetFrameHeight(pHealthFrame, height)
endif
call SetFramePoint(pHealthFrame, ANCHOR_TOP, pRootFrame, anchor, offsetX + GetFrameWidth(pHealthFrame)/2, -offsetY)
endfunction
function EditHeroBarManaBar takes integer buttonId, integer anchor, real offsetX, real offsetY, real width, real height returns nothing
local integer pManaFrame = Memory[GetHeroBarButton(buttonId)/4 + 116]
local integer pRootFrame = GetRootFrame()
if (width >= 0) then
call SetFrameWidth(pManaFrame, width)
endif
if (height >= 0) then
call SetFrameHeight(pManaFrame, height)
endif
call SetFramePoint(pManaFrame, ANCHOR_TOP, pRootFrame, anchor, offsetX + GetFrameWidth(pManaFrame)/2, -offsetY)
endfunction
// =================================================
private function Init takes nothing returns nothing
set address_GetGameUI = address_GameBase + 0x300710
set address_SetFramePoint = address_GameBase + 0x606770
set address_SetFramePoint2 = address_GameBase + 0x6061B0
set address_SetFrameWidth = address_GameBase + 0x605D90
set address_SetFrameHeight = address_GameBase + 0x605DB0
set address_GetFrameTextAddress = address_GameBase + 0x61C7B0
set address_GetFrameItemAddress = address_GameBase + 0x5FA970
set address_GetFrameSkinAddress = address_GameBase + 0x31F530
set address_UpdateFrameText = address_GameBase + 0x60CA10
set pGameUI = GetGameUI(0, 0)
endfunction
endlibrary