Blizzard default UI adds quest objective info in mob tooltips. I can't remember how it is enabled or disabled (or even if it could be disabled).
Too my knowledge you can't, and plus you really wouldn't want to anyway, as WoW has more information about it's quests than a mod, unless ofcourse it comes lumbered with a giant database.
Definitely looks like some kind of mount addons debug messages
Assuming not too many people are hooking AddMessage, and the message is being added to the DEFAULT_CHAT_FRAME, then the attached mod will print out the sent message followed by what sent it (which will be a couple of lines long).
When the spam gets shown again can you please take a screenshot of the output, the text will be in blue.
You could create an invisible EditBox (the type of frame appearing under the default chat window when users are typing), use :SetText("/say something") to essentially type the string into the box, and then call the same function it calls to run the parser. I don't recall offhand what that function is named; you could look in FrameXML\ChatFrame.lua for more.
Doing this does not allow the execution of secure slash commands, though.
ChatEdit_ParseText() - line 3285 of ChatFrame.lua
function ChatEdit_ParseText(editBox, send)
local text = editBox:GetText();
if ( strlen(text) <= 0 ) then
return;
end
if ( strsub(text, 1, 1) ~= "/" ) then
return;
end
-- If the string is in the format "/cmd blah", command will be "/cmd"
local command = strmatch(text, "^(/[^%s]+)") or "";
local msg = "";
if ( command ~= text ) then
msg = strsub(text, strlen(command) + 2);
end
command = strupper(command);
-- Check and see if we've got secure commands to run before we look for chat types or slash commands.
-- This hash table is prepopulated, unlike the other ones, since nobody can add secure commands. (See line 1205 or thereabouts)
-- We don't want this code to run unless send is 1, but we need ChatEdit_HandleChatType to run when send is 1 as well, which is why we
-- didn't just move ChatEdit_HandleChatType inside the send == 0 conditional, which could have also solved the problem with insecure
-- code having the ability to affect secure commands.
if ( send == 1 and hash_SecureCmdList[command] ) then
hash_SecureCmdList[command](strtrim(msg));
editBox:AddHistoryLine(text);
ChatEdit_OnEscapePressed(editBox);
return;
end
-- Handle chat types. No need for a securecall here, since we should be done with anything secure.
if ( ChatEdit_HandleChatType(editBox, msg, command, send) ) then
return;
end
if ( send == 0 ) then
return;
end
-- Check the hash tables for slash commands and emotes to see if we've run this before.
if ( hash_SlashCmdList[command] ) then
-- if the code in here changes - change the corresponding code below
hash_SlashCmdList[command](strtrim(msg), editBox);
editBox:AddHistoryLine(text);
ChatEdit_OnEscapePressed(editBox);
return;
elseif ( hash_EmoteTokenList[command] ) then
-- if the code in here changes - change the corresponding code below
DoEmote(hash_EmoteTokenList[command], msg);
editBox:AddHistoryLine(text);
ChatEdit_OnEscapePressed(editBox);
return;
end
-- If we didn't have the command in the hash tables, look for it the slow way...
for index, value in pairs(SlashCmdList) do
local i = 1;
local cmdString = _G["SLASH_"..index..i];
while ( cmdString ) do
cmdString = strupper(cmdString);
if ( cmdString == command ) then
-- if the code in here changes - change the corresponding code above
hash_SlashCmdList[command] = value; -- add to hash
value(strtrim(msg), editBox);
editBox:AddHistoryLine(text);
ChatEdit_OnEscapePressed(editBox);
return;
end
i = i + 1;
cmdString = _G["SLASH_"..index..i];
end
end
local i = 1;
local j = 1;
local cmdString = _G["EMOTE"..i.."_CMD"..j];
while ( i <= MAXEMOTEINDEX ) do
if ( cmdString and strupper(cmdString) == command ) then
local token = _G["EMOTE"..i.."_TOKEN"];
-- if the code in here changes - change the corresponding code above
if ( token ) then
hash_EmoteTokenList[command] = token; -- add to hash
DoEmote(token, msg);
end
editBox:AddHistoryLine(text);
ChatEdit_OnEscapePressed(editBox);
return;
end
j = j + 1;
cmdString = _G["EMOTE"..i.."_CMD"..j];
if ( not cmdString ) then
i = i + 1;
j = 1;
cmdString = _G["EMOTE"..i.."_CMD"..j];
end
end
-- Unrecognized chat command, show simple help text
if ( editBox.chatFrame ) then
local info = ChatTypeInfo["SYSTEM"];
editBox.chatFrame:AddMessage(HELP_TEXT_SIMPLE, info.r, info.g, info.b, info.id);
end
-- Reset the chat type and clear the edit box's contents
ChatEdit_OnEscapePressed(editBox);
return;
end
So, I've been looking at the tooltip code in both Bagon_Tooltips and Engravings, and have gotten the following rough code from them (It's just a stripped down version of the stuff in Bagon_Tooltips, really.)
So, I really just need to then add in some code to get the relevant information to add in the AddText function, right? (AddDoubleLine was used as that's what I'm using in my addon anyway.)
jup, but I don't think you need the frame:Show() bit, as the tooltip is shown after "OnTooltipSetItem", anyway.
Also it might be an idea to stick the
function(self, ...)
local itemLink = select(2, self:GetItem())
if itemLink and GetItemInfo(itemLink) then --fix for blizzard doing craziness when doing getiteminfo
AddText(self, itemLink)
end
end
bit outside the HookTip function so your don't end up creating 2 of the same function.
As for the custom tooltip issue, how about some kind of standard when creating a custom tooltip that you want to be shown, and be modified i.e.
local handledscripts = {OnTooltipSetItem = true, OnTooltipSetUnit = true, OnTooltipSetSpell = true}
for script, _ in pairs(handledscripts) do
mytip:SetScript(script, GameTooltip:GetScript(script))
end
hooksecurefunc(GameTooltip, "SetScript",
function(gt, script, handle)
if handledscripts[script] then
mytip:SetScript(script, handle)
end
end
)
2. Do you or your users need support for other addon tooltips? Do you only need it to work with the default UI? LibTipHooker maintains a list of most popular tooltip addons for you.
Because your hooking the mthods instead of the Script, why not just hook the metatable instead so then you don't need to maintain that list?
That also fixes this problem.
What about dynamically generated tooltips, for example LinkWrangler or Links gives you as many ItemRefTooltips as you need, do you want to support these? LibTipHooker does.
Until then you could muck about with newproxy for the time being.
local t = {cat = true, dog = true, len = 2}
local p = newproxy(true)
local pmeta = getmetatable(p)
pmeta.__index = t
pmeta.__newindex = function(p, k, v)
if t[k] == nil and v ~= nil then
t.len = t.len + 1
elseif t[k] ~= nil and v == nil then
t.len = t.len - 1
end
t[k] = v
end
pmeta.__len = function() return t.len end
print(#p) --2
p.foo = "bar"
print(#p) --3
p.cat = nil
print(#p) --2
I don't know the overhead of using a metatable proxy, but I don't imagine it will be anything huge.
If you want working examples have a look at the Bagnon_Tooltips folder in Bagnon or Engravings.
Also where you want to add the line of text is important, adding a line to the end is as simple as GameTooltip:AddLine() or GameTooltip:AddDoubleLine() whereas adding one in the middle is slightly more difficult.
0
Heres some reading for table.sort
http://www.lua.org/pil/19.3.html
http://lua-users.org/wiki/TableLibraryTutorial
http://www.wellho.net/mouth/1697_Sorting-in-lua-specifying-your-own-sort-routine.html
Because I'm seriously confused about what your trying to do.
0
Too my knowledge you can't, and plus you really wouldn't want to anyway, as WoW has more information about it's quests than a mod, unless ofcourse it comes lumbered with a giant database.
0
0
Assuming not too many people are hooking AddMessage, and the message is being added to the DEFAULT_CHAT_FRAME, then the attached mod will print out the sent message followed by what sent it (which will be a couple of lines long).
When the spam gets shown again can you please take a screenshot of the output, the text will be in blue.
Hope I explained this well enough.
0
How so?
0
0
ChatEdit_ParseText() - line 3285 of ChatFrame.lua
0
Just tested it, and you don't need to call :Show() when hooking "OnTooltipSetUnit" or "OnTooltipSetItem", as it will get called after using your hook.
0
jup, but I don't think you need the frame:Show() bit, as the tooltip is shown after "OnTooltipSetItem", anyway.
Also it might be an idea to stick the
bit outside the HookTip function so your don't end up creating 2 of the same function.
0
Grab yourself a lua interpreter, and use something like.
0
Awful idea, or zomg fantastic idea?
0
Because your hooking the mthods instead of the Script, why not just hook the metatable instead so then you don't need to maintain that list?
That also fixes this problem.
0
Until then you could muck about with newproxy for the time being.
I don't know the overhead of using a metatable proxy, but I don't imagine it will be anything huge.
0
and whats that got to do with the price of eggs?
0
Also where you want to add the line of text is important, adding a line to the end is as simple as GameTooltip:AddLine() or GameTooltip:AddDoubleLine() whereas adding one in the middle is slightly more difficult.
Hope this helps.