Skip to content
Snippets Groups Projects
Commit 408a8ae2 authored by DarkGod's avatar DarkGod
Browse files

When the server receives a donation, notify & thank the player that did it

parent edb3d7f8
No related branches found
No related tags found
No related merge requests found
......@@ -154,7 +154,7 @@ function _M:gainAchievement(id, src, ...)
local color = a.huge and "GOLD" or "LIGHT_GREEN"
game.log("#"..color.."#New Achievement: %s!", a.name)
self:showAchievement("New Achievement: #"..color.."#"..a.name, a)
profile.chat:achievement(a.name, a.huge, true)
if not a.no_chat_broadcast then profile.chat:achievement(a.name, a.huge, true) end
if a.on_gain then a:on_gain(src) end
return true
......
......@@ -18,6 +18,7 @@
-- darkgod@te4.org
require "engine.class"
local Dialog = require "engine.ui.Dialog"
--- Module that handles multiplayer chats extensions, automatically loaded by engine.UserChat if found
module(..., package.seeall, class.make)
......@@ -74,6 +75,23 @@ function _M:event(e)
self.chat:addMessage("link", e.channel, e.login, {e.name, color}, "#ANTIQUE_WHITE#has linked a creature: #WHITE# "..data.name, {mode="tooltip", tooltip=data.desc})
elseif data.kind == "killer-link" then
self.chat:addMessage("death", e.channel, e.login, {e.name, color}, "#CRIMSON#"..data.msg.."#WHITE#", data.desc and {mode="tooltip", tooltip=data.desc} or nil)
elseif data.kind == "donator-update" and data.donated > 0 then
if data.donated <= 5 then world:gainAchievement("BRONZE_DONATOR", game:getPlayer(true))
elseif data.donated <= 15 then world:gainAchievement("SILVER_DONATOR", game:getPlayer(true))
elseif data.donated <= 30 then world:gainAchievement("GOLD_DONATOR", game:getPlayer(true))
elseif data.donated <= 60 then world:gainAchievement("STRALITE_DONATOR", game:getPlayer(true))
else world:gainAchievement("VORATUN_DONATOR", game:getPlayer(true))
end
local text = ([[#{bold}#Thank you#{normal}# for you donation, your support means a lot for the continued survival of this game.
Your current donation total is #LIGHT_GREEN#%0.2f euro#WHITE#.
Your Item's Vault has #TEAL#%d slots#WHITE#.
Again, thank you, and enjoy Eyal!
#{italic}#Your malevolent local god of darkness, #GOLD#DarkGod#{normal}#]]):format(data.donated, data.items_vault_slots)
Dialog:simpleLongPopup("Thank you", text, 600)
end
end
end
game/modules/tome/data/gfx/achievements/bronze_donator.png

30.9 KiB

game/modules/tome/data/gfx/achievements/gold_donator.png

32.5 KiB

game/modules/tome/data/gfx/achievements/silver_donator.png

33.7 KiB

game/modules/tome/data/gfx/achievements/stralite_donator.png

29 KiB

game/modules/tome/data/gfx/achievements/voratun_donator.png

34.4 KiB

......@@ -58,16 +58,16 @@ 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=[[]]}
local euro = Textzone.new{auto_width=true, auto_height=true, text=[[euro]]}
self.c_recur = Checkbox.new{title="Make it a recurring monthly 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}
self:loadUI{
{left=0, top=0, ui=desc},
{left=5, bottom=5 + ok.h, ui=self.c_donate},
{left=5+self.c_donate.w, bottom=10 + ok.h, ui=euro},
{left=5+self.c_donate.w+5, bottom=5 + ok.h, ui=self.c_recur},
{left=5, bottom=5 + ok.h + self.c_recur.h, ui=self.c_donate},
{left=5+self.c_donate.w, bottom=10 + ok.h + self.c_recur.h, ui=euro},
{left=0, bottom=5 + ok.h, ui=self.c_recur},
{left=0, bottom=0, ui=ok},
{right=0, bottom=0, ui=cancel},
}
......
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