-Releasing Multilanguage support tid:80352 hx to Lilith and all other contributors

No other langage is enable by default, change LANG_ENABLE in msg_conf.h
-- Add 2 new atcommand :
@langtype to switch over langages
@reloadmsgconf to reload the db
Langage choosen is account wide, not reseted by default on relog.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@17251 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
glighta 2013-04-12 03:50:16 +00:00
parent 67f080a485
commit bba1db77e0
43 changed files with 7254 additions and 1231 deletions

View File

@ -63,10 +63,13 @@ import:
# 1) create conf/import folder
# 2) add missing files
# 3) remove remaining .svn folder
@echo "building conf/import folder..."
@echo "building conf/import and conf/msg_conf/import folder..."
@if test ! -d conf/import ; then mkdir conf/import ; fi
@for f in $$(ls conf/import-tmpl) ; do if test ! -e conf/import/$$f ; then cp conf/import-tmpl/$$f conf/import ; fi ; done
@rm -rf conf/import/.svn
@if test ! -d conf/msg_conf/import ; then mkdir conf/msg_conf/import ; fi
@for f in $$(ls conf/msg_conf/import-tmpl) ; do if test ! -e conf/msg_conf/import/$$f ; then cp conf/msg_conf/import-tmpl/$$f conf/msg_conf/import ; fi ; done
@rm -rf conf/msg_conf/import/.svn
clean:
@$(MAKE) -C src/common $@

View File

@ -0,0 +1 @@

View File

@ -0,0 +1 @@

View File

@ -0,0 +1 @@

View File

@ -0,0 +1,2 @@
t

View File

@ -0,0 +1 @@

View File

@ -0,0 +1 @@

View File

@ -0,0 +1 @@

View File

@ -0,0 +1 @@

View File

@ -443,6 +443,12 @@
// Homunculus messages
450: You already have a homunculus
//msg sys
460: Unknow syntaxe, usage : @langtype eng|rus|spn|chn|mal|ind|frn
461: Langtype is now = %s=>%d
462: The choosen langage is currently disable please choose another
463: Msg_conf have been reloaded
// Messages of others (not for GM commands)
// ----------------------------------------
@ -1452,4 +1458,4 @@
1435: You're now in the '#%s' channel for '%s'.
//Custom translations
import: conf/import/msg_conf.txt
//import: conf/msg_conf/import/map_msg_eng_conf.txt

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -5124,14 +5124,14 @@ int do_init(int argc, char **argv)
mapindex_init();
start_point.map = mapindex_name2id("new_zone01");
CHAR_CONF_NAME = "conf/char_athena.conf";
LAN_CONF_NAME = "conf/subnet_athena.conf";
SQL_CONF_NAME = "conf/inter_athena.conf";
MSG_CONF_NAME = "conf/msg_conf/char_msg.conf";
CHAR_CONF_NAME = "conf/char_athena.conf";
LAN_CONF_NAME = "conf/subnet_athena.conf";
SQL_CONF_NAME = "conf/inter_athena.conf";
MSG_CONF_NAME_EN = "conf/msg_conf/char_msg.conf";
cli_get_options(argc,argv);
msg_config_read(MSG_CONF_NAME);
msg_config_read(MSG_CONF_NAME_EN);
char_config_read(CHAR_CONF_NAME);
char_lan_config_read(LAN_CONF_NAME);
sql_config_read(SQL_CONF_NAME);

View File

@ -21,7 +21,7 @@ char* SQL_CONF_NAME;
char* LOGIN_CONF_NAME;
//common
char* LAN_CONF_NAME; //char-login
char* MSG_CONF_NAME; //all
char* MSG_CONF_NAME_EN; //all
bool opt_has_next_value(const char* option, int i, int argc)
{
@ -64,7 +64,7 @@ int cli_get_options(int argc, char ** argv)
display_versionscreen(true);
} else if (strcmp(arg, "msg-config") == 0) {
if (opt_has_next_value(arg, i, argc))
MSG_CONF_NAME = argv[++i];
MSG_CONF_NAME_EN = argv[++i];
} else if (strcmp(arg, "run-once") == 0) // close the map-server as soon as its done.. for testing [Celest]
{
runflag = CORE_ST_STOP;

View File

@ -27,7 +27,7 @@ extern "C" {
extern char* LOGIN_CONF_NAME;
//common
extern char* LAN_CONF_NAME; //char-login
extern char* MSG_CONF_NAME; //all
extern char* MSG_CONF_NAME_EN; //all
extern void display_helpscreen(bool exit);
int cli_get_options(int argc, char ** argv);

View File

@ -24,42 +24,42 @@ const char* _msg_txt(int msg_number,int size, char ** msg_table)
*------------------------------------------*/
int _msg_config_read(const char* cfgName,int size, char ** msg_table)
{
int msg_number;
char line[1024], w1[1024], w2[1024];
FILE *fp;
static int called = 1;
int msg_number;
char line[1024], w1[1024], w2[1024];
FILE *fp;
static int called = 1;
if ((fp = fopen(cfgName, "r")) == NULL) {
ShowError("Messages file not found: %s\n", cfgName);
return 1;
}
if ((--called) == 0)
memset(msg_table, 0, sizeof (msg_table[0]) * size);
while (fgets(line, sizeof (line), fp)) {
if (line[0] == '/' && line[1] == '/')
continue;
if (sscanf(line, "%[^:]: %[^\r\n]", w1, w2) != 2)
continue;
if (strcmpi(w1, "import") == 0)
_msg_config_read(w2,size,msg_table);
else {
msg_number = atoi(w1);
if (msg_number >= 0 && msg_number < size) {
if (msg_table[msg_number] != NULL)
aFree(msg_table[msg_number]);
msg_table[msg_number] = (char *) aMalloc((strlen(w2) + 1) * sizeof (char));
strcpy(msg_table[msg_number], w2);
}
if ((fp = fopen(cfgName, "r")) == NULL) {
ShowError("Messages file not found: %s\n", cfgName);
return -1;
}
}
fclose(fp);
ShowInfo("Finished reading %s.\n",cfgName);
if ((--called) == 0)
memset(msg_table, 0, sizeof (msg_table[0]) * size);
return 0;
while (fgets(line, sizeof (line), fp)) {
if (line[0] == '/' && line[1] == '/')
continue;
if (sscanf(line, "%[^:]: %[^\r\n]", w1, w2) != 2)
continue;
if (strcmpi(w1, "import") == 0)
_msg_config_read(w2,size,msg_table);
else {
msg_number = atoi(w1);
if (msg_number >= 0 && msg_number < size) {
if (msg_table[msg_number] != NULL)
aFree(msg_table[msg_number]);
msg_table[msg_number] = (char *) aMalloc((strlen(w2) + 1) * sizeof (char));
strcpy(msg_table[msg_number], w2);
}
}
}
fclose(fp);
ShowInfo("Finished reading %s.\n",cfgName);
return 0;
}
/*==========================================
@ -70,3 +70,39 @@ void _do_final_msg(int size, char ** msg_table){
for (i = 0; i < size; i++)
aFree(msg_table[i]);
}
/*
* lookup a langtype string into his associate langtype number
* return -1 if not found
*/
int msg_langstr2langtype(char * langtype){
int lang=-1;
if(!strncmp(langtype, "eng",2)) lang=0;
else if (!strncmp(langtype, "rus",2)) lang = 1;
else if (!strncmp(langtype, "spn",2)) lang = 2;
else if (!strncmp(langtype, "grm",2)) lang = 3;
else if (!strncmp(langtype, "chn",2)) lang = 4;
else if (!strncmp(langtype, "mal",2)) lang = 5;
else if (!strncmp(langtype, "idn",2)) lang = 6;
else if (!strncmp(langtype, "frn",2)) lang = 7;
return lang;
}
/*
* verify that the choosen langtype is enable
* return
* 1 : langage enable
* -1 : false range
* -2 : disable
*/
int msg_checklangtype(int lang, bool display){
uint16 test=1;
if(!lang) return 1; //default english
else if(lang < 0 && (test<<(lang-1)) > LANG_MAX ) return -1; //false range
else if (LANG_ENABLE&(test<<(lang-1)) ) return 1;
else if(display) {
ShowDebug("Unsuported langtype=%d\n",lang);
}
return -2;
}

View File

@ -8,9 +8,26 @@
extern "C" {
#endif
enum lang_types {
LANG_RUS = 0x01,
LANG_SPN = 0x02,
LANG_GRM = 0x04,
LANG_CHN = 0x08,
LANG_MAL = 0x10,
LANG_IND = 0x20,
LANG_FRN = 0x40,
LANG_MAX
};
// What languages are enabled? bitmask FF mean all
//#define LANG_ENABLE 0xFF
#define LANG_ENABLE 0x00
const char* _msg_txt(int msg_number,int size, char ** msg_table);
int _msg_config_read(const char* cfgName,int size, char ** msg_table);
void _do_final_msg(int size, char ** msg_table);
int msg_langstr2langtype(char * langtype);
//verify that the choosen langtype is enable
int msg_checklangtype(int lang, bool display);
#ifdef __cplusplus
}

View File

@ -553,9 +553,9 @@ int parse_fromchar(int fd){
char birthdate[10+1] = "";
char pincode[PINCODE_LENGTH+1];
int account_id = RFIFOL(fd,2);
memset(pincode,0,PINCODE_LENGTH+1);
RFIFOSKIP(fd,6);
if( !accounts->load_num(accounts, &acc, account_id) )
@ -1863,11 +1863,11 @@ int do_init(int argc, char** argv)
LOGIN_CONF_NAME = "conf/login_athena.conf";
LAN_CONF_NAME = "conf/subnet_athena.conf";
MSG_CONF_NAME = "conf/msg_conf/login_msg.conf";
MSG_CONF_NAME_EN = "conf/msg_conf/login_msg.conf";
cli_get_options(argc,argv);
msg_config_read(MSG_CONF_NAME);
msg_config_read(MSG_CONF_NAME_EN);
login_config_read(LOGIN_CONF_NAME);
login_lan_config_read(LAN_CONF_NAME);

File diff suppressed because it is too large Load Diff

View File

@ -58,13 +58,13 @@ bool buyingstore_setup(struct map_session_data* sd, unsigned char slots)
if( map[sd->bl.m].flag.novending )
{// custom: no vending maps
clif_displaymessage(sd->fd, msg_txt(276)); // "You can't open a shop on this map"
clif_displaymessage(sd->fd, msg_txt(sd,276)); // "You can't open a shop on this map"
return false;
}
if( map_getcell(sd->bl.m, sd->bl.x, sd->bl.y, CELL_CHKNOVENDING) )
{// custom: no vending cells
clif_displaymessage(sd->fd, msg_txt(204)); // "You can't open a shop on this cell."
clif_displaymessage(sd->fd, msg_txt(sd,204)); // "You can't open a shop on this cell."
return false;
}
@ -101,7 +101,7 @@ void buyingstore_create(struct map_session_data* sd, int zenylimit, unsigned cha
if( !pc_can_give_items(sd) )
{// custom: GM is not allowed to buy (give zeny)
sd->buyingstore.slots = 0;
clif_displaymessage(sd->fd, msg_txt(246));
clif_displaymessage(sd->fd, msg_txt(sd,246));
clif_buyingstore_open_failed(sd, BUYINGSTORE_CREATE, 0);
return;
}
@ -113,13 +113,13 @@ void buyingstore_create(struct map_session_data* sd, int zenylimit, unsigned cha
if( map[sd->bl.m].flag.novending )
{// custom: no vending maps
clif_displaymessage(sd->fd, msg_txt(276)); // "You can't open a shop on this map"
clif_displaymessage(sd->fd, msg_txt(sd,276)); // "You can't open a shop on this map"
return;
}
if( map_getcell(sd->bl.m, sd->bl.x, sd->bl.y, CELL_CHKNOVENDING) )
{// custom: no vending cells
clif_displaymessage(sd->fd, msg_txt(204)); // "You can't open a shop on this cell."
clif_displaymessage(sd->fd, msg_txt(sd,204)); // "You can't open a shop on this cell."
return;
}
@ -221,7 +221,7 @@ void buyingstore_open(struct map_session_data* sd, int account_id)
if( !pc_can_give_items(sd) )
{// custom: GM is not allowed to sell
clif_displaymessage(sd->fd, msg_txt(246));
clif_displaymessage(sd->fd, msg_txt(sd,246));
return;
}
@ -259,7 +259,7 @@ void buyingstore_trade(struct map_session_data* sd, int account_id, unsigned int
if( !pc_can_give_items(sd) )
{// custom: GM is not allowed to sell
clif_displaymessage(sd->fd, msg_txt(246));
clif_displaymessage(sd->fd, msg_txt(sd,246));
clif_buyingstore_trade_failed_seller(sd, BUYINGSTORE_TRADE_SELLER_FAILED, 0);
return;
}

View File

@ -61,7 +61,7 @@ static struct chat_data* chat_createchat(struct block_list* bl, const char* titl
if( bl->type != BL_NPC )
cd->kick_list = idb_alloc(DB_OPT_BASE);
return cd;
}
@ -83,13 +83,13 @@ int chat_createpcchat(struct map_session_data* sd, const char* title, const char
if( map[sd->bl.m].flag.nochat )
{
clif_displaymessage(sd->fd, msg_txt(281));
clif_displaymessage(sd->fd, msg_txt(sd,281));
return 0; //Can't create chatrooms on this map.
}
if( map_getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKNOCHAT) )
{
clif_displaymessage (sd->fd, msg_txt(665));
clif_displaymessage (sd->fd, msg_txt(sd,665));
return 0;
}
@ -158,10 +158,10 @@ int chat_joinchat(struct map_session_data* sd, int chatid, const char* pass)
pc_setchatid(sd,cd->bl.id);
clif_joinchatok(sd, cd); //To the person who newly joined the list of all
clif_addchat(cd, sd); //Reports To the person who already in the chat
clif_dispchat(cd, 0); //Reported number of changes to the people around
clif_addchat(cd, sd); //Reports To the person who already in the chat
clif_dispchat(cd, 0); //Reported number of changes to the people around
chat_triggerevent(cd); //Event
chat_triggerevent(cd); //Event
return 0;
}
@ -204,14 +204,14 @@ int chat_leavechat(struct map_session_data* sd, bool kicked)
if( cd->users == 0 && cd->owner->type == BL_PC ) { // Delete empty chatroom
struct skill_unit* unit;
struct skill_unit_group* group;
struct skill_unit_group* group;
clif_clearchat(cd, 0);
db_destroy(cd->kick_list);
map_deliddb(&cd->bl);
map_delblock(&cd->bl);
map_freeblock(&cd->bl);
unit = map_find_skill_unit_oncell(&sd->bl, sd->bl.x, sd->bl.y, AL_WARP, NULL, 0);
group = (unit != NULL) ? unit->group : NULL;
if (group != NULL)
@ -318,7 +318,7 @@ int chat_kickchat(struct map_session_data* sd, const char* kickusername)
nullpo_retr(1, sd);
cd = (struct chat_data *)map_id2bl(sd->chatID);
if( cd==NULL || (struct block_list *)sd != cd->owner )
return -1;
@ -328,7 +328,7 @@ int chat_kickchat(struct map_session_data* sd, const char* kickusername)
if (pc_has_permission(cd->usersd[i], PC_PERM_NO_CHAT_KICK))
return 0; //gm kick protection [Valaris]
idb_put(cd->kick_list,cd->usersd[i]->status.char_id,(void*)1);
chat_leavechat(cd->usersd[i],1);
@ -370,14 +370,14 @@ int chat_deletenpcchat(struct npc_data* nd)
cd = (struct chat_data*)map_id2bl(nd->chat_id);
if( cd == NULL )
return 0;
chat_npckickall(cd);
clif_clearchat(cd, 0);
map_deliddb(&cd->bl);
map_delblock(&cd->bl);
map_freeblock(&cd->bl);
nd->chat_id = 0;
return 0;
}

View File

@ -810,7 +810,7 @@ int chrif_changesex(struct map_session_data *sd) {
WFIFOW(char_fd,30) = 5;
WFIFOSET(char_fd,44);
clif_displaymessage(sd->fd, msg_txt(408)); //"Need disconnection to perform change-sex request..."
clif_displaymessage(sd->fd, msg_txt(sd,408)); //"Need disconnection to perform change-sex request..."
if (sd->fd)
clif_authfail_fd(sd->fd, 15);
@ -843,15 +843,15 @@ static void chrif_char_ask_name_answer(int acc, const char* player_name, uint16
}
if( type > 0 && type <= 5 )
snprintf(action,25,"%s",msg_txt(427+type)); //block|ban|unblock|unban|change the sex of
snprintf(action,25,"%s",msg_txt(sd,427+type)); //block|ban|unblock|unban|change the sex of
else
snprintf(action,25,"???");
switch( answer ) {
case 0 : sprintf(output, msg_txt(424), action, NAME_LENGTH, player_name); break;
case 1 : sprintf(output, msg_txt(425), NAME_LENGTH, player_name); break;
case 2 : sprintf(output, msg_txt(426), action, NAME_LENGTH, player_name); break;
case 3 : sprintf(output, msg_txt(427), action, NAME_LENGTH, player_name); break;
case 0 : sprintf(output, msg_txt(sd,424), action, NAME_LENGTH, player_name); break;
case 1 : sprintf(output, msg_txt(sd,425), NAME_LENGTH, player_name); break;
case 2 : sprintf(output, msg_txt(sd,426), action, NAME_LENGTH, player_name); break;
case 3 : sprintf(output, msg_txt(sd,427), action, NAME_LENGTH, player_name); break;
default: output[0] = '\0'; break;
}
@ -907,7 +907,7 @@ int chrif_changedsex(int fd) {
// save character
sd->login_id1++; // change identify, because if player come back in char within the 5 seconds, he can change its characters
// do same modify in login-server for the account, but no in char-server (it ask again login_id1 to login, and don't remember it)
clif_displaymessage(sd->fd, msg_txt(409)); //"Your sex has been changed (need disconnection by the server)..."
clif_displaymessage(sd->fd, msg_txt(sd,409)); //"Your sex has been changed (need disconnection by the server)..."
set_eof(sd->fd); // forced to disconnect for the change
map_quit(sd); // Remove leftovers (e.g. autotrading) [Paradox924X]
}
@ -1001,18 +1001,18 @@ int chrif_accountban(int fd) {
sd->login_id1++; // change identify, because if player come back in char within the 5 seconds, he can change its characters
if (RFIFOB(fd,6) == 0) { // 0: change of statut, 1: ban
int ret_status = RFIFOL(fd,7); // status or final date of a banishment
if(0<ret_status && ret_status<=9)
clif_displaymessage(sd->fd, msg_txt(411+ret_status));
else if(ret_status==100)
clif_displaymessage(sd->fd, msg_txt(421));
else
clif_displaymessage(sd->fd, msg_txt(420)); //"Your account has not more authorised."
int ret_status = RFIFOL(fd,7); // status or final date of a banishment
if(0<ret_status && ret_status<=9)
clif_displaymessage(sd->fd, msg_txt(sd,411+ret_status));
else if(ret_status==100)
clif_displaymessage(sd->fd, msg_txt(sd,421));
else
clif_displaymessage(sd->fd, msg_txt(sd,420)); //"Your account has not more authorised."
} else if (RFIFOB(fd,6) == 1) { // 0: change of statut, 1: ban
time_t timestamp;
char tmpstr[2048];
timestamp = (time_t)RFIFOL(fd,7); // status or final date of a banishment
strcpy(tmpstr, msg_txt(423)); //"Your account has been banished until "
strcpy(tmpstr, msg_txt(sd,423)); //"Your account has been banished until "
strftime(tmpstr + strlen(tmpstr), 24, "%d-%m-%Y %H:%M:%S", localtime(&timestamp));
clif_displaymessage(sd->fd, tmpstr);
}

View File

@ -5572,7 +5572,7 @@ void clif_chsys_mjoin(struct map_session_data *sd) {
if( !( map[sd->bl.m].channel->opt & raChSys_OPT_ANNOUNCE_JOIN ) ) {
char mout[60];
sprintf(mout, msg_txt(1435),raChSys.local_name,map[sd->bl.m].name); // You're now in the '#%s' channel for '%s'.
sprintf(mout, msg_txt(sd,1435),raChSys.local_name,map[sd->bl.m].name); // You're now in the '#%s' channel for '%s'.
clif_disp_onlyself(sd, mout, strlen(mout));
}
}
@ -6655,7 +6655,7 @@ void clif_party_inviteack(struct map_session_data* sd, const char* nick, int res
#if PACKETVER < 20070904
if( result == 7 ) {
clif_displaymessage(fd, msg_txt(3));
clif_displaymessage(fd, msg_txt(sd,3));
return;
}
#endif
@ -6962,7 +6962,7 @@ void clif_sendegg(struct map_session_data *sd)
fd=sd->fd;
if (battle_config.pet_no_gvg && map_flag_gvg(sd->bl.m)) { //Disable pet hatching in GvG grounds during Guild Wars [Skotlex]
clif_displaymessage(fd, msg_txt(666));
clif_displaymessage(fd, msg_txt(sd,666));
return;
}
WFIFOHEAD(fd, MAX_INVENTORY * 2 + 4);
@ -7465,7 +7465,7 @@ void clif_guild_basicinfo(struct map_session_data *sd) {
memcpy(WFIFOP(fd,46),g->name, NAME_LENGTH);
memcpy(WFIFOP(fd,70),g->master, NAME_LENGTH);
safestrncpy((char*)WFIFOP(fd,94),msg_txt(300+guild_checkcastles(g)),16); // "'N' castles"
safestrncpy((char*)WFIFOP(fd,94),msg_txt(sd,300+guild_checkcastles(g)),16); // "'N' castles"
WFIFOL(fd,110) = 0; // zeny
WFIFOSET(fd,packet_len(0x1b6));
@ -9415,7 +9415,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
// pet
if( sd->pd ) {
if( battle_config.pet_no_gvg && map_flag_gvg(sd->bl.m) ) { //Return the pet to egg. [Skotlex]
clif_displaymessage(sd->fd, msg_txt(666));
clif_displaymessage(sd->fd, msg_txt(sd,666));
pet_menu(sd, 3); //Option 3 is return to egg.
} else {
map_addblock(&sd->pd->bl);
@ -10280,7 +10280,7 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd)
clif_chsys_join(channel,sd);
clif_chsys_send(channel,sd,message);
} else {
clif_displaymessage(fd, msg_txt(1402)); //You're not in that channel, type '@join <#channel_name>'
clif_displaymessage(fd, msg_txt(sd,1402)); //You're not in that channel, type '@join <#channel_name>'
}
return;
}
@ -10739,16 +10739,16 @@ void clif_parse_ChatLeave(int fd, struct map_session_data* sd)
//Handles notifying asker and rejecter of what has just ocurred.
//Type is used to determine the correct msg_txt to use:
//0:
static void clif_noask_sub(struct map_session_data *src, struct map_session_data *target, int type)
static void clif_noask_sub(struct map_session_data *sd, struct map_session_data *tsd, int type)
{
const char* msg;
char output[256];
// Your request has been rejected by autoreject option.
msg = msg_txt(392);
clif_disp_onlyself(src, msg, strlen(msg));
msg = msg_txt(sd,392);
clif_disp_onlyself(sd, msg, strlen(msg));
//Notice that a request was rejected.
snprintf(output, 256, msg_txt(393+type), src->status.name, 256);
clif_disp_onlyself(target, output, strlen(output));
snprintf(output, 256, msg_txt(tsd,393+type), sd->status.name, 256);
clif_disp_onlyself(tsd, output, strlen(output));
}
@ -11715,7 +11715,7 @@ void clif_parse_CreateParty(int fd, struct map_session_data *sd)
name[NAME_LENGTH-1] = '\0';
if( map[sd->bl.m].flag.partylock ) {// Party locked.
clif_displaymessage(fd, msg_txt(227));
clif_displaymessage(fd, msg_txt(sd,227));
return;
}
if( battle_config.basic_skill_check && pc_checkskill(sd,NV_BASIC) < 7 ) {
@ -11734,7 +11734,7 @@ void clif_parse_CreateParty2(int fd, struct map_session_data *sd)
name[NAME_LENGTH-1] = '\0';
if( map[sd->bl.m].flag.partylock ) {// Party locked.
clif_displaymessage(fd, msg_txt(227));
clif_displaymessage(fd, msg_txt(sd,227));
return;
}
if( battle_config.basic_skill_check && pc_checkskill(sd,NV_BASIC) < 7 ) {
@ -11754,7 +11754,7 @@ void clif_parse_PartyInvite(int fd, struct map_session_data *sd)
struct map_session_data *t_sd;
if(map[sd->bl.m].flag.partylock) {// Party locked.
clif_displaymessage(fd, msg_txt(227));
clif_displaymessage(fd, msg_txt(sd,227));
return;
}
@ -11775,7 +11775,7 @@ void clif_parse_PartyInvite2(int fd, struct map_session_data *sd)
name[NAME_LENGTH-1] = '\0';
if(map[sd->bl.m].flag.partylock) {// Party locked.
clif_displaymessage(fd, msg_txt(227));
clif_displaymessage(fd, msg_txt(sd,227));
return;
}
@ -11812,7 +11812,7 @@ void clif_parse_ReplyPartyInvite2(int fd,struct map_session_data *sd)
void clif_parse_LeaveParty(int fd, struct map_session_data *sd)
{
if(map[sd->bl.m].flag.partylock) { //Guild locked.
clif_displaymessage(fd, msg_txt(227));
clif_displaymessage(fd, msg_txt(sd,227));
return;
}
party_leave(sd);
@ -11824,7 +11824,7 @@ void clif_parse_LeaveParty(int fd, struct map_session_data *sd)
void clif_parse_RemovePartyMember(int fd, struct map_session_data *sd)
{
if(map[sd->bl.m].flag.partylock) { //Guild locked.
clif_displaymessage(fd, msg_txt(227));
clif_displaymessage(fd, msg_txt(sd,227));
return;
}
party_removemember(sd,RFIFOL(fd,2),(char*)RFIFOP(fd,6));
@ -12145,11 +12145,11 @@ void clif_parse_OpenVending(int fd, struct map_session_data* sd)
if( sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOROOM )
return;
if( map[sd->bl.m].flag.novending ) {
clif_displaymessage (sd->fd, msg_txt(276)); // "You can't open a shop on this map"
clif_displaymessage (sd->fd, msg_txt(sd,276)); // "You can't open a shop on this map"
return;
}
if( map_getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKNOVENDING) ) {
clif_displaymessage (sd->fd, msg_txt(204)); // "You can't open a shop on this cell."
clif_displaymessage (sd->fd, msg_txt(sd,204)); // "You can't open a shop on this cell."
return;
}
@ -12168,7 +12168,7 @@ void clif_parse_CreateGuild(int fd,struct map_session_data *sd)
name[NAME_LENGTH-1] = '\0';
if(map[sd->bl.m].flag.guildlock) { //Guild locked.
clif_displaymessage(fd, msg_txt(228));
clif_displaymessage(fd, msg_txt(sd,228));
return;
}
@ -12333,7 +12333,7 @@ void clif_parse_GuildInvite(int fd,struct map_session_data *sd)
struct map_session_data *t_sd;
if(map[sd->bl.m].flag.guildlock) { //Guild locked.
clif_displaymessage(fd, msg_txt(228));
clif_displaymessage(fd, msg_txt(sd,228));
return;
}
@ -12365,11 +12365,11 @@ void clif_parse_GuildReplyInvite(int fd,struct map_session_data *sd)
void clif_parse_GuildLeave(int fd,struct map_session_data *sd)
{
if(map[sd->bl.m].flag.guildlock) { //Guild locked.
clif_displaymessage(fd, msg_txt(228));
clif_displaymessage(fd, msg_txt(sd,228));
return;
}
if( sd->bg_id ) {
clif_displaymessage(fd, msg_txt(670)); //"You can't leave battleground guilds."
clif_displaymessage(fd, msg_txt(sd,670)); //"You can't leave battleground guilds."
return;
}
@ -12383,7 +12383,7 @@ void clif_parse_GuildExpulsion(int fd,struct map_session_data *sd)
{
if( map[sd->bl.m].flag.guildlock || sd->bg_id )
{ // Guild locked.
clif_displaymessage(fd, msg_txt(228));
clif_displaymessage(fd, msg_txt(sd,228));
return;
}
guild_expulsion(sd,RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),(char*)RFIFOP(fd,14));
@ -12437,7 +12437,7 @@ void clif_parse_GuildRequestAlliance(int fd, struct map_session_data *sd)
return;
if(map[sd->bl.m].flag.guildlock) { //Guild locked.
clif_displaymessage(fd, msg_txt(228));
clif_displaymessage(fd, msg_txt(sd,228));
return;
}
@ -12475,7 +12475,7 @@ void clif_parse_GuildDelAlliance(int fd, struct map_session_data *sd)
return;
if(map[sd->bl.m].flag.guildlock) { //Guild locked.
clif_displaymessage(fd, msg_txt(228));
clif_displaymessage(fd, msg_txt(sd,228));
return;
}
guild_delalliance(sd,RFIFOL(fd,2),RFIFOL(fd,6));
@ -12492,7 +12492,7 @@ void clif_parse_GuildOpposition(int fd, struct map_session_data *sd)
return;
if(map[sd->bl.m].flag.guildlock) { //Guild locked.
clif_displaymessage(fd, msg_txt(228));
clif_displaymessage(fd, msg_txt(sd,228));
return;
}
@ -12516,7 +12516,7 @@ void clif_parse_GuildOpposition(int fd, struct map_session_data *sd)
void clif_parse_GuildBreak(int fd, struct map_session_data *sd)
{
if( map[sd->bl.m].flag.guildlock ) { //Guild locked.
clif_displaymessage(fd, msg_txt(228));
clif_displaymessage(fd, msg_txt(sd,228));
return;
}
guild_break(sd,(char*)RFIFOP(fd,2));
@ -13162,7 +13162,7 @@ void clif_parse_FriendsListAdd(int fd, struct map_session_data *sd)
// Friend doesn't exist (no player with this name)
if (f_sd == NULL) {
clif_displaymessage(fd, msg_txt(3));
clif_displaymessage(fd, msg_txt(sd,3));
return;
}
@ -13179,7 +13179,7 @@ void clif_parse_FriendsListAdd(int fd, struct map_session_data *sd)
// Friend already exists
for (i = 0; i < MAX_FRIENDS && sd->status.friends[i].char_id != 0; i++) {
if (sd->status.friends[i].char_id == f_sd->status.char_id) {
clif_displaymessage(fd, msg_txt(671)); //"Friend already exists."
clif_displaymessage(fd, msg_txt(sd,671)); //"Friend already exists."
return;
}
}
@ -13275,7 +13275,7 @@ void clif_parse_FriendsListRemove(int fd, struct map_session_data *sd)
(sd->status.friends[i].char_id != char_id || sd->status.friends[i].account_id != account_id); i++);
if (i == MAX_FRIENDS) {
clif_displaymessage(fd, msg_txt(672)); //"Name not found in list."
clif_displaymessage(fd, msg_txt(sd,672)); //"Name not found in list."
return;
}
@ -13300,7 +13300,7 @@ void clif_parse_FriendsListRemove(int fd, struct map_session_data *sd)
} else { //friend not online -- ask char server to delete from his friendlist
if(chrif_removefriend(char_id,sd->status.char_id)) { // char-server offline, abort
clif_displaymessage(fd, msg_txt(673)); //"This action can't be performed at the moment. Please try again later."
clif_displaymessage(fd, msg_txt(sd,673)); //"This action can't be performed at the moment. Please try again later."
return;
}
}
@ -13313,7 +13313,7 @@ void clif_parse_FriendsListRemove(int fd, struct map_session_data *sd)
memcpy(&sd->status.friends[j-1], &sd->status.friends[j], sizeof(sd->status.friends[0]));
memset(&sd->status.friends[MAX_FRIENDS-1], 0, sizeof(sd->status.friends[MAX_FRIENDS-1]));
clif_displaymessage(fd, msg_txt(674)); //"Friend removed"
clif_displaymessage(fd, msg_txt(sd,674)); //"Friend removed"
WFIFOHEAD(fd,packet_len(0x20a));
WFIFOW(fd,0) = 0x20a;
@ -14153,7 +14153,7 @@ void clif_parse_Mail_send(int fd, struct map_session_data *sd)
}
if( DIFF_TICK(sd->cansendmail_tick, gettick()) > 0 ) {
clif_displaymessage(sd->fd,msg_txt(675)); //"Cannot send mails too fast!!."
clif_displaymessage(sd->fd,msg_txt(sd,675)); //"Cannot send mails too fast!!."
clif_Mail_send(fd, true); // fail
return;
}
@ -14473,7 +14473,7 @@ void clif_parse_Auction_bid(int fd, struct map_session_data *sd)
int bid = RFIFOL(fd,6);
if( !pc_can_give_items(sd) ) { //They aren't supposed to give zeny [Inkfish]
clif_displaymessage(sd->fd, msg_txt(246));
clif_displaymessage(sd->fd, msg_txt(sd,246));
return;
}

View File

@ -23,10 +23,10 @@ void duel_savetime(struct map_session_data* sd)
{
time_t timer;
struct tm *t;
time(&timer);
t = localtime(&timer);
pc_setglobalreg(sd, "PC_LAST_DUEL_TIME", t->tm_mday*24*60 + t->tm_hour*60 + t->tm_min);
}
@ -35,12 +35,12 @@ int duel_checktime(struct map_session_data* sd)
int diff;
time_t timer;
struct tm *t;
time(&timer);
t = localtime(&timer);
diff = t->tm_mday*24*60 + t->tm_hour*60 + t->tm_min - pc_readglobalreg(sd, "PC_LAST_DUEL_TIME");
return !(diff >= 0 && diff < battle_config.duel_time_interval);
}
static int duel_showinfo_sub(struct map_session_data* sd, va_list va)
@ -50,7 +50,7 @@ static int duel_showinfo_sub(struct map_session_data* sd, va_list va)
char output[256];
if (sd->duel_group != ssd->duel_group) return 0;
sprintf(output, " %d. %s", ++(*p), sd->status.name);
clif_disp_onlyself(ssd, output, strlen(output));
return 1;
@ -62,13 +62,13 @@ void duel_showinfo(const unsigned int did, struct map_session_data* sd)
char output[256];
if(duel_list[did].max_players_limit > 0)
sprintf(output, msg_txt(370), //" -- Duels: %d/%d, Members: %d/%d, Max players: %d --"
sprintf(output, msg_txt(sd,370), //" -- Duels: %d/%d, Members: %d/%d, Max players: %d --"
did, duel_count,
duel_list[did].members_count,
duel_list[did].members_count + duel_list[did].invites_count,
duel_list[did].max_players_limit);
else
sprintf(output, msg_txt(371), //" -- Duels: %d/%d, Members: %d/%d --"
sprintf(output, msg_txt(sd,371), //" -- Duels: %d/%d, Members: %d/%d --"
did, duel_count,
duel_list[did].members_count,
duel_list[did].members_count + duel_list[did].invites_count);
@ -81,19 +81,19 @@ int duel_create(struct map_session_data* sd, const unsigned int maxpl)
{
int i=1;
char output[256];
while(duel_list[i].members_count > 0 && i < MAX_DUEL) i++;
if(i == MAX_DUEL) return 0;
duel_count++;
sd->duel_group = i;
duel_list[i].members_count++;
duel_list[i].invites_count = 0;
duel_list[i].max_players_limit = maxpl;
strcpy(output, msg_txt(372)); // " -- Duel has been created (@invite/@leave) --"
strcpy(output, msg_txt(sd,372)); // " -- Duel has been created (@invite/@leave) --"
clif_disp_onlyself(sd, output, strlen(output));
clif_map_property(sd, MAPPROPERTY_FREEPVPZONE);
//clif_misceffect2(&sd->bl, 159);
return i;
@ -104,14 +104,14 @@ void duel_invite(const unsigned int did, struct map_session_data* sd, struct map
char output[256];
// " -- Player %s invites %s to duel --"
sprintf(output, msg_txt(373), sd->status.name, target_sd->status.name);
sprintf(output, msg_txt(sd,373), sd->status.name, target_sd->status.name);
clif_disp_message(&sd->bl, output, strlen(output), DUEL_WOS);
target_sd->duel_invite = did;
duel_list[did].invites_count++;
// "Blue -- Player %s invites you to PVP duel (@accept/@reject) --"
sprintf(output, msg_txt(374), sd->status.name);
sprintf(output, msg_txt(sd,374), sd->status.name);
clif_broadcast((struct block_list *)target_sd, output, strlen(output)+1, 0x10, SELF);
}
@ -126,18 +126,18 @@ static int duel_leave_sub(struct map_session_data* sd, va_list va)
void duel_leave(const unsigned int did, struct map_session_data* sd)
{
char output[256];
// " <- Player %s has left duel --"
sprintf(output, msg_txt(375), sd->status.name);
sprintf(output, msg_txt(sd,375), sd->status.name);
clif_disp_message(&sd->bl, output, strlen(output), DUEL_WOS);
duel_list[did].members_count--;
if(duel_list[did].members_count == 0) {
map_foreachpc(duel_leave_sub, did);
map_foreachpc(duel_leave_sub, did);
duel_count--;
}
sd->duel_group = 0;
duel_savetime(sd);
clif_map_property(sd, MAPPROPERTY_NOTHING);
@ -146,14 +146,14 @@ void duel_leave(const unsigned int did, struct map_session_data* sd)
void duel_accept(const unsigned int did, struct map_session_data* sd)
{
char output[256];
duel_list[did].members_count++;
sd->duel_group = sd->duel_invite;
duel_list[did].invites_count--;
sd->duel_invite = 0;
// " -> Player %s has accepted duel --"
sprintf(output, msg_txt(376), sd->status.name);
sprintf(output, msg_txt(sd,376), sd->status.name);
clif_disp_message(&sd->bl, output, strlen(output), DUEL_WOS);
clif_map_property(sd, MAPPROPERTY_FREEPVPZONE);
@ -163,11 +163,11 @@ void duel_accept(const unsigned int did, struct map_session_data* sd)
void duel_reject(const unsigned int did, struct map_session_data* sd)
{
char output[256];
// " -- Player %s has rejected duel --"
sprintf(output, msg_txt(377), sd->status.name);
sprintf(output, msg_txt(sd,377), sd->status.name);
clif_disp_message(&sd->bl, output, strlen(output), DUEL_WOS);
duel_list[did].invites_count--;
sd->duel_invite = 0;
}

View File

@ -1427,7 +1427,7 @@ int guild_reqalliance(struct map_session_data *sd,struct map_session_data *tsd)
int i;
if(agit_flag || agit2_flag) { // Disable alliance creation during woe [Valaris]
clif_displaymessage(sd->fd,msg_txt(676)); //"Alliances cannot be made during Guild Wars!"
clif_displaymessage(sd->fd,msg_txt(sd,676)); //"Alliances cannot be made during Guild Wars!"
return 0;
} // end addition [Valaris]
@ -1545,7 +1545,7 @@ int guild_delalliance(struct map_session_data *sd,int guild_id,int flag)
nullpo_ret(sd);
if(agit_flag || agit2_flag) { // Disable alliance breaking during woe [Valaris]
clif_displaymessage(sd->fd,msg_txt(677)); //"Alliances cannot be broken during Guild Wars!"
clif_displaymessage(sd->fd,msg_txt(sd,677)); //"Alliances cannot be broken during Guild Wars!"
return 0;
} // end addition [Valaris]
@ -1807,12 +1807,12 @@ int guild_gm_changed(int guild_id, int account_id, int char_id)
strcpy(g->master, g->member[0].name);
if (g->member[pos].sd && g->member[pos].sd->fd) {
clif_displaymessage(g->member[pos].sd->fd, msg_txt(678)); //"You no longer are the Guild Master."
clif_displaymessage(g->member[pos].sd->fd, msg_txt(g->member[pos].sd,678)); //"You no longer are the Guild Master."
g->member[pos].sd->state.gmaster_flag = 0;
}
if (g->member[0].sd && g->member[0].sd->fd) {
clif_displaymessage(g->member[0].sd->fd, msg_txt(679)); //"You have become the Guild Master!"
clif_displaymessage(g->member[0].sd->fd, msg_txt(g->member[pos].sd,679)); //"You have become the Guild Master!"
g->member[0].sd->state.gmaster_flag = g;
//Block his skills for 5 minutes to prevent abuse.
guild_block_skill(g->member[0].sd, 300000);

View File

@ -707,7 +707,7 @@ int merc_hom_change_name_ack(struct map_session_data *sd, char* name, int flag)
normalize_name(name," ");//bugreport:3032
if ( !flag || !strlen(name) ) {
clif_displaymessage(sd->fd, msg_txt(280)); // You cannot use this name
clif_displaymessage(sd->fd, msg_txt(sd,280)); // You cannot use this name
return 0;
}
safestrncpy(hd->homunculus.name,name,NAME_LENGTH);

View File

@ -201,7 +201,7 @@ int intif_main_message(struct map_session_data* sd, const char* message)
nullpo_ret(sd);
// format the message for main broadcasting
snprintf( output, sizeof(output), msg_txt(386), sd->status.name, message );
snprintf( output, sizeof(output), msg_txt(sd,386), sd->status.name, message );
// send the message using the inter-server broadcast service
intif_broadcast2( output, strlen(output) + 1, 0xFE000000, 0, 0, 0, 0 );
@ -1524,7 +1524,7 @@ int intif_parse_Mail_inboxreceived(int fd)
else if( battle_config.mail_show_status && ( battle_config.mail_show_status == 1 || sd->mail.inbox.unread ) )
{
char output[128];
sprintf(output, msg_txt(510), sd->mail.inbox.unchecked, sd->mail.inbox.unread + sd->mail.inbox.unchecked);
sprintf(output, msg_txt(sd,510), sd->mail.inbox.unchecked, sd->mail.inbox.unread + sd->mail.inbox.unchecked);
clif_disp_onlyself(sd, output, strlen(output));
}
return 0;

View File

@ -94,6 +94,7 @@ static DBMap* map_db=NULL; // unsigned int mapindex -> struct map_data*
static DBMap* nick_db=NULL; // int char_id -> struct charid2nick* (requested names of offline characters)
static DBMap* charid_db=NULL; // int char_id -> struct map_session_data*
static DBMap* regen_db=NULL; // int id -> struct block_list* (status_natural_heal processing)
static DBMap* map_msg_db=NULL;
static int map_users=0;
@ -107,7 +108,6 @@ static struct block_list *bl_list[BL_LIST_MAX];
static int bl_list_count = 0;
#define MAP_MAX_MSG 1500
static char* msg_table[MAP_MAX_MSG]; // map Server messages
struct map_data map[MAX_MAP_PER_SERVER];
int map_num = 0;
@ -1699,7 +1699,7 @@ int map_quit(struct map_session_data *sd) {
elemental_clean_effect(sd->ed);
unit_remove_map(&sd->ed->bl,CLR_TELEPORT);
}
unit_remove_map_pc(sd,CLR_TELEPORT);
if( map[sd->bl.m].instance_id ) { // Avoid map conflicts and warnings on next login
@ -3697,6 +3697,81 @@ void set_server_type(void)
SERVER_TYPE = ATHENA_SERVER_MAP;
}
//Msg System
struct msg_data {
char* msg[MAP_MAX_MSG];
};
struct msg_data *map_lang2msgdb(uint8 lang){
return (struct msg_data*)idb_get(map_msg_db, lang);
}
void map_do_init_msg(void){
map_msg_db = idb_alloc(DB_OPT_BASE);
msg_config_read(MSG_CONF_NAME_EN,0); // English (default)
if( LANG_ENABLE&LANG_RUS )
msg_config_read(MSG_CONF_NAME_RUS,1); // Russian
if( LANG_ENABLE&LANG_SPN )
msg_config_read(MSG_CONF_NAME_SPN,2); // Spanish
if( LANG_ENABLE&LANG_GRM )
msg_config_read(MSG_CONF_NAME_GRM,3); // German
if( LANG_ENABLE&LANG_CHN )
msg_config_read(MSG_CONF_NAME_CHN,4); // Chinese
if( LANG_ENABLE&LANG_MAL )
msg_config_read(MSG_CONF_NAME_MAL,5); // Malaysian
if( LANG_ENABLE&LANG_IND )
msg_config_read(MSG_CONF_NAME_IND,6); // Indonesian
if( LANG_ENABLE&LANG_FRN )
msg_config_read(MSG_CONF_NAME_FRN,7); // French
}
void map_do_final_msg(void){
DBIterator *iter = db_iterator(map_msg_db);
struct msg_data *mdb;
for (mdb = dbi_first(iter); dbi_exists(iter); mdb = dbi_next(iter)) {
_do_final_msg(MAP_MAX_MSG,mdb->msg);
aFree(mdb);
}
dbi_destroy(iter);
map_msg_db->destroy(map_msg_db, NULL);
}
void map_msg_reload(void){
map_do_final_msg(); //clear data
map_do_init_msg();
}
int map_msg_config_read(char *cfgName, int lang){
struct msg_data *mdb;
if( (mdb = map_lang2msgdb(lang)) == NULL )
CREATE(mdb, struct msg_data, 1);
else
idb_remove(map_msg_db, lang);
idb_put(map_msg_db, lang, mdb);
if(_msg_config_read(cfgName,MAP_MAX_MSG,mdb->msg)!=0){ //an error occur
idb_remove(map_msg_db, lang); //@TRYME
aFree(mdb);
}
return 0;
}
const char* map_msg_txt(struct map_session_data *sd, int msg_number){
struct msg_data *mdb;
uint8 lang = 0; //default
const char *tmp; //to verify result
if(sd && sd->langtype) lang = sd->langtype;
if( (mdb = map_lang2msgdb(lang)) != NULL){
tmp = _msg_txt(msg_number,MAP_MAX_MSG,mdb->msg);
if(strcmp(tmp,"??"))
return tmp;
ShowDebug("msgnmber %d not found for langtype=%d, trying fallback2\n",lang);
}
ShowDebug("langtype=%d choosed not loaded, trying fallback\n",lang);
if(lang != 0 && (mdb = map_lang2msgdb(0)) != NULL) //fallback
return _msg_txt(msg_number,MAP_MAX_MSG,mdb->msg);
return "??";
}
/// Called when a terminate signal is received.
void do_shutdown(void)
@ -3729,9 +3804,19 @@ int do_init(int argc, char *argv[])
BATTLE_CONF_FILENAME = "conf/battle_athena.conf";
ATCOMMAND_CONF_FILENAME = "conf/atcommand_athena.conf";
SCRIPT_CONF_NAME = "conf/script_athena.conf";
MSG_CONF_NAME = "conf/msg_conf/map_msg.conf";
GRF_PATH_FILENAME = "conf/grf-files.txt";
/* Multilanguage */
MSG_CONF_NAME_EN = "conf/msg_conf/map_msg.conf"; // English (default)
MSG_CONF_NAME_RUS = "conf/msg_conf/map_msg_rus.conf"; // Russian
MSG_CONF_NAME_SPN = "conf/msg_conf/map_msg_spn.conf"; // Spanish
MSG_CONF_NAME_GRM = "conf/msg_conf/map_msg_grm.conf"; // German
MSG_CONF_NAME_CHN = "conf/msg_conf/map_msg_chn.conf"; // Chinese
MSG_CONF_NAME_MAL = "conf/msg_conf/map_msg_mal.conf"; // Malaysian
MSG_CONF_NAME_IND = "conf/msg_conf/map_msg_ind.conf"; // Indonesian
MSG_CONF_NAME_FRN = "conf/msg_conf/map_msg_frn.conf"; // French
/* Multilanguage */
cli_get_options(argc,argv);
rnd_init();
@ -3762,7 +3847,6 @@ int do_init(int argc, char *argv[])
}
battle_config_read(BATTLE_CONF_FILENAME);
msg_config_read(MSG_CONF_NAME);
script_config_read(SCRIPT_CONF_NAME);
inter_config_read(INTER_CONF_NAME);
log_config_read(LOG_CONF_NAME);
@ -3775,7 +3859,6 @@ int do_init(int argc, char *argv[])
nick_db = idb_alloc(DB_OPT_BASE);
charid_db = idb_alloc(DB_OPT_BASE);
regen_db = idb_alloc(DB_OPT_BASE); // efficient status_natural_heal processing
iwall_db = strdb_alloc(DB_OPT_RELEASE_DATA,2*NAME_LENGTH+2+1); // [Zephyrus] Invisible Walls
map_sql_init();
@ -3793,6 +3876,7 @@ int do_init(int argc, char *argv[])
add_timer_func_list(map_removemobs_timer, "map_removemobs_timer");
add_timer_interval(gettick()+1000, map_freeblock_timer, 0, 0, 60*1000);
map_do_init_msg();
do_init_atcommand();
do_init_battle();
do_init_instance();
@ -3843,12 +3927,3 @@ int do_init(int argc, char *argv[])
return 0;
}
int map_msg_config_read(char *cfgName){
return _msg_config_read(cfgName,MAP_MAX_MSG,msg_table);
}
const char* map_msg_txt(int msg_number){
return _msg_txt(msg_number,MAP_MAX_MSG,msg_table);
}
void map_do_final_msg(void){
_do_final_msg(MAP_MAX_MSG,msg_table);
}

View File

@ -25,12 +25,13 @@ enum E_MAPSERVER_ST {
MAPSERVER_ST_LAST
};
#define msg_config_read(cfgName) map_msg_config_read(cfgName)
#define msg_txt(msg_number) map_msg_txt(msg_number)
#define msg_config_read(cfgName,isnew) map_msg_config_read(cfgName,isnew)
#define msg_txt(sd,msg_number) map_msg_txt(sd,msg_number)
#define do_final_msg() map_do_final_msg()
int map_msg_config_read(char *cfgName);
const char* map_msg_txt(int msg_number);
int map_msg_config_read(char *cfgName,int lang);
const char* map_msg_txt(struct map_session_data *sd,int msg_number);
void map_do_final_msg(void);
void map_msg_reload(void);
#define MAX_NPC_PER_MAP 512
#define AREA_SIZE battle_config.area_size
@ -747,14 +748,23 @@ void do_reconnect_map(void); //Invoked on map-char reconnection [Skotlex]
void map_addmap2db(struct map_data *m);
void map_removemapdb(struct map_data *m);
//option readed in cli
extern char *INTER_CONF_NAME;
extern char *LOG_CONF_NAME;
extern char *MAP_CONF_NAME;
extern char *BATTLE_CONF_FILENAME;
extern char *ATCOMMAND_CONF_FILENAME;
extern char *SCRIPT_CONF_NAME;
extern char *MSG_CONF_NAME;
extern char *MSG_CONF_NAME_EN;
extern char *GRF_PATH_FILENAME;
//other lang supported
char *MSG_CONF_NAME_RUS;
char *MSG_CONF_NAME_GRM;
char *MSG_CONF_NAME_CHN;
char *MSG_CONF_NAME_MAL;
char *MSG_CONF_NAME_IND;
char *MSG_CONF_NAME_FRN;
char *MSG_CONF_NAME_SPN;
//Useful typedefs from jA [Skotlex]
typedef struct map_session_data TBL_PC;

View File

@ -136,13 +136,13 @@ void mvptomb_create(struct mob_data *md, char *killer, time_t time)
nd->bl.id = md->tomb_nid = npc_get_new_npc_id();
nd->ud.dir = md->ud.dir;
nd->ud.dir = md->ud.dir;
nd->bl.m = md->bl.m;
nd->bl.x = md->bl.x;
nd->bl.y = md->bl.y;
nd->bl.type = BL_NPC;
safestrncpy(nd->name, msg_txt(656), sizeof(nd->name));
safestrncpy(nd->name, msg_txt(NULL,656), sizeof(nd->name));
nd->class_ = 565;
nd->speed = 200;
@ -2390,7 +2390,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
//A Rare Drop Global Announce by Lupus
if( mvp_sd && drop_rate <= battle_config.rare_drop_announce ) {
char message[128];
sprintf (message, msg_txt(541), mvp_sd->status.name, md->name, it->jname, (float)drop_rate/100);
sprintf (message, msg_txt(NULL,541), mvp_sd->status.name, md->name, it->jname, (float)drop_rate/100);
//MSG: "'%s' won %s's %s (chance: %0.02f%%)"
intif_broadcast(message,strlen(message)+1,0);
}
@ -2529,7 +2529,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
struct item_data *i_data;
char message[128];
i_data = itemdb_exists(item.nameid);
sprintf (message, msg_txt(541), mvp_sd->status.name, md->name, i_data->jname, temp/100.);
sprintf (message, msg_txt(NULL,541), mvp_sd->status.name, md->name, i_data->jname, temp/100.);
//MSG: "'%s' won %s's %s (chance: %0.02f%%)"
intif_broadcast(message,strlen(message)+1,0);
}

View File

@ -1155,25 +1155,25 @@ int npc_globalmessage(const char* name, const char* mes)
void run_tomb(struct map_session_data* sd, struct npc_data* nd)
{
char buffer[200];
char time[10];
char time[10];
strftime(time, sizeof(time), "%H:%M", localtime(&nd->u.tomb.kill_time));
strftime(time, sizeof(time), "%H:%M", localtime(&nd->u.tomb.kill_time));
// TODO: Find exact color?
snprintf(buffer, sizeof(buffer), msg_txt(657), nd->u.tomb.md->db->name);
clif_scriptmes(sd, nd->bl.id, buffer);
snprintf(buffer, sizeof(buffer), msg_txt(sd,657), nd->u.tomb.md->db->name);
clif_scriptmes(sd, nd->bl.id, buffer);
clif_scriptmes(sd, nd->bl.id, msg_txt(658));
clif_scriptmes(sd, nd->bl.id, msg_txt(sd,658));
snprintf(buffer, sizeof(buffer), msg_txt(659), time);
clif_scriptmes(sd, nd->bl.id, buffer);
snprintf(buffer, sizeof(buffer), msg_txt(sd,659), time);
clif_scriptmes(sd, nd->bl.id, buffer);
clif_scriptmes(sd, nd->bl.id, msg_txt(660));
clif_scriptmes(sd, nd->bl.id, msg_txt(sd,660));
snprintf(buffer, sizeof(buffer), msg_txt(661), nd->u.tomb.killer_name[0] ? nd->u.tomb.killer_name : "Unknown");
clif_scriptmes(sd, nd->bl.id, buffer);
snprintf(buffer, sizeof(buffer), msg_txt(sd,661), nd->u.tomb.killer_name[0] ? nd->u.tomb.killer_name : "Unknown");
clif_scriptmes(sd, nd->bl.id, buffer);
clif_scriptclose(sd, nd->bl.id);
clif_scriptclose(sd, nd->bl.id);
}
/*==========================================

View File

@ -345,7 +345,7 @@ int party_invite(struct map_session_data *sd,struct map_session_data *tsd)
ARR_FIND(0, MAX_PARTY, i, p->data[i].sd == sd);
if( i == MAX_PARTY || !p->party.member[i].leader ) {
clif_displaymessage(sd->fd, msg_txt(282));
clif_displaymessage(sd->fd, msg_txt(sd,282));
return 0;
}
@ -359,7 +359,7 @@ int party_invite(struct map_session_data *sd,struct map_session_data *tsd)
// confirm whether the account has the ability to invite before checking the player
if( !pc_has_permission(sd, PC_PERM_PARTY) || (tsd && !pc_has_permission(tsd, PC_PERM_PARTY)) ) {
clif_displaymessage(sd->fd, msg_txt(81)); // "Your GM level doesn't authorize you to preform this action on the specified player."
clif_displaymessage(sd->fd, msg_txt(sd,81)); // "Your GM level doesn't authorize you to preform this action on the specified player."
return 0;
}
@ -644,13 +644,13 @@ bool party_changeleader(struct map_session_data *sd, struct map_session_data *ts
return false;
if (!tsd || tsd->status.party_id != sd->status.party_id) {
clif_displaymessage(sd->fd, msg_txt(283));
clif_displaymessage(sd->fd, msg_txt(sd,283));
return false;
}
if( map[sd->bl.m].flag.partylock )
{
clif_displaymessage(sd->fd, msg_txt(287));
clif_displaymessage(sd->fd, msg_txt(sd,287));
return false;
}
@ -663,7 +663,7 @@ bool party_changeleader(struct map_session_data *sd, struct map_session_data *ts
if (!p->party.member[mi].leader)
{ //Need to be a party leader.
clif_displaymessage(sd->fd, msg_txt(282));
clif_displaymessage(sd->fd, msg_txt(sd,282));
return false;
}
@ -674,11 +674,11 @@ bool party_changeleader(struct map_session_data *sd, struct map_session_data *ts
//Change leadership.
p->party.member[mi].leader = 0;
if (p->data[mi].sd->fd)
clif_displaymessage(p->data[mi].sd->fd, msg_txt(284));
clif_displaymessage(p->data[mi].sd->fd, msg_txt(sd,284));
p->party.member[tmi].leader = 1;
if (p->data[tmi].sd->fd)
clif_displaymessage(p->data[tmi].sd->fd, msg_txt(285));
clif_displaymessage(p->data[tmi].sd->fd, msg_txt(sd,285));
//Update info.
intif_party_leaderchange(p->party.party_id,p->party.member[tmi].account_id,p->party.member[tmi].char_id);

View File

@ -1075,7 +1075,7 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim
// message of the limited time of the account
if (expiration_time != 0) { // don't display if it's unlimited or unknow value
char tmpstr[1024];
strftime(tmpstr, sizeof(tmpstr) - 1, msg_txt(501), localtime(&expiration_time)); // "Your account time limit is: %d-%m-%Y %H:%M:%S."
strftime(tmpstr, sizeof(tmpstr) - 1, msg_txt(sd,501), localtime(&expiration_time)); // "Your account time limit is: %d-%m-%Y %H:%M:%S."
clif_wis_message(sd->fd, wisp_server_name, tmpstr, strlen(tmpstr)+1);
}
@ -1146,6 +1146,9 @@ int pc_reg_received(struct map_session_data *sd)
sd->change_level_3rd = pc_readglobalreg(sd,"jobchange_level_3rd");
sd->die_counter = pc_readglobalreg(sd,"PC_DIE_COUNTER");
sd->langtype = pc_readaccountreg(sd,"#langtype");
if(msg_checklangtype(sd->langtype,true)<0) sd->langtype=0; //invalid langtype reset to default
// Cash shop
sd->cashPoints = pc_readaccountreg(sd,"#CASHPOINTS");
sd->kafraPoints = pc_readaccountreg(sd,"#KAFRAPOINTS");
@ -3697,7 +3700,7 @@ int pc_paycash(struct map_session_data *sd, int price, int points, e_log_pick_ty
if( battle_config.cashshop_show_points )
{
char output[128];
sprintf(output, msg_txt(504), points, cash, sd->kafraPoints, sd->cashPoints);
sprintf(output, msg_txt(sd,504), points, cash, sd->kafraPoints, sd->cashPoints);
clif_disp_onlyself(sd, output, strlen(output));
}
return cash+points;
@ -3724,7 +3727,7 @@ int pc_getcash( struct map_session_data *sd, int cash, int points, e_log_pick_ty
if( battle_config.cashshop_show_points )
{
sprintf(output, msg_txt(505), cash, sd->cashPoints);
sprintf(output, msg_txt(sd,505), cash, sd->cashPoints);
clif_disp_onlyself(sd, output, strlen(output));
}
return cash;
@ -3750,7 +3753,7 @@ int pc_getcash( struct map_session_data *sd, int cash, int points, e_log_pick_ty
if( battle_config.cashshop_show_points )
{
sprintf(output, msg_txt(506), points, sd->kafraPoints);
sprintf(output, msg_txt(sd,506), points, sd->kafraPoints);
clif_disp_onlyself(sd, output, strlen(output));
}
return points;
@ -3964,13 +3967,13 @@ int pc_dropitem(struct map_session_data *sd,int n,int amount)
if( map[sd->bl.m].flag.nodrop )
{
clif_displaymessage (sd->fd, msg_txt(271));
clif_displaymessage (sd->fd, msg_txt(sd,271));
return 0; //Can't drop items in nodrop mapflag maps.
}
if( !pc_candrop(sd,&sd->status.inventory[n]) )
{
clif_displaymessage (sd->fd, msg_txt(263));
clif_displaymessage (sd->fd, msg_txt(sd,263));
return 0;
}
@ -4103,7 +4106,7 @@ int pc_isUseitem(struct map_session_data *sd,int n)
case 14591: // Siege Teleport Scroll
if( sd->duel_group && !battle_config.duel_allow_teleport )
{
clif_displaymessage(sd->fd, msg_txt(663));
clif_displaymessage(sd->fd, msg_txt(sd,663));
return 0;
}
if( nameid != 601 && nameid != 12212 && map[sd->bl.m].flag.noreturn )
@ -4385,7 +4388,7 @@ int pc_cart_additem(struct map_session_data *sd,struct item *item_data,int amoun
if( !itemdb_cancartstore(item_data, pc_get_group_level(sd)) )
{ // Check item trade restrictions [Skotlex]
clif_displaymessage (sd->fd, msg_txt(264));
clif_displaymessage (sd->fd, msg_txt(sd,264));
return 1;
}
@ -4628,7 +4631,7 @@ int pc_steal_item(struct map_session_data *sd,struct block_list *bl, uint16 skil
struct item_data *i_data;
char message[128];
i_data = itemdb_search(itemid);
sprintf (message, msg_txt(542), (sd->status.name != NULL)?sd->status.name :"GM", md->db->jname, i_data->jname, (float)md->db->dropitem[i].p/100);
sprintf (message, msg_txt(sd,542), (sd->status.name != NULL)?sd->status.name :"GM", md->db->jname, i_data->jname, (float)md->db->dropitem[i].p/100);
//MSG: "'%s' stole %s's %s (chance: %0.02f%%)"
intif_broadcast(message,strlen(message)+1,0);
}
@ -4747,7 +4750,7 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y
sd->regen.state.gc = 0;
// make sure vending is allowed here
if (sd->state.vending && map[m].flag.novending) {
clif_displaymessage (sd->fd, msg_txt(276)); // "You can't open a shop on this map"
clif_displaymessage (sd->fd, msg_txt(sd,276)); // "You can't open a shop on this map"
vending_closevending(sd);
}
@ -4797,7 +4800,7 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y
}
if (sd->state.vending && map_getcell(m,x,y,CELL_CHKNOVENDING)) {
clif_displaymessage (sd->fd, msg_txt(204)); // "You can't open a shop on this cell."
clif_displaymessage (sd->fd, msg_txt(sd,204)); // "You can't open a shop on this cell."
vending_closevending(sd);
}
@ -5318,7 +5321,7 @@ const char* job_name(int class_)
case JOB_ACOLYTE:
case JOB_MERCHANT:
case JOB_THIEF:
return msg_txt(550 - JOB_NOVICE+class_);
return msg_txt(NULL,550 - JOB_NOVICE+class_);
case JOB_KNIGHT:
case JOB_PRIEST:
@ -5326,10 +5329,10 @@ const char* job_name(int class_)
case JOB_BLACKSMITH:
case JOB_HUNTER:
case JOB_ASSASSIN:
return msg_txt(557 - JOB_KNIGHT+class_);
return msg_txt(NULL,557 - JOB_KNIGHT+class_);
case JOB_KNIGHT2:
return msg_txt(557);
return msg_txt(NULL,557);
case JOB_CRUSADER:
case JOB_MONK:
@ -5338,23 +5341,23 @@ const char* job_name(int class_)
case JOB_ALCHEMIST:
case JOB_BARD:
case JOB_DANCER:
return msg_txt(563 - JOB_CRUSADER+class_);
return msg_txt(NULL,563 - JOB_CRUSADER+class_);
case JOB_CRUSADER2:
return msg_txt(563);
return msg_txt(NULL,563);
case JOB_WEDDING:
case JOB_SUPER_NOVICE:
case JOB_GUNSLINGER:
case JOB_NINJA:
case JOB_XMAS:
return msg_txt(570 - JOB_WEDDING+class_);
return msg_txt(NULL,570 - JOB_WEDDING+class_);
case JOB_SUMMER:
return msg_txt(621);
return msg_txt(NULL,621);
case JOB_HANBOK:
return msg_txt(694);
return msg_txt(NULL,694);
case JOB_NOVICE_HIGH:
case JOB_SWORDMAN_HIGH:
@ -5363,7 +5366,7 @@ const char* job_name(int class_)
case JOB_ACOLYTE_HIGH:
case JOB_MERCHANT_HIGH:
case JOB_THIEF_HIGH:
return msg_txt(575 - JOB_NOVICE_HIGH+class_);
return msg_txt(NULL,575 - JOB_NOVICE_HIGH+class_);
case JOB_LORD_KNIGHT:
case JOB_HIGH_PRIEST:
@ -5371,10 +5374,10 @@ const char* job_name(int class_)
case JOB_WHITESMITH:
case JOB_SNIPER:
case JOB_ASSASSIN_CROSS:
return msg_txt(582 - JOB_LORD_KNIGHT+class_);
return msg_txt(NULL,582 - JOB_LORD_KNIGHT+class_);
case JOB_LORD_KNIGHT2:
return msg_txt(582);
return msg_txt(NULL,582);
case JOB_PALADIN:
case JOB_CHAMPION:
@ -5383,10 +5386,10 @@ const char* job_name(int class_)
case JOB_CREATOR:
case JOB_CLOWN:
case JOB_GYPSY:
return msg_txt(588 - JOB_PALADIN + class_);
return msg_txt(NULL,588 - JOB_PALADIN + class_);
case JOB_PALADIN2:
return msg_txt(588);
return msg_txt(NULL,588);
case JOB_BABY:
case JOB_BABY_SWORDMAN:
@ -5395,7 +5398,7 @@ const char* job_name(int class_)
case JOB_BABY_ACOLYTE:
case JOB_BABY_MERCHANT:
case JOB_BABY_THIEF:
return msg_txt(595 - JOB_BABY + class_);
return msg_txt(NULL,595 - JOB_BABY + class_);
case JOB_BABY_KNIGHT:
case JOB_BABY_PRIEST:
@ -5403,10 +5406,10 @@ const char* job_name(int class_)
case JOB_BABY_BLACKSMITH:
case JOB_BABY_HUNTER:
case JOB_BABY_ASSASSIN:
return msg_txt(602 - JOB_BABY_KNIGHT + class_);
return msg_txt(NULL,602 - JOB_BABY_KNIGHT + class_);
case JOB_BABY_KNIGHT2:
return msg_txt(602);
return msg_txt(NULL,602);
case JOB_BABY_CRUSADER:
case JOB_BABY_MONK:
@ -5415,26 +5418,26 @@ const char* job_name(int class_)
case JOB_BABY_ALCHEMIST:
case JOB_BABY_BARD:
case JOB_BABY_DANCER:
return msg_txt(608 - JOB_BABY_CRUSADER + class_);
return msg_txt(NULL,608 - JOB_BABY_CRUSADER + class_);
case JOB_BABY_CRUSADER2:
return msg_txt(608);
return msg_txt(NULL,608);
case JOB_SUPER_BABY:
return msg_txt(615);
return msg_txt(NULL,615);
case JOB_TAEKWON:
return msg_txt(616);
return msg_txt(NULL,616);
case JOB_STAR_GLADIATOR:
case JOB_STAR_GLADIATOR2:
return msg_txt(617);
return msg_txt(NULL,617);
case JOB_SOUL_LINKER:
return msg_txt(618);
return msg_txt(NULL,618);
case JOB_GANGSI:
case JOB_DEATH_KNIGHT:
case JOB_DARK_COLLECTOR:
return msg_txt(622 - JOB_GANGSI+class_);
return msg_txt(NULL,622 - JOB_GANGSI+class_);
case JOB_RUNE_KNIGHT:
case JOB_WARLOCK:
@ -5442,7 +5445,7 @@ const char* job_name(int class_)
case JOB_ARCH_BISHOP:
case JOB_MECHANIC:
case JOB_GUILLOTINE_CROSS:
return msg_txt(625 - JOB_RUNE_KNIGHT+class_);
return msg_txt(NULL,625 - JOB_RUNE_KNIGHT+class_);
case JOB_RUNE_KNIGHT_T:
case JOB_WARLOCK_T:
@ -5450,7 +5453,7 @@ const char* job_name(int class_)
case JOB_ARCH_BISHOP_T:
case JOB_MECHANIC_T:
case JOB_GUILLOTINE_CROSS_T:
return msg_txt(681 - JOB_RUNE_KNIGHT_T+class_);
return msg_txt(NULL,681 - JOB_RUNE_KNIGHT_T+class_);
case JOB_ROYAL_GUARD:
case JOB_SORCERER:
@ -5459,7 +5462,7 @@ const char* job_name(int class_)
case JOB_SURA:
case JOB_GENETIC:
case JOB_SHADOW_CHASER:
return msg_txt(631 - JOB_ROYAL_GUARD+class_);
return msg_txt(NULL,631 - JOB_ROYAL_GUARD+class_);
case JOB_ROYAL_GUARD_T:
case JOB_SORCERER_T:
@ -5468,23 +5471,23 @@ const char* job_name(int class_)
case JOB_SURA_T:
case JOB_GENETIC_T:
case JOB_SHADOW_CHASER_T:
return msg_txt(687 - JOB_ROYAL_GUARD_T+class_);
return msg_txt(NULL,687 - JOB_ROYAL_GUARD_T+class_);
case JOB_RUNE_KNIGHT2:
case JOB_RUNE_KNIGHT_T2:
return msg_txt(625);
return msg_txt(NULL,625);
case JOB_ROYAL_GUARD2:
case JOB_ROYAL_GUARD_T2:
return msg_txt(631);
return msg_txt(NULL,631);
case JOB_RANGER2:
case JOB_RANGER_T2:
return msg_txt(627);
return msg_txt(NULL,627);
case JOB_MECHANIC2:
case JOB_MECHANIC_T2:
return msg_txt(629);
return msg_txt(NULL,629);
case JOB_BABY_RUNE:
case JOB_BABY_WARLOCK:
@ -5499,30 +5502,30 @@ const char* job_name(int class_)
case JOB_BABY_SURA:
case JOB_BABY_GENETIC:
case JOB_BABY_CHASER:
return msg_txt(638 - JOB_BABY_RUNE+class_);
return msg_txt(NULL,638 - JOB_BABY_RUNE+class_);
case JOB_BABY_RUNE2:
return msg_txt(638);
return msg_txt(NULL,638);
case JOB_BABY_GUARD2:
return msg_txt(644);
return msg_txt(NULL,644);
case JOB_BABY_RANGER2:
return msg_txt(640);
return msg_txt(NULL,640);
case JOB_BABY_MECHANIC2:
return msg_txt(642);
return msg_txt(NULL,642);
case JOB_SUPER_NOVICE_E:
case JOB_SUPER_BABY_E:
return msg_txt(651 - JOB_SUPER_NOVICE_E+class_);
return msg_txt(NULL,651 - JOB_SUPER_NOVICE_E+class_);
case JOB_KAGEROU:
case JOB_OBORO:
return msg_txt(653 - JOB_KAGEROU+class_);
return msg_txt(NULL,653 - JOB_KAGEROU+class_);
default:
return msg_txt(655);
return msg_txt(NULL,655);
}
}
@ -9195,7 +9198,7 @@ int map_day_timer(int tid, unsigned int tick, int id, intptr_t data)
night_flag = 0; // 0=day, 1=night [Yor]
map_foreachpc(pc_daynight_timer_sub);
strcpy(tmp_soutput, (data == 0) ? msg_txt(502) : msg_txt(60)); // The day has arrived!
strcpy(tmp_soutput, (data == 0) ? msg_txt(NULL,502) : msg_txt(NULL,60)); // The day has arrived!
intif_broadcast(tmp_soutput, strlen(tmp_soutput) + 1, 0);
return 0;
}
@ -9216,7 +9219,7 @@ int map_night_timer(int tid, unsigned int tick, int id, intptr_t data)
night_flag = 1; // 0=day, 1=night [Yor]
map_foreachpc(pc_daynight_timer_sub);
strcpy(tmp_soutput, (data == 0) ? msg_txt(503) : msg_txt(59)); // The night has fallen...
strcpy(tmp_soutput, (data == 0) ? msg_txt(NULL,503) : msg_txt(NULL,59)); // The night has fallen...
intif_broadcast(tmp_soutput, strlen(tmp_soutput) + 1, 0);
return 0;
}

View File

@ -183,6 +183,7 @@ struct map_session_data {
int group_id, group_pos, group_level;
unsigned int permissions;/* group permissions */
int langtype;
int packet_ver; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 ... 18
struct mmo_charstatus status;
struct registry save_reg;
@ -236,7 +237,7 @@ struct map_session_data {
unsigned int canskill_tick; // used to prevent abuse from no-delay ACT files
unsigned int cansendmail_tick; // [Mail System Flood Protection]
unsigned int ks_floodprotect_tick; // [Kill Steal Protection]
unsigned int bloodylust_tick; // bloodylust player timer [out/in re full-heal protection]
unsigned int bloodylust_tick; // bloodylust player timer [out/in re full-heal protection]
struct {
short nameid;

View File

@ -100,15 +100,15 @@ int pet_unlocktarget(struct pet_data *pd)
*------------------------------------------*/
int pet_attackskill(struct pet_data *pd, int target_id)
{
if (!battle_config.pet_status_support || !pd->a_skill ||
if (!battle_config.pet_status_support || !pd->a_skill ||
(battle_config.pet_equip_required && !pd->pet.equip))
return 0;
if (DIFF_TICK(pd->ud.canact_tick, gettick()) > 0)
return 0;
if (rnd()%100 < (pd->a_skill->rate +pd->pet.intimate*pd->a_skill->bonusrate/1000))
{ //Skotlex: Use pet's skill
{ //Skotlex: Use pet's skill
int inf;
struct block_list *bl;
@ -133,7 +133,7 @@ int pet_target_check(struct map_session_data *sd,struct block_list *bl,int type)
int rate;
pd = sd->pd;
Assert((pd->msd == 0) || (pd->msd->pd == pd));
if(bl == NULL || bl->type != BL_MOB || bl->prev == NULL ||
@ -160,7 +160,7 @@ int pet_target_check(struct map_session_data *sd,struct block_list *bl,int type)
if(pd->petDB->defence_attack_rate > 0 && rate <= 0)
rate = 1;
}
if(rnd()%10000 < rate)
if(rnd()%10000 < rate)
{
if(pd->target_id == 0 || rnd()%10000 < pd->petDB->change_target_rate)
pd->target_id = bl->id;
@ -186,7 +186,7 @@ int pet_sc_check(struct map_session_data *sd, int type)
return 1;
pd->recovery->timer = add_timer(gettick()+pd->recovery->delay*1000,pet_recovery_timer,sd->bl.id,0);
return 0;
}
@ -212,7 +212,7 @@ static int pet_hungry(int tid, unsigned int tick, int id, intptr_t data)
if (pd->pet.intimate <= 0)
return 1; //You lost the pet already, the rest is irrelevant.
pd->pet.hungry--;
if( pd->pet.hungry < 0 )
{
@ -322,7 +322,7 @@ int pet_data_init(struct map_session_data *sd, struct s_pet *pet)
nullpo_retr(1, sd);
Assert((sd->status.pet_id == 0 || sd->pd == 0) || sd->pd->msd == sd);
Assert((sd->status.pet_id == 0 || sd->pd == 0) || sd->pd->msd == sd);
if(sd->status.account_id != pet->account_id || sd->status.char_id != pet->char_id) {
sd->status.pet_id = 0;
@ -339,7 +339,7 @@ int pet_data_init(struct map_session_data *sd, struct s_pet *pet)
//The pet_id value was lost? odd... restore it.
sd->status.pet_id = pet->pet_id;
}
i = search_petDB_index(pet->class_,PET_CLASS);
if(i < 0) {
sd->status.pet_id = 0;
@ -388,7 +388,7 @@ int pet_birth_process(struct map_session_data *sd, struct s_pet *pet)
{
nullpo_retr(1, sd);
Assert((sd->status.pet_id == 0 || sd->pd == 0) || sd->pd->msd == sd);
Assert((sd->status.pet_id == 0 || sd->pd == 0) || sd->pd->msd == sd);
if(sd->status.pet_id && pet->incuvate == 1) {
sd->status.pet_id = 0;
@ -416,7 +416,7 @@ int pet_birth_process(struct map_session_data *sd, struct s_pet *pet)
clif_pet_equip_area(sd->pd);
clif_send_petstatus(sd);
}
Assert((sd->status.pet_id == 0 || sd->pd == 0) || sd->pd->msd == sd);
Assert((sd->status.pet_id == 0 || sd->pd == 0) || sd->pd->msd == sd);
return 0;
}
@ -547,14 +547,14 @@ int pet_get_egg(int account_id,int pet_id,int flag)
if(flag)
return 0;
sd = map_id2sd(account_id);
if(sd == NULL)
return 0;
i = search_petDB_index(sd->catch_target_class,PET_CLASS);
sd->catch_target_class = -1;
if(i < 0) {
intif_delete_petdata(pet_id);
return 0;
@ -584,11 +584,11 @@ int pet_menu(struct map_session_data *sd,int menunum)
nullpo_ret(sd);
if (sd->pd == NULL)
return 1;
//You lost the pet already.
if(!sd->status.pet_id || sd->pd->pet.intimate <= 0 || sd->pd->pet.incuvate)
return 1;
switch(menunum) {
case 0:
clif_send_petstatus(sd);
@ -635,7 +635,7 @@ int pet_change_name_ack(struct map_session_data *sd, char* name, int flag)
normalize_name(name," ");//bugreport:3032
if ( !flag || !strlen(name) ) {
clif_displaymessage(sd->fd, msg_txt(280)); // You cannot use this name for your pet.
clif_displaymessage(sd->fd, msg_txt(sd,280)); // You cannot use this name for your pet.
clif_send_petstatus(sd); //Send status so client knows oet name change got rejected.
return 0;
}
@ -655,9 +655,9 @@ int pet_equipitem(struct map_session_data *sd,int index)
nullpo_retr(1, sd);
pd = sd->pd;
if (!pd) return 1;
nameid = sd->status.inventory[index].nameid;
if(pd->petDB->AcceID == 0 || nameid != pd->petDB->AcceID || pd->pet.equip != 0) {
clif_equipitemack(sd,0,0,0);
return 1;
@ -839,7 +839,7 @@ static int pet_ai_sub_hard(struct pet_data *pd, struct map_session_data *sd, uns
pet_randomwalk(pd,tick);
return 0;
}
if (!check_distance_bl(&sd->bl, &pd->bl, pd->db->range3)) {
//Master too far, chase.
if(pd->target_id)
@ -863,7 +863,7 @@ static int pet_ai_sub_hard(struct pet_data *pd, struct map_session_data *sd, uns
pd->status.speed = pd->petDB->speed;
pd->ud.state.change_walk_target = pd->ud.state.speed_changed = 1;
}
if (pd->target_id) {
target= map_id2bl(pd->target_id);
if (!target || pd->bl.m != target->m || status_isdead(target) ||
@ -873,13 +873,13 @@ static int pet_ai_sub_hard(struct pet_data *pd, struct map_session_data *sd, uns
pet_unlocktarget(pd);
}
}
if(!target && pd->loot && pd->loot->count < pd->loot->max && DIFF_TICK(tick,pd->ud.canact_tick)>0) {
//Use half the pet's range of sight.
map_foreachinrange(pet_ai_sub_hard_lootsearch,&pd->bl,
pd->db->range2/2, BL_ITEM,pd,&target);
}
if (!target) {
//Just walk around.
if (check_distance_bl(&sd->bl, &pd->bl, 3))
@ -894,12 +894,12 @@ static int pet_ai_sub_hard(struct pet_data *pd, struct map_session_data *sd, uns
return 0;
}
if(pd->ud.target == target->id &&
(pd->ud.attacktimer != INVALID_TIMER || pd->ud.walktimer != INVALID_TIMER))
return 0; //Target already locked.
if (target->type != BL_ITEM)
if (target->type != BL_ITEM)
{ //enemy targetted
if(!battle_check_range(&pd->bl,target,pd->status.rhw.range))
{ //Chase
@ -921,7 +921,7 @@ static int pet_ai_sub_hard(struct pet_data *pd, struct map_session_data *sd, uns
memcpy(&pd->loot->item[pd->loot->count++],&fitem->item_data,sizeof(pd->loot->item[0]));
pd->loot->weight += itemdb_weight(fitem->item_data.nameid)*fitem->item_data.amount;
map_clearflooritem(target);
}
}
//Target is unlocked regardless of whether it was picked or not.
pet_unlocktarget(pd);
}
@ -959,7 +959,7 @@ static int pet_ai_sub_hard_lootsearch(struct block_list *bl,va_list ap)
if(sd_charid && sd_charid != pd->msd->status.char_id)
return 0;
if(unit_can_reach_bl(&pd->bl,bl, pd->db->range2, 1, NULL, NULL) &&
((*target) == NULL || //New target closer than previous one.
!check_distance_bl(&pd->bl, *target, distance_bl(&pd->bl, bl))))
@ -1040,7 +1040,7 @@ int pet_lootitem_drop(struct pet_data *pd,struct map_session_data *sd)
/*==========================================
* pet bonus giving skills [Valaris] / Rewritten by [Skotlex]
*------------------------------------------*/
*------------------------------------------*/
int pet_skill_bonus_timer(int tid, unsigned int tick, int id, intptr_t data)
{
struct map_session_data *sd=map_id2sd(id);
@ -1050,7 +1050,7 @@ int pet_skill_bonus_timer(int tid, unsigned int tick, int id, intptr_t data)
if(sd == NULL || sd->pd==NULL || sd->pd->bonus == NULL)
return 1;
pd=sd->pd;
if(pd->bonus->timer != tid) {
@ -1058,7 +1058,7 @@ int pet_skill_bonus_timer(int tid, unsigned int tick, int id, intptr_t data)
pd->bonus->timer = INVALID_TIMER;
return 0;
}
// determine the time for the next timer
if (pd->state.skillbonus && pd->bonus->delay > 0) {
bonus = 0;
@ -1082,15 +1082,15 @@ int pet_skill_bonus_timer(int tid, unsigned int tick, int id, intptr_t data)
/*==========================================
* pet recovery skills [Valaris] / Rewritten by [Skotlex]
*------------------------------------------*/
*------------------------------------------*/
int pet_recovery_timer(int tid, unsigned int tick, int id, intptr_t data)
{
struct map_session_data *sd=map_id2sd(id);
struct pet_data *pd;
if(sd==NULL || sd->pd == NULL || sd->pd->recovery == NULL)
return 1;
pd=sd->pd;
if(pd->recovery->timer != tid) {
@ -1099,7 +1099,7 @@ int pet_recovery_timer(int tid, unsigned int tick, int id, intptr_t data)
}
if(sd->sc.data[pd->recovery->type])
{ //Display a heal animation?
{ //Display a heal animation?
//Detoxify is chosen for now.
clif_skill_nodamage(&pd->bl,&sd->bl,TF_DETOXIFY,1,1);
status_change_end(&sd->bl, pd->recovery->type, INVALID_TIMER);
@ -1107,7 +1107,7 @@ int pet_recovery_timer(int tid, unsigned int tick, int id, intptr_t data)
}
pd->recovery->timer = INVALID_TIMER;
return 0;
}
@ -1117,19 +1117,19 @@ int pet_heal_timer(int tid, unsigned int tick, int id, intptr_t data)
struct status_data *status;
struct pet_data *pd;
unsigned int rate = 100;
if(sd==NULL || sd->pd == NULL || sd->pd->s_skill == NULL)
return 1;
pd=sd->pd;
if(pd->s_skill->timer != tid) {
ShowError("pet_heal_timer %d != %d\n",pd->s_skill->timer,tid);
return 0;
}
status = status_get_status_data(&sd->bl);
if(pc_isdead(sd) ||
(rate = get_percentage(status->sp, status->max_sp)) > pd->s_skill->sp ||
(rate = get_percentage(status->hp, status->max_hp)) > pd->s_skill->hp ||
@ -1148,7 +1148,7 @@ int pet_heal_timer(int tid, unsigned int tick, int id, intptr_t data)
/*==========================================
* pet support skills [Skotlex]
*------------------------------------------*/
*------------------------------------------*/
int pet_skill_support_timer(int tid, unsigned int tick, int id, intptr_t data)
{
struct map_session_data *sd=map_id2sd(id);
@ -1157,14 +1157,14 @@ int pet_skill_support_timer(int tid, unsigned int tick, int id, intptr_t data)
short rate = 100;
if(sd==NULL || sd->pd == NULL || sd->pd->s_skill == NULL)
return 1;
pd=sd->pd;
if(pd->s_skill->timer != tid) {
ShowError("pet_skill_support_timer %d != %d\n",pd->s_skill->timer,tid);
return 0;
}
status = status_get_status_data(&sd->bl);
if (DIFF_TICK(pd->ud.canact_tick, tick) > 0)
@ -1172,7 +1172,7 @@ int pet_skill_support_timer(int tid, unsigned int tick, int id, intptr_t data)
pd->s_skill->timer=add_timer(pd->ud.canact_tick,pet_skill_support_timer,sd->bl.id,0);
return 0;
}
if(pc_isdead(sd) ||
(rate = get_percentage(status->sp, status->max_sp)) > pd->s_skill->sp ||
(rate = get_percentage(status->hp, status->max_hp)) > pd->s_skill->hp ||
@ -1181,7 +1181,7 @@ int pet_skill_support_timer(int tid, unsigned int tick, int id, intptr_t data)
pd->s_skill->timer=add_timer(tick+(rate>10?rate:10)*100,pet_skill_support_timer,sd->bl.id,0);
return 0;
}
pet_stop_attack(pd);
pet_stop_walking(pd,1);
pd->s_skill->timer=add_timer(tick+pd->s_skill->delay*1000,pet_skill_support_timer,sd->bl.id,0);
@ -1196,12 +1196,12 @@ int pet_skill_support_timer(int tid, unsigned int tick, int id, intptr_t data)
* Pet read db data
* pet_db.txt
* pet_db2.txt
*------------------------------------------*/
*------------------------------------------*/
int read_petdb()
{
char* filename[] = {"pet_db.txt","pet_db2.txt"};
FILE *fp;
int nameid,i,j,k;
int nameid,i,j,k;
// Remove any previous scripts in case reloaddb was invoked.
for( j = 0; j < MAX_PET_DB; j++ )
@ -1351,7 +1351,7 @@ int do_init_pet(void)
item_drop_ers = ers_new(sizeof(struct item_drop),"pet.c::item_drop_ers",ERS_OPT_NONE);
item_drop_list_ers = ers_new(sizeof(struct item_drop_list),"pet.c::item_drop_list_ers",ERS_OPT_NONE);
add_timer_func_list(pet_hungry,"pet_hungry");
add_timer_func_list(pet_ai_hard,"pet_ai_hard");
add_timer_func_list(pet_skill_bonus_timer,"pet_skill_bonus_timer"); // [Valaris]

View File

@ -12722,7 +12722,7 @@ BUILDIN_FUNC(recovery)
status_revive(&sd->bl, 100, 100);
else
status_percent_heal(&sd->bl, 100, 100);
clif_displaymessage(sd->fd,msg_txt(680));
clif_displaymessage(sd->fd,msg_txt(sd,680));
}
mapit_free(iter);
return 0;
@ -16836,7 +16836,7 @@ BUILDIN_FUNC(buyingstore)
if( npc_isnear(&sd->bl) ) {
char output[150];
sprintf(output, msg_txt(662), battle_config.min_npc_vendchat_distance);
sprintf(output, msg_txt(sd,662), battle_config.min_npc_vendchat_distance);
clif_displaymessage(sd->fd, output);
return 0;
}

View File

@ -5272,7 +5272,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
if (sd)
clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
if (skill_break_equip(src,bl, EQP_WEAPON, 10000, BCT_PARTY) && sd && sd != dstsd)
clif_displaymessage(sd->fd, msg_txt(669));
clif_displaymessage(sd->fd, msg_txt(sd,669));
}
break;
@ -6175,7 +6175,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
break;
}
if(!battle_config.duel_allow_teleport && sd->duel_group && skill_lv <= 2) { // duel restriction [LuzZza]
char output[128]; sprintf(output, msg_txt(365), skill_get_name(AL_TELEPORT));
char output[128]; sprintf(output, msg_txt(sd,365), skill_get_name(AL_TELEPORT));
clif_displaymessage(sd->fd, output); //"Duel: Can't use %s in duel."
break;
}
@ -12722,7 +12722,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id
break;
case AL_WARP:
if(!battle_config.duel_allow_teleport && sd->duel_group) { // duel restriction [LuzZza]
char output[128]; sprintf(output, msg_txt(365), skill_get_name(AL_WARP));
char output[128]; sprintf(output, msg_txt(sd,365), skill_get_name(AL_WARP));
clif_displaymessage(sd->fd, output); //"Duel: Can't use %s in duel."
return 0;
}

View File

@ -97,13 +97,13 @@ int storage_storageopen(struct map_session_data *sd)
if(sd->state.storage_flag)
return 1; //Already open?
if( !pc_can_give_items(sd) )
{ //check is this GM level is allowed to put items to storage
clif_displaymessage(sd->fd, msg_txt(246));
{ //check is this GM level is allowed to put items to storage
clif_displaymessage(sd->fd, msg_txt(sd,246));
return 1;
}
sd->state.storage_flag = 1;
storage_sortitem(sd->status.storage.items, ARRAYLENGTH(sd->status.storage.items));
clif_storagelist(sd, sd->status.storage.items, ARRAYLENGTH(sd->status.storage.items));
@ -140,7 +140,7 @@ static int storage_additem(struct map_session_data* sd, struct item* item_data,
if( item_data->nameid <= 0 || amount <= 0 )
return 1;
data = itemdb_search(item_data->nameid);
if( data->stack.storage && amount > data->stack.amount )
@ -150,10 +150,10 @@ static int storage_additem(struct map_session_data* sd, struct item* item_data,
if( !itemdb_canstore(item_data, pc_get_group_level(sd)) )
{ //Check if item is storable. [Skotlex]
clif_displaymessage (sd->fd, msg_txt(264));
clif_displaymessage (sd->fd, msg_txt(sd,264));
return 1;
}
if( itemdb_isstackable2(data) )
{//Stackable
for( i = 0; i < MAX_STORAGE; i++ )
@ -248,7 +248,7 @@ int storage_storageget(struct map_session_data* sd, int index, int amount)
if( sd->status.storage.items[index].nameid <= 0 )
return 0; //Nothing there
if( amount < 1 || amount > sd->status.storage.items[index].amount )
return 0;
@ -279,7 +279,7 @@ int storage_storageaddfromcart(struct map_session_data* sd, int index, int amoun
if( sd->status.cart[index].nameid <= 0 )
return 0; //No item there.
if( amount < 1 || amount > sd->status.cart[index].amount )
return 0;
@ -302,13 +302,13 @@ int storage_storagegettocart(struct map_session_data* sd, int index, int amount)
if( index < 0 || index >= MAX_STORAGE )
return 0;
if( sd->status.storage.items[index].nameid <= 0 )
return 0; //Nothing there.
if( amount < 1 || amount > sd->status.storage.items[index].amount )
return 0;
if( pc_cart_additem(sd,&sd->status.storage.items[index],amount,LOG_TYPE_STORAGE) == 0 )
storage_delitem(sd,index,amount);
@ -337,7 +337,7 @@ void storage_storageclose(struct map_session_data* sd)
void storage_storage_quit(struct map_session_data* sd, int flag)
{
nullpo_retv(sd);
if (save_settings&4)
chrif_save(sd, flag); //Invokes the storage saving as well.
@ -365,7 +365,7 @@ struct guild_storage *guild2storage(int guild_id)
//For just locating a storage without creating one. [Skotlex]
struct guild_storage *guild2storage2(int guild_id)
{
{
return (struct guild_storage*)idb_get(guild_storage_db,guild_id);
}
@ -393,9 +393,9 @@ int storage_guild_storageopen(struct map_session_data* sd)
if(sd->state.storage_flag)
return 1; //Can't open both storages at a time.
if( !pc_can_give_items(sd) ) { //check is this GM level can open guild storage and store items [Lupus]
clif_displaymessage(sd->fd, msg_txt(246));
clif_displaymessage(sd->fd, msg_txt(sd,246));
return 1;
}
@ -405,10 +405,10 @@ int storage_guild_storageopen(struct map_session_data* sd)
}
if(gstor->storage_status)
return 1;
if( gstor->lock )
return 1;
gstor->storage_status = 1;
sd->state.storage_flag = 2;
storage_sortitem(gstor->items, ARRAYLENGTH(gstor->items));
@ -444,7 +444,7 @@ int guild_storage_additem(struct map_session_data* sd, struct guild_storage* sto
if( !itemdb_canguildstore(item_data, pc_get_group_level(sd)) || item_data->expire_time )
{ //Check if item is storable. [Skotlex]
clif_displaymessage (sd->fd, msg_txt(264));
clif_displaymessage (sd->fd, msg_txt(sd,264));
return 1;
}
@ -462,10 +462,10 @@ int guild_storage_additem(struct map_session_data* sd, struct guild_storage* sto
}
//Add item
for(i=0;i<MAX_GUILD_STORAGE && stor->items[i].nameid;i++);
if(i>=MAX_GUILD_STORAGE)
return 1;
memcpy(&stor->items[i],item_data,sizeof(stor->items[0]));
stor->items[i].amount=amount;
stor->storage_amount++;
@ -513,19 +513,19 @@ int storage_guild_storageadd(struct map_session_data* sd, int index, int amount)
nullpo_ret(sd);
nullpo_ret(stor=guild2storage2(sd->status.guild_id));
if( !stor->storage_status || stor->storage_amount > MAX_GUILD_STORAGE )
return 0;
if( index<0 || index>=MAX_INVENTORY )
return 0;
if( sd->status.inventory[index].nameid <= 0 )
return 0;
if( amount < 1 || amount > sd->status.inventory[index].amount )
return 0;
if( stor->lock ) {
storage_guild_storageclose(sd);
return 0;
@ -554,16 +554,16 @@ int storage_guild_storageget(struct map_session_data* sd, int index, int amount)
if(!stor->storage_status)
return 0;
if(index<0 || index>=MAX_GUILD_STORAGE)
return 0;
if(stor->items[index].nameid <= 0)
return 0;
if(amount < 1 || amount > stor->items[index].amount)
return 0;
if( stor->lock ) {
storage_guild_storageclose(sd);
return 0;
@ -600,7 +600,7 @@ int storage_guild_storageaddfromcart(struct map_session_data* sd, int index, int
if( sd->status.cart[index].nameid <= 0 )
return 0;
if( amount < 1 || amount > sd->status.cart[index].amount )
return 0;
@ -629,10 +629,10 @@ int storage_guild_storagegettocart(struct map_session_data* sd, int index, int a
if(index<0 || index>=MAX_GUILD_STORAGE)
return 0;
if(stor->items[index].nameid<=0)
return 0;
if(amount < 1 || amount > stor->items[index].amount)
return 0;
@ -711,7 +711,7 @@ int storage_guild_storage_quit(struct map_session_data* sd, int flag)
nullpo_ret(sd);
nullpo_ret(stor=guild2storage2(sd->status.guild_id));
if(flag)
{ //Only during a guild break flag is 1 (don't save storage)
sd->state.storage_flag = 0;

View File

@ -32,7 +32,7 @@ void trade_traderequest(struct map_session_data *sd, struct map_session_data *ta
nullpo_retv(sd);
if (map[sd->bl.m].flag.notrade) {
clif_displaymessage (sd->fd, msg_txt(272));
clif_displaymessage (sd->fd, msg_txt(sd,272));
return; //Can't trade in notrade mapflag maps.
}
@ -71,7 +71,7 @@ void trade_traderequest(struct map_session_data *sd, struct map_session_data *ta
if (!pc_can_give_items(sd) || !pc_can_give_items(target_sd)) //check if both GMs are allowed to trade
{
clif_displaymessage(sd->fd, msg_txt(246));
clif_displaymessage(sd->fd, msg_txt(sd,246));
clif_tradestart(sd, 2); // GM is not allowed to trade
return;
}
@ -201,25 +201,25 @@ int impossible_trade_check(struct map_session_data *sd)
index = sd->deal.item[i].index;
if (inventory[index].amount < sd->deal.item[i].amount)
{ // if more than the player have -> hack
sprintf(message_to_gm, msg_txt(538), sd->status.name, sd->status.account_id); // Hack on trade: character '%s' (account: %d) try to trade more items that he has.
sprintf(message_to_gm, msg_txt(sd,538), sd->status.name, sd->status.account_id); // Hack on trade: character '%s' (account: %d) try to trade more items that he has.
intif_wis_message_to_gm(wisp_server_name, PC_PERM_RECEIVE_HACK_INFO, message_to_gm);
sprintf(message_to_gm, msg_txt(539), inventory[index].amount, inventory[index].nameid, sd->deal.item[i].amount); // This player has %d of a kind of item (id: %d), and try to trade %d of them.
sprintf(message_to_gm, msg_txt(sd,539), inventory[index].amount, inventory[index].nameid, sd->deal.item[i].amount); // This player has %d of a kind of item (id: %d), and try to trade %d of them.
intif_wis_message_to_gm(wisp_server_name, PC_PERM_RECEIVE_HACK_INFO, message_to_gm);
// if we block people
if (battle_config.ban_hack_trade < 0) {
chrif_char_ask_name(-1, sd->status.name, 1, 0, 0, 0, 0, 0, 0); // type: 1 - block
set_eof(sd->fd); // forced to disconnect because of the hack
// message about the ban
strcpy(message_to_gm, msg_txt(540)); // This player has been definitively blocked.
strcpy(message_to_gm, msg_txt(sd,540)); // This player has been definitively blocked.
// if we ban people
} else if (battle_config.ban_hack_trade > 0) {
chrif_char_ask_name(-1, sd->status.name, 2, 0, 0, 0, 0, battle_config.ban_hack_trade, 0); // type: 2 - ban (year, month, day, hour, minute, second)
set_eof(sd->fd); // forced to disconnect because of the hack
// message about the ban
sprintf(message_to_gm, msg_txt(507), battle_config.ban_hack_trade); // This player has been banned for %d minute(s).
sprintf(message_to_gm, msg_txt(sd,507), battle_config.ban_hack_trade); // This player has been banned for %d minute(s).
} else
// message about the ban
strcpy(message_to_gm, msg_txt(508)); // This player hasn't been banned (Ban option is disabled).
strcpy(message_to_gm, msg_txt(sd,508)); // This player hasn't been banned (Ban option is disabled).
intif_wis_message_to_gm(wisp_server_name, PC_PERM_RECEIVE_HACK_INFO, message_to_gm);
return 1;
@ -356,14 +356,14 @@ void trade_tradeadditem(struct map_session_data *sd, short index, short amount)
if( !itemdb_cantrade(item, src_lv, dst_lv) && //Can't trade
(pc_get_partner(sd) != target_sd || !itemdb_canpartnertrade(item, src_lv, dst_lv)) ) //Can't partner-trade
{
clif_displaymessage (sd->fd, msg_txt(260));
clif_displaymessage (sd->fd, msg_txt(sd,260));
clif_tradeitemok(sd, index+2, 1);
return;
}
if( item->expire_time )
{ // Rental System
clif_displaymessage (sd->fd, msg_txt(260));
clif_displaymessage (sd->fd, msg_txt(sd,260));
clif_tradeitemok(sd, index+2, 1);
return;
}

View File

@ -57,7 +57,7 @@ void vending_vendinglistreq(struct map_session_data* sd, int id)
if (!pc_can_give_items(sd) || !pc_can_give_items(vsd)) //check if both GMs are allowed to trade
{ // GM is not allowed to trade
clif_displaymessage(sd->fd, msg_txt(246));
clif_displaymessage(sd->fd, msg_txt(sd,246));
return;
}
@ -189,7 +189,7 @@ void vending_purchasereq(struct map_session_data* sd, int aid, int uid, const ui
if( battle_config.buyer_name )
{
char temp[256];
sprintf(temp, msg_txt(265), sd->status.name);
sprintf(temp, msg_txt(sd,265), sd->status.name);
clif_disp_onlyself(vsd,temp,strlen(temp));
}
}
@ -286,7 +286,7 @@ void vending_openvending(struct map_session_data* sd, const char* message, const
}
if( i != j )
clif_displaymessage (sd->fd, msg_txt(266)); //"Some of your items cannot be vended and were removed from the shop."
clif_displaymessage (sd->fd, msg_txt(sd,266)); //"Some of your items cannot be vended and were removed from the shop."
if( i == 0 )
{ // no valid item found