More questlog code.
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@12556 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
1c7cf5aa3e
commit
9bcdb353a4
@ -4,6 +4,7 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO
|
||||
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
|
||||
|
||||
2008/04/10
|
||||
* More quest log code. [Kevin]
|
||||
* Client not marked online until map receives auth request from the client
|
||||
- and is approved. Also added some online/offline sets to the auth system
|
||||
- that were being skipped.(r12552) [Kevin]
|
||||
|
@ -17,14 +17,14 @@ MAP_OBJ = map.o chrif.o clif.o pc.o status.o npc.o \
|
||||
npc_chat.o chat.o path.o itemdb.o mob.o script.o \
|
||||
storage.o skill.o atcommand.o charcommand.o battle.o \
|
||||
intif.o trade.o party.o vending.o guild.o pet.o \
|
||||
log.o mail.o date.o irc.o unit.o mercenary.o
|
||||
log.o mail.o date.o irc.o unit.o mercenary.o quest.o
|
||||
MAP_TXT_OBJ = $(MAP_OBJ:%=obj_txt/%)
|
||||
MAP_SQL_OBJ = $(MAP_OBJ:%=obj_sql/%)
|
||||
MAP_H = map.h chrif.h clif.h pc.h status.h npc.h \
|
||||
chat.h itemdb.h mob.h script.h path.h \
|
||||
storage.h skill.h atcommand.h charcommand.h battle.h \
|
||||
intif.h trade.h party.h vending.h guild.h pet.h \
|
||||
log.h mail.h date.h irc.h unit.h mercenary.h
|
||||
log.h mail.h date.h irc.h unit.h mercenary.h quest.h
|
||||
|
||||
HAVE_MYSQL=@HAVE_MYSQL@
|
||||
ifeq ($(HAVE_MYSQL),yes)
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "status.h"
|
||||
#include "mercenary.h"
|
||||
#include "chrif.h"
|
||||
#include "quest.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "irc.h"
|
||||
#include "clif.h"
|
||||
#include "mail.h"
|
||||
#include "quest.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -7968,8 +7969,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
|
||||
mail_clear(sd);
|
||||
#endif
|
||||
|
||||
//Send quest log [Kevin]
|
||||
clif_send_questlog(sd);
|
||||
quest_pc_login(sd);
|
||||
|
||||
if(map[sd->bl.m].flag.loadevent) // Lance
|
||||
npc_script_event(sd, NPCE_LOADMAP);
|
||||
|
@ -396,6 +396,11 @@ void clif_equipcheckbox(struct map_session_data* sd);
|
||||
|
||||
//quest system [Kevin]
|
||||
void clif_send_questlog(struct map_session_data * sd);
|
||||
void clif_send_questlog_info(struct map_session_data * sd);
|
||||
void clif_send_quest_info(struct map_session_data * sd, struct quest * qd);
|
||||
void clif_send_quest_delete(struct map_session_data * sd, int quest_id);
|
||||
void clif_send_quest_status(struct map_session_data * sd, int quest_id, bool active);
|
||||
|
||||
|
||||
int clif_foreachclient(int (*)(struct map_session_data*,va_list),...);
|
||||
int clif_send(const uint8* buf, int len, struct block_list* bl, enum send_target type);
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "status.h" // struct status_data
|
||||
#include "vending.h" // vending_closevending()
|
||||
#include "pc.h"
|
||||
#include "quest.h"
|
||||
|
||||
#ifndef TXT_ONLY // mail system [Valaris]
|
||||
#include "mail.h"
|
||||
@ -372,6 +373,8 @@ int pc_makesavestatus(struct map_session_data *sd)
|
||||
else
|
||||
memcpy(&sd->status.last_point,&sd->status.save_point,sizeof(sd->status.last_point));
|
||||
}
|
||||
|
||||
quest_make_savedata(sd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -863,6 +866,9 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim
|
||||
clif_wis_message(sd->fd, wisp_server_name, tmpstr, strlen(tmpstr)+1);
|
||||
}
|
||||
|
||||
//Get quest data out of char dat
|
||||
quest_load_info(sd, st);
|
||||
|
||||
// Request all registries (auth is considered completed whence they arrive)
|
||||
intif_request_registry(sd,7);
|
||||
return true;
|
||||
|
137
src/map/quest.c
Normal file
137
src/map/quest.c
Normal file
@ -0,0 +1,137 @@
|
||||
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
|
||||
// For more information, see LICENCE in the main folder
|
||||
|
||||
#include "../common/cbasetypes.h"
|
||||
#include "../common/socket.h"
|
||||
#include "../common/timer.h"
|
||||
#include "../common/malloc.h"
|
||||
#include "../common/version.h"
|
||||
#include "../common/nullpo.h"
|
||||
#include "../common/showmsg.h"
|
||||
#include "../common/strlib.h"
|
||||
#include "../common/utils.h"
|
||||
|
||||
#include "map.h"
|
||||
#include "chrif.h"
|
||||
#include "pc.h"
|
||||
#include "npc.h"
|
||||
#include "itemdb.h"
|
||||
#include "script.h"
|
||||
#include "intif.h"
|
||||
#include "battle.h"
|
||||
#include "mob.h"
|
||||
#include "party.h"
|
||||
#include "unit.h"
|
||||
#include "log.h"
|
||||
#include "clif.h"
|
||||
#include "quest.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
|
||||
//Send quest info on login
|
||||
int quest_pc_login(TBL_PC * sd)
|
||||
{
|
||||
clif_send_questlog(sd);
|
||||
clif_send_questlog_info(sd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct quest * quest_make(int id, time_t time, int num_objs, struct quest_objective ** qo_arr)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int quest_add(TBL_PC * sd, struct quest * qd)
|
||||
{
|
||||
|
||||
int i;
|
||||
|
||||
//Search to see if this quest exists
|
||||
ARR_FIND(0, MAX_QUEST, i, sd->quest_log[i].quest_id == qd->quest_id);
|
||||
|
||||
//Already have this quest
|
||||
if(i!=MAX_QUEST)
|
||||
return 1;
|
||||
|
||||
//Find empty quest log spot
|
||||
ARR_FIND(0, MAX_QUEST, i, sd->quest_log[i].quest_id == 0);
|
||||
|
||||
//Quest log is full
|
||||
if(i == MAX_QUEST)
|
||||
return -1;
|
||||
|
||||
//Copy over quest data
|
||||
memcpy(&sd->quest_log[i], qd, sizeof(struct quest));
|
||||
sd->num_quests++;
|
||||
|
||||
//Notify client
|
||||
clif_send_quest_info(sd, &sd->quest_log[i]);
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
int quest_delete(TBL_PC * sd, int quest_id)
|
||||
{
|
||||
|
||||
int i;
|
||||
|
||||
//Search for quest
|
||||
ARR_FIND(0, MAX_QUEST, i, sd->quest_log[i].quest_id == quest_id);
|
||||
|
||||
//Quest not found
|
||||
if(i != MAX_QUEST)
|
||||
return -1;
|
||||
|
||||
//Zero quest
|
||||
memset(&sd->quest_log[i], 0, sizeof(struct quest));
|
||||
|
||||
//Notify client
|
||||
clif_send_quest_delete(sd, quest_id);
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
int quest_update_objective(TBL_PC * sd, int quest_id, int objective_num, struct quest_objective qod)
|
||||
{
|
||||
|
||||
int i;
|
||||
|
||||
//Search for quest
|
||||
ARR_FIND(0, MAX_QUEST, i, sd->quest_log[i].quest_id == quest_id);
|
||||
|
||||
//Quest not found
|
||||
if(i != MAX_QUEST)
|
||||
return -1;
|
||||
|
||||
memcpy(sd->quest_log[i].objectives[objective_num].name, qod.name, NAME_LENGTH);
|
||||
sd->quest_log[i].objectives[objective_num].count = qod.count;
|
||||
|
||||
//Notify client
|
||||
clif_send_quest_info(sd, &sd->quest_log[i]);
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
int quest_load_info(TBL_PC * sd, struct mmo_charstatus * st)
|
||||
{
|
||||
sd->num_quests = st->num_quests;
|
||||
memcpy(sd->quest_log, st->quest_log, sizeof(st->quest_log));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int quest_make_savedata(TBL_PC * sd)
|
||||
{
|
||||
sd->status.num_quests = sd->num_quests;
|
||||
memcpy(sd->status.quest_log, sd->quest_log, sizeof(sd->quest_log));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
11
src/map/quest.h
Normal file
11
src/map/quest.h
Normal file
@ -0,0 +1,11 @@
|
||||
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
|
||||
// For more information, see LICENCE in the main folder
|
||||
|
||||
#ifndef _QUEST_H_
|
||||
#define _QUEST_H_
|
||||
|
||||
int quest_pc_login(TBL_PC * sd);
|
||||
int quest_load_info(TBL_PC * sd, struct mmo_charstatus * st);
|
||||
int quest_make_savedata(TBL_PC * sd);
|
||||
|
||||
#endif
|
@ -425,6 +425,14 @@ SOURCE=..\src\map\vending.c
|
||||
|
||||
SOURCE=..\src\map\vending.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\src\map\quest.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\src\map\quest.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "zlib"
|
||||
|
||||
|
@ -421,6 +421,14 @@ SOURCE=..\src\map\unit.h
|
||||
|
||||
SOURCE=..\src\map\vending.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\src\map\quest.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\src\map\quest.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "zlib"
|
||||
|
||||
|
@ -322,6 +322,12 @@
|
||||
<File
|
||||
RelativePath="..\src\map\vending.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\map\quest.c">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\map\quest.h">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="common"
|
||||
|
@ -322,6 +322,12 @@
|
||||
<File
|
||||
RelativePath="..\src\map\vending.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\map\quest.c">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\map\quest.h">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="common"
|
||||
|
@ -590,6 +590,14 @@
|
||||
RelativePath="..\src\map\vending.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\map\quest.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\map\quest.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
|
@ -437,6 +437,14 @@
|
||||
RelativePath="..\src\map\vending.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\map\quest.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\map\quest.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="zlib"
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9,00"
|
||||
Version="9.00"
|
||||
Name="map-server_sql"
|
||||
ProjectGUID="{D356871D-58E1-450B-967A-E6E9646175AF}"
|
||||
RootNamespace="map-server_sql"
|
||||
@ -530,6 +530,14 @@
|
||||
RelativePath="..\src\map\pet.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\map\quest.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\map\quest.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\map\script.c"
|
||||
>
|
||||
|
@ -433,6 +433,14 @@
|
||||
RelativePath="..\src\map\vending.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\map\quest.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\map\quest.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="zlib"
|
||||
|
Loading…
x
Reference in New Issue
Block a user