diff --git a/MobileBank.lua b/MobileBank.lua
index 356a3d9..a8b7ff5 100644
--- a/MobileBank.lua
+++ b/MobileBank.lua
@@ -1,23 +1,29 @@
--- MobileBank v0.26
+-- MobileBank v0.30
----------------------------
-- Список команд:
-- /mb cls - очистить собраные данные
+-- /mb hide/show - скрыть/показать главную панель
+-- /mb p - Показать банк игрока
+-- /mb g - Показать банки гильдий
----------------------------
-MB = { }
+MB = {}
-MB.version=0.26
+MB.version=0.30
MB.dataDefaultItems = {
- data = {}
+ Guilds={}
}
for i=1,GetNumGuilds() do
- MB.dataDefaultItems.data[i]={
- [GetGuildName(i)]={}
- }
+ MB.dataDefaultItems.Guilds[i]=
+ {
+ [GetGuildName(i)]={
+
+ }
+ }
end
MB.dataDefaultParams = {
@@ -51,16 +57,15 @@ function MB.OnLoad(eventCode, addOnName)
--Регистрация эвентов
EVENT_MANAGER:RegisterForEvent("MobileBank", EVENT_OPEN_BANK, MB.PL_Opened)
EVENT_MANAGER:RegisterForEvent("MobileBank", EVENT_CLOSE_BANK, MB.PL_Closed)
- -- EVENT_MANAGER:RegisterForEvent("MobileBank", EVENT_GUILD_BANK_SELECTED, MB.GB_Selected)
EVENT_MANAGER:RegisterForEvent("MobileBank", EVENT_OPEN_GUILD_BANK, MB.GB_Opened)
EVENT_MANAGER:RegisterForEvent("MobileBank", EVENT_GUILD_BANK_ITEMS_READY, MB.GB_Ready)
--Загрузка сохраненных переменных
- MB.items= ZO_SavedVars:NewAccountWide( "MB_SavedVars" , 2, "items" , MB.dataDefaultItems, nil )
- MB.params= ZO_SavedVars:New( "MB_SavedVars" , 2, "params" , MB.dataDefaultParams, nil )
+ MB.items= ZO_SavedVars:NewAccountWide( "MB_SavedVars" , 2, "Items" , MB.dataDefaultItems, nil )
+ MB.params= ZO_SavedVars:New( "MB_SavedVars" , 2, "Params" , MB.dataDefaultParams, nil )
--Инициализация графического интерфейся
- MB_UI = WINDOW_MANAGER:CreateTopLevelWindow("MBUI")
+ MB_UI = WINDOW_MANAGER:GetControlByName("MBUI")
-- Создаем меню
MB.CreateMenu()
@@ -78,12 +83,12 @@ function MB.CreateMenu()
MB_UI.Menu.Button={}
MB_UI.Menu.Button.Guild = WINDOW_MANAGER:CreateControl("MBUI_Menu_Button_Guild",MBUI_Menu,CT_BUTTON)
MB_UI.Menu.Button.Player = WINDOW_MANAGER:CreateControl("MBUI_Menu_Button_Player",MBUI_Menu,CT_BUTTON)
- MB_UI.Menu.Button.Move = WINDOW_MANAGER:CreateControl("MBUI_Menu_Button_Move",MBUI_Menu,CT_BUTTON)
+ -- MB_UI.Menu.Button.Move = WINDOW_MANAGER:CreateControl("MBUI_Menu_Button_Move",MBUI_Menu,CT_BUTTON)
--Обработчики событий
-- Клик по гильдии
- MB_UI.Menu.Button.Guild:SetHandler( "OnClicked" , function(self)
+ MB_UI.Menu.Button.Guild:SetHandler("OnClicked" , function(self)
local bool = not(MBUI_Container:IsHidden())
MB.PreviousButtonClicked=MB.LastButtonClicked
MB.LastButtonClicked="Guild"
@@ -112,51 +117,31 @@ function MB.CreateMenu()
MB.HideContainer(bool)
end )
- -- Клик по M
- MB_UI.Menu.Button.Move:SetHandler( "OnClicked" , function(self)
- if MB.UI_Movable then
- MB_UI.Menu:SetMovable(true)
- MBUI_Container:SetMovable(true)
- MB.UI_Movable=false
- else
- MB_UI.Menu:SetMovable(false)
- MBUI_Container:SetMovable(false)
- MB.UI_Movable=true
- end
- end )
MBUI_Menu:SetHandler("OnMouseUp" , function(self) MB.MouseUp(self) end)
MBUI_Container:SetHandler("OnMouseUp" , function(self) MB.MouseUp(self) end)
--Настройки меню
MB_UI.Menu:SetAnchor(TOPLEFT,MBUI,TOPLEFT,MB.params.MBUI_Menu[1],MB.params.MBUI_Menu[2])
- MB_UI.Menu:SetDimensions(200,50)
+ MB_UI.Menu:SetDimensions(130,45)
MB_UI.Menu:SetMouseEnabled(true)
-
- if MB.UI_Movable then
- MB_UI:SetMovable(true)
- MB.UI_Movable=false
- else
- MB_UI:SetMovable(false)
- MB.UI_Movable=true
- end
+ MB_UI.Menu:SetMovable(true)
--Фон
- MB_UI.Menu.BG:SetAnchor(BOTTOM,MBUI_Menu,BOTTOM,0,0)
- MB_UI.Menu.BG:SetDimensions(200,50)
+ MB_UI.Menu.BG:SetAnchor(CENTER,MBUI_Menu,CENTER,0,0)
+ MB_UI.Menu.BG:SetDimensions(130,40)
MB_UI.Menu.BG:SetCenterColor(0,0,0,1)
- MB_UI.Menu.BG:SetEdgeColor(0,0,0,1)
- MB_UI.Menu.BG:SetEdgeTexture("", 8, 1, 1)
+ MB_UI.Menu.BG:SetEdgeColor(0,0,0,0)
MB_UI.Menu.BG:SetAlpha(0.5)
--Заголовок
- MB_UI.Menu.Title:SetAnchor(TOP,MBUI_Menu,TOP,0,0)
+ MB_UI.Menu.Title:SetAnchor(CENTER,MBUI_Menu,TOP,0,13)
MB_UI.Menu.Title:SetFont("ZoFontGame" )
MB_UI.Menu.Title:SetColor(255,255,255,1.5)
- MB_UI.Menu.Title:SetText( "|cff8000Bank Storage|" )
+ MB_UI.Menu.Title:SetText( "|cff8000Mobile Bank|" )
-- Кнопка "Гильдия"
- MB_UI.Menu.Button.Guild:SetAnchor(TOP,MBUI_Menu,TOPRIGHT,-150,20)
+ MB_UI.Menu.Button.Guild:SetAnchor(BOTTOM,MBUI_Menu,BOTTOM,-30,0)
MB_UI.Menu.Button.Guild:SetText("[Guild]")
MB_UI.Menu.Button.Guild:SetDimensions(70,25)
MB_UI.Menu.Button.Guild:SetFont("ZoFontGameBold")
@@ -164,65 +149,31 @@ function MB.CreateMenu()
MB_UI.Menu.Button.Guild:SetMouseOverFontColor(0.8,0.4,0,1)
-- Кнопка "Игрок"
- MB_UI.Menu.Button.Player:SetAnchor(TOP,MBUI_Menu,TOPRIGHT,-90,20)
+ MB_UI.Menu.Button.Player:SetAnchor(BOTTOM,MBUI_Menu,BOTTOM,30,0)
MB_UI.Menu.Button.Player:SetText("[Player]")
MB_UI.Menu.Button.Player:SetDimensions(70,25)
MB_UI.Menu.Button.Player:SetFont("ZoFontGameBold")
MB_UI.Menu.Button.Player:SetNormalFontColor(0,255,255,.7)
MB_UI.Menu.Button.Player:SetMouseOverFontColor(0.8,0.4,0,1)
-
- -- Кнопка "M"
- MB_UI.Menu.Button.Move:SetAnchor(TOP,MBUI_Menu,TOPRIGHT,-40,20)
- MB_UI.Menu.Button.Move:SetText("[M]")
- MB_UI.Menu.Button.Move:SetDimensions(40,25)
- MB_UI.Menu.Button.Move:SetFont("ZoFontGameBold")
- MB_UI.Menu.Button.Move:SetNormalFontColor(0,255,255,.7)
- MB_UI.Menu.Button.Move:SetMouseOverFontColor(0.8,0.4,0,1)
end
function MB.CreateBank()
local OldAnchor=false
- --Настройки контейнера
- MBUI_Container:SetParent(MBUI)
+ -- Настройки контейнера
MBUI_Container:SetAnchor(TOPLEFT,GuiRoot,TOPLEFT,MB.params.MBUI_Container[1],MB.params.MBUI_Container[2])
- MBUI_Container:SetDimensions(560,720)
- MBUI_Container:SetMouseEnabled(true)
- MBUI_Container:SetHidden(true)
-
- -- Фон
- MBUI_ContainerBg:SetAnchor(TOPLEFT,MBUI_Container,TOPLEFT,10,0)
- MBUI_ContainerBg:SetCenterColor(0,0,0,0.5)
- MBUI_ContainerBg:SetEdgeColor(0,0,0,0.5)
- MBUI_ContainerBg:SetDimensions(MBUI_Container:GetDimensions())
-
- -- + Правим Заглавие
- MBUI_ContainerTitle:SetAnchor(TOP,MBUI_Container,TOP,0,15)
- MBUI_ContainerTitle:SetFont("ZoFontGame")
- MBUI_ContainerTitle:SetText( "|cff8000Offline Bank Storage|" )
- MBUI_ContainerTitle:SetHeight(150)
-
- -- Правим Заголовки
- MBUI_ContainerTitleName:SetAnchor(TOP,MBUI_ContainerTitle,LEFT,-100,-15)
- MBUI_ContainerTitleStat:SetAnchor(TOP,MBUI_ContainerTitle,CENTER,130,-15)
- MBUI_ContainerTitleValue:SetAnchor(TOP,MBUI_ContainerTitle,RIGHT,155,-15)
-
- -- Правим Содержание банка
- MBUI_ContainerItemCounter:SetAnchor(CENTER,MBUI_Container,BOTTOM,0,-17)
-
- -- + Правим Слайдер
- MBUI_ContainerSlider:SetAnchor(BOTTOM,MBUI_Container,BOTTOMRIGHT,0,-50)
+ MBUI_Container:SetMovable(true)
+
+ -- Правим Слайдер
MBUI_ContainerSlider:SetValue(11)
- MBUI_ContainerSlider:SetWidth(ZO_PlayerBankBackpackScrollBar:GetWidth())
- MBUI_ContainerSlider:SetHeight(565)
- MBUI_ContainerSlider:SetAllowDraggingFromThumb(true)
+
-- Создаем кнопки для переключения между гильдбанками
local nextXstep=0
- for i=1,#MB.items.data do
+ for i=1,#MB.items.Guilds do
- -- Сохраняем названия гильдий из Ключей(да, да...)
- for k, v in pairs(MB.items.data[i]) do
+ -- Сохраняем названия гильдий из Ключей
+ for k, v in pairs(MB.items.Guilds[i]) do
MB.GuildNames[#MB.GuildNames+1] = k
end
@@ -230,8 +181,8 @@ function MB.CreateBank()
WINDOW_MANAGER:CreateControl("MBUI_ContainerTitleGuildButton"..i,MBUI_ContainerTitle,CT_BUTTON)
_G["MBUI_ContainerTitleGuildButton"..i]:SetParent(MBUI_ContainerTitleGuildButtons)
_G["MBUI_ContainerTitleGuildButton"..i]:SetFont("ZoFontGame" )
- nextXstep=(MBUI_Container:GetWidth()/#MB.items.data*i)
- _G["MBUI_ContainerTitleGuildButton"..i]:SetDimensions(MBUI_Container:GetWidth()/#MB.items.data,20)
+ nextXstep=(MBUI_Container:GetWidth()/#MB.items.Guilds*i)
+ _G["MBUI_ContainerTitleGuildButton"..i]:SetDimensions(MBUI_Container:GetWidth()/#MB.items.Guilds,20)
-- Делаем поправку на ширину самой кнопки
_G["MBUI_ContainerTitleGuildButton"..i]:SetAnchor(TOP,MBUI_Container,TOPLEFT,nextXstep-_G["MBUI_ContainerTitleGuildButton"..i]:GetWidth()/2,40)
_G["MBUI_ContainerTitleGuildButton"..i]:SetText("["..guildname.."]")
@@ -247,57 +198,19 @@ function MB.CreateBank()
end
- -- Создаем строки
+ -- Правим строки (созданы из xml)
for i = 1, 11 do
local dynamicControl = CreateControlFromVirtual("MBUI_Row", MBUI_Container, "TemplateRow",i)
- -- _G[] - позволяет подставлять динамические имена переменных
-- Строка
local fromtop=100
- _G["MBUI_Row"..i]:ClearAnchors()
_G["MBUI_Row"..i]:SetAnchor(TOP,MBUI_Container,TOP,0,fromtop+52*(i-1))
- _G["MBUI_Row"..i]:SetDimensions (530,52)
-
- -- Фон
- _G["MBUI_Row"..i.."Bg"]:SetColor(1,1,1,1)
- --На самом деле это хак ('notexture'). Не могу найти нормальную текстуру
- _G["MBUI_Row"..i.."Bg"]:SetTexture('notexture')
- _G["MBUI_Row"..i.."Bg"]:SetDimensions (549,59)
- _G["MBUI_Row"..i.."Bg"]:GetTextureFileDimensions(512,64)
-
- -- Кнопка
- OldAnchor=_G["MBUI_Row"..i.."Button"]:GetParent()
-
- --Иконка
- OldAnchor=_G["MBUI_Row"..i.."ButtonIcon"]:GetParent()
- -- Это не ошибки. Привязки ниже идут к другому якорю.
- _G["MBUI_Row"..i.."ButtonIcon"]:ClearAnchors()
- _G["MBUI_Row"..i.."ButtonIcon"]:SetAnchor(TOPLEFT,OldAnchor,TOPLEFT,0,0)
- _G["MBUI_Row"..i.."ButtonIcon"]:SetColor(1,1,1,1)
- _G["MBUI_Row"..i.."ButtonIcon"]:SetDimensions (40,40)
- _G["MBUI_Row"..i.."ButtonIcon"]:GetTextureFileDimensions(64,64)
-
- --Количество
- _G["MBUI_Row"..i.."ButtonStackCount"]:ClearAnchors()
- _G["MBUI_Row"..i.."ButtonStackCount"]:SetAnchor(TOPLEFT,OldAnchor,TOPLEFT,20,20)
- _G["MBUI_Row"..i.."ButtonStackCount"]:SetDimensions (38,35)
-
- -- Наименование
- _G["MBUI_Row"..i.."Name"]:ClearAnchors()
- _G["MBUI_Row"..i.."Name"]:SetAnchor(CENTERLEFT,OldAnchor,CENTERLEFT,50,15)
-
-
- -- Отображение статов
- _G["MBUI_Row"..i.."StatValue"]:ClearAnchors()
- _G["MBUI_Row"..i.."StatValue"]:SetAnchor(CENTERLEFT,OldAnchor,CENTERLEFT,380,15)
-
- -- Цена
- _G["MBUI_Row"..i.."SellPrice"]:ClearAnchors()
- _G["MBUI_Row"..i.."SellPrice"]:SetAnchor(CENTERLEFT,OldAnchor,CENTERLEFT,480,15)
-
- _G["MBUI_Row"..i.."Highlight"]:SetEdgeTexture("", 8, 1, 1)
- _G["MBUI_Row"..i.."Highlight"]:SetCenterColor(0,0,0,0)
- _G["MBUI_Row"..i.."Highlight"]:SetEdgeColor(0,0,0,0.5)
+ -- _G["MBUI_Row"..i]:SetDimensions (530,52)
+
+ -- Анимация
+ _G["MBUI_Row"..i.."IconTimeline"]=ANIMATION_MANAGER:CreateTimelineFromVirtual("MBUI_IconAnimation",_G["MBUI_Row"..i.."ButtonIcon"])
+ -- _G["MBUI_Row"..i.."CountTimeline"]=ANIMATION_MANAGER:CreateTimelineFromVirtual("MBUI_IconAnimation",_G["MBUI_Row"..i.."ButtonStackCount"])
+
end
end
@@ -315,27 +228,25 @@ function MB.PrepareBankValues(PrepareType,GuildBankIdToPrepare)
if GetItemName(BAG_BANK,MB.ItemCounter)~="" then
--Избавляемся от мусора при сохранении
- local clearlink=string.gsub(GetItemLink(BAG_BANK,MB.ItemCounter), "(^p)", "")
- clearlink=string.gsub(clearlink, "(^n)", "")
+ local name = zo_strformat(SI_TOOLTIP_ITEM_NAME, GetItemName(BAG_BANK, MB.ItemCounter))
+ local link = GetItemLink(BAG_BANK,MB.ItemCounter)
+ clearlink =string.gsub(link, "|h.+|h", "|h"..tostring(name).."|h")
- local start,finish=string.find(clearlink,'|h.+|h')
- local nameClear=string.sub(clearlink,start+2,finish-2)
- local count = GetSlotStackSize(BAG_BANK,MB.ItemCounter)
- local statvalue = GetItemStatValue(BAG_BANK,MB.ItemCounter)
- local quality = GetItemInfo(BAG_BANK,MB.ItemCounter)
-
- local icon,sellPrice,meetsUsageRequirement,equipType,itemStyle = GetItemLinkInfo(clearlink)
- iconFile=icon
+ local stackCount = GetSlotStackSize(BAG_BANK,MB.ItemCounter)
+ local statValue = GetItemStatValue(BAG_BANK,MB.ItemCounter)
+ local icon, stack, sellPrice, meetsUsageRequirement, locked, equipType, itemStyle, quality = GetItemInfo(BAG_BANK,MB.ItemCounter)
+ local ItemType=GetItemType(BAG_BANK,MB.ItemCounter)
MB.BankValueTable[#MB.BankValueTable+1]={
["link"]=tostring(clearlink),
- ["icon"] = tostring(iconFile),
- ["name"]=tostring(nameClear),
- ["count"]=tostring(count),
- ["statvalue"]=tostring(statvalue),
- ["sellPrice"] = tostring(sellPrice),
- ["quality"] = tostring(quality)
-
+ ["icon"] = tostring(icon),
+ ["name"]=tostring(name),
+ ["stackCount"]=stackCount,
+ ["StatValue"]=statValue,
+ ["sellPrice"] = sellPrice,
+ ["quality"] = quality,
+ ["meetsUsageRequirement"]=meetsUsageRequirement,
+ ["ItemType"]=ItemType
}
end
MB.ItemCounter=MB.ItemCounter+1
@@ -347,7 +258,8 @@ function MB.PrepareBankValues(PrepareType,GuildBankIdToPrepare)
debug("Preparing Guild values")
local guildname=tostring(GetGuildName(GuildBankIdToPrepare))
- MB.BankValueTable=MB.items.data[GuildBankIdToPrepare][guildname]
+ MB.BankValueTable=MB.items.Guilds[GuildBankIdToPrepare][guildname]
+
MBUI_ContainerTitleGuildButtons:SetHidden(false)
else
debug("Unknown prepare type: "..tostring(PrepareType))
@@ -358,7 +270,7 @@ function MB.PrepareBankValues(PrepareType,GuildBankIdToPrepare)
end)
for i=1,11 do
- _G["MBUI_Row"..i]:SetHandler("OnMouseWheel" , function(self, delta)
+ _G["MBUI_Row"..i]:SetHandler("OnMouseWheel" , function(self,delta)
local calculatedvalue=MB.CurrentLastValue-delta
if (calculatedvalue>=11) and (calculatedvalue<=#MB.BankValueTable) then
MB.FillBank(calculatedvalue)
@@ -384,6 +296,7 @@ function MB.FillBank(last)
if (#MB.BankValueTable==0) then
d("No data avaliable. Open your bank first.")
MBUI_ContainerItemCounter:SetHidden(true)
+ MBUI_ContainerSlider:SetHidden(true)
MB.HideContainer(true)
for i=1,11 do
_G["MBUI_Row"..i]:SetHidden(true)
@@ -391,6 +304,7 @@ function MB.FillBank(last)
return
else
local texture='/esoui/art/miscellaneous/scrollbox_elevator.dds'
+ MBUI_ContainerSlider:SetHidden(false)
MBUI_ContainerSlider:SetMinMax(11,#MB.BankValueTable)
MBUI_ContainerSlider:SetThumbTexture(texture, texture, texture, 18, (1/#MB.BankValueTable*25000)/3, 0, 0, 1, 1)
for i=1,11 do
@@ -406,6 +320,9 @@ function MB.FillBank(last)
for i=1,#MB.BankValueTable do
local icon,sellPrice,meetsUsageRequirement,equipType,itemStyle = GetItemLinkInfo(MB.BankValueTable[i].link)
+ _G["MBUI_Row"..i].id=i
+ _G["MBUI_Row"..i].ItemType=MB.BankValueTable[i].ItemType
+
-- Регистрируем отображение тултипов при наведении на строку
_G["MBUI_Row"..i]:SetHandler("OnMouseEnter", function(self)
@@ -417,8 +334,8 @@ function MB.FillBank(last)
ItemTooltip:SetLink(_G["MBUI_Row"..i.."Name"]:GetText())
ItemTooltip:SetAlpha(1)
ItemTooltip:SetHidden(false)
- _G["MBUI_Row"..i.."Highlight"]:SetCenterColor(0.5,0.5,0.5,0.5)
_G["MBUI_Row"..i.."Highlight"]:SetDimensions(GetDimensions(_G["MBUI_Row"..i]))
+
end)
@@ -427,19 +344,30 @@ function MB.FillBank(last)
ItemTooltip:ClearLines()
ItemTooltip:SetAlpha(0)
ItemTooltip:SetHidden(true)
- _G["MBUI_Row"..i.."Highlight"]:SetCenterColor(0.5,0.5,0.5,0)
end)
_G["MBUI_Row"..i.."ButtonIcon"]:SetTexture(MB.BankValueTable[i].icon)
- _G["MBUI_Row"..i.."ButtonStackCount"]:SetText(MB.BankValueTable[i].count)
+
+ if not MB.BankValueTable[i].meetsUsageRequirement then
+ _G["MBUI_Row"..i.."ButtonIcon"]:SetColor(1,0,0,1)
+ else
+ _G["MBUI_Row"..i.."ButtonIcon"]:SetColor(1,1,1,1)
+ end
+
+ _G["MBUI_Row"..i.."ButtonStackCount"]:SetText(MB.BankValueTable[i].stackCount)
_G["MBUI_Row"..i.."Name"]:SetText(MB.BankValueTable[i].link)
- if (MB.BankValueTable[i].statvalue~="0") then
- _G["MBUI_Row"..i.."StatValue"]:SetText(MB.BankValueTable[i].statvalue)
+ if (MB.BankValueTable[i].statValue~=0) then
+ _G["MBUI_Row"..i.."StatValue"]:SetText(MB.BankValueTable[i].statValue)
else
_G["MBUI_Row"..i.."StatValue"]:SetText("-")
end
- _G["MBUI_Row"..i.."SellPrice"]:SetText(MB.BankValueTable[i].count*sellPrice.."|t24:24:EsoUI/Art/currency/currency_gold.dds|t")
+ _G["MBUI_Row"..i.."SellPrice"]:SetText(MB.BankValueTable[i].stackCount*sellPrice.."|t24:24:EsoUI/Art/currency/currency_gold.dds|t")
+
+ _G["MBUI_Row"..i]:SetHandler("OnMouseUp", function(self,button)
+ if button~=2 then return end
+ ZO_ChatWindowTextEntryEditBox:SetText(tostring(ZO_ChatWindowTextEntryEditBox:GetText()).."["..MB.BankValueTable[i].link.."]")
+ end)
end
-- Заполняем вместимость банка
local CurBankCapacity = #MB.BankValueTable
@@ -455,6 +383,9 @@ function MB.FillBank(last)
for i=11,1,-1 do
local icon,sellPrice,meetsUsageRequirement,equipType,itemStyle = GetItemLinkInfo(MB.BankValueTable[last].link)
+ _G["MBUI_Row"..i].id=last
+ _G["MBUI_Row"..i].ItemType=MB.BankValueTable[last].ItemType
+
-- Регистрируем отображение тултипов при наведении на строку
_G["MBUI_Row"..i]:SetHandler("OnMouseEnter", function(self)
@@ -462,6 +393,7 @@ function MB.FillBank(last)
OldAnchor=_G["MBUI_Row"..i.."ButtonIcon"]:GetParent()
ItemTooltip:ClearAnchors()
ItemTooltip:ClearLines()
+
if _G["MBUI_Row"..i]:GetLeft()>=480 then
ItemTooltip:SetAnchor(CENTER,OldAnchor,CENTER,-480,0)
else
@@ -469,9 +401,30 @@ function MB.FillBank(last)
end
ItemTooltip:SetLink(_G["MBUI_Row"..i.."Name"]:GetText())
+
+ -- Сравнительный тултип
+ if self.ItemType==ITEMTYPE_WEAPON or self.ItemType==ITEMTYPE_ARMOR then
+ -- Броня в банке
+ ItemTooltip:ClearAnchors()
+ ComparativeTooltip1:ClearAnchors()
+
+ if _G["MBUI_Row"..i]:GetLeft()>=480 then
+ ItemTooltip:SetAnchor(TOP,OldAnchor,CENTER,-480,0)
+ ComparativeTooltip1:SetAnchor(BOTTOM,OldAnchor,CENTER,-480,0)
+ else
+ ItemTooltip:SetAnchor(TOP,OldAnchor,CENTER,500,0)
+ ComparativeTooltip1:SetAnchor(BOTTOM,OldAnchor,CENTER,500,0)
+ end
+ ComparativeTooltip1:SetAlpha(1)
+ ComparativeTooltip1:SetHidden(false)
+ ItemTooltip:ShowComparativeTooltips()
+ end
+
ItemTooltip:SetAlpha(1)
ItemTooltip:SetHidden(false)
- _G["MBUI_Row"..i.."Highlight"]:SetCenterColor(0.5,0.5,0.5,0.5)
+ _G["MBUI_Row"..i.."Highlight"]:SetAlpha(1)
+
+ _G["MBUI_Row"..i.."IconTimeline"]:PlayFromStart()
end)
_G["MBUI_Row"..i]:SetHandler("OnMouseExit", function(self)
@@ -479,19 +432,40 @@ function MB.FillBank(last)
ItemTooltip:ClearLines()
ItemTooltip:SetAlpha(0)
ItemTooltip:SetHidden(true)
- _G["MBUI_Row"..i.."Highlight"]:SetCenterColor(0.5,0.5,0.5,0)
-
+ _G["MBUI_Row"..i.."Highlight"]:SetAlpha(0)
+
+ _G["MBUI_Row"..i.."IconTimeline"]:PlayFromEnd()
+
+ -- Сравнительный тултип
+ if self.ItemType==ITEMTYPE_WEAPON or self.ItemType==ITEMTYPE_ARMOR then
+ ComparativeTooltip1:ClearAnchors()
+ ItemTooltip:HideComparativeTooltips()
+ end
+
end)
_G["MBUI_Row"..i.."ButtonIcon"]:SetTexture(MB.BankValueTable[last].icon)
- _G["MBUI_Row"..i.."ButtonStackCount"]:SetText(MB.BankValueTable[last].count)
+
+ if not MB.BankValueTable[last].meetsUsageRequirement then
+ _G["MBUI_Row"..i.."ButtonIcon"]:SetColor(1,0,0,1)
+ else
+ _G["MBUI_Row"..i.."ButtonIcon"]:SetColor(1,1,1,1)
+ end
+
+ _G["MBUI_Row"..i.."ButtonStackCount"]:SetText(MB.BankValueTable[last].stackCount)
_G["MBUI_Row"..i.."Name"]:SetText(MB.BankValueTable[last].link)
- if (MB.BankValueTable[last].statvalue~="0") then
- _G["MBUI_Row"..i.."StatValue"]:SetText(MB.BankValueTable[last].statvalue)
+ if (MB.BankValueTable[last].statValue~=0) then
+ _G["MBUI_Row"..i.."StatValue"]:SetText(MB.BankValueTable[last].statValue)
else
_G["MBUI_Row"..i.."StatValue"]:SetText("-")
end
- _G["MBUI_Row"..i.."SellPrice"]:SetText(MB.BankValueTable[last].count*sellPrice.."|t24:24:EsoUI/Art/currency/currency_gold.dds|t")
+ _G["MBUI_Row"..i.."SellPrice"]:SetText(MB.BankValueTable[last].stackCount*sellPrice.."|t20:20:EsoUI/Art/currency/currency_gold.dds|t")
+
+ _G["MBUI_Row"..i]:SetHandler("OnMouseUp", function(self,button)
+ if button~=2 then return end
+ ZO_ChatWindowTextEntryEditBox:SetText(tostring(ZO_ChatWindowTextEntryEditBox:GetText()).."["..MB.BankValueTable[self.id].link.."]")
+ end)
+
if last<=#MB.BankValueTable and last>1 then
last=last-1
else
@@ -529,11 +503,35 @@ end
function commandHandler( text )
if text=="cls" then
- MB.items.data={}
+ MB.items.Guilds={}
MB.params.MBUI_Menu=nil
MB.params.MBUI_Container=nil
ReloadUI()
+ elseif text=="hide" then
+ MB.params.hidden=true
+ MBUI_Menu:SetHidden(true)
+ elseif text=="show" then
+ MB.params.hidden=false
+ MBUI_Menu:SetHidden(false)
+ elseif text=="p" then
+ MB.CurrentLastValue=11
+ MB.PrepareBankValues("Player")
+ MB.FillBank(MB.CurrentLastValue)
+ MBUI_Container:SetHidden(false)
+ MB.PreviousButtonClicked=nil
+ MB.LastButtonClicked=nil
+ elseif text=="g" then
+ MB.CurrentLastValue=11
+ MB.PrepareBankValues("Guild",1)
+ MB.FillBank(MB.CurrentLastValue)
+ MBUI_Container:SetHidden(false)
+ MB.PreviousButtonClicked=nil
+ MB.LastButtonClicked=nil
else
+ d("/mb hide - hide main window")
+ d("/mb show - show main window")
+ d("/mb p - show player bank")
+ d("/mb g - show guild bank")
d("/mb cls - clear all data and reloadui ")
end
end
@@ -571,48 +569,74 @@ if (not MB.AddonReady) then return end
elseif (interactHidden == false) then
MBUI_Container:SetHidden(true)
MBUI_Menu:SetHidden(true)
- else
+ elseif (MB.params.hidden==false) then
MBUI_Menu:SetHidden(false)
+ elseif (MB.params.hidden==true) then
+ MBUI_Menu:SetHidden(true)
end
--Хак на проверку инвентаря спустя Х сек после первого срабатывания эвента
if MB.GCountOnUpdateReady and (GetGameTimeMilliseconds()-MB.GCountOnUpdateTimer>=1000) then
+ MB.GCountOnUpdateReady=false
local guildbankid=GetSelectedGuildBankId()
local guildname=tostring(GetGuildName(guildbankid))
- MB.items.data[guildbankid][guildname]={}
+ MB.items.Guilds[guildbankid][guildname]={}
d("Data saved for "..guildname)
local sv=false
bagIcon, bagSlots=GetBagInfo(BAG_GUILDBANK)
- sv = MB.items.data[guildbankid][guildname]
+ sv = MB.items.Guilds[guildbankid][guildname]
for i=1, #ZO_GuildBankBackpack.data do
+ slotIndex=ZO_GuildBankBackpack.data[i].data.slotIndex
+
+ link = GetItemLink(BAG_GUILDBANK,slotIndex)
+ iconFile=ZO_GuildBankBackpack.data[i].data.iconFile
name=ZO_GuildBankBackpack.data[i].data.name
- count=ZO_GuildBankBackpack.data[i].data.stackCount
+ stackCount=ZO_GuildBankBackpack.data[i].data.stackCount
statValue=ZO_GuildBankBackpack.data[i].data.statValue
sellPrice=ZO_GuildBankBackpack.data[i].data.sellPrice
quality=ZO_GuildBankBackpack.data[i].data.quality
- iconFile=ZO_GuildBankBackpack.data[i].data.iconFile
- slotIndex=ZO_GuildBankBackpack.data[i].data.slotIndex
- link = GetItemLink(BAG_GUILDBANK,slotIndex)
- clearlink =string.gsub(link, "(^p)", "")
- clearlink =string.gsub(clearlink, "(^n)", "")
+ age=ZO_GuildBankBackpack.data[i].data.age
+ bagId=ZO_GuildBankBackpack.data[i].data.bagId
+ equipType=ZO_GuildBankBackpack.data[i].data.equipType
+ isJunk=ZO_GuildBankBackpack.data[i].data.isJunk
+ itemInstanceId=ZO_GuildBankBackpack.data[i].data.itemInstanceId
+ locked=ZO_GuildBankBackpack.data[i].data.locked
+ meetsUsageRequirement=ZO_GuildBankBackpack.data[i].data.meetsUsageRequirement
+ slotType=ZO_GuildBankBackpack.data[i].data.slotType
+ searchData=ZO_GuildBankBackpack.data[i].data.searchData
+ filterData=ZO_GuildBankBackpack.data[i].data.filterData
+ ItemType=GetItemType(BAG_GUILDBANK,slotIndex)
+
+
+ clearlink =string.gsub(link, "|h.+|h", "|h"..tostring(name).."|h")
sv[#sv+1] =
{
["link"] = tostring(clearlink),
["icon"] = tostring(iconFile),
["name"] = tostring(name),
- ["count"] = tostring(count),
- ["statvalue"] = tostring(statValue),
- ["sellPrice"] = tostring(sellPrice),
- ["quality"] = tostring(quality)
+ ["stackCount"] = stackCount,
+ ["statValue"] = statValue,
+ ["sellPrice"] = sellPrice,
+ ["quality"] = quality,
+ ["age"]=quality,
+ ["bagId"]=bagId,
+ ["equipType"]=equipType,
+ ["isJunk"]=isJunk,
+ ["itemInstanceId"]=tostring(itemInstanceId),
+ ["locked"]=locked,
+ ["meetsUsageRequirement"]=meetsUsageRequirement,
+ ["slotType"]=slotType,
+ ["searchData"]=searchData,
+ ["filterData"]=filterData,
+ ["ItemType"]=ItemType
+
}
end
- MB.GCountOnUpdateReady=false
end
-
end
function MB.HideContainer(value)
diff --git a/MobileBank.xml b/MobileBank.xml
index a30d4ce..1096a32 100644
--- a/MobileBank.xml
+++ b/MobileBank.xml
@@ -1,84 +1,135 @@
<GuiXml>
+ <Animations>
+ <AnimationTimeline name="MBUI_IconAnimation" >
+ <Animations>
+ <SizeAnimation duration="150" startHeight="40" startWidth="40" endHeight="70" endWidth="70" />
+ </Animations>
+ </AnimationTimeline>
+ </Animations>
+
<Controls>
+ <!-- Формируем пустышку -->
<TopLevelControl name="MBUI_Blank">
<OnUpdate>
MB.Update(self)
</OnUpdate>
</TopLevelControl>
- <!-- Заготовка отображения информации о предмете -->
- <Control name="MBUI_Container" mouseEnabled="true">
- <Controls>
- <!-- Фон -->
- <Backdrop name="$(parent)Bg">
- </Backdrop>
- <!-- Заголовок -->
- <Label name="$(parent)Title" font="ZoFontGame">
- <Controls>
- <Control name="$(parent)GuildButtons" font="ZoFontGame" text="Name">
- </Control>
+ <TopLevelControl name="MBUI">
+ <Controls>
+ <!-- Заготовка отображения информации о предмете -->
+ <Control name="MBUI_Container" mouseEnabled="true" hidden="true">
+ <Dimensions x="560" y="720" />
+ <Controls>
+ <!-- Фон -->
+ <Backdrop name="$(parent)Bg" centerColor="00000000" edgeColor="00000000">
+ <Anchor point="TOPLEFT" relativePoint="TOPLEFT" offsetX="10" offsetY="0"/>
+ <Dimensions x="560" y="720" />
+ </Backdrop>
- <Label name="$(parent)Name" font="ZoFontGame" text="Name">
- </Label>
+ <Texture name="$(parent)Texture" textureFile="EsoUI/Art/Miscellaneous/centerscreen_left.dds" resizeToFitFile="true">
+ <Anchor point="TOPLEFT" relativePoint="TOPLEFT" offsetX="-40" offsetY="-40"/>
+ <Dimensions x="595" y="940" />
+ <!-- <TextureCoords left="0" right="0" top="0" bottom="0" /> -->
+ </Texture>
- <Label name="$(parent)Stat" font="ZoFontGame" text="Stat">
- </Label>
+ <!-- Заголовок -->
+ <Label name="$(parent)Title" font="ZoFontGame" text="|cff8000Mobile Bank Storage|">
+ <Dimensions y="150" />
+ <Anchor point="TOP" relativePoint="TOP" offsetX="0" offsetY="15"/>
+ <Controls>
+ <Button name="$(parent)Close" font="ZoFontGame" text="[X]">
+ <Anchor point="TOPRIGHT" relativeTo="MBUI_Container" relativePoint="TOPRIGHT" offsetX="0" offsetY="0"/>
+ <Dimensions x="30" y="30" />
+ <OnClicked>
+ MBUI_Container:SetHidden(true)
+ MB.PreviousButtonClicked=nil
+ MB.LastButtonClicked=nil
+ </OnClicked>
+ <OnInitialized>
+ self:SetNormalFontColor(0,255,255,.7)
+ self:SetMouseOverFontColor(0.8,0.4,0,1)
+ </OnInitialized>
+ </Button>
- <Label name="$(parent)Value" font="ZoFontGame" text="Value">
- </Label>
- </Controls>
- </Label>
+ <Control name="$(parent)GuildButtons" font="ZoFontGame" text="Name">
+ </Control>
- <!-- Счетчик вещей -->
- <Label name="$(parent)ItemCounter" font="ZoFontGame" color="white">
- </Label>
+ <Label name="$(parent)Name" font="ZoFontGame" text="Name">
+ <Anchor point="TOP" relativePoint="LEFT" offsetX="-100" offsetY="-15"/>
+ </Label>
- <!-- Слайдер -->
- <Slider name="$(parent)Slider" mouseEnabled="true" step="1">
- </Slider>
+ <Label name="$(parent)Stat" font="ZoFontGame" text="Stat">
+ <Anchor point="TOP" relativePoint="CENTER" offsetX="130" offsetY="-15"/>
+ </Label>
- </Controls>
- </Control>
+ <Label name="$(parent)Value" font="ZoFontGame" text="Value">
+ <Anchor point="TOP" relativePoint="RIGHT" offsetX="155" offsetY="-15"/>
+ </Label>
+ </Controls>
+ </Label>
+
+ <!-- Счетчик вещей -->
+ <Label name="$(parent)ItemCounter" font="ZoFontGame" color="white">
+ <Anchor point="CENTER" relativePoint="BOTTOM" offsetX="0" offsetY="-17"/>
+ </Label>
+
+ <!-- Слайдер -->
+ <Slider name="$(parent)Slider" mouseEnabled="true" step="1" dragFromThumb="true">
+ <Anchor point="BOTTOM" relativePoint="BOTTOMRIGHT" offsetX="-10" offsetY="-50"/>
+ <Dimensions x="16" y="565" />
+ </Slider>
+
+ </Controls>
+ </Control>
+ </Controls>
+ </TopLevelControl>
+
+ <!-- Строка -->
<Control name="TemplateRow" virtual="true" mouseEnabled="true">
- <AnchorFill/>
+ <Dimensions x="530" y="52" />
<Controls>
<!-- Фон -->
- <Texture name="$(parent)Bg">
+ <Texture name="$(parent)Bg" color="000000" alpha="0.5">
<AnchorFill/>
+ <Dimensions x="549" y="59" />
</Texture>
<!-- Подсветка -->
- <Backdrop name="$(parent)Highlight">
- <AnchorFill/>
- </Backdrop>
+ <Texture name="$(parent)Highlight" textureFile="EsoUI/Art/Miscellaneous/listItem_highlight.dds" alpha="0">
+ <AnchorFill />
+ <TextureCoords left="0" right="1" top="0" bottom=".625" />
+ </Texture>
<!-- Кнопка -->
<Control name="$(parent)Button">
<AnchorFill/>
<Controls>
<Texture name="$(parent)Icon">
- <AnchorFill/>
+ <Anchor point="CENTER" relativePoint="LEFT" offsetX="20" offsetY="0"/>
+ <Dimensions x="40" y="40" />
</Texture>
- <Label name="$(parent)StackCount" font="ZoFontGame" color="white">
- <AnchorFill/>
+ <Label name="$(parent)StackCount" font="ZoFontGame" horizontalAlignment="RIGHT">
+ <Anchor point="TOPLEFT" relativePoint="TOPLEFT" offsetX="0" offsetY="20"/>
+ <Dimensions x="38" y="35"/>
</Label>
</Controls>
</Control>
<!-- Имя -->
- <Label name="$(parent)Name" font="ZoFontGame" color="white">
- <AnchorFill/>
+ <Label name="$(parent)Name" font="ZoFontGame">
+ <Anchor point="CENTERLEFT" relativePoint="CENTERLEFT" offsetX="50" offsetY="15"/>
</Label>
<!-- Значение -->
- <Label name="$(parent)StatValue" font="ZoFontGame" color="white">
- <AnchorFill/>
+ <Label name="$(parent)StatValue" font="ZoFontGame">
+ <Anchor point="CENTERLEFT" relativePoint="CENTERLEFT" offsetX="380" offsetY="15"/>
</Label>
<!-- Цена -->
- <Label name="$(parent)SellPrice" font="ZoFontGame" color="white">
- <AnchorFill/>
+ <Label name="$(parent)SellPrice" font="ZoFontGame">
+ <Anchor point="CENTERLEFT" relativePoint="CENTERLEFT" offsetX="480" offsetY="15"/>
</Label>
<!-- Подсказка -->