Repository navigation
API for Addons
Italiano: API per altri addon
FDCP shares its data with other addons through one read-only table, FinlandDragonCreditPointsAPI. The table's name never changes. Azeroth Accord, the guild hub by the same author, reads it to show the season pool, the lineup and a member's credits. Any other addon may read it too.
This page is for addon authors. Players do not need to do anything: the API costs nothing until an addon uses it.
- Read-only. Every function returns a new copy, never one of FDCP's own tables. Changing what you get back changes nothing in FDCP. Writes to the API table are ignored.
-
Never an error. If you pass a wrong argument, or the data is not on this client, you get
nil, or an empty list where a list is expected. -
Versioned.
API_VERSIONis a whole number,1today. It goes up only when a change would break a reader: a field or a function removed, or a field whose meaning changes. New fields and new functions do not change it, so ignore what you do not know. - Only what this player can already see in FDCP. Attendance and absences are never shared, because they are for officers only. Neither are a player's free roster note, the audit, the log or the council.
Not every client holds the same data:
- An officer's client holds the guild's ledger.
- A member's client holds only the credits table that an officer sent.
GetSource() tells you which one you are reading: "LEDGER" or "SNAPSHOT", or nil when the client has no data yet. When a field is nil, it means "not on this client". It does not mean "empty".
| Function | Officer's client (LEDGER) |
Member's client (SNAPSHOT) |
|---|---|---|
IsReady() |
true once the guild roster is read |
the same |
GetVersion() |
the addon's version, API_VERSION
|
the same |
GetSeason() |
id, name, state ("OPEN" or "CLOSED"), updated (date of the newest night) |
the same, plus asOf (the server time when the officer made the table) |
GetPool() |
every main of the season (see below) | the mains who play (active and trial), without ms2, os, twin and avail
|
GetMember(name) |
one entry of the pool; an alt gives its main, with viaAlt = true
|
the same, from the table |
GetCredits(name) |
name, credits, place, of, faction, viaAlt
|
the same numbers |
GetCreditList() |
the credits and places of every playing main | the same |
GetNight() |
the open night: date, instanceID, instance, size, difficulty, faction, raid = names, bench = names |
nil: members have no nights |
GetRules() |
the guild's rules summary, source = "GUILD"
|
the Patto preset's defaults, source = "DEFAULT"
|
GetEvents() |
the event names you can register | the same |
Each entry of the pool has these fields:
-
name:"Name-Realm"; -
faction,classandrole; -
ms1,ms2andos: game spec ids. MS1 is the main spec and MS2 the off-spec used for loot. OS is the spec the player would like to play; -
status:"ACTIVE","TRIAL"or"INACTIVE"; -
alts: a list of names; -
twin: the same player's main in the other faction; -
avail: the weekdays the player can raid ("MON"…"SUN").
place is the player's place in the loot queue, as the Credits Table shows it: fewest credits first, then the name. It is counted among the playing mains of the player's faction, and of is how many they are. An inactive member has credits but no place.
GetRules() gives:
-
preset(for example"PATTO"), andcustom = truewhen the guild changed the preset; -
metric,startCreditsandawardMode; -
costs[category][quality]: a number, or"council". Qualities are3(blue),4(purple) and5(orange); -
responseMultiplier(MS,OS,TMOG); -
lateJoin; -
bench(effect,amount); -
penalties(absence,cheat).
local api = FinlandDragonCreditPointsAPI
if api and api.API_VERSION == 1 then
api.RegisterCallback("CREDITS_CHANGED", function(event)
local mine = api.GetCredits(UnitName("player"))
-- mine is nil when this client does not know your credits yet
end)
endThe events are:
-
READY: the guild roster is read; -
SEASON_CHANGED; -
POOL_CHANGED; -
CREDITS_CHANGED; -
NIGHT_CHANGED; -
RULES_CHANGED.
Your function is called with the event name only. Read the new data with the getters. It runs protected: if it fails, FDCP counts the error (/fdcp debug, line API) and carries on. An event fires once for each change, and only when its own data changed. FDCP checks for changes once a second, and only while at least one callback is registered. Each event takes up to 32 callbacks. Stop listening with UnregisterCallback(event, fn).
Both api.GetSeason() and api:GetSeason() work.
Your addon may load before FDCP. Look for the table after PLAYER_LOGIN, or add ## OptionalDeps: FinlandDragonCreditPoints to your TOC. Before the guild roster is read, IsReady() is false and the getters give nil or empty lists: register READY.
The API is tested offline (Tests/test_public_api.lua). Three things have not been tried in the real client yet:
- another addon reading it;
- the order in which the two addons load;
- the cost of the change check during a raid.
See also Privacy and Data and the decision record ADR 0009.
Finland Dragon Credit Points · fan-made addon for World of Warcraft: Forever, not affiliated with Blizzard Entertainment / addon amatoriale, non affiliato a Blizzard Entertainment · Repository · GPL-3.0
English
- Home
- Installation
- Quick Start: Raider
- Quick Start: Officers
- Commands
- Loot Rules
- Interface Tour
- Site Export
- Addon Check
- Raid Readiness
- Roster and Nights
- Credits Table
- Master Looter Guide
- Rolling for Loot
- Upgrade Hints
- Council
- History
- Export
- Seasons
- Backup and Seasons
- Settings
- FAQ
- Privacy and Data
- API for Other Addons
- Reporting Bugs
- About
Italiano
- Home
- Installazione
- Guida rapida: raider
- Guida rapida: ufficiali
- Comandi
- Regole del loot
- Giro dell'interfaccia
- Esportazione per il sito
- Controllo dell'addon
- Preparazione del raid
- Roster e Serate
- Tabella crediti
- Guida del master looter
- Rollare per il loot
- Suggerimenti di upgrade
- Council
- Storico
- Esporta
- Season
- Backup e season
- Impostazioni
- FAQ
- Privacy e dati
- API per altri addon
- Segnalare un bug
- Crediti e info