sorcery  Diff

Differences From Artifact [569b7fff67]:

To Artifact [c83bd974f4]:


   171    171   	sorcery.enchant.strength = function(stack,id)
   172    172   		-- this functions should be used whenever you need to
   173    173   		-- determine the power of a particular enchantment on
   174    174   		-- an enchanted item.
   175    175   		local e = sorcery.enchant.get(stack)
   176    176   		local p = 0.0
   177    177   		local ct = 0
   178         -		local slots = sorcery.matreg.lookup[stack:get_name()].data.slots
          178  +		local slots = sorcery.matreg.lookup[stack:get_name()]
          179  +		if not (slots and slots.data and slots.data.slots) then return p, ct end
          180  +		slots = slots.data.slots
   179    181   		-- TODO handle strength-boosting spells!
   180    182   		for _,s in pairs(e.spells) do
   181    183   			if s.id == id then
   182    184   				p = p + ((s.boost * slots[s.slot].confluence)/10)
   183    185   				ct = ct + 1
   184    186   			end
   185    187   		end