mirror of
https://github.com/edubart/otclient.git
synced 2025-11-30 07:26:49 +01:00
addon to show walk ping
This commit is contained in:
27
modules/addon_pingbar/pingbar.lua
Normal file
27
modules/addon_pingbar/pingbar.lua
Normal 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 })
|
||||
15
modules/addon_pingbar/pingbar.otmod
Normal file
15
modules/addon_pingbar/pingbar.otmod
Normal 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()
|
||||
@@ -5,7 +5,7 @@ Module
|
||||
website: https://github.com/edubart/otclient
|
||||
|
||||
autoLoad: true
|
||||
autoLoadPriority: 1000
|
||||
autoLoadPriority: 200
|
||||
|
||||
onLoad: |
|
||||
require 'terminal'
|
||||
|
||||
@@ -66,11 +66,11 @@ TopPanel
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.right: parent.right
|
||||
width: 60
|
||||
width: 70
|
||||
|
||||
FrameCounter
|
||||
id: frameCounter
|
||||
anchors.top: parent.top
|
||||
anchors.right: prev.left
|
||||
margin-top: 8
|
||||
margin-right: 12
|
||||
margin-right: 5
|
||||
@@ -12,7 +12,7 @@ local SpeakTypes = {
|
||||
channelWhite = { color = '#FFFFFF' },
|
||||
channelRed = { color = '#F55E5E' },
|
||||
channelOrange = { color = '#FE6500' },
|
||||
private = { color = '#FFFF00' },
|
||||
private = { color = '#5FF7F7' },
|
||||
playerToNpc = { color = '#9F9DFD' },
|
||||
broadcast = { color = '#F55E5E' },
|
||||
privateRed = { color = '#F55E5E' }
|
||||
|
||||
Reference in New Issue
Block a user