Skip to content
Permalink
Browse files
Basic RODEX support (#2186)
Adds basic support for the new mail UI RODEX.

Fixes #1567

Thanks to @RagnarokNova, @Atemo, @aleos89 and everyone else that helped me with this.
Additionally I would like to thank @jezznar and @hazimjauhari90 for their good testing in the pull request.
  • Loading branch information
Lemongrass3110 committed Jun 20, 2017
1 parent 76786e2 commit 58776da1ac14a46d3c717c72ddf2b7f2876f7392
@@ -134,6 +134,29 @@ cashshop_show_points: no
// 2 = Yes, when there are unread mails
mail_show_status: 0

// Amount of mails a user can send a day.
// Default: 100
// 0 = Unlimited
mail_daily_count: 100

// Fee for transferring zeny via mail (Note 2)
// NOTE: this rate is hardcoded in the client, you need to diff your client accordingly if you change this value.
// Default: 2(2%)
// 0 = No fee
mail_zeny_fee: 2

// Amount of zeny to pay for each attached item
// NOTE: this fee is hardcoded in the client, you need to diff your client accordingly if you change this value.
// Default: 2500
// 0 = No fee
mail_attachment_price: 2500

// Maximum weight in total that can be attached to a mail
// NOTE: this limit is hardcoded in the client, you need to diff your client accordingly if you change this value.
// Default: 2000
// 0 = No weight limit
mail_attachment_weight: 2000

// Is monster transformation disabled during Guild Wars?
// If set to yes, monster transforming is automatically removed/disabled when enterting castles during WoE times
mon_trans_disable_in_gvg: no
@@ -261,4 +261,19 @@ default_map_y: 191
// Default: 14
clan_remove_inactive_days: 14

//===================================
// RODEX
//===================================
// After how many days should mails be returned to their sender?
// 0: never return them
// X: return them after X days
// Default: 14
mail_return_days: 14

// How many days after a mail was returned to it's sender should it be deleted completely?
// 0: never delete them
// X: delete them X days after they were returned
// Default: 14
mail_delete_days: 14

import: conf/import/char_conf.txt
@@ -108,6 +108,7 @@ party_db: party
pet_db: pet
friend_db: friends
mail_db: mail
mail_attachment_db: mail_attachments
auction_db: auction
quest_db: quest
homunculus_db: homunculus
@@ -2497,31 +2497,31 @@ packet_keys: 0x62C86D09,0x75944F17,0x112C133D // [YomRawr]

// RODEX Mail system
0x09E7,3 // ZC_NOTIFY_UNREADMAIL
0x09E8,11,dull,0 // CZ_OPEN_MAILBOX
0x09E8,11,mailrefresh,2:3 // CZ_OPEN_MAILBOX
0x09E9,2,dull,0 // CZ_CLOSE_MAILBOX
0x09EA,11,dull,0 // CZ_REQ_READ_MAIL
0x09EA,11,mailread,2:3 // CZ_REQ_READ_MAIL
0x09EB,-1 // ZC_ACK_READ_MAIL
0x09EC,-1,dull,0 // CZ_REQ_WRITE_MAIL
0x09EC,-1,mailsend,2:4:28:52:60:62:64 // CZ_REQ_WRITE_MAIL
0x09ED,3 // ZC_ACK_WRITE_MAIL
0x09EE,11,dull,0 // CZ_REQ_NEXT_MAIL_LIST
0x09EF,11,dull,0 // CZ_REQ_REFRESH_MAIL_LIST
0x09EE,11,mailrefresh,2:3 // CZ_REQ_NEXT_MAIL_LIST
0x09EF,11,mailrefresh,2:3 // CZ_REQ_REFRESH_MAIL_LIST
0x09F0,-1 // ZC_ACK_MAIL_LIST
0x09F1,11,dull,0 // CZ_REQ_ZENY_FROM_MAIL
0x09F1,11,mailgetattach,0 // CZ_REQ_ZENY_FROM_MAIL
0x09F2,12 // ZC_ACK_ZENY_FROM_MAIL
0x09F3,11,dull,0 // CZ_REQ_ITEM_FROM_MAIL
0x09F3,11,mailgetattach,0 // CZ_REQ_ITEM_FROM_MAIL
0x09F4,12 // ZC_ACK_ITEM_FROM_MAIL
0x09F5,11,dull,0 // CZ_REQ_DELETE_MAIL
0x09F5,11,maildelete,0 // CZ_REQ_DELETE_MAIL
0x09F6,11 // ZC_ACK_DELETE_MAIL
0x0A03,2,dull,0 // CZ_REQ_CANCEL_WRITE_MAIL
0x0A04,6,dull,0 // CZ_REQ_ADD_ITEM_TO_MAIL
0x0A03,2,mailcancel,0 // CZ_REQ_CANCEL_WRITE_MAIL
0x0A04,6,mailsetattach,2:4 // CZ_REQ_ADD_ITEM_TO_MAIL
0x0A05,53 // ZC_ACK_ADD_ITEM_TO_MAIL
0x0A06,6,dull,0 // CZ_REQ_REMOVE_ITEM_MAIL
0x0A06,6,mailwinopen,2:4 // CZ_REQ_REMOVE_ITEM_MAIL
0x0A07,9 // ZC_ACK_REMOVE_ITEM_MAIL
0x0A08,26,dull,0 // CZ_REQ_OPEN_WRITE_MAIL
0x0A08,26,mailbegin,0 // CZ_REQ_OPEN_WRITE_MAIL
0x0A12,27 // ZC_ACK_OPEN_WRITE_MAIL
0x0A32,2 // ZC_OPEN_RODEX_THROUGH_NPC_ONLY
0x0A13,26,dull,0 // CZ_CHECK_RECEIVE_CHARACTER_NAME
0x0A13,26,mailreceiver,2 // CZ_CHECK_RECEIVE_CHARACTER_NAME
0x0A14,10 // ZC_CHECK_RECEIVE_CHARACTER_NAME
0x0A32,2 // ZC_OPEN_RODEX_THROUGH_NPC_ONLY

// New EquipPackets Support
0x0A09,45 // ZC_ADD_EXCHANGE_ITEM3
@@ -2657,6 +2657,15 @@ packet_keys: 0x4C17382A,0x7ED174C9,0x29961E4F // [Winnie]
0x088D,5,hommenu,2:4
0x0940,36,storagepassword,2:4:20

// 2016-03-02bRagexe
0x0A51,34

// 2016-03-30aRagexe
0x0A6E,-1,mailsend,2:4:28:52:60:62:64:68 // CZ_REQ_WRITE_MAIL2

// 2016-06-01aRagexe
0x0A7D,-1

// 2017-05-24aRagexeRE
0x0A43,85
0x0A44,-1
@@ -1006,13 +1006,14 @@ Currently the max packet size is 0xFFFF (see 'WFIFOSET()' in 'src/common/socket.

0x3048
Type: ZI
Structure: <cmd>.W <cid>.L <flag>.B
index: 0,2,6
len: 7
Structure: <cmd>.W <cid>.L <flag>.B <mail_type>.B
index: 0,2,6,7
len: 8
parameter:
- cmd : packet identification (0x3048)
- cid
- flag
- mail_type
desc:
- Inbox request

@@ -1029,13 +1030,14 @@ Currently the max packet size is 0xFFFF (see 'WFIFOSET()' in 'src/common/socket.

0x304a
Type: ZI
Structure: <cmd>.W <cid>.L <mail_id>.L
index: 0,2,6
len: 10
Structure: <cmd>.W <cid>.L <mail_id>.L <attachment_type>.B
index: 0,2,6,10
len: 11
parameter:
- cmd : packet identification (0x304a)
- cid
- mail_id
- attachment_type
desc:
- Mail get attachment

@@ -1076,6 +1078,18 @@ Currently the max packet size is 0xFFFF (see 'WFIFOSET()' in 'src/common/socket.
desc:
- Mail send

0x304e
Type: ZI
Structure: <cmd>.W <cid>.L <name>.24B
index: 0,2,6
len: 30
parameter:
- cmd : packet identification (0x304e)
- cid
- name
desc:
- Checks if a character with the given name exists.

0x3050
Type: ZI
Structure: <cmd>.W <len>.W <cid>.L <type>.W <price>.L <page>.W <searchtext>.?B
@@ -1966,14 +1980,15 @@ Currently the max packet size is 0xFFFF (see 'WFIFOSET()' in 'src/common/socket.

0x3848
Type: IZ
Structure: <cmd>.W <size>.W <char_id>.L <flag>.B <md>.?B
index: 0,2,4,8,9
len: variable: 9+md
Structure: <cmd>.W <size>.W <char_id>.L <flag>.B <mail_type>.B <md>.?B
index: 0,2,4,8,9,10
len: variable: 10+md
parameter:
- cmd : packet identification (0x3848)
- size
- char_id
- flag
- mail_type
- md : Mail
desc:
- A player request for mail inbox
@@ -2044,6 +2059,21 @@ Currently the max packet size is 0xFFFF (see 'WFIFOSET()' in 'src/common/socket.
desc:
- Mail sent status (to player if the sender is player and online)

0x384e
Type: IZ
Structure: <cmd>.W <cid_sender>.L <cid_receiver>.L <class>.W <level>.W <name>.24B
index: 0,2,6,10,12,14
len: 38
parameter:
- cmd : packet identification (0x384e)
- cid_sender
- cid_receiver
- class
- level
- name
desc:
- Mail receiver's character data(character id, job, level and name)

0x3850
Type: IZ
Structure: <cmd>.W <size>.W <char_id>.L <count>.W <pages>.W <auction_data>.?B
@@ -6097,6 +6097,12 @@ while hidden then revealing.... you can wonder around =P

---------------------------------------

*unloadnpc "<NPC object name>";

This command will fully unload a NPC object and all of it's duplicates.

---------------------------------------

*doevent "<NPC object name>::<event label>";

This command will start a new execution thread in a specified NPC object at the
@@ -137,3 +137,14 @@ rachel,122,146,0 duplicate(MailBox) Post Box#ra 888
// Veins
//============================================================
veins,218,123,0 duplicate(MailBox) Post Box#ve 888

// RODEX makes these NPCs useless
- script RodexMailBoxInit -1,{
end;

OnInit:
if( PACKETVER >= 20150513 ){
unloadnpc "MailBox";
}
end;
}
@@ -716,35 +716,46 @@ CREATE TABLE IF NOT EXISTS `mail` (
`time` int(11) unsigned NOT NULL default '0',
`status` tinyint(2) NOT NULL default '0',
`zeny` int(11) unsigned NOT NULL default '0',
`nameid` smallint(5) unsigned NOT NULL default '0',
`amount` int(11) unsigned NOT NULL default '0',
`refine` tinyint(3) unsigned NOT NULL default '0',
`attribute` tinyint(4) unsigned NOT NULL default '0',
`identify` smallint(6) NOT NULL default '0',
`card0` smallint(5) unsigned NOT NULL default '0',
`card1` smallint(5) unsigned NOT NULL default '0',
`card2` smallint(5) unsigned NOT NULL default '0',
`card3` smallint(5) unsigned NOT NULL default '0',
`option_id0` smallint(5) unsigned NOT NULL default '0',
`option_val0` smallint(5) unsigned NOT NULL default '0',
`option_parm0` tinyint(3) unsigned NOT NULL default '0',
`option_id1` smallint(5) unsigned NOT NULL default '0',
`option_val1` smallint(5) unsigned NOT NULL default '0',
`option_parm1` tinyint(3) unsigned NOT NULL default '0',
`option_id2` smallint(5) unsigned NOT NULL default '0',
`option_val2` smallint(5) unsigned NOT NULL default '0',
`option_parm2` tinyint(3) unsigned NOT NULL default '0',
`option_id3` smallint(5) unsigned NOT NULL default '0',
`option_val3` smallint(5) unsigned NOT NULL default '0',
`option_parm3` tinyint(3) unsigned NOT NULL default '0',
`option_id4` smallint(5) unsigned NOT NULL default '0',
`option_val4` smallint(5) unsigned NOT NULL default '0',
`option_parm4` tinyint(3) unsigned NOT NULL default '0',
`unique_id` bigint(20) unsigned NOT NULL default '0',
`bound` tinyint(1) unsigned NOT NULL default '0',
`type` smallint(5) NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM;

-- ----------------------------
-- Table structure for `mail_attachments`
-- ----------------------------

CREATE TABLE IF NOT EXISTS `mail_attachments` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`index` smallint(5) unsigned NOT NULL DEFAULT '0',
`nameid` smallint(5) unsigned NOT NULL DEFAULT '0',
`amount` int(11) unsigned NOT NULL DEFAULT '0',
`refine` tinyint(3) unsigned NOT NULL DEFAULT '0',
`attribute` tinyint(4) unsigned NOT NULL DEFAULT '0',
`identify` smallint(6) NOT NULL DEFAULT '0',
`card0` smallint(5) unsigned NOT NULL DEFAULT '0',
`card1` smallint(5) unsigned NOT NULL DEFAULT '0',
`card2` smallint(5) unsigned NOT NULL DEFAULT '0',
`card3` smallint(5) unsigned NOT NULL DEFAULT '0',
`option_id0` smallint(5) unsigned NOT NULL DEFAULT '0',
`option_val0` smallint(5) unsigned NOT NULL DEFAULT '0',
`option_parm0` tinyint(3) unsigned NOT NULL DEFAULT '0',
`option_id1` smallint(5) unsigned NOT NULL DEFAULT '0',
`option_val1` smallint(5) unsigned NOT NULL DEFAULT '0',
`option_parm1` tinyint(3) unsigned NOT NULL DEFAULT '0',
`option_id2` smallint(5) unsigned NOT NULL DEFAULT '0',
`option_val2` smallint(5) unsigned NOT NULL DEFAULT '0',
`option_parm2` tinyint(3) unsigned NOT NULL DEFAULT '0',
`option_id3` smallint(5) unsigned NOT NULL DEFAULT '0',
`option_val3` smallint(5) unsigned NOT NULL DEFAULT '0',
`option_parm3` tinyint(3) unsigned NOT NULL DEFAULT '0',
`option_id4` smallint(5) unsigned NOT NULL DEFAULT '0',
`option_val4` smallint(5) unsigned NOT NULL DEFAULT '0',
`option_parm4` tinyint(3) unsigned NOT NULL DEFAULT '0',
`unique_id` bigint(20) unsigned NOT NULL DEFAULT '0',
`bound` tinyint(1) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id`,`index`)
) ENGINE=MyISAM;

--
-- Table structure for table `mapreg`
--
@@ -0,0 +1,76 @@
-- ----------------------------
-- Table structure for `mail_attachments`
-- ----------------------------

CREATE TABLE IF NOT EXISTS `mail_attachments` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`index` smallint(5) unsigned NOT NULL DEFAULT '0',
`nameid` smallint(5) unsigned NOT NULL DEFAULT '0',
`amount` int(11) unsigned NOT NULL DEFAULT '0',
`refine` tinyint(3) unsigned NOT NULL DEFAULT '0',
`attribute` tinyint(4) unsigned NOT NULL DEFAULT '0',
`identify` smallint(6) NOT NULL DEFAULT '0',
`card0` smallint(5) unsigned NOT NULL DEFAULT '0',
`card1` smallint(5) unsigned NOT NULL DEFAULT '0',
`card2` smallint(5) unsigned NOT NULL DEFAULT '0',
`card3` smallint(5) unsigned NOT NULL DEFAULT '0',
`option_id0` smallint(5) unsigned NOT NULL DEFAULT '0',
`option_val0` smallint(5) unsigned NOT NULL DEFAULT '0',
`option_parm0` tinyint(3) unsigned NOT NULL DEFAULT '0',
`option_id1` smallint(5) unsigned NOT NULL DEFAULT '0',
`option_val1` smallint(5) unsigned NOT NULL DEFAULT '0',
`option_parm1` tinyint(3) unsigned NOT NULL DEFAULT '0',
`option_id2` smallint(5) unsigned NOT NULL DEFAULT '0',
`option_val2` smallint(5) unsigned NOT NULL DEFAULT '0',
`option_parm2` tinyint(3) unsigned NOT NULL DEFAULT '0',
`option_id3` smallint(5) unsigned NOT NULL DEFAULT '0',
`option_val3` smallint(5) unsigned NOT NULL DEFAULT '0',
`option_parm3` tinyint(3) unsigned NOT NULL DEFAULT '0',
`option_id4` smallint(5) unsigned NOT NULL DEFAULT '0',
`option_val4` smallint(5) unsigned NOT NULL DEFAULT '0',
`option_parm4` tinyint(3) unsigned NOT NULL DEFAULT '0',
`unique_id` bigint(20) unsigned NOT NULL DEFAULT '0',
`bound` tinyint(1) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id`,`index`)
) ENGINE=MyISAM;

insert into `mail_attachments`
(`id`,`index`,`nameid`,`amount`,`refine`,`attribute`,`identify`,`card0`,`card1`,`card2`,`card3`,`option_id0`,`option_val0`,`option_parm0`,`option_id1`,`option_val1`,`option_parm1`,`option_id2`,`option_val2`,`option_parm2`,`option_id3`,`option_val3`,`option_parm3`,`option_id4`,`option_val4`,`option_parm4`,`unique_id`,`bound`)
select
`id`,'0',`nameid`,`amount`,`refine`,`attribute`,`identify`,`card0`,`card1`,`card2`,`card3`,`option_id0`,`option_val0`,`option_parm0`,`option_id1`,`option_val1`,`option_parm1`,`option_id2`,`option_val2`,`option_parm2`,`option_id3`,`option_val3`,`option_parm3`,`option_id4`,`option_val4`,`option_parm4`,`unique_id`,`bound`
from `mail`
where `nameid` <> 0;

alter table `mail`
drop column `nameid`,
drop column `amount`,
drop column `refine`,
drop column `attribute`,
drop column `identify`,
drop column `card0`,
drop column `card1`,
drop column `card2`,
drop column `card3`,
drop column `option_id0`,
drop column `option_val0`,
drop column `option_parm0`,
drop column `option_id1`,
drop column `option_val1`,
drop column `option_parm1`,
drop column `option_id2`,
drop column `option_val2`,
drop column `option_parm2`,
drop column `option_id3`,
drop column `option_val3`,
drop column `option_parm3`,
drop column `option_id4`,
drop column `option_val4`,
drop column `option_parm4`,
drop column `unique_id`,
drop column `bound`;

alter table `mail`
modify `message` varchar(500) NOT NULL default '';

ALTER TABLE `mail`
ADD COLUMN `type` smallint(5) NOT NULL default '0';

1 comment on commit 58776da

@RadianFord
Copy link
Contributor

@RadianFord RadianFord commented on 58776da Jun 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I receive some warnings while compiling on Ubuntu 16.04.2 x64

int_mail.c: In function ‘mapif_parse_Mail_send’:
int_mail.c:541:9: warning: variable ‘account_id’ set but not used [-Wunused-but-set-variable]
  uint32 account_id = 0;
         ^
        CC      int_mercenary.c
        CC      int_party.c
        CC      int_pet.c
        CC      int_quest.c
        CC      int_storage.c
        LD      char-server
make[1]: Leaving directory '/home/wickedro/wickedz/src/char'
make[1]: Entering directory '/home/wickedro/wickedz/src/map'
        MKDIR   obj
        CC      atcommand.c
        CC      battle.c
        CC      battleground.c
        CC      buyingstore.c
        CC      cashshop.c
        CC      channel.c
        CC      chat.c
        CC      chrif.c
        CC      clan.c
        CC      clif.c
clif.c: In function ‘clif_parse_Mail_read’:
clif.c:15423:8: warning: unused variable ‘openType’ [-Wunused-variable]
  uint8 openType = RFIFOB(fd, 2);
        ^
clif.c: In function ‘clif_parse_Mail_getattach’:
clif.c:15509:7: warning: unused variable ‘fail’ [-Wunused-variable]
  bool fail = false;
       ^
clif.c: In function ‘clif_parse_Mail_delete’:
clif.c:15612:6: warning: unused variable ‘openType’ [-Wunused-variable]
  int openType = RFIFOB(fd, 2);
      ^
        CC      date.c
        CC      duel.c
        CC      elemental.c
        CC      guild.c
        CC      homunculus.c
        CC      instance.c
In file included from instance.c:13:0:
clif.h:879:59: warning: ‘struct mail_message’ declared inside parameter list
 void clif_mail_delete(struct map_session_data* sd, struct mail_message *msg, bo
                                                           ^
clif.h:879:59: warning: its scope is only this definition or declaration, which is probably not what you want
clif.h:883:62: warning: ‘enum mail_inbox_type’ declared inside parameter list
 void clif_Mail_refreshinbox(struct map_session_data *sd,enum mail_inbox_type ty
                                                              ^
clif.h:884:104: warning: ‘enum mail_attachment_type’ declared inside parameter list
  map_session_data* sd, struct mail_message *msg, uint8 result, enum mail_attach
                                                                     ^
clif.h:884:104: warning: ‘struct mail_message’ declared inside parameter list
        CC      intif.c
        CC      itemdb.c
        CC      log.c
        CC      mail.c
        CC      map.c
        CC      mapreg.c
        CC      mercenary.c
        CC      mob.c
        CC      npc.c
        CC      npc_chat.c
        CC      party.c
        CC      path.c
        CC      pc.c
        CC      pc_groups.c
        CC      pet.c
        CC      quest.c
        CC      script.c
        CC      searchstore.c
        CC      skill.c
        CC      status.c
        CC      storage.c
        CC      trade.c
In file included from trade.c:6:0:
clif.h:879:59: warning: ‘struct mail_message’ declared inside parameter list
 void clif_mail_delete(struct map_session_data* sd, struct mail_message *msg, bo
                                                           ^
clif.h:879:59: warning: its scope is only this definition or declaration, which is probably not what you want
clif.h:883:62: warning: ‘enum mail_inbox_type’ declared inside parameter list
 void clif_Mail_refreshinbox(struct map_session_data *sd,enum mail_inbox_type ty
                                                              ^
clif.h:884:104: warning: ‘enum mail_attachment_type’ declared inside parameter list
  map_session_data* sd, struct mail_message *msg, uint8 result, enum mail_attach
                                                                     ^
clif.h:884:104: warning: ‘struct mail_message’ declared inside parameter list
        CC      unit.c
        CC      vending.c
In file included from vending.c:8:0:
clif.h:879:59: warning: ‘struct mail_message’ declared inside parameter list
 void clif_mail_delete(struct map_session_data* sd, struct mail_message *msg, bo
                                                           ^
clif.h:879:59: warning: its scope is only this definition or declaration, which is probably not what you want
clif.h:883:62: warning: ‘enum mail_inbox_type’ declared inside parameter list
 void clif_Mail_refreshinbox(struct map_session_data *sd,enum mail_inbox_type ty
                                                              ^
clif.h:884:104: warning: ‘enum mail_attachment_type’ declared inside parameter list
  map_session_data* sd, struct mail_message *msg, uint8 result, enum mail_attach
                                                                     ^
clif.h:884:104: warning: ‘struct mail_message’ declared inside parameter list

Please sign in to comment.