do local AllCardsBagApi = {} local ALL_CARDS_BAG_GUID = "15bb07" -- Returns a specific card from the bag, based on ArkhamDB ID -- @param table: -- id: String ID of the card to retrieve -- @return: If the indexes are still being constructed, an empty table is -- returned. Otherwise, a single table with the following fields -- cardData: TTS object data, suitable for spawning the card -- cardMetadata: Table of parsed metadata AllCardsBagApi.getCardById = function(params) return getObjectFromGUID(ALL_CARDS_BAG_GUID).call("getCardById", params) end -- Gets a random basic weakness from the bag. Once a given ID has been returned -- it will be removed from the list and cannot be selected again until a reload -- occurs or the indexes are rebuilt, which will refresh the list to include all -- weaknesses. -- @return: String ID of the selected weakness. AllCardsBagApi.getRandomWeaknessId = function() return getObjectFromGUID(ALL_CARDS_BAG_GUID).call("getRandomWeaknessId") end AllCardsBagApi.isIndexReady = function() return getObjectFromGUID(ALL_CARDS_BAG_GUID).call("isIndexReady") end -- Called by Hotfix bags when they load. If we are still loading indexes, then -- the all cards and hotfix bags are being loaded together, and we can ignore -- this call as the hotfix will be included in the initial indexing. If it is -- called once indexing is complete it means the hotfix bag has been added -- later, and we should rebuild the index to integrate the hotfix bag. AllCardsBagApi.rebuildIndexForHotfix = function() return getObjectFromGUID(ALL_CARDS_BAG_GUID).call("rebuildIndexForHotfix") end -- Searches the bag for cards which match the given name and returns a list. Note that this is -- an O(n) search without index support. It may be slow. -- @param array must contain these fields to define the search: -- name String or string fragment to search for names -- exact Whether the name match should be exact AllCardsBagApi.getCardsByName = function(params) return getObjectFromGUID(ALL_CARDS_BAG_GUID).call("getCardsByName", params) end AllCardsBagApi.isBagPresent = function() return getObjectFromGUID(ALL_CARDS_BAG_GUID) and true end -- Returns a list of cards from the bag matching a class and level (0 or upgraded) -- @param table: -- class: String class to retrieve ("Guardian", "Seeker", etc) -- isUpgraded: true for upgraded cards (Level 1-5), false for Level 0 -- @return: If the indexes are still being constructed, returns an empty table. -- Otherwise, a list of tables, each with the following fields -- cardData: TTS object data, suitable for spawning the card -- cardMetadata: Table of parsed metadata AllCardsBagApi.getCardsByClassAndLevel = function(params) return getObjectFromGUID(ALL_CARDS_BAG_GUID).call("getCardsByClassAndLevel", params) end AllCardsBagApi.getCardsByCycle = function(cycle) return getObjectFromGUID(ALL_CARDS_BAG_GUID).call("getCardsByCycle", cycle) end AllCardsBagApi.getUniqueWeaknesses = function() return getObjectFromGUID(ALL_CARDS_BAG_GUID).call("getUniqueWeaknesses") end return AllCardsBagApi end