Bläddra i källkod

- Made the report_Src function also report name of non-bl objects.
- The double continuation error will now display both scripts that triggered it.
- Loading the storage from the char-server will fail if player is already tagged in final save state.
- Removed setting ban_spoof_namer, sending invalid global-talk packets will now just kick the player out of the server.
- Added BL_NPC support to status_get_name


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

skotlex 18 år sedan
förälder
incheckning
6630ebff98
10 ändrade filer med 28 tillägg och 41 borttagningar
  1. 6 0
      Changelog-Trunk.txt
  2. 3 0
      conf-tmpl/Changelog.txt
  3. 0 5
      conf-tmpl/battle/gm.conf
  4. 0 5
      src/map/battle.c
  5. 0 1
      src/map/battle.h
  6. 3 25
      src/map/clif.c
  7. 3 0
      src/map/intif.c
  8. 9 3
      src/map/script.c
  9. 2 0
      src/map/status.c
  10. 2 2
      src/map/trade.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/09/19
+	* The double continuation error will now display both scripts that
+	  triggered it. [Skotlex]
+	* Loading the storage from the char-server will fail if player is already
+	  tagged in final save state. [Skotlex]
+	* Removed setting ban_spoof_namer, sending invalid global-talk packets will
+	  now just kick the player out of the server. [Skotlex]
 	* Added echoing messages back to self when using @/# commands on whispers
 	  and party/guild messages, to prevent the client from muting yourself.
 	  [Skotlex]

+ 3 - 0
conf-tmpl/Changelog.txt

@@ -1,5 +1,8 @@
 Date	Added
 
+2006/09/19
+	* Removed setting ban_spoof_namer (as now invalid chat packets just cause
+	  the sending character to be disconnected). [Skotlex]
 2006/09/18
 	* The new socket update code includes support for two new config settings
 	  (packet_athena.txt): frame_size, which can be used to alter the logic

+ 0 - 5
conf-tmpl/battle/gm.conf

@@ -65,11 +65,6 @@ atcommand_gm_only: no
 // Is the character of a GM account set as the object of a display by @ command etc. or not?
 hide_GM_session: no
 
-// Ban people that try to use an other name of its name (spoof name).
-// Duration of the ban, in minutes (default: 5). Value from 0 to 32767
-// to disable the ban, set 0
-ban_spoof_namer: 5
-
 // Ban people that try trade dupe.
 // Duration of the ban, in minutes (default: 5). Value from 0 to 32767
 // to disable the ban, set 0

+ 0 - 5
src/map/battle.c

@@ -3682,7 +3682,6 @@ static const struct battle_data_short {
 	{ "backstab_bow_penalty",              &battle_config.backstab_bow_penalty	},
 	{ "night_at_start",                    &battle_config.night_at_start	}, // added by [Yor]
 	{ "show_mob_info",                     &battle_config.show_mob_info }, // [Valaris]
-	{ "ban_spoof_namer",                   &battle_config.ban_spoof_namer	}, // added by [Yor]
 	{ "hack_info_GM_level",                &battle_config.hack_info_GM_level	}, // added by [Yor]
 	{ "any_warp_GM_min_level",             &battle_config.any_warp_GM_min_level	}, // added by [Yor]
 	{ "packet_ver_flag",                   &battle_config.packet_ver_flag	}, // added by [Yor]
@@ -4118,7 +4117,6 @@ void battle_set_defaults() {
 	battle_config.day_duration = 2*60*60*1000; // added by [Yor] (2 hours)
 	battle_config.night_duration = 30*60*1000; // added by [Yor] (30 minutes)
 	battle_config.show_mob_info = 0;
-	battle_config.ban_spoof_namer = 5; // added by [Yor] (default: 5 minutes)
 	battle_config.hack_info_GM_level = 60; // added by [Yor] (default: 60, GM level)
 	battle_config.any_warp_GM_min_level = 20; // added by [Yor]
 	battle_config.packet_ver_flag = 1023; // added by [Yor]
@@ -4339,9 +4337,6 @@ void battle_validate_conf() {
 	if (battle_config.night_duration != 0 && battle_config.night_duration < 60000) // added by [Yor]
 		battle_config.night_duration = 60000;
 	
-	if (battle_config.ban_spoof_namer > SHRT_MAX)
-		battle_config.ban_spoof_namer = SHRT_MAX;
-
 	if (battle_config.hack_info_GM_level > 100)
 		battle_config.hack_info_GM_level = 100;
 

+ 0 - 1
src/map/battle.h

@@ -331,7 +331,6 @@ extern struct Battle_Config {
 	unsigned short night_at_start; // added by [Yor]
 	int day_duration; // added by [Yor]
 	int night_duration; // added by [Yor]
-	unsigned short ban_spoof_namer; // added by [Yor]
 	short ban_hack_trade; // added by [Yor]
 	unsigned short hack_info_GM_level; // added by [Yor]
 	unsigned short any_warp_GM_min_level; // added by [Yor]

+ 3 - 25
src/map/clif.c

@@ -8641,31 +8641,9 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data *sd) { // S 008c <
 	if (strlen(message) < strlen(sd->status.name) || //If the incoming string is too short...
 		strncmp(message, sd->status.name, strlen(sd->status.name)) != 0) //Or the name does not matches...
 	{
-		unsigned char gm_msg[256];
-		ShowWarning("Hack on global message: character '%s' (account: %d), use an other name to send a (normal) message.\n", sd->status.name, sd->status.account_id);
-		// information is sended to all online GM
-		sprintf(gm_msg, "Hack on global message (normal message): character '%s' (account: %d) uses another name.", sd->status.name, sd->status.account_id);
-		intif_wis_message_to_gm(wisp_server_name, battle_config.hack_info_GM_level, gm_msg);
-		
-		if (strlen(message) == 0)
-			strcpy(gm_msg, " This player sends a void name and a void message.");
-		else
-			snprintf(gm_msg, 255, " This player sends (name:message): '%128s'.", message);
-		intif_wis_message_to_gm(wisp_server_name, battle_config.hack_info_GM_level, gm_msg);
-		// message about the ban
-		if (battle_config.ban_spoof_namer > 0)
-			sprintf(gm_msg, " This player has been banned for %d minute(s).", battle_config.ban_spoof_namer);
-		else
-			sprintf(gm_msg, " This player hasn't been banned (Ban option is disabled).");
-		intif_wis_message_to_gm(wisp_server_name, battle_config.hack_info_GM_level, gm_msg);
-
-		// if we ban people
-		if (battle_config.ban_spoof_namer > 0) {
-			chrif_char_ask_name(-1, sd->status.name, 2, 0, 0, 0, 0, battle_config.ban_spoof_namer, 0); // type: 2 - ban (year, month, day, hour, minute, second)
-			clif_setwaitclose(fd); // forced to disconnect because of the hack
-		}
-		else
-			session[fd]->eof = 1; //Disconnect them too, bad packets can cause problems down the road. [Skotlex]
+		//Hacked message, or infamous "client desynch" issue where they pick
+		//one char while loading another. Just kick them out to correct it.
+		clif_setwaitclose(fd);
 		return;
 	}
 	

+ 3 - 0
src/map/intif.c

@@ -1001,6 +1001,9 @@ int intif_parse_LoadStorage(int fd) {
 		return 1;
 	}
 
+	if (sd->state.finalsave)
+		return 1; //Player is already scheduled to leave the server.
+
 	stor = account2storage( RFIFOL(fd,4));
 
 	if (stor->storage_status == 1) { // Already open.. lets ignore this update

+ 9 - 3
src/map/script.c

@@ -224,9 +224,9 @@ static void report_src(struct script_state *st) {
 		break;
 		default:
 			if (bl->m >=0)
-				ShowDebug("Source (Non-NPC): type %d at %s (%d,%d)\n", bl->type, map[bl->m].name, bl->x, bl->y);
+				ShowDebug("Source (Non-NPC type %d): name %s at %s (%d,%d)\n", bl->type, status_get_name(bl), map[bl->m].name, bl->x, bl->y);
 			else
-				ShowDebug("Source (Non-NPC): type %d (invisible/not on a map)\n", bl->type);
+				ShowDebug("Source (Non-NPC type %d): name %s (invisible/not on a map)\n", bl->type, status_get_name(bl));
 		break;
 	}
 }
@@ -2729,8 +2729,14 @@ void run_script_main(struct script_state *st)
 	}
 	else if(st->state != END && sd){
 		//Resume later (st is already attached to player).
-		if(bk_st)
+		if(bk_st) {
 			ShowWarning("Unable to restore stack! Double continuation!\n");
+			//Report BOTH scripts to see if that can help somehow.
+			ShowDebug("Previous script (lost):");
+			report_src(bk_st);
+			ShowDebug("Current script:");
+			report_src(st);
+		}
 	} else {
 		//Dispose of script.
 		if (sd)

+ 2 - 0
src/map/status.c

@@ -3921,6 +3921,8 @@ const char * status_get_name(struct block_list *bl)
 		return ((struct pet_data *)bl)->pet.name;
 	case BL_HOM:
 		return ((struct homun_data *)bl)->master->homunculus.name;
+	case BL_NPC:
+		return ((struct npc_data*)bl)->name;
 	default:
 		return "Unknown";
 	}

+ 2 - 2
src/map/trade.c

@@ -171,13 +171,13 @@ int impossible_trade_check(struct map_session_data *sd) {
 				chrif_char_ask_name(-1, sd->status.name, 1, 0, 0, 0, 0, 0, 0); // type: 1 - block
 				clif_setwaitclose(sd->fd); // forced to disconnect because of the hack
 				// message about the ban
-				sprintf(message_to_gm, msg_txt(540), battle_config.ban_spoof_namer); //  This player has been definitivly blocked.
+				sprintf(message_to_gm, msg_txt(540)); //  This player has been definitivly blocked.
 			// if we ban people
 			} else if (battle_config.ban_hack_trade > 0) {
 				chrif_char_ask_name(-1, sd->status.name, 2, 0, 0, 0, 0, battle_config.ban_hack_trade, 0); // type: 2 - ban (year, month, day, hour, minute, second)
 				clif_setwaitclose(sd->fd); // forced to disconnect because of the hack
 				// message about the ban
-				sprintf(message_to_gm, msg_txt(507), battle_config.ban_spoof_namer); //  This player has been banned for %d minute(s).
+				sprintf(message_to_gm, msg_txt(507), battle_config.ban_hack_trade); //  This player has been banned for %d minute(s).
 			} else
 				// message about the ban
 				sprintf(message_to_gm, msg_txt(508)); //  This player hasn't been banned (Ban option is disabled).