RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

[RunUO 2.0 RC1] NPC Sales Tax

Joeku

Lord
[RunUO 2.0 RC1] NPC Sales Tax

Code:
/**************************************
*Script Name: NPC Sales Tax          *
*Author: Joeku AKA Demortris          *
*For use with RunUO 2.0              *
*Client Tested with: 5.0.7.1          *
*Version: 1.02                        *
*Initial Release: 01/06/07            *
*Revision Date: 01/06/07              *
**************************************/
Changelog
  • Version 1.0 January 6, 2007: Initial release.
  • Version 1.0 -> 1.01 Post #6 January 6, 2007: Forgot to upload the modified TownRegion.cs :eek:
  • Version 1.01 -> 1.02 Post #18 January 7, 2007: Accidentally uploaded a modified BaseVendor.cs :(
Description

Fun little script that lets you apply sales tax to NPC vendors in any town region. Easily customizable for your own preferred tax values, or even your own custom map.

Features
  • Easily customizable.
  • Full console readout upon load.
Installation

Drop the contents of the "Distros" folder into your Scripts folder. The distro files consist of: BaseVendor.cs, TownRegion.cs. Put Taxes.xml in your Data folder. Put the rest of the files in your custom scripts folder. Recompile and enjoy!
If you want to edit the tax values, or change it for your custom map, see the tutorial HERE.

Future Plans
  • Active XML reading (ability to change tax values in XML files and not have to recompile).
Thank you for using this script, I hope you enjoy it!
 

Attachments

  • NPC Sales Tax.zip
    12.2 KB · Views: 364

Pyro-Tech

Knight
Great idea....allows for some reason to travel to various towns.

and double brownie points on the custom map configurability! :D
 

Griswold76

Wanderer
im getting 2 errors

RunUO - [www.runuo.com] Version 2.0, Build 2357.32527
Core: Running on .NET Framework Version 2.0.50727
Scripts: Compiling C# scripts...failed (2 errors, 0 warnings)
Errors:
+ Customs Scripts/SalesTaxMain.cs:
CS0117: Line 91: 'Server.Regions.TownRegion' does not contain a definition f
or 'Tax'
+ Mobiles/Vendors/BaseVendor.cs:
CS0117: Line 78: 'Server.Regions.TownRegion' does not contain a definition f
or 'Tax'
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.
 

Joeku

Lord
My pleasure, boys :)
Griswold76;631178 said:
im getting 2 errors

RunUO - [www.runuo.com] Version 2.0, Build 2357.32527
Core: Running on .NET Framework Version 2.0.50727
Scripts: Compiling C# scripts...failed (2 errors, 0 warnings)
Errors:
+ Customs Scripts/SalesTaxMain.cs:
CS0117: Line 91: 'Server.Regions.TownRegion' does not contain a definition f
or 'Tax'
+ Mobiles/Vendors/BaseVendor.cs:
CS0117: Line 78: 'Server.Regions.TownRegion' does not contain a definition f
or 'Tax'
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.
Version 1.0 -> 1.01 January 6, 2006 - Forgot to upload the modified TownRegion.cs :eek:
 
this is a great idea!!!! i will be installing it over the next few days

with the race towns i have coming in soon - this will be a nice addition so they can charge "less tax" to their fellow racemen (is that a word lol) with out having to make up a bunch of race vendors with different pricing

by the way - does it also "tax" them on items they sell to the vendors?
 

Joeku

Lord
Edit Tutorial

This short explanation will hopefully help you guys understand how XML works so you can tailor this to your own shard :)

Editing Taxes
  1. You need to open the Taxes.xml file in your Data folder. Internet Explorer is set to open it by default, but to edit it you'll need to right-click the file and select "Edit".
  2. The default file is seen here:
    Code:
    <?xml version="1.0" encoding="utf-8" ?>
    
    <!-- /**************************************
         *Script Name: NPC Sales Tax           *
         *Author: Joeku AKA Demortris          *
         *For use with RunUO 2.0               *
         *Client Tested with: 5.0.7.1          *
         *Version: 1.01                        *
         *Initial Release: 01/06/06            *
         *Revision Date: 01/06/06              *
         **************************************/ -->
    
    <!-- Taxes can only be applied to Town regions.
         The names of the towns MUST be spelled EXACTLY
         how they are spelled in the Regions.xml file,
         otherwise it WON'T WORK.                   -->
    
    <Taxes>
    	<Facet name="Felucca">
    		<Town name="Britain"           tax="20"/>
    		<Town name="Cove"              tax="8" />
    		<Town name="Jhelom"            tax="8" />
    		<Town name="Minoc"             tax="13"/>
    		<Town name="Ocllo"             tax="5" />
    		<Town name="Trinsic"           tax="15"/>
    		<Town name="Vesper"            tax="12"/>
    		<Town name="Yew"               tax="10"/>
    		<Town name="Wind"              tax="7" />
    		<Town name="Serpent's Hold"    tax="0" />
    		<Town name="Skara Brae"        tax="8" />
    		<Town name="Nujel'm"           tax="5" />
    		<Town name="Moonglow"          tax="12"/>
    		<Town name="Magincia"          tax="12"/>
    		<Town name="Buccaneer's Den"   tax="0" />
    	</Facet>
    	<Facet name="Trammel">
    		<Town name="Britain"           tax="20"/>
    		<Town name="Cove"              tax="8" />
    		<Town name="Jhelom"            tax="8" />
    		<Town name="Minoc"             tax="13"/>
    		<Town name="Ocllo"             tax="5" />
    		<Town name="Trinsic"           tax="15"/>
    		<Town name="Vesper"            tax="12"/>
    		<Town name="Yew"               tax="10"/>
    		<Town name="Wind"              tax="7" />
    		<Town name="Serpent's Hold"    tax="0" />
    		<Town name="Skara Brae"        tax="8" />
    		<Town name="Nujel'm"           tax="5" />
    		<Town name="Moonglow"          tax="12"/>
    		<Town name="Magincia"          tax="12"/>
    		<Town name="Buccaneer's Den"   tax="0" />
    	</Facet>
    	<Facet name="Ilshenar">
    		<Town name="Gargoyle City"     tax="10"/>
    		<Town name="Lenmir Anfinmotas" tax="10"/>
    		<Town name="Reg Volon"         tax="10"/>
    		<Town name="Lake Shire"        tax="10"/>
    		<Town name="Bet-Lem Reg"       tax="10"/>
    		<Town name="Mistas"            tax="10"/>
    	</Facet>
    	<Facet name="Malas">
    		<Town name="Luna"              tax="15"/>
    		<Town name="Umbra"             tax="15"/>
    	</Facet>
    	<Facet name="Tokuno">
    		<Town name="Zento"             tax="15"/>
    	</Facet>
    </Taxes>
    As you can plainly see, this is cascaded for easy organization.
  3. To edit the tax for Britain in Felucca, first find the Felucca Facet node:
    Code:
    <Facet name="Felucca">
    	<Town name="Britain"           tax="20"/>
    	<Town name="Cove"              tax="8" />
    	<Town name="Jhelom"            tax="8" />
    	<Town name="Minoc"             tax="13"/>
    	<Town name="Ocllo"             tax="5" />
    	<Town name="Trinsic"           tax="15"/>
    	<Town name="Vesper"            tax="12"/>
    	<Town name="Yew"               tax="10"/>
    	<Town name="Wind"              tax="7" />
    	<Town name="Serpent's Hold"    tax="0" />
    	<Town name="Skara Brae"        tax="8" />
    	<Town name="Nujel'm"           tax="5" />
    	<Town name="Moonglow"          tax="12"/>
    	<Town name="Magincia"          tax="12"/>
    	<Town name="Buccaneer's Den"   tax="0" />
    </Facet>
    Then, just change the tax percentage inside the "Britain" Town sub-node:
    Code:
    <Town name="Britain"           tax="[COLOR="blue"]20[/COLOR]"/>
    To whatever you desire.
  4. Save and close the Taxes.xml file. Recompile your shard to activate the changes.
Editing Regions (for custom maps)
  1. First, follow steps 1 and 2 in the "Editing Taxes" tutorial. Unless you have ripped apart the core and all other files in the server to reflect your actual custom map name, you will still use the default map names in this system (i.e. if you have replaced Felucca with your own custom map, you still use "Felucca" when accessing the regions within).
  2. My custom map replaces Malas, so I'm going to find the Malas Facet node:
    Code:
    <Facet name="Malas">
    	<Town name="Luna"              tax="15"/>
    	<Town name="Umbra"             tax="15"/>
    </Facet>
    And edit/add to it:
    Code:
    <Facet name="Malas">
    	<Town name="Zamora"              tax="20"/>
    	<Town name="Port Shem"             tax="15"/>
    	<Town name="Volcanite"             tax="10"/>
    </Facet>
 
thanks for the little tutorial - that explains some of the other questions i was going to ask

1 other question though - does it work with towns only, or will it work with any region? like dungeons or regions in a box regions?
 

Grimklash

Wanderer
Nice script Joeku.

Heres an idea maybe make it where if not enough taxes collected from the npc vendors slowly the guards and other shop npcs despawn in that region.Then the town starts getting over ran by say forest spawn and monsters until players start buying stuff again to repopulate citizens of the town. Could be a mini gold sink kind of thing and give a reason for town use more.
 

Joeku

Lord
Lord_Greywolf;631272 said:
1 other question though - does it work with towns only, or will it work with any region? like dungeons or regions in a box regions?
It only works with town regions, but if you want to edit the core you can make it work with all regions ;)
It's actually a really easy edit, not nearly as ominous as it sounds *lol*
If you want to, PM me and I'll show you how.
Grimklash;631273 said:
Nice script Joeku.

Heres an idea maybe make it where if not enough taxes collected from the npc vendors slowly the guards and other shop npcs despawn in that region.Then the town starts getting over ran by say forest spawn and monsters until players start buying stuff again to repopulate citizens of the town. Could be a mini gold sink kind of thing and give a reason for town use more.
Thanks :)
It might seem kind of selfish of me, but I only make stuff that I'm actually going to use. It's a neat idea but... it'd take a lot of work and, frankly, I wouldn't use it. It would only be good for a shard with a reasonable playerbase (most of them don't even grab scripts off of these forums...)
 

milvaen

Wanderer
but :(

Code:
Errors:
 + Mobiles/Vendors/BaseVendor.cs:
    CS0246: Line 985: The type or namespace name 'GoldLedger' could not be found
 (are you missing a using directive or an assembly reference?)
    CS0246: Line 986: The type or namespace name 'GoldLedger' could not be found
 (are you missing a using directive or an assembly reference?)
    CS0246: Line 986: The type or namespace name 'GoldLedger' could not be found
 (are you missing a using directive or an assembly reference?)
 

Asmir3

Sorceror
I download the script adn upload and tryed it and got this error
Code:
Errors:
 + Mobiles/Vendors/GenericBuy.cs:
    CS0535: Line 9: 'Server.Mobiles.GenericBuyInfo' does not implement interface
 member 'Server.IBuyItemInfo.GetObject()'
Hope u can fix it thx
 
Top