Talk:Loot Filtration: Difference between revisions

From Path of Diablo Wiki
No edit summary
Line 169: Line 169:
[[File:Wiki-loot-filter-macro1.png]]
[[File:Wiki-loot-filter-macro1.png]]


== Skill & Item Lists ==


Sounds
Loot filters support playback of custom sounds and default game sounds. These sounds can be set using the NotificationSound (see Item Styles) or by using <code>%NOTIFYSOUND()%</code>.


There are two methods to play a custom sound, each with their own pros and cons:
{| class="wikitable"
|+
! Method
! Pros
! Cons
|-
| By Sounds.txt Id
|
* No need to include sound files with your filter.
|
* Plays through the game's shared sound channels.
* Requires looking up an ID from sounds.txt.
|-
| By File Path
|
* Can play custom sounds.
* Custom sounds play on their own channels separate from game sounds.
* Can still load sounds packaged with the base game.
|
* You will need to encode sounds correctly and package them with your filter.
|}


Any custom sounds need to be in the following format:
* Channels: 1 (Mono)
* BitRate: 22050Hz
* Format: Wav
File paths to custom sounds are relative to the filter folder in your Path of Diablo directory. If you want to use a sound that exists in one of the Diablo II archives, you need only append an “@” to the front of the path (eg. "@global\sfx\monster\beetle\attack1") and remove the top-level “data” portion from the path. Paths must always be enclosed in quotation marks.


Defining a reusable sound through-out your filter can be done with Sound[name]. They can be defined at any point in your filter file. To use it, first define your new sound, in this example it will be called “myFilterSound”:
<code>Sound[myFilterSound]: "path\to\file"</code>
Then you can use “myFilterSound” whenever you need a sound path or id.
== Filtering Variables ==
Filtering variables form the basis of any filter boolean expression. They are divided into 5 main types:
* Item codes – these are 3 or 4 letter codes used to match the item's base. A list of item codes can be found on the [[Loot_Filtration_Codes | Loot filtration codes page]].
* Item names – these are the in-game name of the item base, enclosed in quotations, eg: "Super Healing Potion".
* Booleans – these are true or false conditions based on properties of the item, the player or other global information.
* Complex – these are numerical values used in conjunction with the comparison operators.
* Functions – these take a set of 1 or more inputs and produce either a boolean or integer value.
=== Variables ===
Named Variables:
{| class="wikitable"
|+
! Name
! Description
|-
| ALLSK
| Returns the value of the +x to all skills stat
|-
| ALVL
| Returns the affix level of the item
|-
| AR
| Returns the value of the + to attack rating stat
|-
| AREALVL
| Returns the area level (monster level) of the area you are currently in.
|-
| ARMOR
| Boolean indicating if the item is classed as armor
|-
| ARPER
| Returns the value of the attack rating per level stat
|-
| AXE, BOW, DAGGER, JAVELIN, MACE, POLEARM, SCEPTER, SPEAR, STAFF, SWORD, THROWING, WAND, XBOW
| Boolean indicating if the item falls into one of these weapon categories.
|-
| BAR, DIN, DRU, NEC, SIN, SOR, ZON
| Boolean indicating if the item falls into one of these class specific item categories.
|-
| BELT, BOOTS, CHEST, CIRC, GLOVES, HELM, SHIELD
| Boolean indicating if the item falls into one of these armor categories.
|-
| CHSKx
| Returns the level of the charged skill for skill id x
|-
| CLx
| Boolean indicating if the item is part of the given class-specific item group, where x is:
* 1 = Druid Pelt
* 2 = Barbarian Helm
* 3 = Paladin Shield
* 4 = Necromancer Shield
* 5 = Assassin Katar
* 6 = Sorceress Orb
* 7 = Amazon Weapon
|-
| CLSKx
| Returns the value of the + class skills stat, where x is:
* 0 = Amazon
* 1 = Sorceress
* 2 = Necromancer
* 3 = Paladin
* 4 = Barbarian
* 5 = Druid
* 6 = Assassin
|-
| CLVL
| Returns the level of your character
|-
| CORRUPTED
| Boolean indicating if the item is corrupted
|-
| CRAFT, CRAFTED, INF, INFERIOR, MAG, MAGIC, NMAG, NONMAGIC, RARE, SET, SUP, SUPERIOR, UNI, UNIQUE
| Boolean indicating if the item is of the specified quality
|-
| CRAFTALVL
| Returns the affix level of the item if used for crafting
|-
| CRES
| Returns the value of the +% cold resistance stat
|-
| DEF
| Returns the value of the + defense stat
|-
| DEX
| Returns the value of the + dexterity stat
|-
| DIFF, DIFFICULTY
| Returns the current difficulty:
* 0 = Normal
* 1 = Nightmare
* 2 = Hell
|-
| DTM
| Returns the value of the damage to mana stat
|-
| ED
| Returns the value of the +% enhanced damage for weapons or +% enhanced defense for armors
|-
| ELITE, ELT, EXCEPTIONAL, EXC, NORMAL, NORM
| Boolean indicating if the item is of the specified grade
|-
| ENR
| Returns the value of the + energy stat
|-
| EQx
| Boolean indicating if the item is part of the given armor item group, where x is:
* 1 = Helm
* 2 = Chest
* 3 = Shield
* 4 = Gloves
* 5 = Boots
* 6 = Belt
* 7 = Circlet
|-
| ETHEREAL, ETH
| Boolean indicating if the item is Ethereal
|-
| FBR
| Returns the value of the faster block recovery stat
|-
| FCR
| Returns the value of the faster cast rate stat
|-
| FHR
| Returns the value of the faster hit recovery stat
|-
| FILTERLVL
| Returns the current filter level
|-
| FOOLS
| Boolean indicating if the item has the “Fools” affix
|-
| FRES
| Returns the value of the +% fire resistance stat
|-
| FRW
| Returns the value of the faster run/walk speed stat
|-
| GEM
| Boolean indicating if the item is a gem
|-
| GEMGRADE
| Returns the gem's grade:
* 1 = Amethyst
* 2 = Diamond
* 3 = Emerald
* 4 = Ruby
* 5 = Sapphire
* 6= Topaz
* 7 = Skull
|-
| GEMMED
| Boolean indicating if the item is socketed with gems/runes/jewels
|-
| GEMTIER
| Returns the gem tier:
* 1 = Chipped
* 2 = Flawed
* 3 = Normal
* 4 = Flawless
* 5 = Perfect
|-
| GFIND
| Returns the value of the +% gold find stat
|-
| GOLD
| Returns the amount of gold if the item is a gold pile
|-
| GRAIL
| [On Hold]
|-
| HARDCORE
| Boolean indicating if the player is in Hardcore
|-
| IAS
| Returns the value of the increased attack speed stat
|-
| IDENTIFIED, ID
| Boolean indicating if the item is identified
|-
| IDSCROLLS
| Returns the number of identify scrolls in your inventory
|-
| ILVL
| Returns the item level
|-
| LEVEL
| Returns the id of the current level
|-
| LIFE
| Returns the value of the + life stat
|-
| LRES
| Returns the value of the +% lightning resistance stat
|-
| MAEK
| Returns the value of the mana after kill stat
|-
| MANA
| Returns the value of the + mana stat
|-
| MAP
| Boolean indicating if the item is a map
|-
| MAPTIER
| Returns the map tier:
* 1 = White
* 2 = Yellow
* 3 = Red
|-
| MAXDMG
| Returns the value of the + maximum damage stat
|-
| MAXDUR
| Returns the value of the + durability stat
|-
| MFIND
| Returns the value of the +% magic find stat
|-
| MINDMG
| Returns the value of the + minimum damage stat
|-
| NOTIFYLVL
| Returns the current notification level
|-
| OSx
| Returns the value of the + level x skill stat
|-
| PERCENTILE
| Returns the percentile (between 0 and 99) of the base armor roll of the item
|-
| PLRCLASS
| Returns the current class of the player:
* 0 = Amazon
* 1 = Sorceress
* 2 = Necromancer
* 3 = Paladin
* 4 = Barbarian
* 5 = Druid
* 6 = Assassin
|-
| PRES
| Returns the value of the +% poison resistance stat
|-
| POTION
| Boolean indicating if the item is a potion
|-
| POTIONTIER
| Returns the tier of the potion:
* 1 = Minor or rejuvenating
* 2 = Light or full rejuvenating
* 3 = Normal
* 4 = Greater
* 5 = Super
|-
| PRICE
| Returns the vendor sell price for the item in the current difficulty
|-
| QLVL
| Returns the quality level of the item
|-
| QTY
| Returns the quantity of the item stack
|-
| QUEST
| Boolean indicating if the item is a quest item
|-
| REPAIR
| Returns the value of the repairs durability stat
|-
| REPLIFE
| Returns the value of the + life replenish stat
|-
| REPQUANT
| Returns the value of the replenish quantity stat
|-
| REQLEVEL
| Returns the required level of the item
|-
| RES
| Returns the minimum value between all fire/lightning/cold/poison resistance stats on the item
|-
| RUNE
| Boolean indicating if the item is a rune
|-
| RUNETIER
| Returns a value between 1 to 33 indicating the rune's tier
|-
| RUNEWORD, RW
| Boolean indicating if the item is a runeword
|-
| SKx
| Returns the value of the + level x skill (class specific) stat
|-
| SOCKETS, SOCK
| Returns the number of sockets for the item
|-
| SPECIAL
| Boolean indicating if the item is a special item. Current special items are:
* Quest Items
* Synthesized Items
|-
| STR
| Returns the value of the + strength stat
|-
| SYNTH
| Boolean indicating if the item is synthesized
|-
| TABSKx
| Returns the value of the + to {tab} skills stat where x is the id of the tab.
|-
| TPSCROLLS
| Returns the number of townportal scrolls in your inventory (including books)
|-
| VIT
| Returns the value of the + vitality stat
|-
| WEAPON
| Boolean indicating if the item is classed as a weapon
|-
| WPx
| Boolean indicating if the item is part of the given weapon item group, where x is:
* 1 = Axe
* 2 = Mace
* 3 = Sword
* 4 = Dagger
* 5 = Throwing
* 6 = Javelin
* 7 = Spear
* 8 = Polearm
* 9 = Bow
* 10 = Crossbow
* 11 = Staff
* 12 = Wand
* 13 = Scepter
* 14 = One Handed
* 15 = Two Handed
* 16 = Ambihanded
|}
=== Functions ===
Functions:
{| class="wikitable"
|+
! Name
! Description
|-
| CHARSTAT()
|-
| COUNT() [DISABLED]
| Counts the number of matching expressions.
|-
| CSKILLS()
|-
| CHARGES()
|-
| CTCSKILL()
|-
| ITEMLIST()
|-
| ITYPE()
|-
| OSKILL()
|-
| OSKILLS()
|-
| MAXSKILLS()
|-
| MAXOSKILLS()
|-
| PREFIX()
|-
| PLRCLASS()
|-
| REQCLASS()
|-
| SET()
|-
| SKILL()
|-
| SKILLS()
|-
| STAT()
|-
| STORAGE()
|-
| SUFFIX()
|-
| UNIQUE()
|}
== Block-Level Filters ==
Block-level filters provide a mechanism for skipping multiple filter lines (ItemDisplay[expr]: text entries) at once based on a set of common conditions. They can also be used to enable/disable groups of filter lines based on your filter level.
Block-level filters are required to have a start entry (with a filtering expression), and an end entry. Block-level filters can be nested, matching start entries to the next end entry in the file.
A start entry is defined as: <code>EnableIf[expr]</code>
An end entry is defined as: <code>EndIf[]</code>
expr uses the exact same filtering syntax and variables as ItemDisplay[expr]. An example of a basic block level filter is the following:
<pre>
EnableIf[RUNE]
ItemDisplay[]: %ORANGE%%RUNENAME% %TAN%[%RUNETIER%]%CONTINUE%
ItemDisplay[RUNETIER>16]: %NAME%%GOLD%!!HR!!
ItemDisplay[]: %NAME%
EndIf[]
</pre>
In this example, we can collate all filter lines that apply to runes, and then apply progressive styling based on the rune’s tier.
Block-level filters are a very powerful mechanism for both grouping and performance, and their usage is encouraged.
== Item Names ==
Item names can be built using one or more item filter lines. They are defined in the text portion of the ItemDisplay[expr]: text declaration, before any Item Styles or Item Descriptions.
The filters lines’ actions and substitutions are only run if the expr of the ItemDisplay[expr] is true. With the appropriate usage of Filtering Substitutions and the <code>%CONTINUE%</code> action, you can easily create complex names using multiple filtering lines.
When an item name is empty once all filters lines have run, that item will be hidden (when shown on the ground), grayed out (when shown in a vendor screen) or marked as “(Filtered)” (when shown in your inventory).
== Item Descriptions ==
Filters can also attach a “note” to an item's description in a player's or NPC’s inventory. Notes are useful for many things, such as recipes or trade values. Just like with item names, notes can be accrued, and use the same Filtering Substitutions.
Item descriptions are defined by any text appearing in the text portion of an <code>ItemDisplay[expr]</code> that is enclosed in curly braces.
Similar to Text Macro’s, you can also define globally reusable notes with the following syntax: <code>ItemDescription[name]: text</code>
To then use that note in a description, you would use the name enclosed by double curly braces. An example would be the following:
<pre>
ItemDescription[AnImportantNote]: %RED%This is important, don’t lose it!
ItemDisplay[QUEST]: %FULLNAME%{{AnImportantNote}}
</pre>
== Filtering Substitutions ==
Name substitutions allow for rewriting of text based on item information, static strings and other constants.
Constants:
{| class="wikitable"
|+
! Name
! Substitution
|-
|
* %WHITE%
* %RED%
* %GREEN%
* %BLUE%
* %GOLD% 
* %GRAY%
* %BLACK% 
* %TAN% 
* %ORANGE% 
* %YELLOW% 
* %PURPLE% 
* %DGREEN% 
* %DARK_GREEN% 
* %BOLD% 
* %CORAL% 
* %SAGE% 
* %TEAL% 
* %LGRAY% 
* %LIGHT_GRAY%
| Sets any text after the color constant to this color.
Note that %CORAL%, %SAGE%, and %TEAL% are only available in D2GL or Glide Wrapper.
|-
|
* %NEWLINE%
* %NL%
| Inserts a new line
|-
| %LBRACE%
| Inserts a left brace: {
|-
| %RBRACE%
| Inserts a right brace: }
|-
| %LANGLE%
| Inserts a left angle bracket: <
|-
| %RANGLE%
| Inserts a right angle bracket: >
|-
| %SPACE%
| Inserts a single space
|-
| %EMPTY%
| Inserts nothing, used to prevent white-space trimming.
|-
| %HIDE%
| Inserts nothing, purely a convenience to explicitly show this row is meant to hide an item
|}
Values:
{| class="wikitable"
|+
! Name
! Substitution
|-
| %PREVIOUS%
|
|-
| %NAME%
|
|-
| %NOTE%
|
|-
| %ITEMNAME%
|
|-
| %FULLNAME%
|
|-
| %BASENAME%
|
|-
| %RWNAME%
|
|-
| %SOCKETS%
|
|-
| %TIER%
|
|-
| %RUNETIER%
|
|-
| %RUNENAME%
|
|-
| %GEMTIER%
|
|-
| %GEMTYPE%
|
|-
| %MAPTIER%
|
|-
| %POTIONTIER%
|
|-
| %ILVL%
|
|-
| %ALVL%
|
|-
| %QLVL%
|
|-
| %CRAFTALVL%
|
|-
| %LVLREQ% / %REQLEVEL%
|
|-
| %WPNSPD%
|
|-
| %RANGE%
|
|-
| %CODE%
|
|-
| %PRICE%
|
|-
| %PERCENTILE%
|
|-
| %DEF%
|
|-
| %EDAMAGE%
|
|-
| %EDEFENSE%
|
|-
| %RES%
|
|-
| %TOTALRES%
|
|-
| %QTY%
|
|-
| %CLASS%
|
|-
| %CL%
|
|-
| %QUAL% / %QUALITY%
|
|-
| %QT% / %GRADE%
|
|-
| %STAT()%
|
|-
| %SKILL()%
|
|-
| %OSKILL()%
|
|-
| %SKILLNAME()%
|
|}
Item names can also be formed iteratively by using <code>%NAME%</code> to get the name set previously by any matching non-terminating filters. If no match to a substitution or function is found, the text is left unchanged.
== Item Styles ==


= Below to be replaced =
= Below to be replaced =