diff options
-rw-r--r-- | Changelog-Trunk.txt | 6 | ||||
-rw-r--r-- | src/map/atcommand.c | 2 | ||||
-rw-r--r-- | src/map/status.c | 50 | ||||
-rw-r--r-- | src/map/status.h | 1 | ||||
-rw-r--r-- | src/map/unit.c | 2 |
5 files changed, 59 insertions, 2 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 13ced21f6..df89efec4 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -4,6 +4,12 @@ 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.
2006/07/08
+ * Fixed mobinfo displaying exp as signed ints rather than unsigned.
+ [Skotlex]
+ * Added status_check_visibility to check if an object is within range of
+ view of another. Nothing more, nothing less. It's used by unit movement to
+ check whether you can continue chasing your target or not when the "chase
+ target" directive is given. [Skotlex]
* Fixed the char table having party/guild_id as smallint when they need int
there. Thanks to hermematon for pointing it out (use svn_ugprade7580.sql)
[Skotlex]
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 2e1eab8ae..3d8f260b9 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -9365,7 +9365,7 @@ int atcommand_mobinfo( else
sprintf(atcmd_output, "Monster: '%s'/'%s'/'%s' (%d)", mob->name, mob->jname, mob->sprite, mob->vd.class_);
clif_displaymessage(fd, atcmd_output);
- sprintf(atcmd_output, " Level:%d HP:%d SP:%d Base EXP:%d Job EXP:%d", mob->lv, mob->status.max_hp, mob->status.max_sp, mob->base_exp, mob->job_exp);
+ sprintf(atcmd_output, " Level:%d HP:%d SP:%d Base EXP:%u Job EXP:%u", mob->lv, mob->status.max_hp, mob->status.max_sp, mob->base_exp, mob->job_exp);
clif_displaymessage(fd, atcmd_output);
sprintf(atcmd_output, " DEF:%d MDEF:%d STR:%d AGI:%d VIT:%d INT:%d DEX:%d LUK:%d",
mob->status.def, mob->status.mdef, mob->status.str, mob->status.agi,
diff --git a/src/map/status.c b/src/map/status.c index 4b8a9f9f2..1cc6f5f49 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -1027,6 +1027,56 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, int return 1; } +//Checks whether the source can see and chase target. +int status_check_visibility(struct block_list *src, struct block_list *target) +{ + int view_range; + struct status_data* status = status_get_status_data(src); + struct status_change* tsc = status_get_sc(target); + switch (src->type) { + case BL_MOB: + view_range = ((TBL_MOB*)src)->min_chase; + break; + case BL_PET: + view_range = ((TBL_PET*)src)->db->range2; + break; + default: + view_range = AREA_SIZE; + } + + if (src->m != target->m || !check_distance_bl(src, target, view_range)) + return 0; + + switch (target->type) + { + case BL_PC: + { + if (tsc->option&(OPTION_HIDE|OPTION_CLOAK|OPTION_CHASEWALK) + && !(status->mode&MD_BOSS) && ( + ((TBL_PC*)target)->state.perfect_hiding || !( + status->race == RC_INSECT || + status->race == RC_DEMON || + status->mode&MD_DETECTOR + ))) + return 0; + } + break; + default: + //Check for chase-walk/hiding/cloaking opponents. + if (tsc && !(status->mode&MD_BOSS)) + { + if (tsc->option&(OPTION_HIDE|OPTION_CLOAK|OPTION_CHASEWALK) + && !( + status->race == RC_INSECT || + status->race == RC_DEMON || + status->mode&MD_DETECTOR + )) + return 0; + } + } + return 1; +} + void status_calc_bl(struct block_list *bl, unsigned long flag); static int status_base_atk(struct block_list *bl, struct status_data *status) diff --git a/src/map/status.h b/src/map/status.h index 877c9c4ad..526444ab7 100644 --- a/src/map/status.h +++ b/src/map/status.h @@ -617,6 +617,7 @@ void status_calc_misc(struct status_data *status, int level); void status_freecast_switch(struct map_session_data *sd);
int status_getrefinebonus(int lv,int type);
int status_check_skilluse(struct block_list *src, struct block_list *target, int skill_num, int flag); // [Skotlex]
+int status_check_visibility(struct block_list *src, struct block_list *target); //[Skotlex]
int status_readdb(void);
int do_init_status(void);
diff --git a/src/map/unit.c b/src/map/unit.c index 0b7bb663d..5586db0b2 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -226,7 +226,7 @@ static int unit_walktoxy_timer(int tid,unsigned int tick,int id,int data) } else if (ud->target) { //Update target trajectory. struct block_list *tbl = map_id2bl(ud->target); - if (!tbl) { //Cancel chase. + if (!tbl || !status_check_visibility(bl, tbl)) { //Cancel chase. ud->to_x = bl->x; ud->to_y = bl->y; return 0; |