17,101
edits
No edit summary |
(Update for v1.3) |
||
Line 4: | Line 4: | ||
local Num = require('Module:Number') | local Num = require('Module:Number') | ||
local Shared = require('Module:Shared') | local Shared = require('Module:Shared') | ||
local Common = require('Module:Common') | |||
local GameData = require('Module:GameData') | local GameData = require('Module:GameData') | ||
local SkillData = GameData.skillData | local SkillData = GameData.skillData | ||
local Modifiers = require('Module:Modifiers') | |||
local Skills = require('Module:Skills') | local Skills = require('Module:Skills') | ||
local Items = require('Module:Items') | local Items = require('Module:Items') | ||
Line 33: | Line 35: | ||
function p.getPillars(checkFunc) | function p.getPillars(checkFunc) | ||
return GameData.getEntities(SkillData.Agility.pillars, checkFunc) | |||
end | end | ||
Line 104: | Line 91: | ||
local items = {} | local items = {} | ||
for j, currCost in ipairs(obstacle.currencyCosts) do | |||
local shortID = nil | |||
if currCost.id == 'melvorD:GP' then | |||
shortID = 'GP' | |||
elseif currCost.id == 'melvorD:SlayerCoins' then | |||
shortID = 'SC' | |||
end | |||
if shortID ~= nil then | |||
costs[shortID] = currCost.quantity | |||
end | |||
end | end | ||
Line 131: | Line 123: | ||
end | end | ||
function p. | function p.getObstacleCourseTable(frame) | ||
local | local args = frame.args ~= nil and frame.args or frame | ||
local | local realmName = args.realm | ||
local realmID = nil | |||
if realmName ~= nil and realmName ~= '' then | |||
if | local realm = GameData.getEntityByName('realms', realmName) | ||
if realm == nil then | |||
return Shared.printError('No such realm: ' .. realmName) | |||
end | |||
realmID = realm.id | |||
end | end | ||
local result = '' | local result = '' | ||
Line 153: | Line 142: | ||
local catLog = {} | local catLog = {} | ||
local obstacles = p.getObstacles(function(obst) return | local obstacles = p.getObstacles( | ||
function(obst) | |||
return realmID == nil or Skills.getRecipeRealm(obst) == realmID | |||
end | |||
) | |||
table.sort(obstacles, function(a, b) return a.category < b.category end) | table.sort(obstacles, function(a, b) return a.category < b.category end) | ||
Line 179: | Line 172: | ||
local GP = obst.gpReward | local GP = obst.gpReward | ||
local Time = obst.baseInterval / 1000 | local Time = obst.baseInterval / 1000 | ||
result = result..'||'..XP..'||data-sort-value="'.. | local costString = Common.getCostString({ | ||
items = obst.itemCosts, | |||
currencies = obst.currencyCosts | |||
}) | |||
local rewardString = Common.getCostString({ | |||
items = obst.itemRewards, | |||
currencies = obst.currencyRewards | |||
}) | |||
local costVal = (obst.currencyCosts ~= nil and obst.currencyCosts[1].quantity or 0) | |||
local rewardVal = (obst.currencyRewards ~= nil and obst.currencyRewards[1].quantity or 0) | |||
result = result..'||'..XP..'||data-sort-value="'..rewardVal..'"|'..rewardString | |||
result = result..'||data-sort-value="'..Time..'"|'..Shared.timeString(Time, true) | result = result..'||data-sort-value="'..Time..'"|'..Shared.timeString(Time, true) | ||
-- Readded XP/Time and GP/Time (previously commented out) | -- Readded XP/Time and GP/Time (previously commented out) | ||
result = result..'||'..Shared.round(XP / Time, 2, 2) | result = result..'||'..Shared.round(XP / Time, 2, 2) | ||
result = result..'||data-sort-value="'.. | result = result..'||data-sort-value="'..rewardVal/Time..'"|'..Icons.GP(Shared.round(rewardVal/Time, 2, 2)) | ||
local bonuses = {} | local bonuses = {} | ||
--After that, adding the bonuses | --After that, adding the bonuses | ||
local modText = Modifiers.getModifiersText(obst.modifiers, true, false, 10) | |||
if modText == '' then | |||
modText = '<span style="text-negative">None :(</span>' | |||
end | end | ||
result = result..'||'..modText | |||
result = result..'||'.. | |||
--Grabbing requirements to create | --Grabbing requirements to create | ||
Line 199: | Line 202: | ||
--Finally, the cost | --Finally, the cost | ||
result = result..'|| data-sort-value="'.. | result = result..'|| data-sort-value="'..costVal..'"|'..costString | ||
end | end | ||
Line 208: | Line 211: | ||
function p.getPassivePillarTable(frame) | function p.getPassivePillarTable(frame) | ||
local args = frame.args ~= nil and frame.args or frame | |||
local realmName = args.realm | |||
local realmID = nil | |||
if realmName ~= nil and realmName ~= '' then | |||
local realm = GameData.getEntityByName('realms', realmName) | |||
if realm == nil then | |||
return Shared.printError('No such realm: ' .. realmName) | |||
end | |||
realmID = realm.id | |||
end | |||
local result = '' | local result = '' | ||
Line 214: | Line 228: | ||
result = result..'\r\n!Name!!Bonuses!!Cost' | result = result..'\r\n!Name!!Bonuses!!Cost' | ||
local pillars = p.getPillars(function( | local pillars = p.getPillars( | ||
function(pill) | |||
return realmID == nil or Skills.getRecipeRealm(pill) == realmID | |||
end | |||
) | |||
for i, pill in ipairs(pillars) do | for i, pill in ipairs(pillars) do | ||
result = result..'\r\n|-' | result = result..'\r\n|-' | ||
Line 220: | Line 238: | ||
--After that, adding the bonuses | --After that, adding the bonuses | ||
local | local modText = Modifiers.getModifiersText(pill.modifiers, true, false, 10) | ||
if modText == '' then | |||
modText = '<span style="text-negative">None :(</span>' | |||
if | |||
end | end | ||
result = result..'||'.. | result = result..'||'..modText | ||
--Finally, the cost | --Finally, the cost | ||
result = result..'|| data-sort-value="'.. | local costString = Common.getCostString({ | ||
items = pill.itemCosts, | |||
currencies = pill.currencyCosts | |||
}) | |||
local costVal = (pill.currencyCosts ~= nil and pill.currencyCosts[1].quantity or 0) | |||
result = result..'|| data-sort-value="'..costVal..'"|'.. costString | |||
end | end | ||