17,105
edits
mNo edit summary |
mNo edit summary |
||
Line 74: | Line 74: | ||
end | end | ||
if attBonusCols > 0 then | if attBonusCols > 0 then | ||
table.insert(resultPart, '\r\n!colspan="'..attBonusCols..'"|Attack Bonus') | table.insert(resultPart, '\r\n!colspan="'..attBonusCols..'"style="padding:0 0.5em 0 0.5em;"|Attack Bonus') | ||
end | end | ||
if strBonusCols > 0 then | if strBonusCols > 0 then | ||
table.insert(resultPart, '\r\n!colspan="'..strBonusCols..'"|Str. Bonus') | table.insert(resultPart, '\r\n!colspan="'..strBonusCols..'"style="padding:0 0.5em 0 0.5em;"|Str. Bonus') | ||
end | end | ||
if Shared.contains(statColumns, 'magicDamageBonus') then | if Shared.contains(statColumns, 'magicDamageBonus') then | ||
table.insert(resultPart, '\r\n!colspan="1"|% Dmg Bonus') | table.insert(resultPart, '\r\n!colspan="1"style="padding:0 0.5em 0 0.5em;"|% Dmg Bonus') | ||
end | end | ||
if defBonusCols > 0 then | if defBonusCols > 0 then | ||
table.insert(resultPart, '\r\n!colspan="'..defBonusCols..'"|Defence Bonus') | table.insert(resultPart, '\r\n!colspan="'..defBonusCols..'"style="padding:0 0.5em 0 0.5em;"|Defence Bonus') | ||
end | end | ||
if Shared.contains(statColumns, 'damageReduction') then | if Shared.contains(statColumns, 'damageReduction') then | ||
table.insert(resultPart, '\r\n!colspan="1"|DR') | table.insert(resultPart, '\r\n!colspan="1"style="padding:0 0.5em 0 0.5em;"|DR') | ||
end | end | ||
if lvlReqCols > 0 then | if lvlReqCols > 0 then | ||
table.insert(resultPart, '\r\n!colspan="'..lvlReqCols..'|Lvl Req') | table.insert(resultPart, '\r\n!colspan="'..lvlReqCols..'"style="padding:0 0.5em 0 0.5em;"|Lvl Req') | ||
end | end | ||
if includeModifiers and includeDescription then | if includeModifiers and includeDescription then | ||
Line 100: | Line 100: | ||
--One header row down, one to go | --One header row down, one to go | ||
table.insert(resultPart, '\r\n|-class="headerRow-1"') | table.insert(resultPart, '\r\n|-class="headerRow-1"') | ||
table.insert(resultPart, '\r\n!Item') | table.insert(resultPart, '\r\n!style="padding:0 1em 0 0.5em;"|Item') | ||
table.insert(resultPart, '\r\n!Name') | table.insert(resultPart, '\r\n!style="padding:0 1em 0 0.5em;"|Name') | ||
--Weapons have Attack Speed here | --Weapons have Attack Speed here | ||
if isWeaponType then | if isWeaponType then | ||
table.insert(resultPart, '\r\n!Attack Speed') | table.insert(resultPart, '\r\n!style="padding:0 1em 0 0.5em;"|Attack Speed') | ||
table.insert(resultPart, '\r\n!Two Handed?') | table.insert(resultPart, '\r\n!style="padding:0 1em 0 0.5em;"|Two Handed?') | ||
end | end | ||
--Attack bonuses | --Attack bonuses | ||
if Shared.contains(statColumns, 'slashAttackBonus') then | if Shared.contains(statColumns, 'slashAttackBonus') then | ||
table.insert(resultPart, '\r\n!'..Icons.Icon({'Attack', type='skill', notext='true'})) | table.insert(resultPart, '\r\n!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Attack', type='skill', notext='true'})) | ||
end | end | ||
if Shared.contains(statColumns, 'stabAttackBonus') then | if Shared.contains(statColumns, 'stabAttackBonus') then | ||
table.insert(resultPart, '\r\n!'..Icons.Icon({'Strength', type='skill', notext='true'})) | table.insert(resultPart, '\r\n!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Strength', type='skill', notext='true'})) | ||
end | end | ||
if Shared.contains(statColumns, 'blockAttackBonus') then | if Shared.contains(statColumns, 'blockAttackBonus') then | ||
table.insert(resultPart, '\r\n!'..Icons.Icon({'Defence', type='skill', notext='true'})) | table.insert(resultPart, '\r\n!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Defence', type='skill', notext='true'})) | ||
end | end | ||
if Shared.contains(statColumns, 'rangedAttackBonus') then | if Shared.contains(statColumns, 'rangedAttackBonus') then | ||
table.insert(resultPart, '\r\n!'..Icons.Icon({'Ranged', type='skill', notext='true'})) | table.insert(resultPart, '\r\n!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Ranged', type='skill', notext='true'})) | ||
end | end | ||
if Shared.contains(statColumns, 'magicAttackBonus') then | if Shared.contains(statColumns, 'magicAttackBonus') then | ||
table.insert(resultPart, '\r\n!'..Icons.Icon({'Magic', type='skill', notext='true'})) | table.insert(resultPart, '\r\n!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Magic', type='skill', notext='true'})) | ||
end | end | ||
--Strength bonuses | --Strength bonuses | ||
if Shared.contains(statColumns, 'strengthBonus') then | if Shared.contains(statColumns, 'strengthBonus') then | ||
table.insert(resultPart, '\r\n!'..Icons.Icon({'Strength', type='skill', notext='true'})) | table.insert(resultPart, '\r\n!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Strength', type='skill', notext='true'})) | ||
end | end | ||
if Shared.contains(statColumns, 'rangedStrengthBonus') then | if Shared.contains(statColumns, 'rangedStrengthBonus') then | ||
table.insert(resultPart, '\r\n!'..Icons.Icon({'Ranged', type='skill', notext='true'})) | table.insert(resultPart, '\r\n!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Ranged', type='skill', notext='true'})) | ||
end | end | ||
if Shared.contains(statColumns, 'magicDamageBonus') then | if Shared.contains(statColumns, 'magicDamageBonus') then | ||
table.insert(resultPart, '\r\n!'..Icons.Icon({'Magic', type='skill', notext='true'})) | table.insert(resultPart, '\r\n!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Magic', type='skill', notext='true'})) | ||
end | end | ||
--Defence bonuses | --Defence bonuses | ||
if Shared.contains(statColumns, 'defenceBonus') then | if Shared.contains(statColumns, 'defenceBonus') then | ||
table.insert(resultPart, '\r\n!'..Icons.Icon({'Defence', type='skill', notext='true'})) | table.insert(resultPart, '\r\n!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Defence', type='skill', notext='true'})) | ||
end | end | ||
if Shared.contains(statColumns, 'rangedDefenceBonus') then | if Shared.contains(statColumns, 'rangedDefenceBonus') then | ||
table.insert(resultPart, '\r\n!'..Icons.Icon({'Ranged', type='skill', notext='true'})) | table.insert(resultPart, '\r\n!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Ranged', type='skill', notext='true'})) | ||
end | end | ||
if Shared.contains(statColumns, 'magicDefenceBonus') then | if Shared.contains(statColumns, 'magicDefenceBonus') then | ||
table.insert(resultPart, '\r\n!'..Icons.Icon({'Magic', type='skill', notext='true'})) | table.insert(resultPart, '\r\n!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Magic', type='skill', notext='true'})) | ||
end | end | ||
if Shared.contains(statColumns, 'damageReduction') then | if Shared.contains(statColumns, 'damageReduction') then | ||
table.insert(resultPart, '\r\n!'..Icons.Icon({'Defence', type='skill', notext='true'})) | table.insert(resultPart, '\r\n!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Defence', type='skill', notext='true'})) | ||
end | end | ||
--Level requirements | --Level requirements | ||
if Shared.contains(statColumns, 'attackLevelRequired') then | if Shared.contains(statColumns, 'attackLevelRequired') then | ||
table.insert(resultPart, '\r\n!'..Icons.Icon({'Attack', type='skill', notext='true'})) | table.insert(resultPart, '\r\n!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Attack', type='skill', notext='true'})) | ||
end | end | ||
if Shared.contains(statColumns, 'defenceLevelRequired') then | if Shared.contains(statColumns, 'defenceLevelRequired') then | ||
table.insert(resultPart, '\r\n!'..Icons.Icon({'Defence', type='skill', notext='true'})) | table.insert(resultPart, '\r\n!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Defence', type='skill', notext='true'})) | ||
end | end | ||
if Shared.contains(statColumns, 'rangedLevelRequired') then | if Shared.contains(statColumns, 'rangedLevelRequired') then | ||
table.insert(resultPart, '\r\n!'..Icons.Icon({'Ranged', type='skill', notext='true'})) | table.insert(resultPart, '\r\n!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Ranged', type='skill', notext='true'})) | ||
end | end | ||
if Shared.contains(statColumns, 'magicLevelRequired') then | if Shared.contains(statColumns, 'magicLevelRequired') then | ||
table.insert(resultPart, '\r\n!'..Icons.Icon({'Magic', type='skill', notext='true'})) | table.insert(resultPart, '\r\n!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Magic', type='skill', notext='true'})) | ||
end | end | ||
--If includeModifiers is set to 'true', add the Modifiers column | --If includeModifiers is set to 'true', add the Modifiers column | ||
if includeModifiers then | if includeModifiers then | ||
table.insert(resultPart, '\r\n!Modifiers') | table.insert(resultPart, '\r\n!style="padding:0 1em 0 0.5em;"|Modifiers') | ||
end | end | ||
--If includeDescription is set to 'true', add the Description column | --If includeDescription is set to 'true', add the Description column | ||
if includeDescription then | if includeDescription then | ||
table.insert(resultPart, '\r\n!Description') | table.insert(resultPart, '\r\n!style="padding:0 1em 0 0.5em;"|Description') | ||
end | end | ||
--And finally Sources | --And finally Sources | ||
table.insert(resultPart, '\r\n!Sources') | table.insert(resultPart, '\r\n!style="padding:0 1em 0 0.5em;"|Sources') | ||
table.sort(itemList, function(a, b) return a.id < b.id end) | table.sort(itemList, function(a, b) return a.id < b.id end) | ||
Line 176: | Line 176: | ||
--Building rows for weapons | --Building rows for weapons | ||
table.insert(resultPart, '\r\n|-') | table.insert(resultPart, '\r\n|-') | ||
table.insert(resultPart, '\r\n|style ="text-align: left;"|'..Icons.Icon({item.name, type='item', size=50, notext=true})) | table.insert(resultPart, '\r\n|style ="text-align: left;padding: 0 0 0 0;"|'..Icons.Icon({item.name, type='item', size=50, notext=true})) | ||
table.insert(resultPart, '\r\n|style ="text-align: left;"|[['..item.name..']]') | table.insert(resultPart, '\r\n|style ="text-align: left;padding: 0 0.5em 0 0.5em;"|[['..item.name..']]') | ||
table.insert(resultPart, '\r\n| style ="text-align: right;" |'..Shared.formatnum(Items._getItemStat(item, 'attackSpeed', true))) | table.insert(resultPart, '\r\n| style ="text-align: right;padding: 0 0.5em 0 0;" |'..Shared.formatnum(Items._getItemStat(item, 'attackSpeed', true))) | ||
--That's the first list out of the way, now for 2-Handed | --That's the first list out of the way, now for 2-Handed | ||
table.insert(resultPart, '\r\n| style ="text-align: right;"|') | table.insert(resultPart, '\r\n| style ="text-align: right;"|') | ||
Line 184: | Line 184: | ||
for j, statName in pairs(statColumns) do | for j, statName in pairs(statColumns) do | ||
local statValue = Items._getItemStat(item, statName, true) | local statValue = Items._getItemStat(item, statName, true) | ||
table.insert(resultPart, '\r\n| style ="text-align: right;') | table.insert(resultPart, '\r\n| style ="text-align: right;padding: 0 0.5em 0 0;') | ||
if string.find(statName, '^(.+)LevelRequired$') == nil then | if string.find(statName, '^(.+)LevelRequired$') == nil then | ||
if statValue > 0 then | if statValue > 0 then | ||
Line 197: | Line 197: | ||
--If requested, add the item Modifiers | --If requested, add the item Modifiers | ||
if includeModifiers then | if includeModifiers then | ||
table.insert(resultPart, '\r\n|style="text-align:left;white-space:nowrap;"|') | table.insert(resultPart, '\r\n|style="text-align:left;white-space:nowrap;padding:0 0.5em 0 0.5em;"|') | ||
table.insert(resultPart, Constants.getModifiersText(item.modifiers, true)) | table.insert(resultPart, Constants.getModifiersText(item.modifiers, true)) | ||
end | end | ||
--If requested, add description | --If requested, add description | ||
if includeDescription then | if includeDescription then | ||
table.insert(resultPart, '\r\n|style="text-align:left;"|') | table.insert(resultPart, '\r\n|style="text-align:left;padding:0 0.5em 0 0.5em;"|') | ||
table.insert(resultPart, item.description ~= nil and item.description or '') | table.insert(resultPart, item.description ~= nil and item.description or '') | ||
end | end | ||
--Finally, the Sources | --Finally, the Sources | ||
table.insert(resultPart, '\r\n| style ="text-align: right;" |') | table.insert(resultPart, '\r\n| style ="text-align: right;padding: 0 0.5em 0 0.5em;" |') | ||
table.insert(resultPart, ItemSourceTables._getItemSources(item)) | table.insert(resultPart, ItemSourceTables._getItemSources(item)) | ||
else | else | ||
--Building rows for armour | --Building rows for armour | ||
table.insert(resultPart, '\r\n|-') | table.insert(resultPart, '\r\n|-') | ||
table.insert(resultPart, '\r\n|style ="text-align: left;"|'..Icons.Icon({item.name, type='item', size=50, notext=true})) | table.insert(resultPart, '\r\n|style ="text-align: left;padding: 0 0 0 0;"|'..Icons.Icon({item.name, type='item', size=50, notext=true})) | ||
table.insert(resultPart, '\r\n|style ="text-align: left;"|[['..item.name..']]') | table.insert(resultPart, '\r\n|style ="text-align: left;padding: 0 0.5em 0 0.5em;"|[['..item.name..']]') | ||
for j, statName in pairs(statColumns) do | for j, statName in pairs(statColumns) do | ||
local statValue = Items._getItemStat(item, statName, true) | local statValue = Items._getItemStat(item, statName, true) | ||
table.insert(resultPart, '\r\n| style ="text-align: right;') | table.insert(resultPart, '\r\n| style ="text-align: right;padding: 0 0.5em 0 0;') | ||
if statValue > 0 then | if statValue > 0 then | ||
table.insert(resultPart, 'background-color:lightgreen;') | table.insert(resultPart, 'background-color:lightgreen;') | ||
Line 226: | Line 226: | ||
--If requested, add the item Modifiers | --If requested, add the item Modifiers | ||
if includeModifiers then | if includeModifiers then | ||
table.insert(resultPart, '\r\n|style="text-align:left;white-space:nowrap;"|') | table.insert(resultPart, '\r\n|style="text-align:left;white-space:nowrap;padding:0 0.5em 0 0.5em;"|') | ||
table.insert(resultPart, Constants.getModifiersText(item.modifiers, true)) | table.insert(resultPart, Constants.getModifiersText(item.modifiers, true)) | ||
end | end | ||
--If requested, add description | --If requested, add description | ||
if includeDescription then | if includeDescription then | ||
table.insert(resultPart, '\r\n|style="text-align:left;"|') | table.insert(resultPart, '\r\n|style="text-align:left;padding:0 0.5em 0 0.5em;"|') | ||
table.insert(resultPart, item.description ~= nil and item.description or '') | table.insert(resultPart, item.description ~= nil and item.description or '') | ||
end | end | ||
--Finally, the Sources | --Finally, the Sources | ||
table.insert(resultPart, '\r\n| style ="text-align: right;" |') | table.insert(resultPart, '\r\n| style ="text-align: right;padding: 0 0.5em 0 0.5em;" |') | ||
table.insert(resultPart, ItemSourceTables._getItemSources(item)) | table.insert(resultPart, ItemSourceTables._getItemSources(item)) | ||
end | end | ||
Line 279: | Line 279: | ||
else | else | ||
--Now for handling armour | --Now for handling armour | ||
local levelReqs = Items._processEquipmentLevelReqs(item.equipRequirements) | local levelReqs = {['Defence'] = 10} --Items._processEquipmentLevelReqs(item.equipRequirements) | ||
if type == "Armour" or type == "Melee" then | if type == "Armour" or type == "Melee" then | ||
listItem = levelReqs['Defence'] ~= nil or (item.category == 'Combat' and item.type == 'Armour') | listItem = levelReqs['Defence'] ~= nil or (item.category == 'Combat' and item.type == 'Armour') | ||
Line 308: | Line 308: | ||
local isMatch = item.isEquipment | local isMatch = item.isEquipment | ||
if isMatch then | if isMatch then | ||
local levelReqs = Items._processEquipmentLevelReqs(item.equipRequirements) | local levelReqs = {['Defence'] = 10} -- Items._processEquipmentLevelReqs(item.equipRequirements) | ||
if style == 'Melee' then | if style == 'Melee' then | ||
if (levelReqs['Defence'] == nil and levelReqs['Attack'] == nil) and not Shared.contains(styleOverrides.Melee, item.name) then isMatch = false end | if (levelReqs['Defence'] == nil and levelReqs['Attack'] == nil) and not Shared.contains(styleOverrides.Melee, item.name) then isMatch = false end | ||
Line 478: | Line 478: | ||
--Unfortunately just gonna have to manually check all the changes I think... | --Unfortunately just gonna have to manually check all the changes I think... | ||
local itemStats = { | local itemStats = { | ||
{ Stat = Items._processEquipmentStats(item1.equipmentStats), Level = Items._processEquipmentLevelReqs(item1.equipRequirements), SlayBon = Items._getItemModifier(item1, 'increasedSkillXP', 'Slayer') }, | { Stat = {['stabAttackBonus'] = 10, ['slashAttackBonus'] = 15}, Level = {['Defence'] = 10}, SlayBon = Items._getItemModifier(item1, 'increasedSkillXP', 'Slayer') }, | ||
{ Stat = Items._processEquipmentStats(item2.equipmentStats), Level = Items._processEquipmentLevelReqs(item2.equipRequirements), SlayBon = Items._getItemModifier(item2, 'increasedSkillXP', 'Slayer') }, | { Stat = {['stabAttackBonus'] = 20, ['slashAttackBonus'] = 25}, Level = {['Defence'] = 20}, SlayBon = Items._getItemModifier(item2, 'increasedSkillXP', 'Slayer') }, | ||
--{ Stat = Items._processEquipmentStats(item1.equipmentStats), Level = Items._processEquipmentLevelReqs(item1.equipRequirements), SlayBon = Items._getItemModifier(item1, 'increasedSkillXP', 'Slayer') }, | |||
--{ Stat = Items._processEquipmentStats(item2.equipmentStats), Level = Items._processEquipmentLevelReqs(item2.equipRequirements), SlayBon = Items._getItemModifier(item2, 'increasedSkillXP', 'Slayer') }, | |||
} | } | ||
local attBon1 = item1.attackBonus ~= nil and item1.attackBonus or {0, 0, 0} | local attBon1 = item1.attackBonus ~= nil and item1.attackBonus or {0, 0, 0} | ||
Line 560: | Line 562: | ||
table.insert(resultPart, '\r\n|}') | table.insert(resultPart, '\r\n|}') | ||
return table.concat(resultPart) | return table.concat(resultPart) | ||
end | end | ||
return p | return p |