Friday, February 20, 2009

Java: CharSi Update #20

The tab for creating magical and rare items did borrow extensively from the runeword generator class. For the most part both tabs look extremely similar. However there were also some major differences. Specifically rare/magical items can have charges and a chance to cast certain character skills, so a pair of JButtons in the bottom panel enabled those options.

The longest part was, as expected, creating the mod JList/Listener. The list of mods themselves was originally the same list that could appear on any unique/runeword item. Once the code was complete, then those mods that can't actually appear on an item, such as Poison absorb, were commented out. Creating the JList options wasn't difficult so the extra code wasn't a problem, as all that is required is a simple addElement call to the DefaultModelList. Then the Listener was simply a massive if-else statement. When a specific mod is selected the user is prompted for to choose a value to assign the mod, such as Fire resist +30%. Then a String is created and added to the bottom of the already existing item's description.


When completed the user clicks the Save JButton. When this happens the special mods that pertain to defense/damage are used to calculate the item's final values in those areas. The text in the JTextArea is then updated with this information to display the final product as it will appear in the Equipment tab.

With this update the program is completely usable. Not that it wasn't usable before but now any type of character may be created and equipped with any item that can be found ingame. It is possible to generate illegal items, say with +20 to all skills. The amount of checks I put in place were minimal so the user does need to understand a little bit about the game so they don't create hacked items. Perhaps in the future I'll add in the necessary checks, but for now as long as one pays attention it should work fine.

As it is now a working program and the mods have agreed it may be useful to a selection of the community I am prepared to make it available to the general public of diii.net. I need to first create a bit of documentation to walk users through the quirks of the application, but that shouldn't take too much time. Then I'll make a post in the SPF and see what type of feedback I get.

I do expect bugs to be found, I'm not naive enough to think I made a perfect program. Most of the mod values should show correctly, but I am worried the damage numbers may be slightly off. I did the best I could and they look right to me, but I haven't tried every single permutation possible so there may still be a glitch with my calculations. I won't know until someone points it out to me though.

After the documentation is complete the next step is to allow the virtual character to have an inventory. This means a charm generator is next on the agenda. That and fixing any bugs others find when attempting to use CharSi.

Currently CharSi can be downloaded via RapidShare from this location.

No comments: