[RELEASE] Simulate Number of Players 1.13c MP/SP !
Posted: Sat Apr 28, 2018 12:24 pm
After 2-3 Days and proper understanding i did it with the easy way and it's probably the best.
For the goodies here are the 3 tables used by the game (i wrote them just for info),
Ok I'm using D2Template (thanks to kidpaddle and his awesome work) to patch the address and there are 2 address refering to player's Count (in order to select the corresponding value of the table).
You need to patch those addresses:
So now that we have replaced the function CALL with our function i called it "GetVirtualPlayerCount"
it will execute our function instead and it's where the magic happen.
So when the game will call our function it will pass pGame in EAX so you see, i copy the EAX value into "ThisGame" which is our actual pGame (the game room we are in), if there is something wrong and it's not reading the number of clients (probably because you are making an SP mode) it return The VirtualPlayerCount (/Players x) otherwise it will return the number of clients IN THIS pGame (In this room).
So with proper way (admin command, or something else) you will simply need to do this (if you want players 8) pGame->nClients = 8;
As it's impossible to talk about packets handler or anything related to it i'll stop with this but i hope this post helped.
Thanks to kidpaddle for the awesome D2Template that i used for many years and to the people that helped me to find quicker the addresses for the monsters.
For the goodies here are the 3 tables used by the game (i wrote them just for info),
Code: Select all
const int MonsterLife_Percent_Per_Players[9] = { 0,0,50,100,150,200,250,300,350 };
const int MonsterExp_Percent_Per_Players[9] = { 0,0,50,100,150,200,250,300,350 };
const int MonsterDamage_Percent_Per_Players[9] = { 0,0,8,16,24,32,40,48,56 };
You need to patch those addresses:
Code: Select all
{ D2DLL_D2GAME,0x124F8,0x00,(DWORD)GetVirtualPlayerCount, TRUE },
{ D2DLL_D2GAME,0xAF87C,0x00,(DWORD)GetVirtualPlayerCount,TRUE },
it will execute our function instead and it's where the magic happen.
Code: Select all
int __fastcall GetVirtualPlayerCount()
{
D2GameStrc *ThisGame;
__asm
{
mov ThisGame, eax;
}
if (IsBadCodePtr((FARPROC)ThisGame->nClients))
{
return D2GAME_GetVirtualPlayerCount(ThisGame);
}
else
{
return ThisGame->nClients;
}
}
So with proper way (admin command, or something else) you will simply need to do this (if you want players 8) pGame->nClients = 8;
As it's impossible to talk about packets handler or anything related to it i'll stop with this but i hope this post helped.
Thanks to kidpaddle for the awesome D2Template that i used for many years and to the people that helped me to find quicker the addresses for the monsters.