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] Item Smoke Effect

Junior Spellweaver
Joined
Jun 22, 2012
Messages
124
Reaction score
19
I adapted it to work in 1.02C main.
Feel free to use.

.h
Code:
#ifndef __CUSTOM_H__
#define __CUSTOM_H__


const int ITEM_ID = 0x246;
#define GET_ITEM(x, y) (x * 512 + y) + ITEM_ID


class cCustom
{
public:
    void Init();
    static __declspec() void SetItensColorEffect();
    static __declspec() void AllowItemEffect();


    //Set Effects
    const int HDK_ALLOW_ITEM_EFFECT = 0x0052F106;
    const int HDK_SET_COLOR_EFFECT = 0x0052F162;
    const int HDK_ITEM_EFFECT_ALLOW = 0x0052F127;
    const int HDK_ITEM_EFFECT_NOT_ALLOW = 0x0052F76D;
    const int HDK_NEXT_ITEM_COLOR = 0x0052F191;


private:
    const BYTE CustomEffects = 1;
};




extern cCustom gCustom;
#endif
.cpp
Code:
#include "StdAfx.h"
#include "Custom.h"


cCustom gCustom;




void cCustom::Init()
{
    if (this->CustomEffects)
    {
        SetOp(reinterpret_cast<LPVOID>(gCustom.HDK_ALLOW_ITEM_EFFECT), reinterpret_cast<LPVOID>(this->AllowItemEffect), ASM::JMP);
        SetNop(0x0052F10B, 28);
        SetOp(reinterpret_cast<LPVOID>(gCustom.HDK_SET_COLOR_EFFECT), reinterpret_cast<LPVOID>(this->SetItensColorEffect), ASM::JMP);
        SetNop(0x0052F167, 42);
    }
}


__declspec(naked) void cCustom::AllowItemEffect()
{
    DWORD pItemType;


    _asm MOV pItemType, EAX;


    switch (pItemType)
    {
        //Dark Phoenix
        case GET_ITEM(11, 17):
        {
            __asm
            {
                MOV ESI, gCustom.HDK_ITEM_EFFECT_ALLOW;
                JMP ESI;
            }
            break;
        }
        //Great Dragon
        case GET_ITEM(11, 21):
        {
            __asm
            {
                MOV ESI, gCustom.HDK_ITEM_EFFECT_ALLOW;
                JMP ESI;
            }
        break;
        }
    }
    _asm
    {
        CMP EAX, 0x1863;
        JL NOT_ALLOW;
        CMP EAX, 0x1867;
        JG NOT_ALLOW;
        JMP ALLOW;


        NOT_ALLOW:
        MOV ESI, gCustom.HDK_ITEM_EFFECT_NOT_ALLOW;
        JMP ESI;


        ALLOW:
        MOV ESI, gCustom.HDK_ITEM_EFFECT_ALLOW;
        JMP ESI;
    }
}


__declspec(naked) void cCustom::SetItensColorEffect()
{
    DWORD pItemType;


    _asm MOV pItemType, ECX;
    
    switch (pItemType)
    {
        //Dragon Knight Original
        case GET_ITEM(11, 29):
        {
            __asm
            {
                MOV EDX, DWORD PTR SS : [EBP + 0xC];
                MOV DWORD PTR DS : [EDX + 0x128], 0x3F266666;
                MOV EAX, DWORD PTR SS : [EBP + 0xC];
                MOV DWORD PTR DS : [EAX + 0x12C], 0x3E99999A;
                MOV ECX, DWORD PTR SS : [EBP + 0xC];
                MOV DWORD PTR DS : [ECX + 0x130], 0x3DCCCCCD;
            }
            break;
        }
        //Dark Phoenix
        case GET_ITEM(11, 17):
        {
            _asm
            {
                MOV EDX, DWORD PTR SS : [EBP + 0xC];
                MOV DWORD PTR DS : [EDX + 0x128], 0x0;
                MOV EAX, DWORD PTR SS : [EBP + 0xC];
                MOV DWORD PTR DS : [EAX + 0x12C], 0x3F800000;
                MOV ECX, DWORD PTR SS : [EBP + 0xC];
                MOV DWORD PTR DS : [ECX + 0x130], 0x3F800000;
            }
            break;
        }
        //Great Dragon
        case GET_ITEM(11, 21):
        {
            _asm
            {
                MOV EDX, DWORD PTR SS : [EBP + 0xC];
                MOV DWORD PTR DS : [EDX + 0x128], 0x3F800000;
                MOV EAX, DWORD PTR SS : [EBP + 0xC];
                MOV DWORD PTR DS : [EAX + 0x12C], 0x0;
                MOV ECX, DWORD PTR SS : [EBP + 0xC];
                MOV DWORD PTR DS : [ECX + 0x130], 0x0;
            }
            break;
        }
    }


    __asm
    {
        MOV ESI, gCustom.HDK_NEXT_ITEM_COLOR;
        JMP ESI;
    }
}

How can i define setop funtion .. i cant find it
 
Skilled Illusionist
Joined
Jun 22, 2017
Messages
363
Reaction score
557
How can i define setop funtion .. i cant find it

Code:
DWORD SetOp(const LPVOID dwEnterFunction, const LPVOID dwJMPAddress, const BYTE cmd)
{
    BYTE btBuf[5];
    DWORD dwShift    = (ULONG_PTR)dwJMPAddress - (ULONG_PTR)dwEnterFunction - 5;
    // ----
    btBuf[0]  = cmd;
    memcpy( (LPVOID) & btBuf[1], (LPVOID) & dwShift, sizeof(ULONG_PTR));
    // ----
    return WriteMemory(dwEnterFunction, (LPVOID) btBuf, sizeof(btBuf));
}

or u using muemu file, you can use
Code:
SetCompleteHook(BYTE,Offset,&Function);

Byte: 0xE9 = jmp
0xE8 = call
 
Last edited:
Junior Spellweaver
Joined
Jun 22, 2012
Messages
124
Reaction score
19
Code:
DWORD SetOp(const LPVOID dwEnterFunction, const LPVOID dwJMPAddress, const BYTE cmd)
{
    BYTE btBuf[5];
    DWORD dwShift    = (ULONG_PTR)dwJMPAddress - (ULONG_PTR)dwEnterFunction - 5;
    // ----
    btBuf[0]  = cmd;
    memcpy( (LPVOID) & btBuf[1], (LPVOID) & dwShift, sizeof(ULONG_PTR));
    // ----
    return WriteMemory(dwEnterFunction, (LPVOID) btBuf, sizeof(btBuf));
}

or u using muemu file, you can use
Code:
SetCompleteHook(BYTE,Offset,&Function);

Byte: 0xE9 = jmp
0xE8 = call
Can u share me full source for main 1.02c
But lets me test brunohk source
 
Skilled Illusionist
Joined
Aug 5, 2008
Messages
377
Reaction score
33
I'm trying to use this on 1.03k
Smoke shows fine, but it's always white color, why is the color not changing?

Edit: Working fine now.

Brain - [Development] Item Smoke Effect - RaGEZONE Forums
 
Last edited:
Junior Spellweaver
Joined
Jun 22, 2012
Messages
124
Reaction score
19
I'm trying to use this on 1.03k
Smoke shows fine, but it's always white color, why is the color not changing?

Edit: Working fine now.

Brain - [Development] Item Smoke Effect - RaGEZONE Forums

how to change the white effect to another color ?
 
Newbie Spellweaver
Joined
Dec 1, 2010
Messages
65
Reaction score
5
#pragma once

const int ITEM_ID = 0x333;
#define ITEM_GET(x, y) (x * 512 + y) + ITEM_ID

#define HDK_SET_ITEM_EFFECT 0x004F3200
#define HDK_SET_COLOR_EFFECT 0x004F3265
#define HDK_ITEM_EFFECT_ALLOW 0x004F322A
#define HDK_ITEM_EFFECT_NOT_ALLOW 0x004F38C9
#define HDK_NEXT_ITEM_COLOR 0x004F3293

void AttachNewEffect();

figaro, the offsets are correct 1.05d s4 ?

There is no effect here.
 
Last edited:
Joined
Nov 4, 2012
Messages
928
Reaction score
544
.H poop
Code:
#pragma once

// Smoke Effect System (Main 1.03.42 GMO Season 5)
#define oFirstItemCheockOffset				0x005289B7+1
#define oLastItemCheockOffset				0x005289C8+2

#define oDrawItemEffectCall1				0x00404668
#define oDrawItemEffectCall2				0x0047FD32
#define oDrawItemEffectCall3				0x0052AD33
#define oDrawItemEffectCall4				0x0052AD47

#define pDrawItemEffect						((void(__cdecl*)(DWORD ItemStruct,DWORD EffectStruct,DWORD a3)) 0x51EFC8) // Test

typedef struct
{
	int		Index;
	float	R;
	float	G;
	float	B;
} pSmokeItem, *lpSmokeItem;

class cSmokeEffect
{
public:
	cSmokeEffect();

	void Init();
	void Load();
	static void DrawItemEffect(DWORD ItemStruct,DWORD EffectStruct,DWORD a3);

	std::vector<pSmokeItem> m_Data;
};

extern cSmokeEffect gSmokeEffect;

.CPP poop
Code:
#include "StdAfx.h"

cSmokeEffect gSmokeEffect;

cSmokeEffect::cSmokeEffect()
{
	this->Init();
}

void cSmokeEffect::Init()
{
	this->m_Data.clear();
}

void cSmokeEffect::Load()
{
	if(gEncode.ReadScript(CONFIG_BMD_SMOKE))
	{
		WZSMDToken Token = gEncode.GetToken();

		if((Token == END) || (gEncode.GetInt() != 0))
		{
			MessageBox(NULL,"Falha, a seção 0 precisa ser a primeira.",CONFIG_BMD_SMOKE,MB_OK|MB_ICONERROR);
			ExitProcess(0);
		}

		this->Init();

		pSmokeItem Info;

		int BootId = -1;

		while(true)
		{
			Token = gEncode.GetToken();
			if(Token == END || lstrcmpi(gEncode.GetString(),"end") == 0)
			{
				break;
			}

			memset(&Info,NULL,sizeof(Info));

			BootId = gEncode.GetInt();

			Info.Index = ObjectId(11,BootId);
			
			Token = gEncode.GetToken();
			Info.R = gEncode.GetFloat();
			
			Token = gEncode.GetToken();
			Info.G = gEncode.GetFloat();
			
			Token = gEncode.GetToken();
			Info.B = gEncode.GetFloat();

			this->m_Data.push_back(Info);
		}

		gEncode.Close();

		if(this->m_Data.size())
		{
			// Change Check limit for default boots
			gToolKit.SetByte((LPVOID)(oFirstItemCheockOffset),0x47);	// Start boot Id from 11,0
			gToolKit.SetByte((LPVOID)(oLastItemCheockOffset),0xAA);		// Finish boot Id to 11,99

			// Hook all the mess
			gToolKit.SetOp((LPVOID)oDrawItemEffectCall1,this->DrawItemEffect,ASM::CALL);
			gToolKit.SetOp((LPVOID)oDrawItemEffectCall2,this->DrawItemEffect,ASM::CALL);
			gToolKit.SetOp((LPVOID)oDrawItemEffectCall3,this->DrawItemEffect,ASM::CALL);
			gToolKit.SetOp((LPVOID)oDrawItemEffectCall4,this->DrawItemEffect,ASM::CALL);
		}
	}
	else
	{
		MessageBox(NULL,CONFIG_BMD_SMOKE,"ERRO",MB_OK|MB_ICONERROR);
		ExitProcess(0);
	}
}

void cSmokeEffect::DrawItemEffect(DWORD ItemStruct,DWORD EffectStruct,DWORD a3)
{
	*(float*)(EffectStruct + 156) = 0.0f; // None
	*(float*)(EffectStruct + 160) = 0.0f; // None
	*(float*)(EffectStruct + 164) = 0.0f; // None

	for(std::vector<pSmokeItem>::iterator it = gSmokeEffect.m_Data.begin();it != gSmokeEffect.m_Data.end();it++)
	{	
		if(*(WORD*)(ItemStruct + 392) == it->Index) // Boots type (11)
		{
			*(float*)(EffectStruct + 156) =  it->R;
			*(float*)(EffectStruct + 160) =  it->G;
			*(float*)(EffectStruct + 164) =  it->B;
			break;
		}
	}

	pDrawItemEffect(ItemStruct,EffectStruct,a3);
}

Ps. For main 1.03.42 but it can be adjust to other mains

THANKS FOR LEECH IT!
 
Newbie Spellweaver
Joined
Sep 16, 2014
Messages
77
Reaction score
8
Very nice idea.
now i understand why your nick name is Brain :tongue:
I just suggets to do it when you doing any heal skill
then the charcter got the ligth on all his body wings and boots too :p:
But it is only my suggestion.
Good Luck.
 
Skilled Illusionist
Joined
Mar 27, 2013
Messages
305
Reaction score
9
CW1QpD - [Development] Item Smoke Effect - RaGEZONE Forums

8fyLbVI - [Development] Item Smoke Effect - RaGEZONE Forums

Error, smookeffect work in select character but not work in after that


 

Attachments

You must be registered for see attachments list
Skilled Illusionist
Joined
Mar 27, 2013
Messages
305
Reaction score
9
Hook in all calls from pDrawItemEffect.

Check my post;

Where????, It use main 1.05D

.H poop
Code:
#pragma once

// Smoke Effect System (Main 1.03.42 GMO Season 5)
#define oFirstItemCheockOffset                0x005289B7+1
#define oLastItemCheockOffset                0x005289C8+2

#define oDrawItemEffectCall1                0x00404668
#define oDrawItemEffectCall2                0x0047FD32
#define oDrawItemEffectCall3                0x0052AD33
#define oDrawItemEffectCall4                0x0052AD47

#define pDrawItemEffect                        ((void(__cdecl*)(DWORD ItemStruct,DWORD EffectStruct,DWORD a3)) 0x51EFC8) // Test

typedef struct
{
    int        Index;
    float    R;
    float    G;
    float    B;
} pSmokeItem, *lpSmokeItem;

class cSmokeEffect
{
public:
    cSmokeEffect();

    void Init();
    void Load();
    static void DrawItemEffect(DWORD ItemStruct,DWORD EffectStruct,DWORD a3);

    std::vector<pSmokeItem> m_Data;
};

extern cSmokeEffect gSmokeEffect;

.CPP poop
Code:
#include "StdAfx.h"

cSmokeEffect gSmokeEffect;

cSmokeEffect::cSmokeEffect()
{
    this->Init();
}

void cSmokeEffect::Init()
{
    this->m_Data.clear();
}

void cSmokeEffect::Load()
{
    if(gEncode.ReadScript(CONFIG_BMD_SMOKE))
    {
        WZSMDToken Token = gEncode.GetToken();

        if((Token == END) || (gEncode.GetInt() != 0))
        {
            MessageBox(NULL,"Falha, a seção 0 precisa ser a primeira.",CONFIG_BMD_SMOKE,MB_OK|MB_ICONERROR);
            ExitProcess(0);
        }

        this->Init();

        pSmokeItem Info;

        int BootId = -1;

        while(true)
        {
            Token = gEncode.GetToken();
            if(Token == END || lstrcmpi(gEncode.GetString(),"end") == 0)
            {
                break;
            }

            memset(&Info,NULL,sizeof(Info));

            BootId = gEncode.GetInt();

            Info.Index = ObjectId(11,BootId);
            
            Token = gEncode.GetToken();
            Info.R = gEncode.GetFloat();
            
            Token = gEncode.GetToken();
            Info.G = gEncode.GetFloat();
            
            Token = gEncode.GetToken();
            Info.B = gEncode.GetFloat();

            this->m_Data.push_back(Info);
        }

        gEncode.Close();

        if(this->m_Data.size())
        {
            // Change Check limit for default boots
            gToolKit.SetByte((LPVOID)(oFirstItemCheockOffset),0x47);    // Start boot Id from 11,0
            gToolKit.SetByte((LPVOID)(oLastItemCheockOffset),0xAA);        // Finish boot Id to 11,99

            // Hook all the mess
            gToolKit.SetOp((LPVOID)oDrawItemEffectCall1,this->DrawItemEffect,ASM::CALL);
            gToolKit.SetOp((LPVOID)oDrawItemEffectCall2,this->DrawItemEffect,ASM::CALL);
            gToolKit.SetOp((LPVOID)oDrawItemEffectCall3,this->DrawItemEffect,ASM::CALL);
            gToolKit.SetOp((LPVOID)oDrawItemEffectCall4,this->DrawItemEffect,ASM::CALL);
        }
    }
    else
    {
        MessageBox(NULL,CONFIG_BMD_SMOKE,"ERRO",MB_OK|MB_ICONERROR);
        ExitProcess(0);
    }
}

void cSmokeEffect::DrawItemEffect(DWORD ItemStruct,DWORD EffectStruct,DWORD a3)
{
    *(float*)(EffectStruct + 156) = 0.0f; // None
    *(float*)(EffectStruct + 160) = 0.0f; // None
    *(float*)(EffectStruct + 164) = 0.0f; // None

    for(std::vector<pSmokeItem>::iterator it = gSmokeEffect.m_Data.begin();it != gSmokeEffect.m_Data.end();it++)
    {    
        if(*(WORD*)(ItemStruct + 392) == it->Index) // Boots type (11)
        {
            *(float*)(EffectStruct + 156) =  it->R;
            *(float*)(EffectStruct + 160) =  it->G;
            *(float*)(EffectStruct + 164) =  it->B;
            break;
        }
    }

    pDrawItemEffect(ItemStruct,EffectStruct,a3);
}

Ps. For main 1.03.42 but it can be adjust to other mains

THANKS FOR LEECH IT!
How to find offset drawitemeffect
 
Last edited by a moderator:
Newbie Spellweaver
Joined
Sep 28, 2014
Messages
24
Reaction score
0
Hello y cant do for 1.04j y have the offsets ,anyone can adapte source?
#define ITEM_INTER 289#define HDK_SET_ITEM_EFFECT 0x00528864 // 1.04j#define HDK_SET_COLOR_EFFECT 0x005288BA // 1.04j#define HDK_ITEM_EFFECT_ALLOW 0x0052887F // 1.04j#define HDK_ITEM_EFFECT_NOT_ALLOW 0x00528EC6 // 1.04j#define HDK_NEXT_ITEM_COLOR 0x005288E9 // 1.04j
 
Back
Top