// 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;
int login_id1, login_id2, sex, fd;
time_t expiration_time; // # of seconds 1/1/1970 (timestamp): Validity limit of the account (0 = unlimited)
struct map_session_data *sd; //Data from logged on char.
struct mmo_charstatus *char_dat; //Data from char server.
unsigned int node_created; //timestamp for node timeouts
enum sd_state state; //To track whether player was login in/out or changing maps.
};
/*=====================================
* Interface : chrif.h
* Generated by HerculesInterfaceMaker
* created by Susu
*-------------------------------------*/
struct chrif_interface {
/* vars */
int connected;
int other_mapserver_count; //Holds count of how many other map servers are online (apart of this instance) [Skotlex]
/* 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;
struct chrif_interface *chrif;
void chrif_defaults(void);
#endif /* _CHRIF_H_ */