diff options
Diffstat (limited to 'src/emap/script_buildins.c')
-rw-r--r-- | src/emap/script_buildins.c | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/src/emap/script_buildins.c b/src/emap/script_buildins.c index 7393da8..26a2dd4 100644 --- a/src/emap/script_buildins.c +++ b/src/emap/script_buildins.c @@ -2663,3 +2663,69 @@ BUILDIN(homstatus) } +/*========================================== + * return the updated stats of sd (use bonus constants) + * Supported values: bStr~bLuk, bMaxHP, bMaxSP, bDef, bMdef, bAtk + *------------------------------------------*/ +BUILDIN(readparam2) +{ + struct map_session_data *sd; + int data = script_getnum(st,2); + + // Account ID/Player Name is also supported + if (script_hasdata(st, 3)) { + if (script_isstringtype(st, 3)) { + sd = script->nick2sd(st, script_getstr(st, 3)); + } else { + sd = script->id2sd(st, script_getnum(st, 3)); + } + } else { + sd = script->rid2sd(st); + } + + // Error + if (sd == NULL) { + script_pushint(st, -1); + return true; + } + + switch (data) { + case 13: + script_pushint(st, sd->battle_status.str); + break; + case 14: + script_pushint(st, sd->battle_status.agi); + break; + case 15: + script_pushint(st, sd->battle_status.vit); + break; + case 16: + script_pushint(st, sd->battle_status.int_); + break; + case 17: + script_pushint(st, sd->battle_status.dex); + break; + case 18: + script_pushint(st, sd->battle_status.luk); + break; + case 6: + script_pushint(st, sd->battle_status.max_hp); + break; + case 8: + script_pushint(st, sd->battle_status.max_sp); + break; + case 45: + script_pushint(st, sd->battle_status.def); + break; + case 41: + script_pushint(st, sd->battle_status.batk+sd->battle_status.rhw.atk); + break; + default: + ShowError("Wrong paramType in readparam2\nAre you sure you used bonus constants?\nSupported values: bMaxHP, bMaxSP, bStr, bAgi, bVit, bInt, bDex, bLuk, bAtk, bDef\n"); + script_pushint(st, -1); + break; + } + + return true; +} + |