Skip to content

Commit

Permalink
Add Recall + Camera + Potions + Ult
Browse files Browse the repository at this point in the history
  • Loading branch information
finndev committed Dec 31, 2015
1 parent 8dc0598 commit 51c5f85
Showing 1 changed file with 48 additions and 20 deletions.
68 changes: 48 additions & 20 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace ControlBuddy
{
internal class Program
{
public static int[] ControllerArray = {0, 1, 2, 3, 4};
public static int[] ControllerArray = { 0, 1, 2, 3, 4 };
public static Menu Menu;
public static Orbwalker.ActiveModes CurrentMode = Orbwalker.ActiveModes.None;
public static GamepadState Controller;
Expand All @@ -45,7 +45,7 @@ private static void Main(string[] args)
private static void Game_OnGameLoad(EventArgs args)
{
foreach (var c in
ControllerArray.Select(controlId => new Controller((UserIndex) controlId)).Where(c => c.IsConnected))
ControllerArray.Select(controlId => new Controller((UserIndex)controlId)).Where(c => c.IsConnected))
{
Controller = new GamepadState(c.UserIndex);
}
Expand Down Expand Up @@ -73,16 +73,6 @@ private static void Game_OnGameLoad(EventArgs args)

private static void Game_OnGameUpdate(EventArgs args)
{
var wp = ObjectManager.Player.Path.ToList();

//in case you manually click to move
if (wp.Count > 0 && ObjectManager.Player.Distance(wp[wp.Count - 1]) > 540)
{
PadPos = ObjectManager.Player.Position;
SetOrbwalkingMode(Orbwalker.ActiveModes.None);
return;
}

if (Controller == null || !Controller.Connected)
{
Chat.Print("Controller disconnected!");
Expand All @@ -93,14 +83,23 @@ private static void Game_OnGameUpdate(EventArgs args)
Controller.Update();
UpdateStates();

var p = ObjectManager.Player.ServerPosition.To2D() + Controller.LeftStick.Position/75;
// Camera
var camera = Camera.ScreenPosition +
Controller.RightStick.Position / 1500;

if (Camera.ScreenPosition.Distance(camera) > 5)
{
Camera.ScreenPosition = camera;
}

//Orbwalker Position
var p = ObjectManager.Player.ServerPosition.To2D() + Controller.LeftStick.Position / 75;
var pos = new Vector3(p.X, p.Y, ObjectManager.Player.Position.Z);

PadPos = pos;

if (ObjectManager.Player.Distance(pos) < 100)
{
Console.WriteLine("No distance");
return;
}

Expand All @@ -117,27 +116,56 @@ private static void UpdateStates()
return;
}

if (Controller.DPad.IsAnyPressed() || Controller.IsABXYPressed()) // Change mode command
// Orbwalker
if (Controller.IsABXYPressed())
{
if (Controller.DPad.Up || Controller.X)
if (Controller.X)
{
SetOrbwalkingMode(Orbwalker.ActiveModes.Combo);
}
else if (Controller.DPad.Left || Controller.A)
else if (Controller.A)
{
SetOrbwalkingMode(Orbwalker.ActiveModes.LaneClear);
}
else if (Controller.DPad.Right || Controller.Y)
else if (Controller.Y)
{
CurrentMode = Orbwalker.ActiveModes.Flee;
Player.IssueOrder(GameObjectOrder.MoveTo, PadPos);
}
else if (Controller.DPad.Down || Controller.B)
else if (Controller.B)
{
SetOrbwalkingMode(Orbwalker.ActiveModes.LastHit);
}
}

// Items
if (Controller.DPad.IsAnyPressed())
{
if (Controller.DPad.Up)
{
Player.Instance.Spellbook.CastSpell(SpellSlot.Recall, Player.Instance);
}

if (Controller.DPad.Right)
{
var hp = Player.Instance.InventoryItems.FirstOrDefault(w => w.Id == ItemId.Health_Potion);
if (hp != null)
{
hp.Cast(Player.Instance);
}
else
{
Chat.Print("No HP Pot available");
}
}

if (Controller.DPad.Left)
{
Player.Instance.Spellbook.CastSpell(SpellSlot.R, PadPos);
}
}


var s1 = ObjectManager.Player.Spellbook.GetSpell(SpellSlot.Summoner1);
var s2 = ObjectManager.Player.Spellbook.GetSpell(SpellSlot.Summoner2);

Expand Down Expand Up @@ -175,7 +203,7 @@ var enemy in
break;
case "flash": //LOL
Controller.Update();
var pos = ObjectManager.Player.ServerPosition.To2D() + Controller.LeftStick.Position/75;
var pos = ObjectManager.Player.ServerPosition.To2D() + Controller.LeftStick.Position / 75;
pos.Extend(ObjectManager.Player.ServerPosition.To2D(), 550);
ObjectManager.Player.Spellbook.CastSpell(spell.Slot, pos.To3D());
break;
Expand Down

0 comments on commit 51c5f85

Please sign in to comment.