示例#1
0
        // Scuffed method to process actions/attacks.
        public async Task addAction(string attacker, string victim, string attackType, string damagetype, string swingType,
                                    string special, long damage, bool wasCrit)
        {
            if (loggingCombatEvents)
            {
                Log_Manager.write("Attacker: " + attacker + ", Victim: " + victim + ", Attack Type:" + attackType +
                                  ", Damage Type: " + damagetype + ", Swing Type: " + swingType + ", Special: " + special);
            }

            if (attacker == "YOU")
            {
                if (attackType == "Killing")
                {
                    killCount++;
                    if (killCount >= PP_Settings.lengthOfKillstreak)
                    {
                        manClient.queueAction(C_Actions.YOU_KILLED_ENOUGH);
                        killCount = 0;
                    }
                }
                else
                {
                    manClient.queueAction(C_Actions.YOU_HIT);
                }
            }
        }
示例#2
0
        public async Task begin()
        {
            Log_Manager.write("Beginning...");
            while (manClient == null)
            {
                Log_Manager.write("No manager, creating...");
                manClient = new Client_Manager();
                Log_Manager.write("Created.");
            }

            try
            {
                await manClient.connect();
            }
            catch (FileNotFoundException e)
            {
                Log_Manager.write("ERROR: Cannot find " + e.FileName);
                Log_Manager.write("Failed to connect to server.");
                return;
            }
            catch (Exception e)
            {
                Log_Manager.write(e.Message);
                Log_Manager.write("Failed to connect to server.");
            }

            manClient.begin();
        }
示例#3
0
        public Client_Manager()
        {
            isUpdating   = false;
            isRunning    = true;
            chartQuality = 0;

            remote = new Vibe_Remote();

            Log_Manager.write("Created Manager");
        }
示例#4
0
        public static async Task connectDevicesToClient(ButtplugClient client)
        {
            Log_Manager.write("Scanning for new devices...");
            await client.StartScanningAsync();

            Log_Manager.write("Client currently knows about these devices:");
            foreach (var device in client.Devices)
            {
                Log_Manager.write($"- {device.Name}");
            }
        }
示例#5
0
 public void setServerType(bool isEmbedded)
 {
     usingEmbeddedServer = isEmbedded;
     if (usingEmbeddedServer)
     {
         Log_Manager.write("Set to use embedded server. Reconnect to apply changes.");
     }
     else
     {
         Log_Manager.write("Set to use remote server. Reconnect to apply changes.");
     }
 }
示例#6
0
        public void check()
        {
            updateActiveTriggers();

            foreach (KeyValuePair <string, CustomTrigger> pair in ppTriggers)
            {
                // TODO Figure out how to grab the matched lines of text from the log.
                CustomTrigger trigger = pair.Value;
                //trigger.ResultsTab.Controls.

                Log_Manager.write(trigger.LastAudioAlert.ToString() + ", " + trigger.ToString());
            }
        }
示例#7
0
        private async Task connectRemoteServer()
        {
            try
            {
                webConnector = new ButtplugWebsocketConnector(new Uri("ws://localhost:12345/b******g"));
            }
            catch (FileNotFoundException e)
            {
                Log_Manager.write("ERROR: Cannot find " + e.FileName);
            }
            client = new ButtplugClient("Main Client", webConnector);

            await Connection_Manager.connectClientToServer(client);

            client.DeviceAdded += clientDeviceAdded;
        }
示例#8
0
 public static async Task connectClientToServer(ButtplugClient client)
 {
     try
     {
         await client.ConnectAsync();
     }
     catch (FileNotFoundException e)
     {
         Log_Manager.write("ERROR: Cannot find " + e.FileName);
     }
     catch (Exception e)
     {
         Log_Manager.write(e.Message);
         Log_Manager.write(e.InnerException.Message);
         Log_Manager.write(e.InnerException.InnerException.Message);
     }
 }
示例#9
0
        private void updateActiveTriggers()
        {
            foreach (KeyValuePair <string, CustomTrigger> pair in ppTriggers)
            {
                CustomTrigger trigger = pair.Value;

                bool triggerExists = ActGlobals.oFormActMain.CustomTriggers.ContainsKey(trigger.Key);
                if (!triggerExists)
                {
                    Log_Manager.write("Adding trigger, " + trigger.Key + ", to ACT.");
                    ActGlobals.oFormActMain.AddEditCustomTrigger(trigger);
                }
                else
                {
                    Log_Manager.write("Trigger, " + trigger.Key + ", already exists in ACT.");
                }
            }
        }
示例#10
0
        private void addSimpleTrigger(string regex, bool isTabbed = true)
        {
            bool alreadyExists = ppTriggers.ContainsKey(regex);

            if (!alreadyExists)
            {
                ppTriggers.Add(regex, new CustomTrigger(regex, (int)CustomTriggerSoundTypeEnum.None, "", false, "", true)
                {
                    Active   = true,
                    Tabbed   = isTabbed,
                    Category = CATEGORY
                });
            }
            else
            {
                Log_Manager.write("Trigger " + regex + " already exists in listTriggers.");
            }
        }
示例#11
0
        public async Task disconnect()
        {
            isRunning  = false;
            isUpdating = false;

            Log_Manager.write("Disconnecting...");
            try
            {
                await client.DisconnectAsync();
            }
            catch (Exception e)
            {
                Log_Manager.write(e.Message);
                Log_Manager.write(e.InnerException.Message);
                Log_Manager.write(e.InnerException.InnerException.Message);
                Log_Manager.write("Could not disconnect from server.");
                return;
            }

            Log_Manager.write("Disconnected.");
        }
示例#12
0
        public async Task scanForPlugs()
        {
            if (!isScanning)
            {
                if (client.Connected)
                {
                    isScanning = true;
                    await Connection_Manager.connectDevicesToClient(client);

                    isScanning = false;
                }
                else
                {
                    Log_Manager.write(C_Messages.DEVICE_SCAN_FAIL + C_Messages.CLIENT_NOT_CONNECTED);
                }
            }
            else
            {
                Log_Manager.write("Already scanning for new devices.");
            }
        }
示例#13
0
        public async Task reconnect()
        {
            await manClient.disconnect();

            try
            {
                await manClient.connect();
            }
            catch (FileNotFoundException e)
            {
                Log_Manager.write("ERROR: Cannot find " + e.FileName);
                Log_Manager.write("Failed to connect to server.");
                return;
            }
            catch (Exception e)
            {
                Log_Manager.write(e.Message);
                Log_Manager.write("Failed to connect to server.");
            }

            manClient.begin();
        }
示例#14
0
        public async Task connect()
        {
            Log_Manager.write("Connecting to server...");
            try
            {
                await connectServer();
            }
            catch (FileNotFoundException e)
            {
                Log_Manager.write("ERROR: Cannot find " + e.FileName);
                Log_Manager.write("Failed to connect to server.");
                return;
            }
            catch (Exception e)
            {
                Log_Manager.write(e.Message);
                Log_Manager.write("Failed to connect to server.");
                return;
            }
            Log_Manager.write(C_Messages.CLIENT_CONNECTED);

            await scanForPlugs();
        }
示例#15
0
        public double parseLogLine(string line)
        {
            Regex           rxBonusExp = new Regex(RX_BONUS_EXPERIENCE);
            Regex           rxInteger  = new Regex(RX_INTEGER);
            MatchCollection matches    = rxBonusExp.Matches(line);

            foreach (Match match in matches)
            {
                int value = Int32.Parse(Regex.Match(match.Value, RX_INTEGER).Value);
                Log_Manager.write("You received " + value + "% bonus experience.");

                if (value < 100)
                {
                    return((double)value / 100);
                }
                else
                {
                    return((double)100);
                }
            }

            return(-1);
        }
示例#16
0
 private static void clientDeviceAdded(object sender, DeviceAddedEventArgs args)
 {
     Log_Manager.write($"Device ${args.Device.Name} connected");
 }
示例#17
0
 private void clientDeviceAdded(object sender, DeviceAddedEventArgs args)
 {
     Log_Manager.write($"Device ${args.Device.Name} connected");
     remote.buzz(50);
 }
示例#18
0
 public void stopScanning()
 {
     client.StopScanningAsync();
     Log_Manager.write("Stopped scanning for new devices.");
 }