• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

[Development] CreatePetEffect main 1.04j(Kor)

Newbie Spellweaver
Joined
Apr 15, 2018
Messages
5
Reaction score
2
CreatePetEffect main 1.04j(Kor)
​Good use
.CPP
Code:
[CENTER][LEFT][INDENT][INDENT]#define pCreateSpriteEx ((int(__cdecl*)(int Arg1, int Arg2, int Arg3, int Arg4, int Arg5, int Arg6, int Arg7))0x06EE878) //ok 
#define pCreateParticleEx ((int(__cdecl*)(int Arg1, int Arg2, int Arg3, int Arg4, int Arg5, float Arg6, int Arg7))0x006DA9C1) //ok 
#define pObjectGetAngle ((char(__cdecl*)(float Arg1, float Arg2, float Arg3))0x00608782) //ok 
#define pObjectMaxBug ((void(__cdecl*)(int Arg1, char Arg2, int Arg3, int Arg4))0x00612ECB) //ok 
#define sub_007396FD ((int(*)())0x007396FD) //ok 

#define pMainState						*(int*)0x0077EBAC		// -> Main States

char CreatePetEffect(int Arg1, char Arg2)
{
	float v2; // ST14_4@3
	float v3; // ST10_4@3
	char v5; // [sp+17h] [bp-15h]@3
	int v6; // [sp+18h] [bp-14h]@18
	float v7; // [sp+1Ch] [bp-10h]@21
	float v8; // [sp+20h] [bp-Ch]@21
	float v9; // [sp+24h] [bp-8h]@21
	float v10; // [sp+28h] [bp-4h]@20

	vec3_t Color;
	Vector(0.f, 0.f, 0.f, Color);

	vec3_t Color2;
	Vector(0.f, 0.f, 0.f, Color2);

	vec3_t Color3;
	Vector(0.f, 0.f, 0.f, Color3);

	vec3_t Color4;
	Vector(0.f, 0.f, 0.f, Color4);

	vec3_t Color5;
	Vector(0.f, 0.f, 0.f, Color5);

	if (*(BYTE*)(Arg1)) //ok
	{
		if (Arg2)//ok
		{
			v5 = 1;//ok
		}
		else
		{
			v2 = *(float *)(Arg1 + 20) * 0.0099999998;//ok
			v3 = *(float *)(Arg1 + 16) * 0.0099999998;//ok
			v5 = pObjectGetAngle(v3, v2, -20);
		}
		*(BYTE*)(Arg1 + 416) = v5;
		if (*(BYTE*)(Arg1 + 416)) //ok
		{
			if (*(WORD *)(*(DWORD*)(Arg1 + 316) + 2) != 641 && *(WORD *)(Arg1 + 2) != 7305)
				return 1;
			if (Arg2)
			{
				*(DWORD*)(Arg1 + 12) = *(DWORD*)(Arg1 + 12);
			}
		
			else if (pMainState == 2)
			{
				*(DWORD*)(Arg1 + 12) = 1065353216;
			}
			else if (pMainState == 4)
			{
				*(DWORD*)(Arg1 + 12) = 1065353216;
			}
			else if (*(WORD *)(Arg1 + 2) != 364
				&& *(WORD *)(Arg1 + 2) != 366
				&& *(WORD *)(Arg1 + 2) != 365
				&& *(WORD *)(Arg1 + 2) != 367)
			{
				*(DWORD *)(Arg1 + 12) = 1065353216;
			}

			v6 = 0;
			if ((*(DWORD *)(*(DWORD *)(Arg1 + 316) + 168) & 0x4000) == 0x4000)
			v6 = 10;
			pObjectMaxBug(Arg1, 0, 0, v6);
			v10 = (double)(sub_007396FD() % 30 + 70) * 0.0099999998;
			// ----
			/*if (*(DWORD*)(Arg1 + 2) == ObjectId(13, 0))
			{
				v7 = v10 * 0.5;
				v8 = v10 * 0.80000001;
				v9 = v10 * 0.60000002;
				Vector(0.94, 0.812f, 0.5358f, Color);
				pCreateSpriteEx(1707, Arg1 + 16, 1065353216, (int)&Color, Arg1, 0, 0);
			}*/
			if (*(DWORD*)(Arg1 + 2) == ObjectId(13, 0))
			{
				Vector(0.5358f, 0.812f, 0.94f, Color);
				pCreateParticleEx(1733, Arg1 + 16, Arg1 + 24, (int)Color, 11, 0.5f, Arg1);
				Vector(0.94f, 0.834f, 0.553f, Color2);
				pCreateParticleEx(1733, Arg1 + 16, Arg1 + 24, (int)Color2, 11, 0.4f, Arg1);
				Vector(0.553f, 0.94f, 0.84f, Color3);
				pCreateParticleEx(1733, Arg1 + 16, Arg1 + 24, (int)Color3, 11, 0.3f, Arg1);
				Vector(0.235f, 0.125f, 0.85f, Color4);
				pCreateParticleEx(1733, Arg1 + 16, Arg1 + 24, (int)Color4, 11, 0.2f, Arg1);
				Vector(0.85689f, 0.23541f, 0.9635f, Color5);
				pCreateParticleEx(1733, Arg1 + 16, Arg1 + 24, (int)Color5, 11, 0.1f, Arg1);
			}
			// -----------
		}
	}
	return 1;
}

SetHook((LPVOID)CreatePetEffect, (LPVOID)0x004714C2, ASM::CALL); //ok
SetHook((LPVOID)CreatePetEffect, (LPVOID)0x004E7786, ASM::CALL); //ok[/INDENT][/INDENT][/LEFT][/CENTER]

PS 4: for vec3_t definitions see this thread: Glow Fully Source (1.03K)

GXBQ4Hk - [Development] CreatePetEffect  main 1.04j(Kor) - RaGEZONE Forums
Credts:
Kiosani Main 1.05D
MUEx301: Main 1.04j
 

Attachments

You must be registered for see attachments list
Last edited:
Joined
Nov 4, 2012
Messages
928
Reaction score
545
instead of return 1 you need to return function itself duo default items in original function, so you do not need to re-code default pets effects.
And if you need to re-code a default (Existing pet) you can do it normally

Ps. did you try to call same effects in pets at normal item effect system?
 
Newbie Spellweaver
Joined
Apr 3, 2016
Messages
8
Reaction score
0
offset Main 1.05D ?
offset Main 1.04e ?
 
Last edited:
Back
Top