Request Fullfilled
Ok. I think I took care of everything. I wrote a bunch of tests to catch errors. And then tested a bit. Binaries for windows 7+ and osx available here:https://github.com/RobJames-Texas/TL2_ItemDatMaker/releases I added functionality so that you should be able to drag and drop your mesh file from your mod folder onto the exe and it should then ask you for the rest of the parameters. Let me know if you have any issues. Here I'll make a rundown of what the script should do:
Given a 3d model as input, that means the file name and folder location, the scritp should generate a corresponding item unit file in a specific folder.
Example:
Input: D:\Steam\SteamApps\common\Torchlight II\MODS\ITEM_MOD\MEDIA\MODELS\WEAPONS\_SWORDS\Sword_model_01
Unit file:
Created in: D:\Steam\SteamApps\common\Torchlight II\MODS\ITEM_MOD\MEDIA\UNITS\ITEMS\SWORDS\
[UNIT] <STRING>RESOURCEDIRECTORY:media/models/weapons/_Swords <STRING>MESHFILE:Sword_model_01 [/UNIT]List of folders equivalencies
Spoiler (hover to show) _AXES = AXES _BOWS = BOWS _CANNONS = CANNONS _CROSSBOWS = CROSSBOWS _FISTS = FISTS _GREATAXES = 2HAXE _GREATHAMMERS = 2HMACE _GREATSWORDS = 2HSWORD _HAMMERS = MACES _PISTOLS = PISTOLS _POLEARMS = POLEARMS _RIFLES = RIFLES _SHIELDS = SHIELDS _STAVES = STAVES _SWORDS = SWORDS _WANDS = WANDS
Now, this file is totally imcomplete, it needs some basic things, a name, a unittype and a base file. But this things are related to one variable, rarity.
So a second input should be item rarity, the options being, Normal, Magic (Blue), Unique and Legendary. With this we can determine the base file and the unittype of the item. The type of item, that being an sword, axe, greataxe, etc, should be determined using the folder in which the model is stored.
Example:
Rarity input: Magic
Unit file:
[UNIT] <STRING>BASEFILE:media\units\items\swords\base_sword_magic.dat <STRING>UNITTYPE:MAGIC 1HSWORD [/UNIT]List of folder name and base file equivalency
Spoiler (hover to show) _AXES = BASE_AXE _BOWS = BASE_BOW _CANNONS = BASE_CANNON _CROSSBOWS = BASE_CROSSBOW _FISTS = BASE_FIST _GREATAXES = BASE_2HAXE _GREATHAMMERS = BASE_2HMACE _GREATSWORDS = BASE_2HSWORD _HAMMERS = BASE_MACE _PISTOLS = BASE_PISTOL _POLEARMS = BASE_POLEARM _RIFLES = BASE_RIFLE _SHIELDS = BASE_SHIELD _STAVES = BASE_STAFF _SWORDS = BASE_SWORD _WANDS = BASE_WAND
List of folder name and unittype equivalencies
Spoiler (hover to show) _AXES = 1HAXE _BOWS = BOW _CANNONS = CANNON _CROSSBOWS = CROSSBOW _FISTS = FIST _GREATAXES = 2HAXE _GREATHAMMERS = 2HMACE _GREATSWORDS = 2HSWORD _HAMMERS = 1HMACE _PISTOLS = PISTOL _POLEARMS = POLEARM _RIFLES = RIFLE _SHIELDS = SHIELD _STAVES = STAFF _SWORDS = 1HSWORD _WANDS = WAND
Exception, there is no _legendary base file, they use the unique base file.
Now for the name, the name should follow the vanilla convention with a tag added. the tag should be another input. ([itemtype]_[TAG][Rarityletter][Number])
Example:
Input tag: TEST
Unit file:
[UNIT] <STRING>NAME:sword_TESTm01 [/UNIT]Now the last input should be item level, but to make the script have extra option, it should have 2 funtions:
Make Alternative clones, creates two more files using the first as base increasing its level by a predefined amount
Make NG+ Clones, this one should be one of the more interesting function. It would make clones of the item increasing their level simulating the NG+ calculation of GUTS for increasing level.
Example:
Input item level: 15
Make Alt Clones [Y/N]: Y
Unit file:
[UNIT] <INTEGER>LEVEL:15 <INTEGER>MINLEVEL:13 <INTEGER>MAXLEVEL:19 [/UNIT]Alternative Clones:
B:
[UNIT] <STRING>NAME:sword_TESTm01b <STRING>BASEFILE:media\units\items\swords\sword_TESTm01.dat <INTEGER>LEVEL:19 <INTEGER>MINLEVEL:17 <INTEGER>MAXLEVEL:22 [/UNIT]C
[UNIT] <STRING>NAME:sword_TESTm01C <STRING>BASEFILE:media\units\items\swords\sword_TESTm01.dat <INTEGER>LEVEL:23 <INTEGER>MINLEVEL:21 <INTEGER>MAXLEVEL:26 [/UNIT]The MINLEVEL should be LEVEL-2, and MAXLEVEL = LEVEL + 3. The increase in level for the alternatives should be LEVEL+4.
Now how should the "Make NG+ Clones" work, the clones should have a level increase using the equation:
For Item level in the NG range (default 0<i-level<=50)
NG+ Clone (default range : 51 to 80)
I-LevelNG+= 51+[(i-level/50) * (80-51)]
NG++ clone (default range : 81 to 100)
I-levelNG+2 = 81+[(i-level/50) * (100-81)]
NG+++ Clone (default range : 101 to 120)
I-levelNG+3 = 105
For item level in the NG+ range (default 51<=i-level<=80)
NG++ clone (default range : 81 to 100)
I-levelNG+2 = 81+{[(i-level-50)/(80-50)] * (100-81)}
NG+++ Clone (default range : 101 to 120)
I-levelNG+3 = 105
For item level in the NG++ range (default 81<=i-level<=100)
NG+++ Clone (default range : 101 to 120)
I-levelNG+3 = 105
This option should be able to interact with "make alternative clones" in a way that every alteranative clone, get their corresponging NG+ clones.
Example:
Input item level: 15
Make Alt Clones [Y/N]: N
Make NG+ Clones [Y/N]: Y
Unit file:
[UNIT] <INTEGER>LEVEL:15 <INTEGER>MINLEVEL:13 <INTEGER>MAXLEVEL:19 [/UNIT]NG+ Clones:
NG+
[UNIT] <STRING>NAME:sword_TESTm01NG+ <STRING>BASEFILE:media\units\items\swords\sword_TESTm01.dat <INTEGER>LEVEL:60 <INTEGER>MINLEVEL:58 <INTEGER>MAXLEVEL:63 [/UNIT]NG+2
[UNIT] <STRING>NAME:sword_TESTm01NG+2 <STRING>BASEFILE:media\units\items\swords\sword_TESTm01.dat <INTEGER>LEVEL:87 <INTEGER>MINLEVEL:85 <INTEGER>MAXLEVEL:90 [/UNIT]NG+3 (exception in Minlevel and Maxlevel, also has level_requiered:101 added.)
[UNIT] <STRING>NAME:sword_TESTm01NG+3 <STRING>BASEFILE:media\units\items\swords\sword_TESTm01.dat <INTEGER>LEVEL:105 <INTEGER>MINLEVEL:99 <INTEGER>MAXLEVEL:999 <INTEGER>LEVEL_REQUIRED:101 [/UNIT]TL;DR:
Spoiler (hover to show) Script inputs: 3d Model (Full access route) Item Rarity Name Tag Item Level Options: Make Alternative clones Make NG+ Clones Full Example: Input 3d Model: D:\Steam\SteamApps\common\Torchlight II\MODS\ITEM_MOD\MEDIA\MODELS\WEAPONS\_SWORDS\Sword_model_01 Input Rarity: Magic Input tag: TEST Input item level: 15 Make Alt Clones [Y/N]: Y Result: sword_TESTm01.dat Created in: D:\Steam\SteamApps\common\Torchlight II\MODS\ITEM_MOD\MEDIA\UNITS\ITEMS\SWORDS\[UNIT] <STRING>RESOURCEDIRECTORY:media/models/weapons/_Swords <STRING>MESHFILE:Sword_model_01 <STRING>BASEFILE:media\units\items\swords\base_sword_magic.dat <STRING>UNITTYPE:MAGIC 1HSWORD <STRING>NAME:sword_TESTm01 <INTEGER>LEVEL:15 <INTEGER>MINLEVEL:13 <INTEGER>MAXLEVEL:19 [/UNIT] sword_TESTm01b Created in: D:\Steam\SteamApps\common\Torchlight II\MODS\ITEM_MOD\MEDIA\UNITS\ITEMS\SWORDS\[UNIT] <STRING>NAME:sword_TESTm01b <STRING>BASEFILE:media\units\items\swords\sword_TESTm01.dat <INTEGER>LEVEL:19 <INTEGER>MINLEVEL:17 <INTEGER>MAXLEVEL:22 [/UNIT] sword_TESTm01C Created in: D:\Steam\SteamApps\common\Torchlight II\MODS\ITEM_MOD\MEDIA\UNITS\ITEMS\SWORDS\[UNIT] <STRING>NAME:sword_TESTm01C <STRING>BASEFILE:media\units\items\swords\sword_TESTm01.dat <INTEGER>LEVEL:23 <INTEGER>MINLEVEL:21 <INTEGER>MAXLEVEL:26 [/UNIT]