summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSusu <bruant.bastien@gmail.com>2013-06-25 14:12:21 +0200
committerSusu <bruant.bastien@gmail.com>2013-06-25 14:12:21 +0200
commit71627e92fbe36c23993456486a308acd0428fd3d (patch)
tree11944c4fbab516994661ad56e9656d421b025c81 /src
parent5b40d0c2937c2fe4f8e133271d05602543d86277 (diff)
downloadhercules-71627e92fbe36c23993456486a308acd0428fd3d.tar.gz
hercules-71627e92fbe36c23993456486a308acd0428fd3d.tar.bz2
hercules-71627e92fbe36c23993456486a308acd0428fd3d.tar.xz
hercules-71627e92fbe36c23993456486a308acd0428fd3d.zip
- Added chrif interface
Diffstat (limited to 'src')
-rw-r--r--src/map/atcommand.c16
-rw-r--r--src/map/battle.c6
-rw-r--r--src/map/buyingstore.c4
-rw-r--r--src/map/chrif.c190
-rw-r--r--src/map/chrif.h104
-rw-r--r--src/map/clif.c16
-rw-r--r--src/map/intif.c16
-rw-r--r--src/map/map.c40
-rw-r--r--src/map/pc.c22
-rw-r--r--src/map/pet.c2
-rw-r--r--src/map/quest.c8
-rw-r--r--src/map/script.c2
-rw-r--r--src/map/skill.c2
-rw-r--r--src/map/storage.c12
-rw-r--r--src/map/trade.c10
-rw-r--r--src/map/vending.c4
16 files changed, 266 insertions, 188 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index a1bc52924..13519c804 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -745,7 +745,7 @@ ACMD(save)
if (sd->status.pet_id > 0 && sd->pd)
intif_save_petdata(sd->status.account_id, &sd->pd->pet);
- chrif_save(sd,0);
+ chrif->save(sd,0);
clif->message(fd, msg_txt(6)); // Your save point has been changed.
@@ -2745,7 +2745,7 @@ ACMD(char_block)
return false;
}
- chrif_char_ask_name(sd->status.account_id, atcmd_player_name, 1, 0, 0, 0, 0, 0, 0); // type: 1 - block
+ chrif->char_ask_name(sd->status.account_id, atcmd_player_name, 1, 0, 0, 0, 0, 0, 0); // type: 1 - block
clif->message(fd, msg_txt(88)); // Character name sent to char-server to ask it.
return true;
@@ -2842,7 +2842,7 @@ ACMD(char_ban)
return false;
}
- chrif_char_ask_name(sd->status.account_id, atcmd_player_name, 2, year, month, day, hour, minute, second); // type: 2 - ban
+ chrif->char_ask_name(sd->status.account_id, atcmd_player_name, 2, year, month, day, hour, minute, second); // type: 2 - ban
clif->message(fd, msg_txt(88)); // Character name sent to char-server to ask it.
return true;
@@ -2863,7 +2863,7 @@ ACMD(char_unblock)
}
// send answer to login server via char-server
- chrif_char_ask_name(sd->status.account_id, atcmd_player_name, 3, 0, 0, 0, 0, 0, 0); // type: 3 - unblock
+ chrif->char_ask_name(sd->status.account_id, atcmd_player_name, 3, 0, 0, 0, 0, 0, 0); // type: 3 - unblock
clif->message(fd, msg_txt(88)); // Character name sent to char-server to ask it.
return true;
@@ -2884,7 +2884,7 @@ ACMD(char_unban)
}
// send answer to login server via char-server
- chrif_char_ask_name(sd->status.account_id, atcmd_player_name, 4, 0, 0, 0, 0, 0, 0); // type: 4 - unban
+ chrif->char_ask_name(sd->status.account_id, atcmd_player_name, 4, 0, 0, 0, 0, 0, 0); // type: 4 - unban
clif->message(fd, msg_txt(88)); // Character name sent to char-server to ask it.
return true;
@@ -3688,7 +3688,7 @@ ACMD(reloadbattleconf)
)
{ // Exp or Drop rates changed.
mob_reload(); //Needed as well so rate changes take effect.
- chrif_ragsrvinfo(battle_config.base_exp_rate, battle_config.job_exp_rate, battle_config.item_rate_common);
+ chrif->ragsrvinfo(battle_config.base_exp_rate, battle_config.job_exp_rate, battle_config.item_rate_common);
}
clif->message(fd, msg_txt(255));
return true;
@@ -5010,7 +5010,7 @@ ACMD(email)
return false;
}
- chrif_changeemail(sd->status.account_id, actual_email, new_email);
+ chrif->changeemail(sd->status.account_id, actual_email, new_email);
clif->message(fd, msg_txt(148)); // Information sended to login-server via char-server.
return true;
}
@@ -6513,7 +6513,7 @@ ACMD(changesex)
// to avoid any problem with equipment and invalid sex, equipment is unequiped.
for( i=0; i<EQI_MAX; i++ )
if( sd->equip_index[i] >= 0 ) pc->unequipitem(sd, sd->equip_index[i], 3);
- chrif_changesex(sd);
+ chrif->changesex(sd);
return true;
}
diff --git a/src/map/battle.c b/src/map/battle.c
index 9e65146e2..b818e7ef4 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -1489,7 +1489,7 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block
skillratio += 300 + 100 * skill_lv + status_get_int(src);
RE_LVL_DMOD(100);
break;
- case WL_FROSTMISTY: // MATK [{( Skill Level x 100 ) + 200 } x ( Caster’s Base Level / 100 )] %
+ case WL_FROSTMISTY: // MATK [{( Skill Level x 100 ) + 200 } x ( Caster�s Base Level / 100 )] %
skillratio += 100 + 100 * skill_lv;
RE_LVL_DMOD(100);
break;
@@ -6536,14 +6536,14 @@ void Hercules_report(char* date, char *time_c) {
WBUFL(buf,6 + 12 + 9 + 24 + 41 + 4 + 4 + 4 + BFLAG_LENGTH + ( i * ( BFLAG_LENGTH + 4 ) ) ) = *battle_data[i].val;
}
- chrif_send_report(buf, 6 + 12 + 9 + 24 + 41 + 4 + 4 + 4 + ( bd_size * ( BFLAG_LENGTH + 4 ) ) );
+ chrif->send_report(buf, 6 + 12 + 9 + 24 + 41 + 4 + 4 + 4 + ( bd_size * ( BFLAG_LENGTH + 4 ) ) );
aFree(buf);
#undef BFLAG_LENGTH
}
static int Hercules_report_timer(int tid, unsigned int tick, int id, intptr_t data) {
- if( chrif_isconnected() ) {/* char server relays it, so it must be online. */
+ if( chrif->isconnected() ) {/* char server relays it, so it must be online. */
Hercules_report(__DATE__,__TIME__);
}
return 0;
diff --git a/src/map/buyingstore.c b/src/map/buyingstore.c
index dc07c2409..7041042df 100644
--- a/src/map/buyingstore.c
+++ b/src/map/buyingstore.c
@@ -384,8 +384,8 @@ void buyingstore_trade(struct map_session_data* sd, int account_id, unsigned int
}
if( iMap->save_settings&128 ) {
- chrif_save(sd, 0);
- chrif_save(pl_sd, 0);
+ chrif->save(sd, 0);
+ chrif->save(pl_sd, 0);
}
// check whether or not there is still something to buy
diff --git a/src/map/chrif.c b/src/map/chrif.c
index a95193363..9e8b18d3b 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -53,39 +53,39 @@ static const int packet_len_table[0x3d] = { // U - used, F - free
//2af9: Incoming, chrif_connectack -> 'answer of the 2af8 login(ok / fail)'
//2afa: Outgoing, chrif_sendmap -> 'sending our maps'
//2afb: Incoming, chrif_sendmapack -> 'Maps received successfully / or not ..'
-//2afc: Outgoing, chrif_scdata_request -> request sc_data for pc->authok'ed char. <- new command reuses previous one.
-//2afd: Incoming, chrif_authok -> 'client authentication ok'
+//2afc: Outgoing, chrif->scdata_request -> request sc_data for pc->authok'ed char. <- new command reuses previous one.
+//2afd: Incoming, chrif->authok -> 'client authentication ok'
//2afe: Outgoing, send_usercount_tochar -> 'sends player count of this map server to charserver'
-//2aff: Outgoing, send_users_tochar -> 'sends all actual connected character ids to charserver'
+//2aff: Outgoing, chrif->send_users_tochar -> 'sends all actual connected character ids to charserver'
//2b00: Incoming, iMap->setusers -> 'set the actual usercount? PACKET.2B COUNT.L.. ?' (not sure)
-//2b01: Outgoing, chrif_save -> 'charsave of char XY account XY (complete struct)'
-//2b02: Outgoing, chrif_charselectreq -> 'player returns from ingame to charserver to select another char.., this packets includes sessid etc' ? (not 100% sure)
+//2b01: Outgoing, chrif->save -> 'charsave of char XY account XY (complete struct)'
+//2b02: Outgoing, chrif->charselectreq -> 'player returns from ingame to charserver to select another char.., this packets includes sessid etc' ? (not 100% sure)
//2b03: Incoming, clif_charselectok -> '' (i think its the packet after enterworld?) (not sure)
//2b04: Incoming, chrif_recvmap -> 'getting maps from charserver of other mapserver's'
-//2b05: Outgoing, chrif_changemapserver -> 'Tell the charserver the mapchange / quest for ok...'
+//2b05: Outgoing, chrif->changemapserver -> 'Tell the charserver the mapchange / quest for ok...'
//2b06: Incoming, chrif_changemapserverack -> 'awnser of 2b05, ok/fail, data: dunno^^'
-//2b07: Outgoing, chrif_removefriend -> 'Tell charserver to remove friend_id from char_id friend list'
-//2b08: Outgoing, chrif_searchcharid -> '...'
+//2b07: Outgoing, chrif->removefriend -> 'Tell charserver to remove friend_id from char_id friend list'
+//2b08: Outgoing, chrif->searchcharid -> '...'
//2b09: Incoming, map_addchariddb -> 'Adds a name to the nick db'
//2b0a: Incoming/Outgoing, socket_datasync()
//2b0b: Outgoing, update charserv skillid2idx
-//2b0c: Outgoing, chrif_changeemail -> 'change mail address ...'
+//2b0c: Outgoing, chrif->changeemail -> 'change mail address ...'
//2b0d: Incoming, chrif_changedsex -> 'Change sex of acc XY'
-//2b0e: Outgoing, chrif_char_ask_name -> 'Do some operations (change sex, ban / unban etc)'
+//2b0e: Outgoing, chrif->char_ask_name -> 'Do some operations (change sex, ban / unban etc)'
//2b0f: Incoming, chrif_char_ask_name_answer -> 'answer of the 2b0e'
-//2b10: Outgoing, chrif_updatefamelist -> 'Update the fame ranking lists and send them'
-//2b11: Outgoing, chrif_divorce -> 'tell the charserver to do divorce'
+//2b10: Outgoing, chrif->updatefamelist -> 'Update the fame ranking lists and send them'
+//2b11: Outgoing, chrif->divorce -> 'tell the charserver to do divorce'
//2b12: Incoming, chrif_divorceack -> 'divorce chars
//2b13: FREE
//2b14: Incoming, chrif_accountban -> 'not sure: kick the player with message XY'
//2b15: FREE
-//2b16: Outgoing, chrif_ragsrvinfo -> 'sends base / job / drop rates ....'
-//2b17: Outgoing, chrif_char_offline -> 'tell the charserver that the char is now offline'
-//2b18: Outgoing, chrif_char_reset_offline -> 'set all players OFF!'
-//2b19: Outgoing, chrif_char_online -> 'tell the charserver that the char .. is online'
-//2b1a: Outgoing, chrif_buildfamelist -> 'Build the fame ranking lists and send them'
+//2b16: Outgoing, chrif->ragsrvinfo -> 'sends base / job / drop rates ....'
+//2b17: Outgoing, chrif->char_offline -> 'tell the charserver that the char is now offline'
+//2b18: Outgoing, chrif->char_reset_offline -> 'set all players OFF!'
+//2b19: Outgoing, chrif->char_online -> 'tell the charserver that the char .. is online'
+//2b1a: Outgoing, chrif->buildfamelist -> 'Build the fame ranking lists and send them'
//2b1b: Incoming, chrif_recvfamelist -> 'Receive fame ranking lists'
-//2b1c: Outgoing, chrif_save_scdata -> 'Send sc_data of player for saving.'
+//2b1c: Outgoing, chrif->save_scdata -> 'Send sc_data of player for saving.'
//2b1d: Incoming, chrif_load_scdata -> 'received sc_data of player for loading.'
//2b1e: Incoming, chrif_update_ip -> 'Reqest forwarded from char-server for interserver IP sync.' [Lance]
//2b1f: Incoming, chrif_disconnectplayer -> 'disconnects a player (aid X) with the message XY ... 0x81 ..' [Sirius]
@@ -95,10 +95,9 @@ static const int packet_len_table[0x3d] = { // U - used, F - free
//2b23: Outgoing, chrif_keepalive. charserver ping.
//2b24: Incoming, chrif_keepalive_ack. charserver ping reply.
//2b25: Incoming, chrif_deadopt -> 'Removes baby from Father ID and Mother ID'
-//2b26: Outgoing, chrif_authreq -> 'client authentication request'
+//2b26: Outgoing, chrif->authreq -> 'client authentication request'
//2b27: Incoming, chrif_authfail -> 'client authentication failed'
-int chrif_connected = 0;
int char_fd = -1;
int srvinfo;
static char char_ip_str[128];
@@ -106,14 +105,13 @@ static uint32 char_ip = 0;
static uint16 char_port = 6121;
static char userid[NAME_LENGTH], passwd[NAME_LENGTH];
static int chrif_state = 0;
-int other_mapserver_count=0; //Holds count of how many other map servers are online (apart of this instance) [Skotlex]
//Interval at which map server updates online listing. [Valaris]
#define CHECK_INTERVAL 3600000
//Interval at which map server sends number of connected users. [Skotlex]
#define UPDATE_INTERVAL 10000
//This define should spare writing the check in every function. [Skotlex]
-#define chrif_check(a) { if(!chrif_isconnected()) return a; }
+#define chrif_check(a) { if(!chrif->isconnected()) return a; }
/// Resets all the data.
@@ -139,7 +137,7 @@ struct auth_node* chrif_search(int account_id) {
}
struct auth_node* chrif_auth_check(int account_id, int char_id, enum sd_state state) {
- struct auth_node *node = chrif_search(account_id);
+ struct auth_node *node = chrif->search(account_id);
return ( node && node->char_id == char_id && node->state == state ) ? node : NULL;
}
@@ -147,7 +145,7 @@ struct auth_node* chrif_auth_check(int account_id, int char_id, enum sd_state st
bool chrif_auth_delete(int account_id, int char_id, enum sd_state state) {
struct auth_node *node;
- if ( (node = chrif_auth_check(account_id, char_id, state) ) ) {
+ if ( (node = chrif->auth_check(account_id, char_id, state) ) ) {
int fd = node->sd ? node->sd->fd : node->fd;
if ( session[fd] && session[fd]->session_data == node->sd )
@@ -171,7 +169,7 @@ bool chrif_auth_delete(int account_id, int char_id, enum sd_state state) {
static bool chrif_sd_to_auth(TBL_PC* sd, enum sd_state state) {
struct auth_node *node;
- if ( chrif_search(sd->status.account_id) )
+ if ( chrif->search(sd->status.account_id) )
return false; //Already exists?
node = ers_alloc(auth_db_ers, struct auth_node);
@@ -208,12 +206,12 @@ static bool chrif_auth_logout(TBL_PC* sd, enum sd_state state) {
}
bool chrif_auth_finished(TBL_PC* sd) {
- struct auth_node *node= chrif_search(sd->status.account_id);
+ struct auth_node *node= chrif->search(sd->status.account_id);
if ( node && node->sd == sd && node->state == ST_LOGIN ) {
node->sd = NULL;
- return chrif_auth_delete(node->account_id, node->char_id, ST_LOGIN);
+ return chrif->auth_delete(node->account_id, node->char_id, ST_LOGIN);
}
return false;
@@ -276,8 +274,8 @@ int chrif_save(struct map_session_data *sd, int flag) {
if (flag && sd->state.active) { //Store player data which is quitting
//FIXME: SC are lost if there's no connection at save-time because of the way its related data is cleared immediately after this function. [Skotlex]
- if ( chrif_isconnected() )
- chrif_save_scdata(sd);
+ if ( chrif->isconnected() )
+ chrif->save_scdata(sd);
if ( !chrif_auth_logout(sd,flag == 1 ? ST_LOGOUT : ST_MAPCHANGE) )
ShowError("chrif_save: Failed to set up player %d:%d for proper quitting!\n", sd->status.account_id, sd->status.char_id);
}
@@ -367,7 +365,7 @@ int chrif_recvmap(int fd) {
if (battle_config.etc_log)
ShowStatus("Received maps from %d.%d.%d.%d:%d (%d maps)\n", CONVIP(ip), port, j);
- other_mapserver_count++;
+ chrif->other_mapserver_count++;
return 0;
}
@@ -381,7 +379,7 @@ int chrif_removemap(int fd) {
for(i = 10, j = 0; i < RFIFOW(fd, 2); i += 4, j++)
iMap->eraseipport(RFIFOW(fd, i), ip, port);
- other_mapserver_count--;
+ chrif->other_mapserver_count--;
if(battle_config.etc_log)
ShowStatus("remove map of server %d.%d.%d.%d:%d (%d maps)\n", CONVIP(ip), port, j);
@@ -391,15 +389,15 @@ int chrif_removemap(int fd) {
// received after a character has been "final saved" on the char-server
static void chrif_save_ack(int fd) {
- chrif_auth_delete(RFIFOL(fd,2), RFIFOL(fd,6), ST_LOGOUT);
- chrif_check_shutdown();
+ chrif->auth_delete(RFIFOL(fd,2), RFIFOL(fd,6), ST_LOGOUT);
+ chrif->check_shutdown();
}
// request to move a character between mapservers
int chrif_changemapserver(struct map_session_data* sd, uint32 ip, uint16 port) {
nullpo_retr(-1, sd);
- if (other_mapserver_count < 1) {//No other map servers are online!
+ if (chrif->other_mapserver_count < 1) {//No other map servers are online!
clif->authfail_fd(sd->fd, 0);
return -1;
}
@@ -430,7 +428,7 @@ int chrif_changemapserver(struct map_session_data* sd, uint32 ip, uint16 port) {
int chrif_changemapserverack(int account_id, int login_id1, int login_id2, int char_id, short map_index, short x, short y, uint32 ip, uint16 port) {
struct auth_node *node;
- if ( !( node = chrif_auth_check(account_id, char_id, ST_MAPCHANGE) ) )
+ if ( !( node = chrif->auth_check(account_id, char_id, ST_MAPCHANGE) ) )
return -1;
if ( !login_id1 ) {
@@ -440,7 +438,7 @@ int chrif_changemapserverack(int account_id, int login_id1, int login_id2, int c
clif->changemapserver(node->sd, map_index, x, y, ntohl(ip), ntohs(port));
//Player has been saved already, remove him from memory. [Skotlex]
- chrif_auth_delete(account_id, char_id, ST_MAPCHANGE);
+ chrif->auth_delete(account_id, char_id, ST_MAPCHANGE);
return 0;
}
@@ -458,7 +456,7 @@ int chrif_connectack(int fd) {
ShowStatus("Successfully logged on to Char Server (Connection: '"CL_WHITE"%d"CL_RESET"').\n",fd);
chrif_state = 1;
- chrif_connected = 1;
+ chrif->chrif_connected = 1;
chrif_sendmap(fd);
@@ -470,7 +468,7 @@ int chrif_connectack(int fd) {
}
socket_datasync(fd, true);
- chrif_skillid2idx(fd);
+ chrif->skillid2idx(fd);
return 0;
}
@@ -485,13 +483,13 @@ static int chrif_reconnect(DBKey key, DBData *data, va_list ap) {
case ST_LOGIN:
if ( node->sd && node->char_dat == NULL ) {//Since there is no way to request the char auth, make it fail.
pc->authfail(node->sd);
- chrif_char_offline(node->sd);
- chrif_auth_delete(node->account_id, node->char_id, ST_LOGIN);
+ chrif->char_offline(node->sd);
+ chrif->auth_delete(node->account_id, node->char_id, ST_LOGIN);
}
break;
case ST_LOGOUT:
//Re-send final save
- chrif_save(node->sd, 1);
+ chrif->save(node->sd, 1);
break;
case ST_MAPCHANGE: { //Re-send map-change request.
struct map_session_data *sd = node->sd;
@@ -499,7 +497,7 @@ static int chrif_reconnect(DBKey key, DBData *data, va_list ap) {
uint16 port;
if( iMap->mapname2ipport(sd->mapindex,&ip,&port) == 0 )
- chrif_changemapserver(sd, ip, port);
+ chrif->changemapserver(sd, ip, port);
else //too much lag/timeout is the closest explanation for this error.
clif->authfail_fd(sd->fd, 3);
@@ -517,10 +515,10 @@ void chrif_on_ready(void) {
chrif_state = 2;
- chrif_check_shutdown();
+ chrif->check_shutdown();
//If there are players online, send them to the char-server. [Skotlex]
- send_users_tochar();
+ chrif->send_users_tochar();
//Auth db reconnect handling
auth_db->foreach(auth_db,chrif_reconnect);
@@ -572,9 +570,9 @@ int chrif_scdata_request(int account_id, int char_id) {
* Request auth confirmation
*------------------------------------------*/
void chrif_authreq(struct map_session_data *sd) {
- struct auth_node *node= chrif_search(sd->bl.id);
+ struct auth_node *node= chrif->search(sd->bl.id);
- if( node != NULL || !chrif_isconnected() ) {
+ if( node != NULL || !chrif->isconnected() ) {
set_eof(sd->fd);
return;
}
@@ -622,7 +620,7 @@ void chrif_authok(int fd) {
if ( ( sd = iMap->id2sd(account_id) ) != NULL )
return;
- if ( ( node = chrif_search(account_id) ) == NULL )
+ if ( ( node = chrif->search(account_id) ) == NULL )
return; // should not happen
if ( node->state != ST_LOGIN )
@@ -632,7 +630,7 @@ void chrif_authok(int fd) {
/*
//When we receive double login info and the client has not connected yet,
//discard the older one and keep the new one.
- chrif_auth_delete(node->account_id, node->char_id, ST_LOGIN);
+ chrif->auth_delete(node->account_id, node->char_id, ST_LOGIN);
*/
return; // should not happen
}
@@ -651,8 +649,8 @@ void chrif_authok(int fd) {
pc->authfail(sd);
}
- chrif_char_offline(sd); //Set him offline, the char server likely has it set as online already.
- chrif_auth_delete(account_id, char_id, ST_LOGIN);
+ chrif->char_offline(sd); //Set him offline, the char server likely has it set as online already.
+ chrif->auth_delete(account_id, char_id, ST_LOGIN);
}
// client authentication failed
@@ -667,7 +665,7 @@ void chrif_authfail(int fd) {/* HELLO WORLD. ip in RFIFOL 15 is not being used (
login_id1 = RFIFOL(fd,10);
sex = RFIFOB(fd,14);
- node = chrif_search(account_id);
+ node = chrif->search(account_id);
if( node != NULL &&
node->account_id == account_id &&
@@ -677,7 +675,7 @@ void chrif_authfail(int fd) {/* HELLO WORLD. ip in RFIFOL 15 is not being used (
node->state == ST_LOGIN )
{// found a match
clif->authfail_fd(node->fd, 0);
- chrif_auth_delete(account_id, char_id, ST_LOGIN);
+ chrif->auth_delete(account_id, char_id, ST_LOGIN);
}
}
@@ -695,13 +693,13 @@ int auth_db_cleanup_sub(DBKey key, DBData *data, va_list ap) {
case ST_LOGOUT:
//Re-save attempt (->sd should never be null here).
node->node_created = iTimer->gettick(); //Refresh tick (avoid char-server load if connection is really bad)
- chrif_save(node->sd, 1);
+ chrif->save(node->sd, 1);
break;
default:
//Clear data. any connected players should have timed out by now.
ShowInfo("auth_db: Node (state %s) timed out for %d:%d\n", states[node->state], node->account_id, node->char_id);
- chrif_char_offline_nsd(node->account_id, node->char_id);
- chrif_auth_delete(node->account_id, node->char_id, node->state);
+ chrif->char_offline_nsd(node->account_id, node->char_id);
+ chrif->auth_delete(node->account_id, node->char_id, node->state);
break;
}
return 1;
@@ -825,7 +823,7 @@ int chrif_changesex(struct map_session_data *sd) {
/*==========================================
* R 2b0f <accid>.l <name>.24B <type>.w <answer>.w
- * Processing a reply to chrif_char_ask_name() (request to modify an account).
+ * Processing a reply to chrif->char_ask_name() (request to modify an account).
* type of operation:
* 1: block, 2: ban, 3: unblock, 4: unban, 5: changesex
* type of answer:
@@ -1037,9 +1035,9 @@ int chrif_disconnectplayer(int fd) {
sd = iMap->id2sd(account_id);
if( sd == NULL ) {
- struct auth_node* auth = chrif_search(account_id);
+ struct auth_node* auth = chrif->search(account_id);
- if( auth != NULL && chrif_auth_delete(account_id, auth->char_id, ST_LOGIN) )
+ if( auth != NULL && chrif->auth_delete(account_id, auth->char_id, ST_LOGIN) )
return 0;
return -1;
@@ -1333,11 +1331,11 @@ int chrif_char_online(struct map_session_data *sd) {
/// Called when the connection to Char Server is disconnected.
void chrif_on_disconnect(void) {
- if( chrif_connected != 1 )
+ if( chrif->chrif_connected != 1 )
ShowWarning("Connection to Char Server lost.\n\n");
- chrif_connected = 0;
+ chrif->chrif_connected = 0;
- other_mapserver_count = 0; //Reset counter. We receive ALL maps from all map-servers on reconnect.
+ chrif->other_mapserver_count = 0; //Reset counter. We receive ALL maps from all map-servers on reconnect.
iMap->eraseallipport();
//Attempt to reconnect in a second. [Skotlex]
@@ -1447,7 +1445,7 @@ int chrif_parse(int fd) {
switch(cmd) {
case 0x2af9: chrif_connectack(fd); break;
case 0x2afb: chrif_sendmapack(fd); break;
- case 0x2afd: chrif_authok(fd); break;
+ case 0x2afd: chrif->authok(fd); break;
case 0x2b00: iMap->setusers(RFIFOL(fd,2)); chrif_keepalive(fd); break;
case 0x2b03: clif->charselectok(RFIFOL(fd,2), RFIFOB(fd,6)); break;
case 0x2b04: chrif_recvmap(fd); break;
@@ -1546,15 +1544,15 @@ static int check_connect_char_server(int tid, unsigned int tick, int id, intptr_
realloc_fifo(char_fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK);
chrif_connect(char_fd);
- chrif_connected = (chrif_state == 2);
+ chrif->chrif_connected = (chrif_state == 2);
srvinfo = 0;
} else {
if (srvinfo == 0) {
- chrif_ragsrvinfo(battle_config.base_exp_rate, battle_config.job_exp_rate, battle_config.item_rate_common);
+ chrif->ragsrvinfo(battle_config.base_exp_rate, battle_config.job_exp_rate, battle_config.item_rate_common);
srvinfo = 1;
}
}
- if ( chrif_isconnected() )
+ if ( chrif->isconnected() )
displayed = 0;
return 0;
}
@@ -1648,3 +1646,65 @@ int do_init_chrif(void) {
return 0;
}
+
+/*=====================================
+* Default Functions : chrif.h
+* Generated by HerculesInterfaceMaker
+* created by Susu
+*-------------------------------------*/
+void chrif_defaults(void) {
+ chrif = &chrif_s;
+
+ /* vars */
+
+ chrif->chrif_connected = 0;
+ chrif->other_mapserver_count = 0;
+
+ /* funcs */
+
+ chrif->setuserid = chrif_setuserid;
+ chrif->setpasswd = chrif_setpasswd;
+ chrif->checkdefaultlogin = chrif_checkdefaultlogin;
+ chrif->setip = chrif_setip;
+ chrif->setport = chrif_setport;
+
+ chrif->isconnected = chrif_isconnected;
+ chrif->check_shutdown = chrif_check_shutdown;
+
+ chrif->search = chrif_search;
+ chrif->auth_check = chrif_auth_check;
+ chrif->auth_delete = chrif_auth_delete;
+ chrif->auth_finished = chrif_auth_finished;
+
+ chrif->authreq = chrif_authreq;
+ chrif->authok = chrif_authok;
+ chrif->scdata_request = chrif_scdata_request;
+ chrif->save = chrif_save;
+ chrif->charselectreq = chrif_charselectreq;
+ chrif->changemapserver = chrif_changemapserver;
+
+ chrif->searchcharid = chrif_searchcharid;
+ chrif->changeemail = chrif_changeemail;
+ chrif->char_ask_name = chrif_char_ask_name;
+ chrif->updatefamelist = chrif_updatefamelist;
+ chrif->buildfamelist = chrif_buildfamelist;
+ chrif->save_scdata = chrif_save_scdata;
+ chrif->ragsrvinfo = chrif_ragsrvinfo;
+ chrif->char_offline = chrif_char_offline;
+ chrif->char_offline_nsd = chrif_char_offline_nsd;
+ chrif->char_reset_offline = chrif_char_reset_offline;
+ chrif->send_users_tochar = send_users_tochar;
+ chrif->char_online = chrif_char_online;
+ chrif->changesex = chrif_changesex;
+ //chrif->chardisconnect = chrif_chardisconnect;
+ chrif->divorce = chrif_divorce;
+
+ chrif->removefriend = chrif_removefriend;
+ chrif->send_report = chrif_send_report;
+
+ chrif->do_final_chrif = do_final_chrif;
+ chrif->do_init_chrif = do_init_chrif;
+
+ chrif->flush_fifo = chrif_flush_fifo;
+ chrif->skillid2idx = chrif_skillid2idx;
+}
diff --git a/src/map/chrif.h b/src/map/chrif.h
index 9c7142905..faabedeed 100644
--- a/src/map/chrif.h
+++ b/src/map/chrif.h
@@ -1,13 +1,10 @@
// Copyright (c) Hercules Dev Team, licensed under GNU GPL.
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-
#ifndef _CHRIF_H_
#define _CHRIF_H_
-
#include "../common/cbasetypes.h"
#include <time.h>
-
enum sd_state { ST_LOGIN, ST_LOGOUT, ST_MAPCHANGE };
struct auth_node {
int account_id, char_id;
@@ -19,53 +16,72 @@ struct auth_node {
enum sd_state state; //To track whether player was login in/out or changing maps.
};
-void chrif_setuserid(char* id);
-void chrif_setpasswd(char* pwd);
-void chrif_checkdefaultlogin(void);
-int chrif_setip(const char* ip);
-void chrif_setport(uint16 port);
-
-int chrif_isconnected(void);
-void chrif_check_shutdown(void);
-extern int chrif_connected;
-extern int other_mapserver_count;
-struct auth_node* chrif_search(int account_id);
-struct auth_node* chrif_auth_check(int account_id, int char_id, enum sd_state state);
-bool chrif_auth_delete(int account_id, int char_id, enum sd_state state);
-bool chrif_auth_finished(struct map_session_data* sd);
-void chrif_authreq(struct map_session_data* sd);
-void chrif_authok(int fd);
-int chrif_scdata_request(int account_id, int char_id);
-int chrif_save(struct map_session_data* sd, int flag);
-int chrif_charselectreq(struct map_session_data* sd, uint32 s_ip);
-int chrif_changemapserver(struct map_session_data* sd, uint32 ip, uint16 port);
+/*=====================================
+* Interface : chrif.h
+* Generated by HerculesInterfaceMaker
+* created by Susu
+*-------------------------------------*/
+struct chrif_interface {
-int chrif_searchcharid(int char_id);
-int chrif_changeemail(int id, const char *actual_email, const char *new_email);
-int chrif_char_ask_name(int acc, const char* character_name, unsigned short operation_type, int year, int month, int day, int hour, int minute, int second);
-int chrif_updatefamelist(struct map_session_data *sd);
-int chrif_buildfamelist(void);
-int chrif_save_scdata(struct map_session_data *sd);
-int chrif_ragsrvinfo(int base_rate,int job_rate, int drop_rate);
-int chrif_char_offline(struct map_session_data *sd);
-int chrif_char_offline_nsd(int account_id, int char_id);
-int chrif_char_reset_offline(void);
-int send_users_tochar(void);
-int chrif_char_online(struct map_session_data *sd);
-int chrif_changesex(struct map_session_data *sd);
-int chrif_chardisconnect(struct map_session_data *sd);
-int chrif_divorce(int partner_id1, int partner_id2);
+ /* vars */
+
+ int chrif_connected;
+ int other_mapserver_count; //Holds count of how many other map servers are online (apart of this instance) [Skotlex]
-int chrif_removefriend(int char_id, int friend_id);
-void chrif_send_report(char* buf, int len);
+ /* funcs */
+
+ void (*setuserid) (char* id);
+ void (*setpasswd) (char* pwd);
+ void (*checkdefaultlogin) (void);
+ int (*setip) (const char* ip);
+ void (*setport) (uint16 port);
+
+ int (*isconnected) (void);
+ void (*check_shutdown) (void);
+
+ struct auth_node* (*search) (int account_id);
+ struct auth_node* (*auth_check) (int account_id, int char_id, enum sd_state state);
+ bool (*auth_delete) (int account_id, int char_id, enum sd_state state);
+ bool (*auth_finished) (struct map_session_data* sd);
+
+ void (*authreq) (struct map_session_data* sd);
+ void (*authok) (int fd);
+ int (*scdata_request) (int account_id, int char_id);
+ int (*save) (struct map_session_data* sd, int flag);
+ int (*charselectreq) (struct map_session_data* sd, uint32 s_ip);
+ int (*changemapserver) (struct map_session_data* sd, uint32 ip, uint16 port);
+
+ int (*searchcharid) (int char_id);
+ int (*changeemail) (int id, const char *actual_email, const char *new_email);
+ int (*char_ask_name) (int acc, const char* character_name, unsigned short operation_type, int year, int month, int day, int hour, int minute, int second);
+ int (*updatefamelist) (struct map_session_data *sd);
+ int (*buildfamelist) (void);
+ int (*save_scdata) (struct map_session_data *sd);
+ int (*ragsrvinfo) (int base_rate,int job_rate, int drop_rate);
+ int (*char_offline) (struct map_session_data *sd);
+ int (*char_offline_nsd) (int account_id, int char_id);
+ int (*char_reset_offline) (void);
+ int (*send_users_tochar) (void);
+ int (*char_online) (struct map_session_data *sd);
+ int (*changesex) (struct map_session_data *sd);
+ int (*chardisconnect) (struct map_session_data *sd);
+ int (*divorce) (int partner_id1, int partner_id2);
+
+ int (*removefriend) (int char_id, int friend_id);
+ void (*send_report) (char* buf, int len);
+
+ int (*do_final_chrif) (void);
+ int (*do_init_chrif) (void);
+
+ int (*flush_fifo) (void);
+ void (*skillid2idx) (int fd);
+} chrif_s;
-int do_final_chrif(void);
-int do_init_chrif(void);
+struct chrif_interface *chrif;
-int chrif_flush_fifo(void);
-void chrif_skillid2idx(int fd);
+void chrif_defaults(void);
#endif /* _CHRIF_H_ */
diff --git a/src/map/clif.c b/src/map/clif.c
index 3e01230b2..f98df7ec3 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -9295,7 +9295,7 @@ void clif_parse_WantToConnection(int fd, struct map_session_data* sd) {
}
if (bl ||
- ((node=chrif_search(account_id)) && //An already existing node is valid only if it is for this login.
+ ((node=chrif->search(account_id)) && //An already existing node is valid only if it is for this login.
!(node->account_id == account_id && node->char_id == char_id && node->state == ST_LOGIN)))
{
clif->authfail_fd(fd, 8); //Still recognizes last connection
@@ -9321,7 +9321,7 @@ void clif_parse_WantToConnection(int fd, struct map_session_data* sd) {
WFIFOSET(fd,packet_len(0x283));
#endif
- chrif_authreq(sd);
+ chrif->authreq(sd);
}
void clif_hercules_chsys_mjoin(struct map_session_data *sd) {
if( !map[sd->bl.m].channel ) {
@@ -10334,7 +10334,7 @@ void clif_parse_Restart(int fd, struct map_session_data *sd) {
if( !sd->sc.data[SC_CLOAKING] && !sd->sc.data[SC_HIDING] && !sd->sc.data[SC_CHASEWALK] && !sd->sc.data[SC_CLOAKINGEXCEED] &&
(!battle_config.prevent_logout || DIFF_TICK(iTimer->gettick(), sd->canlog_tick) > battle_config.prevent_logout) )
{ //Send to char-server for character selection.
- chrif_charselectreq(sd, session[fd]->client_addr);
+ chrif->charselectreq(sd, session[fd]->client_addr);
} else {
clif->disconnect_ack(sd, 1);
}
@@ -13869,7 +13869,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
+ if(chrif->removefriend(char_id,sd->status.char_id)) { // char-server offline, abort
clif->message(fd, msg_txt(673)); //"This action can't be performed at the moment. Please try again later."
return;
}
@@ -14560,7 +14560,7 @@ void clif_parse_Mail_getattach(int fd, struct map_session_data *sd)
int i;
bool fail = false;
- if( !chrif_isconnected() )
+ if( !chrif->isconnected() )
return;
if( mail_id <= 0 )
return;
@@ -14621,7 +14621,7 @@ void clif_parse_Mail_delete(int fd, struct map_session_data *sd)
int mail_id = RFIFOL(fd,2);
int i;
- if( !chrif_isconnected() )
+ if( !chrif->isconnected() )
return;
if( mail_id <= 0 )
return;
@@ -14670,7 +14670,7 @@ void clif_parse_Mail_setattach(int fd, struct map_session_data *sd)
int amount = RFIFOL(fd,4);
unsigned char flag;
- if( !chrif_isconnected() )
+ if( !chrif->isconnected() )
return;
if (idx < 0 || amount < 0)
return;
@@ -14704,7 +14704,7 @@ void clif_parse_Mail_send(int fd, struct map_session_data *sd)
struct mail_message msg;
int body_len;
- if( !chrif_isconnected() )
+ if( !chrif->isconnected() )
return;
if( sd->state.trading )
return;
diff --git a/src/map/intif.c b/src/map/intif.c
index e364f5c25..294d79656 100644
--- a/src/map/intif.c
+++ b/src/map/intif.c
@@ -147,7 +147,7 @@ int intif_broadcast(const char* mes, int len, int type)
if (CheckForCharServer())
return 0;
- if (other_mapserver_count < 1)
+ if (chrif->other_mapserver_count < 1)
return 0; //No need to send.
WFIFOHEAD(inter_fd, 16 + lp + len);
@@ -175,7 +175,7 @@ int intif_broadcast2(const char* mes, int len, unsigned long fontColor, short fo
if (CheckForCharServer())
return 0;
- if (other_mapserver_count < 1)
+ if (chrif->other_mapserver_count < 1)
return 0; //No need to send.
WFIFOHEAD(inter_fd, 16 + len);
@@ -219,7 +219,7 @@ int intif_wis_message(struct map_session_data *sd, char *nick, char *mes, int me
if (CheckForCharServer())
return 0;
- if (other_mapserver_count < 1)
+ if (chrif->other_mapserver_count < 1)
{ //Character not found.
clif->wis_end(sd->fd, 1);
return 0;
@@ -502,7 +502,7 @@ int intif_party_message(int party_id,int account_id,const char *mes,int len)
if (CheckForCharServer())
return 0;
- if (other_mapserver_count < 1)
+ if (chrif->other_mapserver_count < 1)
return 0; //No need to send.
WFIFOHEAD(inter_fd,len + 12);
@@ -637,7 +637,7 @@ int intif_guild_message(int guild_id,int account_id,const char *mes,int len)
if (CheckForCharServer())
return 0;
- if (other_mapserver_count < 1)
+ if (chrif->other_mapserver_count < 1)
return 0; //No need to send.
WFIFOHEAD(inter_fd, len + 12);
@@ -950,7 +950,7 @@ int intif_parse_Registers(int fd)
struct global_reg *reg;
int *qty;
int account_id = RFIFOL(fd,4), char_id = RFIFOL(fd,8);
- struct auth_node *node = chrif_auth_check(account_id, char_id, ST_LOGIN);
+ struct auth_node *node = chrif->auth_check(account_id, char_id, ST_LOGIN);
if (node)
sd = node->sd;
else { //Normally registries should arrive for in log-in chars.
@@ -1723,7 +1723,7 @@ static void intif_parse_Mail_send(int fd)
{
clif->mail_send(sd->fd, false);
if( iMap->save_settings&16 )
- chrif_save(sd, 0);
+ chrif->save(sd, 0);
}
}
}
@@ -1814,7 +1814,7 @@ static void intif_parse_Auction_register(int fd)
{
clif->auction_message(sd->fd, 1); // Confirmation Packet ??
if( iMap->save_settings&32 )
- chrif_save(sd,0);
+ chrif->save(sd,0);
}
else
{
diff --git a/src/map/map.c b/src/map/map.c
index 74e2c74e0..ee56f140f 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -1566,7 +1566,7 @@ void map_reqnickdb(struct map_session_data * sd, int charid)
CREATE(req, struct charid_request, 1);
req->next = p->requests;
p->requests = req;
- chrif_searchcharid(charid);
+ chrif->searchcharid(charid);
}
/*==========================================
@@ -1629,11 +1629,11 @@ int map_quit(struct map_session_data *sd) {
int i;
if(!sd->state.active) { //Removing a player that is not active.
- struct auth_node *node = chrif_search(sd->status.account_id);
+ struct auth_node *node = chrif->search(sd->status.account_id);
if (node && node->char_id == sd->status.char_id &&
node->state != ST_LOGOUT)
//Except when logging out, clear the auth-connect data immediately.
- chrif_auth_delete(node->account_id, node->char_id, node->state);
+ chrif->auth_delete(node->account_id, node->char_id, node->state);
//Non-active players should not have loaded any data yet (or it was cleared already) so no additional cleanups are needed.
return 0;
}
@@ -1728,7 +1728,7 @@ int map_quit(struct map_session_data *sd) {
party->booking_delete(sd); // Party Booking [Spiria]
pc->makesavestatus(sd);
pc->clean_skilltree(sd);
- chrif_save(sd,1);
+ chrif->save(sd,1);
unit_free_pc(sd);
return 0;
}
@@ -1790,7 +1790,7 @@ const char* map_charid2nick(int charid)
if( *p->nick )
return p->nick;// name in nick_db
- chrif_searchcharid(charid);// request the name
+ chrif->searchcharid(charid);// request the name
return NULL;
}
@@ -3354,13 +3354,13 @@ int map_config_read(char *cfgName) {
if( msg_silent ) // only bother if its actually enabled
ShowInfo("Console Silent Setting: %d\n", atoi(w2));
} else if (strcmpi(w1, "userid")==0)
- chrif_setuserid(w2);
+ chrif->setuserid(w2);
else if (strcmpi(w1, "passwd") == 0)
- chrif_setpasswd(w2);
+ chrif->setpasswd(w2);
else if (strcmpi(w1, "char_ip") == 0)
- char_ip_set = chrif_setip(w2);
+ char_ip_set = chrif->setip(w2);
else if (strcmpi(w1, "char_port") == 0)
- chrif_setport(atoi(w2));
+ chrif->setport(atoi(w2));
else if (strcmpi(w1, "map_ip") == 0)
map_ip_set = clif->setip(w2);
else if (strcmpi(w1, "bind_ip") == 0)
@@ -5018,12 +5018,12 @@ void do_final(void)
ShowStatus("Cleaned up %d maps."CL_CLL"\n", iMap->map_num);
id_db->foreach(id_db,cleanup_db_sub);
- chrif_char_reset_offline();
- chrif_flush_fifo();
+ chrif->char_reset_offline();
+ chrif->flush_fifo();
atcommand->final();
battle->final();
- do_final_chrif();
+ chrif->do_final_chrif();
ircbot->final();/* before clif. */
clif->final();
do_final_npc();
@@ -5075,7 +5075,7 @@ void do_final(void)
static int map_abort_sub(struct map_session_data* sd, va_list ap)
{
- chrif_save(sd,1);
+ chrif->save(sd,1);
return 1;
}
@@ -5093,7 +5093,7 @@ void do_abort(void)
return;
}
run = 1;
- if (!chrif_isconnected())
+ if (!chrif->isconnected())
{
if (pc_db->size(pc_db))
ShowFatalError("Server has crashed without a connection to the char-server, %u characters can't be saved!\n", pc_db->size(pc_db));
@@ -5101,7 +5101,7 @@ void do_abort(void)
}
ShowError("Server received crash signal! Attempting to save all online characters!\n");
iMap->map_foreachpc(map_abort_sub);
- chrif_flush_fifo();
+ chrif->flush_fifo();
}
/*======================================================
@@ -5161,7 +5161,7 @@ void do_shutdown(void)
mapit->free(iter);
flush_fifos();
}
- chrif_check_shutdown();
+ chrif->check_shutdown();
}
}
@@ -5233,6 +5233,7 @@ void map_hp_symbols(void) {
HPM->share(bg,"battlegrounds");
HPM->share(buyingstore,"buyingstore");
HPM->share(clif,"clif");
+ HPM->share(chrif,"chrif");
HPM->share(guild,"guild");
HPM->share(gstorage,"gstorage");
HPM->share(homun,"homun");
@@ -5266,6 +5267,7 @@ void load_defaults(void) {
battleground_defaults();
buyingstore_defaults();
clif_defaults();
+ chrif_defaults();
guild_defaults();
gstorage_defaults();
homunculus_defaults();
@@ -5398,7 +5400,7 @@ int do_init(int argc, char *argv[])
// loads npcs
iMap->reloadnpc(false);
- chrif_checkdefaultlogin();
+ chrif->checkdefaultlogin();
if (!map_ip_set || !char_ip_set) {
char ip_str[16];
@@ -5416,7 +5418,7 @@ int do_init(int argc, char *argv[])
if (!map_ip_set)
clif->setip(ip_str);
if (!char_ip_set)
- chrif_setip(ip_str);
+ chrif->setip(ip_str);
}
battle->config_read(iMap->BATTLE_CONF_FILENAME);
@@ -5461,7 +5463,7 @@ int do_init(int argc, char *argv[])
atcommand->init();
battle->init();
instance->init();
- do_init_chrif();
+ chrif->do_init_chrif();
clif->init();
ircbot->init();
script->init();
diff --git a/src/map/pc.c b/src/map/pc.c
index 0d1a99175..b1ba2b5c8 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -360,7 +360,7 @@ void pc_addfame(struct map_session_data *sd,int count)
clif->fame_taekwon(sd,count);
break;
}
- chrif_updatefamelist(sd);
+ chrif->updatefamelist(sd);
}
// Check whether a player ID is in the fame rankers' list of its job, returns his/her position if so, 0 else
@@ -1238,13 +1238,13 @@ int pc_reg_received(struct map_session_data *sd)
iMap->addiddb(&sd->bl);
iMap->delnickdb(sd->status.char_id, sd->status.name);
- if (!chrif_auth_finished(sd))
+ if (!chrif->auth_finished(sd))
ShowError("pc_reg_received: Failed to properly remove player %d:%d from logging db!\n", sd->status.account_id, sd->status.char_id);
pc->load_combo(sd);
status_calc_pc(sd,1);
- chrif_scdata_request(sd->status.account_id, sd->status.char_id);
+ chrif->scdata_request(sd->status.account_id, sd->status.char_id);
intif_Mail_requestinbox(sd->status.char_id, 0); // MAIL SYSTEM - Request Mail Inbox
intif_request_questlog(sd);
@@ -4838,8 +4838,8 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y
sd->bl.x=x;
sd->bl.y=y;
pc->clean_skilltree(sd);
- chrif_save(sd,2);
- chrif_changemapserver(sd, ip, (short)port);
+ chrif->save(sd,2);
+ chrif->changemapserver(sd, ip, (short)port);
//Free session data from this map server [Kevin]
unit_free_pc(sd);
@@ -7579,16 +7579,16 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper)
//if you were previously famous, not anymore.
if (fame_flag) {
- chrif_save(sd,0);
- chrif_buildfamelist();
+ chrif->save(sd,0);
+ chrif->buildfamelist();
} else if (sd->status.fame > 0) {
//It may be that now they are famous?
switch (sd->class_&MAPID_UPPERMASK) {
case MAPID_BLACKSMITH:
case MAPID_ALCHEMIST:
case MAPID_TAEKWON:
- chrif_save(sd,0);
- chrif_buildfamelist();
+ chrif->save(sd,0);
+ chrif->buildfamelist();
break;
}
}
@@ -9032,7 +9032,7 @@ int pc_divorce(struct map_session_data *sd)
if( (p_sd = iMap->charid2sd(sd->status.partner_id)) == NULL )
{ // Lets char server do the divorce
- if( chrif_divorce(sd->status.char_id, sd->status.partner_id) )
+ if( chrif->divorce(sd->status.char_id, sd->status.partner_id) )
return -1; // No char server connected
return 0;
@@ -9210,7 +9210,7 @@ int pc_autosave(int tid, unsigned int tick, int id, intptr_t data)
last_save_id = sd->bl.id;
save_flag = 2;
- chrif_save(sd,0);
+ chrif->save(sd,0);
break;
}
mapit->free(iter);
diff --git a/src/map/pet.c b/src/map/pet.c
index 8ed88c46c..e6ef0a488 100644
--- a/src/map/pet.c
+++ b/src/map/pet.c
@@ -408,7 +408,7 @@ int pet_birth_process(struct map_session_data *sd, struct s_pet *pet)
intif_save_petdata(sd->status.account_id,pet);
if (iMap->save_settings&8)
- chrif_save(sd,0); //is it REALLY Needed to save the char for hatching a pet? [Skotlex]
+ chrif->save(sd,0); //is it REALLY Needed to save the char for hatching a pet? [Skotlex]
if(sd->bl.prev != NULL) {
iMap->addblock(&sd->pd->bl);
diff --git a/src/map/quest.c b/src/map/quest.c
index b56088886..3776d603f 100644
--- a/src/map/quest.c
+++ b/src/map/quest.c
@@ -100,7 +100,7 @@ int quest_add(TBL_PC * sd, int quest_id)
clif->quest_add(sd, &sd->quest_log[i], sd->quest_index[i]);
if( iMap->save_settings&64 )
- chrif_save(sd,0);
+ chrif->save(sd,0);
return 0;
}
@@ -148,7 +148,7 @@ int quest_change(TBL_PC * sd, int qid1, int qid2)
clif->quest_add(sd, &sd->quest_log[i], sd->quest_index[i]);
if( iMap->save_settings&64 )
- chrif_save(sd,0);
+ chrif->save(sd,0);
return 0;
}
@@ -179,7 +179,7 @@ int quest_delete(TBL_PC * sd, int quest_id)
clif->quest_delete(sd, quest_id);
if( iMap->save_settings&64 )
- chrif_save(sd,0);
+ chrif->save(sd,0);
return 0;
}
@@ -250,7 +250,7 @@ int quest_update_status(TBL_PC * sd, int quest_id, quest_state status) {
clif->quest_delete(sd, quest_id);
if( iMap->save_settings&64 )
- chrif_save(sd,0);
+ chrif->save(sd,0);
return 0;
}
diff --git a/src/map/script.c b/src/map/script.c
index bbae42c6f..06830704b 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -9965,7 +9965,7 @@ BUILDIN(changesex)
// to avoid any problem with equipment and invalid sex, equipment is unequiped.
for( i=0; i<EQI_MAX; i++ )
if( sd->equip_index[i] >= 0 ) pc->unequipitem(sd, sd->equip_index[i], 3);
- chrif_changesex(sd);
+ chrif->changesex(sd);
return true;
}
diff --git a/src/map/skill.c b/src/map/skill.c
index 509de6f4a..413233b4f 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -17845,7 +17845,7 @@ void skill_reload (void) {
}
}
}
- chrif_skillid2idx(0);
+ chrif->skillid2idx(0);
/* lets update all players skill tree : so that if any skill modes were changed they're properly updated */
iter = mapit_getallusers();
for( sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); sd = (TBL_PC*)mapit->next(iter) )
diff --git a/src/map/storage.c b/src/map/storage.c
index e3fa073af..5b3c75d58 100644
--- a/src/map/storage.c
+++ b/src/map/storage.c
@@ -321,7 +321,7 @@ void storage_storageclose(struct map_session_data* sd)
clif->storageclose(sd);
if( iMap->save_settings&4 )
- chrif_save(sd,0); //Invokes the storage saving as well.
+ chrif->save(sd,0); //Invokes the storage saving as well.
sd->state.storage_flag = 0;
}
@@ -334,7 +334,7 @@ void storage_storage_quit(struct map_session_data* sd, int flag)
nullpo_retv(sd);
if (iMap->save_settings&4)
- chrif_save(sd, flag); //Invokes the storage saving as well.
+ chrif->save(sd, flag); //Invokes the storage saving as well.
sd->state.storage_flag = 0;
}
@@ -688,7 +688,7 @@ int storage_guild_storageclose(struct map_session_data* sd)
if (stor->storage_status)
{
if (iMap->save_settings&4)
- chrif_save(sd, 0); //This one also saves the storage. [Skotlex]
+ chrif->save(sd, 0); //This one also saves the storage. [Skotlex]
else
gstorage->save(sd->status.account_id, sd->status.guild_id,0);
stor->storage_status=0;
@@ -711,13 +711,13 @@ int storage_guild_storage_quit(struct map_session_data* sd, int flag)
stor->storage_status = 0;
clif->storageclose(sd);
if (iMap->save_settings&4)
- chrif_save(sd,0);
+ chrif->save(sd,0);
return 0;
}
if(stor->storage_status) {
if (iMap->save_settings&4)
- chrif_save(sd,0);
+ chrif->save(sd,0);
else
gstorage->save(sd->status.account_id,sd->status.guild_id,1);
}
@@ -762,4 +762,4 @@ void gstorage_defaults(void) {
gstorage->pc_quit = storage_guild_storage_quit;
gstorage->save = storage_guild_storagesave;
gstorage->saved = storage_guild_storagesaved;
-} \ No newline at end of file
+}
diff --git a/src/map/trade.c b/src/map/trade.c
index a2a29651b..c44f04884 100644
--- a/src/map/trade.c
+++ b/src/map/trade.c
@@ -206,13 +206,13 @@ int impossible_trade_check(struct map_session_data *sd)
intif_wis_message_to_gm(iMap->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
+ 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.
// 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)
+ 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).
@@ -603,8 +603,8 @@ void trade_tradecommit(struct map_session_data *sd)
// save both player to avoid crash: they always have no advantage/disadvantage between the 2 players
if (iMap->save_settings&1)
{
- chrif_save(sd,0);
- chrif_save(tsd,0);
+ chrif->save(sd,0);
+ chrif->save(tsd,0);
}
}
@@ -621,4 +621,4 @@ void trade_defaults(void)
trade->ok = trade_tradeok;
trade->cancel = trade_tradecancel;
trade->commit = trade_tradecommit;
-} \ No newline at end of file
+}
diff --git a/src/map/vending.c b/src/map/vending.c
index b9575c8dd..898008a3a 100644
--- a/src/map/vending.c
+++ b/src/map/vending.c
@@ -198,8 +198,8 @@ void vending_purchasereq(struct map_session_data* sd, int aid, unsigned int uid,
//Always save BOTH: buyer and customer
if( iMap->save_settings&2 ) {
- chrif_save(sd,0);
- chrif_save(vsd,0);
+ chrif->save(sd,0);
+ chrif->save(vsd,0);
}
//check for @AUTOTRADE users [durf]