/** * Send to login-serv the request of banking operation from map * HA 0x2740<aid>L <type>B <data>L * @param account_id * @param type : 0 = select, 1 = update * @param data * @return */ int chlogif_BankingReq(int32 account_id, int8 type, int32 data){ loginif_check(-1); WFIFOHEAD(login_fd,11); WFIFOW(login_fd,0) = 0x2740; WFIFOL(login_fd,2) = account_id; WFIFOB(login_fd,6) = type; WFIFOL(login_fd,7) = data; WFIFOSET(login_fd,11); return 0; }
void mapif_homunculus_renamed(int fd, int account_id, int char_id, unsigned char flag, const char *name) { nullpo_retv(name); WFIFOHEAD(fd, NAME_LENGTH+12); WFIFOW(fd, 0) = 0x3894; WFIFOL(fd, 2) = account_id; WFIFOL(fd, 6) = char_id; WFIFOB(fd,10) = flag; safestrncpy(WFIFOP(fd,11), name, NAME_LENGTH); WFIFOSET(fd, NAME_LENGTH+12); }
int mapif_homun_created(int fd,int account_id, struct s_homunculus *p) { WFIFOHEAD(fd, sizeof(struct s_homunculus)+9); WFIFOW(fd, 0) =0x3890; WFIFOW(fd,2) = sizeof(struct s_homunculus)+9; WFIFOL(fd,4) = account_id; WFIFOB(fd,8)= p->hom_id?1:0; memcpy(WFIFOP(fd,9), p, sizeof(struct s_homunculus)); WFIFOSET(fd, WFIFOW(fd,2)); return 0; }
void mapif_elemental_send(int fd, struct s_elemental *ele, unsigned char flag) { int size = sizeof(struct s_elemental) + 5; nullpo_retv(ele); WFIFOHEAD(fd,size); WFIFOW(fd,0) = 0x387c; WFIFOW(fd,2) = size; WFIFOB(fd,4) = flag; memcpy(WFIFOP(fd,5),ele,sizeof(struct s_elemental)); WFIFOSET(fd,size); }
// Create a party whether or not int mapif_party_created(int fd,int account_id,int char_id,struct party *p) { WFIFOHEAD(fd, 39); WFIFOW(fd,0)=0x3820; WFIFOL(fd,2)=account_id; WFIFOL(fd,6)=char_id; if(p!=NULL){ WFIFOB(fd,10)=0; WFIFOL(fd,11)=p->party_id; memcpy(WFIFOP(fd,15),p->name,NAME_LENGTH); ShowInfo("int_party: Party created (%d - %s)\n",p->party_id,p->name); }else{ WFIFOB(fd,10)=1; WFIFOL(fd,11)=0; memset(WFIFOP(fd,15),0,NAME_LENGTH); } WFIFOSET(fd,39); return 0; }
void mapif_homunculus_created(int fd, int account_id, const struct s_homunculus *sh, unsigned char flag) { nullpo_retv(sh); WFIFOHEAD(fd, sizeof(struct s_homunculus)+9); WFIFOW(fd,0) = 0x3890; WFIFOW(fd,2) = sizeof(struct s_homunculus)+9; WFIFOL(fd,4) = account_id; WFIFOB(fd,8)= flag; memcpy(WFIFOP(fd,9),sh,sizeof(struct s_homunculus)); WFIFOSET(fd, WFIFOW(fd,2)); }
/// Party creation notification. /// @param result 0 on success, 1 on failure static void mapif_party_created(int fd, int account_id, int char_id, int result, int party_id, const char* name) { WFIFOHEAD(fd, 39); WFIFOW(fd,0) = 0x3820; WFIFOL(fd,2) = account_id; WFIFOL(fd,6) = char_id; WFIFOB(fd,10) = result; WFIFOL(fd,11) = party_id; safestrncpy((char*)WFIFOP(fd,15), name, NAME_LENGTH); WFIFOSET(fd,39); }
//Request to kick char from a certain map server. [Skotlex] int mapif_disconnectplayer(int fd, int account_id, int char_id, int reason) { if (fd < 0) return -1; WFIFOW(fd,0) = 0x2b1f; WFIFOL(fd,2) = account_id; WFIFOB(fd,6) = reason; WFIFOSET(fd,7); return 0; }
// パーティメンバ追加可否 int mapif_party_memberadded(int fd, int party_id, int account_id, int char_id, int flag) { WFIFOHEAD(fd, 15); WFIFOW(fd,0) = 0x3822; WFIFOL(fd,2) = party_id; WFIFOL(fd,6) = account_id; WFIFOL(fd,10) = char_id; WFIFOB(fd,14) = flag; WFIFOSET(fd,15); return 0; }
/*========================================== * Saves character data. * Flag = 1: Character is quitting * Flag = 2: Character is changing map-servers *------------------------------------------*/ int chrif_save(struct map_session_data *sd, int flag) { nullpo_retr(-1, sd); pc_makesavestatus(sd); 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_auth_logout(sd, flag==1?ST_LOGOUT:ST_MAPCHANGE)) ShowError("chrif_save: Falha em configurar personagem %d:%d para sair adequadamente!\n", sd->status.account_id, sd->status.char_id); } if(!chrif_isconnected()) return -1; //Character is saved on reconnect. //For data sync if (sd->state.storage_flag == 2) storage_guild_storagesave(sd->status.account_id, sd->status.guild_id, flag); if (flag) sd->state.storage_flag = 0; //Force close it. //Saving of registry values. if (sd->state.reg_dirty&4) intif_saveregistry(sd, 3); //Save char regs if (sd->state.reg_dirty&2) intif_saveregistry(sd, 2); //Save account regs if (sd->state.reg_dirty&1) intif_saveregistry(sd, 1); //Save account2 regs WFIFOHEAD(char_fd, sizeof(sd->status) + 13); WFIFOW(char_fd,0) = 0x2b01; WFIFOW(char_fd,2) = sizeof(sd->status) + 13; WFIFOL(char_fd,4) = sd->status.account_id; WFIFOL(char_fd,8) = sd->status.char_id; WFIFOB(char_fd,12) = (flag==1)?1:0; //Flag to tell char-server this character is quitting. memcpy(WFIFOP(char_fd,13), &sd->status, sizeof(sd->status)); WFIFOSET(char_fd, WFIFOW(char_fd,2)); if( sd->status.pet_id > 0 && sd->pd ) intif_save_petdata(sd->status.account_id,&sd->pd->pet); if( sd->hd && merc_is_hom_active(sd->hd) ) merc_save(sd->hd); if( sd->md && mercenary_get_lifetime(sd->md) > 0 ) mercenary_save(sd->md); #ifndef TXT_ONLY if( sd->save_quest ) intif_quest_save(sd); #endif return 0; }
// The reply of Wisp/page static void intif_wis_replay(int id, int flag) { WFIFOW(char_fd, 0) = 0x3002; WFIFOL(char_fd, 2) = id; WFIFOB(char_fd, 6) = flag; // flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target WFIFOSET(char_fd, 7); if (battle_config.etc_log) PRINTF("intif_wis_replay: id: %d, flag:%d\n", id, flag); }
int mapif_pet_info (int fd, int account_id, struct s_pet *p) { WFIFOHEAD (fd, sizeof (struct s_pet) + 9); WFIFOW (fd, 0) = 0x3881; WFIFOW (fd, 2) = sizeof (struct s_pet) + 9; WFIFOL (fd, 4) = account_id; WFIFOB (fd, 8) = 0; memcpy (WFIFOP (fd, 9), p, sizeof (struct s_pet)); WFIFOSET (fd, WFIFOW (fd, 2)); return 0; }
static void mapif_mercenary_send(int fd, struct s_mercenary *merc, unsigned char flag) { int size = sizeof(struct s_mercenary) + 5; WFIFOHEAD(fd,size); WFIFOW(fd,0) = 0x3870; WFIFOW(fd,2) = size; WFIFOB(fd,4) = flag; memcpy(WFIFOP(fd,5),merc,sizeof(struct s_mercenary)); WFIFOSET(fd,size); }
// パーティ作成可否 static void mapif_party_created(int fd, int account_id, struct party *p) { WFIFOW(fd, 0) = 0x3820; WFIFOL(fd, 2) = account_id; if (p != NULL) { WFIFOB(fd, 6) = 0; WFIFOL(fd, 7) = p->party_id; WFIFO_STRING(fd, 11, p->name, 24); PRINTF("int_party: created! %d %s\n", p->party_id, p->name); } else { WFIFOB(fd, 6) = 1; WFIFOL(fd, 7) = 0; WFIFO_STRING(fd, 11, "error", 24); } WFIFOSET(fd, 35); }
int mapif_pet_noinfo (int fd, int account_id) { WFIFOHEAD (fd, sizeof (struct s_pet) + 9); WFIFOW (fd, 0) = 0x3881; WFIFOW (fd, 2) = sizeof (struct s_pet) + 9; WFIFOL (fd, 4) = account_id; WFIFOB (fd, 8) = 1; memset (WFIFOP (fd, 9), 0, sizeof (struct s_pet)); WFIFOSET (fd, WFIFOW (fd, 2)); return 0; }
int mapif_rename_homun_ack(int fd, int account_id, int char_id, unsigned char flag, char *name){ WFIFOHEAD(fd, NAME_LENGTH+12); WFIFOW(fd, 0) =0x3894; WFIFOL(fd, 2) =account_id; WFIFOL(fd, 6) =char_id; WFIFOB(fd, 10) =flag; memcpy(WFIFOP(fd, 11), name, NAME_LENGTH); WFIFOSET(fd, NAME_LENGTH+12); return 0; }
/*========================================== * 性別変化要求 *------------------------------------------*/ int chrif_changesex(int id, int sex) { chrif_check(-1); WFIFOHEAD(char_fd,9); WFIFOW(char_fd,0) = 0x2b11; WFIFOW(char_fd,2) = 9; WFIFOL(char_fd,4) = id; WFIFOB(char_fd,8) = sex; WFIFOSET(char_fd,9); return 0; }
void mapif_mail_sendinbox(int fd, int char_id, unsigned char flag, struct mail_data *md) { nullpo_retv(md); //FIXME: dumping the whole structure like this is unsafe [ultramage] WFIFOHEAD(fd, sizeof(struct mail_data) + 9); WFIFOW(fd,0) = 0x3848; WFIFOW(fd,2) = sizeof(struct mail_data) + 9; WFIFOL(fd,4) = char_id; WFIFOB(fd,8) = flag; memcpy(WFIFOP(fd,9),md,sizeof(struct mail_data)); WFIFOSET(fd,WFIFOW(fd,2)); }
int mapif_info_homunculus(int fd, int account_id, struct s_homunculus *hd) { WFIFOHEAD(fd, sizeof(struct s_homunculus)+9); WFIFOW(fd,0) = 0x3891; WFIFOW(fd,2) = sizeof(struct s_homunculus)+9; WFIFOL(fd,4) = account_id; WFIFOB(fd,8) = 1; // account loaded with success memcpy(WFIFOP(fd,9), hd, sizeof(struct s_homunculus)); WFIFOSET(fd, sizeof(struct s_homunculus)+9); return 0; }
int mapif_homun_noinfo(int fd,int account_id) { WFIFOHEAD(fd,sizeof(struct s_homunculus) + 9); WFIFOW(fd,0)=0x3891; WFIFOW(fd,2)=sizeof(struct s_homunculus) + 9; WFIFOL(fd,4)=account_id; WFIFOB(fd,8)=0; memset(WFIFOP(fd,9),0,sizeof(struct s_homunculus)); WFIFOSET(fd,WFIFOW(fd,2)); return 0; }
// ギルド同盟/敵対要求 int intif_guild_alliance (int guild_id1, int guild_id2, int account_id1, int account_id2, int flag) { WFIFOW (inter_fd, 0) = 0x303d; WFIFOL (inter_fd, 2) = guild_id1; WFIFOL (inter_fd, 6) = guild_id2; WFIFOL (inter_fd, 10) = account_id1; WFIFOL (inter_fd, 14) = account_id2; WFIFOB (inter_fd, 18) = flag; WFIFOSET (inter_fd, 19); return 0; }
// ギルドメンバ脱退/追放要求 int intif_guild_leave (int guild_id, int account_id, int char_id, int flag, const char *mes) { WFIFOW (inter_fd, 0) = 0x3034; WFIFOL (inter_fd, 2) = guild_id; WFIFOL (inter_fd, 6) = account_id; WFIFOL (inter_fd, 10) = char_id; WFIFOB (inter_fd, 14) = flag; memcpy (WFIFOP (inter_fd, 15), mes, 40); WFIFOSET (inter_fd, 55); return 0; }
// パーティメンバ追加可否 void mapif_party_memberadded(int fd, int party_id, int account_id, int char_id, const char *name, unsigned char flag) { WFIFOW(fd,0)=0x3822; WFIFOL(fd,2)=party_id; WFIFOL(fd,6)=account_id; WFIFOL(fd,10)=char_id; WFIFOB(fd,14)=flag; strncpy(WFIFOP(fd,15), name, 24); WFIFOSET(fd,39); return; }
// メンバ追加可否 int mapif_guild_memberadded(int fd, int guild_id, int account_id, int char_id, int flag) { WFIFOHEAD(fd, 15); WFIFOW(fd,0) = 0x3832; WFIFOL(fd,2) = guild_id; WFIFOL(fd,6) = account_id; WFIFOL(fd,10) = char_id; WFIFOB(fd,14) = flag; WFIFOSET(fd, 15); return 0; }
/*========================================== * Send Mail *------------------------------------------*/ void mapif_rodex_send(int fd, int sender_id, int receiver_id, int receiver_accountid, bool result) { Assert_retv(sender_id >= 0); Assert_retv(receiver_id + receiver_accountid > 0); WFIFOHEAD(fd,15); WFIFOW(fd,0) = 0x3897; WFIFOL(fd,2) = sender_id; WFIFOL(fd,6) = receiver_id; WFIFOL(fd,10) = receiver_accountid; WFIFOB(fd,14) = result; WFIFOSET(fd,15); }
/** * HA 0x2742 * Request vip data to loginserv * @param aid : account_id to request the vip data * @param flag : 0x1 Select info and update old_groupid, 0x2 VIP duration is changed by atcommand or script, 0x8 First request on player login * @param add_vip_time : tick to add to vip timestamp * @param mapfd: link to mapserv for ack * @return 0 if success */ int chlogif_reqvipdata(uint32 aid, uint8 flag, int32 timediff, int mapfd) { loginif_check(-1); #ifdef VIP_ENABLE WFIFOHEAD(login_fd,15); WFIFOW(login_fd,0) = 0x2742; WFIFOL(login_fd,2) = aid; //aid WFIFOB(login_fd,6) = flag; //flag WFIFOL(login_fd,7) = timediff; //req_inc_duration WFIFOL(login_fd,11) = mapfd; //req_inc_duration WFIFOSET(login_fd,15); #endif return 0; }
/** * HA 0x2720 * Request account info to login-server */ int chlogif_req_accinfo(int fd, int u_fd, int u_aid, int account_id, int8 type) { loginif_check(-1); //ShowInfo("%d request account info for %d (type %d)\n", u_aid, account_id, type); WFIFOHEAD(login_fd,19); WFIFOW(login_fd,0) = 0x2720; WFIFOL(login_fd,2) = fd; WFIFOL(login_fd,6) = u_fd; WFIFOL(login_fd,10) = u_aid; WFIFOL(login_fd,14) = account_id; WFIFOB(login_fd,18) = type; WFIFOSET(login_fd,19); return 1; }
//Request to kick char from a certain map server. [Skotlex] int mapif_disconnectplayer(int fd, uint32 account_id, uint32 char_id, int reason) { if (fd >= 0) { WFIFOHEAD(fd,7); WFIFOW(fd,0) = 0x2b1f; WFIFOL(fd,2) = account_id; WFIFOB(fd,6) = reason; WFIFOSET(fd,7); return 0; } return -1; }
// パーティ移動要求 void intif_party_changemap(dumb_ptr<map_session_data> sd, int online) { if (sd != NULL) { WFIFOW(char_fd, 0) = 0x3025; WFIFOL(char_fd, 2) = sd->status.party_id; WFIFOL(char_fd, 6) = sd->status.account_id; WFIFO_STRING(char_fd, 10, sd->bl_m->name_, 16); WFIFOB(char_fd, 26) = online; WFIFOW(char_fd, 27) = sd->status.base_level; WFIFOSET(char_fd, 29); } }
/*========================================== * Saves character data. * Flag = 1: Character is quitting * Flag = 2: Character is changing map-servers *------------------------------------------*/ int chrif_save(struct map_session_data *sd, int flag) { nullpo_retr(-1, sd); if (!flag) //The flag check is needed to prevent 'nosave' taking effect when a jailed player logs out. pc_makesavestatus(sd); 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_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); } if(!chrif_isconnected()) return -1; //Character is saved on reconnect. //For data sync if (sd->state.storage_flag == 1) storage_storage_save(sd->status.account_id, flag); else if (sd->state.storage_flag == 2) storage_guild_storagesave(sd->status.account_id, sd->status.guild_id, flag); if (flag) sd->state.storage_flag = 0; //Force close it. //Saving of registry values. if (sd->state.reg_dirty&4) intif_saveregistry(sd, 3); //Save char regs if (sd->state.reg_dirty&2) intif_saveregistry(sd, 2); //Save account regs if (sd->state.reg_dirty&1) intif_saveregistry(sd, 1); //Save account2 regs WFIFOHEAD(char_fd, sizeof(sd->status) + 13); WFIFOW(char_fd,0) = 0x2b01; WFIFOW(char_fd,2) = sizeof(sd->status) + 13; WFIFOL(char_fd,4) = sd->status.account_id; WFIFOL(char_fd,8) = sd->status.char_id; WFIFOB(char_fd,12) = (flag==1)?1:0; //Flag to tell char-server this character is quitting. memcpy(WFIFOP(char_fd,13), &sd->status, sizeof(sd->status)); WFIFOSET(char_fd, WFIFOW(char_fd,2)); if(sd->status.pet_id > 0 && sd->pd) intif_save_petdata(sd->status.account_id,&sd->pd->pet); if (sd->hd && merc_is_hom_active(sd->hd)) merc_save(sd->hd); return 0; }