2017-08-28 00:04:05 +02:00
|
|
|
if not config.xmas or config.xmas==0 then return nil end
|
2017-01-22 11:38:01 +01:00
|
|
|
|
2015-12-22 14:38:56 +01:00
|
|
|
local gifts = {
|
|
|
|
e2 = {
|
2017-12-31 11:24:21 +01:00
|
|
|
[1057] = { year = 2017, item = 'snowglobe', msg='santa_f' },
|
|
|
|
[959] = { year = 2015, item = 'snowglobe', msg='santa_f' },
|
|
|
|
[624] = { year = 2009, item = 'xmastree', msg='santa_m' },
|
|
|
|
[468] = { year = 2006, item = 'snowman', msg='santa_m' },
|
|
|
|
[416] = { year = 2005, item = 'stardust' },
|
|
|
|
[364] = { year = 2004, item = 'speedsail' }
|
2015-12-22 14:38:56 +01:00
|
|
|
},
|
|
|
|
e3 = {
|
2017-12-31 11:24:21 +01:00
|
|
|
[26] = { year = 2009, item = 'xmastree' }
|
2015-12-22 14:38:56 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
local function give_gifts(gift)
|
|
|
|
eressea.log.info("Es weihnachtet sehr (" .. gift.year .. ")")
|
|
|
|
local msg = nil
|
|
|
|
if gift.msg then
|
|
|
|
msg = message.create(gift.msg)
|
|
|
|
msg:set_resource("item", gift.item)
|
|
|
|
end
|
|
|
|
if gift.item then
|
|
|
|
for f in factions() do
|
|
|
|
f:add_item(gift.item, 1)
|
|
|
|
if msg then
|
|
|
|
msg:send_faction(f)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
local self = {}
|
|
|
|
|
|
|
|
function self.init()
|
|
|
|
local turn = get_turn()
|
|
|
|
local tbl = gifts[config.rules]
|
|
|
|
if tbl then
|
2017-12-31 11:24:21 +01:00
|
|
|
gift = tbl[turn]
|
|
|
|
if gift then
|
|
|
|
give_gifts(gift)
|
2015-12-22 14:38:56 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
return self
|