From 937922483e45c64536a1986779eee5a7b0b88fa2 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Mon, 26 Aug 2019 12:54:18 -0300 Subject: 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. --- npc/functions/politics.txt | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'npc/functions') 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; } -- cgit v1.2.3-70-g09d2