﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using LeagueSharp;
using LeagueSharp.Common;

namespace Quinn
{
    class Program
    {
        public static Spell Q, W, E, R;
        public static Menu Config;
        private static Obj_AI_Hero Player;


        static void Main(string[] args)
        {
            CustomEvents.Game.OnGameLoad += OnGameLoad;
        }

        private static void OnGameLoad(EventArgs args)
        {
            Player = ObjectManager.Player;

            Q = new Spell(SpellSlot.Q, 1000);
            W = new Spell(SpellSlot.W, 1000);
            E = new Spell(SpellSlot.E, 1000);
            R = new Spell(SpellSlot.R, 1000);
            Config = new Menu("Exploit Framework", "Exploit", true);
            Config.AddSubMenu(new Menu("Exploits", "Exploits"));
            Config.AddSubMenu(new Menu("Emote", "Emote", false));
            Config.AddSubMenu(new Menu("Cast", "CON", false));
            Config.AddSubMenu(new Menu("Charged Cast", "CC", false));
            Config.AddSubMenu(new Menu("Interact", "Inter", false));
            Config.AddSubMenu(new Menu("Set Target", "SET", false));
            Config.AddSubMenu(new Menu("Move", "Move", false));
            Config.SubMenu("Emote").AddItem(new MenuItem("Block", "Block it?").SetValue(false));
            Config.SubMenu("CON").AddItem(new MenuItem("Block1", "Block it?").SetValue(false));
            Config.SubMenu("CC").AddItem(new MenuItem("Block2", "Block it?").SetValue(false));
            Config.SubMenu("Inter").AddItem(new MenuItem("Block3", "Block it?").SetValue(false));
            Config.SubMenu("SET").AddItem(new MenuItem("Block4", "Block it?").SetValue(false));
            Config.SubMenu("Move").AddItem(new MenuItem("Block5", "Block it?").SetValue(false));
            
            Config.AddToMainMenu();
            Game.OnGameUpdate += game_Update;
            Game.OnGameSendPacket += OnSend;

        }

        private static void OnSend(GamePacketEventArgs args)
        {
            if (Config.Item("Block").GetValue<bool>() && args.PacketData[0] == Packet.C2S.Emote.Header)
            {
                args.Process = false;
            }
            if (Config.Item("Block1").GetValue<bool>() && args.PacketData[0] == Packet.C2S.Cast.Header)
            {
                args.Process = false;
            }
            if (Config.Item("Block2").GetValue<bool>() && args.PacketData[0] == Packet.C2S.ChargedCast.Header)
            {
                args.Process = false;
            }
            if (Config.Item("Block3").GetValue<bool>() && args.PacketData[0] == Packet.C2S.InteractObject.Header)
            {
                args.Process = false;
            }
            if (Config.Item("Block4").GetValue<bool>() && args.PacketData[0] == Packet.C2S.SetTarget.Header)
            {
                args.Process = false;
            }
            if (Config.Item("Block5").GetValue<bool>() && args.PacketData[0] == Packet.C2S.Move.Header)
            {
                args.Process = false;
            }
        }

        private static void game_Update(EventArgs args)
        {
            // somthing here?
        }
    }
}
