Compare commits
54 Commits
v50400-1.7
...
classic
| Author | SHA1 | Date | |
|---|---|---|---|
| 587a7e0d56 | |||
| 0cb3708671 | |||
| 35023a61c1 | |||
| a4f08a0b44 | |||
| 771bfaf5eb | |||
| 48eba18c2b | |||
| 089d270ade | |||
| 83abacd2f9 | |||
| 895f0ccd4c | |||
| 4d657ecee1 | |||
| 6352b997d1 | |||
| 23ff6cf7f3 | |||
| 17486c3251 | |||
| f6706c380b | |||
| f4ac2a0139 | |||
| b49f508c47 | |||
| 3a62dd9b99 | |||
| 6e353d9ebd | |||
| 733b7cc325 | |||
| f42d4c2a34 | |||
| 7c694ba727 | |||
| 77c25484f1 | |||
| f75aa0bd11 | |||
| 284bf213dd | |||
| 252e10de9a | |||
| 800a9b450b | |||
| e086ca746b | |||
| e140c68663 | |||
| 1f35539578 | |||
| 5e6b8eebf8 | |||
| 570abca36f | |||
| 7e13a47e52 | |||
| 152d61d84f | |||
| d21ff3c73a | |||
| 59d3e610c3 | |||
| b5dc2961b0 | |||
| 238145bef1 | |||
| 6e5fa165f2 | |||
| c0db29ffe8 | |||
| 5fc53d2191 | |||
| b03e7b4df2 | |||
| 31f513db74 | |||
| 25765b5f3c | |||
| 3e06a3a7ad | |||
| 1dffea8341 | |||
| 237217ede4 | |||
| 9c84784542 | |||
| 5775870bcd | |||
| 00683de69b | |||
| 2b8a6af9e2 | |||
| 232f424a6f | |||
| 8ccff635a0 | |||
| 2298e37175 | |||
| 191ee4dd73 |
21
.pkgmeta
21
.pkgmeta
@ -33,24 +33,3 @@ externals:
|
|||||||
Libs/AceGUI-3.0:
|
Libs/AceGUI-3.0:
|
||||||
url: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceGUI-3.0
|
url: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceGUI-3.0
|
||||||
tag: latest
|
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
|
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
<Bindings>
|
<Bindings>
|
||||||
<Binding name="MYINVENTORY" header="MYBAGSHEADER">
|
<Binding name="MYINVENTORY" header="MYBAGSHEADER" category="ADDONS">
|
||||||
if MyInventory then MyInventory:Toggle() end
|
if MyInventory then MyInventory:Toggle() end
|
||||||
</Binding>
|
</Binding>
|
||||||
<Binding name="MYBANK">
|
<Binding name="MYBANK" header="MYBAGSHEADER" category="ADDONS">
|
||||||
if MyBank then MyBank:Toggle() end
|
if MyBank then MyBank:Toggle() end
|
||||||
</Binding>
|
</Binding>
|
||||||
<Binding name="MYEQUIPMENT">
|
<Binding name="MYEQUIPMENT" header="MYBAGSHEADER" category="ADDONS">
|
||||||
if MyEquipment then MyEquipment:Toggle() end
|
if MyEquipment then MyEquipment:Toggle() end
|
||||||
</Binding>
|
</Binding>
|
||||||
</Bindings>
|
</Bindings>
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
local L = LibStub("AceLocale-3.0"):NewLocale("MyBags", "enUS", true)
|
local L = LibStub("AceLocale-3.0"):NewLocale("MyBags", "enUS", true)
|
||||||
|
|
||||||
if not L then return end
|
if not L then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
-- Global locales
|
-- Global locales
|
||||||
L["ACE_TEXT_OF"] = "of";
|
L["ACE_TEXT_OF"] = "of";
|
||||||
@ -13,6 +15,7 @@ L["BINDING_NAME_MYINVENTORY"] = "Toggle MyInventory"
|
|||||||
L["BINDING_NAME_MYBANK"] = "Toggle MyBank"
|
L["BINDING_NAME_MYBANK"] = "Toggle MyBank"
|
||||||
L["BINDING_NAME_MYEQUIPMENT"] = "Toggle MyEquipment"
|
L["BINDING_NAME_MYEQUIPMENT"] = "Toggle MyEquipment"
|
||||||
|
|
||||||
|
-- Bag types
|
||||||
L["ACEG_TEXT_AMMO"] = "Ammo";
|
L["ACEG_TEXT_AMMO"] = "Ammo";
|
||||||
L["ACEG_TEXT_QUIVER"] = "Quiver";
|
L["ACEG_TEXT_QUIVER"] = "Quiver";
|
||||||
L["ACEG_TEXT_SOUL"] = "Soul Bag";
|
L["ACEG_TEXT_SOUL"] = "Soul Bag";
|
||||||
@ -21,6 +24,7 @@ L["ACEG_TEXT_ENGINEER"] = "Engineering Bag";
|
|||||||
L["ACEG_TEXT_GEM"] = "Gem Bag";
|
L["ACEG_TEXT_GEM"] = "Gem Bag";
|
||||||
L["ACEG_TEXT_HERB"] = "Herb Bag";
|
L["ACEG_TEXT_HERB"] = "Herb Bag";
|
||||||
L["ACEG_TEXT_MINING"] = "Mining Bag";
|
L["ACEG_TEXT_MINING"] = "Mining Bag";
|
||||||
|
|
||||||
L["ACEG_TEXT_NOW_SET_TO"] = "is now set to";
|
L["ACEG_TEXT_NOW_SET_TO"] = "is now set to";
|
||||||
L["ACEG_TEXT_DEFAULT"] = "default";
|
L["ACEG_TEXT_DEFAULT"] = "default";
|
||||||
L["ACEG_DISPLAY_OPTION"] = "[|cfff5f530%s|r]";
|
L["ACEG_DISPLAY_OPTION"] = "[|cfff5f530%s|r]";
|
||||||
@ -32,6 +36,12 @@ L["MYBAGS_TITLE0"] = ""
|
|||||||
L["MYBAGS_TITLE1"] = "%s's "
|
L["MYBAGS_TITLE1"] = "%s's "
|
||||||
L["MYBAGS_TITLE2"] = "%s of %s's "
|
L["MYBAGS_TITLE2"] = "%s of %s's "
|
||||||
|
|
||||||
|
-- MYBANK_NAME = "MyBank"
|
||||||
|
-- MYBANK_DESCRIPTION = "All in one bank mod"
|
||||||
|
L["MYBANKFRAME_TITLE"] = "Bank"
|
||||||
|
L["MYINVENTORYFRAME_TITLE"] = "Inventory"
|
||||||
|
L["MYEQUIPMENTFRAME_TITLE"] = "Equipment"
|
||||||
|
|
||||||
L["MYBAGS_SLOTS_FREE"] = "%d/%d Slots Free";
|
L["MYBAGS_SLOTS_FREE"] = "%d/%d Slots Free";
|
||||||
L["MYBAGS_SLOTS_USED"] = "%d/%d Slots Used";
|
L["MYBAGS_SLOTS_USED"] = "%d/%d Slots Used";
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,8 @@
|
|||||||
## Interface: 50400
|
## Interface: 70000
|
||||||
## Author: Ramble (modified by Isharra) (updated by thegabbert) (converted to Ace3 by Takika)
|
## Author: Ramble (modified by Isharra) (updated by thegabbert) (converted to Ace3 by Takika)
|
||||||
## Version: 51
|
|
||||||
## Title: MyBags |cff007FFF -Ace3-|r
|
## Title: MyBags |cff007FFF -Ace3-|r
|
||||||
## Notes: Complete Replacement for Inventory and Bank Bags.
|
## Notes: Complete Replacement for Inventory and Bank Bags.
|
||||||
## OptionalDeps: MyBagsCache, DataStore_Containers
|
## OptionalDeps: DataStore, DataStore_Containers, DataStore_Characters
|
||||||
## SavedVariables: MyInventoryDB, MyBankDB, MyEquipmentDB
|
## SavedVariables: MyInventoryDB, MyBankDB, MyEquipmentDB
|
||||||
|
|
||||||
Embeds.xml
|
Embeds.xml
|
||||||
@ -14,4 +13,3 @@ MyBagsCore\MyBags.xml
|
|||||||
MyInventory\MyInventory.xml
|
MyInventory\MyInventory.xml
|
||||||
MyBank\MyBank.xml
|
MyBank\MyBank.xml
|
||||||
MyEquipment\MyEquipment.xml
|
MyEquipment\MyEquipment.xml
|
||||||
|
|
||||||
|
|||||||
@ -1,12 +0,0 @@
|
|||||||
<?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>
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
<?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>
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
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";
|
|
||||||
|
|
||||||
@ -1,452 +0,0 @@
|
|||||||
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, t, id, il, n = select(3, strfind(l, "|cff(%x+)|H(%l+):(%-?%d+)([^|]+)|h%[(.-)%]|h|r"))
|
|
||||||
|
|
||||||
-- return n, c, id .. il, id, t
|
|
||||||
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
|
|
||||||
@ -1,16 +0,0 @@
|
|||||||
## Interface: 50400
|
|
||||||
## 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
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
<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>
|
|
||||||
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
<?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>
|
|
||||||
@ -1,36 +0,0 @@
|
|||||||
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"
|
|
||||||
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,7 @@
|
|||||||
xsi:schemaLocation="http://www.blizzard.com/wow/ui/FrameXML/UI.xsd">
|
xsi:schemaLocation="http://www.blizzard.com/wow/ui/FrameXML/UI.xsd">
|
||||||
<Script file="MyBags.lua"/>
|
<Script file="MyBags.lua"/>
|
||||||
<!-- Templates -->
|
<!-- Templates -->
|
||||||
<Button name="MyBagsItemButtonTemplate" inherits="ContainerFrameItemButtonTemplate" virtual="true">
|
<Button name="MyBagsItemButtonTemplate" inherits="ContainerFrameItemButtonTemplate" virtual="true" hidden="true">
|
||||||
<Frames>
|
<Frames>
|
||||||
<Cooldown name="$parentCooldown" inherits="CooldownFrameTemplate"/>
|
<Cooldown name="$parentCooldown" inherits="CooldownFrameTemplate"/>
|
||||||
</Frames>
|
</Frames>
|
||||||
@ -366,6 +366,22 @@
|
|||||||
<Frame name="$parentBag4" inherits="MyBagsContainerTemplate" id="4"/>
|
<Frame name="$parentBag4" inherits="MyBagsContainerTemplate" id="4"/>
|
||||||
<Frame name="$parentButtons" inherits="MyBagsButtonBarTemplate"/>
|
<Frame name="$parentButtons" inherits="MyBagsButtonBarTemplate"/>
|
||||||
<Frame name="$parentCharSelect" inherits="MyBagsCharSelectTemplate"/>
|
<Frame name="$parentCharSelect" inherits="MyBagsCharSelectTemplate"/>
|
||||||
|
<Button name="$parentSortButton">
|
||||||
|
<Size x="28" y="26"/>
|
||||||
|
<NormalTexture atlas="bags-button-autosort-up"/>
|
||||||
|
<PushedTexture atlas="bags-button-autosort-down"/>
|
||||||
|
<HighlightTexture file="Interface\Buttons\ButtonHilight-Square" alphaMode="ADD">
|
||||||
|
<Size x="24" y="23"/>
|
||||||
|
<Anchors>
|
||||||
|
<Anchor point="CENTER" x="0" y="0"/>
|
||||||
|
</Anchors>
|
||||||
|
</HighlightTexture>
|
||||||
|
<Scripts>
|
||||||
|
<OnEnter/>
|
||||||
|
<OnLeave/>
|
||||||
|
<OnClick/>
|
||||||
|
</Scripts>
|
||||||
|
</Button>
|
||||||
<Frame name="$parentTokenFrame">
|
<Frame name="$parentTokenFrame">
|
||||||
<Size>
|
<Size>
|
||||||
<AbsDimension x="183" y="32"/>
|
<AbsDimension x="183" y="32"/>
|
||||||
|
|||||||
@ -1,4 +0,0 @@
|
|||||||
<?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>
|
|
||||||
@ -1,34 +0,0 @@
|
|||||||
-- 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
|
|
||||||
}
|
|
||||||
]]
|
|
||||||
@ -2,6 +2,7 @@ local MYBANK_DEFAULT_OPTIONS = {
|
|||||||
["Columns"] = 14,
|
["Columns"] = 14,
|
||||||
["Replace"] = true,
|
["Replace"] = true,
|
||||||
["Bag"] = "bar",
|
["Bag"] = "bar",
|
||||||
|
["BagSort"] = true,
|
||||||
["Graphics"] = "art",
|
["Graphics"] = "art",
|
||||||
["Count"] = "free",
|
["Count"] = "free",
|
||||||
["HlItems"] = true,
|
["HlItems"] = true,
|
||||||
@ -34,14 +35,32 @@ local MYBANK_DEFAULT_OPTIONS = {
|
|||||||
["_RIGHTOFFSET"] = 3,
|
["_RIGHTOFFSET"] = 3,
|
||||||
}
|
}
|
||||||
|
|
||||||
MyBank = LibStub("AceAddon-3.0"):NewAddon("MyBank", "MyBagsCore-1.0", "AceHook-3.0", "AceEvent-3.0", "AceConsole-3.0")
|
MyBank = LibStub("AceAddon-3.0"):NewAddon("MyBank", "MyBagsCore-1.1", "AceHook-3.0", "AceEvent-3.0", "AceConsole-3.0")
|
||||||
local MB_Config = LibStub("AceConfig-3.0")
|
local MB_Config = LibStub("AceConfig-3.0")
|
||||||
local MB_Dialog = LibStub("AceConfigDialog-3.0")
|
local MB_Dialog = LibStub("AceConfigDialog-3.0")
|
||||||
local MB_Cmd = LibStub("AceConfigCmd-3.0")
|
local MB_Cmd = LibStub("AceConfigCmd-3.0")
|
||||||
local MB_Core = LibStub("MyBagsCore-1.0")
|
local MB_Core = LibStub("MyBagsCore-1.1")
|
||||||
|
|
||||||
local L = LibStub("AceLocale-3.0"):GetLocale("MyBags")
|
local L = LibStub("AceLocale-3.0"):GetLocale("MyBags")
|
||||||
|
|
||||||
|
-- Lua APIs
|
||||||
|
local pairs = pairs
|
||||||
|
local strtrim = strtrim
|
||||||
|
|
||||||
|
-- WoW APIs
|
||||||
|
local _G = _G
|
||||||
|
local CloseBackpack = CloseBackpack
|
||||||
|
local IsBagOpen = IsBagOpen
|
||||||
|
local MoneyFrame_Update = MoneyFrame_Update
|
||||||
|
local OpenBackpack = OpenBackpack
|
||||||
|
local PlaySound = PlaySound
|
||||||
|
local SetPortraitTexture = SetPortraitTexture
|
||||||
|
local SortBankBags = SortBankBags
|
||||||
|
local ToggleBackpack = ToggleBackpack
|
||||||
|
|
||||||
|
--Global variables that we don't cache, list them here for the mikk's Find Globals script
|
||||||
|
-- GLOBALS:
|
||||||
|
|
||||||
function MyBank:OnInitialize()
|
function MyBank:OnInitialize()
|
||||||
self.name = "MyBank"
|
self.name = "MyBank"
|
||||||
self.frameName = "MyBankFrame"
|
self.frameName = "MyBankFrame"
|
||||||
@ -55,12 +74,13 @@ function MyBank:OnInitialize()
|
|||||||
self.anchorParent = "UIParent"
|
self.anchorParent = "UIParent"
|
||||||
self.anchorOffsetX = 5
|
self.anchorOffsetX = 5
|
||||||
self.anchorOffsetY = 100
|
self.anchorOffsetY = 100
|
||||||
self.db = LibStub("AceDB-3.0"):New("MyBankDB");
|
self.db = LibStub("AceDB-3.0"):New("MyBankDB")
|
||||||
local prof = self.db:GetCurrentProfile()
|
local prof = self.db:GetCurrentProfile()
|
||||||
if self.db.profiles[prof] and self.db.profiles[prof]["Columns"] and self.db.profiles[prof]["Columns"] > 0 then
|
if self.db.profiles[prof] and self.db.profiles[prof]["Columns"] and self.db.profiles[prof]["Columns"] > 0 then
|
||||||
else
|
else
|
||||||
self.db.profiles[prof] = self.defaults
|
self.db.profiles[prof] = self.defaults
|
||||||
end
|
end
|
||||||
|
|
||||||
self:RegisterChatCommand("mb", "MB_ChatCommand")
|
self:RegisterChatCommand("mb", "MB_ChatCommand")
|
||||||
self:RegisterChatCommand("mybank", "MB_ChatCommand")
|
self:RegisterChatCommand("mybank", "MB_ChatCommand")
|
||||||
self.options = {
|
self.options = {
|
||||||
@ -136,6 +156,17 @@ function MyBank:OnInitialize()
|
|||||||
MyBank:SetBagDisplay(val)
|
MyBank:SetBagDisplay(val)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
bagsort = {
|
||||||
|
type = "toggle",
|
||||||
|
name = "BagSort",
|
||||||
|
desc = "Toggle bag sort button",
|
||||||
|
get = function(info)
|
||||||
|
return MyBank.IsSet("BagSort")
|
||||||
|
end,
|
||||||
|
set = function(info, val)
|
||||||
|
MyBank:SetBagSort()
|
||||||
|
end,
|
||||||
|
},
|
||||||
back = {
|
back = {
|
||||||
type = "select",
|
type = "select",
|
||||||
name = "Background",
|
name = "Background",
|
||||||
@ -389,7 +420,7 @@ function MyBank:OnInitialize()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function MyBank:OnEnable()
|
function MyBank:OnEnable()
|
||||||
-- MyBagsCore:Enable(self);
|
-- MyBagsCore:Enable(self)
|
||||||
MyBankFrameBank.maxIndex = 28
|
MyBankFrameBank.maxIndex = 28
|
||||||
MyBankFrameBank:SetID(BANK_CONTAINER)
|
MyBankFrameBank:SetID(BANK_CONTAINER)
|
||||||
MyBankFrameBag0:SetID(5)
|
MyBankFrameBag0:SetID(5)
|
||||||
@ -399,25 +430,29 @@ function MyBank:OnEnable()
|
|||||||
MyBankFrameBag4:SetID(9)
|
MyBankFrameBag4:SetID(9)
|
||||||
MyBankFrameBag5:SetID(10)
|
MyBankFrameBag5:SetID(10)
|
||||||
MyBankFrameBag6:SetID(11)
|
MyBankFrameBag6:SetID(11)
|
||||||
|
|
||||||
if self.GetOpt("Replace") then
|
if self.GetOpt("Replace") then
|
||||||
BankFrame:UnregisterEvent("BANKFRAME_OPENED")
|
BankFrame:UnregisterEvent("BANKFRAME_OPENED")
|
||||||
BankFrame:UnregisterEvent("BANKFRAME_CLOSED")
|
BankFrame:UnregisterEvent("BANKFRAME_CLOSED")
|
||||||
_G["BankFrame"] = self.frame
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
self:RegisterEvent("BANKFRAME_OPENED")
|
||||||
|
|
||||||
MyBankFramePortrait:SetTexture("Interface\\Addons\\MyBags\\Skin\\MyBankPortrait")
|
MyBankFramePortrait:SetTexture("Interface\\Addons\\MyBags\\Skin\\MyBankPortrait")
|
||||||
StaticPopupDialogs["PURCHASE_BANKBAG"] = {
|
StaticPopupDialogs["PURCHASE_BANKBAG"] = {
|
||||||
|
preferredIndex = STATICPOPUPS_NUMDIALOGS,
|
||||||
text = TEXT(CONFIRM_BUY_BANK_SLOT),
|
text = TEXT(CONFIRM_BUY_BANK_SLOT),
|
||||||
button1 = TEXT(YES),
|
button1 = TEXT(YES),
|
||||||
button2 = TEXT(NO),
|
button2 = TEXT(NO),
|
||||||
OnAccept = function()
|
OnAccept = function(self)
|
||||||
if CT_oldPurchaseSlot then
|
if CT_oldPurchaseSlot then
|
||||||
CT_oldPurchaseSlot()
|
CT_oldPurchaseSlot()
|
||||||
else
|
else
|
||||||
PurchaseSlot()
|
PurchaseSlot()
|
||||||
end;
|
end;
|
||||||
end,
|
end,
|
||||||
OnShow = function()
|
OnShow = function(self)
|
||||||
MoneyFrame_Update(this:GetName().."MoneyFrame", GetBankSlotCost());
|
MoneyFrame_Update(self:GetName() .. "MoneyFrame", GetBankSlotCost());
|
||||||
end,
|
end,
|
||||||
showAlert = 1,
|
showAlert = 1,
|
||||||
hasMoneyFrame = 1,
|
hasMoneyFrame = 1,
|
||||||
@ -427,9 +462,10 @@ function MyBank:OnEnable()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function MyBank:MB_ChatCommand(input)
|
function MyBank:MB_ChatCommand(input)
|
||||||
if not input or input:trim() == "" then
|
if not input or strtrim(input) == "" then
|
||||||
MB_Dialog:Open(self.name)
|
MB_Dialog:Open(self.name)
|
||||||
else
|
else
|
||||||
|
input = strtrim(input)
|
||||||
MB_Cmd.HandleCommand(MyBank, "mybank", self.name, input)
|
MB_Cmd.HandleCommand(MyBank, "mybank", self.name, input)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -443,7 +479,10 @@ end
|
|||||||
function MyBank:LoadDropDown()
|
function MyBank:LoadDropDown()
|
||||||
local dropDown = _G[self.frameName .. "CharSelectDropDown"]
|
local dropDown = _G[self.frameName .. "CharSelectDropDown"]
|
||||||
local dropDownButton = _G[self.frameName .. "CharSelectDropDownButton"]
|
local dropDownButton = _G[self.frameName .. "CharSelectDropDownButton"]
|
||||||
if not dropDown then return end
|
if not dropDown then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local last_this = _G["this"]
|
local last_this = _G["this"]
|
||||||
_G["this"] = dropDownButton
|
_G["this"] = dropDownButton
|
||||||
UIDropDownMenu_Initialize(dropDown, self.UserDropDown_Initialize)
|
UIDropDownMenu_Initialize(dropDown, self.UserDropDown_Initialize)
|
||||||
@ -454,13 +493,14 @@ end
|
|||||||
|
|
||||||
function MyBank:UserDropDown_Initialize()
|
function MyBank:UserDropDown_Initialize()
|
||||||
local this = self or _G.this
|
local this = self or _G.this
|
||||||
local chars, char_num, i
|
local chars, char_num
|
||||||
chars = MyBank:GetSortedCharList(MyBank.GetOpt("Sort"))
|
chars = MyBank:GetSortedCharList(MyBank.GetOpt("Sort"))
|
||||||
char_num = getn(chars)
|
char_num = #chars
|
||||||
if (char_num == 0) then
|
if (char_num == 0) then
|
||||||
MyBank.GetOpt("Player")
|
-- MyBank.GetOpt("Player")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local frame = this:GetParent():GetParent()
|
local frame = this:GetParent():GetParent()
|
||||||
local selectedValue = UIDropDownMenu_GetSelectedValue(this)
|
local selectedValue = UIDropDownMenu_GetSelectedValue(this)
|
||||||
|
|
||||||
@ -472,7 +512,10 @@ function MyBank:UserDropDown_Initialize()
|
|||||||
["owner"] = frame.self,
|
["owner"] = frame.self,
|
||||||
["checked"] = nil,
|
["checked"] = nil,
|
||||||
}
|
}
|
||||||
if selectedValue == info.value then info.checked = 1 end
|
if selectedValue == info.value then
|
||||||
|
info.checked = 1
|
||||||
|
end
|
||||||
|
|
||||||
UIDropDownMenu_AddButton(info)
|
UIDropDownMenu_AddButton(info)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -488,10 +531,14 @@ end
|
|||||||
|
|
||||||
function MyBank:RegisterEvents()
|
function MyBank:RegisterEvents()
|
||||||
MB_Core:RegisterEvents(self)
|
MB_Core:RegisterEvents(self)
|
||||||
self:RegisterEvent("BANKFRAME_OPENED")
|
|
||||||
self:RegisterEvent("BANKFRAME_CLOSED")
|
|
||||||
self:RegisterEvent("PLAYERBANKSLOTS_CHANGED", "LayoutFrameOnEvent")
|
self:RegisterEvent("PLAYERBANKSLOTS_CHANGED", "LayoutFrameOnEvent")
|
||||||
self:RegisterEvent("PLAYERBANKBAGSLOTS_CHANGED","LayoutFrameOnEvent")
|
self:RegisterEvent("PLAYERBANKBAGSLOTS_CHANGED","LayoutFrameOnEvent")
|
||||||
|
self:RegisterEvent("BANKFRAME_CLOSED")
|
||||||
|
end
|
||||||
|
|
||||||
|
function MyBank:UnregisterEvents()
|
||||||
|
MB_Core:UnregisterEvents(self)
|
||||||
|
self:RegisterEvent("BANKFRAME_OPENED")
|
||||||
end
|
end
|
||||||
|
|
||||||
function MyBank:HookFunctions()
|
function MyBank:HookFunctions()
|
||||||
@ -506,17 +553,20 @@ function MyBank:ToggleAllBags(forceopen)
|
|||||||
else
|
else
|
||||||
ToggleBackpack()
|
ToggleBackpack()
|
||||||
end
|
end
|
||||||
local action, i
|
|
||||||
|
local action
|
||||||
if (IsBagOpen(0) or MyInventory.frame:IsVisible()) then
|
if (IsBagOpen(0) or MyInventory.frame:IsVisible()) then
|
||||||
action = "OpenBag"
|
action = "OpenBag"
|
||||||
else
|
else
|
||||||
action = "CloseBag"
|
action = "CloseBag"
|
||||||
end
|
end
|
||||||
|
|
||||||
for i = 1, 4, 1 do
|
for i = 1, 4, 1 do
|
||||||
if not (MyInventory.GetOpt("Replace") and MyInventory:IncludeBag(i)) then
|
if not (MyInventory.GetOpt("Replace") and MyInventory:IncludeBag(i)) then
|
||||||
self.hooks[action](i)
|
self.hooks[action](i)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
for i = 5, 11, 1 do
|
for i = 5, 11, 1 do
|
||||||
if not MyBank.GetOpt("Replace") or not MyBank:IncludeBag(i) then
|
if not MyBank.GetOpt("Replace") or not MyBank:IncludeBag(i) then
|
||||||
self.hooks[action](i)
|
self.hooks[action](i)
|
||||||
@ -525,7 +575,6 @@ function MyBank:ToggleAllBags(forceopen)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function MyBank:CloseAllBags()
|
function MyBank:CloseAllBags()
|
||||||
local i
|
|
||||||
MyInventory:Close()
|
MyInventory:Close()
|
||||||
CloseBackpack() -- just in case backpack is not contolled by MyInventory
|
CloseBackpack() -- just in case backpack is not contolled by MyInventory
|
||||||
for i = 1, 4, 1 do
|
for i = 1, 4, 1 do
|
||||||
@ -533,6 +582,7 @@ function MyBank:CloseAllBags()
|
|||||||
self.hooks.CloseBag(i)
|
self.hooks.CloseBag(i)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
for i = 5, 11, 1 do
|
for i = 5, 11, 1 do
|
||||||
if not MyBank.GetOpt("Replace") or not MyBank:IncludeBag(i) then
|
if not MyBank.GetOpt("Replace") or not MyBank:IncludeBag(i) then
|
||||||
self.hooks.CloseBag(i)
|
self.hooks.CloseBag(i)
|
||||||
@ -547,6 +597,7 @@ function MyBank:BAG_UPDATE(event, bag)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function MyBank:BANKFRAME_OPENED()
|
function MyBank:BANKFRAME_OPENED()
|
||||||
|
self:RegisterEvents()
|
||||||
MyBank.atBank = true
|
MyBank.atBank = true
|
||||||
SetPortraitTexture(MyBankFramePortrait, "npc")
|
SetPortraitTexture(MyBankFramePortrait, "npc")
|
||||||
if self.Freeze == "always" or (self.Freeze == "sticky" and self.frame:IsVisible()) then
|
if self.Freeze == "always" or (self.Freeze == "sticky" and self.frame:IsVisible()) then
|
||||||
@ -554,6 +605,7 @@ function MyBank:BANKFRAME_OPENED()
|
|||||||
else
|
else
|
||||||
self.holdOpen = false
|
self.holdOpen = false
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.GetOpt("Replace") then
|
if self.GetOpt("Replace") then
|
||||||
self:Open()
|
self:Open()
|
||||||
else
|
else
|
||||||
@ -570,26 +622,30 @@ function MyBank:BANKFRAME_CLOSED()
|
|||||||
end -- calling self:close() would trigger the bank closing twice
|
end -- calling self:close() would trigger the bank closing twice
|
||||||
else
|
else
|
||||||
self.holdOpen = false
|
self.holdOpen = false
|
||||||
if self.isLive then self:LayoutFrame() end
|
if self.isLive then
|
||||||
|
self:LayoutFrame()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
self:UnregisterEvents()
|
||||||
|
end
|
||||||
|
|
||||||
function MyBank:GetInfoFunc()
|
function MyBank:GetInfoFunc()
|
||||||
if self.isLive then
|
if self.isLive then
|
||||||
return self.GetInfoLive
|
return self.GetInfoLive
|
||||||
end
|
end
|
||||||
|
|
||||||
if IsAddOnLoaded("DataStore_Containers") then
|
if IsAddOnLoaded("DataStore_Containers") then
|
||||||
return self.GetInfoDataStore
|
return self.GetInfoDataStore
|
||||||
end
|
end
|
||||||
if IsAddOnLoaded("MyBagsCache") then
|
|
||||||
return self.GetInfoMyBagsCache
|
|
||||||
end
|
|
||||||
return self.GetInfoNone
|
return self.GetInfoNone
|
||||||
end
|
end
|
||||||
|
|
||||||
function MyBank:GetSortedCharList(sorttype, realm)
|
function MyBank:GetSortedCharList(sorttype, realm)
|
||||||
|
local result = {}
|
||||||
|
|
||||||
if IsAddOnLoaded("DataStore_Containers") then
|
if IsAddOnLoaded("DataStore_Containers") then
|
||||||
local realmname
|
|
||||||
local realmlist = {}
|
local realmlist = {}
|
||||||
local realmcount = 0
|
local realmcount = 0
|
||||||
if not realm then
|
if not realm then
|
||||||
@ -601,10 +657,8 @@ function MyBank:GetSortedCharList(sorttype, realm)
|
|||||||
realmcount = 1
|
realmcount = 1
|
||||||
realmlist[1] = realm
|
realmlist[1] = realm
|
||||||
end
|
end
|
||||||
local result = {}
|
|
||||||
local idx = 0
|
local idx = 0
|
||||||
local i
|
|
||||||
local charname, charkey
|
|
||||||
for i = 1, realmcount do
|
for i = 1, realmcount do
|
||||||
for charname, charkey in pairs(DataStore:GetCharacters(realmlist[i])) do
|
for charname, charkey in pairs(DataStore:GetCharacters(realmlist[i])) do
|
||||||
-- charkey = DataStore:GetCharacter(charname, realmlist[i])
|
-- charkey = DataStore:GetCharacter(charname, realmlist[i])
|
||||||
@ -614,9 +668,10 @@ function MyBank:GetSortedCharList(sorttype, realm)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local swapped
|
local swapped
|
||||||
local q, w
|
local q, w
|
||||||
local x_time, y_time;
|
local x_time, y_time
|
||||||
local charName, realmName
|
local charName, realmName
|
||||||
repeat
|
repeat
|
||||||
swapped = 0
|
swapped = 0
|
||||||
@ -629,12 +684,14 @@ function MyBank:GetSortedCharList(sorttype, realm)
|
|||||||
else
|
else
|
||||||
x_time = DataStore:GetModuleLastUpdate(DataStore_Containers, charName, realmName)
|
x_time = DataStore:GetModuleLastUpdate(DataStore_Containers, charName, realmName)
|
||||||
end
|
end
|
||||||
|
|
||||||
charName, realmName = self:SplitString(w)
|
charName, realmName = self:SplitString(w)
|
||||||
if (not DataStore:GetModuleLastUpdate(DataStore_Containers, charName, realmName)) then
|
if (not DataStore:GetModuleLastUpdate(DataStore_Containers, charName, realmName)) then
|
||||||
y_time = 0
|
y_time = 0
|
||||||
else
|
else
|
||||||
y_time = DataStore:GetModuleLastUpdate(DataStore_Containers, charName, realmName)
|
y_time = DataStore:GetModuleLastUpdate(DataStore_Containers, charName, realmName)
|
||||||
end
|
end
|
||||||
|
|
||||||
if self:SortChars(q, w, x_time, y_time, sorttype) then
|
if self:SortChars(q, w, x_time, y_time, sorttype) then
|
||||||
result[i] = w
|
result[i] = w
|
||||||
result[i + 1] = q
|
result[i + 1] = q
|
||||||
@ -642,51 +699,10 @@ function MyBank:GetSortedCharList(sorttype, realm)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
until swapped == 0
|
until swapped == 0
|
||||||
|
end
|
||||||
|
|
||||||
return result
|
return result
|
||||||
end
|
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()
|
function MyBank:SetReplace()
|
||||||
self.TogMsg("Replace", "Replace default bags")
|
self.TogMsg("Replace", "Replace default bags")
|
||||||
@ -701,3 +717,8 @@ function MyBank:SetReplace()
|
|||||||
BankFrame:RegisterEvent("BANKFRAME_CLOSED")
|
BankFrame:RegisterEvent("BANKFRAME_CLOSED")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function MyBank:SortBags()
|
||||||
|
PlaySound("UI_BagSorting_01")
|
||||||
|
SortBankBags()
|
||||||
|
end
|
||||||
@ -1,7 +1,6 @@
|
|||||||
<Ui xmlns="http://www.blizzard.com/wow/ui/"
|
<Ui xmlns="http://www.blizzard.com/wow/ui/"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://www.blizzard.com/wow/ui/FrameXML/UI.xsd">
|
xsi:schemaLocation="http://www.blizzard.com/wow/ui/FrameXML/UI.xsd">
|
||||||
<Include file="Locals\Locals.xml"/>
|
|
||||||
<Script file="MyBank.lua"/>
|
<Script file="MyBank.lua"/>
|
||||||
<Frame name="MyBagsBankContainerTemplate" inherits="MyBagsContainerTemplate" ID="BANK_CONTAINER" virtual="true">
|
<Frame name="MyBagsBankContainerTemplate" inherits="MyBagsContainerTemplate" ID="BANK_CONTAINER" virtual="true">
|
||||||
</Frame>
|
</Frame>
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
local MYBAGS_MAXEQUIPSLOTS = 19
|
|
||||||
local MYBAGS_SLOTCOLOR = { 0.5, 0.5, 0.5 }
|
local MYBAGS_SLOTCOLOR = { 0.5, 0.5, 0.5 }
|
||||||
local MYEQUIPMENT_SLOT = {}
|
local MYEQUIPMENT_SLOT = {}
|
||||||
|
|
||||||
@ -46,22 +45,72 @@ local MYEQUIPMENT_DEFAULT_OPTIONS = {
|
|||||||
["_RIGHTOFFSET"] = 3,
|
["_RIGHTOFFSET"] = 3,
|
||||||
}
|
}
|
||||||
|
|
||||||
MyEquipment = LibStub("AceAddon-3.0"):NewAddon("MyEquipment", "AceConsole-3.0", "AceHook-3.0", "AceEvent-3.0", "MyBagsCore-1.0")
|
MyEquipment = LibStub("AceAddon-3.0"):NewAddon("MyEquipment", "AceConsole-3.0", "AceHook-3.0", "AceEvent-3.0", "MyBagsCore-1.1")
|
||||||
local ME_Dialog = LibStub("AceConfigDialog-3.0")
|
local ME_Dialog = LibStub("AceConfigDialog-3.0")
|
||||||
local ME_Cmd = LibStub("AceConfigCmd-3.0")
|
local ME_Cmd = LibStub("AceConfigCmd-3.0")
|
||||||
|
|
||||||
|
-- Lua APIs
|
||||||
|
local pairs = pairs
|
||||||
|
local strlen, strsub, strfind, strtrim = string.len, string.sub, string.find, strtrim
|
||||||
|
local select = select
|
||||||
|
local tonumber = tonumber
|
||||||
|
|
||||||
|
-- WoW APIs
|
||||||
|
local _G = _G
|
||||||
|
local ChatEdit_InsertLink = ChatEdit_InsertLink
|
||||||
|
local CursorCanGoInSlot = CursorCanGoInSlot
|
||||||
|
local CursorUpdate = CursorUpdate
|
||||||
|
local DressUpItemLink = DressUpItemLink
|
||||||
|
local GetInventoryItemCooldown = GetInventoryItemCooldown
|
||||||
|
local GetInventoryItemCount = GetInventoryItemCount
|
||||||
|
local GetInventoryItemLink = GetInventoryItemLink
|
||||||
|
local GetInventoryItemTexture = GetInventoryItemTexture
|
||||||
|
local GetInventorySlotInfo = GetInventorySlotInfo
|
||||||
|
local InRepairMode = InRepairMode
|
||||||
|
local IsControlKeyDown = IsControlKeyDown
|
||||||
|
local IsInventoryItemLocked = IsInventoryItemLocked
|
||||||
|
local IsShiftKeyDown = IsShiftKeyDown
|
||||||
|
local PaperDollItemSlotButton_OnClick = PaperDollItemSlotButton_OnClick
|
||||||
|
local PaperDollItemSlotButton_OnEvent = PaperDollItemSlotButton_OnEvent
|
||||||
|
local PaperDollItemSlotButton_OnModifiedClick = PaperDollItemSlotButton_OnModifiedClick
|
||||||
|
local SetItemButtonCount = SetItemButtonCount
|
||||||
|
local SetItemButtonDesaturated = SetItemButtonDesaturated
|
||||||
|
local SetItemButtonTexture = SetItemButtonTexture
|
||||||
|
local SetItemButtonTextureVertexColor = SetItemButtonTextureVertexColor
|
||||||
|
local SetTooltipMoney = SetTooltipMoney
|
||||||
|
local ShowInspectCursor = ShowInspectCursor
|
||||||
|
local UnitHasRelicSlot = UnitHasRelicSlot
|
||||||
|
|
||||||
|
--Global variables that we don't cache, list them here for the mikk's Find Globals script
|
||||||
|
-- GLOBALS:
|
||||||
|
|
||||||
|
|
||||||
local function ColorConvertHexToDigit(h)
|
local function ColorConvertHexToDigit(h)
|
||||||
if(strlen(h)~=6) then return 0,0,0 end
|
if (strlen(h) ~= 6) then
|
||||||
local r={a=10,b=11,c=12,d=13,e=14,f=15}
|
return 0, 0, 0
|
||||||
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,
|
end
|
||||||
((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
|
local r = {
|
||||||
|
a = 10,
|
||||||
|
b = 11,
|
||||||
|
c = 12,
|
||||||
|
d = 13,
|
||||||
|
e = 14,
|
||||||
|
f = 15
|
||||||
|
}
|
||||||
|
|
||||||
|
return ((tonum(strsub(h, 1, 1)) or r[strsub(h, 1, 1)] or 0) * 16 + (tonum(strsub(h, 2, 2)) or r[strsub(h, 2, 2)] or 0)) / 255,
|
||||||
|
((tonum(strsub(h, 3, 3)) or r[strsub(h, 3, 3)] or 0) * 16 + (tonum(strsub(h, 4, 4)) or r[strsub(h, 4, 4)] or 0)) / 255,
|
||||||
|
((tonum(strsub(h, 5, 5)) or r[strsub(h, 5, 5)] or 0) * 16 + (tonum(strsub(h, 6, 6)) or r[strsub(h, 6, 6)] or 0)) / 255
|
||||||
end
|
end
|
||||||
|
|
||||||
local function GetItemInfoFromLink(l)
|
local function GetItemInfoFromLink(l)
|
||||||
if(not l) then return end
|
if (not l) then
|
||||||
local c,id,il,n=select(3, strfind(l,"|cff(%x+)|Hitem:(%-?%d+)([^|]+)|h%[(.-)%]|h|r"))
|
return
|
||||||
return n,c,id..il,id
|
end
|
||||||
|
|
||||||
|
local c, t, id, il, n = select(3, strfind(l, "|cff(%x+)|H(%l+):(%-?%d+)([^|]+)|h%[(.-)%]|h|r"))
|
||||||
|
return n, c, id .. il, id, t
|
||||||
end
|
end
|
||||||
|
|
||||||
local function tonum(val)
|
local function tonum(val)
|
||||||
@ -312,7 +361,6 @@ end
|
|||||||
|
|
||||||
function MyEquipment:OnEnable()
|
function MyEquipment:OnEnable()
|
||||||
MyEquipmentFramePortrait:SetTexture("Interface\\Addons\\MyBags\\Skin\\MyEquipmentPortrait")
|
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
|
for key,value in pairs(SLOTNAMES) do -- Just in case Blizzard shuffles the slot name table around
|
||||||
local slotId = GetInventorySlotInfo(value)
|
local slotId = GetInventorySlotInfo(value)
|
||||||
MYEQUIPMENT_SLOT[slotId] = value
|
MYEQUIPMENT_SLOT[slotId] = value
|
||||||
@ -333,7 +381,10 @@ end
|
|||||||
function MyEquipment:LoadDropDown()
|
function MyEquipment:LoadDropDown()
|
||||||
local dropDown = _G[self.frameName .. "CharSelectDropDown"]
|
local dropDown = _G[self.frameName .. "CharSelectDropDown"]
|
||||||
local dropDownButton = _G[self.frameName .. "CharSelectDropDownButton"]
|
local dropDownButton = _G[self.frameName .. "CharSelectDropDownButton"]
|
||||||
if not dropDown then return end
|
if not dropDown then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local last_this = _G["this"]
|
local last_this = _G["this"]
|
||||||
_G["this"] = dropDownButton
|
_G["this"] = dropDownButton
|
||||||
UIDropDownMenu_Initialize(dropDown, self.UserDropDown_Initialize)
|
UIDropDownMenu_Initialize(dropDown, self.UserDropDown_Initialize)
|
||||||
@ -347,15 +398,15 @@ function MyEquipment:UserDropDown_Initialize()
|
|||||||
local this = self or _G.this
|
local this = self or _G.this
|
||||||
local chars, charnum
|
local chars, charnum
|
||||||
chars = MyEquipment:GetSortedCharList(MyEquipment.GetOpt("Sort"))
|
chars = MyEquipment:GetSortedCharList(MyEquipment.GetOpt("Sort"))
|
||||||
charnum = getn(chars)
|
charnum = #chars
|
||||||
if (charnum == 0) then
|
if (charnum == 0) then
|
||||||
self.GetOpt("Player")
|
-- self.GetOpt("Player")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local frame = this:GetParent():GetParent()
|
local frame = this:GetParent():GetParent()
|
||||||
local selectedValue = UIDropDownMenu_GetSelectedValue(this)
|
local selectedValue = UIDropDownMenu_GetSelectedValue(this)
|
||||||
|
|
||||||
local i
|
|
||||||
for i = 1, charnum do
|
for i = 1, charnum do
|
||||||
local info = {
|
local info = {
|
||||||
["text"] = chars[i],
|
["text"] = chars[i],
|
||||||
@ -364,7 +415,10 @@ function MyEquipment:UserDropDown_Initialize()
|
|||||||
["owner"] = frame.self,
|
["owner"] = frame.self,
|
||||||
["checked"] = nil,
|
["checked"] = nil,
|
||||||
}
|
}
|
||||||
if selectedValue == info.value then info.checked = 1 end
|
if selectedValue == info.value then
|
||||||
|
info.checked = 1
|
||||||
|
end
|
||||||
|
|
||||||
UIDropDownMenu_AddButton(info)
|
UIDropDownMenu_AddButton(info)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -384,11 +438,10 @@ end
|
|||||||
function MyEquipment:GetRelic(charID)
|
function MyEquipment:GetRelic(charID)
|
||||||
if self.isLive then
|
if self.isLive then
|
||||||
return UnitHasRelicSlot("player")
|
return UnitHasRelicSlot("player")
|
||||||
elseif IsAddOnLoaded("MyBagsCache") then
|
else
|
||||||
return MyBagsCache:GetRelic(charID)
|
|
||||||
end
|
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function MyEquipment:GetInfoFunc()
|
function MyEquipment:GetInfoFunc()
|
||||||
if self.isLive then
|
if self.isLive then
|
||||||
@ -397,15 +450,13 @@ function MyEquipment:GetInfoFunc()
|
|||||||
elseif IsAddOnLoaded("DataStore_Inventory") then
|
elseif IsAddOnLoaded("DataStore_Inventory") then
|
||||||
return self.GetInfoDataStore
|
return self.GetInfoDataStore
|
||||||
]]
|
]]
|
||||||
elseif IsAddOnLoaded("MyBagsCache") then
|
else
|
||||||
return self.GetInfoMyBagsCache
|
|
||||||
end
|
|
||||||
return self.GetInfoNone
|
return self.GetInfoNone
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function MyEquipment:GetEquipInfoLive(itemIndex)
|
function MyEquipment:GetEquipInfoLive(itemIndex)
|
||||||
local itemLink = GetInventoryItemLink("player",itemIndex)
|
local itemLink = GetInventoryItemLink("player",itemIndex)
|
||||||
local myColor, myLink, myName = nil
|
|
||||||
local texture, count, quality, ID = nil
|
local texture, count, quality, ID = nil
|
||||||
if itemLink or itemIndex == 0 then
|
if itemLink or itemIndex == 0 then
|
||||||
texture = GetInventoryItemTexture("player",itemIndex)
|
texture = GetInventoryItemTexture("player",itemIndex)
|
||||||
@ -415,7 +466,7 @@ function MyEquipment:GetEquipInfoLive(itemIndex)
|
|||||||
ID = select(4, GetItemInfoFromLink(itemLink))
|
ID = select(4, GetItemInfoFromLink(itemLink))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local hasRelic = UnitHasRelicSlot("player")
|
|
||||||
local locked = IsInventoryItemLocked(itemIndex)
|
local locked = IsInventoryItemLocked(itemIndex)
|
||||||
return texture, count, ID, locked, quality, readable, nil
|
return texture, count, ID, locked, quality, readable, nil
|
||||||
end
|
end
|
||||||
@ -423,7 +474,7 @@ end
|
|||||||
function MyEquipment:MyEquipmentItemSlotButton_OnLoad(widget)
|
function MyEquipment:MyEquipmentItemSlotButton_OnLoad(widget)
|
||||||
widget:RegisterForDrag("LeftButton")
|
widget:RegisterForDrag("LeftButton")
|
||||||
_G[widget:GetName() .. "NormalTexture"]:SetTexture("Interface\\AddOns\\MyBags\\Skin\\Button")
|
_G[widget:GetName() .. "NormalTexture"]:SetTexture("Interface\\AddOns\\MyBags\\Skin\\Button")
|
||||||
widget.UpdateTooltip = widget.MyEquipmentItemSlotButton_OnEnter;
|
widget.UpdateTooltip = widget.MyEquipmentItemSlotButton_OnEnter
|
||||||
end
|
end
|
||||||
|
|
||||||
function MyEquipment:MyEquipmentItemSlotButton_OnEnter(widget)
|
function MyEquipment:MyEquipmentItemSlotButton_OnEnter(widget)
|
||||||
@ -433,9 +484,13 @@ function MyEquipment:MyEquipmentItemSlotButton_OnEnter(widget)
|
|||||||
local hasItem, hasCooldown, repairCost = GameTooltip:SetInventoryItem("player", widget:GetID())
|
local hasItem, hasCooldown, repairCost = GameTooltip:SetInventoryItem("player", widget:GetID())
|
||||||
if not hasItem then
|
if not hasItem then
|
||||||
text = TEXT(_G[MYEQUIPMENT_SLOT[tonum(strsub(widget:GetName(), 21))]])
|
text = TEXT(_G[MYEQUIPMENT_SLOT[tonum(strsub(widget:GetName(), 21))]])
|
||||||
if widget.hasRelic then text = TEXT(_G["RELICSLOT"]) end
|
if widget.hasRelic then
|
||||||
|
text = TEXT(_G["RELICSLOT"])
|
||||||
|
end
|
||||||
|
|
||||||
GameTooltip:SetText(text)
|
GameTooltip:SetText(text)
|
||||||
end
|
end
|
||||||
|
|
||||||
if (InRepairMode() and repairCost and (repairCost > 0)) then
|
if (InRepairMode() and repairCost and (repairCost > 0)) then
|
||||||
GameTooltip:AddLine(TEXT(REPAIR_COST), "", 1, 1, 1)
|
GameTooltip:AddLine(TEXT(REPAIR_COST), "", 1, 1, 1)
|
||||||
SetTooltipMoney(GameTooltip, repairCost)
|
SetTooltipMoney(GameTooltip, repairCost)
|
||||||
@ -449,11 +504,19 @@ function MyEquipment:MyEquipmentItemSlotButton_OnEnter(widget)
|
|||||||
local _, count, ID, _, quality, _, name = self:GetInfo(widget:GetID())
|
local _, count, ID, _, quality, _, name = self:GetInfo(widget:GetID())
|
||||||
if ID and ID ~= "" then
|
if ID and ID ~= "" then
|
||||||
local hyperlink = self:GetHyperlink(ID)
|
local hyperlink = self:GetHyperlink(ID)
|
||||||
if hyperlink then GameTooltip:SetHyperlink(hyperlink) end
|
if hyperlink then
|
||||||
if IsControlKeyDown() and hyperlink then ShowInspectCursor() end
|
GameTooltip:SetHyperlink(hyperlink)
|
||||||
|
end
|
||||||
|
|
||||||
|
if IsControlKeyDown() and hyperlink then
|
||||||
|
ShowInspectCursor()
|
||||||
|
end
|
||||||
else
|
else
|
||||||
text = TEXT(_G[MYEQUIPMENT_SLOT[tonum(strsub(widget:GetName(), 21))]])
|
text = TEXT(_G[MYEQUIPMENT_SLOT[tonum(strsub(widget:GetName(), 21))]])
|
||||||
if widget.hasRelic then text = TEXT(_G["RELICSLOT"]) end
|
if widget.hasRelic then
|
||||||
|
text = TEXT(_G["RELICSLOT"])
|
||||||
|
end
|
||||||
|
|
||||||
if name then -- it's a bleeding ammo slot
|
if name then -- it's a bleeding ammo slot
|
||||||
text = name
|
text = name
|
||||||
GameTooltip:SetText(text, ColorConvertHexToDigit(quality))
|
GameTooltip:SetText(text, ColorConvertHexToDigit(quality))
|
||||||
@ -487,7 +550,10 @@ function MyEquipment:MyEquipmentItemSlotButton_OnModifiedClick(widget, button)
|
|||||||
elseif (IsShiftKeyDown()) then
|
elseif (IsShiftKeyDown()) then
|
||||||
local ID = select(3, self:GetInfo(widget:GetID()))
|
local ID = select(3, self:GetInfo(widget:GetID()))
|
||||||
local hyperLink
|
local hyperLink
|
||||||
if ID then hyperLink = self:GetHyperlink(ID) end
|
if ID then
|
||||||
|
hyperLink = self:GetHyperlink(ID)
|
||||||
|
end
|
||||||
|
|
||||||
if hyperLink then
|
if hyperLink then
|
||||||
ChatEdit_InsertLink(hyperLink)
|
ChatEdit_InsertLink(hyperLink)
|
||||||
end
|
end
|
||||||
@ -512,6 +578,7 @@ function MyEquipment:MyEquipmentItemSlotButton_OnEvent(widget, event)
|
|||||||
else
|
else
|
||||||
widget:UnlockHighlight()
|
widget:UnlockHighlight()
|
||||||
end
|
end
|
||||||
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -525,7 +592,7 @@ end
|
|||||||
|
|
||||||
function MyEquipment:LayoutEquipmentFrame(self)
|
function MyEquipment:LayoutEquipmentFrame(self)
|
||||||
local itemBase = "MyEquipmentSlotsItem"
|
local itemBase = "MyEquipmentSlotsItem"
|
||||||
local texture, count, locked, quality, ammo, key, value, id
|
local texture, count, locked, quality, id
|
||||||
local slotColor = ((self.GetOpt("SlotColor")) or MYBAGS_SLOTCOLOR)
|
local slotColor = ((self.GetOpt("SlotColor")) or MYBAGS_SLOTCOLOR)
|
||||||
local charID = self:GetCurrentPlayer()
|
local charID = self:GetCurrentPlayer()
|
||||||
local hasRelic = self:GetRelic(charID)
|
local hasRelic = self:GetRelic(charID)
|
||||||
@ -534,6 +601,7 @@ function MyEquipment:LayoutEquipmentFrame(self)
|
|||||||
if self.aioiOrder and (hasRelic or hideAmmo) then
|
if self.aioiOrder and (hasRelic or hideAmmo) then
|
||||||
self.curCol = self.curCol + 1
|
self.curCol = self.curCol + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
for key, value in pairs(SLOTNAMES) do
|
for key, value in pairs(SLOTNAMES) do
|
||||||
local slot = GetInventorySlotInfo(value)
|
local slot = GetInventorySlotInfo(value)
|
||||||
local itemButton = _G[itemBase .. slot]
|
local itemButton = _G[itemBase .. slot]
|
||||||
@ -541,6 +609,7 @@ function MyEquipment:LayoutEquipmentFrame(self)
|
|||||||
self.curCol = 0
|
self.curCol = 0
|
||||||
self.curRow = self.curRow + 1
|
self.curRow = self.curRow + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
itemButton:Show()
|
itemButton:Show()
|
||||||
itemButton:ClearAllPoints()
|
itemButton:ClearAllPoints()
|
||||||
itemButton:SetPoint("TOPLEFT", self.frame:GetName(), "TOPLEFT", self:GetXY(self.curRow, self.curCol))
|
itemButton:SetPoint("TOPLEFT", self.frame:GetName(), "TOPLEFT", self:GetXY(self.curRow, self.curCol))
|
||||||
@ -549,24 +618,30 @@ function MyEquipment:LayoutEquipmentFrame(self)
|
|||||||
if id and id ~= "" then
|
if id and id ~= "" then
|
||||||
itemButton.hasItem = 1
|
itemButton.hasItem = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.isLive then
|
if self.isLive then
|
||||||
local start, duration, enable = GetInventoryItemCooldown("player", slot)
|
local start, duration, enable = GetInventoryItemCooldown("player", slot)
|
||||||
local cooldown = _G[itemButton:GetName() .. "Cooldown"]
|
local cooldown = _G[itemButton:GetName() .. "Cooldown"]
|
||||||
CooldownFrame_SetTimer(cooldown,start,duration,enable)
|
CooldownFrame_Set(cooldown, start, duration, enable)
|
||||||
if duration > 0 and enable == 0 then
|
if duration > 0 and enable == 0 then
|
||||||
SetItemButtonTextureVertexColor(itemButton, 0.4,0.4,0.4)
|
SetItemButtonTextureVertexColor(itemButton, 0.4,0.4,0.4)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if value == "RANGEDSLOT" and hasRelic then
|
if value == "RANGEDSLOT" and hasRelic then
|
||||||
itemButton.hasRelic = 1
|
itemButton.hasRelic = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
SetItemButtonTexture(itemButton, (texture or ""))
|
SetItemButtonTexture(itemButton, (texture or ""))
|
||||||
SetItemButtonCount(itemButton, count)
|
SetItemButtonCount(itemButton, count)
|
||||||
SetItemButtonDesaturated(itemButton, locked, 0.5, 0.5, 0.5)
|
SetItemButtonDesaturated(itemButton, locked, 0.5, 0.5, 0.5)
|
||||||
if locked and locked ~= "" then
|
if locked and locked ~= "" then
|
||||||
itemButton:LockHighlight()
|
itemButton:LockHighlight()
|
||||||
self.watchLock = 1
|
self.watchLock = 1
|
||||||
else itemButton:UnlockHighlight() end
|
else
|
||||||
|
itemButton:UnlockHighlight()
|
||||||
|
end
|
||||||
|
|
||||||
if quality and self.GetOpt("Border") then
|
if quality and self.GetOpt("Border") then
|
||||||
SetItemButtonNormalTextureVertexColor(itemButton, ColorConvertHexToDigit(quality))
|
SetItemButtonNormalTextureVertexColor(itemButton, ColorConvertHexToDigit(quality))
|
||||||
else
|
else
|
||||||
@ -576,7 +651,7 @@ function MyEquipment:LayoutEquipmentFrame(self)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function MyEquipment:ME_ChatCommand(input)
|
function MyEquipment:ME_ChatCommand(input)
|
||||||
if not input or input:trim() == "" then
|
if not input or strtrim(input) == "" then
|
||||||
ME_Dialog:Open(self.name)
|
ME_Dialog:Open(self.name)
|
||||||
else
|
else
|
||||||
ME_Cmd.HandleCommand(MyEquipment, "myequipment", self.name, input)
|
ME_Cmd.HandleCommand(MyEquipment, "myequipment", self.name, input)
|
||||||
@ -584,6 +659,7 @@ function MyEquipment:ME_ChatCommand(input)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function MyEquipment:GetSortedCharList(sorttype, realm)
|
function MyEquipment:GetSortedCharList(sorttype, realm)
|
||||||
|
local result = {}
|
||||||
--[[
|
--[[
|
||||||
if IsAddOnLoaded("DataStore_Inventory") then
|
if IsAddOnLoaded("DataStore_Inventory") then
|
||||||
local realmname
|
local realmname
|
||||||
@ -598,7 +674,6 @@ function MyEquipment:GetSortedCharList(sorttype, realm)
|
|||||||
realmcount = 1
|
realmcount = 1
|
||||||
realmlist[1] = realm
|
realmlist[1] = realm
|
||||||
end
|
end
|
||||||
local result = {}
|
|
||||||
local idx = 0
|
local idx = 0
|
||||||
local i
|
local i
|
||||||
local charname, charkey
|
local charname, charkey
|
||||||
@ -613,7 +688,7 @@ function MyEquipment:GetSortedCharList(sorttype, realm)
|
|||||||
end
|
end
|
||||||
local swapped
|
local swapped
|
||||||
local q, w
|
local q, w
|
||||||
local x_time, y_time;
|
local x_time, y_time
|
||||||
local charName, realmName
|
local charName, realmName
|
||||||
repeat
|
repeat
|
||||||
swapped = 0
|
swapped = 0
|
||||||
@ -639,49 +714,7 @@ function MyEquipment:GetSortedCharList(sorttype, realm)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
until swapped == 0
|
until swapped == 0
|
||||||
return result
|
|
||||||
end
|
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
|
return result
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
<Ui xmlns="http://www.blizzard.com/wow/ui/"
|
<Ui xmlns="http://www.blizzard.com/wow/ui/"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://www.blizzard.com/wow/ui/FrameXML/UI.xsd">
|
xsi:schemaLocation="http://www.blizzard.com/wow/ui/FrameXML/UI.xsd">
|
||||||
<Script file="locals.lua" />
|
|
||||||
<Script file="MyEquipment.lua" />
|
<Script file="MyEquipment.lua" />
|
||||||
|
|
||||||
<!-- Templates -->
|
<!-- Templates -->
|
||||||
|
|||||||
@ -1,29 +0,0 @@
|
|||||||
-- 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
|
|
||||||
}
|
|
||||||
]]
|
|
||||||
@ -2,6 +2,7 @@ local MYINVENTORY_DEFAULT_OPTIONS = {
|
|||||||
["Columns"] = 12,
|
["Columns"] = 12,
|
||||||
["Replace"] = true,
|
["Replace"] = true,
|
||||||
["Bag"] = "bar",
|
["Bag"] = "bar",
|
||||||
|
["BagSort"] = true,
|
||||||
["Graphics"] = "art",
|
["Graphics"] = "art",
|
||||||
["Count"] = "free",
|
["Count"] = "free",
|
||||||
["HlItems"] = true,
|
["HlItems"] = true,
|
||||||
@ -37,10 +38,10 @@ local MYINVENTORY_DEFAULT_OPTIONS = {
|
|||||||
["_RIGHTOFFSET"] = 3,
|
["_RIGHTOFFSET"] = 3,
|
||||||
}
|
}
|
||||||
|
|
||||||
MyInventory = LibStub("AceAddon-3.0"):NewAddon("MyInventory", "AceConsole-3.0", "AceHook-3.0", "AceEvent-3.0", "MyBagsCore-1.0")
|
MyInventory = LibStub("AceAddon-3.0"):NewAddon("MyInventory", "AceConsole-3.0", "AceHook-3.0", "AceEvent-3.0", "MyBagsCore-1.1")
|
||||||
local MI_Dialog = LibStub("AceConfigDialog-3.0")
|
local MI_Dialog = LibStub("AceConfigDialog-3.0")
|
||||||
local MI_Cmd = LibStub("AceConfigCmd-3.0")
|
local MI_Cmd = LibStub("AceConfigCmd-3.0")
|
||||||
local MB_Core = LibStub("MyBagsCore-1.0")
|
local MB_Core = LibStub("MyBagsCore-1.1")
|
||||||
|
|
||||||
local L = LibStub("AceLocale-3.0"):GetLocale("MyBags")
|
local L = LibStub("AceLocale-3.0"):GetLocale("MyBags")
|
||||||
|
|
||||||
@ -55,6 +56,7 @@ function MyInventory:OnInitialize()
|
|||||||
self.anchorOffsetX = -5
|
self.anchorOffsetX = -5
|
||||||
self.anchorOffsetY = 100
|
self.anchorOffsetY = 100
|
||||||
self.isBank = false
|
self.isBank = false
|
||||||
|
self.version = MB_Core:GetCoreVersion()
|
||||||
self.db = LibStub("AceDB-3.0"):New("MyInventoryDB")
|
self.db = LibStub("AceDB-3.0"):New("MyInventoryDB")
|
||||||
local prof = self.db:GetCurrentProfile()
|
local prof = self.db:GetCurrentProfile()
|
||||||
if self.db.profiles[prof] and self.db.profiles[prof]["Columns"] and self.db.profiles[prof]["Columns"] > 0 then
|
if self.db.profiles[prof] and self.db.profiles[prof]["Columns"] and self.db.profiles[prof]["Columns"] > 0 then
|
||||||
@ -136,6 +138,17 @@ function MyInventory:OnInitialize()
|
|||||||
MyInventory:SetBagDisplay(val)
|
MyInventory:SetBagDisplay(val)
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
|
bagsort = {
|
||||||
|
type = "toggle",
|
||||||
|
name = "BagSort",
|
||||||
|
desc = "Toggle bag sort button",
|
||||||
|
get = function(info)
|
||||||
|
return MyInventory.IsSet("BagSort")
|
||||||
|
end,
|
||||||
|
set = function(info, val)
|
||||||
|
MyInventory:SetBagSort()
|
||||||
|
end,
|
||||||
|
},
|
||||||
back = {
|
back = {
|
||||||
type = "select",
|
type = "select",
|
||||||
name = "Background",
|
name = "Background",
|
||||||
@ -443,7 +456,6 @@ function MyInventory:UserDropDown_Initialize()
|
|||||||
local chars = MyInventory:GetSortedCharList(MyInventory.GetOpt("Sort"))
|
local chars = MyInventory:GetSortedCharList(MyInventory.GetOpt("Sort"))
|
||||||
local frame = this:GetParent():GetParent()
|
local frame = this:GetParent():GetParent()
|
||||||
local selectedValue = UIDropDownMenu_GetSelectedValue(this)
|
local selectedValue = UIDropDownMenu_GetSelectedValue(this)
|
||||||
local i
|
|
||||||
|
|
||||||
for i = 1, getn(chars) do
|
for i = 1, getn(chars) do
|
||||||
local info = {
|
local info = {
|
||||||
@ -531,9 +543,7 @@ function MyInventory:GetInfoFunc()
|
|||||||
if IsAddOnLoaded("DataStore_Containers") then
|
if IsAddOnLoaded("DataStore_Containers") then
|
||||||
return self.GetInfoDataStore
|
return self.GetInfoDataStore
|
||||||
end
|
end
|
||||||
if IsAddOnLoaded("MyBagsCache") then
|
|
||||||
return self.GetInfoMyBagsCache
|
|
||||||
end
|
|
||||||
return self.GetInfoNone
|
return self.GetInfoNone
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -557,7 +567,6 @@ end
|
|||||||
|
|
||||||
function MyInventory:GetSortedCharList(sorttype, realm)
|
function MyInventory:GetSortedCharList(sorttype, realm)
|
||||||
if IsAddOnLoaded("DataStore_Containers") then
|
if IsAddOnLoaded("DataStore_Containers") then
|
||||||
local realmname
|
|
||||||
local realmlist = {}
|
local realmlist = {}
|
||||||
local realmcount = 0
|
local realmcount = 0
|
||||||
if not realm then
|
if not realm then
|
||||||
@ -610,46 +619,4 @@ function MyInventory:GetSortedCharList(sorttype, realm)
|
|||||||
until swapped == 0
|
until swapped == 0
|
||||||
return result
|
return result
|
||||||
end
|
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
|
end
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
<Ui xmlns="http://www.blizzard.com/wow/ui/"
|
<Ui xmlns="http://www.blizzard.com/wow/ui/"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://www.blizzard.com/wow/ui/FrameXML/UI.xsd">
|
xsi:schemaLocation="http://www.blizzard.com/wow/ui/FrameXML/UI.xsd">
|
||||||
<Script file="locals.lua"/>
|
|
||||||
<Script file="MyInventory.lua"/>
|
<Script file="MyInventory.lua"/>
|
||||||
<Frame name="MyInventoryAnchorFrame" hidden="false" movable="true" parent="UIParent">
|
<Frame name="MyInventoryAnchorFrame" hidden="false" movable="true" parent="UIParent">
|
||||||
<Size>
|
<Size>
|
||||||
|
|||||||
@ -1,36 +0,0 @@
|
|||||||
-- 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,
|
|
||||||
}
|
|
||||||
]]
|
|
||||||
Reference in New Issue
Block a user