summaryrefslogtreecommitdiff
path: root/npc/functions/politics.txt
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2019-09-02 16:58:56 -0300
committerJesusaves <cpntb1@ymail.com>2019-09-02 16:58:56 -0300
commit5994a28a51deb506df694364c275ce25fca6cf03 (patch)
tree337e1c9299cab0d7b7cc27d17d648228db010835 /npc/functions/politics.txt
parent465510eb35a32d065c28e86036ab73dd11a663e7 (diff)
downloadserverdata-5994a28a51deb506df694364c275ce25fca6cf03.tar.gz
serverdata-5994a28a51deb506df694364c275ce25fca6cf03.tar.bz2
serverdata-5994a28a51deb506df694364c275ce25fca6cf03.tar.xz
serverdata-5994a28a51deb506df694364c275ce25fca6cf03.zip
Ask for a tax of 0.05% when selling items
Diffstat (limited to 'npc/functions/politics.txt')
-rw-r--r--npc/functions/politics.txt20
1 files changed, 20 insertions, 0 deletions
diff --git a/npc/functions/politics.txt b/npc/functions/politics.txt
index 322cdb654..1c983e8d9 100644
--- a/npc/functions/politics.txt
+++ b/npc/functions/politics.txt
@@ -44,6 +44,26 @@ function script PurchaseTaxes {
return;
}
+// Proccess Taxes from sales (5% from purchase tax)
+// SaleTaxes( Location )
+function script SaleTaxes {
+ .@tax=0;
+ for (.@i=0; .@i < getarraysize(@sold_nameid); .@i++) {
+ // Note: Some NPC might not
+ .@price=getiteminfo(@sold_nameid[.@i], ITEMINFO_SELLPRICE);
+ .@tax+=.@price*@sold_quantity[.@i];
+ }
+ .@loc$=strtoupper(getarg(0, LOCATION$));
+ .@vat=getd("$"+.@loc$+"_TAX");
+ .@vat=.@vat/20; // Only 5% of purchase tax, this is often 0.05%
+ .@tax=.@tax*.@vat/10000;
+ if (.@tax) {
+ debugmes "Sale: %s paid %d in taxes to %s prefecture!", strcharinfo(0), .@tax, .@loc$;
+ setd("$"+.@loc$+"_TAX", .@vat+.@tax);
+ }
+ return;
+}
+
- script Politics NPC_HIDDEN,{
OnSun0000: