Пример #1
0
 public static void stopSmurf(Smurf smurf)
 {
     try {
         Smurf containsSmurf = smurfs.First(pendSmurf => pendSmurf.username == smurf.username && pendSmurf.region == smurf.region);
         if (containsSmurf != null)
         {
             int indexNum = smurfs.IndexOf(containsSmurf);
             containsSmurf.Dispose();
             smurfs.RemoveAt(indexNum);
         }
         updateStatus();
     }catch (Exception ex) {
     }
 }
Пример #2
0
        public static void updateSmurfData(Smurf smurf)
        {
            dynamic smurfPacket = new JObject();

            smurfPacket.type  = "smurfdbupdate";
            smurfPacket.token = App.Client.Token;
            smurfPacket.smurf = JToken.FromObject(smurf);
            smurfPacket.smurf.currentLevel = smurf.currentLevel;
            smurfPacket.smurf.currentip    = smurf.currentip;
            smurfPacket.smurf.currentrp    = smurf.currentrp;
            string buffer = smurfPacket.ToString(Formatting.None);

            sendqueue.Add(buffer);
        }
Пример #3
0
 private void OnTimedEvent(object source, ElapsedEventArgs e)
 {
     if (!_requestStop)
     {
         errorTimer--;
         if (errorTimer <= 0)
         {
             Smurf containsSmurf = SmurfManager.smurfs.First(pendSmurf => pendSmurf.username == username && pendSmurf.region == region);
             if (containsSmurf != null)
             {
                 Logger.Push("Restarting smurf because didn't recieve any message for a long time!", "warning", username);
                 errorTimer = 15;
                 restartHard();
             }
         }
     }
 }
Пример #4
0
        public static void addSmurf(Smurf newSmurf)
        {
            bool containsSmurf = smurfs.Any(smurf => smurf.username == newSmurf.username && smurf.region == newSmurf.region);

            if (!containsSmurf)
            {
                smurfs.Add(newSmurf);
                Logger.Push("Smurf " + newSmurf.username + " registered to system.", "info");
                newSmurf.loadSelf();
                newSmurf.start();
            }
            else
            {
                Logger.Push("Smurf " + newSmurf.username + " already registered to system!", "info");
                newSmurf.start();
            }
            updateStatus();
        }
Пример #5
0
        //Timer Checker



        public void init(string _username, string _password, int _desiredLevel, Region _region, QueueTypes _queue, Smurf _smurf)
        {
            //Init
            username     = _username;
            password     = _password;
            desiredLevel = _desiredLevel;
            region       = _region;
            queue        = _queue;
            smurf        = _smurf;
            isHost       = _smurf.isHost;



            //Listeners
            connection.OnConnect          += new LoLConnection.OnConnectHandler(connection_OnConnect);
            connection.OnDisconnect       += new LoLConnection.OnDisconnectHandler(connection_OnDisconnect);
            connection.OnError            += new LoLConnection.OnErrorHandler(connection_OnError);
            connection.OnLogin            += new LoLConnection.OnLoginHandler(connection_OnLogin);
            connection.OnLoginQueueUpdate += new LoLConnection.OnLoginQueueUpdateHandler(connection_OnLoginQueueUpdate);
            connection.OnMessageReceived  += new LoLConnection.OnMessageReceivedHandler(connection_OnMessageReceived);

            //Disposal
            m_disposed = false;
        }
Пример #6
0
        private async void messageHandler(JToken msg)
        {
            switch (msg.Value <string>("type"))
            {
            case "status":
                string remoteCount = msg.Value <string>("remoteLength");
                Remotes = "Remote Controllers: " + remoteCount;
                SystemSounds.Exclamation.Play();
                SmurfManager.updateStatus();
                break;

            case "cmdWrite":
                string input = msg.Value <string>("text");
                cmd.writeLine(input);
                break;

            case "updateSettings":
                Logger.Push("Settings Updated", "info");
                dynamic settings = msg.Value <dynamic>("settings");

                App.Client.UserData.Settings.PacketSearch    = (bool)settings.packetSearch;
                Properties.Settings.Default.packetSearch     = App.Client.UserData.Settings.PacketSearch;
                App.Client.UserData.Settings.BuyBoost        = (bool)settings.buyBoost;
                Properties.Settings.Default.buyBoost         = App.Client.UserData.Settings.BuyBoost;
                App.Client.UserData.Settings.Reconnect       = (bool)settings.reconnect;
                Properties.Settings.Default.reconnect        = App.Client.UserData.Settings.Reconnect;
                App.Client.UserData.Settings.DisableGpu      = (bool)settings.disableGpu;
                Properties.Settings.Default.disableGpu       = App.Client.UserData.Settings.DisableGpu;
                App.Client.UserData.Settings.ManualInjection = (bool)settings.manualInjection;
                Properties.Settings.Default.manualInjection  = App.Client.UserData.Settings.ManualInjection;
                Properties.Settings.Default.Save();

                App.gameContainer.Dispatcher.Invoke(new Action(() =>
                {
                    if (App.Client.UserData.Settings.DisableGpu)
                    {
                        App.gameContainer.Show();
                        FileManager.LockCamera();
                    }
                    else
                    {
                        if (App.gameContainer.runningCount() == 0)
                        {
                            App.gameContainer.Hide();
                        }
                    }
                }), DispatcherPriority.ContextIdle);



                SystemSounds.Asterisk.Play();
                if (!underSettingsNotify)
                {
                    underSettingsNotify = true;
                    string _text = Text;
                    Text = _text + ", Settings updated.";
                    await Task.Delay(TimeSpan.FromSeconds(3));

                    if (Text == _text + ", Settings updated.")
                    {
                        Text = _text;
                    }
                    underSettingsNotify = false;
                }
                break;

            case "smurf":
                double remainingTrialSm = Math.Round((double)((App.Client.UserData.Trial - App.Client.Date) / 60000));
                bool   valid            = SmurfManager.smurfs.Count == 0 || App.Client.UserData.Type == (int)2 || (App.Client.UserData.Type == (int)0 && remainingTrialSm > 0);
                if (msg.Value <string>("action") == "start")
                {
                    if (valid)
                    {
                        Smurf newSmurf = msg.Value <dynamic>("smurf").ToObject <Smurf>();
                        SmurfManager.addSmurf(newSmurf);
                        SmurfManager.updateStatus();
                    }
                }
                else
                {
                    Smurf oldSmurf = msg.Value <dynamic>("smurf").ToObject <Smurf>();
                    SmurfManager.stopSmurf(oldSmurf);
                    SmurfManager.updateStatus();
                }
                break;

            case "group":
                double remainingTrialGm = Math.Round((double)((App.Client.UserData.Trial - App.Client.Date) / 60000));
                if (App.Client.UserData.Type == (int)2 || (App.Client.UserData.Type == (int)0 && remainingTrialGm > 0))
                {
                    if (msg.Value <string>("action") == "start")
                    {
                        Group newGroup = msg.Value <dynamic>("group").ToObject <Group>();
                        var   list     = msg.Value <dynamic>("group");

                        SmurfManager.addGroup(newGroup);
                        SmurfManager.updateStatus();
                    }
                    else
                    {
                        Group newGroup = msg.Value <dynamic>("group").ToObject <Group>();
                        SmurfManager.stopGroup(newGroup);
                        SmurfManager.updateStatus();
                    }
                }
                break;
            }
        }