Move from SVN to GIT

This commit is contained in:
Sandor Takacs
2014-02-10 17:17:11 +01:00
commit b17ef61449
49 changed files with 5268 additions and 0 deletions

56
.pkgmeta Normal file
View File

@ -0,0 +1,56 @@
package-as: MyBags
enable-nolib-creation: no
externals:
Libs/LibStub:
url: svn://svn.wowace.com/wow/libstub/mainline/trunk
tag: latest
Libs/CallbackHandler-1.0:
url: svn://svn.wowace.com/wow/callbackhandler/mainline/trunk/CallbackHandler-1.0
tag: latest
Libs/AceLocale-3.0:
url: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceLocale-3.0
tag: latest
Libs/AceAddon-3.0:
url: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceAddon-3.0
tag: latest
Libs/AceEvent-3.0:
url: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceEvent-3.0
tag: latest
Libs/AceConsole-3.0:
url: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceConsole-3.0
tag: latest
Libs/AceConfig-3.0:
url: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceConfig-3.0
tag: latest
Libs/AceHook-3.0:
url: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceHook-3.0
tag: latest
Libs/AceDB-3.0:
url: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceDB-3.0
tag: latest
Libs/AceGUI-3.0:
url: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceGUI-3.0
tag: latest
MyBagsCache/Libs/LibStub:
url: svn://svn.wowace.com/wow/libstub/mainline/trunk
tag: latest
MyBagsCache/Libs/CallbackHandler-1.0:
url: svn://svn.wowace.com/wow/callbackhandler/mainline/trunk/CallbackHandler-1.0
tag: latest
MyBagsCache/Libs/AceAddon-3.0:
url: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceAddon-3.0
tag: latest
MyBagsCache/Libs/AceEvent-3.0:
url: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceEvent-3.0
tag: latest
MyBagsCache/Libs/AceDB-3.0:
url: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceDB-3.0
tag: latest
MyBagsCache/Libs/AceLocale-3.0:
url: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceLocale-3.0
tag: latest
move-folders:
MyBags/MyBagsCache: MyBagsCache

11
Bindings.xml Normal file
View File

@ -0,0 +1,11 @@
<Bindings>
<Binding name="MYINVENTORY" header="MYBAGSHEADER">
if MyInventory then MyInventory:Toggle() end
</Binding>
<Binding name="MYBANK">
if MyBank then MyBank:Toggle() end
</Binding>
<Binding name="MYEQUIPMENT">
if MyEquipment then MyEquipment:Toggle() end
</Binding>
</Bindings>

17
Embeds.xml Normal file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<Ui xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.blizzard.com/wow/ui/" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Script file="Libs\LibStub\LibStub.lua"/>
<Include file="Libs\CallbackHandler-1.0\CallbackHandler-1.0.xml"/>
<!--Ace3 Libraries-->
<Include file="Libs\AceAddon-3.0\AceAddon-3.0.xml"/>
<Include file="Libs\AceEvent-3.0\AceEvent-3.0.xml"/>
<Include file="Libs\AceConsole-3.0\AceConsole-3.0.xml"/>
<Include file="Libs\AceLocale-3.0\AceLocale-3.0.xml"/>
<Include file="Libs\AceHook-3.0\AceHook-3.0.xml"/>
<Include file="Libs\AceDB-3.0\AceDB-3.0.xml"/>
<Include file="Libs\AceGUI-3.0\AceGUI-3.0.xml"/>
<Include file="Libs\AceConfig-3.0\AceConfig-3.0.xml"/>
</Ui>

6
Locals/GlobalStrings.lua Normal file
View File

@ -0,0 +1,6 @@
local L = LibStub("AceLocale-3.0"):GetLocale("MyBags")
BINDING_HEADER_MYBAGSHEADER = L["BINDING_HEADER_MYBAGSHEADER"]
BINDING_NAME_MYINVENTORY = L["BINDING_NAME_MYINVENTORY"]
BINDING_NAME_MYBANK= L["BINDING_NAME_MYBANK"]
BINDING_NAME_MYEQUIPMENT = L["BINDING_NAME_MYEQUIPMENT"]

6
Locals/Locals.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Ui xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.blizzard.com/wow/ui/" xsi:schemaLocation="http://www.blizzard.com/wow/ui/FrameXML\UI.xsd">
<Include file="enUS.lua"/>
<Include file="GlobalStrings.lua"/>
</Ui>

37
Locals/enUS.lua Normal file
View File

@ -0,0 +1,37 @@
local L = LibStub("AceLocale-3.0"):NewLocale("MyBags", "enUS", true)
if not L then return end
-- Global locales
L["ACE_TEXT_OF"] = "of";
L["CHARACTER_DELIMITOR"] = " of ";
L["SplitString must be passed a string as the first argument"] = "SplitString must be passed a string as the first argument";
--KEYBINDINGS
L["BINDING_HEADER_MYBAGSHEADER"] = "My Bags"
L["BINDING_NAME_MYINVENTORY"] = "Toggle MyInventory"
L["BINDING_NAME_MYBANK"] = "Toggle MyBank"
L["BINDING_NAME_MYEQUIPMENT"] = "Toggle MyEquipment"
L["ACEG_TEXT_AMMO"] = "Ammo";
L["ACEG_TEXT_QUIVER"] = "Quiver";
L["ACEG_TEXT_SOUL"] = "Soul Bag";
L["ACEG_TEXT_ENCHANT"] = "Enchanting Bag";
L["ACEG_TEXT_ENGINEER"] = "Engineering Bag";
L["ACEG_TEXT_GEM"] = "Gem Bag";
L["ACEG_TEXT_HERB"] = "Herb Bag";
L["ACEG_TEXT_MINING"] = "Mining Bag";
L["ACEG_TEXT_NOW_SET_TO"] = "is now set to";
L["ACEG_TEXT_DEFAULT"] = "default";
L["ACEG_DISPLAY_OPTION"] = "[|cfff5f530%s|r]";
L["ACE_CMD_REPORT_NO_VAL"] = "|cffc7c7c7no value|r"
L["ACE_CMD_RESULT"] = "|cffffff78%s:|r %s"
--Titles
L["MYBAGS_TITLE0"] = ""
L["MYBAGS_TITLE1"] = "%s's "
L["MYBAGS_TITLE2"] = "%s of %s's "
L["MYBAGS_SLOTS_FREE"] = "%d/%d Slots Free";
L["MYBAGS_SLOTS_USED"] = "%d/%d Slots Used";

17
MyBags.toc Normal file
View File

@ -0,0 +1,17 @@
## Interface: 50001
## Author: Ramble (modified by Isharra) (updated by thegabbert) (converted to Ace3 by Takika)
## Version: 51
## Title: MyBags |cff007FFF -Ace3-|r
## Notes: Complete Replacement for Inventory and Bank Bags.
## OptionalDeps: MyBagsCache, DataStore_Containers
## SavedVariables: MyInventoryDB, MyBankDB, MyEquipmentDB
Embeds.xml
Locals\Locals.xml
MyBagsCore\MyBags.xml
MyInventory\MyInventory.xml
MyBank\MyBank.xml
MyEquipment\MyEquipment.xml

12
MyBagsCache/Embeds.xml Normal file
View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<Ui xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.blizzard.com/wow/ui/" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Script file="Libs\LibStub\LibStub.lua"/>
<Include file="Libs\CallbackHandler-1.0\CallbackHandler-1.0.xml"/>
<!--Ace3 Libraries-->
<Include file="Libs\AceAddon-3.0\AceAddon-3.0.xml"/>
<Include file="Libs\AceEvent-3.0\AceEvent-3.0.xml"/>
<Include file="Libs\AceDB-3.0\AceDB-3.0.xml"/>
<Include file="Libs\AceLocale-3.0\AceLocale-3.0.xml"/>
</Ui>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Ui xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.blizzard.com/wow/ui/" xsi:schemaLocation="http://www.blizzard.com/wow/ui/FrameXML\UI.xsd">
<Include file="enUS.lua"/>
</Ui>

View File

@ -0,0 +1,11 @@
local L = LibStub("AceLocale-3.0"):NewLocale("MyBagsCache", "enUS", true, true)
if not L then
print("AceLocale not loaded")
return
end
L["ACE_TEXT_OF"] = "of";
L["CHARACTER_DELIMITOR"] = " of ";
L["SplitString must be passed a string as the first argument"] = "SplitString must be passed a string as the first argument";

449
MyBagsCache/MyBagsCache.lua Normal file
View File

@ -0,0 +1,449 @@
MyBagsCache = LibStub("AceAddon-3.0"):NewAddon("MyBagsCache", "AceEvent-3.0");
local L = LibStub("AceLocale-3.0"):GetLocale("MyBagsCache")
local select, tinsert, type = select, table.insert, type
local strfind, strsub, strtrim = string.find, string.sub, strtrim
local error, unpack = error, unpack
local tonumber, pairs = tonumber, pairs
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 SplitString(s, p, n)
if (type(s) ~= "string") then
error(L["SplitString must be passed a string as the first argument"], 2)
end
local l, sp, ep = {}, 0
while (sp) do
sp, ep = strfind(s, p)
if (sp) then
tinsert(l, strsub(s, 1, sp - 1))
s = strsub(s, ep + 1)
else
tinsert(l, s)
break
end
if (n) then
n = n - 1
end
if (n and (n == 0)) then
tinsert(l, s)
break
end
end
return unpack(l)
end
local function SortChars(a, b, a_time, b_time, t)
local a_player, a_realm = SplitString(a, L["CHARACTER_DELIMITOR"])
local b_player, b_realm = SplitString(b, L["CHARACTER_DELIMITOR"])
if (t == "realm") then
if (a_realm == b_realm) then
return (a_player > b_player)
else
return (a_realm > b_realm)
end
elseif (t == "char") then
if (a_player == b_player) then
return (a_realm > b_realm)
else
return (a_player > b_player)
end
elseif (t == "update") then
return a_time < b_time
end
end
function MyBagsCache:OnInitialize()
self.db = LibStub("AceDB-3.0"):New("MyBagsCacheDB");
local charName = strtrim(UnitName("player"));
local realmName = strtrim(GetRealmName());
-- self.atBank = false
self.Player = charName .. L["CHARACTER_DELIMITOR"] .. realmName
if not self.db.global[self.Player] then
self.db.global[self.Player]={}
end
end
function MyBagsCache:OnEnable()
self:RegisterEvent("PLAYER_MONEY")
self:RegisterEvent("PLAYERBANKSLOTS_CHANGED")
self:RegisterEvent("PLAYERBANKBAGSLOTS_CHANGED")
self:RegisterEvent("BANKFRAME_OPENED")
self:RegisterEvent("BANKFRAME_CLOSED")
self:RegisterEvent("UNIT_INVENTORY_CHANGED")
self:RegisterEvent("BAG_UPDATE")
self:RegisterEvent("BANKFRAME_OPENED")
self:RegisterEvent("BANKFRAME_CLOSED")
self:RegisterEvent("VOID_STORAGE_CONTENTS_UPDATE")
self:RegisterEvent("VOID_TRANSFER_DONE")
-- self:RegisterEvent("INVENTORY_SEARCH_UPDATE")
self:RegisterEvent("VOID_STORAGE_OPEN")
self:RegisterEvent("VOID_STORAGE_CLOSE")
if not self.db.global[self.Player][0] then
self:SaveItems()
end
end
function MyBagsCache:VOID_STORAGE_CONTENTS_UPDATE()
-- Move item in Void OR
-- Move item from Void to Withdraw
if (CanUseVoidStorage()) then
self.atVoid = true
self:SaveItems()
self:SaveUpdateTime()
end
end
function MyBagsCache:VOID_TRANSFER_DONE()
-- Move items between bags and void
if (CanUseVoidStorage()) then
self.atVoid = true
self:SaveItems()
self:SaveUpdateTime()
end
end
--[[
function MyBagsCache:INVENTORY_SEARCH_UPDATE()
-- Search box change
end
]]
function MyBagsCache:VOID_STORAGE_OPEN()
-- Open Void
if (CanUseVoidStorage()) then
self.atVoid = true
self:SaveItems()
self:SaveUpdateTime()
end
end
function MyBagsCache:VOID_STORAGE_CLOSE()
-- Close Void
self.atVoid = false
end
function MyBagsCache:PLAYER_MONEY()
self.db.global[self.Player].cash = GetMoney();
self:SaveUpdateTime()
end
function MyBagsCache:PLAYERBANKBAGSLOTS_CHANGED()
local numSlots, full = GetNumBankSlots()
local cost = GetBankSlotCost(numSlots)
if not self.db.global[self.Player].BankSlots then
self.db.global[self.Player].BankSlots = {}
end
self.db.global[self.Player].BankSlots = {
["Number"] = numSlots,
["Cost"] = cost,
["Full"] = full
}
self:SaveUpdateTime()
end
function MyBagsCache:PLAYERBANKSLOTS_CHANGED()
local itemIndex
for itemIndex = 1, 28 do
self:SaveItemInfo(BANK_CONTAINER, itemIndex)
end
self:SaveUpdateTime()
end
function MyBagsCache:BAG_UPDATE(event, bagIndex)
if not self.atBank and bagIndex > 4 and bagIndex <= 11 then
return
end
local slots = self:SaveBagInfo(bagIndex)
local itemIndex
for itemIndex = 1, slots do
self:SaveItemInfo(bagIndex, itemIndex)
end
self:SaveUpdateTime()
end
function MyBagsCache:UNIT_INVENTORY_CHANGED(event, unit)
if (unit == "player") then
self:SaveEquipment()
self:SaveUpdateTime()
end
end
function MyBagsCache:BANKFRAME_OPENED()
self.atBank = true
self:SaveItems()
self:SaveUpdateTime()
end
function MyBagsCache:BANKFRAME_CLOSED()
self.atBank = false
end
function MyBagsCache:SaveUpdateTime()
self.db.global[self.Player].updateTime = GetTime()
end
function MyBagsCache:SaveItems()
self:SaveVoid()
self:SaveInventory()
self:SaveBank()
self:SaveEquipment()
self:PLAYER_MONEY()
end
function MyBagsCache:SaveVoid()
if not self.atVoid then return end
if not self.db.global[self.Player]["Void"] then
self.db.global[self.Player]["Void"] = {}
end
local itemIndex
local VOID_STORAGE_SIZE = 80
for itemIndex = 1, VOID_STORAGE_SIZE do
local itemID, texture = GetVoidItemInfo(itemIndex);
if (itemID) then
local myName, myLink = GetItemInfo(itemID)
local myColor = select(2, GetItemInfoFromLink(myLink))
self.db.global[self.Player]["Void"][itemIndex] = {
["Name"] = myName,
["Color"] = myColor,
["Link"] = myLink,
["Count"] = 1,
["Texture"] = texture,
}
else
self.db.global[self.Player]["Void"][itemIndex] = nil
end
end
end
function MyBagsCache:SaveInventory()
local bagIndex
for bagIndex = 0, 4 do
local slots = self:SaveBagInfo(bagIndex)
local itemIndex
for itemIndex = 1, slots do
self:SaveItemInfo(bagIndex, itemIndex)
end
end
end
function MyBagsCache:SaveBank()
if not self.atBank then return end
if not self.db.global[self.Player][BANK_CONTAINER] then
self.db.global[self.Player][BANK_CONTAINER] = {}
end
if not self.db.global[self.Player][BANK_CONTAINER][0] then
self.db.global[self.Player][BANK_CONTAINER][0] = {}
end
self.db.global[self.Player][BANK_CONTAINER][0] = {
["Count"] = 28
}
local itemIndex, bagIndex
for itemIndex = 1, 28 do
self:SaveItemInfo(BANK_CONTAINER, itemIndex)
end
for bagIndex = 5, 11 do
local slots = self:SaveBagInfo(bagIndex)
for itemIndex = 1, slots do
self:SaveItemInfo(bagIndex, itemIndex)
end
end
end
function MyBagsCache:SaveEquipment()
if not self.db.global[self.Player].equipment then
self.db.global[self.Player].equipment = {}
end
local itemIndex
for itemIndex = 0, 19 do
self:SaveEquipmentInfo(itemIndex)
end
local hasRelic = UnitHasRelicSlot("player")
self.db.global[self.Player].equipment.hasRelic = hasRelic
end
function MyBagsCache:SaveBagInfo(bagIndex)
local invID -- get Inventory ID
if bagIndex >= 1 and bagIndex <=4 then
invID = ContainerIDToInventoryID(bagIndex)
elseif bagIndex >= 5 and bagIndex <= 11 then
invID = BankButtonIDToInvSlotID(bagIndex, 1)
else
invID = nil;
end
if bagIndex == 0 then -- Set Count to 16
if not self.db.global[self.Player][bagIndex] then
self.db.global[self.Player][bagIndex]= {}
end
self.db.global[self.Player][bagIndex][0] = {
["Count"] = 16,
["Texture"] = "Interface\\Buttons\\Button-Backpack-Up"
}
return 16
end
local bagSize = GetContainerNumSlots(bagIndex)
local itemLink = GetInventoryItemLink("player", invID)
if itemLink then
local name, myColor, myLink = GetItemInfoFromLink(itemLink)
local soulbound, madeBy = nil
local texture = GetInventoryItemTexture("player", invID)
if not self.db.global[self.Player][bagIndex] then
self.db.global[self.Player][bagIndex] = {}
end
self.db.global[self.Player][bagIndex][0] = {
["Name"] = name,
["Color"] = myColor,
["Link"] = myLink,
["Count"] = bagSize,
["Texture"] = texture,
["Soulbound"] = soulbound,
["MadeBy"] = madeBy
}
end
if bagSize > 0 then
return bagSize
else
self.db.global[self.Player][bagIndex] = nil
return 0
end
end
function MyBagsCache:SaveEquipmentInfo(itemIndex)
local itemLink = GetInventoryItemLink("player", itemIndex)
if itemLink or itemIndex == 0 then
-- local myColor, myLink, myName, soulbound, madeBy = nil
local texture = GetInventoryItemTexture("player", itemIndex)
local count = GetInventoryItemCount("player", itemIndex)
local myName, myColor, myLink = GetItemInfoFromLink(itemLink)
if not self.db.global[self.Player].equipment[itemIndex] then
self.db.global[self.Player].equipment[itemIndex] = {}
end
self.db.global[self.Player].equipment[itemIndex] = {
["Name"] = myName,
["Color"] = myColor,
["Link"] = myLink,
["Count"] = count,
["Texture"] = texture,
["Soulbound"] = nil,
["MadeBy"] = nil,
}
else
self.db.global[self.Player].equipment[itemIndex] = nil
end
end
function MyBagsCache:SaveItemInfo(bagIndex, itemIndex)
local itemLink = GetContainerItemLink(bagIndex, itemIndex)
if itemLink then
local myName, myColor, myLink = GetItemInfoFromLink(itemLink)
local texture, itemCount = GetContainerItemInfo(bagIndex, itemIndex)
self.db.global[self.Player][bagIndex][itemIndex] = {
["Name"] = myName,
["Color"] = myColor,
["Link"] = myLink,
["Count"] = itemCount,
["Texture"] = texture,
["Soulbound"] = nil,
["MadeBy"] = nil,
}
else
self.db.global[self.Player][bagIndex][itemIndex] = nil
end
end
function MyBagsCache:GetInfo(bagIndex, slotIndex, charID)
slotIndex = tonumber(slotIndex or 0)
if not self.db.global[charID] or not self.db.global[charID][bagIndex] or not self.db.global[charID][bagIndex][slotIndex] then
return nil, 0, nil, nil, nil
else
local data = self.db.global[charID][bagIndex][slotIndex]
return data.Texture, data.Count, data.Link, data.Color, data.Name
end
end
function MyBagsCache:GetRelic(charID)
if not self.db.global[charID] or not self.db.global[charID].equipment or not self.db.global[charID].equipment.hasRelic then
return nil
else
return self.db.global[charID].equipment.hasRelic
end
end
function MyBagsCache:GetCash(charID)
if not self.db.global[charID] or not self.db.global[charID].cash then
return nil
else
return self.db.global[charID].cash
end
end
function MyBagsCache:GetCharList(realm)
local result = {}
local cache = self.db.global
local index, value
for index, value in pairs(cache) do
if index ~= "profiles" then
local charName, realmID = SplitString(index, L["CHARACTER_DELIMITOR"])
if (not realm or realmID == realm) then
result[index] = {
name = charName,
realm = realmID,
}
end
end
end
return result
end
function MyBagsCache:GetSortedCharList(sorttype, realm)
local result = {}
local idx = 0
local cache = self.db.global
local index, value
for index, value in pairs(cache) do
if index ~= "profiles" then
local realmID = select(2, SplitString(index, L["CHARACTER_DELIMITOR"]))
if (not realm or realmID == realm) then
idx = idx + 1
result[idx] = index
end
end
end
local swapped
local x_time, y_time
local q, w, i
repeat
swapped = 0
for i = 1, idx-1 do
q = result[i]
w = result[i+1]
if (not self.db.global[q].updateTime) then
x_time = 0
else
x_time = self.db.global[q].updateTime
end
if (not self.db.global[w].updateTime) then
y_time = 0
else
y_time = self.db.global[w].updateTime
end
if 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

View File

@ -0,0 +1,16 @@
## Interface: 50100
## Author: Takika
## Title: MyBagsCache3 |cff007FFF -Ace3-|r
## Notes: Item database for Equipment, Inventory and Bank Bags.
## OptionalDeps: Ace3
## SavedVariables: MyBagsCacheDB
## LoadOnDemand: 0
# Libraries
Embeds.xml
#Locales
Locals\Locals.xml
MyBagsCache.xml
MyBagsCache.lua

View File

@ -0,0 +1,12 @@
<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">
<GameTooltip name="MyBagsCacheHiddenTooltip" inherits="GameTooltipTemplate" parent="UIParent" hidden="true">
<Scripts>
<OnLoad>
self:SetOwner(UIParent, "ANCHOR_NONE");
</OnLoad>
</Scripts>
</GameTooltip>
</Ui>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Ui xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.blizzard.com/wow/ui/" xsi:schemaLocation="http://www.blizzard.com/wow/ui/FrameXML\UI.xsd">
<Include file="enUS.lua"/>
</Ui>

View File

@ -0,0 +1,36 @@
local L = LibStub("AceLocale-3.0"):NewLocale("MyBagsCore", "enUS", true)
if not L then
return
end
L["ACE_TEXT_OF"] = "of";
L["CHARACTER_DELIMITOR"] = " of ";
L["ACEG_TEXT_AMMO"] = "Ammo";
L["ACEG_TEXT_QUIVER"] = "Quiver";
L["ACEG_TEXT_SOUL"] = "Soul Bag";
L["ACEG_TEXT_ENCHANT"] = "Enchanting Bag";
L["ACEG_TEXT_ENGINEER"] = "Engineering Bag";
L["ACEG_TEXT_GEM"] = "Gem Bag";
L["ACEG_TEXT_HERB"] = "Herb Bag";
L["ACEG_TEXT_MINING"] = "Mining Bag";
L["ACEG_TEXT_NOW_SET_TO"] = "is now set to";
L["ACEG_TEXT_DEFAULT"] = "default";
L["ACEG_DISPLAY_OPTION"] = "[|cfff5f530%s|r]";
L["ACE_CMD_REPORT_NO_VAL"] = "|cffc7c7c7no value|r"
L["ACE_CMD_RESULT"] = "|cffffff78%s:|r %s"
--MyInventory Title
L["MYBAGS_TITLE0"] = ""
L["MYBAGS_TITLE1"] = "%s's "
L["MYBAGS_TITLE2"] = "%s of %s's "
L["MYBAGS_SLOTS_FREE"] = "%d/%d Slots Free";
L["MYBAGS_SLOTS_USED"] = "%d/%d Slots Used";
-- SLASHCOMMANDS
--KEYBINDINGS
L["BINDING_HEADER_MYBAGSHEADER"] = "My Bags"
L["BINDING_NAME_MYINVENTORY"] = "My Inventory Toggle"
L["BINDING_NAME_MYBANK"] = "My Bank Toggle"
L["BINDING_NAME_MYEQUIPMENT"] = "My Equipment Toggle"

1653
MyBagsCore/MyBags.lua Normal file

File diff suppressed because it is too large Load Diff

445
MyBagsCore/MyBags.xml Normal file
View File

@ -0,0 +1,445 @@
<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="MyBags.lua"/>
<!-- Templates -->
<Button name="MyBagsItemButtonTemplate" inherits="ContainerFrameItemButtonTemplate" virtual="true">
<Frames>
<Cooldown name="$parentCooldown" inherits="CooldownFrameTemplate"/>
</Frames>
<Scripts>
<OnLoad>
mybags = self:GetParent():GetParent().self;
mybags:ItemButton_OnLoad(self)
</OnLoad>
<PostClick>
if ( IsModifierKeyDown() ) then
mybags = self:GetParent():GetParent().self
mybags:ItemButton_OnModifiedClick(self, button)
end
</PostClick>
<OnDragStart>
mybags = self:GetParent():GetParent().self
mybags:ItemButton_OnDragStart(self)
</OnDragStart>
<OnReceiveDrag>
mybags = self:GetParent():GetParent().self
mybags:ItemButton_OnReceiveDrag(self)
</OnReceiveDrag>
<OnEnter>
mybags = self:GetParent():GetParent().self
mybags:ItemButton_OnEnter(self)
</OnEnter>
<OnLeave>
mybags = self:GetParent():GetParent().self
mybags:ItemButton_OnLeave(self)
</OnLeave>
<OnUpdate>
if ( GameTooltip:IsOwned( self ) ) then
mybags = self:GetParent():GetParent().self
mybags:ItemButton_OnEnter(self)
end
</OnUpdate>
</Scripts>
</Button>
<CheckButton name="MyBagsBagButtonTemplate" inherits="ItemButtonTemplate" hidden="true" virtual="true">
<CheckedTexture alphaMode="ADD" file="Interface\Buttons\ButtonHilight-Square"/>
<HighlightTexture alphaMode="ADD" file="Interface\Buttons\CheckButtonHilight"/>
<Scripts>
<OnLoad>
self.isBag = 1;
self:RegisterForClicks("LeftButtonUp", "RightButtonUp")
self:RegisterForDrag("LeftButton")
</OnLoad>
<OnClick>
mybags = self:GetParent():GetParent().self
mybags:BagButton_OnClick(self, button)
</OnClick>
<OnDragStart>
mybags = self:GetParent():GetParent().self
mybags:BagButton_OnDragStart(self)
</OnDragStart>
<OnReceiveDrag>
mybags = self:GetParent():GetParent().self
mybags:BagButton_OnReceiveDrag(self)
</OnReceiveDrag>
<OnEnter>
mybags = self:GetParent():GetParent(self).self
mybags:BagButton_OnEnter(self)
</OnEnter>
<OnLeave>
mybags = self:GetParent():GetParent(self).self
mybags:BagButton_OnLeave(self)
</OnLeave>
</Scripts>
</CheckButton>
<Frame name="MyBagsContainerTemplate" virtual="true">
<Frames>
<Frame name="$parentBackRow1"/>
<Frame name="$parentBackRow2"/>
<Frame name="$parentBackRow3"/>
<CheckButton name="$parentBag" inherits="MyBagsBagButtonTemplate" id="0"/>
</Frames>
</Frame>
<Frame name="MyBagsButtonBarTemplate" hidden="false" virtual="true">
<Size>
<AbsDimension x="100" y="20"/>
</Size>
<Anchors>
<Anchor point="TOPRIGHT" relativeTo="$parent" relativePoint="TOPRIGHT"/>
</Anchors>
<Frames>
<Button name="$parentCloseButton" inherits="UIPanelCloseButton">
<Anchors>
<Anchor point="TOPRIGHT" relativeTo="$parent" relativePoint="TOPRIGHT">
<Offset>
<AbsDimension x="-1" y="-1"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnClick>
mybags = self:GetParent():GetParent().self;
mybags:Close();
</OnClick>
</Scripts>
</Button>
<Button name="$parentLockButton" inherits="UIPanelCloseButton">
<NormalTexture name="$parentNormalTexture" file="Interface\AddOns\MyBags\Skin\LockButton-Unlocked-Up"/>
<PushedTexture name="$parentPushedTexture" file="Interface\AddOns\MyBags\Skin\LockButton-Locked-Down"/>
<Anchors>
<Anchor point="RIGHT" relativeTo="$parentCloseButton" relativePoint="LEFT">
<Offset>
<Absdimension x="10" y="0"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnClick>
mybags = self:GetParent():GetParent().self
mybags:LockButton_OnClick()
</OnClick>
</Scripts>
</Button>
</Frames>
</Frame>
<Frame name="MyBagsCharSelectTemplate" virtual="true" hidden="false">
<Size>
<AbsDimension x="190" y="30"/>
</Size>
<Anchors>
<Anchor point="TOP">
<Offset>
<AbsDimension x="0" y="-38"/>
</Offset>
</Anchor>
</Anchors>
<Frames>
<Frame name="$parentDropDown" inherits="UIDropDownMenuTemplate" enableMouse="true" hidden="false">
<Size>
<AbsDimension x="150" y="30"/>
</Size>
<Anchors>
<Anchor point="RIGHT">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer level="BACKGROUND">
<FontString name="$parentLabel" inherits="GameFontNormalSmall" text="Select Player:">
<Anchors>
<Anchor point="BOTTOMLEFT" relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="18" y="0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
</Frame>
</Frames>
</Frame>
<EditBox name="MyBagsSearchBoxTemplate" inherits="BagSearchBoxTemplate" letters="15" hidden="true" virtual="true">
<Size x="130" y="20"/>
<Scripts>
<!--
<OnHide>
myedit = self:GetParent().self
myedit:BagSearch_OnHide()
</OnHide>
-->
<OnTextChanged>
myedit = self:GetParent().self
myedit:BagSearch_OnTextChanged()
</OnTextChanged>
<!--
<OnChar>
myedit = self:GetParent().self
myedit:BagSearch_OnChar()
</OnChar>
<OnEnterPressed>
myedit = self:GetParent().self
myedit:EditBox_ClearFocus()
</OnEnterPressed>
<OnEditFocusLost>
myedit = self:GetParent().self
myedit:BagSearch_OnEditFocusLost()
</OnEditFocusLost>
-->
<OnEditFocusGained>
myedit = self:GetParent().self
myedit:BagSearch_OnEditFocusGained()
</OnEditFocusGained>
<OnHide function="BagSearch_OnHide"/>
<!--
<OnTextChanged function="BagSearch_OnTextChanged"/>
-->
<OnChar function="BagSearch_OnChar"/>
<OnEnterPressed function="EditBox_ClearFocus"/>
<OnEditFocusLost function="BagSearch_OnEditFocusLost"/>
<!--
<OnEditFocusGained function="BagSearch_OnEditFocusGained"/>
-->
</Scripts>
</EditBox>
<Frame name="MyBagsFrameTemplate" 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="$parentBag0" inherits="MyBagsContainerTemplate" id="0"/>
<Frame name="$parentBag1" inherits="MyBagsContainerTemplate" id="1"/>
<Frame name="$parentBag2" inherits="MyBagsContainerTemplate" id="2"/>
<Frame name="$parentBag3" inherits="MyBagsContainerTemplate" id="3"/>
<Frame name="$parentBag4" inherits="MyBagsContainerTemplate" id="4"/>
<Frame name="$parentButtons" inherits="MyBagsButtonBarTemplate"/>
<Frame name="$parentCharSelect" inherits="MyBagsCharSelectTemplate"/>
<Frame name="$parentTokenFrame">
<Size>
<AbsDimension x="183" y="32"/>
</Size>
<Frames>
<Button name="$parentToken1" inherits="BackpackTokenTemplate" id="1">
<Anchors>
<Anchor point="LEFT">
<Offset x="13" y="0"/>
</Anchor>
</Anchors>
</Button>
<Button name="$parentToken2" inherits="BackpackTokenTemplate" id="2">
<Anchors>
<Anchor point="LEFT" relativeTo="$parentToken1" relativePoint="RIGHT">
<Offset x="2" y="0"/>
</Anchor>
</Anchors>
</Button>
<Button name="$parentToken3" inherits="BackpackTokenTemplate" id="3">
<Anchors>
<Anchor point="LEFT" relativeTo="$parentToken2" relativePoint="RIGHT">
<Offset x="2" y="0"/>
</Anchor>
</Anchors>
</Button>
</Frames>
</Frame>
<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>
<EditBox name="$parentSearchBox" inherits="MyBagsSearchBoxTemplate" letters="15" hidden="false" text="SEARCH">
<Size x="130" y="20"/>
<Anchors>
<Anchor point="BOTTOMRIGHT" relativeTo="$parentCharSelect" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="-10" y="8"/>
</Offset>
</Anchor>
</Anchors>
</EditBox>
</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>
mybags = self.self
if not mybags.GetOpt("Lock") then
self:GetParent():StopMovingOrSizing()
end
</OnMouseUp>
</Scripts>
</Frame>
<GameTooltip name="MyBagsHiddenTooltip" inherits="GameTooltipTemplate" parent="UIParent" hidden="true">
<Scripts>
<OnLoad>
self:SetOwner(UIParent, "ANCHOR_NONE");
</OnLoad>
</Scripts>
</GameTooltip>
</Ui>

4
MyBank/Locals/Locals.xml Normal file
View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Ui xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.blizzard.com/wow/ui/" xsi:schemaLocation="http://www.blizzard.com/wow/ui/FrameXML\UI.xsd">
<Include file="enUS.lua"/>
</Ui>

34
MyBank/Locals/enUS.lua Normal file
View File

@ -0,0 +1,34 @@
-- Version : English - Ramble
MYBANK_NAME = "MyBank"
MYBANK_DESCRIPTION = "All in one bank mod"
MYBANKFRAME_TITLE = "Bank"
-- SLASHCOMMANDS
-- MYBANK_COMMANDS = {"/mybank", "/mb"}
--[[ MYBANK_CMD_OPTIONS = {
MYBAGS_CMD_OPT_REPLACE, -- done
MYBAGS_CMD_OPT_FREEZE, -- done
MYBAGS_CMD_OPT_LOCK, -- done
MYBAGS_CMD_OPT_COLUMNS, -- done
MYBAGS_CMD_OPT_BAG, -- done
MYBAGS_CMD_OPT_HIGHLIGHT, -- 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_REVERSE, -- done
MYBAGS_CMD_OPT_BORDER, -- done
MYBAGS_CMD_OPT_PLAYERSEL, -- done
MYBAGS_CMD_OPT_COUNT, -- 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
}
]]

703
MyBank/MyBank.lua Normal file
View File

@ -0,0 +1,703 @@
local MYBANK_DEFAULT_OPTIONS = {
["Columns"] = 14,
["Replace"] = true,
["Bag"] = "bar",
["Graphics"] = "art",
["Count"] = "free",
["HlItems"] = true,
["Sort"] = "realm",
["Search"] = true,
["HlBags"] = true,
["Freeze"] = "sticky",
["Lock"] = false,
["NoEsc"] = false,
["Title"] = true,
["Cash"] = true,
["Buttons"] = true,
["AIOI"] = false,
["Border"] = true,
["Cache"] = nil,
["Player"] = true,
["Scale"] = false,
["Strata"] = "DIALOG",
["Anchor"] = "bottomleft",
["BackColor"] = {0.7,0,0,0},
["SlotColor"] = nil,
["AmmoColor"] = nil,
["EnchantColor"] = nil,
["EngColor"] = nil,
["HerbColor"] = nil,
["MAXBAGSLOTS"] = 36,
["_TOPOFFSET"] = 28,
["_BOTTOMOFFSET"] = 20,
["_LEFTOFFSET"] = 8,
["_RIGHTOFFSET"] = 3,
}
MyBank = LibStub("AceAddon-3.0"):NewAddon("MyBank", "MyBagsCore-1.0", "AceHook-3.0", "AceEvent-3.0", "AceConsole-3.0")
local MB_Config = LibStub("AceConfig-3.0")
local MB_Dialog = LibStub("AceConfigDialog-3.0")
local MB_Cmd = LibStub("AceConfigCmd-3.0")
local MB_Core = LibStub("MyBagsCore-1.0")
local L = LibStub("AceLocale-3.0"):GetLocale("MyBags")
function MyBank:OnInitialize()
self.name = "MyBank"
self.frameName = "MyBankFrame"
self.defaults = MYBANK_DEFAULT_OPTIONS
self.totalBags = 7
self.firstBag = 5
self.isBank = true
self.atBank = false
self.saveBankFrame = BankFrame
self.anchorPoint = "BOTTOMLEFT"
self.anchorParent = "UIParent"
self.anchorOffsetX = 5
self.anchorOffsetY = 100
self.db = LibStub("AceDB-3.0"):New("MyBankDB");
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("mb", "MB_ChatCommand")
self:RegisterChatCommand("mybank", "MB_ChatCommand")
self.options = {
type = "group",
args = {
replace = {
type = "toggle",
name = "Replace",
desc = "Set replacing of default bags",
get = function(info)
return MyBank.IsSet("Replace")
end,
set = function(info, val)
MyBank:SetReplace()
end,
},
freeze = {
type = "select",
name = "Freeze",
desc = "Keep window from closing when you leave vendors or bank",
values = {
["always"] = "Always leave the bag open",
["sticky"] = "Only leave open if manually opened",
["none"] = "Let the UI close the window",
},
get = function(info)
return MyBank.GetOpt("Freeze")
end,
set = function(info, val)
MyBank:SetFreeze(val)
end,
},
lock = {
type = "toggle",
name = "Lock",
desc = "Keep the window from moving",
get = function(info)
return MyBank.IsSet("Lock")
end,
set = function(info, val)
MyBank:SetLock()
end,
},
cols = {
type = "range",
name = "Columns",
desc = "Resize the frame",
step = 1,
min = 2,
max = 24,
softMin = 2,
softMax = 24,
get = function(info)
return MyBank.GetOpt("Columns")
end,
set = function(info, val)
MyBank:SetColumns(val)
end,
},
bag = {
type = "select",
name = "Bag",
desc = "Toggle between bag button view options",
values = {
["bar"] = "Bags are displayed as a bar on top of the frame",
["before"] = "Bag icons are places in the frame before bag slots",
["none"] = "Bags are hidden from the frame",
},
get = function(info)
return MyBank.GetOpt("Bag")
end,
set = function(info, val)
MyBank:SetBagDisplay(val)
end,
},
back = {
type = "select",
name = "Background",
desc = "Toggle window background options",
values = {
["default"] = "Semi-transparent minimalistic background",
["art"] = "Blizzard style artwork",
["none"] = "Disable background",
},
get = function(info)
return MyBank.GetOpt("Graphics")
end,
set = function(info, val)
MyBank:SetGraphicsDisplay(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 MyBank.GetOpt("Sort")
end,
set = function(info, val)
MyBank.SetOpt("Sort", val)
MyBank.Result("Sort: ", val)
end,
},
search = {
type = "toggle",
name = "Search",
desc = "Enable searchbox",
get = function(info)
return MyBank.GetOpt("Search")
end,
set = function(info, val)
MyBank:SetSearch()
end,
},
highlight = {
type = "multiselect",
name = "Hilight",
desc = "Toggle Highlighting options",
values = {
["items"] = "Highlight items when you mouse over bag slots",
["bag"] = "Highlight bag when you mouse over an item",
},
get = function(info, key)
if key == "items" then
return MyBank.GetOpt("HlItems")
end
if key == "bag" then
return MyBank.GetOpt("HlBags")
end
end,
set = function(info, key, val)
MyBank:SetHighlight(key)
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 MyBank.GetOpt("NoEsc")
end,
set = function(info, val)
MyBank:SetNoEsc()
end,
},
title = {
type = "toggle",
name = "Title",
desc = "Show/Hide the title",
get = function(info)
return MyBank.GetOpt("Title")
end,
set = function(info, val)
MyBank:SetTitle()
end,
},
cash = {
type = "toggle",
name = "Cash",
desc = "Show/Hide the money display",
get = function(info)
return MyBank.GetOpt("Cash")
end,
set = function(info, val)
MyBank:SetCash()
end,
},
buttons = {
type = "toggle",
name = "Buttons",
desc = "Show/Hide the close and lock buttons",
get = function(info)
return MyBank.GetOpt("Buttons")
end,
set = function(info, val)
MyBank:SetButtons()
end,
},
aioi = {
type = "toggle",
name = "AIOI",
desc = "Toggle partial row placement at bottom left or upper right",
get = function(info)
return MyBank.GetOpt("AIOI")
end,
set = function(info, val)
MyBank:SetAIOI()
end,
},
reverse = {
type = "toggle",
name = "Reverse",
desc = "Toggle order of bags (item order within bags is unchanged)",
get = function(info)
return MyBank.GetOpt("Reverse")
end,
set = function(info, val)
MyBank:SetReverse()
end,
},
quality = {
type = "toggle",
name = "Quality",
desc = "Highlight items based on quality",
get = function(info)
return MyBank.GetOpt("Border")
end,
set = function(info, val)
MyBank:SetBorder()
end,
},
player = {
type = "toggle",
name = "Player",
desc = "Show/Hide the offline player selection box",
get = function(info)
return MyBank.GetOpt("Player")
end,
set = function(info, val)
MyBank:SetPlayerSel()
end,
},
count = {
type = "select",
name = "Count",
desc = "Toggles between item count display modes",
values = {
["free"] = "Count free slots",
["used"] = "Count used slots",
["none"] = "Disable slot display",
},
get = function(info)
return MyBank.GetOpt("Count")
end,
set = function(info, val)
MyBank:SetCount(val)
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 MyBank.GetOpt("Scale")
end,
set = function(info, val)
MyBank: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 MyBank.GetOpt("Strata")
end,
set = function(info, val)
MyBank: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 MyBank.GetOpt("Anchor")
end,
set = function(info, val)
MyBank:SetAnchor(val)
end,
},
tog = {
type = "execute",
name = "Toggle",
desc = "Toggle the frame",
guiHidden = true,
func = function()
MyBank: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
MyBank:ResetSettings()
end
if key == "anchor" then
MyBank:ResetAnchor()
end
end
},
},
}
end
function MyBank:OnEnable()
-- MyBagsCore:Enable(self);
MyBankFrameBank.maxIndex = 28
MyBankFrameBank:SetID(BANK_CONTAINER)
MyBankFrameBag0:SetID(5)
MyBankFrameBag1:SetID(6)
MyBankFrameBag2:SetID(7)
MyBankFrameBag3:SetID(8)
MyBankFrameBag4:SetID(9)
MyBankFrameBag5:SetID(10)
MyBankFrameBag6:SetID(11)
if self.GetOpt("Replace") then
BankFrame:UnregisterEvent("BANKFRAME_OPENED")
BankFrame:UnregisterEvent("BANKFRAME_CLOSED")
_G["BankFrame"] = self.frame
end
MyBankFramePortrait:SetTexture("Interface\\Addons\\MyBags\\Skin\\MyBankPortrait")
StaticPopupDialogs["PURCHASE_BANKBAG"] = {
text = TEXT(CONFIRM_BUY_BANK_SLOT),
button1 = TEXT(YES),
button2 = TEXT(NO),
OnAccept = function()
if CT_oldPurchaseSlot then
CT_oldPurchaseSlot()
else
PurchaseSlot()
end;
end,
OnShow = function()
MoneyFrame_Update(this:GetName().."MoneyFrame", GetBankSlotCost());
end,
showAlert = 1,
hasMoneyFrame = 1,
timeout = 0,
hideOnEscape = 1,
}
end
function MyBank:MB_ChatCommand(input)
if not input or input:trim() == "" then
MB_Dialog:Open(self.name)
else
MB_Cmd.HandleCommand(MyBank, "mybank", self.name, input)
end
end
function MyBank:Disable()
BankFrame = self.saveBankFrame
BankFrame:RegisterEvent("BANKFRAME_OPENED")
BankFrame:RegisterEvent("BANKFRAME_CLOSED")
end
function MyBank: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_SetWidth(dropDown, 140)
_G["this"] = last_this
end
function MyBank:UserDropDown_Initialize()
local this = self or _G.this
local chars, char_num, i
chars = MyBank:GetSortedCharList(MyBank.GetOpt("Sort"))
char_num = getn(chars)
if (char_num == 0) then
MyBank.GetOpt("Player")
return
end
local frame = this:GetParent():GetParent()
local selectedValue = UIDropDownMenu_GetSelectedValue(this)
for i = 1, char_num 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 MyBank: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 MyBank:RegisterEvents()
MB_Core:RegisterEvents(self)
self:RegisterEvent("BANKFRAME_OPENED")
self:RegisterEvent("BANKFRAME_CLOSED")
self:RegisterEvent("PLAYERBANKSLOTS_CHANGED", "LayoutFrameOnEvent")
self:RegisterEvent("PLAYERBANKBAGSLOTS_CHANGED","LayoutFrameOnEvent")
end
function MyBank:HookFunctions()
MB_Core:HookFunctions(self)
self:RawHook("ToggleAllBags", true)
self:RawHook("CloseAllBags", true)
end
function MyBank:ToggleAllBags(forceopen)
if forceopen then
OpenBackpack()
else
ToggleBackpack()
end
local action, i
if (IsBagOpen(0) or MyInventory.frame:IsVisible()) then
action = "OpenBag"
else
action = "CloseBag"
end
for i=1, 4, 1 do
if not (MyInventory.GetOpt("Replace") and MyInventory:IncludeBag(i)) then
self.hooks[action](i)
end
end
for i=5, 11, 1 do
if not MyBank.GetOpt("Replace") or not MyBank:IncludeBag(i) then
self.hooks[action](i)
end
end
end
function MyBank:CloseAllBags()
local i
MyInventory:Close()
CloseBackpack() -- just in case backpack is not contolled by MyInventory
for i=1, 4, 1 do
if not MyInventory.GetOpt("Replace") or not MyInventory:IncludeBag(i) then
self.hooks.CloseBag(i)
end
end
for i=5, 11, 1 do
if not MyBank.GetOpt("Replace") or not MyBank:IncludeBag(i) then
self.hooks.CloseBag(i)
end
end
end
function MyBank:BAG_UPDATE(event, bag)
if self.isLive and (bag == -1 or (bag >= 5 and bag <= 11)) then
self:LayoutFrame()
end
end
function MyBank:BANKFRAME_OPENED()
MyBank.atBank = true
SetPortraitTexture(MyBankFramePortrait, "npc")
if self.Freeze == "always" or (self.Freeze == "sticky" and self.frame:IsVisible()) then
self.holdOpen = true
else
self.holdOpen = false
end
if self.GetOpt("Replace") then
self:Open()
else
self:LayoutFrame()
end
end
function MyBank:BANKFRAME_CLOSED()
MyBank.atBank = false
MyBankFramePortrait:SetTexture("Interface\\Addons\\MyBags\\Skin\\MyBankPortrait")
if self.GetOpt("Replace") and not self.holdOpen then
if self.frame:IsVisible() then
self.frame:Hide()
end -- calling self:close() would trigger the bank closing twice
else
self.holdOpen = false
if self.isLive then self:LayoutFrame() end
end
end
function MyBank:GetInfoFunc()
if self.isLive then
return self.GetInfoLive
end
if IsAddOnLoaded("DataStore_Containers") then
return self.GetInfoDataStore
end
if IsAddOnLoaded("MyBagsCache") then
return self.GetInfoMyBagsCache
end
return self.GetInfoNone
end
function MyBank:GetSortedCharList(sorttype, realm)
if IsAddOnLoaded("DataStore_Containers") 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_Containers.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_Containers, charName, realmName)) then
x_time = 0
else
x_time = DataStore:GetModuleLastUpdate(DataStore_Containers, charName, realmName)
end
charName, realmName = self:SplitString(w)
if (not DataStore:GetModuleLastUpdate(DataStore_Containers, charName, realmName)) then
y_time = 0
else
y_time = DataStore:GetModuleLastUpdate(DataStore_Containers, 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
function MyBank:SetReplace()
self.TogMsg("Replace", "Replace default bags")
self:LayoutFrame()
if self.GetOpt("Replace") then
BankFrame:UnregisterEvent("BANKFRAME_OPENED")
BankFrame:UnregisterEvent("BANKFRAME_CLOSED")
_G["BankFrame"] = self.frame
else
_G["BankFrame"] = self.saveBankFrame
BankFrame:RegisterEvent("BANKFRAME_OPENED")
BankFrame:RegisterEvent("BANKFRAME_CLOSED")
end
end

8
MyBank/MyBank.toc Normal file
View File

@ -0,0 +1,8 @@
## Interface: 40300
## Author: Ramble (modified by Isharra) (updated by thegabbert)
## Title: MyBank |cff007FFF -Ace-|r
## Notes: A replacement for the Blizzard Bank frame bags allowing remote viewing and viewing of other characters data when KC_Items.bank or MyBagsCache are available.
## Dependancies: Ace, MyBags
## SavedVariables: MyBankDB
## LoadOnDemand: 0
MyBank.xml

36
MyBank/MyBank.xml Normal file
View File

@ -0,0 +1,36 @@
<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">
<Include file="Locals\Locals.xml"/>
<Script file="MyBank.lua"/>
<Frame name="MyBagsBankContainerTemplate" inherits="MyBagsContainerTemplate" ID="BANK_CONTAINER" virtual="true">
</Frame>
<Frame name="MyBankAnchorFrame" hidden="false" movable="true" parent="UIParent">
<Size><AbsDimension x="10" y="10"/></Size>
<Anchors>
<Anchor point="BOTTOMLEFT" >
<Offset><AbsDimension x="5" y="100"/></Offset>
</Anchor>
</Anchors>
<Frames>
<Frame name="MyBankFrame" inherits="MyBagsFrameTemplate">
<Anchors>
<Anchor point="BOTTOMLEFT" />
</Anchors>
<Frames>
<Frame name="$parentBank" inherits="MyBagsBankContainerTemplate" ID="BANK_CONTAINER"/>
<Frame name="$parentBag5" inherits="MyBagsContainerTemplate" id="5"/>
<Frame name="$parentBag6" inherits="MyBagsContainerTemplate" id="6"/>
</Frames>
<Scripts>
<OnHide>
if MyBank.atBank then
CloseBankFrame()
end
</OnHide>
</Scripts>
</Frame>
</Frames>
</Frame>
</Ui>

687
MyEquipment/MyEquipment.lua Normal file
View 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

View 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
View 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
View 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
}
]]

655
MyInventory/MyInventory.lua Normal file
View File

@ -0,0 +1,655 @@
local MYINVENTORY_DEFAULT_OPTIONS = {
["Columns"] = 12,
["Replace"] = true,
["Bag"] = "bar",
["Graphics"] = "art",
["Count"] = "free",
["HlItems"] = true,
["Sort"] = "realm",
["Search"] = true,
["Token"] = true,
["HlBags"] = true,
["Freeze"] = "sticky",
["NoEsc"] = false,
["Lock"] = false,
["Title"] = true,
["Cash"] = true,
["Buttons"] = true,
["AIOI"] = false,
["Reverse"] = false,
["Border"] = true,
["Cache"] = nil,
["Player"] = true,
["Scale"] = false,
["Strata"] = "DIALOG",
["Anchor"] = "bottomright",
["BackColor"] = {0.7,0,0,0},
["SlotColor"] = nil,
["AmmoColor"] = nil,
["EnchantColor"] = nil,
["EngColor"] = nil,
["HerbColor"] = nil,
["Companion"] = nil,
["MAXBAGSLOTS"] = 36,
["_TOPOFFSET"] = 28,
["_BOTTOMOFFSET"] = 20,
["_LEFTOFFSET"] = 8,
["_RIGHTOFFSET"] = 3,
}
MyInventory = LibStub("AceAddon-3.0"):NewAddon("MyInventory", "AceConsole-3.0", "AceHook-3.0", "AceEvent-3.0", "MyBagsCore-1.0")
local MI_Dialog = LibStub("AceConfigDialog-3.0")
local MI_Cmd = LibStub("AceConfigCmd-3.0")
local MB_Core = LibStub("MyBagsCore-1.0")
local L = LibStub("AceLocale-3.0"):GetLocale("MyBags")
function MyInventory:OnInitialize()
self.name = "MyInventory"
self.frameName = "MyInventoryFrame"
self.defaults = MYINVENTORY_DEFAULT_OPTIONS
self.totalBags = 5
self.firstBag = 0
self.anchorPoint = "BOTTOMRIGHT"
self.anchorParent = "UIParent"
self.anchorOffsetX = -5
self.anchorOffsetY = 100
self.isBank = false
self.db = LibStub("AceDB-3.0"):New("MyInventoryDB")
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("mi", "MI_ChatCommand")
self:RegisterChatCommand("myinventory", "MI_ChatCommand")
self.options = {
type = "group",
args = {
replace = {
type = "toggle",
name = "Replace",
desc = "Set replacing of default bags",
get = function(info)
return MyInventory.IsSet("Replace")
end,
set = function(info, val)
MyInventory:SetReplace()
end,
},
freeze = {
type = "select",
name = "Freeze",
desc = "Keep window from closing when you leave vendors or bank",
values = {
["always"] = "Always leave the bag open",
["sticky"] = "Only leave open if manually opened",
["none"] = "Let the UI close the window",
},
get = function(info)
return MyInventory.GetOpt("Freeze")
end,
set = function(info, val)
MyInventory:SetFreeze(val)
end,
},
lock = {
type = "toggle",
name = "Lock",
desc = "Keep the window from moving",
get = function(info)
return MyInventory.IsSet("Lock")
end,
set = function(info, val)
MyInventory:SetLock()
end,
},
cols = {
type = "range",
name = "Columns",
desc = "Resize the frame",
step = 1,
min = 2,
max = 24,
softMin = 2,
softMax = 24,
get = function(info)
return MyInventory.GetOpt("Columns")
end,
set = function(info, val)
MyInventory:SetColumns(val)
end,
},
bag = {
type = "select",
name = "Bag",
desc = "Toggle between bag button view options",
values = {
["bar"] = "Bags are displayed as a bar on top of the frame",
["before"] = "Bag icons are places in the frame before bag slots",
["none"] = "Bags are hidden from the frame",
},
get = function(info)
return MyInventory.GetOpt("Bag")
end,
set = function(info, val)
MyInventory:SetBagDisplay(val)
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 MyInventory.GetOpt("Graphics")
end,
set = function(info, val)
MyInventory:SetGraphicsDisplay(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 MyInventory.GetOpt("Sort")
end,
set = function(info, val)
MyInventory.SetOpt("Sort", val)
MyInventory.Result("Sort: ", val)
end,
},
search = {
type = "toggle",
name = "Search",
desc = "Enable searchbox",
get = function(info)
return MyInventory.GetOpt("Search")
end,
set = function(info, val)
MyInventory:SetSearch()
end,
},
token = {
type = "toggle",
name = "Token",
desc = "Show token frame",
get = function(info)
return MyInventory.GetOpt("Token")
end,
set = function(info, val)
MyInventory:SetToken()
end,
},
highlight = {
type = "multiselect",
name = "Hilight",
desc = "Toggle Highlighting options",
values = {
["items"] = "Highlight items when you mouse over bag slots",
["bag"] = "Highlight bag when you mouse over an item",
},
get = function(info, key)
if key == "items" then
return MyInventory.GetOpt("HlItems")
end
if key == "bag" then
return MyInventory.GetOpt("HlBags")
end
end,
set = function(info, key, val)
MyInventory:SetHighlight(key)
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 MyInventory.GetOpt("NoEsc")
end,
set = function(info, val)
MyInventory:SetNoEsc()
end,
},
title = {
type = "toggle",
name = "Title",
desc = "Show/Hide the title",
get = function(info)
return MyInventory.GetOpt("Title")
end,
set = function(info, val)
MyInventory:SetTitle()
end,
},
cash = {
type = "toggle",
name = "Cash",
desc = "Show/Hide the money display",
get = function(info)
return MyInventory.GetOpt("Cash")
end,
set = function(info, val)
MyInventory:SetCash()
end,
},
buttons = {
type = "toggle",
name = "Buttons",
desc = "Show/Hide the close and lock buttons",
get = function(info)
return MyInventory.GetOpt("Buttons")
end,
set = function(info, val)
MyInventory:SetButtons()
end,
},
aioi = {
type = "toggle",
name = "AIOI",
desc = "Toggle partial row placement at bottom left or upper right",
get = function(info)
return MyInventory.GetOpt("AIOI")
end,
set = function(info, val)
MyInventory:SetAIOI()
end,
},
reverse = {
type = "toggle",
name = "Reverse",
desc = "Toggle order of bags (item order within bags is unchanged)",
get = function(info)
return MyInventory.GetOpt("Reverse")
end,
set = function(info, val)
MyInventory:SetReverse()
end,
},
quality = {
type = "toggle",
name = "Quality",
desc = "Highlight items based on quality",
get = function(info)
return MyInventory.GetOpt("Border")
end,
set = function(info, val)
MyInventory:SetBorder()
end,
},
player = {
type = "toggle",
name = "Player",
desc = "Show/Hide the offline player selection box",
get = function(info)
return MyInventory.GetOpt("Player")
end,
set = function(info, val)
MyInventory:SetPlayerSel()
end,
},
companion = {
type = "toggle",
name = "Companion",
desc = "Open/close MyInventory with bank, mail and trade windows",
get = function(info)
return MyInventory.GetOpt("Companion")
end,
set = function(info, val)
MyInventory:SetCompanion()
end,
},
count = {
type = "select",
name = "Count",
desc = "Toggles between item count display modes",
values = {
["free"] = "Count free slots",
["used"] = "Count used slots",
["none"] = "Disable slot display",
},
get = function(info)
return MyInventory.GetOpt("Count")
end,
set = function(info, val)
MyInventory:SetCount(val)
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 MyInventory.GetOpt("Scale")
end,
set = function(info, val)
MyInventory: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 MyInventory.GetOpt("Strata")
end,
set = function(info, val)
MyInventory: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 MyInventory.GetOpt("Anchor")
end,
set = function(info, val)
MyInventory:SetAnchor(val)
end,
},
tog = {
type = "execute",
name = "Toggle",
desc = "Toggle the frame",
guiHidden = true,
func = function()
MyInventory: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
MyInventory:ResetSettings()
end
if key == "anchor" then
MyInventory:ResetAnchor()
end
end
},
--[[
back = {
type = "select",
name = "back",
desc = "Toggle window background options",
values = {
["default"] = "Semi-transparent minimalistic background",
["art"] = "Blizzard style artwork",
["none"] = "Disable background",
},
get = function(info)
return MyInventory.GetOpt("")
end
},
]]
},
}
end
function MyInventory: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 MyInventory:UserDropDown_Initialize()
local this = self or _G.this
local chars = MyInventory:GetSortedCharList(MyInventory.GetOpt("Sort"))
local frame = this:GetParent():GetParent()
local selectedValue = UIDropDownMenu_GetSelectedValue(this)
local i
for i = 1, getn(chars) 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 MyInventory: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 MyInventory:HookFunctions()
MB_Core:HookFunctions(self)
self:RawHook("ToggleBackpack", true)
self:RawHook("OpenBackpack", true)
self:RawHook("CloseBackpack", true)
end
function MyInventory:ToggleBackpack()
if not (self.GetOpt("Replace") and self:IncludeBag(0)) then
self.hooks.ToggleBackpack()
else
self:Toggle()
end
end
function MyInventory:OpenBackpack()
if not (self.GetOpt("Replace") and self:IncludeBag(0)) then
self.hooks["OpenBackpack"]()
else
if MailFrame:IsVisible() then self.Companion = 1 end
if self.frame:IsVisible() then self.holdOpen = 1 end
self:Open()
end
end
function MyInventory:CloseBackpack()
if not (self.GetOpt("Replace") and self:IncludeBag(0)) then
self.hooks.CloseBackpack()
elseif not self.Freeze then
self:Close()
elseif self.Freeze == "sticky" then
if self.holdOpen then
self.holdOpen = nil
else
self:Close()
end
end
end
function MyInventory:CompanionOpen()
self.Companion = 1
self:OpenBackpack()
end
function MyInventory:CompanionClose()
if self.Companion then -- if not true it's a duplicate event
self.Companion = nil
self:CloseBackpack()
end
end
function MyInventory:BAG_UPDATE(event, bag)
if self.isLive and (bag == -2 or (bag >= 0 and bag <= 4)) then
self:LayoutFrame()
end
end
function MyInventory:GetInfoFunc()
if self.isLive then
return self.GetInfoLive
end
if IsAddOnLoaded("DataStore_Containers") then
return self.GetInfoDataStore
end
if IsAddOnLoaded("MyBagsCache") then
return self.GetInfoMyBagsCache
end
return self.GetInfoNone
end
function MyInventory:BagIDToInvSlotID(bag)
if bag < 1 or bag > 4 then return nil end
return ContainerIDToInventoryID(bag)
end
function MyInventory:IsBagSlotUsable(slot)
if (slot >= 0 and slot <= 4) then return true end
return false
end
function MyInventory:MI_ChatCommand(input)
if not input or input:trim() == "" then
MI_Dialog:Open(self.name)
else
MI_Cmd.HandleCommand(MyInventory, "myinventory", self.name, input)
end
end
function MyInventory:GetSortedCharList(sorttype, realm)
if IsAddOnLoaded("DataStore_Containers") 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
for i=1, realmcount do
for charname, _ in pairs(DataStore:GetCharacters(realmlist[i])) do
if DataStore_Containers.Characters[DataStore:GetCharacter(charname, realmlist[i])] 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 max = idx - 1;
local charName, realmName
repeat
swapped = 0
for i = 1, max do
q = result[i]
w = result[i+1]
charName, realmName = self:SplitString(q)
if (not DataStore:GetModuleLastUpdate(DataStore_Containers, charName, realmName)) then
x_time = 0
else
x_time = DataStore:GetModuleLastUpdate(DataStore_Containers, charName, realmName)
end
charName, realmName = self:SplitString(w)
if (not DataStore:GetModuleLastUpdate(DataStore_Containers, charName, realmName)) then
y_time = 0
else
y_time = DataStore:GetModuleLastUpdate(DataStore_Containers, 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 MBC = MyBagsCache
local result = {}
local idx = 0
local cache = MBC.db.global
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 max = idx - 1;
repeat
swapped = 0
for i = 1, max do
q = result[i]
w = result[i+1]
if (not MBC.db.global[q].updateTime) then
x_time = 0
else
x_time = MBC.db.global[q].updateTime
end
if (not MBC.db.global[w].updateTime) then
y_time = 0
else
y_time = MBC.db.global[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

View File

@ -0,0 +1,8 @@
## Interface: 40300
## Author: Isharra (updated by thegabbert)
## Title: MyInventory |cff007FFF -Ace-|r
## Notes: A replacement for the default inventory bags allowing viewing of other characters data when KC_Items.inventory or MyBagsCache are available.
## Dependancies: Ace, MyBags
## SavedVariables: MyInventoryDB
## LoadOnDemand: 0
MyInventory.xml

View File

@ -0,0 +1,31 @@
<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="MyInventory.lua"/>
<Frame name="MyInventoryAnchorFrame" 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="MyInventoryFrame" inherits="MyBagsFrameTemplate">
<Size>
<AbsDimension x="500" y="500"/>
</Size>
<Anchors>
<Anchor point="BOTTOMRIGHT"/>
</Anchors>
<Frames>
</Frames>
</Frame>
</Frames>
</Frame>
</Ui>

36
MyInventory/locals.lua Normal file
View File

@ -0,0 +1,36 @@
-- Version : English - Ramble
MYINVENTORY_NAME = "MyInventory"
MYINVENTORY_DESCRIPTION = "All in one inventory mod"
MYINVENTORYFRAME_TITLE = "Inventory"
-- SLASHCOMMANDS
--[[
MYINVENTORY_COMMANDS = {"/myinventory", "/mi"}
MYINVENTORY_CMD_OPTIONS = {
MYBAGS_CMD_OPT_TOGGLE, -- done
MYBAGS_CMD_OPT_FREEZE, -- done
MYBAGS_CMD_OPT_NOESC, -- done
MYBAGS_CMD_OPT_COLUMNS, -- done
MYBAGS_CMD_OPT_REPLACE, -- done
MYBAGS_CMD_OPT_BAG, -- done
MYBAGS_CMD_OPT_GRAPHICS, -- ????
MYBAGS_CMD_OPT_HIGHLIGHT, -- done
MYBAGS_CMD_OPT_LOCK, -- done
MYBAGS_CMD_OPT_TITLE, -- done
MYBAGS_CMD_OPT_CASH, -- done
MYBAGS_CMD_OPT_BUTTONS, -- done
MYBAGS_CMD_OPT_AIOI, -- done
MYBAGS_CMD_OPT_REVERSE, -- done
MYBAGS_CMD_OPT_BORDER, -- done
MYBAGS_CMD_OPT_PLAYERSEL, -- done
MYBAGS_CMD_OPT_COUNT,
MYBAGS_CMD_OPT_SCALE,
MYBAGS_CMD_OPT_STRATA,
MYBAGS_CMD_OPT_ANCHOR,
MYBAGS_CMD_RESET,
MYBAGS_CMD_OPT_SLOTCOLOR,
MYBAGS_CMD_OPT_COMPANION,
}
]]

BIN
Skin/Backpack.blp Normal file

Binary file not shown.

BIN
Skin/BottomCenter.blp Normal file

Binary file not shown.

BIN
Skin/BottomLeft.blp Normal file

Binary file not shown.

BIN
Skin/BottomRight.blp Normal file

Binary file not shown.

BIN
Skin/Button.blp Normal file

Binary file not shown.

BIN
Skin/Center.blp Normal file

Binary file not shown.

BIN
Skin/Left.blp Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
Skin/MinimizeButton-Up.blp Normal file

Binary file not shown.

BIN
Skin/MyBankPortrait.tga Normal file

Binary file not shown.

Binary file not shown.

BIN
Skin/Right.blp Normal file

Binary file not shown.

BIN
Skin/TopCenter.blp Normal file

Binary file not shown.

BIN
Skin/TopLeft.blp Normal file

Binary file not shown.

BIN
Skin/TopRight.blp Normal file

Binary file not shown.

BIN
Skin/blank.blp Normal file

Binary file not shown.