Jump to content
  • 0

disable @duel if Job=Bard/Dancer


Question

6 answers to this question

Recommended Posts

Posted (edited)

add code to file /src/map/atcommand.c in commands ACMD_FUNC(duel), ACMD_FUNC(invite) and ACMD_FUNC(accept)

    if(sd->class_&MAPID_UPPERMASK == MAPID_BARDDANCER) {
        clif_displaymessage(fd, "command not use job Bard and Dancer");
        return 0;
    }

not tested.

 

 

P.S. i bad speak English.

Edited by Evil
Posted

add code to file /src/map/atcommand.c in commands ACMD_FUNC(duel), ACMD_FUNC(invite) and ACMD_FUNC(accept)

    if(sd->class_&MAPID_UPPERMASK) == MAPID_BARDDANCER) {
        clif_displaymessage(fd, "command not use job Bard and Dancer");
        return 0;
    }

not tested.

 

 

P.S. i bad speak English.

Thank you sir,But it doesn't work :(

i'm get error while recompile

Posted (edited)

 src/map/atcommand.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index cd090a5..66c229e 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -7899,6 +7899,13 @@ static int atcommand_mutearea_sub(struct block_list *bl,va_list ap)
 		return 0;
 	}
 
+	if ( ( target_sd->class_&MAPID_UPPERMASK ) == MAPID_BARDDANCER ) {
+		char aaa[255];
+		sprintf( aaa, "You can't invite %s into @duel because %s is a bard/dancer", target_sd->status.name, ( target_sd->status.sex )? "he" : "she" );
+		clif_displaymessage( fd, aaa );
+		return 0;
+	}
+
 	if(target_sd->duel_group > 0 || target_sd->duel_invite > 0) {
 		// "Duel: Player already in duel."
 		clif_displaymessage(fd, msg_txt(sd,353));
@@ -7941,6 +7948,11 @@ static int atcommand_mutearea_sub(struct block_list *bl,va_list ap)
 		return 0;
 	}
 
+	if ( ( sd->class_&MAPID_UPPERMASK ) == MAPID_BARDDANCER ) {
+		clif_displaymessage( fd, "You can't @duel because you are a bard/dancer" );
+		return 0;
+	}
+
 	if( message[0] ) {
 		if(sscanf(message, "%d", &maxpl) >= 1) {
 			if(maxpl < 2 || maxpl > 65535) {
@@ -7958,6 +7970,12 @@ static int atcommand_mutearea_sub(struct block_list *bl,va_list ap)
 						clif_displaymessage(fd, msg_txt(sd,353)); // "Duel: Player already in duel."
 						return 0;
 					}
+					else if ( ( target_sd->class_&MAPID_UPPERMASK ) == MAPID_BARDDANCER ) {
+						char aaa[255];
+						sprintf( aaa, "You can't invite %s into @duel because %s is a bard/dancer", target_sd->status.name, ( target_sd->status.sex )? "he" : "she" );
+						clif_displaymessage( fd, aaa );
+						return 0;
+					}
 					duel_invite(newduel, sd, target_sd);
 					clif_displaymessage(fd, msg_txt(sd,354)); // "Duel: Invitation has been sent."
 				}

edit: the patch file doesn't make sense

here these 2 functions that I've edit

ACMD_FUNC(invite)
{
	unsigned int did = sd->duel_group;
	struct map_session_data *target_sd = map_nick2sd((char *)message);

	if(did == 0) {
		// "Duel: @invite without @duel."
		clif_displaymessage(fd, msg_txt(sd,350));
		return 0;
	}

	if(duel_list[did].max_players_limit > 0 &&
		duel_list[did].members_count >= duel_list[did].max_players_limit) {

		// "Duel: Limit of players is reached."
		clif_displaymessage(fd, msg_txt(sd,351));
		return 0;
	}

	if(target_sd == NULL) {
		// "Duel: Player not found."
		clif_displaymessage(fd, msg_txt(sd,352));
		return 0;
	}

	if ( ( target_sd->class_&MAPID_UPPERMASK ) == MAPID_BARDDANCER ) {
		char aaa[255];
		sprintf( aaa, "You can't invite %s into @duel because %s is a bard/dancer", target_sd->status.name, ( target_sd->status.sex )? "he" : "she" );
		clif_displaymessage( fd, aaa );
		return 0;
	}

	if(target_sd->duel_group > 0 || target_sd->duel_invite > 0) {
		// "Duel: Player already in duel."
		clif_displaymessage(fd, msg_txt(sd,353));
		return 0;
	}

	if(battle_config.duel_only_on_same_map && target_sd->bl.m != sd->bl.m)
	{
		sprintf(atcmd_output, msg_txt(sd,364), message);
		clif_displaymessage(fd, atcmd_output);
		return 0;
	}

	duel_invite(did, sd, target_sd);
	// "Duel: Invitation has been sent."
	clif_displaymessage(fd, msg_txt(sd,354));
	return 0;
}

ACMD_FUNC(duel)
{
	unsigned int maxpl = 0;

	if(sd->duel_group > 0) {
		duel_showinfo(sd->duel_group, sd);
		return 0;
	}

	if(sd->duel_invite > 0) {
		// "Duel: @duel without @reject."
		clif_displaymessage(fd, msg_txt(sd,355));
		return 0;
	}

	if(!duel_checktime(sd)) {
		char output[CHAT_SIZE_MAX];
		// "Duel: You can take part in duel only one time per %d minutes."
		sprintf(output, msg_txt(sd,356), battle_config.duel_time_interval);
		clif_displaymessage(fd, output);
		return 0;
	}

	if ( ( sd->class_&MAPID_UPPERMASK ) == MAPID_BARDDANCER ) {
		clif_displaymessage( fd, "You can't @duel because you are a bard/dancer" );
		return 0;
	}

	if( message[0] ) {
		if(sscanf(message, "%d", &maxpl) >= 1) {
			if(maxpl < 2 || maxpl > 65535) {
				clif_displaymessage(fd, msg_txt(sd,357)); // "Duel: Invalid value."
				return 0;
			}
			duel_create(sd, maxpl);
		} else {
			struct map_session_data *target_sd;
			target_sd = map_nick2sd((char *)message);
			if(target_sd != NULL) {
				unsigned int newduel;
				if((newduel = duel_create(sd, 2)) != -1) {
					if(target_sd->duel_group > 0 ||	target_sd->duel_invite > 0) {
						clif_displaymessage(fd, msg_txt(sd,353)); // "Duel: Player already in duel."
						return 0;
					}
					else if ( ( target_sd->class_&MAPID_UPPERMASK ) == MAPID_BARDDANCER ) {
						char aaa[255];
						sprintf( aaa, "You can't invite %s into @duel because %s is a bard/dancer", target_sd->status.name, ( target_sd->status.sex )? "he" : "she" );
						clif_displaymessage( fd, aaa );
						return 0;
					}
					duel_invite(newduel, sd, target_sd);
					clif_displaymessage(fd, msg_txt(sd,354)); // "Duel: Invitation has been sent."
				}
			} else {
				// "Duel: Player not found."
				clif_displaymessage(fd, msg_txt(sd,352));
				return 0;
			}
		}
	} else
		duel_create(sd, 0);

	return 0;
}
Edited by AnnieRuru
Posted (edited)

AnnieRuru

@invite - check target

target_sd->class_&MAPID_UPPERMASK

@duel - check who use

sd->class_&MAPID_UPPERMASK

if use command not bard - invite bard - command good work.

 

my idea check who use all commands...

Edited by Evil

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...