Add Player Fame script commands (#7310)

* Add the ability to update and retrieve fame info of a character.
This commit is contained in:
HAO YAN 2022-10-21 01:05:39 +08:00 committed by GitHub
parent 07c18f248b
commit a001e1c6e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 60 additions and 0 deletions

View File

@ -11183,3 +11183,24 @@ See 'achievementinfo' for valid <type> values.
- Excludes ACHIEVEINFO_LEVEL and ACHIEVEINFO_SCORE. - Excludes ACHIEVEINFO_LEVEL and ACHIEVEINFO_SCORE.
--------------------------------------- ---------------------------------------
*addfame(<amount>,{,<char id>})
Increases the fame of the attached player or the supplied <char id> by the <amount> given.
Note: Only works with classes that use the ranking system.
---------------------------------------
*getfame({<char id>})
Gets the fame points of the attached player or the supplied <char id>.
Note: Only works with classes that use the ranking system.
---------------------------------------
*getfamerank({<char id>})
Returns fame rank (start from 1 to MAX_FAME_LIST), else 0.
Note: Only works with classes that use the ranking system.
---------------------------------------

View File

@ -26710,6 +26710,42 @@ BUILDIN_FUNC(item_enchant){
#endif #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" #include "../custom/script.inc"
// declarations that were supposed to be exported from npc_chat.cpp // 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(get_reputation_points, "i?"),
BUILDIN_DEF(item_reform, "??"), BUILDIN_DEF(item_reform, "??"),
BUILDIN_DEF(item_enchant, "i?"), BUILDIN_DEF(item_enchant, "i?"),
BUILDIN_DEF(addfame, "i?"),
BUILDIN_DEF(getfame, "?"),
BUILDIN_DEF(getfamerank, "?"),
#include "../custom/script_def.inc" #include "../custom/script_def.inc"
{NULL,NULL,NULL}, {NULL,NULL,NULL},