User:Cqm/efficiency.js/herblore.js

/** * Herblore efficiency calculator * * Loosely based on MediaWiki:Common.js/calc.js by Quarenon * @author Cqm */


 * ( function ( $, rswiki ) {

'use strict';

rswiki.efficiency = rswiki.efficiency || {}; rswiki.efficiency.herblore = ( function {

// scroll of cleansing modifier // 1 without scroll, 0.9 with scroll var s = 1, // income money = 0, // list of potions // this is the order they will be in when the table is generated // so this is what you need to edit to alter said order potions = [ 'Clean guam', 'Attack potion (3)', 'Ranging potion (3)', 'Strength potion (3)', 'Attack mix (2)', 'Magic potion (3)-1', 'Magic potion (3)-2', 'Magic potion (3)-3', 'Magic potion (3)-4', 'Ranging mix (2)', 'Clean marrentill', 'Antipoison (3)', 'Antipoison mix (2)', 'Magic mix (2)', 'Relicym\'s mix (2)', 'Clean tarromin', 'Strength mix (2)', 'Serum 207 (3)', 'Guam tar', 'Clean harralander', 'Restore potion (3)', 'Restore mix (2)', 'Clean ranarr', 'Energy potion (3)', 'Energy mix (2)', 'Clean toadflax', 'Defence potion (3)', 'Marrentill tar', 'Defence mix (2)', 'Agility potion (3)', 'Clean spirit weed', 'Combat potion (3)', 'Agility mix (2)', 'Prayer potion (3)', 'Tarromin tar', 'Clean irit', 'Summoning potion (3)', 'Crafting potion (3)', 'Combat mix (2)', 'Clean wergali', 'Prayer mix (2)', 'Harralander tar', 'Super attack (3)', 'Super attack mix (2)', 'Clean avantoe', 'Super antipoison (3)', 'Fishing potion (3)', 'Anti-p supermix (2)', 'Super energy (3)', 'Hunter potion (3)', 'Fishing mix (2)', 'Clean kwuarm', 'Super strength (3)', 'Super energy mix (2)', 'Fletching potion (3)', 'Hunting mix (2)', 'Clean snapdragon', 'Super strength mix (2)', 'Weapon poison (3)', 'Super restore (3)', 'Clean cadantine', 'Super defence (3)', 'Clean lantadyme', 'Super restore mix (2)', 'Antifire (3)', 'Clean dwarf weed', 'Super defence mix (2)', 'Super ranging potion (3)', 'Antidote+ mix (2)', 'Clean torstol', 'Antifire mix (2)', 'Super magic potion (3)', 'Zamorak brew (3)', 'Super ranging mix (2)', 'Saradomin brew (3)', 'Super magic mix (2)', 'Zamorak mix (2)', 'Clean fellstalk', 'Prayer renewal (3)', 'Extreme attack (3)', 'Extreme strength (3)', 'Extreme defence (3)', 'Extreme magic (3)', 'Extreme ranging (3)', 'Adrenaline potion (3)', 'Super antifire (3)', 'Super prayer (3)', 'Overload (3)', 'Guam potion (unf)', 'Tarromin potion (unf)', 'Marrentill potion (unf)', 'Harralander potion (unf)', 'Ranarr potion (unf)', 'Toadflax potion (unf)', 'Spirit weed potion (unf)', 'Irit potion (unf)', 'Wergali potion (unf)', 'Avantoe potion (unf)', 'Kwuarm potion (unf)', 'Snapdragon potion (unf)', 'Cadantine potion (unf)', 'Lantadyme potion (unf)', 'Dwarf weed potion (unf)', 'Torstol potion (unf)', 'Fellstalk potion (unf)', 'Relicym\'s balm (3)', 'Guthix rest (3)', 'Guthix balance (3) (unf)', 'Guthix balance (3)', 'Super fishing explosive', 'Magic essence (3)', 'Super Guthix rest (3)', 'Super Saradomin brew (3)', 'Super Zamorak brew (3)', 'Mixture - step 1 (3)', 'Mixture - step 2 (3)', 'Sanfew serum (3)', 'Weapon poison++ (3)', 'Antipoison++ (4)', 'Antipoison+ (4)', 'Weapon poison+ (3)', ],           // data object // this contains static data by default (ingredients, level, xp, profit and num/hour           // price and image are added when the script is run            // when adding potions remember to add them to the potions array above, this data object            // and add their ingredients to the ingredients object if not already there            data = {                'Clean guam': {                    ingredients: ['Grimy guam'],                    lvl: 1,                    xp: 2.5,                    profit: function  {                        return data['Clean guam'].price - ing['Grimy guam'].price;                    },                    num: 5000                },                'Guam potion (unf)': {                    ingredients: ['Clean guam', 'Vial of water'],                    lvl: 1,                    xp: 1,                    profit: function  {                        return data['Guam potion (unf)'].price - s * ing['Clean guam'].price - ing['Vial of water'].price; },                   num: 2200 },               'Attack potion (3)': { ingredients: ['Guam potion (unf)', 'Eye of newt'], lvl: 3, xp: 25, profit: function { return data['Attack potion (3)'].price - ing['Guam potion (unf)'].price - s * ing['Eye of newt'].price; },                   num: 2000 },               'Ranging potion (3)': { ingredients: ['Guam potion (unf)', 'Redberries'], lvl: 3, xp: 30, profit: function { return data['Ranging potion (3)'].price - ing['Guam potion (unf)'].price - s * ing['Redberries'].price; },                   num: 2000 },               'Strength potion (3)': { ingredients: ['Tarromin potion (unf)', 'Limpwurt root'], lvl: 3, xp: 25, profit: function { return data['Strength potion (3)'].price - ing['Tarromin potion (unf)'].price - s * ing['Limpwurt root'].price; },                   num: 2000 },               'Attack mix (2)': { ingredients: ['Attack potion (2)', 'Roe'], lvl: 4, xp: 8, profit: function { return data['Attack mix (2)'].price - ing['Attack potion (2)'].price - ing['Roe'].price; },                   num: 2000 },               // there are 4 ways to make a magic potion // so each one is suffixed with a number to identify it internally // whoch is stripped when the result is generated 'Magic potion (3)-1': { ingredients: ['Tarromin potion (unf)', 'Red bead'], lvl: 5, xp: 35, profit: function { return data['Magic potion (3)-1'].price - ing['Tarromin potion (unf)'].price - s * ing['Red bead'].price; },                   num: 2000 },               'Magic potion (3)-2': { ingredients: ['Tarromin potion (unf)', 'Yellow bead'], lvl: 5, xp: 35, profit: function { return data['Magic potion (3)-2'].price - ing['Tarromin potion (unf)'].price - s * ing['Yellow bead'].price; },                   num: 2000 },               'Magic potion (3)-3': { ingredients: ['Tarromin potion (unf)', 'Black bead'], lvl: 5, xp: 35, profit: function { return data['Magic potion (3)-3'].price - ing['Tarromin potion (unf)'].price - s * ing['Black bead'].price; },                   num: 2000 },               'Magic potion (3)-4': { ingredients: ['Tarromin potion (unf)', 'White bead'], lvl: 5, xp: 35, profit: function { return data['Magic potion (3)-4'].price - ing['Tarromin potion (unf)'].price - s * ing['White bead'].price; },                   num: 2000 },               'Ranging mix (2)': { ingredients: ['Ranging potion (2)', 'Roe'], lvl: 5, xp: 8, profit: function { return data['Ranging mix (2)'].price - ing['Ranging potion (2)'].price - ing['Roe'].price; },                   num: 2000 },               'Clean marrentill': { ingredients: ['Grimy marrentill'], lvl: 5, xp: 3.8, profit: function { return data['Clean marrentill'].price - ing['Grimy marrentill'].price; },                   num: 5000 },               'Antipoison (3)': { ingredients: ['Marrentill potion (unf)', 'Unicorn horn dust'], lvl: 5, xp: 37.5, profit: function { return data['Antipoison (3)'].price - ing['Marrentill potion (unf)'].price - s * ing['Unicorn horn dust'].price; },                   num: 2000 },               'Antipoison mix (2)': { ingredients: ['Antipoison (2)', 'Roe'], lvl: 6, xp: 12, profit: function { return data['Antipoison mix (2)'].price - ing['Antipoison (2)'].price - ing['Roe'].price; },                   num: 2000 },               'Magic mix (2)': { ingredients: ['Magic potion (2)', 'Roe'], lvl: 7, xp: 8, profit: function { return data['Magic mix (2)'].price - ing['Magic potion (2)'].price - ing['Roe'].price; },                   num: 2000 },               'Relicym\'s mix (2)': { ingredients: ['Relicym\'s balm (2)', 'Roe'], lvl: 9, xp: 14, profit: function { return data['Relicym\'s mix (2)'].price - ing['Relicym\'s balm (2)'].price - ing['Roe'].price; },                   num: 2000 },               'Clean tarromin': { ingredients: ['Grimy tarromin'], lvl: 11, xp: 5, profit: function { return data['Clean tarromin'].price - ing['Grimy tarromin'].price; },                   num: 5000 },               'Strength mix (2)': { ingredients: ['Strength potion (2)', 'Roe'], lvl: 14, xp: 17, profit: function { return data['Strength mix (2)'].price - ing['Strength potion (2)'].price - ing['Roe'].price; },                   num: 2000 },               'Serum 207 (3)': { ingredients: ['Tarromin potion (unf)', 'Ashes'], lvl: 15, xp: 50, profit: function { return 0 - ing['Tarromin potion (unf)'].price - s * ing['Ashes'].price; },                   num: 2000 },               'Guam tar': { ingredients: ['Clean guam', 'Swamp tar'], lvl: 19, xp: 30, profit: function { return 15 * data['Guam tar'].price - ing['Clean guam'].price -15 * ing['Swamp tar'].price; },                   num: 1800 },               'Clean harralander': { ingredients: ['Grimy harralander'], lvl: 20, xp: 6.3, profit: function { return data['Clean harralander'].price - ing['Grimy harralander'].price; },                   num: 5000 },               'Restore potion (3)': { ingredients: ['Harralander potion (unf)', 'Red spiders\' eggs'], lvl: 22, xp: 62.5, profit: function { return data['Restore potion (3)'].price - ing['Harralander potion (unf)'].price - s * ing['Red spiders\' eggs'].price; },                   num: 2000 },               'Restore mix (2)': { ingredients: ['Restore potion (2)', 'Roe'], lvl: 24, xp: 21, profit: function { return data['Restore mix (2)'].price - ing['Restore potion (2)'].price - ing['Roe'].price; },                   num: 2000 },               'Clean ranarr': { ingredients: ['Grimy ranarr'], lvl: 25, xp: 7.5, profit: function { return data['Clean ranarr'].price - ing['Grimy ranarr'].price; },                   num: 5000 },               'Energy potion (3)': { ingredients: ['Harralander potion (unf)', 'Chocolate dust'], lvl: 26, xp: 67.5, profit: function { return data['Energy potion (3)'].price - ing['Harralander potion (unf)'].price - s * ing['Chocolate dust'].price; },                   num: 2000 },               'Energy mix (2)': { ingredients: ['Energy potion (2)', 'Caviar'], lvl: 29, xp: 23, profit: function { return data['Energy mix (2)'].price - ing['Energy potion (2)'].price - ing['Caviar'].price; },                   num: 2000 },               'Clean toadflax': { ingredients: ['Grimy toadflax'], lvl: 30, xp: 8, profit: function { return data['Clean toadflax'].price - ing['Grimy toadflax'].price; },                   num: 5000 },               'Defence potion (3)': { ingredients: ['Ranarr potion (unf)', 'White berries'], lvl: 30, xp: 75, profit: function { return data['Defence potion (3)'].price - ing['Ranarr potion (unf)'].price - s * ing['White berries'].price; },                   num: 2000 },               'Marrentill tar': { ingredients: ['Clean marrentill', 'Swamp tar'], lvl: 31, xp: 42.5, profit: function { return 15 * data['Marrentill tar'].price - ing['Clean marrentill'].price -15 * ing['Swamp tar'].price; },                   num: 1800 },               'Defence mix (2)': { ingredients: ['Defence potion (2)', 'Caviar'], lvl: 33, xp: 25, profit: function { return data['Defence mix (2)'].price - ing['Defence potion (2)'].price - ing['Caviar'].price; },                   num: 2000 },               'Agility potion (3)': { ingredients: ['Toadflax potion (unf)', 'Toad\'s legs'], lvl: 34, xp: 80, profit: function { return data['Agility potion (3)'].price - ing['Toadflax potion (unf)'].price - s * ing['Toad\'s legs'].price; },                   num: 2000 },               'Clean spirit weed': { ingredients: ['Grimy spirit weed'], lvl: 35, xp: 7.8, profit: function { return data['Clean spirit weed'].price - ing['Grimy spirit weed'].price; },                   num: 5000 },               'Combat potion (3)': { ingredients: ['Harralander potion (unf)', 'Goat horn dust'], lvl: 36, xp: 84, profit: function { return data['Combat potion (3)'].price - ing['Harralander potion (unf)'].price - s * ing['Goat horn dust'].price; },                   num: 2000 },               'Agility mix (2)': { ingredients: ['Agility potion (2)', 'Caviar'], lvl: 37, xp: 27, profit: function { return data['Agility mix (2)'].price - ing['Agility potion (2)'].price - ing['Caviar'].price; },                   num: 2000 },               'Prayer potion (3)': { ingredients: ['Ranarr potion (unf)', 'Snape grass'], lvl: 38, xp: 87.5, profit: function { return data['Prayer potion (3)'].price - ing['Ranarr potion (unf)'].price - s * ing['Snape grass'].price; },                   num: 2000 },               'Tarromin tar': { ingredients: ['Clean tarromin', 'Swamp tar'], lvl: 39, xp: 55, profit: function { return 15 * data['Tarromin tar'].price - ing['Clean tarromin'].price -15 * ing['Swamp tar'].price; },                   num: 1800 },               'Clean irit': { ingredients: ['Grimy irit'], lvl: 40, xp: 8.8, profit: function { return data['Clean irit'].price - ing['Grimy irit'].price; },                   num: 5000 },               'Summoning potion (3)': { ingredients: ['Spirit weed potion (unf)', 'Cockatrice egg'], lvl: 40, xp: 92, profit: function { return data['Summoning potion (3)'].price - ing['Spirit weed potion (unf)'].price - s * ing['Cockatrice egg'].price; },                   num: 2000 },               'Crafting potion (3)': { ingredients: ['Wergali potion (unf)', 'Frog spawn'], lvl: 40, xp: 92, profit: function { return data['Crafting potion (3)'].price - ing['Wergali potion (unf)'].price - s * ing['Frog spawn'].price; },                   num: 90 },               'Combat mix (2)': { ingredients: ['Combat potion (2)', 'Caviar'], lvl: 40, xp: 28, profit: function { return data['Combat mix (2)'].price - ing['Combat potion (2)'].price - ing['Caviar'].price; },                   num: 2000 },               'Clean wergali': { ingredients: ['Grimy wergali'], lvl: 41, xp: 9.5, profit: function { return data['Clean wergali'].price - ing['Grimy wergali'].price; },                   num: 5000 },               'Prayer mix (2)': { ingredients: ['Prayer potion (2)', 'Caviar'], lvl: 42, xp: 29, profit: function { return data['Prayer mix (2)'].price - ing['Prayer potion (2)'].price - ing['Caviar'].price; },                   num: 2000 },               'Harralander tar': { ingredients: ['Clean harralander', 'Swamp tar'], lvl: 44, xp: 72.5, profit: function { return 15 * data['Harralander tar'].price - ing['Clean harralander'].price -15 * ing['Swamp tar'].price; },                   num: 1800 },               'Super attack (3)': { ingredients: ['Irit potion (unf)', 'Eye of newt'], lvl: 45, xp: 100, profit: function { return data['Super attack (3)'].price - ing['Irit potion (unf)'].price - s * ing['Eye of newt'].price; },                   num: 2000 },               'Super attack mix (2)': { ingredients: ['Super attack (2)', 'Caviar'], lvl: 47, xp: 33, profit: function { return data['Super attack mix (2)'].price - ing['Super attack (2)'].price - ing['Caviar'].price; },                   num: 2000 },               'Clean avantoe': { ingredients: ['Grimy avantoe'], lvl: 48, xp: 10, profit: function { return data['Clean avantoe'].price - ing['Grimy avantoe'].price; },                   num: 5000 },               'Super antipoison (3)': { ingredients: ['Irit potion (unf)', 'Unicorn horn dust'], lvl: 48, xp: 106.3, profit: function { return data['Super antipoison (3)'].price - ing['Irit potion (unf)'].price - s * ing['Unicorn horn dust'].price; },                   num: 2000 },               'Fishing potion (3)': { ingredients: ['Avantoe potion (unf)', 'Snape grass'], lvl: 50, xp: 112.5, profit: function { return data['Fishing potion (3)'].price - ing['Avantoe potion (unf)'].price - s * ing['Snape grass'].price; },                   num: 2000 },               'Anti-p supermix (2)': { ingredients: ['Super antipoison (2)', 'Caviar'], lvl: 51, xp: 35, profit: function { return data['Anti-p supermix (2)'].price - ing['Super antipoison (2)'].price - ing['Caviar'].price; },                   num: 2000 },               'Super energy (3)': { ingredients: ['Avantoe potion (unf)', 'Mort myre fungus'], lvl: 52, xp: 117.5, profit: function { return data['Super energy (3)'].price - ing['Avantoe potion (unf)'].price - s * ing['Mort myre fungus'].price; },                   num: 2000 },               'Hunter potion (3)': { ingredients: ['Avantoe potion (unf)', 'Kebbit teeth dust'], lvl: 53, xp: 120, profit: function { return data['Hunter potion (3)'].price - ing['Avantoe potion (unf)'].price - s * ing['Kebbit teeth dust'].price; },                   num: 2000 },               'Fishing mix (2)': { ingredients: ['Fishing potion (2)', 'Caviar'], lvl: 53, xp: 39, profit: function { return data['Fishing mix (2)'].price - ing['Fishing potion (2)'].price - ing['Caviar'].price; },                   num: 2000 },               'Clean kwuarm': { ingredients: ['Grimy kwuarm'], lvl: 54, xp: 11.3, profit: function { return data['Clean kwuarm'].price - ing['Grimy kwuarm'].price; },                   num: 5000 },               'Super strength (3)': { ingredients: ['Kwuarm potion (unf)', 'Limpwurt root'], lvl: 55, xp: 125, profit: function { return data['Super strength (3)'].price - ing['Kwuarm potion (unf)'].price - s * ing['Limpwurt root'].price; },                   num: 2000 },               'Super energy mix (2)': { ingredients: ['Super energy (2)', 'Caviar'], lvl: 56, xp: 39, profit: function { return data['Super energy mix (2)'].price - ing['Super energy (2)'].price - ing['Caviar'].price; },                   num: 2000 },               'Fletching potion (3)': { ingredients: ['Wergali potion (unf)', 'Wimpy feather'], lvl: 58, xp: 132, profit: function { return data['Fletching potion (3)'].price - ing['Wergali potion (unf)'].price - s * ing['Wimpy feather'].price; },                   num: 2500 },               'Hunting mix (2)': { ingredients: ['Hunter potion (2)', 'Caviar'], lvl: 58, xp: 40, profit: function { return data['Hunting mix (2)'].price - ing['Hunter potion (2)'].price - ing['Caviar'].price; },                   num: 2000 },               'Clean snapdragon': { ingredients: ['Grimy snapdragon'], lvl: 59, xp: 11.8, profit: function { return data['Clean snapdragon'].price - ing['Grimy snapdragon'].price; },                   num: 5000 },               'Super strength mix (2)': { ingredients: ['Super strength (2)', 'Caviar'], lvl: 59, xp: 42, profit: function { return data['Super strength mix (2)'].price - ing['Super strength (2)'].price - ing['Caviar'].price; },                   num: 2000 },               'Weapon poison (3)': { ingredients: ['Kwuarm potion (unf)', 'Dragon scale dust'], lvl: 60, xp: 137.5, profit: function { return data['Weapon poison (3)'].price - ing['Kwuarm potion (unf)'].price - s * ing['Dragon scale dust'].price; },                   num: 1100 },               'Super restore (3)': { ingredients: ['Snapdragon potion (unf)', 'Red spiders\' eggs'], lvl: 63, xp: 142.5, profit: function { return data['Super restore (3)'].price - ing['Snapdragon potion (unf)'].price - s * ing['Red spiders\' eggs'].price; },                   num: 2000 },               'Clean cadantine': { ingredients: ['Grimy cadantine'], lvl: 65, xp: 12.5, profit: function { return data['Clean cadantine'].price - ing['Grimy cadantine'].price; },                   num: 5000 },               'Super defence (3)': { ingredients: ['Cadantine potion (unf)', 'White berries'], lvl: 66, xp: 150, profit: function { return data['Super defence (3)'].price - ing['Cadantine potion (unf)'].price - s * ing['White berries'].price; },                   num: 2000 },               'Clean lantadyme': { ingredients: ['Grimy lantadyme'], lvl: 67, xp: 13.1, profit: function { return data['Clean lantadyme'].price - ing['Grimy lantadyme'].price; },                   num: 5000 },               'Super restore mix (2)': { ingredients: ['Super restore (2)', 'Caviar'], lvl: 67, xp: 48, profit: function { return data['Super restore mix (2)'].price - ing['Super restore (2)'].price - ing['Caviar'].price; },                   num: 2000 },               'Antifire (3)': { ingredients: ['Lantadyme potion (unf)', 'Dragon scale dust'], lvl: 69, xp: 157.5, profit: function { return data['Antifire (3)'].price - ing['Lantadyme potion (unf)'].price - s * ing['Dragon scale dust'].price; },                   num: 2000 },               'Clean dwarf weed': { ingredients: ['Grimy dwarf weed'], lvl: 70, xp: 13.8, profit: function { return data['Clean dwarf weed'].price - ing['Grimy dwarf weed'].price; },                   num: 5000 },               'Super defence mix (2)': { ingredients: ['Super defence (2)', 'Caviar'], lvl: 71, xp: 50, profit: function { return data['Super defence mix (2)'].price - ing['Super defence (2)'].price - ing['Caviar'].price; },                   num: 2000 },               'Super ranging potion (3)': { ingredients: ['Dwarf weed potion (unf)', 'Wine of Zamorak'], lvl: 72, xp: 162.5, profit: function { return data['Super ranging potion (3)'].price - ing['Dwarf weed potion (unf)'].price - s * ing['Wine of Zamorak'].price; },                   num: 2000 },               'Antidote+ mix (2)': { ingredients: ['Antipoison+ (2)', 'Caviar'], lvl: 74, xp: 52, profit: function { return data['Antidote+ mix (2)'].price - ing['Antipoison+ (2)'].price - ing['Caviar'].price; },                   num: 2000 },               'Clean torstol': { ingredients: ['Grimy torstol'], lvl: 75, xp: 15, profit: function { return data['Clean torstol'].price - ing['Grimy torstol'].price; },                   num: 5000 },               'Antifire mix (2)': { ingredients: ['Antifire (2)', 'Caviar'], lvl: 75, xp: 53, profit: function { return data['Antifire mix (2)'].price - ing['Antifire (2)'].price - ing['Caviar'].price; },                   num: 2000 },               'Super magic potion (3)': { ingredients: ['Lantadyme potion (unf)', 'Potato cactus'], lvl: 76, xp: 172.5, profit: function { return data['Super magic potion (3)'].price - ing['Lantadyme potion (unf)'].price - s * ing['Potato cactus'].price; },                   num: 2000 },               'Zamorak brew (3)': { ingredients: ['Torstol potion (unf)', 'Jangerberries'], lvl: 78, xp: 175, profit: function { return data['Zamorak brew (3)'].price - ing['Torstol potion (unf)'].price - s * ing['Jangerberries'].price; },                   num: 2000 },               'Super ranging mix (2)': { ingredients: ['Super ranging potion (2)', 'Caviar'], lvl: 80, xp: 54, profit: function { return data['Super ranging mix (2)'].price - ing['Super ranging potion (2)'].price - ing['Caviar'].price; },                   num: 2000 },               'Saradomin brew (3)': { ingredients: ['Toadflax potion (unf)', 'Crushed nest'], lvl: 81, xp: 180, profit: function { return data['Saradomin brew (3)'].price - ing['Toadflax potion (unf)'].price - s * ing['Crushed nest'].price; },                   num: 2000 },               'Super magic mix (2)': { ingredients: ['Super magic potion (2)', 'Caviar'], lvl: 83, xp: 57, profit: function { return data['Super magic mix (2)'].price - ing['Super magic potion (2)'].price - ing['Caviar'].price; },                   num: 2000 },               'Zamorak mix (2)': { ingredients: ['Zamorak brew (2)', 'Caviar'], lvl: 85, xp: 58, profit: function { return data['Zamorak mix (2)'].price - ing['Zamorak brew (2)'].price - ing['Caviar'].price; },                   num: 2000 },               'Clean fellstalk': { ingredients: ['Grimy fellstalk'], lvl: 91, xp: 16.8, profit: function { return data['Clean fellstalk'].price - ing['Grimy fellstalk'].price; },                   num: 5000 },               'Prayer renewal (3)': { ingredients: ['Fellstalk potion (unf)', 'Morchella mushroom'], lvl: 94, xp: 190, profit: function { return data['Prayer renewal (3)'].price - ing['Fellstalk potion (unf)'].price - s * ing['Morchella mushroom'].price; },                   num: 2000 },               'Extreme attack (3)': { ingredients: ['Super attack (3)', 'Clean avantoe'], lvl: 88, xp: 220, profit: function { return 0 - ing['Super attack (3)'].price - s * ing['Clean avantoe'].price; },                   num: 2000 },               'Extreme strength (3)': { ingredients: ['Super strength (3)', 'Clean dwarf weed'], lvl: 89, xp: 230, profit: function { return 0 - ing['Super strength (3)'].price - s * ing['Clean dwarf weed'].price; },                   num: 2000 },               'Extreme defence (3)': { ingredients: ['Super defence (3)', 'Clean lantadyme'], lvl: 90, xp: 240, profit: function { return 0 - ing['Super defence (3)'].price - s * ing['Clean lantadyme'].price; },                   num: 2000 },               'Extreme magic (3)': { ingredients: ['Super magic potion', 'Ground mud runes'], lvl: 91, xp: 250, profit: function { return 0 - ing['Super magic potion (3)'].price - s * ing['Mud rune'].price; },                   num: 1000 },               'Extreme ranging (3)': { ingredients: ['Super ranging potion', 'Grenwall spikes'], lvl: 92, xp: 260, profit: function { return 0 - ing['Super ranging potion (3)'].price - s * ing['Grenwall spikes'].price; },                   num: 2600 },               'Adrenaline potion (3)': { ingredients: ['Super energy (3)', 'Papaya fruit'], lvl: 84, xp: 200, profit: function { return 0 - ing['Super energy (3)'].price - s * ing['Papaya fruit'].price; },                   num: 2000 },               'Super antifire (3)': { ingredients: ['Antifire (3)', 'Phoenix feather'], lvl: 85, xp: 210, profit: function { return 0 - ing['Antifire (3)'].price; },                   num: 450 },               'Super prayer (3)': { ingredients: ['Prayer potion (3)', 'Wyvern bonemeal'], lvl: 94, xp: 270, profit: function { return 0 - ing['Prayer potion (3)'].price - ing['Wyvern bones'].price; },                   num: 200 },               'Overload (3)': { ingredients: ['Clean torstol', 'Super attack (3)', 'Super strength (3)', 'Super defence (3)', 'Super ranging potion (3)', 'Super magic potion (3)', 'Clean avantoe', 'Clean dwarf weed', 'Clean lantadyme', 'Ground mud runes', 'Grenwall spikes'], lvl: 96, xp: 2200, profit: function { return 0 - ( ing['Clean torstol'].price + ing['Super attack (3)'].price + ing['Super strength (3)'].price + ing['Super defence (3)'].price + ing['Super magic potion (3)'].price + ing['Super ranging potion (3)'].price + ing['Clean avantoe'].price + ing['Clean dwarf weed'].price + ing['Clean lantadyme'].price + ing['Mud rune'].price + ing['Grenwall spikes'].price ); },                   num: 240 },               'Tarromin potion (unf)': { ingredients: ['Clean tarromin', 'Vial of water'], lvl: 5, xp: 1, profit: function { return data['Tarromin potion (unf)'].price - s * ing['Clean tarromin'].price - ing['Vial of water'].price; },                   num: 2200 },               'Marrentill potion (unf)': { ingredients: ['Clean marrentill', 'Vial of water'], lvl: 9, xp: 1, profit: function { return data['Marrentill potion (unf)'].price - s * ing['Clean marrentill'].price - ing['Vial of water'].price; },                   num: 2200 },               'Harralander potion (unf)': { ingredients: ['Clean harralander', 'Vial of water'], lvl: 18, xp: 1, profit: function { return data['Harralander potion (unf)'].price - s * ing['Clean harralander'].price - ing['Vial of water'].price; },                   num: 2200 },               'Ranarr potion (unf)': { ingredients: ['Clean ranarr', 'Vial of water'], lvl: 25, xp: 1, profit: function { return data['Ranarr potion (unf)'].price - s * ing['Clean ranarr'].price - ing['Vial of water'].price; },                   num: 2200 },               'Toadflax potion (unf)': { ingredients: ['Clean toadflax', 'Vial of water'], lvl: 30, xp: 1, profit: function { return data['Toadflax potion (unf)'].price - s * ing['Clean toadflax'].price - ing['Vial of water'].price; },                   num: 2200 },               'Spirit weed potion (unf)': { ingredients: ['Clean spirit weed', 'Vial of water'], lvl: 35, xp: 1, profit: function { return data['Spirit weed potion (unf)'].price - s * ing['Clean spirit weed'].price - ing['Vial of water'].price; },                   num: 2200 },               'Irit potion (unf)': { ingredients: ['Clean irit', 'Vial of water'], lvl: 40, xp: 1, profit: function { return data['Irit potion (unf)'].price - s * ing['Clean irit'].price - ing['Vial of water'].price; },                   num: 2200 },               'Wergali potion (unf)': { ingredients: ['Clean wergali', 'Vial of water'], lvl: 41, xp: 1, profit: function { return data['Wergali potion (unf)'].price - s * ing['Clean wergali'].price - ing['Vial of water'].price; },                   num: 2200 },               'Avantoe potion (unf)': { ingredients: ['Clean avantoe', 'Vial of water'], lvl: 48, xp: 1, profit: function { return data['Avantoe potion (unf)'].price - s * ing['Clean avantoe'].price - ing['Vial of water'].price; },                   num: 2200 },               'Kwuarm potion (unf)': { ingredients: ['Clean kwuarm', 'Vial of water'], lvl: 54, xp: 1, profit: function { return data['Kwuarm potion (unf)'].price - s * ing['Clean kwuarm'].price - ing['Vial of water'].price; },                   num: 2200 },               'Snapdragon potion (unf)': { ingredients: ['Clean snapdragon', 'Vial of water'], lvl: 59, xp: 1, profit: function { return data['Snapdragon potion (unf)'].price - s * ing['Clean snapdragon'].price - ing['Vial of water'].price; },                   num: 2200 },               'Cadantine potion (unf)': { ingredients: ['Clean cadantine', 'Vial of water'], lvl: 65, xp: 1, profit: function { return data['Cadantine potion (unf)'].price - s * ing['Clean cadantine'].price - ing['Vial of water'].price; },                   num: 2200 },               'Lantadyme potion (unf)': { ingredients: ['Clean lantadyme', 'Vial of water'], lvl: 67, xp: 1, profit: function { return data['Lantadyme potion (unf)'].price - s * ing['Clean lantadyme'].price - ing['Vial of water'].price; },                   num: 2200 },               'Dwarf weed potion (unf)': { ingredients: ['Clean dwarf weed', 'Vial of water'], lvl: 70, xp: 1, profit: function { return data['Dwarf weed potion (unf)'].price - s * ing['Clean dwarf weed'].price - ing['Vial of water'].price; },                   num: 2200 },               'Weapon poison+ (3)': { ingredients: ['Coconut milk', 'Cactus spine', 'Red spiders\' eggs'], lvl: 73, xp: 166, profit: function { return data['Weapon poison+ (3)'].price - ing['Coconut milk'].price - s * ing['Cactus spine'].price - s * ing['Red spiders\' eggs'].price; },                   num: 1100 },

'Torstol potion (unf)': { ingredients: ['Clean torstol', 'Vial of water'], lvl: 75, xp: 1, profit: function { return data['Torstol potion (unf)'].price - s * ing['Clean torstol'].price - ing['Vial of water'].price; },                   num: 2200 },               'Fellstalk potion (unf)': { ingredients: ['Clean fellstalk', 'Vial of water'], lvl: 71, xp: 1, profit: function { return data['Fellstalk potion (unf)'].price - s * ing['Clean fellstalk'].price - ing['Vial of water'].price; },                   num: 2200 },               'Relicym\'s balm (3)': { ingredients: ['Vial of water', 'Clean rogue\'s purse', 'Clean snake weed'], lvl: 8, xp: 41, profit: function { return data['Relicym\'s balm (3)'].price - ing['Vial of water'].price; },                   num: 90 },               'Guthix rest (3)': { ingredients: ['Harralander potion (unf)', 'Clean marrentill'], lvl: 18, xp: 59.5, profit: function { return ing['Guthix rest (3)'].price - s * ing['Clean marrentill'].price - ing['Harralander potion (unf)'].price; },                   num: 2000 },               'Guthix balance (3) (unf)': { ingredients: ['Restore potion (3)', 'Garlic'], lvl: 22, xp: 25, profit: function { return data['Guthix balance (3) (unf)'].price -ing['Super restore (3)'].price - s * ing['Garlic'].price; },                   num: 2000 },               'Guthix balance (3)': { ingredients: ['Guthix balance (3) (unf)', 'Silver dust'], lvl: 22, xp: 25, profit: function { return data['Guthix balance (3)'].price - ing['Guthix balance (3) (unf)'].price - s * ing['Silver dust'].price; },                   num: 2000 },               'Super fishing explosive': { ingredients: ['Guam potion (unf)', 'Rubium'], lvl: 31, xp: 55, profit: function { return 0 - ing['Guam potion (unf)'].price; },                   num: 200 },               'Magic essence (3)': { ingredients: ['Vial of water', 'Starflower', 'Gorak claw powder'], lvl: 57, xp: 131, profit: function { return 0 - ing['Vial of water'].price; },                   num: 120 },               'Super Guthix rest (3)': { ingredients: ['Guthix rest (3)', 'Wine of Guthix'], lvl: 93, xp: 59.5, profit: function { return data['Super Guthix rest (3)'].price - ing['Guthix rest (3)'].price - s * ing['Wine of Guthix'].price; },                   num: 2000 },               'Super Saradomin brew (3)': { ingredients: ['Saradomin brew (3)', 'Wine of Saradomin'], lvl: 93, xp: 180, profit: function { return data['Super Saradomin brew (3)'].price - ing['Saradomin brew (3)'].price - s * ing['Wine of Saradomin'].price; },                   num: 2000 },               'Super Zamorak brew (3)': { ingredients: ['Zamorak brew (3)', 'Wine of Zamorak'], lvl: 93, xp: 180, profit: function { return data['Super Zamorak brew (3)'].price - ing['Zamorak brew (3)'].price - s * ing['Wine of Zamorak'].price; },                   num: 2000 },               'Mixture - step 1 (3)': { ingredients: ['Super restore (3)', 'Unicorn horn dust'], lvl: 65, xp: 47.5, profit: function { return data['Mixture - step 1 (3)'].price - ing['Super restore (3)'].price - s * ing['Unicorn horn dust'].price; },                   num: 2000 },               'Mixture - step 2 (3)': { ingredients: ['Mixture - step 1 (3)', 'Clean snake weed'], lvl: 65, xp: 52.5, profit: function { return data['Mixture - step 2 (3)'].price - ing['Mixture - step 1 (3)'].price; },                   num: 180 },               'Sanfew serum (3)': { ingredients: ['Mixture - step 2 (3)', 'Nail beast nails'], lvl: 65, xp: 60, profit: function { return data['Sanfew serum (3)'].price - ing['Mixture - step 2 (3)'].price - s * ing['Nail beast nails'].price; },                   num: 2000 },               'Weapon poison++ (3)': { ingredients: ['Coconut milk', 'Poison ivy berries', 'Cave nightshade'], lvl: 82, xp: 191, profit: function { return data['Weapon poison++ (3)'].price - ing['Coconut milk'].price - s * ing['Poison ivy berries'].price; },                   num: 80 },               'Antipoison++ (4)': { ingredients: ['Coconut milk', 'Clean irit', 'Magic roots'], lvl: 79, xp: 178.5, profit: function { return data['Antipoison++ (4)'].price - s * ing['Clean irit'].price - ing['Coconut milk'].price - s * ing['Magic roots'].price; },                   num: 1100 },               'Antipoison+ (4)': { ingredients: ['Coconut milk', 'Clean toadflax', 'Yew roots'], lvl: 68, xp: 156, profit: function { return data['Antipoison+ (4)'].price - s * ing['Clean toadflax'].price - ing['Coconut milk'].price - s * ing['Yew roots'].price; },                   num: 1100 },           },            // this is out ingredients object // by default each entry is an empty object which is filled out when the script runs // some entries here are duplicates of the data object // but there's negligible performance difference, so don't worry ing = { 'Grimy guam': {}, 'Guam potion (unf)': {}, 'Eye of newt': {}, 'Redberries': {}, 'Tarromin potion (unf)': {}, 'Limpwurt root': {}, 'Attack potion (2)': {}, 'Roe': {}, 'Red bead': {}, 'Yellow bead': {}, 'Black bead': {}, 'White bead': {}, 'Ranging potion (2)': {}, 'Grimy marrentill': {}, 'Marrentill potion (unf)': {}, 'Unicorn horn dust': {}, 'Antipoison (2)': {}, 'Magic potion (2)': {}, 'Relicym\'s balm (2)': {}, 'Grimy tarromin': {}, 'Strength potion (2)': {}, 'Ashes': {}, 'Clean guam': {}, 'Swamp tar': {}, 'Grimy harralander': {}, 'Harralander potion (unf)': {}, 'Red spiders\' eggs': {}, 'Restore potion (2)': {}, 'Grimy ranarr': {}, 'Chocolate dust': {}, 'Energy potion (2)': {}, 'Caviar': {}, 'Grimy toadflax': {}, 'Ranarr potion (unf)': {}, 'White berries': {}, 'Clean marrentill': {}, 'Defence potion (2)': {}, 'Toadflax potion (unf)': {}, 'Toad\'s legs': {}, 'Grimy spirit weed': {}, 'Goat horn dust': {}, 'Agility potion (2)': {}, 'Snape grass': {}, 'Clean tarromin': {}, 'Grimy irit': {}, 'Spirit weed potion (unf)': {}, 'Cockatrice egg': {}, 'Wergali potion (unf)': {}, 'Frog spawn': {}, 'Combat potion (2)': {}, 'Grimy wergali': {}, 'Prayer potion (2)': {}, 'Clean harralander': {}, 'Irit potion (unf)': {}, 'Super attack (2)': {}, 'Grimy avantoe': {}, 'Avantoe potion (unf)': {}, 'Super antipoison (2)': {}, 'Mort myre fungus': {}, 'Kebbit teeth dust': {}, 'Fishing potion (2)': {}, 'Grimy kwuarm': {}, 'Kwuarm potion (unf)': {}, 'Super energy (2)': {}, 'Wimpy feather': {}, 'Hunter potion (2)': {}, 'Grimy snapdragon': {}, 'Super strength (2)': {}, 'Coconut milk': {}, 'Cactus spine': {}, 'Snapdragon potion (unf)': {}, 'Grimy cadantine': {}, 'Cadantine potion (unf)': {}, 'Grimy lantadyme': {}, 'Super restore (2)': {}, 'Lantadyme potion (unf)': {}, 'Dragon scale dust': {}, 'Grimy dwarf weed': {}, 'Super defence (2)': {}, 'Dwarf weed potion (unf)': {}, 'Wine of Zamorak': {}, 'Antipoison+ (2)': {}, 'Grimy torstol': {}, 'Antifire (2)': {}, 'Potato cactus': {}, 'Torstol potion (unf)': {}, 'Jangerberries': {}, 'Super ranging potion (2)': {}, 'Crushed nest': {}, 'Super magic potion (2)': {}, 'Zamorak brew (2)': {}, 'Grimy fellstalk': {}, 'Fellstalk potion (unf)': {}, 'Morchella mushroom': {}, 'Clean avantoe': {}, 'Clean dwarf weed': {}, 'Super defence (3)': {}, 'Clean lantadyme': {}, 'Super magic potion (3)': {}, 'Mud rune': {}, 'Super ranging potion (3)': {}, 'Grenwall spikes': {}, 'Super energy (3)': {}, 'Papaya fruit': {}, 'Antifire (3)': {}, 'Phoenix feather': {}, 'Prayer potion (3)': {}, 'Wyvern bones': {}, 'Clean torstol': {}, 'Super attack (3)': {}, 'Super strength (3)': {}, 'Vial of water': {}, 'Clean ranarr': {}, 'Clean toadflax': {}, 'Clean spirit weed': {}, 'Clean irit': {}, 'Clean wergali': {}, 'Clean kwuarm': {}, 'Clean snapdragon': {}, 'Clean cadantine': {}, 'Clean fellstalk': {}, 'Clean rogue\'s purse': {}, 'Clean snake weed': {}, 'Restore potion (3)': {}, 'Garlic': {}, 'Guthix balance (3) (unf)': {}, 'Silver dust': {}, 'Rubium': {}, 'Starflower': {}, 'Gorak claw powder': {}, 'Guthix rest (3)': {}, 'Wine of Guthix': {}, 'Saradomin brew (3)': {}, 'Wine of Saradomin': {}, 'Zamorak brew (3)': {}, 'Super restore (3)': {}, 'Mixture - step 1 (3)': {}, 'Mixture - step 2 (3)': {}, 'Nail beast nails': {}, 'Poison ivy berries': {}, 'Cave nightshade': {}, 'Magic roots': {}, 'Yew roots': {} };

/**        * Fills out price and image keys in data * Fills out price keys in ing */       function getData { var x, text = '';

$( '#efficiency-data>tbody>tr' ).each( function {

var $td = $( this ).children( 'td' ), key, price, img;

$td.each( function ( i ) {                   if ( i === 0 ) {                        key = $( this ).text.trim;                    } else if ( i === 1 ) {                        price = $( this ).text.trim;                    } else if ( i === 2 ) {                        img = $( this ).children( 'a' ).attr( 'href' );                    }                } ); data[key].price = parseInt( price, 10 ); data[key].image = '';

} );           $( '#efficiency-ingredients>tbody>tr' ).each( function  {

var $td = $( this ).children( 'td' ), key, price;

$td.each( function ( i ) {                   if ( i === 0 ) {                        key = $( this ).text.trim;                    } else if ( i === 1 ) {                        price = $( this ).text.trim;                    }                } );

ing[key].price = parseInt( price, 10 );

} );

}

/**        *         */        function throwError( text ) {

var $result = $( '#herb-result' ); $result.empty; $result.append(               $( ' ' )                    .css( 'background', '#f00' )                    .text( error )            );

return false;

}

/**        *         */        function checkMods {

money = $( '#herb-form-income' ).val .replace( /,/g, '' );

money = parseInt( money, 10 );

// check money is a number if ( isNaN( money ) ) { throwError( 'Income must be a number.' ); return false; }

// check money is an integer if ( Math.round( money ) !== money ) { throwError( 'Income must be an integer.' ); return false; }

// check for scroll of cleansing modifier s = $( '#herb-form-scroll' ).prop( 'checked' ) ? 0.9 : 1;

return true;

}

function buildForm {

var $form = $( '#herb-form' ); $form.empty; $form.append(               $( ' ' )                    .on( 'submit', generate )                    .attr( { action: '#', id: 'herb-form-inner' } )                   .append( $( ' ';

$result.html( text );

mw.loader.using( 'jquery.tablesorter', function {                $( '#herb-table' ).tablesorter;            } );

return false; }

getData; console.log( ing, data );

return { build: buildForm };

} );

$( rswiki.efficiency.herblore.build );

} ( this.jQuery, this.rswiki = this.rswiki || {} ) );