Solo usuarios registrados pueden comentar y agradecer, Logueate o Registrate

Autor Topic: Codigo de ExQuest (Sistema Quest)  (Visto 1794 veces)

0 Miembros and 1 Guest are viewing this topic.

Offline linkzero on: March 30, 2017, 07:25:43 PM

  • 0 puntos por ventas
  • *
  • Rank: Puto amo
  • Posts: 274
  • Gracias recibida: 1772
  • ar
Bueno de la mano de los mismos Exteam les traigo una fuente que a alguno le puede servir,segun dice compatible con la mayoria de los server.

Cambios en la base de datos que deben ejecutar

Code: [Select]
alter table [Character] add [ExQuest_num] int not null default(0)
alter table [Character] add [ExQuest_kill] int not null default(0)
alter table [Character] add [ExQuest_start] int not null default(0)
alter table [Character] add [Ex_FreePoints] int not null default(0)
alter table [MEMB_INFO] add [CashPoint] int not null default(0))

user.h

Code: [Select]
struct Ex_User
{
//FreePoints
int Ex_FreePoints;
//Quest System
int ExQuest_num;
int ExQuest_kill;
int ExQuest_start;
//Time
int ExTimeTick;
//Reset
int Resets;
int GResets;
//Vip System
int VipStatus;
int VipTimeTick;
int VipTimeEnd;
};
extern Ex_User ExUser[OBJECT_MAX];

Quest_PGW.h

Code: [Select]
class Q_PGW
{
public:
void Q_Load();
void Q_Num();
void Q_CreateStruct(int aIndex);
void Q_NPC (int aIndex,int aNPC);
void KilledMob(int aIndex);
bool Presents(int aIndex,int Present,int Gifts);
bool IsBadFileLine(char *FileLine, int &Flag);
struct
{
int Mob;
int Coun;
int proc;
int rew;
int gift;
char msg[100];
char msg2[100];
} Number[1000];
int Count;
}; extern Q_PGW Qest_PGW;

Quest_PGW.cpp

Code: [Select]

#include "Quest_PGW.h"
#include "StdAfx.h"
#include "Experience.h"
#include "USER.h"
#include "Message.h"
#include "Defines.h"
#include "AddFunctions.h"
#include "ExCore.h"
#include "Logs.h"

Q_PGW Qest_PGW;


int EnableExQuest = GetPrivateProfileInt("Common","Enable",0,"..\\Settings\\ExQuest.ini");

bool Q_PGW::IsBadFileLine(char *FileLine, int &Flag)
{
if(Flag == 0)
{
if(isdigit(FileLine[0]))
{
Flag = FileLine[0] - 48;
return true;
}
}
else if(Flag < 0 || Flag > 9)
{
Flag = 0;
}

if(!strncmp(FileLine, "end", 3))
{
Flag = 0;
return true;
}

if(FileLine[0] == '/' || FileLine[0] == '\n')
return true;

for(UINT i = 0; i < strlen(FileLine); i++)
{
if(isalnum(FileLine[i]))
return false;
}
return true;
}
//====================================================
void Q_PGW::Q_Num()
{
for(int i(0);i<1000;i++)
{
Number[i].Mob = 0;
Number[i].Coun = 0;
Number[i].proc = 0;
Number[i].rew = 0;
Number[i].gift = 0;
Number[i].msg[0] = NULL;
Number[i].msg2[0] = NULL;
}
}
void Q_PGW::Q_Load()
{
if(!EnableExQuest)
return;
Q_Num();
FILE *file;
file = fopen("..\\Settings\\ExQuest.ini","r");
if(file == NULL)
{
MessageBoxA(0,"Settings\\ExQuest.ini Load Error","CRITICAL ERROR",0);
ExitProcess(1);
return;
}
char Buff[256];
int Flag = 0;
Count = 0;
while(!feof(file)) // Проверяем есть ли строка в документе
{
fgets(Buff,256,file);//Функция читает текущую строку
if(IsBadFileLine(Buff, Flag)) //Вспомогательная функция
continue;
if(Flag == 1)
{
int n[10];
char mes[100];
char mes2[100];
//gets(mes);
sscanf(Buff,"%d %d %d %d %d \"%[^\"]\" \"%[^\"]\"",&n[0],&n[1],&n[2],&n[3],&n[4],&mes,&mes2);
Number[Count].Mob = n[0];
Number[Count].Coun = n[1];
Number[Count].proc = n[2];
Number[Count].rew = n[3];
Number[Count].gift = n[4];
sprintf(Number[Count].msg,"%s",mes);
sprintf(Number[Count].msg2,"%s",mes2);
Count++;
}
}
fclose(file);
}
void Q_PGW::Q_CreateStruct(int aIndex)
{
if(!EnableExQuest)
return;
OBJECTSTRUCT * gObj = (OBJECTSTRUCT*)OBJECT_POINTER(aIndex); // int Q_PGW_num;
/* Путь великого воина #end */// int Ex_FreePoints;
/* Путь великого воина #kill */// int Q_PGW_kill;
/* Путь великого воина #start */// int Q_PGW_start;
if(!MySQL.Execute("SELECT ExQuest_num FROM Character WHERE Name='%s'",gObj->Name))
{
ErrorConnectDataBase(aIndex);
CriticalExError(aIndex);
return;
}
ExUser[aIndex].ExQuest_num = MySQL.GetInt();
//-------------------------------------------------------------------------
//if(!MySQL.Execute("SELECT ExQuest_kill FROM Character WHERE Name='%s'",gObj->Name))
//{
// ErrorConnectDataBase(aIndex);
// CriticalExError(aIndex);
// return;
//}
//ExUser[aIndex].ExQuest_kill = MySQL.GetInt();
ExUser[aIndex].ExQuest_kill = 0;
//-------------------------------------------------------------------------
if(!MySQL.Execute("SELECT ExQuest_start FROM Character WHERE Name='%s'",gObj->Name))
{
ErrorConnectDataBase(aIndex);
CriticalExError(aIndex);
return;
}
ExUser[aIndex].ExQuest_start = MySQL.GetInt();
//-------------------------------------------------------------------------
if(!MySQL.Execute("SELECT Ex_FreePoints FROM Character WHERE Name='%s'",gObj->Name))
{
ErrorConnectDataBase(aIndex);
CriticalExError(aIndex);
return;
}
ExUser[aIndex].Ex_FreePoints = MySQL.GetInt();
//-------------------------------------------------------------------------
Log.ExQuestLog("[Q_CreateStruct][%s]ExQuest_num: %d,ExQuest_kill: %d,ExQuest_start: %d,Ex_FreePoints: %d",gObj->Name,
ExUser[aIndex].ExQuest_num,ExUser[aIndex].ExQuest_kill,ExUser[aIndex].ExQuest_st
art,ExUser[aIndex].Ex_FreePoints);
}
void Q_PGW::Q_NPC (int aIndex,int aNPC)
{
if(!EnableExQuest)
return;
int ExQNPC = GetPrivateProfileInt("Common","NPC",0,"..\\Settings\\ExQuest.ini");
int ExQNPCM = GetPrivateProfileInt("Common","NPC_Map",0,"..\\Settings\\ExQuest.ini");
int ExQNPCX = GetPrivateProfileInt("Common","NPC_X",0,"..\\Settings\\ExQuest.ini");
int ExQNPCY = GetPrivateProfileInt("Common","NPC_Y",0,"..\\Settings\\ExQuest.ini");
OBJECTSTRUCT * gObj = (OBJECTSTRUCT*)OBJECT_POINTER(aIndex);
OBJECTSTRUCT *gObjNPC = (OBJECTSTRUCT*) OBJECT_POINTER (aNPC);
//371 120 141
if ((gObjNPC->Class == ExQNPC) && (gObjNPC->MapNumber == ExQNPCM) && (gObjNPC->X == ExQNPCX) && (gObjNPC->Y == ExQNPCY))
{
//MySQL.Execute("SELECT ExQuest_num FROM Character WHERE Name='%s'",gObj->Name);
//int ExQuest_num = MySQL.GetInt();
//Проверяем не закончен ли квест
if(ExUser[aIndex].ExQuest_num < Count)
{
//MySQL.Execute("SELECT ExQuest_start FROM Character WHERE Name='%s'",gObj->Name);
//int ExQuest_start = MySQL.GetInt();
//MySQL.Execute("SELECT ExQuest_kill FROM Character WHERE Name='%s'",gObj->Name);
//int ExQuest_kill = MySQL.GetInt();
//Проверяем начат ли уже квест
if(ExUser[aIndex].ExQuest_start == 0)
{
Log.ExQuestLog("[Q_NPC][%s] Взял задание № %d ",gObj->Name,ExUser[aIndex].ExQuest_num+1);
ChatTargetSendNogs(gObjNPC,"Удачной охоты!",aIndex);
ExUser[aIndex].ExQuest_start = 1;
MySQL.Execute("UPDATE Character SET ExQuest_start = 1 WHERE Name='%s'",gObj->Name);
MessageChat(aIndex,"@[ExQuest] Задание №%d",ExUser[aIndex].ExQuest_num+1);
MessageChat(aIndex,"@[ExQuest] %s",Number[ExUser[aIndex].ExQuest_num].msg);
MessageChat(aIndex,"@[ExQuest] %s [%d/%d]",Number[ExUser[aIndex].ExQuest_num].msg2,ExUser[aIndex].ExQuest_kill,Number
[ExUser[aIndex].ExQuest_num].Coun);
}
//Если квест уже взят
else if (ExUser[aIndex].ExQuest_start == 1)
{
Log.ExQuestLog("[Q_NPC][%s] Если квест уже взят № %d ",gObj->Name,ExUser[aIndex].ExQuest_num+1);
//Если квест выполнен
if(ExUser[aIndex].ExQuest_kill == Number[ExUser[aIndex].ExQuest_num].Coun)
{
int ExQuest_gift = Presents(aIndex,Number[ExUser[aIndex].ExQuest_num].rew,Number[ExUser[aIndex].ExQ
uest_num].gift); //Функция вознаграждения
if(ExQuest_gift == false)
{
ChatTargetSendNogs(gObjNPC,"Освободите место и вернитесь за подарком!",aIndex);
return;
}
ExUser[aIndex].ExQuest_start = 0;
ExUser[aIndex].ExQuest_num++;
ExUser[aIndex].ExQuest_kill = 0;
ChatTargetSendNogs(gObjNPC,"Поздравляю вы выполнили задание!",aIndex);
MySQL.Execute("UPDATE Character SET ExQuest_start = 0 WHERE Name='%s'",gObj->Name);
MySQL.Execute("UPDATE Character SET ExQuest_num = ExQuest_num + 1 WHERE Name='%s'",gObj->Name);
//MySQL.Execute("UPDATE Character SET ExQuest_kill = 0 WHERE Name='%s'",gObj->Name);
if(ExUser[aIndex].ExQuest_num == Count)
MessageChat(aIndex,"@[ExQuest] Finish");
}
//Если квест не выполнен
else
{
ChatTargetSendNogs(gObjNPC,"Ваше задание не закончено!",aIndex);
MessageChat(aIndex,"@[ExQuest] %s",Number[ExUser[aIndex].ExQuest_num].msg);
MessageChat(aIndex,"@[ExQuest] %s [%d/%d]",Number[ExUser[aIndex].ExQuest_num].msg2,ExUser[aIndex].ExQuest_kill,Number
[ExUser[aIndex].ExQuest_num].Coun);
}
}
}
else
{
Log.ExQuestLog("[Q_NPC][%s] Вы выполнили все задания!",gObj->Name);
ChatTargetSendNogs(gObjNPC,"Вы выполнили все задания!",aIndex);
MessageChat(aIndex,"@[ExQuest] Finish");
}
}
}
void Q_PGW::KilledMob(int aIndex)
{
if(!EnableExQuest)
return;
OBJECTSTRUCT * gObj = (OBJECTSTRUCT*)OBJECT_POINTER(aIndex);
int iRate = rand()%100+1;
//MySQL.Execute("SELECT ExQuest_num FROM Character WHERE Name='%s'",gObj->Name);
//int ExQuest_num = MySQL.GetInt();
if(Number[ExUser[aIndex].ExQuest_num].proc >= iRate)
{
//MySQL.Execute("SELECT ExQuest_kill FROM Character WHERE Name='%s'",gObj->Name);
//int ExQuest_kill = MySQL.GetInt();
if(ExUser[aIndex].ExQuest_kill < Number[ExUser[aIndex].ExQuest_num].Coun)
{
Log.ExQuestLog("[KilledMob][%s] Убил Квестового моба!",gObj->Name);
ExUser[aIndex].ExQuest_kill++;
//MySQL.Execute("UPDATE Character SET ExQuest_kill = ExQuest_kill + 1 WHERE Name='%s'",gObj->Name);
MessageChat(aIndex,"@[ExQuest] %s [%d/%d]",Number[ExUser[aIndex].ExQuest_num].msg2,ExUser[aIndex].ExQuest_kill,Number
[ExUser[aIndex].ExQuest_num].Coun);
if(ExUser[aIndex].ExQuest_kill == Number[ExUser[aIndex].ExQuest_num].Coun)
MessageChat(aIndex,"@[ExQuest] Задание выполнено!");
}
}
}
bool Q_PGW::Presents(int aIndex, int Present, int Gifts)
{
OBJECTSTRUCT * gObj = (OBJECTSTRUCT*)OBJECT_POINTER(aIndex);
//1- Зен, 2 - Gem, 3 - FreePoints, 4 - Items
Log.ExQuestLog("[Presents][%s] Получил приз: № %d в размере: %d!",gObj->Name,Present,Gifts);
if(Present == 1)
{
if((gObj->Money + Gifts) <= 2000000000)
{
gObj->Money += Gifts;
MessageChat(aIndex,"@[ExQuest] Вознаграждение Zen: %d",Gifts);
GCMoneySend(gObj->m_Index, gObj->Money);
}
else
{
MessageChat(aIndex,"@[ExQuest] Не достаточно места под зен");
return false;
}
}
else if(Present == 2)
{
MySQL.Execute("UPDATE MEMB_INFO SET CashPoint = CashPoint + %d WHERE memb___id='%s'",Gifts,gObj->AccountID);
MessageChat(aIndex,"@[ExQuest] Вознаграждение Gem: %d",Gifts);
}
else if(Present == 3)
{
ExUser[aIndex].Ex_FreePoints += Gifts;
gObj->LevelUpPoint += Gifts;
MySQL.Execute("UPDATE Character SET Ex_FreePoints = Ex_FreePoints + %d WHERE Name='%s'",Gifts,gObj->Name);
MessageChat(aIndex,"@[ExQuest] Вознаграждение Points: %d",Gifts);
LevelUpEffect (aIndex,1);
}
else if(Present == 4)
{
ItemSerialCreateSend(aIndex,gObj->MapNumber,gObj->X,gObj->Y,Gifts,0,0,0,0,0,aIndex,0,0);
MessageChat(aIndex,"@[ExQuest] Вознаграждение Items");
}
Firepatcher(aIndex, gObj->X, gObj->Y);
return true;
}

ExQuest.ini


« Ultima edicion: March 31, 2017, 12:48:54 AM by linkzero »

Offline virgen #1 on: March 31, 2017, 12:17:13 AM

  • 0 puntos por ventas
  • *
  • Rank: Dedicado
  • Posts: 55
  • Gracias recibida: 1322
  • ar
esto se agrga a los sources del GS??? o e suna dll???

Offline linkzero #2 on: March 31, 2017, 12:18:35 AM

  • 0 puntos por ventas
  • *
  • Rank: Puto amo
  • Posts: 274
  • Gracias recibida: 1772
  • ar
esto se agrga a los sources del GS??? o e suna dll???

Ambas opciones son validas ... segun la fuente de donde fue sacado funciona en casi cualquier version de mu...yo la voy a probar en un s6 :D

Offline virgen #3 on: March 31, 2017, 12:26:35 AM

  • 0 puntos por ventas
  • *
  • Rank: Dedicado
  • Posts: 55
  • Gracias recibida: 1322
  • ar
esto se agrga a los sources del GS??? o e suna dll???

Ambas opciones son validas ... segun la fuente de donde fue sacado funciona en casi cualquier version de mu...yo la voy a probar en un s6 :D

ok. entonces espero aver que pasa.

Offline linkzero #4 on: March 31, 2017, 12:49:19 AM

  • 0 puntos por ventas
  • *
  • Rank: Puto amo
  • Posts: 274
  • Gracias recibida: 1772
  • ar
esto se agrga a los sources del GS??? o e suna dll???

Ambas opciones son validas ... segun la fuente de donde fue sacado funciona en casi cualquier version de mu...yo la voy a probar en un s6 :D

ok. entonces espero aver que pasa.

Proba nuevamente el codigo estaba mal en algunos lugares corregido..

Offline as65d4as56 #5 on: June 12, 2017, 04:54:57 PM

  • 0 puntos por ventas
  • *
  • Rank: Principiante
  • Posts: 1
  • Gracias recibida: 0
  • ao

Offline splound #6 on: July 14, 2017, 04:20:20 PM

  • C++ Coder
  • 0 puntos por ventas
  • *
  • Rank: Experto
  • Posts: 150
  • Gracias recibida: 520
  • ve
no sirve para muemu


si sirve, solamente tienes que adaptar el codigo.

Offline waltervg91 #7 on: July 23, 2017, 12:26:02 AM

  • 0 puntos por ventas
  • *
  • Rank: Principiante
  • Posts: 14
  • Gracias recibida: 3
  • py
Disculpen mi ignorancia.. como serian las Exquest? osea como funcionan?

Offline melo920 #8 on: July 23, 2017, 08:28:47 AM

  • C++ Coder
  • 0 puntos por ventas
  • *
  • Rank: Destacado
  • Posts: 85
  • Gracias recibida: 1417
  • co
@waltervg91 no es tan difícil solo revisa el archivo ExQuest.ini y veras que te pide un npc (casi siempre se colocas la Elfa de Buff) lo demás es mapa y coordenadas de dicho npc. mas abajo tienes los monster que vas a matar y las recompensas. en si hay esta todo

Offline ZETA #9 on: September 30, 2017, 08:06:09 AM

  • 0 puntos por ventas
  • *
  • Rank: Principiante
  • Posts: 1
  • Gracias recibida: 0
  • uy
Quisiera pedir disculpas de antemano, pero como haría para poner esto en mi servidor? Soy nuevo y me encantaría saber.. Desde ya muchas gracias

Offline ZidSliver #10 on: November 02, 2017, 08:55:22 PM

  • 3D Maker
  • 0 puntos por ventas
  • *
  • Rank: Liga mayor
  • Posts: 186
  • Gracias recibida: 889
  • pe
Buenas @linkzero  esto es funcional en MuEmuS6?

Offline linkzero #11 on: November 03, 2017, 08:04:02 AM

  • 0 puntos por ventas
  • *
  • Rank: Puto amo
  • Posts: 274
  • Gracias recibida: 1772
  • ar
Buenas @linkzero  esto es funcional en MuEmuS6?

No lo probe realmente .. @ZidSliver lo use en un s2 clasico y funciono ..

Offline diemorko #12 on: November 29, 2017, 06:43:18 AM

  • 0 puntos por ventas
  • *
  • Rank: Principiante
  • Posts: 9
  • Gracias recibida: 0
  • pl
Alguien tiene un código para muemu s6?

Solo usuarios registrados pueden comentar y agradecer, Logueate o Registrate

 

Related Topics

  Subject / Started by Replies Last post
2 Replies
857 Views
Last post October 19, 2016, 01:50:10 AM
by KrizR
1 Replies
340 Views
Last post April 08, 2017, 08:08:19 PM
by FBarbosa
2 Replies
385 Views
Last post April 14, 2017, 05:59:19 PM
by ZabiinoOo
4 Replies
547 Views
Last post April 23, 2017, 04:19:05 PM
by Blend
1 Replies
375 Views
Last post September 28, 2017, 10:21:46 AM
by repiolaa