Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Windows;
- using System.Windows.Forms;
- using Buddy.BehaviorTree;
- using Buddy.Common;
- using Buddy.CommonBot;
- using Buddy.Common.Plugins;
- using Buddy.Swtor;
- using Buddy.Common.Math;
- using Buddy.Swtor.Objects;
- namespace Buddywing.Plugins
- {
- class AutoPVP : IPlugin
- {
- #region Implementation of IEquatable<IPlugin>
- /// <summary>
- /// Indicates whether the current object is equal to another object of the same type.
- /// </summary>
- /// <returns>
- /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.
- /// </returns>
- /// <param name="other">An object to compare with this object.</param>
- public bool Equals(IPlugin other)
- {
- return other.Name == Name;
- }
- #endregion
- #region Implementation of IPlugin
- public string Author
- {
- get { return "Wbulot"; }
- }
- public Version Version
- {
- get { return new Version(1, 0, 0); }
- }
- public string Name
- {
- get { return "AutoPVP"; }
- }
- public string Description
- {
- get { return "Cast spell for you"; }
- }
- public Window DisplayWindow
- {
- get { return null; }
- }
- /// <summary> Executes the pulse action. This is called every "tick" of the bot. </summary>
- public void OnPulse()
- {
- }
- public static List<Vector3> EnemyPoints = new List<Vector3>();
- public static List<TorCharacter> GetTorCharacters()
- {
- using (BuddyTor.Memory.AcquireFrame())
- {
- var npcs = ObjectManager.GetObjects<TorNpc>();
- var objects = npcs.Cast<TorCharacter>().ToList();
- var torPlayers = ObjectManager.GetObjects<TorPlayer>();
- objects.AddRange(torPlayers);
- //foreach (var item in objects)
- //{
- //}
- return objects;
- }
- }
- private static int PointsAroundPoint(Vector3 pt, List<Vector3> l, float dist)
- {
- using (BuddyTor.Memory.AcquireFrame())
- {
- var maxDistance = dist * dist;
- return l.Count(p => p.DistanceSqr(pt) <= maxDistance);
- }
- }
- public static bool CheckDpsAoe(int minMobs, float distance, Vector3 center)
- {
- EnemyPoints = new List<Vector3>();
- var objects = GetTorCharacters();
- foreach (var c in objects)
- {
- if (c.IsHostile && c.IsDead == false)
- {
- EnemyPoints.Add(c.Position);
- Logging.Write(c.Name);
- }
- }
- return PointsAroundPoint(center, EnemyPoints, distance) >= minMobs;
- }
- private static void Routine()
- {
- BuddyTor.Update();
- BuddyTor.Me.SetTarget(BuddyTor.Me.CurrentTarget);
- if (BuddyTor.Me.CurrentTarget != null)
- {
- Logging.Write(BuddyTor.Me.CurrentTarget.Name);
- }
- else
- {
- Logging.Write("Il n'y a pas de cible !!");
- }
- if (BuddyTor.Me.IsCasting == false)
- {
- if (BuddyTor.Me.HasBuff("Puissance de Force") == false)
- {
- Logging.Write("Cast Puissance de Force");
- AbilityManager.Cast("Puissance de Force", BuddyTor.Me);
- }
- if (AbilityManager.CanCast("Camouflage de Force", BuddyTor.Me) == true && BuddyTor.Me.HealthPercent < 30)
- {
- Logging.Write("Cast Camouflage de Force");
- AbilityManager.Cast("Camouflage de Force", BuddyTor.Me);
- }
- if (AbilityManager.CanCast("La Force nous garde", BuddyTor.Me) == true && BuddyTor.Me.HealthPercent < 40)
- {
- Logging.Write("Cast La Force nous garde");
- AbilityManager.Cast("La Force nous garde", BuddyTor.Me);
- }
- if (AbilityManager.CanCast("Retour de sabre", BuddyTor.Me) == true && BuddyTor.Me.HealthPercent < 50)
- {
- Logging.Write("Cast Retour de sabre");
- AbilityManager.Cast("Retour de sabre", BuddyTor.Me);
- }
- if (AbilityManager.CanCast("R??primande", BuddyTor.Me) == true && BuddyTor.Me.HealthPercent < 75)
- {
- Logging.Write("Cast R??primande");
- AbilityManager.Cast("R??primande", BuddyTor.Me);
- }
- if (AbilityManager.CanCast("Zen", BuddyTor.Me) == true)
- {
- Logging.Write("Cast Zen");
- AbilityManager.Cast("Zen", BuddyTor.Me);
- }
- if (AbilityManager.CanCast("Balayage de Force", BuddyTor.Me) == true)
- {
- if (CheckDpsAoe(2, 0.5f, BuddyTor.Me.Position) == true)
- {
- Logging.Write("Cast Balayage de Force");
- AbilityManager.Cast("Balayage de Force", BuddyTor.Me);
- }
- }
- if (AbilityManager.CanCast("Effroi", BuddyTor.Me) == true)
- {
- if (CheckDpsAoe(3, 0.7f, BuddyTor.Me.Position) == true)
- {
- Logging.Write("Cast Effroi");
- AbilityManager.Cast("Effroi", BuddyTor.Me);
- }
- }
- if (BuddyTor.Me.CurrentTarget != null)
- {
- if (AbilityManager.CanCast("Pr??cision", BuddyTor.Me.CurrentTarget) == true && BuddyTor.Me.CurrentTarget.Distance <= 0.4)
- {
- Logging.Write("Pr??cision");
- AbilityManager.Cast("Pr??cision", BuddyTor.Me.CurrentTarget);
- }
- if (BuddyTor.Me.ActionPoints < 3)
- {
- if (AbilityManager.CanCast("Frappe acharn??e", BuddyTor.Me.CurrentTarget) == true)
- {
- Logging.Write("Cast Frappe acharn??e");
- AbilityManager.Cast("Frappe acharn??e", BuddyTor.Me.CurrentTarget);
- }
- if (AbilityManager.CanCast("Frappe", BuddyTor.Me.CurrentTarget) == true)
- {
- Logging.Write("Cast Frappe");
- AbilityManager.Cast("Frappe", BuddyTor.Me.CurrentTarget);
- }
- }
- if (AbilityManager.CanCast("Pacification", BuddyTor.Me.CurrentTarget) == true && BuddyTor.Me.CurrentTarget.HealthPercent > 50)
- {
- Logging.Write("Cast Pacification");
- AbilityManager.Cast("Pacification", BuddyTor.Me.CurrentTarget);
- }
- if (AbilityManager.CanCast("Fente cyclone", BuddyTor.Me.CurrentTarget) == true)
- {
- if (CheckDpsAoe(2, 0.3f, BuddyTor.Me.CurrentTarget.Position) == true && BuddyTor.Me.CurrentTarget.Distance <= 0.5)
- {
- Logging.Write("Cast Fente cyclone");
- AbilityManager.Cast("Fente cyclone", BuddyTor.Me.CurrentTarget);
- }
- }
- if (BuddyTor.Me.CurrentTarget.IsCasting && AbilityManager.CanCast("Coup de pied de Force", BuddyTor.Me.CurrentTarget) == true)
- {
- Logging.Write("Cast Coup de pied de Force");
- AbilityManager.Cast("Coup de pied de Force", BuddyTor.Me.CurrentTarget);
- }
- if (AbilityManager.CanCast("Saut de Force", BuddyTor.Me.CurrentTarget) == true)
- {
- Logging.Write("Cast Saut de force");
- AbilityManager.Cast("Saut de Force", BuddyTor.Me.CurrentTarget);
- }
- if (BuddyTor.Me.ActionPoints < 3)
- {
- if (AbilityManager.CanCast("Frappe acharn??e", BuddyTor.Me.CurrentTarget) == true)
- {
- Logging.Write("Cast Frappe acharn??e");
- AbilityManager.Cast("Frappe acharn??e", BuddyTor.Me.CurrentTarget);
- }
- if (AbilityManager.CanCast("Frappe", BuddyTor.Me.CurrentTarget) == true)
- {
- Logging.Write("Cast Frappe");
- AbilityManager.Cast("Frappe", BuddyTor.Me.CurrentTarget);
- }
- }
- if (AbilityManager.CanCast("D??luge de lames", BuddyTor.Me.CurrentTarget) == true)
- {
- Logging.Write("Cast D??luge de lames");
- AbilityManager.Cast("D??luge de lames", BuddyTor.Me.CurrentTarget);
- }
- if (BuddyTor.Me.CurrentTarget.Distance > 0.4 && BuddyTor.Me.CurrentTarget.Distance <= 1)
- {
- if (AbilityManager.CanCast("Temp??te de lame", BuddyTor.Me.CurrentTarget) == true)
- {
- Logging.Write("Cast Temp??te de lame");
- AbilityManager.Cast("Temp??te de lame", BuddyTor.Me.CurrentTarget);
- }
- if (AbilityManager.CanCast("Stase de Force", BuddyTor.Me.CurrentTarget) == true)
- {
- Logging.Write("Cast Stase de Force");
- AbilityManager.Cast("Stase de Force", BuddyTor.Me.CurrentTarget);
- }
- }
- }
- }
- else
- {
- Logging.Write("On est en train de caster, donc wait");
- }
- }
- /// <summary> Executes the initialize action. This is called at initial bot startup. (When the bot itself is started, not when Start() is called) </summary>
- public void OnInitialize()
- {
- Hotkeys.RegisterHotkey("Routine", Routine, Keys.D1);
- }
- /// <summary> Executes the shutdown action. This is called when the bot is shutting down. (Not when Stop() is called) </summary>
- public void OnShutdown()
- {
- }
- /// <summary> Executes the enabled action. This is called when the user has enabled this specific plugin via the GUI. </summary>
- public void OnEnabled()
- {
- }
- /// <summary> Executes the disabled action. This is called whent he user has disabled this specific plugin via the GUI. </summary>
- public void OnDisabled()
- {
- }
- #endregion
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement