summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog-Trunk.txt2
-rw-r--r--conf-tmpl/atcommand_athena.conf3
-rw-r--r--conf-tmpl/msg_athena.conf4
-rw-r--r--src/map/atcommand.c23
-rw-r--r--src/map/atcommand.h4
-rw-r--r--src/map/clif.c77
-rw-r--r--src/map/map.h1
7 files changed, 107 insertions, 7 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 056db18ba..d99fbc789 100644
--- a/Changelog-Trunk.txt
+++ b/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
diff --git a/conf-tmpl/atcommand_athena.conf b/conf-tmpl/atcommand_athena.conf
index 6459c2af2..397817d47 100644
--- a/conf-tmpl/atcommand_athena.conf
+++ b/conf-tmpl/atcommand_athena.conf
@@ -119,6 +119,9 @@ aw: 1
// Main chat
main: 1
+// Autorejecting Deals/Invites
+noask: 1
+
//---------------------------
// 10: Super player+ commands
diff --git a/conf-tmpl/msg_athena.conf b/conf-tmpl/msg_athena.conf
index c3840d22f..f604c55c3 100644
--- a/conf-tmpl/msg_athena.conf
+++ b/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)
// ----------------------------------------
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 686d03c87..d15b04937 100644
--- a/src/map/atcommand.c
+++ b/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;
diff --git a/src/map/atcommand.h b/src/map/atcommand.h
index f67c12844..a0c56821e 100644
--- a/src/map/atcommand.h
+++ b/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
diff --git a/src/map/clif.c b/src/map/clif.c
index 1b15c8247..8976f1536 100644
--- a/src/map/clif.c
+++ b/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;
diff --git a/src/map/map.h b/src/map/map.h
index e7e821bc1..5bce574f4 100644
--- a/src/map/map.h
+++ b/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;