All pastes #166031 Raw Edit

Someone

public text v1 · immutable
·published 2006-09-10 14:11 UTC
rendered paste body
	CacheEquipmentData = function(self)
		self.extraHealingAmount = 0
		self.extraHealingAmountPossible = 0
		self.hasItemIdolOfRejuvenation = 0
		self.hasItemTotemOfLife = 0
		self.hasItemTotemOfSustaining = 0
		self.hasItemLibramOfDivinity = 0
		self.hasItemLibramOfLight = 0
		self.hasBenefitStormrage = false
		self.hasBenefitDreamwalker = false
		self.hasBenefitTranscendance = false
		self.hasBrokenPlusHealingItems = false
		local _SMH_setNames = { }
		local canLookForSetPatterns, itemIsBroken
		local slot

		for i, slot in self.equipmentSlots do
			local id, _ = GetInventorySlotInfo(slot.."Slot")
			local item, _, _ = smhTooltip:SetInventoryItem('player', id)
			if item then
				canLookForSetPatterns = false
				itemIsBroken = false
				itemPlusHealingValue = 0
				local lineCount = smhTooltip:NumLines()
				for j = 1, lineCount, 1 do
					local text = getglobal("smhTooltipTextLeft"..j)
					if text then
						local line = text:GetText()

						--	First we look for specific items of interest
						if j == 1 then
							if line == SMH_ITEM_IDOL_OF_REJUVENATION then
								self.hasItemIdolOfRejuvenation = self:NumberFromTooltipLine(lineCount); break
							elseif line == SMH_ITEM_TOTEM_OF_LIFE then
								self.hasItemTotemOfLife = self:NumberFromTooltipLine(lineCount); break
							elseif line == SMH_ITEM_TOTEM_OF_SUSTAINING then
								self.hasItemTotemOfSustaining = self:NumberFromTooltipLine(lineCount); break
							elseif line == SMH_ITEM_LIBRAM_OF_DIVINITY then
								self.hasItemLibramOfDivinity = self:NumberFromTooltipLine(lineCount); break
							elseif line == SMH_ITEM_LIBRAM_OF_LIGHT then
								self.hasItemLibramOfLight = self:NumberFromTooltipLine(lineCount); break
							end
						end

						local match, setName = string.find(line, self.setNamePattern)
						if match ~= nil then
							if not _SMH_setNames[setName] then
								canLookForSetPatterns = true
								_SMH_setNames[setName] = true
							end
						end

						local match, where, current, total = string.find(line, _smh_DurabilityPattern)
						if match ~= nil then
							if tonumber(total) > 0 and tonumber(current) == 0 then itemIsBroken = true end
						end

						for k, pattern in _smh_healingPatterns do
							local match, _, amount = string.find(line, pattern)
							if (match ~= nil) then
								self:OutputMessage("DEBUG", "On "..slot.." found "..tonumber(amount).." healing.")
								itemPlusHealingValue = itemPlusHealingValue + tonumber(amount)
								break
							end
						end
						if canLookForSetPatterns then
							local possibleMatch
							possibleMatch, _ = string.find(line, _smh_setPatternStormrage)
							if possibleMatch ~= nil then
								self.hasBenefitStormrage = true
								self:OutputMessage("DEBUG", "Found Stormrage benefit.")
							else
								possibleMatch, _ = string.find(line, _smh_setPatternDreamwalker)
								if possibleMatch ~= nil then
									self.hasBenefitDreamwalker = true
									self:OutputMessage("DEBUG", "Found Dreamwalker benefit.")
								else
									possibleMatch, _ = string.find(line, _smh_setPatternTranscendance)
									if possibleMatch ~= nil then
										self.hasBenefitTranscendance = true
										self:OutputMessage("DEBUG", "Found Transcendance benefit")
									else
										for k, pattern in _smh_setHealingPatterns do
											local match, _, amount = string.find(line, pattern)
											if match ~= nil then
												self:OutputMessage("DEBUG", "On "..slot.." found "..tonumber(amount).." healing as part of set.")
												itemPlusHealingValue = itemPlusHealingValue + tonumber(amount)
												break
											end
										end
									end
								end
							end

						end
					end
				end
				if itemPlusHealingValue > 0 then
					if itemIsBroken then
						self.hasBrokenPlusHealingItems = true
						self:OutputMessage("DEBUG", "Item in " .. slot .. " slot is broken, but should have provided " .. itemPlusHealingValue .. " +healing.")
						self.extraHealingAmountPossible = self.extraHealingAmountPossible + itemPlusHealingValue
					else
						self.extraHealingAmount = self.extraHealingAmount + itemPlusHealingValue
						self.extraHealingAmountPossible = self.extraHealingAmountPossible + itemPlusHealingValue
					end
				end
			end
		end

		self:OutputMessage("DEBUG", "Total extra healing found on equipment: ".. self.extraHealingAmount)

		return self.extraHealingAmount, self.extraHealingAmountPossible

	end,