summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--db/constants.conf11
-rw-r--r--db/craft_db.conf60
-rw-r--r--npc/012-8/utils.txt9
-rw-r--r--npc/functions/craft/alchemy.txt44
-rw-r--r--npc/scripts.conf4
5 files changed, 125 insertions, 3 deletions
diff --git a/db/constants.conf b/db/constants.conf
index ab833e4a3..8371dd6b9 100644
--- a/db/constants.conf
+++ b/db/constants.conf
@@ -4208,9 +4208,18 @@ constants_db: {
comment__: "INN enum"
NO_INN: 0
- REDPLUSH_INN: 1
CURRENT_INN: 2
+ comment__: "CRAFT enum"
+ CRAFT_COOKING: 4
+ CRAFT_ALCHEMY: 8
+ CRAFT_EQUIPMENT: 16
+
+ comment__: "CRAFT Scope enum"
+ CRAFT_NPC: 4
+ CRAFT_PLAYER: 8
+ CRAFT_GUILD: 16
+
comment__: "Easter eggs enum"
EE_NONE: 0
EE_SAXSO: 1
diff --git a/db/craft_db.conf b/db/craft_db.conf
index 4397edce9..a3cb06f44 100644
--- a/db/craft_db.conf
+++ b/db/craft_db.conf
@@ -54,5 +54,65 @@ craft_db: (
},
******************************************************************************/
+// Cooking System (ID 0~20, Flag 4)
+//////////////////////////////////////////////////////////////////////////////
+/****************************************************************************/
+
+// Alchemy System (ID 21~40, Flag 8)
+//////////////////////////////////////////////////////////////////////////////
+{
+ Id: 21
+ Name: "CraftHastePotion"
+ Flag: 8
+ SourceItems:
+ (
+ {
+ Plushroom: 15
+ },
+ )
+ CreateItems:
+ (
+ {
+ HastePotion: 3
+ },
+ {
+ HastePotion: 3
+ },
+ {
+ HastePotion: 2
+ },
+ )
+ Priority: 10
+},
+/****************************************************************************/
+{
+ Id: 22
+ Name: "CraftStrengthPotion"
+ Flag: 8
+ SourceItems:
+ (
+ {
+ Chagashroom: 15
+ },
+ )
+ CreateItems:
+ (
+ {
+ StrengthPotion: 3
+ },
+ {
+ StrengthPotion: 3
+ },
+ {
+ StrengthPotion: 2
+ },
+ )
+ Priority: 10
+},
+/****************************************************************************/
+
+// Crafting System (ID 41~80, Flag 16)
+//////////////////////////////////////////////////////////////////////////////
+/****************************************************************************/
)
diff --git a/npc/012-8/utils.txt b/npc/012-8/utils.txt
index e8c5ceb9a..c1f3a9c51 100644
--- a/npc/012-8/utils.txt
+++ b/npc/012-8/utils.txt
@@ -83,8 +83,13 @@ OnInit:
012-8,29,24,0 script Cauldron#RES_0128 NPC_NO_SPRITE,{
- npctalk l("Alchemy system Not Yet Implemented - Blame Jesusalva");
- end;
+ //npctalk l("Alchemy system Not Yet Implemented - Blame Jesusalva");
+ mesc l("What will you brew today?");
+ if (AlchemySystem(CRAFT_PLAYER))
+ mesc l("Success!"), 3;
+ else
+ mesc l("That didn't work!"), 1;
+ close;
OnInit:
.distance=3;
diff --git a/npc/functions/craft/alchemy.txt b/npc/functions/craft/alchemy.txt
new file mode 100644
index 000000000..d0b8efa01
--- /dev/null
+++ b/npc/functions/craft/alchemy.txt
@@ -0,0 +1,44 @@
+// TMW2 Script
+// Author:
+// Jesusalva
+// Description:
+// Alchemy System (Player, Guild, NPC)
+// Notes:
+// Base for Evol MR
+
+// Usage: AlchemySystem ({scope})
+// Scopes: CRAFT_NPC, CRAFT_PLAYER, CRAFT_GUILD
+// If an invalid scope is passed, .knowledge won't be set but will be required
+// Returns true on success, false on failure
+function script AlchemySystem {
+ // Set .scope, .knowledge and .success
+ .scope=getarg(0, CRAFT_PLAYER);
+ if (.scope == CRAFT_PLAYER)
+ copyarray(.knowledge,RECIPES_ALCHEMY,getarraysize(RECIPES_ALCHEMY));
+ else if (.scope == CRAFT_GUILD)
+ copyarray(.knowledge,$@RECIPES_ALCHEMY[getcharid(2)],getarraysize($@RECIPES_ALCHEMY[getcharid(2)]));
+ .success=false;
+
+ setskin "craft2";
+ .@var$ = requestcraft(2);
+ .@craft = initcraft(.@var$);
+ .@entry = findcraftentry(.@craft, CRAFT_ALCHEMY);
+ if (debug || $@GM_OVERRIDE) mes "found craft entry: " + .@entry;
+ if (debug || $@GM_OVERRIDE) mes "knowledge value: " + .knowledge[.@entry];
+ if (.@entry < 0) {
+ .success=false;
+ } else {
+ // Check against COOKING_RECIPES
+ // using CraftCarpCocktail for example (Craft ID)
+ // Checking somehow if you know it (array_find?)
+ if (.scope == CRAFT_NPC || .knowledge[.@entry]) {
+ usecraft .@craft;
+ .success=true;
+ } else {
+ .success=false;
+ }
+ }
+ deletecraft .@craft;
+ setskin "";
+ return .success;
+}
diff --git a/npc/scripts.conf b/npc/scripts.conf
index ad0e2113a..51f620e56 100644
--- a/npc/scripts.conf
+++ b/npc/scripts.conf
@@ -67,6 +67,10 @@
"npc/items/shovel.txt",
"npc/items/teleporter.txt",
+// Crafting System
+"npc/functions/craft/alchemy.txt",
+
+
// custom atcommands
"npc/commands/music.txt",
"npc/commands/exp.txt",