diff options
author | Kevin <Kevin@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-04-13 22:19:02 +0000 |
---|---|---|
committer | Kevin <Kevin@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-04-13 22:19:02 +0000 |
commit | e5242b4b3842fc94a60ad2f66284162948baefeb (patch) | |
tree | 8023e522ce29b67adb11c5db33dc0e71c27d04b1 /src/map/quest.c | |
parent | 40a44f83fc8c640412af6e4f227106eea9c17003 (diff) | |
download | hercules-e5242b4b3842fc94a60ad2f66284162948baefeb.tar.gz hercules-e5242b4b3842fc94a60ad2f66284162948baefeb.tar.bz2 hercules-e5242b4b3842fc94a60ad2f66284162948baefeb.tar.xz hercules-e5242b4b3842fc94a60ad2f66284162948baefeb.zip |
Major updates to the quest system.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12581 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/quest.c')
-rw-r--r-- | src/map/quest.c | 81 |
1 files changed, 74 insertions, 7 deletions
diff --git a/src/map/quest.c b/src/map/quest.c index 997ff2abd..25c879105 100644 --- a/src/map/quest.c +++ b/src/map/quest.c @@ -25,6 +25,7 @@ #include "log.h" #include "clif.h" #include "quest.h" +#include "intif.h" #include <stdio.h> #include <stdlib.h> @@ -67,13 +68,46 @@ int quest_add(TBL_PC * sd, struct quest * qd) memcpy(&sd->quest_log[i], qd, sizeof(struct quest)); sd->num_quests++; - //Notify client - clif_send_quest_info(sd, &sd->quest_log[i]); + //Notify inter server + intif_quest_add(sd->status.char_id, qd); return 0; } +int quest_add_ack(int char_id, int quest_id, int success) +{ + int i; + TBL_PC * sd = map_charid2sd(char_id); + + ///Player no longer on map + if(!sd) + return -1; + + //Search for quest + ARR_FIND(0, MAX_QUEST, i, sd->quest_log[i].quest_id == quest_id); + + //Quest not found, shouldn't happen? + if(i == MAX_QUEST) + return -1; + + if(success) + { + //Notify client + clif_send_quest_info(sd, &sd->quest_log[i]); + } + else + { + ShowError("Quest %d for character %d could not be added!\n", quest_id, char_id); + + //Zero quest + memset(&sd->quest_log[i], 0, sizeof(struct quest)); + sd->num_quests--; + } + + return 0; +} + int quest_delete(TBL_PC * sd, int quest_id) { @@ -83,14 +117,47 @@ int quest_delete(TBL_PC * sd, int quest_id) ARR_FIND(0, MAX_QUEST, i, sd->quest_log[i].quest_id == quest_id); //Quest not found - if(i != MAX_QUEST) + if(i == MAX_QUEST) return -1; - //Zero quest - memset(&sd->quest_log[i], 0, sizeof(struct quest)); + intif_quest_delete(sd->status.char_id, quest_id); - //Notify client - clif_send_quest_delete(sd, quest_id); + return 0; + +} + +int quest_delete_ack(int char_id, int quest_id, int success) +{ + + int i; + TBL_PC * sd = map_charid2sd(char_id); + + ///Player no longer on map + if(!sd) + return -1; + + //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; + + if(success) + { + + //Zero quest + memset(&sd->quest_log[i], 0, sizeof(struct quest)); + sd->num_quests--; + + //Notify client + clif_send_quest_delete(sd, quest_id); + + return 1; + + } + else + ShowError("Quest %d for character %d could not be deleted!\n", quest_id, char_id); return 0; |