- Unjustified Points (Better topbar icon would be nice) ![Unjustified Points](http://i.gyazo.com/81286f46d9b4d56b3fe864140173cf34.png) - Authenticator token support - adjusted 'can change pvp frame' to 1054 - ...master
コミット
ddec9627b8
変更後 幅: | 高さ: | サイズ: 338 B |
変更後 幅: | 高さ: | サイズ: 421 B |
@ -0,0 +1,135 @@
|
||||
unjustifiedPointsWindow = nil
|
||||
unjustifiedPointsButton = nil
|
||||
contentsPanel = nil
|
||||
|
||||
openPvpSituationsLabel = nil
|
||||
currentSkullWidget = nil
|
||||
skullTimeLabel = nil
|
||||
|
||||
dayProgressBar = nil
|
||||
weekProgressBar = nil
|
||||
monthProgressBar = nil
|
||||
|
||||
daySkullWidget = nil
|
||||
weekSkullWidget = nil
|
||||
monthSkullWidget = nil
|
||||
|
||||
function init()
|
||||
connect(g_game, { onGameStart = online,
|
||||
onUnjustifiedPointsChange = onUnjustifiedPointsChange,
|
||||
onOpenPvpSituationsChange = onOpenPvpSituationsChange })
|
||||
connect(LocalPlayer, { onSkullChange = onSkullChange } )
|
||||
|
||||
unjustifiedPointsButton = modules.client_topmenu.addRightGameToggleButton('unjustifiedPointsButton',
|
||||
tr('Unjustified Points'), '/images/topbuttons/unjustifiedpoints', toggle)
|
||||
unjustifiedPointsButton:setOn(true)
|
||||
unjustifiedPointsButton:hide()
|
||||
|
||||
unjustifiedPointsWindow = g_ui.loadUI('unjustifiedpoints', modules.game_interface.getRightPanel())
|
||||
unjustifiedPointsWindow:disableResize()
|
||||
unjustifiedPointsWindow:setup()
|
||||
|
||||
contentsPanel = unjustifiedPointsWindow:getChildById('contentsPanel')
|
||||
|
||||
openPvpSituationsLabel = contentsPanel:getChildById('openPvpSituationsLabel')
|
||||
currentSkullWidget = contentsPanel:getChildById('currentSkullWidget')
|
||||
skullTimeLabel = contentsPanel:getChildById('skullTimeLabel')
|
||||
|
||||
dayProgressBar = contentsPanel:getChildById('dayProgressBar')
|
||||
weekProgressBar = contentsPanel:getChildById('weekProgressBar')
|
||||
monthProgressBar = contentsPanel:getChildById('monthProgressBar')
|
||||
daySkullWidget = contentsPanel:getChildById('daySkullWidget')
|
||||
weekSkullWidget = contentsPanel:getChildById('weekSkullWidget')
|
||||
monthSkullWidget = contentsPanel:getChildById('monthSkullWidget')
|
||||
|
||||
if g_game.isOnline() then
|
||||
online()
|
||||
end
|
||||
end
|
||||
|
||||
function terminate()
|
||||
disconnect(g_game, { onGameStart = online,
|
||||
onUnjustifiedPointsChange = onUnjustifiedPointsChange,
|
||||
onOpenPvpSituationsChange = onOpenPvpSituationsChange })
|
||||
disconnect(LocalPlayer, { onSkullChange = onSkullChange } )
|
||||
|
||||
unjustifiedPointsWindow:destroy()
|
||||
unjustifiedPointsButton:destroy()
|
||||
end
|
||||
|
||||
function onMiniWindowClose()
|
||||
unjustifiedPointsButton:setOn(false)
|
||||
end
|
||||
|
||||
function toggle()
|
||||
if unjustifiedPointsButton:isOn() then
|
||||
unjustifiedPointsWindow:close()
|
||||
unjustifiedPointsButton:setOn(false)
|
||||
else
|
||||
unjustifiedPointsWindow:open()
|
||||
unjustifiedPointsButton:setOn(true)
|
||||
end
|
||||
end
|
||||
|
||||
function online()
|
||||
if g_game.getFeature(GameUnjustifiedPoints) then
|
||||
unjustifiedPointsButton:show()
|
||||
else
|
||||
unjustifiedPointsButton:hide()
|
||||
unjustifiedPointsWindow:close()
|
||||
end
|
||||
|
||||
refresh()
|
||||
end
|
||||
|
||||
function refresh()
|
||||
local localPlayer = g_game.getLocalPlayer()
|
||||
|
||||
local unjustifiedPoints = g_game.getUnjustifiedPoints()
|
||||
onUnjustifiedPointsChange(unjustifiedPoints)
|
||||
|
||||
onSkullChange(localPlayer, localPlayer:getSkull())
|
||||
onOpenPvpSituationsChange(g_game.getOpenPvpSituations())
|
||||
end
|
||||
|
||||
function onSkullChange(localPlayer, skull)
|
||||
if not localPlayer:isLocalPlayer() then return end
|
||||
|
||||
if skull == SkullRed or skull == SkullBlack then
|
||||
currentSkullWidget:setIcon(getSkullImagePath(skull))
|
||||
currentSkullWidget:setTooltip('Remaining skull time')
|
||||
else
|
||||
currentSkullWidget:setIcon('')
|
||||
currentSkullWidget:setTooltip('You have no skull')
|
||||
end
|
||||
|
||||
daySkullWidget:setIcon(getSkullImagePath(getNextSkullId(skull)))
|
||||
weekSkullWidget:setIcon(getSkullImagePath(getNextSkullId(skull)))
|
||||
monthSkullWidget:setIcon(getSkullImagePath(getNextSkullId(skull)))
|
||||
end
|
||||
|
||||
function onOpenPvpSituationsChange(amount)
|
||||
openPvpSituationsLabel:setText(amount)
|
||||
end
|
||||
|
||||
function onUnjustifiedPointsChange(unjustifiedPoints)
|
||||
if unjustifiedPoints.skullTime == 0 then
|
||||
skullTimeLabel:setText('No skull')
|
||||
skullTimeLabel:setTooltip('You have no skull')
|
||||
else
|
||||
skullTimeLabel:setText(unjustifiedPoints.skullTime .. ' days')
|
||||
skullTimeLabel:setTooltip('Remaining skull time')
|
||||
end
|
||||
|
||||
dayProgressBar:setValue(unjustifiedPoints.killsDay, 0, 100)
|
||||
dayProgressBar:setTooltip(string.format('Unjustified points gained during the last 24 hours.\n%i kills left.', unjustifiedPoints.killsDayRemaining))
|
||||
dayProgressBar:setText(unjustifiedPoints.killsDayRemaining .. ' kills left')
|
||||
|
||||
weekProgressBar:setValue(unjustifiedPoints.killsWeek, 0, 100)
|
||||
weekProgressBar:setTooltip(string.format('Unjustified points gained during the last 7 days.\n%i kills left.', unjustifiedPoints.killsWeekRemaining))
|
||||
weekProgressBar:setText(unjustifiedPoints.killsWeekRemaining .. ' kills left')
|
||||
|
||||
monthProgressBar:setValue(unjustifiedPoints.killsMonth, 0, 100)
|
||||
monthProgressBar:setTooltip(string.format('Unjustified points gained during the last 30 days.\n%i kills left.', unjustifiedPoints.killsMonthRemaining))
|
||||
monthProgressBar:setText(unjustifiedPoints.killsMonthRemaining .. ' kills left')
|
||||
end
|
@ -0,0 +1,8 @@
|
||||
Module
|
||||
name: game_unjustifiedpoints
|
||||
description: View unjustified points
|
||||
author: Summ
|
||||
sandboxed: true
|
||||
scripts: [ unjustifiedpoints ]
|
||||
@onLoad: init()
|
||||
@onUnload: terminate()
|
@ -0,0 +1,80 @@
|
||||
SkullProgressBar < ProgressBar
|
||||
height: 13
|
||||
margin: 4 18 0 10
|
||||
anchors.top: prev.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
||||
SkullWidget < UIWidget
|
||||
size: 13 13
|
||||
margin-right: 2
|
||||
anchors.right: parent.right
|
||||
image-source: /images/game/skull_socket
|
||||
|
||||
MiniWindow
|
||||
id: unjustifiedPointsWindow
|
||||
!text: tr('Unjustified Points')
|
||||
height: 114
|
||||
icon: /images/topbuttons/unjustifiedpoints
|
||||
@onClose: modules.game_unjustifiedpoints.onMiniWindowClose()
|
||||
&save: true
|
||||
|
||||
MiniWindowContents
|
||||
Label
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
!text: tr('Open PvP')
|
||||
!tooltip: tr('Open PvP Situations')
|
||||
phantom: false
|
||||
margin-top: 2
|
||||
margin-left: 10
|
||||
|
||||
Label
|
||||
id: openPvpSituationsLabel
|
||||
anchors.top: prev.bottom
|
||||
anchors.left: parent.left
|
||||
font: verdana-11px-rounded
|
||||
margin-left: 12
|
||||
phantom: false
|
||||
|
||||
Label
|
||||
anchors.top: parent.top
|
||||
anchors.right: parent.right
|
||||
!text: tr('Skull Time')
|
||||
margin-top: 2
|
||||
margin-right: 10
|
||||
|
||||
SkullWidget
|
||||
id: currentSkullWidget
|
||||
anchors.top: prev.bottom
|
||||
margin-right: 10
|
||||
|
||||
Label
|
||||
id: skullTimeLabel
|
||||
anchors.top: prev.top
|
||||
anchors.right: prev.left
|
||||
font: verdana-11px-rounded
|
||||
margin-right: 6
|
||||
phantom: false
|
||||
|
||||
SkullProgressBar
|
||||
id: dayProgressBar
|
||||
margin-top: 10
|
||||
|
||||
SkullWidget
|
||||
id: daySkullWidget
|
||||
anchors.top: prev.top
|
||||
|
||||
SkullProgressBar
|
||||
id: weekProgressBar
|
||||
|
||||
SkullWidget
|
||||
id: weekSkullWidget
|
||||
anchors.top: prev.top
|
||||
|
||||
SkullProgressBar
|
||||
id: monthProgressBar
|
||||
|
||||
SkullWidget
|
||||
id: monthSkullWidget
|
||||
anchors.top: prev.top
|
読み込み中…
新しいイシューから参照