Module:Modifiers: Difference between revisions

Handle new scope source ID 'melvorD:CombatArea'
(Amend error handling)
(Handle new scope source ID 'melvorD:CombatArea')
Line 391: Line 391:
-- Uses spell categories, contained within magic skill data
-- Uses spell categories, contained within magic skill data
scopeSourceData = GameData.skillData.Magic
scopeSourceData = GameData.skillData.Magic
elseif scopeSourceID == 'melvorD:CombatArea' then
scopeSourceData = GameData.rawData
elseif scopeSourceID ~= nil then
elseif scopeSourceID ~= nil then
-- Assumed to be a skill ID
-- Assumed to be a skill ID
Line 433: Line 435:
elseif tKey == 'categoryName' then
elseif tKey == 'categoryName' then
if scopeSourceData == nil then
if scopeSourceData == nil then
error('Skill data is required for scope type ' .. tKey, 2)
error('Scope data is required for scope type ' .. tKey, 2)
end
end
local catKey = (
local catKey = (
(scopeSourceID == 'AttackSpell' and 'spellCategories')
(scopeSourceID == 'AttackSpell' and 'spellCategories')
or (scopeSourceID == 'melvorD:CombatArea' and 'combatAreaCategories')
or (scopeSourceID == 'melvorD:Thieving' and 'areas')
or (scopeSourceID == 'melvorD:Thieving' and 'areas')
or (scopeSourceID == 'melvorD:Township' and 'biomes')
or (scopeSourceID == 'melvorD:Township' and 'biomes')
Line 646: Line 649:


function p.test2()
function p.test2()
local item = GameData.getEntityByID('items', 'melvorF:Miners_Helmet') --'melvorD:Aorpheats_Signet_Ring')
local obj = GameData.getEntityByID('pets', 'melvorF:Harley') --'melvorD:Aorpheats_Signet_Ring')
return p.getModifiersText(item.modifiers, true, false, 5)
return p.getModifiersText(obj.modifiers, true, false, 5)
--return p.getModifierSkills(item.modifiers)
--return p.getModifierSkills(item.modifiers)
end
end