/*========================================== * Loads an item from the db. If not found, it will return the dummy item. *------------------------------------------*/ struct item_data* itemdb_search(int nameid) { struct item_data* id; if( nameid >= 0 && nameid < ARRAYLENGTH(itemdb_array) ) id = itemdb_array[nameid]; else id = (struct item_data*)idb_get(itemdb_other, nameid); if( id == NULL ) { ShowWarning("itemdb_search: Item ID %d does not exists in the item_db. Using dummy data.\n", nameid); id = &dummy_item; dummy_item.nameid = nameid; } return id; }
/// retrieve data from db and store it in the provided data structure static bool account_db_txt_load_num(AccountDB* self, struct mmo_account* acc, const int account_id) { AccountDB_TXT* db = (AccountDB_TXT*)self; DBMap* accounts = db->accounts; // retrieve data struct mmo_account* tmp = idb_get(accounts, account_id); if( tmp == NULL ) {// entry not found return false; } // store it memcpy(acc, tmp, sizeof(struct mmo_account)); return true; }
// ギルド解散要求 int mapif_parse_BreakGuild(int fd, int guild_id) { struct guild *g; g = idb_get(guild_db, guild_id); if(g == NULL) return 0; guild_db->foreach(guild_db, guild_break_sub, guild_id); inter_guild_storage_delete(guild_id); mapif_guild_broken(guild_id, 0); if(log_inter) inter_log("guild %s (id=%d) broken" RETCODE, g->name, guild_id); idb_remove(guild_db, guild_id); return 0; }
// パ?ティ?設定?更要求 int mapif_parse_PartyChangeOption(int fd, int party_id, int account_id, int exp, int item) { struct party_data *p; int flag = 0; p = idb_get(party_db, party_id); if (p == NULL) return 0; p->party.exp = exp; if (exp>0 && !party_check_exp_share(p)) { flag |= 0x01; p->party.exp = 0; } p->party.item = item&0x3; mapif_party_optionchanged(fd, &p->party, account_id, flag); return 0; }
// ギルドスキルアップ要求 int mapif_parse_GuildSkillUp(int fd, int guild_id, int skill_num, int account_id) { struct guild *g = idb_get(guild_db, guild_id); int idx = skill_num - GD_SKILLBASE; if (g == NULL || idx < 0 || idx >= MAX_GUILDSKILL) return 0; if (g->skill_point > 0 && g->skill[idx].id > 0 && g->skill[idx].lv < 10) { g->skill[idx].lv++; g->skill_point--; if (guild_calcinfo(g) == 0) mapif_guild_info(-1, g); mapif_guild_skillupack(guild_id, skill_num, account_id); } return 0; }
int chlogif_parse_ackchangesex(int fd, struct char_session_data* sd) { if (RFIFOREST(fd) < 7) return 0; else { unsigned char buf[7]; int acc = RFIFOL(fd,2); int sex = RFIFOB(fd,6); RFIFOSKIP(fd,7); if (acc > 0) { // TODO: Is this even possible? unsigned char i; int char_id = 0, class_ = 0, guild_id = 0; DBMap* auth_db = char_get_authdb(); struct auth_node* node = (struct auth_node*)idb_get(auth_db, acc); SqlStmt *stmt; if (node != NULL) node->sex = sex; // get characters stmt = SqlStmt_Malloc(sql_handle); if (SQL_ERROR == SqlStmt_Prepare(stmt, "SELECT `char_id`, `class`, `guild_id` FROM `%s` WHERE `account_id` = '%d'", schema_config.char_db, acc) || SqlStmt_Execute(stmt)) { SqlStmt_ShowDebug(stmt); SqlStmt_Free(stmt); } SqlStmt_BindColumn(stmt, 0, SQLDT_INT, &char_id, 0, NULL, NULL); SqlStmt_BindColumn(stmt, 1, SQLDT_SHORT, &class_, 0, NULL, NULL); SqlStmt_BindColumn(stmt, 2, SQLDT_INT, &guild_id, 0, NULL, NULL); for (i = 0; i < MAX_CHARS && SQL_SUCCESS == SqlStmt_NextRow(stmt); ++i) { chlogif_parse_change_sex_sub(sex, acc, char_id, class_, guild_id); } SqlStmt_Free(stmt); } // notify all mapservers about this change WBUFW(buf,0) = 0x2b0d; WBUFL(buf,2) = acc; WBUFB(buf,6) = sex; chmapif_sendall(buf, 7); } return 1; }
// Wisp/page transmission result int mapif_parse_WisReply(int fd) { int id, flag; struct WisData *wd; id = RFIFOL(fd,2); flag = RFIFOB(fd,6); wd = (struct WisData*)idb_get(wis_db, id); if (wd == NULL) return 0; // This wisp was probably suppress before, because it was timeout of because of target was found on another map-server if ((--wd->count) <= 0 || flag != 1) { mapif_wis_end(wd, flag); // flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target idb_remove(wis_db, id); } return 0; }
int check_ttl_wisdata(void) { unsigned long tick = gettick(); int i; do { wis_delnum = 0; wis_db->foreach(wis_db, check_ttl_wisdata_sub, tick); for(i = 0; i < wis_delnum; i++) { struct WisData *wd = idb_get(wis_db, wis_dellist[i]); ShowWarning("inter: wis data id=%d time out : from %s to %s\n", wd->id, wd->src, wd->dst); // removed. not send information after a timeout. Just no answer for the player //mapif_wis_end(wd, 1); // flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target idb_remove(wis_db, wd->id); } } while(wis_delnum >= WISDELLIST_MAX); return 0; }
/*========================================== * Loads (and creates if not found) an item from the db. *------------------------------------------*/ struct item_data* itemdb_load(int nameid) { struct item_data *id; if( nameid >= 0 && nameid < ARRAYLENGTH(itemdb_array) ) { id = itemdb_array[nameid]; if( id == NULL || id == &dummy_item ) id = itemdb_array[nameid] = create_item_data(nameid); return id; } id = (struct item_data*)idb_get(itemdb_other, nameid); if( id == NULL || id == &dummy_item ) { id = create_item_data(nameid); idb_put(itemdb_other, nameid, id); } return id; }
void party_booking_update (struct map_session_data *sd, short *job) { int i; struct party_booking_ad_info *pb_ad; pb_ad = (struct party_booking_ad_info *) idb_get (party_booking_db, sd->status.char_id); if (pb_ad == NULL) return; pb_ad->starttime = (int) time (NULL); // Update time. for (i = 0; i < PARTY_BOOKING_JOBS; i++) if (job[i] != 0xFF) pb_ad->p_detail.job[i] = job[i]; else pb_ad->p_detail.job[i] = -1; clif_PartyBookingUpdateNotify (sd, pb_ad); }
/** * Player Requesting char-select from map_serv * @param fd: wich fd to parse from * @return : 0 not enough data received, 1 success */ int chmapif_parse_authok(int fd){ if( RFIFOREST(fd) < 19 ) return 0; else{ uint32 account_id = RFIFOL(fd,2); uint32 login_id1 = RFIFOL(fd,6); uint32 login_id2 = RFIFOL(fd,10); uint32 ip = RFIFOL(fd,14); int version = RFIFOB(fd,18); RFIFOSKIP(fd,19); if( runflag != CHARSERVER_ST_RUNNING ){ chmapif_charselres(fd,account_id,0); }else{ struct auth_node* node; DBMap* auth_db = char_get_authdb(); DBMap* online_char_db = char_get_onlinedb(); // create temporary auth entry CREATE(node, struct auth_node, 1); node->account_id = account_id; node->char_id = 0; node->login_id1 = login_id1; node->login_id2 = login_id2; //node->sex = 0; node->ip = ntohl(ip); node->version = version; //upd version for mapserv //node->expiration_time = 0; // unlimited/unknown time by default (not display in map-server) //node->gmlevel = 0; idb_put(auth_db, account_id, node); //Set char to "@ char select" in online db [Kevin] char_set_charselect(account_id); { struct online_char_data* character = (struct online_char_data*)idb_get(online_char_db, account_id); if( character != NULL ){ character->pincode_success = true; } } chmapif_charselres(fd,account_id,1); } } return 1; }
int check_ttl_wisdata(void) { int64 tick = gettick(); int i; do { wis_delnum = 0; wis_db->foreach(wis_db, check_ttl_wisdata_sub, tick); for(i = 0; i < wis_delnum; i++) { struct WisData *wd = (struct WisData *)idb_get(wis_db, wis_dellist[i]); ShowWarning(read_message("Source.char.inter_checkttlwisdata"), wd->id, wd->src, wd->dst); // removed. not send information after a timeout. Just no answer for the player //mapif_wis_end(wd, 1); // flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target idb_remove(wis_db, wd->id); } } while(wis_delnum >= WISDELLIST_MAX); return 0; }
int mapif_parse_PartyLeaderChange(int fd,int party_id,int account_id,int char_id) { struct party_data *p; int i; p = idb_get(party_db, party_id); if (p == NULL) return 0; for (i = 0; i < MAX_PARTY; i++) { if(p->party.member[i].leader) p->party.member[i].leader = 0; if(p->party.member[i].account_id == account_id && p->party.member[i].char_id == char_id) p->party.member[i].leader = 1; } return 1; }
// Delete member from guild int mapif_parse_GuildLeave(int fd, int guild_id, int account_id, int char_id, int flag, const char *mes) { int i, j; struct guild* g = (struct guild*)idb_get(guild_db, guild_id); if( g == NULL ) { //TODO return 0; } // Find the member ARR_FIND( 0, g->max_member, i, g->member[i].account_id == account_id && g->member[i].char_id == char_id ); if( i == g->max_member ) { //TODO return 0; } if( flag ) { // 追放の場合追放リストに入れる ARR_FIND( 0, MAX_GUILDEXPULSION, j, g->expulsion[j].account_id == 0 ); if (j == MAX_GUILDEXPULSION) { // 一杯なので古いのを消す for(j = 0; j < MAX_GUILDEXPULSION - 1; j++) g->expulsion[j] = g->expulsion[j+1]; j = MAX_GUILDEXPULSION - 1; } // Save the expulsion entry g->expulsion[j].account_id = account_id; safestrncpy(g->expulsion[j].name, g->member[i].name, NAME_LENGTH); safestrncpy(g->expulsion[j].mes, mes, 40); } mapif_guild_withdraw(guild_id, account_id, char_id, flag, g->member[i].name, mes); memset(&g->member[i], 0, sizeof(struct guild_member)); if (guild_check_empty(g) == 0) mapif_guild_info(-1,g);// まだ人がいるのでデ??送信 return 0; }
int mapif_load_pet(int fd,int account_id,int char_id,int pet_id) { struct s_pet *p; p = (struct s_pet*)idb_get(pet_db,pet_id); if(p!=NULL) { if(p->incuvate == 1) { p->account_id = p->char_id = 0; mapif_pet_info(fd,account_id,p); } else if(account_id == p->account_id && char_id == p->char_id) mapif_pet_info(fd,account_id,p); else mapif_pet_noinfo(fd,account_id); } else mapif_pet_noinfo(fd,account_id); return 0; }
int mapif_parse_GuildCastleDataLoad(int fd, int castle_id, int index) { struct guild_castle *gc = idb_get(castle_db, castle_id); if (gc == NULL) { return mapif_guild_castle_dataload(castle_id, 0, 0); } switch(index) { case 1: return mapif_guild_castle_dataload(gc->castle_id, index, gc->guild_id); case 2: return mapif_guild_castle_dataload(gc->castle_id, index, gc->economy); case 3: return mapif_guild_castle_dataload(gc->castle_id, index, gc->defense); case 4: return mapif_guild_castle_dataload(gc->castle_id, index, gc->triggerE); case 5: return mapif_guild_castle_dataload(gc->castle_id, index, gc->triggerD); case 6: return mapif_guild_castle_dataload(gc->castle_id, index, gc->nextTime); case 7: return mapif_guild_castle_dataload(gc->castle_id, index, gc->payTime); case 8: return mapif_guild_castle_dataload(gc->castle_id, index, gc->createTime); case 9: return mapif_guild_castle_dataload(gc->castle_id, index, gc->visibleC); case 10: case 11: case 12: case 13: case 14: case 15: case 16: case 17: return mapif_guild_castle_dataload(gc->castle_id, index, gc->guardian[index-10].visible); case 18: case 19: case 20: case 21: case 22: case 23: case 24: case 25: return mapif_guild_castle_dataload(gc->castle_id, index, gc->guardian[index-18].hp); // end additions [Valaris] default: ShowError("mapif_parse_GuildCastleDataLoad ERROR!! (Not found index=%d)\n", index); return 0; } return 0; }
// オンライン/Lv更新 int mapif_parse_GuildChangeMemberInfoShort(int fd, int guild_id, int account_id, int char_id, int online, int lv, int class_) { struct guild *g; int i, sum, c; g = (struct guild*)idb_get(guild_db, guild_id); if (g == NULL) return 0; ARR_FIND( 0, g->max_member, i, g->member[i].account_id == account_id && g->member[i].char_id == char_id ); if( i < g->max_member ) { g->member[i].online = online; g->member[i].lv = lv; g->member[i].class_ = class_; mapif_guild_memberinfoshort(g, i); } g->average_lv = 0; g->connect_member = 0; c = 0; // member count sum = 0; // total sum of base levels for(i = 0; i < g->max_member; i++) { if( g->member[i].account_id > 0 ) { sum += g->member[i].lv; c++; } if( g->member[i].online ) g->connect_member++; } if( c ) // this check should always succeed... g->average_lv = sum / c; //FIXME: how about sending a mapif_guild_info() update to the mapserver? [ultramage] return 0; }
// ギルド脱退/追放要求 int mapif_parse_GuildLeave(int fd, int guild_id, int account_id, int char_id, int flag, const char *mes) { struct guild *g = NULL; int i, j; g = idb_get(guild_db, guild_id); if (g != NULL) { for(i = 0; i < MAX_GUILD; i++) { if (g->member[i].account_id == account_id && g->member[i].char_id == char_id) { // printf("%d %d\n", i, (int)(&g->member[i])); // printf("%d %s\n", i, g->member[i].name); if (flag) { // 追放の場合追放リストに入れる for(j = 0; j < MAX_GUILDEXPULSION; j++) { if (g->expulsion[j].account_id == 0) break; } if (j == MAX_GUILDEXPULSION) { // 一杯なので古いのを消す for(j = 0; j < MAX_GUILDEXPULSION - 1; j++) g->expulsion[j] = g->expulsion[j+1]; j = MAX_GUILDEXPULSION - 1; } g->expulsion[j].account_id = account_id; memcpy(g->expulsion[j].acc, "dummy", NAME_LENGTH-1); memcpy(g->expulsion[j].name, g->member[i].name, NAME_LENGTH-1); memcpy(g->expulsion[j].mes, mes, 40); } mapif_guild_leaved(guild_id, account_id, char_id, flag, g->member[i].name, mes); // printf("%d %d\n", i, (int)(&g->member[i])); // printf("%d %s\n", i, (&g->member[i])->name); memset(&g->member[i], 0, sizeof(struct guild_member)); if (guild_check_empty(g) == 0) mapif_guild_info(-1,g);// まだ人がいるのでデータ送信 return 0; } } } return 0; }
/** * PIN Code was incorrectly entered too many times. * @param fd: fd to parse from (char-serv) * @return 0 fail (packet does not have enough data), 1 success (continue parsing) */ int logchrif_parse_pincode_authfail(int fd){ if( RFIFOREST(fd) < 6 ) return 0; else{ struct mmo_account acc; AccountDB* accounts = login_get_accounts_db(); if( accounts->load_num(accounts, &acc, RFIFOL(fd,2) ) ){ struct online_login_data* ld; ld = (struct online_login_data*)idb_get(online_db,acc.account_id); if( ld == NULL ) return 0; login_log( host2ip(acc.last_ip), acc.userid, 100, "PIN Code check failed" ); } login_remove_online_user(acc.account_id); RFIFOSKIP(fd,6); } return 1; }
/** * Map-serv request to save mmo_char_status in sql * Receive character data from map-server for saving * @param fd: wich fd to parse from * @param id: wich map_serv id * @return : 0 not enough data received, 1 success */ int chmapif_parse_reqsavechar(int fd, int id){ if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) return 0; { int aid = RFIFOL(fd,4), cid = RFIFOL(fd,8), size = RFIFOW(fd,2); struct online_char_data* character; DBMap* online_char_db = char_get_onlinedb(); if (size - 13 != sizeof(struct mmo_charstatus)) { ShowError("parse_from_map (save-char): Size mismatch! %d != %d\n", size-13, sizeof(struct mmo_charstatus)); RFIFOSKIP(fd,size); return 1; } //Check account only if this ain't final save. Final-save goes through because of the char-map reconnect if (RFIFOB(fd,12) || RFIFOB(fd,13) || ( (character = (struct online_char_data*)idb_get(online_char_db, aid)) != NULL && character->char_id == cid)) { struct mmo_charstatus char_dat; memcpy(&char_dat, RFIFOP(fd,13), sizeof(struct mmo_charstatus)); char_mmo_char_tosql(cid, &char_dat); } else { //This may be valid on char-server reconnection, when re-sending characters that already logged off. ShowError("parse_from_map (save-char): Received data for non-existant/offline character (%d:%d).\n", aid, cid); char_set_char_online(id, cid, aid); } if (RFIFOB(fd,12)) { //Flag, set character offline after saving. [Skotlex] char_set_char_offline(cid, aid); WFIFOHEAD(fd,10); WFIFOW(fd,0) = 0x2b21; //Save ack only needed on final save. WFIFOL(fd,2) = aid; WFIFOL(fd,6) = cid; WFIFOSET(fd,10); } RFIFOSKIP(fd,size); } return 1; }
static int auction_end_timer(int tid, unsigned int tick, int id, intptr_t data) { struct auction_data *auction; if( (auction = (struct auction_data *)idb_get(auction_db_, id)) != NULL ) { if( auction->buyer_id ) { mail_sendmail(0, msg_txt(200), auction->buyer_id, auction->buyer_name, msg_txt(201), msg_txt(202), 0, &auction->item); mapif_Auction_message(auction->buyer_id, 6); // You have won the auction mail_sendmail(0, msg_txt(200), auction->seller_id, auction->seller_name, msg_txt(201), msg_txt(203), auction->price, NULL); } else mail_sendmail(0, msg_txt(200), auction->seller_id, auction->seller_name, msg_txt(201), msg_txt(204), 0, &auction->item); ShowInfo("Auction End: id %u.\n", auction->auction_id); auction->auction_end_timer = INVALID_TIMER; auction_delete(auction); } return 0; }
/// rewrite the data stored in the account_db with the one provided static bool account_db_txt_save(AccountDB* self, const struct mmo_account* acc) { AccountDB_TXT* db = (AccountDB_TXT*)self; DBMap* accounts = db->accounts; int account_id = acc->account_id; // retrieve previous data struct mmo_acount* tmp = idb_get(accounts, account_id); if( tmp == NULL ) {// error condition - entry not found return false; } // overwrite with new data memcpy(tmp, acc, sizeof(struct mmo_account)); // modify save counter and save if needed if( --db->auths_before_save == 0 ) mmo_auth_sync(db); return true; }
/// Add a new entry for this account to the account db and save it. /// If acc->account_id is -1, the account id will be auto-generated, /// and its value will be written to acc->account_id if everything succeeds. static bool account_db_txt_create(AccountDB* self, struct mmo_account* acc) { AccountDB_TXT* db = (AccountDB_TXT*)self; DBMap* accounts = db->accounts; struct mmo_account* tmp; // decide on the account id to assign int account_id = ( acc->account_id != -1 ) ? acc->account_id : db->next_account_id; // absolute maximum if( account_id > END_ACCOUNT_NUM ) return false; // check if the account_id is free tmp = idb_get(accounts, account_id); if( tmp != NULL ) {// error condition - entry already present ShowError("account_db_txt_create: cannot create account %d:'%s', this id is already occupied by %d:'%s'!\n", account_id, acc->userid, account_id, tmp->userid); return false; } // copy the data and store it in the db CREATE(tmp, struct mmo_account, 1); memcpy(tmp, acc, sizeof(struct mmo_account)); tmp->account_id = account_id; idb_put(accounts, account_id, tmp); // increment the auto_increment value if( account_id >= db->next_account_id ) db->next_account_id = account_id + 1; // flush data mmo_auth_sync(db); // write output acc->account_id = account_id; return true; }
void pincode_handle ( int fd, struct char_session_data* sd ) { struct online_char_data* character = (struct online_char_data*)idb_get(chr->online_char_db, sd->account_id); if( character && character->pincode_enable > pincode->charselect ){ character->pincode_enable = pincode->charselect * 2; }else{ pincode->sendstate( fd, sd, PINCODE_OK ); return; } if( strlen(sd->pincode) == 4 ){ if( pincode->changetime && time(NULL) > (sd->pincode_change+pincode->changetime) ){ // User hasn't changed his PIN code for a long time pincode->sendstate( fd, sd, PINCODE_EXPIRED ); } else { // Ask user for his PIN code pincode->sendstate( fd, sd, PINCODE_ASK ); } } else // No PIN code has been set yet pincode->sendstate( fd, sd, PINCODE_NOTSET ); if( character ) character->pincode_enable = -1; }
static int auction_end_timer(int tid, unsigned int tick, int id, intptr_t data) { struct auction_data *auction; if( (auction = (struct auction_data *)idb_get(auction_db_, id)) != NULL ) { if( auction->buyer_id ) { mail_sendmail(0, "Auction Manager", auction->buyer_id, auction->buyer_name, "Auction", "Thanks, you won the auction!.", 0, &auction->item); mapif_Auction_message(auction->buyer_id, 6); // You have won the auction mail_sendmail(0, "Auction Manager", auction->seller_id, auction->seller_name, "Auction", "Payment for your auction!.", auction->price, NULL); } else mail_sendmail(0, "Auction Manager", auction->seller_id, auction->seller_name, "Auction", "No buyers have been found for your auction.", 0, &auction->item); ShowInfo("Auction End: id %u.\n", auction->auction_id); auction->auction_end_timer = INVALID_TIMER; auction_delete(auction); } return 0; }
// ギルドメンバ追加要求 int mapif_parse_GuildAddMember(int fd, int guild_id, struct guild_member *m) { struct guild *g; int i; g = idb_get(guild_db, guild_id); if (g == NULL) { mapif_guild_memberadded(fd, guild_id, m->account_id, m->char_id, 1); return 0; } for(i = 0; i < g->max_member; i++) { if (g->member[i].account_id == 0) { memcpy(&g->member[i], m, sizeof(struct guild_member)); mapif_guild_memberadded(fd, guild_id, m->account_id, m->char_id, 0); guild_calcinfo(g); mapif_guild_info(-1, g); return 0; } } mapif_guild_memberadded(fd, guild_id, m->account_id, m->char_id, 1); return 0; }
// ギルドメンバ追加要求 int mapif_parse_GuildAddMember(int fd, int guild_id, struct guild_member *m) { struct guild *g; int i; g = (struct guild*)idb_get(guild_db, guild_id); if (g == NULL) { mapif_guild_memberadded(fd, guild_id, m->account_id, m->char_id, 1); return 0; } ARR_FIND( 0, g->max_member, i, g->member[i].account_id == 0 ); if( i < g->max_member ) { memcpy(&g->member[i], m, sizeof(struct guild_member)); mapif_guild_memberadded(fd, guild_id, m->account_id, m->char_id, 0); guild_calcinfo(g); mapif_guild_info(-1, g); } else mapif_guild_memberadded(fd, guild_id, m->account_id, m->char_id, 1); return 0; }
// 情報所得 int guild_recv_info(struct guild *sg) { struct guild *g,before; int i,bm,m; struct eventlist *ev,*ev2; struct map_session_data *sd; bool guild_new = false; nullpo_ret(sg); if((g = (struct guild*)idb_get(guild_db,sg->guild_id))==NULL) { guild_new = true; g=(struct guild *)aCalloc(1,sizeof(struct guild)); idb_put(guild_db,sg->guild_id,g); before=*sg; // 最初のロードなのでユーザーのチェックを行う guild_check_member(sg); if ((sd = map_nick2sd(sg->master)) != NULL) { //If the guild master is online the first time the guild_info is received, //that means he was the first to join, so apply guild skill blocking here. if( battle_config.guild_skill_relog_delay ) guild_block_skill(sd, 300000); //Also set the guild master flag. sd->state.gmaster_flag = g; clif_charnameupdate(sd); // [LuzZza] clif_guild_masterormember(sd); } }else before=*g; memcpy(g,sg,sizeof(struct guild)); if(g->max_member > MAX_GUILD) { ShowError("guild_recv_info: Received guild with %d members, but MAX_GUILD is only %d. Extra guild-members have been lost!\n", g->max_member, MAX_GUILD); g->max_member = MAX_GUILD; } for(i=bm=m=0;i<g->max_member;i++){ if(g->member[i].account_id>0){ sd = g->member[i].sd = guild_sd_check(g->guild_id, g->member[i].account_id, g->member[i].char_id); if (sd) clif_charnameupdate(sd); // [LuzZza] m++; }else g->member[i].sd=NULL; if(before.member[i].account_id>0) bm++; } for(i=0;i<g->max_member;i++){ // 情報の送信 sd = g->member[i].sd; if( sd==NULL ) continue; if( before.guild_lv!=g->guild_lv || bm!=m || before.max_member!=g->max_member ){ clif_guild_basicinfo(sd); // 基本情報送信 clif_guild_emblem(sd,g); // エンブレム送信 } if(bm!=m){ // メンバー情報送信 clif_guild_memberlist(g->member[i].sd); } if( before.skill_point!=g->skill_point) clif_guild_skillinfo(sd); // スキル情報送信 if( guild_new ){ // 未送信なら所属情報も送る clif_guild_belonginfo(sd,g); clif_guild_notice(sd,g); sd->guild_emblem_id=g->emblem_id; } } // イベントの発生 if( (ev = (struct eventlist*)idb_remove(guild_infoevent_db,sg->guild_id))!=NULL ) { while(ev){ npc_event_do(ev->name); ev2=ev->next; aFree(ev); ev=ev2; } } return 0; }
/// lookup: castle id -> castle* struct guild_castle* guild_castle_search(int gcid) { return (struct guild_castle*)idb_get(castle_db,gcid); }
/// lookup: guild id -> guild* struct guild* guild_search(int guild_id) { return (struct guild*)idb_get(guild_db,guild_id); }