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!

[Development] Drawing Visual Numbers on Items by Level (Bundled) Source 1.03K

Joined
Oct 29, 2007
Messages
1,267
Reaction score
1,284
English:

Hi all, good for some time now it is possible for me to draw numbers using one of the methods I could find in my main: 1.03K JPN, of class: Character Inventory, based on Item level. I want to share the code with you.

PS: This is in really a: 'Pseudo-code'... because is lacking me re-make a complete struct or class maybe the: OBJECTSTRUCT from main used on: Arg1 -> 'pObj' from this function.

Spanish:

Hola a todos, bueno desde hace algún tiempo es posible para mi dibujar números utilizando uno de los métodos que pude encontrar en mi main: 1.03K JPN, de la clase del: Inventario del Personaje, basándose en el nivel del Item. Quiero compartir el código con ustedes.

PD: Esto es en realidad un: 'Casi-código'... porque esta faltando me re-hacer una estructura completa o clase quizás la: OBJECTSTRUCT del main usada en el: Arg1 (Argumento 1) -> 'pObj' de esta función.

Bundles.cpp file (with a Custom Class):

Code:
BOOL cBundles::DrawNumber(int pObj) // -> 005146C0
{
    int pObject = *(WORD*)pObj; // -> Here I make a: 'pointer' to: Inventory Class Method.
    // ----
    switch(pObject)
    {
        case ItemId(12,30):
            return TRUE;
        break;


        case ItemId(12,31):
            return TRUE;
        break;


        case ItemId(12,150):
            return TRUE;
        break;


        case ItemId(12,151):
            return TRUE;
        break;


        case ItemId(12,152):
            return TRUE;
        break;


        case ItemId(12,153):
            return TRUE;
        break;


        case ItemId(12,154):
            return TRUE;
        break;


        case ItemId(12,155):
            return TRUE;
        break;


        case ItemId(12,156):
            return TRUE;
        break;


        default:
            return pDrawNumber(pObj) >= 2;
        break;
    }
}

void cBundles::InitDrawNumber()
{
    gToolKit.SetOp((LPVOID)0x0050D089,this->DrawNumber,ASM::CALL);
    gToolKit.SetOp((LPVOID)0x007347CE,this->DrawNumber,ASM::CALL);
    gToolKit.SetOp((LPVOID)0x007777DF,this->DrawNumber,ASM::CALL);
}

void cBundles::Load()
{
    this->InitDrawNumber();
}

Bundles.h file (with a Custom Class and some pointers and defines):

Code:
#ifndef __BUNDLES_H__
#define __BUNDLES_H__

#define ItemId(x, y)        ((x * 512) + y)
#define pDrawNumber    ((bool(__cdecl*)(int pObj))0x005146C0)


class cBundles
{
public:
    void Load();
    void InitDrawNumber();


    static BOOL DrawNumber(int pObj);
};


extern cBundles gBundles;


#endif
Screenshots:

ErFQmV5 - [Development] Drawing Visual Numbers on Items by Level (Bundled) Source 1.03K - RaGEZONE Forums


kvSIfIu - [Development] Drawing Visual Numbers on Items by Level (Bundled) Source 1.03K - RaGEZONE Forums



 

Attachments

You must be registered for see attachments list
Skilled Illusionist
Joined
Jun 7, 2014
Messages
315
Reaction score
18
amzing idea to make it . i like your project ;) good luckk

and i have little question , how u choose the number that draw ? that something at main offsets ?
 
Joined
Oct 29, 2007
Messages
1,267
Reaction score
1,284
amzing idea to make it . i like your project ;) good luckk

and i have little question , how u choose the number that draw ? that something at main offsets ?

No bro.. is only by: Item Level... I mean... if your item is: +0 (no levels) then is automatic drawed: '10' number (like on: Bundled Jewel of Bless or Bundled Jewel of Soul). If your item level is: +1 (with level) then is automatic drawed: '20' number and so... :):

For Example:

pIAxIgz - [Development] Drawing Visual Numbers on Items by Level (Bundled) Source 1.03K - RaGEZONE Forums


Offtopic (sorry Karli):

 

Attachments

You must be registered for see attachments list
Last edited:
Joined
Oct 29, 2007
Messages
1,267
Reaction score
1,284
Take it easy "god" ....

I only saying... anyways I don't have a: 1.04e main to debug... I have: 1.04d main and on this main is different the original function... then maybe is necesary re-make the function... but anyways here I leave: 1.04d GMO offsets:

Code:
//----- (004E1230) --------------------------------------------------------
bool __cdecl sub_4E1230(int *a1)
{
  return sub_4E1250(*(_WORD *)a1, 0) != -1;
}

Offsets Calls:

[COLOR=#ff0000]0x004E0728
0x004E0B4B
0x0058E629
0x005C405E
0x005C865F
0x007DCD14
0x00865F75[/COLOR]

PS: Here you can see that this function return another function... on this case: "sub_4E1250(lpObj pObj,char Arg2)"... I'm thinking that this function have related to some calc for item cases or something like this. and on this case you can see that on: Arg1 exists a pointer, then is because return values from another function I mean... something like pointer of pointer :D:

Assembler viewed from ollydbg:

YKjgmwx - [Development] Drawing Visual Numbers on Items by Level (Bundled) Source 1.03K - RaGEZONE Forums


PS2: And about... more calls count maybe is related with: "Bundles" that not exists on: Season 4 main... I mean: Bundled Life, Chaos, Etc.. from: 6.3
 

Attachments

You must be registered for see attachments list
Last edited:
Initiate Mage
Joined
Jun 19, 2015
Messages
17
Reaction score
18
U like code in darkness, without flashlight.

BOOL cBundles::DrawNumber(int pObj)
- first of all, BOOL - integer microsoft type, bool - C++ byte type, u have prototype of original function with bool (byte) and in same time use for hook BOOL (int), its mistake what mean that u dont know what wait application in result

BOOL cBundles::DrawNumber(int pObj)
- ur income argument is pointer type, not int, this function looks like: bool IsJewelBundle(ItemObject* item), ur code work without crash only bcz main.exe builded for x32 system and pointer size is 4 bytes (like integer), but in x64 system its be 8 bytes

int pObject = *(WORD*)pObj; // -> Here I make a: 'pointer' to: Inventory Class Method.
- dont know what u mean with ur own pointer idea, also and with "class method", but its just class object which have first element like unsigned short (int16), for what u place int16 in int32 too i cant understand, maybe byte-racism?
Method - its function inside class or structure object, so u get 'ur own pointer' not to method, u get 'ur own pointer' to variable.

Code:
class ItemObject {
public:
ItemObject() {} // method
virtual ~ItemObject() {} // too method

void Initialize() {} // too method

private:
short _index; // local variable

public:
short Index; // public variable
};

return pDrawNumber(pObj) >= 2;
#define pDrawNumber ((bool(__cdecl*)(int pObj))0x005146C0)
- boolean type its only 1 or 0, true or false, how u get value >= 2 if u use boolean which will return to u only 1 as maximum?...

----

in final u can improve ur code to like this:

Code:
bool IsJewelBundle(ItemObject* item) {
    if (item == nullptr) {
        return false;
    }
    
    if (item->Index >= ITEM_INDEX(12, 30) && item->Index <= ITEM_INDEX(12, 31) || 
        item->Index >= ITEM_INDEX(12, 150) && item->Index <= ITEM_INDEX(12, 156)) {
        return true;
    }
    
    return false;
    
    // or call to original function if u catch not all code
    // like: return ((bool (__cdecl*) (ItemObject*)) 0x5146C0) (item);
}

of course only if u sure that need use bool :laugh:

P.S.: if u code all in this trash style i not recommend to sell anything, ur skill while small for it.
 
Last edited:
Joined
Oct 29, 2007
Messages
1,267
Reaction score
1,284
U like code in darkness, without flashlight.


- first of all, BOOL - integer microsoft type, bool - C++ byte type, u have prototype of original function with bool (byte) and in same time use for hook BOOL (int), its mistake what mean that u dont know what wait application in result


- ur income argument is pointer type, not int, this function looks like: bool IsJewelBundle(ItemObject* item), ur code work without crash only bcz main.exe builded for x32 system and pointer size is 4 bytes (like integer), but in x64 system its be 8 bytes


- dont know what u mean with ur own pointer idea, also and with "class method", but its just class object which have first element like unsigned short (int16), for what u place int16 in int32 too i cant understand, maybe byte-racism?
Method - its function inside class or structure object, so u get 'ur own pointer' not to method, u get 'ur own pointer' to variable.

Code:
class ItemObject {
public:
ItemObject() {} // method
virtual ~ItemObject() {} // too method

void Initialize() {} // too method

private:
short _index; // local variable

public:
short Index; // public variable
};



- boolean type its only 1 or 0, true or false, how u get value >= 2 if u use boolean which will return to u only 1 as maximum?...

----

in final u can improve ur code to like this:

Code:
bool IsJewelBundle(ItemObject* item) {
    if (item == nullptr) {
        return false;
    }
    
    if (item->Index >= ITEM_INDEX(12, 30) && item->Index <= ITEM_INDEX(12, 31) || 
        item->Index >= ITEM_INDEX(12, 150) && item->Index <= ITEM_INDEX(12, 156)) {
        return true;
    }
    
    return false;
    
    // or call to original function if u catch not all code
    // like: return ((bool (__cdecl*) (ItemObject*)) 0x5146C0) (item);
}

of course only if u sure that need use bool :laugh:

P.S.: if u code all in this trash style i not recommend to sell anything, ur skill while small for it.

English:

Well, I certainly never said that my code was the best. If you are able to do it in a better way. Welcome. But still thanks for all those tips. I will take them into account to try to improve.

Spanish:

Bueno ciertamente yo jamas dije que mi código fuese el mejor. Si usted es capaz de hacerlo de una mejor manera. Bienvenido sea. pero aun así Gracias por todos esos tips. voy a tomarlos en cuenta para tratar de mejorar.
 
Initiate Mage
Joined
Jun 19, 2015
Messages
17
Reaction score
18
If you are able to do it in a better way. Welcome.

Code:
//
// import
//


auto GLStateFreeze          = ((void (__cdecl*) (bool)) 0x651C12);
auto GLStateRestore         = ((void (__cdecl*) ()) 0x651B98);


auto DrawNumber             = ((float (__cdecl*) (float, float, int, float)) 0x7B35FA);


auto DisplayItemStack       = ((void (__cdecl*) (MUItemObject*, float, float, float, float, float)) 0x607680);


auto g_ResolutionWidth      = *(int*)0x13E7014;
auto g_ResolutionHeight     = *(int*)0x13E7018;


#define ITEM_INDEX(x, y)    (x * 512 + y)


//
// our provider for original function
//


void OnDisplayItemStack(MUItemObject* item, float x, float y, float width, float height, float scale) {
    if (item == nullptr) {
        return;
    }


    GLStateFreeze(true);
    glColor3f(1.0f, 1.0f, 1.0f);


    //


    float swp   = 1024.0f / g_ResolutionWidth;
    float shp   = 768.0f / g_ResolutionHeight;
    float rel_x = (x + width) - swp * 5.0f;
    float rel_y = y + shp * 1.0f;


    //


    if (item->index == ITEM_INDEX(12, 288)) { // elemental rune
        glColor3f(0.576f, 0.439f, 0.859f);
        DrawNumber(rel_x, rel_y, 50, scale);
    }
    else if (item->index == ITEM_INDEX(14, 343)) { // archangel's hammer
        glColor3f(0.0f, 0.75f, 1.0f);
        DrawNumber(rel_x, rel_y, 70, scale);
    }
    else if (item->index == ITEM_INDEX(14, 352)) { // ruud box
        glColor3f(0.824f, 0.412f, 0.118f);
        DrawNumber(rel_x, rel_y, 1250, scale);
    }
    else if (item->index == ITEM_INDEX(8, 92)) { // gru hill armor
        glColor3f(0.863f, 0.078f, 0.235f);
        DrawNumber(rel_x, rel_y, (item->general_info >> 3) & 0xF, scale);
    }


    //
        
    glColor3f(1.0f, 1.0f, 1.0f);
    GLStateRestore();


    DisplayItemStack(item, x, y, width, height, scale);
}


//
// hook
//


Patcher::At(0x9615DE)->Replace(OnDisplayItemStack);
Patcher::At(0x9EAC84)->Replace(OnDisplayItemStack);

Kiosani - [Development] Drawing Visual Numbers on Items by Level (Bundled) Source 1.03K - RaGEZONE Forums
 
Last edited:
Joined
Oct 29, 2007
Messages
1,267
Reaction score
1,284
Code:
//
// import
//


auto GLStateFreeze          = ((void (__cdecl*) (bool)) 0x651C12);
auto GLStateRestore         = ((void (__cdecl*) ()) 0x651B98);


auto DrawNumber             = ((float (__cdecl*) (float, float, int, float)) 0x7B35FA);


auto DisplayItemStack       = ((void (__cdecl*) (MUItemObject*, float, float, float, float, float)) 0x607680);


auto g_ResolutionWidth      = *(int*)0x13E7014;
auto g_ResolutionHeight     = *(int*)0x13E7018;


#define ITEM_INDEX(x, y)    (x * 512 + y)


//
// our provider for original function
//


void OnDisplayItemStack(MUItemObject* item, float x, float y, float width, float height, float scale) {
    if (item == nullptr) {
        return;
    }


    GLStateFreeze(true);
    glColor3f(1.0f, 1.0f, 1.0f);


    //


    float swp   = 1024.0f / g_ResolutionWidth;
    float shp   = 768.0f / g_ResolutionHeight;
    float rel_x = (x + width) - swp * 5.0f;
    float rel_y = y + shp * 1.0f;


    //


    if (item->index == ITEM_INDEX(12, 288)) { // elemental rune
        glColor3f(0.576f, 0.439f, 0.859f);
        DrawNumber(rel_x, rel_y, 50, scale);
    }
    else if (item->index == ITEM_INDEX(14, 343)) { // archangel's hammer
        glColor3f(0.0f, 0.75f, 1.0f);
        DrawNumber(rel_x, rel_y, 70, scale);
    }
    else if (item->index == ITEM_INDEX(14, 352)) { // ruud box
        glColor3f(0.824f, 0.412f, 0.118f);
        DrawNumber(rel_x, rel_y, 1250, scale);
    }
    else if (item->index == ITEM_INDEX(8, 92)) { // gru hill armor
        glColor3f(0.863f, 0.078f, 0.235f);
        DrawNumber(rel_x, rel_y, (item->general_info >> 3) & 0xF, scale);
    }


    //
        
    glColor3f(1.0f, 1.0f, 1.0f);
    GLStateRestore();


    DisplayItemStack(item, x, y, width, height, scale);
}


//
// hook
//


Patcher::At(0x9615DE)->Replace(OnDisplayItemStack);
Patcher::At(0x9EAC84)->Replace(OnDisplayItemStack);

Kiosani - [Development] Drawing Visual Numbers on Items by Level (Bundled) Source 1.03K - RaGEZONE Forums

Wow bro.. very nice ! 10/10... I will to try to put on: S4 + Colors too thanks :):

PS: All ready! Very Thanks for Idea... :): I make on different colors like you:

0uQoD2Q - [Development] Drawing Visual Numbers on Items by Level (Bundled) Source 1.03K - RaGEZONE Forums


Sincerelly is not difficult if you understand how to make something like this:

Code:
#define oDrawColorB_Buff 0x007347EE
#define oDrawColorG_Buff 0x007347F3
#define oDrawColorR_Buff 0x007347F8


void cBundles::DrawColors(int iColor)
{
	if(iColor == eNormalNumber)
	{
		gToolKit.SetByte((PVOID)(oDrawColorR_Buff+4),0x3F);
		gToolKit.SetByte((PVOID)(oDrawColorR_Buff+3),0x33);
		gToolKit.SetByte((PVOID)(oDrawColorR_Buff+2),0x33);
		gToolKit.SetByte((PVOID)(oDrawColorR_Buff+1),0x33);
		// ----
		gToolKit.SetByte((PVOID)(oDrawColorG_Buff+4),0x3F);
		gToolKit.SetByte((PVOID)(oDrawColorG_Buff+3),0x66);
		gToolKit.SetByte((PVOID)(oDrawColorG_Buff+2),0x66);
		gToolKit.SetByte((PVOID)(oDrawColorG_Buff+1),0x66);
		// ----
		gToolKit.SetByte((PVOID)(oDrawColorB_Buff+4),0x3F);
		gToolKit.SetByte((PVOID)(oDrawColorB_Buff+3),0x80);
		gToolKit.SetByte((PVOID)(oDrawColorB_Buff+2),0x00);
		gToolKit.SetByte((PVOID)(oDrawColorB_Buff+1),0x00);
	}
	else if(iColor == eRedNumber)
	{
		gToolKit.SetByte((PVOID)(oDrawColorR_Buff+4),0x3F);
		gToolKit.SetByte((PVOID)(oDrawColorR_Buff+3),0x80);
		gToolKit.SetByte((PVOID)(oDrawColorR_Buff+2),0x00);
		gToolKit.SetByte((PVOID)(oDrawColorR_Buff+1),0x00);
		// ----
		gToolKit.SetByte((PVOID)(oDrawColorG_Buff+4),0x00);
		gToolKit.SetByte((PVOID)(oDrawColorG_Buff+3),0x00);
		gToolKit.SetByte((PVOID)(oDrawColorG_Buff+2),0x00);
		gToolKit.SetByte((PVOID)(oDrawColorG_Buff+1),0x00);
		// ----
		gToolKit.SetByte((PVOID)(oDrawColorB_Buff+4),0x00);
		gToolKit.SetByte((PVOID)(oDrawColorB_Buff+3),0x00);
		gToolKit.SetByte((PVOID)(oDrawColorB_Buff+2),0x00);
		gToolKit.SetByte((PVOID)(oDrawColorB_Buff+1),0x00);
	}
}

ON DrawNumber proc:

case ItemId(12,151):
			gBundles.DrawColors(eRedNumber);
			return TRUE;
		break;
 

Attachments

You must be registered for see attachments list
Last edited:
Initiate Mage
Joined
Jun 19, 2015
Messages
17
Reaction score
18
Sincerelly is not difficult if you understand how to make something like this:
U are strange, why u so love ugly byte patching, its like creating of Frankenstein, u can in one function setup size of sprite, position of sprite, color of sprite, value of sprite (example value of jewels is: <item level> * 10), for make this simple thing not need many methods, classes, or patches, its only one function...
 
Joined
Oct 29, 2007
Messages
1,267
Reaction score
1,284
U are strange, why u so love ugly byte patching, its like creating of Frankenstein, u can in one function setup size of sprite, position of sprite, color of sprite, value of sprite (example value of jewels is: <item level> * 10), for make this simple thing not need many methods, classes, or patches, its only one function...

well maybe I can understand on better way making on my way.. I mean... sincerely trying to copy your "method" of put short variable like part of my class: cBundles, my main crash... then I search another way to make the same. by this reason is difficult create a class and hook them to main.. I mean you saying that for your main S10 you only must create a simple: "short Index" var like: private class, but sincerely this don't work for me. by this reason I search RGB values on my main and patch them.

PS: With some of work... and 2 websites:





Results like this:



DmG59W8 - [Development] Drawing Visual Numbers on Items by Level (Bundled) Source 1.03K - RaGEZONE Forums


Lqtb3ZQ - [Development] Drawing Visual Numbers on Items by Level (Bundled) Source 1.03K - RaGEZONE Forums


7tUlqOq - [Development] Drawing Visual Numbers on Items by Level (Bundled) Source 1.03K - RaGEZONE Forums


eo6pPnb - [Development] Drawing Visual Numbers on Items by Level (Bundled) Source 1.03K - RaGEZONE Forums


PswTagW - [Development] Drawing Visual Numbers on Items by Level (Bundled) Source 1.03K - RaGEZONE Forums


QOJgnEz - [Development] Drawing Visual Numbers on Items by Level (Bundled) Source 1.03K - RaGEZONE Forums
 

Attachments

You must be registered for see attachments list
Last edited:
Junior Spellweaver
Joined
Dec 6, 2015
Messages
116
Reaction score
34
does anyone have the offset for 1.04E and 1.04J?
 
Back
Top