private void handleMessage(object sender, MessageEventArgs e)
        {
            //info[0] = uniqueid
            //info[1] = command
            //info[2...] = args
            string[] info = e.Data.Split(';');
            info = info.Take(info.Length - 1).ToArray();
            //Wrong id assigned or error
            if (info[0] != config.id)
            {
                return;
            }
            string[] args = new string[info.Length - 2];
            for (int i = 2; i < info.Length; i++)
            {
                args[i - 2] = info[i];
            }
            switch (info[1])
            {
            case "heartbeat":
                WsClient.Send(string.Format("{0};heartbeat;", config.id));
                break;

            case "request-sid":
                WsClient.Send(string.Format("{0};sid;1;{1};", config.id, Context.Player.SessionID));
                break;

            case "request-build":
                WsClient.Send(string.Format("{0};build;1;{1};", config.id,
                                            HttpUtility.UrlEncode(Honey.LinkStructureBuilder(Context.Player.GetPlayerGear()))));
                break;

            case "request-dps":
                int   i     = 0;
                int[] range = (from s in args where int.TryParse(s, out i) select i).ToArray();
                if (range.Length == args.Length && range.Last() <= 4 && range.First() > 0)
                {
                    WsClient.Send(string.Format("{0};dps;{1};{2};", config.id, range.Length, getDamageString(range)));
                }
                else
                {
                    WsClient.Send(string.Format("{0};error;1;invalid-arguments;", config.id));
                }
                break;

            default:
                //Invalid command recieved
                break;
            }
        }
예제 #2
0
 private void ExportGameData()
 {
     if (MonsterHunter.Player.ZoneID != 0)
     {
         string sSession   = MonsterHunter.Player.SteamID != 0 ? $"steam://joinlobby/582010/{MonsterHunter.Player.SteamSession}/{MonsterHunter.Player.SteamID}" : "";
         Data   playerData = new Data
         {
             Name         = MonsterHunter.Player.Name,
             HR           = MonsterHunter.Player.Level,
             MR           = MonsterHunter.Player.MasterRank,
             BuildURL     = Honey.LinkStructureBuilder(MonsterHunter.Player.GetPlayerGear()),
             Session      = MonsterHunter.Player.SessionID,
             SteamSession = sSession,
             Playtime     = MonsterHunter.Player.PlayTime
         };
         dataExporter.ExportData(playerData);
     }
 }
예제 #3
0
        private void OnOpenInBrowserClick(object sender, RoutedEventArgs e)
        {
            string BuildLink = Honey.LinkStructureBuilder(MonsterHunter.Player.GetPlayerGear());

            Process.Start(BuildLink);
        }
예제 #4
0
        private void OnCopyToClipboardClick(object sender, RoutedEventArgs e)
        {
            string BuildLink = Honey.LinkStructureBuilder(MonsterHunter.Player.GetPlayerGear());

            Clipboard.SetData(DataFormats.Text, BuildLink);
        }