summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2019-11-09 17:09:39 -0300
committerJesusaves <cpntb1@ymail.com>2019-11-09 17:09:39 -0300
commit452ec389bdef2ed6d0e021b32ab9c8cc0d270802 (patch)
treef63e34f239af98a110453a911df5f0a825168793
parentb22f27f610747c7053d692a5afcc39f00b0bc5ac (diff)
downloadserverdata-452ec389bdef2ed6d0e021b32ab9c8cc0d270802.tar.gz
serverdata-452ec389bdef2ed6d0e021b32ab9c8cc0d270802.tar.bz2
serverdata-452ec389bdef2ed6d0e021b32ab9c8cc0d270802.tar.xz
serverdata-452ec389bdef2ed6d0e021b32ab9c8cc0d270802.zip
Function helpers
-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: