summaryrefslogtreecommitdiff
path: root/npc/functions/politics.txt
diff options
context:
space:
mode:
Diffstat (limited to 'npc/functions/politics.txt')
-rw-r--r--npc/functions/politics.txt45
1 files changed, 45 insertions, 0 deletions
diff --git a/npc/functions/politics.txt b/npc/functions/politics.txt
index 19fdcda81..b3eeb209f 100644
--- a/npc/functions/politics.txt
+++ b/npc/functions/politics.txt
@@ -94,6 +94,51 @@ function script POL_LocToTP {
return Exception("Invalid town requested / POL_LocToTP", RB_DEFAULT|RB_SPEECH, -1);
}
+// Adjusts prices for crafts
+// POL_AdjustPrice( price, {TOWNCODE} )
+function script POL_AdjustPrice {
+ .@p=getarg(0);
+ .@l$=getarg(1, LOCATION$);
+
+ // Town Admin is always tax exempt
+ if (getd(.@l$ + "_MAYOR$") == strcharinfo(0))
+ .@p=0;
+
+ // Town option for tax immunity
+ if (getd(.@l$ + "_TAXOFF")) {
+ .@vat=getd("$"+.@l$+"_TAX");
+ .@tax=.@p*.@vat/10000;
+ .@p-=.@tax;
+ }
+
+ // Return adjusted price
+ return .@p;
+}
+
+// Change a town money at player expense
+// POL_PlayerMoney( price, {TOWNCODE} )
+function script POL_PlayerMoney {
+ .@p=getarg(0);
+ .@l$=getarg(1, LOCATION$);
+ .@t=POL_LocToTP(.@l$);
+
+ Zeny-=.@p;
+
+ // Town option for tax immunity
+ if (getd(.@l$ + "_TAXOFF")) {
+ return 0;
+ }
+
+ // Calculate tax and add to town vault
+ .@vat=getd("$"+.@l$+"_TAX");
+ .@tax=.@p*.@vat/10000;
+ .@GP=getd("$"+getarg(0)+"_MONEY");
+ setd(.@town$+"_MONEY", .@GP+.@tax);
+
+ // Return the taxes paid
+ return .@tax;
+}
+
- script Politics NPC_HIDDEN,{
OnSun0000: