2012-02-06 02:44:47 +01:00
|
|
|
function dumpWidgets(widget, level)
|
|
|
|
widget = widget or rootWidget
|
|
|
|
level = level or 0
|
|
|
|
for i=1,widget:getChildCount() do
|
|
|
|
local child = widget:getChildByIndex(i)
|
|
|
|
if child:isVisible() then
|
|
|
|
local name = child:getId()
|
|
|
|
if name:match('widget%d+') == nil then
|
|
|
|
print(string.rep(' ', level) .. name)
|
|
|
|
end
|
|
|
|
if child:getId() ~= 'terminalBuffer' then
|
|
|
|
dumpWidgets(child, level+1)
|
|
|
|
end
|
|
|
|
end
|
2011-12-07 01:31:55 +01:00
|
|
|
end
|
2012-01-09 19:45:28 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
function drawDebugBoxes(enable)
|
|
|
|
if enable == nil then enable = true end
|
|
|
|
g_ui.setDebugBoxesDrawing(enable)
|
|
|
|
end
|
2012-01-09 22:16:50 +01:00
|
|
|
|
2012-01-16 06:54:53 +01:00
|
|
|
function hideMap()
|
|
|
|
local map = rootWidget:recursiveGetChildById('gameMapPanel')
|
|
|
|
if map then map:hide() end
|
|
|
|
end
|
|
|
|
|
|
|
|
function showMap()
|
|
|
|
local map = rootWidget:recursiveGetChildById('gameMapPanel')
|
|
|
|
if map then map:show() end
|
|
|
|
end
|
|
|
|
|
2012-01-17 09:26:13 +01:00
|
|
|
function debugContainersItems()
|
|
|
|
function UIItem:onHoverChange(hovered)
|
|
|
|
if hovered then
|
2012-01-17 23:28:55 +01:00
|
|
|
local item = self:getItem()
|
2012-07-23 17:11:53 +02:00
|
|
|
if item then
|
2012-12-28 17:15:57 +01:00
|
|
|
local text = "id: " ..item:getId() ..
|
|
|
|
"\n stackable: " ..tostring(item:isStackable()) ..
|
|
|
|
"\n marketable: " ..tostring(item:isMarketable()) ..
|
|
|
|
"\n vocation: "..(item:getMarketData() and item:getMarketData().restrictVocation or 'none') ..
|
|
|
|
"\n cloth slot: " ..item:getClothSlot()
|
2012-07-24 21:49:19 +02:00
|
|
|
g_tooltip.display(text)
|
2012-07-23 17:11:53 +02:00
|
|
|
end
|
2012-01-17 09:26:13 +01:00
|
|
|
else
|
2012-06-26 00:13:30 +02:00
|
|
|
g_tooltip.hide()
|
2012-01-17 09:26:13 +01:00
|
|
|
end
|
|
|
|
end
|
2012-01-09 22:16:50 +01:00
|
|
|
end
|
2012-01-19 05:12:53 +01:00
|
|
|
|
2012-08-02 16:02:36 +02:00
|
|
|
function debugPosition(enable)
|
|
|
|
if enable == nil then enable = true end
|
|
|
|
local label = rootWidget:getChildById('debugPositionLabel')
|
|
|
|
if not label then
|
|
|
|
label = g_ui.createWidget('GameLabel', rootWidget)
|
|
|
|
label:setColor('pink')
|
|
|
|
label:setFont('terminus-14px-bold')
|
|
|
|
label:setId('debugPositionLabel')
|
|
|
|
label:setPosition({x= 10, y = 40 })
|
|
|
|
label:setPhantom(true)
|
|
|
|
label:setTextAutoResize(true)
|
|
|
|
end
|
|
|
|
if enable then
|
|
|
|
label.event = cycleEvent(function()
|
|
|
|
local player = g_game.getLocalPlayer()
|
|
|
|
if player then
|
|
|
|
local pos = g_game.getLocalPlayer():getPosition()
|
|
|
|
label:show()
|
|
|
|
label:setText('x: ' .. pos.x .. '\ny: ' .. pos.y .. '\nz: ' .. pos.z)
|
|
|
|
else
|
|
|
|
label:hide()
|
|
|
|
end
|
|
|
|
end, 100)
|
|
|
|
else
|
|
|
|
removeEvent(label.event)
|
|
|
|
label.event = nil
|
|
|
|
label:hide()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-02-06 05:39:52 +01:00
|
|
|
function autoReloadModule(name)
|
|
|
|
local function reloadEvent()
|
|
|
|
reloadModule(name)
|
|
|
|
scheduleEvent(reloadEvent, 1000)
|
|
|
|
end
|
|
|
|
reloadEvent()
|
|
|
|
end
|
|
|
|
|