private bool ContextOnInterraction(InteractionContext context) { if (context.Method == InteractionMethod.Right) { if (context.SelectedItem is ScytheItem && context.HasBlock) { if (SkillsUtil.HasSkillLevel(context.Player.User, typeof(ScythePickupRangeSkill), 1)) { PlantUtils.GetReapableBlockAroundPoint(context, context.BlockPosition.Value, SkillsUtil.GetSkillLevel(context.Player.User, typeof(ScythePickupRangeSkill))); } } else if (context.SelectedItem is HoeItem && context.HasBlock) { if (SkillsUtil.HasSkillLevel(context.Player.User, typeof(HoePickupRangeSkill), 1)) { PlantUtils.GetPlantBlockAroundPoint(context, context.BlockPosition.Value, SkillsUtil.GetSkillLevel(context.Player.User, typeof(HoePickupRangeSkill))); } } } return(false); }
public override InteractResult OnActRight(InteractionContext context) { if (context.HasBlock) { var plant = EcoSim.PlantSim.GetPlant(context.BlockPosition.Value); var block = World.GetBlock(context.BlockPosition.Value); if (plant != null && plant is IHarvestable) { if (block is CornBlock) { Result result = (plant as IHarvestable).TryHarvest(context.Player, true); if (result.Success) { InventoryChangeSet changes = new InventoryChangeSet(context.Player.User.Inventory, context.Player.User); changes.AddItems <CornItem>((4) + SkillsUtil.GetSkillLevel(context.Player.User, typeof(GrasslandGathererSkill))); changes.AddItems <CornSeedItem>(1 + SkillsUtil.GetSkillLevel(context.Player.User, typeof(GrasslandGathererSkill))); PlantUtils.GetPlantBlockAroundPoint(context.Player.User, context.BlockPosition.Value, 1 + SkillsUtil.GetSkillLevel(context.Player.User, typeof(FarmingRadiusSkill))); return((InteractResult)this.PlayerDeleteBlock(context.BlockPosition.Value, context.Player, false, 3, null, changes)); } else { return(InteractResult.NoOp); } } else if (block is TomatoesBlock) { Result result = (plant as IHarvestable).TryHarvest(context.Player, true); if (result.Success) { InventoryChangeSet changes = new InventoryChangeSet(context.Player.User.Inventory, context.Player.User); changes.AddItems <TomatoItem>(4 + SkillsUtil.GetSkillLevel(context.Player.User, typeof(GrasslandGathererSkill))); changes.AddItems <TomatoSeedItem>(1 + SkillsUtil.GetSkillLevel(context.Player.User, typeof(GrasslandGathererSkill))); PlantUtils.GetPlantBlockAroundPoint(context.Player.User, context.BlockPosition.Value, 1 + SkillsUtil.GetSkillLevel(context.Player.User, typeof(FarmingRadiusSkill))); return((InteractResult)this.PlayerDeleteBlock(context.BlockPosition.Value, context.Player, false, 3, null, changes)); } else { return(InteractResult.NoOp); } } else if (block is FireweedBlock) { Result result = (plant as IHarvestable).TryHarvest(context.Player, true); if (result.Success) { InventoryChangeSet changes = new InventoryChangeSet(context.Player.User.Inventory, context.Player.User); changes.AddItems <FireweedShootsItem>(5 + SkillsUtil.GetSkillLevel(context.Player.User, typeof(TundraTravellerSkill))); PlantUtils.GetPlantBlockAroundPoint(context.Player.User, context.BlockPosition.Value, 1 + SkillsUtil.GetSkillLevel(context.Player.User, typeof(FarmingRadiusSkill))); return((InteractResult)this.PlayerDeleteBlock(context.BlockPosition.Value, context.Player, false, 3, null, changes)); } else { return(InteractResult.NoOp); } } else if (block is WheatBlock) { Result result = (plant as IHarvestable).TryHarvest(context.Player, true); if (result.Success) { InventoryChangeSet changes = new InventoryChangeSet(context.Player.User.Inventory, context.Player.User); changes.AddItems <WheatItem>(5 + SkillsUtil.GetSkillLevel(context.Player.User, typeof(GrasslandGathererSkill))); changes.AddItems <WheatSeedItem>(1 + SkillsUtil.GetSkillLevel(context.Player.User, typeof(GrasslandGathererSkill))); PlantUtils.GetPlantBlockAroundPoint(context.Player.User, context.BlockPosition.Value, 1 + SkillsUtil.GetSkillLevel(context.Player.User, typeof(FarmingRadiusSkill))); return((InteractResult)this.PlayerDeleteBlock(context.BlockPosition.Value, context.Player, false, 3, null, changes)); } else { return(InteractResult.NoOp); } } else if (block is BeansBlock) { Result result = (plant as IHarvestable).TryHarvest(context.Player, true); if (result.Success) { InventoryChangeSet changes = new InventoryChangeSet(context.Player.User.Inventory, context.Player.User); changes.AddItems <BeansItem>(6 + SkillsUtil.GetSkillLevel(context.Player.User, typeof(ForestForagerSkill))); PlantUtils.GetPlantBlockAroundPoint(context.Player.User, context.BlockPosition.Value, 1 + SkillsUtil.GetSkillLevel(context.Player.User, typeof(FarmingRadiusSkill))); return((InteractResult)this.PlayerDeleteBlock(context.BlockPosition.Value, context.Player, false, 3, null, changes)); } else { return(InteractResult.NoOp); } } else if (block is HuckleberryBlock) { Result result = (plant as IHarvestable).TryHarvest(context.Player, true); if (result.Success) { InventoryChangeSet changes = new InventoryChangeSet(context.Player.User.Inventory, context.Player.User); changes.AddItems <HuckleberriesItem>(5 + SkillsUtil.GetSkillLevel(context.Player.User, typeof(ForestForagerSkill))); changes.AddItems <HuckleberrySeedItem>(1 + SkillsUtil.GetSkillLevel(context.Player.User, typeof(ForestForagerSkill))); PlantUtils.GetPlantBlockAroundPoint(context.Player.User, context.BlockPosition.Value, 1 + SkillsUtil.GetSkillLevel(context.Player.User, typeof(FarmingRadiusSkill))); return((InteractResult)this.PlayerDeleteBlock(context.BlockPosition.Value, context.Player, false, 3, null, changes)); } else { return(InteractResult.NoOp); } } else if (block is BeetsBlock) { Result result = (plant as IHarvestable).TryHarvest(context.Player, true); if (result.Success) { InventoryChangeSet changes = new InventoryChangeSet(context.Player.User.Inventory, context.Player.User); changes.AddItems <BeetItem>(3 + SkillsUtil.GetSkillLevel(context.Player.User, typeof(GrasslandGathererSkill))); changes.AddItems <BeetSeedItem>(1 + SkillsUtil.GetSkillLevel(context.Player.User, typeof(GrasslandGathererSkill))); PlantUtils.GetPlantBlockAroundPoint(context.Player.User, context.BlockPosition.Value, 1 + SkillsUtil.GetSkillLevel(context.Player.User, typeof(FarmingRadiusSkill))); return((InteractResult)this.PlayerDeleteBlock(context.BlockPosition.Value, context.Player, false, 3, null, changes)); } else { return(InteractResult.NoOp); } } else if (block is RiceBlock) { Result result = (plant as IHarvestable).TryHarvest(context.Player, true); if (result.Success) { InventoryChangeSet changes = new InventoryChangeSet(context.Player.User.Inventory, context.Player.User); changes.AddItems <RiceItem>(3 + SkillsUtil.GetSkillLevel(context.Player.User, typeof(GrasslandGathererSkill))); PlantUtils.GetPlantBlockAroundPoint(context.Player.User, context.BlockPosition.Value, 1 + SkillsUtil.GetSkillLevel(context.Player.User, typeof(FarmingRadiusSkill))); return((InteractResult)this.PlayerDeleteBlock(context.BlockPosition.Value, context.Player, false, 3, null, changes)); } else { return(InteractResult.NoOp); } } else if (block is KelpBlock) { Result result = (plant as IHarvestable).TryHarvest(context.Player, true); if (result.Success) { InventoryChangeSet changes = new InventoryChangeSet(context.Player.User.Inventory, context.Player.User); changes.AddItems <KelpItem>(1); PlantUtils.GetPlantBlockAroundPoint(context.Player.User, context.BlockPosition.Value, 1 + SkillsUtil.GetSkillLevel(context.Player.User, typeof(FarmingRadiusSkill))); return((InteractResult)this.PlayerDeleteBlock(context.BlockPosition.Value, context.Player, false, 3, null, changes)); } else { return(InteractResult.NoOp); } } else if (block is PricklyPearBlock) { Result result = (plant as IHarvestable).TryHarvest(context.Player, true); if (result.Success) { InventoryChangeSet changes = new InventoryChangeSet(context.Player.User.Inventory, context.Player.User); changes.AddItems <PricklyPearFruitItem>(3 + SkillsUtil.GetSkillLevel(context.Player.User, typeof(GrasslandGathererSkill))); changes.AddItems <PricklyPearSeedItem>(1 + SkillsUtil.GetSkillLevel(context.Player.User, typeof(GrasslandGathererSkill))); PlantUtils.GetPlantBlockAroundPoint(context.Player.User, context.BlockPosition.Value, 1 + SkillsUtil.GetSkillLevel(context.Player.User, typeof(FarmingRadiusSkill))); return((InteractResult)this.PlayerDeleteBlock(context.BlockPosition.Value, context.Player, false, 3, null, changes)); } else { return(InteractResult.NoOp); } } else if (block is FernBlock) { Result result = (plant as IHarvestable).TryHarvest(context.Player, true); if (result.Success) { InventoryChangeSet changes = new InventoryChangeSet(context.Player.User.Inventory, context.Player.User); changes.AddItems <FiddleheadsItem>(3 + SkillsUtil.GetSkillLevel(context.Player.User, typeof(GrasslandGathererSkill))); changes.AddItems <FernSporeItem>(1 + SkillsUtil.GetSkillLevel(context.Player.User, typeof(GrasslandGathererSkill))); PlantUtils.GetPlantBlockAroundPoint(context.Player.User, context.BlockPosition.Value, 1 + SkillsUtil.GetSkillLevel(context.Player.User, typeof(FarmingRadiusSkill))); return((InteractResult)this.PlayerDeleteBlock(context.BlockPosition.Value, context.Player, false, 3, null, changes)); } else { return(InteractResult.NoOp); } } } return(InteractResult.NoOp); } return(InteractResult.NoOp); }