PDA

View Full Version : |Source| Comando /makeset (MuEmu)



louis
10/09/2017, 10:02 PM
Comando para criar um set completo.

Uso:
(Type | Level | Skill | Luck | Option | Exe)
/makeset 1 15 0 1 7 63 = SET DRAGON FULL


void CCommandManager::CommandMakeSet(LPOBJ lpObj,char* arg) // OK
{
if(gServerInfo.m_CommandMakeSwitch == 0)
{
return;
}

if(gGameMaster.CheckGameMasterLevel(lpObj,gServerI nfo.m_CommandMakeGameMasterLevel) == 0)
{
gNotice.GCNoticeSend(lpObj->Index,1,0,0,0,0,0,gMessage.GetMessage(106));
return;
}

int type = this->GetNumber(arg,0);
int level = this->GetNumber(arg,1);
int skill = this->GetNumber(arg,2);
int luck = this->GetNumber(arg,3);
int option = this->GetNumber(arg,4);
int exc = this->GetNumber(arg,5);
int set = this->GetNumber(arg,6);

GDCreateItemSend(lpObj->Index,0xEB,0,0,GET_ITEM(7,type),level,0,skill,luck ,option,-1,exc,set,0,0,0,0xFF,0);
GDCreateItemSend(lpObj->Index,0xEB,0,0,GET_ITEM(8,type),level,0,skill,luck ,option,-1,exc,set,0,0,0,0xFF,0);
GDCreateItemSend(lpObj->Index,0xEB,0,0,GET_ITEM(9,type),level,0,skill,luck ,option,-1,exc,set,0,0,0,0xFF,0);
GDCreateItemSend(lpObj->Index,0xEB,0,0,GET_ITEM(10,type),level,0,skill,luc k,option,-1,exc,set,0,0,0,0xFF,0);
GDCreateItemSend(lpObj->Index,0xEB,0,0,GET_ITEM(11,type),level,0,skill,luc k,option,-1,exc,set,0,0,0,0xFF,0);

gNotice.GCNoticeSend(lpObj->Index,1,0,0,0,0,0,gMessage.GetMessage(107));

gLog.Output(LOG_COMMAND,"[CommandMakeSet][%s][%s] - (Type: %d, Level: %d, Skill: %d, Luck: %d, Option: %d, Exc: %d, Set: %d)",lpObj->Account,lpObj->Name,type,level,skill,luck,option,exc,set);

}

Créditos:
Louis

andredeco
10/09/2017, 11:42 PM
@louis ([Only registered and activated users can see links])

Se não for pedir muito, eu queria te pedir que se tiver um tempinho sobrando qualquer hora, dar um exemplo de como incluir este comando, por exemplo, na Source. Algo bem resumido, tipo qual parte da Source e onde se inclui o código para o funcionamento. Aprendi algumas coisas fuçando, seria de imensa ajuda esta pequena orientação. Infelizmente não há tutorial algum.

Vlw.

s00x
11/09/2017, 12:15 AM
@louis ([Only registered and activated users can see links])

Se não for pedir muito, eu queria te pedir que se tiver um tempinho sobrando qualquer hora, dar um exemplo de como incluir este comando, por exemplo, na Source. Algo bem resumido, tipo qual parte da Source e onde se inclui o código para o funcionamento. Aprendi algumas coisas fuçando, seria de imensa ajuda esta pequena orientação. Infelizmente não há tutorial algum.

Vlw.

Não sou o louis, mas creio que posso ajudar.
No arquivo CommandManager.cpp e CommandManager.h é que são feito as modificações.

Dessa o scroll até o final da página do CommandManager.cpp e adicione o código do tópico, e no seu arquivo CommandManager.h, inclua o cabeçalho da função:

void CommandMakeSet(LPOBJ lpObj,char* arg);

Feito o informado acima, o Comando esta incluso no seu Servidor, agora é só configurar.
Abra seu arquivo Message.txt do lado do Servidor, e procure pelas linhas 106 e 107, caso não exista, adicione o seguinte:


106 "Você não tem permissão para utilizar o /makeset"
107 "Item criado com Sucesso!"


Lembrando que esse comando é uma variação do /MAKE que já existe no servidor, então ele já utiliza as strings e a verificação do mesmo.
A diferença é que ele já cria o Elmo, Armadura, Luva, Calça e Botas de uma vez só, bastando apenas informar o ID do Item de acordo com o Item.txt

Eu recomendo mudar as linhas do Message.txt para uma nova linha que ainda não exista, porque desse modo o comando só irá funcionar para editar Sets.

Mentor
11/09/2017, 12:29 AM
Excelente explicação s00x thumbup

andredeco
11/09/2017, 12:43 AM
[Only registered and activated users can see links]
No arquivo CommandManager.cpp e CommandManager.h é que são feito as modificações.

Dessa o scroll até o final da página CommandManager.cpp e adicione o código do tópico, e no seu arquivo CommandManager.h, inclua o cabeçalho da função:


Feito o informado acima, o Comando esta incluso no seu código fonte, agora é só configurar.
Abra seu arquivo Message.txt do lado do Servidor, e procure pelas linhas 106 e 107, caso não exista, adicione o seguinte:


Lembrando que esse comando é uma variação do /MAKE que já existe no servidor, então ele já utiliza as strings e a verificação do mesmo.
A diferença é que ele já cria o Elmo, Armadura, Luva, Calça e Botas de uma vez só, bastando apenas informar o ID do Item de acordo com o Item.txt

Eu recomendo mudar as linhas do Message.txt para uma nova linha que ainda não exista, porque desse modo o comando só irá funcionar para editar Sets.

Simplesmente perfeita a sua explicação. Resumida e funcional. Consegui acertar tudo na primeira tentativa.
Muito obrigado mesmo.

ThaylorMello
11/09/2017, 10:31 AM
Muito bom, estou iniciando nessa area , e queria saber se o Sr louis poderia postar mais umas sourcer pra nos ^^

antoniodel
11/09/2017, 12:24 PM
@louis ([Only registered and activated users can see 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


#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


#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


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.

louis
11/09/2017, 12:54 PM
@louis ([Only registered and activated users can see 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


#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


#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


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.

Você pode usar para ter base, mais não funciona no Muemu, você deve se basear na função: void CCommandManager::CommandReset(LPOBJ lpObj,char* arg)

antoniodel
11/09/2017, 08:03 PM
Obrigado louis, eu consegui fazer.

Consegui terminar o NPC Reset. :D


[Only registered and activated users can see links]


[Only registered and activated users can see links]


[Only registered and activated users can see links]

louis
11/09/2017, 10:40 PM
Obrigado louis, eu consegui fazer.

Consegui terminar o NPC Reset. :D


[Only registered and activated users can see links]


[Only registered and activated users can see links]


[Only registered and activated users can see links]

Boaaaaaa 02 kkk

felipecoder
11/10/2017, 08:17 PM
tava procurando essa sourcer vlw emo <3