Ejemplo n.º 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);
         }
     }
 }
Ejemplo n.º 2
0
        private void Update()
        {
            if (!modEnabled.Value || !Player.m_localPlayer || !Player.m_localPlayer.InPlaceMode() || Hud.IsPieceSelectionVisible())
            {
                if (lastOriginalRadius != 0)
                {
                    lastOriginalRadius = 0;
                    lastModdedRadius   = 0;
                    lastTotalDelta     = 0;
                    SetRadius(0);
                }
                return;
            }

            if (useScrollWheel.Value && AedenthornUtils.CheckKeyHeld(scrollModKey.Value, false) && Input.mouseScrollDelta.y != 0)
            {
                SetRadius(Input.mouseScrollDelta.y * scrollWheelScale.Value);
            }
            else if (AedenthornUtils.CheckKeyDown(increaseHotKey.Value))
            {
                SetRadius(hotkeyScale.Value);
            }
            else if (AedenthornUtils.CheckKeyDown(decreaseHotKey.Value))
            {
                SetRadius(-hotkeyScale.Value);
            }
        }
Ejemplo n.º 3
0
            static void Postfix(Animator ___m_animator, ref Container ___m_currentContainer)
            {
                /*
                 * if(!___m_animator.GetBool("visible") && backpack != null)
                 * {
                 *  backpackInventory = backpack.GetComponent<Container>().GetInventory();
                 *  Destroy(backpack);
                 *  backpack = null;
                 *  return;
                 * }
                 */
                if (!modEnabled.Value || !AedenthornUtils.CheckKeyDown(hotKey.Value) || !Player.m_localPlayer || !___m_animator.GetBool("visible"))
                {
                    return;
                }

                if (opening)
                {
                    opening = false;
                    return;
                }

                if (___m_currentContainer != null && ___m_currentContainer == backpackContainer)
                {
                    backpackInventory     = backpackContainer.GetInventory();
                    ___m_currentContainer = null;
                }
                else if (CanOpenBackpack())
                {
                    OpenBackpack();
                }
            }
Ejemplo n.º 4
0
            static void Postfix(bool __result, Piece piece, GameObject ___m_placementGhost)
            {
                if (!modEnabled.Value || !__result || !AedenthornUtils.CheckKeyHeld(modKey.Value))
                {
                    return;
                }

                Door door = piece.gameObject.GetComponent <Door>();

                if (door)
                {
                    var pos  = ___m_placementGhost.transform.position;
                    var guid = Guid.NewGuid();
                    newDoors.Add(pos, guid);

                    if (promptNameOnCreate.Value)
                    {
                        RenameDoor(guid + "");
                    }

                    GameObject keyPrefab = ZNetScene.instance.GetPrefab("DoorKey");
                    GameObject go        = Instantiate(keyPrefab, Player.m_localPlayer.transform.position + Vector3.up, Quaternion.identity);
                    go.GetComponent <ItemDrop>().m_itemData.m_crafterName = guid + "";
                    Dbgl($"Spawned door key for door {guid} at {pos}");
                }
            }
Ejemplo n.º 5
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);
         }
     }
 }
Ejemplo n.º 6
0
            static void Postfix(Hud __instance)
            {
                if (!modEnabled.Value || !addEquipmentRow.Value || Player.m_localPlayer == null)
                {
                    return;
                }

                float gameScale = GameObject.Find("GUI").GetComponent <CanvasScaler>().scaleFactor;

                Vector3 mousePos = Input.mousePosition;

                if (!modEnabled.Value)
                {
                    lastMousePos = mousePos;
                    return;
                }

                SetElementPositions();

                if (lastMousePos == Vector3.zero)
                {
                    lastMousePos = mousePos;
                }


                Transform hudRoot = Hud.instance.transform.Find("hudroot");


                if (AedenthornUtils.CheckKeyHeld(modKeyOne.Value) && AedenthornUtils.CheckKeyHeld(modKeyTwo.Value))
                {
                    Rect quickSlotsRect = Rect.zero;
                    if (hudRoot.Find("QuickAccessBar")?.GetComponent <RectTransform>() != null)
                    {
                        quickSlotsRect = new Rect(
                            hudRoot.Find("QuickAccessBar").GetComponent <RectTransform>().anchoredPosition.x *gameScale,
                            hudRoot.Find("QuickAccessBar").GetComponent <RectTransform>().anchoredPosition.y *gameScale + Screen.height - hudRoot.Find("QuickAccessBar").GetComponent <RectTransform>().sizeDelta.y *gameScale *quickAccessScale.Value,
                            hudRoot.Find("QuickAccessBar").GetComponent <RectTransform>().sizeDelta.x *gameScale *quickAccessScale.Value *(3 / 8f),
                            hudRoot.Find("QuickAccessBar").GetComponent <RectTransform>().sizeDelta.y *gameScale *quickAccessScale.Value
                            );
                    }

                    if (quickSlotsRect.Contains(lastMousePos) && (currentlyDragging == "" || currentlyDragging == "QuickAccessBar"))
                    {
                        quickAccessX.Value += (mousePos.x - lastMousePos.x) / gameScale;
                        quickAccessY.Value += (mousePos.y - lastMousePos.y) / gameScale;
                        currentlyDragging   = "QuickAccessBar";
                    }
                    else
                    {
                        currentlyDragging = "";
                    }
                }
                else
                {
                    currentlyDragging = "";
                }

                lastMousePos = mousePos;
            }
Ejemplo n.º 7
0
 private void Update()
 {
     if (!AedenthornUtils.IgnoreKeyPresses(true) && AedenthornUtils.CheckKeyDown(hotKey.Value))
     {
         int count = repairPieces(repairRadius.Value);
         Dbgl($"Repaired {count} pieces.");
     }
 }
Ejemplo n.º 8
0
 private void Update()
 {
     if (!AedenthornUtils.IgnoreKeyPresses(true) && AedenthornUtils.CheckKeyDown(hotKey.Value))
     {
         int count = DemolishPieces(destroyRadius.Value);
         Dbgl($"Demolished {count} pieces.");
     }
 }
Ejemplo n.º 9
0
 static bool Prefix(InventoryGrid __instance, UIInputHandler element, Inventory ___m_inventory)
 {
     if (modEnabled.Value && AedenthornUtils.CheckKeyHeld(modKey.Value) && !leftClick.Value && InventoryGui.instance)
     {
         RepairClickedItem(__instance, element, ___m_inventory);
         return(false);
     }
     return(true);
 }
Ejemplo n.º 10
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);
     }
 }
Ejemplo n.º 11
0
 static bool Prefix(TerrainOp.Settings ___m_settings)
 {
     //Dbgl($"{___m_settings.m_smooth} {AedenthornUtils.CheckKeyHeld(modKey.Value)}");
     if (!modEnabled.Value || !___m_settings.m_smooth || !AedenthornUtils.CheckKeyHeld(modKey.Value))
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 12
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}");
         }
     }
 }
Ejemplo n.º 13
0
        private void Update()
        {
            if (!modEnabled.Value || AedenthornUtils.IgnoreKeyPresses() || toggleClockKeyOnPress.Value || !PressedToggleKey())
            {
                return;
            }

            bool show = showingClock.Value;

            showingClock.Value = !show;
            Config.Save();
        }
Ejemplo n.º 14
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();
            }
        }
Ejemplo n.º 15
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);
     }
 }
Ejemplo n.º 16
0
            static bool Prefix(Door __instance, ZNetView ___m_nview, bool __result, Humanoid character)
            {
                if (!modEnabled.Value || ___m_nview.GetZDO() == null || !(character is Player) || !___m_nview.GetZDO().GetBool("LockedDoor"))
                {
                    return(true);
                }

                string guid = ___m_nview.GetZDO().GetString("DoorGUID");

                Dbgl($"trying to open door {___m_nview.GetZDO().GetString("DoorGUID")}");
                if (AedenthornUtils.CheckKeyHeld(modKey.Value) && (character as Player).GetInventory().GetAllItems().Exists(i => i.m_crafterName == guid))
                {
                    ___m_nview.GetZDO().Set("DoorLocked", !___m_nview.GetZDO().GetBool("DoorLocked"));
                    __result = true;
                    character.Message(MessageHud.MessageType.Center, string.Format(lockedMessage.Value, ___m_nview.GetZDO().GetBool("DoorLocked")), 0, null);

                    Dbgl($"Door locked: {___m_nview.GetZDO().GetBool("DoorLocked")}");
                    return(false);
                }
                else if (AedenthornUtils.CheckKeyHeld(renameModKey.Value) && (character as Player).GetInventory().GetAllItems().Exists(i => i.m_crafterName == guid))
                {
                    __result = true;

                    RenameDoor(guid);

                    Dbgl($"Door name set to : {___m_nview.GetZDO().GetBool("DoorLocked")}");
                    return(false);
                }
                else if (___m_nview.GetZDO().GetBool("DoorLocked") && (needKeyToClose.Value || ___m_nview.GetZDO().GetInt("state", 0) == 0))
                {
                    Dbgl($"Trying to open door {___m_nview.GetZDO().GetString("DoorGUID")} {(character as Player).GetInventory().GetAllItems().Find(i => i.m_crafterName == ___m_nview.GetZDO().GetString("DoorGUID"))?.m_crafterName}");

                    if (!(character as Player).GetInventory().GetAllItems().Exists(i => i.m_crafterName == ___m_nview.GetZDO().GetString("DoorGUID")))
                    {
                        __instance.m_lockedEffects.Create(__instance.transform.position, __instance.transform.rotation, null, 1f);
                        character.Message(MessageHud.MessageType.Center, Localization.instance.Localize("$msg_door_needkey", new string[]
                        {
                            GetDoorName(guid)
                        }), 0, null);
                        __result = true;
                        Dbgl($"player doesn't have key for {__instance.transform.position}");
                        return(false);
                    }
                    else
                    {
                        Dbgl($"player has key for {__instance.transform.position}");
                    }
                }

                return(true);
            }
Ejemplo n.º 17
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);
                    }
                }
            }
        }
Ejemplo n.º 18
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));
            }
        }
Ejemplo n.º 19
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);
            }
Ejemplo n.º 20
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);
            }
Ejemplo n.º 21
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);
                }
            }
Ejemplo n.º 22
0
        private void Update()
        {
            if (!modEnabled.Value || Player.m_localPlayer == null || !Traverse.Create(Player.m_localPlayer).Method("TakeInput").GetValue <bool>())
            {
                return;
            }

            if (AedenthornUtils.CheckKeyDown(hotKey.Value))
            {
                Dbgl($"pressed hotkey");
                lastHereFishy = Time.realtimeSinceStartup;
                ((ZSyncAnimation)typeof(Player).GetField("m_zanim", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(Player.m_localPlayer)).SetTrigger("gpower");
                if (playHereFishy.Value)
                {
                    Destroy(Player.m_localPlayer.gameObject.GetComponent <AudioSource>());
                    AudioSource playerAudio = Player.m_localPlayer.gameObject.AddComponent <AudioSource>();
                    playerAudio.volume       = Mathf.Clamp(hereFishyVolume.Value, 0.1f, 1f);
                    playerAudio.clip         = fishyClip;
                    playerAudio.loop         = false;
                    playerAudio.spatialBlend = 1f;
                    playerAudio.Play();
                }
                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 && !hereFishyFishies.Contains(fish.gameObject))
                        {
                            //Dbgl($"closest fishy");
                            closest     = distance;
                            closestFish = fish;
                        }
                    }
                }
                if (closestFish != null)
                {
                    Dbgl($"got closest fishy at {closestFish.gameObject.transform.position}");

                    StartCoroutine(FishJump(closestFish, fishyClip.length));
                }
            }
        }
Ejemplo n.º 23
0
            static bool Prefix(Vector3 pos, TerrainOp.Settings modifier, bool ___m_initialized)
            {
                if (!___m_initialized)
                {
                    return(false);
                }

                if (!modEnabled.Value || !modifier.m_smooth || !AedenthornUtils.CheckKeyHeld(modKey.Value))
                {
                    return(true);
                }

                ResetTerrain(pos, toolRadius.Value > 0 ? toolRadius.Value : modifier.GetRadius());

                return(false);
            }
            static bool Prefix(Bed __instance, Humanoid human, bool repeat, ref bool __result, ZNetView ___m_nview)
            {
                if (___m_nview.GetZDO().GetLong("owner", 0L) == Game.instance.GetPlayerProfile().GetPlayerID())
                {
                    return(true);
                }
                if (repeat || !AedenthornUtils.CheckKeyHeld(modKey.Value) || (unclaimedOnly.Value && ___m_nview.GetZDO().GetLong("owner", 0L) != 0))
                {
                    Dbgl($"something's wrong: {repeat} {!AedenthornUtils.CheckKeyHeld(modKey.Value)} {unclaimedOnly.Value && ___m_nview.GetZDO().GetLong("owner", 0L) != 0}");
                    return(true);
                }
                Dbgl($"trying to sleep on bed");

                Player player = human as Player;

                if (!EnvMan.instance.IsAfternoon() && !EnvMan.instance.IsNight())
                {
                    human.Message(MessageHud.MessageType.Center, "$msg_cantsleep", 0, null);
                    __result = false;
                    return(false);
                }
                if (!Traverse.Create(__instance).Method("CheckEnemies", new object[] { player }).GetValue <bool>())
                {
                    __result = false;
                    return(false);
                }
                if (!Traverse.Create(__instance).Method("CheckExposure", new object[] { player }).GetValue <bool>())
                {
                    __result = false;
                    return(false);
                }
                if (!Traverse.Create(__instance).Method("CheckFire", new object[] { player }).GetValue <bool>())
                {
                    __result = false;
                    return(false);
                }
                if (!Traverse.Create(__instance).Method("CheckWet", new object[] { player }).GetValue <bool>())
                {
                    __result = false;
                    return(false);
                }
                human.AttachStart(__instance.m_spawnPoint, true, true, "attach_bed", new Vector3(0f, 0.5f, 0f));
                __result = false;
                return(false);
            }
Ejemplo n.º 25
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);
            }
        }
Ejemplo n.º 26
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 });
                    }
                }
            }
        }
Ejemplo n.º 27
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();
                }
            }
        }
Ejemplo n.º 28
0
        private void Update()
        {
            if (modEnabled.Value && Player.m_localPlayer != null && AedenthornUtils.CheckKeyHeld(modKey.Value, true) && (AedenthornUtils.CheckKeyDown(deleteKey.Value) || AedenthornUtils.CheckKeyDown(checkKey.Value)))
            {
                Dbgl($"modkey {AedenthornUtils.CheckKeyHeld(modKey.Value, true)}, del key {AedenthornUtils.CheckKeyDown(deleteKey.Value)}, check key {AedenthornUtils.CheckKeyDown(checkKey.Value)}");

                LayerMask layerMask = LayerMask.GetMask(layerMaskString.Value.Split(','));

                RaycastHit raycastHit;
                if (Physics.Raycast(GameCamera.instance.transform.position, GameCamera.instance.transform.forward, out raycastHit, maxDeleteDistance.Value) &&
                    Vector3.Distance(raycastHit.point, Player.m_localPlayer.m_eye.position) < maxDeleteDistance.Value)
                {
                    Transform t = raycastHit.collider.transform;

                    while (t.parent.parent && t.parent.name != "_NetSceneRoot" && !t.name.Contains("(Clone)"))
                    {
                        Dbgl($"name: {t.name}, parent name: {t.parent.name}");
                        t = t.parent;
                    }

                    string name = ZNetView.GetPrefabName(t.gameObject);

                    if (AedenthornUtils.CheckKeyDown(checkKey.Value))
                    {
                        Player.m_localPlayer.Message(MessageHud.MessageType.Center, string.Format(checkMessage.Value, name, Vector3.Distance(raycastHit.point, Player.m_localPlayer.m_eye.position)));
                        return;
                    }
                    else if (t.GetComponent <ZNetView>())
                    {
                        t.GetComponent <ZNetView>().Destroy();
                    }
                    else
                    {
                        Destroy(t.gameObject);
                    }
                    Player.m_localPlayer.Message(MessageHud.MessageType.Center, string.Format(deletedMessage.Value, name, Vector3.Distance(raycastHit.point, Player.m_localPlayer.m_eye.position)));
                }
            }
        }
Ejemplo n.º 29
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() });
                }
            }
        }
Ejemplo n.º 30
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();
            }
        }