Autor Tema: CustomClaws - takumi12  (Leído 621 veces)

Desconectado cobyzero06

  • *


  • 9

    6

    230
  • pe
  • A darle nomas
Ahora si es solo copiar y pegar asi que no molesten ._. poner
#include "CustomGloves.h" si esque les salta algun error ._:



MAIN

"stdafx.h"
Código
#include <vector>

#include <map>

"CustomGloves.h"

Código
#pragma once
#define MAX_CUSTOM_GLOVES 100
#define sub_50D810 ((int(__thiscall*)(int a1, int a2, int a3, int a4)) 0x50D810)
#define sub_512D50 ((void*(__thiscall*)(void* a1)) 0x512D50)
#define sub_513C60 ((char*(__thiscall*)(char *This, void *a2, int a3)) 0x513C60)
#define sub_5135F0 ((char*(__thiscall*)(DWORD *This, int a2, int a3)) 0x5135F0)
#define sub_512D60 ((void(*)()) 0x512D60)


struct CUSTOM_RF_GLOVES
{
int Index;
int ItemIndex;
char ModelName[32];
int TextureLeftIndex;
char TextureLeftName[32];
int TextureRightIndex;
char TextureRightName[32];
int ColorR;
int ColorG;
int ColorB;
};

class cCustomGloves
{
public:
cCustomGloves();
virtual ~cCustomGloves();
void Init();
void Load(CUSTOM_RF_GLOVES* info);
bool CheckGloves(int ItemID);
//--
int GetItemIndex(int ItemIndex);
//--------
public:
std::map<int, CUSTOM_RF_GLOVES> m_CustomGlovesInfo;

}; extern cCustomGloves gCustomBattleGloves;


"CustomGloves.cpp"

Código
#include "stdafx.h"
#include "CustomGloves.h"
#include "Defines.h"
#include "Util.h"

cCustomGloves gCustomBattleGloves;

cCustomGloves::cCustomGloves() // OK
{
this->m_CustomGlovesInfo.clear();
}

cCustomGloves::~cCustomGloves() // OK
{

}

//----- (0050DA90) --------------------------------------------------------
void GlovesAssoc(char *This)
{
sub_50D810((int)(This + 92), 1203, 610, 611);
void* v2 = sub_512D50(This + 92);
char* v3 = sub_513C60(This, v2, (int)(This + 92));
sub_5135F0((DWORD *)This + 15, (int)This, (int)v3);
sub_512D60();
// ----
sub_50D810((int)(This + 92), 1204, 612, 613);
v2 = sub_512D50(This + 92);
v3 = sub_513C60(This, v2, (int)(This + 92));
sub_5135F0((DWORD *)This + 15, (int)This, (int)v3);
sub_512D60();
// ----
sub_50D810((int)(This + 92), 1205, 614, 615);
v2 = sub_512D50(This + 92);
v3 = sub_513C60(This, v2, (int)(This + 92));
sub_5135F0((DWORD *)This + 15, (int)This, (int)v3);
sub_512D60();
// ----
sub_50D810((int)(This + 92), 1206, 616, 617);
v2 = sub_512D50(This + 92);
v3 = sub_513C60(This, v2, (int)(This + 92));
sub_5135F0((DWORD *)This + 15, (int)This, (int)v3);
sub_512D60();
// ----
sub_50D810((int)(This + 92), 1211, 610, 611);
v2 = sub_512D50(This + 92);
v3 = sub_513C60(This, v2, (int)(This + 92));
sub_5135F0((DWORD *)This + 15, (int)This, (int)v3);
sub_512D60();
// ----
for(std::map<int, CUSTOM_RF_GLOVES>::iterator it = gCustomBattleGloves.m_CustomGlovesInfo.begin(); it != gCustomBattleGloves.m_CustomGlovesInfo.end(); it++)
{
sub_50D810((int)(This + 92), it->second.ItemIndex + 1171, it->second.TextureLeftIndex + 1171, it->second.TextureRightIndex + 1171);
void* v2 = sub_512D50(This + 92);
char* v3 = sub_513C60(This, v2, (int)(This + 92));
sub_5135F0((DWORD *)This + 15, (int)This, (int)v3);
sub_512D60();
}
}

static BOOL bBattleGlovesGlow_Switcher;

#pragma optimize("t",on)
void __declspec(naked) BattleGloveGlow()
{
static DWORD dwBattleGlovesGlow_Pointer;
static DWORD dwBattleGlovesGlow_Buffer;
static DWORD dwBattleGlovesNewGlow_Buffer;
static DWORD dwBattleGlovesGlow_Jump = 0x005F94E8;
static bool item = false;
// ----
bBattleGlovesGlow_Switcher = FALSE;
// ----
_asm {
MOV dwBattleGlovesGlow_Pointer, EAX
}
// ----
item = gCustomBattleGloves.CheckGloves(dwBattleGlovesGlow_Pointer - 1171);

if (dwBattleGlovesGlow_Pointer == ITEM2(0,35))
{
bBattleGlovesGlow_Switcher = TRUE;
}
//--
else if (item)
{
bBattleGlovesGlow_Switcher = FALSE;
// ----
_asm {
MOV DWORD PTR SS:[EBP-0x4], 0x2C
JMP dwBattleGlovesGlow_Jump
}
}
// ----
if ( bBattleGlovesGlow_Switcher == TRUE ) {
_asm {
MOV dwBattleGlovesGlow_Buffer, 0x005F91C9
JMP dwBattleGlovesGlow_Buffer
}
}
else {
_asm {
MOV dwBattleGlovesGlow_Buffer, 0x005F91D5
JMP dwBattleGlovesGlow_Buffer
}
}
}
#pragma optimize("t",off)
bool validacionPosicion(DWORD dwBattleGlovesGlow_Pointer)
{
if( gCustomBattleGloves.CheckGloves(dwBattleGlovesGlow_Pointer) )
{
return true;
}
else
{
return false;
}
}
#pragma optimize("t",on)

void __declspec(naked) BattleGloveRotate()
{
static DWORD Addr1 = 0x005CD452;
static DWORD GlovesRF = 0;
static float Rotation = -80.0;
static double a1 = 0.07;
static double a2 = 0.1;
_asm
{
MOV ECX, DWORD PTR SS : [EBP + 0x8]
MOV GlovesRF, ECX
}

if(GlovesRF == 0x4B6)
{
_asm
{
FLD DWORD PTR SS:[EBP-0x4C]
FSUB QWORD PTR DS : [0x0D27CA8]/*0x0D27CA8]*/                     //FLOAT 0.004999999888241291
FSTP DWORD PTR SS : [EBP - 0x4C]
FLD DWORD PTR SS : [EBP - 0x48]
FADD QWORD PTR DS : [0x0D254B8]/*0x0D254B8]*/                   //FLOAT 0.01499999966472387
FSTP DWORD PTR SS : [EBP - 0x48]
FLDZ
FSTP DWORD PTR DS:[0x82C6320]
FLDZ
FSTP DWORD PTR DS:[0x82C6324] //[0x82C6324]
FLDZ
FSTP DWORD PTR DS:[0x82C6328] //[0x82C6328]
JMP [Addr1]
}
}
else if(validacionPosicion(GlovesRF -1171) == true) //(GlovesRF -1171)
{
//*(float*)0x82C6320 = 270.0;
_asm
{
FLD DWORD PTR SS:[EBP-0x4C]


FSUB QWORD PTR DS : [a1]                     //FLOAT 0.004999999888241291
FSTP DWORD PTR SS : [EBP - 0x4C]
FLD DWORD PTR SS : [EBP - 0x48] //EBP - 0x48
FADD QWORD PTR DS : [a2]                     //FLOAT 0.01499999966472387
FSTP DWORD PTR SS : [EBP - 0x48] //EBP - 0x48
FLD DWORD PTR DS:[Rotation]                      //FLOAT 270.0000
FSTP DWORD PTR DS:[0x82C6320] //[0x82C6320]
FLDZ
FSTP DWORD PTR DS:[0x82C6324]    //[0x82C6324]                //FLOAT 0.0000
FLDZ
FSTP DWORD PTR DS:[0x82C6328]  // [0x82C6328]                  //FLOAT 0.0000
JMP [Addr1]
}
}
else
{
_asm
{
JMP [Addr1]
}
}

}

void __declspec(naked) BattleGloveScale()
{
static DWORD Addr1 = 0x005CEFF0;
static DWORD Addr2 = 0x005CEFF9;
static DWORD GlovesRF = 0;

_asm
{
MOV ECX, DWORD PTR SS : [EBP + 0x8]
MOV GlovesRF, ECX
}

if(GlovesRF == 0x4B6 || validacionPosicion(GlovesRF -1171) == true)
{
_asm
{
JMP [Addr1]
}
}
else
{
_asm
{
JMP [Addr2]
}
}
}

#pragma optimize("t",off)

void cCustomGloves::Init() // OK
{
//--posicion en el inventario
SetCompleteHook(0xE9,0x005CD419,&BattleGloveRotate);
//-- Tamaño en el inventario
SetCompleteHook(0xE9,0x005CEFE7,&BattleGloveScale);
//-- asociacion de glove
SetCompleteHook(0xE8,0x0050D905,&GlovesAssoc);
//-- Encender Glow
SetCompleteHook(0xE9,0x005F91C2,&BattleGloveGlow);


}

void cCustomGloves::Load(CUSTOM_RF_GLOVES* info) // OK
{
for (int n = 0; n < MAX_CUSTOM_GLOVES; n++)
{
if (info[n].Index < 0 || info[n].Index >= MAX_CUSTOM_GLOVES)
{
return;
}

this->m_CustomGlovesInfo.insert(std::pair<int, CUSTOM_RF_GLOVES>(info[n].ItemIndex,info[n]));
}
}

int cCustomGloves::GetItemIndex(int ItemIndex)
{
std::map<int, CUSTOM_RF_GLOVES>::iterator it = this->m_CustomGlovesInfo.find(ItemIndex);

if(it != this->m_CustomGlovesInfo.end())
{
return it->second.ItemIndex;
}
return -1;
}

bool cCustomGloves::CheckGloves(int ItemIndex)
{
std::map<int, CUSTOM_RF_GLOVES>::iterator it = this->m_CustomGlovesInfo.find(ItemIndex);

if(it != this->m_CustomGlovesInfo.end())
{
return true;
}
return false;
}

"item.cpp"

en void ItemModelLoad() // OK

Código
for(std::map<int, CUSTOM_RF_GLOVES>::iterator it = gCustomBattleGloves.m_CustomGlovesInfo.begin(); it != gCustomBattleGloves.m_CustomGlovesInfo.end(); it++)

{
LoadItemModel(it->second.ItemIndex+ITEM_BASE_MODEL,"Item\\",it->second.ModelName,-1);
LoadItemModel(it->second.TextureLeftIndex+ITEM_BASE_MODEL,"Item\\",it->second.TextureLeftName,-1);
LoadItemModel(it->second.TextureRightIndex+ITEM_BASE_MODEL,"Item\\",it->second.TextureRightName,-1);
}

en void ItemTextureLoad() // OK

Código
for(std::map<int, CUSTOM_RF_GLOVES>::iterator it = gCustomBattleGloves.m_CustomGlovesInfo.begin(); it != gCustomBattleGloves.m_CustomGlovesInfo.end(); it++)

{
LoadItemTexture(it->second.ItemIndex+ITEM_BASE_MODEL,"Item\\",it->second.ModelName,-1);
LoadItemTexture(it->second.TextureLeftIndex+ITEM_BASE_MODEL,"Item\\",it->second.TextureLeftName,-1);
LoadItemTexture(it->second.TextureRightIndex+ITEM_BASE_MODEL,"Item\\",it->second.TextureRightName,-1);
}

"CutomItem.cpp"
en BOOL CCustomItem::GetCustomItemColor(int ItemIndex,float* ItemColor) // OK


Código
	for(std::map<int, CUSTOM_RF_GLOVES>::iterator it = gCustomBattleGloves.m_CustomGlovesInfo.begin(); it != gCustomBattleGloves.m_CustomGlovesInfo.end(); it++)
 {
 if(it->second.ItemIndex == ItemIndex)
 {
 ItemColor[0] = (float)(it->second.ColorR/255.0f);
 ItemColor[1] = (float)(it->second.ColorG/255.0f);
 ItemColor[2] = (float)(it->second.ColorB/255.0f);
 return 1;
 }
 else if(it->second.TextureLeftIndex == ItemIndex)
 {
 ItemColor[0] = (float)(it->second.ColorR/255.0f);
 ItemColor[1] = (float)(it->second.ColorG/255.0f);
 ItemColor[2] = (float)(it->second.ColorB/255.0f);
 return 1;
 }
 else if(it->second.TextureRightIndex == ItemIndex)
 {
 ItemColor[0] = (float)(it->second.ColorR/255.0f);
 ItemColor[1] = (float)(it->second.ColorG/255.0f);
 ItemColor[2] = (float)(it->second.ColorB/255.0f);
 return 1;
 }
}
"Main.cpp"

Código
gCustomBattleGloves.Load(gProtect.m_MainInfo.CustomGloves);
gCustomBattleGloves.Init();

"Protect.h"
Código
CUSTOM_RF_GLOVES CustomGloves[MAX_CUSTOM_GLOVES];
GETMAIN

"CustomGloves.h"
Código
#pragma once
#define MAX_CUSTOM_GLOVES 100

struct CUSTOM_RF_GLOVES
{
int Index;
int ItemIndex;
char ModelName[32];
int TextureLeftIndex;
char TextureLeftName[32];
int TextureRightIndex;
char TextureRightName[32];
int ColorR;
int ColorG;
int ColorB;
};

class CCustomGloves
{
public:
CCustomGloves();
virtual ~CCustomGloves();
void Init();
void Load(char* path);
void SetInfo(CUSTOM_RF_GLOVES info);
public:
CUSTOM_RF_GLOVES m_CustomGlovesInfo[MAX_CUSTOM_GLOVES];
};

extern CCustomGloves gCustomGloves;

"CustomGloves.cpp"

Código
#include "stdafx.h"
#include "CustomGloves.h"
#include "MemScript.h"


CCustomGloves gCustomGloves;

CCustomGloves::CCustomGloves() // OK
{
this->Init();
}

CCustomGloves::~CCustomGloves() // OK
{

}

void CCustomGloves::Init() // OK
{
for(int n=0;n < MAX_CUSTOM_GLOVES;n++)
{
this->m_CustomGlovesInfo[n].Index = -1;
}
}

void CCustomGloves::Load(char* path)
{
CMemScript* lpMemScript = new CMemScript;

if(lpMemScript == 0)
{
printf(MEM_SCRIPT_ALLOC_ERROR,path);
return;
}

if(lpMemScript->SetBuffer(path) == 0)
{
printf(lpMemScript->GetLastError());
delete lpMemScript;
return;
}

this->Init();

try
{
while(true)
{
if(lpMemScript->GetToken() == TOKEN_END)
{
break;
}

if(strcmp("end",lpMemScript->GetString()) == 0)
{
break;
}

CUSTOM_RF_GLOVES info;

memset(&info,0,sizeof(info));

static int CustomItemIndexCount = 0;

info.Index = CustomItemIndexCount++;

info.ItemIndex = lpMemScript->GetNumber();

strcpy_s(info.ModelName,lpMemScript->GetAsString());

info.TextureLeftIndex = lpMemScript->GetAsNumber();

strcpy_s(info.TextureLeftName,lpMemScript->GetAsString());

info.TextureRightIndex = lpMemScript->GetAsNumber();

strcpy_s(info.TextureRightName,lpMemScript->GetAsString());

info.ColorR = lpMemScript->GetAsNumber();

info.ColorG = lpMemScript->GetAsNumber();

info.ColorB = lpMemScript->GetAsNumber();

this->SetInfo(info);
}
}
catch(...)
{
printf(lpMemScript->GetLastError());
}

delete lpMemScript;
}

void CCustomGloves::SetInfo(CUSTOM_RF_GLOVES info) // OK
{
if(info.Index < 0 || info.Index >= MAX_CUSTOM_GLOVES)
{
return;
}

this->m_CustomGlovesInfo[info.Index] = info;
}

"GetMaininfo.cpp"

Código
CUSTOM_RF_GLOVES CustomGloves[MAX_CUSTOM_GLOVES];
gCustomGloves.Load("CustomGloves.txt");
memcpy(info.CustomGloves, gCustomGloves.m_CustomGlovesInfo, sizeof(info.CustomGloves));
"CustomGloves.txt"
Código
//============================
// MasterCodex Season 6 - Mu Online
// Developer: MasterCodex [takumi12]
// Last review: 02.20.2020
//================================
// CustomGloves Config File
//================================
// Agregar archivos en: [Data/Item]
//================================
//GlovesID Model LeftIndex LeftModel RightIndex RightModel        ColorR ColorG ColorB name
46 "BloodangelClo" 400 "BloodangelClo_L" 401 "BloodangelClo_R" 205 192 176 //Bloodangel Claws
56 "Sword39" 402 "Sword39_L" 403 "Sword39_R" 255 226 115 //Darkangel Claws
59 "Sword40" 404 "Sword40_L" 405 "Sword40_R" 255 197 57 //Holyangel Claws
60 "Sword41" 406 "Sword41_L" 407 "Sword41_R" 255 232 112 //Archangel Absolute Claws
61 "Sword42" 408 "Sword42_L" 409 "Sword42_R" 253 255 119 //Blessed Arch's Absolute Claws
64 "Sword43" 410 "Sword43_L" 411 "Sword43_R" 239 154 70 //Soul Claws
80 "Sword44" 412 "Sword44_L" 413 "Sword44_R" 127 127 127 //Blue Eye Claw
52 "Sword37" 414 "Sword37_L" 415 "Sword37_R" 127 127 127 //pantera
81 "GloveDragon" 416 "GloveDragonL" 417 "GloveDragonR" 127 127 127 //pantera
end
CREDITOS
TAKUMI12
CobyZero06(pequeños arreglos ._.)
« Última Modificación: Agosto 14, 2020, 12:40:23 pm por cobyzero06 »

Gracias:

Louis, TecnoBytesRS, Ailson Costa

 

.