Exemple #1
0
        public void GetModeTaiko()
        {
            string value = "ACTION is playing [https://osu.ppy.sh/b/1921936 xi remixed by cosMo@bousouP - FREEDOM DiVE [METAL DIMENSIONS] [Hyper]] <Taiko> +Hidden +HardRock";
            var    mode  = NowPlayingParser.GetMode(value);

            Assert.AreEqual(1, mode);
        }
Exemple #2
0
        public void GetModsMania()
        {
            string value = "ACTION is playing [https://osu.ppy.sh/b/1582621 Cranky - Chandelier - King [Royal]] <osu!mania> +Hidden +DoubleTime |7K|";
            var    mods  = NowPlayingParser.GetMods(value);

            string[] excepted = { "Hidden", "DoubleTime", "7K" };
            CollectionAssert.AreEqual(excepted, mods);
        }
Exemple #3
0
        public void GetModsCatch()
        {
            string value = "ACTION is playing [https://osu.ppy.sh/b/1599005 Co shu Nie - asphyxia (TV edit) [Ascendance & Spec's Nightmare]] <CatchTheBeat> +Hidden +DoubleTime";
            var    mods  = NowPlayingParser.GetMods(value);

            string[] excepted = { "Hidden", "DoubleTime" };
            CollectionAssert.AreEqual(excepted, mods);
        }
Exemple #4
0
        public void GetModsTaiko()
        {
            string value = "ACTION is playing [https://osu.ppy.sh/b/1921936 xi remixed by cosMo@bousouP - FREEDOM DiVE [METAL DIMENSIONS] [Hyper]] <Taiko> +Hidden +HardRock";
            var    mods  = NowPlayingParser.GetMods(value);

            string[] excepted = { "Hidden", "HardRock" };
            CollectionAssert.AreEqual(excepted, mods);
        }
Exemple #5
0
        public void GetModsStd()
        {
            string value = "ACTION is playing [https://osu.ppy.sh/b/2129143 Nashimoto Ui - AaAaAaAAaAaAAa [aAaAaaAaAaaA]] +Hidden +DoubleTime";
            var    mods  = NowPlayingParser.GetMods(value);

            string[] excepted = { "Hidden", "DoubleTime" };
            CollectionAssert.AreEqual(excepted, mods);
        }
Exemple #6
0
        public void GetModsStdNull()
        {
            string value = "ACTION is playing [https://osu.ppy.sh/b/2245774 Turbo - PADORU / PADORU [Gift]]";
            var    mods  = NowPlayingParser.GetMods(value);

            string[] excepted = { };
            CollectionAssert.AreEqual(excepted, mods);
        }
Exemple #7
0
        public void GetIdtd()
        {
            string     value = "ACTION is playing [https://osu.ppy.sh/b/2129143 Nashimoto Ui - AaAaAaAAaAaAAa [aAaAaaAaAaaA]] +Hidden +DoubleTime";
            NowPlaying np    = new NowPlaying();

            NowPlayingParser.GetSongId(np, value);
            Assert.AreEqual(2129143, np.Id);
        }
Exemple #8
0
        public void GetIdMania()
        {
            string     value = "ACTION is playing [https://osu.ppy.sh/b/1582621 Cranky - Chandelier - King [Royal]] <osu!mania> +Hidden +DoubleTime |7K|";
            NowPlaying np    = new NowPlaying();

            NowPlayingParser.GetSongId(np, value);
            Assert.AreEqual(1582621, np.Id);
        }
Exemple #9
0
        public void GetIdCatch()
        {
            string     value = "ACTION is playing [https://osu.ppy.sh/b/1599005 Co shu Nie - asphyxia (TV edit) [Ascendance & Spec's Nightmare]] <CatchTheBeat> +Hidden +DoubleTime";
            NowPlaying np    = new NowPlaying();

            NowPlayingParser.GetSongId(np, value);
            Assert.AreEqual(1599005, np.Id);
        }
Exemple #10
0
        public void GetIdTaiko()
        {
            string     value = "ACTION is playing [https://osu.ppy.sh/b/1921936 xi remixed by cosMo@bousouP - FREEDOM DiVE [METAL DIMENSIONS] [Hyper]] <Taiko> +Hidden +HardRock";
            NowPlaying np    = new NowPlaying();

            NowPlayingParser.GetSongId(np, value);
            Assert.AreEqual(1921936, np.Id);
        }
Exemple #11
0
 public void OnQueryMessage(object sender, IrcEventArgs e)
 {
     Console.WriteLine($"[PM] {e.Data.Nick} : {e.Data.Message}");
     // Check NowPlaying
     if (NowPlayingParser.IsNowPlaying(e.Data.Message))
     {
         NowPlaying np = NowPlayingParser.Parse(e.Data.Message);
         new CommandResult()
         {
             Type   = CommandResultType.MESSAGE,
             Result = $"Is Mapset: {np.IsMapSet} | Id: {np.Id}\n" +
                      $"{np.Beatmap} {np.Url}"
         };
     }
     if (e.Data.Message.StartsWith('!'))
     {
         CommandParser parser = new CommandParser();
         parser.Parse(e.Data.Nick, e.Data.Message, true).Send(irc, e.Data.Nick);
     }
 }
Exemple #12
0
        public void OnQueryAction(object sender, IrcEventArgs e)
        {
            Console.WriteLine($"[PM-ACTION] {e.Data.Nick} : {e.Data.Message}");

            // Check NowPlaying
            if (NowPlayingParser.IsNowPlaying(e.Data.Message))
            {
                NowPlaying np = NowPlayingParser.Parse(e.Data.Message);
                if (np.IsMapSet == true)
                {
                    new CommandResult()
                    {
                        Type   = CommandResultType.MESSAGE,
                        Result = "Sorry. We cannot calculate the mapset."
                    }.Send(irc, e.Data.Nick);
                    return;
                }
                try
                {
                    BanchoUserHistory c = HistoryCache.Get(e.Data.Nick);
                    if (c == null)
                    {
                        c = new BanchoUserHistory(np.Id);
                        HistoryCache.cache[e.Data.Nick] = c;
                    }
                    short _mode = np.Mode == 0 && c.RecentMode == 0 ? (short)0 : np.Mode;
                    if (np.NpType == NowPlayingType.LISTENING)
                    {
                        _mode = c.RecentMode;                         // There is no mode in text.
                    }

                    Calculator calc = LegacyUtil.GetCalculator(_mode, np.Id);
                    string[]   mods = np.Mods;
                    if (!calc.IsConvertable())
                    {
                        // Fallback Calculator
                        calc = LegacyUtil.GetCalculator((short)calc.Beatmap.BeatmapInfo.RulesetID, np.Id);
                    }

                    calc.Mod = Common.GetMods(mods, calc.Ruleset).ToArray();
                    CalculateMessage msg = new CalculateMessage(calc);
                    new CommandResult()
                    {
                        Type   = CommandResultType.MESSAGE,
                        Result = msg.ToString()
                    }.Send(irc, e.Data.Nick);

                    c.RecentBeatmapId = np.Id;
                    c.RecentMode      = np.Mode;
                    c.RecentMod       = new Mod[] { };
                }
                catch (Exception err)
                {
                    new CommandResult()
                    {
                        Type   = CommandResultType.MESSAGE,
                        Result = $"A Error found: {err.Message}"
                    }.Send(irc, e.Data.Nick);
                }
            }
            else if (e.Data.Message.StartsWith("\u0001ACTION is listening to "))
            {
                new CommandResult()
                {
                    Type   = CommandResultType.MESSAGE,
                    Result = "I'm sorry. We can't check/download the un-submitted map."
                }.Send(irc, e.Data.Nick);
            }
        }