|
@@ -24447,6 +24447,59 @@ BUILDIN_FUNC(getvariableofinstance)
|
|
return SCRIPT_CMD_SUCCESS;
|
|
return SCRIPT_CMD_SUCCESS;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+/*
|
|
|
|
+ convertpcinfo(<char_id>,<type>)
|
|
|
|
+ convertpcinfo(<account_id>,<type>)
|
|
|
|
+ convertpcinfo(<player_name>,<type>)
|
|
|
|
+*/
|
|
|
|
+BUILDIN_FUNC(convertpcinfo) {
|
|
|
|
+ TBL_PC *sd;
|
|
|
|
+
|
|
|
|
+ if (script_isstring(st, 2))
|
|
|
|
+ sd = map_nick2sd(script_getstr(st, 2),false);
|
|
|
|
+ else {
|
|
|
|
+ int id = script_getnum(st, 2);
|
|
|
|
+ sd = map_id2sd(id);
|
|
|
|
+ if (!sd)
|
|
|
|
+ sd = map_charid2sd(id);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ int type = script_getnum(st, 3);
|
|
|
|
+
|
|
|
|
+ switch (type) {
|
|
|
|
+ case CPC_NAME:
|
|
|
|
+ case CPC_CHAR:
|
|
|
|
+ case CPC_ACCOUNT:
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ ShowError("buildin_convertpcinfo: Unknown type %d.\n", type);
|
|
|
|
+ script_pushnil(st);
|
|
|
|
+ st->state = END;
|
|
|
|
+ return SCRIPT_CMD_FAILURE;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!sd) {
|
|
|
|
+ if (type == CPC_NAME)
|
|
|
|
+ script_pushstrcopy(st, "");
|
|
|
|
+ else
|
|
|
|
+ script_pushint(st, 0);
|
|
|
|
+ return SCRIPT_CMD_SUCCESS;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ switch (type) {
|
|
|
|
+ case CPC_NAME:
|
|
|
|
+ script_pushstrcopy(st, sd->status.name);
|
|
|
|
+ break;
|
|
|
|
+ case CPC_CHAR:
|
|
|
|
+ script_pushint(st, sd->status.char_id);
|
|
|
|
+ break;
|
|
|
|
+ case CPC_ACCOUNT:
|
|
|
|
+ script_pushint(st, sd->status.account_id);
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ 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
|
|
@@ -25116,6 +25169,7 @@ struct script_function buildin_func[] = {
|
|
|
|
|
|
BUILDIN_DEF(achievement_condition,"i"),
|
|
BUILDIN_DEF(achievement_condition,"i"),
|
|
BUILDIN_DEF(getvariableofinstance,"ri"),
|
|
BUILDIN_DEF(getvariableofinstance,"ri"),
|
|
|
|
+ BUILDIN_DEF(convertpcinfo,"vi"),
|
|
#include "../custom/script_def.inc"
|
|
#include "../custom/script_def.inc"
|
|
|
|
|
|
{NULL,NULL,NULL},
|
|
{NULL,NULL,NULL},
|