Difference between revisions of "Module:Enchantment/data/doc"

From Idlescape Wiki
Jump to navigation Jump to search
m
(Update instructions, notices and js code for enchantments.)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 
<includeonly>[[Category:Module]][[Category:Data Module]]</includeonly>
 
<includeonly>[[Category:Module]][[Category:Data Module]]</includeonly>
JS code to copy into browser console to get JSON.
+
As this module includes functions, it has to be imported into other modules with require(), instead of using mw.loadData()
 +
 
 +
 
 +
When adding new enchantments getTooltip() has to be manually transpiled and added to the final data.<br>
 +
https://github.com/Roblox/js-to-lua might help, but probably not worth the time and hassle for a few edits/additions.<br>
 +
Keep round() and toFixed() when updating the file as they're used by some of the getTooltip functions.
 +
 
 +
 
 +
JS code to copy into browser console to get JSON:
 
<syntaxhighlight lang="js">
 
<syntaxhighlight lang="js">
 
var enchants = Idlescape.data.enchantments
 
var enchants = Idlescape.data.enchantments

Latest revision as of 20:24, 6 May 2025

As this module includes functions, it has to be imported into other modules with require(), instead of using mw.loadData()


When adding new enchantments getTooltip() has to be manually transpiled and added to the final data.
https://github.com/Roblox/js-to-lua might help, but probably not worth the time and hassle for a few edits/additions.
Keep round() and toFixed() when updating the file as they're used by some of the getTooltip functions.


JS code to copy into browser console to get JSON:

var enchants = Idlescape.data.enchantments
for (var id in enchants) {
  enchants[id].desc = enchants[id].getTooltip(1, enchants[id].strengthPerLevel)
}
JSON.stringify(enchants)