Puedo ver tu .Cpp (PEt)
Ahi van
PET.CPP
#include "stdafx.h"
#include "Pet.h"
#include "Import.h"
#include "User.h"
#include "PetProtocol.h"
#include "TMemory.h"
//#include "Fenrir.h"
#include "Protect.h"
#include "Interface.h"
#include "Util.h"
// ----------------------------------------------------------------------------------------------
CustomPet gCustomPet;
CustomPet::CustomPet() //OK
{
this->PetTickCount = 0;
}
CustomPet::~CustomPet()
{
}
char CustomPet::PetHPBar(int a1, int a2)
{
lpViewObj Object = &*(ObjectPreview*)oUserPreviewStruct;
char result;
char PetName[255];
int PetHP;
if ((Object->PetSlot < 7827 || Object->PetSlot > 7831)
&& Object->PetSlot != 7891
&& Object->PetSlot != 7892
&& Object->PetSlot != 7894
&& Object->PetSlot != 7907
&& Object->PetSlot != 7933
&& Object->PetSlot != 7950
&& Object->PetSlot != 7864
&& (Object->PetSlot < ITEM2(13, 174) || Object->PetSlot > ITEM2(13, 512)))
{
result = 0;
}
else
{
memset(&PetHP, 0, 255);
PetName[0] = 0;
switch (Object->PetSlot)
{
case 7827:
wsprintf(PetName, pGetTextLine_(pTextLineThis, 353));
break;
case 7828:
wsprintf(PetName, (char *)oUserTextObject + 84 * (*(WORD *)(oUserPreviewStruct + 556) - 1171));
break;
case 7829:
wsprintf(PetName, pGetTextLine_(pTextLineThis, 355));
break;
case 7830:
wsprintf(PetName, pGetTextLine_(pTextLineThis, 354));
break;
case 7831:
wsprintf(PetName, pGetTextLine_(pTextLineThis, 1187));
break;
case 7864:
wsprintf(PetName, pGetTextLine_(pTextLineThis, 1916));
break;
case 7891:
wsprintf(PetName, (char *)(oUserTextObject + 564480));
break;
case 7892:
wsprintf(PetName, (char *)(oUserTextObject + 564564));
break;
case 7894:
wsprintf(PetName, (char *)(oUserTextObject + 564732));
break;
case 7907:
wsprintf(PetName, (char *)(oUserTextObject + 565824));
break;
case 7933:
wsprintf(PetName, (char *)(oUserTextObject + 568008));
break;
case 7950:
wsprintf(PetName, (char *)(oUserTextObject + 569436));
break;
default:
wsprintf(PetName, (char *)oUserTextObject + 84 * (*(WORD *)(oUserPreviewStruct + 556) - 1171));
break;
}
PetHP = *(BYTE*)(oUserObjectStruct_ + 5550);
sub_7DFA60(1, 50, (int)&PetName, PetHP, 255, 0);
result = 1;
}
return result;
}
bool IsCharacterMove(int a1)
{
if ((*(WORD *)(*(DWORD *)(a1 + 472) + 18) >= 15
&& *(WORD *)(*(DWORD *)(a1 + 472) + 18) <= 37)
|| *(WORD *)(*(DWORD *)(a1 + 472) + 18) == 74
|| *(WORD *)(*(DWORD *)(a1 + 472) + 18) == 75
|| *(WORD *)(*(DWORD *)(a1 + 472) + 18) == 259
|| *(WORD *)(*(DWORD *)(a1 + 472) + 18) == 260)
{
return true;
}
return false;
}
void CustomPet::PetFollowCharacter(int a1, float MaxPos)
{
float v22;
vec3_t MUFLOAT;
vec3_t PetPos;
vec3_t OwnerPos;
vec3_t CurrentPos;
int LootPosition = 1000;
OwnerPos[0] = *(float *)(*(DWORD *)(a1 + 472) + 252);
OwnerPos[1] = *(float *)(*(DWORD *)(a1 + 472) + 256);
OwnerPos[2] = *(float *)(*(DWORD *)(a1 + 472) + 260);
PetPos[0] = OwnerPos[0] - *(float *)(a1 + 252);
PetPos[1] = OwnerPos[1] - *(float *)(a1 + 256);
PetPos[2] = OwnerPos[2] - *(float *)(a1 + 260);
CurrentPos[0] = *(float *)(a1 + 252);
CurrentPos[1] = *(float *)(a1 + 256);
CurrentPos[2] = *(float *)(a1 + 260);
float PetMapPos = PetPos[0] * PetPos[0] + PetPos[1] * PetPos[1];
float diff1 = ((OwnerPos[0] > CurrentPos[0]) ? OwnerPos[0] - CurrentPos[0] : CurrentPos[0] - OwnerPos[0]);
float diff2 = ((OwnerPos[1] > CurrentPos[1]) ? OwnerPos[1] - CurrentPos[1] : CurrentPos[1] - OwnerPos[1]);
float angle = atan(diff2 / diff1) * 180 / PI;
float angle2 = atan2(diff1, diff2) * 180 / PI; //
if (PetMapPos >= MaxPos * MaxPos)
{
float speed;
if (PetMapPos >= (MaxPos * 2) * (MaxPos * 2))
{
speed = 14.0f;
speed += 1.0f;
*(float *)(a1 + 120) = 0.89000002f;
}
else if (PetMapPos >= (MaxPos + (MaxPos / 2)) * (MaxPos + (MaxPos / 2)))
{
speed = 13.0f;
*(float *)(a1 + 120) = 0.69000002f;
}
else
{
speed = 10.0f;
*(float *)(a1 + 120) = 0.40000001f;
}
double MoveX = speed *(cos(angle * PI / 180));
double MoveY = speed *(sin(angle * PI / 180));
if (CurrentPos[0] < OwnerPos[0] && CurrentPos[1] < OwnerPos[1])
{
*(float *)(a1 + 252) += (float)MoveX;
*(float *)(a1 + 256) += (float)MoveY;
*(float *)(a1 + 272) = 180;
*(float *)(a1 + 272) -= angle2;
}
else if (CurrentPos[0] < OwnerPos[0] && CurrentPos[1] > OwnerPos[1])
{
*(float *)(a1 + 252) += (float)MoveX;
*(float *)(a1 + 256) -= (float)MoveY;
*(float *)(a1 + 272) = angle2;
}
else if (CurrentPos[0] > OwnerPos[0] && CurrentPos[1] > OwnerPos[1])
{
*(float *)(a1 + 252) -= (float)MoveX;
*(float *)(a1 + 256) -= (float)MoveY;
*(float *)(a1 + 272) = 360;
*(float *)(a1 + 272) -= angle2;
}
else if (CurrentPos[0] > OwnerPos[0] && CurrentPos[1] < OwnerPos[1])
{
*(float *)(a1 + 252) -= (float)MoveX;
*(float *)(a1 + 256) += (float)MoveY;
*(float *)(a1 + 272) = 180;
*(float *)(a1 + 272) += angle2;
}
//else
//{
// *(float *)(a1 + 252) += abs(MoveX);
// *(float *)(a1 + 256) += abs(MoveY);
// *(float *)(a1 + 272) = *(float *)(*(DWORD *)(a1 + 472) + 272);
//}
*(WORD*)(a1 + 18) = 2;
}
else if (PetMapPos < 70 * 70)
{
if ((*(WORD *)(*(DWORD *)(a1 + 472) + 18) < 15 || *(WORD *)(*(DWORD *)(a1 + 472) + 18) > 37))
{
*(WORD*)(a1 + 18) = 2;
sub_959CE0(a1 + 264, a1 + 372);
sub_95A1E0(a1 + 168, a1 + 372, MUFLOAT);
*(float *)(a1 + 252) = *(float *)(a1 + 252) + MUFLOAT[0];
*(float *)(a1 + 256) = *(float *)(a1 + 256) + MUFLOAT[1];
//*(float *)(a1 + 260) = *(float *)(a1 + 260);
}
}
else
{
if (GetTickCount() <= gCustomPet.PetTickCount + 800)
{
*(WORD*)(a1 + 18) = 1;
}
else if (GetTickCount() <= gCustomPet.PetTickCount + 12000)
{
*(WORD*)(a1 + 18) = 0;
}
else
{
gCustomPet.PetTickCount = GetTickCount();
}
}
if (PetMapPos >= LootPosition * LootPosition)
{
if (*(float *)(a1 + 252) < *(float *)(*(DWORD *)(a1 + 472) + 252))
*(float *)(a1 + 252) = *(float *)(a1 + 252) + PetPos[0] + rand() % 360;
if (*(float *)(a1 + 252) > *(float *)(*(DWORD *)(a1 + 472) + 252))
*(float *)(a1 + 252) = *(float *)(a1 + 252) + PetPos[0] - rand() % 360;
if (*(float *)(a1 + 256) < *(float *)(*(DWORD *)(a1 + 472) + 256))
*(float *)(a1 + 256) = *(float *)(a1 + 256) + PetPos[1] + rand() % 360;
if (*(float *)(a1 + 256) > *(float *)(*(DWORD *)(a1 + 472) + 256))
*(float *)(a1 + 256) = *(float *)(a1 + 256) + PetPos[1] - rand() % 360;
}
*(float *)(a1 + 260) = *(float *)(*(DWORD *)(a1 + 472) + 260);
if (!(rand() % 100))
{
if (PetMapPos < MaxPos * MaxPos)
{
v22 = -(float)(rand() % 64 + 16) * 0.1000000014901161f;
*(float *)(a1 + 272) = (float)(rand() % 360);
}
else
{
v22 = -(float)(rand() % 64 + 128) * 0.1000000014901161f;
}
*(float *)(a1 + 168) = 0.0f;
*(float *)(a1 + 172) = v22;
*(float *)(a1 + 176) = (float)(rand() % 64 - 32) * 0.1000000014901161f;
}
if (*(float *)(a1 + 260) < *(float *)(*(DWORD *)(a1 + 472) + 260) + 100.0f)
*(float *)(a1 + 176) = *(float *)(a1 + 176) + 1.5f;
if (*(float *)(a1 + 260) > *(float *)(*(DWORD *)(a1 + 472) + 260) + 200.0f)
*(float *)(a1 + 176) = *(float *)(a1 + 176) - 1.5f;
}
void CustomPet::PetsMovement(int a1, char a2)
{
if (*(BYTE *)(a1 + 4))
{
lpViewObj lpObj = &*(ObjectPreview*)*(DWORD*)0x07BC4F04;
if (*(DWORD*)0xE609E8 == 5
&& (*(DWORD*)0xE61E18 < 65 || *(DWORD*)0xE61E18 > 68)
&& (!*(BYTE *)(*(DWORD *)(a1 + 472) + 4) || *(BYTE *)(*(DWORD *)(a1 + 472) + 24) != 1))
{
*(BYTE *)(a1 + 4) = 0;
sub_501790(a1, a2);
return;
}
DWORD SkinID = *(DWORD *)(a1 + 48);
DWORD Model = sub_969C50(sub_4CDA10(), SLODWORD(SkinID));
if (Model)
{
if ((SkinID >= ITEM2(13, 174) && SkinID <= ITEM2(13, 512)))
{
gCustomPet.PetFollowCharacter(a1, 150);
switch (SkinID)
{
case ITEM2(13, 226): //King
case ITEM2(13, 281): //Prince
case ITEM2(13, 388): //Prince =)) lazy
*(float*)(a1 + 260) = *(float*)(*(DWORD*)(a1 + 472) + 260) + 40.0f;
break;
case ITEM2(13, 214): //Hawk
case ITEM2(13, 215): //Hawk Evo
case ITEM2(13, 174): //CherryBlossom
case ITEM2(13, 175): //CherryBlossom Evo
case ITEM2(13, 178): //Chrysanthemum
case ITEM2(13, 179): //Chrysanthemum Evo
case ITEM2(13, 200): //Ghost
*(float*)(a1 + 260) = *(float*)(*(DWORD*)(a1 + 472) + 260) + 30.0f;
break;
case ITEM2(13, 201): //Ghost Evo
*(DWORD *)(a1 + 68) = 1;
*(float *)(a1 + 260) = *(float*)(*(DWORD*)(a1 + 472) + 260) + 30.0f;
break;
}
}
}
}
((void(*)(int, char)) 0x501790)(a1, a2);
}
void CustomPet::PreviewCharSet(int ObjectIndex, BYTE * CharSet, lpViewObj Object, int Mode)
{
pPreviewCharSet(ObjectIndex, CharSet, Object, Mode);
lpViewObj lpObj;
if (Object == 0)
{
lpObj = &*(lpViewObj)pGetPreviewStruct(pPreviewThis(), ObjectIndex);
}
else
{
lpObj = Object;
}
PMSG_NEW_CHARACTER_CHARSET_RECV* SelectCharSet = GetNewCharSetSelectCharacter(lpObj->Name);
if (pPlayerState == 4)
{
if (SelectCharSet > 0)
{
BYTE sNewCharSet0 = SelectCharSet->PetCharSet[0] >> 1;
BYTE sNewCharSet1 = SelectCharSet->PetCharSet[1] >> 1;
BYTE sNewCharSet2 = SelectCharSet->PetCharSet[2] >> 1;
BYTE sNewCharSet3 = SelectCharSet->PetCharSet[3] >> 1;
if (sNewCharSet0 > 0 && sNewCharSet0 < 112)
{
if (Mode)
{
*(BYTE *)(Mode + 4) = 0;
}
else
{
sub_5012D0((int)&lpObj->m_Model);
sub_9253D0(sub_4DB230(), (int)&lpObj->m_Model, (int)&lpObj->PetSlot);
}
lpObj->PetSlot = ITEM2(13, 174) + (sNewCharSet0 - 1);
if (Mode)
sub_5013B0(lpObj->PetSlot, (int)&lpObj->m_Model + 252, (int)&lpObj->m_Model, Mode, 0);
else
sub_501700(lpObj->PetSlot, (int)&lpObj->m_Model + 252, (int)&lpObj->m_Model, 0, 0);
}
if (sNewCharSet1 > 0 && sNewCharSet1 < 94)
{
if (Mode)
{
*(BYTE *)(Mode + 4) = 0;
}
else
{
sub_5012D0((int)&lpObj->m_Model);
sub_9253D0(sub_4DB230(), (int)&lpObj->m_Model, (int)&lpObj->PetSlot);
}
lpObj->PetSlot = ITEM2(13, 258) + (sNewCharSet1 - 1);
if (Mode)
sub_5013B0(lpObj->PetSlot, (int)&lpObj->m_Model + 252, (int)&lpObj->m_Model, Mode, 0);
else
sub_501700(lpObj->PetSlot, (int)&lpObj->m_Model + 252, (int)&lpObj->m_Model, 0, 0);
}
if (sNewCharSet2 > 0 && sNewCharSet2 < 100)
{
if (Mode)
{
*(BYTE *)(Mode + 4) = 0;
}
else
{
sub_5012D0((int)&lpObj->m_Model);
sub_9253D0(sub_4DB230(), (int)&lpObj->m_Model, (int)&lpObj->PetSlot);
}
lpObj->PetSlot = ITEM2(13, 351) + (sNewCharSet2 - 1);
if (Mode)
sub_5013B0(lpObj->PetSlot, (int)&lpObj->m_Model + 252, (int)&lpObj->m_Model, Mode, 0);
else
sub_501700(lpObj->PetSlot, (int)&lpObj->m_Model + 252, (int)&lpObj->m_Model, 0, 0);
}
if (sNewCharSet3 > 0 && sNewCharSet3 < 100)
{
if (Mode)
{
*(BYTE *)(Mode + 4) = 0;
}
else
{
sub_5012D0((int)&lpObj->m_Model);
sub_9253D0(sub_4DB230(), (int)&lpObj->m_Model, (int)&lpObj->PetSlot);
}
lpObj->PetSlot = ITEM2(13, 451) + (sNewCharSet3 - 1);
if (Mode)
sub_5013B0(lpObj->PetSlot, (int)&lpObj->m_Model + 252, (int)&lpObj->m_Model, Mode, 0);
else
sub_501700(lpObj->PetSlot, (int)&lpObj->m_Model + 252, (int)&lpObj->m_Model, 0, 0);
}
}
}
NEW_PET_STRUCT* lpCharSet = GetNewPetCharSet(lpObj->aIndex);
if (lpCharSet > 0)
{
BYTE NewCharSet0 = lpCharSet->PetCharSet[0] >> 1;
BYTE NewCharSet1 = lpCharSet->PetCharSet[1] >> 1;
BYTE NewCharSet2 = lpCharSet->PetCharSet[2] >> 1;
BYTE NewCharSet3 = lpCharSet->PetCharSet[3] >> 1;
if (NewCharSet0 > 0 && NewCharSet0 < 112)
{
if (Mode)
{
*(BYTE *)(Mode + 4) = 0;
}
else
{
sub_5012D0((int)&lpObj->m_Model);
sub_9253D0(sub_4DB230(), (int)&lpObj->m_Model, (int)&lpObj->PetSlot);
}
lpObj->PetSlot = ITEM2(13, 174) + (NewCharSet0 - 1);
if (Mode)
sub_5013B0(lpObj->PetSlot, (int)&lpObj->m_Model + 252, (int)&lpObj->m_Model, Mode, 0);
else
sub_501700(lpObj->PetSlot, (int)&lpObj->m_Model + 252, (int)&lpObj->m_Model, 0, 0);
}
if (NewCharSet1 > 0 && NewCharSet1 < 94)
{
if (Mode)
{
*(BYTE *)(Mode + 4) = 0;
}
else
{
sub_5012D0((int)&lpObj->m_Model);
sub_9253D0(sub_4DB230(), (int)&lpObj->m_Model, (int)&lpObj->PetSlot);
}
lpObj->PetSlot = ITEM2(13, 258) + (NewCharSet1 - 1);
if (Mode)
sub_5013B0(lpObj->PetSlot, (int)&lpObj->m_Model + 252, (int)&lpObj->m_Model, Mode, 0);
else
sub_501700(lpObj->PetSlot, (int)&lpObj->m_Model + 252, (int)&lpObj->m_Model, 0, 0);
}
if (NewCharSet2 > 0 && NewCharSet2 < 100)
{
if (Mode)
{
*(BYTE *)(Mode + 4) = 0;
}
else
{
sub_5012D0((int)&lpObj->m_Model);
sub_9253D0(sub_4DB230(), (int)&lpObj->m_Model, (int)&lpObj->PetSlot);
}
lpObj->PetSlot = ITEM2(13, 351) + (NewCharSet2 - 1);
if (Mode)
sub_5013B0(lpObj->PetSlot, (int)&lpObj->m_Model + 252, (int)&lpObj->m_Model, Mode, 0);
else
sub_501700(lpObj->PetSlot, (int)&lpObj->m_Model + 252, (int)&lpObj->m_Model, 0, 0);
}
if (NewCharSet3 > 0 && NewCharSet3 < 100)
{
if (Mode)
{
*(BYTE *)(Mode + 4) = 0;
}
else
{
sub_5012D0((int)&lpObj->m_Model);
sub_9253D0(sub_4DB230(), (int)&lpObj->m_Model, (int)&lpObj->PetSlot);
}
lpObj->PetSlot = ITEM2(13, 451) + (NewCharSet3 - 1);
if (Mode)
sub_5013B0(lpObj->PetSlot, (int)&lpObj->m_Model + 252, (int)&lpObj->m_Model, Mode, 0);
else
sub_501700(lpObj->PetSlot, (int)&lpObj->m_Model + 252, (int)&lpObj->m_Model, 0, 0);
}
}
BYTE CustomPets = CharSet[15] >> 1;
if (CharSet[11] & 1) // == 1
{
lpObj->PetSlot = 7831;
if (Mode)
sub_5013B0(226, (int)&lpObj->m_Model + 252, (int)&lpObj->m_Model, Mode, 0);
else
sub_501700(226, (int)&lpObj->m_Model + 252, (int)&lpObj->m_Model, 0, 0);
}
#if (NEW_FENRIR == 1)
if ((CharSet[11] & 4) == 4)
{
lpObj->PetSlot = 7864;
BYTE v17 = CharSet[15] & 3; // era 3
if (CharSet[16] & 1)
v17 = 4;
if (CustomPets == 122)
v17 = 8;
else if (CustomPets == 123)
v17 = 16;
else if (CustomPets == 124)
v17 = 32;
//fenrir agregado
else if (CustomPets == 125)
v17 = 33;
else if (CustomPets == 126)
v17 = 34;
else if (CustomPets == 127)
v17 = 35;
else if (CustomPets == 128)
v17 = 36;
else if (CustomPets == 129)
v17 = 37;
else if (CustomPets == 130)
v17 = 38;
//---------------------------
lpObj->PetExcellent = v17;
switch (v17)
{
case 1:
if (Mode)
sub_5013B0(384, (int)&lpObj->m_Model + 252, (int)&lpObj->m_Model, Mode, 0);
else
sub_501700(384, (int)&lpObj->m_Model + 252, (int)&lpObj->m_Model, 0, 0);
break;
case 2:
if (Mode)
sub_5013B0(386, (int)&lpObj->m_Model + 252, (int)&lpObj->m_Model, Mode, 0);
else
sub_501700(386, (int)&lpObj->m_Model + 252, (int)&lpObj->m_Model, 0, 0);
break;
case 4:
if (Mode)
sub_5013B0(387, (int)&lpObj->m_Model + 252, (int)&lpObj->m_Model, Mode, 0);
else
sub_501700(387, (int)&lpObj->m_Model + 252, (int)&lpObj->m_Model, 0, 0);
break;
case 8:
if (Mode)
sub_5013B0(0x1833, (int)&lpObj->m_Model + 252, (int)&lpObj->m_Model, Mode, 0);
else
sub_501700(0x1833, (int)&lpObj->m_Model + 252, (int)&lpObj->m_Model, 0, 0);
break;
case 16:
if (Mode)
sub_5013B0(0x1834, (int)&lpObj->m_Model + 252, (int)&lpObj->m_Model, Mode, 0);
else
sub_501700(0x1834, (int)&lpObj->m_Model + 252, (int)&lpObj->m_Model, 0, 0);
break;
case 32:
if (Mode)
sub_5013B0(0x1835, (int)&lpObj->m_Model + 252, (int)&lpObj->m_Model, Mode, 0);
else
sub_501700(0x1835, (int)&lpObj->m_Model + 252, (int)&lpObj->m_Model, 0, 0);
break;
//fenrir agregado
case 33:
if (Mode)
sub_5013B0(0x1836, (int)&lpObj->m_Model + 252, (int)&lpObj->m_Model, Mode, 0);
else
sub_501700(0x1836, (int)&lpObj->m_Model + 252, (int)&lpObj->m_Model, 0, 0);
break;
case 34:
if (Mode)
sub_5013B0(0x1837, (int)&lpObj->m_Model + 252, (int)&lpObj->m_Model, Mode, 0);
else
sub_501700(0x1837, (int)&lpObj->m_Model + 252, (int)&lpObj->m_Model, 0, 0);
break;
case 35:
if (Mode)
sub_5013B0(0x1838, (int)&lpObj->m_Model + 252, (int)&lpObj->m_Model, Mode, 0);
else
sub_501700(0x1838, (int)&lpObj->m_Model + 252, (int)&lpObj->m_Model, 0, 0);
break;
case 36:
if (Mode)
sub_5013B0(0x1839, (int)&lpObj->m_Model + 252, (int)&lpObj->m_Model, Mode, 0);
else
sub_501700(0x1839, (int)&lpObj->m_Model + 252, (int)&lpObj->m_Model, 0, 0);
break;
case 37:
if (Mode)
sub_5013B0(0x1840, (int)&lpObj->m_Model + 252, (int)&lpObj->m_Model, Mode, 0);
else
sub_501700(0x1840, (int)&lpObj->m_Model + 252, (int)&lpObj->m_Model, 0, 0);
break;
case 38:
if (Mode)
sub_5013B0(0x1841, (int)&lpObj->m_Model + 252, (int)&lpObj->m_Model, Mode, 0);
else
sub_501700(0x1841, (int)&lpObj->m_Model + 252, (int)&lpObj->m_Model, 0, 0);
break;
case 39:
if (Mode)
sub_5013B0(0x1842, (int)&lpObj->m_Model + 252, (int)&lpObj->m_Model, Mode, 0);
else
sub_501700(0x1842, (int)&lpObj->m_Model + 252, (int)&lpObj->m_Model, 0, 0);
break;
//---------------------------
default:
if (Mode)
sub_5013B0(385, (int)&lpObj->m_Model + 252, (int)&lpObj->m_Model, Mode, 0);
else
sub_501700(385, (int)&lpObj->m_Model + 252, (int)&lpObj->m_Model, 0, 0);
break;
}
}
#endif
}
void CustomPet::RefreshViewPortItem(int a1)
{
signed int v1; // ST14_4@1
int result; // eax@1
int v6; // [sp+Ch] [bp-14h]@2
int v7; // [sp+10h] [bp-10h]@1
int v8; // [sp+14h] [bp-Ch]@2
BYTE v9; // [sp+1Dh] [bp-3h]@2
BYTE v10; // [sp+1Eh] [bp-2h]@2
BYTE v11; // [sp+1Fh] [bp-1h]@2
v1 = sub_57D9A0(*(BYTE *)(a1 + 4) + (*(BYTE *)(a1 + 3) << 8));
result = sub_96A4C0(sub_402BC0(), v1);
v7 = result;
if (result)
{
v6 = result + 776;
v8 = sub_58AA80(a1 + 5);
v11 = *(BYTE *)(a1 + 6) & 0xF;
v10 = *(BYTE *)(a1 + 8) & 0x3F;
v9 = *(BYTE *)(a1 + 9);
switch ((signed int)*(BYTE *)(a1 + 6) >> 4)
{
case 8:
if (v8 == 0x1FFF)
{
*(WORD *)(v7 + 556) = -1;
sub_5012D0(v6);
sub_9253D0(sub_4DB230(), v7, -1);
}
else
{
*(WORD *)(v7 + 556) = v8 + 1171;
*(BYTE *)(v7 + 558) = 0;
if (v8 >= ITEM2(13, 174) && v8 <= ITEM2(13, 512))
{
sub_501700(v8 + 1171, v6 + 252, v6, 0, 0);
}
}
break;
default:
break;
}
}
((void(*)(int))0x6411A0)(a1);
}
void CustomPet::Load()
{
SetOp((LPVOID)0x0048E17D, CustomPet::PetsMovement, ASM::CALL);
SetOp((LPVOID)0x00503756, CustomPet::PetsMovement, ASM::CALL);
SetOp((LPVOID)0x007DF8BB, CustomPet::PetHPBar, ASM::CALL);
SetOp((LPVOID)0x48FB8C, CustomPet::PreviewCharSet, ASM::CALL);
SetOp((LPVOID)0x63D2D8, CustomPet::PreviewCharSet, ASM::CALL);
SetOp((LPVOID)0x641189, CustomPet::PreviewCharSet, ASM::CALL);
SetOp((LPVOID)0x641F42, CustomPet::PreviewCharSet, ASM::CALL);
SetOp((LPVOID)0x642598, CustomPet::PreviewCharSet, ASM::CALL);
SetOp((LPVOID)0x65EA2D, CustomPet::PreviewCharSet, ASM::CALL);
SetOp((LPVOID)0x664267, CustomPet::RefreshViewPortItem, ASM::CALL);
}
PET.H
#pragma once
#include "Object.h"
#include "Defines.h"
#include "zzzmathlib.h"
#define PI 3.14159265
// ----------------------------------------------------------------------------------------------
//Pet
#define pMaybeDrawPetHP ((char(__stdcall*)(int a1, int a2)) 0x7DFDB0)
#define sub_50D100 ((size_t(__cdecl*)(char * a1, char * a2, ...)) 0x50D100)
#define sub_7DFA60 ((int(__stdcall*)(signed int PosX, signed int PosY, int a3, signed int a4, signed int a5, char a6)) 0x7DFA60)
#define sub_501790 ((char(__cdecl*)(int a1, char a2)) 0x501790)
#define sub_540C30 ((int(__cdecl*)(float, float, float, float)) 0x540C30)
#define sub_540EA0 ((int(__cdecl*)(float, float a2, float)) 0x540EA0)
#define sub_959CE0 ((int(__cdecl*)(DWORD, DWORD)) 0x959CE0)
#define sub_95A1E0 ((int(__cdecl*)(DWORD a1, DWORD a2, float *a3)) 0x95A1E0)
#define sub_541460 ((void(__cdecl*)(int a1)) 0x541460)
#define sub_4CDA10 ((LPVOID(*)())0x4CDA10)
#define sub_969C50 ((int(__thiscall*)(LPVOID This, signed int a2)) 0x969C50)
#define sub_5D6700 ((int(__cdecl*)(unsigned __int8 a1, unsigned __int8 a2)) 0x5D6700)
#define sub_5422E0 ((bool(__cdecl*)(__int16 a1)) 0x5422E0)
#define sub_542310 ((__int16(__cdecl*)(int a1, int a2, char a3)) 0x542310)
#define sub_545030 ((int(__thiscall*)(LPVOID This, int a2, DWORD *a3, DWORD *BMD, char a5)) 0x545030)
#define sub_6D9070 ((void(__cdecl*)(int a1, int a2, int a3, float * a4, int a5, int a6, __int16 a7, __int16 a8, __int16 a9, __int16 a10, float a11, __int16 a12)) 0x6D9070)
#define sub_74CD30 ((int(__cdecl*)(int a1, int a2, int a3, vec3_t a4, int a5, float a6, int a7)) 0x74CD30)
#define sub_74CD30_ ((int(__cdecl*)(DWORD a1, vec3_t a2, int a3, vec3_t a4, int a5, float a6, int a7)) 0x74CD30)
#define sub_4DB1C0 ((bool(__cdecl*)(signed int a1))0x4DB1C0)
#define sub_4C8640 ((bool(__thiscall*)(void * This,char a2)) 0x4C8640)
#define sub_4DB250 ((int(__cdecl*)()) 0x4DB250)
#define sub_4E44A0 ((bool(__thiscall*)(int This)) 0x4E44A0)
#define sub_7293F0 ((char*(__cdecl*)(int a1, int a2, int a3, int a4, int a5, char a6, int a7)) 0x7293F0)
#define sub_5039A0 ((void(__cdecl*)(int a1, int a2)) 0x5039A0)
#define sub_72D1B0 ((void(__cdecl*)(int a1, int a2, int a3, int a4, int a5, int a6, float a7, __int16 a8, __int16 a9, char a10, int a11, int a12, __int16 a13)) 0x72D1B0)
#define sub_542280 ((bool(__cdecl*)(__int16 a1)) 0x542280)
#define sub_545180 ((char(__thiscall*)(void * This, int a2, int a3, int a4, float a5, int a6, int a7)) 0x545180)
#define sub_5CA0D0 ((void(__cdecl*)( int a1, int a2, int a3, int a4, int a5, int a6, char a7)) 0x5CA0D0)
#define sub_9250E0 ((int(__thiscall*)(LPVOID This, int a1, int a2, int a3, int a4, int a5, int a6)) 0x9250E0)
#define sub_4DB230 ((LPVOID(*)())0x4DB230)
#define sub_501700 ((DWORD(__cdecl*)(DWORD, DWORD, DWORD, DWORD, DWORD)) 0x501700)
#define sub_57D9A0 ((DWORD(__cdecl*)(DWORD)) 0x57D9A0)
#define sub_58AA80 ((DWORD(__cdecl*)(DWORD)) 0x58AA80)
#define sub_4E6670 ((DWORD(__cdecl*)(DWORD)) 0x4E6670)
#define sub_57F020 ((DWORD(__cdecl*)(DWORD)) 0x57F020)
#define sub_4F8C30 ((DWORD(__cdecl*)(DWORD)) 0x4F8C30)
#define sub_534B40 ((DWORD(__cdecl*)(DWORD)) 0x534B40)
#define sub_5012D0 ((DWORD(__cdecl*)(DWORD)) 0x5012D0)
#define sub_9253D0 ((int(__thiscall*)(LPVOID This,int a1, short a2)) 0x9253D0)
#define sub_4F94A0 ((DWORD(__cdecl*)(DWORD)) 0x4F94A0)
#define sub_57FC30 ((int(__cdecl*)(BYTE CharSet)) 0x57FC30)
#define sub_587500 ((DWORD(__cdecl*)(char)) 0x587500)
#define sub_402BC0 ((LPVOID(*)())0x402BC0)
#define sub_405230 ((int(__cdecl*)(char a1)) 0x405230)
#define sub_4F9930 ((int(__cdecl*)(char *a1)) 0x4F9930)
#define sub_4F8B80 ((int(__cdecl*)(int a1)) 0x4F8B80)
#define sub_4E65A0 ((bool(__cdecl*)(signed int a1)) 0x4E65A0)
#define sub_4FA780 ((int(__thiscall*)(int This, int a2)) 0x4FA780)
#define sub_5013B0 ((char(__cdecl*)(int a1, int a2, int a3, int a4, int a5)) 0x5013B0)
#define sub_4EFF70 ((void(__cdecl*)(LPVOID This,int a1)) 0x4EFF70)
#define sub_96A4C0 ((int(__thiscall*)(LPVOID This, signed int a2)) 0x96A4C0)
#define sub_57FD90 ((void(__cdecl*)(int a1, BYTE * a2, int a3, int a4)) 0x57FD90)
#define sub_558630 ((void(__cdecl*)(int a1, int a2, int a3)) 0x558630)
#define SLODWORD(x) (*((DWORD*)&(x)))
#define sub_771310 ((int(__cdecl*)(int a1, int a2, float a3, vec3_t a4, int a5, float a6, int a7)) 0x771310)
#define sub_771310_ ((int(__cdecl*)(int a1, vec3_t a2, float a3, vec3_t a4, int a5, float a6, int a7)) 0x771310)
#define sub_95A340 ((int(__cdecl*)(int a1, int a2, int a3)) 0x95A340)
#define sub_5440B0 ((int(__fastcall*)(int a1, int a2, int a3, float a4, float a5, __int16 a6, int a7, int a8, char a9, char a10)) 0x5440B0)
#define sub_922D50 ((signed int(__thiscall*)(int This, unsigned int a2)) 0x922D50);
#define sub_580BB0 ((int(__cdecl*)(DWORD, DWORD)) 0x580BB0)
#define sub_4CD7F0 ((int(__stdcall*)(DWORD,DWORD)) 0x4CD7F0)
#define pDrawMonsterEffect ((char(__cdecl*)(int a1, int a2, int a3)) 0x8C7790)
#define sub_5D81B0 ((int(__cdecl*)(float, float)) 0x5D81B0)
#define sub_544E60 ((void(__thiscall*)(LPVOID This, vec3_t a2, int a3, signed int a4, int a5)) 0x544E60)
#define sub_9593B0 ((int(__stdcall*)(HDC This, LPCSTR lpMultiByteStr, int, LPSIZE psizl)) 0x9593B0)
#define pSetTextSize ((int(__thiscall*)(LPVOID This, HFONT a2)) 0x420120)
#define pFontBold *(DWORD*)0xE8C58C
#define sub_8CBA40 ((int(__cdecl*)(int, int, float, float, float, float, GLfloat *v)) 0x8CBA40) //Effect? 32141
#define sub_5DAD80 ((int(__cdecl*)(int, float, float, float, float, GLfloat *v, float, float, float, char)) 0x5DAD80) //effect ?32313
#define sub_56EFC0 ((int(__cdecl*)(int, int, float, int, float, float, float)) 0x56EFC0)
#define sub_4E65C0 ((bool(__cdecl*)(signed int MapNumber)) 0x4E65C0)
#define sub_89CB00 ((LPVOID(*)())0x89CB00)
#define sub_89CB90 ((int(__thiscall*)(LPVOID This)) 0x89CB90)
#define pPreviewPetThis *(DWORD*)0x007BC4F04
#define LODWORD(h) ((DWORD)(__int64(h) & __int64(0xffffffff)))
#define MAX_LOOTOBJECT 1024 // 1000
//#define iPetAddInventoryPos 0x005CC8E4 // 1.04E ENG
class CustomPet
{
public:
CustomPet();
virtual ~CustomPet();
void Load();
static void PreviewCharSet(int ObjectIndex, BYTE * CharSet, lpViewObj Object, int Mode);
static void PetsMovement(int a1, char a2);
static char PetHPBar(int a1, int a2);
static void RefreshViewPortItem(int a1);
static void PetFollowCharacter(int a1, float MaxPos);
DWORD PetTickCount;
}; extern CustomPet gCustomPet;
PetHook.cpp
#include "stdafx.h"
#include "Protect.h"
#include "PetHook.h"
#include "Util.h"
#include "Defines.h"
#include "Import.h"
#include "TMemory.h"
#include "Pet.h"
ObjCreateBug gObjCreateBug = (ObjCreateBug)0x00501700;
ObjCreatePet gObjCreatePet = (ObjCreatePet)0x00835E40;
void gObjCreatePetEx(int ItemId)
{
int ItemSwitch = *(WORD*)ItemId;
int PetPreview = LODWORD(pPreviewPetThis) + 776;
if (ItemSwitch >= ITEM2(13, 174) && ItemSwitch <= ITEM2(13, 512))
{
gObjCreateBug(ItemSwitch + 1171, PetPreview + 252, PetPreview, 0, 0);
}
gObjCreatePet(ItemId);
}
bool ResetPetPreviewEx(int ItemId)
{
bool Result;
if (ItemId)
Result = *(WORD*)ItemId == 0x1A00 //Angel
|| *(WORD*)ItemId == 0x1A01 //Satan
|| *(WORD*)ItemId == 0x1A02 //Unicorn
|| *(WORD*)ItemId == 0x1A03 //Dinorant
|| *(WORD*)ItemId == 0x1A04 //Dark Horse
|| *(WORD*)ItemId == 0x1A05 //Dark Raven
|| *(WORD*)ItemId == 0x1A25 //Fenrir //
|| *(WORD*)ItemId == ITEM2(13, 64)
|| *(WORD*)ItemId == ITEM2(13, 65)
|| *(WORD*)ItemId == ITEM2(13, 67)
|| *(WORD*)ItemId == ITEM2(13, 80)
|| *(WORD*)ItemId == ITEM2(13, 106)
|| *(WORD*)ItemId == ITEM2(13, 123)
|| *(WORD*)ItemId == ITEM2(13, 174)
|| *(WORD*)ItemId == ITEM2(13, 175)
|| *(WORD*)ItemId == ITEM2(13, 176)
|| *(WORD*)ItemId == ITEM2(13, 177)
|| *(WORD*)ItemId == ITEM2(13, 178)
|| *(WORD*)ItemId == ITEM2(13, 179)
|| *(WORD*)ItemId == ITEM2(13, 180)
|| *(WORD*)ItemId == ITEM2(13, 181)
|| *(WORD*)ItemId == ITEM2(13, 182)
|| *(WORD*)ItemId == ITEM2(13, 183)
|| *(WORD*)ItemId == ITEM2(13, 184)
|| *(WORD*)ItemId == ITEM2(13, 185)
|| *(WORD*)ItemId == ITEM2(13, 186)
|| *(WORD*)ItemId == ITEM2(13, 187)
|| *(WORD*)ItemId == ITEM2(13, 188)
|| *(WORD*)ItemId == ITEM2(13, 189)
|| *(WORD*)ItemId == ITEM2(13, 190)
|| *(WORD*)ItemId == ITEM2(13, 191)
|| *(WORD*)ItemId == ITEM2(13, 192)
|| *(WORD*)ItemId == ITEM2(13, 193)
|| *(WORD*)ItemId == ITEM2(13, 194)
|| *(WORD*)ItemId == ITEM2(13, 195)
|| *(WORD*)ItemId == ITEM2(13, 196)
|| *(WORD*)ItemId == ITEM2(13, 197)
|| *(WORD*)ItemId == ITEM2(13, 198)
|| *(WORD*)ItemId == ITEM2(13, 199)
|| *(WORD*)ItemId == ITEM2(13, 200)
|| *(WORD*)ItemId == ITEM2(13, 201)
|| *(WORD*)ItemId == ITEM2(13, 202)
|| *(WORD*)ItemId == ITEM2(13, 203)
|| *(WORD*)ItemId == ITEM2(13, 204)
|| *(WORD*)ItemId == ITEM2(13, 205)
|| *(WORD*)ItemId == ITEM2(13, 206)
|| *(WORD*)ItemId == ITEM2(13, 207)
|| *(WORD*)ItemId == ITEM2(13, 208)
|| *(WORD*)ItemId == ITEM2(13, 209)
|| *(WORD*)ItemId == ITEM2(13, 210)
|| *(WORD*)ItemId == ITEM2(13, 211)
|| *(WORD*)ItemId == ITEM2(13, 212)
|| *(WORD*)ItemId == ITEM2(13, 213)
|| *(WORD*)ItemId == ITEM2(13, 214)
|| *(WORD*)ItemId == ITEM2(13, 215)
|| *(WORD*)ItemId == ITEM2(13, 216)
|| *(WORD*)ItemId == ITEM2(13, 217)
|| *(WORD*)ItemId == ITEM2(13, 218)
|| *(WORD*)ItemId == ITEM2(13, 219)
|| *(WORD*)ItemId == ITEM2(13, 220)
|| *(WORD*)ItemId == ITEM2(13, 221)
|| *(WORD*)ItemId == ITEM2(13, 222)
|| *(WORD*)ItemId == ITEM2(13, 223)
|| *(WORD*)ItemId == ITEM2(13, 224)
|| *(WORD*)ItemId == ITEM2(13, 225)
|| *(WORD*)ItemId == ITEM2(13, 226)
|| *(WORD*)ItemId == ITEM2(13, 227)
|| *(WORD*)ItemId == ITEM2(13, 228)
|| *(WORD*)ItemId == ITEM2(13, 229)
|| *(WORD*)ItemId == ITEM2(13, 230)
|| *(WORD*)ItemId == ITEM2(13, 231)
|| *(WORD*)ItemId == ITEM2(13, 232)
|| *(WORD*)ItemId == ITEM2(13, 233)
|| *(WORD*)ItemId == ITEM2(13, 234)
|| *(WORD*)ItemId == ITEM2(13, 235)
|| *(WORD*)ItemId == ITEM2(13, 236)
|| *(WORD*)ItemId == ITEM2(13, 237)
|| *(WORD*)ItemId == ITEM2(13, 238)
|| *(WORD*)ItemId == ITEM2(13, 239)
|| *(WORD*)ItemId == ITEM2(13, 240)
|| *(WORD*)ItemId == ITEM2(13, 241)
|| *(WORD*)ItemId == ITEM2(13, 242)
|| *(WORD*)ItemId == ITEM2(13, 243)
|| *(WORD*)ItemId == ITEM2(13, 244)
|| *(WORD*)ItemId == ITEM2(13, 245)
|| *(WORD*)ItemId == ITEM2(13, 246)
|| *(WORD*)ItemId == ITEM2(13, 247)
|| *(WORD*)ItemId == ITEM2(13, 248)
|| *(WORD*)ItemId == ITEM2(13, 249)
|| *(WORD*)ItemId == ITEM2(13, 250)
|| *(WORD*)ItemId == ITEM2(13, 251)
|| *(WORD*)ItemId == ITEM2(13, 252)
|| *(WORD*)ItemId == ITEM2(13, 253)
|| *(WORD*)ItemId == ITEM2(13, 254)
|| *(WORD*)ItemId == ITEM2(13, 255)
|| *(WORD*)ItemId == ITEM2(13, 256)
|| *(WORD*)ItemId == ITEM2(13, 257)
|| *(WORD*)ItemId == ITEM2(13, 258)
|| *(WORD*)ItemId == ITEM2(13, 259)
|| *(WORD*)ItemId == ITEM2(13, 260)
|| *(WORD*)ItemId == ITEM2(13, 261)
|| *(WORD*)ItemId == ITEM2(13, 262)
|| *(WORD*)ItemId == ITEM2(13, 263)
|| *(WORD*)ItemId == ITEM2(13, 264)
|| *(WORD*)ItemId == ITEM2(13, 265)
|| *(WORD*)ItemId == ITEM2(13, 266)
|| *(WORD*)ItemId == ITEM2(13, 267)
|| *(WORD*)ItemId == ITEM2(13, 268)
|| *(WORD*)ItemId == ITEM2(13, 269)
|| *(WORD*)ItemId == ITEM2(13, 270)
|| *(WORD*)ItemId == ITEM2(13, 271)
|| *(WORD*)ItemId == ITEM2(13, 272)
|| *(WORD*)ItemId == ITEM2(13, 273)
|| *(WORD*)ItemId == ITEM2(13, 274)
|| *(WORD*)ItemId == ITEM2(13, 275)
|| *(WORD*)ItemId == ITEM2(13, 276)
|| *(WORD*)ItemId == ITEM2(13, 277)
|| *(WORD*)ItemId == ITEM2(13, 278)
|| *(WORD*)ItemId == ITEM2(13, 279)
|| *(WORD*)ItemId == ITEM2(13, 280)
|| *(WORD*)ItemId == ITEM2(13, 281)
|| *(WORD*)ItemId == ITEM2(13, 282)
|| *(WORD*)ItemId == ITEM2(13, 283)
|| *(WORD*)ItemId == ITEM2(13, 284)
|| *(WORD*)ItemId == ITEM2(13, 285)
|| *(WORD*)ItemId == ITEM2(13, 286)
|| *(WORD*)ItemId == ITEM2(13, 287)
|| *(WORD*)ItemId == ITEM2(13, 288)
|| *(WORD*)ItemId == ITEM2(13, 289)
|| *(WORD*)ItemId == ITEM2(13, 290)
|| *(WORD*)ItemId == ITEM2(13, 291)
|| *(WORD*)ItemId == ITEM2(13, 292)
|| *(WORD*)ItemId == ITEM2(13, 293)
|| *(WORD*)ItemId == ITEM2(13, 294)
|| *(WORD*)ItemId == ITEM2(13, 295)
|| *(WORD*)ItemId == ITEM2(13, 296)
|| *(WORD*)ItemId == ITEM2(13, 297)
|| *(WORD*)ItemId == ITEM2(13, 298)
|| *(WORD*)ItemId == ITEM2(13, 299)
|| *(WORD*)ItemId == ITEM2(13, 300)
|| *(WORD*)ItemId == ITEM2(13, 301)
|| *(WORD*)ItemId == ITEM2(13, 302)
|| *(WORD*)ItemId == ITEM2(13, 303)
|| *(WORD*)ItemId == ITEM2(13, 304)
|| *(WORD*)ItemId == ITEM2(13, 305)
|| *(WORD*)ItemId == ITEM2(13, 306)
|| *(WORD*)ItemId == ITEM2(13, 307)
|| *(WORD*)ItemId == ITEM2(13, 308)
|| *(WORD*)ItemId == ITEM2(13, 309)
|| *(WORD*)ItemId == ITEM2(13, 310)
|| *(WORD*)ItemId == ITEM2(13, 311)
|| *(WORD*)ItemId == ITEM2(13, 312)
|| *(WORD*)ItemId == ITEM2(13, 313)
|| *(WORD*)ItemId == ITEM2(13, 314)
|| *(WORD*)ItemId == ITEM2(13, 315)
|| *(WORD*)ItemId == ITEM2(13, 316)
|| *(WORD*)ItemId == ITEM2(13, 317)
|| *(WORD*)ItemId == ITEM2(13, 318)
|| *(WORD*)ItemId == ITEM2(13, 319)
|| *(WORD*)ItemId == ITEM2(13, 320)
|| *(WORD*)ItemId == ITEM2(13, 321)
|| *(WORD*)ItemId == ITEM2(13, 322)
|| *(WORD*)ItemId == ITEM2(13, 323)
|| *(WORD*)ItemId == ITEM2(13, 324)
|| *(WORD*)ItemId == ITEM2(13, 325)
|| *(WORD*)ItemId == ITEM2(13, 326)
|| *(WORD*)ItemId == ITEM2(13, 327)
|| *(WORD*)ItemId == ITEM2(13, 328)
|| *(WORD*)ItemId == ITEM2(13, 329)
|| *(WORD*)ItemId == ITEM2(13, 330)
|| *(WORD*)ItemId == ITEM2(13, 331)
|| *(WORD*)ItemId == ITEM2(13, 332)
|| *(WORD*)ItemId == ITEM2(13, 333)
|| *(WORD*)ItemId == ITEM2(13, 334)
|| *(WORD*)ItemId == ITEM2(13, 335)
|| *(WORD*)ItemId == ITEM2(13, 336)
|| *(WORD*)ItemId == ITEM2(13, 337)
|| *(WORD*)ItemId == ITEM2(13, 338)
|| *(WORD*)ItemId == ITEM2(13, 339)
|| *(WORD*)ItemId == ITEM2(13, 340)
|| *(WORD*)ItemId == ITEM2(13, 341)
|| *(WORD*)ItemId == ITEM2(13, 342)
|| *(WORD*)ItemId == ITEM2(13, 343)
|| *(WORD*)ItemId == ITEM2(13, 344)
|| *(WORD*)ItemId == ITEM2(13, 345)
|| *(WORD*)ItemId == ITEM2(13, 346)
|| *(WORD*)ItemId == ITEM2(13, 347)
|| *(WORD*)ItemId == ITEM2(13, 348)
|| *(WORD*)ItemId == ITEM2(13, 349)
|| *(WORD*)ItemId == ITEM2(13, 350)
|| *(WORD*)ItemId == ITEM2(13, 351)
|| *(WORD*)ItemId == ITEM2(13, 352)
|| *(WORD*)ItemId == ITEM2(13, 353)
|| *(WORD*)ItemId == ITEM2(13, 354)
|| *(WORD*)ItemId == ITEM2(13, 355)
|| *(WORD*)ItemId == ITEM2(13, 356)
|| *(WORD*)ItemId == ITEM2(13, 357)
|| *(WORD*)ItemId == ITEM2(13, 358)
|| *(WORD*)ItemId == ITEM2(13, 359)
|| *(WORD*)ItemId == ITEM2(13, 360)
|| *(WORD*)ItemId == ITEM2(13, 361)
|| *(WORD*)ItemId == ITEM2(13, 362)
|| *(WORD*)ItemId == ITEM2(13, 363)
|| *(WORD*)ItemId == ITEM2(13, 364)
|| *(WORD*)ItemId == ITEM2(13, 365)
|| *(WORD*)ItemId == ITEM2(13, 366)
|| *(WORD*)ItemId == ITEM2(13, 367)
|| *(WORD*)ItemId == ITEM2(13, 368)
|| *(WORD*)ItemId == ITEM2(13, 369)
|| *(WORD*)ItemId == ITEM2(13, 370)
|| *(WORD*)ItemId == ITEM2(13, 371)
|| *(WORD*)ItemId == ITEM2(13, 372)
|| *(WORD*)ItemId == ITEM2(13, 373)
|| *(WORD*)ItemId == ITEM2(13, 374)
|| *(WORD*)ItemId == ITEM2(13, 375)
|| *(WORD*)ItemId == ITEM2(13, 376)
|| *(WORD*)ItemId == ITEM2(13, 377)
|| *(WORD*)ItemId == ITEM2(13, 378)
|| *(WORD*)ItemId == ITEM2(13, 379)
|| *(WORD*)ItemId == ITEM2(13, 380)
|| *(WORD*)ItemId == ITEM2(13, 381)
|| *(WORD*)ItemId == ITEM2(13, 382)
|| *(WORD*)ItemId == ITEM2(13, 383)
|| *(WORD*)ItemId == ITEM2(13, 384)
|| *(WORD*)ItemId == ITEM2(13, 385)
|| *(WORD*)ItemId == ITEM2(13, 386)
|| *(WORD*)ItemId == ITEM2(13, 387)
|| *(WORD*)ItemId == ITEM2(13, 388)
|| *(WORD*)ItemId == ITEM2(13, 389)
|| *(WORD*)ItemId == ITEM2(13, 390)
|| *(WORD*)ItemId == ITEM2(13, 391)
|| *(WORD*)ItemId == ITEM2(13, 392)
|| *(WORD*)ItemId == ITEM2(13, 393)
|| *(WORD*)ItemId == ITEM2(13, 394)
|| *(WORD*)ItemId == ITEM2(13, 395)
|| *(WORD*)ItemId == ITEM2(13, 396)
|| *(WORD*)ItemId == ITEM2(13, 397)
|| *(WORD*)ItemId == ITEM2(13, 398)
|| *(WORD*)ItemId == ITEM2(13, 399)
|| *(WORD*)ItemId == ITEM2(13, 400)
|| *(WORD*)ItemId == ITEM2(13, 401)
|| *(WORD*)ItemId == ITEM2(13, 402)
|| *(WORD*)ItemId == ITEM2(13, 403)
|| *(WORD*)ItemId == ITEM2(13, 404)
|| *(WORD*)ItemId == ITEM2(13, 405)
|| *(WORD*)ItemId == ITEM2(13, 406)
|| *(WORD*)ItemId == ITEM2(13, 407)
|| *(WORD*)ItemId == ITEM2(13, 408)
|| *(WORD*)ItemId == ITEM2(13, 409)
|| *(WORD*)ItemId == ITEM2(13, 410)
// || *(WORD*)ItemId == ITEM(12, 208)
// || *(WORD*)ItemId == ITEM(12, 194)
// || *(WORD*)ItemId == ITEM(12, 220)
// || *(WORD*)ItemId == ITEM(12, 221)
;
else
Result = 0;
return Result;
}
void gObjCreatePetExHook()
{
SetOp((LPVOID)0x00836481, (LPVOID)ResetPetPreviewEx, ASM::CALL);
SetOp((LPVOID)0x007DD304, (LPVOID)gObjCreatePetEx, ASM::CALL);
SetOp((LPVOID)0x00833B08, (LPVOID)gObjCreatePetEx, ASM::CALL);
// SetCompleteHook(0xE8, 0x007DD304, &gObjCreatePetEx); // new tipo
// SetCompleteHook(0xE8, 0x00833B08, &gObjCreatePetEx); // new tipo
}
PetHook.h
#define ItemId(x, y) ((x * 512) + y)
#define pPreviewPetThis *(DWORD*)0x007BC4F04
#define LODWORD(h) ((DWORD)(__int64(h) & __int64(0xffffffff)))
namespace eBugType
{
enum T
{
NewPet = 7972,
};
};
typedef void(__thiscall *ObjCreatePet)(int ItemId);
extern ObjCreatePet gObjCreatePet;
// --
typedef int(__cdecl *ObjCreateBug)(int BugId, int Arg2, int Arg3, int Arg4, int Arg5);
extern ObjCreateBug gObjCreateBug;
// --
void gObjCreatePetExHook();
custompet.cpp
// CustomItem.cpp: implementation of the cCustomPet class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "CustomPet.h"
#include "Defines.h"
cCustomPet gCustomPet2;
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
cCustomPet::cCustomPet() // OK
{
this->Init();
}
cCustomPet::~cCustomPet() // OK
{
}
void cCustomPet::Init() // OK
{
for (int n = 0; n < MAX_PET_ITEM; n++)
{
this->m_CustomPetInfo[n].Index = -1;
}
}
void cCustomPet::Load(CUSTOM_PET_INFO* info) // OK
{
for (int n = 0; n < MAX_PET_ITEM; n++)
{
this->SetInfo(info[n]);
}
}
void cCustomPet::SetInfo(CUSTOM_PET_INFO info) // OK
{
if (info.Index < 0 || info.Index >= MAX_PET_ITEM)
{
return;
}
this->m_CustomPetInfo[info.Index] = info;
}
CUSTOM_PET_INFO* cCustomPet::GetInfo(int index) // OK
{
if (index < 0 || index >= MAX_PET_ITEM)
{
return 0;
}
if (this->m_CustomPetInfo[index].Index != index)
{
return 0;
}
return &this->m_CustomPetInfo[index];
}
CUSTOM_PET_INFO* cCustomPet::GetInfoByItem(int ItemType) // OK
{
for (int n = 0; n < MAX_PET_ITEM; n++)
{
CUSTOM_PET_INFO* lpInfo = this->GetInfo(n);
if (lpInfo == 0)
{
continue;
}
if (lpInfo->ItemType == ItemType)
{
return lpInfo;
}
}
return 0;
}
BOOL cCustomPet::CheckCustomItemByItem(int ItemIndex) // OK
{
if (this->GetInfoByItem(ItemIndex) != 0)
{
return 1;
}
return 0;
}
custompet.h
#pragma once
#define MAX_PET_ITEM 512 // 350
struct CUSTOM_PET_INFO
{
int Index;
int ItemType;
int ItemIndex;
char ModelName[32];
};
class cCustomPet
{
public:
cCustomPet();
virtual ~cCustomPet();
void Init();
void Load(CUSTOM_PET_INFO* info);
void SetInfo(CUSTOM_PET_INFO info);
CUSTOM_PET_INFO* GetInfo(int index);
CUSTOM_PET_INFO* GetInfoByItem(int ItemType);
BOOL CheckCustomItemByItem(int ItemIndex);
public:
CUSTOM_PET_INFO m_CustomPetInfo[MAX_PET_ITEM];
};
extern cCustomPet gCustomPet2;
petprotocol.cpp
#include "stdafx.h"
#include "PetProtocol.h"
NEW_PET_STRUCT gNewPetCharSet[400];
PMSG_NEW_CHARACTER_CHARSET_RECV gNewPetCharSetSelectChar[5];
void ClearNewPetCharSet() // OK
{
for (int n = 0; n < 400; n++)
{
gNewPetCharSet[n].index = 0xFFFF;
memset(gNewPetCharSet[n].PetCharSet, 0, sizeof(gNewPetCharSet[n].PetCharSet));
}
}
void InsertNewPetCharSet(WORD index, BYTE *CharSet) // OK
{
for (int n = 0; n < 400; n++)
{
if (gNewPetCharSet[n].index == 0xFFFF)
{
gNewPetCharSet[n].index = index;
memcpy(gNewPetCharSet[n].PetCharSet, CharSet, sizeof(gNewPetCharSet[n].PetCharSet));
return;
}
}
}
NEW_PET_STRUCT* GetNewPetCharSet(WORD index) // OK
{
for (int n = 0; n < 400; n++)
{
if (gNewPetCharSet[n].index != 0xFFFF)
{
if (gNewPetCharSet[n].index == index)
{
return &gNewPetCharSet[n];
}
}
}
return 0;
}
void ClearNewPetCharSetSelectCharacter() // OK
{
for (int n = 0; n < 5; n++)
{
memset(gNewPetCharSetSelectChar[n].Name, 0, sizeof(gNewPetCharSetSelectChar[n].Name));
memset(gNewPetCharSetSelectChar[n].PetCharSet, 0, sizeof(gNewPetCharSetSelectChar[n].PetCharSet));
}
}
void InsertNewPetCharSetSelectCharacter(char * Name, BYTE *CharSet) // OK
{
for (int n = 0; n < 5; n++)
{
if (gNewPetCharSetSelectChar[n].Name[0] == '\0')
{
memcpy(gNewPetCharSetSelectChar[n].Name, Name, sizeof(gNewPetCharSetSelectChar[n].Name));
memcpy(gNewPetCharSetSelectChar[n].PetCharSet, CharSet, sizeof(gNewPetCharSetSelectChar[n].PetCharSet));
return;
}
}
}
PMSG_NEW_CHARACTER_CHARSET_RECV* GetNewCharSetSelectCharacter(char *Name) // OK
{
for (int n = 0; n < 5; n++)
{
if (gNewPetCharSetSelectChar[n].Name[0] != '\0')
{
if (strncmp(gNewPetCharSetSelectChar[n].Name, Name, sizeof(gNewPetCharSetSelectChar[n].Name)) == 0)
{
return &gNewPetCharSetSelectChar[n];
}
}
}
return 0;
}
petprotocol.h
#pragma once
#include "Protocol.h"
struct PMSG_NEW_PET_CHARSET_RECV
{
PSWMSG_HEAD header; // C2:F3:E6
BYTE count;
};
struct NEW_PET_STRUCT
{
WORD index;
BYTE PetCharSet[18];
};
struct PMSG_NEW_SELECT_CHARACTER_CHARSET_RECV
{
PSWMSG_HEAD header; // C2:F3:E8
BYTE count;
};
struct PMSG_NEW_CHARACTER_CHARSET_RECV
{
char Name[10];
BYTE PetCharSet[18];
};
void ClearNewPetCharSet();
void InsertNewPetCharSet(WORD index, BYTE *CharSet);
NEW_PET_STRUCT* GetNewPetCharSet(WORD index);
void ClearNewPetCharSetSelectCharacter();
void InsertNewPetCharSetSelectCharacter(char * Name, BYTE *CharSet);
PMSG_NEW_CHARACTER_CHARSET_RECV* GetNewCharSetSelectCharacter(char *Name);
void GCPetCharSetRecv(PMSG_NEW_PET_CHARSET_RECV* lpMsg);
void GCPetCharSetSelectCharacterRecv(PMSG_NEW_SELECT_CHARACTER_CHARSET_RECV* lpMsg);