darkfriend77
Member
- Joined
- Jun 14, 2011
- Messages
- 467
- Reaction score
- 2
How to use "Item Rules 2" in Trinity
Item Rules 2 is included in Trinity Releases by default. Actual releases of Trinity and Item Rules 2 are found here LINK.
If you need more help i recommand to post in the orginal thread from Item Rules 2 LINK.
0. How is Item Rules 2 structured
The "Item Rules 2" structure looks like this ... more or less.
Demonbuddy/Plugins/GilesTrinity/
ItemRules
+- Core
+- Rules
....+- custom
....+- hard
........+- legendary.dis
........+- magic.dis
........+- rare.dis
........+- special.dis
........+- pickup.dis
....+- medium
........+- legendary.dis
........+- magic.dis
........+- rare.dis
........+- special.dis
........+- pickup.dis
....+- soft
........+- legendary.dis
........+- magic.dis
........+- rare.dis
........+- special.dis
........+- pickup.dis
1. How to setup Trinity & Item Rules 2
1.1 Setup Trinity
In Trinity you have to change the following marked setting to "File Based Script Rules".
1.2 Configuration Item Rules
its all in trinity now .. just check the tab ItemRules
1.3 Check Logs in Demonbuddy
If everything is configured right you should see at startup of demonbuddy similar logs.
2. When do the rules apply
The item drop event:
The item stash/trash event:
3. How do the rules work
A Item rule is structured in three parts. The first part is separated by a '#' sign from the second one and the third part which is optional is separated by a '->'.
'PART1' # 'PART2'
example: [QUALITY] == "Legendary" # True
or
'PART1' # 'PART2' -> 'PART3'
example: [QUALITY] == "Legendary" # True -> [KEEP]
PART1 is intended to hold values from an item that are already known before the item is identified. (exception: Legendary Names)
This qualifies following Attributes:
This qualifies following Attributes:
Rules must be writen by a one liner rules over multiple lines are not supported. The structure of the parts in it self isn't important.
[STR] > 10 is the same as 10 < [STR].
Example:
This rule will multiply attackspeed, critchance & critdmg an every rare item and if the result is bigger then 0 it will keep that item. This qualifies every item that has all three stats on it.
3.1 Actions
Following actions exist in Item Rules 2.
Actions for pickup rules: (pickups.dis)
3.2 Operators
3.3 Attributes
3.4 Values
ItemBaseType
3.5 Functions
.dual
converting into a binary value 0 and 1.
Example:
[VIT].dual (item with vitality 123) -> 1
[VIT].dual (item with vitality 0) -> 0
@OFFSTAT:=[AS%].dual+[CRIT%].dual+[CRITDMG%].dual
.max
returning a percentage of the max value possible on that item.
Example:
[VIT].max (gloves with 100 VIT, max is 200) -> 0.5
3.6. Macro
Macros can be used to reuse predefinated rules and logic. They have to be defined before they are used.
For example an implementation of EHP:
after this definition we can use [@EHP] as a existing attribute for everyitem.
4. FAQ
4.1 Use one rule folder for all my bots?
This solution helps to have all bots using the same rule set.
Copy your rule set with at least the rule strength type (soft,medium,hard,custom) you are using to a separate folder.
....+- hard
........+- legendary.dis
........+- magic.dis
........+- rare.dis
........+- special.dis
........+- pickup.dis
For example
Then change in config.dis the [RULEPATH] to this folder. From now then Item Rules will load rules from there.
4.2 If i have more then one rule matching an item which will be priorized?
Item Rules 2 engine works from top to bottom of the rule files and as soon it has a matching rule it does that action. So only the frist matching rule counts.
Item Rules 2 is included in Trinity Releases by default. Actual releases of Trinity and Item Rules 2 are found here LINK.
If you need more help i recommand to post in the orginal thread from Item Rules 2 LINK.
0. How is Item Rules 2 structured
1. How to setup Trinity & Item Rules 2
1.1 Setup Trinity
1.2 Configuration Item Rules
1.3 Check Logs in Demonbuddy
2. When do the rules apply
3. How do the rules work
3.1 Actions
3.2 Operators
3.3 Attributes
3.4 Values
3.5 Functions
3.6. Macro
4. FAQ
4.1 Use one rule folder for all my bots?
4.2 If i have more then one rule matching an item which will be priorized?
0. How is Item Rules 2 structured
The "Item Rules 2" structure looks like this ... more or less.
Demonbuddy/Plugins/GilesTrinity/
ItemRules
+- Core
+- Rules
....+- custom
....+- hard
........+- legendary.dis
........+- magic.dis
........+- rare.dis
........+- special.dis
........+- pickup.dis
....+- medium
........+- legendary.dis
........+- magic.dis
........+- rare.dis
........+- special.dis
........+- pickup.dis
....+- soft
........+- legendary.dis
........+- magic.dis
........+- rare.dis
........+- special.dis
........+- pickup.dis
1. How to setup Trinity & Item Rules 2
1.1 Setup Trinity
In Trinity you have to change the following marked setting to "File Based Script Rules".

1.2 Configuration Item Rules
its all in trinity now .. just check the tab ItemRules
1.3 Check Logs in Demonbuddy
If everything is configured right you should see at startup of demonbuddy similar logs.
2. When do the rules apply
The item drop event:
Code:
+-------------------------+
| EVENT |
| Item Drop |
| FileBasedScriptingRules |
+-----------+-------------+
|
V
+--------------+
| pickup.dis +--> <matching rule>
+------+-------+ |
| +-> PICKUP
V +-> IGNORE
<no matching rule>
|
|
|
V
+--------+---------+
| trinity setting |
| decide if item |
| pickup |
+------------------+
The item stash/trash event:
Code:
+-------------------------+
| EVENT |
| Item Stash\Trash |
| FileBasedScriptingRules |
+-----------+-------------+
|
V
+--------------+
| legendary.dis|
| rare.dis +--> <matching rule>
| magic.dis | |
| special.dis | +-> KEEP
+------+-------+ +-> TRASH
| |
V V
<no matching rule> SCORE
| |
|<-----------------+
|
V
+------------------+
| trinity scoring |
| decide if item |
| stashed/trashed |
+------------------+
3. How do the rules work
A Item rule is structured in three parts. The first part is separated by a '#' sign from the second one and the third part which is optional is separated by a '->'.
'PART1' # 'PART2'
example: [QUALITY] == "Legendary" # True
or
'PART1' # 'PART2' -> 'PART3'
example: [QUALITY] == "Legendary" # True -> [KEEP]
PART1 is intended to hold values from an item that are already known before the item is identified. (exception: Legendary Names)
This qualifies following Attributes:
- [NAME] (exception legenderys)
- [BASETYPE]
- [TYPE]
- [ONEHAND]
- [TWOHAND]
- [QUALITY]
- [LEVEL]
This qualifies following Attributes:
- [STR]
- [CRIT%]
- ...
Rules must be writen by a one liner rules over multiple lines are not supported. The structure of the parts in it self isn't important.
[STR] > 10 is the same as 10 < [STR].
Example:
Code:
[QUALITY] == "Rare" # ([AS%] * [CRIT%] * [CRITDMG%]) > 0 -> [KEEP]
This rule will multiply attackspeed, critchance & critdmg an every rare item and if the result is bigger then 0 it will keep that item. This qualifies every item that has all three stats on it.
3.1 Actions
Following actions exist in Item Rules 2.
Actions for pickup rules: (pickups.dis)
- [PICKUP] pickup item
- [IGNORE] ignore item
- [KEEP] keep item
- [TRASH] trash item
- [SCORE] use score to evaluate item
3.2 Operators
Code:
AND "&&" true && false -> false
OR "||" true || false -> true
EQUAL "==" 10 == 11 -> false
NOTEQUAL "!=" 10 != 11 -> true
LESSEREQUAL "<=" 10 <= 10 -> true
BIGGEREQUAL ">=" 10 >= 10 -> true
LESSTHEN "<" 10 < 10 -> false
BIGGERTHEN ">" 10 > 10 -> false
BRACKETS "()" (5+5)*2 == 5+(5*2) -> false
PLUS/MINUS "+-" 1 + 2 -> 3
MULT/DIV "*/" 1 * 2 -> 2
3.3 Attributes
Code:
[BASETYPE] | YES | ItemBaseType | Weapon
[QUALITY] | YES | ItemQuality | Rare
[TYPE] | YES | ItemType | Axe
[LEVEL] | YES | Level | 60
[ONEHAND] | YES | OneHand | true
[TWOHAND] | YES | TwoHand | false
Code:
[STR] | Strength | 100
[DEX] | Dexterity | 100
[INT] | Intelligence | 100
[VIT] | Vitality | 100
Code:
[REGEN] | HealthPerSecond | 254
[LIFE%] | LifePercent | 12
[LS%] | LifeSteal | 3
[LOH] | LifeOnHit | 655
[MS%] | MovementSpeed | 12
[AS%] | AttackSpeedPercent | 6
Code:
[CRIT%] | CritPercent | 4.5
[CRITDMG%] | CritDamagePercent | 59
[BLOCK%] | BlockChance | 8
Code:
[ALLRES] | ResistAll | 80
[RESPHYSICAL] | ResistPhysical | 60
[RESFIRE] | ResistFire | 60
[RESCOLD] | ResistCold | 60
[RESLIGHTNING] | ResistLightning | 60
[RESARCAN] | ResistArcane | 60
[RESPOISON] | ResistPoison | 60
[RESHOLY] | ResistHoly | 60
Code:
[ARMOR] | Armor | 345
[ARMORBONUS] | ArmorBonus | 200
[ARMORTOT] | ArmorTotal | 1300
Code:
[FIREDMG%] | FireDamagePercent | 3
[LIGHTNINGDMG%] | LightningDamagePercent | 3
[COLDDMG%] | ColdDamagePercent | 3
[POISONDMG%] | PoisonDamagePercent | 3
[ARCANEDMG%] | ArcaneDamagePercent | 3
[HOLYDMG%] | HolyDamagePercent | 3
Code:
[DPS] | WeaponDamagePerSecond | 1100
[WEAPAS] | WeaponAttacksPerSecond | 1.5
[WEAPMAXDMG] | WeaponMaxDamage | 560
[WEAPMINDMG] | WeaponMinDamage | 255
[WEAPDMGTYPE] | WeaponDamageType | Fire
[MINDMG] | MinDamage | 100
[MAXDMG] | MaxDamage | 200
Code:
[THORNS] | Thorns | 2345
[DMGREDPHYSICAL] | DamageReductionPhysicalPerc.| 2
Code:
[MAXARCPOWER] | MaxArcanePower | 15
[ARCONCRIT] | ArcaneOnCrit | 10
[MAXMANA] | MaxMana | 5
[MANAREG] | ManaRegen | 5
[MAXFURY] | MaxFury | 5
[HEALTHSPIRIT] | HealthPerSpiritSpent | 245
[MAXSPIRIT] | MaxSpirit | 10
[SPIRITREG] | SpiritRegen | 5
[HATREDREG] | HatredRegen | 5
[MAXDISCIP] | MaxDiscipline | 5
Code:
[GF%] | GoldFind | 25
[MF%] | MagicFind | 20
[PICKRAD] | PickUpRadius | 5
[GLOBEBONUS] | HealthGlobeBonus | 5468
[SOCKETS] | Sockets | 1
Code:
[MAXSTAT] | highest class specific stat | 200
| (str,int,dex) |
[MAXSTATVIT] | highest class specific stat | 250
| (str,int,dex) + vit |
[MAXONERES] | highest single resist | 60
| (arcane,cold,fire,holy, |
| lightning,physical,poison) |
[TOTRES] | total resistance | 140
| (allres,arcane,cold,fire,holy,
| lightning,physical,poison) |
[DMGFACTOR] | dmg factor | 12
| = as% + crit%*2 + critdmg%/5|
| + average/20 |
[STRVIT],[DEXVIT],[INTVIT] | primary attribut vitality | 200
[AVGDMG] | average dmg | 200
| = (mindmg + maxdmg) / 2 |
[OFFSTATS] | offensiv stats | 3
| = as%,crit%,critdmg%,avgdmg |
| counting each as one if it is
| bigger then 0 |
[DEFSTATS] | defensiv stats | 3
| = vit,allres,armorbonus, |
| block%,life%,regen |
| counting each as one if it is
| bigger then 0 |
3.4 Values
ItemBaseType
- Armor
- Weapon
- Jewelry
- Misc
- Axe
- Sword
- Mace
- Dagger
- Bow
- Crossbow
- Staff
- Spear
- Shield
- Gloves
- Boots
- Chest
- Ring
- Amulet
- Quiver
- Shoulder
- Legs
- FistWeapon
- Mojo
- CeremonialDagger
- WizardHat
- Helm
- Belt
- Bracer
- Orb
- MightyWeapon
- MightyBelt
- Polearm
- Cloak
- Wand
- SpiritStone
- Daibo
- HandCrossbow
- VoodooMask
- FollowerSpecial
- CraftingPlan
- Inferior
- Normal
- Superior
- Rare
- Magic
- Legendary
- Special
- Rare4 (only for craftingPlan)
- Rare5 (only for craftingPlan)
- Rare6 (only for craftingPlan)
3.5 Functions
.dual
converting into a binary value 0 and 1.
Example:
[VIT].dual (item with vitality 123) -> 1
[VIT].dual (item with vitality 0) -> 0
@OFFSTAT:=[AS%].dual+[CRIT%].dual+[CRITDMG%].dual
.max
returning a percentage of the max value possible on that item.
Example:
[VIT].max (gloves with 100 VIT, max is 200) -> 0.5
3.6. Macro
Macros can be used to reuse predefinated rules and logic. They have to be defined before they are used.
For example an implementation of EHP:
Code:
@EHP := ((1000+[VIT])*(1+[LIFE%]/100)*35)/(1-(1-(1-([ARMORBONUS]/((50*63)+[ARMORBONUS])))*(1-(([ALLRES]+[MAXONERES]/7)/((5*63)+([ARMORTOT]/((50*63)+[ARMORTOT])))))))
after this definition we can use [@EHP] as a existing attribute for everyitem.
Code:
[QUALITY] == "Rare" && [BASETYPE] == "Armor" # [@EHP] > 60000
4. FAQ
4.1 Use one rule folder for all my bots?
This solution helps to have all bots using the same rule set.
Copy your rule set with at least the rule strength type (soft,medium,hard,custom) you are using to a separate folder.
....+- hard
........+- legendary.dis
........+- magic.dis
........+- rare.dis
........+- special.dis
........+- pickup.dis
For example
C:\DBItemRules\
Then change in config.dis the [RULEPATH] to this folder. From now then Item Rules will load rules from there.
[RULEPATH] == C:\DBItemRules\
4.2 If i have more then one rule matching an item which will be priorized?
Item Rules 2 engine works from top to bottom of the rule files and as soon it has a matching rule it does that action. So only the frist matching rule counts.
CONTACT:
skype: darkfriend77
email: [email protected]
PM demonbuddypage: darkfriend77
Donators:
get access to private repository
get access to beta development
get access to private tools
get access to new rule sets
skype: darkfriend77
email: [email protected]
PM demonbuddypage: darkfriend77

Donators:
get access to private repository
get access to beta development
get access to private tools
get access to new rule sets

Attachments
Last edited: