Browse Source

- simplified the code for @autoloot
- made @hominfo display the six basic stats.
- Simplified the MD_DETECTOR checks, since now all insects/demons have it set, and it's no longer needed to check for the race.


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

skotlex 18 năm trước cách đây
mục cha
commit
9bd4913d7e
4 tập tin đã thay đổi với 43 bổ sung90 xóa
  1. 3 0
      Changelog-Trunk.txt
  2. 24 56
      src/map/atcommand.c
  3. 1 1
      src/map/skill.c
  4. 15 33
      src/map/status.c

+ 3 - 0
Changelog-Trunk.txt

@@ -4,6 +4,9 @@ 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/12/11
+	* made @hominfo display the six basic stats. [Skotlex]
+	* Simplified the MD_DETECTOR checks, since now all insects/demons have it
+	  set, and it's no longer needed to check for the race. [Skotlex]
 	* Updated sql files [Playtester]
 	* Spirit of Sin and Enchant Deadly Poison now stack. [Skotlex]
 	* Fixed skill damage card bonuses not working on magic skills. [Skotlex]

+ 24 - 56
src/map/atcommand.c

@@ -8115,69 +8115,31 @@ atcommand_partyoption(
  */
 int atcommand_autoloot(const int fd, struct map_session_data* sd, const char* command, const char* message)
 {
-	// autoloot command with value
 	int rate;
-
+	double drate;
 	nullpo_retr(-1, sd);
-
 	// autoloot command without value
 	if(!message || !*message)
 	{
-		// autoloot on -> off
-		if(sd->state.autoloot)
-		{
-			clif_displaymessage(fd, "Autoloot is now off.");
-			sd->state.autoloot = 0;
-			return 0;
-		// autoloot off -> on
-		} else {
-			clif_displaymessage(fd, "Autoloot is now on.");
-			sd->state.autoloot = 10000;
-			return 0;
-		}
-	}
-
-	// get maximum droprate limit
-	rate = (int)(atof(message) * 100.);
-
-	// check for invalid value
-	if(rate > 10000)
-	{
-		clif_displaymessage(fd, "Invalid value. Choose value between 0 and 100.");
-		return 0;
-	}
-
-	// autoloot value is 0, turn autoloot off
-	if(rate == 0)
-	{
-		if(sd->state.autoloot == 0)
-			clif_displaymessage(fd, "Autoloot is already off.");
-		else {
-			clif_displaymessage(fd, "Autoloot is now off.");
-			sd->state.autoloot = 0;
-		}
-		return 0;
-	}
-
-	// autoloot value is 100, turn autoloot on
-	if(rate == 10000)
-	{
-		if(sd->state.autoloot == 10000)
-			clif_displaymessage(fd, "Autoloot is already on.");
-		else {
-			clif_displaymessage(fd, "Autoloot is now on.");
-			sd->state.autoloot = 10000;
-		}
-		return 0;
+		if (sd->state.autoloot)
+			rate = 0;
+		else
+			rate = 10000;
+	} else {
+		drate = atof(message);
+		rate = (int)(drate*100);
 	}
-
-	// autoloot value is between 0 and 100
-	snprintf(atcmd_output, sizeof atcmd_output, "Autolooting items with drop rates of %0.02f%% and below.", rate/100.);
-	clif_displaymessage(fd, atcmd_output);
+	if (rate < 0) rate = 0;
+	if (rate > 10000) rate = 10000;
+	
 	sd->state.autoloot = rate;
-
-	return 0;
-}
+	if (sd->state.autoloot) { 
+		snprintf(atcmd_output, sizeof atcmd_output, "Autolooting items with drop rates of %0.02f%% and below.",((double)sd->state.autoloot)/100.);
+		clif_displaymessage(fd, atcmd_output);
+	}else 
+		clif_displaymessage(fd, "Autoloot is now off.");
+	return 0;  
+}   
 
 
 /*==========================================
@@ -9969,6 +9931,12 @@ int atcommand_hominfo(
 		hd->homunculus.hunger, hd->homunculus.intimacy/100);
 	clif_displaymessage(fd, atcmd_output);
 
+	snprintf(atcmd_output, sizeof(atcmd_output) ,
+		"Stats: Str %d / Agi %d / Vit %d / Int %d / Dex %d / Luk %d",
+		status->str, status->agi, status->vit,
+		status->int_, status->dex, status->luk);
+	clif_displaymessage(fd, atcmd_output);
+
 	return 0;
 }
 

+ 1 - 1
src/map/skill.c

@@ -5691,7 +5691,6 @@ int skill_castend_id (int tid, unsigned int tick, int id, int data)
 				if (md->db->skill[md->skillidx].emotion >= 0)
 					clif_emotion(src, md->db->skill[md->skillidx].emotion);
 			}
-
 		}
 
 		if(src != target && battle_config.skill_add_range &&
@@ -6286,6 +6285,7 @@ int skill_castend_pos2 (struct block_list *src, int x, int y, int skillid, int s
 
 	if (sd && !(flag&1) && sd->state.arrow_atk) //Consume arrow if a ground skill was not invoked. [Skotlex]
 		battle_consume_ammo(sd, skillid, skilllv);
+		
 	return 0;
 }
 

+ 15 - 33
src/map/status.c

@@ -1087,12 +1087,8 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, int
 			struct map_session_data *sd = (TBL_PC*) target;
 			if (pc_isinvisible(sd))
 				return 0;
-			if (tsc->option&hide_flag && !(status->mode&MD_BOSS)
-				&& (sd->special_state.perfect_hiding || !(
-					status->race == RC_INSECT ||
-				  	status->race == RC_DEMON ||
-				  	status->mode&MD_DETECTOR
-				)))
+			if (tsc->option&hide_flag && !(status->mode&MD_BOSS) &&
+				(sd->special_state.perfect_hiding || !(status->mode&MD_DETECTOR)))
 				return 0;
 		}
 		break;
@@ -1110,15 +1106,9 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, int
 			return 0;
 	default:
 		//Check for chase-walk/hiding/cloaking opponents.
-		if (tsc && !(status->mode&MD_BOSS))
-		{
-			if (tsc->option&hide_flag && !(
-				status->race == RC_INSECT ||
-			  	status->race == RC_DEMON ||
-			  	status->mode&MD_DETECTOR
-			))
-				return 0;
-		}
+		if (tsc && tsc->option&hide_flag && !(status->mode&MD_BOSS) && 
+			!(status->mode&MD_DETECTOR))
+			return 0;
 	}
 	return 1;
 }
@@ -1144,32 +1134,24 @@ int status_check_visibility(struct block_list *src, struct block_list *target)
 		return 0;
 	
 	switch (target->type)
-	{
+	{	//Check for chase-walk/hiding/cloaking opponents.
 	case BL_PC:
 		{
-			if (tsc->option&(OPTION_HIDE|OPTION_CLOAK|OPTION_CHASEWALK)
-				&& !(status->mode&MD_BOSS) && (
-					((TBL_PC*)target)->special_state.perfect_hiding || !(
-					status->race == RC_INSECT ||
-				  	status->race == RC_DEMON ||
-				  	status->mode&MD_DETECTOR
-				)))
+			if(tsc->option&(OPTION_HIDE|OPTION_CLOAK|OPTION_CHASEWALK) &&
+				!(status->mode&MD_BOSS) &&
+				(
+				 	((TBL_PC*)target)->special_state.perfect_hiding ||
+				  	!(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
-				))
+		if (tsc && tsc->option&(OPTION_HIDE|OPTION_CLOAK|OPTION_CHASEWALK) &&
+			!(status->mode&MD_BOSS) && !(status->mode&MD_DETECTOR))
 				return 0;
-		}
 	}
+
 	return 1;
 }