summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2019-08-26 12:54:18 -0300
committerJesusaves <cpntb1@ymail.com>2019-08-26 12:54:18 -0300
commit937922483e45c64536a1986779eee5a7b0b88fa2 (patch)
tree6f4c6e3e97797f4eb25ecf724c260de42b6409c7
parent9b4d09b1620915f3f105f6d9b5e1e1c7d99f4efc (diff)
downloadserverdata-937922483e45c64536a1986779eee5a7b0b88fa2.tar.gz
serverdata-937922483e45c64536a1986779eee5a7b0b88fa2.tar.bz2
serverdata-937922483e45c64536a1986779eee5a7b0b88fa2.tar.xz
serverdata-937922483e45c64536a1986779eee5a7b0b88fa2.zip
Conduct elections :>
Mayor will be reelected if nobody runs for the office. But they are not automatically candidate, meaning they lose the office if someone else runs and gets zero votes.
-rw-r--r--npc/003-3/malindou.txt6
-rw-r--r--npc/functions/politics.txt38
2 files changed, 41 insertions, 3 deletions
diff --git a/npc/003-3/malindou.txt b/npc/003-3/malindou.txt
index 952ba67a8..a27b8cf4d 100644
--- a/npc/003-3/malindou.txt
+++ b/npc/003-3/malindou.txt
@@ -429,17 +429,17 @@ OnInit:
// $LOC_REPUTATION - Town reputation. Affects Max Tax and Weekly Income.
// Tulim
- $TULIM_MAYOR$="Saulc";
+ $TULIM_MAYOR$="Saulc GM";
$TULIM_TAX=100;
$TULIM_EXPORT=10000;
$TULIM_REPUTATION=50;
// Halin
- $HALIN_MAYOR$="Saulc";
+ $HALIN_MAYOR$="Saulc GM";
$HALIN_TAX=100;
$HALIN_EXPORT=1000;
$HALIN_REPUTATION=50;
// Hurns
- $HURNS_MAYOR$="Saulc";
+ $HURNS_MAYOR$="Saulc GM";
$HURNS_TAX=100;
$HURNS_EXPORT=3000;
$HURNS_REPUTATION=50;
diff --git a/npc/functions/politics.txt b/npc/functions/politics.txt
index 9349a6990..3d21d313d 100644
--- a/npc/functions/politics.txt
+++ b/npc/functions/politics.txt
@@ -20,6 +20,10 @@
// $LOC_EXPORT - Defines how much Hurnscald exports (weekly income)
// $LOC_REPUTATION - Town reputation. Affects Max Tax and Weekly Income;
// Note: Tax cannot exceed 10% ie 1000. Reputation must be between 0 and 100.
+//
+// "Temporary Arrays":
+// $LOC_CANDIDATE$ - Candidate for Office
+// $LOC_VOTES - Number of votes of Candidate
// Proccess Taxes from purchases
// PurchaseTaxes( Location )
@@ -83,7 +87,41 @@ OnSun0000:
rodex_sendmail(gf_charnameid($FROSTIA_MAYOR$), "Frostia Townhall", "Term Income", "You've received the money for the term.", .@tax);
// Conduct elections
+ .@w=array_highest($TULIM_VOTES);
+ if ($TULIM_CANDIDATE$[.@w] != "")
+ $TULIM_MAYOR$=$TULIM_CANDIDATE$[.@w];
+ deletearray($TULIM_CANDIDATE$);
+ deletearray($TULIM_VOTES);
+ .@w=array_highest($HALIN_VOTES);
+ if ($HALIN_CANDIDATE$[.@w] != "")
+ $HALIN_MAYOR$=$HALIN_CANDIDATE$[.@w];
+ deletearray($HALIN_CANDIDATE$);
+ deletearray($HALIN_VOTES);
+
+ .@w=array_highest($HURNS_VOTES);
+ if ($HURNS_CANDIDATE$[.@w] != "")
+ $HURNS_MAYOR$=$HURNS_CANDIDATE$[.@w];
+ deletearray($HURNS_CANDIDATE$);
+ deletearray($HURNS_VOTES);
+
+ .@w=array_highest($LOF_VOTES);
+ if ($LOF_CANDIDATE$[.@w] != "")
+ $LOF_MAYOR$=$LOF_CANDIDATE$[.@w];
+ deletearray($LOF_CANDIDATE$);
+ deletearray($LOF_VOTES);
+
+ .@w=array_highest($NIVAL_VOTES);
+ if ($NIVAL_CANDIDATE$[.@w] != "")
+ $NIVAL_MAYOR$=$NIVAL_CANDIDATE$[.@w];
+ deletearray($NIVAL_CANDIDATE$);
+ deletearray($NIVAL_VOTES);
+
+ .@w=array_highest($FROSTIA_VOTES);
+ if ($FROSTIA_CANDIDATE$[.@w] != "")
+ $FROSTIA_MAYOR$=$FROSTIA_CANDIDATE$[.@w];
+ deletearray($FROSTIA_CANDIDATE$);
+ deletearray($FROSTIA_VOTES);
end;
}