summaryrefslogtreecommitdiff
path: root/npc/functions
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2021-04-17 16:07:04 -0300
committerJesusaves <cpntb1@ymail.com>2021-04-17 16:07:04 -0300
commit14f7af0b7b3839f0e1b35c31bf3bd17e70cf366f (patch)
treed9a501ffc748bca4cf19a56942d91bdd82d5eeb5 /npc/functions
parentbd9d7c6142986a30f6fcd355efe22704f5bf4be4 (diff)
downloadserverdata-14f7af0b7b3839f0e1b35c31bf3bd17e70cf366f.tar.gz
serverdata-14f7af0b7b3839f0e1b35c31bf3bd17e70cf366f.tar.bz2
serverdata-14f7af0b7b3839f0e1b35c31bf3bd17e70cf366f.tar.xz
serverdata-14f7af0b7b3839f0e1b35c31bf3bd17e70cf366f.zip
Refactor Sagatha functions. Add shear spell (reusing ML code)
Diffstat (limited to 'npc/functions')
-rw-r--r--npc/functions/global_event_handler.txt2
-rw-r--r--npc/functions/mob_points.txt72
-rw-r--r--npc/functions/quests.txt37
3 files changed, 66 insertions, 45 deletions
diff --git a/npc/functions/global_event_handler.txt b/npc/functions/global_event_handler.txt
index e832623f..d0014b87 100644
--- a/npc/functions/global_event_handler.txt
+++ b/npc/functions/global_event_handler.txt
@@ -13,7 +13,7 @@ OnPCLoginEvent:
end;
OnPCKillEvent:
- callfunc "elanore_decrease_exp"; // decrease heal exp for doing bad things
+ elanore_decrease_exp(); // decrease heal exp for doing bad things
end;
OnNPCKillEvent:
diff --git a/npc/functions/mob_points.txt b/npc/functions/mob_points.txt
index 2a39fbee..a9f6f1d4 100644
--- a/npc/functions/mob_points.txt
+++ b/npc/functions/mob_points.txt
@@ -48,50 +48,34 @@ function script MobPoints {
callfunc("AddValonCntMask");
- if ((@mobId == 1003) || (@mobId == 1004) || (@mobId == 1009) || (@mobId == 1057)
- || (@mobId == 1104) || (@mobId == 1105) || (@mobId == 1106) || (@mobId == 1107))
- goto L_Good;
-
- // Attitude adjustment for the witch (can we refactor this to another function? Not sure about max. recursion depth)
-
- @value = 0;
- if (@mobId == 1018)
- @value = 3;
-
- if (@mobId == 1020)
- @value = 3;
- if (@mobId == 1027)
- @value = 3;
- if (@mobId == 1028)
- @value = 4;
- if (@mobId == 1038)
- @value = 2;
- if (@mobId == 1094)
- @value = 3;
- if (@mobId == 1112)
- @value = 3;
- if (@mobId == 1113)
- @value = 3;
-
- if (@value == 0)
- goto L_Celestia;
-
- callfunc "QuestSagathaAnnoy";
- goto L_Celestia;
-
-L_Good:
- @value = 1;
- callfunc "QuestSagathaHappy";
- goto L_Celestia;
-
-L_Celestia:
- if (QL_CELESTIA < 5 || QL_CELESTIA >= 205 || @mobId != 1072) goto L_Return;
- QL_CELESTIA = QL_CELESTIA + 1;
- if (QL_CELESTIA == 205)
- message strcharinfo(0), "Yeti : ##3This should be enough yetis killed to please Celestia.";
- goto L_Return;
+ // Attitude adjustment for Sagatha
+ switch (@mobId) {
+ case 1018:
+ case 1020:
+ case 1027:
+ case 1094:
+ case 1112:
+ case 1113:
+ QuestSagathaAnnoy(3); break;
+ case 1028:
+ QuestSagathaAnnoy(4); break;
+ case 1038:
+ QuestSagathaAnnoy(2); break;
+ case 1003:
+ case 1004:
+ case 1009:
+ case 1057:
+ case 1104:
+ case 1105:
+ case 1106:
+ case 1107:
+ QuestSagathaHappy(1); break;
+ }
-L_Return:
- @value = 0;
+ if (QL_CELESTIA >= 5 && QL_CELESTIA < 205 && @mobId == Yeti) {
+ QL_CELESTIA = QL_CELESTIA + 1;
+ if (QL_CELESTIA == 205)
+ message strcharinfo(0), "Yeti : ##3This should be enough yetis killed to please Celestia.";
+ }
return;
}
diff --git a/npc/functions/quests.txt b/npc/functions/quests.txt
new file mode 100644
index 00000000..3f0c40ef
--- /dev/null
+++ b/npc/functions/quests.txt
@@ -0,0 +1,37 @@
+// The Mana World quest functions script
+
+function script QuestSagathaHappy {
+ .@value = getarg(0, @value);
+ .@unhappiness = (QUEST_MAGIC & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT;
+ if (.@unhappiness < .@value)
+ .@unhappiness = 0;
+
+ .@unhappiness = .@unhappiness - .@value;
+
+ QUEST_MAGIC = (QUEST_MAGIC & ~NIBBLE_3_MASK) | (.@unhappiness << NIBBLE_3_SHIFT);
+ return;
+}
+
+function script QuestSagathaAnnoy {
+ .@value = getarg(0, @value);
+ .@unhappiness = (QUEST_MAGIC & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT;
+ if ((.@unhappiness + .@value) > 15)
+ .@unhappiness = 15;
+
+ .@unhappiness = .@unhappiness + .@value;
+ QUEST_MAGIC = (QUEST_MAGIC & ~NIBBLE_3_MASK) | (.@unhappiness << NIBBLE_3_SHIFT);
+ return;
+}
+
+function script elanore_decrease_exp {
+ .@heal_exp = getq2(MagicQuest_Healing);
+
+ if (.@heal_exp < 8)
+ .@heal_exp = 0;
+ else
+ .@heal_exp -= 8;
+
+ setq2(MagicQuest_Healing, .@heal_exp);
+ return;
+}
+