- More official way of auction mails.

- Added a new condition in mail. If sender_id = 0 you just can't return that mail.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@12313 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
zephyrus 2008-03-07 02:37:47 +00:00
parent 2fda0f2d90
commit df249eaed2
2 changed files with 8 additions and 9 deletions

View File

@ -122,22 +122,21 @@ static int auction_end_timer(int tid, unsigned int tick, int id, int data)
struct mail_message msg; struct mail_message msg;
memset(&msg, 0, sizeof(struct mail_message)); memset(&msg, 0, sizeof(struct mail_message));
msg.send_id = auction->seller_id; msg.send_id = 0;
safestrncpy(msg.send_name, auction->seller_name, NAME_LENGTH); safestrncpy(msg.send_name, "Auction Manager", NAME_LENGTH);
safestrncpy(msg.title, "Auction", MAIL_TITLE_LENGTH);
msg.timestamp = (unsigned int)calc_times(); msg.timestamp = (unsigned int)calc_times();
if( auction->buyer_id ) if( auction->buyer_id )
{ // Send item to Buyer's Mail (custom messages) { // Send item to Buyer's Mail (custom messages)
msg.dest_id = auction->buyer_id; msg.dest_id = auction->buyer_id;
safestrncpy(msg.dest_name, auction->buyer_name, NAME_LENGTH); safestrncpy(msg.dest_name, auction->buyer_name, NAME_LENGTH);
safestrncpy(msg.title, "[Auction Winner] Your Item", MAIL_TITLE_LENGTH);
safestrncpy(msg.body, "Thanks, you won the auction!.", MAIL_BODY_LENGTH); safestrncpy(msg.body, "Thanks, you won the auction!.", MAIL_BODY_LENGTH);
} }
else else
{ // Return item to Seller's Mail (custom messages) { // Return item to Seller's Mail (custom messages)
msg.dest_id = auction->seller_id; msg.dest_id = auction->seller_id;
safestrncpy(msg.dest_name, auction->seller_name, NAME_LENGTH); safestrncpy(msg.dest_name, auction->seller_name, NAME_LENGTH);
safestrncpy(msg.title, "[Auction Fail] Your Item", MAIL_TITLE_LENGTH);
safestrncpy(msg.body, "Sorry, No one buy your item...", MAIL_BODY_LENGTH); safestrncpy(msg.body, "Sorry, No one buy your item...", MAIL_BODY_LENGTH);
} }
@ -150,16 +149,16 @@ static int auction_end_timer(int tid, unsigned int tick, int id, int data)
{ // Send Money to Seller { // Send Money to Seller
memset(&msg, 0, sizeof(struct mail_message)); memset(&msg, 0, sizeof(struct mail_message));
msg.send_id = auction->buyer_id; msg.send_id = 0;
safestrncpy(msg.send_name, auction->buyer_name, NAME_LENGTH); safestrncpy(msg.send_name, "Auction Manager", NAME_LENGTH);
msg.dest_id = auction->seller_id; msg.dest_id = auction->seller_id;
safestrncpy(msg.dest_name, auction->seller_name, NAME_LENGTH); safestrncpy(msg.dest_name, auction->seller_name, NAME_LENGTH);
msg.timestamp = (unsigned int)calc_times(); msg.timestamp = (unsigned int)calc_times();
msg.zeny = auction->price; msg.zeny = auction->price;
// Custom Messages, need more info // Custom Messages, need more info
safestrncpy(msg.title, "[Auction] Your Zeny", MAIL_TITLE_LENGTH); safestrncpy(msg.title, "Auction", MAIL_TITLE_LENGTH);
safestrncpy(msg.body, "Thanks, you won the auction!.", MAIL_BODY_LENGTH); safestrncpy(msg.body, "Here is the money from your Auction.", MAIL_BODY_LENGTH);
mail_savemessage(&msg); mail_savemessage(&msg);
mapif_Mail_new(&msg); mapif_Mail_new(&msg);

View File

@ -11615,7 +11615,7 @@ void clif_parse_Mail_return(int fd, struct map_session_data *sd)
return; 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 && sd->mail.inbox.msg[i].send_id != 0 )
intif_Mail_return(sd->status.char_id, mail_id); intif_Mail_return(sd->status.char_id, mail_id);
else else
clif_Mail_return(sd->fd, mail_id, 1); clif_Mail_return(sd->fd, mail_id, 1);