Hey guys, This is a reupload from 2017 by Roccus. I could save it and i want that the legion modding comes more alive. It's time for it.
First, let's start with the tools i used so far :
How to reset 010 Editor:
Open regedit (windows) and HKEY_CURRENT_USER/SOFTWARE and delete the SweetScape folder. It will reset your 30 days trial. U can do it again and again ?
If you do a 3d custom model or edit one you Will see all mesh separated in game like a constructed doll but it s not that visible in my opinion. And you have to put SET M2UseLOD "0" In your config.wtf file in your WTF because your models Will expand otherwise. Don't ask me why but this Will fix everything.
Let's get started now, i will tell you when to use each of those things.
PART 1 : Understanding and Editing db2 files from DBFilesClient.
Thanx to Barncastle everything is easier with his awesome WDBX Editor which permits to open those db2 with their definitions for 7.3, 7.2, 7.1 etc. For big editing you can even export them to sql file, to your sql server directly as a table and even is csv format which are all pretty cool for mass editing.
You all know that there's almost only numbers in the new db2 format from blizzard and that'w why it was difficult to know which textures of models were related to what numbers. Here's the solution. I haven't tried everything. I can tell you that for spell related db2 it's a real maze and i never found the links between them so I will give you the example with either creature db2 and item db2.
So you need to extract from cascexplorer or Cascview the modelfiledata.db2, texturefiledata.db2 and thanx to cascexplorer, go to Tools > Extract CASC System Files like this :
You just have to wait for it to complete the extraction which is pretty fast and then go take the root file in your cascexplorer folder. It's called « root » and cascexplorer won't tell you if the process is finished, it will be done when you can interact again with the tool.
Now use the list_root made by wungasaurus i shared on the links and move the rootfile and your most up to date listfile in the list_root.exe folder. shift+right click to open a command prompt on the folder path. Then type : list_root.exe « listfile.txt » « root » dump_all > whathevername.txt and wait for the process to list the root file of the game which is « Filedata » of Legion to make it easier to understand. Ok now you got everything needed. (note that a little bit of excel editing to get rid of the middle hash between path and Ids make it easier to read this filedata)
Here's how you need to use the generated filedata root + modelfiledata.db2 + texturefiledata.db2. I like to make them to csv format on notepad++ for my research.
You want to get a special weapon displayID from legion (which is a hard thing since WMV doesn't do it anymore) now it's easy. Open your Itemdisplayinfo.db2 and search for a displayid like this.
See the purple highlighted IDS, first one is Model ID and second one Texture ID :
Remember those ID's, now go to modelfiledata.db2 for the first one and texturefiledata.db2 for the second one :
here's modelIDs of the root :
here's texture root ID :
now take ID 140142 for model and 140164 for texture. Now go to your root file and search the corresponding ID and then you'll get the filepath and its name ! You can also do this process from root file to itemdisplayinfo !
Now if you ask me, is it the same for every db2 ? Well no, if you take the example for creatures and some others : take the M2 ID from root file, like felreaver2.m2, note its ID, then go to creaturemodeldata.db2 and search this id in the ninth column from the end (or just ctrl+f to find it in csv mode) then you note creaturemodeldata.db2 model ID, the first valu in the row. Then go to creatureDisplayInfo.db2 and search in the third column the creaturemodeldata ID to find the DisplayID of the NPC. On the same row as the found npc you'll get the textureID but this time it's directly the rootfile ID, no need to do the texturefiledata.db2 process this time either.
The same goes for GameObjectDisplayInfo.db2. The second column values are the models of the m2 gameobjects. And you can add all the wmo gameobject from root file in this db2 to get all the existing wmo in root spawnable in game. (you need only to put the first part on the wmo's You need only to put the .wmo one, not all the ones with _XXX in the name before.wmo. Then you need to do some sql databases updates to make this work in game but I'll explain it in the SQL part of the tutorial.
Here's a video I made of the process to find felo'melorn blue displayID :
PART 2 : Understanding the M21 format and M2 Hexa_Editing
You all know from your retroporting from legion to wotlk or wod etc that all m2 files contain an 8 bytes MD21 header and that you can't retroport them without deleting the MD21 header. I will tell you how to write a custom MD21 header as it's only a pretty simple thing when we know what are the four last bytes of it. We will see how to edit textures, hardcode texture, use creaturedisplayInfo.db2 texture. Unfortnately i can't do animated textures or particles, i never achieved this. And i will tell you how to edit skin01 file to put texture on blank areas of your model too. So here we go.
Let's take the voidbroken model from 7.3 :
Now to edit it, cut the 8 bytes before MD20, and i suggest you paste them in an empty document in case you're not changing the size of the M2 and by that i mean not adding block of data and adding new bytes etc.
Run the M2Template for 010 editor and wait for it to load the structure :
Go the the texture section at the end and unfold it, you will see this when you finish unfolding everything:
Some explaining now. Hardcoded setting means that those are « linked to the model » if I say this in a simple way. Like some data stored in a personnal M2 databases
If you want to edit the name of a texture for practice like Creature\VoidBroken\VoidBrokenShadow.blp. Go to insert mode and write in the right column of the hexa part and type like Creature\Voidbroken\Voidbro.blp. You will be left with something like « Creature\Voidbroken\Voidbro.blphadow.blp » to get rid of the other useless char go to hexa part and go to the corresponding hexadécimal and replace those ones by 00 00 00 until you got only rhe wanted path. Like this :
If you make an error of char just press ctrl+z and not delete key as it will delete a byte and don't do that. Deleting just one byte will fuck all up. Be careful.
Now the settings you must put in the corresponding hardcoded texture block. Our new path start at offset 238560 for a length of 32, (from C to p it's 31 but you can put +1 in the length it son't change a thing.) now go in the texture block and edit what needs to be edited :
Now reload the M2template and done ! All modifications applied, now one last thing before doing the new MD21 header and modifying efficiently the skin01 file. Your new texture is voidbro.blp.
The first hardcoded one, it's the texture_texture 1, now go to texlookup section and search int the right part the ID 1 to find the corresponding skin textureID :
Remember this ID for the skin01 part.
Now the other thing, some explaining for creaturdisplay1 (11) creaturedisplay2 (12) and creaturedisplay3 (13) that can be set in the place of hardcode. The 11 one means model will take the first texture from the three texture column of the models displayid using db2 texturepath, like different color of harpy if you want to see. So imagine i want to use second texture on model to load in game I set the thing to cretauredisplay2 (12). As simple as that. So if you want to swap your model with another model that has 4 skin colors you can make 4 customs BLP's in your swapped creature folder and set to first texture column of creaturedisplayinfo.db2 to apply more easily the textures.
How to generate a right MD21 header for our model ?
You need to know that if you haven't added or deleted any bytes, you just have to place the cursor at the start of your file before the 'M' of 'MD20' and press ctrl+shift+I to insert bytes. You must have start adress 0 and size 8 in decimal. And you have now 8 empty bytes. Just paste the MD21 header you deleted to launch the M2template on 010editor. Save and you're done.
On the other hand, if you lost it and you wanna know how it's done here's the explaining :
MD21 has some FID sections, ctrl+f and search in ASCII « FID », you'l have SFID, AFID and for some models BFID. Those sections are not counted in the size of the file like the 8 bytes of the MD21 header. In fact, the header has 8 bytes, 4 are taken by 'MD21' and the other 4 are the old size of the M2 so it's the length of everything between the header and the FID sections.
In reality you must read the open file from the bottom to othe start. So here's how to get the old size of the m2 :
start the selection after all last FID that you will find ! And go up to the M of MD20.
The circled value is the old size, in my example that is just for the theory, we will remember 689024 as the old size. Go to a decimal to hexa converter, you'll get you value in hexadécimal to enter in the last 4 bytes of your header.
You must read the value from right to left, so in 4 bytes it's 80 83 0A 00, just need to enter it in the 4 empty bytes in the hexa section of 010 like this :
Select the four bytes you worte and in the circled section on the screen you'll see that de int value is 689024 ! You have a working MD21 header for your specific M2 model. Congrat ! Save all the changes and it's done !
Now how to find right mesh part of which texu_textureunit of skin01 using skin00 and WMV reading a custom folder.
Make a custom folder on your dekstop and launch de last version of wmv that can read you wow folder, and in setting put the path to your custom folder. Then go create a creature folder in custom and fill it with your voidbroken.m2 and .skin and lauch again your wmv to load it. Find the model in creature section and open show model control. Unfortunately, WMV is unstable with legion and i can't make screen of the voidbroken we did. But here's the menu :
You just need to uncheck the green numbers to disable geosets ad fin the right one, imagine now that you take only the geoset 1 of the voidbroken. Open the skin00 and skin01 of it and load skintemplate on both of them in 010 editor. Open the submesh section and unfold the  one : and remember its ID and also startTriangles and to make sure you identify the right one in skin01 because skin01 has more submesh than th 00 one. It's because skin00 load the 3D mesh and skin01 is for texture and it separates mesh into sections as far as i guessed it.
Go to skin01 and open submesh section like skin00 and search for the submesh that has the same settings as the submesh  in skin00 :
See ? More submeshes but the one that link to de  from skin00 is the  of skin01. Now unfold Texu textureunit section and search the one referencing submesh 3 :
search all the ones that have uint16 submesh 3 as there can be more than one especially if you're doing character models which are way more complex !
Now take the texlookup ID from the M2, remember the ID 1 ? put it in the textureID of this texu textureunit. Save edits and you're done, you hardcoded Creature\voidbroken\voidbro.blp on submesh 1 of the model !
Last part of the tutorial of MD21. How to swap a legion model with a new one ?
MD21 has FID files as you saw in the MD21 structure before skin editing. You need to swap the SFID of your new edited M2 with the SFID of the swapped model. Follow this video to see the effect of not swapping the SFID and how to do it (it's written in french but you have all the manipulation for basic swapping done!) :
And se're done for the MD21 explanation and M2 hex editing, I hope i was clear enough as it is a complex thing to understand and need some time to adapt to the basics ! You'll need to train until you make it work !
PART 3 : SQL Database Editing :
This part will need to be completed by someone who know his stuff on legion databases !
It will be a short part because i know only how to make wmo gameobject patch and how to technically blacksmith new items with custom stats and names.
To blacksmith items, you'll need to edit the hotfix DB.
In order to do this, you'll need Helnesis getDB2hash and to use the knowledge you learned from the root of the part 1 of the tutorial.
You just need to test until it works, everything pretty much documented on trinitycore but you need to edit :
when you edited and added the new rows in all those files (i suggest to put same ID to all 4 to have a more easier way to do things). Go to hotfix_data to apply the hotfix, use helnesis getdb2hash to find the hash or use wowpacketparser thing, and in table hash put the hash of each table, so 4 row with the 4 hash of the four tables. In recorID put the ID of the item, like if you did ID 5000000, put 5000000 for each table in the for rows, except if you did like 1, 2 ,3, 4, then you need to put the specifi ID for each tablehash. Then put for the four rows for the item, Ths ID of the creation of each of the four rows in the four columns in RecordID in deleted put 0 or it won't be applied as a hotfix for your server.
For french people maybe this could help even if it's wod, it may help :
EDIT: Here's an advanced visual tutorial of the databse editing needed to do such thing made generously by Magna !
Now for the gameobject patch, go to World DB and open Gameobject_template table and gameobject_template_addon table.
Pretty much easy to do I think. I'm done for Legion DB editing since i'm not an Emulator.
PART 4 : 3D Modelling in Blender, the tools and theory.
Sorry but i won't tell you exatly how to do every step cause in my opinion it's not fun if you do not find it by yourself but with evey video tutorial that are hidden + public ones and advanced tutorials I found on the web you will be able to do this if you try !
You need both blender 2.73 and 2.78, if you ask me why it's because 2.73 got a feature called transfert weight and it permit to transfert weight to bone pretty good if the shape is almost the same ! And in 2.78 transfert weight doesn't work good but you can paint yourself each bone one by one for more precision like for fingers (this nightmare!).
Install the M2i import/export scripts in you blender. As well as wow tools and multiedit.
Converts blp to png using Blp2png to apply them onto models in blender.
Wow tools permits to hide cape, or hair or facials geosets groups to work faster. Multiedit permits to edit multiple mesh at the same time but when you're done never forget to multiedit exit or you will fuck up everything !
To convert your model to M2i use M2modredux 4.8.13 i gave you in intro, it can converts MD21 model to M2i without having to delete the header first ! (works on some items too, not all unfortunately, not everything is perfect.) and use it to export to m2 after your finished editing.
So i'm done. Here's tutorial on how to edit using blender 2.73 and transfert weight :
For Uvmapping editing :
And now for general things you can do in blender :
Now if you ask me for weightpainting and possibility in blender 2.78 + 2.73 :
This big tutorial on my legion knowledge has now come to an end.
I didn't told you everything I know but with the theory you can do the same as me with a lot of hardwork to get the habits.
Here's some of my best examples :
+ making vrykul, skeleton or naga morph accessible with the theory of db2 editing + root file etc. Hope it will help a lot of you.