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() { 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 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); }