mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
feat: add core WoW Lua API functions for addon development
Add 13 WoW-compatible Lua API functions that addons can call: Unit API: UnitName, UnitHealth, UnitHealthMax, UnitPower, UnitPowerMax, UnitLevel, UnitExists, UnitIsDead, UnitClass (supports "player", "target", "focus", "pet" unit IDs) Game API: GetMoney, IsInGroup, IsInRaid, GetPlayerMapPosition Updated HelloWorld addon to demonstrate querying player state.
This commit is contained in:
parent
290e9bfbd8
commit
7da1f6f5ca
2 changed files with 185 additions and 0 deletions
|
|
@ -1,3 +1,18 @@
|
|||
-- HelloWorld addon — test the WoWee addon system
|
||||
print("|cff00ff00[HelloWorld]|r Addon loaded! Lua 5.1 is working.")
|
||||
print("|cff00ff00[HelloWorld]|r GetTime() = " .. string.format("%.2f", GetTime()) .. " seconds")
|
||||
|
||||
-- Query player info (will show real data when called after world entry)
|
||||
local name = UnitName("player")
|
||||
local level = UnitLevel("player")
|
||||
local health = UnitHealth("player")
|
||||
local maxHealth = UnitHealthMax("player")
|
||||
local gold = math.floor(GetMoney() / 10000)
|
||||
|
||||
print("|cff00ff00[HelloWorld]|r Player: " .. name .. " (Level " .. level .. ")")
|
||||
if maxHealth > 0 then
|
||||
print("|cff00ff00[HelloWorld]|r Health: " .. health .. "/" .. maxHealth)
|
||||
end
|
||||
if gold > 0 then
|
||||
print("|cff00ff00[HelloWorld]|r Gold: " .. gold .. "g")
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue