Cartographer/Notes

From WowAce Wiki

Jump to: navigation, search

Contents

API Documentation

Cartographer_Notes:RegisterIcon("name", data)

Registers a custom icon with Cartographer-Notes.

Args

"name" 
string - name of the icon.
data 
table - data table

Remarks

The data table takes the following shape:

data = {
    text = "Unknown", -- name of the icon. Should be localized.
    path = "Interface\\Icons\\INV_Misc_QuestionMark", -- path to the icon
    cLeft = 0, -- texCoord left
    cRight = 1, -- texCoord right
    cTop = 0, -- texCoord left
    cBottom = 1, -- texCoord bottom
    width = 16, -- width of the icon
    height = 16, -- height of the icon
    alpha = 1, -- transparency of the icon
    showToUser = false, -- whether to allow the user to use this icon
}

text and path are the only required values, everything else has the above values as defaults.

Example

Cartographer_Notes:RegisterIcon("Unknown", {
    text = "Unknown",
    path = "Interface\\Icons\\INV_Misc_QuestionMark",
})

Cartographer_Notes:UnregisterIcon("name")

Unregisters a custom icon with Cartographer-Notes

Args

"name" 
string - name of the icon

Example

Cartographer_Notes:RegisterIcon("MyIcon")

Cartographer_Notes:IsIconRegistered("name")

Check if a given icon is already registered with Cartographer-Notes

Args

"name" 
string - name of the icon

Example

Cartographer_Notes:IsIconRegistered("MyIcon")

Cartographer_Notes:OpenNewNoteFrame(x, y [, "creator"])

Opens a dialog for the current map to create a new note at the given coordinate.

Args

number - X-coordinate [0, 1]
number - Y-coordinate [0, 1]
["creator"] 
string - creator of the icon.

Example

Cartographer_Notes:OpenNewNoteFrame(0.642, 0.474)

 :ShowEditDialog("zone", id or "zone", x, y)

Opens a dialog for the given note.

Args

"zone" 
string - English name of the zone
number - X-coordinate [0, 1]
number - Y-coordinate [0, 1]
id 
number - ID number

Example

Cartographer_Notes:ShowEditDialog("Mulgore", 0.642, 0.474)

Cartographer_Notes:SetNote("zone", x, y, "icon", "creator", ...)

Sets a note at the given zone and coordinate.

Args

"zone" 
string - English or localized name of the zone
number - X-coordinate [0, 1]
number - Y-coordinate [0, 1]
"creator" 
string - creator of the note. Note: To save in an external database, use the database's name here.
"icon" 
string - icon of the note. (As previously registered by :RegisterIcon("name", data))
... 
key-value list to be saved in data table.

Remarks

This will only save non-default values in the database.

If "creator" is the name of a database, the note will be saved there instead of polluting the main database.

Standard values to set are: title, titleR, titleG, titleB, info, infoR, infoB, infoG, info2, info2R, info2G, info2B

Example

Cartographer_Notes:SetNote("Tirisfal Glades", .842, .163, "Skull", "MyDatabase",
    'title', "Here be dragons")

Cartographer_Notes:GetNote("zone", x, y)

Returns values of a given note.

Args

"zone" 
string - English or localized name of the zone
number - X-coordinate [0, 1]
number - Y-coordinate [0, 1]

Returns

"zone", x, y, "icon" [, "database"], data

"zone" 
string - English name of the zone
number - X-coordinate [0, 1]
number - Y-coordinate [0, 1]
"icon" 
string - icon of the note. (As previously registered by :RegisterIcon("name", data))
["database"] 
string - database the note is stored in
nil - stored in the main database
data 
table - data table of the note itself
string - icon, if that's all the data consists of.

Example

local zone, x, y, icon, db, data = Cartographer_Notes:GetNote("Mulgore", .654, .847)

Cartographer_Notes:DeleteNote("zone", x, y)

Deletes a given note.

Args

"zone" 
string - English or localized name of the zone
number - X-coordinate [0, 1]
number - Y-coordinate [0, 1]

Example

Cartographer_Notes:DeleteNote("Mulgore", .654, .847)

Cartographer_Notes:RefreshMap()

Refreshes the map's notes, if open.

Example

Cartographer_Notes:RefreshMap()

Cartographer_Notes:RegisterNotesDatabase("name", db [, handler])

Registers an external notes database with Cartographer-Notes.

Args

"name" 
string - name of the database.
db 
table - table to save data into.
[handler] 
table - handler object which can override certain aspects of the notes.
[localeHandler] 
table - handler object text will be checked against to see if a translation exists.

Remarks

Almost always, you will want to store your notes in a place outside the main database. Use this method to do so.

The overrides available are :OnNoteClick("zone", id, data), :OnNoteMenuRequest("zone", id, data, level, value, ...), :OnNoteTooltipRequest("zone", id, data, inMinimap), and :IsNoteHidden("zone", id, data, inMinimap),

:GetNoteTransparency("zone",id,data), :GetNoteScaling("zone",id,data), :IsMiniNoteHidden("zone",id,data), :IsTracking("zone",id,data), noteDefaults, and noteLocaleHandler.

You can consult <a href="http://wowace.com/wiki/Cartographer/Notes_Overrides" title="Cartographer/Notes Overrides">Notes Overrides</a> for detailled description of those overrides.

noteDefaults is a special case where it is a table where it can have the following data pieces overridden: titleCol, info, infoCol, info2, and info2Col. The data that ends with Col will need an encoded color id, which can be achieved by doing Cartographer_Notes.getColorID(r, g, b).

noteLocaleHandler must have the methods HasTranslation

and GetTranslation, which will be run on the title, info, and info2 parts of a note before showing.
Note: AceLocale-2.2 instances have these methods

Example

Cartographer_Notes:RegisterNotesDatabase("MyNotes", MyNotesDB, MyNotesAddon)

Cartographer_Notes:UnregisterNotesDatabase("name")

Unregisters an external notes database from Cartographer-Notes.

Args

"name" 
string - name of the database.

Remarks

This is handy to call when your module is disabled and you wish to hide the notes related to it.

Example

Cartographer_Notes:UnregisterNotesDatabase("MyNotes")

Cartographer_Notes:EnableDevelopment("name")

Enables development on a given notes database.

Args

"name" 
string - name of the database.

Remarks

This allows all notes from the database to be editted, moved, and easily lets the user make a new one.

Example

Cartographer_Notes:EnableDevelopment("MyNotes")

Cartographer_Notes:SendNoteToPlayer("zone", x, y, "player")

Sends a note through the whisper stream to another player. Due to changes in 2.0 this may or may not cause your client to disconnect

Args

"zone" 
string - English or localized name of the zone
number - X-coordinate [0, 1]
number - Y-coordinate [0, 1]
"player" 
string - name of the player

Remarks

This will make the encrypted message show up if the other player does not have AceComm-2.0.

Returns

boolean - whether the send was successful.

Example

Cartographer_Notes:SendNoteToPlayer("Mulgore", .746, .844, "Monkeyman")

Cartographer_Notes:SendNoteToGuild("zone", x, y)

Sends a note through the hidden guild stream to the player's guild.

Args

"zone" 
string - English or localized name of the zone
number - X-coordinate [0, 1]
number - Y-coordinate [0, 1]

Returns

success : boolean - whether the send was successful.

Example

Cartographer_Notes:SendNoteToGuild("Mulgore", .746, .844)

Cartographer_Notes:SendNoteToParty("zone", x, y)

Sends a note through the hidden party stream to the player's party.

Args

"zone" 
string - English or localized name of the zone
number - X-coordinate [0, 1]
number - Y-coordinate [0, 1]

Returns

success : boolean - whether the send was successful.

Example

Cartographer_Notes:SendNoteToParty("Mulgore", .746, .844)

Cartographer_Notes:SendNoteToRaid("zone", x, y)

Sends a note through the hidden raid stream to the player's raid or battleground raid.

Args

"zone" 
string - English or localized name of the zone
number - X-coordinate [0, 1]
number - Y-coordinate [0, 1]

Returns

success : boolean - whether the send was successful.

Example

Cartographer_Notes:SendNoteToRaid("Mulgore", .746, .844)

Cartographer_Notes:SendNoteToGroup("zone", x, y)

Sends a note through the hidden party or raid stream to the player's party, raid or battleground raid.

Args

"zone" 
string - English or localized name of the zone
number - X-coordinate [0, 1]
number - Y-coordinate [0, 1]

Returns

success : boolean - whether the send was successful.

Example

Cartographer_Notes:SendNoteToGroup("Mulgore", .746, .844)

<a href="http://wowace.com/wiki/Cartographer/Notes" name="Cartographer_Notes:IsShowingCreator.28.29"></a>

Cartographer_Notes:IsShowingCreator()

Returns whether Cartographer-Notes is showing the `Created by:' line

Returns

boolean - whether Cartographer-Notes is showing the `Created by:' line

Example

local showCreator = Cartographer_Notes:IsShowingCreator()

Cartographer_Notes:IsShowingNotifications()

Returns whether Cartographer-Notes is showing comm confirmation message to the console

Returns

boolean - whether Cartographer-Notes is showing the confirmation messages

Example

local showCreator = Cartographer_Notes:IsShowingNotifications()


<a href="http://wowace.com/wiki/Cartographer/Notes" name="Cartographer_Notes:IterateNearbyNotes.28.22zone.22.2C_x.2C_y_.5B.2C_radius.5D_.5B.2C_.22db.22.5D_.5B.2C_maxNotes.5D_.5B.2C_use_yards.5D.29"></a>

Cartographer_Notes:IterateNearbyNotes("zone", x, y [, radius] [, "db"] [, maxNotes] [, use_yards])

Returns an iterator which iterates through nearby notes.

Args

"zone" 
string - English or localized name of the zone
number - X-coordinate [0, 1]
number - Y-coordinate [0, 1]
[radius] 
number - radius [0, sqrt(2)] - or [0, inf) if use_yards
nil - maximum radius
["db"] 
string - name of the database to check within.
nil - main Notes database
[maxNotes] 
number - maximum number of notes to iterate through.

nil - iterate through all notes.

[use_yards] 
boolean - whether the radius is in yards instead of points

Returns

iterator - iterator which returns "zone", x, y, "icon" [, "db"], data

Example

for zone, x, y, icon, db, data in Cartographer_Notes:IterateNearbyNotes("Mulgore", 0.753, 0.364, 5, "MyNotes", 10, true) do
    DoSomething()
end

<a href="http://wowace.com/wiki/Cartographer/Notes" name="Cartographer_Notes:GetNearbyNote.28.22zone.22.2C_x.2C_y_.5B.2C_radius.5D_.5B.2C_.22db.22.5D_.5B.2C_use_yards.5D.29"></a>

Cartographer_Notes:GetNearbyNote("zone", x, y [, radius] [, "db"] [, use_yards])

Returns info from the closest note to the given point within the given radius

Args

"zone" 
string - English or localized name of the zone
number - X-coordinate [0, 1]
number - Y-coordinate [0, 1]
[radius] 
number - radius [0, sqrt(2)]
nil - maximum radius
["db"] 
string - name of the database to check within.
nil - main Notes database
[use_yards] 
boolean - whether the radius is in yards instead of points

Returns

"zone", x, y, "icon" [, "db"], data

"zone" 
string - English name of the zone
number - X-coordinate [0, 1]
number - Y-coordinate [0, 1]
"icon" 
string - icon of the note
["db"] 
string - name of the database
nil - main Notes database
data 
table - data table of the note itself
string - icon, if that's all the data consists of.

Example

local zone, x, y, icon, db, data = Cartographer_Notes:GetNearbyNote("Mulgore", 0.753, 0.364, 5, "MyNotes", true)

Cartographer_Notes:ClearAllNotes()

This method will remove all notes on the currently selected map. This cant be undone.

Args

none

Returns

none

Example

Catrographer_Notes:ClearAllNotes()

Cartographer_Notes:OverrideIconGraphic(name,newPath)

Function to allow you to remap an icon's texture

Args

name 
string - the Icon to remap NOTE: you need to use the registered icon name, not the localized text.
newPath 
string - the new icon texture path

Returns

the texture path of the icon you replaced

Example

Cartographer_Notes:OverrideIconGraphic('Copper',"Interface\\Icons\\INV_Misc_QuestionMark") -- remap copper to a question mark

Cartographer_Notes:GetIconList()

Returns a list of icon name to textures

Args

none

Returns

a table keyed by icon name, with a subtable holding localized text name and icon path

Example

local list = Cartographer_Notes:GetIconList() for k,v in pairs(list) do

self:Print("Icon:"..k.." Textual name: "..v.name.." Texture path:"..v.path)

Cartographer_Notes.getColorID(r, g, b)

Returns an encoded color ID, as used in the databases.

Args

number - [0, 1] red color
number - [0, 1] green color
number - [0, 1] blue color

Returns

number - an encoded color ID.

Remarks

Cartographer_Notes.getColorID(r, g, b):format("%02x%02x%02x") == "rrggbb"

Example

local color = Cartographer_Notes.getColorID(r, g, b)

Cartographer_Notes.getRGB(colorID)

Returns the decoded r, g, and b values from an encoded color ID.

Args

colorID 
number - color ID

Returns

r, g, b

number - [0, 1] red color
number - [0, 1] green color
number - [0, 1] blue color

Example

local r, g, b = Cartographer_Notes.getRGB(colorID)

Cartographer_Notes.getID(x, y)

Returns an encoded coordinate ID, as used in the databases.

Args

number - [0, 1] horizontal coordinate
number - [0, 1] vertical coordinate

Returns

number - an encoded coordinate ID.

Example

local id = Cartographer_Notes.getID(x, y)

Cartographer_Notes.getXY(id)

Returns the decoded x and y values from an encoded coordinate ID.

Args

id 
number - an encoded coordinate ID.

Returns

x, y

number - [0, 1] horizontal coordinate
number - [0, 1] vertical coordinate

Example

local xy = Cartographer_Notes.getXY(id)

Event: "CartographerNotes_NoteSet" - "zone", x, y, "icon", ["database"], fromComm

Triggered when a note is added or changed.

Provided args

"zone" 
string - English name of the zone
number - X-coordinate [0, 1]
number - Y-coordinate [0, 1]
"icon" 
string - icon of the note
["database"] 
string - name of the database note is attached to
nil - using the main database.
fromComm 
boolean - indicates this event was generated as a result of receiving a comm note.

Event: "CartographerNotes_NoteDeleted" - "zone", x, y, "icon", ["database"]

Triggered when a note is removed.

Provided args

"zone" 
string - English name of the zone
number - X-coordinate [0, 1]
number - Y-coordinate [0, 1]
"icon" 
string - icon of the note
["database"] 
string - name of the database note is attached to
nil - using the main database.

Remarks

This also fires when a note is moved from one place to another, as it shows it as destroying one note and creating a new one.

Personal tools
Support the Site