summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2023-07-08 14:42:19 -0300
committerJesusaves <cpntb1@ymail.com>2023-07-08 14:42:19 -0300
commit7ce577cc3048b91a10b5f26809f3b5bd8feeffd1 (patch)
treec9c52df66918d714b671595b8f28817d13417f3a
parent8d0a50f303276368816e3a940ee05fc5c6f854fa (diff)
downloadserverdata-7ce577cc3048b91a10b5f26809f3b5bd8feeffd1.tar.gz
serverdata-7ce577cc3048b91a10b5f26809f3b5bd8feeffd1.tar.bz2
serverdata-7ce577cc3048b91a10b5f26809f3b5bd8feeffd1.tar.xz
serverdata-7ce577cc3048b91a10b5f26809f3b5bd8feeffd1.zip
Fix race condition
-rw-r--r--npc/functions/hub.txt19
-rw-r--r--npc/functions/vault.txt21
2 files changed, 23 insertions, 17 deletions
diff --git a/npc/functions/hub.txt b/npc/functions/hub.txt
index ae347bd..a10b9a9 100644
--- a/npc/functions/hub.txt
+++ b/npc/functions/hub.txt
@@ -143,22 +143,9 @@ function script HUB_Logout {
// Register logout time
if (!.@dead) {
CHAREG_CLEANUP=gettimetick(2);
- // Send updates to Vault API
- if (getvaultid()) {
- .@api$=json_encode("UID", ##VAULT,
- "GID", getcharid(3),
- "VAR1N", "CRQUEST",
- "VAR1V", ##01_CRQUEST,
- //"VAR2N", "CRWORLD",
- //"VAR2V", ##01_CRWORLD,
- "VEXP", ##VAULT_EXP,
- "GOTO", ##VAULT_GOTO,
- "MLTO", ##VAULT_MLTO);
- ##VAULT_EXP=0;
- ##VAULT_GOTO=0;
- ##VAULT_MLTO=0;
- api_send(API_FLUSHVAULT, .@api$);
- }
+ export_vault();
+ ##VAULT_GOTO=0;
+ ##VAULT_MLTO=0;
}
return;
diff --git a/npc/functions/vault.txt b/npc/functions/vault.txt
index a2adf7c..89a6161 100644
--- a/npc/functions/vault.txt
+++ b/npc/functions/vault.txt
@@ -15,12 +15,30 @@ function script getvaultexp {
RB_DEBUGMES | RB_IRCBROADCAST | RB_GLOBALANNOUNCE | RB_ISFATAL);
if (getvaultid()) {
##VAULT_EXP+=.@exp;
- consoleinfo("Granting %d Soul Exp to %d under the Moubootaur's authority.",
+ consoleinfo("Granting %d Soul Exp to %d under the Crossroads' authority.",
.@exp, ##VAULT);
}
return;
}
+function script export_vault {
+ // Send updates to Vault API
+ if (getvaultid()) {
+ .@api$=json_encode("UID", ##VAULT,
+ "GID", getcharid(3),
+ "VAR1N", "CRQUEST",
+ "VAR1V", ##01_CRQUEST,
+ //"VAR2N", "CRWORLD",
+ //"VAR2V", ##01_CRWORLD,
+ "VEXP", ##VAULT_EXP,
+ "GOTO", ##VAULT_GOTO,
+ "MLTO", ##VAULT_MLTO);
+ ##VAULT_EXP=0;
+ api_send(API_FLUSHVAULT, .@api$);
+ }
+ return;
+}
+
// MirrorLakeSendTo(World, Lake)
function script MirrorLakeSendTo {
.@w=getarg(0);
@@ -29,6 +47,7 @@ function script MirrorLakeSendTo {
##VAULT_MLTO=.@t;
closeclientdialog;
dispbottom l("Darkness fills your vision...");
+ export_vault();
sleep2(1000);
kick(getcharid(3), 7); // 7 is not a valid kick reason
//atcommand("@kick "+strcharinfo(0));