Adding new maps to GameServer (1.00.18)
This tutorial shows, how we can add new maps. All offset are for GS 1.00.18, but you can easly find them in other GameServers. OK, we can start.
Firstly open GameServer in Olly.
I. Gameserver has limit of maps. We must remove it:
1. Change:
Code:
00520203 |. 6A 28 push 28 [40 maps <- number of original maps (HEX)]
->
00520203 |. 6A 33 push 33 [51 map <- here is numer of our maps (in HEX)]
2. Function MAPSVR_DATA::Clear
Code:
0054D9D4 837D F8 28 cmp [local.iMAP_COUNT], 28
->
0054D9D4 837D F8 33 cmp [local.iMAP_COUNT], 33
3. Function gObjCheckAttackArea
Code:
00501591 837D FC 28 cmp [local.mapnumber], 28
->
00501591 837D FC 33 cmp [local.mapnumber], 33
005015BB 837D F8 28 cmp [local.tarmapnumber], 28
->
005015BB 837D F8 33 cmp [local.tarmapnumber], 33
4. Function gObjSetState
Code:
004F507C 837D FC 28 cmp [local.n], 28
->
004F507C 837D FC 33 cmp [local.n], 33
5. Function CItemBagEx::CItemBagEx
Code:
0047CAB1 6A 28 push 28
->
0047CAB1 6A 33 push 33
II. Now we must remove warp limit:
1. Function MapNumberCheck
Code:
0048F72F 837D 08 27 cmp [arg.map], 27 [Maps 0-39]
->
0048F72F 837D 08 32 cmp [arg.map], 32 [Maps 0-50]
2. Function gObjSetCharacter
Code:
004D3C58 83FA 27 cmp edx, 27
->
004D3C58 83FA 32 cmp edx, 32
3. Function GetMapMoveLevel
Code:
004D2980 837D 0C 27 cmp [arg.mapnumber], 27
->
004D2980 837D 0C 32 cmp [arg.mapnumber], 32
III. OK, we have some space for new maps. Now we must load them. We can easly write DLL, which loads new maps:
1. Loading new maps looks that:
Code:
void LoadMaps()
{
LoadMap("..\\Data\\Terrain41.att", 40);
LoadMap("..\\Data\\Terrain42.att", 41);
/*... Dalej ładujemy kolejne mapy...*/
}
_declspec (naked) void LoadMap (char * mapname, DWORD mapnr)
{
__asm
{
PUSH EBP
MOV EBP, ESP
SUB ESP, 4
MOV ECX, mapnr
IMUL ECX, ECX, 0x51068
ADD ECX, 0x9FF4BD0
MOV EDX , 0x403A6C
CALL EDX
MOV EAX, mapname
PUSH EAX
MOV ECX, mapnr
IMUL ECX, ECX, 0x51068
ADD ECX, 0x9FF4BD0
MOV EDX, 0x403698
CALL EDX
MOV ESP, EBP
POP EBP
RETN
}
}
2. We must make call to our DLL. The best place is GameMainInit function.
IV. OK, we have new maps loaded., but there is no item drop. We must remove drop item limit:
1. Fix item drop. Function gObjMonsterDieGiveItem:
Code:
0041B60B |. /74 4C je short GameServ.0041B659
->
0041B60B /EB 4C jmp short GameServ.0041B659
2. Fix picking items. Functions CGItemGetRequest and MapClass::ItemGive:
Code:
0043596C |. /75 49 jnz short GameServ.004359B7
->
0043596C /EB 49 jmp short GameServ.004359B7
00490847 |. /74 53 je short GameServ.0049089C
->
00490847 /EB 53 jmp short GameServ.0049089C
V. Now we add respawn after death on new maps. Lorencia will be good choice.
1. Go to gObjSetState function and change:
Code:
004F47A8 |. 83F8 01 |cmp eax, 1
004F47AB |. 75 4A |jnz short GameServ.004F47F7
->
004F47A8 /E9 F4080000 jmp GameServ.004F50A1
2. On offset004F50A1 we write:
Code:
004F50A1 83F8 01 cmp eax, 1 [Lorencia]
004F50A4 75 05 jnz short GameServ.004F50AB
004F50A6 ^ E9 02F7FFFF jmp GameServ.004F47AD
004F50AB 83F8 29 cmp eax, 29 [Our map (HEX)]
004F50AE 75 05 jnz short GameServ.004F50B5
004F50B0 ^ E9 F8F6FFFF jmp GameServ.004F47AD
004F50B5 83F8 30 cmp eax, 30 [Our map (HEX)]
004F50B8 ^ 0F85 39F7FFFF jnz GameServ.004F47F7
004F50BE ^ E9 EAF6FFFF jmp GameServ.004F47AD
VI. Done. :) We have fully working new maps!
Re: [Guide] Adding new maps to GameServer (1.00.18)
i would do that if
1.I wouldent be a noob at asm
2.I had terrains
3.I had terrains (Client side)
Re: [Guide] Adding new maps to GameServer (1.00.18)
Re: [Guide] Adding new maps to GameServer (1.00.18)
very very good job thank you very very very very much 100/100
Re: [Guide] Adding new maps to GameServer (1.00.18)
Quote:
void LoadMaps()
{
LoadMap("..\\Data\\Terrain41.att", 40);
LoadMap("..\\Data\\Terrain42.att", 41);
/*... Dalej ładujemy kolejne mapy...*/
}
_declspec (naked) void LoadMap (char * mapname, DWORD mapnr)
{
__asm
{
PUSH EBP
MOV EBP, ESP
SUB ESP, 4
MOV ECX, mapnr
IMUL ECX, ECX, 0x51068
ADD ECX, 0x9FF4BD0
MOV EDX , 0x403A6C
CALL EDX
MOV EAX, mapname
PUSH EAX
MOV ECX, mapnr
IMUL ECX, ECX, 0x51068
ADD ECX, 0x9FF4BD0
MOV EDX, 0x403698
CALL EDX
MOV ESP, EBP
POP EBP
RETN
}
}
How i can use it? I write it where??? and i want add map 51(Ebleland)?
Sorry i bad english!!!
Re: [Guide] Adding new maps to GameServer (1.00.18)
gg, what about memory allocation for new maps?)))
i've added maps for 99.60T with new memory allocation for all maps and it worked perfectly, but i don't think that this method will work, because in 99.60T memory for maps was allocated statically not dynamically
the same thing is when changing max lvl, exp table has fixed size
so just by changing values in GS for kind of things would work only if memory was allocated dynamically, thats why when you want to change max lvl or number of maps to the value higher then it was compiled with, you have to reallocate memory for array and change all references to original array, and GS will do all the work for you =)
Re: [Guide] Adding new maps to GameServer (1.00.18)
Re: [Guide] Adding new maps to GameServer (1.00.18)
you need to change some offsets from the example above. in the naked asm declaration, those are for 99.88T
Re: [Guide] Adding new maps to GameServer (1.00.18)
Good !...Nice 10/10 to you...DMCahir
1 Attachment(s)
Re: [Guide] Adding new maps to GameServer (1.00.18)
I am trying to make an addition for map 51 can anyone share a working unpacked dll that can be edited or already done for map 51. I followed this guide and then used Chris05 guide to hook the dll and every time I try to start the gs now it crashes so I am assuming my dll is made improperly. Thanks in advance for the assistance. for those that might want to look at the dll and tell me what may be wrong here it is.
Re: [Guide] Adding new maps to GameServer (1.00.18)
error C2660: 'LoadMap' : function does not take 2 arguments
Edit: Problem solved(I forgot to add arguments in .h file)
Re: [Guide] Adding new maps to GameServer (1.00.18)
Is this the correct code for adding map 51 in gs 1.00.18?
void LoadMaps()
{
LoadMap("..\\Data\\Terrain51.att", 50);
/*... Dalej ?adujemy kolejne mapy...*/
}
_declspec (naked) void LoadMap (char * mapname, DWORD mapnr)
{
__asm
{
PUSH EBP
MOV EBP, ESP
SUB ESP, 4
MOV ECX, mapnr
IMUL ECX, ECX, 0x51068
ADD ECX, 0x9FF4BD0
MOV EDX , 0x403A6C
CALL EDX
MOV EAX, mapname
PUSH EAX
MOV ECX, mapnr
IMUL ECX, ECX, 0x51068
ADD ECX, 0x9FF4BD0
MOV EDX, 0x403698
CALL EDX
MOV ESP, EBP
POP EBP
RETN
}
}
or is there something that needs to be altered? your help is appreciated.
Re: [Guide] Adding new maps to GameServer (1.00.18)
You need to write there all maps!
The maps.cpp file:
Code:
#include "maps.h"
void LoadMap()
{
LoadMap("..\\Data\\Terrain51.att", 50);
//Add all maps
}
_declspec (naked) void LoadMap (char * mapname, DWORD mapnr)
{
__asm
{
PUSH EBP
MOV EBP, ESP
SUB ESP, 4
MOV ECX, mapnr
IMUL ECX, ECX, 0x51068
ADD ECX, 0x9FF4BD0
MOV EDX , 0x403A6C
CALL EDX
MOV EAX, mapname
PUSH EAX
MOV ECX, mapnr
IMUL ECX, ECX, 0x51068
ADD ECX, 0x9FF4BD0
MOV EDX, 0x403698
CALL EDX
MOV ESP, EBP
POP EBP
RETN
}
}
The maps.h file:
Code:
void LoadMap(char * mapname, DWORD mapnr);
I'm sure that GameServer will load the maps, but I think you need to allocate memory for them, which is a pretty long story. And I also think that you will be reteleported on the map every 1 second. You need to hook the compiled DLL in GameServer, and you need to make the modifications in GameServer posted by Cahir.
Re: [Guide] Adding new maps to GameServer (1.00.18)
i didn't see remove the limit of maps, its only increasing :p
Re: [Guide] Adding new maps to GameServer (1.00.18)
He didn't remove the limits for load terrains and for teleport. He only increased them to 52.