From fe84618e4c80ee808cf7beed0e2a5d3e57bc8975 Mon Sep 17 00:00:00 2001 From: Inkfish Date: Sun, 13 Sep 2009 08:31:19 +0000 Subject: * Progressbar aborts when player is attacked. * Do not stand if damage is from yourself or has no source.(bugreport:3582) * Any mobs killed by party members within view range are taken into account in questlog. * 'unit_walktobl' now uses at least 1 as the range since 'unit_can_reach_bl' always sets the target coordinates 1 cell away from the target block. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14057 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/clif.h | 1 + src/map/mob.c | 8 +++++--- src/map/pc.c | 18 ++++++++++-------- src/map/pet.c | 2 +- src/map/quest.c | 22 ++++++++++++++++++++++ src/map/quest.h | 1 + 6 files changed, 40 insertions(+), 12 deletions(-) (limited to 'src/map') diff --git a/src/map/clif.h b/src/map/clif.h index 5a3df7ffb..6ee0c4d51 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -485,5 +485,6 @@ void clif_party_show_picker(struct map_session_data * sd, struct item * item_dat // Progress Bar [Inkfish] void clif_progressbar(struct map_session_data * sd, unsigned long color, unsigned int second); +void clif_progressbar_abort(struct map_session_data * sd); #endif /* _CLIF_H_ */ diff --git a/src/map/mob.c b/src/map/mob.c index 37fa65ea4..f0741a2cf 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -1274,7 +1274,7 @@ int mob_warpchase(struct mob_data *md, struct block_list *target) map_foreachinrange (mob_warpchase_sub, &md->bl, md->db->range2, BL_NPC, md, target, &warp, &distance); - if (warp && unit_walktobl(&md->bl, &warp->bl, 0, 1)) + if (warp && unit_walktobl(&md->bl, &warp->bl, 1, 1)) return 1; return 0; } @@ -1456,7 +1456,7 @@ static bool mob_ai_sub_hard(struct mob_data *md, unsigned int tick) if (!can_move) //Stuck. Wait before walking. return true; md->state.skillstate = MSS_LOOT; - if (!unit_walktobl(&md->bl, tbl, 0, 1)) + if (!unit_walktobl(&md->bl, tbl, 1, 1)) mob_unlocktarget(md, tick); //Can't loot... return true; } @@ -1993,7 +1993,9 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) } pc_setglobalreg(sd,"TK_MISSION_COUNT", sd->mission_count); } - //Move to status.c, and send a delete quest packet and then an add quest packet can refresh the kill counts. Just a trick. :P[Inkfish] + if( sd->status.party_id ) + map_foreachinrange(quest_update_objective_sub,&md->bl,AREA_SIZE,BL_PC,sd->status.party_id,md->class_); + else if( sd->avail_quests ) quest_update_objective(sd, md->class_); } diff --git a/src/map/pc.c b/src/map/pc.c index acd583ca1..d0a6d0124 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -5375,23 +5375,25 @@ static int pc_respawn_timer(int tid, unsigned int tick, int id, intptr data) void pc_damage(struct map_session_data *sd,struct block_list *src,unsigned int hp, unsigned int sp) { if (sp) clif_updatestatus(sd,SP_SP); - if (!hp) return; + if (hp) clif_updatestatus(sd,SP_HP); + else return; + + if( !src || src == &sd->bl ) + return; - if(pc_issit(sd)) { + if( pc_issit(sd) ) + { pc_setstand(sd); skill_sit(sd,0); } - clif_updatestatus(sd,SP_HP); + if( sd->progressbar.npc_id ) + clif_progressbar_abort(sd); - if(!src || src == &sd->bl) - return; - - if(sd->status.pet_id > 0 && sd->pd && battle_config.pet_damage_support) + if( sd->status.pet_id > 0 && sd->pd && battle_config.pet_damage_support ) pet_target_check(sd,src,1); sd->canlog_tick = gettick(); - return; } int pc_dead(struct map_session_data *sd,struct block_list *src) diff --git a/src/map/pet.c b/src/map/pet.c index f933836a1..816a98c0d 100644 --- a/src/map/pet.c +++ b/src/map/pet.c @@ -908,7 +908,7 @@ static int pet_ai_sub_hard(struct pet_data *pd, struct map_session_data *sd, uns } else { //Item Targeted, attempt loot if (!check_distance_bl(&pd->bl, target, 1)) { //Out of range - if(!unit_walktobl(&pd->bl, target, 0, 1)) //Unreachable target. + if(!unit_walktobl(&pd->bl, target, 1, 1)) //Unreachable target. pet_unlocktarget(pd); return 0; } else{ diff --git a/src/map/quest.c b/src/map/quest.c index 03a74214f..f73beb902 100644 --- a/src/map/quest.c +++ b/src/map/quest.c @@ -178,6 +178,28 @@ int quest_delete(TBL_PC * sd, int quest_id) return 0; } +int quest_update_objective_sub(struct block_list *bl, va_list ap) +{ + struct map_session_data * sd; + int mob, party; + + nullpo_retr(0, bl); + nullpo_retr(0, sd = (struct map_session_data *)bl); + + party = va_arg(ap,int); + mob = va_arg(ap,int); + + if( !sd->avail_quests ) + return 0; + if( sd->status.party_id != party ) + return 0; + + quest_update_objective(sd, mob); + + return 1; +} + + void quest_update_objective(TBL_PC * sd, int mob) { int i,j; diff --git a/src/map/quest.h b/src/map/quest.h index 505d2047b..94ae57eb5 100644 --- a/src/map/quest.h +++ b/src/map/quest.h @@ -21,6 +21,7 @@ int quest_pc_login(TBL_PC * sd); int quest_add(TBL_PC * sd, int quest_id); int quest_delete(TBL_PC * sd, int quest_id); int quest_change(TBL_PC * sd, int qid1, int qid2); +int quest_update_objective_sub(struct block_list *bl, va_list ap); void quest_update_objective(TBL_PC * sd, int mob); int quest_update_status(TBL_PC * sd, int quest_id, quest_state status); int quest_check(TBL_PC * sd, int quest_id, quest_check_type type); -- cgit v1.2.3-60-g2f50