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

[Plugin Addon] "Item Rules" with a file based scripting language

For something like [STAT_COMBO] or [STAT_SUM] or whatever we want to call it, would this work?

return Compare((Math.Max(item.Stats.Strength, Math.Max(item.Stats.Dexterity, item.Stats.Intelligence))) + item.Stats.Vitality, comparator, Int32.Parse(str2));

Basically you check which main stat is the highest, then add vitality on top to get a single total to see if an item has high enough stats. Most useful for armor pieces.

adding this one ..

"[CLASSMAXSTATVITA]"
return compare(new float[] { item.Stats.Strength, item.Stats.Intelligence, item.Stats.Dexterity }.Max() + item.Stats.Vitality, comparator, Int32.Parse(str2));
 
Code:
//___  ___  ____ __ _ ____ ____ ____ ____ __   ___    _  ___      
//|  \ |  \ | . \| V \|  _\| . \|___\| __\| \|\|  \   |/ | _\     
//| . \| . \|  <_|  <_| _\ |  <_| /  |  ]_|  \|| . \     [__ \    
//|___/|/\_/|/\_/|/\_/|/   |/\_/|/   |___/|/\_/|___/     |___/    
//____ ____ ____ _      ____ _    __   ____   ____ ____ ____ __   
//|___\|_ _\| __\|\/\   | . \|| \ | |  | __\  |_ _\|   ||   || |  
//| /    || |  ]_|   \  |  <_||_|\| |__|  ]_    || | . || . || |__
//|/     |/ |___/|/v\/  |/\_/|___/|___/|___/    |/ |___/|___/|___/
// this is a comment ... doesn't do anything.
// Version 01a
// by darkfriend 
// +----------------+
// | Test Selection |
// +----------------+

[BASETYPE] == Weapon # [CLASSMAXSTATVITA] > 300 && ([AS%] > 0 || [CRITDMG%] > 50) && [SOCKETS]  > 0 # [KEEP]

// ******************************************************
// * Structure	                                        *
// ******************************************************
// only use one line per rule
//
// '#' sign divides the rule in to 3 parts
// 1 # 2 # 3 example. [TYPE] == Legs # [STR] < 50 # [TRASH]
//
// part 1 =  [TYPE] == Legs
// the info available on unidentified items ...
//
// part 2 =  [STR] < 50
// the info available on identified items ...
//
// part 3 =  [TRASH]
// the action to do with the item on a positive rule outcome
//
// ******************************************************
// * Logical Operators                                  *
// ******************************************************
// and			"&&"
// or			"||"
// equal then		"=="
// not equal then	"!="
// less or equal then	"<="
// bigger or equal then	">="
// less then		"<"
// bigger then		">"
// u can use round brackets (blah || blah || blah
//
// ******************************************************
// * IMPLEMENETED ATTRIBUTES AND VALUES                 *
// ******************************************************
// ItemBaseType			[BASETYPE] 
// ItemQuality			[TYPE] 
// ItemType			[QUALITY] 
// Level			[LEVEL] 
// ------------------------------------------------------
// Strength			[STR] 
// Dexterity			[DEX] 
// Intelligence			[INT] 
// Vitality			[VIT] 
// ------------------------------------------------------
// HealthPerSecond		[REGEN] 
// LifePercent			[LIFE%] 
// LifeSteal			[LS%] 
// LifeOnHit			[LOH] 
// MovementSpeed		[MS%] 
// AttackSpeedPercent		[AS%] 
// ------------------------------------------------------
// CritPercent			[CRIT%] 
// CritDamagePercent		[CRITDMG%] 
// BlockChance			[BLOCK%] 
// ------------------------------------------------------
// ResistAll			[ALLRES] 
// ResistPhysical		[RESPHYSICAL] 
// ResistFire			[RESFIRE] 
// ResistCold			[RESCOLD] 
// ResistLightning		[RESLIGHTNING] 
// ResistArcane			[RESARCAN] 
// ResistPoison			[RESPOISON] 
// ResistHoly			[RESHOLY] 
// ------------------------------------------------------
// Armor			[ARMOR] 
// ArmorBonus			[ARMORBONUS] 
// ArmorTotal			[ARMORTOT] 
// ------------------------------------------------------
// FireDamagePercent		[FIREDMG%] 
// LightningDamagePercent	[LIGHTNINGDMG%] 
// ColdDamagePercent		[COLDDMG%] 
// PoisonDamagePercent		[POISONDMG%] 
// ArcaneDamagePercent		[ARCANEDMG%] 
// HolyDamagePercent		[HOLYDMG%] 
// ------------------------------------------------------
// WeaponDamagePerSecond	[DPS] 
// WeaponAttacksPerSecond	[WEAPAS] 
// WeaponMaxDamage		[WEAPMAXDMG] 
// WeaponMinDamage		[WEAPMINDMG] 
// MinDamage			[MINDMG] 
// MaxDamage			[MAXDMG] 
// ------------------------------------------------------
// Thorns			[THORNS] 
// DamageReductionPhysicalPerc.	[DMGREDPHYSICAL] 
// ------------------------------------------------------
// MaxArcanePower		[MAXARCPOWER] 
// ArcaneOnCrit			[ARCONCRIT] 
// MaxMana			[MAXMANA] 
// ManaRegen			[MANAREG] 
// MaxFury			[MAXFURY] 
// HealthPerSpiritSpent		[HEALTHSPIRIT] 
// MaxSpirit			[MAXSPIRIT] 
// SpiritRegen			[SPIRITREG] 
// HatredRegen			[HATREDREG] 
// MaxDiscipline		[MAXDISCIP] 
// ------------------------------------------------------
// GoldFind			[GF%] 
// MagicFind			[MF%] 
// PickUpRadius			[PICKUP] 
// HealthGlobeBonus		[GLOBEBONUS] 
// ------------------------------------------------------
// Sockets			[SOCKETS] 
// ------------------------------------------------------
// highest class specific stat (str,int,dex)
// 				[CLASSMAXSTAT]
// highest class specific stat (str,int,dex) + vit
// 				[CLASSMAXSTATVITA]
// ------------------------------------------------------
// 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
//
// ItemBaseType
// ------------
// Armor,Weapon,Jewelry,Misc,Gem
//
// ItemQuality
// -----------
// Inferior,Normal,Superior,Magic1,Magic2,Magic3
// Rare4,Rare5,Rare6,Legendary,Special
 
Don't know if this is a coincidence, but my antivirus flagged a file named "setup.exe", a couple seconds after downloading, in the same folder as to where I downloaded this file.
 
Don't know if this is a coincidence, but my antivirus flagged a file named "setup.exe", a couple seconds after downloading, in the same folder as to where I downloaded this file.

in the provided zip file ... are only *.cs c-sharp source files and a item.dis specification which is a txt based file ... there isn't any exe file ...
 
do we need to replace trinity files .cs and .xaml?
Two-hand / One-hand classification please? Should be simple like:
[BASETYPE] == Weapon1H # blahblahblah
[BASETYPE] == Weapon2H # blahblahblah

or smt like that
 
Last edited:
Thanks for going through the trouble to post up this info! I'm no coding expert by any definition (the most experience I had was years ago doing HTML and then a few years after that doing basic scripts for Neverwinter Nights 2 :P) So I appreciate that you've gotten the more difficult aspects of the coding and managed it down into a syntax that's much easier to understand and configure!

I'm definitely going to be reading up on this and following it's progression, great job!
 
Code:
//Legendary
[QUALITY] == Legendary # [KEEP]

//Weapons One handed
[BASETYPE] == Weapon && [HAND] == one # [DPS] >= 799 && [CRITDMG%] >= 50 && [SOCKETS] > 0 && ([LOH] >= 700 || [LS%] > 0) # [KEEP]
[BASETYPE] == Weapon && [HAND] == one # [DPS] >= 799 && [CRITDMG%] >= 80 && [SOCKETS] > 0 # [KEEP]
//Weapons Two handed
[BASETYPE] == Weapon && [HAND] == two # [DPS] >= 1200 && [CRITDMG%] >= 170 && [SOCKETS] > 0 # [KEEP]
[BASETYPE] == Weapon && [HAND] == two # [DPS] >= 1100 && [CRITDMG%] >= 130 && [SOCKETS] > 0 && ([LOH] >= 700 || [LS%] > 0) # [KEEP]

//Gloves
[TYPE] == Gloves # [DEX] >= 200 && ([CRITDMG%] > 0 || [AS%] > 0 || [CRIT%] > 0) && [ALLRES] >= 60 && [VIT] >= 60 # [KEEP]
[TYPE] == Gloves # [INT] >= 200 && ([CRITDMG%] > 0 || [AS%] > 0 || [CRIT%] > 0) && [ALLRES] >= 60 && [VIT] >= 60 # [KEEP]
[TYPE] == Gloves # [CLASSMAXSTAT] >= 100 && [CRITDMG%] > 0 && [CRIT%] > 0 && [ALLRES] >= 40 # [KEEP]
[TYPE] == Gloves # [CLASSMAXSTAT] >= 100 && [CRITDMG%] > 0 && [CRIT%] > 0 && [AS%] > 0 # [KEEP]
[TYPE] == Gloves # [CLASSMAXSTAT] >= 100 && [CRITDMG%] > 0 && [AS%] > 0 && [ALLRES] >= 40 # [KEEP]
[TYPE] == Gloves # [CLASSMAXSTAT] >= 150 && ([CRITDMG%] > 0 || [AS%] > 0 || [CRIT%] > 0) && [ALLRES] >= 60 && [VIT] >= 60 # [KEEP]

//Boots
[TYPE] == Boots # [DEX] >= 240 && [MS%] >= 10 && [VIT] >= 60 && [ALLRES] >= 60 # [KEEP]
[TYPE] == Boots # [CLASSMAXSTAT] >= 150 && [MS%] >= 10 && [VIT] >= 60 && [ALLRES] >= 60 # [KEEP]

//Chests
[TYPE] == Chest # [CLASSMAXSTAT] >= 150 && [SOCKETS] >= 2 && [VIT] >= 60 && [ALLRES] >= 60 # [KEEP]
[TYPE] == Chest # [CLASSMAXSTAT] >= 200 && [VIT] >= 150 && [ALLRES] >= 60 # [KEEP]
[TYPE] == Chest # [CLASSMAXSTAT] >= 200 && [VIT] >= 60 && [ALLRES] >= 60 && [LIFE%] >= 9 # [KEEP]

//Rings
[TYPE] == Ring # [CLASSMAXSTAT] >= 60 && [VIT] >= 60 && [ALLRES] >= 40 && [LIFE%] >= 9 # [KEEP]
[TYPE] == Ring # [CLASSMAXSTAT] >= 60 && ([CRITDMG%] > 0 || [AS%] > 0 || [CRIT%] > 0) && [ALLRES] >= 40 && [VIT] >= 60 # [KEEP]
[TYPE] == Ring # [CLASSMAXSTAT] >= 60 && ([CRITDMG%] > 0 || [AS%] > 0 || [CRIT%] > 0) && [ALLRES] >= 40 && [LOH] >= 250 # [KEEP]

//Amulet
[TYPE] == Amulet # [CLASSMAXSTAT] >= 100 && ([CRITDMG%] > 0 || [AS%] > 0 || [CRIT%] > 0) && [ALLRES] >= 40 && [LOH] >= 250 # [KEEP]
[TYPE] == Amulet # [CLASSMAXSTAT] >= 100 && ([CRITDMG%] > 0 || [AS%] > 0 || [CRIT%] > 0) && [ALLRES] >= 40 && [VIT] >= 60 # [KEEP]
[TYPE] == Amulet # [CLASSMAXSTAT] >= 100 && [CRITDMG%] > 0 && [AS%] > 0 && [CRIT%] > 0 # [KEEP]

//Shoulders
[TYPE] == Shoulder # ([DEX] >= 150 || [STR] >= 200 || [INT] >= 150) && [VIT] >= 80 && [ALLRES] >= 60 # [KEEP]
[TYPE] == Shoulder # ([DEX] >= 150 || [STR] >= 200 || [INT] >= 150) && [LIFE%] >= 9 && [ALLRES] >= 60 # [KEEP]
 
//Pants
[TYPE] == Legs # [CLASSMAXSTAT] >= 150 && [SOCKETS] >= 1 && [VIT] >= 150 && [ALLRES] >= 60 # [KEEP]
[TYPE] == Legs # [CLASSMAXSTAT] >= 150 && [VIT] >= 200 && [ALLRES] >= 60 # [KEEP]

//Helms
[TYPE] == Helm # ([DEX] >= 150 || [STR] >= 150 || [INT] >= 200) && [SOCKETS] >= 1 && ([VIT] >= 60 || [LIFE%] >= 9) && [ALLRES] >= 60 # [KEEP]
[TYPE] == Helm # ([DEX] >= 120 || [STR] >= 120 || [INT] >= 160) && [SOCKETS] >= 1 && [CRIT%] > 0 # [KEEP]

//Belts
[TYPE] == Belt # ([DEX] >= 150 || [STR] >= 200 || [INT] >= 150) && ([VIT] >= 60 || [LIFE%] >= 9) && [ALLRES] >= 60 # [KEEP]

//Bracers
[TYPE] == Bracer # ([DEX] >= 150 || [STR] >= 150 || [INT] >= 150) && [CRIT%] >= 3 && [ALLRES] >= 60 # [KEEP]
[TYPE] == Bracer # ([DEX] >= 150 || [STR] >= 150 || [INT] >= 150) && [VIT] >= 60 && [ALLRES] >= 60 # [KEEP]


check please
 
Last edited:
do we need to replace trinity files .cs and .xaml?
Two-hand / One-hand classification please? Should be simple like:
[BASETYPE] == Weapon1H # blahblahblah
[BASETYPE] == Weapon2H # blahblahblah

or smt like that

t the moment its still necessary to use GilesTrinity.cs from my zip ...

changes i made to GilesTrinity.cs

- added orginal ACDItem to his GilesCachedACDItem Object to keep my code on the db standard functionality
- added a small if in his function shouldwestashitem() to add the ItemRuleSet


later i gona add loging in a file that lets u see what the rules do ... and i gona add 1h and 2h
 
do i need to set Giles Settings to from "use gildes filters and scoring" to "use custom loot rules" ?
 
TrinityCuston_v03a.zip
- added log flag set to true ... in the item.dis by default log willl be found in a separate log file
- added [HAND] ... = one for 1h and two for 2h

added next version ...
 
i added quite a few rules and am slightly confused by the log saying:
30102012200529: ### STARTING A NEW SESSION WITH ITEMRULESET ###
30102012200529: [LOG]=True
30102012200529: 1:[BASETYPE] == Weapon && [HAND] == one # [DPS] > 800 && [CRITDMG%] > 50 && [SOCKETS] > 0 # [KEEP]
30102012200529: 2:[BASETYPE] == Armor # [CLASSMAXSTATVITA] > 100 && [ALLRES] > 50 && ([CRIT%] > 3 || [CRITDMG%] > 50 || [AS%] > 5) # [KEEP]
30102012200529: initialized 2 itemrulesets!
those 2 default lines are not even in the item.dis anymore ..
 
i added quite a few rules and am slightly confused by the log saying:

those 2 default lines are not even in the item.dis anymore ..

check out the item.dis in //plugins/gilestrinity/specification ... u need to restart demonbuddy to re-read the item rules ... this is set so at the moment to avoid reading the file on each item comparison ... i will change that maybee later
 
either the OR or the () aren't working correctly ... gona dig deeper ...

30102012200422: ### STARTING A NEW SESSION WITH ITEMRULESET ###
30102012200422: [LOG]=True
30102012200422: 1:[BASETYPE] == Weapon && [HAND] == one # [DPS] > 800 && [CRITDMG%] > 50 && [SOCKETS] > 0 # [KEEP]
30102012200422: 2:[BASETYPE] == Armor # [CLASSMAXSTATVITA] > 100 && [ALLRES] > 50 && ([CRIT%] > 3 || [CRITDMG%] > 50 || [AS%] > 5) # [KEEP] seems not working as intended ...
30102012200422: initialized 2 itemrulesets!
30102012211537: KEEP: Horizon Apex,Rare4,Legs (63)
30102012211537: KEEP: Death Resolve,Rare4,Shield (61)
30102012214256: KEEP: Sergeant's Orbit,Rare5,Belt (61)
30102012220959: KEEP: Cleansing Mail,Rare5,Legs (63)
30102012220959: KEEP: Reflective Snare,Rare6,Gloves (62)
 
on the first view it seems a problem of tabs used in the item.dis ....just use space ...

I might not be thinking right, but you could do a replace all "\t" with " " to make sure noone else get the name problem, yes/no?
 
Back
Top