Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Decompiled gObjCreatePet function from main.exe (1.03.15) eng

Joined
Oct 29, 2007
Messages
1,290
Reaction score
1,308
Well hello everyone again this time I would like to share my decompilation of this function that basically what it does is create a starting object an item equipped in the Character's Inventory, Enjoy it!

Code:
[COLOR=#ff0000].cpp file[/COLOR]

ObjCreateBug gObjCreateBug		= (ObjCreateBug)0x004ADF24;
ObjCreatePet gObjCreatePet		= (ObjCreatePet)0x0075720C;

void gObjCreatePetEx(int ItemId)
{
    int ItemSwitch        = *(WORD*)ItemId;
    int PetPreview        = LODWORD(pPreviewPetThis) + 700;
    // ----
    switch (ItemSwitch)
    {
        case ItemId(13, 98):
            gObjCreateBug(eBugType::Skeleton, PetPreview + 252, PetPreview, 0, 0);
        break;
        // ---
        case ItemId(13, 99):
            gObjCreateBug(eBugType::Unicorn, PetPreview + 252, PetPreview, 0, 0);
        break;
    }
    gObjCreatePet(ItemId);
}

void gObjCreatePetExHook()
{
    Utils.SetHook((LPVOID)gObjCreatePetEx,(LPVOID)0x0073684D,ASM::CALL);
    Utils.SetHook((LPVOID)gObjCreatePetEx,(LPVOID)0x0075567E,ASM::CALL);
}

Code:
[COLOR=#ff0000].h file

[/COLOR]#define ItemId(x, y)            ((x * 512) + y)
#define pPreviewPetThis            *(DWORD*)0x07A76A00
#define LODWORD(h)                ((DWORD)(__int64(h) & __int64(0xffffffff)))

enum eBugType
{
    Skeleton        = 7587,
    Unicorn            = 7588,
};

typedef void (__thiscall *ObjCreatePet)(int ItemId);
extern ObjCreatePet gObjCreatePet;
// --
typedef int (__cdecl *ObjCreateBug)(int BugId, int Arg2, int Arg3, int Arg4, int Arg5);
extern ObjCreateBug gObjCreateBug;
// --

Video test:



PS: This is my own code based on original...
I mean.. is not complete decompilation code of original function from main.exe code, but works to add new pets.

PS 2: This code is only to create a temporal preview of every pet or object equipped (for a complete work with this you must modify your server side & client side gObjMakePreviewCharSet functions)... to generate movement on every model, hp bar for pet and etc, you must use anothers functions from your main.

Credits:


Webzen & Me (Nemesis).
 
Newbie Spellweaver
Joined
Feb 12, 2012
Messages
60
Reaction score
2
You could post the main? or to offset 1:03:11?
 
Joined
Oct 29, 2007
Messages
1,290
Reaction score
1,308
Here the same source code but, with offsets for 1.03.11 (Jpn) Protocol:

Source:
Code:
ObjCreateBug gObjCreateBug = (ObjCreateBug)0x004AC2C4;
ObjCreatePet gObjCreatePet = (ObjCreatePet)0x0075574A;

void gObjCreatePetEx(int ItemId)
{
    int ItemSwitch = *(WORD*)ItemId;
    int PetPreview = LODWORD(pPreviewPetThis) + 700;

    switch(ItemSwitch)
    {
        case ItemId(13,106):
        {
            gObjCreateBug(eBugType::Unicorn_Pet, PetPreview + 252, PetPreview, 0, 0);
            break;
        }
        case ItemId(13,123):
        {
            gObjCreateBug(eBugType::Skeleton_Pet, PetPreview + 252, PetPreview, 0, 0);
            break;
        }
    }

    gObjCreatePet(ItemId);
}

void gObjCreatePetExHook()
{
    Utils.SetHook((LPVOID)gObjCreatePetEx,(LPVOID)0x00734BA6,ASM::CALL);
    Utils.SetHook((LPVOID)gObjCreatePetEx,(LPVOID)0x00753C6E,ASM::CALL);
}

Header:
Code:
#ifndef _PETS_H_
#define _PETS_H_

enum eBugType
{
    Skeleton_Pet    = [COLOR=#ff0000]7613[/COLOR], [COLOR=#ffa07a]// -> Fixed for: ItemId(13,123)[/COLOR]
    Unicorn_Pet      = [COLOR=#ff0000]7596[/COLOR], [COLOR=#ffa07a]// -> Fixed for: ItemId(13,106)[/COLOR]
};

typedef void (__thiscall *ObjCreatePet)(int ItemId);
extern ObjCreatePet gObjCreatePet;

typedef int (__cdecl *ObjCreateBug)(int BugId, int Arg2, int Arg3, int Arg4, int Arg5);
extern ObjCreateBug gObjCreateBug;

void gObjCreatePetExHook();

#endif
 
Last edited:
Newbie Spellweaver
Joined
Feb 12, 2012
Messages
60
Reaction score
2
Here the same source code but, with offsets for 1.03.11 (Jpn) Protocol:

Source:
Code:
ObjCreateBug gObjCreateBug = (ObjCreateBug)0x004AC2C4;
ObjCreatePet gObjCreatePet = (ObjCreatePet)0x0075574A;

void gObjCreatePetEx(int ItemId)
{
    int ItemSwitch = *(WORD*)ItemId;
    int PetPreview = LODWORD(pPreviewPetThis) + 700;

    switch(ItemSwitch)
    {
        case ItemId(13,106):
        {
            gObjCreateBug(eBugType::Unicorn_Pet, PetPreview + 252, PetPreview, 0, 0);
            break;
        }
        case ItemId(13,123):
        {
            gObjCreateBug(eBugType::Skeleton_Pet, PetPreview + 252, PetPreview, 0, 0);
            break;
        }
    }

    gObjCreatePet(ItemId);
}

void gObjCreatePetExHook()
{
    Utils.SetHook((LPVOID)gObjCreatePetEx,(LPVOID)0x00734BA6,ASM::CALL);
    Utils.SetHook((LPVOID)gObjCreatePetEx,(LPVOID)0x00753C6E,ASM::CALL);
}

Header:
Code:
#ifndef _PETS_H_
#define _PETS_H_

enum eBugType
{
    Skeleton_Pet    = 7598,
    Unicorn_Pet        = 7599,
};

typedef void (__thiscall *ObjCreatePet)(int ItemId);
extern ObjCreatePet gObjCreatePet;

typedef int (__cdecl *ObjCreateBug)(int BugId, int Arg2, int Arg3, int Arg4, int Arg5);
extern ObjCreateBug gObjCreateBug;

void gObjCreatePetExHook();

#endif


Excuse the question, but where I can find enum eBugType
{
     Skeleton_Pet = 7598,
     Unicorn_Pet = 7599,
};

I saw that the .15 is different numbers could give a short explanation? thank you!
 
Joined
Oct 29, 2007
Messages
1,290
Reaction score
1,308
Excuse the question, but where I can find enum eBugType
{
Skeleton_Pet = 7598,
Unicorn_Pet = 7596,
};

I saw that the .15 is different numbers could give a short explanation? thank you!

Is only the ObjectId bro... -.-!

Small Explain:

ItemId calc = Type * MaxIndex + Index
ObjectId calc = Type * MaxIndex + Index + ItemOffsetInArray(834)

Then... for:

case ItemId(13,106):
{
gObjCreateBug(eBugType::Unicorn_Pet, PetPreview + 252, PetPreview, 0, 0);
break;
}

because is -> ObjectId calc: 13 * 512 + 106 + 834 = Unicorn_Pet = 7596,
 
Newbie Spellweaver
Joined
Feb 12, 2012
Messages
60
Reaction score
2
Is only the ObjectId bro... -.-!

Small Explain:

ItemId calc = Type * MaxIndex + Index
ObjectId calc = Type * MaxIndex + Index + ItemOffsetInArray(834)

Then... for:

case ItemId(13,106):
{
gObjCreateBug(eBugType::Unicorn_Pet, PetPreview + 252, PetPreview, 0, 0);
break;
}

because is -> ObjectId calc: 13 * 512 + 106 + 834 = Unicorn_Pet = 7596,

#define pPreviewPetThis *(DWORD*)0x07A76A00

You could post the 1:03:11(jpn)?
 
Newbie Spellweaver
Joined
Feb 12, 2012
Messages
60
Reaction score
2
brow a question, after I put in my source that I need to do that to give + "load" in their image on the client?
mine is named "IMP" and the image of IMP ..
 
Joined
Oct 29, 2007
Messages
1,290
Reaction score
1,308
I'm working (for fun purposses & maybe sell too ^^) on this the lastest days on this:

Kiosani - Decompiled gObjCreatePet function from main.exe (1.03.15) eng - RaGEZONE Forums


PS: I'm decompiling so much functions from my main.exe to make this :D: hmm.. is COOL guys ? :D:
PS 2: Actually.. I can add any Pet Type.. (I have decompiled Pet Class from main, maybe create a cool System like: Muun xD).




Dark Wolf Pet (Custom Pet Type Fenrir):

Kiosani - Decompiled gObjCreatePet function from main.exe (1.03.15) eng - RaGEZONE Forums


Blue Dragon Pet (Custom Pet Type Guardian):

Kiosani - Decompiled gObjCreatePet function from main.exe (1.03.15) eng - RaGEZONE Forums
 
Newbie Spellweaver
Joined
Feb 12, 2012
Messages
60
Reaction score
2
I'm working (for fun purposses & maybe sell too ^^) on this the lastest days on this:

Kiosani - Decompiled gObjCreatePet function from main.exe (1.03.15) eng - RaGEZONE Forums


PS: I'm decompiling so much functions from my main.exe to make this :D: hmm.. is COOL guys ? :D:
PS 2: Actually.. I can add any Pet Type.. (I have decompiled Pet Class from main, maybe create a cool System like: Muun xD).




Dark Wolf Pet (Custom Pet Type Fenrir):

Kiosani - Decompiled gObjCreatePet function from main.exe (1.03.15) eng - RaGEZONE Forums


Blue Dragon Pet (Custom Pet Type Guardian):

Kiosani - Decompiled gObjCreatePet function from main.exe (1.03.15) eng - RaGEZONE Forums


beyond gObjCreatePet you do something more for the image of the pets appear on the doll?
 
Joined
Oct 29, 2007
Messages
1,290
Reaction score
1,308
beyond gObjCreatePet you do something more for the image of the pets appear on the doll?

yes, I have decompiled: 20% from main code to make this :p gObjCreatePet is only to make a Temp view from every Pet on Viewport using.. Item inventory id.. I say on the first post, that to make a complete work with this is necesary decompile: gObjMakePreviewCharSet function from your main.exe and anothers like: Pet Follow Character, Pet HP Bar Interface, Pet Walk on the Map (for: Fenrir Style Pets), and etc.

 
Last edited:
Newbie Spellweaver
Joined
Feb 12, 2012
Messages
60
Reaction score
2
yes, I have decompiled: 20% from main code to make this :p gObjCreatePet is only to make a Temp view from every Pet on Viewport using.. Item inventory id.. I say on the first post, that to make a complete work with this is necesary decompile: gObjMakePreviewCharSet function from your main.exe and anothers like: Pet Follow Character, Pet HP Bar Interface, Pet Walk on the Map (for: Fenrir Style Pets), and etc.



mano video is private as could release him?
 
Newbie Spellweaver
Joined
Jun 14, 2012
Messages
59
Reaction score
32
I could not make it work in the main 1.05D, the pets are static, are not walking around the character ... thank you.

3Vp1M89 - Decompiled gObjCreatePet function from main.exe (1.03.15) eng - RaGEZONE Forums
 

Attachments

You must be registered for see attachments list
Back
Top