[source]Full PetSystem

08/11/2012 11:01 balika01#1
#closed because lot of people sent me "please help", "how to add to game"....
08/11/2012 11:13 [The]Domco#2
Okay, but how i can add this function to the game file ?
08/11/2012 11:26 akupowa#3
Quote:
Originally Posted by balika01 View Post
Hello everybody!

Here the source:
Code:
int __fastcall quest__pet_summon(int a1)
{
	//- get datas from lua -- read vnum and name
	int mobvnum = lua_tonumber(a1, 1);
	const char* mobname = lua_tostring(a1, 2);
	//- get character position
	int spawn_mapindex = *(_DWORD *)(a1 + 220 + 32)/*character_mapindex*/;
	int spawn_x = *(_DWORD *)(a1 + 220 + 48)/*character_x_on_map*/ + number_ex(-20, 20, (int)"pets", 10)/*random number*/;
	int spawn_y = *(_DWORD *)(a1 + 220 + 52)/*character_y_on_map*/ + number_ex(-20, 20, (int)"pets", 10)/*random number*/;
	int spawn_z = *(_DWORD *)(a1 + 220 + 56)/*character_z_on_map*/;
	int spawn_rotate = *(_DWORD *)(a1 + 220 + 2344) + 180.0/*character_rotate_on_map*/;
	//- create mob
	int mobid = CHARACTER_MANAGER__SpawnMob(0,mobvnum,spawn_mapindex,spawn_x,spawn_y,spawn_z,0,spawn_rotate,0);
	//- set mob name
	std__string__assign(0, 0, mobid + 260, (int)mobname, strlen(mobname));
	//- show mob
	if (!CHARACTER__Show(mobid,spawn_mapindex,spawn_x,spawn_y,spawn_z,0))
	{
	//- if not showed the mob:
		//- remove mob
		CHARACTER_MANAGER__DestroyCharacter(a1, 0, singleton_CHARACTER_MANAGER___ms_singleton, mobid);
		//- send error to syserr
		sys_err((int)"PetSummon", 192, "cannot show monster", 137591780);
		//- return 0 -- exit func
		return 0;
	}
	//- attach mob to character
	CHARACTER__SetRider(a1, 0, mobid, a1 + 220);
	//- return whit spawned mob id (id of the mob on map)
	lua_pushnumber(a1, mobid);
	return 1;
}

int __fastcall quest__pet_unsummon(int a1)
{
	//- get datas from lua -- read spawned mob id (id of the mob on map)
	int mobid = lua_tonumber(a1, 1);
	//- return if mobid is 0 -- exit func
	if ( !mobid ) return 0;
	//- deattach mob from character
	CHARACTER__SetRider(a1, 0, mobid, 0);
	//- remove mob
	CHARACTER_MANAGER__DestroyCharacter(a1, 0, singleton_CHARACTER_MANAGER___ms_singleton, mobid);
	// return -- end of func
	return 0;
}
is it from the new game file? :rolleyes:
08/11/2012 11:43 XxxGaGaxxX#4
Quote:
Originally Posted by balika01 View Post
#closed because lot of people sent me "please help", "how to add to game"....
Why you don't help them then?^^

Let me guess, you've just copied this Source from another Forum and post it here, but you don't know how to add it yourself... :D
08/11/2012 11:51 [The]Domco#5
Eh .. I Only know ho to edit old functions but i dont know how to add new so -.-
08/11/2012 13:23 xKri#6
Quote:
Originally Posted by Creator7111 View Post
Eh .. I Only know ho to edit old functions but i dont know how to add new so -.-
Maybe you have to add it to the pseudocode and recompile it...
08/11/2012 13:27 [The]Domco#7
Quote:
Originally Posted by xKri View Post
Maybe you have to add it to the pseudocode and recompile it...
How ?
08/11/2012 13:28 NiiceOne#8
Quote:
Originally Posted by Creator7111 View Post
Eh .. I Only know ho to edit old functions but i dont know how to add new so -.-
i think it should be the same as you will add a new function in the client.
08/11/2012 13:31 Pаylasici#9
Quote:
Originally Posted by balika01 View Post
#closed because lot of people sent me "please help", "how to add to game"....
PHP Code:
int __fastcall quest__pet_summon(int a1)
{
    
//- get datas from lua -- read vnum and name
    
int mobvnum lua_tonumber(a11);
    const 
charmobname lua_tostring(a12);
    
//- get character position
    
int spawn_mapindex = *(_DWORD *)(a1 220 32)/*character_mapindex*/;
    
int spawn_x = *(_DWORD *)(a1 220 48)/*character_x_on_map*/ number_ex(-2020, (int)"pets"10)/*random number*/;
    
int spawn_y = *(_DWORD *)(a1 220 52)/*character_y_on_map*/ number_ex(-2020, (int)"pets"10)/*random number*/;
    
int spawn_z = *(_DWORD *)(a1 220 56)/*character_z_on_map*/;
    
int spawn_rotate = *(_DWORD *)(a1 220 2344) + 180.0/*character_rotate_on_map*/;
    
//- create mob
    
int mobid CHARACTER_MANAGER__SpawnMob(0,mobvnum,spawn_mapindex,spawn_x,spawn_y,spawn_z,0,spawn_rotate,0);
    
//- set mob name
    
std__string__assign(00mobid 260, (int)mobnamestrlen(mobname));
    
//- show mob
    
if (!CHARACTER__Show(mobid,spawn_mapindex,spawn_x,spawn_y,spawn_z,0))
    {
    
//- if not showed the mob:
        //- remove mob
        
CHARACTER_MANAGER__DestroyCharacter(a10singleton_CHARACTER_MANAGER___ms_singletonmobid);
        
//- send error to syserr
        
sys_err((int)"PetSummon"192"cannot show monster"137591780);
        
//- return 0 -- exit func
        
return 0;
    }
    
//- attach mob to character
    
CHARACTER__SetRider(a10mobida1 220);
    
//- return whit spawned mob id (id of the mob on map)
    
lua_pushnumber(a1mobid);
    return 
1;
}

int __fastcall quest__pet_unsummon(int a1)
{
    
//- get datas from lua -- read spawned mob id (id of the mob on map)
    
int mobid lua_tonumber(a11);
    
//- return if mobid is 0 -- exit func
    
if ( !mobid ) return 0;
    
//- deattach mob from character
    
CHARACTER__SetRider(a10mobid0);
    
//- remove mob
    
CHARACTER_MANAGER__DestroyCharacter(a10singleton_CHARACTER_MANAGER___ms_singletonmobid);
    
// return -- end of func
    
return 0;

08/11/2012 13:52 xKri#10
Quote:
Originally Posted by Creator7111 View Post
How ?
You can get the pseudocode of the gamefile by IDA disassembler.
Then add the code of pet system (i don't know where) in the source and recompile it on freebsd.

[Only registered and activated users can see links. Click Here To Register...]

I'm not sure that it's the correct way, but I'll try :)
08/11/2012 13:54 XxxGaGaxxX#11
Quote:
Originally Posted by killerblümchen1999 View Post
PHP Code:
int __fastcall quest__pet_summon(int a1)
{
    
//- get datas from lua -- read vnum and name
    
int mobvnum lua_tonumber(a11);
    const 
charmobname lua_tostring(a12);
    
//- get character position
    
int spawn_mapindex = *(_DWORD *)(a1 220 32)/*character_mapindex*/;
    
int spawn_x = *(_DWORD *)(a1 220 48)/*character_x_on_map*/ number_ex(-2020, (int)"pets"10)/*random number*/;
    
int spawn_y = *(_DWORD *)(a1 220 52)/*character_y_on_map*/ number_ex(-2020, (int)"pets"10)/*random number*/;
    
int spawn_z = *(_DWORD *)(a1 220 56)/*character_z_on_map*/;
    
int spawn_rotate = *(_DWORD *)(a1 220 2344) + 180.0/*character_rotate_on_map*/;
    
//- create mob
    
int mobid CHARACTER_MANAGER__SpawnMob(0,mobvnum,spawn_mapindex,spawn_x,spawn_y,spawn_z,0,spawn_rotate,0);
    
//- set mob name
    
std__string__assign(00mobid 260, (int)mobnamestrlen(mobname));
    
//- show mob
    
if (!CHARACTER__Show(mobid,spawn_mapindex,spawn_x,spawn_y,spawn_z,0))
    {
    
//- if not showed the mob:
        //- remove mob
        
CHARACTER_MANAGER__DestroyCharacter(a10singleton_CHARACTER_MANAGER___ms_singletonmobid);
        
//- send error to syserr
        
sys_err((int)"PetSummon"192"cannot show monster"137591780);
        
//- return 0 -- exit func
        
return 0;
    }
    
//- attach mob to character
    
CHARACTER__SetRider(a10mobida1 220);
    
//- return whit spawned mob id (id of the mob on map)
    
lua_pushnumber(a1mobid);
    return 
1;
}

int __fastcall quest__pet_unsummon(int a1)
{
    
//- get datas from lua -- read spawned mob id (id of the mob on map)
    
int mobid lua_tonumber(a11);
    
//- return if mobid is 0 -- exit func
    
if ( !mobid ) return 0;
    
//- deattach mob from character
    
CHARACTER__SetRider(a10mobid0);
    
//- remove mob
    
CHARACTER_MANAGER__DestroyCharacter(a10singleton_CHARACTER_MANAGER___ms_singletonmobid);
    
// return -- end of func
    
return 0;


Wtf, akupowa zitiert es, du postest es nach 5 Minuten & kriegst dafür 'n thanks o.O...
08/11/2012 16:05 Pаylasici#12
Quote:
Originally Posted by XxxGaGaxxX View Post

Wtf, akupowa zitiert es, du postest es nach 5 Minuten & kriegst dafür 'n thanks o.O...
Weil ich es kann...

Nein Spaß, ich habe seinen Beitrag schon vorher zitiert, nur nach
wenigen Minuten meinen Beitrag abgesendet.
08/11/2012 19:07 kwiatmix#13
help!

How can i add this code to the game file ?
08/11/2012 19:09 matuszny1987#14
haha kwiatmix o kurwa
08/11/2012 19:09 Pаylasici#15
It's not possible to add new functions to the "Game Binary" with the natural way.