public override bool Test(Sim a, EquestrianCenter target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { PetPool pool; if (!PetPoolManager.TryGetPetPool(PetPoolType.BuySellHorse, out pool, false)) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(EquestrianCenter.BuyHorse.LocalizeString(a.IsFemale, "PoolEmpty", new object[0x0])); return false; } /* if (!a.Household.CanAddSpeciesToHousehold(CASAgeGenderFlags.Horse, 0x1, true)) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(EquestrianCenter.BuyHorse.LocalizeString(a.IsFemale, "TooManyPetsInHousehold", new object[0x0])); return false; } */ Lot lotHome = a.LotHome; if ((lotHome != null) && lotHome.HasVirtualResidentialSlots) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(PetAdoption.LocalizeString(a.IsFemale, "CannotAdoptHorse", new object[0])); return false; } return true; }
public override bool Test(Sim a, EquestrianCenter target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { PetPool pool; if (!PetPoolManager.TryGetPetPool(PetPoolType.BuySellHorse, out pool, false)) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(EquestrianCenter.BuyHorse.LocalizeString(a.IsFemale, "PoolEmpty", new object[0x0])); return(false); } /* * if (!a.Household.CanAddSpeciesToHousehold(CASAgeGenderFlags.Horse, 0x1, true)) * { * greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(EquestrianCenter.BuyHorse.LocalizeString(a.IsFemale, "TooManyPetsInHousehold", new object[0x0])); * return false; * } */ Lot lotHome = a.LotHome; if ((lotHome != null) && lotHome.HasVirtualResidentialSlots) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(PetAdoption.LocalizeString(a.IsFemale, "CannotAdoptHorse", new object[0])); return(false); } return(true); }
public override bool Test(Sim a, EquestrianCenter target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { if (target.IsActorUsingMe(a)) { return(false); } Posture posture = a.Posture as RidingPosture; if (posture == null) { posture = a.Posture as LeadingHorsePosture; if (posture == null) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(EquestrianCenter.OfferStallionAsStud.LocalizeString(a.IsFemale, "NeedHorse", new object[] { a })); return(false); } } Sim container = posture.Container as Sim; if (!container.IsSelectable) { return(false); } if (container.SimDescription.IsFemale) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(EquestrianCenter.OfferStallionAsStud.LocalizeString(a.IsFemale, "NeedMaleHorse", new object[] { a })); return(false); } else if (container.SimDescription.Child) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(EquestrianCenter.OfferStallionAsStud.LocalizeString(a.IsFemale, "NeedAdultHorse", new object[] { a })); return(false); } else if (container.SimDescription.Elder) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(EquestrianCenter.OfferStallionAsStud.LocalizeString(container.IsFemale, "ElderPetsTooOldForBreed", new object[] { container })); return(false); } /* * if (container.SimDescription.IsUnicorn) * { * greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(EquestrianCenter.OfferStallionAsStud.LocalizeString(a.IsFemale, "UnicornCannotBeOffered", new object[] { a })); * return false; * } */ Motives motives = container.Motives; if (motives.HasMotive(CommodityKind.StallionOffered) && (motives.GetValue(CommodityKind.StallionOffered) >= EquestrianCenter.kOfferStallionMotiveThreshold)) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(EquestrianCenter.OfferStallionAsStud.LocalizeString(a.IsFemale, "Cooldown", new object[] { a, container })); return(false); } return(true); }
public override bool Test(Sim a, EquestrianCenter target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { if (target.IsActorUsingMe(a)) { return false; } Posture posture = a.Posture as RidingPosture; if (posture == null) { posture = a.Posture as LeadingHorsePosture; if (posture == null) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(EquestrianCenter.OfferStallionAsStud.LocalizeString(a.IsFemale, "NeedHorse", new object[] { a })); return false; } } Sim container = posture.Container as Sim; if (!container.IsSelectable) { return false; } if (container.SimDescription.IsFemale) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(EquestrianCenter.OfferStallionAsStud.LocalizeString(a.IsFemale, "NeedMaleHorse", new object[] { a })); return false; } else if (container.SimDescription.Child) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(EquestrianCenter.OfferStallionAsStud.LocalizeString(a.IsFemale, "NeedAdultHorse", new object[] { a })); return false; } else if (container.SimDescription.Elder) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(EquestrianCenter.OfferStallionAsStud.LocalizeString(container.IsFemale, "ElderPetsTooOldForBreed", new object[] { container })); return false; } /* if (container.SimDescription.IsUnicorn) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(EquestrianCenter.OfferStallionAsStud.LocalizeString(a.IsFemale, "UnicornCannotBeOffered", new object[] { a })); return false; } */ Motives motives = container.Motives; if (motives.HasMotive(CommodityKind.StallionOffered) && (motives.GetValue(CommodityKind.StallionOffered) >= EquestrianCenter.kOfferStallionMotiveThreshold)) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(EquestrianCenter.OfferStallionAsStud.LocalizeString(a.IsFemale, "Cooldown", new object[] { a, container })); return false; } return true; }
public override bool Test(Sim a, EquestrianCenter target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { if (target.IsActorUsingMe(a)) { return(false); } Posture posture = a.Posture as RidingPosture; if (posture == null) { posture = a.Posture as LeadingHorsePosture; if (posture == null) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(EquestrianCenter.SellHorse.LocalizeString(a.IsFemale, "SimNeedsToBeRidingAHorse", new object[] { a })); return(false); } } Sim container = posture.Container as Sim; if (!container.IsSelectable) { return(false); } SimDescription simDescription = container.SimDescription; if (simDescription.Child) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(Localization.LocalizeString(a.IsFemale, "Gameplay/Objects/RabbitHoles/EquestrianCenter/OfferStallionAsStud:NeedAdultHorse", new object[] { a })); return(false); } /* * if (simDescription.IsUnicorn) * { * greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(EquestrianCenter.SellHorse.LocalizeString(a.IsFemale, "UnicornCannotBeSold", new object[0x0])); * return false; * } */ SocialWorkerPetPutUp instance = SocialWorkerPetPutUp.Instance; Lot lotHome = container.LotHome; if ((((instance != null) && (lotHome != null)) && (instance.IsServiceRequested(lotHome) || instance.IsAnySimAssignedToLot(lotHome))) && (instance.PetToPutUp == simDescription)) { return(false); } return(true); }
public override bool Test(Sim a, EquestrianCenter target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { if (target.IsActorUsingMe(a)) { return false; } Posture posture = a.Posture as RidingPosture; if (posture == null) { posture = a.Posture as LeadingHorsePosture; if (posture == null) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(EquestrianCenter.SellHorse.LocalizeString(a.IsFemale, "SimNeedsToBeRidingAHorse", new object[] { a })); return false; } } Sim container = posture.Container as Sim; if (!container.IsSelectable) { return false; } SimDescription simDescription = container.SimDescription; if (simDescription.Child) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(Localization.LocalizeString(a.IsFemale, "Gameplay/Objects/RabbitHoles/EquestrianCenter/OfferStallionAsStud:NeedAdultHorse", new object[] { a })); return false; } /* if (simDescription.IsUnicorn) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(EquestrianCenter.SellHorse.LocalizeString(a.IsFemale, "UnicornCannotBeSold", new object[0x0])); return false; } */ SocialWorkerPetPutUp instance = SocialWorkerPetPutUp.Instance; Lot lotHome = container.LotHome; if ((((instance != null) && (lotHome != null)) && (instance.IsServiceRequested(lotHome) || instance.IsAnySimAssignedToLot(lotHome))) && (instance.PetToPutUp == simDescription)) { return false; } return true; }
public override bool Test(Sim a, EquestrianCenter target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { /* * if (!target.DoorsOpen) * { * if (this.IsFirstLevel) * { * if (target.ShowInProgress) * { * greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(EquestrianCenter.EnterEquestrianCompetition.LocalizeString(a.IsFemale, "DoorsClosed", new object[0x0])); * } * else * { * greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(EquestrianCenter.EnterEquestrianCompetition.LocalizeString(a.IsFemale, "DoorsNeedToBeOpen", new object[] { a })); * } * } * return false; * } */ if (target.IsActorUsingMe(a)) { return(false); } if (!(a.Posture is RidingPosture) && !(a.Posture is LeadingHorsePosture)) { if (IsFirstLevel) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(EquestrianCenter.EnterEquestrianCompetition.LocalizeString(a.IsFemale, "RequiresHorse", new object[] { a })); } return(false); } if (IsFirstLevel) { return(false); } return(EquestrianCenter.EnterEquestrianCompetition.CanEnterCompetition(CompetitionType, CompetitionLevel, a, CannotEnterCompetition, ref greyedOutTooltipCallback)); }
public override bool Test(Sim a, EquestrianCenter target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { if (target.IsActorUsingMe(a)) { return(false); } Posture posture = a.Posture as RidingPosture; if (posture == null) { posture = a.Posture as LeadingHorsePosture; if (posture == null) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(EquestrianCenter.BreedMare.LocalizeString(a.IsFemale, "NeedHorse", new object[] { a })); return(false); } } Sim container = posture.Container as Sim; if (!container.IsSelectable) { return(false); } if (!container.SimDescription.IsFemale) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(EquestrianCenter.BreedMare.LocalizeString(a.IsFemale, "NeedFemaleHorse", new object[] { a })); return(false); } if (container.SimDescription.Child) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(EquestrianCenter.BreedMare.LocalizeString(a.IsFemale, "NeedAdultHorse", new object[] { a })); return(false); } if (container.SimDescription.Elder) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(EquestrianCenter.BreedMare.LocalizeString(container.IsFemale, "ElderPetsTooOldForBreed", new object[] { container })); return(false); } /* Removed * if (container.SimDescription.IsUnicorn) * { * greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(EquestrianCenter.BreedMare.LocalizeString(a.IsFemale, "UnicornCannotBeBreed", new object[] { a })); * return false; * } * if (!container.Household.CanAddSpeciesToHousehold(container.SimDescription.Species, 0x1, true)) * { * greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(EquestrianCenter.BreedMare.LocalizeString(container.IsFemale, "TooManyHorsesInHousehold", new object[] { container })); * return false; * } */ if (container.SimDescription.IsPregnant) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(EquestrianCenter.BreedMare.LocalizeString(container.IsFemale, "AlreadyPregnant", new object[] { container })); return(false); } return(true); }
protected override bool PrivateUpdate(ScenarioFrame frame) { mPushes++; if (Sim.CreatedSim == null) { IncStat("Hibernating"); return false; } else if (Sim.CreatedSim.InteractionQueue == null) { IncStat("No Queue"); return false; } if (mPushes <= 1) { Sim.CreatedSim.InteractionQueue.CancelAllInteractions(); } bool maxSkill = true; List<SkillNames> practiceSkills = new List<SkillNames>(); RidingSkill riding = Sim.SkillManager.GetSkill<RidingSkill>(SkillNames.Riding); if ((riding == null) || (!riding.ReachedMaxLevel())) { maxSkill = false; practiceSkills.Add(SkillNames.Riding); } Racing racing = mHorse.SkillManager.GetSkill<Racing>(SkillNames.Racing); if ((racing == null) || (!racing.ReachedMaxLevel())) { maxSkill = false; practiceSkills.Add(SkillNames.Racing); } Jumping jumping = mHorse.SkillManager.GetSkill<Jumping>(SkillNames.Jumping); if ((jumping == null) || (!jumping.ReachedMaxLevel())) { maxSkill = false; practiceSkills.Add(SkillNames.Jumping); } List<EquestrianCenter> lotCenters = new List<EquestrianCenter>(); List<EquestrianCenter> centers = new List<EquestrianCenter>(); foreach (EquestrianCenter hole in Sims3.Gameplay.Queries.GetObjects<EquestrianCenter>()) { if (Sim.CreatedSim.LotCurrent == hole.LotCurrent) { lotCenters.Add(hole); } centers.Add(hole); } if (lotCenters.Count > 0) { centers = lotCenters; } EquestrianCenter center = null; if (centers.Count > 0) { center = RandomUtil.GetRandomObjectFromList(centers); } else { IncStat("No Centers"); } if (center != null) { CompetitionType type = CompetitionType.Racing; bool canCompete = (maxSkill) || (RandomUtil.CoinFlip()); if (canCompete) { List<CompetitionType> types = new List<CompetitionType>(sTypes); while (types.Count > 0) { type = RandomUtil.GetRandomObjectFromList(types); types.Remove(type); canCompete = false; switch (type) { case CompetitionType.CrossCountry: if (RidingSkill.CanEnterCrossCountryCompetition(Sim)) { canCompete = true; } break; case CompetitionType.Jumping: if (!RidingSkill.CanEnterJumpingCompetition(Sim)) { canCompete = true; } break; case CompetitionType.Racing: if (!RidingSkill.CanEnterRacingCompetition(Sim)) { canCompete = true; } break; } if (canCompete) { break; } } } if (canCompete) { List<CompetitionLevel> levels = new List<CompetitionLevel>(); foreach (CompetitionLevel level in sLevels) { GreyedOutTooltipCallback callback = null; if (EquestrianCenter.EnterEquestrianCompetition.CanEnterCompetition(type, level, Sim.CreatedSim, false, ref callback)) { levels.Add(level); } } if (levels.Count == 0) { IncStat("No Levels"); } else { CompetitionLevel level = RandomUtil.GetRandomObjectFromList(levels); if (Common.kDebugging) { Common.DebugNotify("Compete " + type + " " + level, Sim.CreatedSim); } if (!Situations.PushVisit(this, Sim, center.LotCurrent)) { IncStat("Visit Fail"); return false; } else if (Situations.PushInteraction<EquestrianCenter>(this, Sim, center, new EnterEquestrianCompetitionEx.Definition(type, level))) { return true; } else { IncStat("Competition Fail"); } } } } if (practiceSkills.Count == 0) { IncStat("No Practice Skills"); return false; } bool practiceJumping = true; if ((riding != null) & (riding.SkillLevel >= RidingSkill.kLevelForTrainForRacing)) { switch (RandomUtil.GetRandomObjectFromList(practiceSkills)) { case SkillNames.Riding: practiceJumping = RandomUtil.CoinFlip(); break; case SkillNames.Racing: practiceJumping = false; break; } } if (!practiceJumping) { List<TrainingPosts> lotPosts = new List<TrainingPosts>(); List<TrainingPosts> posts = new List<TrainingPosts>(); foreach(TrainingPosts post in Sims3.Gameplay.Queries.GetObjects<TrainingPosts>()) { if (Sim.CreatedSim.LotCurrent == post.LotCurrent) { lotPosts.Add(post); } posts.Add(post); } if (lotPosts.Count > 0) { posts = lotPosts; } if (posts.Count > 0) { TrainingPosts choice = RandomUtil.GetRandomObjectFromList(posts); if (!Situations.PushVisit(this, Sim, choice.LotCurrent)) { IncStat("Visit Fail"); return false; } else if (Situations.PushInteraction<TrainingPosts>(this, Sim, choice, new ManagerSituation.WithCallbackPush(Manager, TrainingPosts.RiderTrainForRacing.Singleton, null, null, new MountScenario(Sim, mPushes)))) { return true; } else { IncStat("Traning Fail"); } } } int ridingSkill = 0; if (riding != null) { ridingSkill = riding.SkillLevel; } List<HorseJump> lotJumps = new List<HorseJump>(); List<HorseJump> jumps = new List<HorseJump>(); foreach (HorseJump jump in Sims3.Gameplay.Queries.GetObjects<HorseJump>()) { if (jump.LotCurrent == null) continue; if (!jump.LotCurrent.IsCommunityLot) { if (!jump.LotCurrent.CanSimTreatAsHome(Sim.CreatedSim)) continue; } if (jump.JumpTuning == null) continue; if (jump.JumpTuning.HighSuccessChances[ridingSkill] < 0.75) continue; if (Sim.CreatedSim.LotCurrent == jump.LotCurrent) { lotJumps.Add(jump); } jumps.Add(jump); } if (lotJumps.Count > 0) { jumps = lotJumps; } if (jumps.Count > 0) { HorseJump choice = RandomUtil.GetRandomObjectFromList(jumps); if (!Situations.PushVisit(this, Sim, choice.LotCurrent)) { IncStat("Visit Fail"); return false; } else if (Situations.PushInteraction<HorseJump>(this, Sim, choice, new ManagerSituation.WithCallbackPush(Manager, HorseJump.Jump.Singleton, null, null, new MountScenario(Sim, mPushes)))) { return true; } else { IncStat("Jump Fail"); return false; } } else { IncStat("No Jump Choices"); return false; } }
public override bool Test(Sim a, EquestrianCenter target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { /* if (!target.DoorsOpen) { if (this.IsFirstLevel) { if (target.ShowInProgress) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(EquestrianCenter.EnterEquestrianCompetition.LocalizeString(a.IsFemale, "DoorsClosed", new object[0x0])); } else { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(EquestrianCenter.EnterEquestrianCompetition.LocalizeString(a.IsFemale, "DoorsNeedToBeOpen", new object[] { a })); } } return false; } */ if (target.IsActorUsingMe(a)) { return false; } if (!(a.Posture is RidingPosture) && !(a.Posture is LeadingHorsePosture)) { if (IsFirstLevel) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(EquestrianCenter.EnterEquestrianCompetition.LocalizeString(a.IsFemale, "RequiresHorse", new object[] { a })); } return false; } if (IsFirstLevel) { return false; } return EquestrianCenter.EnterEquestrianCompetition.CanEnterCompetition(CompetitionType, CompetitionLevel, a, CannotEnterCompetition, ref greyedOutTooltipCallback); }
public override string GetInteractionName(Sim actor, EquestrianCenter target, InteractionObjectPair iop) { return base.GetInteractionName(actor, target, new InteractionObjectPair(EquestrianCenter.EnterEquestrianCompetition.Singleton, target)); }
public override string GetInteractionName(Sim actor, EquestrianCenter target, InteractionObjectPair iop) { return(base.GetInteractionName(actor, target, new InteractionObjectPair(EquestrianCenter.EnterEquestrianCompetition.Singleton, target))); }
public override bool Test(Sim a, EquestrianCenter target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { if (target.IsActorUsingMe(a)) { return false; } Posture posture = a.Posture as RidingPosture; if (posture == null) { posture = a.Posture as LeadingHorsePosture; if (posture == null) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(EquestrianCenter.BreedMare.LocalizeString(a.IsFemale, "NeedHorse", new object[] { a })); return false; } } Sim container = posture.Container as Sim; if (!container.IsSelectable) { return false; } if (!container.SimDescription.IsFemale) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(EquestrianCenter.BreedMare.LocalizeString(a.IsFemale, "NeedFemaleHorse", new object[] { a })); return false; } if (container.SimDescription.Child) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(EquestrianCenter.BreedMare.LocalizeString(a.IsFemale, "NeedAdultHorse", new object[] { a })); return false; } if (container.SimDescription.Elder) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(EquestrianCenter.BreedMare.LocalizeString(container.IsFemale, "ElderPetsTooOldForBreed", new object[] { container })); return false; } /* Removed if (container.SimDescription.IsUnicorn) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(EquestrianCenter.BreedMare.LocalizeString(a.IsFemale, "UnicornCannotBeBreed", new object[] { a })); return false; } if (!container.Household.CanAddSpeciesToHousehold(container.SimDescription.Species, 0x1, true)) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(EquestrianCenter.BreedMare.LocalizeString(container.IsFemale, "TooManyHorsesInHousehold", new object[] { container })); return false; } */ if (container.SimDescription.IsPregnant) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(EquestrianCenter.BreedMare.LocalizeString(container.IsFemale, "AlreadyPregnant", new object[] { container })); return false; } return true; }