public override bool Run() { LotLocation val = default(LotLocation); ulong lotLocation = World.GetLotLocation(Hit.mPoint, ref val); Vector3 val2 = Hit.mPoint; if (!DrinkFromPondHelper.RouteToDrinkLocation(Hit.mPoint, Actor, Hit.mType, Hit.mId)) { return(false); } EWCatFishingSkill skill = Actor.SkillManager.GetSkill <EWCatFishingSkill>(EWCatFishingSkill.SkillNameID); if (skill == null) { skill = Actor.SkillManager.AddElement(EWCatFishingSkill.SkillNameID) as EWCatFishingSkill; } if (skill == null) { Show(new Format("Error: Attempt to add EWFishingSkill to " + Actor.Name + " FAILED.", NotificationStyle.kDebugAlert)); return(false); } skill.StartSkillGain(EWCatFishingSkill.kEWFishingSkillGainRateNormal); EnterStateMachine("Puddle", "Enter", "x"); BeginCommodityUpdates(); AnimateSim("Loop Play"); bool flag = DoLoop(ExitReason.Default, LoopDelegate, mCurrentStateMachine); EndCommodityUpdates(flag); AnimateSim("Exit"); skill.StopSkillGain(); return(flag); }
public override bool Run() { bool result = false; IPond nearestWater = GetNearestWater(Actor.Position, float.MaxValue); if (nearestWater == null) { return(false); } ulong notUsed = 10u; // Not used by the method. I don't know what it was supposed to be. if (!DrinkFromPondHelper.RouteToDrinkLocation(nearestWater.RepresentativePondPosition(), Actor, GameObjectHitType.WaterPond, notUsed)) { return(false); } mossBall = GlobalFunctions.CreateObjectOutOfWorld("petToyBallFoil", ProductVersion.EP5); //bool isChaining = Actor.CurrentInteraction is ITendGarden; mossBall.SetColorTint(74, 93, 35, 0); // RGB value for Dark Moss Green mossBall.AddToWorld(); mossBall.SetPosition(Actor.Position); CarryUtils.Acquire(Actor, mossBall); EnterCarry(Actor, mossBall); CarryUtils.Request(Actor, "PickUp"); CarryUtils.Request(Actor, "Carry"); //if (!PetCarrySystem.PickUpWithoutRouting(Actor, mossBall as IPetCarryable)) // { // return false; // } EnterStateMachine("DrinkFromPond", "Enter", "x"); AnimateSim("Loop"); AnimateSim("Loop"); AnimateSim("Exit"); if (Target.RouteSimToMeAndCheckInUse(Actor) && WaterTestDisregardGardeningSkill(Target, Actor)) { ConfigureInteraction(); //TryConfigureTendGardenInteraction(Actor.CurrentInteraction); result = DoWater(); } CarryUtils.Request(Actor, "PutDown"); CarryUtils.ExitCarry(Actor); mossBall.Destroy(); //if (IsChainingPermitted(flag)) //{ // IgnorePlants.Add(Target); // if (flag2) // { // PushNextInteractionInChain(Singleton, WaterTest, Target.LotCurrent); // } // else // { // PushNextInteractionInChain(Singleton, WaterTestDisregardGardeningSkill, Target.LotCurrent); // } //} return(result); }
public override bool Run() { Vector3 trySpot = Hit.mPoint; Vector3 newTargetPos = trySpot; if (!DrinkFromPondHelper.RouteToDrinkLocation(Hit.mPoint, Actor, Hit.mType, Hit.mId)) { return(false); } if (Actor.SkillManager.HasElement(EWCatFishingSkill.SkillNameID)) { skill = Actor.SkillManager.GetSkill <EWCatFishingSkill>(EWCatFishingSkill.SkillNameID); } else { skill = Actor.SkillManager.AddElement(EWCatFishingSkill.SkillNameID) as EWCatFishingSkill; } if (skill.OppFishercatCompleted) { skill.StartSkillGain(EWCatFishingSkill.kEWFishingSkillGainRateFishercat); } else { skill.StartSkillGain(EWCatFishingSkill.kEWFishingSkillGainRateNormal); } mFishingData = FishingSpot.GetFishingData(trySpot, Hit.mType); BeginCommodityUpdates(); StartStages(); mHasCatFisherTrait = false; bool flag = true; while (flag && !ActiveStage.IsComplete(this)) { flag = LoopAnimation(); } skill.StopSkillGain(); EndCommodityUpdates(flag); return(flag); }
public bool LoopAnimation() { if (!DrinkFromPondHelper.RouteToDrinkLocation(Hit.mPoint, Actor, Hit.mType, Hit.mId)) { return(false); } StandardEntry(); EnterStateMachine("CatHuntInPond", "Enter", "x"); AddOneShotScriptEventHandler(101u, (SacsEventHandler)(object)new SacsEventHandler(SnapOnExit)); AnimateSim("PrePounceLoop"); // TODO: If we don't have an opportunity for catching fish faster, we should float mLoopLengthForNextFish = RandomUtil.GetFloat(EWCatFishHere.kMinMaxPrePounceTime[0], EWCatFishHere.kMinMaxPrePounceTime[1]); bool loopFlag = DoTimedLoop(mLoopLengthForNextFish); if (loopFlag) { EventTracker.SendEvent(EventTypeId.kGoFishingCat, Actor); float successBonus = 0; // Check for salt and freshwater opportunity bonuses if ((TerrainIsWaterPond && skill.OppPondProvisionerCompleted) || (!TerrainIsWaterPond && skill.OppSaltaholicCompleted)) { successBonus = EWCatFishingSkill.kFishCatchingBonus; } bool successFlag = RandomUtil.InterpolatedChance(0f, skill.MaxSkillLevel, EWCatFishHere.kMinMaxSuccesChance[0] + successBonus, EWCatFishHere.kMinMaxSuccesChance[1] + successBonus, skill.SkillLevel); FishType fishType = FishType.None; AnimateSim("FishLoop"); if (successFlag) { fishType = EWCatFishHere.GetCaughtFishType(Actor, Hit); switch (fishType) { case FishType.None: { // This is just in case there is weirdness. AnimateSim("ExitFailure"); break; } default: { Fish fish = Fish.CreateFishOfRandomWeight(fishType, Actor.SimDescription); EventTracker.SendEvent(EventTypeId.kPreyTypeCaught, Actor, fish); string message = skill.RegisterCaughtFish(fish, TerrainIsWaterPond); if (fish.CatHuntingComponent != null) { fish.CatHuntingComponent.SetCatcher(Actor); } fish.UpdateVisualState(CatHuntingComponent.CatHuntingModelState.Carried); SetActor("fish", (IHasScriptProxy)(object)fish); mNumberFishCaught++; if (Actor.Motives.GetValue(CommodityKind.Hunger) <= EWCatFishHere.kEatFishHungerThreshold) { // Notify if cat eats caught fish message += Localization.LocalizeString("Gameplay/Abstracts/ScriptObject/CatFishHere:EatFishTns", Actor, fish.GetLocalizedName(), fish.Weight); Actor.ShowTNSIfSelectable(message, NotificationStyle.kGameMessagePositive); AnimateSim("ExitEat"); fish.Destroy(); Actor.Motives.ChangeValue(CommodityKind.Hunger, EWCatFishHere.kHungerGainFromEating); } else { if (message != "") { // Notify if the fish is interesting (new type or weight record) message += Localization.LocalizeString("Gameplay/Abstracts/ScriptObject/CatFishHere:PutFishInInventoryTns", Actor, fish.GetLocalizedName(), fish.Weight); Actor.ShowTNSIfSelectable(message, NotificationStyle.kGameMessagePositive); } AnimateSim("ExitInventory"); fish.UpdateVisualState(CatHuntingComponent.CatHuntingModelState.InInventory); if (!Actor.Inventory.TryToAdd(fish)) { fish.Destroy(); } } break; } } } else { AnimateSim("ExitFailure"); } } else { AnimateSim("ExitPrePounce"); } StandardExit(); return(loopFlag); }
public override bool Run() { EWCatFishingSkill skill = Actor.SkillManager.GetSkill <EWCatFishingSkill>(EWCatFishingSkill.SkillNameID); if (skill == null) { skill = (Actor.SkillManager.AddElement(EWCatFishingSkill.SkillNameID) as EWCatFishingSkill); if (skill == null) { return(false); } } if (!DrinkFromPondHelper.RouteToDrinkLocation(Hit.mPoint, Actor, Hit.mType, Hit.mId)) { return(false); } if (skill.OppFishercatCompleted) { skill.StartSkillGain(EWCatFishingSkill.kEWFishingSkillGainRateFishercat); } else { skill.StartSkillGain(EWCatFishingSkill.kEWFishingSkillGainRateNormal); } StandardEntry(); EnterStateMachine("CatHuntInPond", "Enter", "x"); AddOneShotScriptEventHandler(101u, (SacsEventHandler)(object)new SacsEventHandler(SnapOnExit)); BeginCommodityUpdates(); AnimateSim("PrePounceLoop"); // TODO: If we don't have an opportunity for catching fish faster, we should bool flag = DoTimedLoop(RandomUtil.GetFloat(kMinMaxPrePounceTime[0], kMinMaxPrePounceTime[1])); if (flag) { EventTracker.SendEvent(EventTypeId.kGoFishingCat, Actor); AnimateSim("FishLoop"); float successBonus = 0; if ((TerrainIsWaterPond && skill.OppPondProvisionerCompleted) || (!TerrainIsWaterPond && skill.OppSaltaholicCompleted)) { successBonus = EWCatFishingSkill.kFishCatchingBonus; } flag = RandomUtil.InterpolatedChance(0f, skill.MaxSkillLevel, kMinMaxSuccesChance[0] + successBonus, kMinMaxSuccesChance[1] + successBonus, skill.SkillLevel); if (flag) { FishType caughtFishType = GetCaughtFishType(Actor, Hit); Fish fish = Fish.CreateFishOfRandomWeight(caughtFishType, Actor.SimDescription); // Register will return a message if the fish is new or interesting string message = skill.RegisterCaughtFish(fish, TerrainIsWaterPond); if (fish.CatHuntingComponent != null) { fish.CatHuntingComponent.SetCatcher(Actor); } fish.UpdateVisualState(CatHuntingComponent.CatHuntingModelState.Carried); SetActor("fish", fish); if (Actor.Motives.GetValue(CommodityKind.Hunger) <= kEatFishHungerThreshold) { message += Localization.LocalizeString("Gameplay/Abstracts/ScriptObject/CatFishHere:EatFishTns", Actor, fish.GetLocalizedName(), fish.Weight); Actor.ShowTNSIfSelectable(message, NotificationStyle.kGameMessagePositive); AnimateSim("ExitEat"); fish.Destroy(); Actor.Motives.ChangeValue(CommodityKind.Hunger, kHungerGainFromEating); } else { message += Localization.LocalizeString("Gameplay/Abstracts/ScriptObject/CatFishHere:PutFishInInventoryTns", Actor, fish.GetLocalizedName(), fish.Weight); Actor.ShowTNSIfSelectable(message, NotificationStyle.kGameMessagePositive); AnimateSim("ExitInventory"); fish.UpdateVisualState(CatHuntingComponent.CatHuntingModelState.InInventory); if (!Actor.Inventory.TryToAdd(fish)) { fish.Destroy(); } } } else { Actor.ShowTNSIfSelectable(Localization.LocalizeString("Gameplay/Abstracts/ScriptObject/CatFishHere:FishFail", Actor.Name), NotificationStyle.kGameMessageNegative); AnimateSim("ExitFailure"); } } else { AnimateSim("ExitPrePounce"); } EndCommodityUpdates(flag); StandardExit(); skill.StopSkillGain(); return(true); }