MediaWiki:Gadget-idle-data.js: Difference between revisions

From Idle Clans wiki
(Created page with ";(function($, mw, idleClans) { const data = { →‎* * Automatically generated experience table for levels 1 to 120, shouldn't * be manually modified.: EXP_TABLE: [ 0 →‎Level 1: , 75, 150, 226, 302, 378, 455, 607, 759, 911, 1_063, 1_216, 1_369, 1_522, 1_826, 2_130, 2_434, 2_738, 3_042, 3_347, 3_652, 4_257, 4_863, 5_469,...")
 
No edit summary
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
;(function($, mw, idleClans) {
;(function($, mw, idleClans) {
const data = {
var data = {
/**
/**
* Automatically generated experience table for levels 1 to 120, shouldn't
* Automatically generated experience table for levels 1 to 120, shouldn't
* be manually modified.
* be manually modified.
*/
*/
EXP_TABLE: [ 0 /* Level 1 */,
EXP_TABLE: [
        75,       150,        226,        302,        378,        455,        607,        759,        911,      1_063,
0,       75,       151,      227,      303,      380,      531,      683,      836,      988,
    1_216,      1_369,      1_522,      1_826,      2_130,      2_434,      2_738,      3_042,      3_347,      3_652,
1141,    1294,    1447,    1751,    2054,    2358,    2663,    2967,    3272,    3577,
    4_257,      4_863,      5_469,      6_075,      6_681,      7_287,      7_894,      9_101,    10_308,    11_516,
4182,    4788,    5393,    5999,    6606,    7212,    7819,    9026,    10233,   11441,
    12_724,    13_932,    15_140,    16_348,    18_757,    21_166,    23_575,    25_985,    28_395,    30_805,
12648,    13856,    15065,    16273,    18682,    21091,    23500,    25910,    28319,    30729,
    33_215,    38_025,    42_836,    47_647,    52_458,    57_270,    62_082,    66_894,    76_506,     86_118,
33140,    37950,    42761,    47572,    52383,    57195,    62006,    66818,    76431,    86043,
    95_731,    105_344,    114_957,    124_571,    134_185,    153_399,    172_613,    191_827,    211_042,    230_257,
95656,    105269,  114882,  124496,  134109,  153323,  172538,  191752,  210967,  230182,
  249_472,    268_688,    307_104,    345_520,    383_936,    422_352,    460_769,    499_186,    537_603,    614_421,
249397,  268613,  307028,  345444,   383861,  422277,  460694,  499111,  537528,  614346,
  691_239,    768_057,   844_875,   921_693,   998_512, 1_075_3311_228_9501_382_5701_536_1901_689_810,
691163,  767981,  844800,   921618,   998437,   10752561228875138249515361141689734,
1_843_4301_997_0502_150_6712_457_8922_765_1133_072_3353_379_5573_686_7793_994_0014_301_223,
1843355199697521505962457817276503830722603379481368670339939264301148,
4_915_6465_530_0696_144_4926_758_9167_373_3407_987_7648_602_1889_831_012, 11_059_837, 12_288_662,
49155715529994614441767588417373264798768886021139830937, 11059762, 12288587,
13_517_487, 14_746_313, 15_975_139, 17_203_965, 19_661_591, 22_119_217, 24_576_844, 27_034_471, 29_492_098, 31_949_726,
13517412, 14746238, 15975063, 17203889, 19661516, 22119142, 24576769, 27034396, 29492023, 31949651,
34_407_354, 39_322_582, 44_237_810, 49_153_038, 54_068_267, 58_983_496, 63_898_725, 68_813_955, 78_644_385, 88_474_815
34407278, 39322506, 44237735, 49152963, 54068192, 58983421, 63898650, 68813880, 78644309, 88474739
],
],


Line 49: Line 49:
if (xp >= this.EXP_TABLE[this.EXP_TABLE.length - 1]) return 120;
if (xp >= this.EXP_TABLE[this.EXP_TABLE.length - 1]) return 120;


for (let i = this.EXP_TABLE.length - 1; i >= 0; i--) {
for (var i = this.EXP_TABLE.length - 1; i >= 0; i--) {
if (this.EXP_TABLE[i] <= xp) {
if (this.EXP_TABLE[i] <= xp) {
return i + 1;
return i + 1;
Line 82: Line 82:
* The boost gained from the daily ad boost.
* The boost gained from the daily ad boost.
*/
*/
DAILY_AD: 0.3,
DAILY_AD: 0.3
},
},


Line 100: Line 100:
/**
/**
* The enchantment speed boost for each scroll tier, starting at tier 0
* The enchantment speed boost for each scroll tier, starting at tier 0
* (common) and ending at tier 2 (exceptional).
* (no enchantment) and ending at tier 3 (exceptional).
*/
*/
ENCHANTMENTS: [0.015, 0.03, 0.05],
ENCHANTMENTS: [0, 0.015, 0.03, 0.05],


/**
/**
Line 117: Line 117:
*/
*/
getEnchantmentBoost: function(tier, ancientKnowledge) {
getEnchantmentBoost: function(tier, ancientKnowledge) {
if (tier < 0 || tier > 2) return NaN;
if (tier < 0 || tier > this.ENCHANTMENTS.length - 1) return NaN;
if (tier === 0) return 0;


let boost = this.ENCHANTMENTS[tier];
var boost = this.ENCHANTMENTS[tier];
if (ancientKnowledge)
if (ancientKnowledge)
boost *= this.other.POTION_OF_ANCIENT_KNOWLEDGE;
boost *= data.boosts.other.POTION_OF_ANCIENT_KNOWLEDGE;


return boost;
return boost;
},
}
},
},


Line 141: Line 142:
* How many times you can claim the daily ad boost per day.
* How many times you can claim the daily ad boost per day.
*/
*/
DAILY_AD_AMOUNT: 4,
DAILY_AD_AMOUNT: 4
}
}


Line 162: Line 163:
{ name: "Pufferfish",  levelReq: 60,  exp: 105,  time: 12.5  },
{ name: "Pufferfish",  levelReq: 60,  exp: 105,  time: 12.5  },
{ name: "Anglerfish",  levelReq: 70,  exp: 155,  time: 17.5  },
{ name: "Anglerfish",  levelReq: 70,  exp: 155,  time: 17.5  },
{ name: "Tuna",        levelReq: 85,  exp: 331.5, time: 26.},
{ name: "Tuna",        levelReq: 85,  exp: 255,   time: 26.25 },


{ name: "Meat",        levelReq: 10,  exp: 30,    time: 3    },
{ name: "Meat",        levelReq: 10,  exp: 30,    time: 2.5  },
{ name: "Giant Meat",  levelReq: 30,  exp: 60,    time: 4    },
{ name: "Giant Meat",  levelReq: 30,  exp: 60,    time: 4    },
{ name: "Quality Meat", levelReq: 60,  exp: 120,  time: 6    },
{ name: "Quality Meat", levelReq: 60,  exp: 120,  time: 6    },
Line 192: Line 193:
*/
*/
getTask: function(skill, task) {
getTask: function(skill, task) {
const tasks = this[skill.toUpperCase()];
var tasks = this[skill.toUpperCase()];
if (!tasks) return null;
if (!tasks) return null;


Line 202: Line 203:


// It must be a string.
// It must be a string.
for (let i = 0; i < tasks.length; i++) {
for (var i = 0; i < tasks.length; i++) {
if (tasks[i].name.toLowerCase() === task.toLowerCase())
if (tasks[i].name.toLowerCase() === task.toLowerCase())
return tasks[i];
return tasks[i];

Latest revision as of 06:51, 11 June 2024

;(function($, mw, idleClans) {
var data = {
	/**
	 * Automatically generated experience table for levels 1 to 120, shouldn't
	 * be manually modified.
	 */
	EXP_TABLE: [
		0,        75,       151,      227,      303,      380,      531,      683,      836,      988,
		1141,     1294,     1447,     1751,     2054,     2358,     2663,     2967,     3272,     3577,
		4182,     4788,     5393,     5999,     6606,     7212,     7819,     9026,     10233,    11441,
		12648,    13856,    15065,    16273,    18682,    21091,    23500,    25910,    28319,    30729,
		33140,    37950,    42761,    47572,    52383,    57195,    62006,    66818,    76431,    86043,
		95656,    105269,   114882,   124496,   134109,   153323,   172538,   191752,   210967,   230182,
		249397,   268613,   307028,   345444,   383861,   422277,   460694,   499111,   537528,   614346,
		691163,   767981,   844800,   921618,   998437,   1075256,  1228875,  1382495,  1536114,  1689734,
		1843355,  1996975,  2150596,  2457817,  2765038,  3072260,  3379481,  3686703,  3993926,  4301148,
		4915571,  5529994,  6144417,  6758841,  7373264,  7987688,  8602113,  9830937,  11059762, 12288587,
		13517412, 14746238, 15975063, 17203889, 19661516, 22119142, 24576769, 27034396, 29492023, 31949651,
		34407278, 39322506, 44237735, 49152963, 54068192, 58983421, 63898650, 68813880, 78644309, 88474739
	],

	/**
	 * Get the experience required for a specific level.
	 *
	 * @param   {number} level
	 *          The level to get the experience for, will be clamped to the
	 *          range of 1 to 120.
	 *
	 * @returns {number}
	 *          The experience required for the specified level.
	 */
	getExperienceForLevel: function(level) {
		level = Math.max(1, Math.min(120, level));
		return this.EXP_TABLE[level - 1];
	},

	/**
	 * Get the level for a specific amount of experience.
	 *
	 * @param   {number} xp
	 *          The amount of experience to get the level for, will be clamped
	 *          to the range of 0 to the maximum experience for level 120.
	 *
	 * @returns {number}
	 *          The level for the specified amount of experience.
	 */
	getLevelForExperience: function(xp) {
		if (xp <= 0) return 1;
		if (xp >= this.EXP_TABLE[this.EXP_TABLE.length - 1]) return 120;

		for (var i = this.EXP_TABLE.length - 1; i >= 0; i--) {
			if (this.EXP_TABLE[i] <= xp) {
				return i + 1;
			}
		}
	},

	/*
	 * Boosts
	 */

	boosts: {
		/*
		 * Values are in percentages, so a value of 0.05 means a 5% boost, 0.5
		 * is a 50% boost, etc.
		 */

		experience: {
			/**
			 * Clan house boost for each tier, starting at tier 0 (no house) and
			 * ending at tier 6 (maxed clan house).
			 */
			CLAN_HOUSE: [0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3],

			/**
			 * The personal house boost for each tier, starting at tier 0 (no house)
			 * and ending at tier 5 (maxed house).
			 */
			PERSONAL_HOUSE: [0, 0.05, 0.1, 0.15, 0.2, 0.25],

			/**
			 * The boost gained from the daily ad boost.
			 */
			DAILY_AD: 0.3
		},

		speed: {
			/**
			 * The skill item boost for each tier, starting at tier 0 (no item)
			 * and ending at tier 7 (godlike item).
			 */
			SKILL_ITEM: [0, 0.04, 0.06, 0.08, 0.1, 0.12, 0.15, 0.2],

			/**
			 * The skill cape boost for each tier, starting at tier 0 (no cape) and
			 * ending at tier 4 (maxed skill cape).
			 */
			SKILL_CAPE: [0, 0.05, 0.1, 0.15, 0.2],

			/**
			 * The enchantment speed boost for each scroll tier, starting at tier 0
			 * (no enchantment) and ending at tier 3 (exceptional).
			 */
			ENCHANTMENTS: [0, 0.015, 0.03, 0.05],

			/**
			 * Get the speed boost for a specific enchantment scroll tier.
			 *
			 * @param   {number} tier
			 *          The tier of the enchantment scroll.
			 * @param   {boolean} ancientKnowledge
			 *          If we're using the ancient knowledge boost.
			 *
			 * @returns {number}
			 *          The speed boost for the specified enchantment scroll tier,
			 *          or NaN if the tier is out of range.
			 */
			getEnchantmentBoost: function(tier, ancientKnowledge) {
				if (tier < 0 || tier > this.ENCHANTMENTS.length - 1) return NaN;
				if (tier === 0) return 0;

				var boost = this.ENCHANTMENTS[tier];
				if (ancientKnowledge)
					boost *= data.boosts.other.POTION_OF_ANCIENT_KNOWLEDGE;

				return boost;
			}
		},

		other: {
			/**
			 * The boost Potion of Ancient Knowledge gives to enchantment scrolls.
			 */
			POTION_OF_ANCIENT_KNOWLEDGE: 1.5,

			/**
			 * How long the daily ad boost lasts in hours.
			 */
			DAILY_AD_HOURS: 2,

			/**
			 * How many times you can claim the daily ad boost per day.
			 */
			DAILY_AD_AMOUNT: 4
		}

	},

	/*
	 * Skills
	 */

	tasks: {
		COOKING: [
			{ name: "Piranha",      levelReq: 1,    exp: 10,    time: 3     },
			{ name: "Perch",        levelReq: 10,   exp: 16,    time: 3.5   },
			{ name: "Mackerel",     levelReq: 15,   exp: 20,    time: 4     },
			{ name: "Cod",          levelReq: 20,   exp: 26,    time: 4.5   },
			{ name: "Trout",        levelReq: 25,   exp: 33,    time: 5     },
			{ name: "Salmon",       levelReq: 30,   exp: 40,    time: 6     },
			{ name: "Carp",         levelReq: 40,   exp: 56,    time: 7.5   },
			{ name: "Zander",       levelReq: 50,   exp: 80,    time: 10    },
			{ name: "Pufferfish",   levelReq: 60,   exp: 105,   time: 12.5  },
			{ name: "Anglerfish",   levelReq: 70,   exp: 155,   time: 17.5  },
			{ name: "Tuna",         levelReq: 85,   exp: 255,   time: 26.25 },

			{ name: "Meat",         levelReq: 10,   exp: 30,    time: 2.5   },
			{ name: "Giant Meat",   levelReq: 30,   exp: 60,    time: 4     },
			{ name: "Quality Meat", levelReq: 60,   exp: 120,   time: 6     },
			{ name: "Superior Meat",levelReq: 90,   exp: 250,   time: 10    },

			{ name: "Potato Soup",  levelReq: 20,   exp: 40,    time: 2.5   },
			{ name: "Meat Burger",  levelReq: 20,   exp: 75,    time: 4     },
			{ name: "Cod Soup",     levelReq: 40,   exp: 150,   time: 5.5   },
			{ name: "Blueberry Pie",levelReq: 50,   exp: 200,   time: 6     },
			{ name: "Salmon Salad", levelReq: 60,   exp: 250,   time: 7     },
			{ name: "Porcini Soup", levelReq: 70,   exp: 400,   time: 8     },
			{ name: "Beef Stew",    levelReq: 80,   exp: 550,   time: 9     },
			{ name: "Power Pizza",  levelReq: 95,   exp: 750,   time: 10    }
		],

		/**
		 * Get the task in a given skill by either the name or the index of the
		 * task.
		 *
		 * @param   {string} skill
		 *          The skill to get the task for.
		 * @param   {string|number} task
		 *          The name of the task to get.
		 *
		 * @returns {{name: string, levelReq: number, exp: number, time: number}|null}
		 *          The task with the specified name, or null if no task was found.
		 */
		getTask: function(skill, task) {
			var tasks = this[skill.toUpperCase()];
			if (!tasks) return null;

			// Check if the task is a number
			if (typeof task === "number") {
				if (task < 0 || task >= tasks.length) return null;
				return tasks[task];
			}

			// It must be a string.
			for (var i = 0; i < tasks.length; i++) {
				if (tasks[i].name.toLowerCase() === task.toLowerCase())
					return tasks[i];
			}

			return null;
		}
	}
};

// Add the data object to the idleClans object.
idleClans.data = data;

})(window.jQuery, window.mw, window.idleClans = window.idleClans || {});