Refactored achievement conditions (#3831)

They now use the normal script engine and not a duplicated portion of code of it.
This is required for another pending update.

This also fixes atcommands not triggering status achievements.

Thanks to @aleos89 and @RadianFord
This commit is contained in:
Lemongrass3110
2019-01-13 17:26:25 +01:00
committed by GitHub
parent 444d7394c2
commit 4706115d5b
7 changed files with 105 additions and 368 deletions

View File

@@ -12197,7 +12197,7 @@ BUILDIN_FUNC(warpwaitingpc)
/// Detaches a character from a script.
///
/// @param st Script state to detach the character from.
static void script_detach_rid(struct script_state* st)
void script_detach_rid(struct script_state* st)
{
if(st->rid)
{
@@ -24061,6 +24061,17 @@ BUILDIN_FUNC( camerainfo ){
#endif
}
// This function is only meant to be used inside of achievement conditions
BUILDIN_FUNC(achievement_condition){
// Push what we get from the script
script_pushint( st, 2 );
// Otherwise the script is freed afterwards
st->state = RERUNLINE;
return SCRIPT_CMD_SUCCESS;
}
#include "../custom/script.inc"
// declarations that were supposed to be exported from npc_chat.c
@@ -24724,6 +24735,8 @@ struct script_function buildin_func[] = {
BUILDIN_DEF(is_guild_leader,"?"),
BUILDIN_DEF(is_party_leader,"?"),
BUILDIN_DEF(camerainfo,"iii?"),
BUILDIN_DEF(achievement_condition,"i"),
#include "../custom/script_def.inc"
{NULL,NULL,NULL},