Wednesday, December 31, 2008

Java: CharSi Update #14

Any mods provided by equipment is now properly displayed in the Stats panel, minus damage and attack rating calculations. The first step was to add a method for each category of mod that would sum the data from each of the equipment subpanels into a single value. I split up the mods into small groups to make things a bit easier, such as all boolean values in one method, all mods of note in another and so forth. During the calculations the mods that are based on character level had to be taken into account as well. This was done with a simple addition to the currently summed value.

((int)charLevelMods[15])*(levelCBox.getSelectedIndex()+1)

Once the summing was completed it was a simple matter of creating another method to populate all of the JTextFields and JTextAreas. To do this a couple of different methods were created to populate patches of these components, then a single method is made that calls all of the methods together, both the summing and populating ones. I determined it was easier just to sum everything each time a value is changed rather than only the ones affected, to ensure that I didn't miss something along the way.

The miscMods panel had a few different wrinkles beyond the others. Specifically the text files that contain the random mod information for each piece of equipment needed to be dealt with for when the program is closed or the item added/removed. Adding the information wasn't too difficult, however a new method needed to be created to erase all of the file's content when the item was removed or the program closed. This new method basically overwrote the current file with a blank one and is called every time just before an item is added or whenever one is removed, as well as when the miscMod Panel is initialized for cases when the program is closed with equipment still assigned to the virtual character.

Once that was done it was a simple matter of taking every mod that isn't deal with in any of the other panels and appending that mod's information to a StringBuffer that is then displayed in the miscMod JTextArea.

Now with all of the other Panels completed it is time to work on the Damage panel. This one will take a little research first as I need to get the correct damage equation to ensure I don't repeat the mistakes of the current LCS. That and I know I need to alter the current component's GUI quite a bit to take into account kick, smite, one-handed and throw damage as well as active auras for Paladins. Once that is completed there are only a few cleanup items to take care of before the current iteration of the program is complete. Then I'll have to decide what the next step will be.

No comments: