diff --git a/.pkgmeta b/.pkgmeta
index 9313abf..56cd803 100644
--- a/.pkgmeta
+++ b/.pkgmeta
@@ -1,6 +1,9 @@
package-as: ItemRack
externals:
ItemRack/Libs/LibStub: https://repos.curseforge.com/wow/libstub/trunk
+ ItemRack/Libs/CallbackHandler-1.0: https://repos.curseforge.com/wow/callbackhandler/trunk/CallbackHandler-1.0
+ ItemRack/Libs/LibDataBroker-1.1: https://github.com/tekkub/libdatabroker-1-1
+ ItemRack/Libs/LibDBIcon-1.0: https://repos.curseforge.com/wow/libdbicon-1-0/trunk/LibDBIcon-1.0
ItemRackOptions/Libs/LibStub: https://repos.curseforge.com/wow/libstub/trunk
move-folders:
ItemRack/ItemRack: ItemRack
diff --git a/ItemRack/ItemRack.lua b/ItemRack/ItemRack.lua
index 9ad7acf..176aa07 100644
--- a/ItemRack/ItemRack.lua
+++ b/ItemRack/ItemRack.lua
@@ -12,6 +12,9 @@ function ItemRack.IsBCC()
return WOW_PROJECT_ID == WOW_PROJECT_BURNING_CRUSADE_CLASSIC
end
+local LDB = LibStub("LibDataBroker-1.1")
+local LDBIcon = LibStub("LibDBIcon-1.0")
+
ItemRackUser = {
Sets = {}, -- user's sets
ItemsUsed = {}, -- items that have been used (for notify purposes)
@@ -46,8 +49,7 @@ ItemRackSettings = {
AllowEmpty = "ON", -- allow empty slot as a choice in menus
HideTradables = "OFF", -- allow non-soulbound gear to appear in menu
AllowHidden = "ON", -- allow the ability to hide items/sets in the menu with alt+click
- ShowMinimap = "ON", -- whether to show the minimap button
- SquareMinimap = "OFF", -- whether to position minimap button as if on a square minimap
+ ShowMinimap = true, -- whether to show the minimap button
TrinketMenuMode = "OFF", -- whether to merge top/bottom trinkets to one menu (leftclick=top,rightclick=bottom)
AnotherOther = "OFF", -- whether to dock the merged trinket menu to bottom trinket
EquipToggle = "OFF", -- whether to toggle equipping a set when choosing to equip it
@@ -149,8 +151,6 @@ ItemRack.TooltipInfo = {
ItemRack.BankOpen = nil -- 1 if bank is open, nil if not
-ItemRack.LastCurrentSet = nil -- last known current set
-
ItemRack.EventHandlers = {}
ItemRack.ExternalEventHandlers = {}
@@ -216,6 +216,7 @@ end
function ItemRack.OnPlayerLogin()
-- Normally some of these methods cannot be called in combat without causing errors, but since we run these IMMEDIATELY
-- on PLAYER_LOGIN event we get a grace period where it allows us to run secure code in combat.
+ ItemRack.InitBroker()
ItemRack.InitEventHandlers()
ItemRack.InitTimers()
ItemRack.InitCore()
@@ -445,9 +446,7 @@ function ItemRack.InitCore()
ItemRack.CreateTimer("MenuMouseover",ItemRack.MenuMouseover,.25,1)
ItemRack.CreateTimer("TooltipUpdate",ItemRack.TooltipUpdate,1,1)
ItemRack.CreateTimer("CooldownUpdate",ItemRack.CooldownUpdate,1,1)
- ItemRack.CreateTimer("MinimapDragging",ItemRack.MinimapDragging,0,1)
ItemRack.CreateTimer("LocksChanged",ItemRack.LocksChanged,.2)
- ItemRack.CreateTimer("MinimapShine",ItemRack.MinimapShineUpdate,0,1)
ItemRack.CreateTimer("DelayedCombatQueue",ItemRack.DelayedCombatQueue,.1)
for i=-2,11 do
@@ -483,7 +482,6 @@ function ItemRack.InitCore()
ItemRackFrame:RegisterEvent("UNIT_SPELLCAST_FAILED")
--end
ItemRack.StartTimer("CooldownUpdate")
- ItemRack.MoveMinimap()
ItemRack.ReflectAlpha()
ItemRack.SetSetBindings()
@@ -519,11 +517,7 @@ function ItemRack.UpdateCurrentSet()
ItemRackButton20Icon:SetTexture(texture)
ItemRackButton20Name:SetText(setname)
end
- ItemRackMinimapIcon:SetTexture(texture)
- if setname ~= ItemRack.LastCurrentSet then
- ItemRack.MinimapShineFadeIn()
- ItemRack.LastCurrentSet = setname
- end
+ ItemRack.Broker.icon = texture
end
--[[ Item info gathering ]]
@@ -1728,35 +1722,26 @@ end
--[[ Minimap button ]]
-function ItemRack.MinimapDragging()
- local xpos,ypos = GetCursorPosition()
- local xmin,ymin = Minimap:GetLeft(), Minimap:GetBottom()
-
- xpos = xmin-xpos/Minimap:GetEffectiveScale()+70
- ypos = ypos/Minimap:GetEffectiveScale()-ymin-70
-
- ItemRackSettings.IconPos = math.deg(math.atan2(ypos,xpos))
- ItemRack.MoveMinimap()
-end
-
-function ItemRack.MoveMinimap()
- if ItemRackSettings.ShowMinimap=="ON" then
- local xpos,ypos
- local angle = ItemRackSettings.IconPos or -100
- if ItemRackSettings.SquareMinimap=="ON" then
- -- brute force method until trig solution figured out - min/max a point on a circle beyond square
- xpos = 110 * cos(angle)
- ypos = 110 * sin(angle)
- xpos = math.max(-82,math.min(xpos,84))
- ypos = math.max(-86,math.min(ypos,82))
- else
- xpos = 80*cos(angle)
- ypos = 80*sin(angle)
- end
- ItemRackMinimapFrame:SetPoint("TOPLEFT","Minimap","TOPLEFT",52-xpos,ypos-52)
- ItemRackMinimapFrame:Show()
+function ItemRack.InitBroker()
+ local texture = ItemRack.GetTextureBySlot(20)
+ texture = [[Interface\AddOns\ItemRack\ItemRackIcon]]
+ ItemRack.Broker = LDB:NewDataObject("ItemRack", {
+ type = "launcher",
+ text = "ItemRack",
+ icon = texture,
+ OnClick = ItemRack.MinimapOnClick,
+ OnEnter = ItemRack.MinimapOnEnter
+ })
+ ItemRackSettings.minimap = ItemRackSettings.minimap or { hide = false }
+ LDBIcon:Register("ItemRack", ItemRack.Broker, ItemRackSettings.minimap)
+ ItemRack.ShowMinimap()
+end
+
+function ItemRack.ShowMinimap()
+ if ItemRackSettings.ShowMinimap == "ON" then
+ LDBIcon:Show("ItemRack")
else
- ItemRackMinimapFrame:Hide()
+ LDBIcon:Hide("ItemRack")
end
end
@@ -1773,9 +1758,9 @@ function ItemRack.MinimapOnClick(self,button)
else
local xpos,ypos = GetCursorPosition()
if ypos>400 then
- ItemRack.DockWindows("TOPRIGHT",ItemRackMinimapFrame,"BOTTOMRIGHT","VERTICAL")
+ ItemRack.DockWindows("TOPRIGHT",self,"BOTTOMRIGHT","VERTICAL")
else
- ItemRack.DockWindows("BOTTOMRIGHT",ItemRackMinimapFrame,"TOPRIGHT","VERTICAL")
+ ItemRack.DockWindows("BOTTOMRIGHT",self,"TOPRIGHT","VERTICAL")
end
ItemRack.BuildMenu(20, nil, 4)
end
@@ -1790,26 +1775,6 @@ function ItemRack.MinimapOnEnter(self)
end
end
-
-function ItemRack.MinimapShineUpdate(elapsed)
- ItemRack.MinimapShineAlpha = ItemRack.MinimapShineAlpha + (elapsed*2*ItemRack.MinimapShineDirection)
- if ItemRack.MinimapShineAlpha < .1 then
- ItemRack.StopTimer("MinimapShine")
- ItemRackMinimapShine:Hide()
- elseif ItemRack.MinimapShineAlpha > .9 then
- ItemRack.MinimapShineDirection = -1
- else
- ItemRackMinimapShine:SetAlpha(ItemRack.MinimapShineAlpha)
- end
-end
-
-function ItemRack.MinimapShineFadeIn()
- ItemRack.MinimapShineAlpha = .1
- ItemRack.MinimapShineDirection = 1
- ItemRackMinimapShine:Show()
- ItemRack.StartTimer("MinimapShine")
-end
-
--[[ Non-LoD options support ]]
function ItemRack.ToggleOptions(self,tab)
diff --git a/ItemRack/ItemRack.xml b/ItemRack/ItemRack.xml
index 17a2fa5..25fe38a 100644
--- a/ItemRack/ItemRack.xml
+++ b/ItemRack/ItemRack.xml
@@ -43,99 +43,6 @@
-
-
diff --git a/ItemRack/ItemRackEvents.lua b/ItemRack/ItemRackEvents.lua
index 55a6c36..4699171 100644
--- a/ItemRack/ItemRackEvents.lua
+++ b/ItemRack/ItemRackEvents.lua
@@ -451,17 +451,21 @@ function ItemRack.ProcessBuffEvent()
end
end
+local prevIcon
function ItemRack.ReflectEventsRunning()
if ItemRackUser.EnableEvents=="ON" and next(ItemRackUser.Events.Enabled) then
-- if events enabled and an event is enabled, show gear icons on set and minimap button
if ItemRackUser.Buttons[20] then
ItemRackButton20Queue:Show()
end
- ItemRackMinimapGear:Show()
+ prevIcon = ItemRack.Broker.icon
+ ItemRack.Broker.icon = [[Interface\AddOns\ItemRack\ItemRackGear]]
else
if ItemRackUser.Buttons[20] then
ItemRackButton20Queue:Hide()
end
- ItemRackMinimapGear:Hide()
+ if prevIcon then
+ ItemRack.Broker.icon = prevIcon
+ end
end
end
diff --git a/ItemRack/Libs/Libs.xml b/ItemRack/Libs/Libs.xml
index 64ed596..01f63ae 100644
--- a/ItemRack/Libs/Libs.xml
+++ b/ItemRack/Libs/Libs.xml
@@ -1,4 +1,7 @@
+
+
+
diff --git a/ItemRackOptions/ItemRackOptions.lua b/ItemRackOptions/ItemRackOptions.lua
index 50c55ad..c44d1b5 100644
--- a/ItemRackOptions/ItemRackOptions.lua
+++ b/ItemRackOptions/ItemRackOptions.lua
@@ -114,7 +114,6 @@ function ItemRackOpt.OnLoad(self)
{type="check",optset=ItemRackSettings,variable="AllowHidden",label="Allow hidden items",tooltip="Enable Alt+clicking of menu items to hide/show them in the menu. Hold Alt as you enter a menu to show all."},
{type="check",optset=ItemRackSettings,variable="HideTradables",label="Hide tradables",tooltip="Prevent tradable items from showing up in the menu."},
{type="check",optset=ItemRackSettings,variable="ShowMinimap",label="Show minimap button",tooltip="Show the minimap button to access options or change sets."},
- {type="check",optset=ItemRackSettings,variable="SquareMinimap",depend="ShowMinimap",label="Square minimap",tooltip="If you use a square minimap, make the button drag along square edge."},
{type="check",optset=ItemRackSettings,variable="MinimapTooltip",depend="ShowMinimap",label="Show minimap tooltip",tooltip="If tooltips enabled, show what mouse clicks will do when clicking the minimap button."},
{type="check",optset=ItemRackSettings,variable="TrinketMenuMode",label="TrinketMenu mode",tooltip="When mouseover of either trinket slot, open anchored to the top trinket. Left click of a menu item will equip to the top trinket. Right click will equip to the bottom trinket."},
{type="check",optset=ItemRackSettings,variable="AnchorOther",depend="TrinketMenuMode",label="Anchor other trinket",tooltip="In TrinketMenu mode, trinket menus dock to the top trinket. Check this to anchor them to the bottom trinket."},
@@ -824,8 +823,8 @@ function ItemRackOpt.OptListCheckButtonOnClick(self,override)
ItemRack.WriteMenuCooldowns()
elseif opt.variable=="LargeNumbers" then
ItemRack.ReflectCooldownFont()
- elseif opt.variable=="ShowMinimap" or opt.variable=="SquareMinimap" then
- ItemRack.MoveMinimap()
+ elseif opt.variable=="ShowMinimap" then
+ ItemRack.ShowMinimap()
elseif opt.variable=="EnableQueues" or opt.variable=="EnablePerSetQueues" then
ItemRack.UpdateCombatQueue()
elseif opt.variable=="ShowHotKeys" then