本文整理汇总了C#中WoWUnit.Target方法的典型用法代码示例。如果您正苦于以下问题:C# WoWUnit.Target方法的具体用法?C# WoWUnit.Target怎么用?C# WoWUnit.Target使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WoWUnit
的用法示例。
在下文中一共展示了WoWUnit.Target方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetTarget
private void SetTarget( WoWUnit unit)
{
if (unit != null)
{
unit.Target();
while (IsGameStable() && ObjectManager.ObjectList.Contains(unit) && Me.CurrentTarget != unit)
{
Thread.Sleep(10);
}
}
}
示例2: ShouldAttack
// TODO: is more detailed config needed? Probably a difference may be set configurable
public bool ShouldAttack(WoWUnit pet)
{
if (PluginSettings.Instance.DoNotEngage)
{
Logger.WriteDebug("DoNotEngage is set - not engaging");
return false;
}
// if the pet is withing the range of desired zone
pet.Target();
int level = _petLua.GetTargetLevel();
string classification = _petLua.GetTargetClassification();
Logger.WriteDebug("Pet " + pet.Name + ", level=" + level + ", " + classification);
if( classification != "normal" && PluginSettings.Instance.IgnoreElites)
{
Logger.WriteDebug("Pet is " + classification + " and IgnoreElites is set. Ignoring.");
return false;
}
if (PluginSettings.Instance.AutoZoneChange)
{
if ((CurrentProfileLevel - 2 <= level && level <= CurrentProfileLevel + 2))
{ return true; }
else
{ Logger.WriteDebug(string.Format("WildPet {0} level {1}: not fit for expected zone range [{2}-{3}]", pet.Name, level, ValidLevel(CurrentProfileLevel - 2), ValidLevel(CurrentProfileLevel + 2))); }
}
int shiftedLevel = MyPets.Pet(0).Level + PluginSettings.ModeInfo.ZoneDiff;
shiftedLevel = ValidLevel(shiftedLevel);
if (shiftedLevel-2 <= level && level <= shiftedLevel+2 )
return true;
Logger.WriteDebug( string.Format("WildPet {0} level {1}: not fit for expected range about Pet1 level={2} + ZoneDiff={3}: [{4}-{5}]",
pet.Name, level, MyPets.Pet(0).Level, PluginSettings.ModeInfo.ZoneDiff, ValidLevel(shiftedLevel-2), ValidLevel(shiftedLevel+2 )));
int[] rangeProfile = GetRangeOfCurrentProfile();
if (rangeProfile.Length == 2 && rangeProfile[0] != 0 && rangeProfile[1] != 0)
{
if (rangeProfile[0] - 2 <= level && level <= rangeProfile[1] + 2)
{
Logger.Write(string.Format("WildPet {0} level {1}: fit for loaded profile range [{2}-{3}]", pet.Name, level, ValidLevel(rangeProfile[0] - 2), ValidLevel(rangeProfile[1] + 2)));
return true;
}
else
{
Logger.WriteDebug(string.Format("WildPet {0} level {1}: not fit for loaded profile range [{2}-{3}]", pet.Name, level, ValidLevel(rangeProfile[0] - 2), ValidLevel(rangeProfile[1] + 2)));
}
}
else
{
Logger.WriteDebug("No Range in current profile name: " + GetCurrentProfileName());
}
return false;
}
示例3: Tar
private void Tar(WoWUnit tar)
{
if (Styx.BotManager.Current.Name != "LazyRaider")
{
tar.Target();
}
}
示例4: Buff
/// <summary>
/// Buffs the specified unit with a spell. Optionally targeting the current target.
/// </summary>
/// <param name="spell">The name of the spell to buff.</param>
/// <param name="target">The unit to buff.</param>
/// <param name="targetLast">Whether or not we should re-target our old target after buffing the unit.</param>
public void Buff(string spell, WoWUnit target, bool targetLast)
{
var autoSelfCast = Lua.GetReturnVal<bool>("return GetCVar('autoSelfCast')", 0);
// don't target self if we got AutoSelfCast on, or if target isn't me
if (target != Me || target == Me && !autoSelfCast)
target.Target();
// Quick sleep to allow WoW to update us
Thread.Sleep(100);
Log("Buffing " + target.Name + " with " + spell);
this[spell].Cast();
if (targetLast && (target != Me && !autoSelfCast))
{
// Again... wait for WoW to update/cast
Thread.Sleep(100);
StyxWoW.Me.TargetLastTarget();
// Sheesh... so much waiting...
Thread.Sleep(100);
}
}
示例5: TargetUnit
protected void TargetUnit(WoWUnit unit)
{
BotPoi.Current = new BotPoi(unit, PoiType.Kill);
unit.Target();
}
示例6: Tar
private void Tar(WoWUnit tar)
{
if (Styx.BotManager.Current.Name != "LazyRaider")
{
tar.Target();
WoWMovement.ConstantFace(tar.Guid);
}
}
示例7: CastSafe
// ------------ Spell Functions
public static bool CastSafe(string spellName, WoWUnit Unit, bool wait)
{
bool SpellSuccess = false;
if (Me.IsCasting)
{
Logging.Write("Rarekiller Part Spells: I was already Casting");
return false;
}
if (!SpellManager.HasSpell(spellName))
{
Logging.Write("Rarekiller Part Spells: I don't have Spell {0}", spellName);
return false;
}
if (SpellManager.HasSpell(spellName) && !Me.IsCasting)
{
if (SpellManager.Spells[spellName].CastTime > 1)
WoWMovement.MoveStop();
Unit.Target();
Thread.Sleep(100);
Unit.Face();
Thread.Sleep(150);
while (SpellManager.GlobalCooldown)
{
Thread.Sleep(10);
}
if (!SpellManager.CanCast(spellName))
{
Logging.Write("Rarekiller Part Spells: cannot cast spell '{0}' yet - cd={1}, gcd={2}, casting={3} ",
SpellManager.Spells[spellName].Name,
SpellManager.Spells[spellName].Cooldown,
SpellManager.GlobalCooldown,
Me.IsCasting
);
return false;
}
SpellSuccess = SpellManager.Cast(spellName);
Thread.Sleep(200);
//if (SpellManager.GlobalCooldown || Me.IsCasting)
// SpellSuccess = true;
if (SpellSuccess)
Logging.Write("Rarekiller Part Spells: * {0}.", spellName);
if (wait)
{
while (SpellManager.GlobalCooldown || Me.IsCasting)
{
Thread.Sleep(100);
}
}
Logging.Write("Rarekiller Part Spells: Spell successfull? {0}.", SpellSuccess);
return SpellSuccess;
}
Logging.Write("Rarekiller Part Spells: Can't cast {0}.", spellName);
return false;
}
示例8: Tar
private void Tar(WoWUnit tar)
{
if (Manual)
{
tar.Target();
WoWMovement.ConstantFace(tar.Guid);
}
}
示例9: Routine
public static void Routine(WoWUnit _unit)
{
while (_unit != null && _unit.IsAlive && !StyxWoW.Me.IsSwimming && _unit.Distance <= CharacterSettings.Instance.PullDistance && !StyxWoW.Me.Mounted)
{
WoWSpell AutoAtack = WoWSpell.FromId(6603);
#region PALDIN
if (StyxWoW.Me.Class == WoWClass.Paladin)
{
TreeRoot.StatusText = "CritterKillSquad: slay node ...";
WoWUnit AOEunit = BotCKS.getNode(_unit, 9, 2);
WoWSpell Weihe = WoWSpell.FromId(26573);
WoWSpell HammerDR = WoWSpell.FromId(53595);
WoWSpell HZorn = WoWSpell.FromId(2812);
WoWSpell KStoß = WoWSpell.FromId(35395);
WoWSpell GSturm = WoWSpell.FromId(53385);
WoWSpell SiegelDW = WoWSpell.FromId(31801);
WoWSpell Richturteil = WoWSpell.FromId(20271);
// need buff?
if (SpellManager.HasSpell(SiegelDW.Id) && !StyxWoW.Me.HasAura(SiegelDW.Name) && !Styx.StyxWoW.GlobalCooldown)
{
TreeRoot.StatusText = "CritterKillSquad: need buff " + SiegelDW.Name + " ...";
BotCKS.slog("need buff " + SiegelDW.Name);
SiegelDW.Cast();
Thread.Sleep(BotCKS.ran.Next(400, 800));
}
if (AOEunit != null)
{
if (AOEunit.Distance >= 3)
{
MoveToNode(AOEunit, 3);
}
TreeRoot.StatusText = "CritterKillSquad: search for best " + Weihe.Name + " point ...";
if (SpellManager.HasSpell(GSturm) && !GSturm.Cooldown && !Styx.StyxWoW.GlobalCooldown && StyxWoW.Me.HolyPowerPercent > 0)
{
TreeRoot.StatusText = "CritterKillSquad: cast " + GSturm.Name + " on ≈ " + BotCKS.AOEcount + " " + AOEunit.Name;
BotCKS.slog("Cast " + GSturm.Name + " on ≈ " + BotCKS.AOEcount + " " + AOEunit.Name);
GSturm.Cast();
}
else if (SpellManager.HasSpell(HammerDR) && !HammerDR.Cooldown && !Styx.StyxWoW.GlobalCooldown)
{
if (AOEunit.Distance >= 3)
MoveToNode(AOEunit, 3);
if (!StyxWoW.Me.GotTarget || !StyxWoW.Me.CurrentTarget.IsAlive || StyxWoW.Me.CurrentTarget != AOEunit)
{
TreeRoot.StatusText = "CritterKillSquad: face " + AOEunit.Name + " ...";
AOEunit.Target();
AOEunit.Face();
Thread.Sleep(BotCKS.ran.Next(200, 500));
}
TreeRoot.StatusText = "CritterKillSquad: Cast " + HammerDR.Name + " on ≈ " + BotCKS.AOEcount + " " + AOEunit.Name;
BotCKS.slog("Cast " + HammerDR.Name + " on ≈ " + BotCKS.AOEcount + " " + AOEunit.Name);
HammerDR.Cast();
StyxWoW.Me.ClearTarget();
}
else if (SpellManager.HasSpell(Weihe) && !Weihe.Cooldown && !Styx.StyxWoW.GlobalCooldown)
{
TreeRoot.StatusText = "CritterKillSquad: cast " + Weihe.Name + " on ≈ " + BotCKS.AOEcount + " " + AOEunit.Name;
BotCKS.slog("Cast " + Weihe.Name + " on ≈ " + BotCKS.AOEcount + " " + AOEunit.Name);
Weihe.Cast();
}
else if (SpellManager.HasSpell(HZorn) && !HZorn.Cooldown && !Styx.StyxWoW.GlobalCooldown)
{
TreeRoot.StatusText = "CritterKillSquad: Cast " + HZorn.Name + " on ≈ " + BotCKS.AOEcount + " " + AOEunit.Name;
BotCKS.slog("Cast " + HZorn.Name + " on ≈ " + BotCKS.AOEcount + " " + AOEunit.Name);
HZorn.Cast();
}
else
{
TreeRoot.StatusText = "CritterKillSquad: [WAIT] " + Weihe.Name + " & " + HammerDR.Name + " & " + HZorn.Name + " on cooldown ...";
Thread.Sleep(300);
//continue;
}
Thread.Sleep(BotCKS.ran.Next(200, 700));
}
else if (SpellManager.HasSpell(KStoß.Id) && !Styx.StyxWoW.GlobalCooldown && !KStoß.Cooldown)
{
if (_unit.Distance >= 3)
MoveToNode(_unit, 3);
TreeRoot.StatusText = "CritterKillSquad: Cast " + KStoß.Name + " ...";
BotCKS.slog("Cast " + KStoß.Name);
if (!StyxWoW.Me.GotTarget || !StyxWoW.Me.CurrentTarget.IsAlive || StyxWoW.Me.CurrentTarget != _unit)
{
TreeRoot.StatusText = "CritterKillSquad: face " + _unit.Name + " ...";
_unit.Target();
_unit.Face();
Thread.Sleep(BotCKS.ran.Next(200, 500));
}
KStoß.Cast();
Thread.Sleep(BotCKS.ran.Next(950, 1200));
StyxWoW.Me.ClearTarget();
}
//.........这里部分代码省略.........
示例10: Tar
private void Tar(WoWUnit tar)
{
if (Manual)
{
tar.Target();
}
}
示例11: ReTarget
private void ReTarget(WoWUnit target)
{
if (CheckUnit(Me) && CheckUnit(target) && (!Me.GotTarget || Me.IsTargetingMeOrPet || Me.CurrentTarget.IsFriendly))
{
target.Target();
}
}
示例12: Pulse
public override void Pulse()
{
try
{
crashFix();
//Release spirit override
while (MeCheck && !Me.IsAlive && Me.IsInInstance)
{
DiedInInstance = true;
List<WoWPlayer> rezzerList = Me.PartyMembers.FindAll(player =>
(player.Class == WoWClass.Shaman ||
player.Class == WoWClass.Paladin ||
player.Class == WoWClass.Priest ||
player.Class == WoWClass.Druid) &&
player.IsAlive &&
player.Distance < 60);
if (rezzerList.Count == 0)
{
Log("No rezzers around. Releasing corpse");
Lua.DoString("RepopMe()", "lfg.lua");
//Crash fix
while (MeCheck)
{
Thread.Sleep(100);
}
crashFix();
break;
}
Lua.DoString("AcceptResurrect()", "lfg.lua");
Thread.Sleep(100);
}
//Retrieve corpse override
while (MeCheck && Me.Auras.ContainsKey("Ghost") && DiedInInstance)
{
tickCount = Environment.TickCount;
while (MeCheck)
{
safeMoveTo(Me.CorpsePoint);
Thread.Sleep(100);
if (Environment.TickCount - tickCount > 120000)
{
warningSound();
Log("Corpse run failed !");
return;
}
crashFix();
}
}
//Changing profile
if (MeCheck && Me.IsInInstance && Logic.Profiles.ProfileManager.XmlLocation != emptyProfile)
{
Log("Entered to the dungeon. Loading emtpy profile");
LevelbotSettings.Instance.LastUsedPath = Logic.Profiles.ProfileManager.XmlLocation;
Logic.Profiles.ProfileManager.LoadNew(emptyProfile, false);
}
else if (MeCheck && !Me.IsInInstance && Logic.Profiles.ProfileManager.XmlLocation == emptyProfile)
{
Log("Loading previous profile");
Logic.Profiles.ProfileManager.LoadNew(LevelbotSettings.Instance.LastUsedPath, true);
}
//Variable checks
if (MeCheck && !Me.IsInInstance)
{
if (UseMountWasOn)
LevelbotSettings.Instance.UseMount = true;
if (LootWasOn)
LevelbotSettings.Instance.LootMobs = true;
RaFHelper.SetLeader(Me);
LastTarget = null;
tank = null;
_tank = null;
}
else
{
if (LevelbotSettings.Instance.UseMount)
UseMountWasOn = true;
else
UseMountWasOn = false;
if (LevelbotSettings.Instance.LootMobs)
LootWasOn = true;
else
LootWasOn = false;
LevelbotSettings.Instance.UseMount = false;
LevelbotSettings.Instance.LootMobs = false;
Queued = false;
}
if (MeCheck && Me.IsAlive)
{
DiedInInstance = false;
}
//.........这里部分代码省略.........
示例13: CreateMainBehavior
protected override Composite CreateMainBehavior()
{
return new PrioritySelector(
// If quest is done, behavior is done...
new Decorator(context => IsDone,
new Action(context =>
{
LogInfo("Finished");
BehaviorDone();
})),
// Done due to count completing?
new Decorator(context => Counter >= NumOfTimesToUseItem,
new Action(context => { BehaviorDone(); })),
// If item is no longer viable to use, warn user and we're done...
new Decorator(context => !IsViable(ItemToUse),
new Action(context =>
{
LogError("We no longer have a viable Item({0}) to use--terminating", ItemId);
TreeRoot.Stop();
BehaviorDone();
})),
// If no viable target, find a new mob to harass...
new Decorator(context => !IsViableForItemUse(SelectedTarget),
new PrioritySelector(
new Action(context =>
{
Me.ClearTarget();
SelectedTarget = FindBestTarget();
// Target selected mob as feedback to user...
if ((SelectedTarget != null) && (Me.CurrentTarget != SelectedTarget))
{ SelectedTarget.Target(); }
return RunStatus.Failure; // fall through
}),
// If we couldn't find a mob, move back to center of hunting grounds...
new Decorator(context => SelectedTarget == null,
new PrioritySelector(
new Decorator(context => Me.Location.Distance(CurrentHuntingGroundWaypoint.Location) <= CurrentHuntingGroundWaypoint.Radius,
new Action(context => { CurrentHuntingGroundWaypoint = HuntingGrounds.FindNextWaypoint(CurrentHuntingGroundWaypoint.Location); })),
UtilityBehaviorPS_MoveTo(
context => CurrentHuntingGroundWaypoint.Location,
context => string.IsNullOrEmpty(CurrentHuntingGroundWaypoint.Name)
? "to next hunting ground waypoint"
: string.Format("to hunting ground waypoint '{0}'", CurrentHuntingGroundWaypoint.Name)
),
new Decorator(context => Me.Location.Distance(HuntingGroundCenter) <= Navigator.PathPrecision,
new Action(context => { LogInfo("Waiting for mobs to respawn."); }))
))
)),
// Pick a fight, if needed...
new Decorator(context => !Me.Combat && IsViableForItemUse(SelectedTarget),
UtilityBehaviorPS_GetMobsAttention(context => SelectedTarget))
);
}
示例14: On_Use
public static bool On_Use(string itemname, WoWUnit target)
{
string fnname = "FTWCore.On_Use";
MyTimer.Start(fnname);
bool retval = false;
using (StyxWoW.Memory.AcquireFrame())
{
if (itemname.ToLower() == "trinket1" && StyxWoW.Me.Inventory.Equipped.Trinket1 != null)
{
WoWItem trinket = StyxWoW.Me.Inventory.Equipped.Trinket1;
if (trinket.Cooldown == 0 && trinket.Usable == true && trinket.TriggersSpell == true)
{
FTWLogger.log("Using trinket {0}", StyxWoW.Me.Inventory.Equipped.Trinket1.Name);
StyxWoW.Me.Inventory.Equipped.Trinket1.Use();
}
}
else if (itemname.ToLower() == "trinket2" && StyxWoW.Me.Inventory.Equipped.Trinket2 != null)
{
WoWItem trinket = StyxWoW.Me.Inventory.Equipped.Trinket2;
if (trinket.Cooldown == 0 && trinket.Usable == true && trinket.TriggersSpell == true)
{
FTWLogger.log("Using trinket {0}", StyxWoW.Me.Inventory.Equipped.Trinket2.Name);
StyxWoW.Me.Inventory.Equipped.Trinket2.Use();
}
}
else
{
WoWItem item = GetInventoryItem(itemname);
if (item == null)
{
FTWLogger.debug("Couldn't find item {0}", itemname);
}
else if (item.Usable == false)
{
FTWLogger.debug("Item {0} is not usable", item.Name);
}
else if (item.Cooldown > 0)
{
FTWLogger.debug("Item {0} is on cooldown. Time remaining: {1}", item.Name, item.CooldownTimeLeft.TotalSeconds);
}
else if (FTWCoreStatus.OnCooldown(item.Name))
{
FTWLogger.debug("Item {0} is on cooldown.", item.Name);
}
else
{
if (target != null && target.Guid != StyxWoW.Me.Guid)
{
target.Target();
Thread.Sleep(100);
}
FTWLogger.log("Using item '{0}'", item.Name);
item.Use();
retval = false;
}
}
}
MyTimer.Stop(fnname);
return retval;
}