Exemplo n.º 1
0
 public bool Remove(int id)
 {
     if (FindAward(id) != null)
     {
         Awards.Remove(FindAward(id));
         return(true);
     }
     return(false);
 }
Exemplo n.º 2
0
 public bool Remove(string name)
 {
     if (FindAward(name) != null)
     {
         Awards.Remove(FindAward(name));
         return(true);
     }
     return(false);
 }
Exemplo n.º 3
0
        public bool RemoveAward(Guid id)
        {
            Award tmp = Awards.FirstOrDefault(x => x.Id == id);

            if (tmp == null)
            {
                return(false);
            }
            TableUserAward.Remove(id);
            return(Awards.Remove(tmp));
        }
Exemplo n.º 4
0
        public override void Use(Player p, string message, CommandData data)
        {
            if (message.Length == 0 || message.IndexOf(' ') == -1)
            {
                Help(p); return;
            }
            string[] args = message.SplitSpaces(2);

            if (IsCreateCommand(args[0]))
            {
                args = args[1].Split(awardArgs, 2);
                if (args.Length == 1)
                {
                    p.Message("%WUse a : to separate the award name from its description.");
                    Help(p); return;
                }

                if (!Awards.Add(args[0], args[1]))
                {
                    p.Message("This award already exists."); return;
                }
                else
                {
                    Chat.MessageGlobal("Award added: &6{0} : {1}", args[0], args[1]);
                    Awards.SaveAwards();
                }
            }
            else if (IsDeleteCommand(args[0]))
            {
                if (!Awards.Remove(args[1]))
                {
                    p.Message("This award does not exist."); return;
                }
                else
                {
                    Chat.MessageGlobal("Award removed: &6{0}", args[1]);
                    Awards.SaveAwards();
                }
            }
            else
            {
                Help(p);
            }
        }
Exemplo n.º 5
0
        public override void Use(Player p, string message)
        {
            if (message == "" || message.IndexOf(' ') == -1)
            {
                Help(p); return;
            }
            string[] args = message.SplitSpaces(2);
            if (!(args[0].CaselessEq("add") || args[0].CaselessEq("del")))
            {
                Help(p); return;
            }

            if (args[0].CaselessEq("add"))
            {
                args = args[1].Split(awardArgs, 2);
                if (args.Length == 1)
                {
                    Player.Message(p, "&cUse a : to separate the award name from its description.");
                    Help(p); return;
                }

                if (!Awards.Add(args[0], args[1]))
                {
                    Player.Message(p, "This award already exists."); return;
                }
                else
                {
                    Chat.MessageAll("Award added: &6{0} : {1}", args[0], args[1]);
                    Awards.SaveAwards();
                }
            }
            else
            {
                if (!Awards.Remove(args[1]))
                {
                    Player.Message(p, "This award does not exist."); return;
                }
                else
                {
                    Chat.MessageAll("Award removed: &6{0}", args[1]);
                    Awards.SaveAwards();
                }
            }
        }