/** * Kick a member from a chat room. * @param sd : player requesting * @param kickusername : player name to be kicked * @retur 1:success, 0:failure */ int chat_kickchat(struct map_session_data* sd, const char* kickusername) { struct chat_data* cd; int i; nullpo_retr(1, sd); cd = (struct chat_data *)map_id2bl(sd->chatID); if( cd == NULL || (struct block_list *)sd != cd->owner ) return -1; ARR_FIND( 0, cd->users, i, strncmp(cd->usersd[i]->status.name, kickusername, NAME_LENGTH) == 0 ); if( i == cd->users ) return -1; if (pc_has_permission(cd->usersd[i], PC_PERM_NO_CHAT_KICK)) return 0; //gm kick protection [Valaris] idb_put(cd->kick_list,cd->usersd[i]->status.char_id,(void*)1); chat_leavechat(cd->usersd[i],1); return 0; }
/// Kicks all the users from the chat room. int chat_npckickall(struct chat_data* cd) { nullpo_ret(cd); while( cd->users > 0 ) chat_leavechat(cd->usersd[cd->users-1],0); return 0; }
/*========================================== * チャットルームから全員蹴り出す *------------------------------------------ */ int chat_npckickall(struct chat_data *cd) { nullpo_retr(0, cd); while(cd->users>0){ chat_leavechat(cd->usersd[cd->users-1]); } return 0; }
/** * Kicks a user from the chat room. * @param cd : chat to be kicked from * @param kickusername : player name to be kicked * @retur 1:success, 0:failure */ int chat_npckickchat(struct chat_data* cd, const char* kickusername) { int i; nullpo_ret(cd); ARR_FIND( 0, cd->users, i, strncmp(cd->usersd[i]->status.name, kickusername, NAME_LENGTH) == 0 ); if( i == cd->users ) return -1; chat_leavechat(cd->usersd[i],1); return 0; }
/*========================================== * チャットルーム作成 *------------------------------------------ */ void chat_createchat(struct map_session_data *sd, unsigned short limit, unsigned char pub, const char* pass, const char* title, int titlelen) { struct chat_data *cd; nullpo_retv(sd); if(sd->state.joinchat && chat_leavechat(sd,0)) return; cd = (struct chat_data *)aCalloc(1,sizeof(struct chat_data)); cd->limit = (unsigned char)limit; cd->pub = pub; cd->users = 1; memcpy(cd->pass,pass,8); if(titlelen >= sizeof(cd->title)-1) { titlelen = sizeof(cd->title)-1; } memcpy(cd->title,title,titlelen); cd->title[titlelen] = 0; cd->owner = (struct block_list **)(&cd->usersd[0]); cd->usersd[0] = sd; cd->bl.m = sd->bl.m; cd->bl.x = sd->bl.x; cd->bl.y = sd->bl.y; cd->bl.type = BL_CHAT; cd->zeny = 0; cd->lowlv = 0; cd->highlv = MAX_LEVEL; cd->job = 0xFFFFFFFF; cd->upper = 0; cd->bl.id = map_addobject(&cd->bl); if(cd->bl.id == 0) { clif_createchat(sd,1); aFree(cd); return; } sd->chatID = cd->bl.id; sd->state.joinchat = 1; clif_createchat(sd,0); clif_dispchat(cd,-1); return; }
/*========================================== * チャットルームから蹴り出す *------------------------------------------ */ void chat_kickchat(struct map_session_data *sd, const char *kickusername) { struct chat_data *cd; int i; nullpo_retv(sd); cd = map_id2cd(sd->chatID); if(cd == NULL || &sd->bl != (*cd->owner)) return; for(i = 0; i < cd->users; i++) { if(strncmp(cd->usersd[i]->status.name, kickusername, 24) == 0) { linkdb_insert(&cd->ban_list, INT2PTR(cd->usersd[i]->status.char_id), INT2PTR(1)); chat_leavechat(cd->usersd[i], 1); break; } } return; }
/*========================================== * kick an user from a chatroom *------------------------------------------*/ int chat_kickchat(struct map_session_data* sd, const char* kickusername) { struct chat_data* cd; int i; nullpo_retr(1, sd); cd = (struct chat_data *)map_id2bl(sd->chatID); if( cd==NULL || (struct block_list *)sd != cd->owner ) return -1; ARR_FIND( 0, cd->users, i, strncmp(cd->usersd[i]->status.name, kickusername, NAME_LENGTH) == 0 ); if( i == cd->users ) return -1; if( battle_config.gm_kick_chat && pc_isGM(cd->usersd[i]) >= battle_config.gm_kick_chat ) return 0; //gm kick protection [Valaris] chat_leavechat(cd->usersd[i],1); return 0; }
/*========================================== * チャットルームから蹴り出す *------------------------------------------ */ int chat_kickchat(struct map_session_data *sd,char *kickusername) { struct chat_data *cd; int i; nullpo_retr(1, sd); cd = (struct chat_data *)map_id2bl(sd->chatID); for(i = 0; i < cd->users; i++) { if (strcmp(cd->usersd[i]->status.name, kickusername) == 0) { if (battle_config.gm_kick_chat && pc_isGM(cd->usersd[i]) >= battle_config.gm_kick_chat) //gm kick protection by valaris return 0; chat_leavechat(cd->usersd[i]); return 0; } } return -1; }
/*========================================== * チャットルームから蹴り出す *------------------------------------------ */ int chat_kickchat(struct map_session_data *sd,char *kickusername) { struct chat_data *cd; int i,kickuser; cd=(struct chat_data*)map_id2bl(sd->chatID); if(cd==NULL || (struct block_list *)sd!=(*cd->owner)) return 1; for(i = 0,kickuser=-1;i < cd->users;i++){ if(strcmp(cd->usersd[i]->status.name,kickusername)==0){ kickuser=i; break; } } if(kickuser<0) // そんな人は居ない return -1; chat_leavechat(cd->usersd[kickuser]); return 0; }
/*========================================== * PCのquit処理 map.c内分 * * quit処理の主体が違うような気もしてきた *------------------------------------------ */ int map_quit(struct map_session_data *sd) { if(sd->chatID) // チャットから出る chat_leavechat(sd); if(sd->trade_partner) // 取引を中断する trade_tradecancel(sd); if(sd->party_invite>0) // パーティ勧誘を拒否する party_reply_invite(sd,sd->party_invite_account,0); if(sd->guild_invite>0) // ギルド勧誘を拒否する guild_reply_invite(sd,sd->guild_invite,0); if(sd->guild_alliance>0) // ギルド同盟勧誘を拒否する guild_reply_reqalliance(sd,sd->guild_alliance_account,0); party_send_logout(sd); // パーティのログアウトメッセージ送信 guild_send_memberinfoshort(sd,0); // ギルドのログアウトメッセージ送信 pc_cleareventtimer(sd); // イベントタイマを破棄する storage_storage_quit(sd); // 倉庫を開いてるなら保存する skill_castcancel(&sd->bl,0); // 詠唱を中断する skill_status_change_clear(&sd->bl); // ステータス異常を解除する skill_clear_unitgroup(&sd->bl); // スキルユニットグループの削除 skill_cleartimerskill(&sd->bl); pc_stop_walking(sd,0); pc_stopattack(sd); pc_delinvincibletimer(sd); pc_delspiritball(sd,sd->spiritball,1); skill_gangsterparadise(sd,0); pc_calcstatus(sd,4); clif_clearchar_area(&sd->bl,2); if(sd->status.pet_id && sd->pd) { pet_remove_map(sd); if(sd->pet.intimate <= 0) { intif_delete_petdata(sd->status.pet_id); sd->status.pet_id = 0; sd->pd = NULL; sd->petDB = NULL; } else intif_save_petdata(sd->status.account_id,&sd->pet); } if(pc_isdead(sd)) pc_setrestartvalue(sd,2); pc_makesavestatus(sd); chrif_save(sd); storage_storage_save(sd); map_delblock(&sd->bl); numdb_erase(id_db,sd->bl.id); strdb_erase(nick_db,sd->status.name); return 0; }