Example #1
0
 public void Load()
 {
     if (File.Exists(path))
     {
         int mxID = 0;
         using (StreamReader sr = new StreamReader(path, System.Text.Encoding.Default))
         {
             string line;
             while ((line = sr.ReadLine()) != null)
             {
                 string[] t = line.Split('*');
                 if (t.Length == 3)
                 {
                     int temp = System.Convert.ToInt32(t[0]);
                     Awards.Add(new Award(temp, t[1], t[2]));
                     if (temp > mxID)
                     {
                         mxID = temp;
                     }
                 }
             }
         }
         Award.count = mxID;
     }
 }
Example #2
0
        /// <summary>
        /// Handles the logic for speed awards.
        /// </summary>
        private static void HandleSpeedAwards()
        {
            if (StepTimer.ActionReady && Stepping)
            {
                var type = DetermineAward("Step", StepCount);
                if (type != "NULL")
                {
                    var award = new Award(type);
                    Awards.Add(award);
                    StepCount = 0;
                    Stepping  = false;
                }
            }

            if (RegenTimer.ActionReady && Regenerating)
            {
                var type = DetermineAward("Regen", RegenCount);
                if (type != "NULL")
                {
                    var award = new Award(type);
                    Awards.Add(award);
                    RegenCount   = 0;
                    Regenerating = false;
                }
            }
        }
Example #3
0
 public bool AddAward(Award award)
 {
     if (Awards.Any(x => x.Id == award.Id || x.Title == award.Title))
     {
         return(false);
     }
     Awards.Add(award);
     return(true);
 }
Example #4
0
 public bool Add(string name, string discr)
 {
     if (FindAward(name) == null)
     {
         Awards.Add(new Award(++Award.count, name, discr));
         return(true);
     }
     return(false);
 }
Example #5
0
 public bool Add(Award note)
 {
     if (FindAward(note.Name) == null)
     {
         Awards.Add(note);
         return(true);
     }
     Award.count--;
     return(false);
 }
Example #6
0
 public bool AddAward(Award award)
 {
     try
     {
         Awards.Add(award.Id, award);
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Example #7
0
 /// <summary>
 /// Handles the logic for kill awards.
 /// </summary>
 private static void HandleKillAwards()
 {
     if (KillTimer.ActionReady && Killing)
     {
         var type = DetermineAward("Kill", KillCount);
         if (type == "NULL")
         {
             return;
         }
         var award = new Award(type);
         Awards.Add(award);
         KillCount = 0;
         Killing   = false;
     }
 }
Example #8
0
 public static void AddDefaults()
 {
     Awards.Add(buyQueue, "Buy a queue level");
     Awards.Add(infectedEnd, "Get infected in last 5 seconds of a round");
     Awards.Add(onlyHuman, "Be the sole human survivor");
     Awards.Add(killLastHuman, "Infect the last human left");
     Awards.Add(killInvisHuman, "Infect a human who is invisible");
     Awards.Add(killHumanTwice, "Infect a human twice in the same round");
     Awards.Add(reviveSurvive, "Survive a round after using a revive");
     Awards.Add(survive5Rounds, "Survive 5 rounds in a row");
     Awards.Add(luckyNumber7, "Win lottery when exactly 7 players joined it");
     Awards.Add(lowWinChance, "Survive on a map with a win chance of 10% or les");
     Awards.Add(starKiller, "Kill a human with a golden star.");
     Awards.Add(afkKiller, "Infect an auto-afk human");
     Awards.Add(humanKiller, "Infect 10 humans in a row");
 }
Example #9
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);
            }
        }
Example #10
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();
                }
            }
        }
        public static Awards LoadTestData(
            this Awards awards,
            Coins coins
            )
        {
            var rnd = new Random();

            foreach (var coin in coins)
            {
                awards.Add(
                    new Award()
                {
                    CoinRefId = coin.EntityRefId,
                    Value     = rnd.Next(2, 10),
                });
            }

            return(awards);
        }
Example #12
0
        internal void ApplyInternal(CryptoAwarded awarded)
        {
            Awards.Add(awarded);

            StateUpdateLoop();
        }
Example #13
0
 public void GetAward(Award award)
 {
     Awards.Add(award);
 }
Example #14
0
 /// <summary>
 /// Adds an award to the list of awards.
 /// </summary>
 /// <param name="award">The award to add</param>
 public void AddAward(Award award)
 {
     Awards.Add(award);
 }