Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- class SkyrimAlchemy {
- private String[][] ingredients = new String [][] {
- new String[] {"Abecean Longfin", "Weakness to Frost", "Fortify Sneak", "Weakness to Poison", "Fortify Restoration"},
- new String[] {"Ash Creep Cluster (DB)", "Damage Stamina", "Invisibility", "Resist Fire", "Fortify Destruction"},
- new String[] {"Ash Hopper Jelly (DB)", "Restore Health", "Fortify Light Armor", "Resist Shock", "Weakness to Frost"},
- new String[] {"Ashen Grass Pod (DB)", "Resist Fire", "Weakness to Shock", "Fortify Lockpicking", "Fortify Sneak"},
- new String[] {"Ancestor Moth Wing (DG)", "Damage Stamina", "Fortify Conjuration", "Damage Magicka Regen", "Fortify Enchanting"},
- new String[] {"Bear Claws", "Restore Stamina", "Fortify Health", "Fortify One-Handed", "Damage Magicka Regen"},
- new String[] {"Bee", "Restore Stamina", "Ravage Stamina", "Regenerate Stamina", "Weakness to Shock"},
- new String[] {"Beehive Husk", "Resist Poison", "Fortify Light Armor", "Fortify Sneak", "Fortify Destruction"},
- new String[] {"Bleeding Crown", "Weakness to Fire", "Fortify Block", "Weakness to Poison", "Resist Magic"},
- new String[] {"Blisterwort", "Damage Stamina", "Frenzy", "Restore Health", "Fortify Smithing"},
- new String[] {"Blue Butterfly Wing", "Damage Stamina", "Fortify Conjuration", "Damage Magicka Regen", "Fortify Enchanting"},
- new String[] {"Blue Dartwing", "Resist Shock", "Fortify Pickpocket", "Restore Health", "Fear"},
- new String[] {"Blue Mountain Flower", "Restore Health", "Fortify Health", "Fortify Conjuration", "Damage Magicka Regen"},
- new String[] {"Boar Tusk (DB)", "Fortify Stamina", "Fortify Health", "Fortify Block", "Frenzy"},
- new String[] {"Bone Meal", "Damage Stamina", "Resist Fire", "Fortify Conjuration", "Ravage Stamina"},
- new String[] {"Briar Heart", "Restore Magicka", "Fortify Block", "Paralysis", "Fortify Magicka"},
- new String[] {"Burnt Spriggan Wood (DB)", "Weakness to Fire", "Fortify Alteration", "Damage Magicka Regen", "Slow"},
- new String[] {"Butterfly Wing", "Restore Health", "Fortify Barter", "Lingering Damage Stamina", "Damage Magicka"},
- new String[] {"Canis Root", "Damage Stamina", "Fortify One-Handed", "Fortify Marksman", "Paralysis"},
- new String[] {"Charred Skeever Hide", "Restore Stamina", "Cure Disease", "Resist Poison", "Restore Health"},
- new String[] {"Chaurus Eggs", "Weakness to Poison", "Fortify Stamina", "Damage Magicka", "Invisibility"},
- new String[] {"Chaurus Hunter Antennae (DG)", "Damage Stamina", "Fortify Conjuration", "Damage Magicka Regen", "Fortify Enchanting"},
- new String[] {"Chicken's Egg", "Resist Magic", "Damage Magicka Regen", "Waterbreathing", "Lingering Damage Stamina"},
- new String[] {"Creep Cluster", "Restore Magicka", "Damage Stamina Regen", "Fortify Carry Weight", "Weakness to Magic"},
- new String[] {"Crimson Nirnroot", "Damage Health", "Damage Stamina", "Invisibility", "Resist Magic"},
- new String[] {"Cyrodilic Spadetail", "Damage Stamina", "Fortify Restoration", "Fear", "Ravage Health"},
- new String[] {"Daedra Heart", "Damage Stamina Regen", "Restore Health", "Damage Magicka", "Fear"},
- new String[] {"Deathbell", "Damage Health", "Ravage Stamina", "Slow", "Weakness to Poison"},
- new String[] {"Dragon's Tongue", "Resist Fire", "Fortify Barter", "Fortify Illusion", "Fortify Two-handed"},
- new String[] {"Dwarven Oil", "Weakness to Magic", "Fortify Illusion", "Regenerate Magicka", "Restore Magicka"},
- new String[] {"Ectoplasm", "Restore Magicka", "Fortify Destruction", "Fortify Magicka", "Damage Health"},
- new String[] {"Elves Ear", "Restore Magicka", "Fortify Marksman", "Weakness to Frost", "Resist Fire"},
- new String[] {"Emperor Parasol Mossv", "Damage Health", "Fortify Magicka", "Regenerate Health", "Fortify Two-Handed"},
- new String[] {"Eye of Sabre Cat", "Restore Stamina", "Ravage Health", "Damage Magicka", "Restore Health"},
- new String[] {"Falmer Ear", "Damage Health", "Resist Poison", "Frenzy", "Fortify Lockpicking"},
- new String[] {"Felsaad Tern Feathers (DB)", "Restore Health", "Fortify Light Armor", "Cure Disease", "Resist Magic"},
- new String[] {"Fire Salts", "Weakness to Frost", "Restore Magicka", "Resist Fire", "Regenerate Magicka"},
- new String[] {"Fly Amanita", "Resist Fire", "Fortify Two-handed", "Frenzy", "Regenerate Stamina"},
- new String[] {"Frost Mirriam", "Resist Frost", "Fortify Sneak", "Ravage Magicka", "Damage Stamina Regen"},
- new String[] {"Frost Salts", "Weakness to Fire", "Resist Frost", "Restore Magicka", "Fortify Conjuration"},
- new String[] {"Garlic", "Resist Poison", "Fortify Stamina", "Regenerate Magicka", "Regenerate Health"},
- new String[] {"Giant Lichen", "Ravage Health", "Weakness to Shock", "Weakness to Poison", "Restore Magicka"},
- new String[] {"Giant's Toe", "Damage Stamina", "Fortify Health", "Fortify Carry Weight", "Damage Stamina Regen"},
- new String[] {"Gleamblossom (DG)", "Resist Magic", "Fear", "Regenerate Health", "Paralysis"},
- new String[] {"Glow Dust", "Damage Magicka", "Damage Magicka Regen", "Fortify Destruction", "Resist Shock"},
- new String[] {"Glowing Mushroom", "Resist Shock", "Fortify Destruction", "Fortify Smithing", "Fortify Health"},
- new String[] {"Grass Pod", "Resist Poison", "Ravage Magicka", "Fortify Alteration", "Restore Magicka"},
- new String[] {"Hagraven Claw", "Resist Magic", "Lingering Damage Magicka", "Fortify Enchanting", "Fortify Barter"},
- new String[] {"Hagraven Feathers", "Damage Magicka", "Fortify Conjuration", "Frenzy", "Weakness to Shock"},
- new String[] {"Hanging Moss", "Damage Magicka", "Fortify Health", "Damage Magicka Regen", "Fortify One-Handed"},
- new String[] {"Hawk Beak", "Restore Stamina", "Resist Frost", "Fortify Carry Weight", "Resist Shock"},
- new String[] {"Hawk's Egg", "Resist Magic", "Damage Magicka Regen", "Waterbreathing", "Lingering Damage Stamina"},
- new String[] {"Hawk Feathers", "Cure Disease", "Fortify Light Armor", "Fortify One-Handed", "Fortify Sneak"},
- new String[] {"Histcarp", "Restore Stamina", "Fortify Magicka", "Damage Stamina Regen", "Waterbreathing"},
- new String[] {"Honeycomb", "Restore Stamina", "Fortify Block", "Fortify Light Armor", "Ravage Stamina"},
- new String[] {"Human Flesh", "Damage Health", "Paralysis", "Restore Magicka", "Fortify Sneak"},
- new String[] {"Human Heart", "Damage Health", "Damage Magicka", "Damage Magicka Regen", "Frenzy"},
- new String[] {"Ice Wraith Teeth", "Weakness to Frost", "Fortify Heavy Armor", "Invisibility", "Weakness to Fire"},
- new String[] {"Imp Stool", "Damage Health", "Lingering Damage Health", "Paralysis", "Restore Health"},
- new String[] {"Jarrin Root", "Damage Health", "Damage Magicka", "Damage Stamina", "Damage Magicka Regen"},
- new String[] {"Jazbay Grapes", "Weakness to Magic", "Fortify Magicka", "Regenerate Magicka", "Ravage Health"},
- new String[] {"Juniper Berries", "Weakness to Fire", "Fortify Marksman", "Regenerate Health", "Damage Stamina Regen"},
- new String[] {"Large Antlers", "Restore Stamina", "Fortify Stamina", "Slow", "Damage Stamina Regen"},
- new String[] {"Lavender", "Resist Magic", "Fortify Stamina", "Ravage Magicka", "Fortify Conjuration"},
- new String[] {"Luna Moth Wing", "Damage Magicka", "Fortify Light Armor", "Regenerate Health", "Invisibility"},
- new String[] {"Moon Sugar", "Weakness to Fire", "Resist Frost", "Restore Magicka", "Regenerate Magicka"},
- new String[] {"Mora Tapinella", "Restore Magicka", "Lingering Damage Health", "Regenerate Stamina", "Fortify Illusion"},
- new String[] {"Mudcrab Chitin", "Restore Stamina", "Cure Disease", "Resist Poison", "Resist Fire"},
- new String[] {"Namira's Rot", "Damage Magicka", "Fortify Lockpicking", "Fear", "Regenerate Health"},
- new String[] {"Netch Jelly (DB)", "Paralysis", "Fortify Carry Weight", "Restore Stamina", "Fear"},
- new String[] {"Nightshade", "Damage Health", "Damage Magicka Regen", "Lingering Damage Stamina", "Fortify Destruction"},
- new String[] {"Nirnroot", "Damage Health", "Damage Stamina", "Invisibility", "Resist Magic"},
- new String[] {"Nordic Barnacle", "Damage Magicka", "Waterbreathing", "Regenerate Health", "Fortify Pickpocket"},
- new String[] {"Orange Dartwing", "Restore Stamina", "Ravage Magicka", "Fortify Pickpocket", "Lingering Damage Health"},
- new String[] {"Pearl", "Restore Stamina", "Fortify Block", "Restore Magicka", "Resist Shock"},
- new String[] {"Pine Thrush Egg", "Restore Stamina", "Fortify Lockpicking", "Weakness to Poison", "Resist Shock"},
- new String[] {"Poison Bloom (DG)", "Damage Health", "Slow", "Fortify Carry Weight", "Fear"},
- new String[] {"Powdered Mammoth Tusk", "Restore Stamina", "Fortify Sneak", "Weakness to Fire", "Fear"},
- new String[] {"Purple Mountain Flower", "Restore Stamina", "Fortify Sneak", "Lingering Damage Magicka", "Resist Frost"},
- new String[] {"Red Mountain Flower", "Restore Magicka", "Ravage Magicka", "Fortify Magicka", "Damage Health"},
- new String[] {"River Betty", "Damage Health", "Fortify Alteration", "Slow", "Fortify Carry Weight"},
- new String[] {"Rock Warbler Egg", "Restore Health", "Fortify One-Handed", "Damage Stamina", "Weakness to Magic"},
- new String[] {"Sabre Cat Tooth", "Restore Stamina", "Fortify Heavy Armor", "Fortify Smithing", "Weakness to Poison"},
- new String[] {"Salmon Roe", "Restore Stamina", "Waterbreathing", "Fortify Magicka", "Regenerate Magicka"},
- new String[] {"Salt Pile", "Weakness to Magic", "Fortify Restoration", "Slow", "Regenerate Magicka"},
- new String[] {"Scaly Pholiata", "Weakness to Magic", "Fortify Illusion", "Regenerate Stamina", "Fortify Carry Weight"},
- new String[] {"Scathecraw (DB)", "Ravage Health", "Ravage Stamina", "Ravage Magicka", "Lingering Damage Health"},
- new String[] {"Silverside Perch", "Restore Stamina", "Damage Stamina Regen", "Ravage Health", "Resist Frost"},
- new String[] {"Skeever Tail", "Damage Stamina Regen", "Ravage Health", "Damage Health", "Fortify Light Armor"},
- new String[] {"Slaughterfish Egg", "Resist Poison", "Fortify Pickpocket", "Lingering Damage Health", "Fortify Stamina"},
- new String[] {"Slaughterfish Scales", "Resist Frost", "Lingering Damage Health", "Fortify Heavy Armor", "Fortify Block"},
- new String[] {"Small Antlers", "Weakness to Poison", "Fortify Restoration", "Lingering Damage Stamina", "Damage Health"},
- new String[] {"Small Pearl", "Restore Stamina", "Fortify One-Handed", "Fortify Restoration", "Resist Frost"},
- new String[] {"Snowberries", "Resist Fire", "Fortify Enchanting", "Resist Frost", "Resist Shock"},
- new String[] {"Spawn Ash (DB)", "Ravage Stamina", "Resist Fire", "Fortify Enchanting", "Ravage Magicka"},
- new String[] {"Spider Egg", "Damage Stamina", "Damage Magicka Regen", "Fortify Lockpicking", "Fortify Marksman"},
- new String[] {"Spriggan Sap", "Damage Magicka Regen", "Fortify Enchanting", "Fortify Smithing", "Fortify Alteration"},
- new String[] {"Swamp Fungal Pod", "Resist Shock", "Lingering Damage Magicka", "Paralysis", "Restore Health"},
- new String[] {"Taproot", "Weakness to Magic", "Fortify Illusion", "Regenerate Magicka", "Restore Magicka"},
- new String[] {"Thistle Branch", "Resist Frost", "Ravage Stamina", "Resist Poison", "Fortify Heavy Armor"},
- new String[] {"Torchbug Thorax", "Restore Stamina", "Lingering Damage Magicka", "Weakness to Magic", "Fortify Stamina"},
- new String[] {"Trama Root (DB)", "Weakness to Shock", "Fortify Carry Weight", "Damage Magicka", "Slow"},
- new String[] {"Troll Fat", "Resist Poison", "Fortify Two-handed", "Frenzy", "Damage Health"},
- new String[] {"Tundra Cotton", "Resist Magic", "Fortify Magicka", "Fortify Block", "Fortify Barter"},
- new String[] {"Vampire Dust", "Invisibility", "Restore Magicka", "Regenerate Health", "Cure Disease"},
- new String[] {"Void Salts", "Weakness to Shock", "Resist Magic", "Damage Health", "Fortify Magicka"},
- new String[] {"Wheat", "Restore Health", "Fortify Health", "Damage Stamina Regen", "Lingering Damage Magicka"},
- new String[] {"White Cap", "Weakness to Frost", "Fortify Heavy Armor", "Restore Magicka", "Ravage Magicka"},
- new String[] {"Wisp Wrappings", "Restore Stamina", "Fortify Destruction", "Fortify Carry Weight", "Resist Magic"},
- new String[] {"Yellow Mountain Flower (DG)", "Resist Poison", "Fortify Restoration", "Fortify Health", "Damage Stamina Regen"},
- };
- SkyrimAlchemy () {
- String searchMode = "ing";
- Scanner scanner = new Scanner (System.in);
- System.out.println (" ");
- do {
- String input = scanner.nextLine ();
- if (input.matches ("^quit$")) {
- scanner = null;
- return;
- };
- if (input.matches ("^setmode .+"))
- searchMode = input.substring (7).equals ("ing") ? "ing" : "eff";
- else if (searchMode.equals ("ing"))
- getCompatableIngredients (input);
- else if (searchMode.equals ("eff"))
- getCompatableEffects (input);
- } while (scanner != null);
- };
- String findRealIngredientName (String input) {
- for (String [] array : ingredients)
- if (array [0].toLowerCase ().equals (input.toLowerCase ()))//.substring (0, input.length () - 1) == input.toLowerCase ())
- return array [0];
- return "not found";
- };
- String findRealEffect (String input) {
- for (String [] array : ingredients)
- for (int i = 1; i < array.length; i++)
- if (array [i].toLowerCase ().equals (input.toLowerCase ()))//.substring (0, input.length () - 1) == input.toLowerCase ())
- return array [i];
- return "not found";
- };
- String [] getIngredientEffects (String input) {
- input = findRealIngredientName (input);
- if (input.equals ("not found"))
- return new String [] {"Not found", "Not found", "Not found", "Not found"};
- for (String[] s: ingredients)
- if (s [0].equals (input))
- return new String []{s [1], s [2], s [3], s [4]};
- return new String [] {"Not found", "Not found", "Not found", "Not found"};
- };
- void getCompatableIngredients (String input) {
- input = findRealIngredientName (input);
- if (input.equals ("not found")) {
- print ("Ingredient not found.");
- return ;
- };
- String [] ingredientEffects = getIngredientEffects (input);
- HashMap <String, Boolean> compatableIngredients = new
- HashMap <>();
- print ("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
- print (input); //simulate normality of terminal?
- print ("Finding compatable ingredients for " + input);
- print (String.format ("Ingredients: %s, %s, %s, %s", ingredientEffects [0], ingredientEffects [1], ingredientEffects [2], ingredientEffects [3]));
- for (String arr[]: ingredients)
- for (int i = 1; i < arr.length; ++i)
- for (int j = 0; j < ingredientEffects.length; ++j)
- if (arr [i].equals (ingredientEffects [j]))
- if (compatableIngredients.get (arr [0]) == null)
- compatableIngredients.put (arr [0], Boolean.TRUE);
- Object []objs = compatableIngredients.keySet ().toArray ();
- if (objs.length == 0)
- print ("None found");
- else
- for (Object key:objs)
- print (key.toString ());
- };
- void getCompatableEffects (String effect) {
- String input = findRealEffect (effect);
- if (input.equals ("not found")) {
- print ("Effect not found.");
- return ;
- };
- String [] ingredientEffects = getIngredientEffects (input);
- HashMap <String, Boolean> compatableIngredients = new
- HashMap <>();
- print ("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
- print (input); //simulate normality of terminal?
- print ("Finding compatable effects for " + input);
- for (String arr[]: ingredients)
- for (int i = 1; i < arr.length; ++i)
- for (int j = 0; j < ingredientEffects.length; ++j)
- if (arr [i].toLowerCase ().equals (input.toLowerCase ()))
- if (compatableIngredients.get (arr [0]) == null)
- compatableIngredients.put (arr [0], Boolean.TRUE);
- Object []objs = compatableIngredients.keySet ().toArray ();
- if (objs.length == 0)
- print ("None found");
- else
- for (Object key:objs)
- print (key.toString ());
- };
- void print (String s) {
- System.out.println (s);
- };
- void print (String [] s) {
- String raw = "";
- for (String str : s)
- raw += raw.length() == 0 ? "" : "\t" + str;
- print (raw);
- };
- static void main (String []args) {
- new SkyrimAlchemy ();
- };
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement