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 gObjItemAttach function from main.exe 1.03.15 (Eng)

Joined
Oct 29, 2007
Messages
1,262
Reaction score
1,270
Well this is my first decompilation code.. this job is functional to: 100% (tested) This is the function that allows you to attach apples and / or potions of all types that exist: Season 4, in the character inventory (using: Left Click), could be used to create a new jewelry packaging system that do not exist in: Season 4, as are: Bundled of Jewel of Chaos or Bundled Jewel of Life of: Season 6, good without much more to say, I give you the source code for anyone who wants to use it.

Code:
char __stdcall gObjAttachItemEx(int ItemStartId, int ItemEndId)
{
    char result;


    if ( !ItemStartId || !ItemEndId )
    {
        return 0;
    }
    
    int ItemStartRange                = *(WORD*)ItemStartId;
    int ItemEndRange                = *(WORD*)ItemEndId;
    int ItemDurInByte1                = *(BYTE*)(ItemStartId+22);
    int ItemDurInByte2                = *(BYTE*)(ItemEndId+22);
    // ---------------------------------------------------------
    // for Elf Botls & Arrows
    // ---------------------------------------------------------
    int ItemStartSpecialRange        = *(DWORD*)(ItemStartId+2);
    int ItemEndSpecialRange            = *(DWORD*)(ItemEndId+2);


    if ( ItemStartRange != ItemEndRange )
    {
        goto REGRESO;
    }


    if ( ItemStartRange == ITEM(14,7) && ItemEndRange == ITEM(14,7) && ItemDurInByte1 < 250 && ItemDurInByte2 < 250 )
    {
        return 1;
    }
    
    if ( ItemStartRange >= ITEM(14,0) && ItemStartRange <= ITEM(14,8) && ItemStartRange != ITEM(14,7) && ItemEndRange >= ITEM(14,0) && ItemEndRange <= ITEM(14,8) && ItemEndRange != ITEM(14,7) && ItemDurInByte1 < 3 && ItemDurInByte2 < 3 )
    {
        return 1;
    }


    if ( ItemStartRange >= ITEM(14,38) && ItemStartRange <= ITEM(14,40) && ItemEndRange >= ITEM(14,38) && ItemEndRange <= ITEM(14,40) && ItemDurInByte1 < 3 && ItemDurInByte2 < 3 )
    {
        return 1;
    }


    if ( ItemStartRange == ITEM(4,7) && ItemEndRange == ITEM(4,7) && ItemStartSpecialRange == ItemEndSpecialRange )//Elf Bolts
    {
        return 1;
    }


    if ( ItemStartRange == ITEM(4,15) && ItemEndRange == ITEM(4,15) && ItemStartSpecialRange == ItemEndSpecialRange )//Elf Arrows
    {
        return 1;
    }


    if ( ItemStartRange == ITEM(14,28) && ItemEndRange == ITEM(14,28) )//Symbol of Kundun
    {
        return 1;
    }


    if ( ItemStartRange >= ITEM(13,32) && ItemStartRange <= ITEM(13,34) && ItemEndRange >= ITEM(13,32) && ItemEndRange <= ITEM(13,34) )//Splinter of Armor, Bless of Guardian & Claw of Beast
    {
        return 1;
    }


    if ( ItemStartRange >= ITEM(14,46) && ItemStartRange <= ITEM(14,50) && ItemEndRange >= ITEM(14,46) && ItemEndRange <= ITEM(14,50) && ItemDurInByte1 < 3 && ItemDurInByte2 < 3 )//Jack O'Lantern: Bless, Rage, Scream, Food & Drink Scrolls
    {
        return 1;
    }


    if ( ItemStartRange == ITEM(14,70) && ItemEndRange == ITEM(14,70) && ItemDurInByte1 < 50 && ItemDurInByte2 < 50 )//Elite Healing Potion
    {
        return 1;
    }


    if ( ItemStartRange == ITEM(14,71) && ItemEndRange == ITEM(14,71) && ItemDurInByte1 < 50 && ItemDurInByte2 < 50 )//Elite Mana Potion
    {
        return 1;
    }


    if ( ItemStartRange == ITEM(14,78) && ItemEndRange == ITEM(14,78) && ItemDurInByte1 < 3 && ItemDurInByte2 < 3 )//Leap of Strenght
    {
        return 1;
    }


    if ( ItemStartRange == ITEM(14,79) && ItemEndRange == ITEM(14,79) && ItemDurInByte1 < 3 && ItemDurInByte2 < 3 )//Leap of Agility
    {
        return 1;
    }


    if ( ItemStartRange == ITEM(14,80) && ItemEndRange == ITEM(14,80) && ItemDurInByte1 < 3 && ItemDurInByte2 < 3 )//Leap of Vitality
    {
        return 1;
    }


    if ( ItemStartRange == ITEM(14,81) && ItemEndRange == ITEM(14,81) && ItemDurInByte1 < 3 && ItemDurInByte2 < 3 )//Leap of Energy
    {
        return 1;
    }


    if ( ItemStartRange == ITEM(14,82) && ItemEndRange == ITEM(14,82) && ItemDurInByte1 < 3 && ItemDurInByte2 < 3 )//Leap of Command
    {
        return 1;
    }


    if ( ItemStartRange == ITEM(14,94) && ItemEndRange == ITEM(14,94) && ItemDurInByte1 < 50 && ItemDurInByte2 < 50 )//Medium Elite Healing Potion
    {
        return 1;
    }


    if ( ItemStartRange == ITEM(14,85) && ItemEndRange == ITEM(14,85) && ItemDurInByte1 < 3 && ItemDurInByte2 < 3 )//Cherry Blossom Wine
    {
        return 1;
    }


    if ( ItemStartRange == ITEM(14,86) && ItemEndRange == ITEM(14,86) && ItemDurInByte1 < 3 && ItemDurInByte2 < 3 )//Cherry Blossom Rice Cake
    {
        return 1;
    }


    if ( ItemStartRange == ITEM(14,87) && ItemEndRange == ITEM(14,87) && ItemDurInByte1 < 3 && ItemDurInByte2 < 3 )//Cherry Blossom Flower Petal
    {
        return 1;
    }


    if ( ItemStartRange == ITEM(14,88) && ItemEndRange == ITEM(14,88) && ItemDurInByte1 < 10 && ItemDurInByte2 < 10 )//White Cherry Blossom Branch (x10)
    {
        return 1;
    }


    if ( ItemStartRange == ITEM(14,89) && ItemEndRange == ITEM(14,89) && ItemDurInByte1 < 30 && ItemDurInByte2 < 30 )//Red Cherry Blossom Branch (x30)
    {
        return 1;
    }


    if ( ItemStartRange == ITEM(14,90) && ItemEndRange == ITEM(14,90) && ItemDurInByte1 < 50 && ItemDurInByte2 < 50 )//Golden Cherry Blossom Branch (x50)
    {
        return 1;
    }


    if ( ItemStartRange != ITEM(14,100) || ItemDurInByte1 >= 255 || ItemDurInByte2 >= 255 )//Restore normal durability from other types of items gets from: Item(Kor).txt
REGRESO:
    result = 0;
    else
    result = 1;
    return result;
}


void HookFunction()
{
    Utils.SetHook((LPVOID)gObjAttachItemEx, (LPVOID)0x0073595E, ASM::CALL);
    Utils.SetHook((LPVOID)gObjAttachItemEx, (LPVOID)0x007595E9, ASM::CALL);
    Utils.SetHook((LPVOID)gObjAttachItemEx, (LPVOID)0x0075C610, ASM::CALL);
}


extern "C" _declspec(dllexport) void RunDLL()
{
    DWORD OldProtect;
    if(VirtualProtect(LPVOID(0x401000),0x00875FFF,PAGE_EXECUTE_READWRITE,&OldProtect))
    {
        HookFunction();
    }
    else
    {
        MessageBoxA(NULL,"Cannot load Client.dll","Error",MB_OK);
        ExitProcess(0);
    }
}

Video TEST:



PS: This is my first decompilation made totally by me, and 100% Tested & Works!

PS 2: For can make this fix on counts of Apples you must modify your server side too.

Credits for this: Webzen, IDA & me :):



Thanks to all friends!, now I must fix Numbers that show main.exe.. I must search the correct function for this, decompile and modify :): I'm trying..
 
Last edited:
King of the bongo
Joined
Oct 17, 2009
Messages
829
Reaction score
214
I find this code useful. Thank you for this release.
 
Junior Spellweaver
Joined
Jun 25, 2006
Messages
191
Reaction score
226
i really dont understand this function... it actually does not do anything but checking durability and range?

it does not "attach" anything, no logic part for inventory, not even modify some variable that "somehow" would be related to the rendering pipeline (which is the tricky part in my opinion)

so i think it should be called "bool _dosomechecksforVisualItems(int _itemStartId, int _itemEndId)" and it sould be a private method in the VisualInventory class

anyway, maybe some guy would find it usefull, but no me :( :glare:

nemesismucoder :cool:
 
Junior Spellweaver
Joined
Apr 16, 2007
Messages
145
Reaction score
82
apple stack is´t a fail, anyways

the best way = Return that function and made stack manager on server side

Yes but ofc client has its local check like in this case to reduce unnecessary packets going to server so you still need to edit that check in the client.
 
Back
Top