summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2020-05-14 21:47:55 -0300
committerJesusaves <cpntb1@ymail.com>2020-08-05 03:25:42 -0300
commit7b7a700659b32cc73a8636c2103520cd4dada22a (patch)
tree5f43df694c8fd8772bd94c08796294775e37bc4c
parent4ec2c54254ac88de7998353399070ae91fbaf9e4 (diff)
downloadserverdata-7b7a700659b32cc73a8636c2103520cd4dada22a.tar.gz
serverdata-7b7a700659b32cc73a8636c2103520cd4dada22a.tar.bz2
serverdata-7b7a700659b32cc73a8636c2103520cd4dada22a.tar.xz
serverdata-7b7a700659b32cc73a8636c2103520cd4dada22a.zip
Initial version of getv/setv
-rw-r--r--npc/functions/main.txt34
1 files changed, 5 insertions, 29 deletions
diff --git a/npc/functions/main.txt b/npc/functions/main.txt
index 34468237..02374e14 100644
--- a/npc/functions/main.txt
+++ b/npc/functions/main.txt
@@ -224,22 +224,6 @@ function script npctalkonce {
return true;
}
-// validacc() -> Validate attached player vault account
-// Returns "true" on success
-function script validacc {
- .@id=##VAULT[0];
- if (.@id > 0)
- return true;
- // We failed; Maybe we can do something about it?
- if (debug) {
- ##VAULT[0]=getcharid(3);
- consolemes(CONSOLEMES_WARNING, "Account %d has no vault index. Debug environment detected, automatically assigning one...", getcharid(3));
- return true;
- }
- // Nothing to be done about it; I dunno what sort of env this is!
- return false;
-}
-
// getv(variable{, Vault ID}) -> Returns a Vault Variable
function script getv {
.@v$=getarg(0);
@@ -264,7 +248,7 @@ function script getv {
// setv(variable, value{, Vault ID}) -> Sets a Vault Variable
function script setv {
.@v$=getarg(0);
- if (isstr(getarg(1))) {
+ if (charat(.@v$, getstrlen(.@v$)-1) == "$") {
.@val$=getarg(1);
.@str=true;
} else {
@@ -274,17 +258,17 @@ function script setv {
.@id=getarg(2, ##VAULT[0]);
// Hard Fail
if (.@id <= 0) {
- announce "ERROR: setv."+.@v$+" failed - Sysadmin help required.", bc_all|bc_npc;
- channelmes("#irc", "CRITICAL ERROR: Invalid Account (detv."+.@v$+")");
+ announce "ERROR: getv."+.@v$+" failed - Sysadmin help required.", bc_all|bc_npc;
+ channelmes("#irc", "CRITICAL ERROR: Invalid Account (getv."+.@v$+")");
if (playerattached()) {
- dispbottom "A critical error happened in setv."+.@v$+" function. This error is fatal, we halt execution.";
+ dispbottom "A critical error happened in getv."+.@v$+" function. This error is fatal, we halt execution.";
consolemes(CONSOLEMES_ERROR, "Account %d has no vault index. This error is fatal, script execution halted.", getcharid(3));
} else {
consolemes(CONSOLEMES_ERROR, "Vault function called from script without a valid vault account ID. This error is fatal, script execution was halted.");
}
end;
}
- // Yes, 70% of the function is hard-failing.
+ // Yes, 90% of the function is hard-failing.
// I miss Exception() function >__>
if (.@str)
return setd("$VAULT_"+.@v$+"["+.@id+"]", .@val$);
@@ -292,14 +276,6 @@ function script setv {
return setd("$VAULT_"+.@v$+"["+.@id+"]", .@val);
}
-// Get some acc id from char name, even if offline.
-// This is a highly sensitive function; Use with caution.
-// gf_accid( Name )
-function script gf_accid {
- .@nb = query_sql("SELECT account_id FROM `char` WHERE name='"+escape_sql(getarg(0))+"' LIMIT 2", .@value);
- return .@value[0];
-}
-
function script getquestlink {
return "[@@q" + getarg(0) + "|@@]";
}