diff --git a/DataBase.lua b/DataBase.lua
index 16d4a63..36b57d7 100644
--- a/DataBase.lua
+++ b/DataBase.lua
@@ -7,12 +7,13 @@
----------------------------
DB = { }
-DB.version=0.02
+DB.version=0.03
DB.dataDefault = {
data = {}
}
+DB.UI_Movable=false
local ShowInfo = true
local startupTS = GetGameTimeMilliseconds()
@@ -51,6 +52,9 @@ function DB.OnLoad(eventCode, addOnName)
db_UI.TB = WINDOW_MANAGER:CreateControl("DBUI_TB",DBUI,CT_TEXTBUFFER)
db_UI.Slider = WINDOW_MANAGER:CreateControl("DBUI_Slider",DBUI_TB,CT_SLIDER)
db_UI.Tooltip = WINDOW_MANAGER:CreateControl("DBUI_Tooltip",DBUI,CT_TOOLTIP)
+ db_UI.Button_Guild = WINDOW_MANAGER:CreateControl("DBUI_BtG",DBUI,CT_BUTTON)
+ db_UI.Button_Player = WINDOW_MANAGER:CreateControl("DBUI_BtP",DBUI,CT_BUTTON)
+ db_UI.Button_MoveOff = WINDOW_MANAGER:CreateControl("DBUI_MO",DBUI,CT_BUTTON)
--Обработчики событий
--Прокрутка слайдера и буфера колёсиком
@@ -60,17 +64,41 @@ function DB.OnLoad(eventCode, addOnName)
db_UI.Slider:SetValue(db_UI.Slider:GetValue()- delta)
end)
- --Прокрутка буфера ползунком слайдера
- db_UI.Slider:SetHandler("OnValueChanged",
- function(self, val, eventReason)
- db_UI.TB:SetScrollPosition(#DB.items.data-val)
- end)
+ -- Клик по гильдии
+ db_UI.Button_Guild:SetHandler( "OnClicked" , function(self)
+ db_UI.TB:Clear()
+ DB.DisplayGuildBank()
+ end )
+
+ -- Клик по игроку
+ db_UI.Button_Player:SetHandler( "OnClicked" , function(self)
+ db_UI.TB:Clear()
+ DB.DisplayPlayerBank()
+ end )
+
+ -- Клик по M
+ db_UI.Button_MoveOff:SetHandler( "OnClicked" , function(self)
+ if DB.UI_Movable then
+ db_UI:SetMovable(true)
+ DB.UI_Movable=false
+ else
+ db_UI:SetMovable(false)
+ DB.UI_Movable=true
+ end
+ end )
--Общие настройки интерфейса
db_UI:SetAnchor(TOPLEFT,GuiRoot,TOPLEFT,10,10)
db_UI:SetDimensions(300,245)
db_UI:SetMouseEnabled(true)
- db_UI:SetMovable(true)
+
+ if DB.UI_Movable then
+ db_UI:SetMovable(true)
+ DB.UI_Movable=false
+ else
+ db_UI:SetMovable(false)
+ DB.UI_Movable=true
+ end
--Фон
db_UI.BG:SetDimensions(300,245)
@@ -83,13 +111,12 @@ function DB.OnLoad(eventCode, addOnName)
--Заголовок
db_UI.Title:SetFont("ZoFontGame" )
db_UI.Title:SetColor(255,255,255,1.5)
- db_UI.Title:SetText( "GuildBank Storage: " )
- db_UI.Title:SetAnchor(TOPLEFT,DBUI,TOPLEFT,10,0)
+ db_UI.Title:SetText( "|cff8000Bank Storage|" )
+ db_UI.Title:SetAnchor(TOP,DBUI,TOP,0,0)
--Выводим число вещей в инвентаре:
db_UI.Items:SetFont("ZoFontGame" )
db_UI.Items:SetColor(255,255,255,1.5)
- db_UI.Items:SetText("ItemsTotal: "..#DB.items.data)
db_UI.Items:SetAnchor(TOPLEFT,DBUI,TOPLEFT,10,20)
--Текстовый буфер
@@ -97,7 +124,6 @@ function DB.OnLoad(eventCode, addOnName)
db_UI.TB:SetFont( "ZoFontGame" )
db_UI.TB:SetAnchor(BOTTOM,DBUI,BOTTOM,0,-5)
db_UI.TB:SetLinkEnabled(true)
- db_UI.TB:SetMaxHistoryLines(#DB.items.data)
--Подсказка
-- db_UI.Tooltip:SetDimensions(425,345)
@@ -108,42 +134,109 @@ function DB.OnLoad(eventCode, addOnName)
-- /script db_UI.Slider:SetBackgroundBottomTexture("", 8, 1, 1)
local tex = "/esoui/art/miscellaneous/scrollbox_elevator.dds"
- db_UI.Slider:SetMinMax(1,#DB.items.data)
db_UI.Slider:SetWidth(22)
db_UI.Slider:SetOrientation(ORIENTATION_VERTICAL)
db_UI.Slider:SetThumbTexture(tex, tex, tex, 22, 100, 0, 0, 1, 1)
- db_UI.Slider:SetAnchor(BOTTOM,db_UI,BOTTOMRIGHT,-10,0)
+ db_UI.Slider:SetAnchor(BOTTOMRIGHT,db_UI,BOTTOMRIGHT,0,0)
db_UI.Slider:SetMouseEnabled(true)
db_UI.Slider:SetHeight(245)
- db_UI.Slider:SetValue(#DB.items.data)
db_UI.Slider:SetValueStep(1)
+ -- Кнопка "Гильдия"
+ db_UI.Button_Guild:SetText("[Guild]")
+ db_UI.Button_Guild:SetAnchor(TOP,DBUI,TOPRIGHT,-150,20)
+ db_UI.Button_Guild:SetDimensions(70,25)
+ db_UI.Button_Guild:SetFont("ZoFontGameBold")
+ db_UI.Button_Guild:SetNormalFontColor(0,255,255,.7)
+ db_UI.Button_Guild:SetMouseOverFontColor(0.8,0.4,0,1)
+
+ -- Кнопка "Игрок"
+ db_UI.Button_Player:SetText("[Player]")
+ db_UI.Button_Player:SetAnchor(TOP,DBUI,TOPRIGHT,-90,20)
+ db_UI.Button_Player:SetDimensions(70,25)
+ db_UI.Button_Player:SetFont("ZoFontGameBold")
+ db_UI.Button_Player:SetNormalFontColor(0,255,255,.7)
+ db_UI.Button_Player:SetMouseOverFontColor(0.8,0.4,0,1)
+
+ -- Кнопка "M"
+ db_UI.Button_MoveOff:SetText("[M]")
+ db_UI.Button_MoveOff:SetAnchor(TOP,DBUI,TOPRIGHT,-40,20)
+ db_UI.Button_MoveOff:SetDimensions(40,25)
+ db_UI.Button_MoveOff:SetFont("ZoFontGameBold")
+ db_UI.Button_MoveOff:SetNormalFontColor(0,255,255,.7)
+ db_UI.Button_MoveOff:SetMouseOverFontColor(0.8,0.4,0,1)
+
+
--Отображение
db_UI.Items.Item={}
db_UI.Items.Item.name ={}
db_UI.Items.Item.count ={}
- if (#DB.items.data==0) then return end
- for i=1, #DB.items.data, 1 do
+ function DB.DisplayGuildBank()
+ if (#DB.items.data==0) then return end
+
+ --Обновляем изменяемые значения
+ db_UI.Items:SetText("ItemsTotal: "..#DB.items.data)
+ db_UI.Slider:SetMinMax(1,#DB.items.data)
+ db_UI.Slider:SetValue(#DB.items.data)
+ db_UI.TB:SetMaxHistoryLines(#DB.items.data)
+ db_UI.TB:SetScrollPosition(0)
+
+ --Прокрутка буфера ползунком слайдера
+ db_UI.Slider:SetHandler("OnValueChanged",
+ function(self, val, eventReason)
+ db_UI.TB:SetScrollPosition(#DB.items.data-val)
+ end)
+
+ for i=1, #DB.items.data, 1 do
+ db_UI.TB:AddMessage(i.."|| "..DB.items.data[i].count.." || "..DB.items.data[i].name)
+
+ -- --Название
+ -- db_UI.Items.Item.name[i] = WINDOW_MANAGER:CreateControl("DBUI_Item_name_"..i,DBUI,CT_LABEL)
+ -- db_UI.Items.Item.name[i]:SetFont("ZoFontGame" )
+ -- db_UI.Items.Item.name[i]:SetColor(255,255,255,1.5)
+ -- db_UI.Items.Item.name[i]:SetText(DB.items.data[i].name)
+ -- db_UI.Items.Item.name[i]:SetAnchor(TOPLEFT,DBUI,TOPLEFT,20,20+i*20)
+
+ -- --Количество
+ -- db_UI.Items.Item.name[i] = WINDOW_MANAGER:CreateControl("DBUI_Item_count_"..i,DBUI,CT_LABEL)
+ -- db_UI.Items.Item.name[i]:SetFont("ZoFontGame" )
+ -- db_UI.Items.Item.name[i]:SetColor(255,255,255,1.5)
+ -- db_UI.Items.Item.name[i]:SetText(DB.items.data[i].count)
+ -- db_UI.Items.Item.name[i]:SetAnchor(TOPLEFT,DBUI,TOPLEFT,300,20+i*20)
+
+ end
+ end
- db_UI.TB:AddMessage(i.."|| "..DB.items.data[i].count.." || "..DB.items.data[i].name)
- -- --Название
- -- db_UI.Items.Item.name[i] = WINDOW_MANAGER:CreateControl("DBUI_Item_name_"..i,DBUI,CT_LABEL)
- -- db_UI.Items.Item.name[i]:SetFont("ZoFontGame" )
- -- db_UI.Items.Item.name[i]:SetColor(255,255,255,1.5)
- -- db_UI.Items.Item.name[i]:SetText(DB.items.data[i].name)
- -- db_UI.Items.Item.name[i]:SetAnchor(TOPLEFT,DBUI,TOPLEFT,20,20+i*20)
+ function DB.DisplayPlayerBank()
+ DB.ItemCounter=0
+ local RealItemNumber=1
+ bagIcon, bagSlots=GetBagInfo(BAG_BANK)
- -- --Количество
- -- db_UI.Items.Item.name[i] = WINDOW_MANAGER:CreateControl("DBUI_Item_count_"..i,DBUI,CT_LABEL)
- -- db_UI.Items.Item.name[i]:SetFont("ZoFontGame" )
- -- db_UI.Items.Item.name[i]:SetColor(255,255,255,1.5)
- -- db_UI.Items.Item.name[i]:SetText(DB.items.data[i].count)
- -- db_UI.Items.Item.name[i]:SetAnchor(TOPLEFT,DBUI,TOPLEFT,300,20+i*20)
+ while (DB.ItemCounter < bagSlots) do
+ if GetItemName(BAG_BANK,DB.ItemCounter)~="" then
+ db_UI.TB:AddMessage(RealItemNumber.." : "..GetItemLink(BAG_BANK,DB.ItemCounter).." : "..GetSlotStackSize(BAG_BANK,DB.ItemCounter))
+ RealItemNumber=RealItemNumber+1
+ end
+ DB.ItemCounter=DB.ItemCounter+1
+ end
+ --Обновляем изменяемые значения
+ db_UI.Items:SetText("ItemsTotal: "..RealItemNumber-1)
+ db_UI.Slider:SetMinMax(1,RealItemNumber-1)
+ db_UI.Slider:SetValue(RealItemNumber-1)
+ db_UI.TB:SetMaxHistoryLines(RealItemNumber-1)
+ db_UI.TB:SetScrollPosition(0)
+
+ --Прокрутка буфера ползунком слайдера
+ db_UI.Slider:SetHandler("OnValueChanged",
+ function(self, val, eventReason)
+ db_UI.TB:SetScrollPosition((RealItemNumber-1)-val)
+ end)
end
+ DB.DisplayGuildBank()
end
@@ -209,16 +302,15 @@ function DB.icount()
d("BagSpaceOccupied: "..(bagSlots-bagSpace))
d("slot:name:count")
- -- что-то тут не так...
- while (ItemCounter < bagSlots) do
- if GetItemName(BAG_BACKPACK,ItemCounter)~="" then
- d(ItemCounter.." : "..GetItemName(BAG_BACKPACK,ItemCounter).." : "..GetItemTotalCount(BAG_BACKPACK,ItemCounter))
+ while (DB.ItemCounter < bagSlots) do
+ if GetItemName(BAG_BACKPACK,DB.ItemCounter)~="" then
+ d(DB.ItemCounter.." : "..GetItemName(BAG_BACKPACK,DB.ItemCounter).." : "..GetItemTotalCount(BAG_BACKPACK,DB.ItemCounter))
end
- ItemCounter=ItemCounter+1
+ DB.ItemCounter=DB.ItemCounter+1
end
d("---------------------")
d("Items total: "..(bagSlots-bagSpace))
- d("Slots counted: "..ItemCounter)
+ d("Slots counted: "..DB.ItemCounter)
end
function DB.bcount()