- The last, i hope, fix to the mail system.
* kRO have a possible way to read mail by just sending the open mail window packet to the client. This protection adds a mapflag town, to set the only maps that allow mail operations. because there is no way to know when client closes the mail inbox window. * git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@12279 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
1cbcdaf3f2
commit
84ffdd36bf
@ -3,7 +3,7 @@
|
|||||||
//===== By: ==================================================
|
//===== By: ==================================================
|
||||||
//= L0ne_W0lf
|
//= L0ne_W0lf
|
||||||
//===== Current Version: =====================================
|
//===== Current Version: =====================================
|
||||||
//= 1.3a
|
//= 1.4
|
||||||
//===== Compatible With: =====================================
|
//===== Compatible With: =====================================
|
||||||
//= eAthena SVN
|
//= eAthena SVN
|
||||||
//===== Description: =========================================
|
//===== Description: =========================================
|
||||||
@ -15,8 +15,33 @@
|
|||||||
//= 1.2 Swapped "atcommand" for "Openmail". [L0ne_W0lf]
|
//= 1.2 Swapped "atcommand" for "Openmail". [L0ne_W0lf]
|
||||||
//= 1.3 Added Veins mail box. [L0ne_W0lf]
|
//= 1.3 Added Veins mail box. [L0ne_W0lf]
|
||||||
//= 1.3a Corrected a typo error. (bugreport:798) [Samuray22]
|
//= 1.3a Corrected a typo error. (bugreport:798) [Samuray22]
|
||||||
|
//= 1.4 Added a Mapflag to prevent mail operations in other maps [Zephyrus]
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
|
// Allow Mail Inbox reading from
|
||||||
|
//============================================================
|
||||||
|
prontera mapflag town
|
||||||
|
izlude mapflag town
|
||||||
|
morocc mapflag town
|
||||||
|
geffen mapflag town
|
||||||
|
payon mapflag town
|
||||||
|
pay_arche mapflag town
|
||||||
|
alberta mapflag town
|
||||||
|
aldebaran mapflag town
|
||||||
|
yuno mapflag town
|
||||||
|
lighthalzen mapflag town
|
||||||
|
einbroch mapflag town
|
||||||
|
einbech mapflag town
|
||||||
|
comodo mapflag town
|
||||||
|
umbala mapflag town
|
||||||
|
amatsu mapflag town
|
||||||
|
gonryun mapflag town
|
||||||
|
ayothaya mapflag town
|
||||||
|
louyang mapflag town
|
||||||
|
hugel mapflag town
|
||||||
|
rachel mapflag town
|
||||||
|
veins mapflag town
|
||||||
|
|
||||||
// Prontera
|
// Prontera
|
||||||
//============================================================
|
//============================================================
|
||||||
prontera,146,86,0 script Mailbox#prt::MailBox 888,{
|
prontera,146,86,0 script Mailbox#prt::MailBox 888,{
|
||||||
|
@ -24,6 +24,7 @@ void do_init_atcommand(void);
|
|||||||
void do_final_atcommand(void);
|
void do_final_atcommand(void);
|
||||||
int atcommand_config_read(const char *cfgName);
|
int atcommand_config_read(const char *cfgName);
|
||||||
|
|
||||||
|
int atcommand_mail(const int fd, struct map_session_data* sd,const char* command, const char* message);
|
||||||
int atcommand_item(const int fd, struct map_session_data* sd,const char* command, const char* message);
|
int atcommand_item(const int fd, struct map_session_data* sd,const char* command, const char* message);
|
||||||
int atcommand_mapmove(const int fd, struct map_session_data* sd,const char* command, const char* message);
|
int atcommand_mapmove(const int fd, struct map_session_data* sd,const char* command, const char* message);
|
||||||
int atcommand_monster(const int fd, struct map_session_data* sd, const char* command, const char* message);
|
int atcommand_monster(const int fd, struct map_session_data* sd, const char* command, const char* message);
|
||||||
|
@ -11441,6 +11441,9 @@ void clif_parse_Mail_refreshinbox(int fd, struct map_session_data *sd)
|
|||||||
{
|
{
|
||||||
struct mail_data* md = &sd->mail.inbox;
|
struct mail_data* md = &sd->mail.inbox;
|
||||||
|
|
||||||
|
if( mail_invalid_operation(sd) )
|
||||||
|
return;
|
||||||
|
|
||||||
if( md->amount < MAIL_MAX_INBOX && (md->full || md->changed) )
|
if( md->amount < MAIL_MAX_INBOX && (md->full || md->changed) )
|
||||||
intif_Mail_requestinbox(sd->status.char_id, 1);
|
intif_Mail_requestinbox(sd->status.char_id, 1);
|
||||||
else
|
else
|
||||||
@ -11517,6 +11520,9 @@ void clif_Mail_read(struct map_session_data *sd, int mail_id)
|
|||||||
|
|
||||||
void clif_parse_Mail_read(int fd, struct map_session_data *sd)
|
void clif_parse_Mail_read(int fd, struct map_session_data *sd)
|
||||||
{
|
{
|
||||||
|
if( mail_invalid_operation(sd) )
|
||||||
|
return;
|
||||||
|
|
||||||
clif_Mail_read(sd, RFIFOL(fd,2));
|
clif_Mail_read(sd, RFIFOL(fd,2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -11528,6 +11534,9 @@ void clif_parse_Mail_getattach(int fd, struct map_session_data *sd)
|
|||||||
int i, mail_id = RFIFOL(fd,2);
|
int i, mail_id = RFIFOL(fd,2);
|
||||||
bool fail = false;
|
bool fail = false;
|
||||||
|
|
||||||
|
if( mail_invalid_operation(sd) )
|
||||||
|
return;
|
||||||
|
|
||||||
ARR_FIND(0, MAIL_MAX_INBOX, i, sd->mail.inbox.msg[i].id == mail_id);
|
ARR_FIND(0, MAIL_MAX_INBOX, i, sd->mail.inbox.msg[i].id == mail_id);
|
||||||
if( i == MAIL_MAX_INBOX )
|
if( i == MAIL_MAX_INBOX )
|
||||||
return;
|
return;
|
||||||
@ -11580,6 +11589,9 @@ void clif_parse_Mail_delete(int fd, struct map_session_data *sd)
|
|||||||
{
|
{
|
||||||
int i, mail_id = RFIFOL(fd,2);
|
int i, mail_id = RFIFOL(fd,2);
|
||||||
|
|
||||||
|
if( mail_invalid_operation(sd) )
|
||||||
|
return;
|
||||||
|
|
||||||
ARR_FIND(0, MAIL_MAX_INBOX, i, sd->mail.inbox.msg[i].id == mail_id);
|
ARR_FIND(0, MAIL_MAX_INBOX, i, sd->mail.inbox.msg[i].id == mail_id);
|
||||||
if (i < MAIL_MAX_INBOX)
|
if (i < MAIL_MAX_INBOX)
|
||||||
{
|
{
|
||||||
@ -11602,6 +11614,9 @@ void clif_parse_Mail_return(int fd, struct map_session_data *sd)
|
|||||||
{
|
{
|
||||||
int i, mail_id = RFIFOL(fd,2);
|
int i, mail_id = RFIFOL(fd,2);
|
||||||
|
|
||||||
|
if( mail_invalid_operation(sd) )
|
||||||
|
return;
|
||||||
|
|
||||||
ARR_FIND(0, MAIL_MAX_INBOX, i, sd->mail.inbox.msg[i].id == mail_id);
|
ARR_FIND(0, MAIL_MAX_INBOX, i, sd->mail.inbox.msg[i].id == mail_id);
|
||||||
if (i < MAIL_MAX_INBOX)
|
if (i < MAIL_MAX_INBOX)
|
||||||
intif_Mail_return(sd->status.char_id, mail_id);
|
intif_Mail_return(sd->status.char_id, mail_id);
|
||||||
|
@ -4,8 +4,10 @@
|
|||||||
#ifndef TXT_ONLY
|
#ifndef TXT_ONLY
|
||||||
|
|
||||||
#include "../common/nullpo.h"
|
#include "../common/nullpo.h"
|
||||||
|
#include "../common/showmsg.h"
|
||||||
|
|
||||||
#include "mail.h"
|
#include "mail.h"
|
||||||
|
#include "atcommand.h"
|
||||||
#include "itemdb.h"
|
#include "itemdb.h"
|
||||||
#include "clif.h"
|
#include "clif.h"
|
||||||
#include "pc.h"
|
#include "pc.h"
|
||||||
@ -177,4 +179,16 @@ void mail_deliveryfail(struct map_session_data *sd, struct mail_message *msg)
|
|||||||
clif_Mail_send(sd->fd, true);
|
clif_Mail_send(sd->fd, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This function only check if the mail operations are valid
|
||||||
|
bool mail_invalid_operation(struct map_session_data *sd)
|
||||||
|
{
|
||||||
|
if( !map[sd->bl.m].flag.town && pc_isGM(sd) < get_atcommand_level(atcommand_mail) )
|
||||||
|
{
|
||||||
|
ShowWarning("clif_parse_Mail: char '%s' trying to do invalid mail operations.\n", sd->status.name);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -16,5 +16,6 @@ bool mail_setattachment(struct map_session_data *sd, struct mail_message *msg);
|
|||||||
void mail_getattachment(struct map_session_data* sd, int zeny, struct item* item);
|
void mail_getattachment(struct map_session_data* sd, int zeny, struct item* item);
|
||||||
int mail_openmail(struct map_session_data *sd);
|
int mail_openmail(struct map_session_data *sd);
|
||||||
void mail_deliveryfail(struct map_session_data *sd, struct mail_message *msg);
|
void mail_deliveryfail(struct map_session_data *sd, struct mail_message *msg);
|
||||||
|
bool mail_invalid_operation(struct map_session_data *sd);
|
||||||
|
|
||||||
#endif /* _MAIL_H_ */
|
#endif /* _MAIL_H_ */
|
||||||
|
@ -1164,6 +1164,7 @@ struct map_data {
|
|||||||
int npc_num;
|
int npc_num;
|
||||||
int users;
|
int users;
|
||||||
struct map_flag {
|
struct map_flag {
|
||||||
|
unsigned town : 1; // [Suggestion to protect Mail System]
|
||||||
unsigned autotrade : 1;
|
unsigned autotrade : 1;
|
||||||
unsigned allowks : 1; // [Kill Steal Protection]
|
unsigned allowks : 1; // [Kill Steal Protection]
|
||||||
unsigned nomemo : 1;
|
unsigned nomemo : 1;
|
||||||
|
@ -2414,6 +2414,8 @@ static const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, con
|
|||||||
map[m].flag.autotrade=state;
|
map[m].flag.autotrade=state;
|
||||||
else if (!strcmpi(w3,"allowks"))
|
else if (!strcmpi(w3,"allowks"))
|
||||||
map[m].flag.allowks=state; // [Kill Steal Protection]
|
map[m].flag.allowks=state; // [Kill Steal Protection]
|
||||||
|
else if (!strcmpi(w3,"town"))
|
||||||
|
map[m].flag.town=state;
|
||||||
else if (!strcmpi(w3,"nomemo"))
|
else if (!strcmpi(w3,"nomemo"))
|
||||||
map[m].flag.nomemo=state;
|
map[m].flag.nomemo=state;
|
||||||
else if (!strcmpi(w3,"noteleport"))
|
else if (!strcmpi(w3,"noteleport"))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user