Commit a5549906 authored by Robin Schoonover's avatar Robin Schoonover

Import some basic code.

parents
## Interface: 50100
## Title: AllTheIDs
GameTooltip.lua
local function AddIDLine(tip, name, id)
if not tip._alltheid then
tip._alltheid = name
tip:AddLine(format("|cff33cc44%s ID:|r %s", name, id))
if tip:IsShown() then
-- force redraw
tip:Show()
end
end
end
local function HookTipScript(...)
GameTooltip:HookScript(...)
ItemRefTooltip:HookScript(...)
end
local function HookTip(method, hookfunc)
hooksecurefunc(GameTooltip, method, function(self, ...) hookfunc(GameTooltip, ...) end)
hooksecurefunc(ItemRefTooltip, method, function(self, ...) hookfunc(ItemRefTooltip, ...) end)
end
local function TODO(tip, name, ...)
print("TODO AllTheIDs: ",name, ...)
print("GetItem: ", tip:GetItem())
print("GetSpell: ", tip:GetSpell())
print("GetUnit: ", tip:GetUnit())
end
--
--
--
HookTipScript("OnTooltipCleared", function(self)
self._alltheid = nil
end)
HookTipScript("OnTooltipSetItem", function(self)
local name, link = self:GetItem()
if link then
local _,_,id = strfind(link, "|Hitem:(%d+):")
AddIDLine(self, "Item", id)
end
end)
HookTipScript("OnTooltipSetSpell", function(self)
local name, rank, spellID = self:GetSpell()
AddIDLine(self, "Spell", spellID)
end)
HookTipScript("OnTooltipSetUnit", function(self)
local name, unit = self:GetUnit()
local guid = UnitGUID(unit)
local utype = strsub(guid, 5, 5)
if utype == "1" then
-- world object
AddIDLine(self, "Object", tonumber(strsub(guid, 6, 12), 16))
elseif utype == "3" or utype == "5" then
-- npc/pet/vehicle
AddIDLine(self, "NPC", tonumber(strsub(guid, 6, 10), 16))
end
end)
--
--
--
HookTip("SetAchievementByID", function(self, id)
AddIDLine(self, "Achievement", id)
end)
HookTip("SetCurrencyByID", function(self, id)
AddIDLine(self, "Currency", id)
end)
HookTip("SetCurrencyToken", function(self, idx)
TODO(self, "SetCurrencyToken")
end)
HookTip("SetGlyph", function(self, socket, talent)
TODO(self, "SetGlyph", socket, talent)
end)
HookTip("SetGlyphByID", function(self, id)
AddIDLine(self, "Glyph", id)
end)
HookTip("SetGuildBankItem", function(self, tab, slot)
TODO(self, "SetGuildBankItem")
end)
HookTip("SetHyperlink", function(self, link)
local _, _, name, id = strfind(link, "(%w+):(%d+)")
AddIDLine(self, name:gsub("^%l", string.upper), id)
end)
HookTip("SetInboxItem", function(self, mail, attach)
TODO(self, "SetInboxItem")
end)
HookTip("SetInventoryItem", function(self, unit, slot, nameOnly)
TODO(self, "SetInventoryItem")
end)
HookTip("SetInventoryItemByID", function(self, id)
TODO(self, "SetInventoryItemByID")
end)
HookTip("SetItemByID", function(self, id)
AddIDLine(self, "Item", id)
end)
HookTip("SetLFGCompletionReward", function(self)
TODO(self, "SetLFGCompletionReward")
end)
HookTip("SetLFGDungeonReward", function(self)
TODO(self, "SetLFGDungeonReward")
end)
HookTip("SetLFGDungeonShortageReward", function(self)
TODO(self, "SetLFGDungeonShortageReward")
end)
HookTip("SetLootCurrency", function(self)
TODO(self, "SetLootCurrency")
end)
HookTip("SetLootItem", function(self, slot)
TODO(self, "SetLootItem")
end)
HookTip("SetLootRollItem", function(self, id)
TODO(self, "SetLootRollItem")
end)
HookTip("SetMerchantCostItem", function(self, idx, currency)
TODO(self, "SetMerchantCostItem")
end)
HookTip("SetMerchantItem", function(self, idx)
TODO(self, "SetMerchantItem")
end)
HookTip("SetMissingLootItem", function(self)
TODO(self, "SetMissingLootItem")
end)
HookTip("SetPetAction", function(self, idx)
TODO(self, "SetPetAction")
end)
HookTip("SetPossession", function(self, idx)
TODO(self, "SetPossession")
end)
HookTip("SetQuestCurrency", function(self)
TODO(self, "SetQuestCurrency")
end)
HookTip("SetQuestItem", function(self, itemType, idx)
TODO(self, "SetQuestItem")
end)
HookTip("SetQuestLogCurrency", function(self, ...)
TODO(self, "SetQuestLogCurrency", ...)
end)
HookTip("SetQuestLogItem", function(self, itemType, index)
TODO(self, "SetQuestLogItem", itemType, index)
end)
HookTip("SetQuestLogRewardSpell", function(self, idx)
TODO(self, "SetQuestLogRewardSpell", idx)
end)
HookTip("SetQuestLogSpecialItem", function(self, idx)
TODO(self, "SetQuestLogSpecialItem", idx)
end)
HookTip("SetQuestRewardSpell", function(self, ...)
TODO(self, "SetQuestRewardSpell", ...)
end)
HookTip("SetReforgeItem", function(self, ...)
TODO(self, "SetReforgeItem", ...)
end)
HookTip("SetSendMailItem", function(self, slot)
TODO(self, "SetSendMailItem", slot)
end)
HookTip("SetShapeshift", function(self, index)
TODO(self, "SetShapeshift", index)
end)
HookTip("SetSocketGem", function(self, index)
TODO(self, "SetSocketGem", index)
end)
HookTip("SetSocketedItem", function(self, ...)
TODO(self, "SetSocketedItem", ...)
end)
HookTip("SetSpellBookItem", function(self, ...)
TODO(self, "SetSpellBookItem", ...)
end)
HookTip("SetTotem", function(self, slot)
TODO(self, "SetTotem", slot)
end)
HookTip("SetTradePlayerItem", function(self, idx)
TODO(self, "SetTradePlayerItem", idx)
end)
HookTip("SetTradeSkillItem", function(self, skillIndex, reagentIndex)
TODO(self, "SetTradeSkillItem", skillIndex, reagentIndex)
end)
HookTip("SetTradeTargetItem", function(self, idx)
TODO(self, "SetTradeTargetItem", idx)
end)
HookTip("SetTrainerService", function(self, idx)
TODO(self, "SetTrainerService", idx)
end)
HookTip("SetTransmogrifyItem", function(self, ...)
TODO(self, "SetTransmogrifyItem", ...)
end)
HookTip("SetUnitAura", function(self, unit, index, filter)
TODO(self, "SetUnitAura", unit, index, filter)
end)
HookTip("SetUnitBuff", function(self, unit, index, filter)
TODO(self, "SetUnitBuff", unit, index, filter)
end)
HookTip("SetUnitDebuff", function(self, unit, index, filter)
TODO(self, "SetUnitDebuff", unit, index, filter)
end)
HookTip("SetUpgradeItem", function(self, ...)
TODO(self, "SetUpgradeItem", ...)
end)
HookTip("SetVoidDepositItem", function(self, ...)
TODO(self, "SetVoidDepositItem", ...)
end)
HookTip("SetVoidItem", function(self, ...)
TODO(self, "SetVoidItem", ...)
end)
HookTip("SetVoidWithdrawalItem", function(self, ...)
TODO(self, "SetVoidWithdrawalItem", ...)
end)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment