• Visit Rebornbuddy
  • [GUIDE] How to use "Item Rules 2" in Trinity

    Discussion in 'Trinity' started by darkfriend77, Jan 6, 2013.

    1. darkfriend77

      darkfriend77 Member

      Joined:
      Jun 14, 2011
      Messages:
      467
      Likes Received:
      2
      Trophy Points:
      18
      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".

      [​IMG]

      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.

      [​IMG]





      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]
      PART2 is intended to hold values from an item that are only known after the item is identified.
      This qualifies following Attributes:
      • [STR]
      • [CRIT%]
      • ...
      PART3 is intended to hold the action that is done when the rule has a positive outcome. It is optional because the default action is [KEEP].
      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
      Actions for stashing rules: (legendary.dis,rare.dis,magic.dis,special.dis)
      • [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
      ItemType:
      • 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
      ItemQuality
      • 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
      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.

      CONTACT:
      skype: darkfriend77
      email: darkfriend@swissonline.ch
      PM demonbuddypage: darkfriend77


      [​IMG]

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

      [​IMG]
       

      Attached Files:

      Last edited: Apr 30, 2013
    2. Thelifeguard

      Thelifeguard New Member

      Joined:
      Dec 1, 2012
      Messages:
      98
      Likes Received:
      0
      Trophy Points:
      0
      Holy crap. Great guide.
       
    3. Ziago

      Ziago New Member

      Joined:
      Oct 8, 2010
      Messages:
      29
      Likes Received:
      0
      Trophy Points:
      0
      Great guide and great work, i'm trying it now. I really want that "AnotherLogViewer", but i don't know where to get it, searched for it on forums and google but with 0 results....
      can you tell me where to find it?
      Thanks a lot
       
    4. adessis

      adessis New Member

      Joined:
      Jun 14, 2012
      Messages:
      122
      Likes Received:
      0
      Trophy Points:
      0
      Thanks, awesome guide.
       
    5. leehun00

      leehun00 Member

      Joined:
      Jan 15, 2010
      Messages:
      101
      Likes Received:
      0
      Trophy Points:
      16
      great!!
       
    6. sparani

      sparani New Member

      Joined:
      Oct 24, 2010
      Messages:
      123
      Likes Received:
      1
      Trophy Points:
      0
      hi,

      can some1 tell me pls where the difference between these 2 rules is:

      Code:
      // keep all Weapon for now
      //[QUALITY] == "Legendary" && [BASETYPE] == "Weapon"
      Code:
      [QUALITY] == "Legendary" && [NAME] == "The Butcher's Sickle"
      can i assume (IF i remve the "//" in the 1st one) it will be the same because every legendary is listed in the file legendary.dis anyway?
      or will only the 1st one keep all legendaries?

      besides: ain't there missing something like -> [KEEP] at the end anyway? im a lil confused here!

      thx4hlp :)

      edit:
      ok, the last thing is clear now:
      so, just to be sure i can add [QUALITY] == "Legendary" && [BASETYPE] == "Weapon" (respectively just remove the //) to be sure every legendary is being kept?



      edit2:
      strange, my DB is just saying:
      Code:
      [17:03:54.097 N] [Trinity]PICKLOG 3 
      [17:03:54.097 N] [Trinity]KEEPLOG 3 
      [17:03:54.097 N] [Trinity]reading ... pickup.dis 
      [17:03:54.097 N] [Trinity] ... loaded: 12 pickup rules
      [17:03:54.097 N] [Trinity] ... loaded: 0 item soft rules
      [17:03:54.097 N] [Trinity] ... loaded: 0 macros
      but i changed the path in the config.dis...

      -> edit4: ok i need to change the path in the DB settings to the config.dis as well, i see ;D
       
      Last edited: Jan 22, 2013
    7. zarkein

      zarkein New Member

      Joined:
      Jan 14, 2013
      Messages:
      48
      Likes Received:
      0
      Trophy Points:
      0
      Hi Darkfriend, is there a Donator version where I can get even harder rules made for someoen with many bots?

      Thanks a lot,

      Zk
       
    8. pindleskin

      pindleskin Community Developer

      Joined:
      Oct 24, 2012
      Messages:
      1,124
      Likes Received:
      2
      Trophy Points:
      38
      what does trash do? sell or salvage?

      I looked at the hard rules.

      Skull Grasp shouldn't have any rules -> can have 4 weapon throw and str and is worth millions... possible other variations...
       
    9. amaraim

      amaraim New Member

      Joined:
      Feb 3, 2013
      Messages:
      9
      Likes Received:
      0
      Trophy Points:
      0
      How do I choose what specific items types to pick up? ( IE which rares to pick up, such as pants, bracers etc, because I wish to not pick up voodoo masks etc).

      I am new to the forums, so please PM me if you've answered >_<
       
    10. AngelsHalo

      AngelsHalo New Member

      Joined:
      Jun 13, 2012
      Messages:
      536
      Likes Received:
      1
      Trophy Points:
      0
      How do you keep legendary items unidentified, can't find a code to do it? Thanks!
       
    11. ssslidesss

      ssslidesss New Member

      Joined:
      Feb 8, 2013
      Messages:
      26
      Likes Received:
      0
      Trophy Points:
      0
      whats the link where we can get the log in key?
       
    12. antonio200184

      antonio200184 New Member

      Joined:
      Nov 13, 2012
      Messages:
      5
      Likes Received:
      0
      Trophy Points:
      0
      Where do i can get Anotherlogviewer ?
       
    13. aaron913

      aaron913 New Member

      Joined:
      Dec 8, 2011
      Messages:
      453
      Likes Received:
      1
      Trophy Points:
      0
      donate to darkfriend i beleive - at least thats where i got it :p - awesome app to fix some rules that might trash some valuable items
       
    14. devianse

      devianse New Member

      Joined:
      Sep 15, 2012
      Messages:
      103
      Likes Received:
      0
      Trophy Points:
      0
      hello, guys, i have some problem with this item rules (with legendaries rulesets). First of all, I wanna apologize for my bad english
      With normal itemrules, db "thinks", that all legendaries are trash (dunno why). When i change these rules completely, the operation,that db is doing with an item is (NULL) (should be trash or keep i think), then instantly (autokeep legendaries) . I think problem can be in my diablo version - its Rus. So, may be, some problems with translation, dunno rly :(. Can u help me?
       
    15. Beetlebomb

      Beetlebomb New Member

      Joined:
      Jan 1, 2011
      Messages:
      131
      Likes Received:
      0
      Trophy Points:
      0
      I don't have the config.dis file in the Rules folder. I checked the most recent trinity build and it's still not there. Where do I go to set which item rules to use?

      I'm new to this so I apologize if the answer is right in my face. I've been looking.

      --Beetle
       
    16. Thric3

      Thric3 New Member

      Joined:
      Oct 23, 2012
      Messages:
      70
      Likes Received:
      0
      Trophy Points:
      0
      Can someone give me an example of using the [TWOHAND] or [ONEHAND] tags?

      I'm attempting to get it to ignore all 2h rares, with the following code
      Code:
      [QUALITY] == "Rare" || "Rare4" && [TWOHAND] == "YES" -> [IGNORE]
      
       
    17. Snargle

      Snargle New Member

      Joined:
      Sep 6, 2013
      Messages:
      1
      Likes Received:
      0
      Trophy Points:
      0
      Hi, I'm new to this, and it seems you all know something I don't. How do I edit the item rules, can I open the .dis files and edit directly? I would like to be able to modify the rules as I see fit depending on my needs.

      Any guidance here would be DOPE!

      thanks

      first post :D
       
    18. osbornx22

      osbornx22 New Member

      Joined:
      Feb 13, 2013
      Messages:
      24
      Likes Received:
      0
      Trophy Points:
      0
      [LIFE%] return 10
      life%.max ist 0,1
      result [LIFE%].max returns 10 / 0,1 = 100 :(

      maxItemStats.Add("MightyBeltFalse[LIFE%]", 0.12);
       
    19. Paisti

      Paisti New Member

      Joined:
      Sep 9, 2013
      Messages:
      10
      Likes Received:
      0
      Trophy Points:
      0
      Yes, you can eit .dis files directly. In my case it has become a never ending process. :)
       
    20. Kevin Spacey

      Kevin Spacey Community Developer

      Joined:
      Aug 31, 2013
      Messages:
      2,830
      Likes Received:
      11
      Trophy Points:
      38
      no DMG% to demons here...
       

    Share This Page