First, add LibUndauntedPledges (LUP) as a dependency in your addon's manifest:
## DependsOn: LibUndauntedPledges
The library can be accessed via the LibUndauntedPledges global variable, and it is recommended that you localize it for usage; for example:
local LUP = LibUndauntedPledges
All dates supplied to and returned from this library are aligned with each server's daily reset times and are completely agnostic to local time zones.
Values for pledgeGiverId:
LUP.BASE1 -- First base-game pledge giver (Maj) LUP.BASE2 -- Second base-game pledge giver (Glirion) LUP.DLC1 -- DLC pledge giver (Urgarlag)
Values for suppliedIdType:
LUP.TYPE_ZONE -- zoneId LUP.TYPE_QUEST -- questId LUP.TYPE_ACTIVITY -- activityId
Get the current server date for the selected server:
LUP.GetCurrentServerDate( server )
server is the name of the server (i.e., "NA", "EU", or "PTS"). If it is omitted (nil), the current server is assumed.
Returns: year, month, day
Get the the localized name of a pledge giver:
LUP.GetPledgeGiverName( pledgeGiverId )
pledgeGiverId is one of the defined constants.
The return is the localized name of the pledge giver. Localized names are available for all seven of the languages officially supported by the game. For all other languages, English names will be used.
Get the number of pledges in a pledge giver's rotation:
LUP.GetPledgeCount( pledgeGiverId )
pledgeGiverId is one of the defined constants.
The return is the number of pledges associated with the pledge giver.
Given a dungeon's zoneId, pledge questId or Activity Finder activityId, look up the other IDs associated with the dungeon:
LUP.LookupIds( suppliedId, suppliedIdType )
suppliedId is the ID supplied for this lookup.
suppliedIdType is the type of ID in the suppliedId parameter; it is one of the defined constants.
Returns: zoneId, questId, activityIdN, activityIdV
Zeros are returned if the supplied ID does not correspond to a group dungeon.
Get information about the pledges for a specified date:
LUP.GetPledges( year, month, day ) LUP.GetPledges( offsetDays, server )
The requested date can be supplied in either one of two ways:
year, month, and day representing the server dateoffsetDays (integer) from the current server date of the specified server (string)
offsetDays can be negative; e.g., -1 can be used to retrieve yesterday's pledges. It can also be omitted (nil), in which case an offset of 0 (i.e., the current date) is assumed.server is the name of the server (i.e., "NA", "EU", or "PTS"). If it is omitted (nil), the current server is assumed.Examples: LUP.GetPledges() with no parameters will just return today's pledges for the current server, LUP.GetPledges(1) will return tomorrow's pledges, and LUP.GetPledges(2024, 8, 21) will return the pledges for 2024-08-21.
The return is a table in the following format:
{ -- Sample return for LUP.GetPledges(2024, 8, 21)
date = {
year = 2024, month = 8, day = 21,
wday = 4, wdayLong = "Wednesday", wdayShort = "Wed",
},
[LUP.BASE1] = {
pledgeGiverName = "Maj al-Ragath",
name = "Spindleclutch I",
zoneId = 144,
questId = 5260,
activityIdN = 3,
activityIdV = 315,
},
[LUP.BASE2] = {
pledgeGiverName = "Glirion the Redbeard",
name = "City of Ash I",
zoneId = 176,
questId = 5290,
activityIdN = 10,
activityIdV = 310,
},
[LUP.DLC1] = {
pledgeGiverName = "Urgarlag Chief-bane",
name = "Fang Lair",
zoneId = 1009,
questId = 6155,
activityIdN = 420,
activityIdV = 421,
},
}
The names of the pledge-givers, dungeons, and days of the week are all localized.
Determine if a dungeon is one the pledges on a specified date:
LUP.IsPledge( id, year, month, day ) LUP.IsPledge( id, offsetDays, server )
id represents the dungeon to check. It can either be a number, in which case it is treated as a zoneId, or it can be a table in the form of { suppliedId, suppliedIdType } (refer to the documentation for LUP.LookupIds).
Refer to the documentation for LUP.GetPledges for the specifics of year, month, day, offsetDays, and server.
The return is a boolean indicating whether the dungeon is one of the pledges for that date.