Friday, May 30, 2008

Java: DII Character Simulator Update #5

This project got put on hold due to lack of time once Gorny sucked me into playing the online game Travian with him and bunch of other people from the Diabloii boards. Thankfully that game is over and I can get back into working on this program again, however it took a while to reacquaint myself to the methods, variables and structure of the current code.

I had planned on finishing up the Skill calculator tab so that is where I started. It turns out there aren't any easy equations for how the skill damage/stats are governed, which makes my job a bit harder, and a little tedious. Instead I had to create a separate text file for each skill and list the variable stats for each level in the file.


This was the tedious part, as there are seven classes with thirty skills each and I went up to level twenty for each skill. So say around forty-two hundred columns of data needed to be generated. Thankfully there is an online version of the skill calculator that I use to view the needed information and transpose it into text format. Granted it's an "illegal" version according to Dii.net standards, but the information is accurate and I like the way it's displayed.

While that was the tedious, non-coding part there was also some real coding that went along with the text files. Specifically I needed a way to gather the information from the files and store it in the program for use in calculating skill stats per level when I make my own equations. In order to do this each skill needed it's own float array, one row for each variable stat.

float[] magicArrow = {0, 0, 0, 0};
float[] guidedArrow = {0, 0};
float[] immolationArrow = {0, 0, 0, 0, 0, 0, 0};


And so forth. The trick is recalling which row corresponds to which variable stat, and for this I had to create a set of cliff notes for each character class. Whether or not those files will be incorporated into the final product is up in the air at this point.

Now that there is somewhere to store the information a pair of methods were created to do the actual storing procedure.

public void FillSkillArray(String file, String location, int number, float array[])

This is the workhorse method and will open the associated text file, find the correct column depending on what value the skill has been given (int number) and then save the information into the corresponding float array. Every time a skill value is changed the entire set of skill stat arrays are repopulated. Since this is only populating thirty arrays it isn't time nor resource intensive. The second method simply calls FillSkillArray for each of the thirty skills at all once.

Now with the skill information being saved successfully we need a way to display this information. I see this happening in two parts. The first part will be a method that generates the correct stat amounts depending on synergies and such; one method for each skill. Then to actually display this information I was planning on using a Tip Tool on the label of each skill. While I haven't researched this yet I'm hoping simply hovering the mouse over the skill's label will display the bonuses given or damage done as calculated by the associated method.

I will need to add a few variables for use in the calculation portion that will take into account +skill mods from equipment. For now those will all have a value of zero but it is better to incorporate these variables into the program early than try to do so later on.

No comments: