Diff
checker
텍스트
텍스트
이미지
문서
Excel
폴더
Legal
Enterprise
데스크톱
요금제
로그인
데스크톱 앱 다운로드
텍스트 비교
두 텍스트 파일의 차이점을 찾아보세요
도구
기록
실시간 편집
변경 없는 행 숨기기
줄바꿈 비활성화
레이아웃
나란히 보기
합쳐 보기
비교 단위
스마트
단어
글자
구문 강조
언어 선택
제외
텍스트 변환
첫 변경으로
수정
Diffchecker Desktop
가장 안전하게 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(); } } } }
비교하기