summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog-Trunk.txt1
-rw-r--r--src/map/Makefile.in4
-rw-r--r--src/map/chrif.c1
-rw-r--r--src/map/clif.c4
-rw-r--r--src/map/clif.h5
-rw-r--r--src/map/pc.c6
-rw-r--r--src/map/quest.c137
-rw-r--r--src/map/quest.h11
-rw-r--r--vcproj-6/map-server_sql.dsp8
-rw-r--r--vcproj-6/map-server_txt.dsp8
-rw-r--r--vcproj-7.1/map-server_sql.vcproj6
-rw-r--r--vcproj-7.1/map-server_txt.vcproj6
-rw-r--r--vcproj-8/map-server_sql.vcproj8
-rw-r--r--vcproj-8/map-server_txt.vcproj8
-rw-r--r--vcproj-9/map-server_sql.vcproj10
-rw-r--r--vcproj-9/map-server_txt.vcproj8
16 files changed, 226 insertions, 5 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 8293b92a6..e8fb335cd 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -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]
diff --git a/src/map/Makefile.in b/src/map/Makefile.in
index 7799b43ce..c92318060 100644
--- a/src/map/Makefile.in
+++ b/src/map/Makefile.in
@@ -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)
diff --git a/src/map/chrif.c b/src/map/chrif.c
index 78b8c1733..cc75359ef 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -20,6 +20,7 @@
#include "status.h"
#include "mercenary.h"
#include "chrif.h"
+#include "quest.h"
#include <stdio.h>
#include <stdlib.h>
diff --git a/src/map/clif.c b/src/map/clif.c
index 21d246cfa..01417b2dd 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -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);
diff --git a/src/map/clif.h b/src/map/clif.h
index 684ee0fc0..832829a04 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -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);
diff --git a/src/map/pc.c b/src/map/pc.c
index 3d7572326..32f102b6e 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -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;
diff --git a/src/map/quest.c b/src/map/quest.c
new file mode 100644
index 000000000..499d78d6c
--- /dev/null
+++ b/src/map/quest.c
@@ -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;
+}
+
diff --git a/src/map/quest.h b/src/map/quest.h
new file mode 100644
index 000000000..efcfbc2d0
--- /dev/null
+++ b/src/map/quest.h
@@ -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
diff --git a/vcproj-6/map-server_sql.dsp b/vcproj-6/map-server_sql.dsp
index a80ded6f1..cfcf61a39 100644
--- a/vcproj-6/map-server_sql.dsp
+++ b/vcproj-6/map-server_sql.dsp
@@ -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"
diff --git a/vcproj-6/map-server_txt.dsp b/vcproj-6/map-server_txt.dsp
index 2f56c5a62..4f2e4409e 100644
--- a/vcproj-6/map-server_txt.dsp
+++ b/vcproj-6/map-server_txt.dsp
@@ -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"
diff --git a/vcproj-7.1/map-server_sql.vcproj b/vcproj-7.1/map-server_sql.vcproj
index c80671cff..91e1906b4 100644
--- a/vcproj-7.1/map-server_sql.vcproj
+++ b/vcproj-7.1/map-server_sql.vcproj
@@ -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"
diff --git a/vcproj-7.1/map-server_txt.vcproj b/vcproj-7.1/map-server_txt.vcproj
index e88722e62..e389684da 100644
--- a/vcproj-7.1/map-server_txt.vcproj
+++ b/vcproj-7.1/map-server_txt.vcproj
@@ -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"
diff --git a/vcproj-8/map-server_sql.vcproj b/vcproj-8/map-server_sql.vcproj
index e752872d8..d6cbf3f2d 100644
--- a/vcproj-8/map-server_sql.vcproj
+++ b/vcproj-8/map-server_sql.vcproj
@@ -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>
diff --git a/vcproj-8/map-server_txt.vcproj b/vcproj-8/map-server_txt.vcproj
index f0a6f17a1..db7453962 100644
--- a/vcproj-8/map-server_txt.vcproj
+++ b/vcproj-8/map-server_txt.vcproj
@@ -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"
diff --git a/vcproj-9/map-server_sql.vcproj b/vcproj-9/map-server_sql.vcproj
index d752dda68..15e1527b6 100644
--- a/vcproj-9/map-server_sql.vcproj
+++ b/vcproj-9/map-server_sql.vcproj
@@ -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"
@@ -531,6 +531,14 @@
>
</File>
<File
+ RelativePath="..\src\map\quest.c"
+ >
+ </File>
+ <File
+ RelativePath="..\src\map\quest.h"
+ >
+ </File>
+ <File
RelativePath="..\src\map\script.c"
>
</File>
diff --git a/vcproj-9/map-server_txt.vcproj b/vcproj-9/map-server_txt.vcproj
index e80547c57..61a985d5f 100644
--- a/vcproj-9/map-server_txt.vcproj
+++ b/vcproj-9/map-server_txt.vcproj
@@ -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"