tax rate calculator

General Discussion Started Last reply 34 posts
EDIT: go to page 2 for a web based and more efficient version
the program is designed to find the cheapest town to buy an item from by taking into account the different tax rates (for example a crafter wanting to buy 50 million spirit ore to craft SPS)

the program is fully functional but doubt i have the tax calculations right yet so there should be a fair bit of price discrepancy especially on kain who are the only server with aden or rune taxes set below 15%
i will be playing PTS today to see if i can iron out the tax equation and get a beta version happening

until i get something a bit more solid happening feel free to play around with it and tell me how far your results are skewed from what the program out puts
a variation of 1 adena per soul ore should be very common and i would expect a few 2-5 adena mistakes but anyone who isn't on kain should not have anything close to a 10 adena skew
if you manage to get a price difference of over 20 adena please let me know cause that would have to be a programming error

Security Issues
the program is free from virii/spyware/key loggers now but i will be allowing other ppl to modify it freely and i can't speak for the programs security if someone else decides to re write the whole thing and i can't see the source code
if you are concerned about the security of using it and unable to take the appropriate steps to protect yourself i would advise not using it... although i would also advise not using the internet :P

Programming Stuffs
i am in no way a C++ guru, in fact i've only been playing with the stuff for a few hours worth of study
if anyone wants to make fun of my poor coding skills or even give me some tips feel free to do so but i ask you do it in this post here (http://boards.lineage2.com/showflat.php?Cat=0&Number=937670&an=0&page=1#Post9 37670)

there are a few blocks of code which i have blocked out for now until i have the maths fully worked out, if you are reading the source just ignore them, although fully functional i would prefer just a basic output until i have something more solid

Future changes
1. i will be rewriting the code to output the towns in order from cheapest to most expensive. i should be done with that today if i don't get too caught up checking tax rates

3. i will be attempting to GUI'ify the program

2. i will be attempting to code the program to automatically get the tax rates from the L2 castle control page but that will require some java work and since i don't know java don't hold your breath :P
updated
Hehe intresting. You might wanna add spirit ore price as well.


Hehe intresting. You might wanna add spirit ore price as well.



well its just made to show you the town with the lowest price
if soul ore has the lowest price in giran than anything else you want to buy from an NPC will also be cheapest at that town (soes, hp pots, ore, elixers, gemstones etc)
Can you please remove the redirect feature? It is annoying to no end. Like, make the prog start with /q or something...
you mean directing to the castle control map?
or the redirect to the forum?
i could add an option to skip that if you like just clarify what you need done, i figured it might save ppl some trouble clicking links ^^
I mean forum link. At least make it "you wanna be redirected now Y/N". I`m figuring out the results it gave me then all of a sudden window closes and IE opens. WTH :)
hmm the window shouldn't close it should just open the link and switch focus
i could also change it to open in the background or put a longer timer on it....

anyway i rewrote that code as well as a few other changes. i was gonna upload the new version but i nearly have a grip on the final tax equation so i figured i'd hold out for a semi final build

if you know a tiny bit about C++ and have access to a compiler you can just add these 2 things
at the top (above int main)


int yesno;





and replace Shellexecute down the bottom with this


cin >> yesno;
if (yesno == "y")
{
ShellExecute(NULL, "open", "http://boards.lineage2.com/showflat.php?Cat=0&Number=958333&an=0&page=0#Post9 58333", "cd", NULL, SW_SHOW);
}

ok all done
get v1.0 here!!! (http://www.*********.com/?ecv1szd2zhm)

thanks go to Smytem over on lionna server who was not only one of the only ppl to help me gathering tax information he basically gave me the equation on a silver plater!!
and kandlestik over on hindemith server who was the only other guy who managed to find the time to give me info (apologies to those who gave me the incorrect information, since i may have been unclear in my request)
and Arriel for suggesting changes related to functionality

thumbs done to bartz server who were to busy saying "lawl bsoe more" to bother to respond :P


Changes
added options to open the websites for the castle control map and the forums as per Arriel's request

changed output to display towns in order of cheapest to most expensive

modified the town tax equation so results should be completely accurate (rounded down)

More programming stuff
source file still has some redundant code which i may work with later

i don't think the app is cross platform (shellexecute?) so if you want to use it on linux or w/e you are basically SOL until i get some more experience with c++

should be a fair bit of inefficiency in the way i wrote it, particularly the maths since i'm still trying to get a grasp on proper placement of brackets and the like

my indentation sucks, if you arn't happy with it and would like to suggest better ways to write please post here (http://boards.lineage2.com/showflat.php?Cat=0&Number=937670&page=0&fpart=1&vc =1&nt=3)
suggestion: use HTML

suggestion: use HTML



Yeah, it would probably be alot easier to use a web app to do it. It also solves the issues of cross platform programs.


suggestion: use HTML



Yeah, it would probably be alot easier to use a web app to do it. It also solves the issues of cross platform programs.



I would say PHP or JavaServlets
yeah you guys are prolly right
might make a little java thing then maybe hand it over to stratics
I couldn't sleep last night because I was thinking of a way to make a PHP version of the tax calculator and combine it with a craft calculator for shots that will be wery usefull for me as a WS...I have allready made one in Excel.
if you want to try and race me to making a web based version feel free man
the source code is included with the program but i'm pretty sure the only thing you would really want from it is the 9 lines of code doing the tax calculations

what i am mainly interested in however is a way to grab the tax info directly from the L2 website
if someone could work that out for me that would be fantastic
Don't worry I won't copy your work nor use your code.

I am making it because I'm bored and my web-site needs some new content.

tip about grabing the tax from the site: look at the source code of the castle page and see what javaservlet is being called to get the info ;)
Instead of opening a new thread about the same thing I will just post it here.

Here (http://lineage2.rochand.com/Knowledge/l2tax.php?server=bartz) is my first outcast of the L2Tax. It grabs the tax directly from the official site so it should always be up to date unless NCSoft's web developers change the way the tax is being sent to the site.

I will add some more features in the next few days.

Let me know what you think. The price should get calculated correctly (atleast I hope so...took me almost 2 hours to figure out how L2 is calculating the tax).
if other ppl can verify that it works and if you chose to leave it open to the community i'm done with the project

spent 4 hours studying php and all i can say is the language owns me
must be something to do with how variables are stored but i couldn't get mine to do the maths properly

if it turns out your maths are wrong the equation is just:
base rate + town tax + castle tax
giran has 10% base tax, oren has 15% all others have 20%
so if you want the price for soul ore and giran tax is 15% it will be:
250 + (10 + 15)%

if other ppl can verify that it works and if you chose to leave it open to the community i'm done with the project

spent 4 hours studying php and all i can say is the language owns me
must be something to do with how variables are stored but i couldn't get mine to do the maths properly

if it turns out your maths are wrong the equation is just:
base rate + town tax + castle tax
giran has 10% base tax, oren has 15% all others have 20%
so if you want the price for soul ore and giran tax is 15% it will be:
250 + (10 + 15)%



I will let the site be open, but I don't know if I am gona give out the source dode for it.

PHP can be tricky if you haven't used it before (php.net and phpfreaks.com are 2 good sites to see code samples at ;) ).

I have checked what my calculator gives on 4 different servers that has diferent tax from my own home server and so far it has been spot on, but some of the villages that I haven't checked yet can be wrong.
So far I have checked:
Talking Island
Dwarven Village
Schuttgart
Giran
Orc Village

On Lionna I have checked all the villages.
all starter villages should have the same price as oren
giran should have its own price and all other towns should have the same price as each other

not sure what went wrong with my php coding but i assume it has something to do with me trying to past post data onto a variable or something
as far as i can see php is just a crappy version of C, seems all they done was copy and paste the same code then change the way it works slightly ($ . / etc)
undeclared variables scare me too :P

good work on the page though

all starter villages should have the same price as oren
giran should have its own price and all other towns should have the same price as each other



Hunters has it's own price compared to the other towns.


not sure what went wrong with my php coding but i assume it has something to do with me trying to past post data onto a variable or something
as far as i can see php is just a crappy version of C, seems all they done was copy and paste the same code then change the way it works slightly ($ . / etc)
undeclared variables scare me too :P



I know what you mean. I went from Java to PHP and got the same feeling as you have.


good work on the page though



Thanks :)
Sorry for taking your idea like this, but I have been trying to make something like this almost since I started L2 in C4...they had a different castle site back then so I couldn't get the tax rates until now that they changed the site.


Thanks
Sorry for taking your idea like this, but I have been trying to make something like this almost since I started L2 in C4...they had a different castle site back then so I couldn't get the tax rates until now that they changed the site.


my goal was to make the calculator for myself and share it for the L2 community
if someone else managed to make it faster and better than i could then i'm all to happy to spend my multiple hours learning a crappy language doing something else :P

2 questions if you don't mind answering man
for starters i hate having something beat me so if i don't get a grasp on this stuff it will just eat me up inside

1. is this code solid?

$oren = (($oren / 100) + 1) * 250;



2.what method do you use to write php? and do you know a way to bypass having to host to check code?
i would prefer to use an editor for easier syntax checking and i decided to use roadsend which claimed the ability to create stand alone php code
pretty sure GG was screwing it over since the second i started L2 it instantly became a buggy piece of crap but i noticed that one section of my code would not run correctly unless i hosted it
do i assume that as an error in roadsend?
php. needs an interpreter. with out the interpreter it wont do anything.

$oren needs to have a value.

in your line, $oren = NULL and you cant do anything with nothing.

it should look something like

<?
$oren = 5; //argumentative oren tax = 5%
$oren = (($oren / 100) + 1) * 250;
echo("Oren's tax:" . $oren);
?>

edit:
i didnt read the full post before writing this lol

1. is this code solid?

$oren = (($oren / 100) + 1) * 250;





As giltnathas said you have to give $oren a value first, but yes it is solid.


2.what method do you use to write php? and do you know a way to bypass having to host to check code?
i would prefer to use an editor for easier syntax checking and i decided to use roadsend which claimed the ability to create stand alone php code
pretty sure GG was screwing it over since the second i started L2 it instantly became a buggy piece of crap but i noticed that one section of my code would not run correctly unless i hosted it
do i assume that as an error in roadsend?



I use Dreamweaver to program in and I have installed wamp (http://www.wampserver.com/en/) to test the code localy. It also has a built in MySQL server so you can test almost everything localy before uploading the code to a host.
oops yeah obviously $oren was given a value earlier in the code (post data if thats even possible)



I use Dreamweaver to program in and I have installed wamp (http://www.wampserver.com/en/) to test the code localy. It also has a built in MySQL server so you can test almost everything localy before uploading the code to a host.



good to know
all my html was done with dreamweaver so at least im partially familiar

oops yeah obviously $oren was given a value earlier in the code (post data if thats even possible)



I use Dreamweaver to program in and I have installed wamp (http://www.wampserver.com/en/) to test the code localy. It also has a built in MySQL server so you can test almost everything localy before uploading the code to a host.



good to know
all my html was done with dreamweaver so at least im partially familiar



Dang, I'm old school... All my php coding is done using notepad (on windows) or vi (on Linux).... :eek:
i suck at syntax so if i don't have an app with bright colours and flashing lights and sirens when i do something wrong i can't do jack

most of the time my syntax errors are just a missing ";" or an incorrectly declared variable but if i didn't have an app telling me where to look i would never find them :/

i suck at syntax so if i don't have an app with bright colours and flashing lights and sirens when i do something wrong i can't do jack

most of the time my syntax errors are just a missing ";" or an incorrectly declared variable but if i didn't have an app telling me where to look i would never find them :/



Thats the beauty of PHP. If there is a mistake in the code it will tell you the line and what to look for when you try to view it in the browser ;)
i've had some really annoying errors that point to the last line lol

spent hours, if not days scouring my code looking for a missing " (i think it was)
Aww ...
But don't ever try to find missing . in sendmail configuration :mad:

Aww ...
But don't ever try to find missing . in sendmail configuration :mad:



been there done that...took me 3 days to find that one
web site still down :(
can you re-paste a link if you are still hosting it please man