diff options
author | Jesusaves <cpntb1@ymail.com> | 2019-09-02 16:58:56 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2019-09-02 16:58:56 -0300 |
commit | 5994a28a51deb506df694364c275ce25fca6cf03 (patch) | |
tree | 337e1c9299cab0d7b7cc27d17d648228db010835 | |
parent | 465510eb35a32d065c28e86036ab73dd11a663e7 (diff) | |
download | serverdata-5994a28a51deb506df694364c275ce25fca6cf03.tar.gz serverdata-5994a28a51deb506df694364c275ce25fca6cf03.tar.bz2 serverdata-5994a28a51deb506df694364c275ce25fca6cf03.tar.xz serverdata-5994a28a51deb506df694364c275ce25fca6cf03.zip |
Ask for a tax of 0.05% when selling items
-rw-r--r-- | npc/012-1/shoppakep.txt | 6 | ||||
-rw-r--r-- | npc/012-2/melina.txt | 5 | ||||
-rw-r--r-- | npc/012-3/alan.txt | 5 | ||||
-rw-r--r-- | npc/012-5/nicholas.txt | 5 | ||||
-rw-r--r-- | npc/functions/politics.txt | 20 |
5 files changed, 41 insertions, 0 deletions
diff --git a/npc/012-1/shoppakep.txt b/npc/012-1/shoppakep.txt index a55e36554..5da112f34 100644 --- a/npc/012-1/shoppakep.txt +++ b/npc/012-1/shoppakep.txt @@ -76,4 +76,10 @@ OnBuyItem: debugmes("Purchase confirmed"); PurchaseTaxes("Hurns"); end; + +OnSellItem: + debugmes("Sale confirmed"); + SaleTaxes("Hurns"); + end; } + diff --git a/npc/012-2/melina.txt b/npc/012-2/melina.txt index 83e78b578..ac183a9a6 100644 --- a/npc/012-2/melina.txt +++ b/npc/012-2/melina.txt @@ -65,4 +65,9 @@ OnBuyItem: PurchaseTaxes("Hurns"); end; +OnSellItem: + debugmes("Sale confirmed"); + SaleTaxes("Hurns"); + end; + } diff --git a/npc/012-3/alan.txt b/npc/012-3/alan.txt index 6ec713590..d25531bbf 100644 --- a/npc/012-3/alan.txt +++ b/npc/012-3/alan.txt @@ -133,4 +133,9 @@ OnBuyItem: PurchaseTaxes("Hurns"); end; +OnSellItem: + debugmes("Sale confirmed"); + SaleTaxes("Hurns"); + end; + } diff --git a/npc/012-5/nicholas.txt b/npc/012-5/nicholas.txt index c6043e786..b1a6073e4 100644 --- a/npc/012-5/nicholas.txt +++ b/npc/012-5/nicholas.txt @@ -253,4 +253,9 @@ OnClock1801: OnBuyItem: PurchaseTaxes("Hurns"); end; + +OnSellItem: + debugmes("Sale confirmed"); + SaleTaxes("Hurns"); + end; } 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: |