Merge pull request #753 from ennorehling/master

bug 2402: xmas fix
This commit is contained in:
Enno Rehling 2017-12-31 11:51:21 +01:00 committed by GitHub
commit 141941b760
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 14 deletions

View File

@ -34,6 +34,18 @@
pulled by 8 young dragons flies through the stary night and presents pulled by 8 young dragons flies through the stary night and presents
your faction with a $resource($item,1).</text> your faction with a $resource($item,1).</text>
</message> </message>
<message name="santa_m" section="events">
<type>
<arg name="item" type="resource"/>
</type>
<text locale="de">'Ho ho ho!' Ein dicker Gnom fliegt auf einem von
8 Jungdrachen gezogenen Schlitten durch die Nacht und vermacht Deiner
Partei einen $resource($item,1). (Um diesen Gegenstand einer Einheit zu geben, gib
ihr den Befehl 'BEANSPRUCHE 1 $resource($item,1)').</text>
<text locale="en">'Ho ho ho!' A fat little gnome Gnom on a sled
pulled by 8 young dragons flies through the stary night and presents
your faction with a $resource($item,1).</text>
</message>
<message name="target_region_invalid"> <message name="target_region_invalid">
<type> <type>

View File

@ -2,15 +2,15 @@ if not config.xmas or config.xmas==0 then return nil end
local gifts = { local gifts = {
e2 = { e2 = {
{ year = 2015, turn = 959, item = 'snowglobe', msg='santa_f' }, [1057] = { year = 2017, item = 'snowglobe', msg='santa_f' },
{ year = 2009, turn = 624, item = 'xmastree' }, [959] = { year = 2015, item = 'snowglobe', msg='santa_f' },
{ year = 2006, turn = 468, key = 'xm06', item = 'snowman' }, [624] = { year = 2009, item = 'xmastree', msg='santa_m' },
{ year = 2005, turn = 416, key = 'xm05', item = 'stardust' }, [468] = { year = 2006, item = 'snowman', msg='santa_m' },
{ year = 2004, turn = 364, key = 'xm04', item = 'speedsail' } [416] = { year = 2005, item = 'stardust' },
[364] = { year = 2004, item = 'speedsail' }
}, },
e3 = { e3 = {
-- { year = 2015, turn = 338, item = 'snowglobe' }, [26] = { year = 2009, item = 'xmastree' }
{ year = 2009, turn = 26, key = 'xm09', item = 'xmastree' }
} }
} }
@ -37,13 +37,9 @@ function self.init()
local turn = get_turn() local turn = get_turn()
local tbl = gifts[config.rules] local tbl = gifts[config.rules]
if tbl then if tbl then
for _, gift in ipairs(tbl) do gift = tbl[turn]
if turn == gift.turn then if gift then
give_gifts(gift) give_gifts(gift)
elseif gift.key and not get_key(gift.key) then
give_gifts(gift)
set_key(gift.key)
end
end end
end end
end end