Beispiel #1
0
        public void CreateNewColony()
        {
            Entity            faction = FactionFactory.CreateFaction(_game, "Terran");
            StarSystemFactory sysfac  = new StarSystemFactory(_game);
            StarSystem        sol     = sysfac.CreateSol(_game);
            //Entity starSystem = Entity.Create(_game.GlobalManager);
            //Entity planet = Entity.Create(starSystem.Manager, new List<BaseDataBlob>());
            List <Entity> solBodies         = sol.SystemManager.GetAllEntitiesWithDataBlob <NameDB>(_smAuthToken);
            Entity        planet            = solBodies.Find(item => item.GetDataBlob <NameDB>().DefaultName == "Earth");
            Entity        species           = SpeciesFactory.CreateSpeciesHuman(faction, _game.GlobalManager);
            var           requiredDataBlobs = new List <Type>()
            {
                typeof(ColonyInfoDB),
                typeof(NameDB),
                typeof(InstallationsDB)
            };

            //Entity colony = ColonyFactory.CreateColony(faction, planet);
            ColonyFactory.CreateColony(faction, species, planet);
            Entity       colony       = faction.GetDataBlob <FactionInfoDB>().Colonies[0];
            ColonyInfoDB colonyInfoDB = colony.GetDataBlob <ColonyInfoDB>();

            //NameDB nameDB = colony.GetDataBlob<NameDB>();

            //Assert.IsTrue(HasAllRequiredDatablobs(colony, requiredDataBlobs), "Colony Entity doesn't contains all required datablobs");
            Assert.IsTrue(colonyInfoDB.PlanetEntity == planet, "ColonyInfoDB.PlanetEntity refs to wrong entity");
        }
    public static ExplorationEvent stealEggs()
    {
        ExplorationEvent e = new ExplorationEvent();

        AnimalDef chicken = new AnimalDef();

        chicken.SizeTrait    = SizeFactory.createTiny();
        chicken.SpeciesTrait = SpeciesFactory.createChicken();

        List <AnimalDef> twoChickens = new List <AnimalDef>()
        {
            chicken, chicken
        };

        List <ExplorationCriteria> variableChickenReward = new List <ExplorationCriteria>()
        {
            new ExplorationCriteria(TraitFactory.Attribute.Fighting.ToString(), int.MinValue, 6, new RewardImpl.RandomAnimalPenalty()),
            new ExplorationCriteria(TraitFactory.Attribute.Fighting.ToString(), 6, 10, new RewardImpl.DoNothingReward("The Chicken looks kinda scary, and you back off.")),
            new ExplorationCriteria(TraitFactory.Attribute.Fighting.ToString(), 10, 20, new RewardImpl.AnimalReward(chicken, "You defeat the mother and get one unbroken egg from the nest.")),
            new ExplorationCriteria(TraitFactory.Attribute.Fighting.ToString(), 20, int.MaxValue, new RewardImpl.AnimalReward(twoChickens, "After defeating the mother there are two viable eggs left in the nest."))
        };

        e.description = "You see a nest with a few eggs.  Its mother, a hugely oversized chicken, is nearby.";
        e.options     = new List <ExplorationEvent.Option>()
        {
            new ExplorationEvent.Option("Fight the chicken", variableChickenReward),
            new ExplorationEvent.Option("Run like the wind", TraitFactory.Attribute.Tracking.ToString(), 4, new RewardImpl.DoNothingReward("You run away"), new RewardImpl.RandomAnimalPenalty(), new List <string>()),
            new ExplorationEvent.Option("Build a defensive wall", TraitFactory.Attribute.Strength.ToString(), 20, new RewardImpl.DoNothingReward("You build a wall and make the chicken pay for it."), new RewardImpl.RandomAnimalPenalty(), new List <string>())
        };

        return(e);
    }
Beispiel #3
0
        Entity CreateNewSpecies(GameVM gameVM)
        {
            NameDB    name    = new NameDB(Name);
            SpeciesDB species = new SpeciesDB(BaseGravity.Value,
                                              MinGravity.Value, MaxGravity.Value,
                                              BasePressure.Value, MinPressure.Value,
                                              MaxPressure.Value, BaseTemprature.Value,
                                              MinTemprature.Value, MaxTemprature.Value);

            return(SpeciesFactory.CreateSpeciesFromBlobs(gameVM.CurrentFaction, gameVM.Game.GlobalManager, name, species));
        }
Beispiel #4
0
        private List <Species> GetSpecies(SQLQueryResult sQLQueryResult)
        {
            List <Species> species = new List <Species>();
            {
                for (int i = 0; i < sQLQueryResult.dataTable.Rows.Count; i++)
                {
                    int    speciesID   = (int)sQLQueryResult.dataTable.Rows[i]["SpeciesID"];
                    string speciesName = (String)sQLQueryResult.dataTable.Rows[i]["SpeciesName"];

                    species.Add(SpeciesFactory.Instance().CreateSpecies(speciesID, speciesName));
                }
                return(species);
            }
        }
Beispiel #5
0
        private List <Cage> GetCageList(SQLQueryResult sQLQueryResult)
        {
            List <Cage> cages = new List <Cage>();

            for (int i = 0; i < sQLQueryResult.dataTable.Rows.Count; i++)
            {
                int    cageID      = (int)sQLQueryResult.dataTable.Rows[i]["CageID"];
                int    speciesID   = (int)sQLQueryResult.dataTable.Rows[i]["SpeciesID"];
                string speciesName = (string)sQLQueryResult.dataTable.Rows[i]["SpeciesName"];

                Species species = SpeciesFactory.Instance().CreateSpecies(speciesID, speciesName);

                cages.Add(CageFactory.Instance().CreateCage(cageID, species));
            }
            return(cages);
        }
Beispiel #6
0
    public void Initialize()
    {
        //Create N plots and M animals in the first plot
        int n = 9;

        foreach (var i in System.Linq.Enumerable.Range(0, n))
        {
            createPlot();
        }
        //Start with 2 chickens and a wolf
        getSomePlot().addAnimal(AnimalFactory.Instance.createAnimal
                                    (SpeciesFactory.createChicken(), SizeFactory.createTiny(), /* age: youngAdult */ 5));
        getSomePlot().addAnimal(AnimalFactory.Instance.createAnimal
                                    (SpeciesFactory.createChicken(), SizeFactory.createTiny(), /* age: youngAdult */ 5));
        getSomePlot().addAnimal(AnimalFactory.Instance.createAnimal
                                    (SpeciesFactory.createWolf(), SizeFactory.createMidsized(), /* age: youngAdult */ 5));
    }
 protected override void InitializeValuesAndReferences() {
     base.InitializeValuesAndReferences();
     _speciesFactory = SpeciesFactory.Instance;
     _leaderFactory = LeaderFactory.Instance;
     int maxAiPlayerQty = TempGameValues.MaxAIPlayers;
     _aiPlayersSpecies = new Species[maxAiPlayerQty];
     _aiPlayersSpeciesSelections = new SpeciesGuiSelection[maxAiPlayerQty];
     _aiPlayersColors = new GameColor[maxAiPlayerQty];
     _aiPlayersIQs = new IQ[maxAiPlayerQty];
     _aiPlayersTeams = new TeamID[maxAiPlayerQty];
     _aiPlayersStartLevels = new EmpireStartLevel[maxAiPlayerQty];
     _aiPlayersStartLevelSelections = new EmpireStartLevelGuiSelection[maxAiPlayerQty];
     _aiPlayersHomeSystemDesirability = new SystemDesirability[maxAiPlayerQty];
     _aiPlayersHomeSystemDesirabilitySelections = new SystemDesirabilityGuiSelection[maxAiPlayerQty];
     _aiPlayersUserSeparations = new PlayerSeparation[maxAiPlayerQty];
     _aiPlayersUserSeparationSelections = new PlayerSeparationGuiSelection[maxAiPlayerQty];
 }
Beispiel #8
0
        private List <Animal> GetAnimalList(SQLQueryResult sQLQueryResult)
        {
            List <Animal> animals = new List <Animal>();

            for (int i = 0; i < sQLQueryResult.dataTable.Rows.Count; i++)
            {
                Employee employee = null;
                if (sQLQueryResult.dataTable.Rows[i].IsNull("EmployeeID"))
                {
                }
                else
                {
                    string titleName = (string)sQLQueryResult.dataTable.Rows[i]["TitleName"];
                    int    titleID   = (int)sQLQueryResult.dataTable.Rows[i]["TitleID"];
                    Title  title     = TitleFactory.Instance().CreateTitle(titleName, titleID);

                    string employeeName   = (string)sQLQueryResult.dataTable.Rows[i]["EmployeeName"];
                    int    employeeID     = (int)sQLQueryResult.dataTable.Rows[i]["EmployeeID"];
                    bool   employeeActive = (bool)sQLQueryResult.dataTable.Rows[i]["EmployeeActive"];

                    employee = EmployeeFactory.Instance().CreateEmployee(employeeID, employeeName, employeeActive, title);
                }
                int      CustomerID     = (int)sQLQueryResult.dataTable.Rows[i]["CustomerID"];
                string   customerName   = (string)sQLQueryResult.dataTable.Rows[i]["customername"];
                string   customeradress = (string)sQLQueryResult.dataTable.Rows[i]["Adress"];
                string   customerphone  = (string)sQLQueryResult.dataTable.Rows[i]["Phone"];
                string   customeremail  = (string)sQLQueryResult.dataTable.Rows[i]["Email"];
                bool     customeractive = (bool)sQLQueryResult.dataTable.Rows[i]["Active"];
                Customer customer       = CustomerFactory.Instance().CreateCustomer(CustomerID, customerName, customeradress, customerphone, customeremail, customeractive, 0);
                int      animalID       = (int)sQLQueryResult.dataTable.Rows[i]["AnimalID"];
                string   name           = (string)sQLQueryResult.dataTable.Rows[i]["Name"];
                DateTime birthday       = (DateTime)sQLQueryResult.dataTable.Rows[i]["BirthYear"];
                int      speciesID      = (int)sQLQueryResult.dataTable.Rows[i]["Speciesid"];
                string   speciesName    = (string)sQLQueryResult.dataTable.Rows[i]["SpeciesName"];
                Species  species        = SpeciesFactory.Instance().CreateSpecies(speciesID, speciesName);
                double   weight         = Convert.ToDouble((decimal)sQLQueryResult.dataTable.Rows[i]["Weight"]);
                bool     gender         = (bool)sQLQueryResult.dataTable.Rows[i]["Gender"];
                bool     active         = (bool)sQLQueryResult.dataTable.Rows[i]["Active"];

                animals.Add(AnimalFactory.Instance().CreateAnimal(customer, animalID, name, birthday, species, weight, gender, employee, true));
            }
            return(animals);
        }
        public static BackendInstance GetInstance(UIAdapter ui, Random rng = null)
        {
            Logger.Debug("Creating backend instance.");

            SpeciesFileDescription speciesFileDescription = FileSystemService.GetSpeciesMappings();

            // Map species classes to list of species
            IEnumerable <(SpeciesClass, IList <SpeciesMapping>)> speciesClassMappings =
                speciesFileDescription
                .SpeciesClassMappings
                .Select(classMapping => (
                            SpeciesFactory.GetSpeciesClass(classMapping)
                            , classMapping.SpeciesClassSpeciesMappings))
                .ToList();

            IEnumerable <Species> species
                = speciesClassMappings
                  .AsParallel()
                  .SelectMany(tuple => {
                SpeciesClass parentClass = tuple.Item1;
                IList <SpeciesMapping> speciesMappings = tuple.Item2;

                IEnumerable <Species> childrenSpecies
                    = new List <Species>(speciesMappings.Count);

                childrenSpecies = childrenSpecies
                                  .Concat(speciesMappings.Select(
                                              s => SpeciesFactory.GetSpecies(s, parentClass)));

                return(childrenSpecies);
            }).ToList();

            Random rngToUse = rng ?? new Random();

            BackendInstance instance = new BackendInstance(ui, species, rngToUse);

            Logger.Debug("Species loaded and models created.");

            return(instance);
        }
Beispiel #10
0
        internal TestGame(int numSystems = 10)
        {
            GameSettings = new  NewGameSettings {
                GameName = "Unit Test Game", MaxSystems = numSystems, CreatePlayerFaction = false
            };

            Game = new Game(GameSettings);

            // add a faction:
            HumanFaction = FactionFactory.CreateFaction(Game, "New Terran Utopian Empire");

            // add a species:
            HumanSpecies = SpeciesFactory.CreateSpeciesHuman(HumanFaction, Game.GlobalManager);

            // add another faction:
            GreyAlienFaction = FactionFactory.CreateFaction(Game, "The Grey Empire");
            // Add another species:
            GreyAlienSpecies = SpeciesFactory.CreateSpeciesHuman(GreyAlienFaction, Game.GlobalManager);

            // Greys Name the Humans.
            HumanSpecies.GetDataBlob <NameDB>().SetName(GreyAlienFaction.Guid, "Stupid Terrans");
            // Humans name the Greys.
            GreyAlienSpecies.GetDataBlob <NameDB>().SetName(HumanFaction.Guid, "Space bugs");


            StarSystemFactory starfac = new StarSystemFactory(Game);

            Sol         = starfac.CreateSol(Game);
            Earth       = NameLookup.GetFirstEntityWithName(Sol, "Earth"); //Sol.Entities[3]; //should be fourth entity created
            EarthColony = ColonyFactory.CreateColony(HumanFaction, HumanSpecies, Earth);

            DefaultEngineDesign = DefaultStartFactory.DefaultThrusterDesign(Game, HumanFaction);
            DefaultWeaponDesign = DefaultStartFactory.DefaultSimpleLaser(Game, HumanFaction);
            DefaultShipDesign   = DefaultStartFactory.DefaultShipDesign(Game, HumanFaction);

            Vector3 position = Earth.GetDataBlob <PositionDB>().AbsolutePosition_AU;

            DefaultShip = ShipFactory.CreateShip(DefaultShipDesign, HumanFaction, position, Earth, Sol, "Serial Peacemaker");
            Sol.SetDataBlob(DefaultShip.ID, new TransitableDB());
        }
Beispiel #11
0
        internal static Game CreateTestUniverse(int numSystems, DateTime testTime, bool generateDefaultHumans = false)
        {
            var gamesettings = new NewGameSettings {
                GameName = "Unit Test Game", StartDateTime = testTime, MaxSystems = numSystems, DefaultSolStart = generateDefaultHumans, CreatePlayerFaction = false
            };

            var game = new Game(gamesettings);

            var smAuthToken = new AuthenticationToken(game.SpaceMaster);

            // Systems are currently generated in the Game Constructor.
            // Later, Systems will be initialized in the game constructor, but not actually generated until player discovery.
            //game.GenerateSystems(smAuthToken, numSystems);

            // add a faction:
            Entity humanFaction = FactionFactory.CreateFaction(game, "New Terran Utopian Empire");

            // add a species:
            Entity humanSpecies = SpeciesFactory.CreateSpeciesHuman(humanFaction, game.GlobalManager);

            // add another faction:
            Entity greyAlienFaction = FactionFactory.CreateFaction(game, "The Grey Empire");
            // Add another species:
            Entity greyAlienSpecies = SpeciesFactory.CreateSpeciesHuman(greyAlienFaction, game.GlobalManager);

            // Greys Name the Humans.
            humanSpecies.GetDataBlob <NameDB>().SetName(greyAlienFaction.Guid, "Stupid Terrans");
            // Humans name the Greys.
            greyAlienSpecies.GetDataBlob <NameDB>().SetName(humanFaction.Guid, "Space bugs");
            //TODO Expand the "Test Universe" to cover more datablobs and entities. And ships. Etc.

            if (generateDefaultHumans)
            {
                DefaultStartFactory.DefaultHumans(game, "Humans");
            }

            return(game);
        }
Beispiel #12
0
        public Animal GetAnimal(int animalID)
        {
            string query = Utility.ReadSQLQueryFromFile("GetAnimal.txt");

            SQLQuery sQLQuery = new SQLQuery(query);

            sQLQuery.AddParameter("@animalid", animalID.ToString(), SqlDbType.Int);

            SQLQueryResult sQLQueryResult = SQLDatabaseConnector.QueryDatabase(sQLQuery);

            DataRow dataRow = sQLQueryResult.dataTable.Rows[0];

            int      CustomerID     = (int)sQLQueryResult.dataTable.Rows[0]["CustomerID"];
            string   customerName   = (string)sQLQueryResult.dataTable.Rows[0]["customername"];
            string   customeradress = (string)sQLQueryResult.dataTable.Rows[0]["Adress"];
            string   customerphone  = (string)sQLQueryResult.dataTable.Rows[0]["Phone"];
            string   customeremail  = (string)sQLQueryResult.dataTable.Rows[0]["Email"];
            bool     customeractive = (bool)sQLQueryResult.dataTable.Rows[0]["Active"];
            Customer customer       = CustomerFactory.Instance().CreateCustomer(CustomerID, customerName, customeradress, customerphone, customeremail, customeractive, 0);

            string speciesName = sQLQueryResult.dataTable.Rows[0]["SpeciesName"].ToString();

            int speciesID = (int)sQLQueryResult.dataTable.Rows[0]["SpeciesID"];

            Species species = SpeciesFactory.Instance().CreateSpecies(speciesID, speciesName);

            string name = sQLQueryResult.dataTable.Rows[0]["SpeciesName"].ToString();

            int employeeID = (int)sQLQueryResult.dataTable.Rows[0]["EmployeeID"];

            Employee employee = EmployeeFactory.Instance().GetEmployee(employeeID, name);

            Animal animal = new Animal(customer, (int)dataRow["AnimalID"], (string)dataRow["Name"], (DateTime)dataRow["BirthYear"], species, (double)dataRow["Weight"], (bool)dataRow["Gender"], employee, (bool)dataRow["Active"]);

            return(animal);
        }
 public GameObject createLobster()
 {
     return(createAnimal(SpeciesFactory.createLobster(), SizeFactory.createSmall()));
 }
 public GameObject createBison()
 {
     return(createAnimal(SpeciesFactory.createBison(), SizeFactory.createHuge()));
 }
 public GameObject createWolf()
 {
     return(createAnimal(SpeciesFactory.createWolf(), SizeFactory.createMidsized()));
 }
Beispiel #16
0
        private List <Treatment> GetTreatmentList(SQLQueryResult sQLQueryResult)
        {
            List <Treatment> treatments = new List <Treatment>();

            for (int i = 0; i < sQLQueryResult.dataTable.Rows.Count; i++)
            {
                int           treatmentID;
                TreatmentType treatmentType;
                Employee      employee;
                Employee      animalEmployee = null;
                OperationRoom operationRoom;
                Cage          cage;
                Item          item;
                int           animalID;
                Title         title;


                if (sQLQueryResult.dataTable.Rows[i].IsNull("TreatmentID"))
                {
                    treatmentID = -1;
                }
                else
                {
                    treatmentID = (int)sQLQueryResult.dataTable.Rows[i]["TreatmentID"];
                }
                if (sQLQueryResult.dataTable.Rows[i].IsNull("TreatmentTypeID"))
                {
                    treatmentType = null;
                }
                else
                {
                    int    treatmentTypeID   = (int)sQLQueryResult.dataTable.Rows[i]["TreatmentTypeID"];
                    string treatmentTypeName = (string)sQLQueryResult.dataTable.Rows[i]["Name"];

                    TreatmentType newTreatmentType = TreatmentTypeFactory.Instance().CreateTreatmentType(treatmentTypeID, treatmentTypeName);

                    treatmentType = newTreatmentType;
                }
                if (sQLQueryResult.dataTable.Rows[i].IsNull("OperationRoomID"))
                {
                    operationRoom = null;
                }
                else
                {
                    int operationRoomID = (int)sQLQueryResult.dataTable.Rows[i]["OperationRoomID"];

                    operationRoom = OperationRoomFactory.Instance().CreateOperationRoom(operationRoomID);
                }

                if (sQLQueryResult.dataTable.Rows[i].IsNull("CageID"))
                {
                    cage = null;
                }
                else
                {
                    int    cageID      = (int)sQLQueryResult.dataTable.Rows[i]["CageID"];
                    int    speciesID   = (int)sQLQueryResult.dataTable.Rows[i]["SpeciesID"];
                    string speciesName = (string)sQLQueryResult.dataTable.Rows[i]["SpeciesName"];

                    Species species = SpeciesFactory.Instance().CreateSpecies(speciesID, speciesName);

                    cage = CageFactory.Instance().CreateCage(cageID, species);
                }


                if (sQLQueryResult.dataTable.Rows[i].IsNull("ItemID"))
                {
                    item = null;
                }
                else
                {
                    int     itemID       = (int)sQLQueryResult.dataTable.Rows[i]["ItemID"];
                    string  name         = (string)sQLQueryResult.dataTable.Rows[i]["ItemName"];
                    decimal price        = (decimal)sQLQueryResult.dataTable.Rows[i]["Price"];
                    decimal costPrice    = (decimal)sQLQueryResult.dataTable.Rows[i]["CostPrice"];
                    int     amount       = (int)sQLQueryResult.dataTable.Rows[i]["Amount"];
                    bool    prescription = (bool)sQLQueryResult.dataTable.Rows[i]["Prescription"];
                    bool    treatment    = (bool)sQLQueryResult.dataTable.Rows[i]["ItemTreatment"];
                    bool    itemActive   = (bool)sQLQueryResult.dataTable.Rows[i]["ItemActive"];

                    item = ItemFactory.Instance().CreateItem(itemID, name, amount, price, costPrice, prescription, treatment, itemActive);
                }

                if (sQLQueryResult.dataTable.Rows[i].IsNull("EmployeeID"))
                {
                    employee = null;
                }
                else
                {
                    int    employeeID = (int)sQLQueryResult.dataTable.Rows[i]["EmployeeID"];
                    string name       = (string)sQLQueryResult.dataTable.Rows[i]["Employeename"];
                    int    titleID    = (int)sQLQueryResult.dataTable.Rows[i]["TitleID"];
                    string titleName  = (string)sQLQueryResult.dataTable.Rows[i]["TitleName"];

                    title    = TitleFactory.Instance().CreateTitle(titleName, titleID);
                    employee = EmployeeFactory.Instance().CreateEmployee(employeeID, name, true, title);
                }

                animalID = (int)sQLQueryResult.dataTable.Rows[i]["AnimalID"];
                if (!sQLQueryResult.dataTable.Rows[i].IsNull("AnimalEmployeeID"))
                {
                    int    animalTitleID   = (int)sQLQueryResult.dataTable.Rows[i]["AnimalEmployeeTitleID"];
                    string animalTitleName = (string)sQLQueryResult.dataTable.Rows[i]["AnimalEmployeeTitle"];

                    Title animalEmployeeTitle = TitleFactory.Instance().CreateTitle(animalTitleName, animalTitleID);

                    int    animalEmployeeID   = (int)sQLQueryResult.dataTable.Rows[i]["AnimalEmployeeID"];
                    string animalEmployeeName = (string)sQLQueryResult.dataTable.Rows[i]["AnimalEmployeeName"];

                    bool animalEmployeeActive = (bool)sQLQueryResult.dataTable.Rows[i]["AnimalEmployeeActive"];


                    animalEmployee = EmployeeFactory.Instance().CreateEmployee(animalEmployeeID, animalEmployeeName, animalEmployeeActive, animalEmployeeTitle);
                }

                int    animalSpeciesID   = (int)sQLQueryResult.dataTable.Rows[i]["AnimalSpeciesID"];
                string animalSpeciesName = (string)sQLQueryResult.dataTable.Rows[i]["AnimalSpeciesName"];

                Species animalSpecies = SpeciesFactory.Instance().CreateSpecies(animalSpeciesID, animalSpeciesName);

                int    customerID      = (int)sQLQueryResult.dataTable.Rows[i]["CustomerID"];
                string customerName    = (string)sQLQueryResult.dataTable.Rows[i]["CustomerName"];
                string customerAddress = (string)sQLQueryResult.dataTable.Rows[i]["Adress"];
                string customerPhone   = (string)sQLQueryResult.dataTable.Rows[i]["Phone"];
                string customerEmail   = (string)sQLQueryResult.dataTable.Rows[i]["Email"];
                bool   customerActive  = (bool)sQLQueryResult.dataTable.Rows[i]["CustomerActive"];

                Customer customer = CustomerFactory.Instance().CreateCustomer(customerID, customerName, customerAddress, customerPhone, customerEmail, customerActive, 0);


                string   animalName     = (string)sQLQueryResult.dataTable.Rows[i]["AnimalName"];
                DateTime animalBirthday = (DateTime)sQLQueryResult.dataTable.Rows[i]["BirthYear"];
                bool     animalGender   = (bool)sQLQueryResult.dataTable.Rows[i]["Gender"];
                double   animalWeight   = Convert.ToDouble((decimal)sQLQueryResult.dataTable.Rows[i]["Weight"]);
                bool     animalActive   = (bool)sQLQueryResult.dataTable.Rows[i]["AnimalActive"];

                Animal animal = AnimalFactory.Instance().CreateAnimal(customer, animalID, animalName, animalBirthday, animalSpecies, animalWeight, animalGender, animalEmployee, animalActive);

                if (sQLQueryResult.dataTable.Rows[i].IsNull("AnimalID"))
                {
                    animalID = -1;
                }
                else
                {
                    animalID = (int)sQLQueryResult.dataTable.Rows[i]["AnimalID"];
                }
                DateTime startTime = (DateTime)sQLQueryResult.dataTable.Rows[i]["StartTime"];
                DateTime endTime   = (DateTime)sQLQueryResult.dataTable.Rows[i]["EndTime"];
                bool     payed     = (bool)sQLQueryResult.dataTable.Rows[i]["Payed"];
                string   headline  = (string)sQLQueryResult.dataTable.Rows[i]["Headline"];
                bool     active    = (bool)sQLQueryResult.dataTable.Rows[i]["Active"];
                int      status    = (int)sQLQueryResult.dataTable.Rows[i]["Status"];

                treatments.Add(TreatmentFactory.Instance().CreateTreatment(treatmentID, treatmentType, operationRoom, cage, item, startTime, endTime, payed, headline, active, animal, employee, status));
            }
            return(treatments);
        }
Beispiel #17
0
        private List <Prescription> GetAllPrescriptionList(SQLQueryResult sQLQueryResult)
        {
            List <Prescription> prescriptions = new List <Prescription>();

            for (int i = 0; i < sQLQueryResult.dataTable.Rows.Count; i++)
            {
                int      prescriptionID;
                Employee employee;
                Animal   animal;
                Item     item;
                Title    title;

                if (sQLQueryResult.dataTable.Rows[i].IsNull("EmployeeID"))
                {
                    employee = null;
                }
                else
                {
                    int    employeeID = (int)sQLQueryResult.dataTable.Rows[i]["EmployeeID"];
                    string name       = (string)sQLQueryResult.dataTable.Rows[i]["Employeename"];
                    int    titleID    = (int)sQLQueryResult.dataTable.Rows[i]["TitleID"];
                    string titleName  = (string)sQLQueryResult.dataTable.Rows[i]["TitleName"];

                    title    = TitleFactory.Instance().CreateTitle(titleName, titleID);
                    employee = EmployeeFactory.Instance().CreateEmployee(employeeID, name, true, title);
                }

                if (sQLQueryResult.dataTable.Rows[i].IsNull("AnimalID"))
                {
                    animal = null;
                }
                else
                {
                    int      customerID     = (int)sQLQueryResult.dataTable.Rows[i]["CustomerID"];
                    string   nameCustomer   = (string)sQLQueryResult.dataTable.Rows[i]["CustomerName"];
                    string   address        = (string)sQLQueryResult.dataTable.Rows[i]["Adress"];
                    string   phone          = (string)sQLQueryResult.dataTable.Rows[i]["Phone"];
                    string   email          = (string)sQLQueryResult.dataTable.Rows[i]["Email"];
                    bool     activeCustomer = (bool)sQLQueryResult.dataTable.Rows[i]["CustomerActive"];
                    int      cvr            = 0;
                    string   name           = (string)sQLQueryResult.dataTable.Rows[i]["AnimalName"];
                    DateTime birthYear      = (DateTime)sQLQueryResult.dataTable.Rows[i]["BirthYear"];
                    int      speciesID      = (int)sQLQueryResult.dataTable.Rows[i]["SpeciesID"];
                    string   nameSpecies    = (string)sQLQueryResult.dataTable.Rows[i]["SpeciesName"];
                    double   weight         = Convert.ToDouble((decimal)sQLQueryResult.dataTable.Rows[i]["Weight"]);
                    bool     gender         = (bool)sQLQueryResult.dataTable.Rows[i]["Gender"];
                    bool     activeAnimal   = (bool)sQLQueryResult.dataTable.Rows[i]["AnimalActive"];

                    Species  species  = SpeciesFactory.Instance().CreateSpecies(speciesID, nameSpecies);
                    Customer customer = CustomerFactory.Instance().CreateCustomer(customerID, nameCustomer, address, phone, email, activeCustomer, cvr);

                    animal = AnimalFactory.Instance().CreateAnimal(customer, name, birthYear, species, weight, gender, employee, activeAnimal);
                }

                if (sQLQueryResult.dataTable.Rows[i].IsNull("ItemID"))
                {
                    item = null;
                }
                else
                {
                    int     itemID       = (int)sQLQueryResult.dataTable.Rows[i]["ItemID"];
                    string  name         = (string)sQLQueryResult.dataTable.Rows[i]["ItemName"];
                    decimal price        = (decimal)sQLQueryResult.dataTable.Rows[i]["ItemPrice"];
                    decimal costPrice    = (decimal)sQLQueryResult.dataTable.Rows[i]["CostPrice"];
                    int     amountItem   = (int)sQLQueryResult.dataTable.Rows[i]["ItemAmount"];
                    bool    prescription = (bool)sQLQueryResult.dataTable.Rows[i]["Prescription"];
                    bool    treatment    = (bool)sQLQueryResult.dataTable.Rows[i]["ItemTreatment"];
                    bool    itemActive   = (bool)sQLQueryResult.dataTable.Rows[i]["ItemActive"];

                    item = ItemFactory.Instance().CreateItem(itemID, name, amountItem, price, costPrice, prescription, treatment, itemActive);
                }

                int      amount          = (int)sQLQueryResult.dataTable.Rows[i]["Amount"];
                DateTime prescriptionDay = (DateTime)sQLQueryResult.dataTable.Rows[i]["PrescriptionDay"];
                bool     payed           = (bool)sQLQueryResult.dataTable.Rows[i]["Payed"];
                prescriptionID = (int)sQLQueryResult.dataTable.Rows[i]["PrescriptionID"];

                prescriptions.Add(PrescriptionFactory.Instance().CreatePrescription(prescriptionID, amount, prescriptionDay, payed, employee, animal, item));
            }
            return(prescriptions);
        }
Beispiel #18
0
    public static AnimalDef CreateDefForSpecies(SpeciesFactory.Species species, bool assignRandomTraits)
    {
        AnimalDef animalDef = new AnimalDef();

        switch (species)
        {
        case SpeciesFactory.Species.Cow:
            animalDef.SpeciesTrait = SpeciesFactory.createCow();
            animalDef.SizeTrait    = SizeFactory.createHuge();
            break;

        case SpeciesFactory.Species.Lion:
            animalDef.SpeciesTrait = SpeciesFactory.createLion();
            animalDef.SizeTrait    = SizeFactory.createLarge();
            break;

        case SpeciesFactory.Species.Turtle:
            animalDef.SpeciesTrait = SpeciesFactory.createTurtle();
            animalDef.SizeTrait    = SizeFactory.createSmall();
            break;

        case SpeciesFactory.Species.Turkey:
            animalDef.SpeciesTrait = SpeciesFactory.createTurkey();
            animalDef.SizeTrait    = SizeFactory.createSmall();
            break;

        case SpeciesFactory.Species.Lobster:
            animalDef.SpeciesTrait = SpeciesFactory.createLobster();
            animalDef.SizeTrait    = SizeFactory.createSmall();
            break;

        case SpeciesFactory.Species.Wolf:
            animalDef.SpeciesTrait = SpeciesFactory.createWolf();
            animalDef.SizeTrait    = SizeFactory.createMidsized();
            break;

        case SpeciesFactory.Species.Bat:
            animalDef.SpeciesTrait = SpeciesFactory.createBat();
            animalDef.SizeTrait    = SizeFactory.createTiny();
            break;

        case SpeciesFactory.Species.Bison:
            animalDef.SpeciesTrait = SpeciesFactory.createBison();
            animalDef.SizeTrait    = SizeFactory.createHuge();
            break;

        case SpeciesFactory.Species.Bear:
            animalDef.SpeciesTrait = SpeciesFactory.createBear();
            animalDef.SizeTrait    = SizeFactory.createHuge();
            break;

        case SpeciesFactory.Species.Bee:
            animalDef.SpeciesTrait = SpeciesFactory.createBee();
            animalDef.SizeTrait    = SizeFactory.createTiny();
            break;

        case SpeciesFactory.Species.Crocodile:
            animalDef.SpeciesTrait = SpeciesFactory.createCrocodile();
            animalDef.SizeTrait    = SizeFactory.createLarge();
            break;

        case SpeciesFactory.Species.Bulldog:
            animalDef.SpeciesTrait = SpeciesFactory.createBulldog();
            animalDef.SizeTrait    = SizeFactory.createMidsized();
            break;

        case SpeciesFactory.Species.Tiger:
            animalDef.SpeciesTrait = SpeciesFactory.createTiger();
            animalDef.SizeTrait    = SizeFactory.createLarge();
            break;

        case SpeciesFactory.Species.Deer:
            animalDef.SpeciesTrait = SpeciesFactory.createDeer();
            animalDef.SizeTrait    = SizeFactory.createMidsized();
            break;

        case SpeciesFactory.Species.Bluejay:
            animalDef.SpeciesTrait = SpeciesFactory.createBluejay();
            animalDef.SizeTrait    = SizeFactory.createTiny();
            break;

        case SpeciesFactory.Species.Cat:
            animalDef.SpeciesTrait = SpeciesFactory.createCat();
            animalDef.SizeTrait    = SizeFactory.createSmall();
            break;

        case SpeciesFactory.Species.Alligator:
            animalDef.SpeciesTrait = SpeciesFactory.createAlligator();
            animalDef.SizeTrait    = SizeFactory.createLarge();
            break;

        case SpeciesFactory.Species.BaldEagle:
            animalDef.SpeciesTrait = SpeciesFactory.createBaldEagle();
            animalDef.SizeTrait    = SizeFactory.createSmall();
            break;

        case SpeciesFactory.Species.Sheep:
            animalDef.SpeciesTrait = SpeciesFactory.createSheep();
            animalDef.SizeTrait    = SizeFactory.createMidsized();
            break;

        case SpeciesFactory.Species.Panda:
            animalDef.SpeciesTrait = SpeciesFactory.createPanda();
            animalDef.SizeTrait    = SizeFactory.createLarge();
            break;

        case SpeciesFactory.Species.Fox:
            animalDef.SpeciesTrait = SpeciesFactory.createFox();
            animalDef.SizeTrait    = SizeFactory.createMidsized();
            break;

        case SpeciesFactory.Species.Elephant:
            animalDef.SpeciesTrait = SpeciesFactory.createElephant();
            animalDef.SizeTrait    = SizeFactory.createEnormous();
            break;

        case SpeciesFactory.Species.Dog:
            animalDef.SpeciesTrait = SpeciesFactory.createDog();
            animalDef.SizeTrait    = SizeFactory.createMidsized();
            break;

        case SpeciesFactory.Species.Chicken:
            animalDef.SpeciesTrait = SpeciesFactory.createChicken();
            animalDef.SizeTrait    = SizeFactory.createTiny();
            break;

        case SpeciesFactory.Species.Gorilla:
            animalDef.SpeciesTrait = SpeciesFactory.createGorilla();
            animalDef.SizeTrait    = SizeFactory.createLarge();
            break;

        case SpeciesFactory.Species.Owl:
            animalDef.SpeciesTrait = SpeciesFactory.createOwl();
            animalDef.SizeTrait    = SizeFactory.createSmall();
            break;

        case SpeciesFactory.Species.Horse:
            animalDef.SpeciesTrait = SpeciesFactory.createHorse();
            animalDef.SizeTrait    = SizeFactory.createHuge();
            break;

        case SpeciesFactory.Species.Frog:
            animalDef.SpeciesTrait = SpeciesFactory.createFrog();
            animalDef.SizeTrait    = SizeFactory.createTiny();
            break;

        case SpeciesFactory.Species.Giraffe:
            animalDef.SpeciesTrait = SpeciesFactory.createGiraffe();
            animalDef.SizeTrait    = SizeFactory.createEnormous();
            break;

        case SpeciesFactory.Species.Moose:
            animalDef.SpeciesTrait = SpeciesFactory.createMoose();
            animalDef.SizeTrait    = SizeFactory.createHuge();
            break;

        case SpeciesFactory.Species.Mouse:
            animalDef.SpeciesTrait = SpeciesFactory.createMouse();
            animalDef.SizeTrait    = SizeFactory.createTiny();
            break;

        case SpeciesFactory.Species.Canary:
            animalDef.SpeciesTrait = SpeciesFactory.createCanary();
            animalDef.SizeTrait    = SizeFactory.createTiny();
            break;

        case SpeciesFactory.Species.Pig:
            animalDef.SpeciesTrait = SpeciesFactory.createPig();
            animalDef.SizeTrait    = SizeFactory.createMidsized();
            break;

        case SpeciesFactory.Species.Hippo:
            animalDef.SpeciesTrait = SpeciesFactory.createHippo();
            animalDef.SizeTrait    = SizeFactory.createHuge();
            break;

        case SpeciesFactory.Species.Donkey:
            animalDef.SpeciesTrait = SpeciesFactory.createDonkey();
            animalDef.SizeTrait    = SizeFactory.createLarge();
            break;

        case SpeciesFactory.Species.Monkey:
            animalDef.SpeciesTrait = SpeciesFactory.createMonkey();
            animalDef.SizeTrait    = SizeFactory.createMidsized();
            break;

        case SpeciesFactory.Species.Duck:
            animalDef.SpeciesTrait = SpeciesFactory.createDuck();
            animalDef.SizeTrait    = SizeFactory.createSmall();
            break;

        case SpeciesFactory.Species.Snake:
            animalDef.SpeciesTrait = SpeciesFactory.createSnake();
            animalDef.SizeTrait    = SizeFactory.createSmall();
            break;

        case SpeciesFactory.Species.Penguin:
            animalDef.SpeciesTrait = SpeciesFactory.createPenguin();
            animalDef.SizeTrait    = SizeFactory.createMidsized();
            break;

        case SpeciesFactory.Species.Rhino:
            animalDef.SpeciesTrait = SpeciesFactory.createRhino();
            animalDef.SizeTrait    = SizeFactory.createHuge();
            break;

        case SpeciesFactory.Species.Rabbit:
            animalDef.SpeciesTrait = SpeciesFactory.createRabbit();
            animalDef.SizeTrait    = SizeFactory.createTiny();
            break;

        default:
            break;
        }

        List <BaseTrait> allTraits = new List <BaseTrait>();

        allTraits.Add(animalDef.SpeciesTrait);
        allTraits.Add(animalDef.SizeTrait);
        animalDef.Traits = TraitSelector.selectTraits(allTraits);
        return(animalDef);
    }
 public GameObject createGiraffe()
 {
     return(createAnimal(SpeciesFactory.createGiraffe(), SizeFactory.createEnormous()));
 }
 public GameObject createBaldEagle()
 {
     return(createAnimal(SpeciesFactory.createBaldEagle(), SizeFactory.createSmall()));
 }
 public GameObject createBee()
 {
     return(createAnimal(SpeciesFactory.createBee(), SizeFactory.createTiny()));
 }
        public void Init()
        {
            var gameSettings = new NewGameSettings();

            gameSettings.MaxSystems = 10;
            _game = new Game(gameSettings);
            StaticDataManager.LoadData("Pulsar4x", _game);
            _entityManager = new EntityManager(_game);
            _faction       = FactionFactory.CreateFaction(_game, "Terran"); // Terrian?


            /*_galaxyFactory = new GalaxyFactory();
             * _starSystemFactory = new StarSystemFactory(_galaxyFactory);
             *
             * _starSystem = _starSystemFactory.CreateSol(_game);*/// Seems unnecessary for now

            _gasDictionary = new Dictionary <string, AtmosphericGasSD>();

            foreach (WeightedValue <AtmosphericGasSD> atmos in _game.StaticData.AtmosphericGases)
            {
                _gasDictionary.Add(atmos.Value.ChemicalSymbol, atmos.Value);
            }


            // Create Earth
            _earthPlanet    = setEarthPlanet();
            _coldPlanet     = setEarthPlanet();
            _hotPlanet      = setEarthPlanet();
            _lowGravPlanet  = setEarthPlanet();
            _highGravPlanet = setEarthPlanet();


            _coldPlanet.GetDataBlob <SystemBodyInfoDB>().BaseTemperature = -20.0f;
            _hotPlanet.GetDataBlob <SystemBodyInfoDB>().BaseTemperature  = 120.0f;
            _lowGravPlanet.GetDataBlob <SystemBodyInfoDB>().Gravity      = 0.05;
            _highGravPlanet.GetDataBlob <SystemBodyInfoDB>().Gravity     = 5.0;

            _faction = FactionFactory.CreateFaction(_game, "Terran");

            _humanSpecies    = SpeciesFactory.CreateSpeciesHuman(_faction, _entityManager);
            _exampleSpecies  = SpeciesFactory.CreateSpeciesHuman(_faction, _entityManager);
            _lowGravSpecies  = SpeciesFactory.CreateSpeciesHuman(_faction, _entityManager);
            _highGravSpecies = SpeciesFactory.CreateSpeciesHuman(_faction, _entityManager);
            _lowTempSpecies  = SpeciesFactory.CreateSpeciesHuman(_faction, _entityManager);
            _highTempSpecies = SpeciesFactory.CreateSpeciesHuman(_faction, _entityManager);

            _humanSpecies.GetDataBlob <SpeciesDB>().TemperatureToleranceRange    = 20;
            _exampleSpecies.GetDataBlob <SpeciesDB>().TemperatureToleranceRange  = 20;
            _lowGravSpecies.GetDataBlob <SpeciesDB>().TemperatureToleranceRange  = 20;
            _highGravSpecies.GetDataBlob <SpeciesDB>().TemperatureToleranceRange = 20;
            _lowTempSpecies.GetDataBlob <SpeciesDB>().TemperatureToleranceRange  = 20;
            _highTempSpecies.GetDataBlob <SpeciesDB>().TemperatureToleranceRange = 20;


            _lowGravSpecies.GetDataBlob <SpeciesDB>().BaseGravity = 0.4;
            _lowGravSpecies.GetDataBlob <SpeciesDB>().MaximumGravityConstraint = 0.5;
            _lowGravSpecies.GetDataBlob <SpeciesDB>().MinimumGravityConstraint = 0.01;


            _highGravSpecies.GetDataBlob <SpeciesDB>().BaseGravity = 4.0;
            _highGravSpecies.GetDataBlob <SpeciesDB>().MaximumGravityConstraint = 5.5;
            _highGravSpecies.GetDataBlob <SpeciesDB>().MinimumGravityConstraint = 4.5;

            _lowTempSpecies.GetDataBlob <SpeciesDB>().BaseTemperature = -50.0;
            _lowTempSpecies.GetDataBlob <SpeciesDB>().MaximumTemperatureConstraint = 0.0;
            _lowTempSpecies.GetDataBlob <SpeciesDB>().MinimumTemperatureConstraint = -100.0;

            _highTempSpecies.GetDataBlob <SpeciesDB>().BaseTemperature = 200.0;
            _highTempSpecies.GetDataBlob <SpeciesDB>().MaximumTemperatureConstraint = 300.0;
            _highTempSpecies.GetDataBlob <SpeciesDB>().MinimumTemperatureConstraint = 100.0;
        }
 public GameObject createDonkey()
 {
     return(createAnimal(SpeciesFactory.createDonkey(), SizeFactory.createLarge()));
 }