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; }