Skip to content

Commit

Permalink
Fix PlayerLocation, ItemLocation, TransmogLocation
Browse files Browse the repository at this point in the history
  • Loading branch information
Ketho committed Dec 10, 2024
1 parent 022bf61 commit 1387792
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 18 deletions.
7 changes: 6 additions & 1 deletion Annotations/Interface/Blizzard_FrameXML/TransmogUtil.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@ TransmogPendingInfoMixin = {}
---@param category number
function TransmogPendingInfoMixin:Init(pendingType, transmogID, category) end

---@class TransmogLocationType
---@field slotID? InventorySlots
---@field type? Enum.TransmogType
---@field modification? Enum.TransmogModification

---[Documentation](https://warcraft.wiki.gg/wiki/TransmogLocationMixin)
---@class TransmogLocationMixin
---@class TransmogLocationMixin : TransmogLocationType
TransmogLocationMixin = {}

---@param slotID number
Expand Down
7 changes: 6 additions & 1 deletion Annotations/Interface/Blizzard_ObjectAPI/ItemLocation.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
---@meta _
ItemLocation = {}

---@class ItemLocationMixin
---@class ItemLocationType
---@field equipmentSlotIndex? number
---@field bagID? number
---@field slotIndex? number

---@class ItemLocationMixin : ItemLocationType
---[Documentation](https://warcraft.wiki.gg/wiki/ItemLocationMixin)
ItemLocationMixin = {}

Expand Down
7 changes: 6 additions & 1 deletion Annotations/Interface/Blizzard_ObjectAPI/PlayerLocation.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
---@meta _
PlayerLocation = {}

---@class PlayerLocationType
---@field unit? string
---@field chatLineID? number
---@field guid? string

---[Documentation](https://warcraft.wiki.gg/wiki/PlayerLocationMixin)
---@class PlayerLocationMixin
---@class PlayerLocationMixin : PlayerLocationType
PlayerLocationMixin = {}

---@param guid string
Expand Down
13 changes: 8 additions & 5 deletions Annotations/Interface/Blizzard_SharedXML/Color.lua
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
---@meta _

---@class ColorType
---@field r number
---@field g number
---@field b number
---@field a? number

---[FrameXML](https://www.townlong-yak.com/framexml/go/ColorMixin)
---@class ColorMixin
---@field r number|nil
---@field g number|nil
---@field b number|nil
---@field a number|nil
---@class ColorMixin : ColorType
ColorMixin = {}

---[FrameXML](https://www.townlong-yak.com/framexml/go/CreateColor)
Expand Down
9 changes: 6 additions & 3 deletions Annotations/Interface/Blizzard_SharedXML/Vector2D.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
---@meta _

---@class Vector2DType
---@field x number
---@field y number

---[FrameXML](https://www.townlong-yak.com/framexml/go/Vector2DMixin)
---@class Vector2DMixin
---@field x number|nil
---@field y number|nil
---@class Vector2DMixin : Vector2DType
Vector2DMixin = {}

---[FrameXML](https://www.townlong-yak.com/framexml/go/CreateVector2D)
Expand Down
11 changes: 7 additions & 4 deletions Annotations/Interface/Blizzard_SharedXML/Vector3D.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
---@meta _

---@class Vector3DType
---@field x number
---@field y number
---@field z number

---[FrameXML](https://www.townlong-yak.com/framexml/go/Vector3DMixin)
---@class Vector3DMixin
---@field x number|nil
---@field y number|nil
---@field z number|nil
---@class Vector3DMixin : Vector3DType
Vector3DMixin = {}

---[FrameXML](https://www.townlong-yak.com/framexml/go/CreateVector3D)
Expand Down
6 changes: 3 additions & 3 deletions Annotations/Type/Mixin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
---@alias colorRGB ColorMixin
---@alias colorRGBA ColorMixin
---@alias EmptiableItemLocation ItemLocationMixin
---@alias ItemLocation ItemLocationMixin
---@alias ItemLocation ItemLocationType
---@alias ItemTransmogInfo ItemTransmogInfoMixin
---@alias PlayerLocation PlayerLocationMixin
---@alias PlayerLocation PlayerLocationType
---@alias ReportInfo ReportInfoMixin
---@alias TransmogLocation TransmogLocationMixin
---@alias TransmogLocation TransmogLocationType
---@alias TransmogPendingInfo TransmogPendingInfoMixin
---@alias vector2 Vector2DMixin
---@alias vector3 Vector3DMixin
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Change Log

## [0.18.0] - 2024-12-10
- Fixed PlayerLocation, ItemLocation and TransmogLocation types to not require the whole mixin

## [0.17.9] - 2024-11-28
- Added Blizzard_Menu annotations (by Numy)

Expand Down Expand Up @@ -159,6 +162,7 @@ To avoid loading for Lua projects not related to World of Warcraft, all settings
- PR [#123](https://github.com/Ketho/vscode-wow-api/pull/123) Make childGroups optional in AceConfig.OptionsTable
- PR [#120](https://github.com/Ketho/vscode-wow-api/pull/120) Add definition for tostringall()

[0.18.0]: https://github.com/Ketho/vscode-wow-api/releases/tag/0.18.0
[0.17.9]: https://github.com/Ketho/vscode-wow-api/releases/tag/0.17.9
[0.17.8]: https://github.com/Ketho/vscode-wow-api/releases/tag/0.17.8
[0.17.7]: https://github.com/Ketho/vscode-wow-api/releases/tag/0.17.7
Expand Down
26 changes: 26 additions & 0 deletions LuaScripts/Tests/Mixins.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
-- PlayerLocation
local playerLoc = PlayerLocation:CreateFromUnit("player")
local class1 = C_PlayerInfo.GetClass({unit = "player"})
local class2 = C_PlayerInfo.GetClass(playerLoc)

-- ItemLocation
local itemLoc = ItemLocation:CreateFromEquipmentSlot(1)
local name1 = C_Item.GetItemName(itemLoc)
local name2 = C_Item.GetItemName({equipmentSlotIndex = 1})

-- TransmogLocation
local TransmogUtil = {}
---@type TransmogLocation
local transmogLoc = TransmogUtil.CreateTransmogLocation("HEADSLOT", Enum.TransmogType.Appearance, Enum.TransmogModification.Main)
local slotInfo1 = C_Transmog.GetSlotInfo(transmogLoc)
local slotInfo2 = C_Transmog.GetSlotInfo({slotID=1, type=0, modification=0})

-- todo: differentiate between a mixin as argument or as return

-- vector2, vector3
-- local pos1, pos3 = C_Map.GetWorldPosFromMapPos(37, CreateVector2D(.5, 1))
-- local pos2 = C_Map.GetWorldPosFromMapPos(37, {x = .5, y = 1})

-- colorRGB, colorRGBA
-- local tex = CreateFrame("Frame"):CreateTexture()
-- tex:SetGradient("HORIZONTAL", {r=1, g=1, b=0, a=1}, {r=0, g=0, b=1, a=1})

0 comments on commit 1387792

Please sign in to comment.