浏览代码

- Fixed @item so it only displays message "Item created" on success.
- Changed @raisemap to also function as "@healmap".
- Changed txt_time() to omit days/hours/seconds if there are none.
- Also applied the 'min_chat_delay' to @main, @pettalk and @homtalk.
- Fixed a warning in skill.c (bugreport:6593)

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

brianluau 12 年之前
父节点
当前提交
f8a4c8b82f
共有 3 个文件被更改,包括 39 次插入14 次删除
  1. 33 13
      src/map/atcommand.c
  2. 5 0
      src/map/clif.c
  3. 1 1
      src/map/skill.c

+ 33 - 13
src/map/atcommand.c

@@ -1433,7 +1433,8 @@ ACMD_FUNC(item)
 		}
 	}
 
-	clif_displaymessage(fd, msg_txt(18)); // Item created.
+	if (flag == 0)
+		clif_displaymessage(fd, msg_txt(18)); // Item created.
 	return 0;
 }
 
@@ -1504,7 +1505,8 @@ ACMD_FUNC(item2)
 				clif_additem(sd, 0, 0, flag);
 		}
 
-		clif_displaymessage(fd, msg_txt(18)); // Item created.
+		if (flag == 0)
+			clif_displaymessage(fd, msg_txt(18)); // Item created.
 	} else {
 		clif_displaymessage(fd, msg_txt(19)); // Invalid item ID or name.
 		return -1;
@@ -3264,11 +3266,11 @@ ACMD_FUNC(doommap)
  *------------------------------------------*/
 static void atcommand_raise_sub(struct map_session_data* sd)
 {
-	if (!status_isdead(&sd->bl))
-		return;
-
-	if(!status_revive(&sd->bl, 100, 100))
-		return;
+	if(pc_isdead(sd))
+		status_revive(&sd->bl, 100, 100);
+	else
+		status_percent_heal(&sd->bl, 100, 100);
+	
 	clif_skill_nodamage(&sd->bl,&sd->bl,ALL_RESURRECTION,4,1);
 	clif_displaymessage(sd->fd, msg_txt(63)); // Mercy has been shown.
 }
@@ -4602,21 +4604,21 @@ char* txt_time(unsigned int duration)
 	minutes = duration / 60;
 	seconds = duration - (60 * minutes);
 
-	if (days < 2)
+	if (days == 1)
 		sprintf(temp, msg_txt(219), days); // %d day
-	else
+	else if (days > 1)
 		sprintf(temp, msg_txt(220), days); // %d days
-	if (hours < 2)
+	if (hours == 1)
 		sprintf(temp1, msg_txt(221), temp, hours); // %s %d hour
-	else
+	else if (hours > 1)
 		sprintf(temp1, msg_txt(222), temp, hours); // %s %d hours
 	if (minutes < 2)
 		sprintf(temp, msg_txt(223), temp1, minutes); // %s %d minute
 	else
 		sprintf(temp, msg_txt(224), temp1, minutes); // %s %d minutes
-	if (seconds < 2)
+	if (seconds == 1)
 		sprintf(temp1, msg_txt(225), temp, seconds); // %s and %d second
-	else
+	else if (seconds > 1)
 		sprintf(temp1, msg_txt(226), temp, seconds); // %s and %d seconds
 
 	return temp1;
@@ -6326,6 +6328,12 @@ ACMD_FUNC(pettalk)
 
 	nullpo_retr(-1, sd);
 
+	if ( battle_config.min_chat_delay ) {
+		if( DIFF_TICK(sd->cantalk_tick, gettick()) > 0 )
+			return 0;
+		sd->cantalk_tick = gettick() + battle_config.min_chat_delay;
+	}
+
 	if(!sd->status.pet_id || !(pd=sd->pd))
 	{
 		clif_displaymessage(fd, msg_txt(184));
@@ -7088,6 +7096,12 @@ ACMD_FUNC(homtalk)
 
 	nullpo_retr(-1, sd);
 
+	if ( battle_config.min_chat_delay ) {
+		if( DIFF_TICK(sd->cantalk_tick, gettick()) > 0 )
+			return 0;
+		sd->cantalk_tick = gettick() + battle_config.min_chat_delay;
+	}
+
 	if (sd->sc.count && //no "chatting" while muted.
 		(sd->sc.data[SC_BERSERK] ||
 		(sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT)))
@@ -8084,6 +8098,12 @@ ACMD_FUNC(main)
 				return -1;
 			}
 
+			if ( battle_config.min_chat_delay ) {
+				if( DIFF_TICK(sd->cantalk_tick, gettick()) > 0 )
+					return 0;
+				sd->cantalk_tick = gettick() + battle_config.min_chat_delay;
+			}
+
 			// send the message using inter-server system
 			intif_main_message( sd, message );
 		}

+ 5 - 0
src/map/clif.c

@@ -10002,6 +10002,11 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd)
 		if(!sd->state.mainchat)
 			clif_displaymessage(fd, msg_txt(388)); // You should enable main chat with "@main on" command.
 		else {
+			if ( battle_config.min_chat_delay ) {
+				if( DIFF_TICK(sd->cantalk_tick, gettick()) > 0 )
+					return;
+				sd->cantalk_tick = gettick() + battle_config.min_chat_delay;
+			}
 			// send the main message using inter-server system
 			intif_main_message( sd, message );
 		}

+ 1 - 1
src/map/skill.c

@@ -16390,7 +16390,7 @@ int skill_elementalanalysis(struct map_session_data* sd, int n, int skill_lv, un
 }
 
 int skill_changematerial(struct map_session_data *sd, int n, unsigned short *item_list) {
-	int i, j, k, c, p, nameid, amount;
+	int i, j, k, c, p = 0, nameid, amount;
 	
 	nullpo_ret(sd);
 	nullpo_ret(item_list);