Code:
------------------------
-- FLE ACH API DOC --
-- ACCURATE BETA-4 --
------------------------
FirstLootEver:RegisterAchievement(avID, avLabel, avDesc, avIcon, checkFunc, criteriaTable, fleCategory, previousAch, nextAch)
- Arguments
-- avID
--- (number) Unique ID that identifies the achievement. Duplicate IDs will lead to unexpected behavior (shit will go wrong)
-- avLabel
--- (string) Label that is used to identify the achievement to the user. Duplicate labels are not any issue.
-- avDesc
--- (string) String used to describe the achievement (used in the achievement window)
-- avIcon
--- (string)(texturepath) Path to a texture to use for this achievement. Relative to the WoW root folder.
-- checkFunc
--- (function) Will be called every time a new item is looted
---- Arguments to checkFunc
----- addon
------ The main FLE object
----- id
------ The itemID of the newly looted item. GetItemInfo information can be assumed to already exist in the client cache.
----- readFunc
------ A function that reads a boolean value from the achievement's memory space.
------- readFunc arguments
-------- index
--------- (number) The index in the memory space to read from
----- writeFunc
------ A function that writes a boolean value to the achievement's memory space.
------- writeFunc arguments
-------- index
--------- (number) Index to write the boolean into
-------- value
--------- (boolean) Value to write to the specified memory index
---- Return values for checkFunc
----- doAward
------ If the first return value evaluates to true, the achievement is awarded.
-- criteriaTable
--- (table) A indexed table of criteria to display on the achievement. Consists of functions. Each function will be called when the respective criteria is requested for display.
---- criteriaFunc arguments
----- addon
------ The main FLE addon object
----- readFunc
------ Reads a boolean from the achievement's memory. See checkFunc arguments above for further details.
---- criteriaFunc return values
------ Return values should be the same as the return values from GetAchievementCriteriaInfo. If referencing other achievements, string "FirstLootEver_"..avID should be used. For criteriaID, string "FirstLootEver_"..avID.."_"..criteriaNum should be used.
-- fleCategory
--- (string) A string identifying the category the achievement belongs to. Category will be created if it doesn't exist.
-- previousAch
--- (number) For achievement chains, this is the avID for the previous achievement in the chain, nil otherwise. Can only be passed avIDs of achievements created using FLE APIs.
-- nextAch
--- (number) For achievement chains, this is the avID for the next achievement in the chain, nil otherwise. Can only be passed avIDs of achievements created using FLE APIs.
FirstLootEver:AwardAchievement(avID)
- Arguments
-- avID
--- (number) numeric ID of the achievement to award
---------- Post added 2011-09-10 at 10:10 PM ----------
I'll copy one of my achievement functions and comment it for you in a second.
---------- Post added 2011-09-10 at 10:27 PM ----------
Code:
FirstLootEver:RegisterAchievement(280, "Not Cross-Realm", "Obtain any item of Heirloom quality.", -- avID 280, name is "Not Cross-Realm"
"Interface\\Icons\\Achievement_BG_returnXflags_def_WSG", -- icon texture
function(addon, id) -- checkFunc
if (select(3,GetItemInfo(id))) == 7 then -- if the itemQuality of the looted item is 7 (Heirloom)
return true -- award achievement
end
end,
{ -- it has no criteria to display (single-step-achievement)
},
"Heirloom", -- it's in the heirloom category
nil, -- there's no previous one
281 -- the next one is 281 ("Complete Inheritance!", loot every heirloom there is)
)