WoW:API GetQuestLogLeaderBoard: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
(upgraded deprecated template)
(added example code)
Line 7: Line 7:
;''Arguments''
;''Arguments''


:;i : Index of the quests objectives (see [[API GetNumQuestLeaderBoards|GetNumQuestLeaderBoards()]] ).
:;i : Index of the quests objective (see [[API GetNumQuestLeaderBoards|GetNumQuestLeaderBoards()]] ).


:;questID : Identifier of the quest. If not provided, default to the currently selected Quest, via [[API SelectQuestLogEntry|SelectQuestLogEntry()]].
:;questID : Identifier of the quest in the quest log. If not provided, default to the currently selected Quest, via [[API SelectQuestLogEntry|SelectQuestLogEntry()]].


----
----
Line 19: Line 19:


:;done : Boolean - ''nil'' if this sub objective is not completed yet, else 1
:;done : Boolean - ''nil'' if this sub objective is not completed yet, else 1
----
;''Useful examples''
function GetLeaderBoardDetails (boardIndex,questIndex)
  local leaderboardTxt, itemType, isDone = GetQuestLogLeaderBoard (boardIndex,questIndex);
  local i, j, itemName, numItems, numNeeded = string.find(leaderboardTxt, "(.*):%s*([%d]+)%s*/%s*([%d]+)");
  return itemType, itemName, numItems, numNeeded, isDone;
end
-- returns eg. "monster", "Young Nightsaber slain", 1, 7, nil

Revision as of 18:15, 24 January 2007

WoW API < GetQuestLogLeaderBoard

This function returns up to 3 values:

local desc, type, done = GetQuestLogLeaderBoard(i, [questID])

Arguments
i
Index of the quests objective (see GetNumQuestLeaderBoards() ).
questID
Identifier of the quest in the quest log. If not provided, default to the currently selected Quest, via SelectQuestLogEntry().

Return values
desc
String - The text description of the objective, like: "Kill foo: 0/3"
type
String - could be the following things: "item", "object", "monster", "reputation", or "event".
done
Boolean - nil if this sub objective is not completed yet, else 1

Useful examples
function GetLeaderBoardDetails (boardIndex,questIndex)
  local leaderboardTxt, itemType, isDone = GetQuestLogLeaderBoard (boardIndex,questIndex);
  local i, j, itemName, numItems, numNeeded = string.find(leaderboardTxt, "(.*):%s*([%d]+)%s*/%s*([%d]+)");
  return itemType, itemName, numItems, numNeeded, isDone;
end
-- returns eg. "monster", "Young Nightsaber slain", 1, 7, nil