summaryrefslogtreecommitdiff
path: root/npc/functions
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2019-08-24 18:09:37 -0300
committerJesusaves <cpntb1@ymail.com>2019-08-24 18:09:37 -0300
commitc87308aaf7173fc86c14ee17265c5cd9b5c95561 (patch)
treec66e2dc071aabdb5462b7d382260770ef02a47fc /npc/functions
parent22d32caa83810d18c64c9b2c6f09acec0f015c97 (diff)
downloadserverdata-c87308aaf7173fc86c14ee17265c5cd9b5c95561.tar.gz
serverdata-c87308aaf7173fc86c14ee17265c5cd9b5c95561.tar.bz2
serverdata-c87308aaf7173fc86c14ee17265c5cd9b5c95561.tar.xz
serverdata-c87308aaf7173fc86c14ee17265c5cd9b5c95561.zip
What's the most important thing in a political system? TAXES, OF COURSE!
Diffstat (limited to 'npc/functions')
-rw-r--r--npc/functions/politics.txt55
1 files changed, 55 insertions, 0 deletions
diff --git a/npc/functions/politics.txt b/npc/functions/politics.txt
new file mode 100644
index 000000000..5a2a40981
--- /dev/null
+++ b/npc/functions/politics.txt
@@ -0,0 +1,55 @@
+// TMW2 Script
+// Author:
+// Jesusalva
+// Description:
+// Central Town Political System Controller
+// Note: The office is NOT Mayor, we have from kings to mayors here and you're
+// not a citzen (yet). It'll be... I'll think in a name better than Minister.
+// NPCs:
+// Tulim -
+// Halin -
+// Hurns - Airlia
+// LoF -
+// Nival -
+// Frostia -
+// Variables:
+// $LOC_MAYOR$ - Stores the name of current Hurnscald Mayor
+// $LOC_MONEY - Total money reserves of Hurnscald
+// $LOC_TAX - How much in % is charged as taxes. (OnBuy income)
+// $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.
+
+// Proccess Taxes from purchases
+// PurchaseTaxes( Location )
+function script PurchaseTaxes {
+ .@tax=0;
+ for (.@i=0; .@i < getarraysize(@bought_nameid); .@i++) {
+ // Note: Some NPC might not
+ .@price=getiteminfo(@bought_nameid[.@i], ITEMINFO_BUYPRICE);
+ .@tax+=.@price*@bought_quantity[.@i];
+ }
+ .@loc$=strtoupper(getarg(0, LOCATION$));
+ .@vat=getd("$"+.@loc$+"_TAX");
+ .@tax=.@tax*.@vat/10000;
+ if (.@tax) {
+ debugmes "%s paid %d in taxes to %s prefecture!", strcharinfo(0), .@tax, .@loc$;
+ setd("$"+.@loc$+"_TAX", .@vat+.@tax);
+ }
+ return;
+}
+
+- script Politics NPC_HIDDEN,{
+
+// Weekly income
+OnSun0000:
+ $TULIM_MONEY+=$TULIM_EXPORT*limit(0, $TULIM_REPUTATION, 100)/100;
+ $HALIN_MONEY+=$HALIN_EXPORT*limit(0, $HALIN_REPUTATION, 100)/100;
+ $HURNS_MONEY+=$HURNS_EXPORT*limit(0, $HURNS_REPUTATION, 100)/100;
+ $LOF_MONEY+=$LOF_EXPORT*limit(0, $LOF_REPUTATION, 100)/100;
+ $NIVAL_MONEY+=$NIVAL_EXPORT*limit(0, $NIVAL_REPUTATION, 100)/100;
+ $FROSTIA_MONEY+=$FROSTIA_EXPORT*limit(0, $FROSTIA_REPUTATION, 100)/100;
+ end;
+
+}
+