using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace mmoRL { public class Recipe { public string name; public Item result; public List materials = new List(); public int id = 0; public List requiredSkills = new List(); public Recipe(int resultItem, int[] materialItems, int[] amounts, int[] requiredSkills = null) { this.result = new Item(resultItem); for (int i = 0; i < materialItems.Length; i++) { Item item = new Item(materialItems[i]); item.amount = amounts[i]; this.materials.Add(item); } this.name = this.result.Describe(); if (requiredSkills != null) { for (int i = 0; i < requiredSkills.Length; i++) { this.requiredSkills.Add(requiredSkills[i]); } } } } public static class Crafting { public static List recipes = new List(); public static void Initialize() { //-------------------------------CONSTRUCTION AND PAINTING---------------------------------------------- recipes.Add(new Recipe(3, new int[] { 1 }, new int[] { 1 }, new int[] { 6 })); //1 Wood = 1 Wooden Floor recipes.Add(new Recipe(2, new int[] { 1 }, new int[] { 1 }, new int[] { 6 })); //1 Wood = 1 Wooden Wall recipes.Add(new Recipe(20, new int[] { 19 }, new int[] { 1 }, new int[] { 6 })); //1 Stone = 1 Stone Floor recipes.Add(new Recipe(21, new int[] { 19 }, new int[] { 1 }, new int[] { 6 })); //1 Stone = 1 Stone Wall recipes.Add(new Recipe(11, new int[] { 1, 4 }, new int[] { 1, 1 }, new int[] { 7 })); //Red wall recipes.Add(new Recipe(12, new int[] { 1, 4 }, new int[] { 1, 1 }, new int[] { 7 })); //Red floor recipes.Add(new Recipe(13, new int[] { 1, 5 }, new int[] { 1, 1 }, new int[] { 7 })); //Green wall recipes.Add(new Recipe(14, new int[] { 1, 5 }, new int[] { 1, 1 }, new int[] { 7 })); //Green floor recipes.Add(new Recipe(15, new int[] { 1, 6 }, new int[] { 1, 1 }, new int[] { 7 })); //Blue wall recipes.Add(new Recipe(16, new int[] { 1, 6 }, new int[] { 1, 1 }, new int[] { 7 })); //Blue floor recipes.Add(new Recipe(11, new int[] { 19, 4 }, new int[] { 1, 1 }, new int[] { 7 })); //Red wall (#2) recipes.Add(new Recipe(12, new int[] { 19, 4 }, new int[] { 1, 1 }, new int[] { 7 })); //Red floor (#2) recipes.Add(new Recipe(13, new int[] { 19, 5 }, new int[] { 1, 1 }, new int[] { 7 })); //Green wall (#2) recipes.Add(new Recipe(14, new int[] { 19, 5 }, new int[] { 1, 1 }, new int[] { 7 })); //Green floor (#2) recipes.Add(new Recipe(15, new int[] { 19, 6 }, new int[] { 1, 1 }, new int[] { 7 })); //Blue wall (#2) recipes.Add(new Recipe(16, new int[] { 19, 6 }, new int[] { 1, 1 }, new int[] { 7 })); //Blue floor (#2) recipes.Add(new Recipe(17, new int[] { 1, 10 }, new int[] { 1, 1 }, new int[] { 7 })); //White wall recipes.Add(new Recipe(18, new int[] { 1, 10 }, new int[] { 1, 1 }, new int[] { 7 })); //White floor recipes.Add(new Recipe(17, new int[] { 19, 10 }, new int[] { 1, 1 }, new int[] { 7 })); //White wall (#2) recipes.Add(new Recipe(18, new int[] { 19, 10 }, new int[] { 1, 1 }, new int[] { 7 })); //White floor (#2) recipes.Add(new Recipe(4, new int[] { 7 }, new int[] { 1 }, new int[] { 7 })); //Red ink recipes.Add(new Recipe(5, new int[] { 8 }, new int[] { 1 }, new int[] { 7 })); //Green ink recipes.Add(new Recipe(6, new int[] { 9 }, new int[] { 1 }, new int[] { 7 })); //Blue ink recipes.Add(new Recipe(10, new int[] { 7, 8, 9 }, new int[] { 1, 1, 1 }, new int[] { 7 })); //White ink recipes.Add(new Recipe(25, new int[] { 22 }, new int[] { 1 }, new int[] { 6 })); //Lavawall recipes.Add(new Recipe(26, new int[] { 22 }, new int[] { 1 }, new int[] { 6 })); //Lavafloor recipes.Add(new Recipe(27, new int[] { 23 }, new int[] { 1 }, new int[] { 6 })); //Sandwall recipes.Add(new Recipe(28, new int[] { 23 }, new int[] { 1 }, new int[] { 6 })); //Sandfloor recipes.Add(new Recipe(29, new int[] { 24 }, new int[] { 1 }, new int[] { 6 })); //Darkwall recipes.Add(new Recipe(30, new int[] { 24 }, new int[] { 1 }, new int[] { 6 })); //Darkfloor //recipes.Add(new Recipe(31, new int[] { 1 }, new int[] { 5 })); //Tree //-------------------------------SYMBOLS------------------------------------------- recipes.Add(new Recipe(33, new int[] { 32 }, new int[] { 2 })); //Symbol of Toughness recipes.Add(new Recipe(35, new int[] { 34 }, new int[] { 1 })); //Symbol of Rage recipes.Add(new Recipe(36, new int[] { 1, 19 }, new int[] { 2, 2 })); //Symbol of Creation recipes.Add(new Recipe(37, new int[] { 7, 8, 9, 1 }, new int[] { 1, 1, 1, 1 })); //Symbol of Creativity recipes.Add(new Recipe(38, new int[] { 1 }, new int[] { 5 })); //Symbol of the Warrior recipes.Add(new Recipe(42, new int[] { 41 }, new int[] { 2 })); //Symbol of Genesis recipes.Add(new Recipe(56, new int[] { 32, 34 }, new int[] { 2, 2 })); //Symbol of the Hunt recipes.Add(new Recipe(63, new int[] { 62 }, new int[] { 1 })); //Symbol of the Kobold recipes.Add(new Recipe(64, new int[] { 61 }, new int[] { 1 })); //Symbol of the Orc recipes.Add(new Recipe(65, new int[] { 60 }, new int[] { 1 })); //Symbol of the Giant recipes.Add(new Recipe(66, new int[] { 59, 41 }, new int[] { 2, 2 })); //Symbol of Progress recipes.Add(new Recipe(67, new int[] { 59, 41 }, new int[] { 2, 2 })); //Symbol of Return recipes.Add(new Recipe(70, new int[] { 41 }, new int[] { 3 }, new int[] { 9 })); //Symbol of Alchemy recipes.Add(new Recipe(71, new int[] { 32 }, new int[] { 15 }, new int[] { 4 })); //Symbol of Greater Toughness recipes.Add(new Recipe(72, new int[] { 62 }, new int[] { 8 }, new int[] { 11 })); //Greater Symbol of the Kobold recipes.Add(new Recipe(73, new int[] { 61 }, new int[] { 8 }, new int[] { 12 })); //Greater Symbol of the Orc recipes.Add(new Recipe(74, new int[] { 60 }, new int[] { 8 }, new int[] { 13 })); //Greater Symbol of the Giant recipes.Add(new Recipe(75, new int[] { 32 }, new int[] { 100 }, new int[] { 17 })); //Symbol of Greater Toughness recipes.Add(new Recipe(76, new int[] { 62 }, new int[] { 50 }, new int[] { 18 })); //Greater Symbol of the Kobold recipes.Add(new Recipe(77, new int[] { 61 }, new int[] { 50 }, new int[] { 19 })); //Greater Symbol of the Orc recipes.Add(new Recipe(78, new int[] { 60 }, new int[] { 50 }, new int[] { 20 })); //Greater Symbol of the Giant //------------------------------EQUIPMENT-------------------------------- //Weapons recipes.Add(new Recipe(39, new int[] { 1 }, new [] { 1 })); //Stick recipes.Add(new Recipe(54, new int[] { 1, 19 }, new[] { 1, 1 }, new int[] { 8 })); //Primitive Spear //Armor sets recipes.Add(new Recipe(43, new int[] { 32 }, new[] { 6 }, new int[] { 8 })); //Kobold Armor recipes.Add(new Recipe(44, new int[] { 32 }, new[] { 4 }, new int[] { 8 })); //Kobold Leggings recipes.Add(new Recipe(45, new int[] { 32 }, new[] { 3 }, new int[] { 8 })); //Kobold Helmet recipes.Add(new Recipe(46, new int[] { 34 }, new[] { 5 }, new int[] { 8 })); //Orc-Skin Armor recipes.Add(new Recipe(47, new int[] { 34 }, new[] { 3 }, new int[] { 8 })); //Orc-Skin Leggings recipes.Add(new Recipe(48, new int[] { 34, 52 }, new[] { 2, 1 }, new int[] { 8 })); //Orc-Skin Helmet recipes.Add(new Recipe(49, new int[] { 55, 52 }, new[] { 8, 2 }, new int[] { 8, 10 })); //Leather Armor recipes.Add(new Recipe(50, new int[] { 55, 52 }, new[] { 6, 1 }, new int[] { 8, 10 })); //Leather Leggings recipes.Add(new Recipe(51, new int[] { 55 }, new[] { 3 }, new int[] { 8, 10 })); //Leather Cap recipes.Add(new Recipe(53, new int[] { 55, 52 }, new[] { 2, 2 }, new int[] { 8, 10 })); //Leather Boots recipes.Add(new Recipe(58, new int[] { 50, 41 }, new[] { 1, 3 }, new int[] { 8 })); //Enchanted Leather Boots recipes.Add(new Recipe(69, new int[] { 53, 41, 23, 68 }, new[] { 1, 5, 5, 5 }, new int[] { 8 })); //Boots of Water Walking //----------------------------LEATHERWORKING----------------------------- recipes.Add(new Recipe(55, new int[] { 32 }, new[] { 2 }, new int[] { 10 })); //Leather from kobolds recipes.Add(new Recipe(55, new int[] { 34 }, new[] { 1 }, new int[] { 10 })); //Leather from orcs recipes.Add(new Recipe(52, new int[] { 55 }, new[] { 2 }, new int[] { 10 })); //Leather Rope //-----------------------------SYNTHESIS--------------------------------- //Generic items recipes.Add(new Recipe(1, new int[] { 41 }, new int[] { 1 }, new int[] { 9 })); //Wood recipes.Add(new Recipe(7, new int[] { 41 }, new int[] { 2 }, new int[] { 9 })); //Plants recipes.Add(new Recipe(8, new int[] { 41 }, new int[] { 2 }, new int[] { 9 })); // recipes.Add(new Recipe(9, new int[] { 41 }, new int[] { 2 }, new int[] { 9 })); // recipes.Add(new Recipe(19, new int[] { 41 }, new int[] { 1 }, new int[] { 9 })); //Stone recipes.Add(new Recipe(32, new int[] { 41 }, new int[] { 4 }, new int[] { 9 })); //Kobold Scale recipes.Add(new Recipe(34, new int[] { 41 }, new int[] { 5 }, new int[] { 9 })); //Orc Skin recipes.Add(new Recipe(59, new int[] { 41 }, new int[] { 8 }, new int[] { 9 })); //Giant's Toe recipes.Add(new Recipe(68, new int[] { 41 }, new int[] { 8 }, new int[] { 9 })); //Chela recipes.Add(new Recipe(23, new int[] { 19, 41 }, new int[] { 1, 2 }, new int[] { 9 })); //Sandstone //Unique items recipes.Add(new Recipe(31, new int[] { 1, 41 }, new int[] { 1, 2 }, new int[] { 9 })); //Plantable tree recipes.Add(new Recipe(22, new int[] { 19, 41 }, new int[] { 1, 2 }, new int[] { 9 })); //Lavastone recipes.Add(new Recipe(24, new int[] { 19, 41 }, new int[] { 1, 2 }, new int[] { 9 })); //Darkstone //-----------------------------TRANSMUTATION--------------------------------- recipes.Add(new Recipe(41, new int[] { 32 }, new int[] { 4 }, new int[] { 16 })); //Kobold Scale recipes.Add(new Recipe(41, new int[] { 34 }, new int[] { 3 }, new int[] { 16 })); //Orc Skin recipes.Add(new Recipe(41, new int[] { 43 }, new int[] { 1 }, new int[] { 16 })); //Kobold Armor recipes.Add(new Recipe(41, new int[] { 44 }, new int[] { 1 }, new int[] { 16 })); //Kobold Leggings recipes.Add(new Recipe(41, new int[] { 45 }, new int[] { 1 }, new int[] { 16 })); //Kobold Helmet recipes.Add(new Recipe(41, new int[] { 46 }, new int[] { 1 }, new int[] { 16 })); //Orc-Skin Armor recipes.Add(new Recipe(41, new int[] { 47 }, new int[] { 1 }, new int[] { 16 })); //Orc-Skin Leggings recipes.Add(new Recipe(41, new int[] { 48 }, new int[] { 1 }, new int[] { 16 })); //Orc-Skin Helm recipes.Add(new Recipe(41, new int[] { 49 }, new int[] { 1 }, new int[] { 16 })); //Leather Armor recipes.Add(new Recipe(41, new int[] { 50 }, new int[] { 1 }, new int[] { 16 })); //Leather Leggings recipes.Add(new Recipe(41, new int[] { 51 }, new int[] { 1 }, new int[] { 16 })); //Leather Cap recipes.Add(new Recipe(41, new int[] { 53 }, new int[] { 1 }, new int[] { 16 })); //Leather Boots recipes.Add(new Recipe(41, new int[] { 57 }, new int[] { 1 }, new int[] { 16 })); //Orcish Spear recipes.Add(new Recipe(41, new int[] { 58 }, new int[] { 1 }, new int[] { 16 })); //Enchanted Leather Boots recipes.Add(new Recipe(41, new int[] { 59 }, new int[] { 2 }, new int[] { 16 })); //Giant's Toe recipes.Add(new Recipe(41, new int[] { 60 }, new int[] { 1 }, new int[] { 16 })); //Giant's Arm recipes.Add(new Recipe(41, new int[] { 61 }, new int[] { 1 }, new int[] { 16 })); //Orc's Thumb recipes.Add(new Recipe(41, new int[] { 62 }, new int[] { 1 }, new int[] { 16 })); //Kobold's Arm recipes.Add(new Recipe(41, new int[] { 68 }, new int[] { 2 }, new int[] { 16 })); //Chela recipes.Add(new Recipe(41, new int[] { 69 }, new int[] { 1 }, new int[] { 16 })); //Boots of Water Walking //Give them IDs for (int i = 0; i < recipes.Count; i++) recipes[i].id = i; } public static List GetPossibleRecipes() { List toReturn = new List(); for (int i = 0; i < recipes.Count; i++) { bool canMake = true; for (int ii = 0; ii < recipes[i].materials.Count; ii++) { if (!MainClass.HasItem(recipes[i].materials[ii], recipes[i].materials[ii].amount)) canMake = false; } for (int ii = 0; ii < recipes[i].requiredSkills.Count; ii++) { if (!MainClass.player.HasSkill(recipes[i].requiredSkills[ii])) canMake = false; } if (canMake) toReturn.Add(recipes[i]); } return toReturn; } public static void Craft(Recipe recipe) { for (int i = 0; i < recipe.materials.Count; i++) MainClass.RemoveItem(recipe.materials[i], recipe.materials[i].amount); Item result = new Item(recipe.result.id); MainClass.AddItem(result); Graphics.SetStatus("You have crafted a " + result.Describe() + "."); } } }