public int buildGranary(int buildTime) { Consts.writeEnteringMethodToDebugLog(System.Reflection.MethodBase.GetCurrentMethod().ReflectedType + "." + System.Reflection.MethodBase.GetCurrentMethod().Name); int buildingID = -1; if (Treasury.haveEnoughToWithdraw(Consts.granary_costtobuild)) { Job granaryKeeperJob; int[] granaryJobs = new int[Consts.numberOfGranaryKeepersPerGranary]; LinkedList<InventoryItem> granaryInventory = new LinkedList<InventoryItem>(); buildingID = Program._aStronghold._buildingsList.Count + 1; for (int i = 0; i < Consts.numberOfGranaryKeepersPerGranary; i++) { granaryKeeperJob = Job_creater.createGranaryKeeper(buildingID); granaryJobs[i] = granaryKeeperJob.JobID; _allJobs.AddLast(granaryKeeperJob); } //creates jobs for the Granary Keeper BuildingWithJobsAndInventory granary = new BuildingWithJobsAndInventory(buildingID, //building ID _leader._id, //owner ID Consts.granary, //type Consts.granary_name, //name Consts.granary_hp, //hp Consts.granary_costtobuild, //cost to build new Status(1, Consts.granary_maxlevel), //level Program._gametime, //start build time buildTime, //build time granaryJobs,//jobs granaryInventory,//inventory Consts.buildingState.Planned, new Status(0, Consts.granaryMaxInventory)); Program._aStronghold._buildingsList.AddLast(granary); Treasury.withdrawGold(Consts.granary_costtobuild); }//have enough money to build farm else { Consts.globalEvent.writeEvent("Not enough money in Treasury to build a granary. Treasury currently has " + _treasury.Gold + " gold.", Consts.eventType.Stronghold, Consts.EVENT_DEBUG_NORMAL); Consts.writeToDebugLog("Not enough money to build granary."); } Consts.writeExitingMethodToDebugLog(System.Reflection.MethodBase.GetCurrentMethod().ReflectedType + "." + System.Reflection.MethodBase.GetCurrentMethod().Name); return buildingID; }
public int buildEmploymentOffice(int buildTime) { Consts.writeEnteringMethodToDebugLog(System.Reflection.MethodBase.GetCurrentMethod().ReflectedType + "." + System.Reflection.MethodBase.GetCurrentMethod().Name); int buildingID = -1; Job builderJob; int[] builderJobs = new int[Consts.numberOfInitialBuilders]; buildingID = Program._aStronghold._buildingsList.Count + 1; if (Treasury.haveEnoughToWithdraw(Consts.employmentoffice_costtobuild)) { for (int i = 0; i < Consts.numberOfInitialBuilders; i++) { builderJob = Job_creater.createBuilderJob(buildingID); builderJobs[i] = builderJob.JobID; _allJobs.AddLast(builderJob); } //creates jobs for builders BuildingWithJobsAndInventory employmentoffice = new BuildingWithJobsAndInventory(buildingID, _leader._id, Consts.employmentoffice, Consts.employmentoffice_name, Consts.employmentoffice_hp, Consts.employmentoffice_costtobuild, new Status(1, Consts.employmentoffice_maxlevel), Program._gametime, buildTime, builderJobs, null, Consts.buildingState.Planned, new Status(0, 0)); Program._aStronghold._buildingsList.AddFirst(employmentoffice); Treasury.withdrawGold(Consts.employmentoffice_costtobuild); }//have enough money to build employment office Consts.writeExitingMethodToDebugLog(System.Reflection.MethodBase.GetCurrentMethod().ReflectedType + "." + System.Reflection.MethodBase.GetCurrentMethod().Name); return buildingID; }
public int buildFarm(int buildTime) { Consts.writeEnteringMethodToDebugLog(System.Reflection.MethodBase.GetCurrentMethod().ReflectedType + "." + System.Reflection.MethodBase.GetCurrentMethod().Name); int buildingID = -1; if (Treasury.haveEnoughToWithdraw(Consts.farm_costtobuild)) { Job farmerJob; int[] farmJobs = new int[Consts.numberOfFarmersPerFarm]; buildingID = Program._aStronghold._buildingsList.Count + 1; for (int i = 0; i < Consts.numberOfFarmersPerFarm; i++) { farmerJob = Job_creater.createFarmerJob(buildingID); farmJobs[i] = farmerJob.JobID; _allJobs.AddLast(farmerJob); } //creates jobs for the farmer BuildingWithJobsAndInventory farm = new BuildingWithJobsAndInventory(buildingID, //building ID _leader._id, //owner ID Consts.farm, //type Consts.farm_name, //name Consts.farm_hp, //hp Consts.farm_costtobuild, //cost to build new Status(1, Consts.farm_maxlevel), //level Program._gametime, //start build time buildTime, //build time farmJobs,//jobs null,//inventory Consts.buildingState.Planned, new Status(0, 0)); Program._aStronghold._buildingsList.AddLast(farm); Treasury.withdrawGold(Consts.farm_costtobuild); }//have enough money to build farm else { Consts.globalEvent.writeEvent("Not enough money in Treasury to build a farm. Treasury currently has " + _treasury.Gold + " gold.", Consts.eventType.Stronghold, Consts.EVENT_DEBUG_NORMAL); Consts.writeToDebugLog("Not enough money to build farm."); } Consts.writeExitingMethodToDebugLog(System.Reflection.MethodBase.GetCurrentMethod().ReflectedType + "." + System.Reflection.MethodBase.GetCurrentMethod().Name); return buildingID; }