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

betetr donation popup

git-svn-id: http://svn.net-core.org/repos/t-engine4@4062 51575b47-30f0-44d4-a5cc-537603b46e54
parent 80404096
No related branches found
No related tags found
No related merge requests found
......@@ -565,6 +565,12 @@ function _M:checkDonation(back_insert)
-- This is only called when something nice happens (like an achievement)
-- We then check multiple conditions to make sure the player is in a good state of mind
-- If this is a reccuring donator, do not bother her/him
if profile.auth and tonumber(profile.auth.donated) and profile.auth.sub == "yes" then
print("Donation check: already a reccuring donator")
return
end
-- Dont ask often
local last = profile.mod.donations and profile.mod.donations.last_ask or 0
local min_interval = 15 * 24 * 60 * 60 -- 1 month
......@@ -614,6 +620,7 @@ function _M:checkDonation(back_insert)
-- Request money! Even a god has to eat :)
profile:saveModuleProfile("donations", {last_ask=os.time()})
if back_insert then
game:registerDialogAt(Donation.new(), 2)
else
......
......@@ -34,15 +34,28 @@ function _M:init(source)
self.donation_source = source or "ingame"
Dialog.init(self, "Donations", 500, 300)
local desc = Textzone.new{width=self.iw, auto_height=true, text=[[Hi, I am Nicolas (DarkGod), the maker of this game.
local desc
local recur = false
if not profile.auth or not tonumber(profile.auth.donated) or tonumber(profile.auth.donated) <= 1 then
-- First time donation
desc = Textzone.new{width=self.iw, auto_height=true, text=[[Hi, I am Nicolas (DarkGod), the maker of this game.
It is my dearest hope that you find my game enjoyable, and that you will continue to do so for many years to come!
ToME is free and open-source and will stay that way, but that does not mean I can live without money, so I have come to disturb you here and now to ask for your kindness.
If you feel that the (many) hours you have spent having fun were worth it, please consider making a donation for the future of the game.
]]}
else
-- Recurring donation
recur = true
desc = Textzone.new{width=self.iw, auto_height=true, text=[[Thank you for supporting ToME, your donation was greatly appreciated.
If you want to continue supporting ToME you are welcome to make a new donation or even a reccuring one which helps ensure the future of the game.
Thank you for your kindness!]]}
end
self.c_donate = Numberbox.new{title="Donation amount: ", number=10, max=1000, min=5, chars=5, fct=function() end}
local euro = Textzone.new{auto_width=true, auto_height=true, text=[[€]]}
self.c_recur = Checkbox.new{title="Make it a recurring montly donation", default=false, fct=function() end}
self.c_recur = Checkbox.new{title="Make it a recurring montly donation", default=recur, fct=function() end}
local ok = require("engine.ui.Button").new{text="Accept", fct=function() self:ok() end}
local cancel = require("engine.ui.Button").new{text="Cancel", fct=function() self:cancel() 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