/
if self.offset[PetPaperDollFrameCompanionFrame.mode] ~= self.scrollBar:GetValue() then |
self.scrollBar:SetValue(self.offset[PetPaperDollFrameCompanionFrame.mode]) |
end |
if PetPaperDollFrameCompanionFrame.mode ~= "CRITTER" then |
self.random:Hide() |
else |
self.random:Show() |
end |
end) |
function self:OnEvent(this, event, arg1) |
modelBG:SetTexCoord(0,0.6,0,0.9) |
--modelBG:SetTexture(1,0,0) |
self.random = CreateFrame("Button", "PetListClickRandom", self.model, "UIPanelButtonTemplate") |
self.random:SetText("Random Pet") |
self.random:SetWidth(100) |
self.random:SetHeight(22) |
self.random:SetPoint("BOTTOMLEFT", self.model, -2, 0) |
self.random:SetScript("OnClick", function() |
CallCompanion("CRITTER", random(GetNumCompanions("CRITTER"))) |
end) |
self.buttons = {} |
self.buttons[1] = self:CreateCompanionButton(1) |
self.buttons[1]:SetPoint("TOPLEFT", self.model, "BOTTOMLEFT") |
--Scrolls +2/-2, doesnt exceed max value |
self.scrollBar:SetValue(min(self.scrollBar:GetValue() + (direction * -2), select(2, self.scrollBar:GetMinMaxValues()))) |
end) |
button:SetScript("OnEnter", function() |
local _,_,spellID = GetCompanionInfo(PetPaperDollFrameCompanionFrame.mode, button:GetID()) |
GameTooltip:SetOwner(button, "ANCHOR_CURSOR") |
GameTooltip:SetHyperlink("spell:"..spellID) |
GameTooltip:Show() |
end) |
button:SetScript("OnLeave", function() GameTooltip:Hide() end) |
return button |
end |