TXTtoHTML Tool v1.02

Author: Henning Avenhaus (Char)


------------------------ Table of contents -----------------------------

1. What is this tool able to do?
2. Before starting
3. Getting your .txt files to be processed
4. Usage in detail
 4.1 Graphical user interface
 4.2 The .ini file
 4.3 The itemtypes.txt file (only important for unique and runeword processing)
 4.4 TBL files
 4.5 The ref.htm file
 4.6 The CSS style sheet file
 4.7 Getting the ordering you want
5. If something does not work
6. Version History
7. Credits and Thanks

------------------------------------------------------------------------


1. What is this tool able to do?

The TXTtoHTML tool takes all the standard .txt files from Diablo II / Lord of Destruction or any mod and tries to generate a useful HTML representation of them.
The HTML representation can be done for unique items, set items, and runewords. Perhaps a support for base item representation will be added someday as well, but I do not think it is that important.
The HTML code generated is customizable via a CSS style sheet. The "standard" colors for set items, unique items and so on are already predefined. Furthermore, the code is added into a reference file frame that you can give to the program.
For set items, a master file with all sets is generated and contains links to every single set. Each set has its own HTML file.
For unique items, a tree structure of files is generated. You can define how the tree looks like within the itemtypes.txt file. Thus, you need to use the itemtypes.txt file given to you with this program, as it contains two more fields.
For runewords, four files are generated: One for weapons, one for torso armors, one for helms and one for shields. If a runeword will work in both shields and torso armors, it will appear in both categories.
The TXTtoHTML tool will also calculate the minimum and maximum values for damage, defense, requirements and so on in case they might vary. If the value depends on the character level, character levels from the required level for the item up to character level 99 will be considered.


2. Before starting

Before you start, you first need to download the package and extract it to any folder you like. The package contains:

HTMLtoTXT.exe		- the main program
ref.htm			- a pre-built reference htm file
d2tbl.exe		- Joel's Diablo2 TBL tool
d2tbl.bat		- pre-made batch file for Joel's Diablo2 TBL tool
readme.txt		- this file
txt\			- folder with original Diablo2 Lord of Destruction v1.10 .txt files, 
			  including modified itemtypes.txt file and .tbl files in .txt format
shared\			- folder including the graphics for the runes

When you first start the tool, it will generate an .ini file with standard settings.
Now to get a feel for how the tool works, start it, load the files from the txt\ subfolder and run all processing options (Process Uniques, Process Set Items and Process Runewords).
The tool will generate lots of .htm files, the most important ones being uniqueitems.htm, setitems.htm and runewords.htm. Open them to see what the tool has done.


3. Getting your .txt files to be processed

In order to process everything, the TXTtoHTML tool needs the following:

1) most of the .txt files, the exact list:

	- itemstatcost.txt
	- properties.txt
	- itemtypes.txt (modified version)
	- armor.txt, weapons.txt, misc.txt
	- gems.txt
	- skilldesc.txt
	- skills.txt
	- montype.txt (needed for display of special stats like attack_vs_montype)
	- monstats.txt (needed for display of property "reanimate")
	- runes.txt
	- sets.txt
	- setitems.txt
	- uniqueitems.txt

   The easiest way to achieve this is to either copy all your .txt files to one directory or to 
   copy all your modified .txt files to the txt\ directory.

2) the .tbl files extracted to tab delimited .txt files:

	- string.txt
	- expansionstring.txt
	- patchstring.txt
	- mystring.txt	 	(optional)

   If you do not already have these files extracted, you can find a description on how to 
   extract them in point 4.4.

3) The ref.htm file
   An example of such a file is already given with the tool. If you want to use the design of 
   your own homepage, you find a description on how to do so in point 4.5.


4. Usage in detail
4.1 Graphical user interface

When you start the tool, you will see a graphical user interface roughly divided into four parts. In the upper part of the GUI, you will find several buttons for processing the different types of items and to load the .txt files on the left side. On the right side, you will find the Options. Here, you can select your language (currently, only English is supported), set the TXT file path and see the current maximum character level.
In the lower part of the tool, you will see two large information textboxes. The upper one is the "good" one: Here, informations about the current process is displayed. The lower one is to display errors and warnings.

4.2 The .ini file

TXTtoHTML generates an .ini file called TXTtoHTML.ini on the first start. The .ini file currently has four options:
[clvl_max] 			- maximum character level in your mod, usually 99
[directory] 			- the last accessed .txt file directory
[use_external_colors] 		- used for setting different colors than Diablo2 uses usually.
				  This is undocumented, and you probably will not need it
			  	  anyways, so please leave it at zero.
[show_rune_gfx]			- shall rune and gem graphics be displayed? 0: no, 1: yes
[show_unique_gfx]		- shall unique graphics be displayed? 0: no, 1: yes
[show_set_gfx]			- shall set graphics be displayed? 0: no, 1: yes

4.3 The itemtypes.txt file (only important for unique and runeword processing)

If you want to explicitly set which unique items get their seperate page, which you probably want, you need to tell the tool how you want them to be seperated. This is done through some extra fields in itemtypes.txt. These are called "subdivide" and "makepage". Furthermore, a "string" field is used to let you tell the tool how to call the pages. Futhermore, this is also used to figure out the names for the item types (for runewords).
If you set "makepage" to 1, a seperate .htm page will be generated for that itemtype. If you set "subdivide" to 1, a page will be generated and only contain links to further sub-itemtypes.
For example, if the "makepage" field is set to 1 for torso armors (tors), and the "subdivide" field is set to 1 for armors (armo), you will get an armor page that will contain a link to a page where only torso armors are displayed (as well as probably a link to several other armor types, like shields, helmets, belts and so on. The names of the links are determined by the "string" field.
Study the results you get when using TXTtoHTML on the standard 1.10 vanilla .txt files included in this package to see how all this works some better.

4.4 TBL files

The tool needs to get the strings from somewhere. As all the information regarding strings is hidden in the .tbl files, and there is a simple tool to convert .tbl files to tab delimited .txt files, I have chosen to use this tab delimited .txt format for my tool.
If you do not have Joel's TBL editor already, its also included in this package. Just put your .tbl files (string.tbl, expansionstring.tbl, patchstring.tbl) into one directory along with d2tbl.exe and d2tbl.bat and run d2tbl.bat, it will extract all .tbl files to .txt files. If you do not use modified string.tbl and expansionstring.tbl and are too lazy to extract them, you can of course as well use the already converted ones from the txt\ directory.
If you have your own custom .tbl file, you need to rename it to mystring.tbl and also convert it. TXTtoHTML assumes the custom tbl file to be extracted to mystring.txt.

4.5 The ref.htm file

This file is used for a reference design from the TXTtoHTML tool. Use the website you want to implement the unique items / set items / runewords into.
To let the tool know on what spot in the website you want it to put the generated HTML code, you need to use the tag [code_insertion_space]. This tag will be removed from the HTML file and the generated code will be put into the same place.
Very important: Your ref.htm file needs to include the CSS style sheet file style.css, or you need to include the information from that file into your own CSS style sheet.

4.6 The CSS style sheet file

If you want to change the style of the generated code (like color, size or textsize), you can use the CSS file to do so. It should be quite intuitive, otherwise search the web for a CSS tutorial.

4.7 Getting the ordering you want

The tool usually orders the items by base item level, or, if base item level is equal, by level requirement. If you want, for whatever reason, to have another ordering, you can have this easily. Just add a new colum to your .txt files you want in different order (sets.txt, setitems.txt, runes.txt, uniqueitems.txt, gems.txt), and there you go. The new column has to be called "*TXTtoHTML_ordering" (look at capital / non-capital writing!) and can be added at any place in the file. It will not be read by Diablo2, so you can just leave it in your normal files.
You need to enter ascending integer numbers to the field. Lines with higher integers will be displayed later in the output. If the numbers are equal, the usual procedure will be applied to determine which item will be displayed first (base item level / level requirement). If there is no number, it will be counted as zero.
The ordering of the gems in the example is achieved with this method, and you can look at gems.txt to see how it is done.


5. Problems

There are lots of things that can go wrong with this tool. Thus, some of the following questions will probably be asked. In order not to have to answer them individually, I have answered them here.
If you have a question that is not covered here, first check that you have done everything alright (read the readme again), and then, if the problem persists, contact me. You can reach me per private message on the PhrozenKeep. There also is a feedback thread in the tools forum.

"I do not have any entry in the unique items file except for the Quest Items"
Check your itemtypes.txt file. Probably you are missing the extra fields in there, this leads to exactly this problem.

"The item types are not displayed in the runewords output"
See above. Check your itemtypes.txt file.

"Several strings are not displayed properly"
Check that you have the appropriate .tbl files in the directory, otherwise the tool cannot find the strings

"The tool displays wrong values on my items"
Check that you actually PUT the right values on your items. It happened to me that I found a lot of errors in my files just because I used this tool.

"The property XYZ is not displayed on the item"
Check wether the property (or stat) is displayed in the game itself. The tool does not display anything that is not visible in the game (or at least: it should not).


6. Version History

Version 1.00 (11.01.2006)
First release (not yet downloadable on PhrozenKeep)

Version 1.01 (24.01.2006)
Made available at PhrozenKeep

Bug fixes:
- fixed a bug that could cause wrong strings to display for the "dmg%" property
- fixed ordering of Set items within a set (the ordering was upside down)
- included the property "reanimate", it can be displayed now (needs loading of monstats.txt)
- fixed a bug that could cause properties be displayed as green properties even when "add func" was set to 0 in setitems.txt
- corrected the display if "add func" equal to 1 in setitems.txt

Improvements:
- made the stat display on runes be equal to all other stat displays (i.e. + to all resistances instead of + to each 
  individual one)
- improved the error and warning system, more and better readable warnings are now written out
- introduced warnings if the stats applied are out of range (for example dmg% 600, while 511 is max)
- replaced "Always unique items" with "Quest Items"
- itemstatcost.txt does now load properly if the entries are in a different order (or of fields were added)
- gems.txt does now load properly if the entries are in a different order (of if fields were added)
- jewels and gems are displayed correctly on runewords
- compiled the code with more compiler optimizations, should be a little faster now

Version 1.02 (02.02.2006)

Bug fixes:
- fixed several crashes that could appear if there were multiple lines with the same code in a file
- fixed a crash that would appear if reanimate was used with wrong or non-existant monster type
- improved the loading and internal handling of several files, which should reduce crashes
- dismissed lines if there was a major loading problem, which then could lead to crashes in further program execution

Improvements:
- ability to show graphics for unique and set items (can be disabled in .ini file)
- better warnings / information if something went wrong while loading, also states that line was not loaded if there was a major problem
- log file is now written out for the error log
- made it possible to add a ordering field to uniqueitems.txt, runes.txt, setitems.txt, sets.txt, gems.txt to allow explicit statement of ordering within file. Usage: add a field called "*TXTtoHTML_ordering" to your file and enter ascending numbers
- localization in german and spanish (not finished yet)



7. Credits and thanks

I give credits to Joel for his great .tbl tool which I also was allowed to include in this distribution
Furthermore, I have to thank BrotherLaz, who gave me lots of feedback and found several errors, and Joel, Onyx and Kingpin for giving me their .txt files so I had something I could test my program at, as well as all of you who reported bugs to me.

And of course, big thanks to the people at blizzard who made Diablo2 and Diablo2: Lord of Destruction in the first place, as well as Isolde for making patch 1.10, which made this tool possible in the first place.

