public static bool addAward(string awardName, string awardDescription)
        {
            if (awardExists(awardName)) return false;

            awardData aD = new awardData();
            aD.awardName = camelCase(awardName);
            aD.description = awardDescription;
            allAwards.Add(aD);
            return true;
        }
Beispiel #2
0
        public static void Load()
        {
            if (!File.Exists("text/awardsList.txt"))
            {
                using (StreamWriter SW = File.CreateText("text/awardsList.txt"))
                {
                    SW.WriteLine("#This is a full list of awards. The server will load these and they can be awarded as you please");
                    SW.WriteLine("#Format is:");
                    SW.WriteLine("# awardName : Description of award goes after the colon");
                    SW.WriteLine();
                    SW.WriteLine("Gotta start somewhere : Built your first house");
                    SW.WriteLine("Climbing the ladder : Earned a rank advancement");
                    SW.WriteLine("Do you live here? : Joined the server a huge bunch of times");
                }
            }

            allAwards = new List<awardData>();
            foreach (string s in File.ReadAllLines("text/awardsList.txt"))
            {
                if (s == "" || s[0] == '#') continue;
                if (s.IndexOf(" : ") == -1) continue;

                awardData aD = new awardData();

                aD.setAward(s.Split(new string[] { " : " }, StringSplitOptions.None)[0]);
                aD.description = s.Split(new string[] { " : " }, StringSplitOptions.None)[1];

                allAwards.Add(aD);
            }

            playersAwards = new List<playerAwards>();
            if (File.Exists("text/playerAwards.txt"))
            {
                foreach (String s in File.ReadAllLines("text/playerAwards.txt"))
                {
                    if (s.IndexOf(" : ") == -1) continue;

                    playerAwards pA;
                    pA.playerName = s.Split(new string[] { " : " }, StringSplitOptions.None)[0].ToLower();
                    string myAwards = s.Split(new string[] { " : " }, StringSplitOptions.None)[1];

                    pA.awards = new List<string>();
                    if (myAwards.IndexOf(',') != -1)
                        foreach (string a in myAwards.Split(','))
                            pA.awards.Add(camelCase(a));
                    else if (myAwards.Trim() != "")
                        pA.awards.Add(camelCase(myAwards));

                    playersAwards.Add(pA);
                }
            }

            Save();
        }
Beispiel #3
0
        public static bool addAward(string awardName, string awardDescription)
        {
            if (awardExists(awardName))
            {
                return(false);
            }

            awardData aD = new awardData();

            aD.awardName   = camelCase(awardName);
            aD.description = awardDescription;
            allAwards.Add(aD);
            return(true);
        }
Beispiel #4
0
        public static void Load()
        {
            if (!File.Exists("text/awardsList.txt"))
            {
                StreamWriter SW = new StreamWriter(File.Create("text/awardsList.txt"));
                SW.WriteLine("#This is a full list of awards. The server will load these and they can be awarded as you please");
                SW.WriteLine("#Format is:");
                SW.WriteLine("# awardName : Description of award goes after the colon");
                SW.WriteLine();
                SW.WriteLine("Gotta start somewhere : Built your first house");
                SW.WriteLine("Climbing the ladder : Earned a rank advancement");
                SW.WriteLine("Do you live here? : Joined the server a huge bunch of times");
                SW.Flush();
                SW.Close();
            }

            allAwards = new List <awardData>();
            foreach (string s in File.ReadAllLines("text/awardsList.txt"))
            {
                if (s == "" || s[0] == '#')
                {
                    continue;
                }
                if (s.IndexOf(" : ") == -1)
                {
                    continue;
                }

                awardData aD = new awardData();

                aD.setAward(s.Split(new string[] { " : " }, StringSplitOptions.None)[0]);
                aD.description = s.Split(new string[] { " : " }, StringSplitOptions.None)[1];

                allAwards.Add(aD);
            }

            playersAwards = new List <playerAwards>();
            if (File.Exists("text/playerAwards.txt"))
            {
                foreach (String s in File.ReadAllLines("text/playerAwards.txt"))
                {
                    if (s.IndexOf(" : ") == -1)
                    {
                        continue;
                    }

                    playerAwards pA;
                    pA.playerName = s.Split(new string[] { " : " }, StringSplitOptions.None)[0].ToLower();
                    string myAwards = s.Split(new string[] { " : " }, StringSplitOptions.None)[1];

                    pA.awards = new List <string>();
                    if (myAwards.IndexOf(',') != -1)
                    {
                        foreach (string a in myAwards.Split(','))
                        {
                            pA.awards.Add(camelCase(a));
                        }
                    }
                    else if (myAwards.Trim() != "")
                    {
                        pA.awards.Add(camelCase(myAwards));
                    }

                    playersAwards.Add(pA);
                }
            }

            Save();
        }
Beispiel #5
0
        public static void Load()
        {
            if (!File.Exists("text/awardsList.txt"))
            {
                using (StreamWriter SW = File.CreateText("text/awardsList.txt")) {
                    SW.WriteLine("#put awards here");
                }
            }

            allAwards = new List <awardData>();
            foreach (string s in File.ReadAllLines("text/awardsList.txt"))
            {
                if (s == "" || s[0] == '#')
                {
                    continue;
                }
                if (s.IndexOf(" : ") == -1)
                {
                    continue;
                }

                awardData aD = new awardData();

                aD.setAward(s.Split(new string[] { " : " }, StringSplitOptions.None)[0]);
                aD.description = s.Split(new string[] { " : " }, StringSplitOptions.None)[1];

                allAwards.Add(aD);
            }

            playersAwards = new List <playerAwards>();
            if (File.Exists("text/playerAwards.txt"))
            {
                foreach (String s in File.ReadAllLines("text/playerAwards.txt"))
                {
                    if (s.IndexOf(" : ") == -1)
                    {
                        continue;
                    }

                    playerAwards pA;
                    pA.playerName = s.Split(new string[] { " : " }, StringSplitOptions.None)[0].ToLower();
                    string myAwards = s.Split(new string[] { " : " }, StringSplitOptions.None)[1];

                    pA.awards = new List <string>();
                    if (myAwards.IndexOf(',') != -1)
                    {
                        foreach (string a in myAwards.Split(','))
                        {
                            pA.awards.Add(camelCase(a));
                        }
                    }
                    else if (myAwards.Trim() != "")
                    {
                        pA.awards.Add(camelCase(myAwards));
                    }

                    playersAwards.Add(pA);
                }
            }

            Save();
        }