diff options
Diffstat (limited to 'src/map/script.c')
-rw-r--r-- | src/map/script.c | 130 |
1 files changed, 128 insertions, 2 deletions
diff --git a/src/map/script.c b/src/map/script.c index d2a77036b..dc1a0fa6d 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -12810,7 +12810,7 @@ BUILDIN_FUNC(setcell) /*========================================== * Mercenary Commands *------------------------------------------*/ -BUILDIN_FUNC(createmercenary) +BUILDIN_FUNC(mercenary_create) { struct map_session_data *sd; int class_, contract_time; @@ -12860,6 +12860,128 @@ BUILDIN_FUNC(mercenary_sc_start) return 0; } +BUILDIN_FUNC(mercenary_get_calls) +{ + struct map_session_data *sd = script_rid2sd(st); + int guild; + + if( sd == NULL ) + return 0; + + guild = script_getnum(st,2); + switch( guild ) + { + case ARCH_MERC_GUILD: + script_pushint(st,sd->status.arch_calls); + break; + case SPEAR_MERC_GUILD: + script_pushint(st,sd->status.spear_calls); + break; + case SWORD_MERC_GUILD: + script_pushint(st,sd->status.sword_calls); + break; + default: + script_pushint(st,0); + break; + } + + return 0; +} + +BUILDIN_FUNC(mercenary_set_calls) +{ + struct map_session_data *sd = script_rid2sd(st); + int guild, value, *calls; + + if( sd == NULL ) + return 0; + + guild = script_getnum(st,2); + value = script_getnum(st,3); + + switch( guild ) + { + case ARCH_MERC_GUILD: + calls = &sd->status.arch_calls; + break; + case SPEAR_MERC_GUILD: + calls = &sd->status.spear_calls; + break; + case SWORD_MERC_GUILD: + calls = &sd->status.sword_calls; + break; + default: + return 0; // Invalid Guild + } + + *calls += value; + *calls = cap_value(*calls, 0, INT_MAX); + + return 0; +} + +BUILDIN_FUNC(mercenary_get_faith) +{ + struct map_session_data *sd = script_rid2sd(st); + int guild; + + if( sd == NULL ) + return 0; + + guild = script_getnum(st,2); + switch( guild ) + { + case ARCH_MERC_GUILD: + script_pushint(st,sd->status.arch_faith); + break; + case SPEAR_MERC_GUILD: + script_pushint(st,sd->status.spear_faith); + break; + case SWORD_MERC_GUILD: + script_pushint(st,sd->status.sword_faith); + break; + default: + script_pushint(st,0); + break; + } + + return 0; +} + +BUILDIN_FUNC(mercenary_set_faith) +{ + struct map_session_data *sd = script_rid2sd(st); + int guild, value, *calls; + + if( sd == NULL ) + return 0; + + guild = script_getnum(st,2); + value = script_getnum(st,3); + + switch( guild ) + { + case ARCH_MERC_GUILD: + calls = &sd->status.arch_faith; + break; + case SPEAR_MERC_GUILD: + calls = &sd->status.spear_faith; + break; + case SWORD_MERC_GUILD: + calls = &sd->status.sword_faith; + break; + default: + return 0; // Invalid Guild + } + + *calls += value; + *calls = cap_value(*calls, 0, INT_MAX); + if( mercenary_get_guild(sd->md) == guild ) + clif_mercenary_updatestatus(sd,SP_MERCFAITH); + + return 0; +} + /****************** Questlog script commands *******************/ @@ -13290,8 +13412,12 @@ struct script_function buildin_func[] = { BUILDIN_DEF(hasquest, "i"), BUILDIN_DEF(setwall,"siiiiis"), BUILDIN_DEF(delwall,"s"), - BUILDIN_DEF(createmercenary,"ii"), + BUILDIN_DEF(mercenary_create,"ii"), BUILDIN_DEF(mercenary_heal,"ii"), BUILDIN_DEF(mercenary_sc_start,"iii"), + BUILDIN_DEF(mercenary_get_calls,"i"), + BUILDIN_DEF(mercenary_get_faith,"i"), + BUILDIN_DEF(mercenary_set_calls,"ii"), + BUILDIN_DEF(mercenary_set_faith,"ii"), {NULL,NULL,NULL}, }; |