Exemple #1
0
        private void Load_Database_Values()
        {
            Query query = new Query("select * from Player where user_name=\'" + this.user_name + "\'");

            if (query.result.Tables[0].Rows.Count != 0)
            {
                this.ID = (int)query.result.Tables[0].Rows[0]["id"];
                this.strategy = (PLAYER_STRAT)(int)query.result.Tables[0].Rows[0]["strategy"];
                this.credits_current = (int)query.result.Tables[0].Rows[0]["credits_current"];
                this.Asteroids = Parse_Asteroids(query.result.Tables[0].Rows[0]["asteroids"].ToString());
                this.Structures = Parse_Structures(query.result.Tables[0].Rows[0]["structures"].ToString());
                this.Ships_Attacking = Parse_Ships(query.result.Tables[0].Rows[0]["ships_attacking"].ToString());
                this.Ships_Defending = Parse_Ships(query.result.Tables[0].Rows[0]["ships_defending"].ToString());

                this.action_attack = Parse_Action(query.result.Tables[0].Rows[0]["action_attack"].ToString());
                this.action_build_ship = Parse_Action(query.result.Tables[0].Rows[0]["action_build_ship"].ToString());
                this.action_build_struct = Parse_Action(query.result.Tables[0].Rows[0]["action_build_struct"].ToString());
                this.action_research = Parse_Action(query.result.Tables[0].Rows[0]["action_research"].ToString());
                this.action_diplomacy = Parse_Action(query.result.Tables[0].Rows[0]["action_diplomacy"].ToString());
                this.action_direct = Parse_Action(query.result.Tables[0].Rows[0]["action_direct"].ToString());

                this.tech_ship_weapons = (int)query.result.Tables[0].Rows[0]["tech_ship_weapons"];
                this.tech_ship_hp = (int)query.result.Tables[0].Rows[0]["tech_ship_hp"];
                this.tech_ship_engine = (int)query.result.Tables[0].Rows[0]["tech_ship_engine"];
                this.tech_ship_stealth = (int)query.result.Tables[0].Rows[0]["tech_ship_stealth"];
                this.tech_struct_weapons = (int)query.result.Tables[0].Rows[0]["tech_struct_weapons"];
                this.tech_struct_hp = (int)query.result.Tables[0].Rows[0]["tech_struct_hp"];
                this.tech_struct_econ = (int)query.result.Tables[0].Rows[0]["tech_struct_mining"];
                this.tech_struct_research = (int)query.result.Tables[0].Rows[0]["tech_struct_research"];
                this.tech_struct_diplomacy = (int)query.result.Tables[0].Rows[0]["tech_struct_diplomacy"];
                this.tech_construct_speed = (int)query.result.Tables[0].Rows[0]["tech_construct_speed"];
                this.tech_base_sensors = (int)query.result.Tables[0].Rows[0]["tech_base_sensors"];
                this.tech_base_fleet_cap = (int)query.result.Tables[0].Rows[0]["tech_base_fleet_cap"];
                this.tech_base_asteroid_cap = (int)query.result.Tables[0].Rows[0]["tech_base_asteroid_cap"];

                if (this.action_attack.Type == PLAYER_ACTION.ACTION_NO_ACTION)
                {
                    fleet_at_home = true;
                }
                else
                {
                    fleet_at_home = false;
                }
            }
            else
            {
                MainForm.Log("Error! A player got past authentication without existing! Username: " + this.user_name);
            }
        }
Exemple #2
0
 public static object[] Default_Player(int id, string user_name, PLAYER_STRAT strategy)
 {
     return new object[]
     {
     id,                     //ID
     user_name,              //user_name
     (int)strategy,          //strategy
     STARTING_CREDITS,       //credits_current
     STARTING_ASTEROIDS,     //asteroids
     STARTING_STRUCTURES,    //structures
     STARTING_ACTION,        //action_attack
     STARTING_ACTION,        //action_build_ship
     STARTING_ACTION,        //action_build_struct
     STARTING_ACTION,        //action_research
     STARTING_ACTION,        //action_diplomacy
     STARTING_ACTION,        //action_direct
     STARTING_TECH,          //tech_ship_weapons;
     STARTING_TECH,          //tech_ship_hp;
     STARTING_TECH,          //tech_ship_engine;
     STARTING_TECH,          //tech_ship_stealth;
     STARTING_TECH,          //tech_struct_weapons;
     STARTING_TECH,          //tech_struct_hp;
     STARTING_TECH,          //tech_struct_mining;
     STARTING_TECH,          //tech_struct_research;
     STARTING_TECH,          //tech_construct_speed;
     STARTING_TECH,          //tech_base_sensors;
     STARTING_TECH,          //tech_base_fleet_cap;
     STARTING_TECH,          //tech_base_asteroid_cap;
     STARTING_SHIPS,         //ships_attacking
     STARTING_SHIPS,         //ships_defending
     };
 }