[1.10] Different Inventory Graphics for Each Class
Moderators: Nefarius, Havvoric
-
- Champion of the Light
- Posts: 283
- Joined: Thu Aug 29, 2013 2:38 pm
- Location: Skyrim
[1.10] Different Inventory Graphics for Each Class
Hello,
The thing i want to achieve is make the game load different dc6 images (inventory) for each class. I want to say that im absolute beginner on code editing. I found this link.
This is what i feel as a beginner
Can someone explain it a little more "step by step" maybe? Im asking for too much thing, i know, sorry. Just trying my luck here
Thanks
The thing i want to achieve is make the game load different dc6 images (inventory) for each class. I want to say that im absolute beginner on code editing. I found this link.
This is what i feel as a beginner
Can someone explain it a little more "step by step" maybe? Im asking for too much thing, i know, sorry. Just trying my luck here
Thanks
Life is too short to drive boring cars.
Re: [1.10] Different Inventory Graphics for Each Class
You hook into the code that loads the character inventory graphics, and replace it to load a different file, based on which class is used. You get the current class from the same variable used by the skill tree images loading procedure. Then, instead of passing a static string to the function that loads the image, you pass a formatted string, something along those lines:
Code: Select all
sprintf(szBuffer, "data\\global\\ui\\panel\\invchar%d", D2CLIENT_gdwCharacterClass);
D2CLIENT_LoadCellFile(szBuffer);
-
- Champion of the Light
- Posts: 283
- Joined: Thu Aug 29, 2013 2:38 pm
- Location: Skyrim
Re: [1.10] Different Inventory Graphics for Each Class
i already thinked using char class check from skills but instead of using c++ i thinked in asm. Maybe conditional jump (checks char class same as skill tree) then passes the string but didnt really know how to do it, i can mess things up.
so in your way, (in d2template) i can (lol im sure i cant) make an if statement that checks char class then use the code you gave me?
so in your way, (in d2template) i can (lol im sure i cant) make an if statement that checks char class then use the code you gave me?
Life is too short to drive boring cars.
Re: [1.10] Different Inventory Graphics for Each Class
In my project I did exactly what you want to do, but for the mana orb (I wanted different resources for every class as in Diablo III)
Also as a bonus, it also shows how to achieve an animated orb graphic
As you can see, it's all about passing a formatted string to the function that loads the graphic. Basically, in memory the class is represented by an integer.
0 = amazon
1 = sorceress
[ ... ]
And my code formats this integer into the string, so the %d gets replaced by the class integer. And so it loads Resource0.dc6 when it's an amazon, Resource1.dc6 when it's a sorceress, and so on.
Also as a bonus, it also shows how to achieve an animated orb graphic
Code: Select all
/*
Function: BOTTOMPANEL_DrawResourceOrb
Address: D2Client.0x27A90
Notes:
*/
void __fastcall BOTTOMPANEL_DrawResourceOrb()
{
D2UnitStrc* pPlayer = *D2CLIENT_sgptClientPlayer;
int nEnergy = D2COMMON_GetUnitStat(pPlayer, D2STAT_MANA, 0);
int nMaxEnergy = D2COMMON_GetUnitStat(pPlayer, D2STAT_MAXMANA, 0);
if (!sgptResourceOrbDc6)
{
char szBuffer[256] = {};
sprintf(szBuffer, "Data\\Global\\Themes\\%s\\ResourceOrbs\\Resource%d", gszGuiThemes[sgdwSelectedGuiTheme], pPlayer->dwTxtClass);
sgptResourceOrbDc6 = D2CLIENT_LoadCellFile(szBuffer, CELLFILETYPE_DC6);
}
if (!sgptOrbOverlapDc6)
{
char szBuffer[256] = {};
sprintf(szBuffer, "Data\\Global\\Themes\\%s\\Panels\\BottomPanelOverlap", gszGuiThemes[sgdwSelectedGuiTheme]);
sgptOrbOverlapDc6 = D2CLIENT_LoadCellFile(szBuffer, CELLFILETYPE_DC6);
}
int nOrbSize = GFX_GetStatBarLength(nEnergy, nMaxEnergy, 140);
int nFrames = D2CMP_GetFrameCount(sgptResourceOrbDc6);
D2GfxDataStrc EnergyGfx = {};
D2GfxDataStrc OverlapGfx = {};
EnergyGfx.pCellFile = sgptResourceOrbDc6;
EnergyGfx.nFrame = (GetTickCount() >> 6) % nFrames;
OverlapGfx.pCellFile = sgptOrbOverlapDc6;
D2GFX_DrawVerticalCropImage(&EnergyGfx, 837, 780, 12, nOrbSize, DRAWMODE_NORMAL);
OverlapGfx.nFrame = 0x03;
D2GFX_DrawImage(&OverlapGfx, 768, 768, -1, DRAWMODE_NORMAL, NULL);
OverlapGfx.nFrame = 0x01;
D2GFX_DrawImage(&OverlapGfx, 768, 768, -1, DRAWMODE_NORMAL, NULL);
}
0 = amazon
1 = sorceress
[ ... ]
And my code formats this integer into the string, so the %d gets replaced by the class integer. And so it loads Resource0.dc6 when it's an amazon, Resource1.dc6 when it's a sorceress, and so on.
-
- Champion of the Light
- Posts: 283
- Joined: Thu Aug 29, 2013 2:38 pm
- Location: Skyrim
Re: [1.10] Different Inventory Graphics for Each Class
Thanks a lot, the code you gave me clears most of the questions that i have in my mind. I will try as sson as i can and report back what i did (i hope you will see again). Thanks!
Life is too short to drive boring cars.
Re: [1.10] Different Inventory Graphics for Each Class
How to use ollydbg to do this?kidpaddle94 wrote: ↑Sun Mar 29, 2015 5:41 pmIn my project I did exactly what you want to do, but for the mana orb (I wanted different resources for every class as in Diablo III)
Also as a bonus, it also shows how to achieve an animated orb graphicAs you can see, it's all about passing a formatted string to the function that loads the graphic. Basically, in memory the class is represented by an integer.Code: Select all
/* Function: BOTTOMPANEL_DrawResourceOrb Address: D2Client.0x27A90 Notes: */ void __fastcall BOTTOMPANEL_DrawResourceOrb() { D2UnitStrc* pPlayer = *D2CLIENT_sgptClientPlayer; int nEnergy = D2COMMON_GetUnitStat(pPlayer, D2STAT_MANA, 0); int nMaxEnergy = D2COMMON_GetUnitStat(pPlayer, D2STAT_MAXMANA, 0); if (!sgptResourceOrbDc6) { char szBuffer[256] = {}; sprintf(szBuffer, "Data\\Global\\Themes\\%s\\ResourceOrbs\\Resource%d", gszGuiThemes[sgdwSelectedGuiTheme], pPlayer->dwTxtClass); sgptResourceOrbDc6 = D2CLIENT_LoadCellFile(szBuffer, CELLFILETYPE_DC6); } if (!sgptOrbOverlapDc6) { char szBuffer[256] = {}; sprintf(szBuffer, "Data\\Global\\Themes\\%s\\Panels\\BottomPanelOverlap", gszGuiThemes[sgdwSelectedGuiTheme]); sgptOrbOverlapDc6 = D2CLIENT_LoadCellFile(szBuffer, CELLFILETYPE_DC6); } int nOrbSize = GFX_GetStatBarLength(nEnergy, nMaxEnergy, 140); int nFrames = D2CMP_GetFrameCount(sgptResourceOrbDc6); D2GfxDataStrc EnergyGfx = {}; D2GfxDataStrc OverlapGfx = {}; EnergyGfx.pCellFile = sgptResourceOrbDc6; EnergyGfx.nFrame = (GetTickCount() >> 6) % nFrames; OverlapGfx.pCellFile = sgptOrbOverlapDc6; D2GFX_DrawVerticalCropImage(&EnergyGfx, 837, 780, 12, nOrbSize, DRAWMODE_NORMAL); OverlapGfx.nFrame = 0x03; D2GFX_DrawImage(&OverlapGfx, 768, 768, -1, DRAWMODE_NORMAL, NULL); OverlapGfx.nFrame = 0x01; D2GFX_DrawImage(&OverlapGfx, 768, 768, -1, DRAWMODE_NORMAL, NULL); }
0 = amazon
1 = sorceress
[ ... ]
And my code formats this integer into the string, so the %d gets replaced by the class integer. And so it loads Resource0.dc6 when it's an amazon, Resource1.dc6 when it's a sorceress, and so on.
Re: [1.10] Different Inventory Graphics for Each Class
If you want to use olly to do this, you will need to code it in assembly, you'll probably also need a bit of slack space depending on the version you are editing.
Netiquette, Do you USE it?!?! | Nefarius' Fixed TXT Files | Terms Of Service
Blackened | Day of Death | D2GFEx
"What was yours is mine. Your land, your people, and now your life." - Lim-Dul, the Necromancer
Judgement is Final, Death is Eternal
Re: [1.10] Different Inventory Graphics for Each Class
This is harder than copy this code.
I will try to learn how to make a new dll.
Thank you.
Re: [1.10] Different Inventory Graphics for Each Class
I readed sir_generals Advanced Code Editing Tutorial.sir_general's HeavanStorm C++ Coding Editing Tutorials and Joel's Advanced C++ Code Editing Tutorial.
But i don't know how to copy this code in dll.
I tried to load D2Client.dll by visual studio 2012.But can't find any code.
Have I missed some tutorials?
-
- Posts: 3
- Joined: Thu Aug 27, 2020 10:17 am
Re: [1.10] Different Inventory Graphics for Each Class
Can i have ur dll for diablo 1.13d? Please or please help with my dll http://www.mediafire.com/file/tmmq53yyc ... s.rar/file
Just wanna try like diablo3 diffrent globes for every character. Thanks
Just wanna try like diablo3 diffrent globes for every character. Thanks