ServersMU - Comunidad

Zona Programadores => Sources => Mensaje iniciado por: Applayo en Abril 11, 2021, 07:14:41 pm

Título: [Sources] Rotate Character for 5 slots
Publicado por: Applayo en Abril 11, 2021, 07:14:41 pm

[size=14pt][b]Rotate360Character.cpp[/b][/size]
Code:

void RotateCharacter()
{
if (pCursorX > 108 && pCursorX < 188 && pCursorY > 292 && pCursorY < 413) //Primeiro Slot
{
int v5 = pGetPreviewStruct(pPreviewThis(),0);
int v8 = v5 + 776;
*(float *)(v8 + 272) = *(float *)(v8 + 272) - 5.0;
}
else
{
int v5 = pGetPreviewStruct(pPreviewThis(),0);
int v8 = v5 + 776;
*(float *)(v8 + 272) = 90;
}
if (pCursorX > 203 && pCursorX < 275 && pCursorY > 280 && pCursorY < 393) //Segundo Slot
{
int v5 = pGetPreviewStruct(pPreviewThis(),1);
int v8 = v5 + 776;
*(float *)(v8 + 272) = *(float *)(v8 + 272) - 5.0;
}
else
{
int v5 = pGetPreviewStruct(pPreviewThis(),1);
int v8 = v5 + 776;
*(float *)(v8 + 272) = 75;
}
if (pCursorX > 296 && pCursorX < 373 && pCursorY > 270 && pCursorY < 388) //Terceiro Slot
{
int v5 = pGetPreviewStruct(pPreviewThis(),2);
int v8 = v5 + 776;
*(float *)(v8 + 272) = *(float *)(v8 + 272) - 5.0;
}
else
{
int v5 = pGetPreviewStruct(pPreviewThis(),2);
int v8 = v5 + 776;
*(float *)(v8 + 272) = 45;
}
if (pCursorX > 390 && pCursorX < 457 && pCursorY > 271 && pCursorY < 391) //Quarto Slot
{
int v5 = pGetPreviewStruct(pPreviewThis(),3);
int v8 = v5 + 776;
*(float *)(v8 + 272) = *(float *)(v8 + 272) - 5.0;
}
else
{
int v5 = pGetPreviewStruct(pPreviewThis(),3);
int v8 = v5 + 776;
*(float *)(v8 + 272) = 25;
}
if (pCursorX > 474 && pCursorX < 547 && pCursorY > 273 && pCursorY < 408) //Quinto Slot
{
int v5 = pGetPreviewStruct(pPreviewThis(),4);
int v8 = v5 + 776;
*(float *)(v8 + 272) = *(float *)(v8 + 272) - 5.0;
}
else
{
int v5 = pGetPreviewStruct(pPreviewThis(),4);
int v8 = v5 + 776;
*(float *)(v8 + 272) = 0;
}
}

__declspec(naked) void SelectCharacterPosition()
{
   RotateCharacter();

static DWORD Return_Adress = 0x004D84ED;

_asm
{
PUSH EBP                           
MOV EBP,ESP
SUB ESP,0x0D8
MOV BYTE PTR SS:[EBP-0x1],0x0
jmp [Return_Adress]
}
}

void CustomRotateChar()
{
    SetCompleteHook(0xE9, 0x004D84E0, &SelectCharacterPosition);
}


[size=14pt][b]Rotate360Character.h[/b][/size]
Code:

void CustomRotateChar();
void RotateCharacter();

[size=12pt][b]
Main.cpp[/b][/size]
Code:

#include Rotate360Character.h

CustomRotateChar();


Credito:
Rafhael Souza
Título: Re: [Sources] Rotate Character for 5 slots
Publicado por: robins1998 en Mayo 27, 2021, 02:44:01 am
Very helpful, thanks for sharing.