summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--npc/012-1/shoppakep.txt4
-rw-r--r--npc/012-2/melina.txt4
-rw-r--r--npc/012-3/alan.txt6
-rw-r--r--npc/012-5/nicholas.txt4
-rw-r--r--npc/functions/politics.txt55
-rw-r--r--npc/scripts.conf1
6 files changed, 74 insertions, 0 deletions
diff --git a/npc/012-1/shoppakep.txt b/npc/012-1/shoppakep.txt
index ee65b7d9b..e8e400c75 100644
--- a/npc/012-1/shoppakep.txt
+++ b/npc/012-1/shoppakep.txt
@@ -69,4 +69,8 @@ OnClock0546:
.CurrentItem=ShoppaKepItem();
sellitem .CurrentItem, -1, rand(1,4);
end;
+// Pay your taxes!
+OnBuyItem:
+ PurchaseTaxes("Hurns");
+ end;
}
diff --git a/npc/012-2/melina.txt b/npc/012-2/melina.txt
index bdb40dbc4..cfb636bf0 100644
--- a/npc/012-2/melina.txt
+++ b/npc/012-2/melina.txt
@@ -59,5 +59,9 @@ OnClock2358:
else
restoreshopitem Beer, 150, ($HELENA_ST/3)+1;
end;
+// Pay your taxes!
+OnBuyItem:
+ PurchaseTaxes("Hurns");
+ end;
}
diff --git a/npc/012-3/alan.txt b/npc/012-3/alan.txt
index 286270e78..e595465d8 100644
--- a/npc/012-3/alan.txt
+++ b/npc/012-3/alan.txt
@@ -125,5 +125,11 @@ OnClock1800:
restoreshopitem CursedArrow, -1, (($ARKIM_ST-1400)/200);
if ($ARKIM_ST > 5600)
restoreshopitem PoisonArrow, -1, (($ARKIM_ST-2800)/200);
+ end;
+
+// Pay your taxes!
+OnBuyItem:
+ PurchaseTaxes("Hurns");
+ end;
}
diff --git a/npc/012-5/nicholas.txt b/npc/012-5/nicholas.txt
index 7ffbd14d5..77e84c06c 100644
--- a/npc/012-5/nicholas.txt
+++ b/npc/012-5/nicholas.txt
@@ -248,4 +248,8 @@ OnClock1801:
restoreshopitem Dagger, 600, 5;
restoreshopitem SharpKnife, 450, 10;
end;
+// Pay your taxes!
+OnBuyItem:
+ PurchaseTaxes("Hurns");
+ end;
}
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;
+
+}
+
diff --git a/npc/scripts.conf b/npc/scripts.conf
index db4c0ca55..2e55710e7 100644
--- a/npc/scripts.conf
+++ b/npc/scripts.conf
@@ -56,6 +56,7 @@
"npc/functions/npcmovegraph.txt",
"npc/functions/nurse.txt",
"npc/functions/petsales.txt",
+"npc/functions/politics.txt",
"npc/functions/refine.txt",
"npc/functions/resetstatus.txt",
"npc/functions/riddle.txt",