Module:Sandbox/Skills/data: Difference between revisions

Add Herblore potion tier levels
m (1.0 testing: Constants)
(Add Herblore potion tier levels)
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
-- Version: ALPHA V0.22.1 (?1183)
-- Version: V1.0.3 (?1806)


--[[Generated from the console via
--[[Generated from console via
var txt = JSON.stringify(CONSTANTS)
(function() {
txt = txt.replace(/\'/g, "\\\'")
  var getGameVersion = function() {
txt = txt.replace(/\\\"/g, "\\\\\"")
      var elemVer = document.querySelector("li[data-target='#modal-major-update']:not(.d-none)")
var fullText = "local Constants = mw.text.jsonDecode('" + txt + "')"
      if (elemVer !== undefined) {
      return elemVer.innerText
      }
      else {
        return gameVersion
      }
    }
  var formatJSON = function(txt) {
  var out = JSON.stringify(txt)
  out = out.replace(/\'/g, "\\\'")
  out = out.replace(/\\\"/g, "\\\\\"")
  return out
  }


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]))
  fullText += "\r\n\r\nlocal SkillData = {}"
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')))
  fullText += "\r\n\r\nSkillData.Skills = mw.text.jsonDecode('" + formatJSON(SKILLS) + "')"
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; }))
  // Prayer
txt = txt.replace(/\'/g, "\\\'")
  fullText += "\r\n\r\nSkillData.Prayer = mw.text.jsonDecode('" + formatJSON(PRAYER) + "')"
txt = txt.replace(/\\\"/g, "\\\\\"")
fullText += "\r\n\r\nConstants.Slayer = {}\r\nConstants.Slayer.Tiers = mw.text.jsonDecode('" + txt + "')"


fullText += "\r\n\r\nreturn Constants"
  // Woodcutting
console.log(fullText)
  fullText += "\r\n\r\nSkillData.Woodcutting = {}"
  fullText += "\r\nSkillData.Woodcutting.Trees = mw.text.jsonDecode('" + formatJSON(Woodcutting.trees) + "')"
 
  // Fishing
  fullText += "\r\n\r\nSkillData.Fishing = {}"
  fullText += "\r\nSkillData.Fishing.Fish = mw.text.jsonDecode('" + formatJSON(Fishing.data) + "')"
  fullText += "\r\nSkillData.Fishing.Areas = mw.text.jsonDecode('" + formatJSON(Fishing.areas) + "')"
  fullText += "\r\nSkillData.Fishing.JunkItems = mw.text.jsonDecode('" + formatJSON(Fishing.junkItems) + "')"
  fullText += "\r\nSkillData.Fishing.SpecialItems = mw.text.jsonDecode('" + formatJSON(Fishing.specialItems) + "')"
 
  // Firemaking
  fullText += "\r\n\r\nSkillData.Firemaking = mw.text.jsonDecode('" + formatJSON(Firemaking.recipes) + "')"
 
  // Cooking
  fullText += "\r\n\r\nSkillData.Cooking = {}"
  fullText += "\r\nSkillData.Cooking.Recipes = mw.text.jsonDecode('" + formatJSON(Cooking.recipes) + "')"
 
  // Mining
  fullText += "\r\n\r\nSkillData.Mining = {}"
  fullText += "\r\nSkillData.Mining.Rocks = mw.text.jsonDecode('" + formatJSON(Mining.rockData) + "')"
 
  // Smithing
  fullText += "\r\n\r\nSkillData.Smithing = {}"
  fullText += "\r\nSkillData.Smithing.Recipes = mw.text.jsonDecode('" + formatJSON(Smithing.recipes) + "')"
 
  // Thieving
  fullText += "\r\n\r\nSkillData.Thieving = {}"
  fullText += "\r\nSkillData.Thieving.NPCs = mw.text.jsonDecode('" + formatJSON(Thieving.npcs) + "')"
  fullText += "\r\nSkillData.Thieving.Areas = mw.text.jsonDecode('" + formatJSON(Thieving.areas) + "')"
  fullText += "\r\nSkillData.Thieving.RareItems = mw.text.jsonDecode('" + formatJSON(Thieving.generalRareItems) + "')"
 
  // Farming
  // The below function returns a modified version of newFarmingAreas, removing various properties
  // from each patch object that relate to what the user has planted & are therefore useless for
  // wiki purposes. Not required, but simply makes the data cleaner.
  function wikiGetFarmingAreas() {
    let allowedPatchKeys = ['level', 'cost']
    let wikiFarmingAreas = []
    for (i = 0; i < newFarmingAreas.length; i++) {
      let keyList = Object.keys(newFarmingAreas[i]).filter((n) => n !== 'patches')
      let newPatches = []
      let newArea = {}
      for (j = 0; j < newFarmingAreas[i].patches.length; j++) {
        let newPatch = {}
        allowedPatchKeys.forEach((k) => newPatch[k] = newFarmingAreas[i].patches[j][k])
        newPatches[j] = newPatch
      }
      keyList.forEach((n) => newArea[n] = newFarmingAreas[i][n])
      newArea['patches'] = newPatches
      wikiFarmingAreas[i] = newArea
    }
    return wikiFarmingAreas
  }
  fullText += "\r\n\r\nSkillData.Farming = {}"
  fullText += "\r\nSkillData.Farming.Patches = mw.text.jsonDecode('" + formatJSON(wikiGetFarmingAreas()) + "')"
 
  // Fletching
  fullText += "\r\n\r\nSkillData.Fletching = {}"
  fullText += "\r\nSkillData.Fletching.Recipes = mw.text.jsonDecode('" + formatJSON(Fletching.recipes) + "')"
 
  // Crafting
  fullText += "\r\n\r\nSkillData.Crafting = {}"
  fullText += "\r\nSkillData.Crafting.Recipes = mw.text.jsonDecode('" + formatJSON(Crafting.recipes) + "')"
 
  // Runecrafting
  fullText += "\r\n\r\nSkillData.Runecrafting = {}"
  fullText += "\r\nSkillData.Runecrafting.Recipes = mw.text.jsonDecode('" + formatJSON(Runecrafting.recipes) + "')"
 
  // Herblore
  fullText += "\r\n\r\nSkillData.Herblore = {}"
  fullText += "\r\nSkillData.Herblore.Potions = mw.text.jsonDecode('" + formatJSON(Herblore.potions) + "')"
  fullText += "\r\nSkillData.Herblore.TierMasteryLevels = mw.text.jsonDecode('" + formatJSON(Herblore.tierMasteryLevels) + "')"
 
  // Agility
  fullText += "\r\n\r\nSkillData.Agility = {}"
  fullText += "\r\nSkillData.Agility.Obstacles = mw.text.jsonDecode('" + formatJSON(Agility.obstacles) + "')"
  fullText += "\r\nSkillData.Agility.Pillars = mw.text.jsonDecode('" + formatJSON(Agility.passivePillars) + "')"
 
  // Summoning
  fullText += "\r\n\r\nSkillData.Summoning = {}"
  fullText += "\r\nSkillData.Summoning.RecipeGPCost = mw.text.jsonDecode('" + formatJSON(Summoning.recipeGPCost) + "')"
  fullText += "\r\nSkillData.Summoning.MarkLevels = mw.text.jsonDecode('" + formatJSON(Summoning.markLevels) + "')"
  fullText += "\r\nSkillData.Summoning.Marks = mw.text.jsonDecode('" + formatJSON(Summoning.marks) + "')"
  fullText += "\r\nSkillData.Summoning.Synergies = mw.text.jsonDecode('" + formatJSON(Summoning.synergies) + "')"
 
  // Astrology
  fullText += "\r\n\r\nSkillData.Astrology = {}"
  fullText += "\r\nSkillData.Astrology.Constellations = mw.text.jsonDecode('" + formatJSON(Astrology.constellations) + "')"
  fullText += "\r\nSkillData.Astrology.BaseStardustChance = mw.text.jsonDecode('" + formatJSON(Astrology.baseStardustChance) + "')"
  fullText += "\r\nSkillData.Astrology.BaseGoldenStardustChance = mw.text.jsonDecode('" + formatJSON(Astrology.baseGoldenStardustChance) + "')"
  fullText += "\r\nSkillData.Astrology.BaseInterval = mw.text.jsonDecode('" + formatJSON(Astrology.baseInterval) + "')"
  fullText += "\r\nSkillData.Astrology.ModifierMagnitudeChances = mw.text.jsonDecode('" + formatJSON(Astrology.modifierMagnitudeChances) + "')"
 
  // Mastery
  var skillKeys = Object.keys(SKILLS);
  var tempUnlocks = {};
  for(var i = 0; i < skillKeys.length; i++) {
  var key = skillKeys[i];
  if(SKILLS[key].hasMastery){
  var chkArray = [];
  var unlockArray = masteryUnlocks[key];
  for(var j = 0; j < unlockArray.length; j++) {
  chkArray[j] = {level: unlockArray[j].level, unlock: getMasteryUnlock(key, j)}
  }
  tempUnlocks[key] = chkArray;
  }
  }
  fullText += "\r\n\r\nSkillData.MasteryUnlocks = mw.text.jsonDecode('" + formatJSON(tempUnlocks) + "')"
 
  var tempCheckpoints = {};
  for(var i = 0; i < skillKeys.length; i++) {
  var key = skillKeys[i];
  if(SKILLS[key].hasMastery){
  var chkArray = [];
  for(var j = 0; j < 4; j++) {
  chkArray[j] = getMasteryCheckpointBonus(key, j)
  }
  tempCheckpoints[key] = {bonuses: chkArray};
  }
  }
  fullText += "\r\n\r\nSkillData.MasteryCheckpoints = mw.text.jsonDecode('" + formatJSON(tempCheckpoints) + "')"
 
  var MasteryPoolXP = []
  for(var i = 0; i < skillKeys.length; i++){
  var key = skillKeys[i];
  if(SKILLS[key].hasMastery){
  MasteryPoolXP[key] = getMasteryPoolTotalXP(key);
  }
  }
  fullText += "\r\n\r\nSkillData.MasteryPoolXP = mw.text.jsonDecode('" + formatJSON(MasteryPoolXP) + "')"
 
  var skillMilestones = Object.keys(SKILLS).map(function(s) { if (MILESTONES[SKILLS[s].name] === undefined) { return null } else { return MILESTONES[SKILLS[s].name].length } })
  fullText += "\r\n\r\nSkillData.Milestones = mw.text.jsonDecode('" + formatJSON(skillMilestones) + "')"
 
  // Adventure mode skill unlock costs
  fullText += "\r\n\r\nSkillData.SkillUnlockCosts = mw.text.jsonDecode('" + formatJSON(priceToUnlockSkill) + "')"
 
  fullText += "\r\n\r\nreturn SkillData"
  console.log(fullText)
})()
--]]
--]]


local
local SkillData = {}
 
SkillData.Skills = mw.text.jsonDecode('{"0":{"name":"Woodcutting","media":"assets/media/skills/woodcutting/woodcutting.svg","hasMastery":true,"masteryTokenID":481,"maxLevel":99


Constants.Shop = {}
SkillData.MasteryPoolXP = mw.text.jsonDecode('[4500000,11500000,4500000,15500000,5500000,57500000,null,null,null,null,11500000,12000000,null,28500000,27500000,42000000,null,null,null,15000000,25500000,10000000,5500000]')
Constants.Shop.SlayerItems = mw.text.jsonDecode('[494,502,904,905,906,805,818,948,1005,1008,1007,1006,484,485,513,514,507,508,953,954,955]')


Constants.Shop.Packs = mw.text.jsonDecode('[{"name":"Basic Resupply","description":"+200 Mithril Arrows, +200 Topaz Bolts, +200 Light Runes, +100 Lobsters, +200 Magic Bones","media":"assets/media/bank/lobster_cooked.png","contains":{"items":[[265,200],[684,200],[820,200],[26,100],[441,200]]},"cost":{"gp":0,"slayerCoins":5000,"items":[]},"unlockRequirements":{},"buyLimit":[0,0,0,0],"showBuyLimit":false},{"name":"Standard Resupply","description":"+200 Adamant Arrows, +200 Sapphire Bolts, +500 Light Runes, +150 Crab, +500 Magic Bones","media":"assets/media/bank/crab_cooked.png","contains":{"items":[[266,200],[685,200],[820,500],[28,150],[441,500]]},"cost":{"gp":0,"slayerCoins":10000,"items":[]},"unlockRequirements":{"skillLevel":[[18,50]]},"buyLimit":[0,0,0,0],"showBuyLimit":false},{"name":"Generous Resupply","description":"+200 Rune Arrows, +200 Ruby Bolts, +1000 Light Runes, +200 Sharks, +1000 Magic Bones","media":"assets/media/bank/shark_cooked.png","contains":{"items":[[267,200],[686,200],[820,1000],[29,200],[441,1000]]},"cost":{"gp":0,"slayerCoins":20000,"items":[]},"unlockRequirements":{"skillLevel":[[18,75]]},"buyLimit":[0,0,0,0],"showBuyLimit":false}]')
SkillData.Milestones = mw.text.jsonDecode('[10,24,10,32,12,116,11,1,12,1,24,25,73,58,56,85,87,32,14,31,12,21,12]')


Constants.Slayer = {}
SkillData.SkillUnlockCosts = mw.text.jsonDecode('[10000,25000,50000,200000,250000,400000,1000000,2500000,10000000,25000000,50000000,100000000,200000000,500000000,500000000,500000000,500000000,500000000,500000000]')
Constants.Slayer.Tiers = mw.text.jsonDecode('[{"display":"Easy","cost":0,"minLevel":1,"maxLevel":49,"slayerLevel":1},{"display":"Normal","cost":2000,"minLevel":50,"maxLevel":99,"slayerLevel":25},{"display":"Hard","cost":5000,"minLevel":100,"maxLevel":199,"slayerLevel":50},{"display":"Elite","cost":15000,"minLevel":200,"maxLevel":374,"slayerLevel":75},{"display":"Master","cost":25000,"minLevel":375,"maxLevel":null,"slayerLevel":85}]')


return Constants
return SkillData