@
[Somente membros podem ver os links. ], tem como vc mim dar uma pequena ajuda, estou tentando adicionar um NPC Reset, porém eu encontrei essa sourcer aqui e gostaria de saber se da para fazer ela funciona de forma diferente na MuEmu.
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 á 50 Resets
this->ResetLevel[0][0] = 400; // FREE
this->ResetPoint[0][0] = 300;
this->ResetLevel[1][0] = 350; // VIP Normal
this->ResetPoint[1][0] = 400;
this->ResetLevel[2][0] = 300; // VIP Platinum
this->ResetPoint[2][0] = 500;
// 51 á 100 Resets
this->ResetLevel[0][1] = 400;
this->ResetPoint[0][1] = 200;
this->ResetLevel[1][1] = 350;
this->ResetPoint[1][1] = 350;
this->ResetLevel[2][1] = 300;
this->ResetPoint[2][1] = 450;
// 101 á 200 Resets
this->ResetLevel[0][2] = 400;
this->ResetPoint[0][2] = 200;
this->ResetLevel[1][2] = 350;
this->ResetPoint[1][2] = 300;
this->ResetLevel[2][2] = 300;
this->ResetPoint[2][2] = 400;
// 201 á 300 Resets
this->ResetLevel[0][3] = 400;
this->ResetPoint[0][3] = 150;
this->ResetLevel[1][3] = 350;
this->ResetPoint[1][3] = 250;
this->ResetLevel[2][3] = 300;
this->ResetPoint[2][3] = 350;
// 500 adiante
this->ResetLevel[0][4] = 400;
this->ResetPoint[0][4] = 200;
this->ResetLevel[1][4] = 390;
this->ResetPoint[1][4] = 300;
this->ResetLevel[2][4] = 370;
this->ResetPoint[2][4] = 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 4
#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
NPCTalk.txt
Código:
case 464: rGuard.ResetTalk ( lpNpc, lpObj );
break;
Se vc notar essa soucer de NPC Reset, ela que faz o sistema Dinâmico, porém no servidor da muemu já existe um local onde vc pode diferenciar o reset pontuativo e tabelado que no caso é Data/Util/ResetTable.txt.
Gostaria de uma explicação melhor para não só eu como muitos poder adicionar esse custom ao servidor.