All pastes #60346 Raw Edit

Cladhaire

public lua v1 · immutable
#60346 ·published 2006-05-31 17:09 UTC
rendered paste body
local SLOTNAMES = {	"HeadSlot",	"NeckSlot",	"ShoulderSlot",	"ShirtSlot",	"ChestSlot",	"WaistSlot",	"LegsSlot",	"FeetSlot",	"WristSlot",	"HandsSlot",	"Finger0Slot",	"Finger1Slot",	"Trinket0Slot",	"Trinket1Slot",	"BackSlot",	"MainHandSlot",	"SecondaryHandSlot",	"RangedSlot",	"TabardSlot",};local EQUIP_PREFIX = "^Equip: ";local SET_PREFIX = "Set: ";local HEALBONUS_PATTERNS = {	"Increases healing done by spells and effects by up to (%d+)%.",	"Increases damage and healing done by magical spells and effects by up to (%d+)%."};-- This requires a tooltip to exist, and as currently written expects it to exist under self.tooltip.-- Currently expects the tooltip to be named BishopTooltip, but this is easy to change.function Bishop:ScanPlusHealing()		if arg1 ~= "player" and not force then 		self:debug("Caught a UNIT_INVENTORY_CHANGED() for someone other than 'player'.  Dropping")		return	end		self:debug("Parsing the inventory for +healing items.")		local id, hasItem, ttLine	local healBonus = 0		for i,slotName in SLOTNAMES do		id,_ = GetInventorySlotInfo(slotName)				hasItem = self.tooltip:SetInventoryItem("player", id)				if not hasItem then			self.tooltip:ClearLines()		else			self:debug("Found an item in " .. slotName)						local itemName = BishopTooltipTextLeft1:GetText()			local lines = self.tooltip:NumLines()						for i=2,lines,1 do 				ttLine = getglobal("BishopTooltipTextLeft"..i)				local text = ttLine:GetText()				if text then 					-- We need to parse this line of the tooltip					-- Lets see if we have an "Equip:" string					-- As of right now, there are no set bonus healing bonuses, but that may change.										if string.find(text, EQUIP_PREFIX) then						for idx,pattern in HEALBONUS_PATTERNS do							local _,_,value = string.find(text, pattern)														-- We have a heal bonus string in Equip:							if value then 															self:debug("Found a heal bonus in following line:")								self:debug(text)								healBonus = healBonus + value								self:debug("Incremented self.healBonus to " .. healBonus)							end 						end					end				end 			end 		end	endend