Console
Frames
Message Boxes
GameTooltip
Hooking Functions
Mailbox Internals
Other Items of Interest
<Anchor point="LEFT" relativePoint="TOPLEFT">
o point = text alignment
o relativePoint = X,Y position
DEFAULT_CHAT_FRAME:AddMessage(text)
text =
"Are you sure you want to reset the Simple Banker data? Data for all bankers (not just the current character) will be lost!",button1 =
"Yes",button2 =
"No",OnAccept = SimpleBanker_Reset,
timeout = 0,
whileDead = 1,
hideOnEscape = 1
};
Display the dialog:
This isn't x=StaticPopup_Show (which makes sense when you think about the
need to avoid blocking calls). The button selection calls the function named
in the template.
Substitution values for the format string specified can be added to the call, e.g. StaticPopup_Show("SIMPLEBANKER_RESET", "your character")
Template defined at GameTooltipTemplate.xml
Convert a tooltip to HTML
-- Tooltip to HTML code --
--------------------------
function
SimpleBanker_GameTooltipToHtml() local leftBase, rightBase = "GameTooltipTextLeft", "GameTooltipTextRight"; local html = [[<table class='tooltip'>]];for index = 1, GameTooltip:NumLines() do
html = html
.. [[<tr>]]
.. SimpleBanker_AddToolTipCell(getglobal(leftBase..index))
.. SimpleBanker_AddToolTipCell(getglobal(rightBase..index))
.. [[</tr>]];
end
html = html .. [[</table>]]
return html;
end
function
SimpleBanker_AddToolTipCell(line) local text = line:GetText(); local fontName, fontHeight, fontFlags = line:GetFont()fontHeight = math.floor(fontHeight + 0.1);
fontSize = (fontHeight - 10) /2 + 1;
local html; if (text == nil) thenhtml = [[<td class='tooltip' />]];
elsehtml = [[<td class='tooltip' style='color: #]]
.. SimpleBanker_RgbToString(line:GetTextColor())
.. [['>]]
.. [[<font size=']] .. fontSize.. [['>]]
.. line:GetText()
.. [[</font>]]
.. [[</td>]];
end; return html;
end
;
-- Converts a decimal colour sequence to a RGB string
-- e.g (0.5, 0, 1) -> 8000FF
function
SimpleBanker_RgbToString(r, g, b, a) return SimpleBanker_DecToHex(r) .. SimpleBanker_DecToHex(g) .. SimpleBanker_DecToHex(b);end
;
-- Converts a decimal value to a 2 digit hex value
-- e.g. 0 -> 00, 0.5 -> 7F, 1 -> 255
function
SimpleBanker_DecToHex(dec)-- Adjust for rounding errors
dec = math.floor(dec * 255 + 0.1);
local result = string.format("%x", dec);if (string.len(result) < 2) then
result =
"0" .. result;end; return result;
end
;
xx_PreviousXYZ = XYZ;function
myXYZ()...
xx_PreviousXYZ();
end
;XYZ = myXYZ;
GameTooltip:SetInboxItem(x);
Sets the tooltip to the details of the item in mail slot x
GameTooltip:SetBagItem(bagNum, slotNum);
Sets the tooltip to the details of the item in slot slotNum of bag bagNum.
Events
Event | Description |
CLOSE_INBOX_ITEM | |
MAIL_CLOSED | |
MAIL_INBOX_UPDATE | |
MAIL_FAILED | |
MAIL_SEND_INFO_UPDATE | |
MAIL_SEND_INFO_UPDATE | |
SEND_MAIL_COD_CHANGED | |
SEND_MAIL_MONEY_CHANGED | |
MAIL_SEND_SUCCESS | |
MAIL_SHOW |