本文整理汇总了C++中party_search函数的典型用法代码示例。如果您正苦于以下问题:C++ party_search函数的具体用法?C++ party_search怎么用?C++ party_search使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了party_search函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: party_member_leaved
int party_member_leaved(int party_id,int account_id,int char_id)
{
struct map_session_data *sd=map_id2sd(account_id);
struct party_data *p=party_search(party_id);
int i;
if (sd && sd->status.char_id != char_id) //Wrong target
sd = NULL;
if(p!=NULL){
for(i=0;i<MAX_PARTY;i++)
if(p->party.member[i].account_id==account_id &&
p->party.member[i].char_id==char_id){
clif_party_leaved(p,sd,account_id,p->party.member[i].name,0x00);
memset(&p->party.member[i], 0, sizeof(p->party.member[0]));
memset(&p->data[i], 0, sizeof(p->data[0]));
p->party.count--;
party_check_state(p);
break;
}
}
if(sd!=NULL && sd->status.party_id==party_id){
sd->status.party_id=0;
sd->state.party_sent=0;
clif_charnameupdate(sd); //Update name display [Skotlex]
//TODO: hp bars should be cleared too
}
return 0;
}
示例2: party_member_withdraw
/// Invoked (from char-server) when a party member leaves the party.
int party_member_withdraw(int party_id, int account_id, int char_id)
{
struct map_session_data* sd = map_id2sd(account_id);
struct party_data* p = party_search(party_id);
if( p ) {
int i;
ARR_FIND( 0, MAX_PARTY, i, p->party.member[i].account_id == account_id && p->party.member[i].char_id == char_id );
if( i < MAX_PARTY ) {
clif_party_withdraw(p,sd,account_id,p->party.member[i].name,0x0);
memset(&p->party.member[i], 0, sizeof(p->party.member[0]));
memset(&p->data[i], 0, sizeof(p->data[0]));
p->party.count--;
party_check_state(p);
}
}
if( sd && sd->status.party_id == party_id && sd->status.char_id == char_id ) {
int idxlist[MAX_INVENTORY]; //or malloc to reduce consumtion
int j,i;
j = pc_bound_chk(sd,3,idxlist);
for(i=0;i<j;i++)
pc_delitem(sd,idxlist[i],sd->status.inventory[idxlist[i]].amount,0,1,LOG_TYPE_OTHER);
sd->status.party_id = 0;
clif_charnameupdate(sd); //Update name display [Skotlex]
//TODO: hp bars should be cleared too
if( p->instance_id )
instance_check_kick(sd);
}
return 0;
}
示例3: party_removemember2
int party_removemember2(struct map_session_data *sd,int char_id,int party_id)
{
if( sd ) {
if( !sd->status.party_id )
return -3;
party_trade_bound_cancel(sd);
intif_party_leave(sd->status.party_id,sd->status.account_id,sd->status.char_id);
return 1;
} else {
int i;
struct party_data *p = party_search(party_id);
if( !p )
return -2;
ARR_FIND(0,MAX_PARTY,i,p->party.member[i].char_id == char_id);
if( i >= MAX_PARTY )
return -1;
intif_party_leave(party_id,p->party.member[i].account_id,char_id);
return 1;
}
return 0;
}
示例4: party_recv_message
// パーティメッセージ受信
void party_recv_message(int party_id, int account_id, XString mes)
{
struct party *p;
if ((p = party_search(party_id)) == NULL)
return;
clif_party_message(p, account_id, mes);
}
示例5: party_recv_movemap
int party_recv_movemap(int party_id,int account_id,int char_id, unsigned short map,int online,int lv)
{
struct party_data *p;
int i;
if( (p=party_search(party_id))==NULL)
return 0;
for(i=0;i<MAX_PARTY;i++){
struct map_session_data *sd;
struct party_member *m=&p->party.member[i];
if(m->account_id==account_id && m->char_id==char_id){
m->map = map;
m->online=online;
m->lv=lv;
//Check if they still exist on this map server
sd = map_id2sd(m->account_id);
p->data[i].sd = (sd!=NULL && sd->status.party_id==p->party.party_id && sd->status.char_id == m->char_id && !sd->state.waitingdisconnect)?sd:NULL;
break;
}
}
if(i==MAX_PARTY){
if(battle_config.error_log)
ShowError("party: not found member %d/%d on %d[%s]",account_id,char_id,party_id,p->party.name);
return 0;
}
clif_party_info(p,NULL);
return 0;
}
示例6: party_broken
/// Invoked (from char-server) when a party is disbanded.
int party_broken(int party_id)
{
struct party_data* p;
int i;
p = party_search(party_id);
if( p == NULL )
return 0;
if( p->instance_id )
{
instance[p->instance_id].party_id = 0;
instance_destroy( p->instance_id );
}
for( i = 0; i < MAX_PARTY; i++ )
{
if( p->data[i].sd!=NULL )
{
clif_party_withdraw(p,p->data[i].sd,p->party.member[i].account_id,p->party.member[i].name,0x10);
p->data[i].sd->status.party_id=0;
}
}
idb_remove(party_db,party_id);
return 0;
}
示例7: party_removemember
// パーティ除名要求
int party_removemember(dumb_ptr<map_session_data> sd, int account_id)
{
struct party *p;
int i;
nullpo_ret(sd);
if ((p = party_search(sd->status.party_id)) == NULL)
return 0;
for (i = 0; i < MAX_PARTY; i++)
{ // リーダーかどうかチェック
if (p->member[i].account_id == sd->status.account_id)
if (p->member[i].leader == 0)
return 0;
}
for (i = 0; i < MAX_PARTY; i++)
{ // 所属しているか調べる
if (p->member[i].account_id == account_id)
{
intif_party_leave(p->party_id, account_id);
return 0;
}
}
return 0;
}
示例8: party_send_movemap
void party_send_movemap(struct map_session_data *sd)
{
int i;
struct party_data *p;
if( sd->status.party_id==0 )
return;
intif_party_changemap(sd,1);
p=party_search(sd->status.party_id);
if (!p) return;
if(sd->state.connect_new) {
//Note that this works because this function is invoked before connect_new is cleared.
clif_party_option(p,sd,0x100);
clif_party_info(p,sd);
clif_party_member_info(p,sd);
}
if (sd->fd) { // synchronize minimap positions with the rest of the party
for(i=0; i < MAX_PARTY; i++) {
if (p->data[i].sd &&
p->data[i].sd != sd &&
p->data[i].sd->bl.m == sd->bl.m)
{
clif_party_xy_single(sd->fd, p->data[i].sd);
clif_party_xy_single(p->data[i].sd->fd, sd);
}
}
}
return;
}
示例9: party_send_movemap
// パーティメンバの移動
int party_send_movemap(dumb_ptr<map_session_data> sd)
{
struct party *p;
nullpo_ret(sd);
if (sd->status.party_id == 0)
return 0;
intif_party_changemap(sd, 1);
if (sd->party_sended != 0) // もうパーティデータは送信済み
return 0;
// 競合確認
party_check_conflict(sd);
// あるならパーティ情報送信
if ((p = party_search(sd->status.party_id)) != NULL)
{
party_check_member(p); // 所属を確認する
if (sd->status.party_id == p->party_id)
{
clif_party_info(p, sd->fd);
clif_party_option(p, sd, 0x100);
sd->party_sended = 1;
}
}
return 0;
}
示例10: party_booking_update
void party_booking_update(struct map_session_data *sd, short* job)
{
int i;
struct party_data *p=party_search(sd->status.party_id);
struct party_booking_ad_info *pb_ad;
if (!check_party_leader(sd, p)) {
return;
}
pb_ad = (struct party_booking_ad_info*)idb_get(party_booking_db, p->party.party_id);
if( pb_ad == NULL )
return;
pb_ad->starttime = (int)time(NULL);// Update time.
for(i=0;i<6;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);
return;
}
示例11: party_booking_register
void party_booking_register(struct map_session_data *sd, short level, short mapid, short* job)
{
struct party_booking_ad_info *pb_ad;
struct party_data *p=party_search(sd->status.party_id);
int i;
if (!check_party_leader(sd, p)) {
clif_PartyBookingRegisterAck(sd, 1);
return;
}
pb_ad = (struct party_booking_ad_info*)idb_get(party_booking_db, p->party.party_id);
if( pb_ad == NULL )
{
pb_ad = create_party_booking_data(p->party.party_id);
idb_put(party_booking_db, pb_ad->index, pb_ad);
}
memcpy(pb_ad->charname,sd->status.name,NAME_LENGTH);
pb_ad->starttime = (int)time(NULL);
pb_ad->p_detail.level = level;
pb_ad->p_detail.mapid = mapid;
for(i=0;i<6;i++)
if(job[i] != 0xFF)
pb_ad->p_detail.job[i] = job[i];
else pb_ad->p_detail.job[i] = -1;
clif_PartyBookingRegisterAck(sd, 0);
clif_PartyBookingInsertNotify(sd, pb_ad); // Notice
clif_PartyBookingSearchAck(sd->fd, &pb_ad->index, 1, false); // Update Client!
return;
}
示例12: party_removemember
/// Party member 'sd' requesting kick of member with <account_id, name>.
int party_removemember(struct map_session_data* sd, uint32 account_id, char* name)
{
struct party_data *p;
int i;
p = party_search(sd->status.party_id);
if( p == NULL )
return 0;
// check the requesting char's party membership
ARR_FIND( 0, MAX_PARTY, i, p->party.member[i].account_id == sd->status.account_id && p->party.member[i].char_id == sd->status.char_id );
if( i == MAX_PARTY )
return 0; // request from someone not in party? o.O
if( !p->party.member[i].leader )
return 0; // only party leader may remove members
ARR_FIND( 0, MAX_PARTY, i, p->party.member[i].account_id == account_id && strncmp(p->party.member[i].name,name,NAME_LENGTH) == 0 );
if( i == MAX_PARTY )
return 0; // no such char in party
party_trade_bound_cancel(sd);
intif_party_leave(p->party.party_id,account_id,p->party.member[i].char_id);
return 1;
}
示例13: party_member_withdraw
/// Invoked (from char-server) when a party member leaves the party.
int party_member_withdraw(int party_id, int account_id, int char_id)
{
struct map_session_data* sd = map_id2sd(account_id);
struct party_data* p = party_search(party_id);
int i;
if( p )
{
ARR_FIND( 0, MAX_PARTY, i, p->party.member[i].account_id == account_id && p->party.member[i].char_id == char_id );
if( i < MAX_PARTY )
{
clif_party_withdraw(p,sd,account_id,p->party.member[i].name,0x00);
memset(&p->party.member[i], 0, sizeof(p->party.member[0]));
memset(&p->data[i], 0, sizeof(p->data[0]));
p->party.count--;
party_check_state(p);
clif_party_info(p, NULL);
}
}
if( sd && sd->status.party_id == party_id && sd->status.char_id == char_id )
{
sd->status.party_id = 0;
if( sd->state.spb ) {
sd->state.spb = 0;
clif_displaymessage(sd->fd, msg_txt(1451));
}
clif_charnameupdate(sd); //Update name display [Skotlex]
//TODO: hp bars should be cleared too
if( p->instance_id )
instance_check_kick(sd);
}
return 0;
}
示例14: party_removemember
// パーティ除名要求
int party_removemember(struct map_session_data *sd,int account_id,char *name)
{
struct party *p;
int i;
nullpo_retr(0, sd);
if( (p = party_search(sd->status.party_id)) == NULL )
return 0;
for(i=0;i<MAX_PARTY;i++){ // リーダーかどうかチェック
if(p->member[i].account_id==sd->status.account_id && p->member[i].char_id==sd->status.char_id) {
if(p->member[i].leader)
break;
return 0;
}
}
if (i >= MAX_PARTY) //Request from someone not in party? o.O
return 0;
for(i=0;i<MAX_PARTY;i++){ // 所属しているか調べる
if(p->member[i].account_id==account_id && strncmp(p->member[i].name,name,NAME_LENGTH)==0)
{
intif_party_leave(p->party_id,account_id,p->member[i].char_id);
return 1;
}
}
return 0;
}
示例15: party_recv_movemap
/// Invoked (from char-server) when a party member
/// - changes maps
/// - logs in or out
/// - gains a level (disabled)
int party_recv_movemap(int party_id,int account_id,int char_id, unsigned short map,int online,int lv)
{
struct party_member* m;
struct party_data* p;
int i;
p = party_search(party_id);
if( p == NULL )
return 0;
ARR_FIND( 0, MAX_PARTY, i, p->party.member[i].account_id == account_id && p->party.member[i].char_id == char_id );
if( i == MAX_PARTY )
{
ShowError("party_recv_movemap: char %d/%d not found in party %s (id:%d)",account_id,char_id,p->party.name,party_id);
return 0;
}
m = &p->party.member[i];
m->map = map;
m->online = online;
m->lv = lv;
//Check if they still exist on this map server
p->data[i].sd = party_sd_check(party_id, account_id, char_id);
clif_party_info(p,NULL);
return 0;
}