public static Plant CreatePlantFromSeed(IGameObject seedObj, Soil soil, Sim planter) { PlantDefinition plantDefinition = PlantHelper.GetPlantDefinition(seedObj); if (plantDefinition == null) { return null; } float num = seedObj.Plantable.QualityLevel; if (planter != null) { //int num2 = planter.SkillManager.GetSkillLevel(SkillNames.Gardening); //if (num2 == -1) //{ // num2 = 0; //} //num *= Sims3.Gameplay.Skills.Gardening.QualityMultiplier[(int)plantDefinition.Rarity, num2]; //if (planter.HasTrait(TraitNames.SuperGreenThumb)) //{ // num *= TraitTuning.SuperGreenThumbPlantQualityMultiplier; //} } PlantInitParameters initParams = new PlantInitParameters(seedObj, num, plantDefinition, soil); Plant plant = Plant.DoCreatePlantFromSeed(plantDefinition, soil, initParams, Plant.IsMushroom(seedObj)); plant?.AddSimWhoHelpedGrow(planter); return plant; }
public static void MergePlantSeed(HarvestPlant plant, Ingredient ingredient) { plant.Seed = ingredient; plant.PlantDef = PlantHelper.GetPlantDefinition(plant.Seed); plant.mQualityLevel = ingredient.Plantable.QualityLevel; plant.SetGrowthState(plant.GrowthState); sMergedPlants.Add(plant); ErrorTrap.LogCorrection("Plant Seed Merged: " + ErrorTrap.GetName(plant)); }
protected override void OnActivate() { Me = EntityManager.LocalHero; if (Me == null || Me.HeroId != HeroId.npc_dota_hero_techies) { return; } LandMine = new LandMineAbility(Me.Spellbook.Spells.First(x => x.Id == AbilityId.techies_land_mines)); StasisMine = new StasisMineAbility(Me.Spellbook.Spells.First(x => x.Id == AbilityId.techies_stasis_trap)); Suicide = new SuicideAbility(Me.Spellbook.Spells.First(x => x.Id == AbilityId.techies_suicide)); RemoteMine = new RemoteMineAbility(Me.Spellbook.Spells.First(x => x.Id == AbilityId.techies_remote_mines)); FocusedDetonate = Me.Spellbook.Spells.First(x => x.Id == AbilityId.techies_focused_detonate); MenuManager = new MenuManager(this); Updater = new Updater(this); TargetManager.Init(this); var stackInfo = new StackInfo(this); SuicideDamage = new SuicideDamage(this); _viewManager = new ViewManager(this); AutoPlanter.Init(this); var plantHelper = new PlantHelper(this); }
public List <ald.Plant> GetPlants() { var helper = new PlantHelper(); return(helper.GetthePlants2()); }
public HelperTest() { Sutr = new RoleHelper(new AquaLearnIMDbContext()); Sutt = new TrashHelper(new AquaLearnIMDbContext()); Sutf = new FishHelper(new AquaLearnIMDbContext()); Sutp = new PlantHelper(new AquaLearnIMDbContext()); Suth = new HazardHelper(new AquaLearnIMDbContext()); Sute = new ExhibitHelper(new AquaLearnIMDbContext()); Sutu = new UserHelper(new AquaLearnIMDbContext()); Sutq = new QuizHelper(new AquaLearnIMDbContext()); role = new Role() { Name = "Teacher" }; trash = new Trash() { Name = "Plastic Bottles", Schooling = true, Description = "Americans throw away 35 billion plastic water bottles every year.Making the ocean inhabitable for sea creatures." }; fish = new Fish() { Name = "Shark", Schooling = false, Description = "Sharks are the most threatening predators in the ocean.", WaterType = new WaterType() { WaterTypeId = 4, Name = "Ocean Salt Water" } }; plant = new Plant() { Name = "Algae", Description = "Algae are very diverse and found almost everywhere on the planet. They play an important role in many ecosystems, including providing the foundation for the aquatic food chains supporting all fisheries in the oceans and inland, as well as producing about 70 percent of all the air we breathe." }; hazard = new Hazard() { Name = "Plastic", Description = "Pollution" }; exhibit = new Exhibit() { Name = "Deep Sea", }; user = new User() { Username = "******", Password = "******", ClassroomId = 22 }; quiz = new Quiz() { Name="Quiz" }; Sutr.SetRole(role); Sutt.SetTrash(trash); }
public bool RunCommon() { if (mObjectsToPlant == null || mObjectsToPlant.Count == 0) { return false; } EWHerbLoreSkill skill = EWHerbLoreSkill.StartSkillGain(Actor); if (skill != null) { while (mObjectsToPlant.Count > 0) { PlantableObjectData data = mObjectsToPlant[0]; CurrentTarget = data.PlantableObject; CurrentSoil = data.Soil; if (Plant.DoPlantRoute(Actor, CurrentSoil)) { UnreservePlantablePlantingSucceeded(); Plant plant = CreatePlantFromSeed(CurrentTarget, CurrentSoil, Actor); plant.UpdateHealth(); plant.AddToUseList(Actor); AcquireStateMachine("eatharvestablepet"); mCurrentStateMachine.SetActor("x", Actor); mCurrentStateMachine.EnterState("x", "Enter"); SetParameter("IsEatingOnGround", paramValue: true); // Parrotting the dummyIK code from the plantMedium state machine mDummyIk = Soil.Create(isDummyIk: true); //mDummyIk.SetHiddenFlags(-1); mDummyIk.SetPosition(plant.GetSoil().Position); Vector3 forward = plant.GetSoil().Position - Actor.Position; mDummyIk.SetForward(forward); mDummyIk.AddToWorld(); BeginCommodityUpdates(); AddOneShotScriptEventHandler(201u, new SacsEventHandler(ScriptHandlerOnSimAboutToPlant)); AnimateSim("EatHarvestable"); skill.Planted(plant); AnimateSim("Exit"); EndCommodityUpdates(succeeded: true); plant.RemoveFromUseList(Actor); CurrentSoil.RemoveFromUseList(Actor); if (mDummyIk != null) { mDummyIk.Destroy(); mDummyIk = null; } EventTracker.SendEvent(EventTypeId.kGardened, Actor); if (PlantHelper.IsSeed(CurrentTarget)) { EventTracker.SendEvent(EventTypeId.kEventSeedPlanted, Actor, CurrentTarget); } EventTracker.SendEvent(EventTypeId.kPlantedObject, Actor, plant); } else { CleanupPlantInstances(data, Actor, PlantInteractionType); mObjectsToPlant.RemoveAt(0); } } skill.StopSkillGain(); skill.AddSkillPointsLevelClamped(200, 10); // Bonus, Planting takes animal thinking return true; } return false; }
public bool DoSoilPlacementAndPlant() { EWHerbLoreSkill skill = EWHerbLoreSkill.StartSkillGain(Actor); if (skill != null) { mCurrentTarget = Target; bool flag = false; do { flag = false; if (!ReservePlantable()) { break; } mCurrentSoil = (GlobalFunctions.CreateObjectOutOfWorld("GardenSoil") as Soil); if (mCurrentSoil == null) { break; } mCurrentSoil.SetPlantDef(PlantHelper.GetPlantDefinition(mCurrentTarget)); mCurrentSoil.AddToWorld(); mCurrentSoil.Ghost(); if (!PlaceSoil()) { mSoilPlacementFailure = true; break; } mCurrentSoil.AddToUseList(Actor); mCurrentSoil.SetPlanted(); if (mObjectsToPlant == null) { mObjectsToPlant = new List<PlantableObjectData>(); } mObjectsToPlant.Add(new PlantableObjectData(mCurrentTarget, mCurrentSoil)); if (mInteractionType != PlantInteractionType.FromInventoryPlantMany) { continue; } uint stackNumber = Actor.Inventory.GetStackNumber(mCurrentTarget); if (stackNumber != 0) { List<IGameObject> stackObjects = Actor.Inventory.GetStackObjects(stackNumber, checkInUse: true); if (stackObjects.Count > 0) { mCurrentTarget = stackObjects[0]; flag = true; } } } while (flag); if (mObjectsToPlant != null && mObjectsToPlant.Count > 0) { EWPetDoPlant petDoPlant = EWPetDoPlant.Singleton.CreateInstance(Target, Actor, mPriority, base.Autonomous, cancellableByPlayer: true) as EWPetDoPlant; if (petDoPlant != null) { petDoPlant.SetObjectsToPlant(mObjectsToPlant); petDoPlant.PlantInteractionType = mInteractionType; if (Actor.InteractionQueue.Add(petDoPlant)) { mInteractionPushed = true; } } } skill.StopSkillGain(); return true; } return false; }
public static IGameObject FetchRandomOccultTreat(OccultTypes type, bool isAlien) { if (isAlien) { InteractionDefinition instance = RabbitHole.StealSpaceRocks.Singleton; RabbitHole.StealSpaceRocks instance2 = instance as RabbitHole.StealSpaceRocks; if (instance2 != null) { RabbitHole.StealSpaceRocks.SpaceRockSize weightedIndex = (RabbitHole.StealSpaceRocks.SpaceRockSize)RandomUtil.GetWeightedIndex(instance2.SSRTuning.SpaceRockWeights); RockGemMetal spaceRockSize = RockGemMetal.SpaceRockSmall; switch (weightedIndex) { case RabbitHole.StealSpaceRocks.SpaceRockSize.Small: spaceRockSize = RockGemMetal.SpaceRockSmall; break; case RabbitHole.StealSpaceRocks.SpaceRockSize.Medium: spaceRockSize = RockGemMetal.SpaceRockMedium; break; case RabbitHole.StealSpaceRocks.SpaceRockSize.Large: spaceRockSize = RockGemMetal.SpaceRockLarge; break; } return(RockGemMetalBase.Make(spaceRockSize, false)); } } switch (type) { case OccultTypes.Fairy: PlantRarity rarity = (PlantRarity)RandomUtil.GetInt(0, 3); Quality quality = (Quality)RandomUtil.GetInt(4, 9); PlayerDisclosure playerKnowledgeOfPlantableType = (rarity == PlantRarity.Common) ? PlayerDisclosure.Exposed : PlayerDisclosure.Concealed; IGameObject seed = PlantHelper.CreateRandomPlantable(rarity, quality, true, playerKnowledgeOfPlantableType); return(seed); case OccultTypes.Frankenstein: ScrapInitParameters initData = new ScrapInitParameters(1); IGameObject scrap = GlobalFunctions.CreateObjectOutOfWorld("scrapPile", ProductVersion.EP2, null, initData); return(scrap); case OccultTypes.Genie: IGameObject lamp = GlobalFunctions.CreateObjectOutOfWorld("GenieLamp", ProductVersion.EP6); return(lamp); case OccultTypes.Mermaid: IGameObject kelp = MermadicKelp.MakeMermadicKelp(RandomUtil.CoinFlip()); return(kelp); case OccultTypes.PlantSim: string randomHerb = RandomUtil.GetRandomObjectFromList <string>(new List <string>(Herb.sIngredientToHerbDataMap.Keys)); Ingredient herb = Ingredient.Create(IngredientData.NameToDataMap[randomHerb]); return(herb as IGameObject); case OccultTypes.Robot: TraitChipStaticData data = RandomUtil.GetRandomObjectFromDictionary <ulong, TraitChipStaticData>(GenericManager <TraitChipName, TraitChipStaticData, TraitChip> .sDictionary); if (data != null) { TraitChip chip = TraitChipManager.CreateTraitChip(data.Guid); return(chip); } return(null); case OccultTypes.Vampire: IGameObject vampireTreat = null; if (!GameUtils.IsInstalled(ProductVersion.EP3)) { vampireTreat = Recipe.NameToRecipeHash["VampireJuiceEP7"].CreateFinishedFood(Recipe.MealQuantity.Single, Quality.Perfect); } else { bool coinToss = RandomUtil.CoinFlip(); if (coinToss) { vampireTreat = Recipe.NameToRecipeHash["VampireJuice"].CreateFinishedFood(Recipe.MealQuantity.Single, Quality.Perfect); } else { vampireTreat = Ingredient.Create(IngredientData.NameToDataMap["VampireFruit"]); } } return(vampireTreat); case OccultTypes.Werewolf: List <FishType> fish = new List <FishType>(); List <float> weights = new List <float>(fish.Count); foreach (FishType fishType in Fish.sFishData.Keys) { FishData data2 = Fish.sFishData[fishType]; if (((data2.IngredientData != null) && data2.IngredientData.CanBuyFromStore) && (data2.Level >= 0)) { fish.Add(fishType); weights.Add(1f); } } int weightedIndexFish = RandomUtil.GetWeightedIndex(weights.ToArray()); Fish obj2 = Fish.CreateFishOfRandomWeight(fish[weightedIndexFish]); return(obj2 as IGameObject); case OccultTypes.Witch: if (RandomUtil.CoinFlip()) { ISoloInteractionDefinition cdef = TraitFunctions.ConjureApple.Singleton; TraitFunctions.ConjureApple appleDef = cdef as TraitFunctions.ConjureApple; if (appleDef != null) { return(appleDef.CreateAppleForInventory(RandomUtil.CoinFlip(), Quality.Perfect)); } } else { AlchemyPotion potion = AlchemyPotion.CreateARandomPotion(RandomUtil.CoinFlip(), 0); return(potion as IGameObject); } return(null); case OccultTypes.None: default: return(null); } }