summaryrefslogtreecommitdiff
path: root/npc/functions/clear_vars.txt
diff options
context:
space:
mode:
Diffstat (limited to 'npc/functions/clear_vars.txt')
-rwxr-xr-xnpc/functions/clear_vars.txt184
1 files changed, 184 insertions, 0 deletions
diff --git a/npc/functions/clear_vars.txt b/npc/functions/clear_vars.txt
new file mode 100755
index 00000000..76ab7bf7
--- /dev/null
+++ b/npc/functions/clear_vars.txt
@@ -0,0 +1,184 @@
+
+function script ClearVariables {
+ if(@login_event != 1) goto L_Deprecated;
+
+ if(#BankAccount >= 0) return;
+ if (Zeny >= -#BankAccount) {
+ Zeny = Zeny + #BankAccount;
+ #BankAccount = 0;
+ }
+
+ // Partial fix
+ #BankAccount = #BankAccount + Zeny;
+ Zeny = 0;
+ return;
+}
+
+
+function script ClearGlobalVars {
+ $@loop = 5;
+ goto L_FluffyClear;
+
+L_FluffyClear:
+ if ($@loop == 12)
+ goto L_IlliaClear;
+
+ $Record_Fluffy_Name$[$@loop] = "";
+ $Record_Fluffy_Date$[$@loop] = "";
+ $Record_Fluffy_Kills[$@loop] = 0;
+
+ $@loop = $@loop + 1;
+ goto L_FluffyClear;
+
+
+L_IlliaClear:
+ $@loop = 0;
+ goto L_IlliaLoop;
+
+L_IlliaLoop:
+ if ($Illia_Win_Records$[$@loop] == "")
+ goto L_EventClear;
+
+ $Illia_Win_Records$[$@loop] = "";
+
+ $@loop = $@loop + 1;
+ goto L_IlliaLoop;
+
+L_EventClear:
+ $@loop = 0;
+
+ $CandyOpsComplete = 0;
+
+ $Easter_2010_Npc_State1 = 0;
+ $Easter_2010_Npc_State2 = 0;
+ $Easter_2010_Egg_Loc_State1 = 0;
+ $Easter_2010_Egg_Loc_State2 = 0;
+ $Easter_2010_Egg_Loc_State3 = 0;
+ $Easter_2010_Egg_Loc_State4 = 0;
+ $Easter_2010_Egg_Loc_State5 = 0;
+
+ $hween10 = 0;
+ $hween10_tondel = 0;
+ $hween10_mmallow = 0;
+ $hween10_jelskul = 0;
+ $hween10_canpump = 0;
+
+ $Golbenez_Inn_Cost = 0;
+
+ $hween16 = 0;
+ $hween16_tondel = 0;
+ $hween16_mmallow = 0;
+ $hween16_jelskul = 0;
+ $hween16_canpump = 0;
+
+ $state = 0;
+ return;
+}
+
+function script mapexit {
+ debugmes "TRYING TO MAPEXIT IS DEPRECATED";
+ return;
+}
+
+function script npcaction {
+ debugmes "Deprecated unitaction (did you mean npcsit; or whatever?)";
+ return;
+}
+
+function script gmlog {
+ logmes(getarg(0), LOGMES_ATCOMMAND);
+ return;
+}
+
+function script getx {
+ getmapxy(.@m$, .@x, .@y, 0);
+ return .@x;
+}
+
+function script gety {
+ getmapxy(.@m$, .@x, .@y, 0);
+ return .@y;
+}
+
+function script getnpcx {
+ return .x;
+}
+
+function script getnpcy {
+ return .y;
+}
+
+function script title {
+ setnpcdialogtitle getarg(0);
+ return;
+}
+
+function script camera {
+ if (getarg(0, "") != "")
+ setcamnpc getarg(0);
+ else
+ restorecam;
+ return;
+}
+
+function script mapmask {
+ setmapmask getmapname(), getarg(0);
+ return;
+}
+
+function script getmask {
+ return getmapmask(getmapname());
+}
+
+// isin( map, x1, y1, {[x2, y2][radius]} )
+function script isin {
+ if (getmapxy(.@mapName$, .@xpos, .@ypos, 0) != 0)
+ return false;
+ if (.@mapName$ != getarg(0))
+ return false;
+
+ if (getarg(4,-1) < 0) {
+ // Radius Based
+ if (.@xpos >= getarg(1)-getarg(3) && .@xpos <= getarg(1)+getarg(3) && .@ypos >= getarg(2)-getarg(3) && .@ypos <= getarg(2)+getarg(3))
+ return true;
+ } else {
+ // Coordinate based
+ if (.@xpos >= getarg(1) && .@xpos <= getarg(3) && .@ypos >= getarg(2) && .@ypos <= getarg(4))
+ return true;
+ }
+ return false;
+}
+
+// isat( map, x, y )
+function script isat {
+ return isin(getarg(0), getarg(1), getarg(2), 0);
+}
+
+function script mesn {
+ if (getargcount() > 0) {
+ .@s$ = "[" + getarg(0) + "]";
+ } else {
+ .@s$ = "[" + strnpcinfo(1) + "]";
+ }
+ mes .@s$;
+ return;
+}
+
+// maptimer("<map>", <tick>, "<npc>::<event>")
+function script maptimer {
+ .@c = getunits(BL_PC, .@players, false, getarg(0));
+ for (.@i = 0; .@i < .@c; .@i++) {
+ addtimer(getarg(1), getarg(2), .@players[.@i]);
+ }
+ return .@i;
+}
+
+// areatimer("<map>", <x1>, <y1>, <x2>, <y2>, <tick>, "<npc>::<event>")
+function script areatimer {
+ .@c = getunits(BL_PC, .@players, false, getarg(0), getarg(1), getarg(2), getarg(3), getarg(4));
+ for (.@i = 0; .@i < .@c; .@i++) {
+ addtimer(getarg(5), getarg(6), .@players[.@i]);
+ }
+ return .@i;
+}
+