summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFate <fate-tmw@googlemail.com>2009-01-10 04:19:52 -0700
committerFate <fate-tmw@googlemail.com>2009-01-10 04:19:52 -0700
commit2dd4918c51930301faa4eea5f0f88e9fc08162a8 (patch)
tree77ea63d41cdbb31f9fb99414081a76400dca4941
parentabc02aac744134239b1fb14b8cee0c8adaaf7ebd (diff)
downloadserverdata-2dd4918c51930301faa4eea5f0f88e9fc08162a8.tar.gz
serverdata-2dd4918c51930301faa4eea5f0f88e9fc08162a8.tar.bz2
serverdata-2dd4918c51930301faa4eea5f0f88e9fc08162a8.tar.xz
serverdata-2dd4918c51930301faa4eea5f0f88e9fc08162a8.zip
Added debug magic, properly linked chat helper functions
-rw-r--r--conf/magic.conf.template99
-rw-r--r--npc/001-1_Tulimshar/bard.txt37
-rw-r--r--npc/scripts.conf1
3 files changed, 118 insertions, 19 deletions
diff --git a/conf/magic.conf.template b/conf/magic.conf.template
index 0a994eab..5b86e021 100644
--- a/conf/magic.conf.template
+++ b/conf/magic.conf.template
@@ -51,7 +51,7 @@ CONST SCRIPT_LASTSPELL_MASK = 0xff
CONST SCRIPT_LASTSPELL_SHIFT = 16
CONST SCRIPT_HEALSPELL_MASK = 0xff
CONST SCRIPT_HEALSPELL_SHIFT = 24
-CONST DEBUG = 0
+CONST DEBUG = 1
# Default sfx on caster
PROCEDURE default_effect() =
@@ -814,6 +814,101 @@ SPELL teleport (destination : STRING) : "#A40" =
sfx(location(caster), SFX_TELEPORT, 100);
#--------------------------------------------------------------------------------
+# Debug keywords
+#--------------------------------------------------------------------------------
+
+SPELL debug : "debug" =
+ REQUIRE DEBUG
+ => EFFECT message (caster, "FLAGS: "
+ + "drank=" + ((script_int(caster, "MAGIC_FLAGS") & 1) > 0) + ", "
+ + "Kmseed=" + ((script_int(caster, "MAGIC_FLAGS") & 2) > 0) + ", "
+ + "touched-mseed=" + ((script_int(caster, "MAGIC_FLAGS") & 4) > 0) + ", "
+ + "mseed-max=" + ((script_int(caster, "MAGIC_FLAGS") & 8) > 0) + ", "
+ + "Kauldsbel=" + ((script_int(caster, "MAGIC_FLAGS") & 16) > 0) + ", "
+ + "Kwyara=" + ((script_int(caster, "MAGIC_FLAGS") & 32) > 0) + ", "
+ + "Ksagatha=" + ((script_int(caster, "MAGIC_FLAGS") & 64) > 0) + ", "
+ + "Kmpotion=" + ((script_int(caster, "MAGIC_FLAGS") & 128) > 0) + ", "
+ + "mseed-rumour=" + ((script_int(caster, "MAGIC_FLAGS") & 256) > 0) + ", "
+ + "Kcuttree=" + ((script_int(caster, "MAGIC_FLAGS") & 512) > 0) + ", "
+ + "cut=" + ((script_int(caster, "MAGIC_FLAGS") & 1024) > 0) + ", "
+ + "Kdruidtree=" + ((script_int(caster, "MAGIC_FLAGS") & 2048) > 0) + ", "
+ + "Kimp=" + ((script_int(caster, "MAGIC_FLAGS") & 4096) > 0) + ", "
+ + "Koldwiz=" + ((script_int(caster, "MAGIC_FLAGS") & 8192) > 0));
+ message (caster, "EXP: " + (script_int(caster, "MAGIC_EXPERIENCE") & 0xffff)
+ + ", lastspell=" + ((script_int(caster, "MAGIC_EXPERIENCE") >> 16) & 0xff)
+ + ", healexp=" + ((script_int(caster, "MAGIC_EXPERIENCE") >> 24) & 0xff));
+ message (caster, "STATUS: "
+ + "auldsbel:" + (script_int(caster, "QUEST_MAGIC") & 0x1f) + "," + (script_int(caster, "QUEST_MAGIC") >> 5) + ", "
+ + "dt/mb:" + ((script_int(caster, "QUEST_MAGIC") >> 8) & 0xf) + ", "
+ + "s-unhappy:" + ((script_int(caster, "QUEST_MAGIC") >> 12) & 0xf) + ", "
+ + "sagatha:" + ((script_int(caster, "QUEST_MAGIC") >> 16) & 0xff) + ", "
+ + "swords:" + ((script_int(caster, "QUEST_MAGIC") >> 24) & 0xff) + ", "
+ + "imp:" + ((script_int(caster, "QUEST_MAGIC2") >> 0) & 0xf) + ", "
+ + "elanore:" + ((script_int(caster, "QUEST_MAGIC2") >> 4) & 0xf) + ", "
+ + "wyara:" + ((script_int(caster, "QUEST_MAGIC2") >> 8) & 0xf));
+
+PROCEDURE debug_xmod(name, mask, shift, gain) =
+ value = ((script_int(caster, name) >> shift) & mask) + gain;
+ IF (value < 0)
+ THEN value = 0;
+ IF (value > mask)
+ THEN value = mask;
+ CALL set_var(name, mask, shift, value);
+
+PROCEDURE debug_mod(name, delta) =
+ IF (name = "mexp") THEN CALL debug_xmod("MAGIC_EXP", 0xffff, 0, delta);
+ ELSE IF (name = "lastspell") THEN CALL debug_xmod("MAGIC_EXP", 0xff, 16, delta);
+ ELSE IF (name = "lifeexp") THEN CALL debug_xmod("MAGIC_EXP", 0xff, 24, delta);
+ ELSE IF (name = "F:drank") THEN CALL debug_xmod("MAGIC_FLAGS", 0x1, 0, delta);
+ ELSE IF (name = "F:Kmseed") THEN CALL debug_xmod("MAGIC_FLAGS", 0x1, 1, delta);
+ ELSE IF (name = "F:touched-mseed") THEN CALL debug_xmod("MAGIC_FLAGS", 0x1, 2, delta);
+ ELSE IF (name = "F:mseed-max") THEN CALL debug_xmod("MAGIC_FLAGS", 0x1, 3, delta);
+ ELSE IF (name = "F:Kauldsbel") THEN CALL debug_xmod("MAGIC_FLAGS", 0x1, 4, delta);
+ ELSE IF (name = "F:Kwyara") THEN CALL debug_xmod("MAGIC_FLAGS", 0x1, 5, delta);
+ ELSE IF (name = "F:Ksagatha") THEN CALL debug_xmod("MAGIC_FLAGS", 0x1, 6, delta);
+ ELSE IF (name = "F:Kmpotion") THEN CALL debug_xmod("MAGIC_FLAGS", 0x1, 7, delta);
+ ELSE IF (name = "F:mseed-rumour") THEN CALL debug_xmod("MAGIC_FLAGS", 0x1, 8, delta);
+ ELSE IF (name = "F:Kcuttree") THEN CALL debug_xmod("MAGIC_FLAGS", 0x1, 9, delta);
+ ELSE IF (name = "F:cut") THEN CALL debug_xmod("MAGIC_FLAGS", 0x1, 10, delta);
+ ELSE IF (name = "F:Kdruidtree") THEN CALL debug_xmod("MAGIC_FLAGS", 0x1, 11, delta);
+ ELSE IF (name = "F:Kimp") THEN CALL debug_xmod("MAGIC_FLAGS", 0x1, 12, delta);
+ ELSE IF (name = "F:oldwiz") THEN CALL debug_xmod("MAGIC_FLAGS", 0x1, 13, delta);
+ ELSE IF (name = "auldsbel") THEN CALL debug_xmod("QUEST_MAGIC", 0x1f, 0, delta);
+ ELSE IF (name = "Qauldsbel") THEN CALL debug_xmod("QUEST_MAGIC", 0x7, 5, delta);
+ ELSE IF (name = "dt") THEN CALL debug_xmod("QUEST_MAGIC", 0x3, 10, delta);
+ ELSE IF (name = "mb") THEN CALL debug_xmod("QUEST_MAGIC", 0x3, 8, delta);
+ ELSE IF (name = "s-unhappy") THEN CALL debug_xmod("MAGIC_EXP", 0xff, 12, delta);
+ ELSE IF (name = "sagatha") THEN CALL debug_xmod("QUEST_MAGIC", 0xff, 16, delta);
+ ELSE IF (name = "swords") THEN CALL debug_xmod("QUEST_MAGIC", 0xff, 24, delta);
+ ELSE IF (name = "imp") THEN CALL debug_xmod("QUEST_MAGIC2", 0xf, 0, delta);
+ ELSE IF (name = "elanore") THEN CALL debug_xmod("QUEST_MAGIC2", 0xf, 4, delta);
+ ELSE IF (name = "wyara") THEN CALL debug_xmod("QUEST_MAGIC2", 0xf, 8, delta);
+ ELSE message(caster, "Unknown");
+
+SPELL debug-up1 (name : STRING) : "debug+1" =
+ REQUIRE DEBUG
+ => EFFECT CALL debug_mod(name, 1);
+
+SPELL debug-down1 (name : STRING) : "debug-1" =
+ REQUIRE DEBUG
+ => EFFECT CALL debug_mod(name, 0 - 1);
+
+SPELL debug-up16 (name : STRING) : "debug+16" =
+ REQUIRE DEBUG
+ => EFFECT CALL debug_mod(name, 16);
+
+SPELL debug-down16 (name : STRING) : "debug-16" =
+ REQUIRE DEBUG
+ => EFFECT CALL debug_mod(name, 0 - 16);
+
+SPELL debug-reset : "debug-reset" =
+ REQUIRE DEBUG
+ => EFFECT set_script_variable(caster, "QUEST_MAGIC", 0);
+ set_script_variable(caster, "QUEST_MAGIC2", 0);
+ set_script_variable(caster, "MAGIC_FLAGS", 0);
+ set_script_variable(caster, "MAGIC_EXP", 0);
+
+#--------------------------------------------------------------------------------
# Special-purpose quasispells
#--------------------------------------------------------------------------------
@@ -978,3 +1073,5 @@ TELEPORT-ANCHOR desert : "##02" = @("005-1.gat", 160, 64) @+ (5, 5);
TELEPORT-ANCHOR forest : "##03" = @("015-1.gat", 35, 35) @+ (40, 40);
TELEPORT-ANCHOR snakecave : "##04" = @("011-4.gat", 50, 75) @+ (3, 3);
TELEPORT-ANCHOR dimondscove : "##05" = @("010-2.gat", 23, 79) @+ (3, 3);
+
+
diff --git a/npc/001-1_Tulimshar/bard.txt b/npc/001-1_Tulimshar/bard.txt
index a740b1d5..9420d9fb 100644
--- a/npc/001-1_Tulimshar/bard.txt
+++ b/npc/001-1_Tulimshar/bard.txt
@@ -4,8 +4,8 @@
setarray @songs$, "\"There once was a bard, who had it hard, because a man in dark green, was very mean.\"",
"\"At Hurnscald inn, there was a person of fairest skin, declining wedding bands from quite a many hands.\"",
"\"As the Sun sets down in the forest's brown, she whom the fragrance holds counts her gold.\"";
- set @name, "Bill Ballshaker the Bard";
- mes "[" + @name + "]";
+ set @name$, "Bill Ballshaker the Bard";
+ mes "[" + @name$ + "]";
if (Sex)
mes "\"Greetings, traveler! Have you come to listen to my stories?\"";
if (!Sex)
@@ -20,17 +20,17 @@ L_Main:
close;
L_News:
- mes "[" + @name + "]";
+ mes "[" + @name$ + "]";
mes "\"News I have for you indeed, lest you have already overheard (for then it would no longer be news to you!)\"";
next;
- mes "[" + @name + "]";
+ mes "[" + @name$ + "]";
mes "\"Rumor has it that an ancient source of magic, a Mana Seed, has been sighted in the west, beyond the fair town of Hurnscald.\"";
next;
set MFLAG, MFLAG | MFLAG_MANASEED_RUMOUR;
- mes "[" + @name + "]";
+ mes "[" + @name$ + "]";
mes "\"Whence it came, nobody knows... but they say that sometimes such Mana Seeds may choose a powerful individual to impart some of its mystic power to!\"";
next;
- mes "[" + @name + "]";
+ mes "[" + @name$ + "]";
mes "\"I wonder who might be qualified?\"";
next;
goto L_Main;
@@ -48,64 +48,65 @@ L_Question:
if (@c == @QQ_AULDSBEL) goto L_Q_auldsbel;
if (@c == @QQ_OLDWIZ) goto L_Q_oldwiz;
- mes "[" + @name + "]";
+ mes "[" + @name$ + "]";
mes "\"Alas, I know very little about this matter.\"";
next;
goto L_Main;
L_Q_oldwiz:
- mes "[" + @name + "]";
+ mes "[" + @name$ + "]";
mes "\"The old wizard has been an old man for as long as I remember, living near the mountains in his magic hut-- a hut that is bigger on the inside, just like in the old tales of Gyer Filla the Wise....\"";
next;
- mes "[" + @name + "]";
+ mes "[" + @name$ + "]";
mes "\"I doubt that they are the same person, though. For one, I have never seen his hut fly. For another, Gyer never took apprentices.\"";
next;
goto L_Main;
L_Q_elanore:
- mes "[" + @name + "]";
+ mes "[" + @name$ + "]";
mes "\"Elanore is this town's healer. Rumor has it that she traveled far and wide when she was younger, to learn the deepest secrets of healing magic, after her brother caught a mysterious illness.\"";
next;
goto L_Main;
L_Q_manaseed:
- mes "[" + @name + "]";
+ mes "[" + @name$ + "]";
mes "\"The Mana Seed is said to be a source of great magic. Perhaps some witch or wizard might know more about it?\"";
next;
goto L_Main;
L_Q_wyara:
- mes "[" + @name + "]";
+ mes "[" + @name$ + "]";
mes "\"Wyara is not actually from Hurnscald. As a young witch, she decided to settle down there to help the people of Hurnscald. She is kind and gentle, except towards the Doctor, who seems to have little respect for her potions.\"";
next;
goto L_Main;
L_Q_sagatha:
- mes "[" + @name + "]";
+ mes "[" + @name$ + "]";
mes "\"Sagatha! Ah, such a wonderful and mysterious being; the center of many a tale...\"";
next;
- mes "[" + @name + "]";
+ mes "[" + @name$ + "]";
mes "\"Some say that she is the most powerful witch in all of Argaes. I don't know whether that is true, but I am quite certain that the is the most beautiful of all the witches! Alas, she will let no man touch her...\"";
mes "He sighs.";
next;
- mes "[" + @name + "]";
+ mes "[" + @name$ + "]";
mes "\"I met her only twice, back in my traveling days, but there are two pieces of advice I can give you:\"";
next;
- mes "[" + @name + "]";
+ mes "[" + @name$ + "]";
mes "\"First, she will suffer no fool easily, particularly no man.\"";
next;
- mes "[" + @name + "]";
+ mes "[" + @name$ + "]";
mes "\"Second, the creatures of the forest mean everything to her. Harm them, and you may find her an enemy-- and a powerful one at that...\"";
next;
goto L_Main;
L_Q_auldsbel:
- mes "[" + @name + "]";
+ mes "[" + @name$ + "]";
mes "\"Auldsbel is some wizard from further north, from what I have gathered. He bought a hut near Hurnscald some years back and often comes here to experiment on things, probably because he is not allowed to do these experiments where he comes from.\"";
next;
goto L_Main;
L_Song:
+ mes "[" + @name$ + "]";
set @id, rand(3);
mes @songs$[@id];
close;
diff --git a/npc/scripts.conf b/npc/scripts.conf
index 01cc93eb..ae6b9a83 100644
--- a/npc/scripts.conf
+++ b/npc/scripts.conf
@@ -9,6 +9,7 @@ npc: npc/functions/mob_points.txt
npc: npc/functions/process_equip.txt
npc: npc/functions/slot_machine.txt
npc: npc/functions/soul_menhir.txt
+npc: npc/functions/magic.txt
import: npc/_import.txt