Anonymous

Module:Sandbox/Skills/data: Difference between revisions

From Melvor Idle
m
no edit summary
m (1.0 testing: Constants)
mNo edit summary
Line 1: Line 1:
-- Version: ALPHA V0.22.1 (?1183)
-- Version: PUBLIC BETA V1.0 (?1274)


--[[Generated from the console via
--[[Generated from the console via
var txt = JSON.stringify(CONSTANTS)
(function() {
txt = txt.replace(/\'/g, "\\\'")
  var getGameVersion = function() {
txt = txt.replace(/\\\"/g, "\\\\\"")
      var elemNavHeader = document.getElementsByClassName("nav-main-heading")
var fullText = "local Constants = mw.text.jsonDecode('" + txt + "')"
      if (elemNavHeader.length > 0) {
        var verElem = Array.from(elemNavHeader).filter((i, idx) => i.innerText.toLowerCase().startsWith(gameVersion.toLowerCase()))[0]
        if (verElem !== undefined) {
          return verElem.innerText
        }
      }
      return gameVersion
    }


var wikiSlayerItems = new Set()
  var fullText = "-- Version: " + getGameVersion()
SHOP.Slayer.filter((i) => i.contains.items !== undefined && i.contains.items.length == 1).forEach((i) => wikiSlayerItems.add(i.contains.items[0][0]))
txt = JSON.stringify(Array.from(wikiSlayerItems))
txt = txt.replace(/\'/g, "\\\'")
txt = txt.replace(/\\\"/g, "\\\\\"")
fullText += "\r\n\r\nConstants.Shop = {}\r\nConstants.Shop.SlayerItems = mw.text.jsonDecode('" + txt + "')"


txt = JSON.stringify(SHOP.Slayer.filter((i) => i.name.includes('Resupply')))
  var txt = JSON.stringify(CONSTANTS)
txt = txt.replace(/\'/g, "\\\'")
  txt = txt.replace(/\'/g, "\\\'")
txt = txt.replace(/\\\"/g, "\\\\\"")
  txt = txt.replace(/\\\"/g, "\\\\\"")
fullText += "\r\n\r\nConstants.Shop.Packs = mw.text.jsonDecode('" + txt + "')"
  fullText = fullText + "\r\n\r\nlocal Constants = mw.text.jsonDecode('" + txt + "')"


txt = JSON.stringify(Object.values(SlayerTask.data).sort(function(a, b) { return a.minLevel - b.minLevel; }))
  var wikiSlayerItems = new Set()
txt = txt.replace(/\'/g, "\\\'")
  SHOP.Slayer.filter((i) => i.contains.items !== undefined && i.contains.items.length == 1).forEach((i) => wikiSlayerItems.add(i.contains.items[0][0]))
txt = txt.replace(/\\\"/g, "\\\\\"")
  txt = JSON.stringify(Array.from(wikiSlayerItems))
fullText += "\r\n\r\nConstants.Slayer = {}\r\nConstants.Slayer.Tiers = mw.text.jsonDecode('" + txt + "')"
  txt = txt.replace(/\'/g, "\\\'")
  txt = txt.replace(/\\\"/g, "\\\\\"")
  fullText += "\r\n\r\nConstants.Shop = {}\r\nConstants.Shop.SlayerItems = mw.text.jsonDecode('" + txt + "')"


fullText += "\r\n\r\nreturn Constants"
  txt = JSON.stringify(SHOP.Slayer.filter((i) => i.name.includes('Resupply')))
console.log(fullText)
  txt = txt.replace(/\'/g, "\\\'")
  txt = txt.replace(/\\\"/g, "\\\\\"")
  fullText += "\r\n\r\nConstants.Shop.Packs = mw.text.jsonDecode('" + txt + "')"
 
  txt = JSON.stringify(Object.values(SlayerTask.data).sort(function(a, b) { return a.minLevel - b.minLevel; }))
  txt = txt.replace(/\'/g, "\\\'")
  txt = txt.replace(/\\\"/g, "\\\\\"")
  fullText += "\r\n\r\nConstants.Slayer = {}\r\nConstants.Slayer.Tiers = mw.text.jsonDecode('" + txt + "')"
 
  fullText += "\r\n\r\nreturn Constants"
  console.log(fullText)
})()
--]]
--]]


local
local


Constants.Shop = {}
Constants.Shop = {}