diff options
author | HoraK-FDF <horak-fdf@web.de> | 2023-11-11 02:02:04 +0100 |
---|---|---|
committer | HoraK-FDF <horak-fdf@web.de> | 2023-11-11 02:02:04 +0100 |
commit | 791888e831c6fe0a1722289a1f625cd1e8560285 (patch) | |
tree | 5354395ab6ba998ecc3d4c2825e6c1eea52e52ae | |
parent | 773fc1befb1fe510393ebb423d06efd9c489e641 (diff) | |
download | serverdata-791888e831c6fe0a1722289a1f625cd1e8560285.tar.gz serverdata-791888e831c6fe0a1722289a1f625cd1e8560285.tar.bz2 serverdata-791888e831c6fe0a1722289a1f625cd1e8560285.tar.xz serverdata-791888e831c6fe0a1722289a1f625cd1e8560285.zip |
fluffy event functions
-rw-r--r-- | world/map/npc/commands/_import.txt | 2 | ||||
-rw-r--r-- | world/map/npc/commands/dailypoints.txt | 11 | ||||
-rw-r--r-- | world/map/npc/commands/mobpoints.txt | 11 | ||||
-rw-r--r-- | world/map/npc/functions/bitwise.txt | 146 |
4 files changed, 170 insertions, 0 deletions
diff --git a/world/map/npc/commands/_import.txt b/world/map/npc/commands/_import.txt index e9e64b95..6e2f0cc2 100644 --- a/world/map/npc/commands/_import.txt +++ b/world/map/npc/commands/_import.txt @@ -20,3 +20,5 @@ npc: npc/commands/bosspoints.txt npc: npc/commands/deaths.txt npc: npc/commands/divorce.txt npc: npc/commands/exp.txt +npc: npc/commands/dailypoints.txt +npc: npc/commands/mobpoints.txt diff --git a/world/map/npc/commands/dailypoints.txt b/world/map/npc/commands/dailypoints.txt new file mode 100644 index 00000000..5d5234fc --- /dev/null +++ b/world/map/npc/commands/dailypoints.txt @@ -0,0 +1,11 @@ +-|script|@dailypoints|32767 +{ + message strcharinfo(0), "Daily Points : You currently have " + (DailyQuestPoints + DailyQuestBonus) + " Daily Points."; + close; + +OnInit: + // TODO: allow event managers to give and take daily points + registercmd chr(ATCMD_SYMBOL) + "dailypoints", strnpcinfo(0); + registercmd chr(ATCMD_SYMBOL) + "dailypoint", strnpcinfo(0); // for typos + end; +} diff --git a/world/map/npc/commands/mobpoints.txt b/world/map/npc/commands/mobpoints.txt new file mode 100644 index 00000000..10dc4b5b --- /dev/null +++ b/world/map/npc/commands/mobpoints.txt @@ -0,0 +1,11 @@ +-|script|@mobpoints|32767 +{ + message strcharinfo(0), "Monster Points : You currently have " + Mobpt + " Monster Points."; + close; + +OnInit: + // TODO: allow event managers to give and take monster points + registercmd chr(ATCMD_SYMBOL) + "mobpoints", strnpcinfo(0); + registercmd chr(ATCMD_SYMBOL) + "mobpoint", strnpcinfo(0); // for typos + end; +} 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; +} + |