コード例 #1
0
        //changes a world's status to status
        public string ChageWorldStatus(int world, string status)
        {
            WarbandsWorld w      = new WarbandsWorld(world);
            string        output = "";

            if (status == "beaming" || status == "dead" || status == "broken")
            {
                if (dwfWorlds.Contains(w))
                {
                    for (int i = 0; i < dwfWorlds.Count; ++i)
                    {
                        if (dwfWorlds[i].Equals(w))
                        {
                            dwfWorlds[i].Status = status;
                            output = "World " + world + " updated.";
                        }
                    }
                }
                else if (elmWorlds.Contains(w))
                {
                    for (int i = 0; i < elmWorlds.Count; ++i)
                    {
                        if (elmWorlds[i].Equals(w))
                        {
                            elmWorlds[i].Status = status;
                            output = "World " + world + " updated.";
                        }
                    }
                }
                else if (rdiWorlds.Contains(w))
                {
                    for (int i = 0; i < rdiWorlds.Count; ++i)
                    {
                        if (rdiWorlds[i].Equals(w))
                        {
                            rdiWorlds[i].Status = status;
                            output = "World " + world + " updated.";
                        }
                    }
                }
                else
                {
                    output = "World " + world + " is not an active world.";
                }
            }
            else
            {
                output = "Invalid status.";
            }

            return(output);
        }
コード例 #2
0
        //checks if the world is registered - returns true/false
        public bool CheckIfWorldRegistered(int worldNum)
        {
            WarbandsWorld w = new WarbandsWorld(worldNum);

            if (dwfWorlds.Contains(w) || elmWorlds.Contains(w) || rdiWorlds.Contains(w))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #3
0
        //adds a world to the correct list
        public string AddWorld(int num, string loc)
        {
            WarbandsWorld w = new WarbandsWorld(num);

            if (loc == "dwf")
            {
                if (!w.IsFreeWorld)
                {
                    dwfWorlds.Add(w);
                    return("World " + num + " added as a " + loc + " world.");
                }
                else
                {
                    return("World " + num + " is an invalid world.");
                }
            }
            else if (loc == "elm")
            {
                if (!w.IsFreeWorld)
                {
                    elmWorlds.Add(w);
                    return("World " + num + " added as a " + loc + " world.");
                }
                else
                {
                    return("World " + num + " is an invalid world.");
                }
            }
            else if (loc == "rdi")
            {
                if (!w.IsFreeWorld)
                {
                    rdiWorlds.Add(w);
                    return("World " + num + " added as a " + loc + " world.");
                }
                else
                {
                    return("World " + num + " is an invalid world.");
                }
            }
            else
            {
                return("Invalid location.");
            }
        }
コード例 #4
0
        private string OutputWorldWithStatus(WarbandsWorld w)
        {
            string output = "";

            if (w.Status == "beaming")
            {
                output = "**" + w.WorldNum + "**";
            }
            else if (w.Status == "broken")
            {
                output = w.WorldNum.ToString();
            }
            else if (w.Status == "dead")
            {
                output = "~~" + w.WorldNum + "~~";
            }

            return(output);
        }