Move from SVN to GIT
This commit is contained in:
687
MyEquipment/MyEquipment.lua
Normal file
687
MyEquipment/MyEquipment.lua
Normal file
@ -0,0 +1,687 @@
|
||||
local MYBAGS_MAXEQUIPSLOTS = 19
|
||||
local MYBAGS_SLOTCOLOR = { 0.5, 0.5, 0.5 }
|
||||
local MYEQUIPMENT_SLOT = {}
|
||||
|
||||
local SLOTNAMES = {
|
||||
"HEADSLOT",
|
||||
"NECKSLOT",
|
||||
"SHOULDERSLOT",
|
||||
"BACKSLOT",
|
||||
"CHESTSLOT",
|
||||
"SHIRTSLOT",
|
||||
"TABARDSLOT",
|
||||
"WRISTSLOT",
|
||||
"HANDSSLOT",
|
||||
"WAISTSLOT",
|
||||
"LEGSSLOT",
|
||||
"FEETSLOT",
|
||||
"FINGER0SLOT",
|
||||
"FINGER1SLOT",
|
||||
"TRINKET0SLOT",
|
||||
"TRINKET1SLOT",
|
||||
"MAINHANDSLOT",
|
||||
"SECONDARYHANDSLOT",
|
||||
}
|
||||
|
||||
local MYEQUIPMENT_DEFAULT_OPTIONS = {
|
||||
["Columns"] = 7,
|
||||
["Graphics"] = "art",
|
||||
["Lock"] = false,
|
||||
["NoEsc"] = false,
|
||||
["Title"] = true,
|
||||
["Cash"] = true,
|
||||
["Sort"] = "realm",
|
||||
["Buttons"] = true,
|
||||
["Border"] = true,
|
||||
["Cache"] = nil,
|
||||
["Player"] = true,
|
||||
["Scale"] = false,
|
||||
["Strata"] = "DIALOG",
|
||||
["Anchor"] = "bottomright",
|
||||
["BackColor"] = {0.7,0,0,0},
|
||||
["SlotColor"] = nil,
|
||||
["_TOPOFFSET"] = 28,
|
||||
["_BOTTOMOFFSET"] = 20,
|
||||
["_LEFTOFFSET"] = 8,
|
||||
["_RIGHTOFFSET"] = 3,
|
||||
}
|
||||
|
||||
MyEquipment = LibStub("AceAddon-3.0"):NewAddon("MyEquipment", "AceConsole-3.0", "AceHook-3.0", "AceEvent-3.0", "MyBagsCore-1.0")
|
||||
local ME_Dialog = LibStub("AceConfigDialog-3.0")
|
||||
local ME_Cmd = LibStub("AceConfigCmd-3.0")
|
||||
|
||||
local function ColorConvertHexToDigit(h)
|
||||
if(strlen(h)~=6) then return 0,0,0 end
|
||||
local r={a=10,b=11,c=12,d=13,e=14,f=15}
|
||||
return ((tonumber(strsub(h,1,1)) or r[strsub(h,1,1)] or 0) * 16 + (tonumber(strsub(h,2,2)) or r[strsub(h,2,2)] or 0))/255,
|
||||
((tonumber(strsub(h,3,3)) or r[strsub(h,3,3)] or 0) * 16 + (tonumber(strsub(h,4,4)) or r[strsub(h,4,4)] or 0))/255,
|
||||
((tonumber(strsub(h,5,5)) or r[strsub(h,5,5)] or 0) * 16 + (tonumber(strsub(h,6,6)) or r[strsub(h,6,6)] or 0))/255
|
||||
end
|
||||
|
||||
local function GetItemInfoFromLink(l)
|
||||
if(not l) then return end
|
||||
local c,id,il,n=select(3, strfind(l,"|cff(%x+)|Hitem:(%-?%d+)([^|]+)|h%[(.-)%]|h|r"))
|
||||
return n,c,id..il,id
|
||||
end
|
||||
|
||||
local function tonum(val)
|
||||
return tonumber(val or 0)
|
||||
end
|
||||
|
||||
function MyEquipment:OnInitialize()
|
||||
self.name = "MyEquipment"
|
||||
self.frameName = "MyEquipmentFrame"
|
||||
self.defaults = MYEQUIPMENT_DEFAULT_OPTIONS
|
||||
self.isEquipment = true
|
||||
self.anchorPoint = "BOTTOM"
|
||||
self.anchorParent = "UIParent"
|
||||
self.anchorOffsetX = -5
|
||||
self.anchorOffsetY = 100
|
||||
self.db = LibStub("AceDB-3.0"):New("MyEquipmentDB")
|
||||
local prof = self.db:GetCurrentProfile()
|
||||
if self.db.profiles[prof] and self.db.profiles[prof]["Columns"] and self.db.profiles[prof]["Columns"] > 0 then
|
||||
else
|
||||
self.db.profiles[prof] = self.defaults
|
||||
end
|
||||
self:RegisterChatCommand("mq", "ME_ChatCommand")
|
||||
self:RegisterChatCommand("myequip", "ME_ChatCommand")
|
||||
self:RegisterChatCommand("myequipment", "ME_ChatCommand")
|
||||
self.options = {
|
||||
type = "group",
|
||||
args = {
|
||||
lock = {
|
||||
type = "toggle",
|
||||
name = "Lock",
|
||||
desc = "Keep the window from moving",
|
||||
get = function(info)
|
||||
return MyEquipment.IsSet("Lock")
|
||||
end,
|
||||
set = function(info, val)
|
||||
MyEquipment:SetLock()
|
||||
end,
|
||||
},
|
||||
back = {
|
||||
type = "select",
|
||||
name = "Background",
|
||||
desc = "Toggle window background options",
|
||||
values = {
|
||||
["default"] = "Semi-transparent minimalistic background",
|
||||
["art"] = "Blizard style artwork",
|
||||
["none"] = "Disable background",
|
||||
},
|
||||
get = function(info)
|
||||
return MyEquipment.GetOpt("Graphics")
|
||||
end,
|
||||
set = function(info, val)
|
||||
MyEquipment:SetGraphicsDisplay(val)
|
||||
end,
|
||||
},
|
||||
cols = {
|
||||
type = "range",
|
||||
name = "Columns",
|
||||
desc = "Resize the frame",
|
||||
step = 1,
|
||||
min = 2,
|
||||
max = 24,
|
||||
softMin = 2,
|
||||
softMax = 24,
|
||||
get = function(info)
|
||||
return MyEquipment.GetOpt("Columns")
|
||||
end,
|
||||
set = function(info, val)
|
||||
MyEquipment:SetColumns(val)
|
||||
end,
|
||||
},
|
||||
sort = {
|
||||
type = "select",
|
||||
name = "Sort",
|
||||
desc = "Sort names in character list",
|
||||
values = {
|
||||
["realm"] = "Sort by realm names first",
|
||||
["char"] = "Sort by character names first",
|
||||
["update"] = "Sort by update times",
|
||||
},
|
||||
get = function(info)
|
||||
return MyEquipment.GetOpt("Sort")
|
||||
end,
|
||||
set = function(info, val)
|
||||
MyEquipment.SetOpt("Sort", val)
|
||||
MyEquipment.Result("Sort: ", val)
|
||||
end,
|
||||
},
|
||||
noesc = {
|
||||
type = "toggle",
|
||||
name = "Escape",
|
||||
desc = "Remove frame from the list of UI managed files, to be used with freeze",
|
||||
get = function(info)
|
||||
return MyEquipment.GetOpt("NoEsc")
|
||||
end,
|
||||
set = function(info, val)
|
||||
MyEquipment:SetNoEsc()
|
||||
end,
|
||||
},
|
||||
title = {
|
||||
type = "toggle",
|
||||
name = "Title",
|
||||
desc = "Show/Hide the title",
|
||||
get = function(info)
|
||||
return MyEquipment.GetOpt("Title")
|
||||
end,
|
||||
set = function(info, val)
|
||||
MyEquipment:SetTitle()
|
||||
end,
|
||||
},
|
||||
cash = {
|
||||
type = "toggle",
|
||||
name = "Cash",
|
||||
desc = "Show/Hide the money display",
|
||||
get = function(info)
|
||||
return MyEquipment.GetOpt("Cash")
|
||||
end,
|
||||
set = function(info, val)
|
||||
MyEquipment:SetCash()
|
||||
end,
|
||||
},
|
||||
buttons = {
|
||||
type = "toggle",
|
||||
name = "Buttons",
|
||||
desc = "Show/Hide the close and lock buttons",
|
||||
get = function(info)
|
||||
return MyEquipment.GetOpt("Buttons")
|
||||
end,
|
||||
set = function(info, val)
|
||||
MyEquipment:SetButtons()
|
||||
end,
|
||||
},
|
||||
aioi = {
|
||||
type = "toggle",
|
||||
name = "AIOI",
|
||||
desc = "Toggle partial row placement at bottom left or upper right",
|
||||
get = function(info)
|
||||
return MyEquipment.GetOpt("AIOI")
|
||||
end,
|
||||
set = function(info, val)
|
||||
MyEquipment:SetAIOI()
|
||||
end,
|
||||
},
|
||||
quality = {
|
||||
type = "toggle",
|
||||
name = "Quality",
|
||||
desc = "Highlight items based on quality",
|
||||
get = function(info)
|
||||
return MyEquipment.GetOpt("Border")
|
||||
end,
|
||||
set = function(info, val)
|
||||
MyEquipment:SetBorder()
|
||||
end,
|
||||
},
|
||||
player = {
|
||||
type = "toggle",
|
||||
name = "Player",
|
||||
desc = "Show/Hide the offline player selection box",
|
||||
get = function(info)
|
||||
return MyEquipment.GetOpt("Player")
|
||||
end,
|
||||
set = function(info, val)
|
||||
MyEquipment:SetPlayerSel()
|
||||
end,
|
||||
},
|
||||
scale = {
|
||||
type = "range",
|
||||
name = "Scale",
|
||||
desc = "Sets the Scale for the frame",
|
||||
min = 0.2,
|
||||
max = 2.0,
|
||||
softMin = 0.2,
|
||||
softMax = 2.0,
|
||||
get = function(info)
|
||||
return MyEquipment.GetOpt("Scale")
|
||||
end,
|
||||
set = function(info, val)
|
||||
MyEquipment:SetScale(val)
|
||||
end,
|
||||
},
|
||||
strata = {
|
||||
type = "select",
|
||||
name = "Strata",
|
||||
desc = "Sets the Strata for the frame",
|
||||
values = {
|
||||
["BACKGROUND"] = "BACKGROUND",
|
||||
["LOW"] = "LOW",
|
||||
["MEDIUM"] = "MEDIUM",
|
||||
["HIGH"] = "HIGH",
|
||||
["DIALOG"] = "DIALOG",
|
||||
},
|
||||
get = function(info)
|
||||
return MyEquipment.GetOpt("Strata")
|
||||
end,
|
||||
set = function(info, val)
|
||||
MyEquipment:SetStrata(val)
|
||||
end,
|
||||
},
|
||||
anchor = {
|
||||
type = "select",
|
||||
name = "Anchor",
|
||||
desc = "Sets the anchor point for the frame",
|
||||
values = {
|
||||
["bottomleft"] = "Frame grows from bottom left",
|
||||
["bottomright"] = "Frame grows from bottom right",
|
||||
["topleft"] = "Frame grows from top left",
|
||||
["topright"] = "Frame grows from top right",
|
||||
},
|
||||
get = function(info)
|
||||
return MyEquipment.GetOpt("Anchor")
|
||||
end,
|
||||
set = function(info, val)
|
||||
MyEquipment:SetAnchor(val)
|
||||
end,
|
||||
},
|
||||
tog = {
|
||||
type = "execute",
|
||||
name = "Toggle",
|
||||
desc = "Toggle the frame",
|
||||
guiHidden = true,
|
||||
func = function()
|
||||
MyEquipment:Toggle()
|
||||
end,
|
||||
},
|
||||
reset = {
|
||||
type = "multiselect",
|
||||
name = "Reset",
|
||||
desc = "Resets elements of the addon",
|
||||
guiHidden = true,
|
||||
values = {
|
||||
["settings"] = "Reset all settings to default",
|
||||
["anchor"] = "Reanchors the frame to it's default position",
|
||||
},
|
||||
get = function(info, key)
|
||||
return true
|
||||
end,
|
||||
set = function(info, key, val)
|
||||
if key == "settings" then
|
||||
MyEquipment:ResetSettings()
|
||||
end
|
||||
if key == "anchor" then
|
||||
MyEquipment:ResetAnchor()
|
||||
end
|
||||
end
|
||||
},
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
function MyEquipment:OnEnable()
|
||||
MyEquipmentFramePortrait:SetTexture("Interface\\Addons\\MyBags\\Skin\\MyEquipmentPortrait")
|
||||
local key, value
|
||||
for key,value in pairs( SLOTNAMES ) do -- Just in case Blizzard shuffles the slot name table around
|
||||
local slotId = GetInventorySlotInfo(value)
|
||||
MYEQUIPMENT_SLOT[slotId] = value
|
||||
end
|
||||
end
|
||||
|
||||
function MyEquipment:Disable()
|
||||
end
|
||||
|
||||
function MyEquipment:RegisterEvents()
|
||||
self:RegisterEvent("UNIT_INVENTORY_CHANGED", "LayoutFrameOnEvent")
|
||||
self:RegisterEvent("ITEM_LOCK_CHANGED", "LayoutFrameOnEvent")
|
||||
end
|
||||
|
||||
function MyEquipment:HookFunctions()
|
||||
end
|
||||
|
||||
function MyEquipment:LoadDropDown()
|
||||
local dropDown = _G[self.frameName .. "CharSelectDropDown"]
|
||||
local dropDownButton = _G[self.frameName .. "CharSelectDropDownButton"]
|
||||
if not dropDown then return end
|
||||
local last_this = _G["this"]
|
||||
_G["this"] = dropDownButton
|
||||
UIDropDownMenu_Initialize(dropDown, self.UserDropDown_Initialize)
|
||||
UIDropDownMenu_SetSelectedValue(dropDown, self:GetCurrentPlayer())
|
||||
-- UIDropDownMenu_SetSelectedValue(dropDown, self.Player)
|
||||
UIDropDownMenu_SetWidth(dropDown, 140)
|
||||
_G["this"] = last_this
|
||||
end
|
||||
|
||||
function MyEquipment:UserDropDown_Initialize()
|
||||
local this = self or _G.this
|
||||
local chars, charnum
|
||||
chars = MyEquipment:GetSortedCharList(MyEquipment.GetOpt("Sort"))
|
||||
charnum = getn(chars)
|
||||
if (charnum == 0) then
|
||||
self.GetOpt("Player")
|
||||
return
|
||||
end
|
||||
local frame = this:GetParent():GetParent()
|
||||
local selectedValue = UIDropDownMenu_GetSelectedValue(this)
|
||||
|
||||
local i
|
||||
for i = 1, charnum do
|
||||
local info = {
|
||||
["text"] = chars[i],
|
||||
["value"] = chars[i],
|
||||
["func"] = frame.self.UserDropDown_OnClick,
|
||||
["owner"] = frame.self,
|
||||
["checked"] = nil,
|
||||
}
|
||||
if selectedValue == info.value then info.checked = 1 end
|
||||
UIDropDownMenu_AddButton(info)
|
||||
end
|
||||
end
|
||||
|
||||
function MyEquipment:UserDropDown_OnClick()
|
||||
local this = self or _G.this
|
||||
self = this.owner
|
||||
local dropDown = _G[self.frameName .. "CharSelectDropDown"]
|
||||
self.Player = this.value
|
||||
UIDropDownMenu_SetSelectedValue(dropDown, this.value)
|
||||
self:LayoutFrame()
|
||||
end
|
||||
|
||||
function MyEquipment:BAG_UPDATE() -- no bags here, move along
|
||||
end
|
||||
|
||||
function MyEquipment:GetRelic(charID)
|
||||
if self.isLive then
|
||||
return UnitHasRelicSlot("player")
|
||||
elseif IsAddOnLoaded("MyBagsCache") then
|
||||
return MyBagsCache:GetRelic(charID)
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
function MyEquipment:GetInfoFunc()
|
||||
if self.isLive then
|
||||
return self.GetEquipInfoLive
|
||||
--[[
|
||||
elseif IsAddOnLoaded("DataStore_Inventory") then
|
||||
return self.GetInfoDataStore
|
||||
]]
|
||||
elseif IsAddOnLoaded("MyBagsCache") then
|
||||
return self.GetInfoMyBagsCache
|
||||
end
|
||||
return self.GetInfoNone
|
||||
end
|
||||
|
||||
function MyEquipment:GetEquipInfoLive(itemIndex)
|
||||
local itemLink = GetInventoryItemLink("player",itemIndex)
|
||||
local myColor, myLink, myName = nil
|
||||
local texture, count, quality, ID = nil
|
||||
if itemLink or itemIndex == 0 then
|
||||
texture = GetInventoryItemTexture("player",itemIndex)
|
||||
count = GetInventoryItemCount("player",itemIndex)
|
||||
if itemIndex ~= 0 then
|
||||
quality = select(2, GetItemInfoFromLink(itemLink))
|
||||
ID = select(4, GetItemInfoFromLink(itemLink))
|
||||
end
|
||||
end
|
||||
local hasRelic = UnitHasRelicSlot("player")
|
||||
local locked = IsInventoryItemLocked(itemIndex)
|
||||
return texture, count, ID, locked, quality, readable, nil
|
||||
end
|
||||
|
||||
function MyEquipment:MyEquipmentItemSlotButton_OnLoad(widget)
|
||||
widget:RegisterForDrag("LeftButton")
|
||||
_G[widget:GetName().."NormalTexture"]:SetTexture("Interface\\AddOns\\MyBags\\Skin\\Button")
|
||||
widget.UpdateTooltip = widget.MyEquipmentItemSlotButton_OnEnter;
|
||||
end
|
||||
|
||||
function MyEquipment:MyEquipmentItemSlotButton_OnEnter(widget)
|
||||
local text
|
||||
self:TooltipSetOwner(widget)
|
||||
if self.isLive then
|
||||
local hasItem, hasCooldown, repairCost = GameTooltip:SetInventoryItem("player", widget:GetID())
|
||||
if not hasItem then
|
||||
text = TEXT(_G[MYEQUIPMENT_SLOT[tonum(strsub(widget:GetName(), 21))]])
|
||||
if widget.hasRelic then text = TEXT(_G["RELICSLOT"]) end
|
||||
GameTooltip:SetText(text)
|
||||
end
|
||||
if ( InRepairMode() and repairCost and (repairCost > 0) ) then
|
||||
GameTooltip:AddLine(TEXT(REPAIR_COST), "", 1, 1, 1)
|
||||
SetTooltipMoney(GameTooltip, repairCost)
|
||||
GameTooltip:Show()
|
||||
elseif hasItem and IsControlKeyDown() then
|
||||
ShowInspectCursor()
|
||||
else
|
||||
CursorUpdate(widget)
|
||||
end
|
||||
else
|
||||
local _, count, ID, _, quality, _, name = self:GetInfo(widget:GetID())
|
||||
if ID and ID ~= "" then
|
||||
local hyperlink = self:GetHyperlink(ID)
|
||||
if hyperlink then GameTooltip:SetHyperlink(hyperlink) end
|
||||
if IsControlKeyDown() and hyperlink then ShowInspectCursor() end
|
||||
else
|
||||
text = TEXT(_G[MYEQUIPMENT_SLOT[tonum(strsub(widget:GetName(), 21))]])
|
||||
if widget.hasRelic then text = TEXT(_G["RELICSLOT"]) end
|
||||
if name then -- it's a bleeding ammo slot
|
||||
text = name
|
||||
GameTooltip:SetText(text, ColorConvertHexToDigit(quality))
|
||||
if count >= 1000 then
|
||||
GameTooltip:AddLine(count,1,1,1)
|
||||
GameTooltip:Show()
|
||||
end
|
||||
else
|
||||
GameTooltip:SetText(text)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function MyEquipment:MyEquipmentItemSlotButton_OnClick(widget, button)
|
||||
if self.isLive then
|
||||
PaperDollItemSlotButton_OnClick(widget, button)
|
||||
end
|
||||
end
|
||||
|
||||
function MyEquipment:MyEquipmentItemSlotButton_OnModifiedClick(widget, button)
|
||||
if self.isLive then
|
||||
PaperDollItemSlotButton_OnModifiedClick(widget, button)
|
||||
else
|
||||
if ( button == "LeftButton" ) then
|
||||
if ( IsControlKeyDown() ) then
|
||||
local ID = select(3, self:GetInfo( widget:GetID() ))
|
||||
if DressUpItemLink and ID and ID ~= "" then
|
||||
DressUpItemLink("item:"..ID)
|
||||
end
|
||||
elseif ( IsShiftKeyDown() ) then
|
||||
local ID = select(3, self:GetInfo( widget:GetID() ))
|
||||
local hyperLink
|
||||
if ID then hyperLink = self:GetHyperlink(ID) end
|
||||
if hyperLink then
|
||||
ChatEdit_InsertLink(hyperLink)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function MyEquipment:MyEquipmentItemSlotButton_OnDragStart(widget)
|
||||
if self.isLive then
|
||||
PaperDollItemSlotButton_OnClick(widget, "LeftButton", 1)
|
||||
end
|
||||
end
|
||||
|
||||
function MyEquipment:MyEquipmentItemSlotButton_OnEvent(widget, event)
|
||||
if self.isLive then
|
||||
PaperDollItemSlotButton_OnEvent(widget, event)
|
||||
else
|
||||
if ( event == "CURSOR_UPDATE" ) then
|
||||
if ( CursorCanGoInSlot(widget:GetID() ) ) then
|
||||
widget:LockHighlight()
|
||||
else
|
||||
widget:UnlockHighlight()
|
||||
end
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function MyEquipment:MyEquipmentItemSlotButton_OnUpdate(widget, elapsed)
|
||||
if ( GameTooltip:IsOwned(widget) ) and self.isLive then
|
||||
self:MyEquipmentItemSlotButton_OnEnter(widget)
|
||||
end
|
||||
end
|
||||
|
||||
function MyEquipment:LayoutEquipmentFrame(self)
|
||||
local itemBase = "MyEquipmentSlotsItem"
|
||||
local texture, count, locked, quality, ammo, key, value, id
|
||||
local slotColor = ((self.GetOpt("SlotColor")) or MYBAGS_SLOTCOLOR)
|
||||
local charID = self:GetCurrentPlayer()
|
||||
local hasRelic = self:GetRelic(charID)
|
||||
local hideAmmo = false
|
||||
self.watchLock = false
|
||||
if self.aioiOrder and (hasRelic or hideAmmo) then
|
||||
self.curCol = self.curCol + 1
|
||||
end
|
||||
for key,value in pairs( SLOTNAMES ) do
|
||||
local slot = GetInventorySlotInfo(value)
|
||||
local itemButton = _G[itemBase .. slot]
|
||||
if self.curCol >= self.GetOpt("Columns") then
|
||||
self.curCol = 0
|
||||
self.curRow = self.curRow + 1
|
||||
end
|
||||
itemButton:Show()
|
||||
itemButton:ClearAllPoints()
|
||||
itemButton:SetPoint("TOPLEFT", self.frame:GetName(), "TOPLEFT", self:GetXY(self.curRow, self.curCol))
|
||||
self.curCol = self.curCol + 1
|
||||
texture, count, id, locked, quality = self:GetInfo(slot)
|
||||
if id and id ~= "" then
|
||||
itemButton.hasItem = 1
|
||||
end
|
||||
if self.isLive then
|
||||
local start,duration, enable = GetInventoryItemCooldown("player", slot)
|
||||
local cooldown = _G[itemButton:GetName() .. "Cooldown"]
|
||||
CooldownFrame_SetTimer(cooldown,start,duration,enable)
|
||||
if duration>0 and enable==0 then
|
||||
SetItemButtonTextureVertexColor(itemButton, 0.4,0.4,0.4)
|
||||
end
|
||||
end
|
||||
if value == "RANGEDSLOT" and hasRelic then
|
||||
itemButton.hasRelic = 1
|
||||
end
|
||||
SetItemButtonTexture(itemButton, (texture or ""))
|
||||
SetItemButtonCount(itemButton, count)
|
||||
SetItemButtonDesaturated(itemButton, locked, 0.5, 0.5, 0.5)
|
||||
if locked and locked ~= "" then
|
||||
itemButton:LockHighlight()
|
||||
self.watchLock =1
|
||||
else itemButton:UnlockHighlight() end
|
||||
if quality and self.GetOpt("Border") then
|
||||
SetItemButtonNormalTextureVertexColor(itemButton, ColorConvertHexToDigit(quality))
|
||||
else
|
||||
SetItemButtonNormalTextureVertexColor(itemButton, unpack(slotColor))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function MyEquipment:ME_ChatCommand(input)
|
||||
if not input or input:trim() == "" then
|
||||
ME_Dialog:Open(self.name)
|
||||
else
|
||||
ME_Cmd.HandleCommand(MyEquipment, "myequipment", self.name, input)
|
||||
end
|
||||
end
|
||||
|
||||
function MyEquipment:GetSortedCharList(sorttype, realm)
|
||||
--[[
|
||||
if IsAddOnLoaded("DataStore_Inventory") then
|
||||
local realmname
|
||||
local realmlist = {}
|
||||
local realmcount = 0
|
||||
if not realm then
|
||||
for realmname in pairs(DataStore:GetRealms()) do
|
||||
realmcount = realmcount + 1
|
||||
realmlist[realmcount] = realmname
|
||||
end
|
||||
else
|
||||
realmcount = 1
|
||||
realmlist[1] = realm
|
||||
end
|
||||
local result = {}
|
||||
local idx = 0
|
||||
local i
|
||||
local charname, charkey
|
||||
for i=1, realmcount do
|
||||
for charname, charkey in pairs(DataStore:GetCharacters(realmlist[i])) do
|
||||
-- charkey = DataStore:GetCharacter(charname, realmlist[i])
|
||||
if DataStore_Inventory.Characters[charkey] then
|
||||
idx = idx + 1
|
||||
result[idx] = charname .. L["CHARACTER_DELIMITOR"] .. realmlist[i]
|
||||
end
|
||||
end
|
||||
end
|
||||
local swapped
|
||||
local q, w
|
||||
local x_time, y_time;
|
||||
local charName, realmName
|
||||
repeat
|
||||
swapped = 0
|
||||
for i = 1, idx-1 do
|
||||
q = result[i]
|
||||
w = result[i+1]
|
||||
charName, realmName = self:SplitString(q)
|
||||
if (not DataStore:GetModuleLastUpdate(DataStore_Inventory, charName, realmName)) then
|
||||
x_time = 0
|
||||
else
|
||||
x_time = DataStore:GetModuleLastUpdate(DataStore_Inventory, charName, realmName)
|
||||
end
|
||||
charName, realmName = self:SplitString(w)
|
||||
if (not DataStore:GetModuleLastUpdate(DataStore_Inventory, charName, realmName)) then
|
||||
y_time = 0
|
||||
else
|
||||
y_time = DataStore:GetModuleLastUpdate(DataStore_Inventory, charName, realmName)
|
||||
end
|
||||
if self:SortChars(q, w, x_time, y_time, sorttype) then
|
||||
result[i] = w
|
||||
result[i+1] = q
|
||||
swapped = 1
|
||||
end
|
||||
end
|
||||
until swapped == 0
|
||||
return result
|
||||
end
|
||||
]]
|
||||
if IsAddOnLoaded("MyBagsCache") then
|
||||
local result = {}
|
||||
local idx = 0
|
||||
local cache = MyBagsCache.db.global
|
||||
local index, value
|
||||
for index, value in pairs(cache) do
|
||||
local charName, realmID = self:SplitString(index)
|
||||
if index ~= "profiles" then
|
||||
if (not realm or realmID == realm) then
|
||||
idx = idx + 1
|
||||
result[idx] = index
|
||||
end
|
||||
end
|
||||
end
|
||||
local swapped
|
||||
local q, w
|
||||
local x_time, y_time
|
||||
local i
|
||||
repeat
|
||||
swapped = 0
|
||||
for i = 1, idx-1 do
|
||||
q = result[i]
|
||||
w = result[i+1]
|
||||
if (not cache[q].updateTime) then
|
||||
x_time = 0
|
||||
else
|
||||
x_time = cache[q].updateTime
|
||||
end
|
||||
if (not cache[w].updateTime) then
|
||||
y_time = 0
|
||||
else
|
||||
y_time =cache[w].updateTime
|
||||
end
|
||||
if self:SortChars(q, w, x_time, y_time, sorttype) then
|
||||
result[i] = w
|
||||
result[i+1] = q
|
||||
swapped = 1
|
||||
end
|
||||
end
|
||||
until swapped == 0
|
||||
return result
|
||||
end
|
||||
end
|
||||
8
MyEquipment/MyEquipment.toc
Normal file
8
MyEquipment/MyEquipment.toc
Normal file
@ -0,0 +1,8 @@
|
||||
## Interface: 40300
|
||||
## Author: Isharra (updated by thegabbert)
|
||||
## Title: MyEquipment |cff007FFF -Ace-|r
|
||||
## Notes: An alternate view of your equipped items allowing viewing of other characters data when KC_Items.equipment or MyBagsCache are available.
|
||||
## Dependancies: Ace, MyBags
|
||||
## SavedVariables: MyEquipmentDB
|
||||
## LoadOnDemand: 0
|
||||
MyEquipment.xml
|
||||
237
MyEquipment/MyEquipment.xml
Normal file
237
MyEquipment/MyEquipment.xml
Normal file
@ -0,0 +1,237 @@
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.blizzard.com/wow/ui/FrameXML/UI.xsd">
|
||||
<Script file="locals.lua" />
|
||||
<Script file="MyEquipment.lua" />
|
||||
|
||||
<!-- Templates -->
|
||||
<Button name="MyEquipmentItemButtonTemplate" inherits="ItemButtonTemplate" virtual="true">
|
||||
<Frames>
|
||||
<Cooldown name="$parentCooldown" inherits="CooldownFrameTemplate"/>
|
||||
</Frames>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
MyEquipment:MyEquipmentItemSlotButton_OnLoad(self)
|
||||
</OnLoad>
|
||||
<OnClick>
|
||||
if ( not IsModifierKeyDown() ) then
|
||||
mybags = self:GetParent():GetParent().self
|
||||
mybags:MyEquipmentItemSlotButton_OnClick(self, button)
|
||||
end
|
||||
</OnClick>
|
||||
<PostClick>
|
||||
if ( IsModifierKeyDown() ) then
|
||||
mybags = self:GetParent():GetParent().self
|
||||
mybags:MyEquipmentItemSlotButton_OnModifiedClick(self, button)
|
||||
end
|
||||
</PostClick>
|
||||
<OnDragStart>
|
||||
mybags = self:GetParent():GetParent().self
|
||||
mybags:MyEquipmentItemSlotButton_OnClick(self, "LeftButton", 1)
|
||||
</OnDragStart>
|
||||
<OnReceiveDrag>
|
||||
mybags = self:GetParent():GetParent().self
|
||||
mybags:MyEquipmentItemSlotButton_OnClick(self, "LeftButton", 1)
|
||||
</OnReceiveDrag>
|
||||
<OnEnter>
|
||||
mybags = self:GetParent():GetParent().self
|
||||
mybags:MyEquipmentItemSlotButton_OnEnter(self)
|
||||
</OnEnter>
|
||||
<OnLeave>
|
||||
GameTooltip:Hide()
|
||||
</OnLeave>
|
||||
<OnUpdate>
|
||||
mybags = self:GetParent():GetParent().self
|
||||
mybags:MyEquipmentItemSlotButton_OnUpdate(self, elapsed);
|
||||
</OnUpdate>
|
||||
<OnEvent>
|
||||
mybags = self:GetParent():GetParent().self
|
||||
mybags:MyEquipmentItemSlotButton_OnEvent(self, event)
|
||||
</OnEvent>
|
||||
</Scripts>
|
||||
</Button>
|
||||
|
||||
<Frame name="MyEquipmentTemplate" virtual="true">
|
||||
<Frames>
|
||||
<Frame name="$parentBackRow1"/>
|
||||
<Frame name="$parentBackRow2"/>
|
||||
<Frame name="$parentBackRow3"/>
|
||||
<Button name="$parentItem0" inherits="MyEquipmentItemButtonTemplate" id="0"/>
|
||||
<Button name="$parentItem1" inherits="MyEquipmentItemButtonTemplate" id="1"/>
|
||||
<Button name="$parentItem2" inherits="MyEquipmentItemButtonTemplate" id="2"/>
|
||||
<Button name="$parentItem3" inherits="MyEquipmentItemButtonTemplate" id="3"/>
|
||||
<Button name="$parentItem4" inherits="MyEquipmentItemButtonTemplate" id="4"/>
|
||||
<Button name="$parentItem5" inherits="MyEquipmentItemButtonTemplate" id="5"/>
|
||||
<Button name="$parentItem6" inherits="MyEquipmentItemButtonTemplate" id="6"/>
|
||||
<Button name="$parentItem7" inherits="MyEquipmentItemButtonTemplate" id="7"/>
|
||||
<Button name="$parentItem8" inherits="MyEquipmentItemButtonTemplate" id="8"/>
|
||||
<Button name="$parentItem9" inherits="MyEquipmentItemButtonTemplate" id="9"/>
|
||||
<Button name="$parentItem10" inherits="MyEquipmentItemButtonTemplate" id="10"/>
|
||||
<Button name="$parentItem11" inherits="MyEquipmentItemButtonTemplate" id="11"/>
|
||||
<Button name="$parentItem12" inherits="MyEquipmentItemButtonTemplate" id="12"/>
|
||||
<Button name="$parentItem13" inherits="MyEquipmentItemButtonTemplate" id="13"/>
|
||||
<Button name="$parentItem14" inherits="MyEquipmentItemButtonTemplate" id="14"/>
|
||||
<Button name="$parentItem15" inherits="MyEquipmentItemButtonTemplate" id="15"/>
|
||||
<Button name="$parentItem16" inherits="MyEquipmentItemButtonTemplate" id="16"/>
|
||||
<Button name="$parentItem17" inherits="MyEquipmentItemButtonTemplate" id="17"/>
|
||||
<Button name="$parentItem18" inherits="MyEquipmentItemButtonTemplate" id="18"/>
|
||||
<Button name="$parentItem19" inherits="MyEquipmentItemButtonTemplate" id="19"/>
|
||||
</Frames>
|
||||
</Frame>
|
||||
|
||||
<Frame name="MyEquipmentFrameTemplate" virtual="true" movable="true" enableMouse="true" toplevel="true" hidden="true">
|
||||
<Backdrop bgFile="Interface\ChatFrame\ChatFrameBackground" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true">
|
||||
<BackgroundInsets><AbsInset left="5" right="5" top="5" bottom="5"/></BackgroundInsets>
|
||||
<TileSize><AbsValue val="16"/></TileSize>
|
||||
<EdgeSize><AbsValue val="16"/></EdgeSize>
|
||||
</Backdrop>
|
||||
<Layers>
|
||||
<!-- -LITE{{{ -->
|
||||
<Layer level="BACKGROUND">
|
||||
<Texture name="$parentPortrait" hidden="false" file="Interface\AddOns\MyBags\Skin\Backpack" > <!-- -->
|
||||
<Size><AbsDimension x="58" y="58"/></Size>
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT">
|
||||
<Offset><AbsDimension x="-5" y="1"/></Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</Texture>
|
||||
<Texture name="$parentTextureTopLeft" file="Interface\AddOns\MyBags\Skin\TopLeft" hidden="false">
|
||||
<Size><AbsDimension x="128" y="128"/></Size>
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT">
|
||||
<Offset><AbsDimension x="-65" y="58"/></Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</Texture>
|
||||
<Texture name="$parentTextureTopRight" file="Interface\AddOns\MyBags\Skin\TopRight" hidden="false">
|
||||
<Size><AbsDimension x="64" y="128"/></Size>
|
||||
<Anchors>
|
||||
<Anchor point="TOPRIGHT">
|
||||
<Offset><AbsDimension x="36" y="58"/></Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</Texture>
|
||||
<Texture name="$parentTextureTopCenter" file="Interface\AddOns\MyBags\Skin\TopCenter" hidden="false">
|
||||
<Size><AbsDimension x="128" y="128"/></Size>
|
||||
<Anchors>
|
||||
<Anchor point="BOTTOMLEFT" relativeTo="$parentTextureTopLeft" relativePoint="BOTTOMRIGHT"/>
|
||||
<Anchor point="BOTTOMRIGHT" relativeTo="$parentTextureTopRight" relativePoint="BOTTOMLEFT"/>
|
||||
</Anchors>
|
||||
</Texture>
|
||||
<Texture name="$parentTextureBottomLeft" file="Interface\AddOns\MyBags\Skin\BottomLeft" hidden="false">
|
||||
<Size><AbsDimension x="128" y="128"/></Size>
|
||||
<Anchors>
|
||||
<Anchor point="BOTTOMLEFT">
|
||||
<Offset><AbsDimension x="-65" y="-60"/></Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</Texture>
|
||||
<Texture name="$parentTextureBottomRight" file="Interface\AddOns\MyBags\Skin\BottomRight" hidden="false">
|
||||
<Size><AbsDimension x="64" y="128"/></Size>
|
||||
<Anchors>
|
||||
<Anchor point="BOTTOMRIGHT">
|
||||
<Offset><AbsDimension x="36" y="-60"/></Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</Texture>
|
||||
<Texture name="$parentTextureBottomCenter" file="Interface\AddOns\MyBags\Skin\BottomCenter" hidden="false">
|
||||
<Size><AbsDimension x="128" y="128"/></Size>
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT" relativeTo="$parentTextureBottomLeft" relativePoint="TOPRIGHT"/>
|
||||
<Anchor point="TOPRIGHT" relativeTo="$parentTextureBottomRight" relativePoint="TOPLEFT"/>
|
||||
</Anchors>
|
||||
</Texture>
|
||||
<Texture name="$parentTextureLeft" file="Interface\AddOns\MyBags\Skin\Left" hidden="false">
|
||||
<Size><AbsDimension x="64" y="128"/></Size>
|
||||
<Anchors>
|
||||
<Anchor point="TOPRIGHT" relativeTo="$parentTextureTopLeft" relativePoint="BOTTOMRIGHT"/>
|
||||
<Anchor point="BOTTOMRIGHT" relativeTo="$parentTextureBottomLeft" relativePoint="TOPRIGHT"/>
|
||||
</Anchors>
|
||||
</Texture>
|
||||
<Texture name="$parentTextureRight" file="Interface\AddOns\MyBags\Skin\Right" hidden="false">
|
||||
<Size><AbsDimension x="64" y="128"/></Size>
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT" relativeTo="$parentTextureTopRight" relativePoint="BOTTOMLEFT"/>
|
||||
<Anchor point="BOTTOMLEFT" relativeTo="$parentTextureBottomRight" relativePoint="TOPLEFT"/>
|
||||
</Anchors>
|
||||
</Texture>
|
||||
<Texture name="$parentTextureCenter" file="Interface\AddOns\MyBags\Skin\Center" hidden="false">
|
||||
<Size><AbsDimension x="128" y="128"/></Size>
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT" relativeTo="$parentTextureTopCenter" relativePoint="BOTTOMLEFT"/>
|
||||
<Anchor point="TOPRIGHT" relativeTo="$parentTextureTopCenter" relativePoint="BOTTOMRIGHT"/>
|
||||
<Anchor point="BOTTOMLEFT" relativeTo="$parentTextureBottomCenter" relativePoint="TOPLEFT"/>
|
||||
<Anchor point="BOTTOMRIGHT" relativeTo="$parentTextureBottomCenter" relativePoint="TOPRIGHT"/>
|
||||
</Anchors>
|
||||
</Texture>
|
||||
</Layer>
|
||||
<!-- }}}-LITE -->
|
||||
<Layer level="ARTWORK">
|
||||
<FontString name="$parentName" inherits="GameFontNormal" justifyH="LEFT">
|
||||
<Color r="1.0" g="1.0" b="1.0" />
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT">
|
||||
<Offset><AbsDimension x="7" y="-10"/></Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</FontString>
|
||||
<FontString name="$parentSlots" inherits="GameFontNormal" justifyH="LEFT">
|
||||
<Color r="1.0" g="1.0" b="1.0" />
|
||||
<Anchors>
|
||||
<Anchor point="BOTTOMLEFT">
|
||||
<Offset><AbsDimension x="7" y="10"/></Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</FontString>
|
||||
</Layer>
|
||||
</Layers>
|
||||
<Frames>
|
||||
<Frame name="MyEquipmentSlots" inherits="MyEquipmentTemplate"/>
|
||||
<Frame name="$parentButtons" inherits="MyBagsButtonBarTemplate"/>
|
||||
<Frame name="$parentCharSelect" inherits="MyBagsCharSelectTemplate"/>
|
||||
<Frame name="$parentMoneyFrame" inherits="SmallMoneyFrameTemplate" hidden="false">
|
||||
<Anchors>
|
||||
<Anchor point="BOTTOMRIGHT" relativeTo="$parent" relativePoint="BOTTOMRIGHT">
|
||||
<Offset><AbsDimension x="0" y="8"/></Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</Frame>
|
||||
</Frames>
|
||||
<Scripts>
|
||||
<OnShow>
|
||||
PlaySound("igBackPackOpen")
|
||||
</OnShow>
|
||||
<OnHide>
|
||||
PlaySound("igBackPackClose")
|
||||
</OnHide>
|
||||
<OnMouseDown>
|
||||
mybags = self.self
|
||||
if not mybags.GetOpt("Lock") then
|
||||
self:GetParent():StartMoving()
|
||||
end
|
||||
</OnMouseDown>
|
||||
<OnMouseUp>
|
||||
self:GetParent():StopMovingOrSizing()
|
||||
</OnMouseUp>
|
||||
</Scripts>
|
||||
</Frame>
|
||||
|
||||
<!-- Frame -->
|
||||
<Frame name="MyEquipmentAnchorFrame" hidden="false" movable="true" parent="UIParent">
|
||||
<Size><AbsDimension x="10" y="10"/></Size>
|
||||
<Anchors>
|
||||
<Anchor point="BOTTOMRIGHT" >
|
||||
<Offset><AbsDimension x="-5" y="100"/></Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<Frames>
|
||||
<Frame name="MyEquipmentFrame" inherits="MyEquipmentFrameTemplate">
|
||||
<Size>
|
||||
<AbsDimension x="500" y="500"/>
|
||||
</Size>
|
||||
<Anchors><Anchor point="BOTTOMRIGHT"/></Anchors>
|
||||
</Frame>
|
||||
</Frames>
|
||||
</Frame>
|
||||
</Ui>
|
||||
29
MyEquipment/locals.lua
Normal file
29
MyEquipment/locals.lua
Normal file
@ -0,0 +1,29 @@
|
||||
-- Version : English - Isharra
|
||||
|
||||
MYEQUIPMENT_NAME = "MyEquipment"
|
||||
MYEQUIPMENT_DESCRIPTION = "Equipped items display"
|
||||
|
||||
MYEQUIPMENTFRAME_TITLE = "Equipment"
|
||||
|
||||
-- SLASHCOMMANDS
|
||||
-- /me already taken by emote commands
|
||||
-- MYEQUIPMENT_COMMANDS = {"/myequipment", "/myequip", "/mq"}
|
||||
--[[ MYEQUIPMENT_CMD_OPTIONS = {
|
||||
MYBAGS_CMD_OPT_LOCK, -- done
|
||||
MYBAGS_CMD_OPT_COLUMNS, -- done
|
||||
MYBAGS_CMD_OPT_NOESC, -- done
|
||||
MYBAGS_CMD_OPT_TITLE, -- done
|
||||
MYBAGS_CMD_OPT_CASH, -- done
|
||||
MYBAGS_CMD_OPT_BUTTONS, -- done
|
||||
MYBAGS_CMD_OPT_AIOI, -- done
|
||||
MYBAGS_CMD_OPT_BORDER, -- done
|
||||
MYBAGS_CMD_OPT_PLAYERSEL, -- done
|
||||
MYBAGS_CMD_OPT_SCALE, -- done
|
||||
MYBAGS_CMD_OPT_STRATA, -- done
|
||||
MYBAGS_CMD_OPT_ANCHOR, -- done
|
||||
MYBAGS_CMD_OPT_TOGGLE, -- done
|
||||
MYBAGS_CMD_RESET, -- done
|
||||
MYBAGS_CMD_OPT_GRAPHICS, -- skip
|
||||
MYBAGS_CMD_OPT_SLOTCOLOR, -- skip
|
||||
}
|
||||
]]
|
||||
Reference in New Issue
Block a user