forked from townforge/townforge
401 lines
17 KiB
HCL
401 lines
17 KiB
HCL
script {
|
|
name "Ragnar's raids - Preparation"
|
|
description "Preparations are made for the next raid. Enlist to gather plunder!"
|
|
owner 0
|
|
precondition global "ragnar_raids_enabled" != 0
|
|
precondition (global "ragnar_raids_preparation_start_height" > 0 and blockchain height >= global "ragnar_raids_preparation_start_height")
|
|
OR (global "ragnar_raids_preparation_start_height" == 0 and global "ragnar_raids_set_sail_height" > 0 and blockchain height < global "ragnar_raids_set_sail_height")
|
|
|
|
overrides {
|
|
1 "The fleet is now preparing, and needs gold, labour, wood and food before it is ready to set sail."
|
|
2 "The fleet now has finished preparations, though you can still pledge needs gold, labour, wood and food. It will set sail soon."
|
|
|
|
3 "You can pledge the following from your current inventory:
|
|
|
|
${gold:cur_gold} gold
|
|
${local cur_labour} labour
|
|
${local cur_wood} pine wood
|
|
${local cur_grain} grain
|
|
${local cur_meat} meat
|
|
${local cur_salted_meat} salted meat
|
|
|
|
Fish and vegetables spoil too fast and are unsuitable for the expedition.
|
|
|
|
Your inventory is read at the time of the last script state change.
|
|
If it is out of date, you can select \"I'm done\" and run it again.
|
|
Pledging anything will also cause a state change and refresh your inventory.
|
|
"
|
|
4 "The fleet has now sailed, it is too late to pledge any further resources."
|
|
|
|
local "min_gold" 2500000000
|
|
local "min_labour" 25000
|
|
local "min_wood" 20000
|
|
local "min_food" 20000
|
|
}
|
|
|
|
procedure "check_ready" {
|
|
if (global "ragnar_raids_gold" >= local "min_gold" and global "ragnar_raids_labour" >= local "min_labour" and global "ragnar_raids_wood" >= local "min_wood" and global "ragnar_raids_food" >= local "min_food" and global "ragnar_raids_preparation_start_height" > 0) {
|
|
set global "ragnar_raids_preparation_start_height" 0
|
|
set global "ragnar_raids_set_sail_height" blockchain height
|
|
start background script global "ragnar_raids_raiding_script_id"
|
|
}
|
|
}
|
|
|
|
state "init" {
|
|
init {
|
|
set local "cur_gold" gold
|
|
set local "cur_labour" player item 256
|
|
set local "cur_wood" player item 4
|
|
set local "cur_grain" player item 1025
|
|
set local "cur_meat" player item 1026
|
|
set local "cur_salted_meat" player item 1027
|
|
if (global "ragnar_raids_preparation_start_height" == 0) {
|
|
set local "intro_index" 2
|
|
} else {
|
|
set local "intro_index" 1
|
|
}
|
|
if (global "ragnar_raids_preparation_start_height" == 0 and blockchain height >= global "ragnar_raids_set_sail_height") {
|
|
set local "pledge_index" 4
|
|
} else {
|
|
set local "pledge_index" 3
|
|
}
|
|
}
|
|
text "${${intro_index}}
|
|
|
|
You have currently pledged:
|
|
${gold:player ragnar_raids_gold} gold
|
|
${player ragnar_raids_labour} labour
|
|
${player ragnar_raids_wood} wood
|
|
${player ragnar_raids_food} food
|
|
|
|
The more gold you pledge, the more of the plunder you will receive.
|
|
The more gold and wood, the larger the size of the raiding fleet.
|
|
The larger the size of the raiding fkeet, the more plunder it can carry.
|
|
The more labour, wood and gold, the stronger the raiding party.
|
|
The stronger the raiding party, the more food needed.
|
|
|
|
Current total pledged by all:
|
|
${gold:global ragnar_raids_gold} gold
|
|
${global ragnar_raids_labour} labour
|
|
${global ragnar_raids_wood} wood
|
|
${global ragnar_raids_food} food
|
|
|
|
The raid needs at least the following total resources to be pleged before starting:
|
|
|
|
${gold:min_gold} gold
|
|
${min_labour} labour
|
|
${min_wood} wood
|
|
${min_food} food
|
|
|
|
${${pledge_index}}
|
|
"
|
|
|
|
choice {
|
|
enabled gold >= 1.0 and (global "ragnar_raids_preparation_start_height" > 0 or blockchain height < global "ragnar_raids_set_sail_height")
|
|
text "Pledge 1 more gold"
|
|
reserves { player gold 1.0 }
|
|
actions {
|
|
pay gold 1.0
|
|
set player "ragnar_raids_gold" player "ragnar_raids_gold" + 1.0
|
|
set global "ragnar_raids_gold" global "ragnar_raids_gold" + 1.0
|
|
call "check_ready"
|
|
}
|
|
next state "init"
|
|
}
|
|
choice {
|
|
enabled gold >= 5.0 and (global "ragnar_raids_preparation_start_height" > 0 or blockchain height < global "ragnar_raids_set_sail_height")
|
|
text "Pledge 5 more gold"
|
|
reserves { player gold 5.0 }
|
|
actions {
|
|
pay gold 5.0
|
|
set player "ragnar_raids_gold" player "ragnar_raids_gold" + 5.0
|
|
set global "ragnar_raids_gold" global "ragnar_raids_gold" + 5.0
|
|
call "check_ready"
|
|
}
|
|
next state "init"
|
|
}
|
|
choice {
|
|
enabled gold >= 25.0 and (global "ragnar_raids_preparation_start_height" > 0 or blockchain height < global "ragnar_raids_set_sail_height")
|
|
text "Pledge 25 more gold"
|
|
reserves { player gold 25.0 }
|
|
actions {
|
|
pay gold 25.0
|
|
set player "ragnar_raids_gold" player "ragnar_raids_gold" + 25.0
|
|
set global "ragnar_raids_gold" global "ragnar_raids_gold" + 25.0
|
|
call "check_ready"
|
|
}
|
|
next state "init"
|
|
}
|
|
choice {
|
|
enabled gold >= 100.0 and (global "ragnar_raids_preparation_start_height" > 0 or blockchain height < global "ragnar_raids_set_sail_height")
|
|
text "Pledge 100 more gold"
|
|
reserves { player gold 100.0 }
|
|
actions {
|
|
pay gold 100.0
|
|
set player "ragnar_raids_gold" player "ragnar_raids_gold" + 100.0
|
|
set global "ragnar_raids_gold" global "ragnar_raids_gold" + 100.0
|
|
call "check_ready"
|
|
}
|
|
next state "init"
|
|
}
|
|
choice {
|
|
enabled player item 256 >= 100 and (global "ragnar_raids_preparation_start_height" > 0 or blockchain height < global "ragnar_raids_set_sail_height")
|
|
text "Pledge 100 more labour"
|
|
reserves { player item 256 100 }
|
|
actions {
|
|
consume item 256 100 # labour
|
|
set player "ragnar_raids_labour" player "ragnar_raids_labour" + 100
|
|
set global "ragnar_raids_labour" global "ragnar_raids_labour" + 100
|
|
call "check_ready"
|
|
}
|
|
next state "init"
|
|
}
|
|
choice {
|
|
enabled player item 256 >= 1000 and (global "ragnar_raids_preparation_start_height" > 0 or blockchain height < global "ragnar_raids_set_sail_height")
|
|
text "Pledge 1000 more labour"
|
|
reserves { player item 256 1000 }
|
|
actions {
|
|
consume item 256 1000 # labour
|
|
set player "ragnar_raids_labour" player "ragnar_raids_labour" + 1000
|
|
set global "ragnar_raids_labour" global "ragnar_raids_labour" + 1000
|
|
call "check_ready"
|
|
}
|
|
next state "init"
|
|
}
|
|
choice {
|
|
enabled player item 256 >= 10000 and (global "ragnar_raids_preparation_start_height" > 0 or blockchain height < global "ragnar_raids_set_sail_height")
|
|
text "Pledge 10000 more labour"
|
|
reserves { player item 256 10000 }
|
|
actions {
|
|
consume item 256 10000 # labour
|
|
set player "ragnar_raids_labour" player "ragnar_raids_labour" + 10000
|
|
set global "ragnar_raids_labour" global "ragnar_raids_labour" + 10000
|
|
call "check_ready"
|
|
}
|
|
next state "init"
|
|
}
|
|
choice {
|
|
enabled player item 256 >= 50000 and (global "ragnar_raids_preparation_start_height" > 0 or blockchain height < global "ragnar_raids_set_sail_height")
|
|
text "Pledge 50000 more labour"
|
|
reserves { player item 256 50000 }
|
|
actions {
|
|
consume item 256 50000 # labour
|
|
set player "ragnar_raids_labour" player "ragnar_raids_labour" + 50000
|
|
set global "ragnar_raids_labour" global "ragnar_raids_labour" + 50000
|
|
call "check_ready"
|
|
}
|
|
next state "init"
|
|
}
|
|
choice {
|
|
enabled player item 4 >= 100 and (global "ragnar_raids_preparation_start_height" > 0 or blockchain height < global "ragnar_raids_set_sail_height")
|
|
text "Pledge 100 more pine wood"
|
|
reserves { player item 4 100 }
|
|
actions {
|
|
consume item 4 100 # wood
|
|
set player "ragnar_raids_wood" player "ragnar_raids_wood" + 100
|
|
set global "ragnar_raids_wood" global "ragnar_raids_wood" + 100
|
|
call "check_ready"
|
|
}
|
|
next state "init"
|
|
}
|
|
choice {
|
|
enabled player item 4 >= 1000 and (global "ragnar_raids_preparation_start_height" > 0 or blockchain height < global "ragnar_raids_set_sail_height")
|
|
text "Pledge 1000 more pine wood"
|
|
reserves { player item 4 1000 }
|
|
actions {
|
|
consume item 4 1000 # wood
|
|
set player "ragnar_raids_wood" player "ragnar_raids_wood" + 1000
|
|
set global "ragnar_raids_wood" global "ragnar_raids_wood" + 1000
|
|
call "check_ready"
|
|
}
|
|
next state "init"
|
|
}
|
|
choice {
|
|
enabled player item 4 >= 10000 and (global "ragnar_raids_preparation_start_height" > 0 or blockchain height < global "ragnar_raids_set_sail_height")
|
|
text "Pledge 10000 more pine wood"
|
|
reserves { player item 4 10000 }
|
|
actions {
|
|
consume item 4 10000 # wood
|
|
set player "ragnar_raids_wood" player "ragnar_raids_wood" + 10000
|
|
set global "ragnar_raids_wood" global "ragnar_raids_wood" + 10000
|
|
call "check_ready"
|
|
}
|
|
next state "init"
|
|
}
|
|
choice {
|
|
enabled player item 4 >= 50000 and (global "ragnar_raids_preparation_start_height" > 0 or blockchain height < global "ragnar_raids_set_sail_height")
|
|
text "Pledge 50000 more pine wood"
|
|
reserves { player item 4 50000 }
|
|
actions {
|
|
consume item 4 50000 # wood
|
|
set player "ragnar_raids_wood" player "ragnar_raids_wood" + 50000
|
|
set global "ragnar_raids_wood" global "ragnar_raids_wood" + 50000
|
|
call "check_ready"
|
|
}
|
|
next state "init"
|
|
}
|
|
choice {
|
|
enabled player item 1025 >= 100 and (global "ragnar_raids_preparation_start_height" > 0 or blockchain height < global "ragnar_raids_set_sail_height")
|
|
text "Pledge 100 more grain (200 food)"
|
|
reserves { player item 1025 100 }
|
|
actions {
|
|
consume item 1025 100 # grain
|
|
set player "ragnar_raids_food" player "ragnar_raids_food" + 100 * 2 # assumes 2 food points for grain
|
|
set global "ragnar_raids_food" global "ragnar_raids_food" + 100 * 2
|
|
call "check_ready"
|
|
}
|
|
next state "init"
|
|
}
|
|
choice {
|
|
enabled player item 1025 >= 1000 and (global "ragnar_raids_preparation_start_height" > 0 or blockchain height < global "ragnar_raids_set_sail_height")
|
|
text "Pledge 1000 more grain (2000 food)"
|
|
reserves { player item 1025 1000 }
|
|
actions {
|
|
consume item 1025 1000 # grain
|
|
set player "ragnar_raids_food" player "ragnar_raids_food" + 1000 * 2 # assumes 2 food points for grain
|
|
set global "ragnar_raids_food" global "ragnar_raids_food" + 1000 * 2
|
|
call "check_ready"
|
|
}
|
|
next state "init"
|
|
}
|
|
choice {
|
|
enabled player item 1025 >= 5000 and (global "ragnar_raids_preparation_start_height" > 0 or blockchain height < global "ragnar_raids_set_sail_height")
|
|
text "Pledge 5000 more grain (10000 food)"
|
|
reserves { player item 1025 5000 }
|
|
actions {
|
|
consume item 1025 5000 # grain
|
|
set player "ragnar_raids_food" player "ragnar_raids_food" + 5000 * 2 # assumes 2 food points for grain
|
|
set global "ragnar_raids_food" global "ragnar_raids_food" + 5000 * 2
|
|
call "check_ready"
|
|
}
|
|
next state "init"
|
|
}
|
|
choice {
|
|
enabled player item 1025 >= 25000 and (global "ragnar_raids_preparation_start_height" > 0 or blockchain height < global "ragnar_raids_set_sail_height")
|
|
text "Pledge 25000 more grain (50000 food)"
|
|
reserves { player item 1025 25000 }
|
|
actions {
|
|
consume item 1025 25000 # grain
|
|
set player "ragnar_raids_food" player "ragnar_raids_food" + 25000 * 2 # assumes 2 food points for grain
|
|
set global "ragnar_raids_food" global "ragnar_raids_food" + 25000 * 2
|
|
call "check_ready"
|
|
}
|
|
next state "init"
|
|
}
|
|
choice {
|
|
enabled player item 1026 >= 25 and (global "ragnar_raids_preparation_start_height" > 0 or blockchain height < global "ragnar_raids_set_sail_height")
|
|
text "Pledge 25 more meat (125 food)"
|
|
reserves { player item 1026 25 }
|
|
actions {
|
|
consume item 1026 25 # meat
|
|
set player "ragnar_raids_food" player "ragnar_raids_food" + 25 * 5 # assumes 5 food points for meat
|
|
set global "ragnar_raids_food" global "ragnar_raids_food" + 25 * 5
|
|
call "check_ready"
|
|
}
|
|
next state "init"
|
|
}
|
|
choice {
|
|
enabled player item 1026 >= 100 and (global "ragnar_raids_preparation_start_height" > 0 or blockchain height < global "ragnar_raids_set_sail_height")
|
|
text "Pledge 100 more meat (500 food)"
|
|
reserves { player item 1026 100 }
|
|
actions {
|
|
consume item 1026 100 # meat
|
|
set player "ragnar_raids_food" player "ragnar_raids_food" + 100 * 5 # assumes 5 food points for meat
|
|
set global "ragnar_raids_food" global "ragnar_raids_food" + 100 * 5
|
|
call "check_ready"
|
|
}
|
|
next state "init"
|
|
}
|
|
choice {
|
|
enabled player item 1026 >= 1000 and (global "ragnar_raids_preparation_start_height" > 0 or blockchain height < global "ragnar_raids_set_sail_height")
|
|
text "Pledge 1000 more meat (5000 food)"
|
|
reserves { player item 1026 1000 }
|
|
actions {
|
|
consume item 1026 1000 # meat
|
|
set player "ragnar_raids_food" player "ragnar_raids_food" + 1000 * 5 # assumes 5 food points for meat
|
|
set global "ragnar_raids_food" global "ragnar_raids_food" + 1000 * 5
|
|
call "check_ready"
|
|
}
|
|
next state "init"
|
|
}
|
|
choice {
|
|
enabled player item 1026 >= 5000 and (global "ragnar_raids_preparation_start_height" > 0 or blockchain height < global "ragnar_raids_set_sail_height")
|
|
text "Pledge 5000 more meat (25000 food)"
|
|
reserves { player item 1026 5000 }
|
|
actions {
|
|
consume item 1026 5000 # meat
|
|
set player "ragnar_raids_food" player "ragnar_raids_food" + 5000 * 5 # assumes 5 food points for meat
|
|
set global "ragnar_raids_food" global "ragnar_raids_food" + 5000 * 5
|
|
call "check_ready"
|
|
}
|
|
next state "init"
|
|
}
|
|
choice {
|
|
enabled player item 1027 >= 25 and (global "ragnar_raids_preparation_start_height" > 0 or blockchain height < global "ragnar_raids_set_sail_height")
|
|
text "Pledge 25 more salted meat (125 food)"
|
|
reserves { player item 1027 25 }
|
|
actions {
|
|
consume item 1027 25 # salted meat
|
|
set player "ragnar_raids_food" player "ragnar_raids_food" + 25 * 5 # assumes 5 food points for salted meat
|
|
set global "ragnar_raids_food" global "ragnar_raids_food" + 25 * 5
|
|
call "check_ready"
|
|
}
|
|
next state "init"
|
|
}
|
|
choice {
|
|
enabled player item 1027 >= 100 and (global "ragnar_raids_preparation_start_height" > 0 or blockchain height < global "ragnar_raids_set_sail_height")
|
|
text "Pledge 100 more salted meat (500 food)"
|
|
reserves { player item 1027 100 }
|
|
actions {
|
|
consume item 1027 100 # salted meat
|
|
set player "ragnar_raids_food" player "ragnar_raids_food" + 100 * 5 # assumes 5 food points for salted meat
|
|
set global "ragnar_raids_food" global "ragnar_raids_food" + 100 * 5
|
|
call "check_ready"
|
|
}
|
|
next state "init"
|
|
}
|
|
choice {
|
|
enabled player item 1027 >= 1000 and (global "ragnar_raids_preparation_start_height" > 0 or blockchain height < global "ragnar_raids_set_sail_height")
|
|
text "Pledge 1000 more salted meat (5000 food)"
|
|
reserves { player item 1027 1000 }
|
|
actions {
|
|
consume item 1027 1000 # salted meat
|
|
set player "ragnar_raids_food" player "ragnar_raids_food" + 1000 * 5 # assumes 5 food points for salted meat
|
|
set global "ragnar_raids_food" global "ragnar_raids_food" + 1000 * 5
|
|
call "check_ready"
|
|
}
|
|
next state "init"
|
|
}
|
|
choice {
|
|
enabled player item 1027 >= 5000 and (global "ragnar_raids_preparation_start_height" > 0 or blockchain height < global "ragnar_raids_set_sail_height")
|
|
text "Pledge 5000 more salted meat (25000 food)"
|
|
reserves { player item 1027 5000 }
|
|
actions {
|
|
consume item 1027 5000 # salted meat
|
|
set player "ragnar_raids_food" player "ragnar_raids_food" + 5000 * 5 # assumes 5 food points for salted meat
|
|
set global "ragnar_raids_food" global "ragnar_raids_food" + 5000 * 5
|
|
call "check_ready"
|
|
}
|
|
next state "init"
|
|
}
|
|
choice {
|
|
enabled global "ragnar_raids_preparation_start_height" > 0
|
|
and gold < 1.0
|
|
and player item 4 < 100 # pine
|
|
and player item 256 < 100 # labour
|
|
and player item 1025 < 100 # grain
|
|
and player item 1026 < 25 # meat
|
|
and player item 1027 < 25 # salted meat
|
|
text "You do not have enough gold, labour, pine, grain, meat, nor salted meat to contribute to the next raid."
|
|
}
|
|
choice {
|
|
enabled global "ragnar_raids_preparation_start_height" == 0 and blockchain height >= global "ragnar_raids_set_sail_height"
|
|
text "The raiding party has now set sail."
|
|
}
|
|
choice {
|
|
enabled global "ragnar_raids_preparation_start_height" > 0 or blockchain height < global "ragnar_raids_set_sail_height"
|
|
text "I'm done"
|
|
}
|
|
}
|
|
}
|