Talk:Loot Filtration
"By editing the "item filter" file, which can be found in your "filter" folder within your Path of Diablo installation folder. You may create a set of rules which will change the way loot is displayed.
You can find loot filters made by other players and download instructions at List of Loot Filters.
Contents
Overview
PoD’s loot filter is based off of the same item filtering style originally introduced by BH. It has however grown substantially from the featureset provided by BH.
If you have a request for changes or additions, want to report bugs or merely get help building a filter, please join the Path of Diablo Discord, and ask in the #lootfilter channel.
NOTE: Anything marked as [Deprecated] will be removed in future versions.
Definitions and File Structure
All PoD item filters are utf-8 encoded text files with the .filter file extension, found in the filter directory of your Path of Diablo installation.
Filters are processed from top to bottom, this has an important role when it comes to precedence of filter matching and accruing of transforms to the item name, notifications, notes and styles.
Ordering does not affect filter level names, macros, item code or skill lists.
File comments are made by starting a line with // causing anything else on the line to not be processed. One may also use blank/empty lines without any effect on the filter.
Filter files can contain the following top level definitions:
Name/Syntax | Description |
---|---|
ItemDisplay[expr]: text | Defines a filtering expression and the item name it’ll produce when matched. |
FilterLevel[id]: name | Names a filter level. |
SkillList[name]: skill id’s | Defines a group of skill id’s that can be used to reduce duplication in filter expressions. |
ItemList[name]: item codes | Defines a group of item codes that can be used to reduce duplication in filter expressions. |
Option[name]: value | Defines an option. |
Attribute[name]: value | Defines a preset filter attribute. |
ItemDescription[name]: text | Defines a reusable item note. |
ItemStyle[name]: styling | Defines an item display and notification style. |
TextMacro[name]: text | Defines a reusable text macro to simplify commonly used idioms. |
Sound[name]: path|id | Defines a custom sound for use in the filter. |
EnableIf[expr] | Starts a block-level filter. |
EndIf[] | Ends a block-level filter. |
During parsing, all invalid or incorrectly formatted lines will be ignored to prevent potential crashes. Issues detected by the parser will be logged out to the Diablo II log file, additionally they can be logged to the in-game message console. Any invalid expressions will be ignored and always return true to prevent accidentally hiding items that shouldn’t be hidden.
Item Display Filtering
Items can be filtered on the ground, inventory and NPC trade windows. In each scenario the [ItemDisplay]
entries will be evaluated from the top of the file to bottom, until a terminating match is found. Matches that do not terminate will accrue their changes for filters below them. This allows setting a general filter at the top for common styling and then making specific changes to the style further down. This does mean that you will want to have your most general matching filters at first and your most specific filters last.
If no terminating filter is found, any accrued style changes will still be applied.
Building an item filter is done using a combination of conditions and filtering variables that evaluate to true or false (Boolean logic). For a filter to match an item, the entire expression needs to evaluate to true. See Optimizing Your Filters for performance recommendations.
Filters can optionally include:
- An item note, shown in the full item description. The note can be inlined or use a globally defined note, see Item Descriptions.
- Styling, which can be done via the old (deprecated) specifiers, an inline style or a globally defined style, see Item Styles.
Filtering Syntax
Item filters have two core parts:
- The expression which is used to evaluate if a filter applies to an item.
- The text replacements used when an item matches the filter.
The expression is composed of one or more boolean expressions. These sub-expressions are built up using Filtering Variables. The sub-expressions can be joined together using logical OR (also aliased as ||) and AND (also aliased as &&). A space between two sub-expressions creates an implicit AND.
Parentheses can be used to group sub-expressions to better control the boolean evaluation of the expression.
N.B. Certain expression functions have optional parameters, to avoid parsing errors, ALWAYS use a space between a parameterless function and opening parenthesis.
A sub-expression or sub-expressions group with parentheses can be inverted using the ! (NOT) operator.
Integer comparisons can be performed using the following operators:
- < (less than)
- > (greater than)
- = (equal to)
- <= (less than or equal to)
- >= (greater than or equal to)
- != (not equal to)
Functions that produce integer values when not used with a comparison operator are implicitly converted to a boolean, where a value of 0 is false and any other value is true.
Names are always enclosed in quotation marks (eg: “Super Healing Potion”), however certain functions allow the usage of named-constants, which must not be enclosed, see Filtering Variables for more information.
Options
Filter options define default settings for the filter when it is first loaded. They can be defined anywhere in the filter file. Any or all of the options can be omitted.
Options are defined using the following syntax: Option[name]: value
Where name can be one of the following:
Name | Description |
---|---|
DefaultFilterLevel | Sets a default FilterLevel |
DefaultNotifyLevel | Sets a default NotifyLevel |
IgnoreMissingSounds | Allows filter to not throw errors if sound files cannot be found |
Attributes
Filter attributes define various miscellaneous information about the filter; some of this information is displayed whenever the filter is loaded. They can be defined anywhere in the filter file. Attributes are always string values, any or all of the attributes can be omitted.
Options are defined using the following syntax: Attribute[name]: value
Where name can be one of the following:
Name | Description |
---|---|
Name | What is the name of this filter |
Version | What is the current version of this filter |
Author | Who wrote this filter |
Date | When was the filter last updated |
Filter And Notification Levels
Macros
[TextMacro]
defines a textual substitution that can be reused through-out the filter in [ItemDisplay]
, [ItemDescription]
or inline item notes. They all for all the same substitutions are item names and notes. They however may not include other macros.
To reference a [TextMacro]
, use the following syntax:
%!name!%
where name is a case-sensitive match to any defined [TextMacro]
. If no match is found the text is left unchanged.
For example if you wanted to have red, green, and blue @ signs to be displayed when a super healing potion drops you would define the macros:
TextMacro[RGB]: %RED%@%GREEN%@%BLUE%@ TextMacro[BGR]: %BLUE%@%RED%@%GREEN%@
Then call it the items display line:
ItemDisplay["Super Healing Potion"]: %!RGB!% %RED%%NAME% %!BGR!%
Resulting in:
Below to be replaced
Basics
Item Codes
All items in the game have an id code. Below are a few examples:
Code | Item |
---|---|
tsc | Scroll of Town Portal |
rvs | Rejuvenation Potion |
pk1 | Key of Terror |
cx5 | Orb of Corruption |
See more codes at Loot Filtration Codes
If you would like to rename "Scroll of Town Portal" to a much shorter "TP" then you would type: ItemDisplay[tsc]: TP
You can also add more text to an item. If you want to remember which boss drops which uber key then you would type: ItemDisplay[pk1]: Key of Terror (Countess)
Color Codes
You can also change the color of the item name using color codes. Below are a few example colors:
Code | Color |
---|---|
%GREEN% | |
%DGREEN% | |
%GOLD% | |
%TAN% |
See more codes at Loot Filtration Codes
If you would like to change the color of the Horadric Cube to purple then you would type: ItemDisplay[box]: %PURPLE%Horadric Cube
You can also use multiple colors within a single item. For example if you want the word "Horadric" to be yellow and "Cube" to be purple you would type: ItemDisplay[box]: %YELLOW%Horadric %PURPLE%Cube
Value References
Sometimes you want to call upon a value in the game to show the player. Below are a few examples:
Code | Output |
---|---|
%PRICE% | Selling price of the item |
%ILVL% | Item level |
%SOCKETS% | Show the item's socket count |
See more codes at Loot Filtration Codes
If you want to show the selling price of an item using a dollar sign ($100) as a prefix you would type: ItemDisplay[gpm]: ($%PRICE%) Choking Gas Potion
The same thing can be done to show the item level {L99} as a suffix: ItemDisplay[cm3]: %NAME% {L%ILVL%}
Hiding Items
When you want to hide an item, you simply leave the space behind the colon (:) empty.
So for example if you want to hide Antidote potions (yps) you would type: ItemDisplay[yps]:
This tells the game to display Antidote potions as nothing, which hides the item.
Rule Priority
The higher the rule in your filter file, the higher priority it will have.
This means if on the first line of your item filter you choose to hide all Spears but then on Line 2 you choose to show Spears with 6 sockets then the result is no spear will ever show.
In this example, you would change their location within the file. So show 6 socket spears on Line 1 and hide all spears on Line 2. This will hide all Spears except those with 6 sockets.
Conditions
- >
- <
- =
- <=
- >=
- !=
Using Greater than >, Less than <, Equal to =, Less than or equal to <=, Greater than or equal to >=, and Not equal to != will help add conditions to rules.
You may want to hide gold stacks that are not worth your time (stacks below 1000g) by typing: ItemDisplay[GOLD<1000]:
Logical Operators
You can use logical operators whenever you want to show an item only if a certain condition is met. Below are all the options:
- AND
- OR
- ! (logic negation)
If you want to show all polearms (WP8) with 4 or 5 sockets then you would type: ItemDisplay[WP8 (SOCK>3 AND SOCK<6)]: %NAME%
This same rule can be written in a different way: ItemDisplay[WP8 !SOCK=0 !SOCK=1 !SOCK=2 !SOCK=3 !SOCK=6]: %NAME%
The first one says "Show me all polearms with more than 3 but less than 6 sockets" whereas the second says "Show me all polearms but not ones with 0, 1, 2, 3 or 6 sockets".
It is important to keep AND & OR within their own bracket set. For example: (SOCK>3 OR SOCK=1). This is not required for logic negation (!)
Text Decoration and sounds
You can alter the appearance of item drops by adding filter code to the items display line. To make a super healing potion look like this:
You would format the potions display line as follows:
ItemDisplay["Super Healing Potion"]: %RED%%NAME% %MAPICON(4,5)% %BORDER(1,33)% %BGCOLOR(4)%
Drop decoration and sound modifiers:
Code | Input | Description |
|
---|---|---|---|
%MAPICON(x or x,x)% | One (1-96) or two (1-8) numbers. The first number sets the icon, 2nd shifts the color | Sets an icon that's visible on the minimap | |
%BORDER(x or x,x)% | One (1-253) or two (1-4) numbers. The first number sets a border color, 2nd number sets border thickness | Creates a border around the item name display | |
%BGCOLOR(x)% | One number (1-253) | Adds a background color to the item name display | |
%NOTIFY(x)% | A Color, choosing "ITEM" uses the default item color (blue for magic, yellow for rare, etc.) |
Creates a chat notification when the item drops | |
%NOTIFYSOUND(x)% | Number corresponding with an in game sound index | Forces a special sound when an item drops |
Filter levels
Filters can be set to varying degrees of strictness using filterlevels. To only show minor hp pots in the lowest filter level you could use:
ItemDisplay[hp1 FILTERLVL=1]: %RED%!%WHITE%minor hp
You can give filter levels names that can be seen in game using the H menu:
FilterLevel[1]: Ladder start FilterLevel[2]: Maps FilterLevel[3]: No low runes FilterLevel[4]: No hp/mp pots
Modern Filtering Techniques
Patch #21 Shungite brought us new filtering options, including macros, styles, support for if statements, and better ways to manage custom sounds.
Text Macros
Text macros are lines of text that can be preset and used repeatedly without the need to retype the entirety of the text. This is useful if the same test will be reused in a filter, as well as making some filtering lines easier to read to and change. If, for example you wanted to have red, green, and blue @ signs to be displayed when a super healing potion drops you would display it as:
ItemDisplay["Super Healing Potion"]: %RED%@%GREEN%@%BLUE%@ %RED%%NAME% %BLUE%@%RED%@%GREEN%@
Assuming this text would be used multiple times in a filter, instead of having to reuse that you could assign it to a text macro. At the top of the filter:
TextMacro[RGB]: %RED%@%GREEN%@%BLUE%@ TextMacro[BGR]: %BLUE%@%RED%@%GREEN%@
Then to use a text macro you call it by wrapping the name of it %! !%, like this:
ItemDisplay["Super Healing Potion"]: %!RGB!% %RED%%NAME% %!BGR!%
Styling
Styles can be used to set display options like border and background color of an item drop. Styles are defined at the top of the filter just like text macros and can be used by wrapping the name in << and >> like <<Style>>. To achieve this display:
Define the style at the top of the filter:
ItemStyle[Fancy]: MapIcon = 4, MapIconColor = 5, BorderColor = 33, BorderSize = 1, BackgroundColor = 4
Then apply it using:
ItemDisplay["Super Healing Potion"]: %RED%%NAME% <<Fancy>>
Inline styles
Styles can also be used and edited in-line. Using the above example, if you wanted a different background color you would use:
ItemDisplay["Super Healing Potion"]: %RED%%NAME% <:Fancy: BackgroundColor = 155>
This would apply all parts of the Fancy style except for the background color, background color will use the newly defined color instead.
Style elements border color and background color can also utilize RGB values, for example BackgroundColor = RGB(245/2/19)
.
Applying Styles and Macros together
Text macros and styles can be used together
ItemDisplay["Super Healing Potion"]: %!RGB!% %RED%%NAME% %!BGR!% <:Fancy: BorderColor = 99, BorderSize = 4> ItemDisplay[POTION]: %!RGB!% %PURPLE%%NAME% %!BGR!% <<Fancy>>
Notifications and Sounds
Notifications can come in the form of chat messages or audio cues letting you know an item dropped. You can enable notifications by defining NotificationColor or NotificationSound. Adding notification options to a style definition:
ItemStyle[Fancy]: NotificationColor = RED, NotificationPriority = MEDIUM, NotificationSound = "folderwithsounds\soundfile", NotificationSoundPriority = HIGH
This would give us a red notification in chat when the item drops and play the sound named “soundfile” that’s located in the “folderwithsounds” folder.
Alternatively you can use game sounds by referencing the sound location in game files:
ItemStyle[Fancy]: NotificationColor = RED, NotificationPriority = MEDIUM, NotificationSound = "@global\sfx\item\rune”, NotificationSoundPriority = HIGH
This would give us a red notification in chat when the item drops and play the rune drop sound from the game files.
Items can be given notification and sound notification priority values of high, medium, or low. In game you can choose high medium and low values. Setting the values to low in game will cue all notifications, setting medium in game will allow medium and high notifications, and setting high in game will allow only notifications that are set to high.
If Statements
If statements can be useful when you want to evaluate only certain items on some criteria. Since every drop is evaluated line-by-line in a filter until a match is found, if blocks can provide efficiency by forcing item checks to ignore multiple lines. As an example, if you wanted look for pre-buff assassin claws, and add the skill name to the display, you could use the lines:
ItemDisplay[CL5 NMAG SKILL("Blade Shield")>2]: %NAME% %LIGHT_GRAY%+3 Blade Shield ItemDisplay[CL5 NMAG SKILL("Venom")>2]: %NAME% %LIGHT_GRAY%+3 Venom
This would add “+3 skill name” to these claws, but every item dropped would be evaluated to see if they match. An if statement addressing this could be:
EnableIf[CL5 NMAG] ItemDisplay[SKILL("Venom")>2]: %NAME% %LIGHT_GRAY%+3 Venom %CONTINUE% ItemDisplay[SKILL("Blade Shield")>2]: %NAME% %LIGHT_GRAY%+3 Blade Shield %CONTINUE% ItemDisplay[CL5 NMAG]: %NAME% EndIf[]
This would cause any item that’s not a white or grey assassin claw to ignore those lines.
Another example could be to add Hemorrhage or life tap charges to the items display
EnableIf[(MAG OR NMAG) (WP12)] ItemDisplay[(MAG OR NMAG) SKILL("Hemorrhage")=3]:%NAME% %RED% +3 Hemo ItemDisplay[(MAG OR NMAG) SKILL("Hemorrhage")=2]:%NAME% %RED% +2 Hemo ItemDisplay[(MAG) CHARGES("Life Tap")>0]:%NAME% %LIGHT_GRAY%+Life Tap Charges %CONTINUE% ItemDisplay: %NAME% EndIf[]
These are small examples but this concept can be scaled up to apply to all + skill granting items, runeword bases, and even potions, potentially allowing many items to skip filter lines which wouldn’t apply to them.
ALT Text
Holding the ALT key when hovering over an item shows additional information not seen by default referred to as advanced item descriptions. You can add to these advanced item descriptions by enclosing "ALT text" in brackets {}.
Using:
ItemDisplay[tsc]: %NAME% {This is a TP scroll}
Adds the text "This is a TP scroll" to TP scrolls that's only visible when holding the ALT key on the keyboard.
A more useful implementation for this could be to add cube recipes or possible corruption mods to an item. Presenting this larger amount of text as an advanced item description allows the convenience of having the information there but with the convenience of not having it visible all the time.
Attribution
Attribute codes notify users of general filter info when it's loaded.
Code | Purpose |
---|---|
Attribute[Author]: | Filter authors name |
Attribute[Name]: | Name of the filter |
Attribute[Version]: | Version number |
Attribute[Date]: | Last edit date |
How filter attributes are displayed in game:
Credits
Loot filtration implemented in PoD by Dav92 based on code from McGoD, underbent and Deadlock39. Later rebuilt from the ground up by Necrolis.