From f8ccd420cb13c4e8c3e32ac64ae0e6a43576526e Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Wed, 26 Oct 2022 01:32:27 -0300 Subject: I forgot, but previous commit does nothing without being on global_event_handler --- world/map/npc/functions/global_event_handler.txt | 4 ++++ world/map/npc/functions/vault.txt | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/world/map/npc/functions/global_event_handler.txt b/world/map/npc/functions/global_event_handler.txt index dab56fde..690b0566 100644 --- a/world/map/npc/functions/global_event_handler.txt +++ b/world/map/npc/functions/global_event_handler.txt @@ -38,6 +38,10 @@ OnPCDieEvent: set @killerrid, 0; // reset killer rid end; +OnPCLogoutEvent: + callfunc "VaultLogout"; + end; + OnInit: callfunc "ClearGlobalVars"; callfunc "MOTD"; // set the MOTD array diff --git a/world/map/npc/functions/vault.txt b/world/map/npc/functions/vault.txt index 1c08dba1..ee30863c 100644 --- a/world/map/npc/functions/vault.txt +++ b/world/map/npc/functions/vault.txt @@ -6,6 +6,7 @@ function|script|VaultLogin { if (##VAULT < 1) goto L_Return; + // TODO: Or #VAULT ? Which of the two is set? callsub S_Exp; callsub S_Gold; @@ -170,3 +171,17 @@ L_Flush2: return; } +function|script|VaultLogout +{ + if (##VAULT < 1) goto L_Return; + // TODO: Or #VAULT ? Which of the two is set? + set $@API_PROTOCOL, API_VAULT; + set $@API_DATA$, "'UID': "+##VAULT+", 'GID': "+getcharid(3); + callfunc "FlushAPI"; + + return; + +L_Return: + return; +} + -- cgit v1.2.3-70-g09d2