public static void OnAccept(Sim actor, Sim target, string interaction, ActiveTopic topic, InteractionInstance i) { try { // Reset the attraction so it is recalculated now RelationshipEx.CalculateAttractionScore(Relationship.Get(target.SimDescription, actor.SimDescription, false), true); int score = (int)RelationshipEx.GetAttractionScore(target.SimDescription, actor.SimDescription, true); int index = score / 10; if (index >= 10) { index = 9; } else if (index < 0) { index = 0; } Common.Notify(Common.Localize("CheckAttraction:Result" + index, actor.IsFemale, target.IsFemale, new object[] { actor, target }), actor.ObjectId, target.ObjectId, StyledNotification.NotificationStyle.kSimTalking); } catch (Exception e) { Common.Exception(actor, target, e); } }
public override void Perform(Sim sim, DiseaseVector vector) { if (sim.OccultManager== null) return; if (mRemove) { OccultTypeHelper.Remove(sim.SimDescription, mOccult, true); } else { if (sim.OccultManager.HasOccultType(mOccult)) return; if (mDropOthers) { foreach (OccultTypes type in Enum.GetValues(typeof(OccultTypes))) { if (type == OccultTypes.None) continue; OccultTypeHelper.Remove(sim.SimDescription, type, true); } } OccultTypeHelper.Add(sim.SimDescription, mOccult, false, true); } }
public override bool Test(Sim a, Sim target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { OccultImaginaryFriend friend; if (!OccultImaginaryFriend.TryGetOccultFromSim(target, out friend) || friend.IsReal) { return false; } if (friend.OwnerSimDescriptionId != a.SimDescription.SimDescriptionId) { return false; } Relationship relationship = Relationship.Get(a, target, false); bool flag = (relationship != null) && (relationship.CurrentLTRLiking >= OccultImaginaryFriend.kRelationshipThresholdBeforeCanTurnFriendReal); if (a.Inventory.Find<IImaginaryFriendPotion>(true) == null) { if (flag) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(OccultImaginaryFriend.LocalizeString(a.IsFemale, "NeedImaginaryFriendPotion", new object[] { a })); } return false; } if (!flag) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(OccultImaginaryFriend.LocalizeString(new bool[] { a.IsFemale, target.IsFemale }, "NeedRelToUseImaginaryFriendPotion", new object[] { a, target })); return false; } return true; }
public static void HandleCharacterCreate(PacketStream P, ref LoginClient Client, ref CityServerListener CServerListener) { byte PacketLength = (byte)P.ReadByte(); //Length of the unencrypted data, excluding the header (ID, length, unencrypted length). byte UnencryptedLength = (byte)P.ReadByte(); P.DecryptPacket(Client.EncKey, Client.CryptoService, UnencryptedLength); Logger.LogDebug("Received CharacterCreate!"); string AccountName = P.ReadString(); Sim Char = new Sim(P.ReadString()); Char.Timestamp = P.ReadString(); Char.Name = P.ReadString(); Char.Sex = P.ReadString(); Char.CreatedThisSession = true; Client.CurrentlyActiveSim = Char; switch (Character.CreateCharacter(Char)) { case CharacterCreationStatus.NameAlreadyExisted: //TODO: Send packet. break; case CharacterCreationStatus.ExceededCharacterLimit: //TODO: Send packet. break; } }
public static bool CallbackTest(Sim actor, Sim target, ActiveTopic topic, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { try { if (target.Household == null) { greyedOutTooltipCallback = Common.DebugTooltip("No Household"); return false; } if (target.Household == actor.Household) { greyedOutTooltipCallback = Common.DebugTooltip("Same Household"); return false; } if (target.Household.IsSpecialHousehold) { greyedOutTooltipCallback = Common.DebugTooltip("Special Household"); return false; } return true; } catch (Exception e) { Common.Exception(actor, target, e); return false; } }
public static bool SatisfiesLikingGate(Sim sim, Sim target) { if ((target.IsSelectable) && (GoHere.Settings.mDisallowActiveGoHome)) return true; if (IsAlone(target)) return true; foreach (SimDescription member in Households.All(sim.Household)) { if (target.SimDescription.TeenOrAbove) { if (member.ChildOrBelow) continue; } float liking = 0; Relationship relation = Relationship.Get(member, target.SimDescription, false); if (relation != null) { liking = relation.CurrentLTRLiking; } if (liking >= GoHere.Settings.mRudeGuestLikingGate) { return true; } } return false; }
public static CommodityKind[] GetMotives(Sim sim) { if (sim != null) { if (sim.IsPet) { if (sim.IsADogSpecies) { return kDogMotives; } if (sim.IsCat) { return kCatMotives; } if (sim.IsHorse) { return kHorseMotives; } } if (sim.SimDescription.YoungAdultOrAbove && sim.SimDescription.IsVampire) { return kVampireMotives; } if (sim.SimDescription.IsAlienEvolved) { return kAlienMotives; } } return kMotives; }
public override void Perform(Sim sim, DiseaseVector vector) { if (SimTypes.IsDead(sim.SimDescription)) return; if (!mAllowActive) { if (SimTypes.IsSelectable(sim)) return; } if (sim.InteractionQueue == null) return; SimDescription.DeathType type = mType; if (type == SimDescription.DeathType.None) { List<SimDescription.DeathType> choices = new List<SimDescription.DeathType>(); foreach (SimDescription.DeathType choice in Enum.GetValues(typeof(SimDescription.DeathType))) { if (!OccultTypeHelper.IsInstalled(choice)) continue; choices.Add(choice); } if (choices.Count == 0) return; type = RandomUtil.GetRandomObjectFromList(choices); } InteractionInstance entry = Urnstone.KillSim.Singleton.CreateInstance(sim, sim, new InteractionPriority(InteractionPriorityLevel.MaxDeath, 0f), false, false); (entry as Urnstone.KillSim).simDeathType = type; sim.InteractionQueue.Add(entry); }
public override bool Test(Sim a, WeddingArch target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { try { SimDescription partner = a.Partner; if (partner == null) { return false; } Sim createdSim = partner.CreatedSim; if ((createdSim == null) || !a.IsEngaged) { return false; } if (createdSim.LotCurrent != target.LotCurrent) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(WeddingArch.LocalizeString(a.IsFemale, "FianceNotOnLot", new object[] { createdSim })); return false; } string reason; if (!CommonSocials.CanGetRomantic(a, createdSim, false, false, true, ref greyedOutTooltipCallback, out reason)) { return false; } return CommonSocials.CanGetMarriedNow(a, createdSim, isAutonomous, false, ref greyedOutTooltipCallback); } catch (Exception e) { Common.Exception(a, target, e); return false; } }
public override void Grant(Sim actor, object target) { if (actor.SimDescription.IsPregnant) return; Sim targetSim = target as Sim; if (targetSim == null) { List<SimDescription> choices = new List<SimDescription>(); foreach (SimDescription sim in Household.AllSimsLivingInWorld()) { if (sim.CreatedSim == null) continue; if (sim.TeenOrBelow) continue; if (sim.Gender == actor.SimDescription.Gender) continue; if (sim.TraitManager.HasElement(TraitNames.Good)) continue; if (sim.TraitManager.HasElement(TraitNames.Friendly)) continue; choices.Add(sim); } if (choices.Count == 0) return; targetSim = RandomUtil.GetRandomObjectFromList(choices).CreatedSim; } Pregnancy.Start(actor, targetSim); }
public override float GetMana(Sim sim) { OccultUnicorn unicorn = sim.OccultManager.GetOccultType(OccultTypes.Unicorn) as OccultUnicorn; if (unicorn == null) return 0; return unicorn.MagicPoints.mCurrentMagicPointValue; }
public override bool Test(Sim a, Book target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { if (target is BookToddler) { if (!a.Inventory.Contains(target)) { if (isAutonomous) return false; } if (a.LotHome != a.LotCurrent) return false; } else { if (a.Inventory.Contains(target) && (a.LotCurrent != a.LotHome)) { return false; } } if (target.InUse || (Bookshelf.FindClosestBookshelf(a, target, a.Inventory.Contains(target)) == null)) { return false; } if (!target.IsServiceableBySim(a)) { return false; } return true; }
public static void ReactToSkinnyDippers(Sim sim, GameObject objectSkinnyDippedIn, InteractionDefinition skinnyDipInteraction, List<ulong> skinnyDipperList) { if (!sim.SimDescription.TeenOrBelow && ((skinnyDipperList != null) && (skinnyDipperList.Count != 0x0))) { List<ulong> skinnyDippers = new List<ulong>(skinnyDipperList); skinnyDippers.Remove(sim.SimDescription.SimDescriptionId); if (skinnyDippers.Count != 0x0) { bool flag = Pool.ShouldReactPositiveToSkinnyDipper(sim, skinnyDippers); bool flag2 = false; if (flag && !sim.HasTrait(TraitNames.Hydrophobic)) { flag2 = RandomUtil.RandomChance(Pool.kChancePositiveReactionSimsJoin); } SimDescription simDesc = SimDescription.Find(RandomUtil.GetRandomObjectFromList(skinnyDippers)); if (simDesc != null) { Sim createdSim = simDesc.CreatedSim; Pool.ReactToSkinnyDipper instance = Pool.ReactToSkinnyDipper.Singleton.CreateInstance(createdSim, sim, new InteractionPriority(InteractionPriorityLevel.UserDirected), false, true) as Pool.ReactToSkinnyDipper; instance.IsPositive = flag; instance.ShouldJoin = flag2; instance.DippingObject = objectSkinnyDippedIn; instance.SkinnyDipInteraction = skinnyDipInteraction; sim.InteractionQueue.AddNextIfPossible(instance); } } } }
public override void AddInteractions(InteractionObjectPair iop, Sim actor, SchoolRabbitHole target, List<InteractionObjectPair> results) { foreach (AfterschoolActivityData data in AfterschoolActivityBooter.Activities.Values) { results.Add(new InteractionObjectPair(new Definition(data.mActivity.CurrentActivityType), iop.Target)); } }
/// <summary> /// /// </summary> /// <param name="interactionName"></param> /// <returns></returns> public static List<IMiniSimDescription> ShowSimSelector(Sim actor, Household currentHousehold, string interactionName) { List<IMiniSimDescription> residents = new List<IMiniSimDescription>(); string buttonFalse = Localization.LocalizeString("Ui/Caption/ObjectPicker:Cancel", new object[0]); List<PhoneSimPicker.SimPickerInfo> list = new List<PhoneSimPicker.SimPickerInfo>(); List<object> list2; //Create list of sims foreach (Sim s in currentHousehold.Sims) { list.Add(Phone.Call.CreateBasicPickerInfo(actor.SimDescription, s.SimDescription)); } list2 = PhoneSimPicker.Show(true, ModalDialog.PauseMode.PauseSimulator, list, interactionName, interactionName, buttonFalse, currentHousehold.Sims.Count, false); if (list2 == null || list2.Count == 0) { return null; } foreach (var item in list2) { residents.Add(item as SimDescription); } return residents; }
public override bool Test(Sim a, JuiceKeg target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { try { if (target.IsHaunted) { return false; } if (!Woohooer.Settings.mUnlockTeenActions) { if (a.SimDescription.TeenOrBelow) { return false; } } if (target.IsEmpty()) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(JuiceKeg.LocalizeString("OutOfJuice", new object[0x0])); return false; } return true; } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(a, target, e); return false; } }
public static void BeforeDiagnose(Sim actor, Sim target, string interaction, ActiveTopic topic, InteractionInstance i) { try { FreeClinicSessionSituation freeClinicSessionSituation = FreeClinicSessionSituation.GetFreeClinicSessionSituation(actor); if (freeClinicSessionSituation != null) { freeClinicSessionSituation.NumVaccinations++; freeClinicSessionSituation.AddToIgnoreList(target); freeClinicSessionSituation.BringRandomSimsToSession(0x1); /* HealthManager healthManager = target.SimDescription.HealthManager; if (healthManager != null) { healthManager.Vaccinate(); } */ } } catch (Exception e) { Common.Exception(actor, target, e); } }
public override float GetMana(Sim sim) { OccultGenie genie = sim.OccultManager.GetOccultType(OccultTypes.Genie) as OccultGenie; if (genie == null) return 0; return genie.MagicPoints.mCurrentMagicPointValue; }
public IList<Sim> Load() { using (MySqlConnection conn = new MySqlConnection("server = localhost; user id = root; password = ; database = test")) { conn.Open(); var cmd = conn.CreateCommand(); cmd.CommandText = "set character set 'utf8'"; cmd.ExecuteNonQuery(); var cmdText = @"select * from sim"; cmd = conn.CreateCommand(); cmd.CommandText = cmdText; var reader = cmd.ExecuteReader(); var cityList = new List<Sim>(); while (reader.Read()) { var city = new Sim() { ID = reader.GetInt32("id"), QuestID = reader.GetInt32("quest_id"), CompareID = reader.GetInt32("compare_id"), Value = reader.GetInt32("value"), }; cityList.Add(city); } reader.Close(); return cityList; } }
public override bool Test(Sim actor, Lot target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { // Stops the dead from leaving the cemetery if ((actor.SimDescription.IsDead) && (!actor.SimDescription.IsPlayableGhost)) return false; return base.Test(actor, target, isAutonomous, ref greyedOutTooltipCallback); }
public virtual void Update(float worldTime, Sim.Environment.Terrain t) { float floorPos = t.CalculateHeight(Position.X, Position.Z) + 20; if (currentWaypoint != null) { // the agent has a waypoint in the queue if (distanceToTravel <= 0) { // the agent has reached or just passed its destination, so it uses the next waypoint currentWaypoint = currentWaypoint.Next; SetMovement(); } else { distanceToTravel -= speed; } } position = position + velocity; position.Y = (float)Math.Sin(worldTime * 0.006f + randomOffset)*4 + floorPos + 5; light.MoveTo(Position); if (Updated != null) { Updated(this, EventArgs.Empty); info = String.Format("- Color: {0}", light.Color); } }
public override bool Test(Sim a, RabbitHole target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { try { if (a.FamilyFunds < CollegeOfBusiness.kCostOfBudgetClass) { return false; } if (!SimClock.IsTimeBetweenTimes(CollegeOfBusiness.AttendBudgetClass.kStartAvailibilityTime, CollegeOfBusiness.AttendBudgetClass.kEndAvailibilityTime)) { return false; } /* if (!GameUtils.IsUniversityWorld()) { return false; } */ float num = 0f; if (CollegeOfBusiness.AttendBudgetClass.sCooldownDict.TryGetValue(a.SimDescription.SimDescriptionId, out num)) { return ((SimClock.ElapsedTime(TimeUnit.Hours) - num) > CollegeOfBusiness.AttendBudgetClass.kInteractionCooldown); } return true; } catch (Exception e) { Common.Exception(a, target, e); return false; } }
public static void ApplyPostShowerEffects(Sim actor, IShowerable shower) { BuffManager buffManager = actor.BuffManager; buffManager.RemoveElement(BuffNames.Singed); buffManager.RemoveElement(BuffNames.SingedElectricity); buffManager.RemoveElement(BuffNames.GarlicBreath); SimDescription simDescription = actor.SimDescription; simDescription.RemoveFacePaint(); if (simDescription.IsMummy) { buffManager.AddElement(BuffNames.Soaked, Origin.FromShower); } if (RandomUtil.RandomChance((float)shower.TuningShower.ChanceOfExhileratingShowerBuff)) { buffManager.AddElement(BuffNames.ExhilaratingShower, Origin.FromNiceShower); } if (actor.HasTrait(TraitNames.Hydrophobic)) { actor.PlayReaction(ReactionTypes.Cry, shower as GameObject, ReactionSpeed.AfterInteraction); } else if (shower.ShouldGetColdShower) { actor.BuffManager.AddElement(BuffNames.ColdShower, Origin.FromCheapShower); EventTracker.SendEvent(EventTypeId.kGotColdShowerBuff, actor, shower); } // Custom else if ((shower.Cleanable != null) && (shower.Cleanable.NeedsToBeCleaned)) { actor.PlayReaction(ReactionTypes.Retch, shower as GameObject, ReactionSpeed.AfterInteraction); } actor.Motives.SetMax(CommodityKind.Hygiene); }
public override bool Test(Sim a, VoucherCloneMe target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { target.TargetScienceLab = Voucher.FindNearestScienceLab(a); if (target.TargetScienceLab == null) { return false; } /* if (!Household.ActiveHousehold.CanAddSpeciesToHousehold(a.SimDescription.Species)) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(Localization.LocalizeString(a.IsFemale, "Gameplay/Objects/RabbitHoles/ScienceLab:HouseholdTooLarge", new object[0x0])); return false; } if (a.OccultManager.HasAnyOccultType()) { return false; } if (a.SimDescription.IsGhost) { return false; } */ if (GameUtils.IsOnVacation()) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(Localization.LocalizeString(a.IsFemale, "Ui/Tooltip/Vacation/GreyedoutTooltip:InteractionNotValidOnVacation", new object[0x0])); return false; } return true; }
private bool TryDeductFunds(TattooChair ths, Sim giver, Sim receiver) { if (giver == receiver) { if (giver.FamilyFunds >= Tattooing.kCostTattooSelf) { receiver.ModifyFunds(-Tattooing.kCostTattooSelf); return true; } return false; } if (giver == ths.GetTattooArtist()) { if (!CelebrityManager.TryModifyFundsWithCelebrityDiscount(receiver, giver, Tattooing.kCostTattooFromTattooArtist, true)) { return false; } return true; } if (!CelebrityManager.TryModifyFundsWithCelebrityDiscount(receiver, giver, Tattooing.kCostTattooFromSim, true)) { return false; } return true; }
public static void OnAccept(Sim actor, Sim target, string interaction, ActiveTopic topic, InteractionInstance i) { try { actor.Motives.SetDecay(CommodityKind.Fun, true); target.Motives.SetDecay(CommodityKind.Fun, true); actor.Motives.ChangeValue(CommodityKind.Fun, Jetpack.kFunGainJetPackWoohoo); target.Motives.ChangeValue(CommodityKind.Fun, Jetpack.kFunGainJetPackWoohoo); if (CommonPregnancy.IsSuccess(actor, target, i.Autonomous, CommonWoohoo.WoohooStyle.TryForBaby)) { CommonPregnancy.Impregnate(actor, target, i.Autonomous, CommonWoohoo.WoohooStyle.TryForBaby); } CommonWoohoo.RunPostWoohoo(actor, target, actor.GetActiveJetpack(), CommonWoohoo.WoohooStyle.TryForBaby, CommonWoohoo.WoohooLocation.Jetpack, true); } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(actor, target, e); } }
public override void AddInteractions(InteractionObjectPair iop, Sim actor, Sim target, List<InteractionObjectPair> results) { bool ungreeted = false; if (Skills.Assassination.StaticGuid != SkillNames.None) { Relationship relationship = Relationship.Get(target, actor, false); if ((relationship == null) || (relationship.LTR.CurrentLTR == LongTermRelationshipTypes.Stranger)) { ungreeted = true; } else if (target.NeedsToBeGreeted(actor)) { ungreeted = true; } } if (ungreeted) { foreach (SimDescription.DeathType type in Assassination.Types.Keys) { if (ActionData.Get("NRaas Assassin " + type) != null) { results.Add(new InteractionObjectPair(new Definition("NRaas Assassin " + type), target)); } } } }
public static void PayForWorkOut(Sim sim, Lot lot, int fee) { if (lot.IsCommunityLot) { //Pay if we don't own the lot Household lotOwner = ReturnLotOwner(lot); //If we don't own the lot if (lotOwner != null && lotOwner != sim.Household) { lotOwner.ModifyFamilyFunds(fee); //pay if we have the money, if not add to next bill if (sim.FamilyFunds >= fee) { sim.Household.ModifyFamilyFunds(-fee); } else { sim.Household.UnpaidBills += fee; } } else { //if the lot has no owner, or we don't own the lot if (lotOwner == null || (lotOwner != null && lotOwner != sim.Household)) { sim.Household.ModifyFamilyFunds(-fee); } } } }
public override bool Test(Sim actor, Sim target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { try { HotairBalloon.InBalloonPosture posture = actor.Posture as HotairBalloon.InBalloonPosture; if (posture == null) { return false; } if (posture.Balloon.GetOtherSim(actor) == null) { return false; } // Custom return HotAirBalloonProposal.ProposalTest(posture.Balloon, actor, target, isAutonomous, ref greyedOutTooltipCallback); } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(actor, target, e); return false; } }
public SimID(Sim sim) { if ((sim != null) && (sim.SimDescription != null)) { mID = sim.SimDescription.SimDescriptionId; } }
public override bool CanShareBed(Sim newSim, CommodityKind use, out Sim incompatibleSim) { return(BedController.CanShareBed(this, newSim, use, out incompatibleSim)); }
public bool Allow(IHasPersonality stats, Sim sim) { return(PrivateAllow(stats, sim)); }
public static Vehicle Sim_GetVehicle(Sim ths, Lot lot, bool allowUFO) { if (ths.IsPet) { return(null); } var vehicleForCurrentInteraction = ths.GetVehicleForCurrentInteraction(); if (vehicleForCurrentInteraction != null && !(vehicleForCurrentInteraction is Boat)) { return(vehicleForCurrentInteraction); } bool child = ths.Posture == null || !ths.Posture.Satisfies(CommodityKind.CarryingChild, null); bool canDrive = ths.CanDriveOrCallTaxi(); if (canDrive && !Vehicle.WorldHasSpecialCarRules(GameUtils.GetCurrentWorld()) && (!(ths.SimRoutingComponent != null && ths.SimRoutingComponent.AllowBikes) || (ths.Autonomy != null && ths.Autonomy.SituationComponent != null && ths.Autonomy.SituationComponent.InSituationOfType(typeof(GoHereWithSituation))) || ths.CurrentInteraction is TravelUtil.SitInCarToTriggerTravel || ths.CurrentInteraction is TravelUtil.SitInCarToReturnHomeWithinHomeWorld)) { child = false; } Vehicle vehicle = null; vehicle = ths.GetOwnedAndUsableVehicle(lot, true, child && !ths.IsHoldingAnything(), !GameUtils.IsInstalled(ProductVersion.EP4), allowUFO); if (vehicle == null || vehicle.HasBeenDestroyed) { if (canDrive) { if (ths.SimDescription == null) { return(null); } if (child) { vehicle = Vehicle_CreateTaxiBicycle(ths.SimDescription.Child); } else if (ths.SimDescription.CanDrive && ths.IsHoldingAnything()) { IGameObject gameObject = (!GameUtils.IsInstalled(ProductVersion.EP11) || GameUtils.GetCurrentWorld() != WorldName.FutureWorld) ? GlobalFunctions.CreateObjectOutOfWorld(RandomUtil.CoinFlip() ? "CarUsed2" : "CarSedan", ProductVersion.BaseGame, null, null) : GlobalFunctions.CreateObjectOutOfWorld(RandomUtil.CoinFlip() ? "HoverCarUsed" : "HoverCarExpensive", ProductVersion.EP11, null, null); CarOwnable carOwnable = gameObject as CarOwnable; if (carOwnable != null) { Lot lotHome = ths.LotHome; Household household = ths.Household; if (lotHome != null && household != null && !household.IsServiceNpcHousehold) { int cost = carOwnable.Cost; if (ths.FamilyFunds >= cost) { ths.ModifyFunds(-cost); } else { household.UnpaidBills += cost; } } carOwnable.GeneratedOwnableForNpc = (lotHome == null); carOwnable.DestroyOnRelease = (lotHome == null); carOwnable.LotHome = lotHome; vehicle = carOwnable; } else if (gameObject != null) { gameObject.Destroy(); vehicle = null; } } else { try { if (CarNpcManager.Singleton == null) { throw new NullReferenceException("CarNpcManager.Singleton == null"); } vehicle = CarNpcManager.Singleton.CreateNpcCar(CarNpcManager.NpcCars.Taxi); } catch (ResetException) { throw; } catch (Exception) { } } } else { if (ths.IsHoldingAnything()) { return(null); } vehicle = Vehicle_CreateTaxiBicycle(ths.SimDescription.Child); } } if (vehicle == null || vehicle.HasBeenDestroyed) { if (child && !ths.IsHoldingAnything() && ths.SimDescription != null) { vehicle = Vehicle_CreateTaxiBicycle(ths.SimDescription.Child); } else if (CarNpcManager.Singleton != null) { vehicle = CarNpcManager.Singleton.CreateNpcCar(CarNpcManager.NpcCars.Taxi); } } return(vehicle); }
public override string GetInteractionName(Sim actor, Terrain target, InteractionObjectPair iop) { return(base.GetInteractionName(actor, target, new InteractionObjectPair(sOldSingleton, target))); }
public PluginAsset() { ObjectPtr = Sim.WrapObject(InternalUnsafeMethods.PluginAssetCreateInstance()); }
public TrackedLot(Lot targetLot, Sim owner) : base(targetLot, owner) { }
public override bool CanShareBed(Sim s, BedData entryPart, CommodityKind use, out Sim incompatibleSim) { return(BedController.CanShareBed(this, s, use, out incompatibleSim)); }
public GuiPopUpMenuCtrl() { ObjectPtr = Sim.WrapObject(InternalUnsafeMethods.GuiPopUpMenuCtrlCreateInstance()); }
public RibbonNode(string pName, string pParent, bool pRegister = false) : this(pName, pRegister) { CopyFrom(Sim.FindObject <SimObject>(pParent)); }
public GuiInspectorTypeColor() { ObjectPtr = Sim.WrapObject(InternalUnsafeMethods.GuiInspectorTypeColorCreateInstance()); }
public bool Allow(IScoringGenerator stats, Sim sim, AllowCheck check) { return(PrivateAllow(stats, sim, check)); }
public DInputDevice() { ObjectPtr = Sim.WrapObject(InternalUnsafeMethods.DInputDeviceCreateInstance()); }
public FileObject() { ObjectPtr = Sim.WrapObject(InternalUnsafeMethods.FileObjectCreateInstance()); }
public ScriptMsgListener(string pName, string pParent, bool pRegister = false) : this(pName, pRegister) { CopyFrom(Sim.FindObject <SimObject>(pParent)); }
public override bool Run() { try { if (IntroTutorial.IsRunning && !IntroTutorial.AreYouExitingTutorial()) { return(false); } if (GameStates.IsCurrentlySwitchingSubStates) { return(false); } if (Responder.Instance.OptionsModel.SaveGameInProgress) { return(false); } ResortStaffedObjectComponent resortStaffedObjectComponent = Target.ResortStaffedObjectComponent; if (Target.ResortStaffedObjectComponent == null) { return(false); } ResortWorker service = resortStaffedObjectComponent.GetService(); SimDescription assignedWorker = service.GetAssignedWorker(Target); if (assignedWorker == null) { Sim worker = service.GetWorker(Target); if (worker != null) { assignedWorker = worker.SimDescription; } } if (assignedWorker == null) { return(false); } mTookSemaphore = GameStates.WaitForInteractionStateChangeSemaphore(); if (!mTookSemaphore) { return(false); } ResortExpenseDialog.SwitchToCAS(); try { new Sims.Stylist(Sims.CASBase.EditType.Uniform).Perform(new GameHitParameters <SimDescriptionObject>(Sim.ActiveActor, new SimDescriptionObject(assignedWorker), GameObjectHit.NoHit)); while (GameStates.NextInWorldStateId != InWorldState.SubState.LiveMode) { SpeedTrap.Sleep(0); } if (!CASChangeReporter.Instance.CasCancelled) { service = assignedWorker.Service as ResortWorker; if (service != null) { service.SetIsUsingCustomUniform(assignedWorker.SimDescriptionId); } else { ResortMaintenance maintenance = assignedWorker.Service as ResortMaintenance; if (maintenance != null) { maintenance.SetWorkerOutfit(assignedWorker, Target.LotCurrent.LotId, assignedWorker.GetOutfit(OutfitCategories.Career, 0)); } } } CASChangeReporter.Instance.ClearChanges(); } finally { ResortExpenseDialog.SwitchFromCAS(); } return(true); } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(Actor, Target, e); } return(false); }
public bool Allow(IScoringGenerator stats, Sim sim) { return(PrivateAllow(stats, sim)); }
public override bool Test(Sim a, BassGuitar target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { return(true); }
protected virtual void OnRouteSucceeded(Sim actor, float x) { OnRouteSucceeded(); }
public void GiveWheel(Wheel myWheel) { Sim.DLL_GiveWheelToCar(this.nativeCarObject, myWheel.nativeWheelObject); }
private List <CodeCheckResult> ExcuteCodeCheck(List <string> Files, double MinRange, ref double MaxScore, ref int MaxIndex1, ref int MaxIndex2) { List <CodeCheckResult> OutputExcel = new List <CodeCheckResult>(); TOKEN GenerateToken = new TOKEN(); Sim CalculateSimScore = new Sim(); DFA CalculateDFAScore = new DFA(); Winnowing CalculateWinScore = new Winnowing(); WinText GenerateWinText = new WinText(); BeginProgress(); int total = ((Files.Count() - 1) * Files.Count()) / 2; int Counter = 0, Bar = 0; List <string> WinFiles = new List <string>(); List <List <VN> > VNFiles = new List <List <VN> >(); List <List <string> > SimFiles = new List <List <string> >(); for (int i = 0; i < Files.Count(); ++i) { List <VN> MF = new List <VN>(); CalculateDFAScore.Get_VN(Files[i], MF); VNFiles.Add(MF); List <string> SF = GenerateToken.Read_file(Files[i]); SimFiles.Add(SF); WinFiles.Add(GenerateWinText.FileFilter(Files[i])); } for (int i = 0; i < Files.Count(); ++i) { for (int j = i + 1; j < Files.Count(); ++j) { double SimScore = CalculateSimScore.Sim_Run(SimFiles[i], SimFiles[j]); double DFAScore = CalculateDFAScore.GetVarSim(VNFiles[i], VNFiles[j]); double WinScore = CalculateWinScore.TextSimilarity(WinFiles[i], WinFiles[j]); double TotalScore = DFAScore * 0.3 + SimScore * 0.5 + WinScore * 0.2; //double TotalScore = SimScore * 1.0; if (TotalScore > MaxScore) { MaxIndex1 = i; MaxIndex2 = j; MaxScore = TotalScore; } // System.Diagnostics.Debug.WriteLine(TotalScore.ToString()); Bar = (Counter) * 100 / total; Counter++; SetProgress(Bar); System.Threading.Thread.Sleep(10); //System.Diagnostics.Debug.WriteLine(Bar.ToString()); if (TotalScore < MinRange) { continue; } OutputExcel.Add( new CodeCheckResult(Files[i].Substring(Files[i].LastIndexOf('\\') + 1) , Files[j].Substring(Files[j].LastIndexOf('\\') + 1) , TotalScore.ToString() + "%")); } } FinishProgress(); return(OutputExcel); }
public override void Grant(Sim actor, object target) { actor.InteractionQueue.CancelAllInteractions(); SimArrestSituationEx.Create(actor); }
public override string GetInteractionName(Sim actor, BassGuitar target, InteractionObjectPair iop) { return(base.GetInteractionName(actor, target, new InteractionObjectPair(BassGuitar.PlayForTips.Singleton, target))); }
public bool HasSim(Sim sim) { return(mSimsV2.ContainsKey(sim.SimDescription.SimDescriptionId)); }
public void CreateDataCase07() { CreateBaseData(); Organization.StartDate = CurrentDateTimeForStart.Item1; // '実行日と同日 Organization.EndDate = null; // 不在 SimGroup1.IsolatedNw1IpRange = "192.168.1.128/32"; // '有効ホストIP数=1個 サブネット=32bit var simGroup2 = new SimGroup() { Organization = Organization, Name = "SimGroup2", Apn = "apn.example.com", NasIp = "192.168.0.2", IsolatedNw1IpPool = "ip_pool_2", IsolatedNw1IpRange = "192.168.1.255/30", // '有効ホストIP数=2個 サブネット=30bit)※NIP最大(要補正)アドレス AuthenticationServerIp = "172.16.0.1", PrimaryDns = "192.168.0.2", SecondaryDns = "192.168.0.3", UserNameSuffix = "jincreek2" }; var simGroup3 = new SimGroup() { Organization = Organization, Name = "SimGroup3", Apn = "apn.example.com", NasIp = "192.168.0.2", IsolatedNw1IpPool = "ip_pool_3", IsolatedNw1IpRange = "192.168.1.64/31", // '有効ホストIP数=0個(サブネット = 31bit) AuthenticationServerIp = "172.16.0.1", PrimaryDns = "192.168.0.2", SecondaryDns = "192.168.0.3", UserNameSuffix = "jincreek3" }; MainDbContext.Sim.Add(new Sim() // sim_1 { Msisdn = "111111112", Imsi = "11111111112", IccId = "1111111112", UserName = "******", Password = "******", SimGroup = SimGroup1 }); var sim2 = new Sim() // sim_2 { Msisdn = "111111113", Imsi = "11111111113", IccId = "1111111113", UserName = "******", Password = "******", SimGroup = simGroup2 }; RadiusDbContext.Radcheck.Add(new Radcheck() // SimいるのRadcheckとRadusergroup { Username = sim2.UserName + "@" + sim2.SimGroup.UserNameSuffix, Attribute = "Cleartext-Password", Op = ":=", Value = sim2.Password }); RadiusDbContext.Radcheck.Add(new Radcheck() { Username = sim2.UserName + "@" + sim2.SimGroup.UserNameSuffix, Attribute = "Calling-Station-Id", Op = "==", Value = Sim1.Msisdn }); RadiusDbContext.Radusergroup.Add(new Radusergroup() { Username = sim2.UserName + "@" + sim2.SimGroup.UserNameSuffix, Groupname = sim2.SimGroup.Id.ToString(), }); RadiusDbContext.Radippool.Add(new Radippool() { Framedipaddress = "192.168.1.100", //'simGroup3のCIDR別有効ホストIP範囲に含まれない Nasipaddress = "", Calledstationid = "", Callingstationid = "", Username = "", Poolkey = "", PoolName = simGroup3.IsolatedNw1IpPool }); SetDataForNotSimGroup(); MainDbContext.SaveChanges(); RadiusDbContext.SaveChanges(); }
public GuiMenuBar() { ObjectPtr = Sim.WrapObject(InternalUnsafeMethods.GuiMenuBarCreateInstance()); }
public SimPersistSet(string pName, string pParent, bool pRegister = false) : this(pName, pRegister) { CopyFrom(Sim.FindObject <SimObject>(pParent)); }
public DeleteMineTests(CustomWebApplicationFactoryWithMariaDb <Admin.Startup> factory) { _client = factory.CreateClient(); _context = factory.Services.GetService <IServiceScopeFactory>().CreateScope().ServiceProvider.GetService <MainDbContext>(); Utils.RemoveAllEntities(_context); _context.Add(_org1 = Utils.CreateOrganization(code: 1, name: "org1")); _context.Add(_org2 = Utils.CreateOrganization(code: 2, name: "org2")); _context.Add(_domain1 = new Domain { Id = Guid.NewGuid(), Name = "domain01", Organization = _org1 }); _context.Add(_user1 = new SuperAdmin { AccountName = "user0", Name = "user0", Password = Utils.HashPassword("user0") }); // スーパー管理者 _context.Add(_user2 = new UserAdmin { AccountName = "user1", Name = "user1", Password = Utils.HashPassword("user1"), Domain = _domain1 }); // ユーザー管理者 _context.Add(_simGroup1 = new SimGroup() { Id = Guid.NewGuid(), Name = "simGroup1", Organization = _org1, Apn = "apn", AuthenticationServerIp = "AuthenticationServerIp", IsolatedNw1IpPool = "IsolatedNw1IpPool", IsolatedNw1SecondaryDns = "IsolatedNw1SecondaryDns", IsolatedNw1IpRange = "IsolatedNw1IpRange", IsolatedNw1PrimaryDns = "IsolatedNw1PrimaryDns", NasIp = "NasIp", PrimaryDns = "PrimaryDns", SecondaryDns = "SecondaryDns", UserNameSuffix = "UserNameSuffix", }); _context.Add(_simGroup2 = new SimGroup() { Id = Guid.NewGuid(), Name = "simGroup2", Organization = _org2, Apn = "apn", AuthenticationServerIp = "AuthenticationServerIp", IsolatedNw1IpPool = "IsolatedNw1IpPool", IsolatedNw1SecondaryDns = "IsolatedNw1SecondaryDns", IsolatedNw1IpRange = "IsolatedNw1IpRange", IsolatedNw1PrimaryDns = "IsolatedNw1PrimaryDns", NasIp = "NasIp", PrimaryDns = "PrimaryDns", SecondaryDns = "SecondaryDns", UserNameSuffix = "UserNameSuffix", }); _context.Add(_sim = new Sim() { SimGroup = _simGroup1, Msisdn = "1001", Imsi = "1001", IccId = "1001", UserName = "******", Password = "******" }); _context.Add(_sim2 = new Sim() { SimGroup = _simGroup2, Msisdn = "1002", Imsi = "1002", IccId = "1002", UserName = "******", Password = "******" }); _context.Add(_device1 = new Device() { Domain = _domain1, Name = "device01", UseTpm = true, ManagedNumber = "001", WindowsSignInListCacheDays = 1, ProductName = "", SerialNumber = "" }); _context.SaveChanges(); }
public ForestEditorCtrl(string pName, string pParent, bool pRegister = false) : this(pName, pRegister) { CopyFrom(Sim.FindObject <SimObject>(pParent)); }
public override InteractionDefinition ProxyClone(Sim target) { return(new ProxyDefinition(new TryForBabyDefinition(target))); }
public UpdateMineTests(CustomWebApplicationFactory <JinCreek.Server.Admin.Startup> factory) { _client = factory.CreateClient(); _context = factory.Services.GetService <IServiceScopeFactory>().CreateScope().ServiceProvider.GetService <MainDbContext>(); Utils.RemoveAllEntities(_context); _context.Add(_org1 = Utils.CreateOrganization(code: 1, name: "org1")); _context.Add(_org2 = Utils.CreateOrganization(code: 2, name: "org2")); _context.Add(_domain1 = new Domain { Id = Guid.NewGuid(), Name = "domain01", Organization = _org1 }); _context.Add(_domain2 = new Domain { Id = Guid.NewGuid(), Name = "domain02", Organization = _org2 }); _context.Add(_userGroup1 = new UserGroup { Id = Guid.NewGuid(), Name = "userGroup1", Domain = _domain1 }); _context.Add(_userGroup2 = new UserGroup { Id = Guid.NewGuid(), Name = "userGroup2", Domain = _domain2 }); _context.Add(_user1 = new SuperAdmin { AccountName = "user0", Password = Utils.HashPassword("user0") }); // スーパー管理者 _context.Add(_user2 = new UserAdmin() { AccountName = "user1", Password = Utils.HashPassword("user1"), Domain = _domain1 }); // ユーザー管理者 _context.Add(_user3 = new GeneralUser() { AccountName = "user2", DomainId = _domain1.Id }); _context.Add(_availablePeriod = new AvailablePeriod() { EndUser = _user2, EndDate = DateTime.Parse("2021-03-01"), StartDate = DateTime.Parse("2020-02-10") }); _context.Add(_availablePeriod = new AvailablePeriod() { EndUser = _user3, EndDate = DateTime.Parse("2021-03-01"), StartDate = DateTime.Parse("2020-02-10") }); _context.Add(_user4 = new GeneralUser() { AccountName = "user4", DomainId = _domain2.Id }); _context.Add(_simGroup1 = new SimGroup() { Id = Guid.NewGuid(), Name = "simGroup1", Organization = _org1, Apn = "apn", AuthenticationServerIp = "AuthenticationServerIp", IsolatedNw1IpPool = "IsolatedNw1IpPool", IsolatedNw1SecondaryDns = "IsolatedNw1SecondaryDns", IsolatedNw1IpRange = "IsolatedNw1IpRange", IsolatedNw1PrimaryDns = "IsolatedNw1PrimaryDns", NasIp = "NasIp", PrimaryDns = "PrimaryDns", SecondaryDns = "SecondaryDns" }); _context.Add(_simGroup2 = new SimGroup { Id = Guid.NewGuid(), Name = "simGroup2", Organization = _org2, IsolatedNw1IpPool = "" }); _context.Add(_sim1 = new Sim() // 組織 : '自組織 { Msisdn = "msisdn01", Imsi = "imsi01", IccId = "iccid01", UserName = "******", Password = "******", SimGroup = _simGroup1 }); _context.Add(_device1 = new Device() { LteModule = null, Domain = _domain1, Name = "device01", UseTpm = true, ManagedNumber = "001", WindowsSignInListCacheDays = 1, }); _context.Add(_simDevice1 = new SimAndDevice() { Sim = _sim1, Device = _device1, IsolatedNw2Ip = "127.0.0.1/18", AuthenticationDuration = 1, StartDate = DateTime.Parse("2020-02-01"), EndDate = DateTime.Parse("2021-02-01") }); _context.Add(_multiFactor1 = new MultiFactor { SimAndDeviceId = _simDevice1.Id, EndUserId = _user3.Id, ClosedNwIp = "127.0.0.1", StartDate = DateTime.Now, EndDate = DateTime.Now }); _context.Add(_multiFactor2 = new MultiFactor // 他組織 { SimAndDeviceId = _simDevice1.Id, EndUserId = _user4.Id, ClosedNwIp = "127.0.0.1", StartDate = DateTime.Now, EndDate = DateTime.Now }); _context.SaveChanges(); }