|
|
(16 intermediate revisions by 2 users not shown) |
Line 7: |
Line 7: |
| local Icons = require('Module:Icons') | | local Icons = require('Module:Icons') |
| local Items = require('Module:AuronTest') | | local Items = require('Module:AuronTest') |
| local ItemSourceTables = require('Module:AuronTest/SourceTables')
| |
| local ItemUseTables = require('Module:AuronTest/UseTables')
| |
|
| |
|
| local weaponTypes = {'Magic Staff', 'Magic Wand', 'Ranged Weapon', 'Weapon'} | | local weaponTypes = {'Magic Staff', 'Magic Wand', 'Ranged Weapon', 'Weapon'} |
Line 92: |
Line 90: |
| end | | end |
| if includeModifiers and includeDescription then | | if includeModifiers and includeDescription then |
| table.insert(resultPart, '\r\n!colspan="3"|') | | table.insert(resultPart, '\r\n!colspan="2"|') |
| elseif includeModifiers or includeDescription then | | elseif includeModifiers or includeDescription then |
| table.insert(resultPart, '\r\n!colspan="2"|')
| |
| else
| |
| table.insert(resultPart, '\r\n!colspan="1"|') | | table.insert(resultPart, '\r\n!colspan="1"|') |
| end | | end |
Line 167: |
Line 163: |
| table.insert(resultPart, '\r\n!style="padding:0 1em 0 0.5em;"|Description') | | table.insert(resultPart, '\r\n!style="padding:0 1em 0 0.5em;"|Description') |
| end | | end |
|
| |
| --And finally 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 205: |
Line 198: |
| 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
| |
| table.insert(resultPart, '\r\n| style ="text-align: right;padding: 0 0.5em 0 0.5em;" |')
| |
| table.insert(resultPart, ItemSourceTables._getItemSources(item))
| |
| else | | else |
| --Building rows for armour | | --Building rows for armour |
Line 234: |
Line 224: |
| 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
| |
| table.insert(resultPart, '\r\n| style ="text-align: right;padding: 0 0.5em 0 0.5em;" |')
| |
| table.insert(resultPart, ItemSourceTables._getItemSources(item))
| |
| end | | end |
| end | | end |
|
| |
|
| table.insert(resultPart, '\r\n|}') | | table.insert(resultPart, '\r\n|}') |
| | |
| return table.concat(resultPart) | | return table.concat(resultPart) |
| end | | end |
Line 279: |
Line 267: |
| else | | else |
| --Now for handling armour | | --Now for handling armour |
| 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 = Items._getItemStat(item, 'defenceLevelRequired') ~= nil or (item.category == 'Combat' and item.type == 'Armour') |
| elseif type == "Ranged Armour" or type == "Ranged" then | | elseif type == "Ranged Armour" or type == "Ranged" then |
| listItem = levelReqs['Ranged'] ~= nil or (item.category == 'Combat' and item.type == 'Ranged Armour') | | listItem = Items._getItemStat(item, 'rangedLevelRequired') ~= nil or (item.category == 'Combat' and item.type == 'Ranged Armour') |
| elseif type == "Magic Armour" or type == "Magic" then | | elseif type == "Magic Armour" or type == "Magic" then |
| listItem = levelReqs['Magic'] or (item.category == 'Combat' and item.type == 'Magic Armour') | | listItem = Items._getItemStat(item, 'magicLevelRequired') or (item.category == 'Combat' and item.type == 'Magic Armour') |
| else | | else |
| listItem = item.type == type and item.category ~= 'Combat' | | listItem = item.type == type and item.category ~= 'Combat' |
Line 297: |
Line 284: |
| end | | end |
|
| |
|
| return p._getEquipmentTable(itemList).."[[Category:getEquipmentTable]]" | | local result = p._getEquipmentTable(itemList).."[[Category:getEquipmentTable]]" |
| | |
| | return result |
| end | | end |
|
| |
|
Line 306: |
Line 295: |
|
| |
|
| local itemList = Items.getItems(function(item) | | local itemList = Items.getItems(function(item) |
| local isMatch = item.isEquipment | | local isMatch = true |
| if isMatch then | | if style == 'Melee' then |
| local levelReqs = {['Defence'] = 10} -- Items._processEquipmentLevelReqs(item.equipRequirements)
| | if (Items._getItemStat(item, 'defenceLevelRequired') == nil and Items._getItemStat(item, 'attackLevelRequired') == nil) and not Shared.contains(styleOverrides.Melee, item.name) then isMatch = false end |
| if style == 'Melee' then
| | elseif style == 'Ranged' then |
| if (levelReqs['Defence'] == nil and levelReqs['Attack'] == nil) and not Shared.contains(styleOverrides.Melee, item.name) then isMatch = false end
| | if Items._getItemStat(item, 'rangedLevelRequired') == nil and not Shared.contains(styleOverrides.Ranged, item.name) then isMatch = false end |
| elseif style == 'Ranged' then
| | elseif style == 'Magic' then |
| if levelReqs['Ranged'] == nil and not Shared.contains(styleOverrides.Ranged, item.name) then isMatch = false end
| | if Items._getItemStat(item, 'magicLevelRequired') == nil and not Shared.contains(styleOverrides.Magic, item.name) then isMatch = false end |
| elseif style == 'Magic' then
| | elseif style == 'None' then |
| if levelReqs['Magic'] == nil and not Shared.contains(styleOverrides.Magic, item.name) then isMatch = false end
| | if (Items._getItemStat(item, 'defenceLevelRequired') ~= nil or Items._getItemStat(item, 'rangedLevelRequired') ~= nil or Items._getItemStat(item, 'magicLevelRequired') ~= nil or |
| elseif style == 'None' then
| | Shared.contains(styleOverrides.Melee, item.name) or Shared.contains(styleOverrides.Ranged, item.name) or Shared.contains(styleOverrides.Magic, item.name)) and |
| if (levelReqs['Defence'] ~= nil or levelReqs['Ranged'] ~= nil or levelReqs['Magic'] ~= nil or
| | not Shared.contains(styleOverrides.None, item.name) then |
| Shared.contains(styleOverrides.Melee, item.name) or Shared.contains(styleOverrides.Ranged, item.name) or Shared.contains(styleOverrides.Magic, item.name)) and
| | isMatch = false |
| not Shared.contains(styleOverrides.None, item.name) then
| |
| isMatch = false
| |
| end
| |
| end | | end |
| if slot == nil or not Shared.contains(item.validSlots, slot) then isMatch = false end
| | end |
| | if slot == nil or not Shared.contains(item.validSlots, slot) then isMatch = false end |
|
| |
|
| if isMatch and other ~= nil then
| | if isMatch and other ~= nil then |
| if slot == 'Weapon' then --For quiver slot or weapon slot, 'other' is the ammo type
| | if slot == 'Weapon' then --For quiver slot or weapon slot, 'other' is the ammo type |
| if other == 'Arrows' then
| | if other == 'Arrows' then |
| if item.ammoTypeRequired ~= 0 then isMatch = false end
| | if item.ammoTypeRequired ~= 0 then isMatch = false end |
| elseif other == 'Bolts' then
| | elseif other == 'Bolts' then |
| if item.ammoTypeRequired ~= 1 then isMatch = false end
| | if item.ammoTypeRequired ~= 1 then isMatch = false end |
| end
| | end |
| elseif slot == 'Quiver' then
| | elseif slot == 'Quiver' then |
| if other == 'Arrows' then
| | if other == 'Arrows' then |
| if item.ammoType ~= 0 then isMatch = false end
| | if item.ammoType ~= 0 then isMatch = false end |
| elseif other == 'Bolts' then
| | elseif other == 'Bolts' then |
| if item.ammoType ~= 1 then isMatch = false end
| | if item.ammoType ~= 1 then isMatch = false end |
| elseif other == 'Javelins' then
| | elseif other == 'Javelins' then |
| if item.ammoType ~= 2 then isMatch = false end
| | if item.ammoType ~= 2 then isMatch = false end |
| elseif other == 'Throwing Knives' then
| | elseif other == 'Throwing Knives' then |
| if item.ammoType ~= 3 then isMatch = false end
| | if item.ammoType ~= 3 then isMatch = false end |
| elseif other == 'Thrown' then
| | elseif other == 'Thrown' then |
| if item.ammoType ~= 2 and item.ammoType ~= 3 then isMatch = false end
| | if item.ammoType ~= 2 and item.ammoType ~= 3 then isMatch = false end |
| end
| |
| end | | end |
| end | | end |
Line 350: |
Line 336: |
| end) | | end) |
|
| |
|
| return p._getEquipmentTable(itemList, includeModifiers, includeDescription) | | local result = p._getEquipmentTable(itemList, includeModifiers, includeDescription) |
| | |
| | return result |
| end | | end |
|
| |
|
Line 391: |
Line 379: |
| return p._getEquipmentTable(itemList, includeModifiers) | | return p._getEquipmentTable(itemList, includeModifiers) |
| end | | end |
| end
| |
|
| |
| function p.getDoubleLootTable(frame)
| |
| local modsDL = {
| |
| 'increasedChanceToDoubleLootCombat',
| |
| 'decreasedChanceToDoubleLootCombat',
| |
| 'increasedChanceToDoubleLootThieving',
| |
| 'decreasedChanceToDoubleLootThieving',
| |
| 'increasedChanceToDoubleItemsGlobal',
| |
| 'decreasedChanceToDoubleItemsGlobal'
| |
| }
| |
| local modDetail = {}
| |
| for i, modName in pairs(modsDL) do
| |
| local mName, mText, mSign, mIsNeg, mValUnsigned = Constants.getModifierDetails(modName)
| |
| modDetail[modName] = { mult = (mSign == "+" and 1 or -1) }
| |
| end
| |
|
| |
| local itemList = Items.getItems(function(item)
| |
| if item.modifiers ~= nil then
| |
| for modName, val in pairs(item.modifiers) do
| |
| if Shared.contains(modsDL, modName) then return true end
| |
| end
| |
| return false
| |
| end
| |
| end)
| |
| table.sort(itemList, function(a, b) return a.id < b.id end)
| |
|
| |
| local resultPart = {}
| |
| table.insert(resultPart, '{| class="wikitable sortable stickyHeader"\r\n|-class="headerRow-0"')
| |
| table.insert(resultPart, '\r\n!colspan="2"|Name!!Bonus!!Description!!Sources')
| |
| for i, item in Shared.skpairs(itemList) do
| |
| local lootValue = 0
| |
| for modName, modDet in pairs(modDetail) do
| |
| lootValue = lootValue + (item.modifiers[modName] or 0) * modDet.mult
| |
| end
| |
| table.insert(resultPart, '\r\n|-')
| |
| table.insert(resultPart, '\r\n|data-sort-value="'..item.name..'"|'..Icons.Icon({item.name, type='item', size=50, notext=true}))
| |
| table.insert(resultPart, '||[['..item.name..']]')
| |
| table.insert(resultPart, '||style ="text-align: right;" data-sort-value="'..lootValue..'"|'..lootValue..'%')
| |
| table.insert(resultPart, '||'..item.description)
| |
| table.insert(resultPart, '\r\n| style ="text-align: right;white-space: nowrap;padding: 0 0.5em 0 0.5em;" |')
| |
| table.insert(resultPart, ItemSourceTables._getItemSources(item))
| |
| end
| |
|
| |
| table.insert(resultPart, '\r\n|}')
| |
| return table.concat(resultPart)
| |
| end
| |
|
| |
| function p.getItemTableRows(frame)
| |
| local startID = frame.args ~= nil and frame.args[1] or frame[1]
| |
| local rowCount = frame.args ~= nil and frame.args[2] or frame[2]
| |
| if type(startID ) == 'string' then startID = tonumber(startID) end
| |
| if rowCount == nil then rowCount = 200 end
| |
| if type(rowCount) == 'string' then rowCount = tonumber(rowCount) end
| |
|
| |
| local rowResult = {}
| |
| for i = startID, startID + rowCount - 1, 1 do
| |
| local item = Items.getItemByID(i)
| |
| if item == nil then break end
| |
| local rowPart = {}
| |
| table.insert(rowPart, '|-\r\n|'..Icons.Icon({item.name, type='item', size='50', notext=true})..'||[['..item.name..']]')
| |
| table.insert(rowPart, '||style="text-align:right;"|'..i..'||'..item.category..'||'..item.type)
| |
| table.insert(rowPart, '||style="text-align:right;" data-sort-value="'..item.sellsFor..'"|'..Icons.GP(item.sellsFor))
| |
| table.insert(rowPart, '||style="text-align:right;"|'..ItemSourceTables._getItemSources(item, false, 'false'))
| |
| table.insert(rowPart, '||style="text-align:right;"|'..ItemUseTables._getItemUses(item, false, 'false'))
| |
| table.insert(rowResult, table.concat(rowPart))
| |
| end
| |
|
| |
| return table.concat(rowResult, '\r\n')
| |
| end | | end |
|
| |
|
Line 477: |
Line 396: |
|
| |
|
| --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 statList = { |
| { Stat = {['stabAttackBonus'] = 10, ['slashAttackBonus'] = 15}, Level = {['Defence'] = 10}, SlayBon = Items._getItemModifier(item1, 'increasedSkillXP', 'Slayer') }, | | -- {'statName', 'statDescription'} |
| { Stat = {['stabAttackBonus'] = 20, ['slashAttackBonus'] = 25}, Level = {['Defence'] = 20}, SlayBon = Items._getItemModifier(item2, 'increasedSkillXP', 'Slayer') }, | | {'stabAttackBonus', '{V} '..Icons.Icon({'Melee', notext=true})..' Stab Bonus'}, |
| --{ Stat = Items._processEquipmentStats(item1.equipmentStats), Level = Items._processEquipmentLevelReqs(item1.equipRequirements), SlayBon = Items._getItemModifier(item1, 'increasedSkillXP', 'Slayer') }, | | {'slashAttackBonus', '{V} '..Icons.Icon({'Melee', notext=true})..' Slash Bonus'}, |
| --{ Stat = Items._processEquipmentStats(item2.equipmentStats), Level = Items._processEquipmentLevelReqs(item2.equipRequirements), SlayBon = Items._getItemModifier(item2, 'increasedSkillXP', 'Slayer') }, | | {'blockAttackBonus', '{V} '..Icons.Icon({'Melee', notext=true})..' Block Bonus'}, |
| | {'meleeStrengthBonus', '{V} '..Icons.Icon({'Strength', type='skill', notext=true})..' Strength Bonus'}, |
| | {'rangedStrengthBonus', '{V} '..Icons.Icon({'Ranged', type='skill', notext=true})..' Strength Bonus'}, |
| | {'magicStrengthBonus', '{V}% '..Icons.Icon({'Magic', type='skill', notext=true})..' Damage Bonus'}, |
| | {'meleeDefenceBonus', '{V} '..Icons.Icon({'Defence', type='skill', notext=true})..' Defence Bonus'}, |
| | {'rangedDefenceBonus', '{V} '..Icons.Icon({'Ranged', type='skill', notext=true})..' Defence Bonus'}, |
| | {'magicDefenceBonus', '{V} '..Icons.Icon({'Magic', type='skill', notext=true})..' Defence Bonus'}, |
| | {'damageReduction', '{V}% Damage Reduction'}, |
| | {'increasedSlayerXP', '{V}% '..Icons.Icon({'Slayer', type='skill', notext=true})..' Bonus XP'}, |
| | {'attackLevelRequired', '{V} '..Icons.Icon({'Attack', type='skill', notext=true})..' Level Required'}, |
| | {'defenceLevelRequired', '{V} '..Icons.Icon({'Defence', type='skill', notext=true})..' Level Required'}, |
| | {'rangedLevelRequired', '{V} '..Icons.Icon({'Ranged', type='skill', notext=true})..' Level Required'}, |
| | {'magicLevelRequired', '{V} '..Icons.Icon({'Magic', type='skill', notext=true})..' Level Required'}, |
| } | | } |
| local attBon1 = item1.attackBonus ~= nil and item1.attackBonus or {0, 0, 0} | | for i, stat in ipairs(statList) do |
| local attBon2 = item2.attackBonus ~= nil and item2.attackBonus or {0, 0, 0}
| | if stat[1] == 'increasedSlayerXP' then |
| getSpecificStatString(itemStats[1]['Stat']['stabAttackBonus'], itemStats[2]['Stat']['stabAttackBonus'], '{V} '..Icons.Icon({'Melee', notext=true})..' Stab Bonus')
| | getSpecificStatString(Items._getItemModifier(item1, stat[1], 'Slayer'), Items._getItemModifier(item2, stat[1], 'Slayer'), stat[2]) |
| getSpecificStatString(itemStats[1]['Stat']['slashAttackBonus'], itemStats[2]['Stat']['slashAttackBonus'], '{V} '..Icons.Icon({'Melee', notext=true})..' Slash Bonus')
| | else |
| getSpecificStatString(itemStats[1]['Stat']['blockAttackBonus'], itemStats[2]['Stat']['blockAttackBonus'], '{V} '..Icons.Icon({'Melee', notext=true})..' Block Bonus')
| | getSpecificStatString(Items._getItemStat(item1, stat[1]), Items._getItemStat(item2, stat[1]), stat[2]) |
| | | end |
| getSpecificStatString(itemStats[1]['Stat']['meleeStrengthBonus'], itemStats[2]['Stat']['meleeStrengthBonus'], '{V} '..Icons.Icon({'Strength', type='skill', notext=true})..' Strength Bonus')
| | end |
| getSpecificStatString(itemStats[1]['Stat']['rangedStrengthBonus'], itemStats[2]['Stat']['rangedStrengthBonus'], '{V} '..Icons.Icon({'Ranged', type='skill', notext=true})..' Strength Bonus')
| |
| getSpecificStatString(itemStats[1]['Stat']['magicStrengthBonus'], itemStats[2]['Stat']['magicStrengthBonus'], '{V}% '..Icons.Icon({'Magic', type='skill', notext=true})..' Damage Bonus')
| |
| | |
| getSpecificStatString(itemStats[1]['Stat']['meleeDefenceBonus'], itemStats[2]['Stat']['meleeDefenceBonus'], '{V} '..Icons.Icon({'Defence', type='skill', notext=true})..' Defence Bonus')
| |
| getSpecificStatString(itemStats[1]['Stat']['rangedDefenceBonus'], itemStats[2]['Stat']['rangeDefenceBonus'], '{V} '..Icons.Icon({'Ranged', type='skill', notext=true})..' Defence Bonus')
| |
| getSpecificStatString(itemStats[1]['Stat']['magicDefenceBonus'], itemStats[2]['Stat']['magicDefenceBonus'], '{V} '..Icons.Icon({'Magic', type='skill', notext=true})..' Defence Bonus')
| |
| getSpecificStatString(itemStats[1]['Stat']['damageReduction'], itemStats[2]['Stat']['damageReduction'], '{V}% Damage Reduction')
| |
| | |
| getSpecificStatString(itemStats[1]['SlayBon'], itemStats[2]['SlayBon'], '{V}% '..Icons.Icon({'Slayer', type='skill', notext=true})..' Bonus XP')
| |
| | |
| getSpecificStatString(itemStats[1]['Level']['Attack'], itemStats[2]['Level']['Attack'], '{V} '..Icons.Icon({'Attack', type='skill', notext=true})..' Level Required')
| |
| getSpecificStatString(itemStats[1]['Level']['Defence'], itemStats[2]['Level']['Defence'], '{V} '..Icons.Icon({'Defence', type='skill', notext=true})..' Level Required')
| |
| getSpecificStatString(itemStats[1]['Level']['Ranged'], itemStats[2]['Level']['Ranged'], '{V} '..Icons.Icon({'Ranged', type='skill', notext=true})..' Level Required')
| |
| getSpecificStatString(itemStats[1]['Level']['Magic'], itemStats[2]['Level']['Magic'], '{V} '..Icons.Icon({'Magic', type='skill', notext=true})..' Level Required') | |
|
| |
|
| return table.concat(changeArray, '<br/>') | | return table.concat(changeArray, '<br/>') |