Auctioneer/5.0/Core API

From Norganna's AddOns

Jump to: navigation, search

Core API

Introduction

The Core API is exposed via the AucAdvanced.API namespace and should provide the only functions that you will ever need to use to interact with the core, or other modules in most normal conditions (unless specific, non-generic interaction is called for.)

Following is a list of the functions that comprise the Core API, and their defined purposes.

API Functions

API function: AucAdvanced.API.GetMarketValue(itemLink, [serverKey])
Purpose: Acquire the market value of the given item.

This function acquires the current market value of the mentioned item using a configurable algorithm to process the data used by the other installed algorithms.

Note: The result of this function does not (and should not) take into account competition, it simply returns what a particular item is "worth", and not what you could currently sell it for. Valuations based off current economic state is the role of utility modules' and/or their GetPrice() functions.

Note 2: This algorithm currently "works" by doing an average of the existing Stats modules' prices (and thus excluding Util modules' prices). This is a big and nasty hack that needs to be "fixed". The current thought on the best way to do this is to provide a configurable weighted average algorithm.
API function: AucAdvanced.API.GetAlgorithms()
Purpose: Returns a list of avaliable pricing algorithms
Calling this function will return an indexed table with valid algorithm names that you can query for prices.
API function: AucAdvanced.API.IsValidAlgorithm(algorithm)
Purpose: Checks to see if a given pricing algorithm is valid
Call this function with an algorithm name to check if it's currently valid.
API function: AucAdvanced.API.GetAlgorithmValue(algorithm, itemLink, [serverKey])
Purpose: Get the algorithm's valuation of the given item

By passing the algorithm name, and the itemLink, you can get the valuation price for the given item, by the given named algorithm's GetPrice() function.

This function should be called in preference to individual modules' GetPrice() functions, even between closely affiliated modules, as this function provides additional protection against infinite recursion and non-existant modules.
API function: AucAdvanced.API.QueryImage(query, [faction, [realm, [...]]])
Purpose: Uses the current image to perform a search query

The scanning engine maintains what it views as a current image of what exists on the AH at any given time.

This function allows parametized queries of that data to be performed, and the results returned as an indexed table of the result data (which can be unpacked with the UnpackImageItem() API function below)

The query parameter is a named table with the following possible keys:

  • filter - A function that will be called with the data stream and the remainder of the argument stack to determine if the item should be filtered from the list. If filter(data, ...) returns true, then the item will be filtered out of the results.
  • minUseLevel - The minimum required level to be included in the results
  • maxUseLevel - The maximum required level to be included in the results
  • minItemLevel - The minimum item level to be included in the results
  • maxItemLevel - The maximum item level to be included in the results
  • class - The name of the item class to be included in the results
  • subclass - The name of the subclass to be included in the results
  • quality - The minimum quality level (0-6) to be included in the results
  • invType - The name of the equip slot to be included in the results
  • seller - The name of the seller to be included in the results
  • name - The name of the item (or substring) to be included in the results
  • minStack - The minimum stack size to be included in the results
  • maxStack - The maximum stack size to be included in the results
  • minBid - The minimum bid amount to be included in the results
  • maxBid - The masimum bid amount to be included in the results
  • minBuyout - The minimum buyout amount to be included in the results
  • maxBuyout - The maximum buyout amount to be included in the results
API function: AucAdvanced.API.UnpackImageItem(itemData)
Purpose: Unpacks a packed image item
Image items are stored in an indexed table. This function further abstracts the process by taking the items from the indexed table, and placing them into a named table. If you want to access the contained data by name instead of field number, you should call this function, which will unpack the data into a named table for you.
API function: AucAdvanced.API.ListUpdate()
Purpose: Sends a "listupdate" message to any listening modules

Some modules play with the AH browse window, and require notification when they are needed to update their auction displays.

This function will notify all listening modules that the browse window contains changes, and their respective changes should be refreshed.
Personal tools