Added new features to the options.
* Added 'enable smart walk' and 'show connection ping' options. * Minor tidy ups.
This commit is contained in:
parent
4bac36d3bc
commit
b58f4aa465
|
@ -7,15 +7,25 @@ Panel
|
||||||
id: autoChaseOverride
|
id: autoChaseOverride
|
||||||
!text: tr('Allow auto chase override')
|
!text: tr('Allow auto chase override')
|
||||||
|
|
||||||
|
OptionCheckBox
|
||||||
|
id: smartWalk
|
||||||
|
!text: tr('Enable smart walking')
|
||||||
|
!tooltip: tr('Will detect when to use diagonal step based on the\nkeys you are pressing')
|
||||||
|
|
||||||
OptionCheckBox
|
OptionCheckBox
|
||||||
id: walkBooster
|
id: walkBooster
|
||||||
!text: tr('Enable walk booster')
|
!text: tr('Enable walk booster')
|
||||||
!tooltip: tr('Also know as dash in tibia community, recommended\nfor playing characters with high speed')
|
!tooltip: tr('Also known as dash in tibia community, recommended\nfor playing characters with high speed')
|
||||||
|
|
||||||
OptionCheckBox
|
OptionCheckBox
|
||||||
id: enableMusic
|
id: enableMusic
|
||||||
!text: tr('Enable music')
|
!text: tr('Enable music')
|
||||||
|
|
||||||
|
OptionCheckBox
|
||||||
|
id: showPing
|
||||||
|
!text: tr('Show connection ping')
|
||||||
|
!tooltip: tr('Display connection speed to the server (milliseconds)')
|
||||||
|
|
||||||
OptionCheckBox
|
OptionCheckBox
|
||||||
id: showLeftPanel
|
id: showLeftPanel
|
||||||
!text: tr('Show left panel')
|
!text: tr('Show left panel')
|
||||||
|
|
|
@ -35,7 +35,7 @@ Panel
|
||||||
!tooltip: tr('Limits FPS to 60')
|
!tooltip: tr('Limits FPS to 60')
|
||||||
|
|
||||||
OptionCheckBox
|
OptionCheckBox
|
||||||
id: showfps
|
id: showFps
|
||||||
!text: tr('Show frame rate')
|
!text: tr('Show frame rate')
|
||||||
|
|
||||||
OptionCheckBox
|
OptionCheckBox
|
||||||
|
|
|
@ -2,7 +2,8 @@ Options = {}
|
||||||
|
|
||||||
local defaultOptions = {
|
local defaultOptions = {
|
||||||
vsync = false,
|
vsync = false,
|
||||||
showfps = true,
|
showFps = true,
|
||||||
|
showPing = true,
|
||||||
fullscreen = false,
|
fullscreen = false,
|
||||||
classicControl = false,
|
classicControl = false,
|
||||||
walkBooster = false,
|
walkBooster = false,
|
||||||
|
@ -131,11 +132,16 @@ function Options.setOption(key, value)
|
||||||
if options[key] == value then return end
|
if options[key] == value then return end
|
||||||
if key == 'vsync' then
|
if key == 'vsync' then
|
||||||
g_window.setVerticalSync(value)
|
g_window.setVerticalSync(value)
|
||||||
elseif key == 'showfps' then
|
elseif key == 'showFps' then
|
||||||
addEvent(function()
|
addEvent(function()
|
||||||
local frameCounter = rootWidget:recursiveGetChildById('frameCounter')
|
local frameCounter = rootWidget:recursiveGetChildById('frameCounter')
|
||||||
if frameCounter then frameCounter:setVisible(value) end
|
if frameCounter then frameCounter:setVisible(value) end
|
||||||
end)
|
end)
|
||||||
|
elseif key == 'showPing' then
|
||||||
|
addEvent(function()
|
||||||
|
local ping = rootWidget:recursiveGetChildById('pingLabel')
|
||||||
|
if ping then ping:setVisible(value) end
|
||||||
|
end)
|
||||||
elseif key == 'fullscreen' then
|
elseif key == 'fullscreen' then
|
||||||
g_window.setFullscreen(value)
|
g_window.setFullscreen(value)
|
||||||
elseif key == 'enableMusic' then
|
elseif key == 'enableMusic' then
|
||||||
|
|
|
@ -36,7 +36,7 @@ PingLabel < Label
|
||||||
font: verdana-11px-rounded
|
font: verdana-11px-rounded
|
||||||
@onSetup: |
|
@onSetup: |
|
||||||
self.updateEvent = cycleEvent(function()
|
self.updateEvent = cycleEvent(function()
|
||||||
if g_game.isOnline() then
|
if g_game.isOnline() and Options.getOption('showPing') then
|
||||||
local ping = -1
|
local ping = -1
|
||||||
if g_game.getFeature(GameClientPing) then
|
if g_game.getFeature(GameClientPing) then
|
||||||
ping = g_game.getPing()
|
ping = g_game.getPing()
|
||||||
|
|
|
@ -68,10 +68,10 @@ TopMenuPanel
|
||||||
visible: false
|
visible: false
|
||||||
|
|
||||||
FrameCounterLabel
|
FrameCounterLabel
|
||||||
|
id: frameCounter
|
||||||
color: white
|
color: white
|
||||||
margin-top: 4
|
margin-top: 4
|
||||||
margin-left: 5
|
margin-left: 5
|
||||||
id: frameCounter
|
|
||||||
text-auto-resize: true
|
text-auto-resize: true
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.left: leftGameButtonsPanel.right
|
anchors.left: leftGameButtonsPanel.right
|
||||||
|
|
|
@ -89,7 +89,6 @@ function UICreatureButton:updateSkull(skullId)
|
||||||
|
|
||||||
if skullId ~= SkullNone then
|
if skullId ~= SkullNone then
|
||||||
skullWidget:setWidth(skullWidget:getHeight())
|
skullWidget:setWidth(skullWidget:getHeight())
|
||||||
print(skullId)
|
|
||||||
local imagePath = getSkullImagePath(skullId)
|
local imagePath = getSkullImagePath(skullId)
|
||||||
skullWidget:setImageSource(imagePath)
|
skullWidget:setImageSource(imagePath)
|
||||||
labelWidget:setMarginLeft(5)
|
labelWidget:setMarginLeft(5)
|
||||||
|
|
|
@ -154,6 +154,7 @@ end
|
||||||
|
|
||||||
function smartWalk()
|
function smartWalk()
|
||||||
local dir
|
local dir
|
||||||
|
if Options.getOption('smartWalk') then
|
||||||
if g_keyboard.isKeyPressed('Up') and g_keyboard.isKeyPressed('Left') then
|
if g_keyboard.isKeyPressed('Up') and g_keyboard.isKeyPressed('Left') then
|
||||||
dir = NorthWest
|
dir = NorthWest
|
||||||
elseif g_keyboard.isKeyPressed('Up') and g_keyboard.isKeyPressed('Right') then
|
elseif g_keyboard.isKeyPressed('Up') and g_keyboard.isKeyPressed('Right') then
|
||||||
|
@ -162,7 +163,10 @@ function smartWalk()
|
||||||
dir = SouthWest
|
dir = SouthWest
|
||||||
elseif g_keyboard.isKeyPressed('Down') and g_keyboard.isKeyPressed('Right') then
|
elseif g_keyboard.isKeyPressed('Down') and g_keyboard.isKeyPressed('Right') then
|
||||||
dir = SouthEast
|
dir = SouthEast
|
||||||
elseif g_keyboard.isKeyPressed('Up') then
|
end
|
||||||
|
end
|
||||||
|
if not dir then
|
||||||
|
if g_keyboard.isKeyPressed('Up') then
|
||||||
dir = North
|
dir = North
|
||||||
elseif g_keyboard.isKeyPressed('Down') then
|
elseif g_keyboard.isKeyPressed('Down') then
|
||||||
dir = South
|
dir = South
|
||||||
|
@ -171,6 +175,7 @@ function smartWalk()
|
||||||
elseif g_keyboard.isKeyPressed('Right') then
|
elseif g_keyboard.isKeyPressed('Right') then
|
||||||
dir = East
|
dir = East
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if Options.getOption('walkBooster') then
|
if Options.getOption('walkBooster') then
|
||||||
if g_game.getLocalPlayer():canWalk(dir) then
|
if g_game.getLocalPlayer():canWalk(dir) then
|
||||||
|
|
Loading…
Reference in New Issue