summaryrefslogtreecommitdiff
path: root/src/map/mail.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/mail.c')
-rw-r--r--src/map/mail.c60
1 files changed, 42 insertions, 18 deletions
diff --git a/src/map/mail.c b/src/map/mail.c
index 5e102755d..0e03a3265 100644
--- a/src/map/mail.c
+++ b/src/map/mail.c
@@ -1,5 +1,6 @@
// Mail System for eAthena SQL
// Created by Valaris
+// moved all strings to msg_athena.conf [Lupus]
#include <stdio.h>
#include <stdlib.h>
@@ -20,6 +21,7 @@ char mail_db[32] = "mail";
int MAIL_CHECK_TIME = 120000;
int mail_timer;
+extern char msg_table[1000][256]; // Server messages (0-499 reserved for GM commands, 500-999 reserved for others)
#ifdef MEMWATCH
#include "memwatch.h"
@@ -43,7 +45,9 @@ int mail_check(struct map_session_data *sd,int type)
mail_res = mysql_store_result(&mail_handle);
if(mail_res) {
if (mysql_num_rows(mail_res) == 0) {
- clif_displaymessage(sd->fd,"You have no messages.");
+ //clif_displaymessage(sd->fd,"You have no messages.");
+ clif_displaymessage(sd->fd,msg_table[516]);
+
mysql_free_result(mail_res);
return 0;
}
@@ -64,19 +68,23 @@ int mail_check(struct map_session_data *sd,int type)
priority++;
if(type==2 || type==3) {
if(atoi(mail_row[4])) {
- sprintf(message, "%d - From : %s (New - Priority)", i, mail_row[2]);
+ //sprintf(message, "%d - From : %s (New - Priority)", i, mail_row[2]);
+ sprintf(message, msg_table[511], i, mail_row[2]);
+
clif_displaymessage(sd->fd, message);
}
else {
- sprintf(message, "%d - From : %s (New)", i, mail_row[2]);
+ //sprintf(message, "%d - From : %s (New)", i, mail_row[2]);
+ sprintf(message, msg_table[512], i, mail_row[2]);
clif_displaymessage(sd->fd, message);
}
}
}
else if(type==2){
- sprintf(message, "%d - From : %s", i, mail_row[2]);
+ //sprintf(message, "%d - From : %s", i, mail_row[2]);
+ sprintf(message, msg_table[513], i, mail_row[2]);
clif_displaymessage(sd->fd, message);
}
@@ -90,15 +98,19 @@ int mail_check(struct map_session_data *sd,int type)
}
if(i>0 && new>0 && type==1) {
- sprintf(message, "You have %d new messages.", new);
+ //sprintf(message, "You have %d new messages.", new);
+ sprintf(message, msg_table[514], new);
+
clif_displaymessage(sd->fd, message);
}
if(i>0 && new>0 && priority>0 && type==1) {
- sprintf(message, "You have %d unread priority messages.", priority);
+ //sprintf(message, "You have %d unread priority messages.", priority);
+ sprintf(message, msg_table[515], priority);
clif_displaymessage(sd->fd, message);
}
if(!new) {
- clif_displaymessage(sd->fd, "You have no new messages.");
+ //clif_displaymessage(sd->fd, "You have no new messages.");
+ clif_displaymessage(sd->fd, msg_table[516]);
}
return 0;
@@ -123,7 +135,8 @@ int mail_read(struct map_session_data *sd, int message_id)
if(mail_res) {
if (mysql_num_rows(mail_res) == 0) {
mysql_free_result(mail_res);
- clif_displaymessage(sd->fd, "Message not found.");
+ //clif_displaymessage(sd->fd, "Message not found.");
+ clif_displaymessage(sd->fd, msg_table[517]);
return 0;
}
@@ -136,7 +149,8 @@ int mail_read(struct map_session_data *sd, int message_id)
}
}
- sprintf(message, "Reading message from %s", mail_row[2]);
+ //sprintf(message, "Reading message from %s", mail_row[2]);
+ sprintf(message, msg_table[518], mail_row[2]);
clif_displaymessage(sd->fd, message);
sprintf(message, "%s", mail_row[3]);
@@ -174,19 +188,23 @@ int mail_delete(struct map_session_data *sd, int message_id)
if(mail_res) {
if (mysql_num_rows(mail_res) == 0) {
mysql_free_result(mail_res);
- clif_displaymessage(sd->fd, "Message not found.");
+ //clif_displaymessage(sd->fd, "Message not found.");
+ clif_displaymessage(sd->fd, msg_table[517]);
return 0;
}
if ((mail_row = mysql_fetch_row(mail_res))) {
if(!atoi(mail_row[2]) && atoi(mail_row[3])) {
mysql_free_result(mail_res);
- clif_displaymessage(sd->fd,"Cannot delete unread priority mail.");
+ //clif_displaymessage(sd->fd,"Cannot delete unread priority mail.");
+ clif_displaymessage(sd->fd,msg_table[519]);
+
return 0;
}
if(!atoi(mail_row[4])) {
mysql_free_result(mail_res);
- clif_displaymessage(sd->fd,"You have recieved new mail, use @listmail before deleting.");
+ //clif_displaymessage(sd->fd,"You have recieved new mail, use @listmail before deleting.");
+ clif_displaymessage(sd->fd,msg_table[520]);
return 0;
}
sprintf(tmp_msql,"DELETE FROM `%s` WHERE `message_id` = \"%d\"", mail_db, atoi(mail_row[0]));
@@ -195,7 +213,8 @@ int mail_delete(struct map_session_data *sd, int message_id)
printf("DB server Error (update Read `%s`)- %s\n", mail_db, mysql_error(&mail_handle) );
return 0;
}
- else clif_displaymessage(sd->fd,"Message deleted.");
+ //else clif_displaymessage(sd->fd,"Message deleted.");
+ else clif_displaymessage(sd->fd,msg_table[521]);
}
mysql_free_result(mail_res);
@@ -214,13 +233,15 @@ int mail_send(struct map_session_data *sd, char *name, char *message, int flag)
return 0;
if(pc_isGM(sd) < 80 && sd->mail_counter > 0) {
- clif_displaymessage(sd->fd,"You must wait 10 minutes before sending another message");
+ //clif_displaymessage(sd->fd,"You must wait 10 minutes before sending another message");
+ clif_displaymessage(sd->fd,msg_table[522]);
return 0;
}
if(strcmp(name,"*")==0) {
if(pc_isGM(sd) < 80) {
- clif_displaymessage(sd->fd, "Access Denied.");
+ //clif_displaymessage(sd->fd, "Access Denied.");
+ clif_displaymessage(sd->fd, msg_table[523]);
return 0;
}
else
@@ -238,7 +259,8 @@ int mail_send(struct map_session_data *sd, char *name, char *message, int flag)
if(mail_res) {
if (mysql_num_rows(mail_res) == 0) {
mysql_free_result(mail_res);
- clif_displaymessage(sd->fd,"Character does not exist.");
+ //clif_displaymessage(sd->fd,"Character does not exist.");
+ clif_displaymessage(sd->fd,msg_table[524]);
return 0;
}
@@ -263,7 +285,8 @@ int mail_send(struct map_session_data *sd, char *name, char *message, int flag)
}
}
- clif_displaymessage(sd->fd,"Mail has been sent.");
+ //clif_displaymessage(sd->fd,"Mail has been sent.");
+ clif_displaymessage(sd->fd,msg_table[525]);
return 0;
}
@@ -300,7 +323,8 @@ int mail_check_timer(int tid,unsigned int tick,int id,int data)
if(pc_isGM(sd) < 80 && sd->mail_counter > 0)
sd->mail_counter--;
if(sd->status.account_id==atoi(mail_row[0]))
- clif_displaymessage(sd->fd, "You have new mail.");
+ //clif_displaymessage(sd->fd, "You have new mail.");
+ clif_displaymessage(sd->fd, msg_table[526]);
}
}
}