Quantcast
Download
(8 Kb)
Download
Updated: 05/26/19 01:50 PM
Compatibility:
Elsweyr (5.0.5)
Wrathstone (4.3)
Updated:05/26/19 01:50 PM
Created:05/04/19 08:28 AM
Monthly downloads:4,706
Total downloads:25,471
Favorites:105
MD5:
5.0.5
LibFilters-3.0  Popular! (More than 5000 hits)
Version: 3.0r1.2
by: Baertram [More]
LibFilters-3.0
THis version of LibFilters does NOT need any dependency to other libraries anymore (e.g. no LibStub needed).
You simply reference it by using the global Variable
Code:
LibFilters3
Attention - PLEASE READ
If you also use LibFilters-2.0:
Please update your addons to NOT use LibFilters-2.0 anymore, instead use LibFilters-3.0!
Change your addons manifest TXT file to ##DependsOn: LibFilters-3.0 and be sure to update the call of your addon to LibFilters-3.0 global variable LibFilters3 instead of the old one (or LiBStub instanced one)!

If LibFilters-3.0 and LibFilters-2.0 are loaded at the same time you'll see this information in your chat and should contact the authors of your addons which still use LibFilters-2.0 to update to LibFilters-3.0 please:
Code:
[LibFilters-3.0]An older version of this library is loaded too: LibFilters-2.0.
Please check which addons use this old Library in the ingame AddOn Manager and inform their authors to switch to LibFilters-3.0.
Otherwise addons using the different versions might conflict at some filter panels!"

Welcome to LibFilters-3.0!

The goal of LibFilters is to provide an easy interface for applying custom sorting rules to different lists of items found in the game. At the moment, you can filter the inventory, bank withdrawal, bank deposits, guild bank withdrawal, guild bank deposits, vendor buying, vendor selling, buyback, repair, guild store selling, mail sending, trading, smithing (refinement, deconstruction, improvement, research), alchemy creation, enchanting creation, enchanting extraction, fence selling, fence laundering, the craftbag, and the quickslot inventory.

To use LibFilters in your addon, you simply assign a reference to it's global variable LibFilters3.
Yo do NOT need any call to LibStub for it anymore. In your manifest you need to add LibFilters-3.0 to the ##DependsOn tag:
Code:
##DependsOn: LibFilters-3.0
In your addon, you need to invoke LibFilters with the global LibFilters3 variable and then initialize LibFilters:

Lua Code:
  1. local LibFilters = LibFilters3
  2. LibFilters:InitializeLibFilters()

This is the list of available filterType constants:
Code:
LF_INVENTORY                = 1
LF_BANK_WITHDRAW            = 2
LF_BANK_DEPOSIT             = 3
LF_GUILDBANK_WITHDRAW       = 4
LF_GUILDBANK_DEPOSIT        = 5
LF_VENDOR_BUY               = 6
LF_VENDOR_SELL              = 7
LF_VENDOR_BUYBACK           = 8
LF_VENDOR_REPAIR            = 9
LF_GUILDSTORE_BROWSE        = 10
LF_GUILDSTORE_SELL          = 11
LF_MAIL_SEND                = 12
LF_TRADE                    = 13
LF_SMITHING_REFINE          = 14
LF_SMITHING_CREATION        = 15
LF_SMITHING_DECONSTRUCT     = 16
LF_SMITHING_IMPROVEMENT     = 17
LF_SMITHING_RESEARCH        = 18
LF_ALCHEMY_CREATION         = 19
LF_ENCHANTING_CREATION      = 20
LF_ENCHANTING_EXTRACTION    = 21
LF_PROVISIONING_COOK        = 22
LF_PROVISIONING_BREW        = 23
LF_FENCE_SELL               = 24
LF_FENCE_LAUNDER            = 25
LF_CRAFTBAG                 = 26
LF_QUICKSLOT                = 27
LF_RETRAIT                  = 28
LF_HOUSE_BANK_WITHDRAW      = 29
LF_HOUSE_BANK_DEPOSIT       = 30
LF_JEWELRY_REFINE           = 31
LF_JEWELRY_CREATION         = 32
LF_JEWELRY_DECONSTRUCT      = 33
LF_JEWELRY_IMPROVEMENT      = 34
LF_JEWELRY_RESEARCH         = 35
LF_SMITHING_RESEARCH_DIALOG = 36
LF_JEWELRY_RESEARCH_DIALOG  = 37
LF_FILTER_MAX               = LF_JEWELRY_RESEARCH_DIALOG
The filterTypes will pass information from the bag&slotInde xor the inventorySlot to a filterCallback function registered to that filterType. For the slots, these are the keys available in the passed table:

Code:
inventory slot: age, bagId, condition, dataEntry, equipType, filterData,
  iconFile, inventory, isJunk, isPlayerLocked, itemInstanceId, itemType,
  launderPrice, locked, meetsUsageRequirement, name, quality, rawName,
  requiredLevel, searchData, sellPrice, slotControl, slotIndex,
  specializedItemType, stackCount, stackLaunderPrice, statValue, stolen,
  uniqueId

store slot: currencyQuantity1, currencyQuantity2, currencyType1,
  currencyType2, dataEntry, entryType, filterData, icon, isUnique,
  meetsRequirementsToBuy, meetsRequirementsToEquip, name, price, quality,
  questNameColor, sellPrice, slotIndex, stack, stackBuyPrice,
  stackBuyPriceCurrency1, stackBuyPriceCurrency2, statValue

buyback slot: icon, meetsRequirements, name, price, quality, slotIndex,
  stack, stackBuyPrice

repair slot: bagId, condition, dataEntry, icon, name, quality, repairCost,
  slotIndex, stackCount

quickslot slot: age, bagId, filterData, iconFile, locked,
  meetsUsageRequirement, name, quality, sellPrice, slotIndex, slotType,
  stackCount, stackSellPrice, stolen
LibFilters has the following functions available:

Code:
LibFilters:GetMaxFilter()
Returns the maximum filterType available

LibFilters:HookAdditionalFilter(filterType, inventory)
FilterType is one of the provided "LF_" prefixed constants. Inventory needs
  to be some construct which can make use of an additionalFilter to
  determine if an item is shown or not. Look in
  LibFilters:InitializeLibFilters and/or helper.lua for examples.

LibFilters:InitializeLibFilters()
Must be called after you've assigned LibFilters-3.0 to your local variable.

LibFilters:GetCurrentFilterTypeForInventory(inventoryType)
Returns the filterType currently affecting the provided inventoryType.

LibFilters:GetFilterCallback(filterTag, filterType)
filterTag is the unique string that identifies your filter. filterType is
  the provided "LF_" prefixed constants your filter was registered for.
  Returns the filterCallback registered for the provided filterTag and
  filterType; returns nil otherwise.

LibFilters:IsFilterRegistered(filterTag, filterType)
filterTag is the unique string that identifies your filter. filterType is
  the provided "LF_" prefixed constants your filter was registered for.
  Returns true if there is a filter registered with the provided filterTag.
  Returns false if there is not a filter registered with the provided
  filterTag. filterType is optional. If a filterType is provided, will only
  return true if a filter is registered to that filterType under the
  provided filterTag.

LibFilters:RegisterFilter(filterTag, filterType, filterCallback)
filterTag is a unique string to identify your filter. filterType is one of
  the provided "LF_" prefixed constants. filterCallback is a function which
  accepts either one or two arguments; this is determined by the filterType.
  filterCallback should return true if an item is to be shown.
  filterCallback should return false if an item should not be shown.

LibFilters:RequestUpdate(filterType)
filterType is one of the provided "LF_" prefixed constants. Runs the updater
  appropriate for the provided filter type to pick up any filtering changes.

LibFilters:UnregisterFilter(filterTag, filterType)
filterTag is the unique string that identifies your filter. filterType the
  provided "LF_" prefixed constants your filter was registered for.
  filterType is optional. If a filterType is not provided, all filters
  registered with the provided filterTag will be unregistered.
[v3.0 r1.2]
Fixed: Removed LibFilters2_filterType and exchanged them with LibFilters3_filterType in the inventory/layout data

[v3.0 r1.1]
-Removed optional dependency and chat message to inform about LibFilters-2.0 removal
-Fixed helper
Optional Files (0)


Archived Files (2)
File Name
Version
Size
Uploader
Date
3.0r1.1
8kB
Baertram
05/11/19 04:51 PM
3.0r1.0
8kB
05/04/19 08:28 AM


There have been no comments posted to this file.
Be the first to add one.



Category Jump: