int party_create(struct map_session_data *sd,char *name,int item,int item2) { struct party_member leader; nullpo_retr(0, sd); if(sd->status.party_id) { clif_party_created(sd,2); return 0; } party_fill_member(&leader, sd); leader.leader = 1; intif_create_party(&leader,name,item,item2); return 0; }
int party_created(int account_id, int fail, intptr_t party_id, char *name) { struct map_session_data *sd; sd = map_id2sd(account_id); nullpo_retr(0, sd); if (fail == 0) { struct party *p; sd->status.party_id = party_id; if ((p = numdb_search(party_db, party_id)) != NULL) { printf("party: id already exists!\n"); exit(1); } CALLOC(p, struct party, 1); p->party_id = party_id; strncpy(p->name, name, 24); numdb_insert(party_db,party_id, p); clif_party_created(sd, 0); // 0xfa <flag>.B: 0: Party has successfully been organized, 1: That Party Name already exists., 2: The Character is already in a party. } else {
int party_create(struct map_session_data *sd,char *name,int item,int item2) { struct party_member leader; char tname[NAME_LENGTH]; safestrncpy(tname, name, NAME_LENGTH); trim(tname); if( !tname[0] ) // empty name return 0; if( sd->status.party_id > 0 || sd->party_joining || sd->party_creating ) { // already associated with a party clif_party_created(sd,2); return -2; } sd->party_creating = true; party_fill_member(&leader, sd, 1); intif_create_party(&leader,name,item,item2); return 1; }