Anonymous

Module:Skills/Gathering: Difference between revisions

From Melvor Idle
no edit summary
No edit summary
No edit summary
Line 19: Line 19:
-- Guarantee order by iterating through currency game data definition
-- Guarantee order by iterating through currency game data definition
local currID = currencyDefn.id
local currID = currencyDefn.id
local val = Shared.round(lootValue[currID], 2, 2)
local val = Num.round(lootValue[currID], 2, 2)
if val ~= nil then
if val ~= nil then
table.insert(returnPart, Icons._Currency(currID, val))
table.insert(returnPart, Icons._Currency(currID, val))
Line 67: Line 67:
local sellCurrency = log.sellsForCurrency or 'melvorD:GP'
local sellCurrency = log.sellsForCurrency or 'melvorD:GP'
local XPSec = baseXP / (baseInt / 1000)
local XPSec = baseXP / (baseInt / 1000)
local currSec = Shared.round(log.sellsFor / (baseInt / 1000), 2, 2)
local currSec = Num.round(log.sellsFor / (baseInt / 1000), 2, 2)


Line 89: Line 89:
  :attr('data-sort-value', baseInt)
  :attr('data-sort-value', baseInt)
  :css('text-align', 'right')
  :css('text-align', 'right')
:tag('td'):wikitext(Shared.round(XPSec, 2, 2))
:tag('td'):wikitext(Num.round(XPSec, 2, 2))
  :css('text-align', 'right')
  :css('text-align', 'right')
:tag('td'):wikitext(Icons._Currency(sellCurrency, currSec))
:tag('td'):wikitext(Icons._Currency(sellCurrency, currSec))
Line 428: Line 428:
row:tag('td')
row:tag('td')
:css('text-align', 'right')
:css('text-align', 'right')
:wikitext(Shared.round(XPSec, 2, 2))
:wikitext(Num.round(XPSec, 2, 2))
end
end
end
end
Line 544: Line 544:
:css('text-align', 'right')
:css('text-align', 'right')
:attr('data-sort-value', odds)
:attr('data-sort-value', odds)
:wikitext(Shared.fraction(1, Shared.round2(1/(odds/100), 0)))
:wikitext(Num.fraction(1, Num.round2(1/(odds/100), 0)))
row:tag('td')
row:tag('td')
:css('text-align', 'right')
:css('text-align', 'right')
:attr('data-sort-value', odds)
:attr('data-sort-value', odds)
:wikitext(Shared.round(odds, 4, 4) .. '%')
:wikitext(Num.round(odds, 4, 4) .. '%')
end
end
end
end
Line 623: Line 623:
--Show fraction as long as it isn't going to be 1/1
--Show fraction as long as it isn't going to be 1/1
table.insert(normalTxt, '||style="text-align:right" data-sort-value="'..loot.weight..'"')
table.insert(normalTxt, '||style="text-align:right" data-sort-value="'..loot.weight..'"')
table.insert(normalTxt, '|'..Shared.fraction(loot.weight * lootChance, totalWt * 100))
table.insert(normalTxt, '|'..Num.fraction(loot.weight * lootChance, totalWt * 100))
table.insert(normalTxt, '||')
table.insert(normalTxt, '||')
else
else
table.insert(normalTxt, '||colspan="2" data-sort-value="'..loot.weight..'"')
table.insert(normalTxt, '||colspan="2" data-sort-value="'..loot.weight..'"')
end
end
table.insert(normalTxt, 'style="text-align:right"|'..Shared.round(dropChance, 2, 2)..'%')
table.insert(normalTxt, 'style="text-align:right"|'..Num.round(dropChance, 2, 2)..'%')


--Adding to the average loot value based on price & dropchance
--Adding to the average loot value based on price & dropchance
Line 645: Line 645:
table.insert(normalTxt, '\r\n|colspan="2" ')
table.insert(normalTxt, '\r\n|colspan="2" ')
end
end
table.insert(normalTxt, 'style="text-align:right"|'..Shared.round(lootChance, 2, 2)..'%')
table.insert(normalTxt, 'style="text-align:right"|'..Num.round(lootChance, 2, 2)..'%')
end
end
table.insert(normalTxt, '\r\n|}')
table.insert(normalTxt, '\r\n|}')
Line 680: Line 680:
lineTxt = lineTxt..'\r\n|-\r\n|'..Icons.Icon({thisItem.name, type='item'})
lineTxt = lineTxt..'\r\n|-\r\n|'..Icons.Icon({thisItem.name, type='item'})
lineTxt = lineTxt..'||data-sort-value="'..drop.quantity..'"| '..Num.formatnum(drop.quantity)..'||data-sort-value="'..thisItem.sellsFor..'"|'..Items.getValueText(thisItem)
lineTxt = lineTxt..'||data-sort-value="'..drop.quantity..'"| '..Num.formatnum(drop.quantity)..'||data-sort-value="'..thisItem.sellsFor..'"|'..Items.getValueText(thisItem)
lineTxt = lineTxt..'||style="text-align:right"|'..Shared.fraction(1, 1/(SkillData.Thieving.baseAreaUniqueChance/100))
lineTxt = lineTxt..'||style="text-align:right"|'..Num.fraction(1, 1/(SkillData.Thieving.baseAreaUniqueChance/100))
lineTxt = lineTxt..'||'..Shared.round(SkillData.Thieving.baseAreaUniqueChance, 2, 2)..'%'
lineTxt = lineTxt..'||'..Num.round(SkillData.Thieving.baseAreaUniqueChance, 2, 2)..'%'
dropLines[thisItem.name] = lineTxt
dropLines[thisItem.name] = lineTxt
end
end
2,874

edits