Jump to content
  • 0

How to save taxes as a usable value ?


Exportforce

Question


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  13
  • Reputation:   0
  • Joined:  09/05/13
  • Last Seen:  

Hello,

 

is there any known way to save the taxes done by trades ?

So other scripts can use it ?

 

Reffering to config: vending_tax

 

thanks

Link to comment
Share on other sites

5 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

getbattleflag("vending_tax")

A value of 200 means 2% tax.

Since scripts can only do integer math, you'd have to do something like:

  • multiple price by 100 // this converts dollars to cents
  • subtract (price * vending_tax) // subtract 2% tax
  • divide price by 100 // converts cents back to dollars
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  13
  • Reputation:   0
  • Joined:  09/05/13
  • Last Seen:  

But getbattleflag only telly me the set tax?

What I need is, when someone buys something for 100 Zeny the script should fetch e.g. 2 Zeny and store them. if someone then buys something for 10000 the script adds another 200.

But how do I fetch this value ?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

Are you talking about the vending_tax that is automatically deducted when players buy from vendors ?

--> sorry, that is not saved anywhere. The 2% zeny just "disappears" after the transaction.

But you could modify the source code any maybe store it in a global permanent variable like $tax_collected

Or are you talking about when someone buys something from a NPC or script, you want to deduct and store the 2% tax?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  666
  • Reputation:   93
  • Joined:  04/27/12
  • Last Seen:  

Yea, as Brain is saying, atm it's not possible, you'd need to edit the src code, if your trying to store the tax from a Vending Purchase. However, if your trying to store the tax from a normal NPC purchase, then you'll need to use a Dynamic NPC. You'd first need to use a Dynamic NPC to create the ' tax ' and also store it. At the moment those are your options. But, additionally, you should be able to also edit the src code for a normal NPC, and add a ' tax ' feature. Not exactly sure, what the actual coding to do so is, but the snippet that you need to edit should be here

This is in NPC.C for editing normal NPC sells. Couldn't find the purchase section I might have over looked it lol. Just woke up @.@;

		value = pc_modifysellvalue(sd, sd->inventory_data[idx]->value_sell);

		z+= (double)value*amount;

Now this is for Vening:

	pc_payzeny(sd, (int)z, LOG_TYPE_VENDING, vsd);
	if( battle_config.vending_tax )
		z -= z * (battle_config.vending_tax/10000.);

You'll see here, that it actually, sets your zeny - that tax. So, here is most likely where you'd need to have it store the tax into a var. Not sure how, but Brian.. I'm sure he knows...D:

Edited by GmOcean
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  13
  • Reputation:   0
  • Joined:  09/05/13
  • Last Seen:  

Okay if that is not possible... sad.

Thought, since there is a calculation ,that there are some ways to grab of the ammounts, to have maybe something like a treasure room where all taxes are stored to use them in other ways.

Thanks though :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...