Diff
checker
文本
文本
圖像
文檔
Excel
文件夾
Legal
Enterprise
桌面版
定價
登入
下載 Diffchecker 桌面版
比較文本
尋找兩個文字檔案之間的差異
工具
歷史
即時編輯器
摺疊未變更行
關閉換行
檢視
拆分
統一
比對精度
智能
單詞
字符
語法突出顯示
選擇語法
忽略
文字轉換
前往第一個差異
編輯輸入
Diffchecker Desktop
執行Diffchecker最安全的方式。取得Diffchecker桌面應用程式:您的差異永遠不會離開您的電腦!
取得桌面版
Untitled diff
建立於
10 年前
差異永不過期
清除
匯出
分享
解釋
29 刪除
行
總計
刪除
字符
總計
刪除
要繼續使用此功能,請升級到
Diff
checker
Pro
查看價格
277 行
全部複製
31 新增
行
總計
新增
字符
總計
新增
要繼續使用此功能,請升級到
Diff
checker
Pro
查看價格
279 行
全部複製
複製
已複製
複製
已複製
Original
Lord's
using LeagueSharp;
using LeagueSharp;
using LeagueSharp.Common;
using LeagueSharp.Common;
複製
已複製
複製
已複製
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;
複製
已複製
複製
已複製
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"),
複製
已複製
複製
已複製
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"),
複製
已複製
複製
已複製
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"),
複製
已複製
複製
已複製
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;
複製
已複製
複製
已複製
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
複製
已複製
複製
已複製
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();
複製
已複製
複製
已複製
foreach (var ward in _wards)
foreach (var ward in _wards)
複製
已複製
複製
已複製
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)
{
{
複製
已複製
複製
已複製
wardSpellSlot =
Items
.GetWardSlot();
wardSpellSlot =
Ward
.GetWardSlot();
}
}
複製
已複製
複製
已複製
else if (Config.Item("placekey
pink
").GetValue<KeyBind>().Active)
else if (Config.Item("placekey
conWard
").GetValue<KeyBind>().Active)
{
{
複製
已複製
複製
已複製
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)
{
{
複製
已複製
複製
已複製
wardSpellSlot =
Items
.GetWardSlot();
wardSpellSlot =
Ward
.GetWardSlot();
}
}
複製
已複製
複製
已複製
else if (Config.Item("placekey
pink
").GetValue<KeyBind>().Active)
else if (Config.Item("placekey
conWard
").GetValue<KeyBind>().Active)
{
{
複製
已複製
複製
已複製
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();
}
}
}
}
}
}
}
}
複製
已複製
複製
已複製
已保存差異
原始文本
開啟檔案
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(); } } } }
更改後文本
開啟檔案
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(); } } } }
尋找差異