Suggestion of implementation of is_party_leader and is_guild_leader script commands. (#3617)
* Implemented is_party_leader and is_guild_leader script commands. Thanks to @cydh !
This commit is contained in:
@@ -23991,6 +23991,58 @@ BUILDIN_FUNC(identifyall) {
|
||||
return SCRIPT_CMD_SUCCESS;
|
||||
}
|
||||
|
||||
BUILDIN_FUNC(is_guild_leader)
|
||||
{
|
||||
struct map_session_data* sd;
|
||||
struct guild* guild_data;
|
||||
int guild_id;
|
||||
|
||||
if (!script_rid2sd(sd)) {
|
||||
script_pushint(st, false);
|
||||
return SCRIPT_CMD_FAILURE;
|
||||
}
|
||||
|
||||
if (script_hasdata(st, 2))
|
||||
guild_id = script_getnum(st, 2);
|
||||
else
|
||||
guild_id = sd->status.guild_id;
|
||||
|
||||
guild_data = guild_search(guild_id);
|
||||
if (guild_data)
|
||||
script_pushint(st, (guild_data->member[0].char_id == sd->status.char_id));
|
||||
else
|
||||
script_pushint(st, false);
|
||||
return SCRIPT_CMD_SUCCESS;
|
||||
}
|
||||
|
||||
BUILDIN_FUNC(is_party_leader)
|
||||
{
|
||||
struct map_session_data* sd;
|
||||
struct party_data* p_data;
|
||||
int p_id, i = 0;
|
||||
|
||||
if (!script_rid2sd(sd)) {
|
||||
script_pushint(st, false);
|
||||
return SCRIPT_CMD_FAILURE;
|
||||
}
|
||||
|
||||
if (script_hasdata(st, 2))
|
||||
p_id = script_getnum(st, 2);
|
||||
else
|
||||
p_id = sd->status.party_id;
|
||||
|
||||
p_data = party_search(p_id);
|
||||
if (p_data) {
|
||||
ARR_FIND( 0, MAX_PARTY, i, p_data->data[i].sd == sd );
|
||||
if (i < MAX_PARTY){
|
||||
script_pushint(st, p_data->party.member[i].leader);
|
||||
return SCRIPT_CMD_SUCCESS;
|
||||
}
|
||||
}
|
||||
script_pushint(st, false);
|
||||
return SCRIPT_CMD_SUCCESS;
|
||||
}
|
||||
|
||||
#include "../custom/script.inc"
|
||||
|
||||
// declarations that were supposed to be exported from npc_chat.c
|
||||
@@ -24651,6 +24703,8 @@ struct script_function buildin_func[] = {
|
||||
BUILDIN_DEF(mail, "isss*"),
|
||||
BUILDIN_DEF(open_roulette,"?"),
|
||||
BUILDIN_DEF(identifyall,"??"),
|
||||
BUILDIN_DEF(is_guild_leader,"?"),
|
||||
BUILDIN_DEF(is_party_leader,"?"),
|
||||
#include "../custom/script_def.inc"
|
||||
|
||||
{NULL,NULL,NULL},
|
||||
|
||||
Reference in New Issue
Block a user