Grid/Developer Documentation

From WowAce Wiki

Jump to: navigation, search

I guess this page never got restored after the wiki exploded.

GridStatusTarget is about as simple as a status module can be.

Contents

API Documentation to follow

:RegisterStatus(status, desc, options, inMainMenu)
:UnregisterStatus(status)
GridStatus:SendStatusGained(name, status, priority, range, color, text,  value, maxValue, texture)
GridStatus:SendStatusLost(name, status)



GridStatus Module

To create a GridStatus module, use:

GridStatusMyModule = GridStatus:NewModule("GridStatusMyModule")

The following functions are inherited by all GridStatus modules.

Variables

<module>.menuName = string

Title for the module's menu.

<module>.extraOptions = table

An optional AceOptions table containing extra options to be inserted into the module's menu.

<module>.defaultDB = table

Default settings to be used by the module's AceDB namespace. Accessed via self.db.profile.

Functions

<module>:RegisterStatus(status, description, options, inMainMenu)

Registers a status with Grid

Args

status 
string - name of the status
description 
string - description of the status
options 
table - table of option name/value pairs to set defaults
inMainMenu
boolean - whether the status options should be in the main menu


GridStatus

GridStatus provides the framework for querying and updating the status of the units monitored by Grid.


Events

Events triggered by GridStatus


Grid_StatusRegistered(status, description, moduleName)

Triggered whenever a new status is registered. Useful for updating configuration menus.

Args

status 
string - name of the status
description 
string - description of the status
moduleName 
string - name of the module registering the status


Grid_StatusUnregistered(status)

Triggered whenever an existing status is unregistered. Useful for updating configuration menus.

Args

status 
string - name of the status

Grid_StatusGained(name, status, priority, range, color, text, value, maxValue, texture)

See GridStatus:SendStatusGained for details.

Grid_StatusLost(name, status)

See GridStatus:SendStatusLost for details.


Functions

GridStatus:RegisterStatus(status, description, moduleName)

Registers a status with Grid (called by <module>:RegisterStatus()).

Args

status 
string - name of the status
description 
string - description of the status
moduleName 
string - name of the module associated with the status

GridStatus:UnregisterStatus(status, moduleName)

Unregisters a status with Grid

Args

status 
string - name of the status
moduleName 
string - name of the module (in case it provides multiple statuses)

GridStatus:IsStatusRegistered(status)

Returns if a status is registered.

Args

status 
string - name of the status to check


GridStatus:RegisteredStatusIterator()

Returns

status, moduleName, description

GridStatus:SendStatusGained(name, status, priority, range, color, text, value, maxValue, texture)

Lets Grid know that a status has been gained. SendStatusGained caches the arguments for each status to prevent status events from being triggered if nothing has changed. Calling SendStatusGained with different arguments for an existing status will overwrite the existing status and trigger a Grid_StatusGained event.

Args

name 
string - name of the unit affected
status 
string - the status that is gained
priority 
number (0-99) - priority for the status (0 = don't display, 1 = lowest, 99 = highest)
range 
number - if the unit is more than range yards away, do not display the status
color 
table { r = (0-1), g = (0-1), b = (0-1), a = (0-1) } - color for the status. Used by GridFrame to color text, bar, and box indicators.
text 
string - text for the status. Used by GridFrame to set text indicators.
value 
number - current value for the status (ala health/mana)
maxValue 
number - maximum value for the status. Value and maxValue are used by GridFrame to set statusbar indicators
texture 
string - texture/icon to display for the status. Used by GridFrame to set icon indicators.


GridStatus:SendStatusLost(name, status)

Lets Grid know that a status has been lost. Will not trigger Grid_StatusLost event if there is no cached status.

Args

name 
string - name of the unit affected
status 
string - the status that is lost


GridStatus:GetCachedStatus(name, status)

Returns the status of a status.

Args

name 
string - name of the unit affected
status 
string - the status that is queried

Returns

A reference to the table for the cached status.

GridStatus:CachedStatusIterator(status)

Provides an iterator for all cached statuses or just the one specified.

Args

status 
string - status to iterate for or nil for all

Returns

name, status, statusTable



Your first GridStatus Module

General Information

Every status module must provide a <module>.menuName that defines the name in the Grid configuration menu. the defaultDB table defines the defaults for the module's statuses. Whether or not to check aggro, what to display for the name of the status, whether it is enabled by default, the default color and the default priority.

This is a simple module that registers itself to GridStatus. It is incomplete and only shows how to get registered with GridStatus.

-- this creates a variable called GridStatusAggro that is a GridStatus module
-- with self.name = "GridStatusAggro" (which is the moduleName used above)
GridStatusAggro = GridStatus:NewModule("GridStatusAggro")

-- this is the name that will be shown in the configuration menu
GridStatusAggro.menuName = "Aggro"

-- sets the default options for the entire module.
GridStatusAggro.defaultDB = {
    debug = true, 

    -- by default, the menu options added by :RegisterStatus look for a table
    -- in the module's AceDB table with the same name as the status
    alert_aggro = {
        text = "Aggro",
        enable = true,
        color = { r = 1, g = 0, b = 0, a = 1 },
        priority = 99,
        range = true,
    },
}

-- our module doesn't need a configuration menu of its own since we only have one status
GridStatusAggro.options = false
 
-- create the OnInitialize method
function GridStatusAggro:OnInitialize()
    -- run the parents OnInitialize method to initialize the options table and AceDB defaults
    self.super.OnInitialize(self)

    -- register the "alert_aggro" status with GridStatus using a localized description
    -- no additional options for the status, and put it in the main menu
    self:RegisterStatus('alert_aggro', L["Aggro alert"], nil, true)
end

-- rest of the module to come later


GridLayout

Functions

GridLayout:AddLayout(layoutName, layout)

Adds a custom layout to the list of available layouts.

Args

layoutName 
string - a name for the layout
layout 
table - a layout table as described below

Example

GridLayout:AddLayout(L["By Group 40"], {
		defaults = {
			--[[ Available settings from SecureTemplates.lua
			nameList = [STRING]
			  -- a comma separated list of player names (not used if 'groupFilter' is set)
			groupFilter = [1-8, STRING]
			  -- a comma seperated list of raid group numbers and/or uppercase class names
			strictFiltering = [BOOLEAN]
			  -- if true, then characters must match both a group and a class from the groupFilter list
			sortMethod = ["INDEX", "NAME"]
			  -- defines how the group is sorted (Default: "INDEX")
			sortDir = ["ASC", "DESC"]
			  -- defines the sort order (Default: "ASC")
			groupBy = [nil, "GROUP", "CLASS"]
			  --  (Default: nil)
			groupingOrder = [STRING]
			  -- specifies the order of the groupings (ie. "1,2,3,4,5,6,7,8")
			maxColumns = [NUMBER]
			  -- maximum number of columns the header will create (Default: 1)
			unitsPerColumn = [NUMBER or nil]
			  -- maximum units that will be displayed in a singe column, nil is infinate (Default: nil)
			startingIndex = [NUMBER]
			  -- the index in the final sorted unit list at which to start displaying units (Default: 1)
			--]]

			-- nameList = "",
			-- groupFilter = "",
			-- sortMethod = "INDEX", -- or "NAME"
			-- sortDir = "ASC", -- or "DESC"
			-- strictFiltering = false
		},
		[1] = {
			groupFilter = "1",
		},
		[2] = {
			groupFilter = "2",
		},
		[3] = {
			groupFilter = "3",
		},
		[4] = {
			groupFilter = "4",
		},
		[5] = {
			groupFilter = "5",
		},
		[6] = {
			groupFilter = "6",
		},
		[7] = {
			groupFilter = "7",
		},
		[8] = {
			groupFilter = "8",
		},
	})
Personal tools
Support the Site