summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLed Mitz <smoothshifter@tuta.io>2023-07-10 16:51:32 +0000
committerLed Mitz <smoothshifter@tuta.io>2023-07-10 16:51:32 +0000
commitd8eb983f077617326bf86900a9f249ab9171d4dd (patch)
treeaefbb07507d8541dfc61e29398aaf2f022d02ac3
parent759d091d696aa0e67645405e5017ca2fed709abf (diff)
parent0a6997d3c17a812ac966782ef5d6b46ebd2ea889 (diff)
downloadserverdata-d8eb983f077617326bf86900a9f249ab9171d4dd.tar.gz
serverdata-d8eb983f077617326bf86900a9f249ab9171d4dd.tar.bz2
serverdata-d8eb983f077617326bf86900a9f249ab9171d4dd.tar.xz
serverdata-d8eb983f077617326bf86900a9f249ab9171d4dd.zip
Merge branch 'jesusalva/vault' into 'master'
Some missing functions See merge request legacy/serverdata!667
-rw-r--r--world/map/db/const.txt16
-rw-r--r--world/map/npc/013-2/notes.txt9
-rw-r--r--world/map/npc/functions/bitwise.txt146
-rw-r--r--world/map/npc/functions/vault.txt73
-rw-r--r--world/map/npc/scripts.conf3
5 files changed, 244 insertions, 3 deletions
diff --git a/world/map/db/const.txt b/world/map/db/const.txt
index 6490a6f5..0612fedc 100644
--- a/world/map/db/const.txt
+++ b/world/map/db/const.txt
@@ -510,3 +510,19 @@ API_VAULT 607
API_SENDMAIL 501
//API_DISCORD 301
//API_PINCODE 302
+
+// Mirror Lake Constants
+// World Identifiers
+WORLD_ID 3
+MLP_CR 1
+MLP_ML 2
+
+// Quest Constants
+MLP_ML_NARD 1
+MLP_ML_JAK1 2
+MLP_CR_DEBUT 4
+
+// Local Quest Constants
+MLP_TMW_CELESTIA 1
+MLP_TMW_YETIKING 2
+
diff --git a/world/map/npc/013-2/notes.txt b/world/map/npc/013-2/notes.txt
index 99de40df..3a0215b9 100644
--- a/world/map/npc/013-2/notes.txt
+++ b/world/map/npc/013-2/notes.txt
@@ -16,6 +16,15 @@
013-2,38,20,0|script|Saying#wiz|400
{
mes "The early bird catcheth the worm.";
+ if (##VAULT <= 0) goto L_Close;
+ mes "##9There is something weird on this saying, but you can't quite put your finger on it.##0";
+ if (GM < G_SYSOP) goto L_Close;
+ next;
+ //close2;
+ void call("MirrorLakeSendTo", MLP_ML);
+ close;
+
+L_Close:
close;
}
diff --git a/world/map/npc/functions/bitwise.txt b/world/map/npc/functions/bitwise.txt
new file mode 100644
index 00000000..fe851f15
--- /dev/null
+++ b/world/map/npc/functions/bitwise.txt
@@ -0,0 +1,146 @@
+// ALL functions here are call()-only
+
+// A Byte can go up to 255. There are 4 bytes. The fourth can go up to 127.
+// get_byte(VAR, BYTEID)
+function|script|get_byte
+{
+ set .@v, getarg(0);
+ set .@id, getarg(1);
+ if (.@id == 0) goto L_Byte0;
+ if (.@id == 1) goto L_Byte1;
+ if (.@id == 2) goto L_Byte2;
+ if (.@id == 3) goto L_Byte3;
+ debugmes "get_byte invalid call";
+ return -1;
+
+L_Byte0:
+ return (.@v & BYTE_0_MASK) >> BYTE_0_SHIFT;
+
+L_Byte1:
+ return (.@v & BYTE_1_MASK) >> BYTE_1_SHIFT;
+
+L_Byte2:
+ return (.@v & BYTE_2_MASK) >> BYTE_2_SHIFT;
+
+L_Byte3:
+ return (.@v & BYTE_3_MASK) >> BYTE_3_SHIFT;
+}
+
+// A Nibble can go up to 15. There are 7 nibbles..
+// get_nibble(VAR, BYTEID)
+function|script|get_nibble
+{
+ set .@v, getarg(0);
+ set .@id, getarg(1);
+ if (.@id == 0) goto L_Nibble0;
+ if (.@id == 1) goto L_Nibble1;
+ if (.@id == 2) goto L_Nibble2;
+ if (.@id == 3) goto L_Nibble3;
+ if (.@id == 4) goto L_Nibble4;
+ if (.@id == 5) goto L_Nibble5;
+ if (.@id == 6) goto L_Nibble6;
+ debugmes "get_byte invalid call";
+ return -1;
+
+L_Nibble0:
+ return (.@v & NIBBLE_0_MASK) >> NIBBLE_0_SHIFT;
+
+L_Nibble1:
+ return (.@v & NIBBLE_1_MASK) >> NIBBLE_1_SHIFT;
+
+L_Nibble2:
+ return (.@v & NIBBLE_2_MASK) >> NIBBLE_2_SHIFT;
+
+L_Nibble3:
+ return (.@v & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT;
+
+L_Nibble4:
+ return (.@v & NIBBLE_4_MASK) >> NIBBLE_4_SHIFT;
+
+L_Nibble5:
+ return (.@v & NIBBLE_5_MASK) >> NIBBLE_5_SHIFT;
+
+L_Nibble6:
+ return (.@v & NIBBLE_6_MASK) >> NIBBLE_6_SHIFT;
+
+// In theory, there's a "nibble 7" but it is broken so it is not available
+}
+
+/////////////////////////////////////////////////////////////////////////////////
+// A Byte can go up to 255. There are 4 bytes. The fourth can go up to 127.
+// set_byte(VAR, BYTEID, VALUE)
+function|script|set_byte
+{
+ set .@v, getarg(0);
+ set .@id, getarg(1);
+ if (.@id == 0) goto L_Byte0;
+ if (.@id == 1) goto L_Byte1;
+ if (.@id == 2) goto L_Byte2;
+ if (.@id == 3) goto L_Byte3;
+ debugmes "get_byte invalid call";
+ return -1;
+
+L_Byte0:
+ set getarg(0), ((.@v & ~(BYTE_0_MASK)) | (getarg(2) << BYTE_0_SHIFT));
+ return;
+
+L_Byte1:
+ set getarg(0), ((.@v & ~(BYTE_1_MASK)) | (getarg(2) << BYTE_1_SHIFT));
+ return;
+
+L_Byte2:
+ set getarg(0), ((.@v & ~(BYTE_2_MASK)) | (getarg(2) << BYTE_2_SHIFT));
+ return;
+
+L_Byte3:
+ set getarg(0), ((.@v & ~(BYTE_3_MASK)) | (getarg(2) << BYTE_3_SHIFT));
+ return;
+}
+
+
+
+// A Nibble can go up to 15. There are 7 nibbles..
+// get_nibble(VAR, NIBBLEID, VALUE)
+function|script|set_nibble
+{
+ set .@v, getarg(0);
+ set .@id, getarg(1);
+ if (.@id == 0) goto L_Nibble0;
+ if (.@id == 1) goto L_Nibble1;
+ if (.@id == 2) goto L_Nibble2;
+ if (.@id == 3) goto L_Nibble3;
+ if (.@id == 4) goto L_Nibble4;
+ if (.@id == 5) goto L_Nibble5;
+ if (.@id == 6) goto L_Nibble6;
+ debugmes "get_byte invalid call";
+ return -1;
+
+L_Nibble0:
+ set getarg(0), ((.@v & ~(NIBBLE_0_MASK)) | (getarg(2) << NIBBLE_0_SHIFT));
+ return;
+
+L_Nibble1:
+ set getarg(0), ((.@v & ~(NIBBLE_1_MASK)) | (getarg(2) << NIBBLE_1_SHIFT));
+ return;
+
+L_Nibble2:
+ set getarg(0), ((.@v & ~(NIBBLE_2_MASK)) | (getarg(2) << NIBBLE_2_SHIFT));
+ return;
+
+L_Nibble3:
+ set getarg(0), ((.@v & ~(NIBBLE_3_MASK)) | (getarg(2) << NIBBLE_3_SHIFT));
+ return;
+
+L_Nibble4:
+ set getarg(0), ((.@v & ~(NIBBLE_4_MASK)) | (getarg(2) << NIBBLE_4_SHIFT));
+ return;
+
+L_Nibble5:
+ set getarg(0), ((.@v & ~(NIBBLE_5_MASK)) | (getarg(2) << NIBBLE_5_SHIFT));
+ return;
+
+L_Nibble6:
+ set getarg(0), ((.@v & ~(NIBBLE_6_MASK)) | (getarg(2) << NIBBLE_6_SHIFT));
+ return;
+}
+
diff --git a/world/map/npc/functions/vault.txt b/world/map/npc/functions/vault.txt
index a0da16b1..f2c51387 100644
--- a/world/map/npc/functions/vault.txt
+++ b/world/map/npc/functions/vault.txt
@@ -6,12 +6,18 @@
function|script|VaultLogin
{
if (##VAULT < 1) goto L_Return;
- // TODO: Or #VAULT ? Which of the two is set?
+ // Imports & Vitals
callsub S_Exp;
callsub S_Gold;
callsub S_Preset;
+ // Quest Handlers
+ callsub S_Quest_CR1;
+
+ // Mirror lake
+ callsub S_MirrorLake;
+
// Clean up
set @last_preset, 0;
return; // go back to global handler
@@ -43,6 +49,7 @@ S_Preset:
// TODO: Give more ammo, iron powder, sulphur powder, etc. instead of equips
// Give also some bug legs and maggot slime if applicable?
/* Handle weapons */
+ /*
if (##PRESET >= 1 && @last_preset < 1)
getitem "SharpKnife",1;
if (##PRESET >= 2 && @last_preset < 2)
@@ -83,14 +90,55 @@ S_Preset:
getitem "IronPowder", 150;
if (##PRESET >= 19 && @last_preset < 19)
getitem "TerraniteArrow",250;
-
+ */
set ##PRESET, 0;
return;
+
+////////////////////////////////
+S_Quest_CR1:
+ if (!(##01_CRQUEST & 1)) goto S_Return;
+ if (##03_TMWWORLD & MLP_CR_DEBUT) goto S_Return;
+ // Check if you can receive the rewards
+ getinventorylist;
+ if (@inventorylist_count >= 96) goto S_Return;
+ // Mark quest as done and issue rewards
+ set BOSS_POINTS, BOSS_POINTS + 871;
+ set ##03_TMWWORLD, ##03_TMWWORLD | MLP_CR_DEBUT;
+ getitem WhiteCake, 1;
+ getitem ChocolateCake, 1;
+ getitem OrangeCake, 1;
+ getitem AppleCake, 1;
+ message strcharinfo(0), "Mirror Lake : You gained 871 boss points.";
+ return;
+
+////////////////////////////////
+S_MirrorLake:
+ // Wipe any existing TMWA internal mirror lake information
+ set ##VAULT_GOTO, 0;
+ set ##VAULT_MLTO, 0;
+ // TODO: Put the Mirror Lake Portal into the shipwreck? (see portal #2)
+ set .@gto, call("get_byte", ##00_INFO, 3);
+ set .@mlp, call("get_nibble", ##00_INFO, 5);
+ // If we're moving from Mirror Lake to TMW
+ if (.@gto != WORLD_ID) goto S_MirrorFix;
+ debugmes "Vault User "+##VAULT+" moved to lake "+.@mlp;
+ if (.@mlp == 1) warp "013-2", 37, 23; // Hurnscald Mirror Lake
+ if (.@mlp == 2) warp "002-1", 30, 58; // Tulimshar Mirror Lake
+ // Unset the target lake/world
+ void call("set_byte", ##00_INFO, 3, 0);
+ void call("set_nibble", ##00_INFO, 5, 0);
+ return;
+
+// We've moved to the wrong world, so preserve it.
+S_MirrorFix:
+ set ##VAULT_GOTO, call("get_byte", ##00_INFO, 3);
+ set ##VAULT_MLTO, call("get_nibble", ##00_INFO, 5);
+ return;
}
// Remember: ##VAULT_EXP, ##VAULT_GOTO, ##VAULT_MLTO for Mirror Lake Protocol
-// However, without kick(7), it is not really worth anything
+// However, without kick(7), it is not really worth anything - so I presumed 7
// Remember: Quote symbols are illegal, simple or double, except for parameter
// To reset the database:
// cleararray $EXPORT_DATA$[0], "", 254;
@@ -161,3 +209,22 @@ L_Return:
return;
}
+// MirrorLakeSendTo(World)
+function|script|MirrorLakeSendTo
+{
+ if (##VAULT < 1) goto L_Return;
+ set ##VAULT_GOTO, getarg(0);
+ // This is TMWA - so it'll always use Lake #0 for performance reasons
+ set $@API_PROTOCOL, API_VAULT;
+ set $@API_DATA$, "'UID': "+##VAULT+", 'GID': "+getcharid(3);
+ callfunc "FlushAPI";
+ message strcharinfo(0), "Darkness fills your vision...";
+ // TODO: Misc effects
+ // TODO: Sleep for 10~15 seconds (for mapreg)
+ // TODO: Disconnect user
+ return;
+
+L_Return:
+ return;
+}
+
diff --git a/world/map/npc/scripts.conf b/world/map/npc/scripts.conf
index c17ae367..10e9448d 100644
--- a/world/map/npc/scripts.conf
+++ b/world/map/npc/scripts.conf
@@ -1,5 +1,8 @@
// This is the main script import file
+// Core Functions
+npc: npc/functions/bitwise.txt
+
// NPC Functions
npc: npc/functions/banker.txt
npc: npc/functions/barber.txt