Diff
checker
Texte
Texte
Images
Documents
Excel
Dossiers
Legal
Enterprise
Application de bureau
Prix
Se connecter
Télécharger Diffchecker Desktop
Comparer le texte
Trouver la différence entre deux fichiers texte
Outils
Historique
Éditeur live
Cacher identiques
Sans retour à la ligne
Vue
Divisé
Unifié
Niveau de précision
Intelligent
Mot
Caractère
Coloration syntaxique
Choisir la syntaxe
Ignorer
Transformer le texte
Aller au premier écart
Modifier l'entrée
Diffchecker Desktop
La façon la plus sécurisée d'utiliser Diffchecker. Obtenez l'application Diffchecker Desktop : vos diffs ne quittent jamais votre ordinateur !
Obtenir Desktop
Untitled diff
Créé
il y a 10 ans
Le diff n'expire jamais
Effacer
Exporter
Partager
Expliquer
29 suppressions
Lignes
Total
Supprimé
Caractères
Total
Supprimé
Pour continuer à utiliser cette fonctionnalité, passez à
Diff
checker
Pro
Voir les prix
277 lignes
Copier tout
31 ajouts
Lignes
Total
Ajouté
Caractères
Total
Ajouté
Pour continuer à utiliser cette fonctionnalité, passez à
Diff
checker
Pro
Voir les prix
279 lignes
Copier tout
Copier
Copié
Copier
Copié
Original
Lord's
using LeagueSharp;
using LeagueSharp;
using LeagueSharp.Common;
using LeagueSharp.Common;
Copier
Copié
Copier
Copié
using Color = SharpDX.Color;
using SharpDX;
using SharpDX;
using System;
using System;
using System.Reflection;
using System.Reflection;
using System.Linq;
using System.Linq;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Text;
using System.Text;
using System.Threading.Tasks;
using System.Threading.Tasks;
Copier
Copié
Copier
Copié
namespace PerfectWard
using System.Drawing;
namespace PerfectWard
Reborn
{
{
internal class PerfectWardTracker
internal class PerfectWardTracker
{
{
public static Helper Helper;
public static Helper Helper;
static readonly List<KeyValuePair<int, String>> _wards = new List<KeyValuePair<int, String>> //insertion order
static readonly List<KeyValuePair<int, String>> _wards = new List<KeyValuePair<int, String>> //insertion order
{
{
new KeyValuePair<int, String>(3340, "Warding Totem Trinket"),
new KeyValuePair<int, String>(3340, "Warding Totem Trinket"),
new KeyValuePair<int, String>(2301, "Eye of the Watchers"),
new KeyValuePair<int, String>(2301, "Eye of the Watchers"),
new KeyValuePair<int, String>(2302, "Eye of the Oasis"),
new KeyValuePair<int, String>(2302, "Eye of the Oasis"),
new KeyValuePair<int, String>(2303, "Eye of the Equinox"),
new KeyValuePair<int, String>(2303, "Eye of the Equinox"),
Copier
Copié
Copier
Copié
new KeyValuePair<int, String>(3205, "Quill Coat"),
//
new KeyValuePair<int, String>(3205, "Quill Coat"),
new KeyValuePair<int, String>(3207, "Spirit Of The Ancient Golem"),
new KeyValuePair<int, String>(3207, "Spirit Of The Ancient Golem"),
new KeyValuePair<int, String>(3154, "Wriggle's Lantern"),
new KeyValuePair<int, String>(3154, "Wriggle's Lantern"),
new KeyValuePair<int, String>(2049, "Sight Stone"),
new KeyValuePair<int, String>(2049, "Sight Stone"),
new KeyValuePair<int, String>(2045, "Ruby Sightstone"),
new KeyValuePair<int, String>(2045, "Ruby Sightstone"),
Copier
Copié
Copier
Copié
new KeyValuePair<int, String>(3160, "Feral Flare"),
//
new KeyValuePair<int, String>(3160, "Feral Flare"),
new KeyValuePair<int, String>(2050, "Explorer's Ward"),
new KeyValuePair<int, String>(2050, "Explorer's Ward"),
new KeyValuePair<int, String>(2044, "Stealth Ward"),
new KeyValuePair<int, String>(2044, "Stealth Ward"),
Copier
Copié
Copier
Copié
new KeyValuePair<int, String>(2055, "Control Ward"),
};
};
int _lastTimeWarded;
int _lastTimeWarded;
private const int VK_LBUTTON = 1;
private const int VK_LBUTTON = 1;
private const int WM_KEYDOWN = 0x0100, WM_KEYUP = 0x0101, WM_CHAR = 0x0102, WM_SYSKEYDOWN = 0x0104, WM_SYSKEYUP = 0x0105, WM_MOUSEDOWN = 0x201;
private const int WM_KEYDOWN = 0x0100, WM_KEYUP = 0x0101, WM_CHAR = 0x0102, WM_SYSKEYDOWN = 0x0104, WM_SYSKEYUP = 0x0105, WM_MOUSEDOWN = 0x201;
Copier
Copié
Copier
Copié
public static
LeagueSharp.Common.
Menu Config;
public static
Menu Config;
public static float lastuseward = 0;
public static float lastuseward = 0;
public class Wardspoting
public class Wardspoting
{
{
public static WardSpot _PutSafeWard;
public static WardSpot _PutSafeWard;
}
}
public PerfectWardTracker()
public PerfectWardTracker()
{
{
Game.OnStart += OnGameStart;
Game.OnStart += OnGameStart;
Game.OnUpdate += Game_OnGameUpdate;
Game.OnUpdate += Game_OnGameUpdate;
Drawing.OnDraw += OnDraw;
Drawing.OnDraw += OnDraw;
//Create the menu
//Create the menu
Copier
Copié
Copier
Copié
Config = new
LeagueSharp.Common.Menu("PerfectWard", "PerfectWard", true);
Config = new
Menu("PerfectWardReborn", "PerfectWardReborn", true).SetFontStyle(FontStyle.Bold, Color.DarkSeaGreen);
Config.SubMenu("Drawing").AddItem(new LeagueSharp.Common.MenuItem("drawplaces", "Draw ward places").SetValue(new Circle(true, System.Drawing.Color.FromArgb(100, 255, 0, 255))));
Config.AddSubMenu(new Menu("WardKey", "WardKey"));
Config.SubMenu("
Drawing
").AddItem(new
LeagueSharp.Common.
MenuItem("
drawDistance
", "
Don't draw if the distance >"))
.SetValue(new
Slider(2000, 10000, 1));
Config.SubMenu("WardKey").AddItem(new MenuItem("placekey", "NormalWard Key").SetValue(new KeyBind("Z".ToCharArray()[0], KeyBindType.Press))).SetFontStyle(FontStyle.Bold, Color.Green);
Config.SubMenu("Drawing").AddItem(new
LeagueSharp.Common.
MenuItem("
placekey
", "
NormalWard Key
").SetValue(new
KeyBind("Z".ToCharArray()[0], KeyBindType.Press
)));
Config.SubMenu("
WardKey
").AddItem(new
MenuItem("
placekeyconWard
", "
ControlWard Key")
.SetValue(new
KeyBind("U".ToCharArray()[0], KeyBindType.Press))).SetFontStyle(FontStyle.Bold, Color.DarkOrange);
Config.SubMenu("Drawing").AddItem(new
LeagueSharp.Common.MenuItem("placekeypink", "PinkWard Key").SetValue(new KeyBind("C".ToCharArray()[0], KeyBindType.Press)));
Config.SubMenu("Drawing").AddItem(new
MenuItem("
drawplaces
", "
Draw ward places
").SetValue(new
Circle(true, System.Drawing.Color.FromArgb(100, 255, 0, 255)
)));
Config.SubMenu("AutoBushRevealer").AddItem(new MenuItem("AutoBushKey", "Key").SetValue(new KeyBind("
Ctrl
".ToCharArray()[0], KeyBindType.Press)));
Config.SubMenu("Drawing").AddItem(new
MenuItem("drawDistance", "Don't draw if the distance >")).SetValue(new Slider(2000, 10000, 1));
Config.AddSubMenu(new Menu("AutoBushRevealer", "AutoBushRevealer"));
Config.AddSubMenu(new Menu("Auto Bush Revealer", "AutoBushRevealer"));
Config.SubMenu("AutoBushRevealer").AddItem(new MenuItem("AutoBushKey", "Key").SetValue(new KeyBind("
C
".ToCharArray()[0], KeyBindType.Press)));
Config.SubMenu("AutoBushRevealer").AddItem(new MenuItem("AutoBushEnabled", "Enabled").SetValue(true));
Config.SubMenu("AutoBushRevealer").AddItem(new MenuItem("AutoBushEnabled", "Enabled").SetValue(true));
Config.AddToMainMenu();
Config.AddToMainMenu();
Copier
Copié
Copier
Copié
foreach (var ward in _wards)
foreach (var ward in _wards)
Copier
Copié
Copier
Copié
Config.SubMenu("Auto Bush Ward Type").AddItem(new MenuItem("AutoBush" + ward.Key, ward.Value).SetValue(true));
Config.SubMenu("Auto Bush Ward Type").AddItem(new MenuItem("AutoBush" + ward.Key, ward.Value).SetValue(true));
Game.OnUpdate += Game_OnGameUpdate;
Game.OnUpdate += Game_OnGameUpdate;
}
}
InventorySlot GetWardSlot()
InventorySlot GetWardSlot()
{
{
return _wards.Select(x => x.Key).Where(id => Config.Item("AutoBush" + id).GetValue<bool>() && Items.CanUseItem(id)).Select(wardId => ObjectManager.Player.InventoryItems.FirstOrDefault(slot => slot.Id == (ItemId)wardId)).FirstOrDefault();
return _wards.Select(x => x.Key).Where(id => Config.Item("AutoBush" + id).GetValue<bool>() && Items.CanUseItem(id)).Select(wardId => ObjectManager.Player.InventoryItems.FirstOrDefault(slot => slot.Id == (ItemId)wardId)).FirstOrDefault();
}
}
static public InventorySlot GetAnyWardSlot()
static public InventorySlot GetAnyWardSlot()
{
{
return _wards.Select(x => x.Key).Where(Items.CanUseItem).Select(wardId => ObjectManager.Player.InventoryItems.FirstOrDefault(slot => slot.Id == (ItemId)wardId)).FirstOrDefault();
return _wards.Select(x => x.Key).Where(Items.CanUseItem).Select(wardId => ObjectManager.Player.InventoryItems.FirstOrDefault(slot => slot.Id == (ItemId)wardId)).FirstOrDefault();
}
}
Obj_AI_Base GetNearObject(String name, Vector3 pos, int maxDistance)
Obj_AI_Base GetNearObject(String name, Vector3 pos, int maxDistance)
{
{
return ObjectManager.Get<Obj_AI_Base>().FirstOrDefault(x => x.Name == name && x.Distance(pos) <= maxDistance);
return ObjectManager.Get<Obj_AI_Base>().FirstOrDefault(x => x.Name == name && x.Distance(pos) <= maxDistance);
}
}
void Game_OnGameUpdate(EventArgs args)
void Game_OnGameUpdate(EventArgs args)
{
{
int time = Environment.TickCount;
int time = Environment.TickCount;
if (Config.Item("AutoBushEnabled").GetValue<bool>() && Config.Item("AutoBushKey").GetValue<KeyBind>().Active)
if (Config.Item("AutoBushEnabled").GetValue<bool>() && Config.Item("AutoBushKey").GetValue<KeyBind>().Active)
foreach (Obj_AI_Hero enemy in Helper.EnemyInfo.Where(x =>
foreach (Obj_AI_Hero enemy in Helper.EnemyInfo.Where(x =>
x.Player.IsValid &&
x.Player.IsValid &&
!x.Player.IsVisible &&
!x.Player.IsVisible &&
!x.Player.IsDead &&
!x.Player.IsDead &&
x.Player.Distance(ObjectManager.Player.ServerPosition) < 1000 &&
x.Player.Distance(ObjectManager.Player.ServerPosition) < 1000 &&
time - x.LastSeen < 2500).Select(x => x.Player))
time - x.LastSeen < 2500).Select(x => x.Player))
{
{
var bestWardPos = GetWardPos(enemy.ServerPosition);
var bestWardPos = GetWardPos(enemy.ServerPosition);
// var bestWardPos = GetWardPos(enemy.ServerPosition, 165, 2);
// var bestWardPos = GetWardPos(enemy.ServerPosition, 165, 2);
if (bestWardPos != enemy.ServerPosition && bestWardPos != Vector3.Zero && bestWardPos.Distance(ObjectManager.Player.ServerPosition) <= 600)
if (bestWardPos != enemy.ServerPosition && bestWardPos != Vector3.Zero && bestWardPos.Distance(ObjectManager.Player.ServerPosition) <= 600)
{
{
int timedif = Environment.TickCount - _lastTimeWarded;
int timedif = Environment.TickCount - _lastTimeWarded;
if (timedif > 1250 && !(timedif < 2500 && GetNearObject("SightWard", bestWardPos, 200) != null)) //no near wards
if (timedif > 1250 && !(timedif < 2500 && GetNearObject("SightWard", bestWardPos, 200) != null)) //no near wards
{
{
var wardSlot = GetWardSlot();
var wardSlot = GetWardSlot();
if (wardSlot != null && wardSlot.Id != ItemId.Unknown)
if (wardSlot != null && wardSlot.Id != ItemId.Unknown)
{
{
ObjectManager.Player.Spellbook.CastSpell(wardSlot.SpellSlot, bestWardPos);
ObjectManager.Player.Spellbook.CastSpell(wardSlot.SpellSlot, bestWardPos);
_lastTimeWarded = Environment.TickCount;
_lastTimeWarded = Environment.TickCount;
}
}
}
}
}
}
}
}
InventorySlot wardSpellSlot = null;
InventorySlot wardSpellSlot = null;
if (Config.Item("placekey").GetValue<KeyBind>().Active)
if (Config.Item("placekey").GetValue<KeyBind>().Active)
{
{
Copier
Copié
Copier
Copié
wardSpellSlot =
Items
.GetWardSlot();
wardSpellSlot =
Ward
.GetWardSlot();
}
}
Copier
Copié
Copier
Copié
else if (Config.Item("placekey
pink
").GetValue<KeyBind>().Active)
else if (Config.Item("placekey
conWard
").GetValue<KeyBind>().Active)
{
{
Copier
Copié
Copier
Copié
wardSpellSlot = Ward.
GetPinkSlot
();
wardSpellSlot = Ward.
GetConWardSlot
();
}
}
{
{
if (wardSpellSlot == null || lastuseward + 1000 > Environment.TickCount)
if (wardSpellSlot == null || lastuseward + 1000 > Environment.TickCount)
{
{
return;
return;
}
}
Vector3? nearestWard = Ward.FindNearestWardSpot(Drawing.ScreenToWorld(Game.CursorPos.X, Game.CursorPos.Y));
Vector3? nearestWard = Ward.FindNearestWardSpot(Drawing.ScreenToWorld(Game.CursorPos.X, Game.CursorPos.Y));
if (nearestWard != null)
if (nearestWard != null)
{
{
if (wardSpellSlot != null)
if (wardSpellSlot != null)
{
{
Console.WriteLine("putting ward");
Console.WriteLine("putting ward");
ObjectManager.Player.Spellbook.CastSpell(wardSpellSlot.SpellSlot, (Vector3)nearestWard);
ObjectManager.Player.Spellbook.CastSpell(wardSpellSlot.SpellSlot, (Vector3)nearestWard);
lastuseward = Environment.TickCount;
lastuseward = Environment.TickCount;
}
}
}
}
WardSpot nearestSafeWard = Ward.FindNearestSafeWardSpot(Drawing.ScreenToWorld(Game.CursorPos.X, Game.CursorPos.Y));
WardSpot nearestSafeWard = Ward.FindNearestSafeWardSpot(Drawing.ScreenToWorld(Game.CursorPos.X, Game.CursorPos.Y));
if (nearestSafeWard != null)
if (nearestSafeWard != null)
{
{
if (wardSpellSlot != null)
if (wardSpellSlot != null)
{
{
ObjectManager.Player.IssueOrder(GameObjectOrder.MoveTo, nearestSafeWard.MovePosition);
ObjectManager.Player.IssueOrder(GameObjectOrder.MoveTo, nearestSafeWard.MovePosition);
Wardspoting._PutSafeWard = nearestSafeWard;
Wardspoting._PutSafeWard = nearestSafeWard;
}
}
}
}
}
}
if (Wardspoting._PutSafeWard != null && lastuseward + 1000 < Environment.TickCount)
if (Wardspoting._PutSafeWard != null && lastuseward + 1000 < Environment.TickCount)
{
{
wardSpellSlot = Items.GetWardSlot();
wardSpellSlot = Items.GetWardSlot();
if (Math.Sqrt(Math.Pow(Wardspoting._PutSafeWard.ClickPosition.X - ObjectManager.Player.Position.X, 2) + Math.Pow(Wardspoting._PutSafeWard.ClickPosition.Y - ObjectManager.Player.Position.Y, 2)) <= 640.0)
if (Math.Sqrt(Math.Pow(Wardspoting._PutSafeWard.ClickPosition.X - ObjectManager.Player.Position.X, 2) + Math.Pow(Wardspoting._PutSafeWard.ClickPosition.Y - ObjectManager.Player.Position.Y, 2)) <= 640.0)
{
{
if (Config.Item("placekey").GetValue<KeyBind>().Active)
if (Config.Item("placekey").GetValue<KeyBind>().Active)
{
{
Copier
Copié
Copier
Copié
wardSpellSlot =
Items
.GetWardSlot();
wardSpellSlot =
Ward
.GetWardSlot();
}
}
Copier
Copié
Copier
Copié
else if (Config.Item("placekey
pink
").GetValue<KeyBind>().Active)
else if (Config.Item("placekey
conWard
").GetValue<KeyBind>().Active)
{
{
Copier
Copié
Copier
Copié
wardSpellSlot = Ward.
GetPinkSlot
();
wardSpellSlot = Ward.
GetConWardSlot
();
}
}
if (wardSpellSlot != null)
if (wardSpellSlot != null)
{
{
Console.WriteLine("putting ward2");
Console.WriteLine("putting ward2");
ObjectManager.Player.Spellbook.CastSpell(wardSpellSlot.SpellSlot, Wardspoting._PutSafeWard.ClickPosition);
ObjectManager.Player.Spellbook.CastSpell(wardSpellSlot.SpellSlot, Wardspoting._PutSafeWard.ClickPosition);
lastuseward = Environment.TickCount;
lastuseward = Environment.TickCount;
}
}
Wardspoting._PutSafeWard = null;
Wardspoting._PutSafeWard = null;
}
}
}
}
}
}
Vector3 GetWardPos(Vector3 lastPos, int radius = 165, int precision = 3) //maybe reverse autobushward code from the bots?
Vector3 GetWardPos(Vector3 lastPos, int radius = 165, int precision = 3) //maybe reverse autobushward code from the bots?
{
{
//old: Vector3 wardPos = enemy.Position + Vector3.Normalize(enemy.Position - ObjectManager.Player.Position) * 150;
//old: Vector3 wardPos = enemy.Position + Vector3.Normalize(enemy.Position - ObjectManager.Player.Position) * 150;
var count = precision;
var count = precision;
while (count > 0)
while (count > 0)
{
{
var vertices = radius;
var vertices = radius;
var wardLocations = new WardLocation[vertices];
var wardLocations = new WardLocation[vertices];
var angle = 2 * Math.PI / vertices;
var angle = 2 * Math.PI / vertices;
for (var i = 0; i < vertices; i++)
for (var i = 0; i < vertices; i++)
{
{
var th = angle * i;
var th = angle * i;
var pos = new Vector3((float)(lastPos.X + radius * Math.Cos(th)), (float)(lastPos.Y + radius * Math.Sin(th)), 0);
var pos = new Vector3((float)(lastPos.X + radius * Math.Cos(th)), (float)(lastPos.Y + radius * Math.Sin(th)), 0);
wardLocations[i] = new WardLocation(pos, NavMesh.IsWallOfGrass(pos, 5));
wardLocations[i] = new WardLocation(pos, NavMesh.IsWallOfGrass(pos, 5));
}
}
var grassLocations = new List<GrassLocation>();
var grassLocations = new List<GrassLocation>();
for (var i = 0; i < wardLocations.Length; i++)
for (var i = 0; i < wardLocations.Length; i++)
{
{
if (!wardLocations[i].Grass) continue;
if (!wardLocations[i].Grass) continue;
if (i != 0 && wardLocations[i - 1].Grass)
if (i != 0 && wardLocations[i - 1].Grass)
grassLocations.Last().Count++;
grassLocations.Last().Count++;
else
else
grassLocations.Add(new GrassLocation(i, 1));
grassLocations.Add(new GrassLocation(i, 1));
}
}
var grassLocation = grassLocations.OrderByDescending(x => x.Count).FirstOrDefault();
var grassLocation = grassLocations.OrderByDescending(x => x.Count).FirstOrDefault();
if (grassLocation != null) //else: no pos found. increase/decrease radius?
if (grassLocation != null) //else: no pos found. increase/decrease radius?
{
{
var midelement = (int)Math.Ceiling(grassLocation.Count / 2f);
var midelement = (int)Math.Ceiling(grassLocation.Count / 2f);
lastPos = wardLocations[grassLocation.Index + midelement - 1].Pos;
lastPos = wardLocations[grassLocation.Index + midelement - 1].Pos;
radius = (int)Math.Floor(radius / 2f);
radius = (int)Math.Floor(radius / 2f);
}
}
count--;
count--;
}
}
return lastPos;
return lastPos;
}
}
class WardLocation
class WardLocation
{
{
public readonly Vector3 Pos;
public readonly Vector3 Pos;
public readonly bool Grass;
public readonly bool Grass;
public WardLocation(Vector3 pos, bool grass)
public WardLocation(Vector3 pos, bool grass)
{
{
Pos = pos;
Pos = pos;
Grass = grass;
Grass = grass;
}
}
}
}
class GrassLocation
class GrassLocation
{
{
public readonly int Index;
public readonly int Index;
public int Count;
public int Count;
public GrassLocation(int index, int count)
public GrassLocation(int index, int count)
{
{
Index = index;
Index = index;
Count = count;
Count = count;
}
}
}
}
private void OnGameStart(EventArgs args)
private void OnGameStart(EventArgs args)
{
{
Helper = new Helper();
Helper = new Helper();
Game.PrintChat(
Game.PrintChat(
string.Format(
string.Format(
"{0} v{1} loaded.",
"{0} v{1} loaded.",
Assembly.GetExecutingAssembly().GetName().Name,
Assembly.GetExecutingAssembly().GetName().Name,
Assembly.GetExecutingAssembly().GetName().Version
Assembly.GetExecutingAssembly().GetName().Version
)
)
);
);
}
}
private void OnDraw(EventArgs args)
private void OnDraw(EventArgs args)
{
{
if (Config.Item("drawplaces").GetValue<Circle>().Active)
if (Config.Item("drawplaces").GetValue<Circle>().Active)
{
{
Ward.DrawWardSpots();
Ward.DrawWardSpots();
Ward.DrawSafeWardSpots();
Ward.DrawSafeWardSpots();
}
}
}
}
}
}
}
}
Copier
Copié
Copier
Copié
Différences enregistrées
Texte d'origine
Ouvrir un fichier
Original using LeagueSharp; using LeagueSharp.Common; using SharpDX; using System; using System.Reflection; using System.Linq; using System.Collections.Generic; using System.Text; using System.Threading.Tasks; namespace PerfectWard { internal class PerfectWardTracker { public static Helper Helper; static readonly List<KeyValuePair<int, String>> _wards = new List<KeyValuePair<int, String>> //insertion order { new KeyValuePair<int, String>(3340, "Warding Totem Trinket"), new KeyValuePair<int, String>(2301, "Eye of the Watchers"), new KeyValuePair<int, String>(2302, "Eye of the Oasis"), new KeyValuePair<int, String>(2303, "Eye of the Equinox"), new KeyValuePair<int, String>(3205, "Quill Coat"), new KeyValuePair<int, String>(3207, "Spirit Of The Ancient Golem"), new KeyValuePair<int, String>(3154, "Wriggle's Lantern"), new KeyValuePair<int, String>(2049, "Sight Stone"), new KeyValuePair<int, String>(2045, "Ruby Sightstone"), new KeyValuePair<int, String>(3160, "Feral Flare"), new KeyValuePair<int, String>(2050, "Explorer's Ward"), new KeyValuePair<int, String>(2044, "Stealth Ward"), }; int _lastTimeWarded; private const int VK_LBUTTON = 1; private const int WM_KEYDOWN = 0x0100, WM_KEYUP = 0x0101, WM_CHAR = 0x0102, WM_SYSKEYDOWN = 0x0104, WM_SYSKEYUP = 0x0105, WM_MOUSEDOWN = 0x201; public static LeagueSharp.Common.Menu Config; public static float lastuseward = 0; public class Wardspoting { public static WardSpot _PutSafeWard; } public PerfectWardTracker() { Game.OnStart += OnGameStart; Game.OnUpdate += Game_OnGameUpdate; Drawing.OnDraw += OnDraw; //Create the menu Config = new LeagueSharp.Common.Menu("PerfectWard", "PerfectWard", true); Config.SubMenu("Drawing").AddItem(new LeagueSharp.Common.MenuItem("drawplaces", "Draw ward places").SetValue(new Circle(true, System.Drawing.Color.FromArgb(100, 255, 0, 255)))); Config.SubMenu("Drawing").AddItem(new LeagueSharp.Common.MenuItem("drawDistance", "Don't draw if the distance >")).SetValue(new Slider(2000, 10000, 1)); Config.SubMenu("Drawing").AddItem(new LeagueSharp.Common.MenuItem("placekey", "NormalWard Key").SetValue(new KeyBind("Z".ToCharArray()[0], KeyBindType.Press))); Config.SubMenu("Drawing").AddItem(new LeagueSharp.Common.MenuItem("placekeypink", "PinkWard Key").SetValue(new KeyBind("C".ToCharArray()[0], KeyBindType.Press))); Config.SubMenu("AutoBushRevealer").AddItem(new MenuItem("AutoBushKey", "Key").SetValue(new KeyBind("Ctrl".ToCharArray()[0], KeyBindType.Press))); Config.AddSubMenu(new Menu("Auto Bush Revealer", "AutoBushRevealer")); Config.SubMenu("AutoBushRevealer").AddItem(new MenuItem("AutoBushEnabled", "Enabled").SetValue(true)); Config.AddToMainMenu(); foreach (var ward in _wards) Config.SubMenu("Auto Bush Ward Type").AddItem(new MenuItem("AutoBush" + ward.Key, ward.Value).SetValue(true)); Game.OnUpdate += Game_OnGameUpdate; } InventorySlot GetWardSlot() { return _wards.Select(x => x.Key).Where(id => Config.Item("AutoBush" + id).GetValue<bool>() && Items.CanUseItem(id)).Select(wardId => ObjectManager.Player.InventoryItems.FirstOrDefault(slot => slot.Id == (ItemId)wardId)).FirstOrDefault(); } static public InventorySlot GetAnyWardSlot() { return _wards.Select(x => x.Key).Where(Items.CanUseItem).Select(wardId => ObjectManager.Player.InventoryItems.FirstOrDefault(slot => slot.Id == (ItemId)wardId)).FirstOrDefault(); } Obj_AI_Base GetNearObject(String name, Vector3 pos, int maxDistance) { return ObjectManager.Get<Obj_AI_Base>().FirstOrDefault(x => x.Name == name && x.Distance(pos) <= maxDistance); } void Game_OnGameUpdate(EventArgs args) { int time = Environment.TickCount; if (Config.Item("AutoBushEnabled").GetValue<bool>() && Config.Item("AutoBushKey").GetValue<KeyBind>().Active) foreach (Obj_AI_Hero enemy in Helper.EnemyInfo.Where(x => x.Player.IsValid && !x.Player.IsVisible && !x.Player.IsDead && x.Player.Distance(ObjectManager.Player.ServerPosition) < 1000 && time - x.LastSeen < 2500).Select(x => x.Player)) { var bestWardPos = GetWardPos(enemy.ServerPosition); // var bestWardPos = GetWardPos(enemy.ServerPosition, 165, 2); if (bestWardPos != enemy.ServerPosition && bestWardPos != Vector3.Zero && bestWardPos.Distance(ObjectManager.Player.ServerPosition) <= 600) { int timedif = Environment.TickCount - _lastTimeWarded; if (timedif > 1250 && !(timedif < 2500 && GetNearObject("SightWard", bestWardPos, 200) != null)) //no near wards { var wardSlot = GetWardSlot(); if (wardSlot != null && wardSlot.Id != ItemId.Unknown) { ObjectManager.Player.Spellbook.CastSpell(wardSlot.SpellSlot, bestWardPos); _lastTimeWarded = Environment.TickCount; } } } } InventorySlot wardSpellSlot = null; if (Config.Item("placekey").GetValue<KeyBind>().Active) { wardSpellSlot = Items.GetWardSlot(); } else if (Config.Item("placekeypink").GetValue<KeyBind>().Active) { wardSpellSlot = Ward.GetPinkSlot(); } { if (wardSpellSlot == null || lastuseward + 1000 > Environment.TickCount) { return; } Vector3? nearestWard = Ward.FindNearestWardSpot(Drawing.ScreenToWorld(Game.CursorPos.X, Game.CursorPos.Y)); if (nearestWard != null) { if (wardSpellSlot != null) { Console.WriteLine("putting ward"); ObjectManager.Player.Spellbook.CastSpell(wardSpellSlot.SpellSlot, (Vector3)nearestWard); lastuseward = Environment.TickCount; } } WardSpot nearestSafeWard = Ward.FindNearestSafeWardSpot(Drawing.ScreenToWorld(Game.CursorPos.X, Game.CursorPos.Y)); if (nearestSafeWard != null) { if (wardSpellSlot != null) { ObjectManager.Player.IssueOrder(GameObjectOrder.MoveTo, nearestSafeWard.MovePosition); Wardspoting._PutSafeWard = nearestSafeWard; } } } if (Wardspoting._PutSafeWard != null && lastuseward + 1000 < Environment.TickCount) { wardSpellSlot = Items.GetWardSlot(); if (Math.Sqrt(Math.Pow(Wardspoting._PutSafeWard.ClickPosition.X - ObjectManager.Player.Position.X, 2) + Math.Pow(Wardspoting._PutSafeWard.ClickPosition.Y - ObjectManager.Player.Position.Y, 2)) <= 640.0) { if (Config.Item("placekey").GetValue<KeyBind>().Active) { wardSpellSlot = Items.GetWardSlot(); } else if (Config.Item("placekeypink").GetValue<KeyBind>().Active) { wardSpellSlot = Ward.GetPinkSlot(); } if (wardSpellSlot != null) { Console.WriteLine("putting ward2"); ObjectManager.Player.Spellbook.CastSpell(wardSpellSlot.SpellSlot, Wardspoting._PutSafeWard.ClickPosition); lastuseward = Environment.TickCount; } Wardspoting._PutSafeWard = null; } } } Vector3 GetWardPos(Vector3 lastPos, int radius = 165, int precision = 3) //maybe reverse autobushward code from the bots? { //old: Vector3 wardPos = enemy.Position + Vector3.Normalize(enemy.Position - ObjectManager.Player.Position) * 150; var count = precision; while (count > 0) { var vertices = radius; var wardLocations = new WardLocation[vertices]; var angle = 2 * Math.PI / vertices; for (var i = 0; i < vertices; i++) { var th = angle * i; var pos = new Vector3((float)(lastPos.X + radius * Math.Cos(th)), (float)(lastPos.Y + radius * Math.Sin(th)), 0); wardLocations[i] = new WardLocation(pos, NavMesh.IsWallOfGrass(pos, 5)); } var grassLocations = new List<GrassLocation>(); for (var i = 0; i < wardLocations.Length; i++) { if (!wardLocations[i].Grass) continue; if (i != 0 && wardLocations[i - 1].Grass) grassLocations.Last().Count++; else grassLocations.Add(new GrassLocation(i, 1)); } var grassLocation = grassLocations.OrderByDescending(x => x.Count).FirstOrDefault(); if (grassLocation != null) //else: no pos found. increase/decrease radius? { var midelement = (int)Math.Ceiling(grassLocation.Count / 2f); lastPos = wardLocations[grassLocation.Index + midelement - 1].Pos; radius = (int)Math.Floor(radius / 2f); } count--; } return lastPos; } class WardLocation { public readonly Vector3 Pos; public readonly bool Grass; public WardLocation(Vector3 pos, bool grass) { Pos = pos; Grass = grass; } } class GrassLocation { public readonly int Index; public int Count; public GrassLocation(int index, int count) { Index = index; Count = count; } } private void OnGameStart(EventArgs args) { Helper = new Helper(); Game.PrintChat( string.Format( "{0} v{1} loaded.", Assembly.GetExecutingAssembly().GetName().Name, Assembly.GetExecutingAssembly().GetName().Version ) ); } private void OnDraw(EventArgs args) { if (Config.Item("drawplaces").GetValue<Circle>().Active) { Ward.DrawWardSpots(); Ward.DrawSafeWardSpots(); } } } }
Texte modifié
Ouvrir un fichier
Lord's using LeagueSharp; using LeagueSharp.Common; using Color = SharpDX.Color; using SharpDX; using System; using System.Reflection; using System.Linq; using System.Collections.Generic; using System.Text; using System.Threading.Tasks; using System.Drawing; namespace PerfectWardReborn { internal class PerfectWardTracker { public static Helper Helper; static readonly List<KeyValuePair<int, String>> _wards = new List<KeyValuePair<int, String>> //insertion order { new KeyValuePair<int, String>(3340, "Warding Totem Trinket"), new KeyValuePair<int, String>(2301, "Eye of the Watchers"), new KeyValuePair<int, String>(2302, "Eye of the Oasis"), new KeyValuePair<int, String>(2303, "Eye of the Equinox"), //new KeyValuePair<int, String>(3205, "Quill Coat"), new KeyValuePair<int, String>(3207, "Spirit Of The Ancient Golem"), new KeyValuePair<int, String>(3154, "Wriggle's Lantern"), new KeyValuePair<int, String>(2049, "Sight Stone"), new KeyValuePair<int, String>(2045, "Ruby Sightstone"), //new KeyValuePair<int, String>(3160, "Feral Flare"), new KeyValuePair<int, String>(2050, "Explorer's Ward"), new KeyValuePair<int, String>(2044, "Stealth Ward"), new KeyValuePair<int, String>(2055, "Control Ward"), }; int _lastTimeWarded; private const int VK_LBUTTON = 1; private const int WM_KEYDOWN = 0x0100, WM_KEYUP = 0x0101, WM_CHAR = 0x0102, WM_SYSKEYDOWN = 0x0104, WM_SYSKEYUP = 0x0105, WM_MOUSEDOWN = 0x201; public static Menu Config; public static float lastuseward = 0; public class Wardspoting { public static WardSpot _PutSafeWard; } public PerfectWardTracker() { Game.OnStart += OnGameStart; Game.OnUpdate += Game_OnGameUpdate; Drawing.OnDraw += OnDraw; //Create the menu Config = new Menu("PerfectWardReborn", "PerfectWardReborn", true).SetFontStyle(FontStyle.Bold, Color.DarkSeaGreen); Config.AddSubMenu(new Menu("WardKey", "WardKey")); Config.SubMenu("WardKey").AddItem(new MenuItem("placekey", "NormalWard Key").SetValue(new KeyBind("Z".ToCharArray()[0], KeyBindType.Press))).SetFontStyle(FontStyle.Bold, Color.Green); Config.SubMenu("WardKey").AddItem(new MenuItem("placekeyconWard", "ControlWard Key").SetValue(new KeyBind("U".ToCharArray()[0], KeyBindType.Press))).SetFontStyle(FontStyle.Bold, Color.DarkOrange); Config.SubMenu("Drawing").AddItem(new MenuItem("drawplaces", "Draw ward places").SetValue(new Circle(true, System.Drawing.Color.FromArgb(100, 255, 0, 255)))); Config.SubMenu("Drawing").AddItem(new MenuItem("drawDistance", "Don't draw if the distance >")).SetValue(new Slider(2000, 10000, 1)); Config.AddSubMenu(new Menu("AutoBushRevealer", "AutoBushRevealer")); Config.SubMenu("AutoBushRevealer").AddItem(new MenuItem("AutoBushKey", "Key").SetValue(new KeyBind("C".ToCharArray()[0], KeyBindType.Press))); Config.SubMenu("AutoBushRevealer").AddItem(new MenuItem("AutoBushEnabled", "Enabled").SetValue(true)); Config.AddToMainMenu(); foreach (var ward in _wards) Config.SubMenu("Auto Bush Ward Type").AddItem(new MenuItem("AutoBush" + ward.Key, ward.Value).SetValue(true)); Game.OnUpdate += Game_OnGameUpdate; } InventorySlot GetWardSlot() { return _wards.Select(x => x.Key).Where(id => Config.Item("AutoBush" + id).GetValue<bool>() && Items.CanUseItem(id)).Select(wardId => ObjectManager.Player.InventoryItems.FirstOrDefault(slot => slot.Id == (ItemId)wardId)).FirstOrDefault(); } static public InventorySlot GetAnyWardSlot() { return _wards.Select(x => x.Key).Where(Items.CanUseItem).Select(wardId => ObjectManager.Player.InventoryItems.FirstOrDefault(slot => slot.Id == (ItemId)wardId)).FirstOrDefault(); } Obj_AI_Base GetNearObject(String name, Vector3 pos, int maxDistance) { return ObjectManager.Get<Obj_AI_Base>().FirstOrDefault(x => x.Name == name && x.Distance(pos) <= maxDistance); } void Game_OnGameUpdate(EventArgs args) { int time = Environment.TickCount; if (Config.Item("AutoBushEnabled").GetValue<bool>() && Config.Item("AutoBushKey").GetValue<KeyBind>().Active) foreach (Obj_AI_Hero enemy in Helper.EnemyInfo.Where(x => x.Player.IsValid && !x.Player.IsVisible && !x.Player.IsDead && x.Player.Distance(ObjectManager.Player.ServerPosition) < 1000 && time - x.LastSeen < 2500).Select(x => x.Player)) { var bestWardPos = GetWardPos(enemy.ServerPosition); // var bestWardPos = GetWardPos(enemy.ServerPosition, 165, 2); if (bestWardPos != enemy.ServerPosition && bestWardPos != Vector3.Zero && bestWardPos.Distance(ObjectManager.Player.ServerPosition) <= 600) { int timedif = Environment.TickCount - _lastTimeWarded; if (timedif > 1250 && !(timedif < 2500 && GetNearObject("SightWard", bestWardPos, 200) != null)) //no near wards { var wardSlot = GetWardSlot(); if (wardSlot != null && wardSlot.Id != ItemId.Unknown) { ObjectManager.Player.Spellbook.CastSpell(wardSlot.SpellSlot, bestWardPos); _lastTimeWarded = Environment.TickCount; } } } } InventorySlot wardSpellSlot = null; if (Config.Item("placekey").GetValue<KeyBind>().Active) { wardSpellSlot = Ward.GetWardSlot(); } else if (Config.Item("placekeyconWard").GetValue<KeyBind>().Active) { wardSpellSlot = Ward.GetConWardSlot(); } { if (wardSpellSlot == null || lastuseward + 1000 > Environment.TickCount) { return; } Vector3? nearestWard = Ward.FindNearestWardSpot(Drawing.ScreenToWorld(Game.CursorPos.X, Game.CursorPos.Y)); if (nearestWard != null) { if (wardSpellSlot != null) { Console.WriteLine("putting ward"); ObjectManager.Player.Spellbook.CastSpell(wardSpellSlot.SpellSlot, (Vector3)nearestWard); lastuseward = Environment.TickCount; } } WardSpot nearestSafeWard = Ward.FindNearestSafeWardSpot(Drawing.ScreenToWorld(Game.CursorPos.X, Game.CursorPos.Y)); if (nearestSafeWard != null) { if (wardSpellSlot != null) { ObjectManager.Player.IssueOrder(GameObjectOrder.MoveTo, nearestSafeWard.MovePosition); Wardspoting._PutSafeWard = nearestSafeWard; } } } if (Wardspoting._PutSafeWard != null && lastuseward + 1000 < Environment.TickCount) { wardSpellSlot = Items.GetWardSlot(); if (Math.Sqrt(Math.Pow(Wardspoting._PutSafeWard.ClickPosition.X - ObjectManager.Player.Position.X, 2) + Math.Pow(Wardspoting._PutSafeWard.ClickPosition.Y - ObjectManager.Player.Position.Y, 2)) <= 640.0) { if (Config.Item("placekey").GetValue<KeyBind>().Active) { wardSpellSlot = Ward.GetWardSlot(); } else if (Config.Item("placekeyconWard").GetValue<KeyBind>().Active) { wardSpellSlot = Ward.GetConWardSlot(); } if (wardSpellSlot != null) { Console.WriteLine("putting ward2"); ObjectManager.Player.Spellbook.CastSpell(wardSpellSlot.SpellSlot, Wardspoting._PutSafeWard.ClickPosition); lastuseward = Environment.TickCount; } Wardspoting._PutSafeWard = null; } } } Vector3 GetWardPos(Vector3 lastPos, int radius = 165, int precision = 3) //maybe reverse autobushward code from the bots? { //old: Vector3 wardPos = enemy.Position + Vector3.Normalize(enemy.Position - ObjectManager.Player.Position) * 150; var count = precision; while (count > 0) { var vertices = radius; var wardLocations = new WardLocation[vertices]; var angle = 2 * Math.PI / vertices; for (var i = 0; i < vertices; i++) { var th = angle * i; var pos = new Vector3((float)(lastPos.X + radius * Math.Cos(th)), (float)(lastPos.Y + radius * Math.Sin(th)), 0); wardLocations[i] = new WardLocation(pos, NavMesh.IsWallOfGrass(pos, 5)); } var grassLocations = new List<GrassLocation>(); for (var i = 0; i < wardLocations.Length; i++) { if (!wardLocations[i].Grass) continue; if (i != 0 && wardLocations[i - 1].Grass) grassLocations.Last().Count++; else grassLocations.Add(new GrassLocation(i, 1)); } var grassLocation = grassLocations.OrderByDescending(x => x.Count).FirstOrDefault(); if (grassLocation != null) //else: no pos found. increase/decrease radius? { var midelement = (int)Math.Ceiling(grassLocation.Count / 2f); lastPos = wardLocations[grassLocation.Index + midelement - 1].Pos; radius = (int)Math.Floor(radius / 2f); } count--; } return lastPos; } class WardLocation { public readonly Vector3 Pos; public readonly bool Grass; public WardLocation(Vector3 pos, bool grass) { Pos = pos; Grass = grass; } } class GrassLocation { public readonly int Index; public int Count; public GrassLocation(int index, int count) { Index = index; Count = count; } } private void OnGameStart(EventArgs args) { Helper = new Helper(); Game.PrintChat( string.Format( "{0} v{1} loaded.", Assembly.GetExecutingAssembly().GetName().Name, Assembly.GetExecutingAssembly().GetName().Version ) ); } private void OnDraw(EventArgs args) { if (Config.Item("drawplaces").GetValue<Circle>().Active) { Ward.DrawWardSpots(); Ward.DrawSafeWardSpots(); } } } }
Trouver la différence