Преглед изворни кода

Added @noask command: enable/disable deals/invites autorejecting.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@6376 54d463be-8e91-2dee-dedb-b68131a5f0ec
LuzZza пре 19 година
родитељ
комит
c2276ce3e2
7 измењених фајлова са 107 додато и 7 уклоњено
  1. 2 0
      Changelog-Trunk.txt
  2. 3 0
      conf-tmpl/atcommand_athena.conf
  3. 4 0
      conf-tmpl/msg_athena.conf
  4. 23 0
      src/map/atcommand.c
  5. 3 1
      src/map/atcommand.h
  6. 71 6
      src/map/clif.c
  7. 1 0
      src/map/map.h

+ 2 - 0
Changelog-Trunk.txt

@@ -4,6 +4,8 @@ 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/04/29
+	* Added @noask command: enable/disable deals/invites autorejecting.
+	  [LuzZza]
 	* Removed unreferenced local variable in pc.c [Lance]
 	* Reverted npc_checknear to exclude check for class_ -1.
 	* Removed npc_checknear in npc_buysellsel, npc_selllist and npc_buylist

+ 3 - 0
conf-tmpl/atcommand_athena.conf

@@ -119,6 +119,9 @@ aw: 1
 // Main chat
 main: 1
 
+// Autorejecting Deals/Invites
+noask: 1
+
 //---------------------------
 // 10: Super player+ commands
 

+ 4 - 0
conf-tmpl/msg_athena.conf

@@ -370,6 +370,10 @@
 386: Main@%s: %s
 387: You cannot use Main chat while muted.
 388: You should enable main chat with "@main on" command.
+//NoAsk
+390: Autorejecting is activated.
+391: Autorejecting is deactivated.
+392: You request has been rejected by autoreject option.
 
 // Messages of others (not for GM commands)
 // ----------------------------------------

+ 23 - 0
src/map/atcommand.c

@@ -294,6 +294,7 @@ ACMD_FUNC(main); // LuzZza
 ACMD_FUNC(clone); // [Valaris]
 ACMD_FUNC(tonpc); // LuzZza
 ACMD_FUNC(commands); // [Skotlex]
+ACMD_FUNC(noask); //LuzZza
 
 /*==========================================
  *AtCommandInfo atcommand_info[]�\‘¢‘̂̒è‹`
@@ -609,6 +610,7 @@ static AtCommandInfo atcommand_info[] = {
 	{ AtCommand_Clone,				"@evilclone",		50, atcommand_clone }, // [Valaris]
 	{ AtCommand_ToNPC,				"@tonpc",			40, atcommand_tonpc }, // LuzZza
 	{ AtCommand_Commands,			"@commands",		1, atcommand_commands }, // [Skotlex]
+	{ AtCommand_NoAsk,				"@noask",			1, atcommand_noask }, // [LuzZza]
 
 // add new commands before this line
 	{ AtCommand_Unknown,			NULL,				 1, NULL }
@@ -10191,6 +10193,27 @@ int atcommand_main(
 	return 0;
 }
 
+/*=====================================
+ * Autorejecting Invites/Deals [LuzZza]
+ * Usage: @noask
+ *-------------------------------------
+ */
+int atcommand_noask(
+	const int fd, struct map_session_data* sd,
+	const char* command, const char* message)
+{
+
+	if(sd->state.noask) {
+		clif_displaymessage(fd, msg_txt(391)); // Autorejecting is deactivated.
+		sd->state.noask = 0;
+	} else {
+		clif_displaymessage(fd, msg_txt(390)); // Autorejecting is activated.
+		sd->state.noask = 1;
+	}
+	
+	return 0;
+}
+
 void do_init_atcommand() {
 	users_db = db_alloc(__FILE__,__LINE__,DB_UINT,DB_OPT_BASE,sizeof(int));
 	duel_count = 0;

+ 3 - 1
src/map/atcommand.h

@@ -268,7 +268,9 @@ enum AtCommandType {
 
 	AtCommand_Clone, // [Valaris]
 	AtCommand_ToNPC, // LuzZza
-	AtCommand_Commands, // [Skotlex]	
+	AtCommand_Commands, // [Skotlex]
+	AtCommand_NoAsk, // [LuzZza]
+	
 	// end <- Ahem, guys, don't place AtCommands after AtCommand_Unknown! [Skotlex]
 	AtCommand_Unknown,
 	AtCommand_MAX

+ 71 - 6
src/map/clif.c

@@ -9317,7 +9317,17 @@ void clif_parse_ChatLeave(int fd,struct map_session_data *sd)
  */
 void clif_parse_TradeRequest(int fd,struct map_session_data *sd)
 {
-	RFIFOHEAD(fd);
+	struct map_session_data *t_sd;
+	
+	RFIFOHEAD(fd);	
+	t_sd = map_id2sd(RFIFOL(sd->fd,2));
+
+	// @noask [LuzZza]
+	if(t_sd && t_sd->state.noask) {
+		// Your request has been rejected by autoreject option.
+		clif_displaymessage(fd, msg_txt(392));
+		return;
+	}
 
 	if(battle_config.basic_skill_check == 0 || pc_checkskill(sd,NV_BASIC) >= 1){
 		trade_traderequest(sd,RFIFOL(sd->fd,2));
@@ -10019,7 +10029,19 @@ void clif_parse_CreateParty2(int fd, struct map_session_data *sd) {
  *------------------------------------------
  */
 void clif_parse_PartyInvite(int fd, struct map_session_data *sd) {
-	RFIFOHEAD(fd);
+	
+	struct map_session_data *t_sd;
+	
+	RFIFOHEAD(fd);	
+	t_sd = map_id2sd(RFIFOL(sd->fd,2));
+
+	// @noask [LuzZza]
+	if(t_sd && t_sd->state.noask) {
+		// Your request has been rejected by autoreject option.
+		clif_displaymessage(fd, msg_txt(392));
+		return;
+	}
+	
 	party_invite(sd, RFIFOL(fd,2));
 }
 
@@ -10235,7 +10257,19 @@ void clif_parse_GuildChangeNotice(int fd,struct map_session_data *sd) {
  *------------------------------------------
  */
 void clif_parse_GuildInvite(int fd,struct map_session_data *sd) {
-	RFIFOHEAD(fd);
+
+	struct map_session_data *t_sd;
+	
+	RFIFOHEAD(fd);	
+	t_sd = map_id2sd(RFIFOL(sd->fd,2));
+
+	// @noask [LuzZza]
+	if(t_sd && t_sd->state.noask) {
+		// Your request has been rejected by autoreject option.
+		clif_displaymessage(fd, msg_txt(392));
+		return;
+	}
+
 	guild_invite(sd,RFIFOL(fd,2));
 }
 
@@ -10290,7 +10324,19 @@ void clif_parse_GuildMessage(int fd,struct map_session_data *sd) {
  *------------------------------------------
  */
 void clif_parse_GuildRequestAlliance(int fd, struct map_session_data *sd) {
-	RFIFOHEAD(fd);
+	
+	struct map_session_data *t_sd;
+	
+	RFIFOHEAD(fd);	
+	t_sd = map_id2sd(RFIFOL(sd->fd,2));
+
+	// @noask [LuzZza]
+	if(t_sd && t_sd->state.noask) {
+		// Your request has been rejected by autoreject option.
+		clif_displaymessage(fd, msg_txt(392));
+		return;
+	}
+	
 	guild_reqalliance(sd,RFIFOL(fd,2));
 }
 
@@ -10317,7 +10363,19 @@ void clif_parse_GuildDelAlliance(int fd, struct map_session_data *sd) {
  *------------------------------------------
  */
 void clif_parse_GuildOpposition(int fd, struct map_session_data *sd) {
-	RFIFOHEAD(fd);
+	
+	struct map_session_data *t_sd;
+	
+	RFIFOHEAD(fd);	
+	t_sd = map_id2sd(RFIFOL(sd->fd,2));
+
+	// @noask [LuzZza]
+	if(t_sd && t_sd->state.noask) {
+		// Your request has been rejected by autoreject option.
+		clif_displaymessage(fd, msg_txt(392));
+		return;
+	}
+	
 	guild_opposition(sd,RFIFOL(fd,2));
 }
 
@@ -10846,6 +10904,13 @@ void clif_parse_FriendsListAdd(int fd, struct map_session_data *sd) {
 		return;
 	}
 
+	// @noask [LuzZza]
+	if(f_sd->state.noask) {
+		// Your request has been rejected by autoreject option.
+		clif_displaymessage(fd, msg_txt(392));
+		return;
+	}
+
 	// Friend already exists
 	for (i = 0; i < MAX_FRIENDS && sd->status.friends[i].char_id != 0; i++) {
 		if (sd->status.friends[i].char_id == f_sd->status.char_id) {
@@ -10861,7 +10926,7 @@ void clif_parse_FriendsListAdd(int fd, struct map_session_data *sd) {
 	}
 		
 	f_fd = f_sd->fd;
-	WFIFOHEAD(fd,packet_len_table[0x207]);
+	WFIFOHEAD(f_fd,packet_len_table[0x207]);
 	WFIFOW(f_fd,0) = 0x207;
 	WFIFOL(f_fd,2) = sd->status.account_id;
 	WFIFOL(f_fd,6) = sd->status.char_id;

+ 1 - 0
src/map/map.h

@@ -506,6 +506,7 @@ struct map_session_data {
 		unsigned showexp :1;
 		unsigned showzeny :1;
 		unsigned mainchat :1; //[LuzZza] 
+		unsigned noask :1; // [LuzZza]
 		unsigned trading :1; //[Skotlex] is 1 only after a trade has started.
 		unsigned deal_locked :2; //1: Clicked on OK. 2: Clicked on TRADE
 		unsigned party_sent :1;