Maybe the problem its not ou me.groupid but as how it create the lists, since he locks on one target it seems its not renewing the list
why in some parts you use <TorCharacter> and in others <TorNPC> and <TorPlayer>?
public override void Dispose()
{
}
public override void Dispose()
{
Targeting.Cache();
}
public static TorCharacter hTank;
public static TorCharacter hTarget;
public static void Cache()
{
hTank = tankCandidate;
hTarget = healCandidate;
}
oh well i wish i could help more. But i lack the programing knowledge T.T
Plugins have the onpulse command public void OnPulse() which sounds like your pulse your looking for. Couldn't tell you if it's just plugin only. A lot of people have put their code in their plugins to run within there just bashing through it over and over.
Been reading through the default code, yours, and Pures. I did add buddy as a reference so I could see everything and yes companion was definitely torNPC so it was being called wrong. Some people reported other routines worked but I found reports of all of them breaking after 4.0. I think it's not an issue with the Targeting however a core bot issue I am suspecting otherwise all of them wouldn't be a bust as of 4.0
I think it's one of 2 things, either the Lists aren't updating or the health checks aren't kicking right or a combination of the 2.
I haven't tried this but you might, under Spell.cs and under the heal spells this should work.
In the different Spell functions eg.
public static Composite Heal(string spell, int hp = 100, Selection<bool> reqs = null)
add a log line above the return so it can run
Logger.Write(Targeting.HealTarget.HealthPercent.To String()); <--- not completely sure that's right since it's a float to a string might have to create a string first, then fill string, then log write.
public static string SpellCast = "";
SpellCast = Targeting.HealTarget.HealthPercent.ToString();
Logger.Write(SpellCast);
This should push out to the log file the heal targets percentage, when healing non stop it would let you see if the percentage actually moves or not.
Here's what wired203 sent me this morning. I don't see any reason to keep it private, but if you want I'll take this down. I think it's helpful for anyone to see, maybe they'll have a good idea too!
Sharing is good, but do note this would be for stock default combat and not the modified routine.
I put it in the Spell.Cast section-- would it not work there?
// Copyright (C) 2011-2015 Bossland GmbH
// See the file LICENSE for the source code's detailed license
using System.Collections.Generic;
using System.Linq;
using Buddy.BehaviorTree;
using Buddy.Common.Math;
using Buddy.Swtor;
using Buddy.Swtor.Objects;
using DefaultCombat.Helpers;
namespace DefaultCombat.Core
{
public static class Targeting
{
private static TorPlayer Me
{
get { return BuddyTor.Me; }
}
#region TestStuff
public static IEnumerable<TorCharacter> PartyMembers { get { return getPartyMembers(); } }
public static IEnumerable<TorCharacter> Tanks { get { return getTanks(); } }
public static int addCount(TorCharacter unit, float range)
{
var t = ObjectManager.GetObjects<TorCharacter>().Where(p => p != null
&& p.IsValidTarget()
&& p.InLineOfSight
&& p.Position.DistanceSqr(unit.Position) <= range * range
&& p.IsTargetable).ToList();
return t.Count();
}
public static int injuredfriendCount(TorCharacter unit, float range)
{
var t = PartyMembers.Where(p => p != null
&& p.InLineOfSight
&& p.HealthPercent <= 75
&& p.Position.DistanceSqr(unit.Position) <= range * range
&& p.IsFriendly).ToList();
return t.Count();
}
public static IEnumerable<TorCharacter> getPartyMembers()
{
if (Me.GroupId == 0)
{
var t = ObjectManager.GetObjects<TorCharacter>().Where(p => p != null && p.IsTargetable && p.Guid == Me.Companion.Guid).ToList();
t.Add(Me);
return t;
}
else
{
var t = ObjectManager.GetObjects<TorPlayer>().Where(p => p != null && p.IsTargetable && p.GroupId == Me.GroupId).ToList();
return t;
}
}
public static IEnumerable<TorCharacter> getTanks()
{
if (Me.GroupId == 0)
{
return ObjectManager.GetObjects<TorNpc>().Where(p => p != null && p.IsTargetable && p.Guid == Me.Companion.Guid);
}
if (Me.GroupId == 0 && Me.Companion == null)
{
return ObjectManager.GetObjects<TorPlayer>().Where(p => p != null && p.IsTargetable && p.Guid == Me.Guid);
}
else
{
var t = ObjectManager.GetObjects<TorPlayer>().Where(p => p != null && p.GroupId == Me.GroupId && p.IsTargetable && (p.Discipline == CharacterDiscipline.Defense
|| p.Discipline == CharacterDiscipline.Darkness
|| p.Discipline == CharacterDiscipline.Immortal
|| p.Discipline == CharacterDiscipline.KeneticCombat
|| p.Discipline == CharacterDiscipline.ShieldSpecialist
|| p.Discipline == CharacterDiscipline.ShieldTech)).ToList();
return t;
}
}
public static TorCharacter healCandidate
{
get
{
if (!Me.InCombat) return null;
var t = PartyMembers.Where(p => p != null
&& !p.IsDead
&& p.InLineOfSight
&& p.Distance <= 30).OrderBy(p => p.HealthPercent).FirstOrDefault();
return t != null ? t : null;
}
}
public static TorCharacter tankCandidate
{
get
{
if (!Me.InCombat) return null;
var t = Tanks.Where(p => p != null
&& !p.IsDead
&& p.InLineOfSight
&& p.Distance <= 30).OrderBy(p => p.HealthPercent).FirstOrDefault();
return t != null ? t : null;
}
}
public static TorCharacter hTank;
public static TorCharacter hTarget;
public static int adds;
public static int aoeheal;
public static void Cache()
{
hTank = tankCandidate;
hTarget = healCandidate;
adds = addCount(Me.CurrentTarget, Distance.MeleeAoE);
aoeheal = injuredfriendCount(hTarget, Distance.MeleeAoE);
}
public static Composite ScanTargets
{
get
{
return new Action(delegate
{
using (BuddyTor.Memory.AcquireFrame())
{
hTank = null;
hTarget = null;
adds = 0;
aoeheal = 0;
getTanks();
getPartyMembers();
aoeheal++;
adds++;
return RunStatus.Failure;
}
});
}
}
#endregion
}
}