summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2020-06-17 05:20:35 -0300
committerJesusaves <cpntb1@ymail.com>2020-06-17 05:20:35 -0300
commit762d57158cc464ec5ba0bde6b67b0d260ec1e4b2 (patch)
treeeea3e46cc65db433b2b0a238ffc25992fdf0d0ab
parent4e242e64460a5548b77d512f317a8cd66967a95f (diff)
downloadserverdata-762d57158cc464ec5ba0bde6b67b0d260ec1e4b2.tar.gz
serverdata-762d57158cc464ec5ba0bde6b67b0d260ec1e4b2.tar.bz2
serverdata-762d57158cc464ec5ba0bde6b67b0d260ec1e4b2.tar.xz
serverdata-762d57158cc464ec5ba0bde6b67b0d260ec1e4b2.zip
This only creates the crafting workbench function
And allows it to be based with an override
-rw-r--r--db/constants.conf5
-rw-r--r--npc/functions/crafting.txt72
-rw-r--r--npc/scripts.conf1
3 files changed, 78 insertions, 0 deletions
diff --git a/db/constants.conf b/db/constants.conf
index 59dce74b..4ade0226 100644
--- a/db/constants.conf
+++ b/db/constants.conf
@@ -4187,6 +4187,11 @@ constants_db: {
RUSTYPICK_INN: 2
comment__: "CRAFT enum"
+ CRAFT_COOKING: 4
+ CRAFT_ALCHEMY: 8
+ CRAFT_EQUIPMENT: 16
+
+ // May be changed later
CRAFT_SANDWICH: 4
comment__: "Being actions"
diff --git a/npc/functions/crafting.txt b/npc/functions/crafting.txt
new file mode 100644
index 00000000..3d99d72d
--- /dev/null
+++ b/npc/functions/crafting.txt
@@ -0,0 +1,72 @@
+// Moubootaur Legends Script
+// Author:
+// Jesusalva
+// Description:
+// Smith System (Unified)
+// Notes:
+// Modified for The Mana World: rEvolt
+//
+// This one is more crazy. Cannot be equipping target craft.
+// After successful craft, we use CraftDB return code to equip() the
+// new item and apply a random option bonus based on crafter skills
+// eg. setequipoption(EQI_HAND_R, 1, VAR_STRAMOUNT, 5)
+
+// Usage: SmithSystem ({checks=True})
+// Returns true on success, false on failure
+function script SmithSystem {
+ mesc l("WARNING: Strange bugs may happen if you attempt to craft an item you already have on inventory!"), 1;
+ setskin "craft4";
+ .@var$ = requestcraft(4);
+ .@craft = initcraft(.@var$);
+ .@entry = findcraftentry(.@craft, CRAFT_EQUIPMENT);
+ if (debug || $@GM_OVERRIDE) mes "found craft entry: " + .@entry;
+ if (debug || $@GM_OVERRIDE) mes "knowledge value: " + .knowledge[.@entry];
+ if (.@entry < 0) {
+ .success=false;
+ } else {
+ if (!getarg(0, true)) {
+ usecraft .@craft;
+ .@it=getcraftcode(.@entry);
+ getitem(.@it, 1);
+ .success=true;
+ } else if (RECIPES_EQUIPMENT[.@entry]) {
+ // Player craft item
+ usecraft .@craft;
+ .@it=getcraftcode(.@entry);
+
+ // Update your CRAFTING_SCORE
+ CRAFTING_SCORE+=getiteminfo(.@it, ITEMINFO_ELV);
+
+ // Obtain the item, and record the craftsman name
+ // PS. This prevents dyes from being used!!
+ getnameditem(.@it, strcharinfo(0));
+
+ // This is where we add options we don't want this now
+ // The functions are not ready yet
+ /*
+ if (getskilllv(TMW2_CRAFT)) {
+ delinventorylist(); // Needed, because we'll rely on rfind()
+ getinventorylist();
+ .@index=array_rfind(@inventorylist_id, .@it);
+ if (csys_Check(.@index, 75000)) {
+ csys_Apply(.@index);
+ }
+ }
+ */
+
+ // Get experience for the craft
+ // I'm using the same EXP formula from Moubootaur Legends
+ // Which is based on the item sell price
+ .@xp=getiteminfo(.@it, ITEMINFO_SELLPRICE);
+ getexp .@xp+BaseLevel, (.@xp/3)+BaseLevel+JobLevel;
+ .success=true;
+ } else {
+ .success=false;
+ }
+ }
+ deletecraft .@craft;
+ setskin "";
+ return .success;
+}
+
+
diff --git a/npc/scripts.conf b/npc/scripts.conf
index a42bd0b5..88886371 100644
--- a/npc/scripts.conf
+++ b/npc/scripts.conf
@@ -56,6 +56,7 @@
"npc/functions/manhole.txt",
"npc/functions/skills.txt",
"npc/functions/lockpicks.txt",
+"npc/functions/crafting.txt",
// quest debug
"npc/functions/quest-debug/functions.txt",