What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal

[Plugin] ItemRuleExaminer 1.0

Ipo

New Member
Joined
Jun 13, 2012
Messages
24
Reaction score
1
[Plugin] ItemRuleExaminer 1.4 (Updated 2012-07-01)

I had some trouble with ItemRules, those files can be a little daunting and figuring out if you've gotten it right is sometimes harder than it needs to be. To help myself with that I wrote this plugin, which tries to match all the items in the inventory, equipped and on the ground against the current set of ItemRules, and prints the results to the terminal.

How to use:
* Install the plugin.
* Enter the game with a character.
* (optional)Set logging to Verbose.
* Turn plugin on.
* Wait a few seconds, this may take some time.
* Open the log-file in the log-directory where you installed DemonBuddy.
The plugin will now have listed all the items in your inventory, equipped and on the ground, complete with their stats and what the ItemRules think of them(Pickup/Keep/Sell/Salvage). If you set the logging to Verbose DemonBuddy will also have stated the description of the ItemRule that matched for each category(at least in DemonBuddy .146).


This is kind of a utility-plugin, so I don't imagine I will do much updates or support of it. Just putting it out there for whomever might find it useful!

Example output:
[15:35:26.765 V] [ItemRules] Matched Glittering Sanctified Quiver of Pain with rule: Pick up magic 61+:PickUp
[15:35:26.766 V] [ItemRules] Matched Glittering Sanctified Quiver of Pain with rule: Keep things with high gold find:Keep
[15:35:26.766 V] [ItemRules] Matched Glittering Sanctified Quiver of Pain with rule: Salvage magic 61+:Salvage
[15:35:26.766 N] [ItemRuleExaminer 1.4] Glittering Sanctified Quiver of Pain: PICKUP / KEEP / SALVAGE
[15:35:26.766 N] [ItemRuleExaminer 1.4] Glittering Sanctified Quiver of Pain (Armor-Quiver):
[15:35:26.767 N] [ItemRuleExaminer 1.4] Quality: Magic2
[15:35:26.767 N] [ItemRuleExaminer 1.4] Level: 62
[15:35:26.767 N] [ItemRuleExaminer 1.4] RequiredLevel: 60
[15:35:26.768 N] [ItemRuleExaminer 1.4] Dexterity: 83.00
[15:35:26.768 N] [ItemRuleExaminer 1.4] GoldFind: 12.99
[15:35:26.770 N] [ItemRuleExaminer 1.4] WeaponDamageType: None
[15:35:26.773 N] [ItemRuleExaminer 1.4]
[15:35:26.820 V] [Item Rules] Matched Flawless Square Ruby with rule: Pick up gems:PickUp
[15:35:26.821 V] [Item Rules] Matched Flawless Square Ruby with rule: Keep gems:Keep
[15:35:26.822 N] [ItemRuleExaminer 1.4] Flawless Square Ruby: PICKUP / KEEP
[15:35:26.822 N] [ItemRuleExaminer 1.4] Flawless Square Ruby (Gem-Unknown):
[15:35:26.822 N] [ItemRuleExaminer 1.4] Quality: Normal
[15:35:26.822 N] [ItemRuleExaminer 1.4] Level: 60
[15:35:26.826 N] [ItemRuleExaminer 1.4] WeaponDamageType: None
[15:35:26.829 N] [ItemRuleExaminer 1.4]
[15:35:26.855 V] [Item Rules] Matched Gold with rule: Pick up gold:PickUp
[15:35:26.857 N] [ItemRuleExaminer 1.4] 251 x Gold: PICKUP
[15:35:26.857 N] [ItemRuleExaminer 1.4] Gold (Misc-Unknown):
[15:35:26.857 N] [ItemRuleExaminer 1.4] Quality: Normal
[15:35:26.857 N] [ItemRuleExaminer 1.4] Level: 1
[15:35:26.861 N] [ItemRuleExaminer 1.4] WeaponDamageType: None
[15:35:26.865 N] [ItemRuleExaminer 1.4]
[15:35:26.874 V] [Item Rules] Matched {c:ffffff00}Plan: Exalted Dread Shield{/c} with rule: Pick up plans:PickUp
[15:35:26.875 V] [Item Rules] Matched {c:ffffff00}Plan: Exalted Dread Shield{/c} with rule: Keep plans:Keep
[15:35:26.875 N] [ItemRuleExaminer 1.4] {c:ffffff00}Plan: Exalted Dread Shield{/c}: PICKUP / KEEP
[15:35:26.875 N] [ItemRuleExaminer 1.4] {c:ffffff00}Plan: Exalted Dread Shield{/c} (Misc-Unknown):
[15:35:26.875 N] [ItemRuleExaminer 1.4] Quality: Normal
[15:35:26.876 N] [ItemRuleExaminer 1.4] Level: 46
[15:35:26.880 N] [ItemRuleExaminer 1.4] WeaponDamageType: None
[15:35:26.883 N] [ItemRuleExaminer 1.4]
[15:35:26.893 V] [ItemRules] Matched Sledge of Athskeleng with rule: Pick up legendary:PickUp
[15:35:26.895 V] [ItemRules] Matched Sledge of Athskeleng with rule: Keep legendary items:Keep
[15:35:26.895 V] [ItemRules] Matched Sledge of Athskeleng with rule: Sell magic 60-:Sell
[15:35:26.895 N] [ItemRuleExaminer 1.4] Sledge of Athskeleng: PICKUP / KEEP / SELL
[15:35:26.895 N] [ItemRuleExaminer 1.4] Sledge of Athskeleng (Weapon-Mace):
[15:35:26.896 N] [ItemRuleExaminer 1.4] Quality: Legendary
[15:35:26.896 N] [ItemRuleExaminer 1.4] Level: 59
[15:35:26.896 N] [ItemRuleExaminer 1.4] RequiredLevel: 58
[15:35:26.897 N] [ItemRuleExaminer 1.4] Dexterity: 81.00
[15:35:26.897 N] [ItemRuleExaminer 1.4] Sockets: 1
[15:35:26.897 N] [ItemRuleExaminer 1.4] WeaponAttacksPerSecond: 0.90
[15:35:26.897 N] [ItemRuleExaminer 1.4] WeaponMinDamage: 430.00
[15:35:26.897 N] [ItemRuleExaminer 1.4] WeaponMaxDamage: 500.00
[15:35:26.897 N] [ItemRuleExaminer 1.4] WeaponDamagePerSecond: 411.65
[15:35:26.898 N] [ItemRuleExaminer 1.4] WeaponDamageType: None
[15:35:26.898 N] [ItemRuleExaminer 1.4] MovementSpeed: 6.00
[15:35:26.901 N] [ItemRuleExaminer 1.4]
[15:35:26.948 V] [ItemRules] Matched Glittering Doom Pauldrons of Assault with rule: Pick up magic 61+:PickUp
[15:35:26.949 V] [ItemRules] Matched Glittering Doom Pauldrons of Assault with rule: Keep things with high gold find:Keep
[15:35:26.949 V] [ItemRules] Matched Glittering Doom Pauldrons of Assault with rule: Salvage magic 61+:Salvage
[15:35:26.949 N] [ItemRuleExaminer 1.4] Glittering Doom Pauldrons of Assault: PICKUP / KEEP / SALVAGE
[15:35:26.949 N] [ItemRuleExaminer 1.4] Glittering Doom Pauldrons of Assault (Armor-Shoulder):
[15:35:26.950 N] [ItemRuleExaminer 1.4] Quality: Magic2
[15:35:26.950 N] [ItemRuleExaminer 1.4] Level: 61
[15:35:26.950 N] [ItemRuleExaminer 1.4] RequiredLevel: 60
[15:35:26.951 N] [ItemRuleExaminer 1.4] Strength: 142.00
[15:35:26.951 N] [ItemRuleExaminer 1.4] Armor: 312.67
[15:35:26.951 N] [ItemRuleExaminer 1.4] ArmorTotal: 312.00
[15:35:26.952 N] [ItemRuleExaminer 1.4] GoldFind: 11.99
[15:35:26.953 N] [ItemRuleExaminer 1.4] WeaponDamageType: None
[15:35:26.966 N] [ItemRuleExaminer 1.4]

Changelog:
1.0 - Initial version.
1.1 - Should fix the exceptions that would happen in some circumstances.
1.2 - Trying to force DemonBuddy to update the items for the cases where nothing seems to happen.
1.3 - Fixed a couple of potential issues pointed out by GilesSmith.
1.4 - Filtering out invalid items in an attempt to be less spammy.

Edit: Added version 1.1, the problem you were having were probably because you were not logged in to a character when activating the plugin. That should be fixed now. I also clarified the instructions a bit in regards to how to get at *all* the data, since the log window isn't always able to hold all the text this plugin generates, using the actual log-file is much better.
Edit: Added version 1.2.
Edit: Added version 1.3.
Edit: Added version 1.4 and some example output.
 

Attachments

Last edited:
Just tried it to find out why some crappy stuff is landing in my stash.


Here is an example of a crappy sword which landed in my stash:

[17:46:42.311 N] [ItemRuleExaminer 1.0]
[17:46:42.320 V] [ItemRules] Matched Socketed Brimstone Sword of Horror with rule: :PickUp
[17:46:42.320 V] [Item Rules] Matched Socketed Brimstone Sword of Horror with rule: NAME_MATCH_ONLY:Keep
[17:46:42.320 V] [ItemRules] Matched Socketed Brimstone Sword of Horror with rule: Sell Everything:Sell
[17:46:42.320 N] [ItemRuleExaminer 1.0] Socketed Brimstone Sword of Horror: PICKUP / KEEP / SELL
[17:46:42.320 N] [ItemRuleExaminer 1.0] Socketed Brimstone Sword of Horror (Weapon-Sword):
[17:46:42.321 N] [ItemRuleExaminer 1.0] Quality: Magic2
[17:46:42.321 N] [ItemRuleExaminer 1.0] Level: 55
[17:46:42.321 N] [ItemRuleExaminer 1.0] RequiredLevel: 54
[17:46:42.323 N] [ItemRuleExaminer 1.0] Sockets: 1
[17:46:42.323 N] [ItemRuleExaminer 1.0] WeaponAttacksPerSecond: 1,10
[17:46:42.323 N] [ItemRuleExaminer 1.0] WeaponMinDamage: 162,00
[17:46:42.323 N] [ItemRuleExaminer 1.0] WeaponMaxDamage: 239,00
[17:46:42.323 N] [ItemRuleExaminer 1.0] WeaponDamagePerSecond: 220,55
[17:46:42.324 N] [ItemRuleExaminer 1.0] WeaponDamageType: None

Anyone know what "NAME_MATCH_ONLY" means and how to fix this in my rules?
 
Just tried it to find out why some crappy stuff is landing in my stash.
Here is an example of a crappy sword which landed in my stash:
Anyone know what "NAME_MATCH_ONLY" means and how to fix this in my rules?

You probably have this in your rules:
<ItemRule itemName="*Brimstone" />

Which quite a few rules have to try and force "Fiery Brimstone" (inferno crafting material) into your stash. Change the rule to;
<ItemRule itemName="Fiery Brimstone" />

And it'll stop it from accidentally filtering any items that have "<something> brimstone" as an item name :)

Great idea for a plugin btw - will be helpful double-checking more complicated item rulesets!
 
Yeah i had *Brimstone* in my rules. Thanks for the help.:)


Another one, maybe you can help me with this too:

[17:46:42.304 V] [ItemRules] Matched Cavalry Abyss with rule: :PickUp
[17:46:42.306 V] [ItemRules] Matched Cavalry Abyss with rule: Rare gear with crit chance:Keep
[17:46:42.306 V] [ItemRules] Matched Cavalry Abyss with rule: Sell Everything:Sell
[17:46:42.306 N] [ItemRuleExaminer 1.0] Cavalry Abyss: PICKUP / KEEP / SELL
[17:46:42.306 N] [ItemRuleExaminer 1.0] Cavalry Abyss (Armor-Legs):
[17:46:42.306 N] [ItemRuleExaminer 1.0] Quality: Rare4
[17:46:42.306 N] [ItemRuleExaminer 1.0] Level: 52
[17:46:42.306 N] [ItemRuleExaminer 1.0] RequiredLevel: 51
[17:46:42.307 N] [ItemRuleExaminer 1.0] Vitality: 54,00
[17:46:42.307 N] [ItemRuleExaminer 1.0] Armor: 230,00
[17:46:42.307 N] [ItemRuleExaminer 1.0] ArmorTotal: 230,00
[17:46:42.307 N] [ItemRuleExaminer 1.0] Sockets: 2
[17:46:42.308 N] [ItemRuleExaminer 1.0] WeaponDamageType: None
[17:46:42.309 N] [ItemRuleExaminer 1.0] HealthPerSecond: 25,00

These Pants get stashed even though they don't even have crit chance on them. :confused:

Rules look like this:
<ItemRule ruleType="Keep" itemBaseType="Armor" description="Rare gear with crit chance">
<StatRules>
<Rule stat="CritPercent" quality="Rare4" />
</StatRules>
</ItemRule>
 
Yeah i had *Brimstone* in my rules. Thanks for the help.:)
Another one, maybe you can help me with this too:
[17:46:42.304 V] [ItemRules] Matched Cavalry Abyss with rule: :PickUp
[17:46:42.306 V] [ItemRules] Matched Cavalry Abyss with rule: Rare gear with crit chance:Keep
[17:46:42.306 V] [ItemRules] Matched Cavalry Abyss with rule: Sell Everything:Sell
[17:46:42.306 N] [ItemRuleExaminer 1.0] Cavalry Abyss: PICKUP / KEEP / SELL
[17:46:42.306 N] [ItemRuleExaminer 1.0] Cavalry Abyss (Armor-Legs):
[17:46:42.306 N] [ItemRuleExaminer 1.0] Quality: Rare4
[17:46:42.306 N] [ItemRuleExaminer 1.0] Level: 52
[17:46:42.306 N] [ItemRuleExaminer 1.0] RequiredLevel: 51
[17:46:42.307 N] [ItemRuleExaminer 1.0] Vitality: 54,00
[17:46:42.307 N] [ItemRuleExaminer 1.0] Armor: 230,00
[17:46:42.307 N] [ItemRuleExaminer 1.0] ArmorTotal: 230,00
[17:46:42.307 N] [ItemRuleExaminer 1.0] Sockets: 2
[17:46:42.308 N] [ItemRuleExaminer 1.0] WeaponDamageType: None
[17:46:42.309 N] [ItemRuleExaminer 1.0] HealthPerSecond: 25,00
These Pants get stashed even though they don't even have crit chance on them. :confused:
Rules look like this:
<ItemRule ruleType="Keep" itemBaseType="Armor" description="Rare gear with crit chance">
<StatRules>
<Rule stat="CritPercent" quality="Rare4" />
</StatRules>
</ItemRule>
You don't have a min-value set for the crit percent. Try this;

<Rule stat="CritPercent" minValue="5" />

Without a min value, it's checking if it has a crit percent of 0% or more. Which is true - it does have 0% (or more)!
 
These Pants get stashed even though they don't even have crit chance on them. :confused:

Rules look like this:
<ItemRule ruleType="Keep" itemBaseType="Armor" description="Rare gear with crit chance">
<StatRules>
<Rule stat="CritPercent" quality="Rare4" />
</StatRules>
</ItemRule>
You probably need to provide a minimum value, like so:
<Rule stat="DamageReductionPhysicalPercent" minValue="17" />
(Technically all items have all stats as far as DB is concerned, it's just that most of the time the actual value is 0..in which case this plugin simply doesn't print them)

Also I don't even know if it's possible to have more than one condition per 'rule', like you're trying to do with both quality and stat there(or by extension, maybe one rule with two or more separate stats). Does anyone else have any insight there?
 
Last edited:
Also I don't even know if it's possible to have more than one condition per 'rule', like you're trying to do with both quality and stat there(or by extension, maybe one rule with two or more separate stats). Does anyone else have any insight there?

Rules like this are also in the DefaultItemRules.xml that comes with Demonbuddy so i think it should work with multiple conditions per rule. But I'm not 100% sure either.
 
Rules like this are also in the DefaultItemRules.xml that comes with Demonbuddy so i think it should work with multiple conditions per rule. But I'm not 100% sure either.
Yeah, you're right, for example:
<Rule stat="Intelligence" minValue="100" quality="Rare4" />

I wonder if it would be possible to get something like this working though..
<Rule stat="Intelligence" minValue="100" stat="Vitality" minValue="50" quality="Rare4" />
..doesn't seem likely, but it would be useful if it were. Further experimentation is necessary.
 
Yeah, you're right, for example:
I wonder if it would be possible to get something like this working though..
..doesn't seem likely, but it would be useful if it were. Further experimentation is necessary.
No, only the "quality" stat can be applied to each rule. And I have no idea why. But apparently the first quality listed is the one used for the entire ruleset. You would do this for multiple stats;

<ItemRule ruleType="Keep" itemBaseType="Armor" description="Rare gear with 100 int and 50 vit">
<StatRules>
<Rule stat="Intelligence" minValue="100" quality="Rare4" />
<Rule stat="Vitality" minValue="50" />
</StatRules>
</ItemRule>

though personally I just leave the "quality" stat out altogether and work on better specific filters. I posted a rule set with pretty specific filters here;
http://www.thebuddyforum.com/demonb...dual-requirements-every-single-item-slot.html

If you want to take a look (has different filtersets for every different item slot)
 
Random idea for you Ipo, though this might not be possible... can a plugin "hook on" to a part of the bot - eg looting?

As it might be a cool idea to expand your item plugin and make it record statistics about items as they get looted (or perhaps as they get stashed/sold/salvaged by the bot). Record total items picked up. Filter that out into "misc" items (items without an item level) and armour/weapons/jewellery. Be able to see average drop chances (eg of all the items picked up, 0.05% of them were legendary, 0.2% were item level 63, etc.). It could also check the "loot rules" for each item as and when it gets picked up and log any rule hits if needed.

Is anything even vaguely like this possible with the way plugins get coded?
 
I think the latest DB update might have broke the plugin? :(

Code:
[17:56:22.794 N] [ItemRuleExaminer 1.0] Enabled!
[17:56:22.794 D] Exception while enabling plugin ItemRuleExaminer 1.0: System.NullReferenceException: Object reference not set to an instance of an object.
   at ItemRuleExaminer.ItemRuleExaminer.DoUpdate()
   at ItemRuleExaminer.ItemRuleExaminer.OnEnabled()
   at Zeta.Common.Plugins.PluginContainer.set_Enabled(Boolean value)
[17:56:25.186 N] [ItemRuleExaminer 1.0] Disabled!
 
Random idea for you Ipo, though this might not be possible... can a plugin "hook on" to a part of the bot - eg looting?
As far as I'm aware there's no hooks provided for looting, but if one really wanted something like that I guess one could keep track of the contents of the inventory manually and run some code whenever something 'new' is detected. Right now the plugin will scan *all* known items at regular intervals, including inventory/equipped/ground/whatever else, and as soon as something new pops up, it will be checked against the rules, so technically one could keep it running and it would check new items against the rules as they drop.

As it might be a cool idea to expand your item plugin and make it record statistics about items as they get looted (or perhaps as they get stashed/sold/salvaged by the bot). Record total items picked up. Filter that out into "misc" items (items without an item level) and armour/weapons/jewellery. Be able to see average drop chances (eg of all the items picked up, 0.05% of them were legendary, 0.2% were item level 63, etc.). It could also check the "loot rules" for each item as and when it gets picked up and log any rule hits if needed.
Yeah, I could see that making for interesting data, but writing that kind of stat-tracking plugin would take an awful lot of work and I simply don't have that kind of time right now. :)

In other news, I just tested the plugin out on .153 and it seems to work there as well.
 
It still seems to work for me using .151, I can't reproduce the problem.

I can't get it to run at all. Just deleted entire DB folder, redownloaded fresh latest version, ONLY installed your plugin and nothing else, and when trying to enable the plugin (regardless of which account or character I try, regardless of being in a game or on the "resume game" screen), I just get this;

Code:
[14:58:36.571 N] [ItemRuleExaminer 1.0] Enabled!
[14:58:36.571 D] Exception while enabling plugin ItemRuleExaminer 1.0: System.NullReferenceException: Object reference not set to an instance of an object.
   at ItemRuleExaminer.ItemRuleExaminer.DoUpdate() in j:\DB\Plugins\ItemRuleExaminer\ItemRuleExaminer.cs:line 116
   at ItemRuleExaminer.ItemRuleExaminer.OnEnabled() in j:\DB\Plugins\ItemRuleExaminer\ItemRuleExaminer.cs:line 205
   at Zeta.Common.Plugins.PluginContainer.set_Enabled(Boolean value)

It seems to be purely this;
Code:
			foreach (var item in ZetaDia.Actors.Me.Inventory.Backpack)
			{
				RuleMatchItem(item);
			}
			foreach (var item in ZetaDia.Actors.Me.Inventory.Equipped)
			{
				RuleMatchItem(item);
			}

I tried changing "ZetaDia.Actors.Me." to just "ZetaDia.Me." (both apparently are valid) but same errors. I tried removing the loops for backpack and equipped (I'm guessing the third thing, "ZetaDia.Actors.ACDList", can get items on the floor?), but while there's no errors, there's never any matches/any items ever appearing in the log (as if it's never finding anything at all, despite being enabled).

Any ideas on alternatives I could try rather than that for method, or any safeties you could add to catch exactly what error is occurring in the attempted foreach loop? Or why it's only me getting these errors? :( Would appreciate any help, this plugin's really useful (potentially) as I'm suspicious about how reliable the lootrules are in DB (they seem a bit buggy and I want to double-check my rules & items!).
 
Try adding
Code:
ZetaDia.Actors.Refresh();
before that code. I found that Me was null otherwise. The OnPulse doesn't seem to work though so I had to disable/enable the plugin when I wanted it to run.
 
Try adding
Code:
ZetaDia.Actors.Refresh();
before that code. I found that Me was null otherwise. The OnPulse doesn't seem to work though so I had to disable/enable the plugin when I wanted it to run.

Hmm, "'Zeta.Internals.ActorManager' does not contain a definition for 'Refresh' and no extension method 'Refresh' accepting a first argument of type 'Zeta.Internals.ActorManager' could be found (are you missing a using directive or an assembly reference?)"

With your line exactly as it is. Not sure what's going on with mine :(
 
Alright, thanks to the more detailed crash logs I think I've nailed down what caused the problems. Try version 1.1 and see if that works better for you!
 
Alright, thanks to the more detailed crash logs I think I've nailed down what caused the problems. Try version 1.1 and see if that works better for you!

I appreciate the effort in trying to fix it... but while I don't get any errors now, I get no output either. Just;
"[02:40:45.055 N] [ItemRuleExaminer 1.1] Enabled!"

And no output (tried playing for a while, making loot drop off monsters, picking stuff up, etc.).

For whatever reasons, it seems that the plugin isn't being sent the info for ZetaDia.Actors (nothing in ZetaDia.Actors.ACDList, and NULL being returned for ZetaDia.Actors.Me.Inventory.Backpack/Inventory).

I'm at a complete loss as to why mine would be doing this, but not yours. Would you be able to try out a completely fresh install of the latest version of DB (start with a blank directory so no chance of old files), see if yours still works then?

If it does then I can only assume it's something different at the core of DB - ie relating to me being on Windows 7 64 bit, or the specific .net version I have :S No other plugins seem to cause any problems though (been botting successfully for ages!).
 
Back
Top