コード例 #1
0
 public static ExtraPlayerData InfectPlayer(ExtraPlayerData Alive)
 {
     if (!ZombiePlugin.CureOn && !Alive.Infected)
     {
         if (Alive.Survivor)
         {
             Player.UniversalChat("[Zombie Survival]: " + Colors.red + Alive.Player.Username + " failed the Survivor challenge!");
             int AmountTaken = 0;
             try
             {
                 AmountTaken = (int)Math.Round(Alive.Player.Money / (Random.NextDouble() * 100));
             }
             catch { AmountTaken = Alive.Player.Money / 2; }//Divide by zero can occur here
             TakeMoney(Alive.Player, AmountTaken); //Exponential function, 1 lets them have nearly all their money, 0.01 removes all their money
             //Is also less tough on players with lower money, while more tougher on players with moar money
         }
         Alive.Infected             = true;
         Alive.Player.IsHeadFlipped = true;
         Alive.Player.DisplayName   = Colors.red + "Undeaad";
         return(Alive);
     }
     else if (ZombiePlugin.CureOn && Alive.Infected)
     {
         DisinfectPlayer(Alive);
     }
     return(null);
 }
コード例 #2
0
        public static void DisinfectRandomPlayer(List <ExtraPlayerData> ExtraPlayerData)
        {
            ExtraPlayerData e = ExtraPlayerData[Random.Next(0, ExtraPlayerData.Count())];

            if (e.Infected)
            {
                DisinfectPlayer(e);
            }
        }
コード例 #3
0
 public static ExtraPlayerData DisinfectPlayer(ExtraPlayerData Alive)
 {
     if (Alive.Infected)
     {
         Alive.Infected             = false;
         Alive.Player.IsHeadFlipped = false;
         Alive.Player.DisplayName   = Alive.Player.Username;
     }
     return(Alive);
 }
コード例 #4
0
 public static void SendUserType(ExtraPlayerData p)
 {
     /*if( p == null ) return;
      *
      * Packet packet = new Packet();
      * if (p.Referee)
      *  packet.bytes = new byte[2] { 15, 100 };
      * else
      *  packet.bytes = new byte[2] { 15, 0 };
      * p.Player.SendPacket(packet);*/
 }
コード例 #5
0
 public static void ResetPlayer(ExtraPlayerData p)
 {
     p.Player.ExtraData.CreateIfNotExist("Voted", false);
     p.Player.ExtraData["Voted"] = false;
     p.Player.IsHeadFlipped      = false;
     p.Infected           = false;
     p.AmountOfBlocksLeft = Random.Next(40, 80);
     p.Player.DisplayName = p.Player.Color + p.Player.Username;
     p.Survivor           = false;
     p.AmountInfected     = 0;
     p.AmountMoved        = 0;
 }
コード例 #6
0
 public static void InfectPlayer(Player Infected, ExtraPlayerData Alive)
 {
     InfectPlayer(Alive);
     try
     {
         if (!ZombiePlugin.CureOn)
         {
             ZombieHelper.DisplayInfectMessage(Alive.Player, Infected);
         }
         else
         {
             ZombieHelper.DisplayDisinfectMessage(Alive.Player, Infected);
         }
     }
     catch { }
 }
コード例 #7
0
        public void OnConnect(Player Player, ConnectionEventArgs args)
        {
            if (Player.Group.Permission < ServerSettings.GetSettingInt("StaffTimePermission"))
            {
                try
                {
                    string picUri = "http://s3.amazonaws.com/MinecraftSkins/" + Player.Username + ".png";
                    WebRequest requestPic = WebRequest.Create(picUri);
                    WebResponse responsePic = requestPic.GetResponse();
                    Image webImage = Image.FromStream(responsePic.GetResponseStream());

                    foreach (string s in Directory.GetFiles("bannedskins", "*.png"))
                    {
                        if (ZombieHelper.CompareImages(ZombieHelper.GetBitmap(s), (Bitmap)webImage))
                        {
                            Player.Kick("This skin is not allowed to be used on this server!");
                            args.Cancel();
                            return;
                        }
                    }
                }
                catch { } //404 if invalid skin, do nothing
            }

            if (OmniBan.Contains(Player.Username.ToLower()) || OmniBan.Contains(Player.Ip + ""))
            {
                Player.Kick("You have been omnibanned from this server!");
                args.Cancel();
                return;
            }

            if (ZombieLevel != null)
                if (Player.Level != ZombieLevel)
                    Player.Level = ZombieLevel;

            ExtraPlayerData l = new ExtraPlayerData(Player);
            ExtraPlayerData.Add(l);
            ZombieHelper.ResetPlayer(l);
            if (!ZombieRoundEnabled && !Voting)
            {
                if (AmountOfMinutesElapsed - 1 != 2)
                    Player.SendMessage("[Zombie Survival]: " + Colors.red + "Round starts in " + -(AmountOfMinutesElapsed - 2) + ":" + (-(AmountOfSecondsElapsed % 60 - 60)).ToString("D2") + " minutes [Gamemode: " + ZombieHelper.GetGamemode(Gamemode) + "]");
            }
            else if (!Voting)
            {
                l.Infected = true;
                l.Player.IsHeadFlipped = true;
                l.Player.DisplayName = Colors.red + "Undeaad";
                Player.SendMessage("[Zombie Survival]: " + Colors.red + "A zombie game is in progress! You are infected as you joined before the game started. [Gamemode: " + ZombieHelper.GetGamemode(Gamemode) + "]");
            }
            else
            {
                Player.SendMessage("[Zombie Survival]: " + Colors.red + "Vote on the next level by typing the level name!");
                Player.SendMessage("[Zombie Survival]: " + Colors.red + "Options: " + LevelChoices[0] + "/" + LevelChoices[1] + "/random");
            }
        }
コード例 #8
0
        public static void SendUserType(ExtraPlayerData p)
        {
            /*if( p == null ) return;

            Packet packet = new Packet();
            if (p.Referee)
                packet.bytes = new byte[2] { 15, 100 };
            else
                packet.bytes = new byte[2] { 15, 0 };
            p.Player.SendPacket(packet);*/
        }
コード例 #9
0
 public static void ResetPlayer(ExtraPlayerData p)
 {
     p.Player.ExtraData.CreateIfNotExist("Voted", false);
     p.Player.ExtraData["Voted"] = false;
     p.Player.IsHeadFlipped = false;
     p.Infected = false;
     p.AmountOfBlocksLeft = Random.Next(40, 80);
     p.Player.DisplayName = p.Player.Color + p.Player.Username;
     p.Survivor = false;
     p.AmountInfected = 0;
     p.AmountMoved = 0;
 }
コード例 #10
0
 public static ExtraPlayerData InfectPlayer(ExtraPlayerData Alive)
 {
     if (!ZombiePlugin.CureOn && !Alive.Infected)
     {
         if (Alive.Survivor)
         {
             Player.UniversalChat("[Zombie Survival]: " + Colors.red + Alive.Player.Username + " failed the Survivor challenge!");
             int AmountTaken = 0;
             try
             {
                 AmountTaken = (int)Math.Round(Alive.Player.Money / (Random.NextDouble() * 100));
             }
             catch { AmountTaken = Alive.Player.Money / 2; }//Divide by zero can occur here
             TakeMoney(Alive.Player, AmountTaken); //Exponential function, 1 lets them have nearly all their money, 0.01 removes all their money
             //Is also less tough on players with lower money, while more tougher on players with moar money
         }
         Alive.Infected = true;
         Alive.Player.IsHeadFlipped = true;
         Alive.Player.DisplayName = Colors.red + "Undeaad";
         return Alive;
     }
     else if (ZombiePlugin.CureOn && Alive.Infected)
     {
         DisinfectPlayer(Alive);
     }
     return null;
 }
コード例 #11
0
 public static void InfectPlayer(Player Infected, ExtraPlayerData Alive)
 {
     InfectPlayer(Alive);
     try
     {
         if (!ZombiePlugin.CureOn)
             ZombieHelper.DisplayInfectMessage(Alive.Player, Infected);
         else
             ZombieHelper.DisplayDisinfectMessage(Alive.Player, Infected);
     }
     catch { }
 }
コード例 #12
0
 public static void InfectPlayer(ExtraPlayerData Infected, ExtraPlayerData Alive)
 {
     Infected.AmountInfected++;
     InfectPlayer(Infected.Player, Alive);
 }
コード例 #13
0
 public static ExtraPlayerData DisinfectPlayer(ExtraPlayerData Alive)
 {
     if (Alive.Infected)
     {
         Alive.Infected = false;
         Alive.Player.IsHeadFlipped = false;
         Alive.Player.DisplayName = Alive.Player.Username;
     }
     return Alive;
 }
コード例 #14
0
        public static string CleanString(Player Player, string Message)
        {
            ExtraPlayerData p = ZombiePlugin.FindPlayer(Player);

            string[] message = Message.Split(' ');

            #region Caps Filter
            string[] noCapsMessage = new string[message.Length];
            int      e             = 0;
            bool     hitCaps       = false;
            foreach (string s in message)
            {
                int count = 0;
                foreach (char c in s)
                {
                    if (Char.IsUpper(c))
                    {
                        count++;
                    }
                }

                if (count >= (s.Length / 2) && s.Length > 3)
                {
                    noCapsMessage[e] = s.ToLower();
                    if (!hitCaps)
                    {
                        Player.SendMessage("Hey! Stop using caps lock!");
                        hitCaps = true;
                    }
                }
                else
                {
                    noCapsMessage[e] = s;
                }
                e++;
            }
            message = noCapsMessage;
            #endregion

            #region Spam Filter
            double seconds = (DateTime.Now - p.SpamTime).TotalSeconds;
            if (seconds < 5)
            {
                if (p.Spam > 7)
                {
                    p.Player.SendMessage("Please don't spam! You have been muted for 20 seconds...");
                    return("");
                }
                else
                {
                    p.Spam += 1;
                }
            }
            else
            {
                if (p.Spam > 7)
                {
                    p.Player.SendMessage("Please don't spam again :|");
                    p.Spam = 0;
                }
                else if (p.Spam < 12)
                {
                    p.Spam -= 1;
                }
            }
            #endregion

            #region Swear Filter
            string[] noSwearMessage = new string[message.Length];
            int      z       = 0;
            bool     noSwear = false;
            foreach (string s in message)
            {
                string tempS = s;
                tempS = s.ToLower();
                foreach (var pattern in RegexReduce)
                {
                    tempS = Regex.Replace(tempS, pattern.Value, pattern.Key /*, RegexOptions.IgnoreCase*/);
                }
                if (SwearFilter.Contains(tempS))
                {
                    noSwearMessage[z] = GetRandomString().Substring(0, tempS.Length);
                    if (!noSwear)
                    {
                        Player.SendMessage("Hey! Stop swearing!");
                        noSwear = true;
                    }
                }
                else
                {
                    noSwearMessage[z] = s;
                }
                z++;
            }
            message = noSwearMessage;
            #endregion

            p.SpamTime = DateTime.Now;

            return(String.Join(" ", message));
        }
コード例 #15
0
 public static void InfectPlayer(ExtraPlayerData Infected, ExtraPlayerData Alive)
 {
     Infected.AmountInfected++;
     InfectPlayer(Infected.Player, Alive);
 }