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

Fixed donations popup

git-svn-id: http://svn.net-core.org/repos/t-engine4@4030 51575b47-30f0-44d4-a5cc-537603b46e54
parent 9f3f0a13
No related branches found
No related tags found
No related merge requests found
......@@ -141,9 +141,9 @@ end
--- Show an achievement gain dialog
function _M:showAchievement(title, a)
if not config.settings.cheat then
-- if not config.settings.cheat then
game:registerDialog(Achievement.new("New Achievement: #LIGHT_GREEN#"..a.name, a))
end
-- end
end
--- Format an achievement source
......
......@@ -566,8 +566,8 @@ function _M:checkDonation(back_insert)
-- We then check multiple conditions to make sure the player is in a good state of mind
-- Dont ask often
local last = profile.generic.donations and profile.generic.donations.last_ask or 0
local min_interval = 30 * 24 * 60 * 60 -- 1 month
local last = profile.mod.donations and profile.mod.donations.last_ask or 0
local min_interval = 15 * 24 * 60 * 60 -- 1 month
if os.time() < last + min_interval then
print("Donation check: too soon")
return
......@@ -613,9 +613,7 @@ function _M:checkDonation(back_insert)
end
-- Request money! Even a god has to eat :)
profile.generic.donations = profile.generic.donations or {}
profile.generic.donations.last_ask = os.time()
profile:saveGenericProfile("donations", profile.generic.donations)
profile:saveModuleProfile("donations", {last_ask=os.time()})
if back_insert then
game:registerDialogAt(Donation.new(), 2)
else
......
......@@ -59,4 +59,5 @@ profile_defs = {
uniques = { {cid="index:string:50"}, {victim="index:string:50"}, {nb="number"}, receive=function(data, save) save.uniques = save.uniques or {} save.uniques[data.cid] = save.uniques[data.cid] or {} inc_set(save.uniques[data.cid], data.victim, data, "nb") end, export=function(env) for cid, d in pairs(env.uniques or {}) do for name, v in pairs(d) do add{cid=cid, victim=name, nb=v} end end end },
deaths = { {cid="index:string:50"}, {source="index:string:50"}, {nb="number"}, receive=function(data, save) save.sources = save.sources or {} save.sources[data.cid] = save.sources[data.cid] or {} inc_set(save.sources[data.cid], data.source, data, "nb") end, export=function(env) for cid, d in pairs(env.sources or {}) do for name, v in pairs(d) do add{cid=cid, source=name, nb=v} end end end },
achievements = { {id="index:string:40"}, {gained_on="timestamp"}, {who="string:50"}, {turn="number"}, receive=function(data, save) save[data.id] = {who=data.who, when=data.gained_on, turn=data.turn} end, export=function(env) for id, v in pairs(env) do add{id=id, who=v.who, gained_on=v.when, turn=v.turn} end end },
donations = { no_sync=true, {last_ask="timestamp"}, receive=function(data, save) save.last_ask = data.last_ask end, export=function(env) add{last_ask=env.last_ask} 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