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 mPoint = Hit.mPoint; FishingData fishingData = FishingSpot.GetFishingData(mPoint, Hit.mType); FishingSpotData fishingSpotData = fishingData as FishingSpotData; string str = (fishingSpotData == null) ? Localization.LocalizeString("Gameplay/Objects/Fishing:EmptyWater") : ((!fishingSpotData.IsActive) ? Localization.LocalizeString("Gameplay/Objects/Fishing:InactiveWater") : Localization.LocalizeString("Gameplay/Objects/Fishing:ActiveWater")); str += "\n"; List <FishType> fish = fishingData.GetFish(); List <int> chances = fishingData.GetChances(); EWCatFishingSkill skill = Actor.SkillManager.GetSkill <EWCatFishingSkill>(EWCatFishingSkill.SkillNameID); for (int i = 0; i < chances.Count; i++) { if (chances[i] > 0) { FishType fishType = fish[i]; if (fishType != FishType.None && fishType != FishType.Box) { // Only fish appropriate to skill or that sim "knows about" (has already caught) will be // displayed. This should be just like human fishing. str = str + "\n" + GetFishName(fish[i], skill); //str = str + "\n" + fish[i].ToString(); } } } Show(new Format(str, NotificationStyle.kGameMessagePositive)); return(true); }
public string GetFishName(FishType type, EWCatFishingSkill fishingSkill) { if (Fish.sFishData.TryGetValue(type, out FishData value) && fishingSkill != null && (fishingSkill.SkillLevel >= value.Level || fishingSkill.KnowsAbout(type))) { return(Localization.LocalizeString(value.StringKeyName)); } return(Localization.LocalizeString("Gameplay/Objects/Fishing:UnknownFish")); }
public override void MergeTravelData(Skill skill) { base.MergeTravelData(skill); EWCatFishingSkill fishing = skill as EWCatFishingSkill; mNumberFishCaught = fishing.mNumberFishCaught; mHeaviestFishWeight = fishing.mHeaviestFishWeight; mFishingInfo = fishing.mFishingInfo; mHeaviestTypeName = fishing.mHeaviestTypeName; mUniqueFishCaught = fishing.mUniqueFishCaught; }
public override bool Test(Sim a, Terrain target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { if (a.IsCat) { EWCatFishingSkill skill = a.SkillManager.GetSkill <EWCatFishingSkill>(EWCatFishingSkill.SkillNameID); if (skill != null && skill.SkillLevel >= 1) { return(true); } } return(false); }
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 FishCaught(EWCatFishingSkill skill) { mSkill = skill; }
public OppPondProvisioner(EWCatFishingSkill skill) { mSkill = skill; }
public OppSaltaholic(EWCatFishingSkill skill) { mSkill = skill; }
public OppSeafoodGourmet(EWCatFishingSkill skill) { mSkill = skill; }
public OppFishercat(EWCatFishingSkill skill) { mSkill = skill; }
public FreshwaterFishCaught(EWCatFishingSkill skill) { mSkill = skill; }
public SaltwaterFishCaught(EWCatFishingSkill skill) { mSkill = skill; }
public HeaviestFish(EWCatFishingSkill skill) { mSkill = skill; }
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); }