Преглед на файлове

- Fixed mobinfo displaying exp as signed ints rather than unsigned.
- 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.


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@7582 54d463be-8e91-2dee-dedb-b68131a5f0ec

skotlex преди 19 години
родител
ревизия
104eeac167
променени са 5 файла, в които са добавени 59 реда и са изтрити 2 реда
  1. 6 0
      Changelog-Trunk.txt
  2. 1 1
      src/map/atcommand.c
  3. 50 0
      src/map/status.c
  4. 1 0
      src/map/status.h
  5. 1 1
      src/map/unit.c

+ 6 - 0
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]

+ 1 - 1
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,

+ 50 - 0
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)

+ 1 - 0
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);

+ 1 - 1
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;