DW={}
Width=500
Height=500
Col=6
--Make the window
DW.Window = Turbine.UI.Lotro.Window()
DW.Window:SetPosition( 100,0 )
DW.Window:SetSize(Width,Height)
DW.Window:SetVisible(false)
DW.Window:SetText( "Debug Window")
DW.Window:SetZOrder(1000)
DW.Frame={}
DW.Frame=Frame()
DW.Frame:SetParent(DW.Window)
DW.Frame:SetSize(Width-10,Height-60)
DW.Frame:SetTop(40)
DW.Frame.ScrollBar=Turbine.UI.Lotro.ScrollBar()
DW.Frame.ScrollBar:SetOrientation( Turbine.UI.Orientation.Vertical )
DW.Frame.ListBox = Turbine.UI.ListBox()
DW.Frame.ListBox:SetParent( DW.Frame )
DW.Frame.ListBox:SetPosition( 10, 2 )
DW.Frame.ListBox:SetSize( Width-20, Height-64)
DW.Frame.ListBox:SetMaxItemsPerLine(Col)
DW.Frame.ListBox:SetOrientation( Turbine.UI.Orientation.Horizontal )
DW.Frame.ListBox:SetVerticalScrollBar( DW.Frame.ScrollBar )
DW.Frame.ScrollBar:SetParent(DW.Frame)
DW.Frame.ScrollBar:SetPosition(0,2)
DW.Frame.ScrollBar:SetHeight(Height-64)
DW.Frame.ScrollBar:SetWidth(10)
function Debug()
local w1=20
local w2=230
local w3=30
local w4=100
local w5=30
local w6=100
local backpackdata={}
local function label(w,s)
if s==nil then s="-" end
Geoff=Turbine.UI.Label()
Geoff:SetFont(Font)
Geoff:SetText(s)
Geoff:SetMultiline(false)
Geoff:SetMouseVisible(false)
Geoff:SetSize(w,16)
DW.Frame.ListBox:AddItem(Geoff)
end
DW.Window:SetVisible(true)
DW.Frame.ListBox:ClearItems()
label(w1,"id")
label(w2,"Name")
label(w3,"Cat")
label(w4,"CategoryText")
label(w5,"Quality")
label(w6,"Weight")
local Category
local Quality
local CategoryText
local Name
for i=1,backpack:GetSize() do
local item = backpack:GetItem(i)
if item~=nil then
local itemInfo=item:GetItemInfo();
Category=GetCat(item)
Quality=itemInfo:GetQuality()
CategoryText=ItemCategory[GetCat(item)]
Name=itemInfo:GetName()
--Name=string.gsub(Name,"[^%a]","")
W=weight(i)
else
Category=nil
Quality=nil
CategoryText=nil
Name=nil
W=weight(i)
end
backpackdata[i]={
{
["Name"] = Name,
["Category"] = Category,
["Quality"] = Quality,
["CategoryText"] = CategoryText,
["W"] = W
}}
label(w1,i)
label(w2,Name)
label(w3,Category)
label(w4,CategoryText)
label(w5,Quality)
label(w6,W)
end
JackdawPlugins.Patch.Save( Turbine.DataScope.Server, "SortpackDebugBackpackContents", backpackdata )
end