From 5ff6b8a397040a73edfe5cf3c9898d0d0cc50e99 Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Sun, 24 Jan 2010 17:14:53 -0700 Subject: Expand ClearVariables function Now removes event variables from 2009 and tryies to fix negative bank accounts. --- npc/001-1_Tulimshar/banker.txt | 2 ++ npc/001-1_Tulimshar/soul-menhir.txt | 1 + npc/009-1_Hurnscald/soul-menhir.txt | 1 + npc/009-2_Hurnscald/richard.txt | 2 ++ npc/020-1_Nivalis/soul-menhir.txt | 1 + npc/functions/clear_vars.txt | 21 +++++++++++++++++++++ 6 files changed, 28 insertions(+) diff --git a/npc/001-1_Tulimshar/banker.txt b/npc/001-1_Tulimshar/banker.txt index c428e6e8..75ea18d5 100644 --- a/npc/001-1_Tulimshar/banker.txt +++ b/npc/001-1_Tulimshar/banker.txt @@ -1,12 +1,14 @@ // 001-1.gat,57,52,0 script Tybalt 107,{ + callfunc "ClearVariables"; set @npcName$, "Tybalt"; callfunc "Banker"; close; } 001-1.gat,51,29,0 script Achar 49,{ + callfunc "ClearVariables"; openstorage; mes "Come again!"; close; diff --git a/npc/001-1_Tulimshar/soul-menhir.txt b/npc/001-1_Tulimshar/soul-menhir.txt index eacdd9e8..00208932 100644 --- a/npc/001-1_Tulimshar/soul-menhir.txt +++ b/npc/001-1_Tulimshar/soul-menhir.txt @@ -1,6 +1,7 @@ // 001-1.gat,38,69,0 script Soul Menhir 144, { + callfunc "ClearVariables"; set @map$, "001-1.gat"; setarray @Xs, 37, 38, 39, 37, 39, 37, 39; setarray @Ys, 68, 68, 68, 69, 69, 70, 70; diff --git a/npc/009-1_Hurnscald/soul-menhir.txt b/npc/009-1_Hurnscald/soul-menhir.txt index d62a1275..5daadd23 100644 --- a/npc/009-1_Hurnscald/soul-menhir.txt +++ b/npc/009-1_Hurnscald/soul-menhir.txt @@ -1,6 +1,7 @@ // 009-1.gat,53,40,0 script Soul Menhir 144, { + callfunc "ClearVariables"; set @map$, "009-1.gat"; setarray @Xs, 52, 53, 54, 52, 54, 52, 54; setarray @Ys, 39, 39, 39, 40, 40, 41, 41; diff --git a/npc/009-2_Hurnscald/richard.txt b/npc/009-2_Hurnscald/richard.txt index 1710ca45..0dcd4d02 100644 --- a/npc/009-2_Hurnscald/richard.txt +++ b/npc/009-2_Hurnscald/richard.txt @@ -1,12 +1,14 @@ // 009-2.gat,20,99,0 script Richard 161,{ + callfunc "ClearVariables"; set @npcName$, "Richard"; callfunc "Banker"; close; } 009-2.gat,19,99,0 script William 48,{ + callfunc "ClearVariables"; openstorage; mes "Come again!"; close; diff --git a/npc/020-1_Nivalis/soul-menhir.txt b/npc/020-1_Nivalis/soul-menhir.txt index 4da72853..ee973170 100644 --- a/npc/020-1_Nivalis/soul-menhir.txt +++ b/npc/020-1_Nivalis/soul-menhir.txt @@ -1,6 +1,7 @@ // 020-1.gat,64,89,0 script Soul Menhir 144, { + callfunc "ClearVariables"; set @map$, "020-1.gat"; setarray @Xs, 63, 64, 65, 63, 65, 63, 65; setarray @Ys, 88, 88, 88, 89, 89, 90, 90; diff --git a/npc/functions/clear_vars.txt b/npc/functions/clear_vars.txt index 706c5cd8..857e3793 100644 --- a/npc/functions/clear_vars.txt +++ b/npc/functions/clear_vars.txt @@ -57,5 +57,26 @@ function script ClearVariables { set QUEST_xmas08_state, 0; + set QUEST_Easter09, 0; + + set Candyman, 0; // Halloween 2009 + + set QUEST_Christmas09_state, 0; + + if (#BankAccount < 0) goto FixBank; + + return; + +FixBank: + if (zeny >= -#BankAccount) goto L_Fix_Full; + + // Partial fix + set #BankAccount, #BankAccount + zeny + set zeny, 0; + return; + +L_Fix_Full: + set zeny, zeny + #BankAccount; + set #BankAccount, 0; return; } -- cgit v1.2.3-60-g2f50