예제 #1
0
 private void Update()
 {
     if (!modEnabled.Value || AedenthornUtils.IgnoreKeyPresses())
     {
         return;
     }
     if (CheckKeyDown(hotKey.Value))
     {
         OpenContainers(0);
     }
     else if (InventoryGui.instance?.IsContainerOpen() == true)
     {
         if (CheckKeyDown(previousKey.Value))
         {
             ((Container)typeof(InventoryGui).GetField("m_currentContainer", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(InventoryGui.instance)).SetInUse(false);
             OpenContainers(-1);
         }
         else if (CheckKeyDown(nextKey.Value))
         {
             ((Container)typeof(InventoryGui).GetField("m_currentContainer", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(InventoryGui.instance)).SetInUse(false);
             OpenContainers(1);
         }
         else if (CheckKeyDown(previousTypeKey.Value))
         {
             ((Container)typeof(InventoryGui).GetField("m_currentContainer", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(InventoryGui.instance)).SetInUse(false);
             OpenContainerType(-1);
         }
         else if (CheckKeyDown(nextTypeKey.Value))
         {
             ((Container)typeof(InventoryGui).GetField("m_currentContainer", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(InventoryGui.instance)).SetInUse(false);
             OpenContainerType(1);
         }
     }
 }
예제 #2
0
 private void Update()
 {
     if (!modEnabled.Value || AedenthornUtils.IgnoreKeyPresses(true))
     {
         return;
     }
     if (AedenthornUtils.CheckKeyDown(hotKey.Value))
     {
         float   closest      = attachDistance.Value;
         Vagon   closestVagon = null;
         Vector3 position     = Player.m_localPlayer.transform.position + Vector3.up;
         foreach (Collider collider in Physics.OverlapSphere(position, attachDistance.Value))
         {
             Vagon v = collider.transform.parent.gameObject.GetComponent <Vagon>();
             if (collider?.attachedRigidbody && v != null && Vector3.Distance(collider.ClosestPoint(position), position) < closest && (v.IsAttached(Player.m_localPlayer) || !v.InUse()))
             {
                 Dbgl("Got nearby cart");
                 closest      = Vector3.Distance(collider.ClosestPoint(position), position);
                 closestVagon = collider.transform.parent.gameObject.GetComponent <Vagon>();
             }
         }
         if (closestVagon != null)
         {
             closestVagon.Interact(Player.m_localPlayer, false, false);
         }
     }
 }
예제 #3
0
 private void Update()
 {
     if (!AedenthornUtils.IgnoreKeyPresses(true) && AedenthornUtils.CheckKeyDown(hotKey.Value))
     {
         int count = repairPieces(repairRadius.Value);
         Dbgl($"Repaired {count} pieces.");
     }
 }
예제 #4
0
 private void Update()
 {
     if (!AedenthornUtils.IgnoreKeyPresses(true) && AedenthornUtils.CheckKeyDown(hotKey.Value))
     {
         int count = DemolishPieces(destroyRadius.Value);
         Dbgl($"Demolished {count} pieces.");
     }
 }
예제 #5
0
 private void Update()
 {
     if (AedenthornUtils.CheckKeyDown(toggleKey.Value) && !AedenthornUtils.IgnoreKeyPresses(true))
     {
         isOn.Value = !isOn.Value;
         Config.Save();
         Player.m_localPlayer.Message(MessageHud.MessageType.Center, string.Format(toggleString.Value, isOn.Value), 0, null);
     }
 }
예제 #6
0
 private void Update()
 {
     if (!AedenthornUtils.IgnoreKeyPresses() && AedenthornUtils.CheckKeyDown(toggleModKey.Value))
     {
         modEnabled.Value = !modEnabled.Value;
         Dbgl($"Repeat Actions: {modEnabled.Value}");
         if (Player.m_localPlayer)
         {
             Player.m_localPlayer.Message(MessageHud.MessageType.TopLeft, $"Repeat Actions: {modEnabled.Value}");
         }
     }
 }
예제 #7
0
        private void Update()
        {
            if (!modEnabled.Value || AedenthornUtils.IgnoreKeyPresses() || toggleClockKeyOnPress.Value || !PressedToggleKey())
            {
                return;
            }

            bool show = showingClock.Value;

            showingClock.Value = !show;
            Config.Save();
        }
예제 #8
0
 private void Update()
 {
     if (!modEnabled.Value || AedenthornUtils.IgnoreKeyPresses())
     {
         return;
     }
     if (CheckKeyDown(toggleKey.Value))
     {
         isOn.Value = !isOn.Value;
         Config.Save();
         Player.m_localPlayer.Message(MessageHud.MessageType.Center, string.Format(toggleString.Value, isOn.Value), 0, null);
     }
 }
예제 #9
0
        private void Update()
        {
            if (!modEnabled.Value || !Player.m_localPlayer || !ZNetScene.instance)
            {
                return;
            }

            if (!AedenthornUtils.IgnoreKeyPresses(true) && AedenthornUtils.CheckKeyDown(hotKey.Value) && CanOpenBackpack())
            {
                opening = true;
                OpenBackpack();
            }
        }
예제 #10
0
        private void Update()
        {
            if (!modEnabled.Value || AedenthornUtils.IgnoreKeyPresses())
            {
                return;
            }

            if (AedenthornUtils.CheckKeyDown(hotKey.Value))
            {
                Dbgl($"pressed hotkey");
                Traverse.Create(Player.m_localPlayer).Field("m_guardianPowerCooldown").SetValue(0);
                float closest     = maxFishyDistance.Value;
                Fish  closestFish = null;
                foreach (Collider collider in Physics.OverlapSphere(Player.m_localPlayer.transform.position, maxFishyDistance.Value))
                {
                    Fish fish = collider.transform.parent?.gameObject?.GetComponent <Fish>();
                    if (fish?.GetComponent <ZNetView>()?.IsValid() == true)
                    {
                        //Dbgl($"got fishy at {fish.gameObject.transform.position}");

                        float distance = Vector3.Distance(Player.m_localPlayer.transform.position, fish.gameObject.transform.position);
                        if (distance < closest)
                        {
                            //Dbgl($"closest fishy");
                            closest     = distance;
                            closestFish = fish;
                        }
                    }
                }
                if (closestFish != null)
                {
                    Dbgl($"got closest fishy at {closestFish.gameObject.transform.position}");

                    currentFish = closestFish;
                    if (playHereFishy.Value && fishyClip != null)
                    {
                        hereFishying = true;

                        ((ZSyncAnimation)typeof(Player).GetField("m_zanim", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(Player.m_localPlayer)).SetTrigger("gpower");

                        AudioSource.PlayClipAtPoint(fishyClip, Player.m_localPlayer.transform.position, Mathf.Clamp(hereFishyVolume.Value, 0.1f, 1f));
                        Invoke("StartJump", fishyClip.length);
                    }
                    else
                    {
                        Invoke("StartJump", 1);
                    }
                }
            }
        }
예제 #11
0
        private void Update()
        {
            if (!modEnabled.Value || AedenthornUtils.IgnoreKeyPresses(true) || !AedenthornUtils.CheckKeyDown(hotKey.Value) || !Player.m_localPlayer)
            {
                return;
            }

            int resets = ResetTerrain(Player.m_localPlayer.transform.position, hotKeyRadius.Value);

            if (resetMessage.Value.Length > 0 && resetMessage.Value.Contains("{0}"))
            {
                Player.m_localPlayer.Message(MessageHud.MessageType.Center, string.Format(resetMessage.Value, resets));
            }
        }
예제 #12
0
            static bool Prefix(Player __instance)
            {
                if (!modEnabled.Value || AedenthornUtils.IgnoreKeyPresses())
                {
                    return(true);
                }

                int which;

                if (AedenthornUtils.CheckKeyDown(hotKey1.Value))
                {
                    which = 1;
                }
                else if (AedenthornUtils.CheckKeyDown(hotKey2.Value))
                {
                    which = 2;
                }
                else if (AedenthornUtils.CheckKeyDown(hotKey3.Value))
                {
                    which = 3;
                }
                else if (AedenthornUtils.CheckKeyDown(hotKey4.Value))
                {
                    which = 4;
                }
                else if (AedenthornUtils.CheckKeyDown(hotKey5.Value))
                {
                    which = 5;
                }
                else if (AedenthornUtils.CheckKeyDown(hotKey6.Value))
                {
                    which = 6;
                }
                else if (AedenthornUtils.CheckKeyDown(hotKey7.Value))
                {
                    which = 7;
                }
                else if (AedenthornUtils.CheckKeyDown(hotKey8.Value))
                {
                    which = 8;
                }
                else
                {
                    return(true);
                }

                usingHotkey = true;
                __instance.UseHotbarItem(which);
                return(false);
            }
예제 #13
0
            static void Postfix(Player __instance, Inventory ___m_inventory)
            {
                if (!modEnabled.Value)
                {
                    return;
                }

                int height = extraRows.Value + (addEquipmentRow.Value ? 5 : 4);

                AccessTools.FieldRefAccess <Inventory, int>(___m_inventory, "m_height") = height;
                __instance.m_tombstone.GetComponent <Container>().m_height = height;


                if (AedenthornUtils.IgnoreKeyPresses(true) || !addEquipmentRow.Value)
                {
                    return;
                }

                if (AedenthornUtils.CheckKeyDown("9"))
                {
                    CreateTombStone();
                }

                int which;

                if (AedenthornUtils.CheckKeyDown(hotKey1.Value))
                {
                    which = 1;
                }
                else if (AedenthornUtils.CheckKeyDown(hotKey2.Value))
                {
                    which = 2;
                }
                else if (AedenthornUtils.CheckKeyDown(hotKey3.Value))
                {
                    which = 3;
                }
                else
                {
                    return;
                }

                ItemDrop.ItemData itemAt = ___m_inventory.GetItemAt(which + 4, ___m_inventory.GetHeight() - 1);
                if (itemAt != null)
                {
                    __instance.UseItem(null, itemAt, false);
                }
            }
예제 #14
0
            static bool Prefix(Player __instance)
            {
                if (!modEnabled.Value || AedenthornUtils.IgnoreKeyPresses())
                {
                    return(true);
                }

                if (AedenthornUtils.CheckKeyDown(hotKey1.Value))
                {
                    __instance.UseHotbarItem(1);
                }
                else if (AedenthornUtils.CheckKeyDown(hotKey2.Value))
                {
                    __instance.UseHotbarItem(2);
                }
                else if (AedenthornUtils.CheckKeyDown(hotKey3.Value))
                {
                    __instance.UseHotbarItem(3);
                }
                else if (AedenthornUtils.CheckKeyDown(hotKey4.Value))
                {
                    __instance.UseHotbarItem(4);
                }
                else if (AedenthornUtils.CheckKeyDown(hotKey5.Value))
                {
                    __instance.UseHotbarItem(5);
                }
                else if (AedenthornUtils.CheckKeyDown(hotKey6.Value))
                {
                    __instance.UseHotbarItem(6);
                }
                else if (AedenthornUtils.CheckKeyDown(hotKey7.Value))
                {
                    __instance.UseHotbarItem(7);
                }
                else if (AedenthornUtils.CheckKeyDown(hotKey8.Value))
                {
                    __instance.UseHotbarItem(8);
                }
                else
                {
                    return(true);
                }

                usingHotkey = true;

                return(false);
            }
예제 #15
0
        private void Update()
        {
            if (!modEnabled.Value || Player.m_localPlayer == null || AedenthornUtils.IgnoreKeyPresses())
            {
                return;
            }


            if (AedenthornUtils.CheckKeyDown(manualRegenKey.Value))
            {
                if (Player.m_localPlayer.InInterior())
                {
                    Dbgl($"Player in dungeon, aborting ({Player.m_localPlayer.transform.position})");
                    return;
                }
                RegenDungeons(true);
            }
        }
예제 #16
0
        private void Update()
        {
            if (!modEnabled.Value)
            {
                return;
            }
            if (testing.Value)
            {
                if (AedenthornUtils.CheckKeyDown(openUIKey.Value))
                {
                    storeOpen = !storeOpen;
                }
                return;
            }
            if (ZNet.instance && Player.m_localPlayer && !AedenthornUtils.IgnoreKeyPresses(true) && AedenthornUtils.CheckKeyDown(openUIKey.Value))
            {
                Dbgl("Pressed hotkey");
                if (storeOpen)
                {
                    Traverse.Create(GameCamera.instance).Field("m_mouseCapture").SetValue(true);
                    Cursor.lockState = CursorLockMode.Locked;
                    Cursor.visible   = false;

                    Dbgl("Closing store");
                    storeOpen = false;
                }
                else
                {
                    ZRpc serverRPC = ZNet.instance.GetServerRPC();
                    if (serverRPC != null)
                    {
                        Dbgl("Requesting store data");
                        JsonCommand command = new JsonCommand()
                        {
                            command = "RequestStoreInfo",
                            id      = SteamUser.GetSteamID().ToString()
                        };
                        string commandJson = JsonUtility.ToJson(command);
                        Dbgl(commandJson);
                        serverRPC.Invoke("SendServerRewardsJSON", new object[] { commandJson });
                    }
                }
            }
        }
예제 #17
0
        private void Update()
        {
            if (!modEnabled.Value || AedenthornUtils.IgnoreKeyPresses(true))
            {
                return;
            }
            if (AedenthornUtils.CheckKeyDown(hairToggleKey.Value))
            {
                showHair.Value = !showHair.Value;
                Config.Save();
                if (hairToggleString.Value.Length > 0)
                {
                    Player.m_localPlayer.Message(MessageHud.MessageType.Center, string.Format(hairToggleString.Value, showHair.Value), 0, null);
                }

                VisEquipment ve = (VisEquipment)typeof(Humanoid).GetField("m_visEquipment", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(Player.m_localPlayer);
                Traverse.Create(ve).Field("m_helmetHideHair").SetValue(!showHair.Value);
                GameObject helmet = Traverse.Create(ve).Field("m_helmetItemInstance").GetValue <GameObject>();
                if (helmet != null)
                {
                    Traverse.Create(ve).Method("UpdateEquipmentVisuals").GetValue();
                }
            }
            else if (AedenthornUtils.CheckKeyDown(beardToggleKey.Value))
            {
                showBeard.Value = !showBeard.Value;
                Config.Save();
                if (beardToggleString.Value.Length > 0)
                {
                    Player.m_localPlayer.Message(MessageHud.MessageType.Center, string.Format(beardToggleString.Value, showBeard.Value), 0, null);
                }

                VisEquipment ve     = (VisEquipment)typeof(Humanoid).GetField("m_visEquipment", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(Player.m_localPlayer);
                GameObject   helmet = Traverse.Create(ve).Field("m_helmetItemInstance").GetValue <GameObject>();
                if (helmet != null)
                {
                    Traverse.Create(ve).Method("UpdateEquipmentVisuals").GetValue();
                }
            }
        }
예제 #18
0
        private void Update()
        {
            if (!modEnabled.Value || !Player.m_localPlayer || !ZNetScene.instance)
            {
                return;
            }

            if (backpack)
            {
                if (!saving && backpack.transform.parent != Player.m_localPlayer.transform)
                {
                    Dbgl("Moving backpack to player");
                    backpack.transform.SetParent(Player.m_localPlayer.transform);
                    InitBackpack();
                }
                if (!AedenthornUtils.IgnoreKeyPresses(true) && AedenthornUtils.CheckKeyDown(hotKey.Value))
                {
                    opening = true;
                    Traverse.Create(backpack.GetComponent <Container>()).Field("m_nview").GetValue <ZNetView>().ClaimOwnership();
                    Traverse.Create(backpack.GetComponent <Container>()).Field("m_nview").GetValue <ZNetView>().InvokeRPC("RequestOpen", new object[] { Player.m_localPlayer.GetPlayerID() });
                }
            }
        }
예제 #19
0
        private void Update()
        {
            if (modEnabled.Value && !AedenthornUtils.IgnoreKeyPresses(true) && AedenthornUtils.CheckKeyDown(hotKey.Value))
            {
                int gridHeight = Player.m_localPlayer.GetInventory().GetHeight();
                int rows       = Math.Max(1, Math.Min(gridHeight, rowsToSwitch.Value));

                List <ItemDrop.ItemData> items = Traverse.Create(Player.m_localPlayer.GetInventory()).Field("m_inventory").GetValue <List <ItemDrop.ItemData> >();
                for (int i = 0; i < items.Count; i++)
                {
                    if (items[i].m_gridPos.y >= rows)
                    {
                        continue;
                    }
                    items[i].m_gridPos.y--;
                    if (items[i].m_gridPos.y < 0)
                    {
                        items[i].m_gridPos.y = rows - 1;
                    }
                }
                Traverse.Create(Player.m_localPlayer.GetInventory()).Method("Changed").GetValue();
            }
        }
예제 #20
0
 private void Update()
 {
     /*
      * if (AedenthornUtils.CheckKeyDown(openUIKey.Value))
      * {
      *  storeOpen = !storeOpen;
      *
      * }
      * return;
      */
     if (ZNet.instance && Player.m_localPlayer && !AedenthornUtils.IgnoreKeyPresses(true) && AedenthornUtils.CheckKeyDown(openUIKey.Value))
     {
         Dbgl("Pressed hotkey");
         if (storeOpen)
         {
             Dbgl("Closing store");
             storeOpen = false;
         }
         else
         {
             ZRpc serverRPC = ZNet.instance.GetServerRPC();
             if (serverRPC != null)
             {
                 Dbgl("Requesting store data");
                 JsonCommand command = new JsonCommand()
                 {
                     command = "RequestStoreInfo",
                     id      = SteamUser.GetSteamID().ToString()
                 };
                 string commandJson = JsonUtility.ToJson(command);
                 Dbgl(commandJson);
                 serverRPC.Invoke("SendServerRewardsJSON", new object[] { commandJson });
             }
         }
     }
 }
예제 #21
0
 private void Update()
 {
     if (!AedenthornUtils.IgnoreKeyPresses(true) && AedenthornUtils.CheckKeyDown(hotKey.Value))
     {
         Player player = Player.m_localPlayer;
         Dbgl($"Ka-boom");
         Collider[] array = Physics.OverlapSphere(player.transform.position, destroyRadius.Value, destroyMask);
         for (int i = 0; i < array.Length; i++)
         {
             Piece piece = array[i].GetComponentInParent <Piece>();
             if (piece)
             {
                 if (!piece.IsCreator())
                 {
                     continue;
                 }
                 if (!piece.m_canBeRemoved)
                 {
                     continue;
                 }
                 if (Location.IsInsideNoBuildLocation(piece.transform.position))
                 {
                     continue;
                 }
                 if (!PrivateArea.CheckAccess(piece.transform.position, 0f, true))
                 {
                     continue;
                 }
                 if (!Traverse.Create(player).Method("CheckCanRemovePiece", new object[] { piece }).GetValue <bool>())
                 {
                     continue;
                 }
                 ZNetView component = piece.GetComponent <ZNetView>();
                 if (component == null)
                 {
                     continue;
                 }
                 if (!piece.CanBeRemoved())
                 {
                     continue;
                 }
                 WearNTear component2 = piece.GetComponent <WearNTear>();
                 if (component2)
                 {
                     component2.Remove();
                 }
                 else
                 {
                     component.ClaimOwnership();
                     piece.DropResources();
                     piece.m_placeEffect.Create(piece.transform.position, piece.transform.rotation, piece.gameObject.transform, 1f);
                     player.m_removeEffects.Create(piece.transform.position, Quaternion.identity, null, 1f);
                     ZNetScene.instance.Destroy(piece.gameObject);
                 }
                 ItemDrop.ItemData rightItem = player.GetRightItem();
                 if (rightItem != null)
                 {
                     player.FaceLookDirection();
                     Traverse.Create(player).Field("m_zanim").GetValue <ZSyncAnimation>().SetTrigger(rightItem.m_shared.m_attack.m_attackAnimation);
                 }
             }
         }
     }
 }