Olá a todos, estou postando mais um codigo para vocês sempre evoluirem nos seus desenvolvimento... sei que não é muito.. mais é alguma coisa kkk
Para usa-lo em outra versão só modificar o ChatTargetSend no Reset.h!
Vamos aos codigos :}
Reset.cpp
Código:
#include "StdAfx.h"
#include "Commands.h"
#include "Configs.h"
#include "GameMaping.h"
#include "User.h"
#include "Main.h"
#include "Protocol.h"
#include "Extra.h"
#include "SQL.h"
#include "Functions.h"
#include "Notice.h"
#include "Reset.h"
ResetGuard rGuard;
static char Msg[99] = {0};
ResetGuard::ResetGuard(void)
{
}
ResetGuard::~ResetGuard(void)
{
}
void ResetGuard::ResetConfigs()
{
this->ResetActive = 0;
this->ResetDelay = 100;
// 0 á 5 Resets
this->ResetLevel[0][0] = 340;
this->ResetPoint[0][0] = 375;
this->ResetLevel[1][0] = 320;
this->ResetPoint[1][0] = 475;
this->ResetLevel[2][0] = 300;
this->ResetPoint[2][0] = 575;
// 5 á 15 Resets
this->ResetLevel[0][1] = 350;
this->ResetPoint[0][1] = 350;
this->ResetLevel[1][1] = 330;
this->ResetPoint[1][1] = 450;
this->ResetLevel[2][1] = 310;
this->ResetPoint[2][1] = 550;
// 15 á 30 Resets
this->ResetLevel[0][2] = 360;
this->ResetPoint[0][2] = 325;
this->ResetLevel[1][2] = 340;
this->ResetPoint[1][2] = 425;
this->ResetLevel[2][2] = 320;
this->ResetPoint[2][2] = 525;
// 30 á 50 Resets
this->ResetLevel[0][3] = 370;
this->ResetPoint[0][3] = 300;
this->ResetLevel[1][3] = 350;
this->ResetPoint[1][3] = 400;
this->ResetLevel[2][3] = 330;
this->ResetPoint[2][3] = 500;
// 50 á 100 Resets
this->ResetLevel[0][4] = 380;
this->ResetPoint[0][4] = 275;
this->ResetLevel[1][4] = 360;
this->ResetPoint[1][4] = 375;
this->ResetLevel[2][4] = 340;
this->ResetPoint[2][4] = 475;
// 100 á 200 Resets
this->ResetLevel[0][5] = 390;
this->ResetPoint[0][5] = 250;
this->ResetLevel[1][5] = 370;
this->ResetPoint[1][5] = 350;
this->ResetLevel[2][5] = 350;
this->ResetPoint[2][5] = 450;
// 200 á 500 Resets
this->ResetLevel[0][6] = 400;
this->ResetPoint[0][6] = 225;
this->ResetLevel[1][6] = 380;
this->ResetPoint[1][6] = 325;
this->ResetLevel[2][6] = 360;
this->ResetPoint[2][6] = 425;
// 500 adiante
this->ResetLevel[0][7] = 400;
this->ResetPoint[0][7] = 200;
this->ResetLevel[1][7] = 390;
this->ResetPoint[1][7] = 300;
this->ResetLevel[2][7] = 370;
this->ResetPoint[2][7] = 400;
// Price
this->ResetPrice = 40000;
// Back Points
this->ResetBackSTR = 18;
this->ResetBackAGI = 15;
this->ResetBackVIT = 19;
this->ResetBackENE = 23;
}
void ResetGuard::ResetTalk(OBJECTSTRUCT * lpObj,OBJECTSTRUCT * lpNpc)
{
if(this->ResetActive == 1)
{
if( lpObj->Level >= this->ResetLevel[lpObj->Vip][lpObj->ResetType] )
{
if( lpObj->Money > this->ResetPrice )
{
lpObj->Money -= this->ResetPrice;
GCMoneySend(lpObj->m_Index,lpObj->Money);
lpObj->Resets += 1;
lpObj->Level = 1;
lpObj->Experience = 1;
lpObj->LevelUpPoint = lpObj->Resets*this->ResetPoint[lpObj->Vip][lpObj->ResetType];
lpObj->Strength = this->ResetBackSTR;
lpObj->Dexterity = this->ResetBackAGI;
lpObj->Vitality = this->ResetBackVIT;
lpObj->Energy = this->ResetBackENE;
GCLevelUpMsgSend(lpObj->m_Index, 1);
MySQL.UpdateResets( lpObj->m_Index );
sprintf_s(Msg,"Você resetou! Parabêns! Agora você possui %d Resets!",lpObj->Resets);
ChatTargetSendNogs(lpNpc,Msg,lpObj->m_Index);
gObjCloseSet( lpObj->m_Index , 1 );
}
else
{ ChatTargetSendNogs(lpNpc,"Você não possui dinheiro suficiente!",lpObj->m_Index); }
}
else
{
sprintf_s(Msg,"Você precisa estar no level %d para Resetar!",this->ResetLevel[lpObj->Vip][lpObj->ResetType]);
ChatTargetSendNogs(lpNpc,Msg,lpObj->m_Index); }
}
else
{ ChatTargetSendNogs(lpNpc,"Eu estou desativado no momento!",lpObj->m_Index); }
}
Reset.h
Código:
#ifndef _RESET_GUARD
#define _RESET_GUARD
#pragma once
#define MAX_VIPS 3
#define TIPOS 8
#define ChatTargetSendNogs ((void(*)(OBJECTSTRUCT*,char* Text,DWORD PlayerID)) 0x00438F00)
class ResetGuard
{
private:
public:
ResetGuard(void);
~ResetGuard(void);
int ResetLevel[MAX_VIPS][TIPOS];
int ResetPoint[MAX_VIPS][TIPOS];
// Reset Definitions
int ResetActive;
int ResetDelay;
int ResetPrice;
// Back Points
int ResetBackSTR;
int ResetBackAGI;
int ResetBackVIT;
int ResetBackENE;
int ResetBackCMD;
void ResetTalk(OBJECTSTRUCT * lpObj,OBJECTSTRUCT * lpNpc);
void ResetConfigs();
};
extern ResetGuard rGuard;
#endif
no NpcTalk ^^
Código:
case 464:
rGuard.ResetTalk ( lpNpc, lpObj );
break;
Codigo 100% testado e funcionando
Duvidas só mandar MP, se gostou agradeça!
by Matheus Borba
eGamesTeam!