diff --git a/doc/script_commands.txt b/doc/script_commands.txt index bf442fc718..938d755bfb 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -11183,3 +11183,24 @@ See 'achievementinfo' for valid values. - Excludes ACHIEVEINFO_LEVEL and ACHIEVEINFO_SCORE. --------------------------------------- + +*addfame(,{,}) + +Increases the fame of the attached player or the supplied by the given. +Note: Only works with classes that use the ranking system. + +--------------------------------------- + +*getfame({}) + +Gets the fame points of the attached player or the supplied . +Note: Only works with classes that use the ranking system. + +--------------------------------------- + +*getfamerank({}) + +Returns fame rank (start from 1 to MAX_FAME_LIST), else 0. +Note: Only works with classes that use the ranking system. + +--------------------------------------- diff --git a/src/map/script.cpp b/src/map/script.cpp index 687567b595..631fd3a64f 100644 --- a/src/map/script.cpp +++ b/src/map/script.cpp @@ -26710,6 +26710,42 @@ BUILDIN_FUNC(item_enchant){ #endif } + +BUILDIN_FUNC(addfame) { + struct map_session_data *sd; + + if (!script_charid2sd(3, sd)) + return SCRIPT_CMD_FAILURE; + + if (!pc_addfame(*sd, script_getnum(st, 2))) + return SCRIPT_CMD_FAILURE; + + return SCRIPT_CMD_SUCCESS; +} + + +BUILDIN_FUNC(getfame) { + struct map_session_data *sd; + + if (!script_charid2sd(2, sd)) + return SCRIPT_CMD_FAILURE; + + script_pushint(st, sd->status.fame); + + return SCRIPT_CMD_SUCCESS; +} + +BUILDIN_FUNC(getfamerank) { + struct map_session_data *sd; + + if (!script_charid2sd(2, sd)) + return SCRIPT_CMD_FAILURE; + + script_pushint(st, pc_famerank(sd->status.char_id, sd->class_ & MAPID_UPPERMASK)); + + return SCRIPT_CMD_SUCCESS; +} + #include "../custom/script.inc" // declarations that were supposed to be exported from npc_chat.cpp @@ -27456,6 +27492,9 @@ struct script_function buildin_func[] = { BUILDIN_DEF(get_reputation_points, "i?"), BUILDIN_DEF(item_reform, "??"), BUILDIN_DEF(item_enchant, "i?"), + BUILDIN_DEF(addfame, "i?"), + BUILDIN_DEF(getfame, "?"), + BUILDIN_DEF(getfamerank, "?"), #include "../custom/script_def.inc" {NULL,NULL,NULL},