-
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.
-
Re: [Guide] Adding new maps to GameServer (1.00.18)
is there a guide anywhere as to how to allocate memory in the gs for new maps? I have not been able to find one.
and yes the character keeps regenerating or flashing when i move to the map. How can i fix that? are there any guides anywhere?
-
Re: [Guide] Adding new maps to GameServer (1.00.18)
soo somebody have the dll compiled? with all the maps? bcuz i have problems compiling >.<
-
Re: [Guide] Adding new maps to GameServer (1.00.18)
-
Re: [Guide] Adding new maps to GameServer (1.00.18)
how to add to SCF 5 Series?
Coz i thik they use someting for the maps they add right?
Thanks
-
Re: [Guide] Adding new maps to GameServer (1.00.18)
i cant add maps for me GS... because dll is not found...
-
Re: [Guide] Adding new maps to GameServer (1.00.18)
why are you giving when it compiles?
error C3861: 'LoadMap': identifier not found
error C2061: syntax error : identifier 'DWORD'
-
Re: [Guide] Adding new maps to GameServer (1.00.18)
@pegasus128
Quote:
why are you giving when it compiles?
error C3861: 'LoadMap': identifier not found
error C2061: syntax error : identifier 'DWORD
=============================================
You have to do so
mapas.h
PHP Code:
# include <stdio.h>
# include <windows.h>
void LoadMaps ();
void LoadMap (char * mapname, DWORD mapnr);
and mapas.cpp
PHP Code:
# include "mapas.h"
void LoadMaps ()
{
LoadMap ("..\\ Data\\Terrain41.att", 40);
LoadMap ("..\\ Data\\Terrain42.att", 41);
}
__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
}
}
-
Re: [Guide] Adding new maps to GameServer (1.00.18)
Delete this line: LoadMap void (char * mapname, DWORD mapnr); and it will work, but it's a bad method to do this.
-
Re: [Guide] Adding new maps to GameServer (1.00.18)
Nice job, DMCahir.
But I think it will occur some problems
With GS 1.00.18:
0x9FF4BD0 is the BASE Offset of MapArray
The default Max number of Map is 0x28
The Map size is 0x51068
The BASE Dir Offset is 0xAC9DC10
You can see: 0x9FF4BD0 + 0x28 * 0x51068 = 0xAC9DC10
So, If we increase the Max number (sample to: 0x33), and after _asm code execute, the memory of MapArray overwrite the value at offset 0xAC9DC10, or if some thing done by GameServer orverwrite the memory of Map number 0x29 ect...
I think some problem will occur!
-
Re: Adding new maps to GameServer (1.00.18)
Hello, I have a question
First: how to do this? "We Must call to make Our DLL. The best place is GameMainInit function"
Second: If I create a. dll with the given source, it compiled and hook it works?
Greetings..
-
Re: Adding new maps to GameServer (1.00.18)
How to load new map in CLient? 1.04D Main
-
Re: Adding new maps to GameServer (1.00.18)
someone could be so kind as to do the same guide for versions 97d or 97 + 99
thank you very much
-
Re: Adding new maps to GameServer (1.00.18)
Para la 97D
#include "mapas.h"
CHAR MapBuff[21][15] = {
"Terrain1.att",
"Terrain2.att",
"Terrain3.att",
"Terrain4.att",
"Terrain5.att",
"Terrain6.att",
"Terrain7.att",
"Terrain8.att",
"Terrain9.att",
"Terrain10.att",
"Terrain11.att",
"Terrain12.att",
"Terrain17.att",
"Terrain18.att",
"Terrain19.att",
"Terrain20.att",
"Terrain21.att",
};
void MapLoad()
{
for(int i=0;i<0x15;i++)
{
_asm
{
Mov Ecx, i
Imul Ecx, Ecx, 0x4DB68
Add Ecx, 0x6354C78
Mov Eax, 0x00402225
Call Eax
Mov Eax, i
Push Eax
Mov Ecx, i
Imul Ecx, Ecx, 0FH
Add Ecx, offset MapBuff
Push Ecx
Mov Ecx, 0x0687DE60
Mov Eax, 0x00401A7D
Call Eax
Push Eax
Mov Ecx, i
Imul Ecx, Ecx, 0x4DB68
Add Ecx, 0x6354C78
Mov Eax, 0x00401FC3
Call Eax
}
}
}
//LoadMaps 100%
SetByte(0x00489424,0x15);
SetByte(0x0048948F,0x15);
SetByte(0x0047C7D4,0x15);
SetByte(0x0047334E,0x15);
SetByte(0x0047C499,0x15);
SetByte(0x0047C7D4,0x15);
SetByte(0x0047C7FE,0x15);
SetByte(0x0045D153,0x15);
SetByte(0x00443782,0x14);
SetByte(0x00497B30,0x14);
SetByte(0x00497C00,0x14);
SetByte(0x0045C620,0x14);
SetByte(0x0045C77B,0x14);
SetByte(0x0045BA63,0x14);
*(DWORD*)(0x004D0A00) = (DWORD)&MapLoad;