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

- Fixed Absorb Spirit Spheres
- Added battle_config min_chat_delay (default 0) specifies in ms what is the min delay between player sent chats (whisper/global/party/guild). Messages that exceed this threshold are silently ignored for now (perhaps need to add a "DON'T SPAM" reply to the player?)


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

skotlex преди 19 години
родител
ревизия
7f776280a5
променени са 8 файла, в които са добавени 47 реда и са изтрити 11 реда
  1. 6 0
      Changelog-Trunk.txt
  2. 4 0
      conf-tmpl/battle/client.conf
  3. 2 0
      src/map/battle.c
  4. 1 0
      src/map/battle.h
  5. 28 0
      src/map/clif.c
  6. 1 0
      src/map/map.h
  7. 2 1
      src/map/pc.c
  8. 3 10
      src/map/skill.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/05/30
+	* Fixed Absorb Spirit Spheres [Skotlex]
+	* Added battle_config min_chat_delay (default 0, battle/client.conf)
+	  specifies in ms what is the min delay between player sent chats
+	  (whisper/global/party/guild). Messages that exceed this threshold are
+	  silently ignored for now (perhaps need to add a "DON'T SPAM" reply to the
+	  player?) [Skotlex]
 	* [Fixed]:
 	  - signed/usigned problem in sprintf and fscanf @ mercenary.c [Lance]
 	* Rewrote/cleaned up @petfriendly. [Skotlex]

+ 4 - 0
conf-tmpl/battle/client.conf

@@ -44,6 +44,10 @@
 // default value: 2047 (all clients)
 packet_ver_flag: 2047
 
+// Minimum delay between whisper/global/party/guild messages (in ms)
+// Messages that break this threshold are silently omitted. 
+min_chat_delay: 0
+
 // valid range of dye's and styles on the client
 min_hair_style: 0
 max_hair_style: 23

+ 2 - 0
src/map/battle.c

@@ -3562,6 +3562,7 @@ static const struct battle_data_short {
 	{ "sg_miracle_skill_ratio",				&battle_config.sg_miracle_skill_ratio },
 	{ "autospell_stacking", 				&battle_config.autospell_stacking },
 	{ "override_mob_names", 				&battle_config.override_mob_names },
+	{ "min_chat_delay",						&battle_config.min_chat_delay },
 };
 
 static const struct battle_data_int {
@@ -3980,6 +3981,7 @@ void battle_set_defaults() {
 	battle_config.sg_miracle_skill_duration=600000;
 	battle_config.autospell_stacking = 0;
 	battle_config.override_mob_names = 0;
+	battle_config.min_chat_delay = 0;
 }
 
 void battle_validate_conf() {

+ 1 - 0
src/map/battle.h

@@ -429,6 +429,7 @@ extern struct Battle_Config {
 	int sg_miracle_skill_duration;
 	unsigned short autospell_stacking; //Enables autospell cards to stack. [Skotlex]
 	unsigned short override_mob_names; //Enables overriding spawn mob names with the mob_db names. [Skotlex]
+	unsigned short min_chat_delay; //Minimum time between client messages. [Skotlex]
 
 } battle_config;
 

+ 28 - 0
src/map/clif.c

@@ -8623,6 +8623,13 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data *sd) { // S 008c <
 		(sd->sc.data[SC_BERSERK].timer != -1 || sd->sc.data[SC_NOCHAT].timer != -1 ))
 		return;
 
+	if (battle_config.min_chat_delay)
+	{	//[Skotlex]
+		if (DIFF_TICK(sd->cantalk_tick, gettick()) > 0)
+			return;
+		sd->cantalk_tick = gettick() + battle_config.min_chat_delay;
+	}
+	
 	if (RFIFOW(fd,2)+4 < 128)
 		buf = buf2; //Use a static buffer.
 	else
@@ -8961,6 +8968,13 @@ void clif_parse_Wis(int fd, struct map_session_data *sd) { // S 0096 <len>.w <ni
 		(sd->sc.data[SC_BERSERK].timer!=-1 || sd->sc.data[SC_NOCHAT].timer != -1))
 		return;
 
+	if (battle_config.min_chat_delay)
+	{	//[Skotlex]
+		if (DIFF_TICK(sd->cantalk_tick, gettick()) > 0)
+			return;
+		sd->cantalk_tick = gettick() + battle_config.min_chat_delay;
+	}
+
 	memcpy(&target,RFIFOP(fd, 4),NAME_LENGTH);
 	target[NAME_LENGTH]='\0';
 	
@@ -10229,6 +10243,13 @@ void clif_parse_PartyMessage(int fd, struct map_session_data *sd) {
 		))
 		return;
 
+	if (battle_config.min_chat_delay)
+	{	//[Skotlex]
+		if (DIFF_TICK(sd->cantalk_tick, gettick()) > 0)
+			return;
+		sd->cantalk_tick = gettick() + battle_config.min_chat_delay;
+	}
+
 	party_send_message(sd, (char*)RFIFOP(fd,4), RFIFOW(fd,2)-4);
 }
 
@@ -10442,6 +10463,13 @@ void clif_parse_GuildMessage(int fd,struct map_session_data *sd) {
 	))
 		return;
 
+	if (battle_config.min_chat_delay)
+	{	//[Skotlex]
+		if (DIFF_TICK(sd->cantalk_tick, gettick()) > 0)
+			return;
+		sd->cantalk_tick = gettick() + battle_config.min_chat_delay;
+	}
+
 	guild_send_message(sd, (char*)RFIFOP(fd,4), RFIFOW(fd,2)-4);
 }
 

+ 1 - 0
src/map/map.h

@@ -612,6 +612,7 @@ struct map_session_data {
 	unsigned int canlog_tick;
 	unsigned int canregen_tick;
 	unsigned int canuseitem_tick;	// [Skotlex]
+	unsigned int cantalk_tick;
 	int hp_sub,sp_sub;
 	int inchealhptick,inchealsptick,inchealspirithptick,inchealspiritsptick;
 

+ 2 - 1
src/map/pc.c

@@ -612,7 +612,8 @@ int pc_authok(struct map_session_data *sd, int login_id2, time_t connect_until_t
 	
 	sd->canregen_tick = tick;
 	sd->canuseitem_tick = tick;
-	
+	sd->cantalk_tick = tick;
+
 	for(i = 0; i < MAX_SKILL_LEVEL; i++)
 		sd->spirit_timer[i] = -1;
 

+ 3 - 10
src/map/skill.c

@@ -3862,17 +3862,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
 			i = 2 * dstmd->db->lv;
 			mob_target(dstmd,src,0);
 		}
-		if (sd){
-			if (i > 0x7FFF)
-				i = 0x7FFF;
-			if (sd->status.sp + i > sd->status.max_sp)
-				i = sd->status.max_sp - sd->status.sp;
-			if (i) {
-				sd->status.sp += i;
-				clif_heal(sd->fd,SP_SP,i);
-			}
-		}
+		if (i) {
+			status_heal(src, 0, i, 3);
 			clif_skill_nodamage(src,bl,skillid,skilllv,0);
+		}
 		break;
 
 	case AC_MAKINGARROW:			/* –î?ì?¬ */