Beispiel #1
0
        public PlayerInfo(int Number, GameParameters Params)
        {
            this.Name   = "Player " + Number.ToString();
            this.Number = Number;

            this.Params = Params;

            Gold = Params.StartGold;
            Jade = Params.StartJade;

            foreach (var spell in Spells.SpellList)
            {
                SpellCasts.Add(spell.Name, 0);
                SpellCosts.Add(spell.Name, 0);
            }
        }
Beispiel #2
0
        public World(bool Skeleton = false, GameParameters GameParams = null, bool RemoveComputerDragonLords = false)
        {
            Guid = new Random().Next();

            this.RemoveComputerDragonLords = RemoveComputerDragonLords;

            MyPlayerNumber = Program.StartupPlayerNumber;
            PlayerTeams    = Program.Teams;
            PlayerTeamVals = vec(Team.Vals[PlayerTeams[1]], Team.Vals[PlayerTeams[2]], Team.Vals[PlayerTeams[3]], Team.Vals[PlayerTeams[4]]);
            MyTeamNumber   = PlayerTeams[MyPlayerNumber];

            CameraAspect = GameClass.ScreenAspect;

            if (GameParams != null)
            {
                Params = GameParams;
            }
            else
            {
                Params = new GameParameters();
            }

            TeamInfo   = new TeamInfo[5];
            PlayerInfo = new PlayerInfo[5];
            for (int i = 1; i <= 4; i++)
            {
                TeamInfo[i]   = new TeamInfo();
                PlayerInfo[i] = new PlayerInfo(i, Params);
            }

            if (Skeleton)
            {
                return;
            }

            int GridN = 1024;

            DataGroup = new DataGroup(GridN, GridN);

            Markers      = new MarkerList();
            UserMessages = new UserMessageList();

            Minimap = new RenderTarget2D(GameClass.Game.GraphicsDevice, 256, 256);
        }
Beispiel #3
0
        public static void ParseOptions(List <string> args)
        {
            Spectate = false;

            GameStarted     = false;
            WorldLoaded     = false;
            Server          = false;
            Client          = false;
            SteamNetworking = false;

            if (args.Contains("--p"))
            {
                int i = args.IndexOf("--p");
                StartupPlayerNumber = int.Parse(args[i + 1]);

                if (StartupPlayerNumber == 0)
                {
                    Spectate = true;
                }
            }

            if (args.Contains("--t"))
            {
                string teams = args[args.IndexOf("--t") + 1];

                for (int i = 0; i < 4; i++)
                {
                    Teams[i + 1] = int.Parse(teams[i].ToString());
                }
            }

            if (args.Contains("--k"))
            {
                string kingdoms = args[args.IndexOf("--k") + 1];

                for (int i = 0; i < 4; i++)
                {
                    Kingdoms[i] = int.Parse(kingdoms[i].ToString());
                }
            }

            if (args.Contains("--n"))
            {
                int i = args.IndexOf("--n"); NumPlayers = int.Parse(args[i + 1]);
            }

            if (args.Contains("--map"))
            {
                int i = args.IndexOf("--map");
                StartupMap = args[i + 1];
            }

            if (args.Contains("--params"))
            {
                int    i           = args.IndexOf("--params");
                string game_params = args[i + 1];
                StartupGameParams = (GameParameters)JsonConvert.DeserializeObject(game_params, typeof(GameParameters));
                StartupGameParams.Setup();
            }

            if (args.Contains("--spells"))
            {
                int    i      = args.IndexOf("--spells");
                string spells = args[i + 1];
                Spells.SpellInfoDict = (Dictionary <string, SpellInfo>)
                                       JsonConvert.DeserializeObject(spells, typeof(Dictionary <string, SpellInfo>));
            }

            if (args.Contains("--server"))
            {
                Server = true;
            }
            else if (args.Contains("--client"))
            {
                Client = true;
            }

            if (args.Contains("--remove-computer-dragonlords"))
            {
                RemoveComputerDragonLords = true;
            }
            else
            {
                RemoveComputerDragonLords = false;
            }

            if (args.Contains("--steam-networking"))
            {
                SteamNetworking = true;
            }

            if (args.Contains("--steam-users"))
            {
                int index = args.IndexOf("--steam-users");
                int count = int.Parse(args[index + 1]);

                for (int i = 0; i < count; i++)
                {
                    string user = args[index + i + 2];
                    SteamUsers[i] = UInt64.Parse(user);
                }
            }

            SteamSpectators = new List <ulong>();
            if (args.Contains("--steam-spectators"))
            {
                int index = args.IndexOf("--steam-spectators");
                int count = int.Parse(args[index + 1]);

                for (int i = 0; i < count; i++)
                {
                    string user = args[index + i + 2];
                    SteamSpectators.Add(UInt64.Parse(user));
                }
            }

            if (args.Contains("--steam-server"))
            {
                int index = args.IndexOf("--steam-server");

                string user = args[index + 1];
                SteamServer = UInt64.Parse(user);
            }

            if (args.Contains("--ip"))
            {
                int i = args.IndexOf("--ip"); IpAddress = args[i + 1];
            }
            if (args.Contains("--port"))
            {
                int i = args.IndexOf("--port"); Port = int.Parse(args[i + 1]);
            }

            if (args.Contains("--always-active"))
            {
                AlwaysActive = true;
            }
            if (args.Contains("--disable-edge"))
            {
                DisableScreenEdge = true;
            }
            if (args.Contains("--headless"))
            {
                Headless = true;
            }
            if (args.Contains("--maxfps"))
            {
                MaxFps = true;
            }
            if (args.Contains("--console"))
            {
                HasConsole = true;
            }

            if (args.Contains("--w"))
            {
                int i = args.IndexOf("--w"); Width = int.Parse(args[i + 1]);
            }
            if (args.Contains("--h"))
            {
                int i = args.IndexOf("--h"); Height = int.Parse(args[i + 1]);
            }

            if (Log.Debug || args.Contains("--debug"))
            {
                HasConsole = true; AlwaysActive = true;
            }

            // Log settings
            Console.WriteLine("ip set to {0}", IpAddress);
            Console.WriteLine("port set to {0}", Port);

            if (Server)
            {
                Console.WriteLine("We Are Legion Server. Player {0}", StartupPlayerNumber);
            }
            if (Client)
            {
                Console.WriteLine("We Are Legion Client. Player {0}", StartupPlayerNumber);
            }

            if (Headless)
            {
                Console.WriteLine("Headless enabled");
            }
            if (MaxFps)
            {
                Console.WriteLine("Max fps enabled");
            }
            if (HasConsole)
            {
                Console.WriteLine("Console enabled"); ConsoleHelper.CreateConsole();
            }

            if (args.Contains("--double"))
            {
                SetDouble(args);
            }
            if (args.Contains("--quad"))
            {
                SetQuad(args);
            }

            PlayersSteamUser = new UInt64[] { 0, 0, 0, 0, 0 };
            for (int player = 1; player <= 4; player++)
            {
                for (int i = 0; i < 4; i++)
                {
                    if (Program.Kingdoms[i] == player)
                    {
                        PlayersSteamUser[player] = Program.SteamUsers[i];
                    }
                }
            }
        }