Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/modules/game_playerdeath/playerdeath.lua b/modules/game_playerdeath/playerdeath.lua
- index 736f86e..53ddf7a 100644
- --- a/modules/game_playerdeath/playerdeath.lua
- +++ b/modules/game_playerdeath/playerdeath.lua
- @@ -1,5 +1,7 @@
- deathWindow = nil
- +local timeToLogin = 5
- +
- local deathTexts = {
- regular = {text = 'Alas! Brave adventurer, you have met a sad fate.\nBut do not despair, for the gods will bring you back\ninto this world in exchange for a small sacrifice\n\nSimply click on Ok to resume your journeys!', height = 140, width = 0},
- unfair = {text = 'Alas! Brave adventurer, you have met a sad fate.\nBut do not despair, for the gods will bring you back\ninto this world in exchange for a small sacrifice\n\nThis death penalty has been reduced by %i%%\nbecause it was an unfair fight.\n\nSimply click on Ok to resume your journeys!', height = 185, width = 0},
- @@ -48,25 +50,37 @@ function openWindow(deathType, penalty)
- deathWindow = g_ui.createWidget('DeathWindow', rootWidget)
- local textLabel = deathWindow:getChildById('labelText')
- + local text
- if deathType == DeathType.Regular then
- if penalty == 100 then
- - textLabel:setText(deathTexts.regular.text)
- + text = deathTexts.regular.text
- deathWindow:setHeight(deathWindow.baseHeight + deathTexts.regular.height)
- deathWindow:setWidth(deathWindow.baseWidth + deathTexts.regular.width)
- else
- - textLabel:setText(string.format(deathTexts.unfair.text, 100 - penalty))
- + text = string.format(deathTexts.unfair.text, 100 - penalty)
- deathWindow:setHeight(deathWindow.baseHeight + deathTexts.unfair.height)
- deathWindow:setWidth(deathWindow.baseWidth + deathTexts.unfair.width)
- end
- elseif deathType == DeathType.Blessed then
- - textLabel:setText(deathTexts.blessed.text)
- + text = deathTexts.blessed.text
- deathWindow:setHeight(deathWindow.baseHeight + deathTexts.blessed.height)
- deathWindow:setWidth(deathWindow.baseWidth + deathTexts.blessed.width)
- end
- +
- + local timerText = '\nYou will be logged in %d seconds.'
- local okButton = deathWindow:getChildById('buttonOk')
- local cancelButton = deathWindow:getChildById('buttonCancel')
- -
- +
- + for i = 0, timeToLogin do
- + scheduleEvent(function ()
- + local dt = rootWidget:recursiveGetChildById('deathWindow')
- + if dt then
- + dt:getChildById('labelText'):setText(text .. string.format(timerText, timeToLogin - i))
- + end
- + end, i * 1000)
- + end
- +
- local okFunc = function()
- CharacterList.doLogin()
- okButton:getParent():destroy()
- @@ -77,7 +91,13 @@ function openWindow(deathType, penalty)
- cancelButton:getParent():destroy()
- deathWindow = nil
- end
- -
- + scheduleEvent(function ()
- + local dt = rootWidget:recursiveGetChildById('deathWindow')
- + local ok = dt:getChildById('buttonOk')
- + if dt then
- + signalcall(ok.onClick, ok)
- + end
- + end, timeToLogin * 1000)
- deathWindow.onEnter = okFunc
- deathWindow.onEscape = cancelFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement