Kết quả 41 đến 42 của 42
-
18-10-15, 10:45 AM #41
Ðề: Custom Quest For zTeam Season 6 Ep 3
This is very similar to the source ExQuest...
Query
CODE
PHP Code: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
PHP Code: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
PHP Code: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;
CODE
PHP Code:#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
CODE
PHP Code:[Common]
Enable = 1
NPC = 371
NPC_Map = 0
NPC_X = 120
NPC_Y = 142
// 1 Приз - Зен
// 2 Приз - Гем
// 3 Приз - Поинта что не горят после ресета
// 4 Приз - Вещь
//[Номер моба][Количество мобов][Процент][Приз][Количество][Сообщение 1][Сообщение 2]
1
3 5 50 1 10 "Kill the Spider in Lorencia" "Spider:"
3 5 50 2 10 "Kill the Spider in Lorencia" "Spider:"
3 5 50 3 10 "Kill the Spider in Lorencia" "Spider:"
3 5 50 4 6159 "Kill the Spider in Lorencia" "Spider:"
3 5 50 1 10 "Kill the Spider in Lorencia" "Spider:"
3 5 50 2 10 "Kill the Spider in Lorencia" "Spider:"
3 5 50 3 10 "Kill the Spider in Lorencia" "Spider:"
3 5 50 4 6159 "Kill the Spider in Lorencia" "Spider:"
end
Khách viếng thăm hãy cùng MaxVoll xây dựng diễn đàn CLBGAMESVN vững mạnh nhé!
-
The Following 4 Users Say Thank You to MaxVoll For This Useful Post:
bambu (11-11-15), hoanmaster (19-10-15), PhamNinh (23-10-15), qcgameprivate (23-10-15)
-
23-10-15, 12:58 PM #42
- Ngày tham gia
- Dec 2012
- Bài viết
- 1,162
- Thanks
- 254
- Thanked 356 Times in 251 Posts
Ðề: Custom Quest For zTeam Season 6 Ep 3
.Khách viếng thăm hãy cùng PhamNinh xây dựng diễn đàn CLBGAMESVN vững mạnh nhé!
Các Chủ đề tương tự
-
[MU] Post Server For zTeam Season 6 Episode 3
Bởi BladeKnight109 trong diễn đàn DevelopmentTrả lời: 56Bài viết cuối: 28-07-15, 08:46 PM -
[MU] Zteam Mu Server Season 6 Ep 3
Bởi gauandy trong diễn đàn ReleasesTrả lời: 19Bài viết cuối: 27-07-15, 04:33 PM -
[MU] Cho mình xin hướng dẫn cài đặt server zteam season 6 ep3 share bên box Release
Bởi fnlove trong diễn đàn Hỏi Đáp/ Yêu CầuTrả lời: 9Bài viết cuối: 27-06-15, 02:17 PM -
[MU] zTeam Season 8 (Crack)
Bởi ikenylee trong diễn đàn ReleasesTrả lời: 421Bài viết cuối: 03-03-15, 10:19 PM -
[MU] ai cài giúp mình server zteam season 6 ep3 share bên box Release với
Bởi Lifetime2602 trong diễn đàn Hỏi Đáp/ Yêu CầuTrả lời: 3Bài viết cuối: 28-07-14, 10:56 AM