From 8b397b940a270a4e4107f76614339742a8c5a257 Mon Sep 17 00:00:00 2001 From: skotlex Date: Tue, 19 Sep 2006 17:23:22 +0000 Subject: - 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://rathena.svn.sourceforge.net/svnroot/rathena/trunk@8812 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/battle.c | 5 ----- src/map/battle.h | 1 - src/map/clif.c | 28 +++------------------------- src/map/intif.c | 3 +++ src/map/script.c | 12 +++++++++--- src/map/status.c | 2 ++ src/map/trade.c | 4 ++-- 7 files changed, 19 insertions(+), 36 deletions(-) (limited to 'src/map') diff --git a/src/map/battle.c b/src/map/battle.c index f9590a50c..68297b7ff 100644 --- a/src/map/battle.c +++ b/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; diff --git a/src/map/battle.h b/src/map/battle.h index 130ec2d4d..8e9dc1010 100644 --- a/src/map/battle.h +++ b/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] diff --git a/src/map/clif.c b/src/map/clif.c index f6aa5e223..a7e377552 100644 --- a/src/map/clif.c +++ b/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; } diff --git a/src/map/intif.c b/src/map/intif.c index 7183533db..6dc5f15cd 100644 --- a/src/map/intif.c +++ b/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 diff --git a/src/map/script.c b/src/map/script.c index 73bf0d7d0..ebe8e060d 100644 --- a/src/map/script.c +++ b/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) diff --git a/src/map/status.c b/src/map/status.c index fba106fab..aeacf4929 100644 --- a/src/map/status.c +++ b/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"; } diff --git a/src/map/trade.c b/src/map/trade.c index fe695d695..ef49a4e2b 100644 --- a/src/map/trade.c +++ b/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). -- cgit v1.2.3-70-g09d2