Beispiel #1
0
            static bool Prefix(TeeterGameCtr __instance, ref int ___gameScores, ref bool ___waitForInput)
            {
                if (!enabled || !settings.ReplaceTeeterTotterGame || !CanTeeterInteract(lastTeeterActor))
                {
                    return(true);
                }
                int num = ___gameScores;

                if (lastAnim == rightAnim)
                {
                    num = Mathf.Clamp(num + 1, -4, 4);
                    __instance.OnActorSpeak(false, LikeLists[new System.Random().Next(0, LikeLists.Length)]);
                }
                else
                {
                    num = Mathf.Clamp(num - 1, -4, 4);
                    __instance.OnActorSpeak(false, DislikeLists[new System.Random().Next(0, DislikeLists.Length)]);
                }
                ___gameScores   = num;
                ___waitForInput = false;
                return(false);
            }
Beispiel #2
0
            static bool Prefix(TeeterGameCtr __instance, bool ___playing, ref bool ___waitForInput, ref float ___startInputTime, ref float ___curTime, ref TeeterActorCtr ___player, ref TeeterActorCtr ___npc)
            {
                if (!enabled || !settings.ReplaceTeeterTotterGame || !CanTeeterInteract(lastTeeterActor))
                {
                    return(true);
                }

                if (___playing)
                {
                    __instance.StopJump(null);
                    if (___waitForInput)
                    {
                        MethodInfo dynMethod = __instance.GetType().GetMethod("ScoreChange", BindingFlags.NonPublic | BindingFlags.Instance);
                        if (Input.GetKeyDown(settings.KissKey))
                        {
                            lastAnim = 1;
                            DoInteract(Player.Self.actor, lastTeeterActor, lastAnim);
                            dynMethod.Invoke(__instance, new object[] { 0 });
                        }
                        else if (Input.GetKeyDown(settings.HugKey))
                        {
                            lastAnim = 0;
                            DoInteract(Player.Self.actor, lastTeeterActor, lastAnim);
                            dynMethod.Invoke(__instance, new object[] { 0 });
                        }
                        else if (Input.GetKeyDown(settings.MassageKey))
                        {
                            lastAnim = 2;
                            DoInteract(Player.Self.actor, lastTeeterActor, lastAnim);
                            dynMethod.Invoke(__instance, new object[] { 0 });
                        }
                        ___startInputTime += Time.deltaTime;
                        if (___startInputTime >= OtherConfig.Self.TeetGameWaitTime)
                        {
                            lastAnim = 999;
                            dynMethod.Invoke(__instance, new object[] { 0 });
                            ___waitForInput = false;
                        }
                    }
                    else
                    {
                        ___startInputTime = 0f;
                        if (!isInteracting && __instance.OnActorSpeak != null)
                        {
                            System.Random rand = new System.Random();
                            int           idx  = rand.Next(0, 3);
                            rightAnim = idx;
                            __instance.OnActorSpeak(false, InteractDlg[Interacts[idx]]);
                            startNotInputTime = 0f;
                            ___waitForInput   = true;
                        }
                    }
                    ___curTime += Time.deltaTime;
                    if (___curTime >= OtherConfig.Self.TeetGameTime)
                    {
                        ___playing        = false;
                        teeterGameRunning = false;
                        lastTeeterActor   = null;
                        MethodInfo dynMethod2 = __instance.GetType().GetMethod("EndGame", BindingFlags.NonPublic | BindingFlags.Instance);
                        dynMethod2.Invoke(__instance, new object[] { 0 });
                    }
                }

                return(false);
            }