Example #1
0
        public void NotifySurrender(IChampion starter, byte flag, byte yesVotes, byte noVotes, byte maxVotes, TeamId team,
                                    float timeOut)
        {
            var surrender = new Surrender(starter, flag, yesVotes, noVotes, maxVotes, team, timeOut);

            _packetHandlerManager.BroadcastPacketTeam(team, surrender, Channel.CHL_S2C);
        }
Example #2
0
        public bool HandlePacket(Peer peer, byte[] data, Game game)
        {
            Surrender surrender = new Surrender();

            game.PacketHandlerManager.broadcastPacketTeam(TeamId.TEAM_BLUE, surrender, Channel.CHL_S2C);
            return(true);
        }
Example #3
0
        public override bool HandlePacket(Peer peer, byte[] data)
        {
            var       c         = _pm.GetPeerInfo(peer).Champion;
            Surrender surrender = new Surrender(c, 0x03, 1, 0, 5, c.Team, 10.0f);

            _game.PacketHandlerManager.broadcastPacketTeam(TeamId.TEAM_BLUE, surrender, Channel.CHL_S2C);
            return(true);
        }
Example #4
0
    private Surrender()
    {
        if (_instance != null)
        {
            return;
        }

        _instance = this;
    }
        public override void SurrenderEvent()
        {
            var surrenderMessage = new Surrender();
            var wrapperMessage   = new WrapperMessage {
                Surrender = surrenderMessage
            };

            ConnectionHandler.Instance.SendWebsocketMessage(wrapperMessage);
        }
        public ActionResult <bool> Surrender([FromBody] Surrender data)
        {
            var game = (from value in iRepository.GetSpellen()
                        where value.Token.Equals(data.gameToken)
                        select value).FirstOrDefault();

            game.Surrender(data.playerToken);

            iRepository.FinishGame(game);

            return(true);
        }
Example #7
0
    public string GenerateSurrenderStory(Surrender resolve)
    {
        string output = "\n";

        if (resolve.actionOwner.name.Equals(GameManagerSimulator.instance.countries[0].name))
        {
            output += "The war had been tough and we had lost many men. The enemy was too strong so we had to surrender";
        }
        else if (resolve.actionOwner.name.Equals(GameManagerSimulator.instance.countries[1].name))
        {
            output += "We had beaten the enemy to a pulp and to the point where the cowards no longer had a will to fight.\n Finally they surrendered to our military might";
        }
        return(output);
    }
Example #8
0
        public LogicSelector(IChampLogic my, Menu menu)
        {
            myChamp     = my;
            current     = MainLogics.Nothing;
            surviLogic  = new Survi(this);
            recallLogic = new Recall(this, menu);
            pushLogic   = new Push(this);
            loadLogic   = new Load(this);
            combatLogic = new Combat(this);
            surrender   = new Surrender();

            Core.DelayAction(() => loadLogic.SetLane(), 1000);
            localAwareness = new LocalAwareness();
            if (MainMenu.GetMenu("AB").Get <CheckBox>("debuginfo").CurrentValue)
            {
                Drawing.OnEndScene += Drawing_OnDraw;
            }
            myChamp.Logic = this;
            Core.DelayAction(Watchdog, 3000);
        }
        public ActionResult <bool> FinishAccept([FromBody] Surrender data)
        {
            try
            {
                var game = (from value in iRepository.GetSpellen()
                            where value.Token.Equals(data.gameToken)
                            select value).FirstOrDefault();

                var player = "";

                if (data.playerToken == game.PlayerToken1)
                {
                    player = "player1DeleteCheck";
                }
                else
                {
                    player = "player2DeleteCheck";
                }

                if (iRepository.AcceptSurrender(player, game))
                {
                    //Check if both parties have agreed, remove the game
                    if (iRepository.BothPlayersAcceptedEnd(game))
                    {
                        //Update the user wins
                        iRepository.RemoveGame(game.Token);
                        return(true);
                    }
                    return(false);
                }
                return(false);
            }
            catch (Exception e)
            {
                return(false);
            }
        }
Example #10
0
        private static void OnLoad(EventArgs args)
        {
            UtliMenu = MainMenu.AddMenu("KappaUtility", "KappaUtility");
            UtliMenu.AddGroupLabel("Global Settings [Must F5 To Take Effect]");
            UtliMenu.Add("AutoLvlUp", new CheckBox("Enable AutoLvlUp"));
            UtliMenu.Add("AutoQSS", new CheckBox("Enable AutoQSS"));
            UtliMenu.Add("AutoTear", new CheckBox("Enable AutoTear"));
            UtliMenu.Add("AutoReveal", new CheckBox("Enable AutoReveal"));
            UtliMenu.Add("GanksDetector", new CheckBox("Enable GanksDetector"));
            UtliMenu.Add("Tracker", new CheckBox("Enable Tracker"));
            UtliMenu.Add("SkinHax", new CheckBox("Enable SkinHax"));
            UtliMenu.Add("Spells", new CheckBox("Enable SummonerSpells"));
            UtliMenu.Add("Potions", new CheckBox("Enable Potions"));
            UtliMenu.Add("Offensive", new CheckBox("Enable Offensive Items"));
            UtliMenu.Add("Defensive", new CheckBox("Enable Defensive Items"));
            if (UtliMenu["AutoLvlUp"].Cast <CheckBox>().CurrentValue)
            {
                AutoLvlUp.OnLoad();
            }
            if (UtliMenu["AutoQSS"].Cast <CheckBox>().CurrentValue)
            {
                AutoQSS.OnLoad();
            }
            if (UtliMenu["AutoTear"].Cast <CheckBox>().CurrentValue)
            {
                AutoTear.OnLoad();
            }
            if (UtliMenu["AutoReveal"].Cast <CheckBox>().CurrentValue)
            {
                AutoReveal.OnLoad();
                loadedreveal = true;
            }
            if (UtliMenu["GanksDetector"].Cast <CheckBox>().CurrentValue)
            {
                GanksDetector.OnLoad();
            }
            if (UtliMenu["Tracker"].Cast <CheckBox>().CurrentValue)
            {
                Tracker.OnLoad();
                Surrender.OnLoad();
                loadedtrack = true;
            }
            if (UtliMenu["SkinHax"].Cast <CheckBox>().CurrentValue)
            {
                SkinHax.OnLoad();
            }
            if (UtliMenu["Spells"].Cast <CheckBox>().CurrentValue)
            {
                Spells.OnLoad();
                Flash.FOnLoad();
            }
            if (UtliMenu["Potions"].Cast <CheckBox>().CurrentValue)
            {
                Potions.OnLoad();
            }
            if (UtliMenu["Offensive"].Cast <CheckBox>().CurrentValue)
            {
                Offensive.OnLoad();
            }
            if (UtliMenu["Defensive"].Cast <CheckBox>().CurrentValue)
            {
                Defensive.OnLoad();
            }

            Game.OnTick        += GameOnTick;
            Drawing.OnEndScene += OnEndScene;
            Drawing.OnDraw     += DrawingOnDraw;
        }
Example #11
0
        public async void Start()
        {
            var ip          = _credentials.serverIp;
            var port        = Convert.ToUInt16(_credentials.serverPort);
            var blowfishKey = Convert.FromBase64String(_credentials.encryptionKey);

            _mySummonerId = Convert.ToUInt64(_credentials.summonerId);

            _blowfish = new BlowFish(blowfishKey);

            // Initialize ENetCS
            Library.Initialize();

            // Initialize Log Class.
            Log.Initialize();

            _enetHost = new Host();
            _enetHost.Create(null, 1);

            var address = new Address();

            address.SetHost(ip);
            address.Port = port;

            _peer = _enetHost.Connect(address, 8);

            _movementTimer          = new Timer();
            _movementTimer.Interval = TimeSpan.FromSeconds(6).TotalMilliseconds;
            _movementTimer.Elapsed += (s, e) =>
            {
                if (_gameStarted && _myNetId != 0)
                {
                    if (!_isOdin)
                    {
                        //                      Log.Write("[{0}] Attempting to move down mid.", _myPlayer);
                        Send(Deserialize <MovementRequest>(MovementRequest.CreateCoop(_myNetId)));
                    }
                    else
                    {
                        if (_isOrder && _captures == 0 && (DateTime.Now - _gameStartTime).TotalSeconds >= 90)
                        {
                            Log.Write("[{0}] Capturing point A", _myPlayer);
                            Send(Deserialize <CapturePoint>(CapturePoint.Create(_myNetId, _capturePoints[0])));
                        }
                        else if (_isOrder && _captures == 8)
                        {
                            if ((DateTime.Now - _gameStartTime).TotalMilliseconds >= 170000)
                            {
                                Send(Deserialize <CapturePoint>(CapturePoint.Create(_myNetId, _capturePoints[4])));
                            }
                            else
                            {
                                Send(Deserialize <MovementRequest>(MovementRequest.CreateOdin(_myNetId, _move)));
                                _move = !_move;
                            }
                        }
                        else if (!_isOrder)
                        {
                            Send(Deserialize <MovementRequest>(MovementRequest.CreateOdin(_myNetId, _move)));
                            _move = !_move;
                        }
                    }

                    if ((DateTime.Now - _gameStartTime).TotalMinutes >= 20)
                    {
//                        Log.Write("[{0}] Attempting to surrender.", _myPlayer);
                        Send(Deserialize <Surrender>(Surrender.Create(_myNetId, 1)));
                    }
                }
            };

            _movementTimer.Start();
            while (_enetHost.Service(1) >= 0)
            {
                Event enetEvent;
                try
                {
                    while (_enetHost.CheckEvents(out enetEvent) > 0)
                    {
                        switch (enetEvent.Type)
                        {
                        case EventType.Connect:
                            OnConnect(blowfishKey);
                            break;

                        case EventType.Receive:
                            OnRecieve(enetEvent);
                            break;

                        case EventType.Disconnect:
                            break;
                        }
                    }
                }catch (InvalidOperationException)
                {
                    break;
                }
            }
        }
Example #12
0
        public static void Execute()
        {
            UtliMenu = MainMenu.AddMenu("CH汉化活化剂", "KappaUtility");
            UtliMenu.AddLabel("CH汉化 Kappa活化剂,有同样功能的脚本最好不要一起开");
            UtliMenu.AddGroupLabel("全局设置 [需要F5才生效]");
            UtliMenu.Add("AutoLvlUp", new CheckBox("开启自动加点"));
            UtliMenu.Add("AutoQSS", new CheckBox("自动解控"));
            UtliMenu.Add("AutoTear", new CheckBox("开启女神叠加"));
            UtliMenu.Add("AutoReveal", new CheckBox("开启自动插眼"));
            UtliMenu.Add("GanksDetector", new CheckBox("开启Gank提示"));
            UtliMenu.Add("Tracker", new CheckBox("开启记录器"));
            UtliMenu.Add("SkinHax", new CheckBox("开启换肤"));
            UtliMenu.Add("Spells", new CheckBox("开启召唤师技能"));
            UtliMenu.Add("Potions", new CheckBox("开启吃药"));
            UtliMenu.Add("Offensive", new CheckBox("开启进攻物品"));
            UtliMenu.Add("Defensive", new CheckBox("开启防守物品"));
            if (UtliMenu["AutoLvlUp"].Cast <CheckBox>().CurrentValue)
            {
                AutoLvlUp.OnLoad();
            }
            if (UtliMenu["AutoQSS"].Cast <CheckBox>().CurrentValue)
            {
                AutoQSS.OnLoad();
            }
            if (UtliMenu["AutoTear"].Cast <CheckBox>().CurrentValue)
            {
                AutoTear.OnLoad();
            }
            if (UtliMenu["AutoReveal"].Cast <CheckBox>().CurrentValue)
            {
                AutoReveal.OnLoad();
                loadedreveal = true;
            }
            if (UtliMenu["GanksDetector"].Cast <CheckBox>().CurrentValue)
            {
                GanksDetector.OnLoad();
            }
            if (UtliMenu["Tracker"].Cast <CheckBox>().CurrentValue)
            {
                Tracker.OnLoad();
                Surrender.OnLoad();
                loadedtrack = true;
            }
            if (UtliMenu["SkinHax"].Cast <CheckBox>().CurrentValue)
            {
                SkinHax.OnLoad();
            }
            if (UtliMenu["Spells"].Cast <CheckBox>().CurrentValue)
            {
                Spells.OnLoad();
                Flash.FOnLoad();
            }
            if (UtliMenu["Potions"].Cast <CheckBox>().CurrentValue)
            {
                Potions.OnLoad();
            }
            if (UtliMenu["Offensive"].Cast <CheckBox>().CurrentValue)
            {
                Offensive.OnLoad();
            }
            if (UtliMenu["Defensive"].Cast <CheckBox>().CurrentValue)
            {
                Defensive.OnLoad();
            }

            Game.OnTick        += GameOnTick;
            Drawing.OnEndScene += OnEndScene;
            Drawing.OnDraw     += DrawingOnDraw;
        }