Added script command mercenary_delete (#6334)

Enable to remove mercenary from player.
This commit is contained in:
HAO YAN 2021-10-27 17:25:57 +08:00 committed by GitHub
parent 46586599fb
commit edfb95f39d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 0 deletions

View File

@ -10069,6 +10069,18 @@ This command is typically used in item scripts of mercenary scrolls.
---------------------------------------
*mercenary_delete {<char id>{,<reply>}};
This command removes the mercenary from a player.
The parameter 'reply' can be one of the following values:
0 - Mercenary soldier's duty hour is over, faith increased by 1. (default)
1 - Your mercenary soldier has been killed, faith decreased by 1.
2 - Your mercenary soldier has been fired.
3 - Your mercenary soldier has ran away.
---------------------------------------
*mercenary_heal <hp>,<sp>;
This command works like 'heal', but affects the mercenary of the

View File

@ -19784,6 +19784,32 @@ BUILDIN_FUNC(mercenary_create)
return SCRIPT_CMD_SUCCESS;
}
BUILDIN_FUNC(mercenary_delete)
{
struct map_session_data *sd;
int type = 0;
if( !script_charid2sd(2, sd) )
return SCRIPT_CMD_FAILURE;
if( sd->md == nullptr ) {
ShowWarning("buildin_mercenary_delete: Tried to delete a non existant mercenary from player '%s' (AID: %u, CID: %u)\n", sd->status.name, sd->status.account_id, sd->status.char_id);
return SCRIPT_CMD_FAILURE;
}
if( script_hasdata(st, 3) ) {
type = script_getnum(st, 3);
if( type < 0 || type > 3 ) {
ShowWarning("buildin_mercenary_delete: invalid type value of %d.\n", type);
return SCRIPT_CMD_FAILURE;
}
}
mercenary_delete(sd->md, type);
return SCRIPT_CMD_SUCCESS;
}
BUILDIN_FUNC(mercenary_heal)
{
struct map_session_data *sd;
@ -25790,6 +25816,7 @@ struct script_function buildin_func[] = {
BUILDIN_DEF(checkwall,"s"),
BUILDIN_DEF(searchitem,"rs"),
BUILDIN_DEF(mercenary_create,"ii"),
BUILDIN_DEF(mercenary_delete,"??"),
BUILDIN_DEF(mercenary_heal,"ii"),
BUILDIN_DEF(mercenary_sc_start,"iii"),
BUILDIN_DEF(mercenary_get_calls,"i"),