Skip to content
Snippets Groups Projects
Commit a8f681a9 authored by dg's avatar dg
Browse files

Fixed donation dialog

git-svn-id: http://svn.net-core.org/repos/t-engine4@3006 51575b47-30f0-44d4-a5cc-537603b46e54
parent d4a13c84
No related branches found
No related tags found
No related merge requests found
......@@ -233,12 +233,11 @@ end
-- @param pos the stack position (1=top, 2=second, ...)
function _M:registerDialogAt(d, pos)
if pos == 1 then return self:registerDialog(d) end
table.insert(self.dialogs, #self.dialogs - (pos - 2), d)
for i = 1, #self.dialogs do
local dd = self.dialogs[i]
self.dialogs[d] = i
d.__stack_id = i
self.dialogs[dd] = i
dd.__stack_id = i
end
if d.on_register then d:on_register() end
if self.onRegisterDialog then self:onRegisterDialog(d) end
......
......@@ -48,7 +48,7 @@ function _M:simplePopup(title, text, fct, no_leave, any_leave)
local d = new(title, 1, 1)
d:loadUI{{left = 3, top = 3, ui=require("engine.ui.Textzone").new{width=w+10, height=h+5, text=text}}}
if not no_leave then
d.key:addBind("EXIT", function() game:unregisterDialog(d) if fct then fct() end end)
d.key:addBind("EXIT", function() print("==============exiting", d) game:unregisterDialog(d) if fct then fct() end end)
if any_leave then d.key:addCommand("__DEFAULT", function() game:unregisterDialog(d) if fct then fct() end end) end
local close = require("engine.ui.Button").new{text="Close", fct=function() d.key:triggerVirtual("EXIT") end}
d:loadUI{no_reset=true, {hcenter = 0, bottom = 3, ui=close}}
......
......@@ -538,32 +538,32 @@ function _M:checkDonation(back_insert)
local min_interval = 30 * 24 * 60 * 60 -- 1 month
if os.time() < last + min_interval then
print("Donation check: too soon")
return
-- return
end
-- Not as soon as they start playing, wait 15 minutes
if os.time() - game.real_starttime < 15 * 60 then
print("Donation check: not started tome long enough")
return
-- return
end
-- Total playtime must be over a few hours
local total = profile.generic.modules_played and profile.generic.modules_played.tome or 0
if total + (os.time() - game.real_starttime) < 7 * 60 * 60 then
print("Donation check: total time too low")
return
-- return
end
-- Dont ask low level characters, they are probably still pissed to not have progressed further
if game.player.level < 15 then
print("Donation check: too low level")
return
-- return
end
-- Dont ask people in immediate danger
if game.player.life / game.player.max_life < 0.7 then
print("Donation check: too low life")
return
-- return
end
-- Dont ask people that already have their hands full
......@@ -577,7 +577,7 @@ function _M:checkDonation(back_insert)
end
if nb_foes > 2 then
print("Donation check: too many foes")
return
-- return
end
-- Request money! Even a god has to eat :)
......
......@@ -20,7 +20,7 @@
name = "Back and Back and Back to the Future"
desc = function(self, who)
local desc = {}
desc[#desc+1] = "After passing through some kind of time anomaly you met a temporal warden who told you to destroy to abominations of this alternate timeline.\n"
desc[#desc+1] = "After passing through some kind of time anomaly you met a temporal warden who told you to destroy the abominations of this alternate timeline.\n"
return table.concat(desc, "\n")
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment