summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog-Trunk.txt2
-rw-r--r--src/char_sql/int_quest.c2
-rw-r--r--src/map/chrif.c3
-rw-r--r--src/map/intif.c9
-rw-r--r--src/map/pc.h1
-rw-r--r--src/map/quest.c5
-rw-r--r--src/map/skill.c18
7 files changed, 29 insertions, 11 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index fe0e94c80..dac59c2d8 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -3,6 +3,8 @@ Date Added
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
+09/10/27
+ * Fixed quest will never get erased when it's the only quest you have. [Inkfish]
09/10/26
* Implemented NPC_VAMPIREGIFT and NPC_WIDESOULDRAIN. [Inkfish]
09/10/25
diff --git a/src/char_sql/int_quest.c b/src/char_sql/int_quest.c
index 16c74fd47..5d84e0b8e 100644
--- a/src/char_sql/int_quest.c
+++ b/src/char_sql/int_quest.c
@@ -112,7 +112,7 @@ int mapif_parse_quest_save(int fd)
memset(qd1, 0, sizeof(qd1));
memset(qd2, 0, sizeof(qd2));
- memcpy(&qd1, RFIFOP(fd,8), RFIFOW(fd,2)-8);
+ if( num1 ) memcpy(&qd1, RFIFOP(fd,8), RFIFOW(fd,2)-8);
num2 = mapif_quests_fromsql(char_id, qd2);
for( i = 0; i < num1; i++ )
diff --git a/src/map/chrif.c b/src/map/chrif.c
index 0ab4aec51..9b0f7f875 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -282,14 +282,13 @@ int chrif_save(struct map_session_data *sd, int flag)
memcpy(WFIFOP(char_fd,13), &sd->status, sizeof(sd->status));
WFIFOSET(char_fd, WFIFOW(char_fd,2));
-
if( sd->status.pet_id > 0 && sd->pd )
intif_save_petdata(sd->status.account_id,&sd->pd->pet);
if( sd->hd && merc_is_hom_active(sd->hd) )
merc_save(sd->hd);
if( sd->md && mercenary_get_lifetime(sd->md) > 0 )
mercenary_save(sd->md);
- if( sd->num_quests )
+ if( sd->save_quest )
intif_quest_save(sd);
return 0;
diff --git a/src/map/intif.c b/src/map/intif.c
index 9643338fa..a663a226e 100644
--- a/src/map/intif.c
+++ b/src/map/intif.c
@@ -1377,8 +1377,12 @@ int intif_parse_questlog(int fd)
int intif_parse_questsave(int fd)
{
+ TBL_PC *sd = map_id2sd(RFIFOL(fd, 2));
+
if( !RFIFOB(fd, 6) )
- ShowError("intif_parse_questsave: Failed to save quest(s) for character %d!\n", RFIFOL(fd, 2));
+ ShowError("intif_parse_questsave: Failed to save quest(s) for character %d!\n", sd->status.char_id);
+ else if( sd )
+ sd->save_quest = false;
return 0;
}
@@ -1396,7 +1400,8 @@ int intif_quest_save(TBL_PC *sd)
WFIFOW(inter_fd,0) = 0x3061;
WFIFOW(inter_fd,2) = len;
WFIFOL(inter_fd,4) = sd->status.char_id;
- memcpy(WFIFOP(inter_fd,8), &sd->quest_log, sizeof(struct quest)*sd->num_quests);
+ if( sd->num_quests )
+ memcpy(WFIFOP(inter_fd,8), &sd->quest_log, sizeof(struct quest)*sd->num_quests);
WFIFOSET(inter_fd, len);
return 0;
diff --git a/src/map/pc.h b/src/map/pc.h
index 6569b86c7..02fab8882 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -391,6 +391,7 @@ struct map_session_data {
int avail_quests;
int quest_index[MAX_QUEST_DB];
struct quest quest_log[MAX_QUEST_DB];
+ bool save_quest;
// temporary debug [flaviojs]
const char* debug_file;
diff --git a/src/map/quest.c b/src/map/quest.c
index f73beb902..6e6bdb76c 100644
--- a/src/map/quest.c
+++ b/src/map/quest.c
@@ -92,6 +92,7 @@ int quest_add(TBL_PC * sd, int quest_id)
sd->quest_index[i] = j;
sd->num_quests++;
sd->avail_quests++;
+ sd->save_quest = true;
clif_quest_add(sd, &sd->quest_log[i], sd->quest_index[i]);
@@ -138,6 +139,7 @@ int quest_change(TBL_PC * sd, int qid1, int qid2)
sd->quest_log[i].state = Q_ACTIVE;
sd->quest_index[i] = j;
+ sd->save_quest = true;
clif_quest_delete(sd, qid1);
clif_quest_add(sd, &sd->quest_log[i], sd->quest_index[i]);
@@ -169,6 +171,7 @@ int quest_delete(TBL_PC * sd, int quest_id)
}
memset(&sd->quest_log[sd->num_quests], 0, sizeof(struct quest));
sd->quest_index[sd->num_quests] = 0;
+ sd->save_quest = true;
clif_quest_delete(sd, quest_id);
@@ -213,6 +216,7 @@ void quest_update_objective(TBL_PC * sd, int mob)
if( quest_db[sd->quest_index[i]].mob[j] == mob && sd->quest_log[i].count[j] < quest_db[sd->quest_index[i]].count[j] )
{
sd->quest_log[i].count[j]++;
+ sd->save_quest = true;
clif_quest_update_objective(sd,&sd->quest_log[i],sd->quest_index[i]);
}
}
@@ -231,6 +235,7 @@ int quest_update_status(TBL_PC * sd, int quest_id, quest_state status)
}
sd->quest_log[i].state = status;
+ sd->save_quest = true;
if( status < Q_COMPLETE )
{
diff --git a/src/map/skill.c b/src/map/skill.c
index a36168191..6b19d23d6 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -5670,14 +5670,20 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
case NPC_WIDESTUN:
case NPC_SLOWCAST:
case NPC_WIDEHELLDIGNITY:
- case NPC_WIDESOULDRAIN:
if (flag&1)
- {
- if( skillid == NPC_WIDESOULDRAIN )
- status_percent_damage(src,bl,0,((skilllv-1)%5+1)*20,false);
- else
- sc_start(bl,type,100,skilllv,skill_get_time2(skillid,skilllv));
+ sc_start(bl,type,100,skilllv,skill_get_time2(skillid,skilllv));
+ else {
+ skill_area_temp[2] = 0; //For SD_PREAMBLE
+ clif_skill_nodamage(src,bl,skillid,skilllv,1);
+ map_foreachinrange(skill_area_sub, bl,
+ skill_get_splash(skillid, skilllv),BL_CHAR,
+ src,skillid,skilllv,tick, flag|BCT_ENEMY|SD_PREAMBLE|1,
+ skill_castend_nodamage_id);
}
+ break;
+ case NPC_WIDESOULDRAIN:
+ if (flag&1)
+ status_percent_damage(src,bl,0,((skilllv-1)%5+1)*20,false);
else {
skill_area_temp[2] = 0; //For SD_PREAMBLE
clif_skill_nodamage(src,bl,skillid,skilllv,1);