Some mods target the Mono version of the game, which is available by opting into the Steam beta branch "alternate"
Decompiled source of Relationship Boyfriend Girlfriend Mod v1.0.0
Mods/WoodStudios.DateNight.dll
Decompiled 9 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.Json; using DateNightMod; using HarmonyLib; using Il2CppFishNet; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppScheduleOne.DevUtilities; using Il2CppScheduleOne.Dialogue; using Il2CppScheduleOne.GameTime; using Il2CppScheduleOne.Messaging; using Il2CppScheduleOne.NPCs; using Il2CppScheduleOne.ObjectScripts; using Il2CppScheduleOne.Persistence; using Il2CppScheduleOne.PlayerScripts; using Il2CppScheduleOne.Property; using Il2CppScheduleOne.UI; using Il2CppScheduleOne.UI.Phone.Map; using Il2CppScheduleOne.UI.Phone.Messages; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using MelonLoader; using MelonLoader.Preferences; using MelonLoader.Utils; using Microsoft.CodeAnalysis; using S1API.Entities; using S1API.GameTime; using S1API.Lifecycle; using S1API.Map; using S1API.Money; using S1API.PhoneApp; using S1API.UI; using S1API.Utils; using Schedule2.Game; using UnityEngine; using UnityEngine.AI; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MelonInfo(typeof(Main), "Date Night", "1.0.0", "Wood Studios", null)] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Schedule2 { internal static class S2Ui { private static Font _font; internal static (GameObject, Button, Text) ButtonWithLabel(string name, string label, Transform parent, Color bgColor, float Width, float Height) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); val.transform.SetParent(parent, false); val.AddComponent<RectTransform>().sizeDelta = new Vector2(Width, Height); Image val2 = val.AddComponent<Image>(); ((Graphic)val2).color = bgColor; Button val3 = val.AddComponent<Button>(); ((Selectable)val3).targetGraphic = (Graphic)(object)val2; GameObject val4 = new GameObject("Label"); val4.transform.SetParent(val.transform, false); RectTransform obj = val4.AddComponent<RectTransform>(); obj.anchorMin = Vector2.zero; obj.anchorMax = Vector2.one; obj.offsetMin = Vector2.zero; obj.offsetMax = Vector2.zero; Text val5 = val4.AddComponent<Text>(); val5.text = label; val5.alignment = (TextAnchor)4; val5.fontSize = 16; val5.fontStyle = (FontStyle)1; ((Graphic)val5).color = Color.white; if ((Object)(object)_font == (Object)null) { _font = Resources.GetBuiltinResource<Font>("Arial.ttf"); } val5.font = _font; return (val, val3, val5); } } } namespace Schedule2.Game { public enum DatingPick { Girlfriend, Boyfriend, Either } public sealed class LoveData { public Dictionary<string, int> Meter { get; set; } = new Dictionary<string, int>(); public Dictionary<string, int> Talked { get; set; } = new Dictionary<string, int>(); public Dictionary<string, int> Flirted { get; set; } = new Dictionary<string, int>(); public Dictionary<string, int> Texted { get; set; } = new Dictionary<string, int>(); public Dictionary<string, int> Gifted { get; set; } = new Dictionary<string, int>(); public Dictionary<string, int> MetOn { get; set; } = new Dictionary<string, int>(); public Dictionary<string, int> Acted { get; set; } = new Dictionary<string, int>(); public string Partner { get; set; } = ""; public int Stage { get; set; } public int Since { get; set; } = -1; public int LastDate { get; set; } = -1; public int Dates { get; set; } public string Home { get; set; } = ""; public string DatePlace { get; set; } = ""; public int DateDay { get; set; } = -1; public int DateState { get; set; } public int CookDay { get; set; } = -1; public int AteDay { get; set; } = -1; public float BuffUntil { get; set; } = -1f; public int BailDay { get; set; } = -100; public int BillDay { get; set; } = -100; public int RaidDay { get; set; } = -100; public int NudgeDay { get; set; } = -1; public int DecayDay { get; set; } = -1; public bool Follow { get; set; } } internal static class Love { internal sealed class Person { public string Id; public string Name; public string First; public bool Woman; public int Style; public string Like; } internal sealed class Reply { public string Text; public Action Picked; } private sealed class Outgoing { public float At; public string Id; public string Msg; public Reply[] Replies; } private sealed class Choices { public string Id; public DialogueController Dc; public DialogueChoice Flirt; public DialogueChoice AskOut; public DialogueChoice Needle; public DialogueChoice Diner; public DialogueChoice MoveIn; public DialogueChoice Eat; public DialogueChoice Come; public DialogueChoice Stay; public DialogueChoice Break; } internal static class Fade { private static float _start = -1f; private static string _text; private static Action _dark; private static Action _after; private static bool _swapped; public static bool On => _start > 0f; public static void Start(string text, Action atDark, Action after) { _start = Time.unscaledTime; _text = text; _dark = atDark; _after = after; _swapped = false; } public static void Update() { if (!On) { return; } float num = Time.unscaledTime - _start; if (!_swapped && num >= 1f) { _swapped = true; try { _dark?.Invoke(); } catch (Exception ex) { LoveHost.Warn("Date Night: " + ex.Message); } } if (!(num >= 5.2f)) { return; } _start = -1f; try { _after?.Invoke(); } catch { } } public static void Draw() { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) if (On) { float num = Time.unscaledTime - _start; float num2 = ((num < 1f) ? num : ((num > 4.2f) ? Mathf.Clamp01(5.2f - num) : 1f)); Rect arg = default(Rect); ((Rect)(ref arg))..ctor(0f, 0f, (float)Screen.width, (float)Screen.height); LoveHost.Fill(arg, new Color(0f, 0f, 0f, num2)); if (num > 1.2f && num < 4.6f) { float num3 = Mathf.Clamp01(Mathf.Min(num - 1.2f, 4.6f - num) * 2f); LoveHost.Text(new Rect((float)Screen.width * 0.15f, (float)Screen.height * 0.45f, (float)Screen.width * 0.7f, 80f), _text, 22, new Color(0.95f, 0.95f, 0.95f, num3), (TextAnchor)4, bold: false); } } } } internal static readonly Person[] People = new Person[6] { new Person { Id = "jennifer_rivera", Name = "Jennifer Rivera", First = "Jennifer", Woman = true, Style = 0, Like = "sweet talk" }, new Person { Id = "lily_turner", Name = "Lily Turner", First = "Lily", Woman = true, Style = 1, Like = "making her laugh" }, new Person { Id = "chloe_bowers", Name = "Chloe Bowers", First = "Chloe", Woman = true, Style = 2, Like = "confidence" }, new Person { Id = "chris_sullivan", Name = "Chris Sullivan", First = "Chris", Woman = false, Style = 1, Like = "making him laugh" }, new Person { Id = "javier_perez", Name = "Javier Pérez", First = "Javier", Woman = false, Style = 0, Like = "sweet talk" }, new Person { Id = "kyle_cooley", Name = "Kyle Cooley", First = "Kyle", Woman = false, Style = 2, Like = "confidence" } }; internal static readonly (string name, int cost, int gain)[] Gifts = new(string, int, int)[3] { ("Flowers", 60, 6), ("Chocolates", 35, 4), ("Necklace", 450, 14) }; internal const int DaysBeforeAskOut = 3; internal const int DaysBeforeMoveIn = 7; internal const int DatesBeforeMoveIn = 3; internal static MelonPreferences_Entry<DatingPick> Pref; private static readonly List<Outgoing> _outbox = new List<Outgoing>(); private static float _next; private static float _dlgAt; private static bool _hooked; private static readonly List<Choices> _choices = new List<Choices>(); private static DialogueController _closeTalk; private static float _closeAt; private static readonly string[][] FlirtLines = new string[3][] { new string[3] { "Oh, stop. ...Okay, don't stop.", "You're sweet, you know that?", "Well, that made my day." }, new string[3] { "Ha! Was that a line? It kind of worked.", "You're ridiculous. I like it.", "Okay, that was smooth." }, new string[3] { "Bold. I like bold.", "Somebody's confident today.", "Keep talking like that and see what happens." } }; private static NPC _held; private static float _goWarn; private static bool _pausedAgent; private static string _heldAt = ""; private static float _wanderAt; private static bool _hidden; private static bool _sleepHooked; private static bool _woke; private static float _followNext; private static readonly string[] MorningLines = new string[4] { "Morning, sleepyhead.", "Good morning. You snore, by the way.", "Morning! Coffee?", "Hey you. Sleep okay?" }; private static bool _sped; private static float _speedWas = 1f; private static MapPOI _pin; private static string _pinFor = ""; private static Sprite _pinPink; private static Sprite _pinBlue; private static float _focusAt = -1f; private static float _billCashBefore = -1f; private static string _hint; private static readonly string[][] Openers = new string[1][] { new string[3] { "Hey you. What are you up to?", "Thinking about anything good today?", "I'm bored. Entertain me." } }; internal static LoveData D => LoveHost.Data(); internal static int MoveInDay => D.Since + 7; internal static Person PartnerP { get { if (!string.IsNullOrEmpty(D.Partner)) { return Find(D.Partner); } return null; } } internal static int Day => Math.Max(0, LoveHost.Day()); internal static int Hhmm { get { try { return TimeManager.CurrentTime; } catch { return 1200; } } } internal static float Minute => (float)Day * 1440f + (float)(Hhmm / 100 * 60) + (float)(Hhmm % 100); internal static bool DidToday(string id) { if (D.Acted.TryGetValue(id, out var value)) { return value == Day; } return false; } internal static int KnownFor(string id) { if (!D.MetOn.TryGetValue(id, out var value)) { return 0; } return Day - value; } internal static int AskOutDay(string id) { int value; return (D.MetOn.TryGetValue(id, out value) ? value : Day) + 3; } internal static bool CanMoveIn(string id) { if (D.Partner == id && D.Stage == 1 && MeterOf(id) >= 75 && D.Dates >= 3) { return Day >= MoveInDay; } return false; } internal static IEnumerable<Person> Eligible() { DatingPick p = ((Pref != null) ? Pref.Value : DatingPick.Either); return People.Where((Person x) => p == DatingPick.Either || ((p != DatingPick.Girlfriend) ? (!x.Woman) : x.Woman)); } internal static Person Find(string id) { return People.FirstOrDefault((Person x) => x.Id == id); } internal static int MeterOf(string id) { if (!D.Meter.TryGetValue(id, out var value)) { return -1; } return value; } internal static bool Met(string id) { return D.Meter.ContainsKey(id); } internal static string BF(Person p) { if (p != null) { if (!p.Woman) { return "boyfriend"; } return "girlfriend"; } return ""; } internal static string Him(Person p) { if (!p.Woman) { return "him"; } return "her"; } internal static string He(Person p) { if (!p.Woman) { return "he"; } return "she"; } internal static NPC Native(string id) { try { return NPCManager.GetNPC(id); } catch { return null; } } internal static NPC Api(string id) { try { foreach (NPC item in NPC.All) { if (item != null && item.ID == id) { return item; } } } catch { } return null; } internal static void Add(string id, int amount, string why = null) { int num = Mathf.Clamp((MeterOf(id) >= 0) ? MeterOf(id) : 0, 0, 100); num = Mathf.Clamp(num + amount, 0, 100); D.Meter[id] = num; if (amount > 0) { D.Talked[id] = Day; } if (why != null) { LoveHost.Log($"Date Night: {Find(id)?.First} {((amount >= 0) ? "+" : "")}{amount} ({why}), now {num}."); } } internal static void Text(string id, string msg, Reply[] replies = null, float delay = 1f) { _outbox.Add(new Outgoing { At = Time.unscaledTime + Mathf.Max(0f, delay), Id = id, Msg = msg, Replies = replies }); } private static void SendDue() { //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Expected O, but got Unknown //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Expected O, but got Unknown for (int num = _outbox.Count - 1; num >= 0; num--) { Outgoing outgoing = _outbox[num]; if (!(Time.unscaledTime < outgoing.At)) { _outbox.RemoveAt(num); try { NPC obj = Native(outgoing.Id); MSGConversation val = ((obj != null) ? obj.MSGConversation : null); if (val == null) { LoveHost.Warn("Date Night: no phone conversation for " + outgoing.Id + "."); } else { try { val.EnsureUIExists(); if (!val.IsSenderKnown) { val.SetIsKnown(true); } if (!val.EntryVisible) { val.SetEntryVisibility(true); } } catch { } val.SendMessage(new Message(outgoing.Msg, (ESenderType)1, true, Random.Range(1, int.MaxValue)), true, true); if (outgoing.Replies != null && outgoing.Replies.Length != 0) { try { val.ClearResponses(false); } catch { } List<Response> val2 = new List<Response>(); for (int i = 0; i < outgoing.Replies.Length; i++) { Reply r = outgoing.Replies[i]; Action action = delegate { try { r.Picked?.Invoke(); } catch (Exception ex2) { LoveHost.Warn("Date Night reply: " + ex2.Message); } }; val2.Add(new Response(r.Text, "love_" + i, DelegateSupport.ConvertDelegate<Action>((Delegate)action), false)); } val.ShowResponses(val2, 0.6f, true); } } } catch (Exception ex) { LoveHost.Warn("Date Night text: " + ex.Message); } } } } internal static void Say(string id, string line, float secs = 4f) { try { NPC obj = Native(id); if (obj != null) { obj.DialogueHandler.ShowWorldspaceDialogue(line, secs); } } catch { } } internal static void Reset() { _hooked = false; _choices.RemoveAll(delegate(Choices c) { try { return (Object)(object)c.Dc == (Object)null || (Object)(object)((Component)c.Dc).gameObject == (Object)null; } catch { return true; } }); try { MapPOI pin = _pin; if (pin != null) { pin.Remove(); } } catch { } _pin = null; _pinFor = ""; RestoreSpeed(); } internal static void Tick() { if (LoveHost.Off || LoveHost.Guest()) { return; } Fade.Update(); HintUpdate(); SendDue(); CloseTalk(); FocusTick(); if (!_sleepHooked) { _sleepHooked = true; try { TimeManager.OnSleepEnd = (Action<int>)Delegate.Combine(TimeManager.OnSleepEnd, (Action<int>)delegate { _woke = true; }); } catch { } } if (_woke) { _woke = false; try { WakeBeside(); } catch { } } if (Time.unscaledTime >= _followNext) { _followNext = Time.unscaledTime + 0.4f; try { FollowTick(); } catch { } } if (!(Time.unscaledTime < _next)) { _next = Time.unscaledTime + 1f; if (!_hooked) { Hook(); } if (Time.unscaledTime >= _dlgAt) { _dlgAt = Time.unscaledTime + 2f; RefreshChoices(); } Daily(); PinTick(); DateTick(); HomeTick(); Buff(); Perks(); } } private static void CloseTalk() { if ((Object)(object)_closeTalk == (Object)null || Time.unscaledTime < _closeAt) { return; } DialogueController closeTalk = _closeTalk; _closeTalk = null; try { NPC componentInParent = ((Component)closeTalk).GetComponentInParent<NPC>(); DialogueHandler val = ((componentInParent != null) ? componentInParent.DialogueHandler : null); if ((Object)(object)val != (Object)null && val.IsDialogueInProgress) { val.EndDialogue(); } } catch { } try { closeTalk.SetCooldown(0f); } catch { } } private static void Hook() { _hooked = true; Person[] people = People; foreach (Person p in people) { NPC val = Native(p.Id); if ((Object)(object)val == (Object)null) { _hooked = false; } else { if (_choices.Any((Choices c) => c.Id == p.Id)) { continue; } DialogueController componentInChildren = ((Component)val).GetComponentInChildren<DialogueController>(true); if ((Object)(object)componentInChildren == (Object)null) { continue; } Choices choices = new Choices { Id = p.Id, Dc = componentInChildren }; choices.Flirt = Choice(componentInChildren, "Flirt", delegate { FlirtInPerson(p); }, 40); choices.AskOut = Choice(componentInChildren, "Ask " + Him(p) + " out", delegate { AskOut(p); }, 39); LovePlace p2 = ((LoveHost.Places.Length != 0) ? LoveHost.Places[0] : null); LovePlace p3 = ((LoveHost.Places.Length > 1) ? LoveHost.Places[1] : null); if (p2 != null) { choices.Needle = Choice(componentInChildren, p2.Choice + " tonight" + ((p2.Cost > 0) ? (" ($" + p2.Cost + ")") : ""), delegate { PlanDate(p, p2.Key); }, 38); } if (p3 != null) { choices.Diner = Choice(componentInChildren, p3.Choice + " tonight" + ((p3.Cost > 0) ? (" ($" + p3.Cost + ")") : ""), delegate { PlanDate(p, p3.Key); }, 37); } choices.MoveIn = Choice(componentInChildren, "Move in with me?", delegate { AskMoveIn(p); }, 36); choices.Eat = Choice(componentInChildren, "Eat dinner together", delegate { EatDinner(p); }, 35); choices.Come = Choice(componentInChildren, "Come with me", delegate { SetFollow(p, on: true); }, 34); choices.Stay = Choice(componentInChildren, "Stay here", delegate { SetFollow(p, on: false); }, 33); choices.Break = Choice(componentInChildren, "We need to talk... (break up)", delegate { BreakUp(p, byPlayer: true); }, 30); _choices.Add(choices); } } if (_hooked) { LoveHost.Log("Date Night: talk options added to " + _choices.Count + " people."); } } private static DialogueChoice Choice(DialogueController dc, string text, Action act, int priority) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown DialogueChoice val = new DialogueChoice(); val.ChoiceText = text; val.Enabled = false; val.ShowWorldspaceDialogue = false; val.onChoosen = new UnityEvent(); EventHelper.AddListener((Action)delegate { try { act(); } catch (Exception ex) { LoveHost.Warn("Date Night: " + ex.Message); } _closeTalk = dc; _closeAt = Time.unscaledTime + 0.15f; }, val.onChoosen); dc.AddDialogueChoice(val, priority); return val; } private static void RefreshChoices() { HashSet<string> hashSet = new HashSet<string>(from x in Eligible() select x.Id); foreach (Choices choice in _choices) { try { Find(choice.Id); bool flag = hashSet.Contains(choice.Id); bool flag2 = D.Partner == choice.Id && D.Stage > 0; bool flag3 = !string.IsNullOrEmpty(D.Partner) && D.Stage > 0 && !flag2; int num = MeterOf(choice.Id); choice.Flirt.Enabled = flag && !flag3; choice.AskOut.Enabled = flag && !flag3 && !flag2 && num >= 35 && Day >= AskOutDay(choice.Id); if (choice.Needle != null) { choice.Needle.Enabled = flag2 && D.DateState == 0; } if (choice.Diner != null) { choice.Diner.Enabled = flag2 && D.DateState == 0; } choice.MoveIn.Enabled = CanMoveIn(choice.Id); choice.Eat.Enabled = flag2 && D.Stage == 2 && D.CookDay == Day && D.AteDay != Day && Hhmm >= 1800; choice.Come.Enabled = flag2 && !D.Follow && D.DateState != 2; choice.Stay.Enabled = flag2 && D.Follow; choice.Break.Enabled = flag2; } catch { } } } private static void FlirtInPerson(Person p) { bool flag = !Met(p.Id); if (DidToday(p.Id)) { Say(p.Id, "You already made me blush today. Come back tomorrow."); return; } D.Flirted[p.Id] = Day; D.Acted[p.Id] = Day; if (flag) { D.MetOn[p.Id] = Day; } int amount = Random.Range(4, 8); Add(p.Id, amount, "flirted in person"); Say(p.Id, FlirtLines[p.Style][Random.Range(0, 3)]); if (flag) { Text(p.Id, "Hey, it's " + p.First + ". Now you've got my number. Don't make it weird.", null, 4f); LoveHost.Notify("Date Night", p.First + " gave you " + (p.Woman ? "her" : "his") + " number. Text " + Him(p) + " from the Date Night app."); } } internal static string AskOut(Person p) { int num = MeterOf(p.Id); if (D.Stage > 0 && D.Partner != p.Id) { return Answer(p, "Aren't you seeing someone?"); } if (num < 50 || Day < AskOutDay(p.Id)) { return Answer(p, "Slow down. Get to know me a little first."); } D.Partner = p.Id; D.Stage = 1; D.Since = Day; D.Dates = 0; D.LastDate = Day; D.DateState = 0; Add(p.Id, 5, "said yes"); LoveHost.Notify("Date Night", p.First + " is your " + BF(p) + " now. Plan a date night from the Date Night app or in person."); Text(p.Id, "So... I'm telling everyone you're my " + (p.Woman ? "boyfriend" : "girlfriend") + " now. Just so you know.", null, 6f); return Answer(p, "Yes. Obviously yes."); } private static string Answer(Person p, string line) { Say(p.Id, line); return line; } internal static bool Free(Vector3 feet, NPC self = null, float radius = 0.28f) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) try { foreach (Collider item in (Il2CppArrayBase<Collider>)(object)Physics.OverlapCapsule(feet + Vector3.up * (radius + 0.12f), feet + Vector3.up * 1.75f, radius, -1, (QueryTriggerInteraction)1)) { if (!((Object)(object)item == (Object)null) && (!((Object)(object)self != (Object)null) || !((Component)item).transform.IsChildOf(((Component)self).transform)) && !((Object)(object)((Component)item).GetComponentInParent<NPC>() != (Object)null) && !((Object)(object)((Component)item).GetComponentInParent<Player>() != (Object)null)) { return false; } } return true; } catch { return true; } } internal static bool FreeSpot(Vector3 near, float range, NPC self, out Vector3 spot, Property inside = null) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) spot = near; NavMeshHit val = default(NavMeshHit); for (float num = 0f; num <= range; num += 0.5f) { int num2 = ((num < 0.01f) ? 1 : Mathf.Max(8, Mathf.RoundToInt(num * 8f))); for (int i = 0; i < num2; i++) { float num3 = (float)i * (float)Math.PI * 2f / (float)num2; if (NavMesh.SamplePosition(near + new Vector3(Mathf.Cos(num3) * num, 0f, Mathf.Sin(num3) * num), ref val, 1.2f, -1) && (!((Object)(object)inside != (Object)null) || inside.DoBoundsContainPoint(((NavMeshHit)(ref val)).position)) && Free(((NavMeshHit)(ref val)).position, self)) { spot = ((NavMeshHit)(ref val)).position; return true; } } } return false; } private static float Ray(Vector3 from, Vector3 dir, float max) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) try { RaycastHit val = default(RaycastHit); if (Physics.Raycast(from, dir, ref val, max, -1, (QueryTriggerInteraction)1)) { return ((RaycastHit)(ref val)).distance; } } catch { } return -1f; } internal static bool FreeFloor(Vector3 near, float range, NPC self, out Vector3 spot) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) spot = near; for (float num = 0f; num <= range; num += 0.4f) { int num2 = ((num < 0.01f) ? 1 : Mathf.Max(8, Mathf.RoundToInt(num * 8f))); for (int i = 0; i < num2; i++) { float num3 = (float)i * (float)Math.PI * 2f / (float)num2; Vector3 val = near + new Vector3(Mathf.Cos(num3) * num, 0f, Mathf.Sin(num3) * num); float num4 = Ray(val + Vector3.up * 1f, Vector3.down, 1.4f); if (!(num4 < 0f)) { Vector3 val2 = val + Vector3.up * (1f - num4); if (!(Mathf.Abs(val2.y - near.y) > 0.15f) && Free(val2, self)) { spot = val2; return true; } } } } return false; } internal static LovePlace Place(string key) { LovePlace[] places = LoveHost.Places; foreach (LovePlace lovePlace in places) { if (lovePlace.Key == key) { return lovePlace; } } return null; } internal static string PlanDate(Person p, string place) { LovePlace lovePlace = Place(place); if (lovePlace == null) { return ""; } if (D.Partner != p.Id || D.Stage == 0) { return "Not dating " + p.First + "."; } if (D.DateState != 0) { return "You already have a date planned."; } D.DatePlace = place; D.DateDay = ((Hhmm >= 2000) ? (Day + 1) : Day); D.DateState = 1; string text = ((D.DateDay == Day) ? "tonight" : "tomorrow night"); Text(p.Id, "It's a date. " + lovePlace.Short + ", " + text + " at 8. Don't be late." + ((lovePlace.Cost > 0) ? (" ($" + lovePlace.Cost + ", you're paying.)") : ""), null, 3f); LoveHost.Notify("Date Night", "Date with " + p.First + " " + text + " at 8 PM at " + lovePlace.Where + "."); return Answer(p, lovePlace.Yes); } private static void DateTick() { Person partnerP = PartnerP; if (partnerP != null && D.Stage != 0 && D.DateState != 0) { int hhmm = Hhmm; if (D.DateState == 1 && Day > D.DateDay) { StoodUp(partnerP); } else if (D.DateState == 1 && Day == D.DateDay && hhmm >= 1930 && hhmm < 2230) { GoToDate(partnerP); } else if (D.DateState == 2 && (Day > D.DateDay || hhmm >= 2300 || hhmm < 400)) { StoodUp(partnerP); } } } private static void GoToDate(Person p) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) NPC val = Native(p.Id); if ((Object)(object)val == (Object)null) { return; } LovePlace lovePlace = Place(D.DatePlace); if (lovePlace == null || lovePlace.Spot == null) { return; } Vector3 pos; Quaternion face; try { if (!lovePlace.Spot(out pos, out face)) { return; } } catch { return; } NavMeshHit val2 = default(NavMeshHit); bool flag; Vector3 spot; if (NavMesh.SamplePosition(pos, ref val2, 1.5f, -1)) { flag = FreeSpot(pos, 4f, val, out spot); if (!flag && Free(pos, val)) { spot = pos; flag = true; } } else { flag = FreeFloor(pos, 2.5f, val, out spot); } if (!flag) { if (Time.unscaledTime >= _goWarn) { _goWarn = Time.unscaledTime + 60f; LoveHost.Warn("Date Night: no clear spot at " + lovePlace.Where + " yet; trying again."); } return; } D.Follow = false; _heldAt = D.DatePlace; Hold(val, spot, face); D.DateState = 2; LoveHost.Log($"Date Night: {p.First} is waiting at {lovePlace.Where}, standing clear at {spot:F2}."); Text(p.Id, lovePlace.Arrived, null, 2f); } private static void Hold(NPC n, Vector3 pos, Quaternion rot) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) _held = n; try { foreach (NPCScheduleManager componentsInChild in ((Component)n).GetComponentsInChildren<NPCScheduleManager>(true)) { componentsInChild.DisableSchedule(); } } catch { } try { n.Movement.Stop(); } catch { } NavMeshHit val = default(NavMeshHit); if (NavMesh.SamplePosition(pos, ref val, 1f, -1)) { try { n.Movement.Warp(((NavMeshHit)(ref val)).position); } catch { } try { ((Component)n).transform.rotation = rot; } catch { } } else { _pausedAgent = true; try { NavMeshAgent componentInChildren = ((Component)n).GetComponentInChildren<NavMeshAgent>(); if ((Object)(object)componentInChildren != (Object)null) { ((Behaviour)componentInChildren).enabled = false; } } catch { } try { ((Component)n).transform.SetPositionAndRotation(pos, rot); } catch { } } try { n.SetVisible(true, false); } catch { } } internal static void Release() { //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) NPC held = _held; _held = null; if ((Object)(object)held == (Object)null) { return; } Vector3 pos; bool flag = D.Stage == 2 && HomeSpot(out pos); HomeSpot(out var pos2); if (_pausedAgent) { _pausedAgent = false; Vector3 position = (flag ? pos2 : ((Component)held).transform.position); if (!flag) { try { Vector3? val = Place(_heldAt)?.Ground?.Invoke(); if (val.HasValue) { position = val.Value; } } catch { } } try { ((Component)held).transform.position = position; } catch { } try { NavMeshAgent componentInChildren = ((Component)held).GetComponentInChildren<NavMeshAgent>(); if ((Object)(object)componentInChildren != (Object)null) { ((Behaviour)componentInChildren).enabled = true; } } catch { } } try { held.Movement.Stop(); } catch { } if (flag) { try { held.Movement.Warp(pos2); } catch { } } else { try { foreach (NPCScheduleManager componentsInChild in ((Component)held).GetComponentsInChildren<NPCScheduleManager>(true)) { componentsInChild.EnableSchedule(); } } catch { } } _wanderAt = Time.unscaledTime + 4f; } internal static void StartDate() { Person p = PartnerP; if (p == null || D.DateState != 2) { return; } LovePlace pl = Place(D.DatePlace); if (pl == null) { return; } int cost = pl.Cost; float num = 0f; try { num = Money.GetCashBalance(); } catch { } if (num < (float)cost) { Say(p.Id, "You don't have $" + cost + " on you? Seriously?"); return; } Fade.Start(string.Format(pl.Fade, p.First), delegate { try { Money.ChangeCashBalance((float)(-cost), true, true); } catch { } Skip(120); D.Dates++; D.LastDate = Day; D.DateState = 0; D.DatePlace = ""; Add(p.Id, pl.Gain, "date night"); try { Player.Local.Health.SetHealth(100f); } catch { } Release(); }, delegate { Say(p.Id, (D.Dates == 1) ? "Tonight was really fun. Let's do it again soon." : "Best night. Thanks for the date.", 6f); }); } private static void StoodUp(Person p) { D.DateState = 0; D.DatePlace = ""; Add(p.Id, -15, "stood up"); Release(); Text(p.Id, "I waited for you all night. Don't bother texting me tonight."); LoveHost.Notify("Date Night", "You stood " + p.First + " up. That hurt."); } private static void Skip(int minutes) { try { int hhmm = Hhmm; int num = hhmm / 100 * 60 + hhmm % 100 + minutes; num %= 1440; NetworkSingleton<TimeManager>.Instance.SetTime(num / 60 * 100 + num % 60); } catch { } } internal static string AskMoveIn(Person p) { if (D.Partner != p.Id || D.Stage != 1) { return ""; } if (!CanMoveIn(p.Id)) { int num = Math.Max(0, MoveInDay - Day); int num2 = Math.Max(0, 3 - D.Dates); return Answer(p, "Move in? It's a little soon." + ((num > 0) ? (" Give it " + num + " more day" + ((num == 1) ? "" : "s") + ".") : "") + ((num2 > 0) ? (" Take me on " + num2 + " more date" + ((num2 == 1) ? "" : "s") + " first.") : "") + ((MeterOf(p.Id) < 75) ? " I need to be sure about us." : "")); } Property val = HomeChoice(); if ((Object)(object)val == (Object)null) { return Answer(p, "Move in where? You need a place with a bed first."); } D.Stage = 2; D.Home = val.PropertyCode; D.CookDay = -1; Add(p.Id, 6, "moved in"); LoveHost.Notify("Date Night", p.First + " is moving into " + val.PropertyName + "."); Text(p.Id, "Packing my stuff now. See you at " + val.PropertyName + ".", null, 3f); _wanderAt = 0f; return Answer(p, "Really? Yes! I'll bring my things over today."); } private static Property HomeChoice() { //IL_0045: Unknown result type (might be due to invalid IL or missing references) try { Player local = Player.Local; Property val = null; List<Property> ownedProperties = Property.OwnedProperties; for (int i = 0; i < ownedProperties.Count; i++) { Property val2 = ownedProperties[i]; if (!((Object)(object)val2 == (Object)null) && !((Object)(object)BedIn(val2) == (Object)null)) { if ((Object)(object)local != (Object)null && val2.DoBoundsContainPoint(((Component)local).transform.position)) { return val2; } if ((Object)(object)val == (Object)null) { val = val2; } } } return val; } catch { return null; } } internal static Property HomeProp() { if (string.IsNullOrEmpty(D.Home)) { return null; } try { List<Property> ownedProperties = Property.OwnedProperties; for (int i = 0; i < ownedProperties.Count; i++) { if ((Object)(object)ownedProperties[i] != (Object)null && ownedProperties[i].PropertyCode == D.Home) { return ownedProperties[i]; } } } catch { } return null; } private static Transform BedIn(Property pr) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) try { foreach (Bed item in Object.FindObjectsByType<Bed>((FindObjectsSortMode)0)) { if ((Object)(object)item != (Object)null && pr.DoBoundsContainPoint(((Component)item).transform.position)) { return ((Component)item).transform; } } } catch { } return null; } private static bool HomeSpot(out Vector3 pos) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) pos = default(Vector3); Property val = HomeProp(); if ((Object)(object)val == (Object)null) { return false; } Transform val2 = (((Object)(object)val.InteriorSpawnPoint != (Object)null) ? val.InteriorSpawnPoint : (((Object)(object)val.NPCSpawnPoint != (Object)null) ? val.NPCSpawnPoint : val.SpawnPoint)); if ((Object)(object)val2 == (Object)null) { return false; } pos = val2.position; if (FreeSpot(pos, 5f, Native(D.Partner), out var spot, val)) { pos = spot; return true; } NavMeshHit val3 = default(NavMeshHit); if (NavMesh.SamplePosition(pos, ref val3, 4f, -1)) { pos = ((NavMeshHit)(ref val3)).position; } return true; } private static void HomeTick() { //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) Person partnerP = PartnerP; if (partnerP == null || D.Stage != 2 || D.DateState == 2 || D.Follow) { return; } Property val = HomeProp(); if ((Object)(object)val == (Object)null) { MoveOut(partnerP, "The place you shared isn't yours any more."); return; } NPC val2 = Native(partnerP.Id); if ((Object)(object)val2 == (Object)null) { return; } int hhmm = Hhmm; bool flag = hhmm >= 2300 || hhmm < 700; try { foreach (NPCScheduleManager componentsInChild in ((Component)val2).GetComponentsInChildren<NPCScheduleManager>(true)) { if (componentsInChild.ScheduleEnabled) { componentsInChild.DisableSchedule(); } } } catch { } bool flag2 = false; Vector3 val3; try { Player local = Player.Local; int num; if ((Object)(object)local != (Object)null) { val3 = ((Component)local).transform.position - ((Component)val2).transform.position; num = ((((Vector3)(ref val3)).sqrMagnitude < 900f) ? 1 : 0); } else { num = 0; } flag2 = (byte)num != 0; } catch { } if (!val.DoBoundsContainPoint(((Component)val2).transform.position) && HomeSpot(out var pos)) { val3 = ((Component)val2).transform.position - pos; if (((Vector3)(ref val3)).sqrMagnitude > 400f) { if (flag2) { try { if (!val2.Movement.IsMoving) { val2.Movement.SetDestination(pos); } return; } catch { return; } } try { val2.Movement.Stop(); val2.Movement.Warp(pos); } catch { } _wanderAt = Time.unscaledTime + 4f; } } if (flag) { Transform val4 = BedIn(val); if (_hidden) { return; } Vector3 spot = ((Component)val2).transform.position; if ((Object)(object)val4 != (Object)null && FreeSpot(val4.position + val4.right * 1.1f, 2.5f, val2, out spot, val)) { val3 = ((Component)val2).transform.position - spot; if (((Vector3)(ref val3)).sqrMagnitude > 1f) { try { val2.Movement.SetDestination(spot); return; } catch { return; } } } try { val2.SetVisible(false, false); } catch { } _hidden = true; return; } if (_hidden) { try { val2.SetVisible(true, false); } catch { } _hidden = false; } if (hhmm >= 1800 && D.CookDay != Day) { D.CookDay = Day; Player local2 = Player.Local; if ((Object)(object)local2 != (Object)null && val.DoBoundsContainPoint(((Component)local2).transform.position)) { Say(partnerP.Id, "Dinner's ready! Come eat.", 5f); } else { Text(partnerP.Id, "I made dinner. It's at " + val.PropertyName + " whenever you get home."); } } if (Time.unscaledTime < _wanderAt) { return; } _wanderAt = Time.unscaledTime + Random.Range(25f, 60f); try { if (val2.Movement.IsMoving) { return; } } catch { } Wander(val2, val); } internal static void SetFollow(Person p, bool on) { if (D.Partner != p.Id || D.Stage == 0) { return; } if (on) { if (D.DateState == 2) { return; } D.Follow = true; NPC val = Native(p.Id); if ((Object)(object)val != (Object)null) { try { val.SetVisible(true, false); } catch { } } _hidden = false; Say(p.Id, (p.Style == 1) ? "Road trip! Kind of." : ((p.Style == 2) ? "Lead the way." : "I'd go anywhere with you.")); } else { StopFollow(p); Say(p.Id, (D.Stage == 2) ? "Okay, I'll head home. See you there." : "Okay. Text me later."); } } internal static void StopFollow(Person p) { if (!D.Follow) { return; } D.Follow = false; NPC val = Native(p.Id); if ((Object)(object)val == (Object)null) { return; } try { val.Movement.Stop(); } catch { } if (D.Stage != 2) { try { foreach (NPCScheduleManager componentsInChild in ((Component)val).GetComponentsInChildren<NPCScheduleManager>(true)) { componentsInChild.EnableSchedule(); } } catch { } } _wanderAt = Time.unscaledTime + 4f; } private static void FollowTick() { //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) if (!D.Follow) { return; } Person partnerP = PartnerP; if (partnerP == null || D.Stage == 0 || D.DateState == 2) { D.Follow = false; return; } NPC val = Native(partnerP.Id); Player local = Player.Local; if ((Object)(object)val == (Object)null || (Object)(object)local == (Object)null) { return; } try { foreach (NPCScheduleManager componentsInChild in ((Component)val).GetComponentsInChildren<NPCScheduleManager>(true)) { if (componentsInChild.ScheduleEnabled) { componentsInChild.DisableSchedule(); } } } catch { } if (_hidden) { try { val.SetVisible(true, false); } catch { } _hidden = false; } bool flag = false; try { flag = (Object)(object)local.CurrentVehicle != (Object)null; } catch { } if (flag) { return; } Vector3 position = ((Component)local).transform.position; Vector3 forward = ((Component)local).transform.forward; forward.y = 0f; if (((Vector3)(ref forward)).sqrMagnitude < 0.01f) { forward = Vector3.forward; } ((Vector3)(ref forward)).Normalize(); Vector3 val2 = ((Component)val).transform.position - position; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude > 1225f) { if (!FreeSpot(position - forward * 2.2f, 4f, val, out var spot)) { return; } try { val.Movement.Stop(); val.Movement.Warp(spot); return; } catch { return; } } if (sqrMagnitude > 10.240001f) { NavMeshHit val3 = default(NavMeshHit); if (!NavMesh.SamplePosition(position - forward * 1.6f + Vector3.Cross(Vector3.up, forward) * 0.8f, ref val3, 2.5f, -1)) { return; } try { val.Movement.SetDestination(((NavMeshHit)(ref val3)).position); return; } catch { return; } } try { if (val.Movement.IsMoving) { val.Movement.Stop(); } } catch { } } private static void WakeBeside() { //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) Person partnerP = PartnerP; if (partnerP == null || D.Stage == 0 || D.DateState == 2) { return; } Player local = Player.Local; NPC val = Native(partnerP.Id); if ((Object)(object)local == (Object)null || (Object)(object)val == (Object)null) { return; } Property val2 = HomeProp(); bool flag = D.Stage == 2 && (Object)(object)val2 != (Object)null && val2.DoBoundsContainPoint(((Component)local).transform.position); if (!D.Follow && !flag) { return; } Vector3 position = ((Component)local).transform.position; Vector3 right = ((Component)local).transform.right; right.y = 0f; if (!FreeSpot(position + ((Vector3)(ref right)).normalized * 1f, 5f, val, out var spot, flag ? val2 : null)) { NavMeshHit val3 = default(NavMeshHit); if (!NavMesh.SamplePosition(position, ref val3, 3f, -1)) { return; } spot = ((NavMeshHit)(ref val3)).position; } try { val.SetVisible(true, false); } catch { } _hidden = false; try { val.Movement.Stop(); val.Movement.Warp(spot); } catch { } try { Vector3 val4 = position - spot; val4.y = 0f; if (((Vector3)(ref val4)).sqrMagnitude > 0.01f) { ((Component)val).transform.rotation = Quaternion.LookRotation(val4); } } catch { } _wanderAt = Time.unscaledTime + 30f; Say(partnerP.Id, MorningLines[Random.Range(0, MorningLines.Length)], 5f); } internal static bool Wander(NPC n, Property pr) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) if (HomeSpot(out var pos)) { Bounds bounds = default(Bounds); ((Bounds)(ref bounds))..ctor(pos, new Vector3(14f, 4f, 14f)); try { GameObject boundingBox = pr.BoundingBox; if ((Object)(object)boundingBox != (Object)null) { Collider component = boundingBox.GetComponent<Collider>(); if ((Object)(object)component != (Object)null) { bounds = component.bounds; } else { Renderer component2 = boundingBox.GetComponent<Renderer>(); if ((Object)(object)component2 != (Object)null) { bounds = component2.bounds; } } } } catch { } Vector3 val = default(Vector3); NavMeshHit val3 = default(NavMeshHit); for (int i = 0; i < 24; i++) { ((Vector3)(ref val))..ctor(Random.Range(((Bounds)(ref bounds)).min.x, ((Bounds)(ref bounds)).max.x), pos.y, Random.Range(((Bounds)(ref bounds)).min.z, ((Bounds)(ref bounds)).max.z)); Vector3 val2 = val - ((Component)n).transform.position; if (!(((Vector3)(ref val2)).sqrMagnitude < 2.5f) && NavMesh.SamplePosition(val, ref val3, 2f, -1) && pr.DoBoundsContainPoint(((NavMeshHit)(ref val3)).position) && Free(((NavMeshHit)(ref val3)).position, n)) { try { n.Movement.SetDestination(((NavMeshHit)(ref val3)).position); return true; } catch { } } } } return false; } internal static void EatDinner(Person p) { if (D.Partner != p.Id || D.Stage != 2 || D.CookDay != Day || D.AteDay == Day) { return; } Fade.Start("Dinner at home with " + p.First + ". " + ((p.Style == 1) ? "Tacos and terrible jokes." : ((p.Style == 2) ? "Steak, done exactly how you like it." : "Pasta, candles, the works.")), delegate { D.AteDay = Day; Skip(45); Add(p.Id, 3, "dinner at home"); try { Player.Local.Health.SetHealth(100f); } catch { } D.BuffUntil = Minute + 180f; }, delegate { LoveHost.Notify("Date Night", "Home-cooked meal: full health and 15% faster for 3 hours."); }); } private static void Buff() { bool flag = D.BuffUntil > 0f && Minute < D.BuffUntil; try { if (flag && !_sped) { _speedWas = PlayerMovement.StaticMoveSpeedMultiplier; PlayerMovement.StaticMoveSpeedMultiplier = _speedWas * 1.15f; _sped = true; } else if (!flag && _sped) { RestoreSpeed(); } } catch { } } private static void RestoreSpeed() { if (_sped) { try { PlayerMovement.StaticMoveSpeedMultiplier = _speedWas; } catch { } _sped = false; } } internal static void MoveOut(Person p, string why) { if (D.Stage == 2) { NPC val = Native(p.Id); if ((Object)(object)val != (Object)null) { try { val.SetVisible(true, false); } catch { } try { foreach (NPCScheduleManager componentsInChild in ((Component)val).GetComponentsInChildren<NPCScheduleManager>(true)) { componentsInChild.EnableSchedule(); } } catch { } } _hidden = false; } D.Stage = ((D.Stage == 2) ? 1 : D.Stage); D.Home = ""; if (why != null) { LoveHost.Notify("Date Night", p.First + " moved out. " + why); } } internal static void BreakUp(Person p, bool byPlayer) { if (!(D.Partner != p.Id)) { StopFollow(p); Release(); if (D.Stage == 2) { MoveOut(p, null); } D.Stage = 0; D.Partner = ""; D.DateState = 0; D.DatePlace = ""; D.Home = ""; D.Meter[p.Id] = Math.Min(MeterOf(p.Id), byPlayer ? 10 : 5); if (byPlayer) { Say(p.Id, "Wow. Okay. Fine. I'll get my stuff."); Text(p.Id, "Came by for the rest of my things. Have a nice life.", null, 30f); } else { Text(p.Id, "I can't do this anymore. You're never around. We're done. I'm moving my stuff out."); } LoveHost.Notify("Date Night", byPlayer ? ("You broke up with " + p.First + ".") : (p.First + " broke up with you.")); } } private static void PinTick() { //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) Person partnerP = PartnerP; string text = ((partnerP != null && D.Stage > 0) ? partnerP.Id : ""); if (text == _pinFor && (_pin == null || !_pin.IsRemoved)) { return; } try { MapPOI pin = _pin; if (pin != null) { pin.Remove(); } } catch { } _pin = null; _pinFor = text; if (text == "") { return; } NPC val = Native(text); if ((Object)(object)val == (Object)null) { _pinFor = ""; return; } try { Sprite val2 = (partnerP.Woman ? (_pinPink ?? (_pinPink = HeartSprite(new Color(1f, 0.42f, 0.7f)))) : (_pinBlue ?? (_pinBlue = HeartSprite(new Color(0.3f, 0.6f, 1f))))); _pin = new MapPOIBuilder("woodstudios.datenight:partner").WithLabel(partnerP.First + " (your " + BF(partnerP) + ")").WithTarget(((Component)val).transform).WithIcon(val2) .Build(); } catch (Exception ex) { LoveHost.Warn("Date Night map pin: " + ex.Message); } } private static void FocusTick() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) if (_focusAt < 0f || Time.unscaledTime < _focusAt) { return; } _focusAt = -1f; try { MapPOI pin = _pin; RectTransform val = ((pin != null) ? pin.UI : null); if ((Object)(object)val != (Object)null) { PlayerSingleton<MapApp>.Instance.FocusPosition(val.anchoredPosition); } } catch { } } internal static string ShowOnMap() { Person partnerP = PartnerP; if (partnerP == null || D.Stage == 0 || _pin == null || _pin.IsRemoved) { return "You're not seeing anyone yet."; } try { try { LoveApp instance = LoveApp.Instance; if (instance != null) { ((PhoneApp)instance).CloseApp(); } } catch { } ((App<MapApp>)(object)PlayerSingleton<MapApp>.Instance).SetOpen(true); _focusAt = Time.unscaledTime + 0.25f; return partnerP.First + " is the " + (partnerP.Woman ? "pink" : "blue") + " heart on your map."; } catch (Exception ex) { return "Couldn't open the map (" + ex.Message + ")."; } } private static Sprite HeartSprite(Color c) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(64, 64, (TextureFormat)4, false); Color32[] array = (Color32[])(object)new Color32[4096]; for (int i = 0; i < 64; i++) { for (int j = 0; j < 64; j++) { float num = ((float)j - 31.5f) / 26f; float num2 = ((float)i - 28f) / 26f; float num3 = num * num + Mathf.Pow(num2 - Mathf.Sqrt(Mathf.Abs(num)) * 0.75f, 2f) - 1f; Color val2 = ((num3 < -0.18f) ? c : ((num3 < 0f) ? Color.white : Color.clear)); array[i * 64 + j] = Color32.op_Implicit(val2); } } val.SetPixels32(new Il2CppStructArray<Color32>(array)); val.Apply(); ((Object)val).hideFlags = (HideFlags)32; return Sprite.Create(val, new Rect(0f, 0f, 64f, 64f), new Vector2(0.5f, 0.5f)); } private static void Daily() { if (D.DecayDay == Day) { return; } bool num = D.DecayDay < 0; D.DecayDay = Day; if (num) { return; } Person partnerP = PartnerP; foreach (string item in D.Meter.Keys.ToList()) { D.Talked.TryGetValue(item, out var value); int num2 = Day - value; bool flag = partnerP != null && partnerP.Id == item && D.Stage > 0; if (flag && D.Stage == 2) { num2 = Math.Max(0, num2 - 2); } if (num2 >= (flag ? 2 : 4)) { Add(item, flag ? (-4) : (-1), "no attention for " + num2 + " days"); } } if (partnerP != null && D.Stage > 0) { int num3 = Day - Math.Max(D.LastDate, D.Since); if (num3 == 6 && D.NudgeDay != Day) { D.NudgeDay = Day; Text(partnerP.Id, "Hey. We haven't had a date night all week. Just saying."); } if (num3 >= 7 && num3 % 7 == 0) { Add(partnerP.Id, -10, "missed the weekly date night"); } if (MeterOf(partnerP.Id) < 15) { BreakUp(partnerP, byPlayer: false); } } } internal static void OnRaid(Property prop) { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) try { Person partnerP = PartnerP; if (partnerP == null || D.Stage != 2 || D.Follow || (Object)(object)prop == (Object)null || prop.PropertyCode != D.Home || D.RaidDay == Day || MeterOf(partnerP.Id) < 30) { return; } D.RaidDay = Day; Player local = Player.Local; if ((Object)(object)local != (Object)null) { Vector3 val = ((Component)local).transform.position - ((Component)prop).transform.position; if (((Vector3)(ref val)).sqrMagnitude < 3600f) { Say(partnerP.Id, "Someone's at the door! Watch out!", 5f); return; } } Text(partnerP.Id, "Babe, there are guys trying to break in at " + prop.PropertyName + "! I'm hiding upstairs. GET HERE.", null, 0.5f); LoveHost.Notify("Incoming call: " + partnerP.First, "\"Someone's breaking into " + prop.PropertyName + "! Get back here!\""); try { NPC val2 = Native(partnerP.Id); if ((Object)(object)val2 != (Object)null) { val2.SetVisible(false, false); _hidden = true; } } catch { } } catch { } } internal static void OnBillOpen(float total) { //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) try { Person partnerP = PartnerP; if (partnerP == null || D.Stage == 0 || Day - D.BillDay < 3 || MeterOf(partnerP.Id) < 40) { return; } D.BillDay = Day; int num = Mathf.RoundToInt(total * 0.5f); if (num > 0) { Money.ChangeCashBalance((float)num, true, false); } NPC val = Native(partnerP.Id); Player local = Player.Local; if ((Object)(object)val != (Object)null && (Object)(object)local != (Object)null) { Vector3 spot = ((Component)local).transform.position + ((Component)local).transform.forward * 1.5f; NavMeshHit val2 = default(NavMeshHit); if (!FreeSpot(spot, 4f, val, out spot) && NavMesh.SamplePosition(spot, ref val2, 4f, -1)) { spot = ((NavMeshHit)(ref val2)).position; } try { val.SetVisible(true, false); val.Movement.Warp(spot); } catch { } _hidden = false; } Say(partnerP.Id, "Oh my god, are you okay? I came as fast as I could.", 6f); Text(partnerP.Id, "I picked you up from Hyland Medical and paid half the bill ($" + num + "). Please be more careful.", null, 8f); LoveHost.Notify("Date Night", partnerP.First + " picked you up from the hospital and covered $" + num + " of the bill."); } catch { } } private static void Perks() { Person partnerP = PartnerP; if (partnerP == null || D.Stage == 0 || Day - D.BailDay < 7 || MeterOf(partnerP.Id) < 60) { return; } try { if (LoveHost.BailReady()) { D.BailDay = Day; int num = LoveHost.BailCost(); LoveHost.BailOut(partnerP.First + " posted your $" + num.ToString("N0") + " bail."); Text(partnerP.Id, "I paid your bail. You owe me a really, really nice dinner.", null, 10f); } } catch { } } private static void HintUpdate() { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) _hint = null; Person partnerP = PartnerP; if (partnerP == null || D.Stage == 0) { return; } Player local = Player.Local; if ((Object)(object)local == (Object)null || Cursor.visible || Fade.On || D.DateState != 2 || !((Object)(object)_held != (Object)null)) { return; } LovePlace lovePlace = Place(D.DatePlace); float num = 3f; Vector3 val = ((Component)local).transform.position - ((Component)_held).transform.position; if (((Vector3)(ref val)).sqrMagnitude < num * num) { _hint = "[E] " + ((lovePlace != null) ? lovePlace.Prompt : "Start the date") + " with " + partnerP.First + ((lovePlace != null && lovePlace.Cost > 0) ? (" ($" + lovePlace.Cost + ")") : ""); if (LoveHost.KeyDown((KeyCode)101)) { StartDate(); } } } internal static void Draw() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) if (!LoveHost.Off) { Fade.Draw(); if (!string.IsNullOrEmpty(_hint)) { Rect val = default(Rect); ((Rect)(ref val))..ctor((float)Screen.width / 2f - 170f, (float)Screen.height * 0.72f, 340f, 32f); LoveHost.Fill(val, new Color(0.04f, 0.05f, 0.04f, 0.72f)); LoveHost.Text(val, _hint, 16, new Color(0.9f, 1f, 0.9f), (TextAnchor)4); } } } internal static string TextFlirt(Person p) { if (!Met(p.Id)) { return "Say hi to " + p.First + " in person first to get " + (p.Woman ? "her" : "his") + " number."; } if (DidToday(p.Id)) { return "You already did something with " + p.First + " today. Try again tomorrow."; } D.Texted[p.Id] = Day; D.Acted[p.Id] = Day; string msg = Openers[0][Random.Range(0, 3)]; string[] array = new string[3] { "Honestly? Just thinking about you.", "Better now that you texted.", "Wishing I was with you." }; string[] array2 = new string[3] { "Teaching my plants to talk. Slow progress.", "Losing an argument with a vending machine.", "Running from my responsibilities. You?" }; string[] array3 = new string[3] { "Planning where I'm taking you this weekend.", "Waiting for you to admit you like me.", "Come find out." }; Reply[] replies = new Reply[3] { Resp(p, array[Random.Range(0, 3)], 0), Resp(p, array2[Random.Range(0, 3)], 1), Resp(p, array3[Random.Range(0, 3)], 2) }; Text(p.Id, msg, replies, 1.5f); return p.First + " texted you back. Open Messages to reply."; } private static Reply Resp(Person p, string text, int style) { return new Reply { Text = text, Picked = delegate { bool num = style == p.Style; int num2 = (num ? 7 : ((Math.Abs(style - p.Style) == 1) ? 2 : (-2))); Add(p.Id, num2, "text flirt"); string msg = (num ? (new string[3] { "Okay, you're dangerous.", "Stop, I'm literally smiling at my phone.", "That's exactly the right answer." })[Random.Range(0, 3)] : ((num2 > 0) ? (new string[3] { "Haha okay.", "Cute.", "You're funny." })[Random.Range(0, 3)] : (new string[3] { "...okay?", "Not sure what to say to that.", "Weird flex but okay." })[Random.Range(0, 3)])); Text(p.Id, msg, null, 2f); } }; } internal static string Gift(Person p, int which) { if (!Met(p.Id)) { return "You haven't met " + p.First + " yet."; } if (D.Stage > 0 && D.Partner != p.Id) { return "You're seeing someone else."; } if (DidToday(p.Id)) { return "You already did something with " + p.First + " today. Try again tomorrow."; } (string, int, int) tuple = Gifts[which]; float num = 0f; try { num = Money.GetCashBalance(); } catch { } if (num < (float)tuple.Item2) { return "You need $" + tuple.Item2 + " cash."; } try { Money.ChangeCashBalance((float)(-tuple.Item2), true, true); } catch { } D.Gifted[p.Id] = Day; D.Acted[p.Id] = Day; Add(p.Id, tuple.Item3, "gift: " + tuple.Item1); Text(p.Id, which switch { 1 => "Chocolate. You know the way to my heart.", 0 => "Flowers?! You didn't have to. They're beautiful.", _ => "Oh my god. A necklace?! I'm wearing it right now.", }, null, 20f); return tuple.Item1 + " are on the way to " + p.First + "."; } internal static string DevState() { Person partnerP = PartnerP; return $"pref {Pref?.Value} partner {((partnerP == null) ? "-" : partnerP.First)} stage {D.Stage} dates {D.Dates} home {D.Home} date {D.DatePlace}/{D.DateDay}/{D.DateState} meters {string.Join(",", D.Meter.Select((KeyValuePair<string, int> kv) => kv.Key + "=" + kv.Value))} held {(Object)(object)_held != (Object)null} hooked {_hooked} choices {_choices.Count}"; } internal static string DevSet(string id, string meter) { D.Meter[id] = Mathf.Clamp(int.Parse(meter), 0, 100); D.Talked[id] = Day; D.MetOn[id] = Day - 3; return DevState(); } internal static string DevAskOut(string id, string _) { Person person = Find(id); if (person != null) { return AskOut(person); } return "no"; } internal static string DevDate(string place, string _) { Person partnerP = PartnerP; if (partnerP == null) { return "no partner"; } D.DateState = 0; PlanDate(partnerP, place); D.DateDay = Day; GoToDate(partnerP); return DevState(); } internal static string DevStart() { StartDate(); return DevState(); } internal static string DevMoveIn() { Person partnerP = PartnerP; if (partnerP == null) { return "no partner"; } D.Dates = Math.Max(D.Dates, 3); D.Since = Math.Min(D.Since, Day - 7); D.Meter[partnerP.Id] = Math.Max(MeterOf(partnerP.Id), 75); return AskMoveIn(partnerP); } internal static string DevText(string id, string _) { Person person = Find(id); if (person != null) { return TextFlirt(person); } return "no"; } internal static string DevRaid() { OnRaid(HomeProp()); return "raid call"; } internal static string DevBill() { D.BillDay = -100; OnBillOpen(250f); return "bill"; } internal static string DevBreak() { Person partnerP = PartnerP; if (partnerP != null) { BreakUp(partnerP, byPlayer: true); } return DevState(); } internal static string DevPhone() { try { Singleton<GameplayMenu>.Instance.Open(); LoveApp instance = LoveApp.Instance; if (instance != null) { ((PhoneApp)instance).OpenApp(); } return "phone open"; } catch (Exception ex) { return ex.Message; } } internal static string DevMessages(string id, string _) { try { Singleton<GameplayMenu>.Instance.Open(); ((App<MessagesApp>)(object)PlayerSingleton<MessagesApp>.Instance).SetOpen(true); NPC obj = Native(id); MSGConversation val = ((obj != null) ? obj.MSGConversation : null); if (val != null) { val.EnsureUIExists(); val.SetIsKnown(true); val.SetEntryVisibility(true); val.EntryClicked(); } return "messages " + id; } catch (Exception ex) { return ex.Message; } } internal static string DevPhoneClose() { try { LoveApp instance = LoveApp.Instance; if (instance != null) { ((PhoneApp)instance).CloseApp(); } Singleton<GameplayMenu>.Instance.Close(); return "phone closed"; } catch (Exception ex) { return ex.Message; } } internal static string DevTalk(string id, string _) { try { NPC obj = Native(id); RefreshChoices(); ((Component)obj).GetComponentInChildren<DialogueController>(true).Interacted(); return "talking to " + id; } catch (Exception ex) { return ex.Message; } } internal static string DevPut(string id, string _) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) try { NPC n = Native(id); Player local = Player.Local; Vector3 pos = ((Component)local).transform.position + ((Component)local).transform.forward * 1.6f; Hold(n, pos, Quaternion.LookRotation(-((Component)local).transform.forward)); _held = null; return "put " + id + " at " + ((Vector3)(ref pos)).ToString("F1"); } catch (Exception ex) { return ex.Message; } } internal static string DevFree(string id, string _) { try { NPC obj = Native(id); NavMeshAgent componentInChildren = ((Component)obj).GetComponentInChildren<NavMeshAgent>(); if ((Object)(object)componentInChildren != (Object)null) { ((Behaviour)componentInChildren).enabled = true; } foreach (NPCScheduleManager componentsInChild in ((Component)obj).GetComponentsInChildren<NPCScheduleManager>(true)) { componentsInChild.EnableSchedule(); } return "freed " + id; } catch (Exception ex) { return ex.Message; } } internal static string DevFade() { Fade.Start(string.Format(LoveHost.Places[0].Fade, PartnerP?.First ?? "your date"), null, null); return "fade"; } internal static string DevPick(string id, string idx) { try { Native(id).DialogueHandler.ChoiceSelected(int.Parse(idx)); return "picked " + idx + " | " + DevState(); } catch (Exception ex) { return ex.Message; } } internal static string DevEnd(string id, string _) { try { Native(id).DialogueHandler.EndDialogue(); return "ended"; } catch (Exception ex) { return ex.Message; } } internal static string DevClear() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) NPC val = _held ?? Native(D.Partner); if ((Object)(object)val == (Object)null) { return "none"; } Vector3 position = ((Component)val).transform.position; StringBuilder stringBuilder = new StringBuilder("at " + ((Vector3)(ref position)).ToString("F2") + " free " + Free(position, val) + " hits:"); try { foreach (Collider item in (Il2CppArrayBase<Collider>)(object)Physics.OverlapCapsule(position + Vector3.up * 0.4f, position + Vector3.up * 1.75f, 0.28f, -1, (QueryTriggerInteraction)1)) { if ((Object)(object)item != (Object)null && !((Component)item).transform.IsChildOf(((Component)val).transform)) { stringBuilder.Append(" " + ((Object)item).name); } } } catch { } return stringBuilder.ToString(); } internal static string DevFollow(string on) { Person partnerP = PartnerP; if (partnerP == null) { return "no partner"; } SetFollow(partnerP, on == "1"); return "follow " + D.Follow + " | " + DevState(); } internal static string DevWake() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) WakeBeside(); NPC val = Native(D.Partner); Player local = Player.Local; if (!((Object)(object)val == (Object)null) && !((Object)(object)local == (Object)null)) { return "dist " + Vector3.Distance(((Component)val).transform.position, ((Component)local).transform.position).ToString("F2") + " free " + Free(((Component)val).transform.position, val); } return "none"; } internal static string DevDist() { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NPC val = Native(D.Partner); Player local = Player.Local; if (!((Object)(object)val == (Object)null) && !((Object)(object)local == (Object)null)) { return "dist " + Vector3.Distance(((Component)val).transform.position, ((Component)local).transform.position).ToString("F2") + " moving " + val.Movement.IsMoving + " follow " + D.Follow + " stage " + D.Stage + " hidden " + _hidden; } return "none"; } internal static string DevWander() { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) NPC val = Native(D.Partner); Property val2 = HomeProp(); if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null) { return "none"; } bool flag = Wander(val, val2); string text = "?"; try { GameObject boundingBox = val2.BoundingBox; Collider val3 = (((Object)(object)boundingBox != (Object)null) ? boundingBox.GetComponent<Collider>() : null); object obj; if (!((Object)(object)val3 != (Object)null)) { obj = "no collider"; } else { Bounds bounds = val3.bounds; Vector3 size = ((Bounds)(ref bounds)).size; obj = ((Vector3)(ref size)).ToString("F1"); } text = (string)obj; } catch { } return "wander " + flag + " bounds " + text + " moving " + val.Movement.IsMoving; } internal static string DevMap() { return ShowOnMap() + ", pin for " + _pinFor; } } public sealed class LoveApp : PhoneApp { private static Sprite _icon; private Text _body; private float _next; private string _note = ""; internal static LoveApp Instance; private readonly List<(Love.Person p, Image bg, Text label)> _names = new List<(Love.Person, Image, Text)>(); private static readonly Color NameOff = new Color(0.18f, 0.18f, 0.22f); private static readonly Color NameOn = new Color(0.62f, 0.2f, 0.38f); private string _selId = ""; protected override string AppName => "Schedule2_DateNight"; protected override string AppTitle => "Date Night"; protected override string IconLabel => "Date Night"; protected override string IconFileName => "Schedule2_DateNight.png"; protected override Sprite IconSprite { get { //IL_0021: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_icon != (Object)null)) { return _icon = AppUi.Icon("DN", new Color(0.62f, 0.16f, 0.32f)); } return _icon; } } protected override void OnCreatedUI(GameObject container) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Unknown result type (might be due to invalid IL or missing references) //IL_03db: Unknown result type (might be due to invalid IL or missing references) //IL_0477: Unknown result type (might be due to invalid IL or missing references) //IL_0515: Unknown result type (might be due to invalid IL or missing references) Instance = this; GameObject val = UIFactory.Panel("DateNightPanel", container.transform, new Color(0.06f, 0.06f, 0.08f), (Vector2?)null, (Vector2?)null, true); AppUi.Title(val.transform, "DATE NIGHT"); int num = 0; Love.Person[] people = Love.People; Vector2 val2 = default(Vector2); foreach (Love.Person person in people) { Love.Person person2 = person; (GameObject, Button, Text) tuple = S2Ui.ButtonWithLabel("Who_" + person.Id, person.Name, val.transform, NameOff, 200f, 30f); GameObject item = tuple.Item1; Button item2 = tuple.Item2; Text item3 = tuple.Item3; RectTransform component = item.GetComponent<RectTransform>(); ((Vector2)(ref val2))..ctor(0f, 1f); component.anchorMax = val2; component.anchorMin = val2; component.pivot = new Vector2(0f, 1f); component.anchoredPosition = new Vector2(16f, (float)(-52 - num * 34)); item3.fontSize = 15; EventHelper.AddListener((Action)delegate { _selId = person2.Id; _note = ""; Fill(); }, (UnityEvent)(object)item2.onClick); _names.Add((person, item.GetComponent<Image>(), item3)); num++; } _body = AppUi.Body(val.transform, 52f, 300f); RectTransform rectTransform = ((Graphic)_body).rectTransform; rectTransform.offsetMin = new Vector2(232f, rectTransform.offsetMin.y); rectTransform.offsetMax = new Vector2(-16f, rectTransform.offsetMax.y); Color c = default(Color); ((Color)(ref c))..ctor(0.55f, 0.16f, 0.3f); Color c2 = default(Color); ((Color)(ref c2))..ctor(0.15f, 0.45f, 0.2f); Color c3 = default(Color); ((Color)(ref c3))..ctor(0.5f, 0.15f, 0.12f); Color c4 = default(Color); ((Color)(ref c4))..ctor(0.15f, 0.32f, 0.55f); AppUi.Btn(val.transform, "Text", 16f, 104f, 222f, c, delegate { Say(Love.TextFlirt(Sel())); }); AppUi.Btn(val.transform, "Ask out", 246f, 104f, 222f, c, delegate { Say(Love.AskOut(Sel())); }); AppUi.Btn(val.transform, "Move in", 476f, 104f, 222f, c2, delegate { Love.Person person3 = Sel(); Say((Love.D.Partner == person3.Id) ? Love.AskMoveIn(person3) : ("Ask " + Love.Him(person3) + " out first.")); }); AppUi.Btn(val.transform, "Find on map", 706f, 104f, 222f, new Color(0.35f, 0.3f, 0.55f), delegate { Say(Love.ShowOnMap()); }); AppUi.Btn(val.transform, "Break up", 936f, 104f, 230f, c3, delegate { Love.Person person3 = Sel(); if (Love.D.Partner == person3.Id) { Love.BreakUp(person3, byPlayer: true); Say("You broke up with " + person3.First + "."); } else { Say("You're not dating " + person3.First + "."); } }); AppUi.Btn(val.transform, "Flowers $" + Love.Gifts[0].cost, 16f, 60f, 376f, c4, delegate { Say(Love.Gift(Sel(), 0)); }); AppUi.Btn(val.transform, "Chocolates $" + Love.Gifts[1].cost, 402f, 60f, 376f, c4, delegate { Say(Love.Gift(Sel(), 1)); }); AppUi.Btn(val.transform, "Necklace $" + Love.Gifts[2].cost, 788f, 60f, 378f, c4, delegate { Say(Love.Gift(Sel(), 2)); }); LovePlace p0 = ((LoveHost.Places.Length != 0) ? LoveHost.Places[0] : null); if (p0 != null) { AppUi.Btn(val.transform, p0.Button + ((p0.Cost > 0) ? (" $" + p0.Cost) : ""), 16f, 16f, 570f, c, delegate { Say(Love.PlanDate(Sel(), p0.Key)); }); } LovePlace p1 = ((LoveHost.Places.Length > 1) ? LoveHost.Places[1] : null); if (p1 != null) { AppUi.Btn(val.transform, p1.Button + ((p1.Cost > 0) ? (" $" + p1.Cost) : ""), 596f, 16f, 570f, c, delegate { Say(Love.PlanDate(Sel(), p1.Key)); }); } Fill(); } internal static string DevOpen() { try { Singleton<GameplayMenu>.Instance.Open(); LoveApp instance = Instance; if (instance != null) { ((PhoneApp)instance).OpenApp(); } return "open"; } catch (Exception ex) { return ex.Message; } } internal static string DevClose() { try { LoveApp instance = Instance; if (instance != null) { ((PhoneApp)instance).CloseApp(); } Singleton<GameplayMenu>.Instance.Close(); return "closed"; } catch (Exception ex) { return ex.Message; } } internal static string DevPick(string id) { LoveApp instance = Instance; if (instance == null) { return "no app"; } instance._selId = id; instance.Fill(); return "picked " + id; } public static void Tick() { LoveApp instance = Instance; if (instance == null || Time.unscaledTime < instance._next) { return; } instance._next = Time.unscaledTime + 1f; try { instance.Fill(); } catch { } } private Love.Person[] List() { return Love.Eligible().ToArray(); } private Love.Person Sel() { Love.Person[] array = List(); Love.Person[] array2 = array; foreach (Love.Person person in array2) { if (person.Id == _selId) { return person; } } Love.Person partnerP = Love.PartnerP; if (partnerP != null && array.Contains(partnerP)) { _selId = partnerP.Id; return partnerP; } _selId = array[0].Id; return array[0]; } private void Say(string s) { _note = s ?? ""; Fill(); } private static string Bar(int v) { if (v < 0) { return "<color=#777777>not met yet</color>"; } int num = Mathf.RoundToInt((float)v / 10f); string text = ((v >= 70) ? "#ff6fa0" : ((v >= 40) ? "#f5bd45" : "#9a9a9a")); return "<color=" + text + ">" + new string('|', num) + "</color><color=#444444>" + new string('|', 10 - num) + "</color> " + v; } private void Fill() { //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_body == (Object)null) { return; } LoveData d = Love.D; StringBuilder stringBuilder = new StringBuilder(); DatingPick num = ((Love.Pref != null) ? Love.Pref.Value : DatingPick.Either); stringBuilder.Append("<size=13><color=#9a9a9a>Looking for: ").Append(num switch { DatingPick.Girlfriend => "a girlfriend", DatingPick.Either => "a girlfriend or boyfriend", _ => "a boyfriend", }).Append(" (Mods app > " + LoveHost.SettingsName + ")</color></size>\n\n"); Love.Person[] source = List(); Love.Person person = Sel(); int num2 = 0; foreach (var name in _names) { Love.Person item = name.p; Image item2 = name.bg; Text item3 = name.label; bool flag = source.Contains(item); ((Component)item2).gameObject.SetActive(flag); if (flag) { ((Component)item2).GetComponent<RectTransform>().anchoredPosition = new Vector2(16f, (float)(-52 - num2 * 34)); num2++; bool flag2 = d.Partner == item.Id && d.Stage > 0; ((Graphic)item2).color = ((item.Id == person.Id) ? NameOn : NameOff); item3.text = item.Name + (flag2 ? " (yours)" : ""); } } Love.Person person2 = Sel(); int num3 = Love.MeterOf(person2.Id); stringBuilder.Append("<b>").Append(person2.Name).Append("</b> ") .Append(Bar(num3)); if (d.Partner == person2.Id && d.Stage > 0) { stringBuilder.Append(" <color=#ff6fa0>your ").Append(Love.BF(person2)).Append("</color>"); } stringBuilder.Append('\n'); if (num3 >= 0 && Love.DidToday(person2.Id)) { stringBuilder.Append("<color=#9a9a9a>You've already done something with ").Append(person2.First).Append(" today. Tomorrow you can again.</color>\n"); } if (num3 < 0) { stringBuilder.Append("You haven't met ").Append(person2.First).Append(". Find ") .Append(Love.Him(person2)) .Append(" around town, talk to ") .Append(Love.Him(person2)) .Append(" and pick Flirt to get ") .Append(person2.Woman ? "her" : "his") .Append(" number.\n"); } else if (d.Partner == person2.Id && d.Stage > 0) { int num4 = Love.Day - Math.Max(d.LastDate, d.Since); stringBuilder.Append("Together ").Append(Love.Day - d.Since).Append(" day(s), ") .Append(d.Dates) .Append(" date night(s). "); stringBuilder.Append((num4 >= 6) ? "<color=#ff6050>Date night is due!</color>" : ("Next date night due in " + (7 - num4) + " day(s).")).Append('\n'); stringBuilder.Append("<color=#9a9a9a>").Append(person2.First).Append(" shows on your map as a ") .Append(person2.Woman ? "pink" : "blue") .Append(" heart.</color>\n"); if (d.Stage == 2) { Property val = Love.HomeProp(); stringBuilder.Append("Lives with you at ").Append(((Object)(object)val != (Object)null) ? val.PropertyName : "your place").Append(". Dinner's at 6.\n"); } else if (Love.CanMoveIn(person2.Id)) { stringBuilder.Append(person2.First).Append(" is ready to move in with you.\n"); } else { stringBuilder.Append("<color=#9a9a9a>Moving in: after day ").Append(Love.MoveInDay).Append(", ") .Append(3) .Append(" date nights (") .Append(d.Dates) .Append(" so far) and a meter of 75.</color>\n"); } if (d.DateState > 0) { stringBuilder.Append("<color=#9fd38a>Date: ").Append(Love.Place(d.DatePlace)?.Where ?? "your date").Append((d.DateDay == Love.Day) ? " tonight" : " tomorrow") .Append(" at 8 PM") .Append((d.DateState == 2) ? (" (" + Love.He(person2) + "'s there now)") : "") .Append(".</color>\n"); } } else { bool flag3 = Love.Day < Love.AskOutDay(person2.Id); stringBuilder.Append((num3 >= 50 && !flag3) ? (person2.First + " would say yes if you asked " + Love.Him(person2) + " out.\n") : ((num3 >= 50) ? (person2.First + " likes you. Get to know " + Love.Him(person2) + " a little longer (ask after day " + Love.AskOutDay(person2.Id) + ").\n") : ((num3 >= 35) ? (person2.First + " likes you. Keep going.\n") : "One thing a day: flirt in person, text, or send a gift.\n"))); if (num3 >= 25) { stringBuilder.Append("<color=#9a9a9a>").Append(person2.First).Append(" goes for ") .Append(person2.Like) .Append(".</color>\n"); } } if (_note.Length > 0) { stringBuilder.Append("\n<color=#9fd38a>").Append(_note).Append("</color>"); } _body.text = stringBuilder.ToString(); } } internal sealed class LovePlace { public delegate bool SpotFn(out Vector3 pos, out Quaternion face); public string Key; public string Short; public string Where; public string Choice; public string Button; public string Yes; public string Arrived; public string Prompt; public string Fade; public int Cost; public int Gain; public SpotFn Spot; public Func<Vector3?> Ground; } internal static class LoveHost { public static Func<LoveData> Data = () => new LoveData(); public static Func<int> Day = () => 0; public static Func<bool> Guest = () => false; public static Action<string> Log = delegate(string s) { MelonLogger.Msg(s); }; public static Action<string> Warn = delegate(string s) { MelonLogger.Warning(s); }; public static Action<string, string> Notify = delegate { }; public static Func<KeyCode, bool> KeyDown = (KeyCode k) => Input.GetKeyDown(k); public static Action<Rect, Color> Fill = delegate { }; public static Action<Rect, string, int, Color, TextAnchor, bool> TextFn = delegate { }; public static LovePlace[] Places = new LovePlace[0];