Beispiel #1
0
        public override void Use(Player p, string message)
        {
            Player who = message == "" ? p : PlayerInfo.Find(message);

            if (message == "")
            {
                message = p.name;
            }
            if (who == null || !Entities.CanSee(p, who))
            {
                Player.SendMessage(p, "\"" + message + "\" is offline! Using /whowas instead.");
                Command.all.Find("whowas").Use(p, message); return;
            }

            Player.SendMessage(p, who.color + who.name + " %S(" + who.DisplayName + ") %Sis on &b" + who.level.name);
            Player.SendMessage(p, who.FullName + " %Shas :");
            Player.SendMessage(p, "> > the rank of " + who.group.color + who.group.name);
            if (Economy.Enabled)
            {
                Player.SendMessage(p, "> > &a" + who.money + " %S" + Server.moneys);
            }

            Player.SendMessage(p, "> > &cdied &a" + who.overallDeath + Server.DefaultColor + " times");
            Player.SendMessage(p, "> > &bmodified &a" + who.overallBlocks + " &eblocks &eand &a" + who.loginBlocks + " &ewere changed &9since logging in&e.");
            string   storedTime = Convert.ToDateTime(DateTime.Now.Subtract(who.timeLogged).ToString()).ToString("HH:mm:ss");
            TimeSpan time       = who.time;

            Player.SendMessage(p, "> > time spent on server: " + time.Days + " Days, " + time.Hours + " Hours, " + time.Minutes + " Minutes, " + time.Seconds + " Seconds.");
            Player.SendMessage(p, "> > been logged in for &a" + storedTime);
            Player.SendMessage(p, "> > first logged into the server on &a" + who.firstLogin.ToString("yyyy-MM-dd") + " at " + who.firstLogin.ToString("HH:mm:ss"));
            Player.SendMessage(p, "> > logged in &a" + who.totalLogins + " %Stimes, &c" + who.totalKicked + " %Sof which ended in a kick.");
            Player.SendMessage(p, "> > " + Awards.AwardAmount(who.name) + " awards");
            string[] data = Ban.GetBanData(who.name);
            if (data != null)
            {
                Player.SendMessage(p, "> > is banned for " + data[1] + " by " + data[0]);
            }

            if (who.isDev)
            {
                Player.SendMessage(p, "> > Player is a &9Developer");
            }
            else if (who.isMod)
            {
                Player.SendMessage(p, "> > Player is a &9MCGalaxy Moderator");
            }

            if (!CheckAdditionalPerm(p))
            {
                return;
            }
            string givenIP;

            if (Server.bannedIP.Contains(who.ip))
            {
                givenIP = "&8" + who.ip + ", which is banned";
            }
            else
            {
                givenIP = who.ip;
            }
            Player.SendMessage(p, "> > the IP of " + givenIP);
            if (Server.useWhitelist && Server.whiteList.Contains(who.name))
            {
                Player.SendMessage(p, "> > Player is &fWhitelisted");
            }
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if ((string)Session["allow"] != "1")
            {
                Response.Redirect("/Pages/Forbidden.aspx");
            }
            else
            {
                if (Request["mid"] != null || Session["update_movie"] != null)
                {
                    if (Session["update_movie"] != null)
                    {
                        m1 = (Movie)Session["update_movie"];
                    }
                    else //FIRST VISIT
                    {
                        m1 = Movies.GetMovieByID(Request["mid"]);
                        Session["update_movie"] = m1;
                    }
                    Session["update_currentpage"] = "UpdateMovie.aspx";

                    // delete section
                    if (Request["deleteAward"] != null)
                    {
                        string[] str = Request["deleteAward"].Split(',');
                        Awards.DeleteMovieAward(m1.GetID().ToString(), str[0], int.Parse(str[1]));
                    }

                    if (Request["deleteActor"] != null)
                    {
                        Actors.DeleteMovieActor(m1.GetID().ToString(), Request["deleteActor"].ToString());
                    }

                    if (Request["deleteDirector"] != null)
                    {
                        Directors.DeleteMovieDirector(m1.GetID().ToString(), Request["deleteDirector"].ToString());
                    }

                    if (Request["deleteWriter"] != null)
                    {
                        Writers.DeleteMovieWriter(m1.GetID().ToString(), Request["deleteWriter"].ToString());
                    }

                    // add section
                    if (Request["addActor"] != null)
                    {
                        Movies.AddMovieActor(m1, Actors.GetActorByID(Request["addActor"]));
                    }

                    if (Request["addDirector"] != null)
                    {
                        Movies.AddMovieDirector(m1, Directors.GetDirectorByID(Request["addDirector"]));
                    }

                    if (Request["addWriter"] != null)
                    {
                        Movies.AddMovieWriter(m1, Writers.GetWriterByID(Request["addWriter"]));
                    }

                    GenresListBox.DataSource     = Genres.GetAllGenres();
                    GenresListBox.DataTextField  = "Genre";
                    GenresListBox.DataValueField = "GenreID";
                    GenresListBox.DataBind();

                    SeriesDropDownList.DataSource     = Series.GetAllSeries();
                    SeriesDropDownList.DataTextField  = "Series";
                    SeriesDropDownList.DataValueField = "SeriesID";
                    SeriesDropDownList.DataBind();

                    AwardsDropDownList.DataSource     = Awards.GetAllAwards();
                    AwardsDropDownList.DataTextField  = "Award";
                    AwardsDropDownList.DataValueField = "AwardID";
                    AwardsDropDownList.DataBind();

                    GlobalIDTextBox.Text = m1.GetGlobalID().ToString();

                    MovieNameTextBox.Text = m1.GetName();
                    int sr = m1.GetSeries();

                    for (int i = 0; i < SeriesDropDownList.Items.Count; i++)
                    {
                        if (int.Parse(SeriesDropDownList.Items[i].Value) == sr)
                        {
                            SeriesDropDownList.Items[i].Selected = true;
                        }
                    }

                    ReleaseYearTextBox.Text = m1.GetReleaseYear().ToString();

                    D3AvailableCheckBox.Checked = m1.Get3DAvailable();

                    RatingTextBox.Text = m1.GetRating().ToString();

                    TotalTimeTextBox.Text = m1.GetTotalTime().ToString();

                    Genre[] g1 = Genres.GetGenresByMovieID(m1.GetID().ToString());

                    for (int i = 0; i < GenresListBox.Items.Count; i++)
                    {
                        for (int j = 0; j < g1.Length; j++)
                        {
                            if (int.Parse(GenresListBox.Items[i].Value) == g1[j].GetID())
                            {
                                GenresListBox.Items[i].Selected = true;
                            }
                        }
                    }

                    Award[] a1 = Awards.GetAwardsByMovieID(m1.GetID().ToString());

                    for (int i = 0; i < a1.Length; i++)
                    {
                        AwardsLabel.Text += "<a href=\"UpdateMovie.aspx?mid=" + m1.GetID() + "&deleteAward=" + "" + a1[i].GetID() + "," + a1[i].GetYear() + "\" style=\"color: #FF0000; font-weight: bold\">X</a>" + "&nbsp&nbsp";
                        AwardsLabel.Text += a1[i].GetAward() + " - " + a1[i].GetYear();
                        AwardsLabel.Text += "<br />";
                    }

                    Actor[] ac1 = Actors.GetActorsByMovieID(m1.GetID().ToString());

                    for (int i = 0; i < ac1.Length; i++)
                    {
                        ActorsLabel.Text += "<a href=\"UpdateMovie.aspx?mid=" + m1.GetID() + "&deleteActor=" + "" + ac1[i].GetID() + "\" style=\"color: #FF0000; font-weight: bold\">X</a>" + "&nbsp&nbsp";
                        ActorsLabel.Text += ac1[i].GetName();
                        ActorsLabel.Text += "<br />";
                    }

                    Director[] d1 = Directors.GetDirectorsByMovieID(m1.GetID().ToString());

                    for (int i = 0; i < d1.Length; i++)
                    {
                        DirectorsLabel.Text += "<a href=\"UpdateMovie.aspx?mid=" + m1.GetID() + "&deleteDirector=" + "" + d1[i].GetID() + "\" style=\"color: #FF0000; font-weight: bold\">X</a>" + "&nbsp&nbsp";
                        DirectorsLabel.Text += d1[i].GetName();
                        DirectorsLabel.Text += "<br />";
                    }

                    Writer[] w1 = Writers.GetWritersByMovieID(m1.GetID().ToString());

                    for (int i = 0; i < w1.Length; i++)
                    {
                        WritersLabel.Text += "<a href=\"UpdateMovie.aspx?mid=" + m1.GetID() + "&deleteWriter=" + "" + w1[i].GetID() + "\" style=\"color: #FF0000; font-weight: bold\">X</a>" + "&nbsp&nbsp";
                        WritersLabel.Text += w1[i].GetName();
                        WritersLabel.Text += "<br />";
                    }

                    MoviePhoto.ImageUrl = "../Pictures/Movies/" + m1.GetMoviePhoto();

                    TrailerTextBox.Text = m1.GetTrailer();
                }
            }
        }
    }
Beispiel #3
0
        public static void Output(Player p, WhoInfo who, bool canSeeIP)
        {
            Player.SendMessage(p, who.FullName + " %S(" + who.Name + ") has:");
            Player.SendMessage(p, ">> Rank of " + who.Group.ColoredName);

            if (Economy.Enabled)
            {
                Player.SendMessage(p, ">> &a" + who.Deaths + " &cdeaths%S, &a" + who.Money +
                                   " %S" + Server.moneys + ", " + Awards.AwardAmount(who.Name) + " awards");
            }
            else
            {
                Player.SendMessage(p, ">> &a" + who.Deaths + " &cdeaths%s, " + Awards.AwardAmount(who.Name) + " awards");
            }

            if (who.LoginBlocks >= 0)
            {
                Player.SendMessage(p, ">> &bModified &a" + who.TotalBlocks + " &eblocks, &a" + who.LoginBlocks + " &esince login");
            }
            else
            {
                Player.SendMessage(p, ">> &bModified &a" + who.TotalBlocks + " &eblocks");
            }

            if (who.TimeOnline.Ticks > 0)
            {
                Player.SendMessage(p, ">> Spent " + Shorten(who.TimeSpent) + " on the server, " + Shorten(who.TimeOnline) + " this session");
            }
            else
            {
                Player.SendMessage(p, ">> Spent " + Shorten(who.TimeSpent) + " on the server");
            }

            if (who.Last.Ticks > 0)
            {
                Player.SendMessage(p, ">> First login &a" + who.First.ToString("yyyy-MM-dd")
                                   + "%S, last login &a" + who.Last.ToString("yyyy-MM-dd"));
            }
            else
            {
                Player.SendMessage(p, ">> First login on &a" + who.First.ToString("yyyy-MM-dd")
                                   + "%S, and is currently &aonline");
            }

            Player.SendMessage(p, ">> Logged in &a" + who.Logins + " %Stimes, &c" + who.Kicks + " %Sof which ended in a kick");
            string[] data = Ban.GetBanData(who.Name);
            if (data != null)
            {
                Player.SendMessage(p, ">> is banned for " + data[1] + " by " + data[0]);
            }

            if (Server.Devs.CaselessContains(who.Name))
            {
                Player.SendMessage(p, ">> Player is a &9Developer");
            }
            if (Server.Mods.CaselessContains(who.Name))
            {
                Player.SendMessage(p, ">> Player is a &9MCGalaxy Moderator");
            }

            if (canSeeIP)
            {
                string ipMsg = who.IP;
                if (Server.bannedIP.Contains(who.IP))
                {
                    ipMsg = "&8" + who.IP + ", which is banned";
                }
                Player.SendMessage(p, ">> The IP of " + ipMsg);
                if (Server.useWhitelist && Server.whiteList.Contains(who.Name))
                {
                    Player.SendMessage(p, ">> Player is &fWhitelisted");
                }
            }

            if (!Server.zombie.Running)
            {
                return;
            }
            Player.SendMessage(p, ">> Survived &a" + who.RoundsTotal +
                               " %Srounds total, most in a row was &e" + who.RoundsMax);
            Player.SendMessage(p, ">> Infected &a" + who.InfectedTotal +
                               " %Splayers total, most in a round was &e" + who.InfectedMax);
        }
        // маппит из Model в Entity
        private void PeopleModelMapToPeoples(PeopleViewModel source, ref People dest, bool isPeoplePart = false)
        {
            try
            {
                dest.Id        = source.Id;
                dest.FirstName = source.FirstName;
                dest.LastName  = source.LastName;
                dest.BirthDate = source.BirthDate;

                if (source.PhotoPeople == null)
                {
                    dest.PhotoPeople = null;
                }
                else
                {
                    dest.PhotoPeople = UtilHelper.HttpPostedFileBaseToByte(source.PhotoPeople);
                }

                if (source.PhotoMIMEType == null || source.PhotoPeople == null)
                {
                    dest.PhotoMIMEType = "";
                }
                else
                {
                    dest.PhotoMIMEType = source.PhotoMIMEType;
                }

                List <PeopleAwards> lst = new List <PeopleAwards>();

                if (isPeoplePart)
                {
                    dest.PeopleAwards = lst;
                    return;
                }

                List <ListPeopleAwardsViewModel> entList = source.PeopleAwards.ToList();

                PeopleAwards peopleAward;
                foreach (var item in entList)
                {
                    peopleAward = new PeopleAwards();

                    peopleAward.Id       = item.Id;
                    peopleAward.PeopleID = item.PeopleID;
                    peopleAward.AwardID  = item.AwardID;

                    Awards award = new Awards();
                    award.Id               = item.Award.Id;
                    award.NameAward        = item.Award.NameAward;
                    award.DescriptionAward = item.Award.DescriptionAward;

                    if (item.Award.PhotoAward != null)
                    {
                        award.PhotoAward = item.Award.PhotoAward;
                    }

                    award.PhotoMIMEType = item.Award.PhotoMIMEType;

                    peopleAward.Award = award;

                    lst.Add(peopleAward);
                }
                dest.PeopleAwards = lst;
            }
            catch (Exception ex)
            {
                Logger.LogException(new Exception(String.Format("Ошибка:\n{0}\n{1}\n{2}", ex.Message, ex.StackTrace, ex.InnerException.StackTrace)));
                throw ex;
            }
        }
        public override void Use(Player p, string message)
        {
            if (message == "" || message.IndexOf(' ') == -1)
            {
                Help(p); return;
            }

            bool give = true;

            if (message.Split(' ')[0].ToLower() == "give")
            {
                give    = true;
                message = message.Substring(message.IndexOf(' ') + 1);
            }
            else if (message.Split(' ')[0].ToLower() == "take")
            {
                give    = false;
                message = message.Substring(message.IndexOf(' ') + 1);
            }

            string foundPlayer = message.Split(' ')[0];
            Player who         = Player.Find(message);

            if (who != null)
            {
                foundPlayer = who.name;
            }
            string awardName = message.Substring(message.IndexOf(' ') + 1);

            if (!Awards.awardExists(awardName))
            {
                Player.SendMessage(p, "The award you entered doesn't exist");
                Player.SendMessage(p, "Use /awards for a list of awards");
                return;
            }

            if (give)
            {
                if (Awards.giveAward(foundPlayer, awardName))
                {
                    Player.GlobalMessage(Server.FindColor(foundPlayer) + foundPlayer + Server.DefaultColor + " was awarded: &b" + Awards.camelCase(awardName));
                }
                else
                {
                    Player.SendMessage(p, "The player already has that award!");
                }
            }
            else
            {
                if (Awards.takeAward(foundPlayer, awardName))
                {
                    Player.GlobalMessage(Server.FindColor(foundPlayer) + foundPlayer + Server.DefaultColor + " had their &b" + Awards.camelCase(awardName) + Server.DefaultColor + " award removed");
                }
                else
                {
                    Player.SendMessage(p, "The player didn't have the award you tried to take");
                }
            }

            Awards.Save();
        }
Beispiel #6
0
        public static void Main(string[] args)
        {
            var    userLogic       = DependencyResolver.UserLogic;
            var    awardsLogic     = DependencyResolver.AwardLogic;
            var    userAwardsLogik = DependencyResolver.UserAwardsLogic;
            Awards ironCross       = new Awards
            {
                Title = "Iron_Kross",
            };
            Awards medalForHonor = new Awards
            {
                Title = "MedalForHonor",
            };
            Awards redStar = new Awards
            {
                Title = "Award_Of_Red_Star",
            };
            Awards goldMedal = new Awards
            {
                Title = "GoldMedal",
            };
            Awards silverMedal = new Awards
            {
                Title = "SilverMedal",
            };
            UsersAwards usersAwards = new UsersAwards
            {
                IdUser  = 1,
                IdAward = 0,
            };

            userAwardsLogik.AddUserAward(usersAwards);
            awardsLogic.AddAward(ironCross);
            awardsLogic.AddAward(medalForHonor);
            awardsLogic.AddAward(redStar);
            awardsLogic.AddAward(goldMedal);
            awardsLogic.AddAward(silverMedal);
            AddUser(userLogic);

            AddUser(userLogic);

            AddUser(userLogic);

            userLogic.DeleteUser(3);

            AddUser(userLogic);
            AddUser(userLogic);
            AddUser(userLogic);
            var user2 = new User
            {
                Id          = 2,
                Name        = "Peter",
                DateOfBirth = new DateTime(56),
            };
            var user3 = new User
            {
                Id          = 1,
                Name        = "Irvin",
                DateOfBirth = new DateTime(1986, 07, 24),
            };

            userLogic.UpdateUser(user2);
            userLogic.UpdateUser(user3);
            ShowUser(userLogic);
            ShowAward(awardsLogic);
            ShowUserAward(userAwardsLogik);
            ShowAwardsOfUser(userAwardsLogik, user3);
        }
Beispiel #7
0
 public void AddAward(Awards award) => AwardStorage.AddAward(award);
Beispiel #8
0
        public override void Use(Player p, string message)
        {
            if (message == "")
            {
                Help(p); return;
            }
            Player pl = Player.Find(message);

            if (pl != null && !pl.hidden)
            {
                Player.SendMessage(p, pl.color + pl.name + Server.DefaultColor + " is online, using /whois instead.");
                Command.all.Find("whois").Use(p, message);
                return;
            }

            if (message.IndexOf("'") != -1)
            {
                Player.SendMessage(p, "Cannot parse request."); return;
            }

            string FoundRank = Group.findPlayer(message.ToLower());

            Database.AddParams("@Name", message);
            DataTable playerDb = Database.fillData("SELECT * FROM Players WHERE Name=@Name");

            if (playerDb.Rows.Count == 0)
            {
                Player.SendMessage(p, Group.Find(FoundRank).color + message + Server.DefaultColor + " has the rank of " + Group.Find(FoundRank).color + FoundRank); return;
            }
            string title = playerDb.Rows[0]["Title"].ToString();
            string color = c.Parse(playerDb.Rows[0]["color"].ToString().Trim());

            if (color == "" || color == null || String.IsNullOrEmpty(color))
            {
                color = Group.Find(FoundRank).color;
            }
            string tcolor = c.Parse(playerDb.Rows[0]["title_color"].ToString().Trim());

            if (title == "" || title == null || String.IsNullOrEmpty(title))
            {
                Player.SendMessage(p, color + message + Server.DefaultColor + " has :");
            }
            else
            {
                Player.SendMessage(p, color + "[" + tcolor + playerDb.Rows[0]["Title"] + color + "] " + message + Server.DefaultColor + " has :");
            }
            Player.SendMessage(p, "> > the rank of " + Group.Find(FoundRank).color + FoundRank);
            try
            {
                if (!Group.Find("Nobody").commands.Contains("pay") && !Group.Find("Nobody").commands.Contains("give") && !Group.Find("Nobody").commands.Contains("take"))
                {
                    Player.SendMessage(p, "> > &a" + playerDb.Rows[0]["Money"] + Server.DefaultColor + " " + Server.moneys);
                }
            }
            catch { }
            Player.SendMessage(p, "> > &cdied &a" + playerDb.Rows[0]["TotalDeaths"] + Server.DefaultColor + " times");
            Player.SendMessage(p, "> > &bmodified &a" + playerDb.Rows[0]["totalBlocks"] + " &eblocks.");
            Player.SendMessage(p, "> > was last seen on &a" + playerDb.Rows[0]["LastLogin"]);
            Player.SendMessage(p, "> > " + TotalTime(playerDb.Rows[0]["TimeSpent"].ToString()));
            Player.SendMessage(p, "> > first logged into the server on &a" + playerDb.Rows[0]["FirstLogin"]);
            Player.SendMessage(p, "> > logged in &a" + playerDb.Rows[0]["totalLogin"] + Server.DefaultColor + " times, &c" + playerDb.Rows[0]["totalKicked"] + Server.DefaultColor + " of which ended in a kick.");
            Player.SendMessage(p, "> > " + Awards.awardAmount(message) + " awards");
            if (Ban.Isbanned(message))
            {
                string[] data = Ban.Getbandata(message);
                Player.SendMessage(p, "> > was banned by " + data[0] + " for " + data[1] + " on " + data[2]);
            }

            if (Server.Devs.Contains(message.ToLower()))
            {
                Player.SendMessage(p, Server.DefaultColor + "> > Player is a &9Developer");
                if (Server.forgeProtection == ForgeProtection.Mod || Server.forgeProtection == ForgeProtection.Dev)
                {
                    Player.SendMessage(p, Server.DefaultColor + "> > Player is &CPROTECTED" + Server.DefaultColor + " under MCForge Staff protection");
                }
            }
            else if (Server.Mods.Contains(message.ToLower()))
            {
                Player.SendMessage(p, Server.DefaultColor + "> > Player is a &9MCForge Moderator");
                if (Server.forgeProtection == ForgeProtection.Mod)
                {
                    Player.SendMessage(p, Server.DefaultColor + "> > Player is &CPROTECTED" + Server.DefaultColor + " under MCForge Staff protection");
                }
            }
            else if (Server.GCmods.Contains(message.ToLower()))
            {
                Player.SendMessage(p, Server.DefaultColor + "> > Player is a &9Global Chat Moderator");
            }

            if (!(p != null && (int)p.group.Permission <= CommandOtherPerms.GetPerm(this)))
            {
                if (Server.bannedIP.Contains(playerDb.Rows[0]["IP"].ToString()))
                {
                    playerDb.Rows[0]["IP"] = "&8" + playerDb.Rows[0]["IP"] + ", which is banned";
                }
                Player.SendMessage(p, "> > the IP of " + playerDb.Rows[0]["IP"]);
                if (Server.useWhitelist)
                {
                    if (Server.whiteList.Contains(message.ToLower()))
                    {
                        Player.SendMessage(p, "> > Player is &fWhitelisted");
                    }
                }
            }
            playerDb.Dispose();
        }
Beispiel #9
0
 public Sportsman() : base()
 {
     awards = new Awards();
 }
        public override void Use(Player p, string message)
        {
            if (message == "")
            {
                Help(p); return;
            }
            Player pl = Player.Find(message);

            if (pl != null && !pl.hidden)
            {
                Player.SendMessage(p, pl.color + pl.name + Server.DefaultColor + " is online, using /whois instead.");
                Command.all.Find("whois").Use(p, message);
                return;
            }

            if (message.IndexOf("'") != -1)
            {
                Player.SendMessage(p, "Cannot parse request."); return;
            }

            string FoundRank = Group.findPlayer(message.ToLower());

            DataTable playerDb = Server.useMySQL ? MySQL.fillData("SELECT * FROM Players WHERE Name='" + message + "'") : SQLite.fillData("SELECT * FROM Players WHERE Name='" + message + "'");

            if (playerDb.Rows.Count == 0)
            {
                Player.SendMessage(p, Group.Find(FoundRank).color + message + Server.DefaultColor + " has the rank of " + Group.Find(FoundRank).color + FoundRank); return;
            }

            Player.SendMessage(p, Group.Find(FoundRank).color + playerDb.Rows[0]["Title"] + " " + message + Server.DefaultColor + " has :");
            Player.SendMessage(p, "> > the rank of " + Group.Find(FoundRank).color + FoundRank);
            try
            {
                if (!Group.Find("Nobody").commands.Contains("pay") && !Group.Find("Nobody").commands.Contains("give") && !Group.Find("Nobody").commands.Contains("take"))
                {
                    Player.SendMessage(p, "> > &a" + playerDb.Rows[0]["Money"] + Server.DefaultColor + " " + Server.moneys);
                }
            }
            catch { }
            Player.SendMessage(p, "> > &cdied &a" + playerDb.Rows[0]["TotalDeaths"] + Server.DefaultColor + " times");
            Player.SendMessage(p, "> > &bmodified &a" + playerDb.Rows[0]["totalBlocks"] + " &eblocks.");
            Player.SendMessage(p, "> > was last seen on &a" + playerDb.Rows[0]["LastLogin"]);
            Player.SendMessage(p, "> > " + TotalTime(playerDb.Rows[0]["TimeSpent"].ToString()));
            Player.SendMessage(p, "> > first logged into the server on &a" + playerDb.Rows[0]["FirstLogin"]);
            Player.SendMessage(p, "> > logged in &a" + playerDb.Rows[0]["totalLogin"] + Server.DefaultColor + " times, &c" + playerDb.Rows[0]["totalKicked"] + Server.DefaultColor + " of which ended in a kick.");
            Player.SendMessage(p, "> > " + Awards.awardAmount(message) + " awards");

            bool skip = false;

            if (p != null)
            {
                if ((int)p.group.Permission <= CommandOtherPerms.GetPerm(this))
                {
                    skip = true;
                }
            }

            if (!skip)
            {
                if (Server.bannedIP.Contains(playerDb.Rows[0]["IP"].ToString()))
                {
                    playerDb.Rows[0]["IP"] = "&8" + playerDb.Rows[0]["IP"] + ", which is banned";
                }
                Player.SendMessage(p, "> > the IP of " + playerDb.Rows[0]["IP"]);
                if (Server.useWhitelist)
                {
                    if (Server.whiteList.Contains(message.ToLower()))
                    {
                        Player.SendMessage(p, "> > Player is &fWhitelisted");
                    }
                }
                if (Server.devs.Contains(message.ToLower()))
                {
                    Player.SendMessage(p, Server.DefaultColor + "> > Player is a &9Developer");
                }
            }
            playerDb.Dispose();
        }
Beispiel #11
0
 public void EditAward(Awards newAward)
 {
     //This method is not necessary when working with a database
 }
Beispiel #12
0
        static void Run()
        {
            for (; ;)
            {
                Console.WriteLine("-----------------------------------"
                                  + Environment.NewLine + "Please choose option:"
                                  + Environment.NewLine + "\t 1: Add user"
                                  + Environment.NewLine + "\t 2: Delete user"
                                  + Environment.NewLine + "\t 3: See all users"
                                  + Environment.NewLine + "\t 4: Add award"
                                  + Environment.NewLine + "\t 5: Add award to user"
                                  + Environment.NewLine + "\t 6: Delete award"
                                  + Environment.NewLine + "\t 7: See all awards"
                                  + Environment.NewLine + "-----------------------------------");

                if (uint.TryParse(Console.ReadLine(), out uint option) &&
                    option > 0 &&
                    option < 8)
                {
                    UsersManager  manager = new UsersManager();
                    AwardsManager Manager = new AwardsManager();
                    Guid          UserId;
                    Guid          AwardId;
                    switch (option)
                    {
                    case 1:
                    {
                        Console.WriteLine("Enter user name");
                        var Name = Console.ReadLine();

                        Console.WriteLine("Enter date of birth");
                        DateTime DateOfBirth;

                        if (!DateTime.TryParse(Console.ReadLine(), out DateOfBirth))
                        {
                            Console.WriteLine("Error!!! Wrong date format");
                        }
                        else if (DateOfBirth > DateTime.Now)
                        {
                            Console.WriteLine("Error!!! Wrong date");
                        }
                        else
                        {
                            Userss newUser = new Userss(Name, DateOfBirth);

                            manager.AddUser(newUser);
                        }

                        break;
                    }

                    case 2:
                    {
                        Console.WriteLine("Enter user id");

                        if (!Guid.TryParse(Console.ReadLine(), out UserId))
                        {
                            Console.WriteLine("Error!!! Wrong id format");
                        }
                        else if (!manager.GetAllUsers().Exists(n => n.UserId == UserId))
                        {
                            Console.WriteLine("Error!!! This user does not exist");
                        }
                        else
                        {
                            manager.DeleteUser(UserId);
                        }


                        break;
                    }

                    case 3:
                    {
                        foreach (Userss user in manager.GetAllUsers())
                        {
                            Console.WriteLine(user);
                        }

                        break;
                    }

                    case 4:
                    {
                        Console.WriteLine("Enter award name");
                        var Name = Console.ReadLine();

                        Awards award = new Awards(Name);
                        Manager.AddAward(award);

                        break;
                    }

                    case 5:
                    {
                        Console.WriteLine("Enter user Id");

                        if (!Guid.TryParse(Console.ReadLine(), out UserId))
                        {
                            Console.WriteLine("Error!!! Wrong id format");
                        }
                        else if (!manager.GetAllUsers().Exists(n => n.UserId == UserId))
                        {
                            Console.WriteLine("Error!!! This user does not exist");
                        }
                        else
                        {
                            Console.WriteLine("Enter award Id");

                            if (!Guid.TryParse(Console.ReadLine(), out AwardId))
                            {
                                Console.WriteLine("Error!!! Wrong id format");
                            }
                            else if (!Manager.GetAllAwards().Exists(n => n.Id == AwardId))
                            {
                                Console.WriteLine("Error!!! This award does not exist");
                            }
                            else
                            {
                                manager.AddAwardToUser(UserId, AwardId);
                            }
                        }

                        break;
                    }

                    case 6:
                    {
                        Console.WriteLine("Enter award Id");

                        if (!Guid.TryParse(Console.ReadLine(), out AwardId))
                        {
                            Console.WriteLine("Error!!! Wrong id format");
                        }
                        else if (!Manager.GetAllAwards().Exists(n => n.Id == AwardId))
                        {
                            Console.WriteLine("Error!!! This award does not exist");
                        }
                        else
                        {
                            Manager.DeleteAward(AwardId);
                        }

                        break;
                    }

                    case 7:
                    {
                        foreach (Awards award in Manager.GetAllAwards())
                        {
                            Console.WriteLine(award);
                        }

                        break;
                    }

                    default:
                    {
                        Console.WriteLine("Unknown command!");
                        break;
                    }
                    }
                }
                else
                {
                    Console.WriteLine("Error!!! Wrong option");
                }
            }
        }
Beispiel #13
0
 public UserWithAward RemoveUsersAward(Users user, Awards award)
 {
     return(RemoveUsersAward(user, award));
 }
        public override void Use(Player p, string message)
        {
            if (message.Split(' ').Length > 2)
            {
                Help(p); return;
            }
            // /awards
            // /awards 1
            // /awards bob
            // /awards bob 1

            int    totalCount  = 0;
            string foundPlayer = "";

            if (message != "")
            {
                if (message.Split(' ').Length == 2)
                {
                    foundPlayer = message.Split(' ')[0];
                    Player who = Player.Find(foundPlayer);
                    if (who != null)
                    {
                        foundPlayer = who.name;
                    }
                    try
                    {
                        totalCount = int.Parse(message.Split(' ')[1]);
                    }
                    catch
                    {
                        Help(p);
                        return;
                    }
                }
                else
                {
                    if (message.Length <= 3)
                    {
                        try
                        {
                            totalCount = int.Parse(message);
                        }
                        catch
                        {
                            foundPlayer = message;
                            Player who = Player.Find(foundPlayer);
                            if (who != null)
                            {
                                foundPlayer = who.name;
                            }
                        }
                    }
                    else
                    {
                        foundPlayer = message;
                        Player who = Player.Find(foundPlayer);
                        if (who != null)
                        {
                            foundPlayer = who.name;
                        }
                    }
                }
            }

            if (totalCount < 0)
            {
                Player.SendMessage(p, "Cannot display pages less than 0");
                return;
            }

            List <Awards.awardData> awardList = new List <Awards.awardData>();

            if (foundPlayer == "")
            {
                awardList = Awards.allAwards;
            }
            else
            {
                foreach (string s in Awards.getPlayersAwards(foundPlayer))
                {
                    Awards.awardData aD = new Awards.awardData();
                    aD.awardName   = s;
                    aD.description = Awards.getDescription(s);
                    awardList.Add(aD);
                }
            }

            if (awardList.Count == 0)
            {
                if (foundPlayer != "")
                {
                    Player.SendMessage(p, "The player has no awards!");
                }
                else
                {
                    Player.SendMessage(p, "There are no awards in this server yet");
                }

                return;
            }

            int max   = totalCount * 5;
            int start = (totalCount - 1) * 5;

            if (start > awardList.Count)
            {
                Player.SendMessage(p, "There aren't that many awards. Enter a smaller number");
                return;
            }
            if (max > awardList.Count)
            {
                max = awardList.Count;
            }

            if (foundPlayer != "")
            {
                Player.SendMessage(p, Server.FindColor(foundPlayer) + foundPlayer + Server.DefaultColor + " has the following awards:");
            }
            else
            {
                Player.SendMessage(p, "Awards available: ");
            }

            if (totalCount == 0)
            {
                foreach (Awards.awardData aD in awardList)
                {
                    Player.SendMessage(p, "&6" + aD.awardName + ": &7" + aD.description);
                }

                if (awardList.Count > 8)
                {
                    Player.SendMessage(p, "&5Use &b/awards " + message + " 1/2/3/... &5for a more ordered list");
                }
            }
            else
            {
                for (int i = start; i < max; i++)
                {
                    Awards.awardData aD = awardList[i];
                    Player.SendMessage(p, "&6" + aD.awardName + ": &7" + aD.description);
                }
            }
        }
Beispiel #15
0
 public bool Exists(Award note)
 {
     return(Awards.Contains(note));
 }
Beispiel #16
0
 public Sportsman(string name, string second, int age, Sex sex, int exp, int golds, int silvers, int bronzes)
     : base(name, second, age, sex)
 {
     awards     = new Awards(golds, silvers, bronzes);
     Experience = exp;
 }
Beispiel #17
0
        public async Task <IActionResult> Import(IFormFile fileExcel)
        {
            if (ModelState.IsValid)
            {
                if (fileExcel != null)
                {
                    using (var stream = new FileStream(fileExcel.FileName, FileMode.Create))
                    {
                        await fileExcel.CopyToAsync(stream);

                        using (XLWorkbook workBook = new XLWorkbook(stream, XLEventTracking.Disabled))
                        {
                            // var lang = _context.BookGenres.Include(b => b.Book).Include(b => b.Book.Language).ToList();
                            //перегляд усіх листів (в даному випадку категорій)
                            foreach (IXLWorksheet worksheet in workBook.Worksheets)
                            {
                                //worksheet.Name - назва категорії. Пробуємо знайти в БД, якщо відсутня, то створюємо нову
                                Awards newaw;
                                var    c = (from aw in _context.Awards
                                            where aw.Name.Contains(worksheet.Name)
                                            select aw).ToList();
                                if (c.Count > 0)
                                {
                                    newaw = c[0];
                                }
                                else
                                {
                                    newaw      = new Awards();
                                    newaw.Name = worksheet.Name;
                                    _context.Awards.Add(newaw);
                                }
                                foreach (IXLRow row in worksheet.RowsUsed().Skip(1))
                                {
                                    try {
                                        Cartoons cartoon = new Cartoons();
                                        int      counter = 0;
                                        foreach (var ca in _context.Cartoons)
                                        {
                                            if (ca.Name == row.Cell(1).Value.ToString())
                                            {
                                                counter++; cartoon = ca; break;
                                            }
                                        }
                                        if (counter > 0)
                                        {
                                            int count = 0;
                                            foreach (var award in _context.CartoonAwards)
                                            {
                                                if ((cartoon.Id == award.CartoonsId) && (newaw.Id == award.AwardsId))
                                                {
                                                    count++; break;
                                                }
                                            }
                                            if (count > 0)
                                            {
                                                goto link1;// якщо такф нагорода вже існує, переходимо до наступного рядка
                                            }
                                            else
                                            {
                                                CartoonAwards cartaw = new CartoonAwards();
                                                cartaw.Cartoons = cartoon;
                                                cartaw.Awards   = newaw;
                                                try
                                                {
                                                    cartaw.Year = Convert.ToInt32(row.Cell(2).Value);
                                                    if (cartaw.Year <= cartoon.Year)
                                                    {
                                                        goto link1;
                                                    }
                                                }
                                                catch { goto link1; }
                                                _context.CartoonAwards.Add(cartaw);
                                                goto link1;// переходимо до наступного рядка, бо вже маємо інформацію про нагороду цього мульта
                                            }
                                        }
                                        else
                                        {
                                            cartoon      = new Cartoons();
                                            cartoon.Name = row.Cell(1).Value.ToString();

                                            try
                                            {
                                                cartoon.Year = Convert.ToInt32(row.Cell(3).Value);
                                                if (cartoon.Year <= 0)
                                                {
                                                    goto link1;
                                                }
                                                cartoon.Duration = Convert.ToInt32(row.Cell(4).Value);
                                            }
                                            catch { goto link1; }
                                            FilmStudios filmstudio = new FilmStudios();
                                            counter = 0;
                                            foreach (var fst in _context.FilmStudios)
                                            {
                                                if (fst.Name == row.Cell(5).Value.ToString())
                                                {
                                                    counter++; filmstudio = fst; break;
                                                }
                                            }
                                            if (counter > 0)
                                            {
                                                cartoon.FilmStudios = filmstudio;
                                            }
                                            else
                                            {
                                                Countries country = new Countries();
                                                counter = 0;
                                                foreach (var co in _context.Countries)
                                                {
                                                    if (co.Name == row.Cell(6).Value.ToString())
                                                    {
                                                        counter++; country = co; break;
                                                    }
                                                }
                                                if (counter > 0)
                                                {
                                                    filmstudio.CountriesId = country.Id;
                                                }
                                                else
                                                {
                                                    country      = new Countries();
                                                    country.Name = row.Cell(6).Value.ToString();
                                                    _context.Countries.Add(country);
                                                    filmstudio.CountriesId = country.Id;
                                                }

                                                // BookGenres bg = new BookGenres();
                                                // cartoon.FilmStudios = filmstudio;
                                                filmstudio.Name = row.Cell(5).Value.ToString();
                                                _context.FilmStudios.Add(filmstudio);
                                            }
                                            _context.Cartoons.Add(cartoon);
                                            CartoonAwards cartaw = new CartoonAwards();
                                            cartaw.Cartoons = cartoon;
                                            cartaw.Awards   = newaw;
                                            try
                                            {
                                                cartaw.Year = Convert.ToInt32(row.Cell(2).Value);
                                                if (cartaw.Year <= cartoon.Year)
                                                {
                                                    goto link1;
                                                }
                                            }
                                            catch { goto link1; }
                                            _context.CartoonAwards.Add(cartaw);
                                        }
                                    }

                                    catch (Exception e)
                                    {
                                        throw new InvalidOperationException("Дані в файлі некоректні", e);
                                        // ModelState.AddModelError("", "Username or Password is wrong.");

                                        //logging самостійно :)
                                    }


                                    link1 :;
                                    await _context.SaveChangesAsync();
                                }
                                //Genres newgen;
                                //var c = (from gen in _context.Genres
                                //         where gen.Name.Contains(worksheet.Name)
                                //         select gen).ToList();
                                //if (c.Count > 0)
                                //{
                                //    newgen = c[0];
                                //}
                                //else
                                //{
                                //    newgen = new Genres();
                                //    newgen.Name = worksheet.Name;
                                //    _context.Genres.Add(newgen);
                                //}
                                //перегляд усіх рядків
                            }
                        }
                    }
                }
            }
            return(RedirectToAction(nameof(Index)));
        }
        public static void AddAwardToList(string name, string wID, string property, string regex)
        {
            var award = new Awards();
              award.Name = name;
              award.Property = property;
              award.Regex = regex;

              KeyValuePair<string,object> myItem = new KeyValuePair<string,object>(wID, award);
              AwardsList.Add(myItem);
        }
        public override void Use(Player p, string message)
        {
            message = message.ToLower();
            if (message == "")
            {
                Help(p); return;
            }
            Player pl = Player.Find(message);

            if (pl != null && !pl.hidden)
            {
                Player.SendMessage(p, pl.color + pl.name + Server.DefaultColor + " is online, using /whois instead.");
                Command.all.Find("whois").Use(p, message);
                return;
            }

            if (message.IndexOf("'") != -1)
            {
                Player.SendMessage(p, "Cannot parse request."); return;
            }

            string FoundRank = Group.findPlayer(message.ToLower());

            if (!Load(message))
            {
                Player.SendMessage(p, Group.Find(FoundRank).color + message + Server.DefaultColor + " has the rank of " + Group.Find(FoundRank).color + FoundRank); return;
            }

            if (title == "" || title == null || String.IsNullOrEmpty(title))
            {
                Player.SendMessage(p, color + message + Server.DefaultColor + " has :");
            }
            else
            {
                Player.SendMessage(p, color + "[" + titlecolor + title + color + "] " + message + Server.DefaultColor + " has :");
            }
            Player.SendMessage(p, "> > the rank of " + Group.Find(FoundRank).color + FoundRank);
            try
            {
                if (!Group.Find("Nobody").commands.Contains("pay") && !Group.Find("Nobody").commands.Contains("give") && !Group.Find("Nobody").commands.Contains("take"))
                {
                    Player.SendMessage(p, "> > &a" + money + Server.DefaultColor + " " + Server.moneys);
                }
            }
            catch { }
            Player.SendMessage(p, "> > &cdied &a" + overalldeaths + Server.DefaultColor + " times");
            Player.SendMessage(p, "> > &bmodified &a" + overallblocks + " &eblocks.");
            Player.SendMessage(p, "> > was last seen on &a" + lastlogin);
            Player.SendMessage(p, "> > first logged into the server on &a" + firstlogin);
            Player.SendMessage(p, "> > logged in &a" + totallogins + Server.DefaultColor + " times, &c" + totalkicks + Server.DefaultColor + " of which ended in a kick.");
            Player.SendMessage(p, "> > " + Awards.awardAmount(message) + " awards");
            if (Ban.Isbanned(message))
            {
                string[] data = Ban.Getbandata(message);
                Player.SendMessage(p, "> > was banned by " + data[0] + " for " + data[1] + " on " + data[2]);
            }

            if (Server.Devs.Contains(message.ToLower()))
            {
                Player.SendMessage(p, Server.DefaultColor + "> > Player is a &9Developer");
                if (Server.forgeProtection == ForgeProtection.Mod || Server.forgeProtection == ForgeProtection.Dev)
                {
                    Player.SendMessage(p, Server.DefaultColor + "> > Player is &CPROTECTED" + Server.DefaultColor + " under MCForge Staff protection");
                }
            }
            else if (Server.Mods.Contains(message.ToLower()))
            {
                Player.SendMessage(p, Server.DefaultColor + "> > Player is a &9MCForge Moderator");
                if (Server.forgeProtection == ForgeProtection.Mod)
                {
                    Player.SendMessage(p, Server.DefaultColor + "> > Player is &CPROTECTED" + Server.DefaultColor + " under MCForge Staff protection");
                }
            }
            else if (Server.GCmods.Contains(message.ToLower()))
            {
                Player.SendMessage(p, Server.DefaultColor + "> > Player is a &9Global Chat Moderator");
            }

            if (!(p != null && (int)p.group.Permission <= CommandOtherPerms.GetPerm(this)))
            {
                if (Server.useWhitelist)
                {
                    if (Server.whiteList.Contains(message.ToLower()))
                    {
                        Player.SendMessage(p, "> > Player is &fWhitelisted");
                    }
                }
            }
        }
Beispiel #20
0
        public static void Output(Player p, WhoInfo who, bool canSeeIP)
        {
            Player.Message(p, who.FullName + " %S(" + who.Name + ") has:");
            Player.Message(p, "  Rank of " + who.Group.ColoredName);

            if (Economy.Enabled)
            {
                Player.Message(p, "  &a{0} &cdeaths%S, &a{2} %S{3}, {1} %Sawards",
                               who.Deaths, Awards.AwardAmount(who.Name), who.Money, Server.moneys);
            }
            else
            {
                Player.Message(p, "  &a{0} &cdeaths%S, {1} %Sawards",
                               who.Deaths, Awards.AwardAmount(who.Name));
            }

            if (who.LoginBlocks >= 0)
            {
                Player.Message(p, "  Modified &a{0} %Sblocks, &a{1} %Ssince login", who.TotalBlocks, who.LoginBlocks);
            }
            else
            {
                Player.Message(p, "  Modified &a{0} %Sblocks", who.TotalBlocks);
            }
            Player.Message(p, "    &a{0} %Splaced, &a{1} %Sdeleted, &a{2} %Sdrawn",
                           who.TotalPlaced, who.TotalDeleted, who.TotalDrawn);

            if (who.TimeOnline.Ticks > 0)
            {
                Player.Message(p, "  Spent &a{0} %Son the server, &a{1} %Sthis session",
                               who.TimeSpent.Shorten(), who.TimeOnline.Shorten());
            }
            else
            {
                Player.Message(p, "  Spent &a{0} %Son the server", who.TimeSpent.Shorten());
            }

            if (who.Last.Ticks > 0)
            {
                Player.Message(p, "  First login &a" + who.First.ToString("yyyy-MM-dd")
                               + "%S, last login &a" + who.Last.ToString("yyyy-MM-dd"));
            }
            else
            {
                Player.Message(p, "  First login on &a" + who.First.ToString("yyyy-MM-dd")
                               + "%S, and is currently &aonline");
            }

            Player.Message(p, "  Logged in &a{0} %Stimes, &c{1} %Sof which ended in a kick", who.Logins, who.Kicks);
            if (who.Group.Permission == LevelPermission.Banned)
            {
                string[] data = Ban.GetBanData(who.Name);
                if (data != null)
                {
                    Player.Message(p, "  is banned for " + data[1] + " by " + data[0]);
                }
                else
                {
                    Player.Message(p, "  is banned");
                }
            }

            if (Server.Devs.CaselessContains(who.Name.TrimEnd('+')))
            {
                Player.Message(p, "  Player is an &9MCGalaxy Developer");
            }
            if (Server.Mods.CaselessContains(who.Name.TrimEnd('+')))
            {
                Player.Message(p, "  Player is an &9MCGalaxy Moderator");
            }

            if (canSeeIP)
            {
                string ipMsg = who.IP;
                if (Server.bannedIP.Contains(who.IP))
                {
                    ipMsg = "&8" + who.IP + ", which is banned";
                }
                Player.Message(p, "  The IP of " + ipMsg);
                if (ServerConfig.WhitelistedOnly && Server.whiteList.Contains(who.Name))
                {
                    Player.Message(p, "  Player is &fWhitelisted");
                }
            }

            if (who.AfkMessage != null)
            {
                Player.Message(p, "  Idle for {0} (AFK {1}%S)", who.IdleTime.Shorten(), who.AfkMessage);
            }
            else if (who.IdleTime.TotalMinutes >= 1)
            {
                Player.Message(p, "  Idle for {0}", who.IdleTime.Shorten());
            }
            if (Core.Match != null)
            {
                Player.Message(p, "  Participated in &a{0} %Sgames", who.TotalRounds);
                Player.Message(p, "  Won &a{0} %Sgames", who.Wins);
                Player.Message(p, "  Lost &a{0} %Sgames", who.Losses);
                Player.Message(p, "  Drawed &a{0} %Sgames", who.Draws);
                Player.Message(p, "  Scored &a{0} %Sgoals", who.Goals);
                Player.Message(p, "  Made &a{0} %Sassists", who.Assists);
                Player.Message(p, "  Saved &a{0} %Stimes", who.Saves);
                Player.Message(p, "  Scored on themselves &a{0} %Stimes", who.OwnGoals);
                Player.Message(p, "  Fouled &a{0} %Stimes", who.Fouls);
                Player.Message(p, "  Has skill slots: &a{0}", who.Pace);
            }

            if (!Server.zombie.Running)
            {
                return;
            }
            Player.Message(p, "  Survived &a{0} %Srounds (max &e{1}%S)",
                           who.RoundsTotal, who.RoundsMax);
            Player.Message(p, "  Infected &a{0} %Splayers (max &e{1}%S)",
                           who.InfectedTotal, who.InfectedMax);
        }
Beispiel #21
0
        public override void Use(Player p, string message)
        {
            Player who = null;

            if (message == "")
            {
                who = p; message = p.name;
            }
            else
            {
                who = Player.Find(message);
            }
            if (who != null && !who.hidden)
            {
                Player.SendMessage(p, who.color + who.name + Server.DefaultColor + " is on &b" + who.level.name);
                Player.SendMessage(p, who.color + who.prefix + who.name + Server.DefaultColor + " has :");
                Player.SendMessage(p, "> > the rank of " + who.group.color + who.group.name);
                try
                {
                    if (!Group.Find("Nobody").commands.Contains("pay") && !Group.Find("Nobody").commands.Contains("give") && !Group.Find("Nobody").commands.Contains("take"))
                    {
                        Player.SendMessage(p, "> > &a" + who.money + Server.DefaultColor + " " + Server.moneys);
                    }
                }
                catch { }
                Player.SendMessage(p, "> > &cdied &a" + who.overallDeath + Server.DefaultColor + " times");
                Player.SendMessage(p, "> > &bmodified &a" + who.overallBlocks + " &eblocks &eand &a" + who.loginBlocks + " &ewere changed &9since logging in&e.");
                string storedTime = Convert.ToDateTime(DateTime.Now.Subtract(who.timeLogged).ToString()).ToString("HH:mm:ss");
                Player.SendMessage(p, "> > time spent on server: " + who.time.Split(' ')[0] + " Days, " + who.time.Split(' ')[1] + " Hours, " + who.time.Split(' ')[2] + " Minutes, " + who.time.Split(' ')[3] + " Seconds.");
                Player.SendMessage(p, "> > been logged in for &a" + storedTime);
                Player.SendMessage(p, "> > first logged into the server on &a" + who.firstLogin.ToString("yyyy-MM-dd") + " at " + who.firstLogin.ToString("HH:mm:ss"));
                Player.SendMessage(p, "> > logged in &a" + who.totalLogins + Server.DefaultColor + " times, &c" + who.totalKicked + Server.DefaultColor + " of which ended in a kick.");
                Player.SendMessage(p, "> > " + Awards.awardAmount(who.name) + " awards");
                if (Ban.Isbanned(who.name))
                {
                    string[] data = Ban.Getbandata(who.name);
                    Player.SendMessage(p, "> > is banned for " + data[1] + " by " + data[0]);
                }

                if (who.isDev)
                {
                    Player.SendMessage(p, Server.DefaultColor + "> > Player is a &9Developer");
                    if (Server.forgeProtection == ForgeProtection.Mod || Server.forgeProtection == ForgeProtection.Dev)
                    {
                        Player.SendMessage(p, Server.DefaultColor + "> > Player is &CPROTECTED" + Server.DefaultColor + " under MCForge Staff protection");
                    }
                }
                else if (who.isMod)
                {
                    Player.SendMessage(p, Server.DefaultColor + "> > Player is a &9MCForge Moderator");
                    if (Server.forgeProtection == ForgeProtection.Mod)
                    {
                        Player.SendMessage(p, Server.DefaultColor + "> > Player is &CPROTECTED" + Server.DefaultColor + " under MCForge Staff protection");
                    }
                }
                else if (who.isGCMod)
                {
                    Player.SendMessage(p, Server.DefaultColor + "> > Player is a &9Global Chat Moderator");
                }

                if (!(p != null && (int)p.group.Permission <= CommandOtherPerms.GetPerm(this)))
                {
                    string givenIP;
                    if (Server.bannedIP.Contains(who.ip))
                    {
                        givenIP = "&8" + who.ip + ", which is banned";
                    }
                    else
                    {
                        givenIP = who.ip;
                    }
                    Player.SendMessage(p, "> > the IP of " + givenIP);
                    if (Server.useWhitelist)
                    {
                        if (Server.whiteList.Contains(who.name))
                        {
                            Player.SendMessage(p, "> > Player is &fWhitelisted");
                        }
                    }
                }
            }
            else
            {
                Player.SendMessage(p, "\"" + message + "\" is offline! Using /whowas instead."); Command.all.Find("whowas").Use(p, message);
            }
        }
        public override void Use(Player p, string message)
        {
            if (message.Split(' ').Length > 1)
            {
                Help(p); return;
            }

            int    totalCount  = 0;
            string foundPlayer = "";

            if (message != "")
            {
                if (message.Split(' ').Length == 2)
                {
                    foundPlayer = message.Split(' ')[0];
                    Player who = Player.Find(foundPlayer);
                    if (who != null)
                    {
                        foundPlayer = who.name;
                    }
                    try { totalCount = int.Parse(message.Split(' ')[1]); } catch { Help(p); return; }
                }
                else
                {
                    if (message.Length <= 3)
                    {
                        try { totalCount = int.Parse(message); } catch {
                            foundPlayer = message;
                            Player who = Player.Find(foundPlayer);
                            if (who != null)
                            {
                                foundPlayer = who.name;
                            }
                        }
                    }
                    else
                    {
                        foundPlayer = message;
                        Player who = Player.Find(foundPlayer);
                        if (who != null)
                        {
                            foundPlayer = who.name;
                        }
                    }
                }
            }


            List <Awards.awardData> awardList = new List <Awards.awardData>();

            if (foundPlayer == "")
            {
                awardList = Awards.allAwards;
            }
            else
            {
                foreach (string s in Awards.getPlayersAwards(foundPlayer))
                {
                    Awards.awardData aD = new Awards.awardData();
                    aD.awardName   = s;
                    aD.description = Awards.getDescription(s);
                    awardList.Add(aD);
                }
            }

            if (awardList.Count == 0)
            {
                Player.SendMessage(p, "No awards found."); return;
            }

            if (foundPlayer != "")
            {
                Player.SendMessage(p, Server.FindColor(foundPlayer) + foundPlayer + Server.DefaultColor + " has the following awards:");
            }
            else
            {
                Player.SendMessage(p, "Awards available: ");
            }

            foreach (Awards.awardData aD in awardList)
            {
                Player.SendMessage(p, "&6" + aD.awardName + ": &7" + aD.description);
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     DataGrid1.DataSource = Awards.GetAllAwards();
     DataGrid1.DataBind();
 }
Beispiel #24
0
        public override void Use(Player p, string message, CommandData data)
        {
            bool take = false;

            if (message.CaselessStarts("give "))
            {
                message = message.Substring(5);
            }
            else if (message.CaselessStarts("take "))
            {
                message = message.Substring(5); take = true;
            }

            string[] args = message.SplitSpaces(2);
            if (args.Length < 2)
            {
                Help(p); return;
            }
            string plName = PlayerInfo.FindMatchesPreferOnline(p, args[0]);

            if (plName == null)
            {
                return;
            }
            string award = Matcher.FindAwards(p, args[1]);

            if (award == null)
            {
                p.Message("Use %T/Awards %Sfor a list of awards"); return;
            }

            string displayName = PlayerInfo.GetColoredName(p, plName);

            if (!take)
            {
                if (Awards.GiveAward(plName, award))
                {
                    Chat.MessageGlobal("{0} %Swas awarded: &b{1}", displayName, award);
                    Awards.SavePlayers();
                }
                else if (plName.CaselessEq(p.name))
                {
                    p.Message("You already have that award.");
                }
                else
                {
                    p.Message("{0} %Salready has that award.", displayName);
                }
            }
            else
            {
                if (Awards.TakeAward(plName, award))
                {
                    Chat.MessageGlobal("{0} %Shad their &b{1} %Saward removed", displayName, award);
                    Awards.SavePlayers();
                }
                else if (plName.CaselessEq(p.name))
                {
                    p.Message("You did not have that award to begin with.");
                }
                else
                {
                    p.Message("{0} %Sdid not have that award to begin with.", displayName);
                }
            }
        }