Explorar o código

Bug Fixes
* Fixes #629 - Removed an extra costume check during action requests.
* Fixes #632 - Fixed long broadcast messages getting truncated.
* Fixes #635 - Fixed Elementals getting removed twice from a map during map_quit().
* Fixes #639 - Adjusted two checks from status_get_sc_def() so that tick_def2 is properly adjusted when pc_sc_def_rate is adjusted in battle config.
* Fixes #645 - Fixed atcommand 'iteminfo' displaying items not dropping from any monsters when battle flag 'mobinfo_type' is active.
* Fixes #652 - Don't call clif_scriptclose() on script command 'close' and script command 'end' when an NPC shop is active.
* Fixes #670 - Resolved a possible map crash when using the Lux Anima Runestone.

aleos89 %!s(int64=9) %!d(string=hai) anos
pai
achega
cef2f9ea63
Modificáronse 7 ficheiros con 26 adicións e 34 borrados
  1. 16 15
      src/map/atcommand.c
  2. 0 3
      src/map/clif.c
  3. 1 8
      src/map/map.c
  4. 3 2
      src/map/script.c
  5. 1 1
      src/map/skill.c
  6. 2 4
      src/map/status.c
  7. 3 1
      src/map/unit.c

+ 16 - 15
src/map/atcommand.c

@@ -726,7 +726,7 @@ ACMD_FUNC(whogm)
 	memset(match_text, '\0', sizeof(match_text));
 	memset(player_name, '\0', sizeof(player_name));
 
-	if (sscanf(message, "%199[^\n]", match_text) < 1)
+	if (sscanf(message, "%255[^\n]", match_text) < 1)
 		strcpy(match_text, "");
 	for (j = 0; match_text[j]; j++)
 		match_text[j] = TOLOWER(match_text[j]);
@@ -1114,13 +1114,13 @@ ACMD_FUNC(kami)
 			return -1;
 		}
 
-		sscanf(message, "%199[^\n]", atcmd_output);
+		sscanf(message, "%255[^\n]", atcmd_output);
 		if (strstr(command, "l") != NULL)
 			clif_broadcast(&sd->bl, atcmd_output, strlen(atcmd_output) + 1, BC_DEFAULT, ALL_SAMEMAP);
 		else
 			intif_broadcast(atcmd_output, strlen(atcmd_output) + 1, (*(command + 5) == 'b' || *(command + 5) == 'B') ? BC_BLUE : BC_DEFAULT);
 	} else {
-		if(!message || !*message || (sscanf(message, "%lx %199[^\n]", &color, atcmd_output) < 2)) {
+		if(!message || !*message || (sscanf(message, "%lx %255[^\n]", &color, atcmd_output) < 2)) {
 			clif_displaymessage(fd, msg_txt(sd,981)); // Please enter color and message (usage: @kamic <color> <message>).
 			return -1;
 		}
@@ -7555,10 +7555,12 @@ ACMD_FUNC(iteminfo)
 
 		if (item_data->maxchance == -1)
 			strcpy(atcmd_output, msg_txt(sd,1281)); //  - Available in the shops only.
-		else if (!battle_config.atcommand_mobinfo_type && item_data->maxchance)
-			sprintf(atcmd_output, msg_txt(sd,1282), (float)item_data->maxchance / 100 ); //  - Maximal monsters drop chance: %02.02f%%
-		else
-			strcpy(atcmd_output, msg_txt(sd,1283)); //  - Monsters don't drop this item.
+		else if (!battle_config.atcommand_mobinfo_type) {
+			if (item_data->maxchance)
+				sprintf(atcmd_output, msg_txt(sd,1282), (float)item_data->maxchance / 100 ); //  - Maximal monsters drop chance: %02.02f%%
+			else
+				strcpy(atcmd_output, msg_txt(sd,1283)); //  - Monsters don't drop this item.
+		}
 		clif_displaymessage(fd, atcmd_output);
 
 	}
@@ -7768,7 +7770,7 @@ ACMD_FUNC(me)
 	if (sd->sc.cant.chat)
 		return -1; //no "chatting" while muted.
 
-	if (!message || !*message || sscanf(message, "%199[^\n]", tempmes) < 0) {
+	if (!message || !*message || sscanf(message, "%255[^\n]", tempmes) < 0) {
 		clif_displaymessage(fd, msg_txt(sd,1302)); // Please enter a message (usage: @me <message>).
 		return -1;
 	}
@@ -10149,9 +10151,8 @@ static void atcommand_get_suggestions(struct map_session_data* sd, const char *n
  */
 bool is_atcommand(const int fd, struct map_session_data* sd, const char* message, int type)
 {
-	char charname[NAME_LENGTH], params[100];
-	char charname2[NAME_LENGTH];
-	char command[100];
+	char charname[NAME_LENGTH], charname2[NAME_LENGTH];
+	char command[CHAT_SIZE_MAX], params[CHAT_SIZE_MAX];
 	char output[CHAT_SIZE_MAX];
 
 	//Reconstructed message
@@ -10194,11 +10195,11 @@ bool is_atcommand(const int fd, struct map_session_data* sd, const char* message
 	if (*message == charcommand_symbol) {
 		do {
 			int x, y, z;
-			char params2[100];
+			char params2[CHAT_SIZE_MAX];
 
 			//Checks to see if #command has a name or a name + parameters.
-			x = sscanf(message, "%99s \"%23[^\"]\" %99[^\n]", command, charname, params);
-			y = sscanf(message, "%99s %23s %99[^\n]", command, charname2, params2);
+			x = sscanf(message, "%255s \"%23[^\"]\" %255[^\n]", command, charname, params);
+			y = sscanf(message, "%255s %23s %255[^\n]", command, charname2, params2);
 
 			//z always has the value of the scan that was successful
 			z = ( x > 1 ) ? x : y;
@@ -10250,7 +10251,7 @@ bool is_atcommand(const int fd, struct map_session_data* sd, const char* message
 	memset(params, '\0', sizeof(params));
 
 	//check to see if any params exist within this command
-	if( sscanf(atcmd_msg, "%99s %99[^\n]", command, params) < 2 )
+	if( sscanf(atcmd_msg, "%255s %255[^\n]", command, params) < 2 )
 		params[0] = '\0';
 
 	// @commands (script based)

+ 0 - 3
src/map/clif.c

@@ -10593,9 +10593,6 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type,
 		if( sd->sc.option&OPTION_COSTUME )
 			return;
 
-		if( sd->sc.option&OPTION_COSTUME )
-			return;
-
 		if (!battle_config.sdelay_attack_enable && pc_checkskill(sd, SA_FREECAST) <= 0) {
 			if (DIFF_TICK(tick, sd->ud.canact_tick) < 0) {
 				clif_skill_fail(sd, 1, USESKILL_FAIL_SKILLINTERVAL, 0);

+ 1 - 8
src/map/map.c

@@ -1834,11 +1834,6 @@ int map_quit(struct map_session_data *sd) {
 	if( map[sd->bl.m].instance_id )
 		instance_delusers(map[sd->bl.m].instance_id);
 
-	if( sd->ed ) {
-		elemental_clean_effect(sd->ed);
-		unit_remove_map(&sd->ed->bl,CLR_RESPAWN);
-	}
-	
 	unit_remove_map_pc(sd,CLR_RESPAWN);
 
 	if( map[sd->bl.m].instance_id ) { // Avoid map conflicts and warnings on next login
@@ -2420,6 +2415,7 @@ static int map_instancemap_clean(struct block_list *bl, va_list ap)
 	nullpo_retr(0, bl);
 	switch(bl->type) {
 		case BL_PC:
+		// BL_PET, BL_HOM, BL_MER, and BL_ELEM are removed with BL_PC
 			map_quit((struct map_session_data *) bl);
 			break;
 		case BL_NPC:
@@ -2428,9 +2424,6 @@ static int map_instancemap_clean(struct block_list *bl, va_list ap)
 		case BL_MOB:
 			unit_free(bl,CLR_OUTSIGHT);
 			break;
-		case BL_PET:
-			//There is no need for this, the pet is removed together with the player. [Skotlex]
-			break;
 		case BL_ITEM:
 			map_clearflooritem(bl);
 			break;

+ 3 - 2
src/map/script.c

@@ -4878,7 +4878,8 @@ BUILDIN_FUNC(close)
 		st->mes_active = 0;
 	}
 
-	clif_scriptclose(sd, st->oid);
+	if (!sd->npc_shopid) // Don't close if a shop was opened.
+		clif_scriptclose(sd, st->oid);
 	return SCRIPT_CMD_SUCCESS;
 }
 
@@ -9132,7 +9133,7 @@ BUILDIN_FUNC(end)
 	if( st->mes_active )
 		st->mes_active = 0;
 
-	if( sd )
+	if (sd && !sd->npc_shopid) // Don't close if a shop was opened.
 		clif_scriptclose(sd, st->oid); // If a menu/select/prompt is active, close it.
 
 	return SCRIPT_CMD_SUCCESS;

+ 1 - 1
src/map/skill.c

@@ -8680,7 +8680,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
 		break;
 
 	case RK_LUXANIMA:
-		if( !sd->status.party_id || flag&1 ) {
+		if( !sd || !sd->status.party_id || flag&1 ) {
 			if( src == bl ) break;
 			while( skill_area_temp[5] >= 0x10 ) {
 				type = SC_NONE;

+ 2 - 4
src/map/status.c

@@ -7511,7 +7511,6 @@ int status_get_sc_def(struct block_list *src, struct block_list *bl, enum sc_typ
 	}
 
 	if (sd) {
-
 		if (battle_config.pc_sc_def_rate != 100) {
 			sc_def = sc_def*battle_config.pc_sc_def_rate/100;
 			sc_def2 = sc_def2*battle_config.pc_sc_def_rate/100;
@@ -7520,12 +7519,11 @@ int status_get_sc_def(struct block_list *src, struct block_list *bl, enum sc_typ
 		sc_def = min(sc_def, battle_config.pc_max_sc_def*100);
 		sc_def2 = min(sc_def2, battle_config.pc_max_sc_def*100);
 
-		if (tick_def > 0 && battle_config.pc_sc_def_rate != 100) {
+		if (battle_config.pc_sc_def_rate != 100) {
 			tick_def = tick_def*battle_config.pc_sc_def_rate/100;
 			tick_def2 = tick_def2*battle_config.pc_sc_def_rate/100;
 		}
 	} else {
-
 		if (battle_config.mob_sc_def_rate != 100) {
 			sc_def = sc_def*battle_config.mob_sc_def_rate/100;
 			sc_def2 = sc_def2*battle_config.mob_sc_def_rate/100;
@@ -7534,7 +7532,7 @@ int status_get_sc_def(struct block_list *src, struct block_list *bl, enum sc_typ
 		sc_def = min(sc_def, battle_config.mob_max_sc_def*100);
 		sc_def2 = min(sc_def2, battle_config.mob_max_sc_def*100);
 
-		if (tick_def > 0 && battle_config.mob_sc_def_rate != 100) {
+		if (battle_config.mob_sc_def_rate != 100) {
 			tick_def = tick_def*battle_config.mob_sc_def_rate/100;
 			tick_def2 = tick_def2*battle_config.mob_sc_def_rate/100;
 		}

+ 3 - 1
src/map/unit.c

@@ -3085,8 +3085,10 @@ void unit_remove_map_pc(struct map_session_data *sd, clr_type clrtype)
 	if(sd->md)
 		unit_remove_map(&sd->md->bl, clrtype);
 
-	if(sd->ed)
+	if(sd->ed) {
+		elemental_clean_effect(sd->ed);
 		unit_remove_map(&sd->ed->bl, clrtype);
+	}
 }
 
 /**