Move.h
#pragma once
class EMove
{
public:
EMove(void);
~EMove(void);
void Load();
void Move(int aIndex,int Num);
char MoveSintax[50][50];
private:
char MoveMsg01[200];
char MoveMsg02[200];
char MoveMsg03[200];
char MoveMsg04[200];
int MoveSwitch[50];
int MoveMap[50];
int MoveCorX[50];
int MoveCorY[50];
int MoveLevel[50];
int MoveZen[50];
int MoveVip[50];
};
extern EMove gmove;
Move.cpp
EMove gmove = EMove();
EMove::EMove(void)
{
}
EMove::~EMove(void)
{
}
void EMove::Load()
{
GetPrivateProfileStringA("MoveSection","MoveMsg01" ,"Não foi possivel mover",this->MoveMsg01,200,".\\Scripts\\CustomMove.script");
GetPrivateProfileStringA("MoveSection","MoveMsg02" ,"Você precisa estar no level %d",this->MoveMsg02,200,".\\Scripts\\CustomMove.script");
GetPrivateProfileStringA("MoveSection","MoveMsg03" ,"Voçê precisa ter %d zen",this->MoveMsg03,200,".\\Scripts\\CustomMove.script");
GetPrivateProfileStringA("MoveSection","MoveMsg04" ,"Comando exclusivo para %s!",this->MoveMsg04,200,".\\Scripts\\CustomMove.script");
char String[20];
for(int i = 0; i < 30; i++)
{
sprintf_s(String,"MoveSwitch_%02d",i);
this->MoveSwitch[i] = GetPrivateProfileIntA("MoveSection",String,0,".\\S cripts\\CustomMove.script");
sprintf_s(String,"MoveMap_%02d",i);
this->MoveMap[i] = GetPrivateProfileIntA("MoveSection",String,0,".\\S cripts\\CustomMove.script");
sprintf_s(String,"MoveCorX_%02d",i);
this->MoveCorX[i] = GetPrivateProfileIntA("MoveSection",String,0,".\\S cripts\\CustomMove.script");
sprintf_s(String,"MoveCorY_%02d",i);
this->MoveCorY[i] = GetPrivateProfileIntA("MoveSection",String,0,".\\S cripts\\CustomMove.script");
sprintf_s(String,"MoveLevel_%02d",i);
this->MoveLevel[i] = GetPrivateProfileIntA("MoveSection",String,0,".\\S cripts\\CustomMove.script");
sprintf_s(String,"MoveZen_%02d",i);
this->MoveZen[i] = GetPrivateProfileIntA("MoveSection",String,0,".\\S cripts\\CustomMove.script");
sprintf_s(String,"MoveVip_%02d",i);
this->MoveVip[i] = GetPrivateProfileIntA("MoveSection",String,0,".\\S cripts\\CustomMove.script");
sprintf_s(String,"MoveSintax_%02d",i);
GetPrivateProfileStringA("MoveSection",String,"/MoveSintaxFail",this->MoveSintax[i],50,".\\Scripts\\CustomMove.script");
}
}
void EMove::Move(int aIndex,int Num)
{
OBJECTSTRUCT* gObj = (OBJECTSTRUCT*)OBJECT_POINTER(aIndex);
int map = this->MoveMap[Num];
int x = this->MoveCorX[Num];
int y = this->MoveCorY[Num];
if(this->MoveSwitch[Num] != 1)
{
outNormal(aIndex,this->MoveMsg01);
}
else if(gObj->Level < this->MoveLevel[Num])
{
outNormal(aIndex,this->MoveMsg02,this->MoveLevel[Num]);
}
else if(gObj->Money < this->MoveZen[Num])
{
outNormal(aIndex,this->MoveMsg03,this->MoveZen[Num]);
}
else if(Get_Vip(gObj->Login) < this->MoveVip[Num])
{
outNormal(aIndex,this->MoveMsg04,GetVipLevel(this->MoveVip[Num]));
}
else
{
gObjTeleport(aIndex, map, x, y);
}
}
Function
#define gObjTeleport ((void(*)(int aIndex, int MapNumber, int X, int Y))0x0040181B)
void outNormal(int aIndex, const char* Format, ...)
{
va_list pArguments;
va_start(pArguments, Format);
vsprintf(&Message[0], Format, pArguments);
va_end(pArguments);
BYTE *Packet;
Packet = (BYTE*) malloc(200);
memset(Packet, 0x00, 200);
*Packet = 0xC1;
*(Packet+2) = 0x0D;
*(Packet+3) = 0x01;
memcpy((Packet+4), Message, strlen(Message));
int Len = (strlen(Message) + 5);
*(Packet+1) = Len;
ProtocolCoreSend(aIndex, Packet, Len);
free (Packet);
}