Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a mapflag to block RODEX #6291

Merged
merged 1 commit into from
Oct 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion conf/msg_conf/map_msg.conf
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,10 @@
// @reloadattendancedb
795: Attendance database has been reloaded.

//796-899 free
// NoRODEX Mapflag
796: You cannot use RODEX on this map.

//797-899 free

//------------------------------------
// More atcommands message
Expand Down
20 changes: 20 additions & 0 deletions src/map/clif.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15799,6 +15799,10 @@ void clif_Mail_refreshinbox(struct map_session_data *sd,enum mail_inbox_type typ
/// 0ac0 <mail id>.Q <unknown>.16B (CZ_OPEN_MAILBOX2)
/// 0ac1 <mail id>.Q <unknown>.16B (CZ_REQ_REFRESH_MAIL_LIST2)
void clif_parse_Mail_refreshinbox(int fd, struct map_session_data *sd){
if( mail_invalid_operation( sd ) ){
return;
}

#if PACKETVER < 20150513
struct mail_data* md = &sd->mail.inbox;

Expand Down Expand Up @@ -16013,6 +16017,10 @@ void clif_parse_Mail_beginwrite( int fd, struct map_session_data *sd ){

safestrncpy(name, RFIFOCP(fd, 2), NAME_LENGTH);

if( mail_invalid_operation( sd ) ){
return;
}

if( sd->state.storage_flag || sd->state.mail_writing || sd->trade_partner ){
clif_send_Mail_beginwrite_ack(sd, name, false);
return;
Expand Down Expand Up @@ -16051,6 +16059,10 @@ void clif_Mail_Receiver_Ack( struct map_session_data* sd, uint32 char_id, short
void clif_parse_Mail_Receiver_Check(int fd, struct map_session_data *sd) {
static char name[NAME_LENGTH];

if( mail_invalid_operation( sd ) ){
return;
}

safestrncpy(name, RFIFOCP(fd, 2), NAME_LENGTH);

intif_mail_checkreceiver(sd, name);
Expand Down Expand Up @@ -16249,6 +16261,10 @@ void clif_parse_Mail_setattach(int fd, struct map_session_data *sd){
if (sd->inventory_data[server_index(idx)] == nullptr)
return;

if( mail_invalid_operation( sd ) ){
return;
}

flag = mail_setitem(sd, idx, amount);

if( flag == MAIL_ATTACH_EQUIPSWITCH ){
Expand Down Expand Up @@ -16331,6 +16347,10 @@ void clif_parse_Mail_send(int fd, struct map_session_data *sd){
return;
}

if( mail_invalid_operation( sd ) ){
return;
}

// Forged request without a begin writing packet?
if( !sd->state.mail_writing ){
return; // Ignore it
Expand Down
7 changes: 6 additions & 1 deletion src/map/mail.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,9 +396,14 @@ bool mail_invalid_operation(struct map_session_data *sd)
ShowWarning("clif_parse_Mail: char '%s' trying to do invalid mail operations.\n", sd->status.name);
return true;
}
#endif
#else
if( map_getmapflag( sd->bl.m, MF_NORODEX ) ){
clif_displaymessage( sd->fd, msg_txt( sd, 796 ) ); // You cannot use RODEX on this map.
return true;
}

return false;
#endif
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/map/map.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,7 @@ enum e_mapflag : int16 {
MF_PRIVATEAIRSHIP_DESTINATION,
MF_SKILL_DURATION,
MF_NOCASHSHOP,
MF_NORODEX,
MF_MAX
};

Expand Down
1 change: 1 addition & 0 deletions src/map/script_constants.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,7 @@
export_constant(MF_PRIVATEAIRSHIP_DESTINATION);
export_constant(MF_SKILL_DURATION);
export_constant(MF_NOCASHSHOP);
export_constant(MF_NORODEX);

/* setcell types */
export_constant(CELL_WALKABLE);
Expand Down