forked from townforge/townforge
37 lines
1.2 KiB
HCL
37 lines
1.2 KiB
HCL
script {
|
|
name "Ragnar's raids - Dividing the plunder"
|
|
description "Get your share of the plunder from the recent raid"
|
|
owner 0
|
|
precondition global "ragnar_raids_plunder_ready" == 1
|
|
precondition player "ragnar_raids_gold" > 0
|
|
|
|
state "init" {
|
|
init {
|
|
if (global "ragnar_raids_gold" > 0) {
|
|
set local "share" global "ragnar_raids_plunder" * player "ragnar_raids_gold" / global "ragnar_raids_gold"
|
|
set player "ragnar_raids_gold" 0
|
|
}
|
|
}
|
|
choice {
|
|
enabled local "share" == 0 and global "ragnar_raids_plunder" == 0
|
|
text "The raiding party came back empty handed, there is no plunder to share."
|
|
}
|
|
choice {
|
|
enabled local "share" == 0 and global "ragnar_raids_gold" > 0
|
|
text "Your share is zero. You either did not contribute enough, or the plunder was very meager, or both."
|
|
}
|
|
choice {
|
|
enabled global "ragnar_raids_gold" == 0
|
|
text "The flotilla came back empty handed, so there no plunder to share."
|
|
}
|
|
choice {
|
|
enabled local "share" > 0
|
|
text "Your share of the plunder is ${gold:share} gold"
|
|
actions {
|
|
award gold local "share"
|
|
set player "ragnar_raids_gold" 0
|
|
}
|
|
}
|
|
}
|
|
}
|