public PersonGenerateParam(GameScenario scenario, Architecture foundLocation, Person finder, bool inGame, PersonGeneratorType preferredType, bool isAI)
 {
     this.scenario = scenario;
     this.foundLocation = foundLocation;
     this.finder = finder;
     this.inGame = inGame;
     this.preferredType = preferredType;
     this.isAI = isAI;
 }
示例#2
0
        public List<string> LoadPersonGeneratorTypes(OleDbConnection connection, GameScenario scen)
        {
            connection.Open();
            OleDbDataReader reader = new OleDbCommand("Select * From PersonGeneratorType", connection).ExecuteReader();
            bool hasZero = false;
            while (reader.Read())
            {
                PersonGeneratorType type = new PersonGeneratorType();
                type.ID = (int)reader["ID"];
                if (type.ID == 0)
                {
                    hasZero = true;
                }
                type.Name = reader["TypeName"].ToString();
                type.generationChance = (int)reader["GenerationChance"];
                type.commandLo = (int)reader["CommandLo"];
                type.commandHi = (int)reader["CommandHi"];
                type.strengthLo = (int)reader["StrengthLo"];
                type.strengthHi = (int)reader["StrengthHi"];
                type.intelligenceLo = (int)reader["IntelligenceLo"];
                type.intelligenceHi = (int)reader["IntelligenceHi"];
                type.politicsLo = (int)reader["PoliticsLo"];
                type.politicsHi = (int)reader["PoliticsHi"];
                type.glamourLo = (int)reader["GlamourLo"];
                type.glamourHi = (int)reader["GlamourHi"];
                type.braveLo = (int)reader["BraveLo"];
                type.braveHi = (int)reader["BraveHi"];
                type.calmnessLo = (int)reader["CalmnessLo"];
                type.calmnessHi = (int)reader["CalmnessHi"];
                type.personalLoyaltyLo = (int)reader["PersonalLoyaltyLo"];
                type.personalLoyaltyHi = (int)reader["PersonalLoyaltyHi"];
                type.ambitionLo = (int)reader["AmbitionLo"];
                type.ambitionHi = (int)reader["AmbitionHi"];
                type.titleChance = (int)reader["TitleChance"];
                type.affectedByRateParameter = (bool)reader["AffectedByRateParameter"];
                this.AllPersonGeneratorTypes.Add(type);
            }
            connection.Close();

            // for backward compatibility
            if (!hasZero)
            {
                foreach (PersonGeneratorType type in this.AllPersonGeneratorTypes)
                {
                    type.ID--;
                }
            }

            return new List<string>();
        }
 public PersonGenerateParam(GameScenario scenario, Architecture foundLocation, Person finder, bool inGame, PersonGeneratorType preferredType, bool isAI)
 {
     this.scenario      = scenario;
     this.foundLocation = foundLocation;
     this.finder        = finder;
     this.inGame        = inGame;
     this.preferredType = preferredType;
     this.isAI          = isAI;
 }
        public List<string> LoadPersonGeneratorTypes(OleDbConnection connection, GameScenario scen)
        {
            connection.Open();
            OleDbDataReader reader = new OleDbCommand("Select * From PersonGeneratorType", connection).ExecuteReader();
            bool hasZero = false;
            while (reader.Read())
            {
                PersonGeneratorType type = new PersonGeneratorType();
                type.ID = (int)reader["ID"];
                if (type.ID == 0)
                {
                    hasZero = true;
                }
                type.Name = reader["TypeName"].ToString();
                type.generationChance = (int)reader["GenerationChance"];
                type.commandLo = (int)reader["CommandLo"];
                type.commandHi = (int)reader["CommandHi"];
                type.strengthLo = (int)reader["StrengthLo"];
                type.strengthHi = (int)reader["StrengthHi"];
                type.intelligenceLo = (int)reader["IntelligenceLo"];
                type.intelligenceHi = (int)reader["IntelligenceHi"];
                type.politicsLo = (int)reader["PoliticsLo"];
                type.politicsHi = (int)reader["PoliticsHi"];
                type.glamourLo = (int)reader["GlamourLo"];
                type.glamourHi = (int)reader["GlamourHi"];
                type.braveLo = (int)reader["BraveLo"];
                type.braveHi = (int)reader["BraveHi"];
                type.calmnessLo = (int)reader["CalmnessLo"];
                type.calmnessHi = (int)reader["CalmnessHi"];
                type.personalLoyaltyLo = (int)reader["PersonalLoyaltyLo"];
                type.personalLoyaltyHi = (int)reader["PersonalLoyaltyHi"];
                type.ambitionLo = (int)reader["AmbitionLo"];
                type.ambitionHi = (int)reader["AmbitionHi"];
                type.titleChance = (int)reader["TitleChance"];
                type.affectedByRateParameter = (bool)reader["AffectedByRateParameter"];

                try
                {
                    type.CostFund = (int)reader["CostFund"];

                }
                catch
                {
                    switch (type.ID)
                    {
                        case 0:
                        case 1:
                        case 2:
                        case 3:
                            type.CostFund = 80000;
                            break;

                        case 4:
                            type.CostFund = 120000;
                            break;

                        case 5:
                            type.CostFund = 150000;
                            break;

                        case 6:
                            type.CostFund = 250000;
                            break;

                        case 7:
                        case 8:
                        case 9:
                            type.CostFund = 15000;
                            break;
                    }
                }
                try
                {
                    type.TypeCount = (int)reader["TypeCount"];

                }
                catch
                {

                    type.TypeCount = 0;
                }

                try
                {
                    type.FactionLimit = (int)reader["FactionLimit"];
                }
                catch
                {
                    switch (type.ID)
                    {
                        case 0:
                        case 1:
                        case 2:
                        case 3:
                        case 4:
                            type.FactionLimit = 10;
                            break;

                        case 5:
                        case 6:
                            type.FactionLimit = 1;
                            break;

                        case 7:
                        case 8:
                        case 9:
                            type.FactionLimit = 9;
                            break;

                    }
                }
                this.AllPersonGeneratorTypes.Add(type);
            }
            connection.Close();

            // for backward compatibility
            if (!hasZero)
            {
                foreach (PersonGeneratorType type in this.AllPersonGeneratorTypes)
                {
                    type.ID--;
                }
            }

            return new List<string>();
        }