Allow leaderless party (#1980)

* Fixed some misc. stuff

* Allow for leaderless party.
This commit is contained in:
Matheus Macabu 2017-11-02 12:32:33 +03:00 committed by Cydh Ramdh
parent c09929aa16
commit f86bb39df8
2 changed files with 17 additions and 21 deletions

View File

@ -177,6 +177,13 @@ int inter_party_tosql(struct party *p, int flag, int index)
Sql_ShowDebug(sql_handle);
}
if( flag & PS_DELLEADER )
{// Remove leader status
if( SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `leader_id`='0', `leader_char`='0' WHERE `party_id`='%d'",
schema_config.party_db, party_id) )
Sql_ShowDebug(sql_handle);
}
if( charserv_config.save_log )
ShowInfo("Party Saved (%d - %s)\n", party_id, p->name);
return 1;
@ -647,18 +654,7 @@ int mapif_parse_PartyLeave(int fd, int party_id, uint32 account_id, uint32 char_
mapif_party_withdraw(party_id, account_id, char_id, name, type);
if (p->party.member[i].leader){
// TODO: Official allow 'leaderless' party
p->party.member[i].account_id = 0;
for (j = 0; j < MAX_PARTY; j++) {
if (!p->party.member[j].account_id)
continue;
mapif_party_withdraw(party_id, p->party.member[j].account_id, p->party.member[j].char_id, p->party.member[j].name, type);
p->party.member[j].account_id = 0;
}
//Party gets deleted on the check_empty call below.
} else {
inter_party_tosql(&p->party,PS_DELMEMBER,i);
inter_party_tosql(&p->party, PS_DELMEMBER|((p->party.member[i].leader) ? PS_DELLEADER : 0x00), i);
j = p->party.member[i].lv;
if(p->party.member[i].online) p->party.count--;
memset(&p->party.member[i], 0, sizeof(struct party_member));
@ -668,7 +664,6 @@ int mapif_parse_PartyLeave(int fd, int party_id, uint32 account_id, uint32 char_
if(p->family) p->family = 0; //Family state broken.
int_party_check_lv(p);
}
}
if (party_check_empty(p) == 0)
mapif_party_info(-1, &p->party, 0);

View File

@ -16,6 +16,7 @@ enum {
PS_ADDMEMBER = 0x08, //Specify new party member (index specifies which party member)
PS_DELMEMBER = 0x10, //Specify member that left (index specifies which party member)
PS_BREAK = 0x20, //Specify that this party must be deleted.
PS_DELLEADER = 0x40, //Specify that member that left is also the leader of the party
};
struct party;