// 打開收信夾 ?封信件顯示標題 public S_Mail(L1PcInstance pc, int type) { List<L1Mail> mails = Lists.newList(); MailTable.getInstance(); for (L1Mail mail : MailTable.getAllMail()) { if (mail.getInBoxId() == pc.getId()) { if (mail.getType() == type) { mails.add(mail); } } } writeC(Opcodes.S_OPCODE_MAIL); writeC(type); writeH(mails.size()); if (mails.isEmpty()) { return; } for (int i = 0; i < mails.size(); i++) { L1Mail mail = mails.get(i); writeD(mail.getId()); writeC(mail.getReadStatus()); writeD((int) (mail.getDate().getTime() / 1000)); writeC(mail.getSenderName().equalsIgnoreCase(pc.getName()) ? 1 : 0); // 寄件/備份 writeS( mail.getSenderName().equalsIgnoreCase(pc.getName()) ? mail.getReceiverName() : mail.getSenderName()); writeByte(mail.getSubject()); } }
/** * <b>寄出信件</b> * * @param pc 寄出信件: 寄信人 , 寄件備份: 收信人<br> * @param isDraft 是否是寄件備份 ? true:備份 , false:寄出 */ public S_Mail(L1PcInstance pc, int mailId, boolean isDraft) { MailTable.getInstance(); L1Mail mail = MailTable.getMail(mailId); writeC(Opcodes.S_OPCODE_MAIL); writeC(0x50); writeD(mailId); writeC(isDraft ? 1 : 0); writeS(pc.getName()); writeByte(mail.getSubject()); }
/** * //讀取一般信件 [Server] opcode = 48 0000: [30] [10] [29 00 00 00] [32 00] 00 00 a4 cb 00 03 08 00 * 0.)...2......... * * <p>//信件存到保管箱 [Server] opcode = 48 0000: [30] [40] [2b 00 00 00] [01] 95 */ public S_Mail(int mailId, int type) { // 刪除信件 // 0x30: 刪除一般 0x31:刪除血盟 0x32:一般存到保管箱 0x40:刪除保管箱 if ((type == 0x30) || (type == 0x31) || (type == 0x32) || (type == 0x40)) { writeC(Opcodes.S_OPCODE_MAIL); writeC(type); writeD(mailId); writeC(1); return; } MailTable.getInstance(); L1Mail mail = MailTable.getMail(mailId); if (mail != null) { writeC(Opcodes.S_OPCODE_MAIL); writeC(type); writeD(mail.getId()); writeByte(mail.getContent()); } }