summaryrefslogtreecommitdiff
path: root/npc
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2020-09-18 18:51:50 +0000
committerMicksha <ms-shaman@gmx.de>2020-09-18 18:51:50 +0000
commit58d39bb066ad21c051d72b4bee577819fdba0381 (patch)
treec19bf1ff552e8dbf7293468301fe152a5d585db3 /npc
parent01ae0e398d5b49db2aafb8af31acf81fb8a522c9 (diff)
downloadserverdata-58d39bb066ad21c051d72b4bee577819fdba0381.tar.gz
serverdata-58d39bb066ad21c051d72b4bee577819fdba0381.tar.bz2
serverdata-58d39bb066ad21c051d72b4bee577819fdba0381.tar.xz
serverdata-58d39bb066ad21c051d72b4bee577819fdba0381.zip
Refine prototype
+2 atk/matk per refine level +1 weapon exp per killed monster level Roughly based on Monster Point System + ML Refine System.
Diffstat (limited to 'npc')
-rw-r--r--npc/config/hairstyle_config.txt2
-rw-r--r--npc/functions/global_event_handler.txt1
-rw-r--r--npc/functions/refine.txt66
-rw-r--r--npc/scripts.conf1
4 files changed, 70 insertions, 0 deletions
diff --git a/npc/config/hairstyle_config.txt b/npc/config/hairstyle_config.txt
index de2d0467..6a43e4c8 100644
--- a/npc/config/hairstyle_config.txt
+++ b/npc/config/hairstyle_config.txt
@@ -20,5 +20,7 @@ OnInit:
"Fire red", "Light violet", "Purple plum", "Navy blue",
"Lagoon blue", "Twisted teal", "Spring Green", "Forest Green",
"Silver Grey", "Esperia Blue";
+
+ setarray $@REFEXP[0], 400, 900, 2250, 6500, 15000;
end;
}
diff --git a/npc/functions/global_event_handler.txt b/npc/functions/global_event_handler.txt
index bc469645..91cd12ef 100644
--- a/npc/functions/global_event_handler.txt
+++ b/npc/functions/global_event_handler.txt
@@ -51,6 +51,7 @@ OnNPCKillEvent:
$MONSTERS_KILLED+=1;
MONSTERS_KILLED+=1;
callfunc("EnoraKills");
+ callfunc("refineupdate");
if ($MONSTERS_KILLED % 1000000 == 0)
callfunc("GetBeanieCopter");
end;
diff --git a/npc/functions/refine.txt b/npc/functions/refine.txt
new file mode 100644
index 00000000..23df387c
--- /dev/null
+++ b/npc/functions/refine.txt
@@ -0,0 +1,66 @@
+// The Mana World Script
+// Author:
+// Jesusalva
+// Inspiration:
+// Pyndragon (LoF)
+// Scall (TMW-BR)
+// Saulc (ML)
+// Description:
+// Handles refinement
+
+// refineupdate( {killedrid} )
+function script refineupdate {
+ // Not armed? We do nothing
+ if (!getequipisequiped(EQI_HAND_R))
+ return;
+
+ // Set temporary variables
+ .@k=getarg(0, killedrid);
+ .@w=getequipid(EQI_HAND_R);
+ .@r=getequiprefinerycnt(EQI_HAND_R);
+
+
+ // Weapon cannot be refined
+ if (!getequipisenableref(EQI_HAND_R))
+ return;
+
+ // Register the weapon experience
+ weaponExp[.@w] = weaponExp[.@w] + getmonsterinfo(.@k, MOB_LV);
+
+ // Get exp needed to level up from global array
+ .@exp=$@REFEXP[.@r];
+
+ // Cannot level up
+ if (.@exp < 1)
+ return;
+
+ // Leveled up!
+ if (weaponExp[.@w] >= .@exp) {
+ weaponExp[.@w]-=.@exp;
+ weaponLvl[.@w] = weaponLvl[.@w] + 1;
+ successrefitem(EQI_HAND_R);
+ dispbottom l("Weapon level up!");
+ }
+ return;
+}
+
+// Resyncs weapon level
+function script refinesync {
+ // Not armed? We do nothing
+ if (!getequipisequiped(EQI_HAND_R))
+ return;
+
+ .@w=getequipid(EQI_HAND_R);
+ .@r=getequiprefinerycnt(EQI_HAND_R);
+ .@lv=weaponLvl[.@w];
+
+ if (.@r > .@lv) {
+ // Refine level overestimated
+ downrefitem(EQI_HAND_R, max(0, .@r - .@lv));
+ } else if (.@lv > .@r) {
+ // Refine level understimated
+ successrefitem(EQI_HAND_R, max(0, .@lv - .@r));
+ }
+ return;
+}
+
diff --git a/npc/scripts.conf b/npc/scripts.conf
index 601b5b8e..d3598405 100644
--- a/npc/scripts.conf
+++ b/npc/scripts.conf
@@ -49,6 +49,7 @@
"npc/functions/generic-text.txt",
"npc/functions/asklanguage.txt",
"npc/functions/game-rules.txt",
+"npc/functions/refine.txt",
"npc/functions/riddle.txt",
"npc/functions/bank.txt",
"npc/functions/confused-tree-dict.txt",