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

This forum is for discussions on how to edit what can not be edited through the txt files, needless to say this isn't about battle net hacking.

Moderators: Nefarius, Havvoric

Post Reply
User avatar
PillarsOfGarendall
Posts: 24
Joined: Wed Sep 18, 2013 3:22 pm
France

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

Post by PillarsOfGarendall » 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),

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.
Last edited by PillarsOfGarendall on Wed May 02, 2018 9:34 pm, edited 6 times in total.
Searching D2Game.dll.pdb of version 1.13c and all the DLL's .pdb if you are an ex blizzard programmer throw me a pm !
Valentin aka Nightshades.

User avatar
devurandom
Forum Regular
Angel
Posts: 897
Joined: Sat Mar 07, 2015 9:07 pm
United States of America

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

Post by devurandom » Sat Apr 28, 2018 3:15 pm

easy to set the global @ patch time

gdwVirtualPlayers D2Game.0x111C1C // 6FD31C1C [1.13c]
Assembly Reference | 1.13d Code Edits | UVLoD | BaseMod Plugin

Fiat paper money is the most elaborate and well devised form of slavery the world has ever seen..

User avatar
PillarsOfGarendall
Posts: 24
Joined: Wed Sep 18, 2013 3:22 pm
France

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

Post by PillarsOfGarendall » Sat Apr 28, 2018 4:09 pm

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 ?
Searching D2Game.dll.pdb of version 1.13c and all the DLL's .pdb if you are an ex blizzard programmer throw me a pm !
Valentin aka Nightshades.

User avatar
Necrolis
Senior Admin
Throne
Posts: 9125
Joined: Sat Mar 25, 2006 1:22 pm
Location: The Land of the Dead
Contact:
South Africa

Hand-picked

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

Post by Necrolis » 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.
Image
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

User avatar
PillarsOfGarendall
Posts: 24
Joined: Wed Sep 18, 2013 3:22 pm
France

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

Post by PillarsOfGarendall » Sat Apr 28, 2018 10:32 pm

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 !
Searching D2Game.dll.pdb of version 1.13c and all the DLL's .pdb if you are an ex blizzard programmer throw me a pm !
Valentin aka Nightshades.

User avatar
thaison
Junior Member
Paladin
Posts: 108
Joined: Fri Apr 03, 2015 11:59 am
Location: Viet Nam
Vietnam

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

Post by thaison » 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

User avatar
PillarsOfGarendall
Posts: 24
Joined: Wed Sep 18, 2013 3:22 pm
France

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

Post by PillarsOfGarendall » Sun Apr 29, 2018 10:28 am

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.
Searching D2Game.dll.pdb of version 1.13c and all the DLL's .pdb if you are an ex blizzard programmer throw me a pm !
Valentin aka Nightshades.

User avatar
PillarsOfGarendall
Posts: 24
Joined: Wed Sep 18, 2013 3:22 pm
France

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

Post by PillarsOfGarendall » Tue May 01, 2018 3:15 pm

Updated Main post.
Searching D2Game.dll.pdb of version 1.13c and all the DLL's .pdb if you are an ex blizzard programmer throw me a pm !
Valentin aka Nightshades.

meinerdeiner
Posts: 17
Joined: Sun Feb 26, 2017 8:29 pm
Germany

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

Post by meinerdeiner » Wed Aug 01, 2018 10:50 pm

Hey where you get this ?

D2GAME_GetVirtualPlayerCount(ThisGame);

mengxuecen
Posts: 33
Joined: Mon Mar 11, 2019 5:34 am

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

Post by mengxuecen » Fri Feb 26, 2021 10:42 am

Hey where you get this ?

D2GAME_GetVirtualPlayerCount(ThisGame);

Post Reply

Return to “Code Editing”