2013-02-28 23:05:53 +01:00
|
|
|
local function pcolored(text, color)
|
|
|
|
color = color or 'white'
|
|
|
|
modules.client_terminal.addLine(text, color)
|
|
|
|
end
|
|
|
|
|
2013-03-01 00:10:36 +01:00
|
|
|
function draw_debug_boxes()
|
|
|
|
g_ui.setDebugBoxesDrawing(not g_ui.isDrawingDebugBoxes())
|
2012-01-09 19:45:28 +01:00
|
|
|
end
|
2012-01-09 22:16:50 +01:00
|
|
|
|
2013-02-28 22:39:27 +01:00
|
|
|
function hide_map()
|
|
|
|
modules.game_interface.getMapPanel():hide()
|
2012-01-16 06:54:53 +01:00
|
|
|
end
|
|
|
|
|
2013-02-28 22:39:27 +01:00
|
|
|
function show_map()
|
|
|
|
modules.game_interface.getMapPanel():show()
|
2012-01-16 06:54:53 +01:00
|
|
|
end
|
|
|
|
|
2013-02-28 22:39:27 +01:00
|
|
|
function auto_reload_module(name)
|
|
|
|
local function reloadEvent()
|
|
|
|
reloadModule(name)
|
|
|
|
scheduleEvent(reloadEvent, 1000)
|
2012-01-17 09:26:13 +01:00
|
|
|
end
|
2013-02-28 22:39:27 +01:00
|
|
|
reloadEvent()
|
2012-01-09 22:16:50 +01:00
|
|
|
end
|
2012-01-19 05:12:53 +01:00
|
|
|
|
2013-02-28 22:39:27 +01:00
|
|
|
local pinging = false
|
2013-03-01 00:10:36 +01:00
|
|
|
local function pingBack(ping)
|
|
|
|
if ping < 300 then color = 'green'
|
|
|
|
elseif ping < 600 then color = 'yellow'
|
|
|
|
else color = 'red' end
|
|
|
|
pcolored(g_game.getWorldName() .. ' => ' .. ping .. ' ms', color)
|
|
|
|
end
|
2013-02-28 22:39:27 +01:00
|
|
|
function ping()
|
|
|
|
if pinging then
|
2013-03-01 00:10:36 +01:00
|
|
|
pcolored('Ping stopped.')
|
2013-02-28 22:39:27 +01:00
|
|
|
g_game.setPingDelay(1000)
|
|
|
|
disconnect(g_game, 'onPingBack', pingBack)
|
2012-08-02 16:02:36 +02:00
|
|
|
else
|
2013-02-28 22:39:27 +01:00
|
|
|
if not (g_game.getFeature(GameClientPing) or g_game.getFeature(GameExtendedClientPing)) then
|
2013-03-01 00:10:36 +01:00
|
|
|
pcolored('this server does not support ping', 'red')
|
2013-02-28 22:39:27 +01:00
|
|
|
return
|
|
|
|
elseif not g_game.isOnline() then
|
2013-03-01 00:10:36 +01:00
|
|
|
pcolored('ping command is only allowed when online', 'red')
|
2013-02-28 22:39:27 +01:00
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2013-03-01 00:10:36 +01:00
|
|
|
pcolored('Starting ping...')
|
2013-02-28 22:39:27 +01:00
|
|
|
g_game.setPingDelay(0)
|
|
|
|
connect(g_game, 'onPingBack', pingBack)
|
2012-08-02 16:02:36 +02:00
|
|
|
end
|
2013-02-28 22:39:27 +01:00
|
|
|
pinging = not pinging
|
2012-08-02 16:02:36 +02:00
|
|
|
end
|
|
|
|
|
2013-02-28 22:39:27 +01:00
|
|
|
function clear()
|
|
|
|
modules.client_terminal.clear()
|
|
|
|
end
|
|
|
|
|
|
|
|
function ls(path)
|
|
|
|
path = path or '/'
|
|
|
|
local files = g_resources.listDirectoryFiles(path)
|
|
|
|
for k,v in pairs(files) do
|
|
|
|
if g_resources.directoryExists(path .. v) then
|
2013-02-28 23:05:53 +01:00
|
|
|
pcolored(path .. v, 'blue')
|
2013-02-28 22:39:27 +01:00
|
|
|
else
|
2013-02-28 23:05:53 +01:00
|
|
|
pcolored(path .. v)
|
2013-02-28 22:39:27 +01:00
|
|
|
end
|
2012-02-06 05:39:52 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-02-28 22:39:27 +01:00
|
|
|
function about_version()
|
2013-02-28 23:05:53 +01:00
|
|
|
pcolored(g_app.getName() .. ' ' .. g_app.getVersion() .. '\n' ..
|
2013-02-28 22:39:27 +01:00
|
|
|
'Rev ' .. g_app.getBuildRevision() .. ' ('.. g_app.getBuildCommit() .. ')\n' ..
|
|
|
|
'Built on ' .. g_app.getBuildDate())
|
2013-01-03 07:24:07 +01:00
|
|
|
end
|
2013-02-24 21:26:19 +01:00
|
|
|
|
2013-02-28 22:39:27 +01:00
|
|
|
function about_graphics()
|
2013-02-28 23:05:53 +01:00
|
|
|
pcolored('Vendor ' .. g_graphics.getVendor() )
|
|
|
|
pcolored('Renderer' .. g_graphics.getRenderer())
|
|
|
|
pcolored('Version' .. g_graphics.getVersion())
|
|
|
|
end
|
|
|
|
|
|
|
|
function about_modules()
|
|
|
|
for k,m in pairs(g_modules.getModules()) do
|
|
|
|
local loadedtext
|
|
|
|
if m:isLoaded() then
|
|
|
|
pcolored(m:getName() .. ' => loaded', 'green')
|
|
|
|
else
|
|
|
|
pcolored(m:getName() .. ' => not loaded', 'red')
|
|
|
|
end
|
|
|
|
end
|
2013-02-24 21:26:19 +01:00
|
|
|
end
|