Page 1 of 1

[RELEASE] Simulate Number of Players 1.13c MP/SP !

Posted: Sat Apr 28, 2018 12:24 pm
by PillarsOfGarendall
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),

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 };
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:

Code: Select all

{ D2DLL_D2GAME,0x124F8,0x00,(DWORD)GetVirtualPlayerCount,	TRUE },
{ D2DLL_D2GAME,0xAF87C,0x00,(DWORD)GetVirtualPlayerCount,TRUE },
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.

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 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.

Re: [HELP] Simulate Number of Players D2Game.dll 1.13c

Posted: Sat Apr 28, 2018 3:15 pm
by devurandom
easy to set the global @ patch time

gdwVirtualPlayers D2Game.0x111C1C // 6FD31C1C [1.13c]

Re: [HELP] Simulate Number of Players D2Game.dll 1.13c

Posted: Sat Apr 28, 2018 4:09 pm
by PillarsOfGarendall
devurandom wrote:
Sat Apr 28, 2018 3:15 pm
easy to set the global @ patch time

gdwVirtualPlayers D2Game.0x111C1C // 6FD31C1C [1.13c]
lol i know this already, but it's not what i'm searching for (maybe i badly explained my case lol).

It's to be used on my mod which is hosted online, so it's obviously runing with pvpgn so it's a command to set the number of players (packet handler and stuff).

This variable seem to do nothing at all online, it's like it's only for SP, i think there is a function or something else that set it ? (when player join the room) for instance.

I'm currently reversing D2Game.dll to get some clue, take note that this must be only in A SPECIFIC ROOM (pGame) as if a player is farming nihlathak and do #players 8 it will set it only for him ... not all room hosted on the D2GS lol ^^.

Also i have XREF from the virtualPlayerCount variable and i found this function, sub_6FCCF840 (D2Game.dll+AF840) may be you know what is this function doing ?

Re: [HELP] Simulate Number of Players D2Game.dll 1.13c MP ONLY

Posted: Sat Apr 28, 2018 4:43 pm
by Necrolis
There will be a branch based on the game type for all the functions that add the various player-count based boni.
Please note that we do not support PVPGN or any private server stuff on this board.

Re: [HELP] Simulate Number of Players D2Game.dll 1.13c MP ONLY

Posted: Sat Apr 28, 2018 10:32 pm
by PillarsOfGarendall
Necrolis wrote:
Sat Apr 28, 2018 4:43 pm
There will be a branch based on the game type for all the functions that add the various player-count based boni.
Please note that we do not support PVPGN or any private server stuff on this board.
Hello, i just want to set the same monster hp,damage,xp and possibly the drop rate of /players 8 in a specific pGame.

So i thought that maybe there is a way to do it ? Or the worst case i clearly iterate all objects/monsters and SET the treasure class to be similar to an actual pGame with 8 players (online) in the room ?

My goal is only to do a way to have the same result of a p8 pGame but with only 1 real players in the said pGame... well it's related to d2game.dll only,
I assume i haven't broke the forum rule.

Ps: Why not update the wiki with all structures :P ? (1.13c).
Thanks !

Re: [HELP] Simulate Number of Players D2Game.dll 1.13c MP ONLY

Posted: Sun Apr 29, 2018 5:51 am
by thaison
If you want a monster like 8 players then check out this address:

Code: Select all

[1.13c]

Life: D2Game.dll - 0xAF5F0
Exp: D2Game.dll - 0xAF5D0
Drop: D2Game.dll - 0x379A0
Or: viewtopic.php?t=63578

Re: [HELP] Simulate Number of Players D2Game.dll 1.13c MP ONLY

Posted: Sun Apr 29, 2018 10:28 am
by PillarsOfGarendall
thaison wrote:
Sun Apr 29, 2018 5:51 am
If you want a monster like 8 players then check out this address:

Code: Select all

[1.13c]

Life: D2Game.dll - 0xAF5F0
Exp: D2Game.dll - 0xAF5D0
Drop: D2Game.dll - 0x379A0
Or: viewtopic.php?t=63578
Thanks for the addresses, now it become more clear in IDA, solving the puzzle :D.

Re: [RELEASE] Simulate Number of Players 1.13c MP/SP !

Posted: Tue May 01, 2018 3:15 pm
by PillarsOfGarendall
Updated Main post.

Re: [RELEASE] Simulate Number of Players 1.13c MP/SP !

Posted: Wed Aug 01, 2018 10:50 pm
by meinerdeiner
Hey where you get this ?

D2GAME_GetVirtualPlayerCount(ThisGame);

Re: [RELEASE] Simulate Number of Players 1.13c MP/SP !

Posted: Fri Feb 26, 2021 10:42 am
by mengxuecen
Hey where you get this ?

D2GAME_GetVirtualPlayerCount(ThisGame);