MediaWiki:Gadget-calc-cooking.js: Difference between revisions
From Idle Clans wiki
No edit summary |
No edit summary |
||
Line 57: | Line 57: | ||
var $braceletDropdown = utils.ui.dropdown(ENCHANTMENTS, 0); | var $braceletDropdown = utils.ui.dropdown(ENCHANTMENTS, 0); | ||
var $poakDropdown = utils.ui.dropdown(["No", "Yes"], 0); | var $poakDropdown = utils.ui.dropdown(["No", "Yes"], 0); | ||
// Task | |||
var taskOptions = idleClans.data.tasks.COOKING.map(function (task) { | |||
return task.name; | |||
}); |
Revision as of 19:22, 10 June 2024
$(function () { var CLAN_HOUSES = ["Tent", "Barn", "Windmill", "House", "Manor", "Castle"]; var PERSONAL_HOUSES = ["Cardboard box", "Tent", "Van Down by the River", "Small cabin", "House"]; var SKILL_CAPE = ["None", "Tier 1", "Tier 2", "Tier 3", "Tier 4"]; var ENCHANTMENTS = ["None", "Common", "Rare", "Exceptional"]; var utils = idleClans.util; var data = idleClans.data; function addDropdown($element, $dropdown, title, alignment) { alignment = alignment || "left"; $element.append("<div class='calc-label-" + alignment + "'>" + title + "</div>"); $element.append($dropdown.$element); } function addHeader($element, title) { $element.append("<div class='calc-header'>" + title + "</div>"); } function addResultEntry($element, label, $result) { var $entry = $("<div class='calc-result-entry'></div>"); $entry.append($("<div class='label'><span>" + label + "</span></div>"), $result); var $value = $("<div class='value'></div>"); $value.append($result); $entry.append($value); $element.append($entry); } function addResultSpacer($element) { $element.append("<div class='calc-result-spacer'></div>"); } function getDropdownValue($dropdown) { return $dropdown.getMenu().findSelectedItem().getData(); } function createCalculator($element) { $element.addClass("idle-calculator"); // XP var $clanHouseDropdown = utils.ui.dropdown(utils.tierify(CLAN_HOUSES, "None"), 0); var $personalHouseDropdown = utils.ui.dropdown(utils.tierify(PERSONAL_HOUSES, "None"), 0); var $dailyAdDropdown = utils.ui.dropdown(["None", "30%", "24/7 (10%)"], 0); // Speed var skillingItemOptions = utils.tierify( [ function(i) {return utils.getRefinedName("cooking pan", i)}, 7 ], "None"); var $skillItemDropdown = utils.ui.dropdown(skillingItemOptions, 0); var $skillCapeDropdown = utils.ui.dropdown(SKILL_CAPE, 0); // - Enchantments var $amuletDropdown = utils.ui.dropdown(ENCHANTMENTS, 0); var $earringDropdown = utils.ui.dropdown(ENCHANTMENTS, 0); var $ringDropdown = utils.ui.dropdown(ENCHANTMENTS, 0); var $braceletDropdown = utils.ui.dropdown(ENCHANTMENTS, 0); var $poakDropdown = utils.ui.dropdown(["No", "Yes"], 0); // Task var taskOptions = idleClans.data.tasks.COOKING.map(function (task) { return task.name; });