addon to show walk ping

This commit is contained in:
Eduardo Bart
2012-01-09 04:46:44 -02:00
parent 81e378cc22
commit b00076bcb9
8 changed files with 56 additions and 14 deletions

View File

@@ -0,0 +1,27 @@
PingBar = {}
local pingLabel
-- public functions
function PingBar.init()
pingLabel = createWidget('UILabel', rootWidget:recursiveGetChildById('leftButtonsPanel'))
pingLabel:applyStyle({ ['anchors.left'] = 'prev.right',
['anchors.top'] = 'parent.top',
['margin-top'] = 12,
['margin-left'] = 10,
font = 'verdana-11px-rounded',
color = '#FE6500',
width = 120,
height = 16})
end
function PingBar.terminate()
pingLabel:destroy()
end
-- hooked events
local function onGamePingUpdate(ping)
pingLabel:setText('Walk Ping: ' .. ping .. ' ms')
end
connect(Game, { onWalkPingUpdate = onGamePingUpdate })

View File

@@ -0,0 +1,15 @@
Module
name: pingbar
description: Show ping in game
author: OTClient team
website: https://github.com/edubart/otclient
autoLoad: true
autoLoadPriority: 1000
onLoad: |
require 'pingbar'
PingBar.init()
onUnload: |
PingBar.terminate()