Junior Member
Join Date: 05.06.2010
Country:
Location: Moscow
Reputation: 1066
|
Добавить:MountInfo in tooltip
local T, C, L, _ = unpack(select(2, ...))
---------------------------------------------------------------------------------------- -- MountInfo in tooltip(MountInfo by Yafis) ---------------------------------------------------------------------------------------- local t = { SetUnitAura = UnitAura, SetUnitBuff = UnitBuff, SetUnitDebuff = UnitDebuff, }
for k, v in pairs(t) do hooksecurefunc(GameTooltip, k, function(self, unit, index, filter) local a = {UnitAura(unit, index, filter)} if a[11] then for i = 1, C_MountJournal.GetNumMounts() do local _, spellID, _, _, _, _, _, _, _, _, isCollected = C_MountJournal.GetMountInfo(i) if spellID == a[11] then local _, _, sourceText = C_MountJournal.GetMountInfoExtra(i) if isCollected then self:AddLine("Already Known", RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b) else self:AddLine("You can explore", GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b) end self:AddLine(sourceText, 1, 1, 1) self:Show() end end end end) end
Items drop
local T, C, L, _ = unpack(select(2, ...))
---------------------------------------------------------------------------------------- -- Items drop (RaresTip by Nathanyel) ---------------------------------------------------------------------------------------- local tooltip = CreateFrame("GameTooltip", "RaresTip", UIParent, "GameTooltipTemplate") local rares = { [50750] = {"Aethis", 87649}, [50817] = {"Ahone the Wanderer", 86588}, [50821] = {"Ai-Li Skymirror", 86589}, [50822] = {"Ai-Ran the Shifting Cloud", 86590}, [50787] = {"Arness the Scale", 90723}, [51059] = {"Blackhoof", 86565}, [50828] = {"Bonobos", 86591}, [50341] = {"Borginn Darkfist", 86570}, [50768] = {"Cournith Waterstrider", 90721}, [50334] = {"Dak the Breaker", 86567}, [50772] = {"Eshelon", 87222}, [51078] = {"Ferdinand", 87652}, [50340] = {"Gaarn the Toxic", 90725}, [50739] = {"Gar'lok", 86578}, [50331] = {"Go-Kan", 90719}, [50354] = {"Havak", 86573}, [50836] = {"Ik-Ik the Nimble", 86593}, [50351] = {"Jonn-Dar", 86572}, [50355] = {"Kah'tir", 87218}, [50749] = {"Kal'tik the Blight", 86579}, [50349] = {"Kang the Soul Thief", 86571}, [50347] = {"Karr the Darkener", 86564}, [50332] = {"Korda Torros", 86566}, [50338] = {"Kor'nas Nightsavage", 87642}, [50363] = {"Krax'ik", 87646}, [50356] = {"Krol the Blade", 86574}, [50734] = {"Lith'ik the Stalker", 87221}, [50333] = {"Lon the Bull", 87219}, [50840] = {"Major Nanners", 86594}, [50823] = {"Mister Ferocious", 87652}, [50806] = {"Moldo One-Eye", 86586}, [50350] = {"Morgrinn Crackfang", 87643}, [50776] = {"Nalash Verdantis", 86563}, [50364] = {"Nal'lak the Ripper", 86576}, [50811] = {"Nasra Spothide", 86587}, [50789] = {"Nessos the Oracle", 86584}, [50344] = {"Norlaxx", 87220}, [50805] = {"Omnis Grinlok", 86585}, [50352] = {"Qu'nas", 90717}, [50816] = {"Ruun Ghostpaw", 90720}, [50780] = {"Sahn Tidehunter", 86582}, [50783] = {"Salyin Warscout", 86583}, [50782] = {"Sarnak", 87650}, [50831] = {"Scritch", 86592}, [50766] = {"Sele'na", 86580}, [50791] = {"Siltriss the Sharpener", 87223}, [50733] = {"Ski'thik", 86577}, [50830] = {"Spriggin", 90724}, [50339] = {"Sulik'shor", 86569}, [50832] = {"The Yowler", 87225}, [50388] = {"Torik-Ethis", 90718}, [50359] = {"Urgolax", 86575}, [50808] = {"Urobi the Walker", 87651}, [50336] = {"Yorik Sharpeye", 86568}, [50820] = {"Yul Wildpaw", 87224}, [50769] = {"Zai the Outcast", 86581}, -- 5.2 Isle of Thunder Rares [50358] = {"Haywire Sunreaver Construct", 94124}, [70530] = {"Ra'sha", 95566}, [69347] = {"Incomplete Drakkari Colossus", 94823}, [69767] = {"Ancient Mogu Guardian", 94826}, [69339] = {"Electromancer Ju'le", 94825}, [69471] = {"Spirit of Warlord Teng", 94707}, [70080] = {"Windweaver Akil'amon", 94709}, [69633] = {"Kor'dok", 94720}, [69749] = {"Qi'nor", 94824}, [69396] = {"Cera", 94706}, [69341] = {"Echo of Kros", 94708}, -- 5.2 Warbringers and their mounts [69769] = {"Zandalari Warbringer (Slate)", 94229}, [69841] = {"Zandalari Warbringer (Amber)", 94230}, [69842] = {"Zandalari Warbringer (Jade)", 94231}, -- Other MoP NPCs/Rares [65003] = {"Martar the Not-So-Smart", 87780}, [66281] = {"Fixxul Lonelyheart", 90078}, [66911] = {"Lorbu Sadsummon ", 90078}, [66900] = {"Huggalon the Heart Watcher", 90067}, [58883] = {"Feverbite", 89365}, [66464] = {"Zhing", 89697}, [66587] = {"Pengsong", 89770}, [58895] = {"Sungraze Behemoth", 89682}, [61848] = {"Wild Onyx Serpent", 93360}, [66162] = {"Scotty", 89373}, [64403] = {"Alani", 90655}, [62767] = {"Gokk'lok", 88417}, [66467] = {"G'nathus", 94595}, -- Thunderfury Bindings [12056] = {"Baron Geddon", 18563}, [12057] = {"Garr", 18564}, -- Timeless Isle Rares [71920] = {"Cursed Hozen Swabby", 104015}, [72193] = {"Karkanos", 104035}, [72875] = {"Ordon Candlekeeper", 86565}, [72895] = {"Burning Berserker", 86566}, [72777] = {"Gulp Frog", 86580}, [73021] = {"Spectral Windwalker", 104336}, [73025] = {"Spectral Mistweaver", 104334}, [72898] = {"High Priest of Ordos", 104329}, [72048] = {"Rattleskew", 104321}, [73157] = {"Rock Moss", 104313}, [72896] = {"Eternal Kilnmaster", 104309}, [73173] = {"Urdur the Cauterizer", 104306}, [72897] = {"Blazebound Chanter", 104304}, [73171] = {"Champion of the Black Flame", 104302}, [73172] = {"Flintlord Gairan", 104298}, [72766] = {"Ancient Spineclaw", 104293}, [72909] = {"Gu'chi the Swarmbringer", 104291}, [72877] = {"Ashleaf Sprite", 104289}, [73158] = {"Emerald Gander", 104287}, [72762] = {"Brilliant Windfeather", 104287}, [73277] = {"Leafmender", 104156}, [73167] = {"Huolon", 104269}, [72970] = {"Golganarr", 104262}, [72809] = {"Eroded Cliffdweller", 104262}, [72007] = {"Master Kukuru (pet drops in chests opened with keys sold by NPC)", 104202}, [73166] = {"Monstrous Spineclaw", 104168}, [73162] = {"Foreboding Flame", 104166}, [73163] = {"Imperial Python", 104161}, [73282] = {"Garnia", 104159}, [73166] = {"Monstrous Spineclaw", 104168}, [72892] = {"Ordon Oathguard", 104330}, [73666] = {"Archiereus of Flame (summoned)", 86574}, [73174] = {"Archiereus of Flame", 86574}, [73161] = {"Great Turtle Furyshell", 86584}, [72045] = {"Chelon", 86584}, [73018] = {"Spectral Brewmaster", 104335}, [73169] = {"Jakur of Ordon", 104331}, [72888] = {"Molten Guardian", 104328}, [71864] = {"Spelurk", 104320}, [72771] = {"Damp Shambler", 104312}, [72769] = {"Spirit of Jadefire", 104307}, [73170] = {"Watcher Osu", 104305}, [72245] = {"Zesqua", 104303}, [73175] = {"Cinderfall", 104299}, [73281] = {"Dread Ship Vazuvius", 104294}, [72841] = {"Death Adder", 104292}, [72908] = {"Spotted Swarmer", 104290}, [72876] = {"Quivering Firestorm Egg", 104286}, [72049] = {"Cranegnasher", 104268}, [72808] = {"Tsavo'ka", 104268}, [72805] = {"Primal Stalker", 104268}, [72775] = {"Bufo", 104169}, [71919] = {"Zhu-Gon the Sour", 104167}, [72767] = {"Jademist Dancer", 104164}, -- Misc [32491] = {"Time-Lost Proto-Drake", 44168}, -- Test [30] = {"Time-Lost Proto-Drake", 774}, } GameTooltip:HookScript("OnTooltipSetUnit", function(self) if not UnitExists("mouseover") then tooltip:Hide() return end local id = tonumber(strmatch(UnitGUID("mouseover") or "", "-(%d+)-%x+$"), 10) if not rares[id] then tooltip:Hide() return end local itemID = rares[id][2] GetItemInfo(itemID) tooltip:SetTemplate("Transparent") tooltip:SetOwner(self, "ANCHOR_TOPRIGHT", 0, 3) tooltip:SetItemByID(itemID) end)
GameTooltip:HookScript("OnHide", function(self) tooltip:Hide() end) if C.tooltip.shift_modifer ~= true then hooksecurefunc(GameTooltip, "FadeOut", function(self) tooltip:FadeOut() end) end
Mouseover out of range pointer
http://i.imgur.com/pWv29TA.jpg
local T, C, L, _ = unpack(select(2, ...))
---------------------------------------------------------------------------------------- -- Mouseover out of range pointer(Mouseover Out of Range Pointer by Gello) ---------------------------------------------------------------------------------------- local slowThrottle = 0.50 -- Update speed when not over a unit frame local midThrottle = 0.10 -- Update speed while over a unit that is far away local fastThrottle = 0.01 -- Update speed while unit is relatively near
local pointer = CreateFrame("Frame", nil, UIParent) pointer.timer = 0 pointer:SetFrameStrata("FULLSCREEN")
pointer.arrow = pointer:CreateTexture(nil, "OVERLAY") -- The actual arrow pointer.arrow:SetSize(32, 32) pointer.arrow:SetTexture("Interface\\MiniMap\\MiniMap-QuestArrow")
local sqrt2 = sqrt(2) -- Stuff to help texcoord mumbo jumbo later local rads45 = 0.25 * PI local rads135 = 0.75 * PI local rads225 = 1.25 * PI local cos, sin = math.cos, math.sin local function corner(r) return 0.5 + cos(r) / sqrt2, 0.5 + sin(r) / sqrt2 end
-- Self here is pointer.arrow; update whether to show arrow and direction it points local function UpdateArrow(self) -- See if there's a unit frame under the mouse local focus = GetMouseFocus() local unit = focus and focus:GetAttribute("unit") if not unit then self:Hide() pointer.timer = slowThrottle return end
local playerX, playerY = UnitPosition("player") local unitX, unitY = UnitPosition(unit)
-- UnitInRange() is what dims default raid frames; it doesn't precisely align with UnitDistanceSquared() -- so using UnitInRange() for the more-important check if in spell casting range local inRange = UnitInRange(unit)
-- Hide arrow if unit does not have coordinates (not in group, pet, etc), or -- player and unit are same unit, or unit is near (and ShowInRange not set in options) if not playerX or not unitX or UnitIsUnit("player", unit) or inRange then self:Hide() pointer.timer = midThrottle return end
local distance = UnitDistanceSquared(unit)
pointer.timer = fastThrottle -- We're going to show an arrow, speed up updates
if inRange then -- Less than 40 yards, near: green (distance 1600 is not reliable with UnitInRange--so going with more visible API) self:SetVertexColor(0, 1, 0) elseif distance < 22500 then -- Less than 150 yards, oor but near: yellow (default color) self:SetVertexColor(1, 1, 1) elseif distance < 250000 then -- Less than 500 yards, relatively far away: red self:SetVertexColor(1, 0, 0) else -- Greater than 500 yards, very far away: brown self:SetVertexColor(0.5, 0.5, 1) end
-- Calculate angle between player facing and mouseover map position (trig courtesy of Javonthalas-Hyjal) local angle = atan2(unitY - playerY, unitX - playerX) * PI / 180 - GetPlayerFacing()
-- Rotate arrow to the calculated angle; from [url]http://wowpedia.org/SetTexCoord_Transformations[/url] local ULx,ULy = corner(angle + rads225) local LLx,LLy = corner(angle + rads135) local URx,URy = corner(angle - rads45) local LRx,LRy = corner(angle + rads45) self:SetTexCoord(ULx, ULy, LLx, LLy, URx, URy, LRx, LRy)
-- Position arrow to lowerleft of cursor local cursorX, cursorY = GetCursorPosition() local scale = UIParent:GetEffectiveScale() self:SetPoint("CENTER", UIParent, "BOTTOMLEFT", cursorX / scale - 10, cursorY / scale - 12)
self:Show() end
pointer:SetScript("OnUpdate", function(self, elapsed) self.timer = self.timer - elapsed if self.timer < 0 then UpdateArrow(self.arrow) end end)
WorldFrame:HookScript("OnEnter", function() pointer:Hide() end) WorldFrame:HookScript("OnLeave", function() if IsInGroup() then pointer.timer = 0 pointer:Show() end end)
Заменить:AutoButton ?
local T, C, L, _ = unpack(select(2, ...))
---------------------------------------------------------------------------------------- -- AutoButton for quest items(ExtraQuestButton by p3lim) ---------------------------------------------------------------------------------------- local AutoButtonAnchor = CreateFrame("Frame", "AutoButtonAnchor", UIParent) AutoButtonAnchor:SetPoint(unpack(C.position.auto_button)) AutoButtonAnchor:SetSize(40, 40)
local Button = CreateFrame("Button", (...), UIParent, "SecureActionButtonTemplate, SecureHandlerStateTemplate, SecureHandlerAttributeTemplate") RegisterStateDriver(Button, "visible", "[extrabar] hide; show") Button:SetAttribute("_onattributechanged", [[ if(name == 'item') then if(value and not self:IsShown() and not HasExtraActionBar()) then self:Show() elseif(not value) then self:Hide() self:ClearBindings() end elseif(name == 'state-visible') then if(value == 'show') then self:CallMethod('Update') else self:Hide() self:ClearBindings() end end
if(self:IsShown() and (name == 'item' or name == 'binding')) then self:ClearBindings()
local key = GetBindingKey('EXTRAACTIONBUTTON1') if(key) then self:SetBindingClick(1, key, self, 'LeftButton') end end ]])
Button:RegisterEvent("PLAYER_LOGIN") Button:SetScript("OnEvent", function(self, event) if event == "BAG_UPDATE_COOLDOWN" then if self:IsShown() then local start, duration, enable = GetItemCooldown(self.itemID) if duration > 0 then self.Cooldown:SetCooldown(start, duration) self.Cooldown:Show() else self.Cooldown:Hide() end end elseif event == "PLAYER_REGEN_ENABLED" then self:SetAttribute("item", self.attribute) self:UnregisterEvent(event) elseif event == "UPDATE_BINDINGS" then if self:IsShown() then self:SetItem() self:SetAttribute("binding", GetTime()) end elseif event == "PLAYER_LOGIN" then self:SetPoint("CENTER", AutoButtonAnchor, "CENTER", 0, 0) self:SetSize(40, 40) self:SetTemplate("Default") self:StyleButton() self:SetScript("OnLeave", GameTooltip_Hide) self:SetAttribute("type", "item") self.updateTimer = 0 self.rangeTimer = 0 self:Hide()
local Icon = self:CreateTexture("$parentIcon", "OVERLAY") Icon:SetTexCoord(0.1, 0.9, 0.1, 0.9) Icon:SetPoint("TOPLEFT", self, "TOPLEFT", 2, -2) Icon:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -2, 2)
self.Icon = Icon
local HotKey = self:CreateFontString("$parentHotKey", "OVERLAY") HotKey:SetFont(C.media.pixel_font, C.media.pixel_font_size * 2, C.media.pixel_font_style) HotKey:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", 1, -2) HotKey:SetJustifyH("CENTER") self.HotKey = HotKey
-- local Count = self:CreateFontString("$parentCount", "OVERLAY") -- Count:SetFont(C.media.pixel_font, C.media.pixel_font_size * 2, C.media.pixel_font_style) -- Count:SetPoint("TOPLEFT", self, "TOPLEFT", 1, -2) -- Count:SetJustifyH("CENTER") -- self.Count = Count
local Cooldown = CreateFrame("Cooldown", "$parentCooldown", self, "CooldownFrameTemplate") Cooldown:ClearAllPoints() Cooldown:SetPoint("TOPLEFT", self, "TOPLEFT", 2, -2) Cooldown:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -2, 2) Cooldown:SetDrawEdge(false) Cooldown:Hide() self.Cooldown = Cooldown
self:RegisterEvent("UPDATE_BINDINGS") self:RegisterEvent("UPDATE_EXTRA_ACTIONBAR") self:RegisterEvent("BAG_UPDATE_COOLDOWN") self:RegisterEvent("BAG_UPDATE_DELAYED") self:RegisterEvent("WORLD_MAP_UPDATE") self:RegisterEvent("QUEST_LOG_UPDATE") self:RegisterEvent("QUEST_POI_UPDATE") else self:Update() end end)
Button:SetScript("OnEnter", function(self) GameTooltip:SetOwner(self, "ANCHOR_LEFT") GameTooltip:SetHyperlink(self.itemLink) end)
Button:SetScript("OnUpdate", function(self, elapsed) if self.rangeTimer > TOOLTIP_UPDATE_TIME then local HotKey = self.HotKey local Icon = self.Icon local inRange = IsItemInRange(self.itemLink, "target") if HotKey:GetText() == RANGE_INDICATOR then if inRange == false then HotKey:SetTextColor(1, 0.1, 0.1) HotKey:Show() Icon:SetVertexColor(1, 0.1, 0.1) elseif inRange then HotKey:SetTextColor(1, 1, 1) HotKey:Show() Icon:SetVertexColor(1, 1, 1) else HotKey:Hide() end else if inRange == false then HotKey:SetTextColor(1, 0.1, 0.1) Icon:SetVertexColor(1, 0.1, 0.1) else HotKey:SetTextColor(1, 1, 1) Icon:SetVertexColor(1, 1, 1) end end
self.rangeTimer = 0 else self.rangeTimer = self.rangeTimer + elapsed end
if self.updateTimer > 5 then self:Update() self.updateTimer = 0 else self.updateTimer = self.updateTimer + elapsed end end)
function Button:SetItem(itemLink, texture) if itemLink then if itemLink == self.itemLink and self:IsShown() then return end
self.Icon:SetTexture(texture) self.itemID, self.itemName = string.match(itemLink, "|Hitem:(.-):.-|h%[(.+)%]|h") self.itemLink = itemLink end
local HotKey = self.HotKey local key = GetBindingKey("EXTRAACTIONBUTTON1") if key then HotKey:SetText(GetBindingText(key, 1)) HotKey:Show() elseif ItemHasRange(self.itemLink) then HotKey:SetText(RANGE_INDICATOR) HotKey:Show() else HotKey:Hide() end
if InCombatLockdown() then self.attribute = self.itemName self:RegisterEvent("PLAYER_REGEN_ENABLED") else self:SetAttribute("item", self.itemName) end end
function Button:RemoveItem() if InCombatLockdown() then self.attribute = nil self:RegisterEvent("PLAYER_REGEN_ENABLED") else self:SetAttribute("item", nil) end end
function Button:Update() local shortestDistance = 62500 local closestQuestLink, closestQuestTexture
for index = 1, GetNumQuestWatches() do local questID, _, questIndex, _, _, isComplete = GetQuestWatchInfo(index) if questID and QuestHasPOIInfo(questID) then local link, texture, _, showCompleted = GetQuestLogSpecialItemInfo(questIndex) if link and (not isComplete or (isComplete and showCompleted)) then local distanceSq, onContinent = GetDistanceSqToQuest(questIndex) if onContinent and distanceSq < shortestDistance then shortestDistance = distanceSq closestQuestLink = link closestQuestTexture = texture end end end end
if closestQuestLink and not HasExtraActionBar() then self:SetItem(closestQuestLink, closestQuestTexture) elseif self:IsShown() then self:RemoveItem() end end
|