If and how one can filter items in WoW by rarity with DKP Log Parser is a common question, so I'm going to sum it up in a thread.
The way that it can be done is by altering the loot pattern, and then more specifically filtering based on the item's color code (and the color is connected to the rarity). The following are the colors and their codes:
Gray - ff9d9d9d
White - ffffffff
Green - ff1eff00
Blue - ff0070dd
Purple - ffa335ee
Orange -ffff8000
For the examples I'm going to assume that the input is strings from CT RaidTracker with the post 1.25.8 format. The loot pattern, which control how loot items should be read, can be found an configured in the configuration's pattern settings in the Join/Leave tab. The important is not how it works (although I will gladly explain that to anyone interested), the important is how we make it so that it only lets the interesting items pass. The following is the default loot pattern fo CT RT with the new format.
| Code: |
| RaidInfo>Loot>key\d+:ItemName<(.+)>Player<(.+)>Time<(\d+)>Count<(\d+)>"Costs<(\d+)"? |
To start we can add a condition to say that it should only allow orange items.
| Code: |
| RaidInfo>Loot>key\d+:ItemName<(.+)>Player<(.+)>Time<(\d+)>Count<(\d+)>"Costs<(\d+)"?>Color<ffff8000 |
Note the "ffff8000" at the end of that pattern, it is the code for the color that should be allowed (as listed in the list above). We can also make it so that several colors should be allowed, for instance the following will allow purple and orange items.
| Code: |
| RaidInfo>Loot>key\d+:ItemName<(.+)>Player<(.+)>Time<(\d+)>Count<(\d+)>"Costs<(\d+)"?>Color<ffff8000|ffa335ee |
Note that I added the color codes for purple to the end of the pattern, separating the codes with '|'. Any number of such colors can be added to the pattern in the same way, allowing more and more item colors. So now we can filter the colors so that we only let items of specific colors through. That might however not be enough, some items of low rarity should still be included in the results. To fix that we can add additional conditions to the pattern.
| Code: |
| RaidInfo>Loot>key\d+:ItemName<(.+)>Player<(.+)>Time<(\d+)>Count<(\d+)>"Costs<(\d+)"?>"Color<ffff8000|ffa335ee~Note<.+" |
This pattern makes it so that an item has to have color purple or orange OR have a note. Notes can, as far as I know, be entered for items, so whenever an item that is not blue, purple or orange appears that one wants to include in the results then one just has to write some kind of note (any text works). The parser will see the note and include the item, event though it is not blue, purple or orange.
Additionally one can tell the parser to let items with properties pass the filter. So one can for instance tell the parser to include all items named "Bright Wooden Staff" or "Dark Wooden Staff" while still including all items of specific colors. This can be done with the following (adding to the previous pattern).
| Code: |
| RaidInfo>Loot>key\d+:ItemName<(.+)>Player<(.+)>Time<(\d+)>Count<(\d+)>"Costs<(\d+)"?>"Color<ffff8000|ffa335ee~Note<.+~ItemName<Bright Wooden Staff|Dark Wooden Staff" |
The same can be done for other things that are exported by CT RaidTracker, for instance item id and so on. The possibilities are quite vast.
Please ask if something is unclear or if you want me to make patterns that lets items through during specific conditions X. |