mirror of
https://github.com/edubart/otclient.git
synced 2025-10-17 04:53:27 +02:00
Protocol 10.76, fixed death window & death packet
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
DeathWindow < MainWindow
|
||||
id: deathWindow
|
||||
!text: tr('You are dead')
|
||||
size: 350 155
|
||||
&baseWidth: 350
|
||||
&baseHeight: 15
|
||||
|
||||
Label
|
||||
!text: tr('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!')
|
||||
id: labelText
|
||||
width: 550
|
||||
height: 140
|
||||
anchors.left: parent.left
|
||||
|
@@ -1,5 +1,11 @@
|
||||
deathWindow = nil
|
||||
|
||||
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},
|
||||
blessed = {text = 'Alas! Brave adventurer, you have met a sad fate.\nBut do not despair, for the gods will bring you back into this world\n\nThis death penalty has been reduced by 100%\nbecause you are blessed with the Adventurer\'s Blessing\n\nSimply click on Ok to resume your journeys!', height = 170, width = 90}
|
||||
}
|
||||
|
||||
function init()
|
||||
g_ui.importStyle('deathwindow')
|
||||
|
||||
@@ -21,9 +27,9 @@ function reset()
|
||||
end
|
||||
end
|
||||
|
||||
function display()
|
||||
function display(deathType, penalty)
|
||||
displayDeadMessage()
|
||||
openWindow()
|
||||
openWindow(deathType, penalty)
|
||||
end
|
||||
|
||||
function displayDeadMessage()
|
||||
@@ -33,12 +39,31 @@ function displayDeadMessage()
|
||||
modules.game_textmessage.displayGameMessage(tr('You are dead.'))
|
||||
end
|
||||
|
||||
function openWindow()
|
||||
function openWindow(deathType, penalty)
|
||||
if deathWindow then
|
||||
deathWindow:destroy()
|
||||
return
|
||||
end
|
||||
|
||||
deathWindow = g_ui.createWidget('DeathWindow', rootWidget)
|
||||
|
||||
local textLabel = deathWindow:getChildById('labelText')
|
||||
if deathType == DeathType.Regular then
|
||||
if penalty == 100 then
|
||||
textLabel:setText(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))
|
||||
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)
|
||||
deathWindow:setHeight(deathWindow.baseHeight + deathTexts.blessed.height)
|
||||
deathWindow:setWidth(deathWindow.baseWidth + deathTexts.blessed.width)
|
||||
end
|
||||
|
||||
local okButton = deathWindow:getChildById('buttonOk')
|
||||
local cancelButton = deathWindow:getChildById('buttonCancel')
|
||||
|
||||
|
Reference in New Issue
Block a user