// Copyright (c) Hercules Dev Team, licensed under GNU GPL.
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
#ifndef CHAR_MAPIF_H
#define CHAR_MAPIF_H
#include "char.h"
struct s_elemental;
struct s_homunculus;
struct s_mercenary;
struct mail_message;
/* mapif interface */
struct mapif_interface {
void (*ban) (int id, unsigned int flag, int status);
void (*server_init) (int id);
void (*server_destroy) (int id);
void (*server_reset) (int id);
void (*on_disconnect) (int id);
void (*on_parse_accinfo) (int account_id, int u_fd, int u_aid, int u_group, int map_fd);
void (*char_ban) (int char_id, time_t timestamp);
int (*sendall) (unsigned char *buf, unsigned int len);
int (*sendallwos) (int sfd, unsigned char *buf, unsigned int len);
int (*send) (int fd, unsigned char *buf, unsigned int len);
void (*send_users_count) (int users);
void (*auction_message) (int char_id, unsigned char result);
void (*auction_sendlist) (int fd, int char_id, short count, short pages, unsigned char *buf);
void (*parse_auction_requestlist) (int fd);
void (*auction_register) (int fd, struct auction_data *auction);
void (*parse_auction_register) (int fd);
void (*auction_cancel) (int fd, int char_id, unsigned char result);
void (*parse_auction_cancel) (int fd);
void (*auction_close) (int fd, int char_id, unsigned char result);
void (*parse_auction_close) (int fd);
void (*auction_bid) (int fd, int char_id, int bid, unsigned char result);
void (*parse_auction_bid) (int fd);
bool (*elemental_save) (struct s_elemental* ele);
bool (*elemental_load) (int ele_id, int char_id, struct s_elemental *ele);
bool (*elemental_delete) (int ele_id);
void (*elemental_send) (int fd, struct s_elemental *ele, unsigned char flag);
void (*parse_elemental_create) (int fd, struct s_elemental* ele);
void (*parse_elemental_load) (int fd, int ele_id, int char_id);
void (*elemental_deleted) (int fd, unsigned char flag);
void (*parse_elemental_delete) (int fd, int ele_id);
void (*elemental_saved) (int fd, unsigned char flag);
void (*parse_elemental_save) (int fd, struct s_elemental* ele);
int (*guild_created) (int fd, int account_id, struct guild *g);
int (*guild_noinfo) (int fd, int guild_id);
int (*guild_info) (int fd, struct guild *g);
int (*guild_memberadded) (int fd, int guild_id, int account_id, int char_id, int flag);
int (*guild_withdraw) (int guild_id, int account_id, int char_id, int flag, const char *name, const char *mes);
int (*guild_memberinfoshort) (struct guild *g, int idx);
int (*guild_broken) (int guild_id, int flag);
int (*guild_message) (int guild_id,int account_id,char *mes,int len, int sfd);
int (*guild_basicinfochanged) (int guild_id, int type, const void *data, int len);
int (*guild_memberinfochanged) (int guild_id, int account_id, int char_id, int type, const void *data, int len);
int (*guild_skillupack) (int guild_id, uint16 skill_id, int account_id);
int (*guild_alliance) (int guild_id1, int guild_id2, int account_id1, int account_id2, int flag, const char *name1, const char *name2);
int (*guild_position) (struct guild *g, int idx);
int (*guild_notice) (struct guild *g);
int (*guild_emblem) (struct guild *g);
int (*guild_master_changed) (struct guild *g, int aid, int cid);
int (*guild_castle_dataload) (int fd, int sz, int *castle_ids);
int (*parse_CreateGuild) (int fd,int account_id,char *name,struct guild_member *master);
int (*parse_GuildInfo) (int fd, int guild_id);
int (*parse_GuildAddMember) (int fd, int guild_id, struct guild_member *m);
int (*parse_GuildLeave) (int fd, int guild_id, int account_id, int char_id, int flag, const char *mes);
int (*parse_GuildChangeMemberInfoShort) (int fd, int guild_id, int account_id, int char_id, int online, int lv, int class_);
int (*parse_BreakGuild) (int fd, int guild_id);
int (*parse_GuildMessage) (int fd, int guild_id, int account_id, char *mes, int len);
int (*parse_GuildBasicInfoChange) (int fd, int guild_id, int type, const void *data, int len);
int (*parse_GuildMemberInfoChange) (int fd, int guild_id, int account_id, int char_id, int type, const char *data, int len);
int (*parse_GuildPosition) (int fd, int guild_id, int idx, struct guild_position *p);
int (*parse_GuildSkillUp) (int fd, int guild_id, uint16 skill_id, int account_id, int max);
int (*parse_GuildDeleteAlliance) (struct guild *g, int guild_id, int account_id1, int account_id2, int flag);
int (*parse_GuildAlliance) (int fd, int guild_id1, int guild_id2, int account_id1, int account_id2, int flag);
int (*parse_GuildNotice) (int fd, int guild_id, const char *mes1, const char *mes2);
int (*parse_GuildEmblem) (int fd, int len, int guild_id, int dummy, const char *data);
int (*parse_GuildCastleDataLoad) (int fd, int len, int *castle_ids);
int (*parse_GuildCastleDataSave) (int fd, int castle_id, int index, int value);
int (*parse_GuildMasterChange) (int fd, int guild_id, const char* name, int len);
void (*homunculus_created) (int fd, int account_id, struct s_homunculus *sh, unsigned char flag);
void (*homunculus_deleted) (int fd, int flag);
void (*homunculus_loaded) (int fd, int account_id, struct s_homunculus *hd);
void (*homunculus_saved) (int fd, int account_id, bool flag);
void (*homunculus_renamed) (int fd, int account_id, int char_id, unsigned char flag, char* name);
bool (*homunculus_save) (struct s_homunculus* hd);
bool (*homunculus_load) (int homun_id, struct s_homunculus* hd);
bool (*homunculus_delete) (int homun_id);
bool (*homunculus_rename) (char *name);
void (*parse_homunculus_create) (int fd, int len, int account_id, struct s_homunculus* phd);
void (*parse_homunculus_delete) (int fd, int homun_id);
void (*parse_homunculus_load) (int fd, int account_id, int homun_id);
void (*parse_homunculus_save) (int fd, int len, int account_id, struct s_homunculus* phd);
void (*parse_homunculus_rename) (int fd, int account_id, int char_id, char* name);
void (*mail_sendinbox) (int fd, int char_id, unsigned char flag, struct mail_data *md);
void (*parse_mail_requestinbox) (int fd);
void (*parse_mail_read) (int fd);
void (*mail_sendattach) (int fd, int char_id, struct mail_message *msg);
void (*mail_getattach) (int fd, int char_id, int mail_id);
void (*parse_mail_getattach) (int fd);
void (*mail_delete) (int fd, int char_id, int mail_id, bool failed);
void (*parse_mail_delete) (int fd);
void (*mail_new) (struct mail_message *msg);
void (*mail_return) (int fd, int char_id, int mail_id, int new_mail);
void (*parse_mail_return) (int fd);
void (*mail_send) (int fd, struct mail_message* msg);
void (*parse_mail_send) (int fd);
bool (*mercenary_save) (struct s_mercenary* merc);
bool (*mercenary_load) (int merc_id, int char_id, struct s_mercenary *merc);
bool (*mercenary_delete) (int merc_id);
void (*mercenary_send) (int fd, struct s_mercenary *merc, unsigned char flag);
void (*parse_mercenary_create) (int fd, struct s_mercenary* merc);
void (*parse_mercenary_load) (int fd, int merc_id, int char_id);
void (*mercenary_deleted) (int fd, unsigned char flag);
void (*parse_mercenary_delete) (int fd, int merc_id);
void (*mercenary_saved) (int fd, unsigned char flag);
void (*parse_mercenary_save) (int fd, struct s_mercenary* merc);
} mapif_s;
struct mapif_interface *mapif;
void mapif_defaults(void);
#endif /* CHAR_MAPIF_H */