public DelegateImpl(object key, Type type, ICRegILGen nestedRegistration) { _key = key; _type = type; _nestedRegistration = nestedRegistration; _myNeed = new Need {Kind = NeedKind.Constant, ClrType = _type}; }
public void Display(Need need) { this.need = need; Label.text = need.Name; DurationSlider.value = need.PercentDuration(); }
public Need(Need need) { Name = need.Name; Value = need.Value; IncreaseValue = need.IncreaseValue; Importance = need.Importance; Role = need.Role; }
/// <summary> /// Creates a new Dance process /// </summary> /// <param name="boid">The boid this process will control</param> /// <param name="toSatisfy">The need this process will satisfy</param> public DanceProcess(Boid boid, Need toSatisfy) { owner = boid; ownerDesire = toSatisfy; ProcessList.Add(navigateToStage); ProcessList.Add(continueWalkToStage); ProcessList.Add(reachStage); }
/// <summary> /// Creates new Bar Process /// </summary> /// <param name="boid">The boid this process will control</param> /// <param name="toSatisfy">The need this process will satisfy</param> public BarProcess(Boid boid, Need toSatisfy) { owner = boid; ownerDesire = toSatisfy; ProcessList.Add(navigateToBar); ProcessList.Add(continueWalkToBar); ProcessList.Add(reachBar); ProcessList.Add(drink); }
void CreateNeeds() { for (int i = 0; i< Needs.Length; i++) { Needs[i] = new Need(); Needs[i].Name = Get.NeedName [i]; Needs [i].Name = Get.NeedName [i]; } }
/// <summary> /// Creates a new Toilet process /// </summary> /// <param name="boid">The boid this process will control</param> /// <param name="toSatisfy">The need this process will satisfy</param> public ToiletProcess(Boid boid, Need toSatisfy) { owner = boid; ownerDesire = toSatisfy; ProcessList.Add(navigateToToilet); ProcessList.Add(continueWalkToToilet); ProcessList.Add(reachToilet); ProcessList.Add(pee); }
public void SufferFromNeed(Need playerNeed) { if (GameManager.Instance.hardMode) { GameManager.Instance.SetGameOverMessage(playerNeed.gameOverMessage); GameManager.Instance.gameState = GameState.GameOver; //GameManager.Instance.GameEnd(); return; } NeedType needType = playerNeed.Type; switch (needType) { case NeedType.Energy: playerNeed.Points = 10; gameManager.Time = 8; gameManager.DaysToDeadLine--; gameManager.LoadNextDay(); break; case NeedType.Hunger: break; case NeedType.Fun: break; case NeedType.Hygiene: break; case NeedType.Mentality: break; default: break; } }
private bool TrySpawnPawn(out Pawn pawn, float limitPoint) { if (!canSpawnPawns) { pawn = null; return(false); } float curPoints = SpawnedPawnsPoints; IEnumerable <PawnKindDef> source = from x in RatkinTunnelUtility.spawnableElitePawnKinds where curPoints + x.combatPower <= limitPoint select x; PawnKindDef kindDef; if (!source.TryRandomElement(out kindDef)) { pawn = null; return(false); } pawn = PawnGenerator.GeneratePawn(kindDef, Faction); spawnedPawns.Add(pawn); GenSpawn.Spawn(pawn, CellFinder.RandomClosewalkCellNear(Position, Map, 2, null), Map, WipeMode.Vanish); Lord lord = Lord; if (lord == null) { lord = CreateNewLord(); } lord.AddPawn(pawn); SoundDefOf.DropPod_Open.PlayOneShot(this); Need rest = pawn.needs.TryGetNeed(NeedDefOf.Rest); rest.CurLevel = rest.MaxLevel; Need food = pawn.needs.TryGetNeed(NeedDefOf.Food); food.CurLevel = food.MaxLevel; return(true); }
public IActionResult UpdateNeeds(Need n) { int sortno = n.SortNo; int need = 0; int max = 0; string find = String.Format(@"select r.""CountProducts"",r.""CountProducts""-r.""CurrentProductsCount"" from ""Rack"" r,""Staff"" s, ""Bakery"" b where r.""SortRack"" = {0} and r.""RackBakeryNo""=b.""BakeryNo"" and s.""StaffBakeryNo""=b.""BakeryNo"" and s.""StaffNo""= {1}", sortno, BakerNo); NpgsqlCommand command = new NpgsqlCommand(find); command.Connection = conn2; conn2.Open(); OpenConnection = true; NpgsqlDataReader dataReader_0; dataReader_0 = command.ExecuteReader(); while(dataReader_0.Read()) { max = Convert.ToInt32(dataReader_0[0]); need= Convert.ToInt32(dataReader_0[1]); } conn2.Close(); OpenConnection = false; string update = String.Format(@"update ""Rack"" set ""CurrentProductsCount""=""CurrentProductsCount""+{0} where ""RackBakeryNo""={1} and ""SortRack""={2}", need,BakerNo,n.SortNo); NpgsqlCommand command2 = new NpgsqlCommand(update); command2.Connection = conn2; conn2.Open(); OpenConnection = true; NpgsqlDataReader dataReader_2; dataReader_2 = command2.ExecuteReader(); dataReader_2.Read(); conn2.Close(); OpenConnection =false; return RedirectToAction("AddProducts"); }
// Something like: <highTemperature, Taste> -> true // <cryThreeTimesInRow, Hunger> -> true // etc. // - matches Rules, needs and true/false // - - list of needs //public List<Need> needs; // - - list of // This should be a list of Needs (Attempt Satisfy Needs) public void AttemptSatisfy(Need need, float increaseRate, string ruleName) { //get component by name (ruleName) //Rule rule = this.FindObjectsOfType<typeof(Rule)>().ToList().Find( x=>x.name == ruleName + " Rule"); Rule rule = rules.Find(x => x.ruleName == ruleName); //Rule rule = rules[0]; //Rule rule = GameObject.Find(ruleName + " Rule").GetComponent<Rule>(); //Rule rule = GameObject.Find( x => x.name == (ruleName + " Rule")); //Rule rule = this.FindObjectsOfType<typeof(Rule)>() if (rule.isSatisfied(need)) { need.Satisfy(increaseRate); } // if (satisfactionRules.AttemptSatisfy(asphyx, "Breathe")){ // maybe later get name from function name // //asphyx.Satisfy(breathingRate); //} }
//add public void Add(Need need) { using (var conn = Connection) { conn.Open(); using (var cmd = conn.CreateCommand()) { cmd.CommandText = @" INSERT INTO Need (NonProfitId, Item, Quantity, Description, Location) OUTPUT INSERTED.ID VALUES (@NonProfitId, @item, @Quantity, @Description, @Location)"; DbUtils.AddParameter(cmd, "@NonProfitId", need.NonProfitId); DbUtils.AddParameter(cmd, "@Item", need.Item); DbUtils.AddParameter(cmd, "@Quantity", need.Quantity); DbUtils.AddParameter(cmd, "@Description", need.Description); DbUtils.AddParameter(cmd, "@Location", need.Location); need.Id = (int)cmd.ExecuteScalar(); } } }
public static bool TreatNeedCondition(this Pawn p, List <NeedCondition> needs, Hediff h, bool debug = false) { string debugStr = debug ? $"{p.LabelShort} TreatNeedCondition - " : ""; foreach (NeedCondition NC in needs) { Tools.Warn(debugStr + $"checking {NC.needDef.defName} => {NC.level.min} > x > {NC.level.max}", debug); Need need = p.needs.AllNeeds.Where( n => n.def == NC.needDef && !NC.level.Includes(n.CurLevelPercentage) ).FirstOrFallback(); if (need == null) { continue; } Tools.Warn(debugStr + $"Found {need.def.defName} out of range: {need.CurLevelPercentage}", debug); return(RemoveHediffAndReturnTrue(p, h, debug)); } return(false); }
public void Report(string username, Need failureCase, bool lost = true) { var newPlayer = !(data.winners.Contains(username) || data.losers.Contains(username)); //var lost = failureCase == null; if (lost) { if (newPlayer) { data.losers.Add(username); } data.headline = $"{username} {failureCase.causeOfDeath} innocent plant"; } else { if (newPlayer) { data.winners.Add(username); } data.headline = $"{username} takes care of plant"; } Draw(); }
private InvalidNeedException(SerializationInfo info, StreamingContext context) : base(info, context) { this.need = (Need)info.GetValue(nameof(this.need), typeof(Need)); this.have = (Need)info.GetValue(nameof(this.have), typeof(Need)); }
void Init(Need Need) { this.Need = Need; }
void CreateNeeds() { for (int i = 0; i< Needs.Length; i++) { Needs[i] = new Need(); Needs[i].Name = Get.NeedName [i]; Needs [i].Name = Get.NeedName [i]; } EatTimer = Random.Range(120, 240); BathTimer = Random.Range(120, 240); DrunkTimer = Random.Range(210, 240); SmokeTimer = Random.Range(120, 240); }
private bool isNearSource(Need need) { return(isSourceNear.Contains(need)); }
// Use this for initialization void Start() { friendship = new Need ("friendship", friendship.currentVal, friendship.changeRate); enmity = new Need ("enmity", enmity.currentVal, enmity.changeRate); competition = new Need ("competition", competition.currentVal, competition.changeRate); lust = new Need ("lust", lust.currentVal, lust.changeRate); greed = new Need ("greed", greed.currentVal, greed.changeRate); mentorship = new Need ("mentorship", mentorship.currentVal, mentorship.changeRate); #region Initializing Needs Dicitonary needs.Add ("friendship", friendship); needs.Add ("enmity", enmity); needs.Add ("competition", competition); needs.Add ("lust", lust); needs.Add ("greed", greed); needs.Add ("mentorship", mentorship); #endregion boredomToInterest = new Affect ("boredomToInterest", boredomToInterest.currentVal); sadToJoy = new Affect ("sadToJoy", sadToJoy.currentVal); supriseToCalm = new Affect ("supriseToCalm", supriseToCalm.currentVal); distressToAmused = new Affect ("distressToAmused", distressToAmused.currentVal); angerToCheers = new Affect ("angerToCheers", angerToCheers.currentVal); disgustToLove = new Affect ("disgustToLove", disgustToLove.currentVal); shameToPride = new Affect ("shameToPride", shameToPride.currentVal); fearToHope = new Affect ("fearToHope", fearToHope.currentVal); #region Initializing Affects Dictionary affects.Add ("boredomToInterest", boredomToInterest); affects.Add ("sadToJoy", sadToJoy); affects.Add ("supriseToCalm", supriseToCalm); affects.Add ("distressToAmused", distressToAmused); affects.Add ("angerToCheers", angerToCheers); affects.Add ("disgustToLove", disgustToLove); affects.Add ("shameToPride", shameToPride); affects.Add ("fearToHope", fearToHope); #endregion; }
public override Task <WaterfallDialog> GetWaterfallDialog(ITurnContext turnContext, CancellationToken cancellation) { return(Task.Run(() => { return new WaterfallDialog(Name, new WaterfallStep[] { async(dialogContext, cancellationToken) => { // Get the categories. var schema = Helpers.GetSchema(); List <string> categories = schema.Categories.Select(c => c.Name).ToList(); if (categories.Count == 1) { // No need to ask for a single category. var userContext = await this.state.GetUserContext(dialogContext.Context, cancellationToken); userContext.Category = schema.Categories.First().Name; // Skip this step. return await dialogContext.NextAsync(null, cancellationToken); } var choices = new List <Choice>(); categories.ForEach(c => choices.Add(new Choice { Value = c })); choices.Add(new Choice { Value = Phrases.None }); return await dialogContext.PromptAsync( Prompt.CategoryPrompt, new PromptOptions() { Prompt = Phrases.Provide.GetCategory, Choices = choices }, cancellationToken); }, async(dialogContext, cancellationToken) => { var schema = Helpers.GetSchema(); var userContext = await this.state.GetUserContext(dialogContext.Context, cancellationToken); if (dialogContext.Result is FoundChoice) { // Choice was validated in case the schema changed. var selectedCategory = ((FoundChoice)dialogContext.Result).Value; if (selectedCategory == Phrases.None) { return await dialogContext.EndDialogAsync(null, cancellationToken); } // Store the category in the user context. userContext.Category = selectedCategory; } // Get the resources in the category. var category = schema.Categories.FirstOrDefault(c => c.Name == userContext.Category); List <string> resources = category.Resources.Select(r => r.Name).ToList(); var choices = new List <Choice>(); resources.ForEach(r => choices.Add(new Choice { Value = r })); choices.Add(new Choice { Value = Phrases.None }); return await dialogContext.PromptAsync( Prompt.ResourcePrompt, new PromptOptions() { Prompt = Phrases.Request.Resources(userContext.Category), Choices = choices, Validations = new ResourcePromptValidations { Category = userContext.Category } }, cancellationToken); }, async(dialogContext, cancellationToken) => { // Choice was validated in case the schema changed. var selectedResource = ((FoundChoice)dialogContext.Result).Value; if (selectedResource == Phrases.None) { return await dialogContext.EndDialogAsync(null, cancellationToken); } var userContext = await this.state.GetUserContext(dialogContext.Context, cancellationToken); userContext.Resource = selectedResource; // Ask how many they need. return await dialogContext.PromptAsync( Prompt.IntPrompt, new PromptOptions { Prompt = Phrases.Request.GetQuantity(selectedResource) }, cancellationToken); }, async(dialogContext, cancellationToken) => { var userContext = await this.state.GetUserContext(dialogContext.Context, cancellationToken); userContext.NeedQuantity = (int)dialogContext.Result; if (userContext.NeedQuantity == 0) { // Delete the need if it has already been added. var user = await api.GetUser(dialogContext.Context); var need = await this.api.GetNeedForUser(user, userContext.Category, userContext.Resource); if (need != null) { await this.api.Delete(need); await Messages.SendAsync(Phrases.Request.CompleteDelete, dialogContext.Context, cancellationToken); } else { await Messages.SendAsync(Phrases.Request.CompleteUpdate, dialogContext.Context, cancellationToken); } return await dialogContext.EndDialogAsync(null, cancellationToken); } // Ask whether or not they are willing to take opened items. return await dialogContext.PromptAsync( Prompt.ConfirmPrompt, new PromptOptions { Prompt = Phrases.Request.GetOpenedOkay }, cancellationToken); }, async(dialogContext, cancellationToken) => { var userContext = await this.state.GetUserContext(dialogContext.Context, cancellationToken); userContext.NeedUnopenedOnly = !(bool)dialogContext.Result; // Ask for any instructions. return await dialogContext.PromptAsync( Prompt.TextPrompt, new PromptOptions { Prompt = Phrases.Request.Instructions }, cancellationToken); }, async(dialogContext, cancellationToken) => { var schema = Helpers.GetSchema(); var userContext = await this.state.GetUserContext(dialogContext.Context, cancellationToken); // Check if they have already added this resource. var user = await api.GetUser(dialogContext.Context); var need = await this.api.GetNeedForUser(user, userContext.Category, userContext.Resource); // Create or update the need. if (need == null) { need = new Need(); need.CreatedById = user.Id; need.Category = userContext.Category; need.Name = userContext.Resource; need.Quantity = userContext.NeedQuantity; need.UnopenedOnly = userContext.NeedUnopenedOnly; need.Instructions = (string)dialogContext.Result; await this.api.Create(need); } else { need.CreatedOn = DateTime.UtcNow; need.Quantity = userContext.NeedQuantity; need.UnopenedOnly = userContext.NeedUnopenedOnly; need.Instructions = (string)dialogContext.Result; await this.api.Update(need); } // The API input requires meters. // Default is 50, but we could make this configurable in the future. double requestMeters = Units.Miles.ToMeters(50); // Get all users within the distance from the user. var usersWithinDistance = await this.api.GetUsersWithinDistance(user.LocationCoordinates, requestMeters); if (usersWithinDistance.Count > 0) { var organization = schema.VerifiedOrganizations.FirstOrDefault(o => o.PhoneNumbers.Contains(user.PhoneNumber)); var message = Phrases.Match.GetMessage(organization.Name, need.Name, need.Quantity, need.Instructions); var queueHelper = new OutgoingMessageQueueHelpers(this.configuration.AzureWebJobsStorage()); // Cache any translations to limit API calls. var translationCache = new Dictionary <string, string>(); // Get any matching resources for the users. foreach (var userWithinDistance in usersWithinDistance) { var resource = await this.api.GetResourceForUser(userWithinDistance, need.Category, need.Name); if (!Helpers.DoesResourceMatchNeed(need, resource)) { continue; } // Check if the user's language is already cached. if (translationCache.TryGetValue(user.Language, out var translation)) { message = translation; } else { // Translate the message if necessary. if (translator.IsConfigured && user.Language != Translator.DefaultLanguage) { message = await translator.TranslateAsync(message, user.Language); } // Cache the message translationCache.Add(user.Language, message); } var data = new OutgoingMessageQueueData { PhoneNumber = userWithinDistance.PhoneNumber, Message = message }; await queueHelper.Enqueue(data); } } await Messages.SendAsync(Phrases.Request.CompleteCreate(user), turnContext, cancellationToken); return await dialogContext.EndDialogAsync(null, cancellationToken); } }); }));
public static Need FromWebNeed(WebNeed s) { Need respVal = new Need { UshahidiId = s.UshahidiId, Timestamp = s.Timestamp, StatusId = (int)PostStatus.Published, //always PublishAnonymously = s.PublishAnonymously, ContactName = s.ContactName, //NN JobTitle = s.JobTitle, Email = Settings.DefaultEmail, //Email = s.Email,//no point - empty //TODO:ensure volunteers do this //PhoneNumber = s.PhoneNumber,//no point - empty //TODO:ensure volunteers do this OrganisationName = s.OrganisationName, Department = s.Department, OrgTypeId = s.OrgTypeId, OrgTypeOther = s.OrgTypeOther, TownOrCity = s.TownOrCity, TweetId = s.TweetId, Postcode = s.Postcode, //NN TellUsMore = s.TellUsMore, Latitude = s.Latitude, Longitude = s.Longitude, }; if (respVal.ContactName != null && respVal.ContactName.Length > 100) { Debugger.Break(); } if (respVal.Department != null && respVal.Department.Length > 200) { Debugger.Break(); } if (respVal.Email != null && respVal.Email.Length > 320) { Debugger.Break(); } if (respVal.JobTitle != null && respVal.JobTitle.Length > 100) { Debugger.Break(); } if (respVal.OrgTypeOther != null && respVal.OrgTypeOther.Length > 300) { Debugger.Break(); } if (respVal.OrganisationName != null && respVal.OrganisationName.Length > 200) { Debugger.Break(); } if (respVal.PhoneNumber != null && respVal.PhoneNumber.Length > 100) { Debugger.Break(); } if (respVal.Postcode != null && respVal.Postcode.Length > 8) { Debugger.Break(); } if (respVal.TownOrCity != null && respVal.TownOrCity.Length > 200) { Debugger.Break(); } respVal.NeedPpeTypes = s.NeedPpeTypes.SelectToList(ppe => FromWebNeedPpeType(ppe, respVal)); List <byte> t = s.NeedPpeTypes.GroupBy(g => g.PpeTypeId).Where(g => g.Count() > 1).SelectToList(g => g.Key); if (t.Count > 0) { Debug.WriteLine($"UshahidiId {s.UshahidiId} Need has duplicate PPE types {HtmlHelp.BuildString(t, ", ")}"); respVal = null; } //if(s.UshahidiId == 471) //{ // Debug.WriteLine($"UshahidiId {s.UshahidiId} has an awesome postcode {respVal.Postcode}"); // respVal = null; //} return(respVal); }
public Need CreateNeed(Need need) { _needs.InsertOne(need); return(need); }
public void UpdateNeed(string id, Need needIn) => _needs.FindOneAndReplace(need => need.Id == id, needIn);
public InvalidNeedException(IWait wait, Need need) : base($"invalid need: expected {need}, have {wait.Need}", wait) { this.need = need; this.have = wait.Need; }
public List <Car> FindCar(Need task, TravelClass travelClass) { List <Car> elegibleCars = cars.FindAll(element => Elegible(element, task, travelClass)); return(elegibleCars); }
public override void PostAbilityAttempt() { //base.PostAbilityAttempt(); ModOptions.SettingsRef settingsRef = new ModOptions.SettingsRef(); if (!this.Pawn.IsColonist && settingsRef.AIAggressiveCasting)// for AI { this.CooldownTicksLeft = Mathf.RoundToInt(this.MaxCastingTicks / 2f); } else { this.CooldownTicksLeft = Mathf.RoundToInt(this.MaxCastingTicks * this.MightUser.coolDown); } if (Rand.Chance(MightUser.arcalleumCooldown)) { this.CooldownTicksLeft = 4; } bool flag = this.mightDef != null; if (flag) { if (mightDef.consumeEnergy) { bool flag3 = this.MightUser.Stamina != null; if (flag3) { if (!this.Pawn.IsColonist && settingsRef.AIAggressiveCasting)// for AI { this.MightUser.Stamina.UseMightPower(this.MightUser.ActualStaminaCost(mightDef) / 2f); } else { this.MightUser.Stamina.UseMightPower(this.MightUser.ActualStaminaCost(mightDef)); } this.MightUser.MightUserXP += (int)((mightDef.staminaCost * 180) * this.MightUser.xpGain * settingsRef.xpMultiplier); } if (this.mightDef.chiCost != 0) { HealthUtility.AdjustSeverity(this.Pawn, TorannMagicDefOf.TM_ChiHD, -100 * this.ActualChiCost); this.MightUser.MightUserXP += (int)((mightDef.chiCost * 100) * this.MightUser.xpGain * settingsRef.xpMultiplier); } if (mightDef.requiredHediff != null) { if (this.Pawn.health != null && this.Pawn.health.hediffSet != null && this.Pawn.health.hediffSet.HasHediff(mightDef.requiredHediff)) { Hediff hd = this.Pawn.health.hediffSet.GetFirstHediffOfDef(mightDef.requiredHediff); hd.Severity -= this.ActualHediffCost; this.MightUser.MightUserXP += (int)((mightDef.hediffXPFactor * this.MightUser.xpGain * settingsRef.xpMultiplier) * mightDef.hediffCost); } else { Log.Warning("" + this.Pawn.LabelShort + " attempted to use an ability requiring the hediff " + mightDef.requiredHediff.label + " but does not have the hediff; should never happen since we required the hediff to use the ability."); } } if (mightDef.requiredNeed != null) { if (this.Pawn.needs != null && this.Pawn.needs.AllNeeds != null && this.Pawn.needs.TryGetNeed(this.mightDef.requiredNeed) != null) { Need nd = this.Pawn.needs.TryGetNeed(this.mightDef.requiredNeed); nd.CurLevel -= this.ActualNeedCost; this.MightUser.MightUserXP += (int)((mightDef.needXPFactor * this.MightUser.xpGain * settingsRef.xpMultiplier) * mightDef.needCost); } else { Log.Warning("" + this.Pawn.LabelShort + " attempted to use an ability requiring the need " + mightDef.requiredNeed.label + " but does not have the need; should never happen since we required the need to use the ability."); } } } } }
private void SetNewResourceUsed(Need need) { SetImageResourceUsed(need); SetResourceUsedAmontText(need); SetResourceUsedPerRoundText(need); }
private static void DoRow(Rect rect, Thing thing, CompVehicle vehicle, ref Pawn specificNeedsTabForPawn, bool doNeeds) { GUI.BeginGroup(rect); Rect rect2 = rect.AtZero(); Pawn pawn = thing as Pawn; //if (listingUsesAbandonSpecificCountButtons) //{ // if (thing.stackCount != 1) // { // CaravanPeopleAndItemsTabUtility.DoAbandonSpecificCountButton(rect2, thing, caravan); // } // rect2.width -= 24f; //} //CaravanPeopleAndItemsTabUtility.DoAbandonButton(rect2, thing, caravan); rect2.width -= 24f; Widgets.InfoCardButton(rect2.width - 24f, (rect.height - 24f) / 2f, thing); rect2.width -= 24f; if (pawn != null && !pawn.Dead) { CaravanPeopleAndItemsTabUtility.DoOpenSpecificTabButton(rect2, pawn, ref specificNeedsTabForPawn); rect2.width -= 24f; } if (pawn == null) { Rect rect3 = rect2; rect3.xMin = rect3.xMax - 60f; CaravanPeopleAndItemsTabUtility.TryDrawMass(thing, rect3); rect2.width -= 60f; } if (Mouse.IsOver(rect2)) { Widgets.DrawHighlight(rect2); } Rect rect4 = new Rect(4f, (rect.height - 27f) / 2f, 27f, 27f); Widgets.ThingIcon(rect4, thing, 1f); if (pawn != null) { Rect bgRect = new Rect(rect4.xMax + 4f, 16f, 100f, 18f); GenMapUI.DrawPawnLabel(pawn, bgRect, 1f, 100f, null, GameFont.Small, false, false); if (doNeeds) { GetNeedsToDisplay(pawn, tmpNeeds); float xMax = bgRect.xMax; for (int i = 0; i < tmpNeeds.Count; i++) { Need need = tmpNeeds[i]; int maxThresholdMarkers = 0; bool doTooltip = true; Rect rect5 = new Rect(xMax, 0f, 100f, 50f); #pragma warning disable IDE0019 // Use pattern matching Need_Mood mood = need as Need_Mood; #pragma warning restore IDE0019 // Use pattern matching if (mood != null) { maxThresholdMarkers = 1; doTooltip = false; //TooltipHandler.TipRegion(rect5, new TipSignal(() => CaravanPeopleAndItemsTabUtility.CustomMoodNeedTooltip(mood), rect5.GetHashCode())); } need.DrawOnGUI(rect5, maxThresholdMarkers, 10f, false, doTooltip); xMax = rect5.xMax; } } if (pawn.Downed) { GUI.color = new Color(1f, 0f, 0f, 0.5f); Widgets.DrawLineHorizontal(0f, rect.height / 2f, rect.width); GUI.color = Color.white; } } else { Rect rect6 = new Rect(rect4.xMax + 4f, 0f, 300f, 30f); Text.Anchor = TextAnchor.MiddleLeft; Text.WordWrap = false; Widgets.Label(rect6, thing.LabelCap); Text.Anchor = TextAnchor.UpperLeft; Text.WordWrap = true; } GUI.EndGroup(); }
public IActionResult Post(Need Need) { _needRepository.Add(Need); return(CreatedAtAction("Get", new { id = Need.Id }, Need)); }
public static void calculateAndApplySemen(Pawn pawn, Pawn partner, xxx.rjwSextype sextype) { if (!RJWSettings.cum_on_body) { return; } Pawn giver, receiver; //Rand.PopState(); //Rand.PushState(RJW_Multiplayer.PredictableSeed()); //dispenser of the seed if (Genital_Helper.has_penis(pawn) || xxx.is_mechanoid(pawn) || xxx.is_insect(pawn)) { giver = pawn; receiver = partner; } else if (partner != null && (Genital_Helper.has_penis(partner) || xxx.is_mechanoid(partner) || xxx.is_insect(partner))) { giver = partner; receiver = pawn; } else //female on female or genderless - no s***n dispensed; maybe add futa support? { return; } //slimes do not waste fluids? //if (xxx.is_slime(giver)) return; //determine entity: int entityType = SemenHelper.CUM_NORMAL; if (xxx.is_mechanoid(giver)) { entityType = SemenHelper.CUM_MECHA; } else if (xxx.is_insect(giver)) { entityType = SemenHelper.CUM_INSECT; } //get pawn genitalia: BodyPartRecord genitals; if (xxx.is_mechanoid(giver)) { genitals = giver.RaceProps.body.AllParts.Find(x => string.Equals(x.def.defName, "MechGenitals")); } else //insects, animals, humans { genitals = giver.RaceProps.body.AllParts.Find(x => x.def == SemenHelper.genitalsDef); } //no cum without genitals if (genitals == null) { return; } //calculate s***n amount: Need sexNeed = giver.needs.AllNeeds.Find(x => string.Equals(x.def.defName, "Sex")); float horniness = 1f; if (sexNeed != null) //non-humans don't have it - therefore just use the default value { horniness = 1f - sexNeed.CurLevel; } float ageScale = Math.Min(80 / SexUtility.ScaleToHumanAge(giver), 1.0f); //calculation lifted from rjw float cumAmount = horniness * giver.BodySize * ageScale * RJWSettings.cum_on_body_amount_adjust; ; if (xxx.has_quirk(giver, "Messy")) { cumAmount *= 1.5f; } //if no partner -> masturbation, apply some cum on self: //if (partner == null && sextype == xxx.rjwSextype.Autofellatio) //{ // if (!xxx.is_slime(giver)) // SemenHelper.cumOn(giver, BodyPartDefOf.Jaw, cumAmount, giver); // return; //} if (partner == null && sextype == xxx.rjwSextype.Masturbation) { if (!xxx.is_slime(giver)) { SemenHelper.cumOn(giver, genitals, cumAmount * 0.3f, giver); //pawns are usually not super-messy -> only apply 30% } return; } else if (partner != null) { List <BodyPartRecord> targetParts = new List <BodyPartRecord>(); //which to apply s***n on IEnumerable <BodyPartRecord> availableParts = SemenHelper.getAvailableBodyParts(receiver); BodyPartRecord randomPart; //not always needed switch (sextype) { case rjw.xxx.rjwSextype.Anal: targetParts.Add(receiver.RaceProps.body.AllParts.Find(x => x.def == SemenHelper.anusDef)); break; case rjw.xxx.rjwSextype.Boobjob: targetParts.Add(receiver.RaceProps.body.AllParts.Find(x => x.def == SemenHelper.chestDef)); break; case rjw.xxx.rjwSextype.DoublePenetration: targetParts.Add(receiver.RaceProps.body.AllParts.Find(x => x.def == SemenHelper.anusDef)); targetParts.Add(receiver.RaceProps.body.AllParts.Find(x => x.def == SemenHelper.genitalsDef)); break; case rjw.xxx.rjwSextype.Fingering: cumAmount = 0; break; case rjw.xxx.rjwSextype.Fisting: cumAmount = 0; break; case rjw.xxx.rjwSextype.Footjob: //random part: availableParts.TryRandomElement <BodyPartRecord>(out randomPart); targetParts.Add(randomPart); break; case rjw.xxx.rjwSextype.Handjob: //random part: availableParts.TryRandomElement <BodyPartRecord>(out randomPart); targetParts.Add(randomPart); break; case rjw.xxx.rjwSextype.Masturbation: cumAmount *= 2f; break; case rjw.xxx.rjwSextype.MechImplant: //one of the openings: int random = Rand.Range(0, 3); if (random == 0) { targetParts.Add(receiver.RaceProps.body.AllParts.Find(x => x.def == SemenHelper.genitalsDef)); } else if (random == 1) { targetParts.Add(receiver.RaceProps.body.AllParts.Find(x => x.def == SemenHelper.anusDef)); } else if (random == 2) { targetParts.Add(receiver.RaceProps.body.AllParts.Find(x => x.def == BodyPartDefOf.Jaw)); } break; case rjw.xxx.rjwSextype.MutualMasturbation: //random availableParts.TryRandomElement <BodyPartRecord>(out randomPart); targetParts.Add(randomPart); break; case rjw.xxx.rjwSextype.None: cumAmount = 0; break; case rjw.xxx.rjwSextype.Oral: targetParts.Add(receiver.RaceProps.body.AllParts.Find(x => x.def == BodyPartDefOf.Jaw)); break; case rjw.xxx.rjwSextype.Scissoring: //I guess if it came to here, a male must be involved? targetParts.Add(receiver.RaceProps.body.AllParts.Find(x => x.def == SemenHelper.genitalsDef)); break; case rjw.xxx.rjwSextype.Vaginal: targetParts.Add(receiver.RaceProps.body.AllParts.Find(x => x.def == SemenHelper.genitalsDef)); break; } if (cumAmount > 0) { if (xxx.is_slime(receiver)) { //slime absorb cum //this needs balancing, since cumamount ranges 0-10(?) which is fine for cum/hentai but not very realistic for feeding //using TransferNutrition for now //Log.Message("cumAmount " + cumAmount); //float nutrition_amount = cumAmount/10; Need_Food need = need = giver.needs.TryGetNeed <Need_Food>(); if (need == null) { //Log.Message("xxx::TransferNutrition() " + xxx.get_pawnname(pawn) + " doesn't track nutrition in itself, probably shouldn't feed the others"); return; } if (receiver?.needs?.TryGetNeed <Need_Food>() != null) { //Log.Message("xxx::TransferNutrition() " + xxx.get_pawnname(partner) + " can receive"); float nutrition_amount = Math.Min(need.MaxLevel / 15f, need.CurLevel); //body size is taken into account implicitly by need.MaxLevel receiver.needs.food.CurLevel += nutrition_amount; } } else { SemenHelper.cumOn(giver, genitals, cumAmount * 0.3f, giver, entityType); //cum on self - smaller amount foreach (BodyPartRecord bpr in targetParts) { if (bpr != null) { SemenHelper.cumOn(receiver, bpr, cumAmount, giver, entityType); //cum on partner } } } } } }
// Use this for initialization void Start() { need = GetComponent <Need>(); need.urgency = 100; nv = GetComponent <NavMeshAgent>(); }
List <Product> GetProducts() { var Pds = new Dictionary <uint, Product>(); string Cont = GetHtmlPrdcts(); if (Cont.Contains("__GETTASK_ERROR__")) { return(Pds.Values.ToList()); } string[] Lines = Cont.Split("\n".ToCharArray()); foreach (string Line in Lines) { if (string.IsNullOrEmpty(Line.Trim())) { continue; } var Cols = Line.Split("\"".ToCharArray()); int I = 0; var PdId = Cols[I++].ToUint(); if (PdId == 0) { continue; //No Product } Product Pd = null; if (Pds.ContainsKey(PdId)) { Pd = Pds[PdId]; } else { Pd = new Product { Id = PdId }; Pds[PdId] = Pd; } Pd.Name = Cols[I++].ToName(); Pd.PDM = Cols[I++].Trim(); var PlanId = Cols[I++].ToUint(); if (PlanId == 0) { continue; //No Plan } var Plan = Pd.GetPlan(PlanId); Plan.Title = Cols[I++].ToName(); Plan.Begin = Cols[I++].ToDt(); Plan.End = Cols[I++].ToDt(); var Nd = new Need { Id = Cols[I++].ToUint() }; if (Nd.Id == 0) { continue; //No Need. } Nd.Title = Cols[I++].ToName(); Nd.St = Need.ToStatus(Cols[I++].Trim()); Nd.Stg = Need.ToStage(Cols[I++].Trim()); Plan.AddNeed(Nd); } return(Pds.Values.ToList()); }
/// <summary> /// Serialize to a JSON object /// </summary> public new void SerializeJson(Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true) { if (includeStartObject) { writer.WriteStartObject(); } if (!string.IsNullOrEmpty(ResourceType)) { writer.WriteString("resourceType", (string)ResourceType !); } ((fhirCsR4.Models.DomainResource) this).SerializeJson(writer, options, false); if ((Target != null) && (Target.Count != 0)) { writer.WritePropertyName("target"); writer.WriteStartArray(); foreach (Reference valTarget in Target) { valTarget.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if ((TargetLocation != null) && (TargetLocation.Count != 0)) { writer.WritePropertyName("targetLocation"); writer.WriteStartArray(); foreach (string valTargetLocation in TargetLocation) { writer.WriteStringValue(valTargetLocation); } writer.WriteEndArray(); } if ((_TargetLocation != null) && (_TargetLocation.Count != 0)) { writer.WritePropertyName("_targetLocation"); writer.WriteStartArray(); foreach (Element val_TargetLocation in _TargetLocation) { val_TargetLocation.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (Need != null) { writer.WritePropertyName("need"); Need.SerializeJson(writer, options); } if (!string.IsNullOrEmpty(Status)) { writer.WriteString("status", (string)Status !); } if (_Status != null) { writer.WritePropertyName("_status"); _Status.SerializeJson(writer, options); } if (!string.IsNullOrEmpty(StatusDate)) { writer.WriteString("statusDate", (string)StatusDate !); } if (_StatusDate != null) { writer.WritePropertyName("_statusDate"); _StatusDate.SerializeJson(writer, options); } if (ValidationType != null) { writer.WritePropertyName("validationType"); ValidationType.SerializeJson(writer, options); } if ((ValidationProcess != null) && (ValidationProcess.Count != 0)) { writer.WritePropertyName("validationProcess"); writer.WriteStartArray(); foreach (CodeableConcept valValidationProcess in ValidationProcess) { valValidationProcess.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (Frequency != null) { writer.WritePropertyName("frequency"); Frequency.SerializeJson(writer, options); } if (!string.IsNullOrEmpty(LastPerformed)) { writer.WriteString("lastPerformed", (string)LastPerformed !); } if (_LastPerformed != null) { writer.WritePropertyName("_lastPerformed"); _LastPerformed.SerializeJson(writer, options); } if (!string.IsNullOrEmpty(NextScheduled)) { writer.WriteString("nextScheduled", (string)NextScheduled !); } if (_NextScheduled != null) { writer.WritePropertyName("_nextScheduled"); _NextScheduled.SerializeJson(writer, options); } if (FailureAction != null) { writer.WritePropertyName("failureAction"); FailureAction.SerializeJson(writer, options); } if ((PrimarySource != null) && (PrimarySource.Count != 0)) { writer.WritePropertyName("primarySource"); writer.WriteStartArray(); foreach (VerificationResultPrimarySource valPrimarySource in PrimarySource) { valPrimarySource.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (Attestation != null) { writer.WritePropertyName("attestation"); Attestation.SerializeJson(writer, options); } if ((Validator != null) && (Validator.Count != 0)) { writer.WritePropertyName("validator"); writer.WriteStartArray(); foreach (VerificationResultValidator valValidator in Validator) { valValidator.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (includeStartObject) { writer.WriteEndObject(); } }
private void Start() { need = Player.Instance.GetNeed(needType); }
private void GetNewJob() { float needPercent = 0; Need need = null; foreach (Need n in needs) { if (n.Amount > needPercent) { need = n; needPercent = n.Amount; } } if (needPercent > 50 && needPercent < 100 && need.RestoreNeedFurn != null) { if (World.Current.CountFurnitureType(need.RestoreNeedFurn.ObjectType) > 0) { MyJob = new Job(null, need.RestoreNeedFurn.ObjectType, need.CompleteJobNorm, need.RestoreNeedTime, null, Job.JobPriority.High, false, true, false); } } if (needPercent == 100 && need != null && need.CompleteOnFail) { MyJob = new Job(CurrTile, null, need.CompleteJobCrit, need.RestoreNeedTime * 10, null, Job.JobPriority.High, false, true, true); } // Get the first job on the queue. if (MyJob == null) { MyJob = World.Current.jobQueue.Dequeue(); // Check if we got a job from the queue. if (MyJob == null) { Debug.ULogChannel("Character", name + " did not find a job."); MyJob = new Job( CurrTile, "Waiting", null, UnityEngine.Random.Range(0.1f, 0.5f), null, Job.JobPriority.Low, false); MyJob.JobDescription = "job_waiting_desc"; } else { if (MyJob.tile == null) { Debug.ULogChannel("Character", name + " found a job."); } else { Debug.ULogChannel("Character", name + " found a job at x " + MyJob.tile.X + " y " + MyJob.tile.Y + "."); } } } // Get our destination from the job. DestTile = MyJob.tile; // If the destination tile does not have neighbours that are walkable it's very likely that they can't be walked to if (DestTile != null) { if (DestTile.HasWalkableNeighbours() == false) { Debug.ULogChannel("Character", "No neighbouring floor tiles! Abandoning job."); AbandonJob(false); return; } } MyJob.OnJobStopped += OnJobStopped; // Immediately check to see if the job tile is reachable. // NOTE: We might not be pathing to it right away (due to // requiring materials), but we still need to verify that the // final location can be reached. Profiler.BeginSample("PathGeneration"); if (MyJob.IsNeed) { // This will calculate a path from current tile to destination tile. pathAStar = new Path_AStar(World.Current, CurrTile, DestTile, need.RestoreNeedFurn.ObjectType, 0, false, true); } else { pathAStar = new Path_AStar(World.Current, CurrTile, DestTile); } Profiler.EndSample(); if (pathAStar != null && pathAStar.Length() == 0) { Debug.ULogChannel("Character", "Path_AStar returned no path to target job tile!"); AbandonJob(false); return; } if (MyJob.adjacent) { IEnumerable <Tile> reversed = pathAStar.Reverse(); reversed = reversed.Skip(1); pathAStar = new Path_AStar(new Queue <Tile>(reversed.Reverse())); DestTile = pathAStar.EndTile(); jobTile = DestTile; } else { jobTile = MyJob.tile; } MyJob.IsBeingWorked = true; }
public void Init(Kitchen k, Need Need) { Kitchen = k; }
/// Use only for serialization public Character() { Needs = new Need[PrototypeManager.Need.Count]; InitializeCharacterValues(); }
public void AddNeed(Need need) { platformContext.Needs.Add(need); platformContext.SaveChanges(); }
public bool DoesNeed(Need need) { var currentNeed = getCurrentNeed(); return(currentNeed != null && currentNeed == need); }