thebbandit
New Member
- Joined
- Jan 24, 2014
- Messages
- 91
- Reaction score
- 3
Hello!
I am editing the combat routine for my Barb, and wanted to add in a new function to Trinity that checks for piles of gold with unites in front of it. I want it to target gold during combat whenever there is more than 3 units in the surrounding area (5 feet) and use Furious Charge to pick up the gold and drag along all the mobs to the destination. As it is right now on default settings, the barb flies all over the place killing everything, and then it has to backtrack finding all the gold it passed by while it was dashing around using the furious charge.
So far I have made some alterations to a few files.
Modify the \cache\TrinityCacheObject.cs to add this line:
Added in this code to the TargetUtil:
Added to Combat\Abilities\BarbarianCombat.cs:
And added in unitsInFrontOfBestTargetGold >= 1 as the condition that it will fire.
I dont know what I am doing wrong :3

So far I have made some alterations to a few files.
Modify the \cache\TrinityCacheObject.cs to add this line:
Code:
public bool IsGold { get { return this.Type == GObjectType.Gold; } }
Added in this code to the TargetUtil:
Code:
internal static TrinityCacheObject GetBestPierceTargetGold(float maxRange, int arcDegrees = 0, bool ignoreUnitsInAoE = false)
{
var result =
(from u in ObjectCache
where u.IsGold &&
u.RadiusDistance <= maxRange &&
((ignoreUnitsInAoE && !u.IsStandingInAvoidance) || !ignoreUnitsInAoE)
orderby u.CountUnitsInFront() descending
select u).FirstOrDefault();
if (result != null)
return result;
if (CurrentTarget != null)
return CurrentTarget;
return GetBestClusterUnitGold(15f, maxRange, 1, true, !ignoreUnitsInAoE);
}
internal static TrinityCacheObject GetBestClusterUnitGold(float radius = 15f, float maxRange = 65f, int count = 1, bool useWeights = true, bool includeUnitsInAoe = true)
{
if (radius < 1f)
radius = 1f;
if (maxRange > 300f)
maxRange = 300f;
TrinityCacheObject bestClusterUnitGold;
var clusterUnitsGold =
(from u in ObjectCache
where u.IsGold &&
((useWeights && u.Weight > 0) || !useWeights) &&
(includeUnitsInAoe || !UnitOrPathInAoE(u)) &&
u.RadiusDistance <= maxRange
orderby u.NearbyUnitsWithinDistance(radius) descending,
u.Distance
select u).ToList();
if (clusterUnitsGold.Any())
bestClusterUnitGold = clusterUnitsGold.FirstOrDefault();
else if (Trinity.CurrentTarget != null)
bestClusterUnitGold = Trinity.CurrentTarget;
else
bestClusterUnitGold = default(TrinityCacheObject);
return bestClusterUnitGold;
}
Added to Combat\Abilities\BarbarianCombat.cs:
Code:
var bestTargetGold = TargetUtil.GetBestPierceTargetGold(20f);
int unitsInFrontOfBestTargetGold = 0;
if (bestTargetGold != null)
unitsInFrontOfBestTargetGold = bestTargetGold.CountUnitsInFront();
Code:
public static bool CanUseFuriousCharge
{
get
{
if (UseOOCBuff)
return false;
var bestTarget = TargetUtil.GetBestPierceTarget(20f);
int unitsInFrontOfBestTarget = 0;
var bestTargetGold = TargetUtil.GetBestPierceTargetGold(20f);
int unitsInFrontOfBestTargetGold = 0;
if (bestTarget != null)
unitsInFrontOfBestTarget = bestTarget.CountUnitsInFront();
if (bestTargetGold != null)
unitsInFrontOfBestTargetGold = bestTargetGold.CountUnitsInFront();
//CurrentTarget.RadiusDistance >= 7f &&
bool currentEliteTargetInRange = CurrentTarget.IsBossOrEliteRareUnique && CurrentTarget.RadiusDistance <= 20f;
return CanCast(SNOPower.Barbarian_FuriousCharge, CanCastFlags.NoTimer) && //!IsCurrentlyAvoiding &&
(unitsInFrontOfBestTargetGold >= 1 || CurrentTarget.IsTreasureGoblin || currentEliteTargetInRange || unitsInFrontOfBestTarget >= 3 || Sets.TheLegacyOfRaekor.IsThirdBonusActive);
}
}
And added in unitsInFrontOfBestTargetGold >= 1 as the condition that it will fire.
I dont know what I am doing wrong :3