summaryrefslogtreecommitdiff
path: root/npc/functions
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 /npc/functions
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.
Diffstat (limited to 'npc/functions')
-rw-r--r--npc/functions/politics.txt38
1 files changed, 38 insertions, 0 deletions
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;
}