Ejemplo n.º 1
0
        public static void SendCaHVoteInterface(this TSPlayer ts, CahGame cahGame)
        {
            if (cahGame.Judge == null)
            {
                cahGame.SetJudge();
            }

            string message = string.Join("\r\n",
                                         new string[]
            {
                RepeatSpaces(100),
                RepeatLineBreaks(10),
                "Cards against humanity",
                Utils.LineSegment,
                cahGame.Winner == null ? $"Waiting for the judge ({cahGame.Judge.Name}) to vote" : "",
                Utils.LineSegment,
                $"Winner of this round: {cahGame.Winner?.Name ??  ""}",
                SplitStringToFitScreen($"Question: {cahGame.Question}"),
                SplitStringToFitScreen($"Chosen answer: {cahGame.Winner?.GetCaHPlayer()?.Answer ?? ""}"),
                Utils.LineSegment,
                RepeatLineBreaks(50)
            });

            ts.SendData(PacketTypes.Status, message);
        }
Ejemplo n.º 2
0
 public static void Spectate(this TSPlayer ts, CahGame cahGame)
 {
     ts.GetCaHPlayer().Spectating = true;
     if (cahGame.Judge == ts)
     {
         cahGame.SetJudge();
     }
 }
Ejemplo n.º 3
0
        public override void Initialize()
        {
            if (!File.Exists(Config.SavePath))
            {
                config = new Config();
                config.Save();
            }
            else
            {
                config = Config.Load();
            }
            Commands.ChatCommands.Add(new Command("cah.play", Cah, "cah"));
            ServerApi.Hooks.ServerLeave.Register(this, OnLeave);

            ServerApi.Hooks.NetSendData.Register(this, OnSendData);
            CahGame        = new CahGame(config);
            timer.Elapsed += Timer_Elapsed;
        }
Ejemplo n.º 4
0
        public static void SendCaHScoreInterface(this TSPlayer ts, CahGame cahGame)
        {
            string message = string.Join("\r\n",
                                         new string[]
            {
                RepeatSpaces(100),
                RepeatLineBreaks(10),
                "Cards against humanity",
                Utils.LineSegment,
                "Current scores overview:",
                Utils.LineSegment,
                GetScores(),
                Utils.LineSegment,
                RepeatLineBreaks(50),
            });

            ts.SendData(PacketTypes.Status, message);
        }
Ejemplo n.º 5
0
        public static void SendCaHLobbyInterface(this TSPlayer ts, CahGame cahGame)
        {
            string message = string.Join("\r\n",
                                         new string[]
            {
                RepeatSpaces(100),
                RepeatLineBreaks(10),
                "Cards against humanity",
                Utils.LineSegment,
                $"Waiting for players to join",
                Utils.LineSegment,
                "Current players:",
                Utils.LineSegment,
                GetUsernames(),
                Utils.LineSegment,
                RepeatLineBreaks(50)
            });

            ts.SendData(PacketTypes.Status, message);
        }
Ejemplo n.º 6
0
        public static void SendCaHJudgeInterface(this TSPlayer ts, CahGame cahGame)
        {
            string message = string.Join("\r\n",
                                         new string[]
            {
                RepeatSpaces(100),
                RepeatLineBreaks(10),
                "Cards against humanity",
                Utils.LineSegment,
                $"You are the judge!",
                SplitStringToFitScreen("Type /cah win <number> to choose a winner for this round."),
                SplitStringToFitScreen($"Question: {cahGame.Question}"),
                $"Players to choose from:",
                Utils.LineSegment,
                GetAnswers(cahGame.Judge, true),
                Utils.LineSegment,
                RepeatLineBreaks(50)
            });

            ts.SendData(PacketTypes.Status, message);
        }
Ejemplo n.º 7
0
        public static void SendCaHGameInterface(this TSPlayer ts, CahGame cahGame)
        {
            string    Optionalmsg = "";
            CahPlayer cplr        = ts.GetCaHPlayer();

            if (cplr.Spectating)
            {
                Optionalmsg = "You are currently spectating and can't do anything.";
            }
            else if (cahGame.Judge == ts)
            {
                Optionalmsg = "You are the judge and cannot submit an answer for this round.";
            }
            else if (!cplr.Answered)
            {
                Optionalmsg = "Use /cah answer <answer>";
            }

            string message = string.Join("\r\n",
                                         new string[]
            {
                RepeatSpaces(100),
                RepeatLineBreaks(10),
                "Cards against humanity",
                Utils.LineSegment,
                $"Round {cahGame.Round}/{cahGame.MaxRounds} - ({cahGame.TimeLeft} seconds left to answer)",
                Utils.SplitStringToFitScreen("Question: " + cahGame.Question),
                Utils.LineSegment,
                "Given answers:",
                Utils.LineSegment,
                GetAnswers(cahGame.Judge, ts == cahGame.Judge),
                Utils.LineSegment,
                SplitStringToFitScreen(Optionalmsg),
                RepeatLineBreaks(50),
            });

            ts.SendData(PacketTypes.Status, message);
        }