// ギルド勧誘への返答 int guild_reply_reqalliance(struct map_session_data *sd,int account_id,int flag) { struct map_session_data *tsd; nullpo_ret(sd); tsd= map_id2sd( account_id ); if (!tsd) { //Character left? Cancel alliance. clif_guild_allianceack(sd,3); return 0; } if(sd->guild_alliance!=tsd->status.guild_id) // 勧誘とギルドIDが違う return 0; if(flag==1){ // 承諾 int i; struct guild *g,*tg; // 同盟数再確認 g=guild_search(sd->status.guild_id); tg=guild_search(tsd->status.guild_id); if(g==NULL || guild_get_alliance_count(g,0) >= battle_config.max_guild_alliance){ clif_guild_allianceack(sd,4); clif_guild_allianceack(tsd,3); return 0; } if(tg==NULL || guild_get_alliance_count(tg,0) >= battle_config.max_guild_alliance){ clif_guild_allianceack(sd,3); clif_guild_allianceack(tsd,4); return 0; } for(i=0;i<MAX_GUILDALLIANCE;i++){ if(g->alliance[i].guild_id==tsd->status.guild_id && g->alliance[i].opposition==1) intif_guild_alliance( sd->status.guild_id,tsd->status.guild_id, sd->status.account_id,tsd->status.account_id,9 ); } for(i=0;i<MAX_GUILDALLIANCE;i++){ if(tg->alliance[i].guild_id==sd->status.guild_id && tg->alliance[i].opposition==1) intif_guild_alliance( tsd->status.guild_id,sd->status.guild_id, tsd->status.account_id,sd->status.account_id,9 ); } // inter鯖へ同盟要請 intif_guild_alliance( sd->status.guild_id,tsd->status.guild_id, sd->status.account_id,tsd->status.account_id,0 ); return 0; }else{ // 拒否 sd->guild_alliance=0; sd->guild_alliance_account=0; if(tsd!=NULL) clif_guild_allianceack(tsd,3); } return 0; }
// ギルド同盟要求 int guild_reqalliance(struct map_session_data *sd,struct map_session_data *tsd) { struct guild *g[2]; int i; if(agit_flag || agit2_flag || agit3_flag) { // Disable alliance creation during woe [Valaris] clif_displaymessage(sd->fd,"Alliances cannot be made during Guild Wars!"); return 0; } // end addition [Valaris] nullpo_ret(sd); if(tsd==NULL || tsd->status.guild_id<=0) return 0; g[0]=guild_search(sd->status.guild_id); g[1]=guild_search(tsd->status.guild_id); if(g[0]==NULL || g[1]==NULL) return 0; // Prevent creation alliance with same guilds [LuzZza] if(sd->status.guild_id == tsd->status.guild_id) return 0; if( guild_get_alliance_count(g[0],0) >= battle_config.max_guild_alliance ) { clif_guild_allianceack(sd,4); return 0; } if( guild_get_alliance_count(g[1],0) >= battle_config.max_guild_alliance ) { clif_guild_allianceack(sd,3); return 0; } if( tsd->guild_alliance>0 ){ clif_guild_allianceack(sd,1); return 0; } for(i=0;i<MAX_GUILDALLIANCE;i++){ // すでに同盟状態か確認 if( g[0]->alliance[i].guild_id==tsd->status.guild_id && g[0]->alliance[i].opposition==0){ clif_guild_allianceack(sd,0); return 0; } } tsd->guild_alliance=sd->status.guild_id; tsd->guild_alliance_account=sd->status.account_id; clif_guild_reqalliance(tsd,sd->status.account_id,g[0]->name); return 0; }
int guild_idisallied(int guild_id, int guild_id2) { int i; struct guild *g; if (guild_id <= 0 || guild_id2 <= 0) return 0; if(guild_id == guild_id2) return 1; g = guild_search(guild_id); nullpo_retr(0, g); for(i=0;i<MAX_GUILDALLIANCE;i++) if(g->alliance[i].guild_id == guild_id2) { if(g->alliance[i].opposition == 0) return 1; else return 0; } return 0; }
//Notification from Char server that a guild's master has changed. [Skotlex] int guild_gm_changed(int guild_id, int pos) { struct guild *g; struct guild_member gm; g=guild_search(guild_id); if (!g || pos < 0 || pos > g->max_member) return 0; memcpy(&gm, &g->member[pos], sizeof (struct guild_member)); memcpy(&g->member[pos], &g->member[0], sizeof(struct guild_member)); memcpy(&g->member[0], &gm, sizeof(struct guild_member)); g->member[pos].position = g->member[0].position; g->member[0].position = 0; //Position 0: guild Master. strcpy(g->master, g->member[0].name); if (g->member[pos].sd && g->member[pos].sd->fd) { clif_displaymessage(g->member[pos].sd->fd, "You no longer are the Guild Master."); g->member[pos].sd->state.gmaster_flag = 0; } if (g->member[0].sd && g->member[0].sd->fd) { clif_displaymessage(g->member[0].sd->fd, "You have become the Guild Master!"); g->member[0].sd->state.gmaster_flag = g; //Block his skills for 5 minutes to prevent abuse. guild_block_skill(g->member[0].sd, 300000); } return 1; }
// ギルドのEXP上納 unsigned int guild_payexp(struct map_session_data *sd,unsigned int exp) { struct guild *g; struct guild_expcache *c; int per; nullpo_ret(sd); if (!exp) return 0; if (sd->status.guild_id == 0 || (g = guild_search(sd->status.guild_id)) == NULL || (per = guild_getposition(g,sd)) < 0 || (per = g->position[per].exp_mode) < 1) return 0; if (per < 100) exp = exp * per / 100; //Otherwise tax everything. c = (struct guild_expcache*)guild_expcache_db->ensure(guild_expcache_db, db_i2key(sd->status.char_id), create_expcache, sd); if (c->exp > UINT64_MAX - exp) c->exp = UINT64_MAX; else c->exp += exp; return exp; }
int guild_send_memberinfoshort(struct map_session_data *sd,int online) { // cleaned up [LuzZza] struct guild *g; nullpo_ret(sd); if(sd->status.guild_id <= 0) return 0; if(!(g = guild_search(sd->status.guild_id))) return 0; intif_guild_memberinfoshort(g->guild_id, sd->status.account_id,sd->status.char_id,online,sd->status.base_level,sd->status.class_); if(!online){ int i=guild_getindex(g,sd->status.account_id,sd->status.char_id); if(i>=0) g->member[i].sd=NULL; else ShowError("guild_send_memberinfoshort: Failed to locate member %d:%d in guild %d!\n", sd->status.account_id, sd->status.char_id, g->guild_id); return 0; } if(sd->state.connect_new) { //Note that this works because it is invoked in parse_LoadEndAck before connect_new is cleared. clif_guild_belonginfo(sd,g); clif_guild_notice(sd,g); sd->guild_emblem_id = g->emblem_id; } return 0; }
// ギルド脱退要求 int guild_leave(struct map_session_data *sd,int guild_id, int account_id,int char_id,const char *mes) { struct guild *g; int i; nullpo_retr(0, sd); g = guild_search(sd->status.guild_id); if(g==NULL) return 0; if( sd->status.account_id!=account_id || sd->status.char_id!=char_id || sd->status.guild_id!=guild_id || map[sd->bl.m].flag.gvg_castle) //Can't leave inside guild castles. return 0; for(i=0;i<g->max_member;i++){ // 所属しているか if( g->member[i].account_id==sd->status.account_id && g->member[i].char_id==sd->status.char_id ){ intif_guild_leave(g->guild_id,sd->status.account_id,sd->status.char_id,0,mes); return 0; } } return 0; }
// ギルド敵対 int guild_opposition(struct map_session_data *sd,int char_id) { struct map_session_data *tsd=map_id2sd(char_id); struct guild *g; int i; nullpo_retr(0, sd); g=guild_search(sd->status.guild_id); if(g==NULL || tsd==NULL) return 0; // Prevent creation opposition with same guilds [LuzZza] if(sd->status.guild_id == tsd->status.guild_id) return 0; if( guild_get_alliance_count(g,1)>=3 ) // 敵対数確認 clif_guild_oppositionack(sd,1); for(i=0;i<MAX_GUILDALLIANCE;i++){ // すでに関係を持っているか確認 if(g->alliance[i].guild_id==tsd->status.guild_id){ if(g->alliance[i].opposition==1){ // すでに敵対 clif_guild_oppositionack(sd,2); return 0; }else // 同盟破棄 intif_guild_alliance( sd->status.guild_id,tsd->status.guild_id, sd->status.account_id,tsd->status.account_id,8 ); } } // inter鯖に敵対要請 intif_guild_alliance( sd->status.guild_id,tsd->status.guild_id, sd->status.account_id,tsd->status.account_id,1 ); return 0; }
// ギルドのEXPキャッシュをinter鯖にフラッシュする int guild_payexp_timer_sub(DBKey dataid, void *data, va_list ap) { int i; struct guild_expcache *c; struct guild *g; c = (struct guild_expcache *)data; if ( (g = guild_search(c->guild_id)) == NULL || (i = guild_getindex(g, c->account_id, c->char_id)) < 0 ) { ers_free(expcache_ers, data); return 0; } if (g->member[i].exp > UINT64_MAX - c->exp) g->member[i].exp = UINT64_MAX; else g->member[i].exp+= c->exp; intif_guild_change_memberinfo(g->guild_id,c->account_id,c->char_id, GMI_EXP,&g->member[i].exp,sizeof(g->member[i].exp)); c->exp=0; ers_free(expcache_ers, data); return 0; }
/*========================================== * ギルド倉庫のデッドロックチェック *------------------------------------------ */ int storage_guild_checklock(int guild_id) { int i; struct guild *g; struct guild_storage *stor; if((g = guild_search(guild_id)) == NULL) return 0; for(i = 0; i < g->max_member; i++) { struct map_session_data *sd = g->member[i].sd; if(sd && sd->state.storage_flag == 2) { // 倉庫を開いている人が居たのでOK return 0; } } // 誰も使用していないのでデッドロックを解除する stor = (struct guild_storage *)numdb_search(guild_storage_db, guild_id); if(stor) { stor->storage_status = 0; } intif_deadlock_guild_storage(guild_id); return 1; }
struct guild_storage *guild2storage(int guild_id) { struct guild_storage *gs = NULL; if(guild_search(guild_id) != NULL) gs = idb_ensure(guild_storage_db,guild_id,create_guildstorage); return gs; }
// ギルド追放要求 int guild_expulsion(struct map_session_data* sd, int guild_id, int account_id, int char_id, const char* mes) { struct map_session_data *tsd; struct guild *g; int i,ps; nullpo_ret(sd); g = guild_search(sd->status.guild_id); if(g==NULL) return 0; if(sd->status.guild_id!=guild_id) return 0; if( (ps=guild_getposition(g,sd))<0 || !(g->position[ps].mode&0x0010) ) return 0; //Expulsion permission //Can't leave inside guild castles. if ((tsd = map_id2sd(account_id)) && tsd->status.char_id == char_id && ((agit_flag || agit2_flag || agit3_flag) && map[tsd->bl.m].flag.gvg_castle)) return 0; // find the member and perform expulsion i = guild_getindex(g, account_id, char_id); if( i != -1 && strcmp(g->member[i].name,g->master) != 0 ) //Can't expel the GL! intif_guild_leave(g->guild_id,account_id,char_id,1,mes); return 0; }
/** * Make a player join the guild channel * - Create a guild channel if it does not exist * @param sd: Player data * @param flag: Join type (1 - Guild chat, 2 - Ally chat) * @return * 0: Success * -1: Invalid player * -2: Player has no guild attached */ int channel_gjoin(struct map_session_data *sd, int flag){ struct Channel *channel; struct guild *g; if(!sd || sd->state.autotrade) return -1; g = sd->guild; if(!g) return -2; channel = g->channel; if(!channel){ channel = channel_create_simple(NULL,NULL,CHAN_TYPE_ALLY,g->guild_id); g->channel = channel; channel_ajoin(g); } if(flag&1) { channel_join(channel,sd); //join our guild chat } if(flag&2){ int i; for (i = 0; i < MAX_GUILDALLIANCE; i++){ struct guild *ag; //allied guld struct guild_alliance *ga = &g->alliance[i]; //guild alliance if(ga->guild_id && (ga->opposition==0) && (ag=guild_search(ga->guild_id)) ) //only join allies channel_join(ag->channel,sd); } } return 0; }
// ギルド追放要求 int guild_explusion(struct map_session_data *sd,int guild_id, int account_id,int char_id,const char *mes) { struct guild *g; int i,ps; nullpo_retr(0, sd); g = guild_search(sd->status.guild_id); if(g==NULL) return 0; if(sd->status.guild_id!=guild_id || map[sd->bl.m].flag.gvg_castle) //Can't leave inside guild castles. return 0; if( (ps=guild_getposition(sd,g))<0 || !(g->position[ps].mode&0x0010) ) return 0; // 処罰権限無し for(i=0;i<g->max_member;i++){ // 所属しているか if( g->member[i].account_id==account_id && g->member[i].char_id==char_id ){ intif_guild_leave(g->guild_id,account_id,char_id,1,mes); //It's wrong way, member info will erased later //see guild_member_leaved [LuzZza] //memset(&g->member[i],0,sizeof(struct guild_member)); return 0; } } return 0; }
// ギルド解散 int guild_break(struct map_session_data *sd,char *name) { struct guild *g; int i; nullpo_ret(sd); if( (g=guild_search(sd->status.guild_id))==NULL ) return 0; if(strcmp(g->name,name)!=0) return 0; if(!sd->state.gmaster_flag) return 0; for(i=0;i<g->max_member;i++){ if( g->member[i].account_id>0 && ( g->member[i].account_id!=sd->status.account_id || g->member[i].char_id!=sd->status.char_id )) break; } if(i<g->max_member){ clif_guild_broken(sd,2); return 0; } intif_guild_break(g->guild_id); return 0; }
/** * Make a player leave a type of channel * @param sd: Player data * @param type: Quit type (1 - Quit guild channel, 2 - Quit ally channel, 4 - Quit map channel, 8 - Quit all users in channel) * @return * 0: Success * -1: Invalid player */ int channel_pcquit(struct map_session_data *sd, int type){ int i; //On closing state we could have clean all chan by sd but pcquit is more used to free unit when //he quit a map_server, not call in map_quit cause we need to cleanup when we switch map-server as well if(!sd) return -1; // Leave all chat channels. if(type&(1|2) && channel_config.ally_tmpl.name != NULL && sd->guild){ //quit guild and ally chan struct guild *g = sd->guild; if(type&1 && channel_haspc(g->channel,sd)==1){ channel_clean(g->channel,sd,0); //leave guild chan } if(type&2){ for (i = 0; i < MAX_GUILDALLIANCE; i++) { //leave all alliance chan struct guild *ag; //allied guild if( g->alliance[i].guild_id && (ag = guild_search(g->alliance[i].guild_id) ) ) { if(channel_haspc(ag->channel,sd) == 1) channel_clean(ag->channel,sd,0); break; } } } } if(type&4 && channel_config.map_tmpl.name != NULL && channel_haspc(map[sd->bl.m].channel,sd)==1){ //quit map chan channel_clean(map[sd->bl.m].channel,sd,0); } if(type&8 && sd->channel_count ) { //quit all chan uint8 count = sd->channel_count; for( i = count-1; i >= 0; i--) { //going backward to avoid shifting channel_clean(sd->channels[i],sd,0); } } return 0; }
// ギルド会話受信 int guild_recv_message(int guild_id,int account_id,const char *mes,int len) { struct guild *g; if( (g=guild_search(guild_id))==NULL) return 0; clif_guild_message(g,account_id,mes,len); return 0; }
// Are these two guilds allied? bool guild_isallied(int guild_id, int guild_id2) { int i; struct guild* g = guild_search(guild_id); nullpo_ret(g); ARR_FIND( 0, MAX_GUILDALLIANCE, i, g->alliance[i].guild_id == guild_id2 ); return( i < MAX_GUILDALLIANCE && g->alliance[i].opposition == 0 ); }
/// lookup: player sd -> member position int guild_getposition(struct guild* g, struct map_session_data* sd) { int i; if( g == NULL && (g=guild_search(sd->status.guild_id)) == NULL ) return -1; ARR_FIND( 0, g->max_member, i, g->member[i].account_id == sd->status.account_id && g->member[i].char_id == sd->status.char_id ); return( i < g->max_member ) ? g->member[i].position : -1; }
// ギルド城データ要求返信 int guild_castledataloadack(int castle_id,int index,int value) { struct guild_castle *gc=guild_castle_search(castle_id); int code=castle_id|(index<<16); struct eventlist *ev,*ev2; if(gc==NULL){ return 0; } switch(index){ case 1: gc->guild_id = value; if (value && guild_search(value)==NULL) //Request guild data which will be required for spawned guardians. [Skotlex] guild_request_info(value); break; case 2: gc->economy = value; break; case 3: gc->defense = value; break; case 4: gc->triggerE = value; break; case 5: gc->triggerD = value; break; case 6: gc->nextTime = value; break; case 7: gc->payTime = value; break; case 8: gc->createTime = value; break; case 9: gc->visibleC = value; break; case 10: case 11: case 12: case 13: case 14: case 15: case 16: case 17: gc->guardian[index-10].visible = value; break; case 18: case 19: case 20: case 21: case 22: case 23: case 24: case 25: gc->guardian[index-18].hp = value; break; default: ShowError("guild_castledataloadack ERROR!! (Not found index=%d)\n", index); return 0; } if( (ev=idb_remove(guild_castleinfoevent_db,code))!=NULL ){ while(ev){ npc_event_do(ev->name); ev2=ev->next; aFree(ev); ev=ev2; } } return 1; }
// ギルド勧誘への返答 int guild_reply_invite(struct map_session_data *sd,int guild_id,int flag) { struct map_session_data *tsd; nullpo_retr(0, sd); //nullpo_retr(0, tsd= map_id2sd( sd->guild_invite_account )); //I checked the code, and there's no "check" for the case where the guy //that invites another to a guild quits the map-server before being replied. //Hence that's a valid null pointer scenario. :) [Skotlex] if ((tsd= map_id2sd( sd->guild_invite_account )) == NULL) { //Do we send a "invitation failed" msg or something to the player? //Or should we accept the invitation and add it to the guild anyway? //afterall, guild_invite holds the guild id that the player was invited to. sd->guild_invite=0; sd->guild_invite_account=0; return 0; } if(sd->guild_invite!=guild_id) // 勧誘とギルドIDが違う return 0; if(flag==1){ // 承諾 struct guild_member m; struct guild *g; int i; // 定員確認 if( (g=guild_search(tsd->status.guild_id))==NULL ){ sd->guild_invite=0; sd->guild_invite_account=0; return 0; } for(i=0;i<g->max_member;i++) if(g->member[i].account_id==0) break; if(i==g->max_member){ sd->guild_invite=0; sd->guild_invite_account=0; clif_guild_inviteack(tsd,3); return 0; } //inter鯖へ追加要求 guild_makemember(&m,sd); intif_guild_addmember( sd->guild_invite, &m ); return 0; }else{ // 拒否 sd->guild_invite=0; sd->guild_invite_account=0; clif_guild_inviteack(tsd,1); } return 0; }
/// Guild invitation reply. /// flag: 0:rejected, 1:accepted int guild_reply_invite(struct map_session_data* sd, int guild_id, int flag) { struct map_session_data* tsd; nullpo_ret(sd); // subsequent requests may override the value if( sd->guild_invite != guild_id ) return 0; // mismatch // look up the person who sent the invite //NOTE: this can be NULL because the person might have logged off in the meantime tsd = map_id2sd(sd->guild_invite_account); if ( sd->status.guild_id > 0 ) // [Paradox924X] { // Already in another guild. if ( tsd ) clif_guild_inviteack(tsd,0); return 0; } else if( flag == 0 ) {// rejected sd->guild_invite = 0; sd->guild_invite_account = 0; if( tsd ) clif_guild_inviteack(tsd,1); } else {// accepted struct guild_member m; struct guild* g; int i; if( (g=guild_search(guild_id)) == NULL ) { sd->guild_invite = 0; sd->guild_invite_account = 0; return 0; } ARR_FIND( 0, g->max_member, i, g->member[i].account_id == 0 ); if( i == g->max_member ) { sd->guild_invite = 0; sd->guild_invite_account = 0; if( tsd ) clif_guild_inviteack(tsd,3); return 0; } guild_makemember(&m,sd); intif_guild_addmember(guild_id, &m); //TODO: send a minimap update to this player } return 0; }
// 同盟関係かどうかチェック // 同盟なら1、それ以外は0 int guild_check_alliance(int guild_id1, int guild_id2, int flag) { struct guild *g; int i; g = guild_search(guild_id1); if (g == NULL) return 0; ARR_FIND( 0, MAX_GUILDALLIANCE, i, g->alliance[i].guild_id == guild_id2 && g->alliance[i].opposition == flag ); return( i < MAX_GUILDALLIANCE ) ? 1 : 0; }
//Notification from Char server that a guild's master has changed. [Skotlex] int guild_gm_changed(int guild_id, int account_id, int char_id) { struct guild *g; struct guild_member gm; int pos, i; g=guild_search(guild_id); if (!g) return 0; for(pos=0; pos<g->max_member && !( g->member[pos].account_id==account_id && g->member[pos].char_id==char_id); pos++); if (pos == 0 || pos == g->max_member) return 0; memcpy(&gm, &g->member[pos], sizeof (struct guild_member)); memcpy(&g->member[pos], &g->member[0], sizeof(struct guild_member)); memcpy(&g->member[0], &gm, sizeof(struct guild_member)); g->member[pos].position = g->member[0].position; g->member[0].position = 0; //Position 0: guild Master. strcpy(g->master, g->member[0].name); if (g->member[pos].sd && g->member[pos].sd->fd) { clif_displaymessage(g->member[pos].sd->fd, "You no longer are the Guild Master."); g->member[pos].sd->state.gmaster_flag = 0; } if (g->member[0].sd && g->member[0].sd->fd) { clif_displaymessage(g->member[0].sd->fd, "You have become the Guild Master!"); g->member[0].sd->state.gmaster_flag = g; //Block his skills for 5 minutes to prevent abuse. guild_block_skill(g->member[0].sd, 300000); } // announce the change to all guild members for( i = 0; i < g->max_member; i++ ) { if( g->member[i].sd && g->member[i].sd->fd ) { clif_guild_basicinfo(g->member[i].sd); clif_guild_memberlist(g->member[i].sd); } } return 1; }
// ギルドエンブレム変更 int guild_change_emblem(struct map_session_data *sd,int len,const char *data) { struct guild *g; nullpo_ret(sd); if (battle_config.require_glory_guild && !((g = guild_search(sd->status.guild_id)) && guild_checkskill(g, GD_GLORYGUILD)>0)) { clif_skill_fail(sd,GD_GLORYGUILD,USESKILL_FAIL_LEVEL,0); return 0; } return intif_guild_emblem(sd->status.guild_id,len,data); }
// ギルドメンバーの役職を返す int guild_getposition(struct map_session_data *sd,struct guild *g) { int i; nullpo_retr(-1, sd); if(g==NULL && (g=guild_search(sd->status.guild_id))==NULL) return -1; for(i=0;i<g->max_member;i++) if( g->member[i].account_id==sd->status.account_id && g->member[i].char_id==sd->status.char_id ) return g->member[i].position; return -1; }
/*========================================== * ギルド倉庫データベース *------------------------------------------ */ static struct guild_storage *guild2storage(int guild_id) { struct guild_storage *gs = NULL; if(guild_search(guild_id) != NULL) { gs = (struct guild_storage *)numdb_search(guild_storage_db,guild_id); if(gs == NULL) { gs = (struct guild_storage *)aCalloc(1,sizeof(struct guild_storage)); gs->guild_id = guild_id; numdb_insert(guild_storage_db,gs->guild_id,gs); } } return gs; }
// スキルポイント割り振り通知 int guild_skillupack(int guild_id,int skill_num,int account_id) { struct map_session_data *sd=map_id2sd(account_id); struct guild *g=guild_search(guild_id); int i; if(g==NULL) return 0; if(sd!=NULL) clif_guild_skillup(sd,skill_num,g->skill[skill_num-GD_SKILLBASE].lv); // 全員に通知 for(i=0;i<g->max_member;i++) if((sd=g->member[i].sd)!=NULL) clif_guild_skillinfo(sd); return 0; }
// ギルド役職変更通知 int guild_position_changed(int guild_id,int idx,struct guild_position *p) { struct guild *g=guild_search(guild_id); int i; if(g==NULL) return 0; memcpy(&g->position[idx],p,sizeof(struct guild_position)); clif_guild_positionchanged(g,idx); // Update char name in client [LuzZza] for(i=0;i<g->max_member;i++) if(g->member[i].position == idx && g->member[i].sd != NULL) clif_charnameupdate(g->member[i].sd); return 0; }
// Celest int guild_getexp(struct map_session_data *sd,int exp) { struct guild_expcache *c; nullpo_ret(sd); if (sd->status.guild_id == 0 || guild_search(sd->status.guild_id) == NULL) return 0; c = (struct guild_expcache*)guild_expcache_db->ensure(guild_expcache_db, db_i2key(sd->status.char_id), create_expcache, sd); if (c->exp > UINT64_MAX - exp) c->exp = UINT64_MAX; else c->exp += exp; return exp; }