LibExtraTip


LibExtraTip is a library of API functions for manipulating additional information into GameTooltips by either adding information to the bottom of existing tooltips (embedded mode) or by adding information to an extra "attached" tooltip construct which is placed to the bottom of the existing tooltip.
Copyright (C) 2008, by the respecive below authors.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

Author: Matt Richard (Tem)
Author: Ken Allan <ken@norganna.org>
Version: 1.0

Class Method LibExtraTip:RegisterTooltip(tooltip)


Adds the provided tooltip to the list of tooltips to monitor for items.


tooltip: GameTooltip object
Returns: true if tooltip is registered
Available since v1.0

Class Method LibExtraTip:IsRegistered(tooltip)


Checks to see if the tooltip has been registered with LibExtraTip


tooltip: GameTooltip object
Returns: true if tooltip is registered
Available since v1.0

Class Method LibExtraTip:AddCallback(callback, priority)


Adds a callback to be informed of any registered tooltip's activity.


Callbacks are passed the following parameters (in order):
  • tooltip: The tooltip object being shown (GameTooltip object)
  • item: The item being shown (in ItemLink format)
  • quantity: The quantity of the item being shown (may be nil when the quantity is unavailable)
  • return values from GetItemInfo (in order)

  • callback: the method to be called
    priority: the priority of the callback (optional, default 200)
    Available since v1.0

    Class Method LibExtraTip:RemoveCallback(callback)


    Removes the given callback from the list of callbacks.


    callback: the callback to remove from notifications
    Returns: true if successfully removed
    Available since v1.0

    Class Method LibExtraTip:SetEmbedMode(flag)


    Sets the default embed mode of the library (default false)


    A false embedMode causes AddLine, AddDoubleLine and AddMoneyLine to add lines to the attached tooltip rather than embed added lines directly in the item tooltip. This setting only takes effect when embed mode is not specified on individual AddLine, AddDoubleLine and AddMoneyLine commands.

    flag: boolean flag if true embeds by default
    Available since v1.0

    Class Method LibExtraTip:AddLine(tooltip, text, r, g, b, embed)


    Adds a line to a registered tooltip.


    tooltip: GameTooltip object
    text: the contents of the tooltip line
    r: red component of the tooltip line color (optional)
    g: green component of the tooltip line color (optional)
    b: blue component of the tooltip line color (optional)
    embed: override the lib's embedMode setting (optional)
    See also: SetEmbedMode
    Available since v1.0

    Class Method LibExtraTip:AddDoubleLine(tooltip, textLeft, textRight, lr, lg, lb, rr, rg, rb, embed)


    Adds a two-columned line to the tooltip.


    tooltip: GameTooltip object
    textLeft: the left column's contents
    textRight: the left column's contents
    r: red component of the tooltip line color (optional)
    g: green component of the tooltip line color (optional)
    b: blue component of the tooltip line color (optional)
    embed: override the lib's embedMode setting (optional)
    See also: SetEmbedMode
    Available since v1.0

    Class Method LibExtraTip:GetMoneyText(money, concise)


    Creates a string representation of the money value passed using embedded textures for the icons


    money: the money value to be converted in copper
    concise: when false (default), the representation of 1g is "1g 00s 00c" when true, it is simply "1g" (optional)
    Available since v1.0

    Class Method LibExtraTip:AddMoneyLine(tooltip, text, money, r, g, b, embed)


    Adds a line with text in the left column and a money frame in the right.


    The money parameter is given in copper coins (i.e. 1g 27s 5c would be 12705)

    tooltip: GameTooltip object
    text: the contents of the tooltip line
    money: the money value to be displayed (in copper)
    r: red component of the tooltip line color (optional)
    g: green component of the tooltip line color (optional)
    b: blue component of the tooltip line color (optional)
    embed: override the lib's embedMode setting (optional)
    See also: SetEmbedMode
    Available since v1.0

    Class Method LibExtraTip:CallTooltipMethod(tooltip, method, args, detail)


    Calls a tooltip's method, passing arguments and setting additional details.


    You must use this function when you are setting your own tooltip, but want LibExtraTip to display the extra tooltip information and notify any callbacks.

    tooltip: GameTooltip object
    method: the tooltip method to call (or nil to not call any)
    args: table of arguments to pass to tooltip method
    detail: additional detail items to set for the callbacks
    Returns: whatever the called method returns
    Available since v1.0

    Class Method LibExtraTip:GetTooltipAdditional(tooltip)


    Get the additional information from a tooltip event.


    Often additional event details are available about the situation under which the tooltip was invoked, such as:
  • The call that triggered the tooltip.
  • The slot/inventory/index of the item in question.
  • Whether the item is usable or not.
  • Auction price information.
  • Ownership information.
  • Any data provided by the Get*Info() functions.
  • If you require access to this information for the current tooltip, call this function to retrieve it.

    tooltip: GameTooltip object
    Returns: table containing the additional information
    Available since v1.0