private static Boolean isValidPlacement()
        {
            bool water = component.m_waterPiece || component.m_noInWater;

            PlayerInstance.m_placementStatus = 0;

            if (component.m_groundOnly || component.m_groundPiece || component.m_cultivatedGroundOnly)
            {
                PlayerInstance.m_placementMarkerInstance.SetActive(false);
            }

            StationExtension component2 = component.GetComponent <StationExtension>();

            if (component2 != null)
            {
                CraftingStation craftingStation = component2.FindClosestStationInRange(component.transform.position);
                if (craftingStation)
                {
                    component2.StartConnectionEffect(craftingStation);
                }
                else
                {
                    component2.StopConnectionEffect();
                    PlayerInstance.m_placementStatus = Player.PlacementStatus.ExtensionMissingStation; // Missing Station
                }
                if (component2.OtherExtensionInRange(component.m_spaceRequirement))
                {
                    PlayerInstance.m_placementStatus = Player.PlacementStatus.MoreSpace; // More Space
                }
            }

            if (component.m_onlyInTeleportArea && !EffectArea.IsPointInsideArea(component.transform.position, EffectArea.Type.Teleport, 0f))
            {
                PlayerInstance.m_placementStatus = Player.PlacementStatus.NoTeleportArea;
            }
            if (!component.m_allowedInDungeons && (component.transform.position.y > 3000f))
            {
                PlayerInstance.m_placementStatus = Player.PlacementStatus.NotInDungeon;
            }
            if (Location.IsInsideNoBuildLocation(PlayerInstance.m_placementGhost.transform.position))
            {
                PlayerInstance.m_placementStatus = Player.PlacementStatus.NoBuildZone;
            }
            float radius = component.GetComponent <PrivateArea>() ? component.GetComponent <PrivateArea>().m_radius : 0f;

            if (!PrivateArea.CheckAccess(PlayerInstance.m_placementGhost.transform.position, radius, true))
            {
                PlayerInstance.m_placementStatus = Player.PlacementStatus.PrivateZone;
            }

            if (PlayerInstance.m_placementStatus != 0)
            {
                component.SetInvalidPlacementHeightlight(true);
            }
            else
            {
                component.SetInvalidPlacementHeightlight(false);
            }
            return(true);
        }
Esempio n. 2
0
    // Token: 0x06000D0A RID: 3338 RVA: 0x0005D01C File Offset: 0x0005B21C
    public string GetHoverText()
    {
        if (!PrivateArea.CheckAccess(base.transform.position, 0f, false, false))
        {
            return(Localization.instance.Localize(this.m_name + "\n$piece_noaccess"));
        }
        switch (this.GetStatus())
        {
        case Fermenter.Status.Empty:
            return(Localization.instance.Localize(this.m_name + " ( $piece_container_empty )\n[<color=yellow><b>$KEY_Use</b></color>] $piece_fermenter_add"));

        case Fermenter.Status.Fermenting:
        {
            string contentName = this.GetContentName();
            if (this.m_exposed)
            {
                return(Localization.instance.Localize(this.m_name + " ( " + contentName + ", $piece_fermenter_exposed )"));
            }
            return(Localization.instance.Localize(this.m_name + " ( " + contentName + ", $piece_fermenter_fermenting )"));
        }

        case Fermenter.Status.Ready:
        {
            string contentName2 = this.GetContentName();
            return(Localization.instance.Localize(this.m_name + " ( " + contentName2 + ", $piece_fermenter_ready )\n[<color=yellow><b>$KEY_Use</b></color>] $piece_fermenter_tap"));
        }
        }
        return(this.m_name);
    }
Esempio n. 3
0
        /// <summary>
        ///     CLIENT SIDE: Creates a <see cref="PortalSelectionGUI" /> when interacting with a portal
        /// </summary>
        private static bool ShowPortalSelection(On.TeleportWorld.orig_Interact orig, TeleportWorld self, Humanoid human, bool hold)
        {
            bool result = orig(self, human, hold);

            // only act on clients
            if (ZNet.instance.IsServerInstance())
            {
                return(result);
            }

            // must be enabled
            if (!ConfigUtil.Get <bool>("Map", "showPortalSelection"))
            {
                return(result);
            }

            // i like my personal space
            if (!PrivateArea.CheckAccess(self.transform.position) || hold)
            {
                return(result);
            }

            PortalSelectionGUI.OpenPortalSelection();

            return(result);
        }
Esempio n. 4
0
 // Token: 0x06000D0B RID: 3339 RVA: 0x0005D11C File Offset: 0x0005B31C
 public bool Interact(Humanoid user, bool hold)
 {
     if (hold)
     {
         return(false);
     }
     if (!PrivateArea.CheckAccess(base.transform.position, 0f, true, false))
     {
         return(true);
     }
     Fermenter.Status status = this.GetStatus();
     if (status == Fermenter.Status.Empty)
     {
         ItemDrop.ItemData itemData = this.FindCookableItem(user.GetInventory());
         if (itemData == null)
         {
             user.Message(MessageHud.MessageType.Center, "$msg_noprocessableitems", 0, null);
             return(true);
         }
         this.AddItem(user, itemData);
     }
     else if (status == Fermenter.Status.Ready)
     {
         this.m_nview.InvokeRPC("Tap", Array.Empty <object>());
     }
     return(true);
 }
Esempio n. 5
0
    // Token: 0x060002F7 RID: 759 RVA: 0x000195B8 File Offset: 0x000177B8
    private void SpawnOnHitTerrain(Vector3 hitPoint, GameObject prefab)
    {
        TerrainModifier componentInChildren = prefab.GetComponentInChildren <TerrainModifier>();

        if (componentInChildren)
        {
            if (!PrivateArea.CheckAccess(hitPoint, componentInChildren.GetRadius(), true, false))
            {
                return;
            }
            if (Location.IsInsideNoBuildLocation(hitPoint))
            {
                return;
            }
        }
        TerrainModifier.SetTriggerOnPlaced(true);
        GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(prefab, hitPoint, Quaternion.LookRotation(this.m_character.transform.forward));

        TerrainModifier.SetTriggerOnPlaced(false);
        IProjectile component = gameObject.GetComponent <IProjectile>();

        if (component != null)
        {
            component.Setup(this.m_character, Vector3.zero, this.m_attackHitNoise, null, this.m_weapon);
        }
    }
Esempio n. 6
0
        private static bool Prefix(Beehive __instance, ref string __result)
        {
            if (!Configuration.Current.Beehive.IsEnabled || !Configuration.Current.Beehive.showDuration)
            {
                return(true);
            }

            if (!PrivateArea.CheckAccess(__instance.transform.position, 0f, false))
            {
                __result = Localization.instance.Localize(__instance.m_name + "\n$piece_noaccess");
                return(false);
            }
            int honeyLevel = __instance.GetHoneyLevel();

            if (honeyLevel > 0)
            {
                __result = Localization.instance.Localize(string.Concat(new object[]
                {
                    __instance.m_name,
                    " ( ",
                    __instance.m_honeyItem.m_itemData.m_shared.m_name,
                    " x ",
                    honeyLevel,
                    " ) " + calculateTimeLeft(__instance) + "\n[<color=yellow><b>$KEY_Use</b></color>] $piece_beehive_extract"
                }));
                return(false);
            }
            __result = Localization.instance.Localize(__instance.m_name + " ( $piece_container_empty ) " + calculateTimeLeft(__instance) + "\n[<color=yellow><b>$KEY_Use</b></color>] $piece_beehive_check");
            return(false);
        }
Esempio n. 7
0
        internal static void SetName(ref Tameable instance, string name, bool save)
        {
            if (!instance)
            {
                return;
            }

            if (instance.m_character)
            {
                instance.m_character.m_name = name;
            }

            if (instance.transform && instance.transform.GetComponent <Text>())
            {
                instance.transform.GetComponent <Text>().text = name;
            }
            if (save)
            {
                if (!PrivateArea.CheckAccess(instance.transform.position, 0f, false))
                {
                    Debug.LogWarning("Cannot set name on ZDO, you do not have access.");
                    return;
                }
                instance.m_nview.ClaimOwnership();
                instance.m_nview.GetZDO().Set(Tameable_Patch.TameableNameZDOKey, name);
            }
        }
Esempio n. 8
0
        static bool Tameable_Interact(ref Tameable __instance, Humanoid user, bool hold)
        {
            bool validKey = Enum.TryParse(Settings.RenameModifierKey.Value, out KeyCode key);

            if (!validKey || !Input.GetKey(key))
            {
                return(true);
            }

            if (!PrivateArea.CheckAccess(__instance.transform.position, 0f, false, true))
            {
                Debug.LogWarning("You don't have permission to edit this animal's name.");
                return(true);
            }
            if (!__instance.m_character.IsTamed())
            {
                Debug.LogWarning("Cannot name an animal before they are tame.");
                return(true);
            }

            TameableTextReciever textReciever = new TameableTextReciever(ref __instance, __instance.m_character.m_name);

            TextInput.instance.RequestText(textReciever, TameableTextInputTopic, TameableMaxNameLength);

            return(false);
        }
            private static bool Prefix(InventoryGui __instance)
            {
                if (WorldofValheimZones.ServerMode)
                {
                    return(true);
                }
                bool isInArea = false;

                // Ward Check
                if (Client.Ward.Drop && PrivateArea.CheckInPrivateArea(Player.m_localPlayer.transform.position, false))
                {
                    if (!PrivateArea.CheckAccess(Player.m_localPlayer.transform.position, 0f, true, false))
                    {
                        bool test     = PrivateArea.CheckAccess(Player.m_localPlayer.transform.position);
                        long PlayerID = Player.m_localPlayer.GetPlayerID();
                        Util.DoAreaEffectW(Player.m_localPlayer.transform.position);
                        MessageHud.instance.ShowMessage(MessageHud.MessageType.TopLeft, "This is a Warded Area", 0, null);
                        isInArea = true;
                        return(!isInArea);
                    }
                }
                if (Util.RestrictionCheck("noitemdrop"))
                {
                    isInArea = true;
                    Util.DoAreaEffect(Player.m_localPlayer.transform.position + Vector3.up * 0.5f);
                    MessageHud.instance.ShowMessage(MessageHud.MessageType.TopLeft, "This is a Private Area", 0, null);
                }
                return(!isInArea);
            }
Esempio n. 10
0
 // Token: 0x06000C72 RID: 3186 RVA: 0x00059310 File Offset: 0x00057510
 public bool Interact(Humanoid character, bool repeat)
 {
     if (repeat)
     {
         return(false);
     }
     if (!PrivateArea.CheckAccess(base.transform.position, 0f, true, false))
     {
         return(true);
     }
     if (this.GetHoneyLevel() > 0)
     {
         this.Extract();
     }
     else
     {
         if (!this.CheckBiome())
         {
             character.Message(MessageHud.MessageType.Center, "$piece_beehive_area", 0, null);
             return(true);
         }
         if (!this.HaveFreeSpace())
         {
             character.Message(MessageHud.MessageType.Center, "$piece_beehive_freespace", 0, null);
             return(true);
         }
         if (!EnvMan.instance.IsDaylight())
         {
             character.Message(MessageHud.MessageType.Center, "$piece_beehive_sleep", 0, null);
             return(true);
         }
         character.Message(MessageHud.MessageType.Center, "$piece_beehive_happy", 0, null);
     }
     return(true);
 }
        // Check for access to object
        private static Boolean isValidRayCastTarget()
        {
            Boolean hitValid = true;

            if (HitPiece.m_onlyInTeleportArea && !EffectArea.IsPointInsideArea(HitPiece.transform.position, EffectArea.Type.Teleport, 0f))
            {
                // Not in Teleport Area
                hitValid = false;
            }
            if (!HitPiece.m_allowedInDungeons && (HitPiece.transform.position.y > 3000f))
            {
                // Not in dungeon
                hitValid = false;
            }
            if (Location.IsInsideNoBuildLocation(HitPiece.transform.position))
            {
                // No build zone
                hitValid = false;
            }
            float radius = HitPiece.GetComponent <PrivateArea>() ? HitPiece.GetComponent <PrivateArea>().m_radius : 0f;

            if (!PrivateArea.CheckAccess(HitPiece.transform.position, radius, true))
            {
                // private zone
                hitValid = false;
            }

            return(hitValid);
        }
Esempio n. 12
0
 // Token: 0x06000F14 RID: 3860 RVA: 0x0006BD64 File Offset: 0x00069F64
 public string GetHoverText()
 {
     if (!PrivateArea.CheckAccess(base.transform.position, 0f, false, false))
     {
         return("\"" + this.GetText() + "\"");
     }
     return("\"" + this.GetText() + "\"\n" + Localization.instance.Localize(this.m_name + "\n[<color=yellow><b>$KEY_Use</b></color>] $piece_use"));
 }
Esempio n. 13
0
        private static bool Prefix(ref Fermenter __instance, ref string __result)
        {
            if (!Configuration.Current.Fermenter.IsEnabled || !Configuration.Current.Fermenter.showFermenterDuration)
            {
                return(true);
            }

            if (!PrivateArea.CheckAccess(__instance.transform.position, 0f, false))
            {
                __result = Localization.instance.Localize(__instance.m_name + "\n$piece_noaccess");
                return(false);
            }
            switch (__instance.GetStatus())
            {
            case Fermenter.Status.Empty:
                __result = Localization.instance.Localize(__instance.m_name + " ( $piece_container_empty )\n[<color=yellow><b>$KEY_Use</b></color>] $piece_fermenter_add");
                return(false);

            case Fermenter.Status.Fermenting:
            {
                string contentName = __instance.GetContentName();

                if (__instance.m_exposed)
                {
                    __result = Localization.instance.Localize(__instance.m_name + " ( " + contentName + ", $piece_fermenter_exposed )");
                    return(false);
                }

                double durationUntilDone = (double)__instance.m_fermentationDuration - __instance.GetFermentationTime();

                string info = "";

                int minutes = (int)durationUntilDone / 60;

                if (((int)durationUntilDone) >= 120)
                {
                    info = minutes + " minutes";
                }
                else
                {
                    info = (int)durationUntilDone + " seconds";
                }

                __result = Localization.instance.Localize(__instance.m_name + " ( " + contentName + ", $piece_fermenter_fermenting )") + " (" + info + ")";
                return(false);
            }

            case Fermenter.Status.Ready:
            {
                string contentName2 = __instance.GetContentName();
                __result = Localization.instance.Localize(__instance.m_name + " ( " + contentName2 + ", $piece_fermenter_ready )\n[<color=yellow><b>$KEY_Use</b></color>] $piece_fermenter_tap");
                return(false);
            }
            }
            __result = __instance.m_name;

            return(false);
        }
Esempio n. 14
0
        public void SetText(string text)
        {
            if (!PrivateArea.CheckAccess(transform.position, 0f, true))
            {
                return;
            }

            StartCoroutine(DownloadTexture(text, ApplyTexture));
        }
Esempio n. 15
0
 // Token: 0x06000F1A RID: 3866 RVA: 0x0006BE64 File Offset: 0x0006A064
 public void SetText(string text)
 {
     if (!PrivateArea.CheckAccess(base.transform.position, 0f, true, false))
     {
         return;
     }
     this.m_nview.ClaimOwnership();
     this.m_textWidget.text = text;
     this.m_nview.GetZDO().Set("text", text);
 }
            private static bool Prefix(WearNTear __instance, HitData hit)
            {
                if (WorldofValheimZones.ServerMode)
                {
                    return(true);
                }

                bool isInArea = false;

                // Is the area we are searching in a Warded area.
                if (Client.Ward.Damage && PrivateArea.CheckInPrivateArea(__instance.transform.position, false))
                {
                    ZDOID attacker = hit.m_attacker;
                    bool  isplayer = false;
                    foreach (var character in Character.GetAllCharacters())
                    {
                        if (character.GetZDOID() == attacker)
                        {
                            if (character.GetComponent <Player>())
                            {
                                isplayer = true;
                            }
                        }
                    }
                    // It's a player so lets see if it has access.
                    if (isplayer)
                    {
                        if (!PrivateArea.CheckAccess(Player.m_localPlayer.transform.position, 0f, true, false))
                        {
                            Util.DoAreaEffectW(__instance.transform.position);
                            MessageHud.instance.ShowMessage(MessageHud.MessageType.TopLeft, "This is a Warded Area", 0, null);
                            isInArea = true;
                            return(!isInArea);
                        }
                    }
                    else
                    {
                        // It's not a player so lets send out a Ward notification and block the damage.
                        PrivateArea.CheckInPrivateArea(__instance.transform.position, true);
                        isInArea = true;
                        return(!isInArea);
                    }
                }
                // Is the user restricted by NoBuildDamage?
                if (Util.RestrictionCheck("nobuilddamage"))
                {
                    isInArea = true;
                    Util.DoAreaEffect(__instance.transform.position + Vector3.up * 0.5f);
                    MessageHud.instance.ShowMessage(MessageHud.MessageType.TopLeft, "This is a Private Area", 0, null);
                }
                return(!isInArea);
            }
Esempio n. 17
0
 // Token: 0x06000F16 RID: 3862 RVA: 0x0006BDD7 File Offset: 0x00069FD7
 public bool Interact(Humanoid character, bool hold)
 {
     if (hold)
     {
         return(false);
     }
     if (!PrivateArea.CheckAccess(base.transform.position, 0f, true, false))
     {
         return(false);
     }
     TextInput.instance.RequestText(this, "$piece_sign_input", this.m_characterLimit);
     return(true);
 }
Esempio n. 18
0
        public static bool SetText(Sign __instance, string text)
        {
            if (PrivateArea.CheckAccess(__instance.transform.position))
            {
                var data = __instance.GetData();
                __instance.m_nview.ClaimOwnership();
                data.description             = text;
                __instance.m_textWidget.text = data.localized;
                __instance.SetData(data);

                return(false);
            }
            return(true);
        }
Esempio n. 19
0
 // Token: 0x06000F76 RID: 3958 RVA: 0x0006DA84 File Offset: 0x0006BC84
 public bool Interact(Humanoid human, bool hold)
 {
     if (hold)
     {
         return(false);
     }
     if (!PrivateArea.CheckAccess(base.transform.position, 0f, true, false))
     {
         human.Message(MessageHud.MessageType.Center, "$piece_noaccess", 0, null);
         return(true);
     }
     TextInput.instance.RequestText(this, "$piece_portal_tag", 10);
     return(true);
 }
Esempio n. 20
0
        private static bool GetHoverText(Fermenter __instance, ref string __result)
        {
            if (Main.timeLeftStyleFermenter.Value == 0)
            {
                return(true);
            }

            if (!PrivateArea.CheckAccess(__instance.transform.position, 0f, false, false))
            {
                __result = Localization.instance.Localize(__instance.m_name + "\n$piece_noaccess");
                return(false);
            }

            return(Patches.HoverText.PatchFermenter(__instance, ref __result));
        }
Esempio n. 21
0
            static void Prefix(ref Fermenter __instance, Humanoid user, bool hold)
            {
                if (hold || !PrivateArea.CheckAccess(__instance.transform.position))
                {
                    return;
                }

                int status = Traverse.Create(__instance).Method("GetStatus").GetValue <int>();

                if (status == 3)    // 3 is the enum value for Ready
                {
                    ((Player)user).RaiseSkill((Skills.SkillType)COOKING_SKILL_ID, configFermenterXPIncrease.Value * 0.5f);
                    //Log($"[Removed Item from Fermenter] Increase Cooking Skill by {configFermenterXPIncrease.Value * 0.5f}");
                }
            }
Esempio n. 22
0
            static void Postfix(Container __instance, ref string __result)
            {
                if (!modEnabled.Value || (__instance.m_checkGuardStone && !PrivateArea.CheckAccess(__instance.transform.position, 0f, false, false)) || __instance.GetInventory().NrOfItems() == 0)
                {
                    return;
                }

                var items = new List <ItemData>();

                foreach (ItemDrop.ItemData idd in __instance.GetInventory().GetAllItems())
                {
                    items.Add(new ItemData(idd));
                }
                SortUtils.SortByType(SortType.Value, items, sortAsc.Value);
                int    entries = 0;
                int    amount  = 0;
                string name    = "";

                for (int i = 0; i < items.Count; i++)
                {
                    if (maxEntries.Value >= 0 && entries >= maxEntries.Value)
                    {
                        if (overFlowText.Value.Length > 0)
                        {
                            __result += "\n" + overFlowText.Value;
                        }
                        break;
                    }
                    ItemData item = items[i];

                    if (item.m_shared.m_name == name || name == "")
                    {
                        amount += item.m_stack;
                    }
                    else
                    {
                        __result += "\n" + string.Format(entryString.Value, amount, Localization.instance.Localize(name));
                        entries++;

                        amount = item.m_stack;
                    }
                    name = item.m_shared.m_name;
                    if (i == items.Count - 1)
                    {
                        __result += "\n" + string.Format(entryString.Value, amount, Localization.instance.Localize(name));
                    }
                }
            }
Esempio n. 23
0
    // Token: 0x06000CAB RID: 3243 RVA: 0x0005ACC0 File Offset: 0x00058EC0
    public string GetHoverText()
    {
        if (this.m_checkGuardStone && !PrivateArea.CheckAccess(base.transform.position, 0f, false, false))
        {
            return(Localization.instance.Localize(this.m_name + "\n$piece_noaccess"));
        }
        string text;

        if (this.m_inventory.NrOfItems() == 0)
        {
            text = this.m_name + " ( $piece_container_empty )";
        }
        else
        {
            text = this.m_name;
        }
        text += "\n[<color=yellow><b>$KEY_Use</b></color>] $piece_container_open";
        return(Localization.instance.Localize(text));
    }
Esempio n. 24
0
    // Token: 0x06000CB7 RID: 3255 RVA: 0x0005B050 File Offset: 0x00059250
    public bool TakeAll(Humanoid character)
    {
        if (this.m_checkGuardStone && !PrivateArea.CheckAccess(base.transform.position, 0f, true, false))
        {
            return(false);
        }
        long playerID = Game.instance.GetPlayerProfile().GetPlayerID();

        if (!this.CheckAccess(playerID))
        {
            character.Message(MessageHud.MessageType.Center, "$msg_cantopen", 0, null);
            return(false);
        }
        this.m_nview.InvokeRPC("RequestTakeAll", new object[]
        {
            playerID
        });
        return(true);
    }
Esempio n. 25
0
 // Token: 0x06000CE8 RID: 3304 RVA: 0x0005C634 File Offset: 0x0005A834
 public string GetHoverText()
 {
     if (!this.m_nview.IsValid())
     {
         return("");
     }
     if (!PrivateArea.CheckAccess(base.transform.position, 0f, false, false))
     {
         return(Localization.instance.Localize(this.m_name + "\n$piece_noaccess"));
     }
     if (!this.CanInteract())
     {
         return(Localization.instance.Localize(this.m_name));
     }
     if (this.m_nview.GetZDO().GetInt("state", 0) != 0)
     {
         return(Localization.instance.Localize(this.m_name + "\n[<color=yellow><b>$KEY_Use</b></color>] $piece_door_close"));
     }
     return(Localization.instance.Localize(this.m_name + "\n[<color=yellow><b>$KEY_Use</b></color>] $piece_door_open"));
 }
Esempio n. 26
0
        public static void ShowPortalSelection(TeleportWorld instance, Humanoid human, bool hold)
        {
            // only act on clients
            if (ZNet.instance.IsServerInstance())
            {
                return;
            }

            // must be enabled
            if (!Configuration.Current.Map.IsEnabled || !Configuration.Current.Map.showPortalSelection)
            {
                return;
            }

            // i like my personal space
            if (!PrivateArea.CheckAccess(instance.transform.position) || hold)
            {
                return;
            }

            PortalSelectionGUI.OpenPortalSelection();
        }
Esempio n. 27
0
    // Token: 0x06000CEA RID: 3306 RVA: 0x0005C6F8 File Offset: 0x0005A8F8
    public bool Interact(Humanoid character, bool hold)
    {
        if (hold)
        {
            return(false);
        }
        if (!this.CanInteract())
        {
            return(false);
        }
        if (!PrivateArea.CheckAccess(base.transform.position, 0f, true, false))
        {
            return(true);
        }
        if (this.m_keyItem != null)
        {
            if (!this.HaveKey(character))
            {
                this.m_lockedEffects.Create(base.transform.position, base.transform.rotation, null, 1f);
                character.Message(MessageHud.MessageType.Center, Localization.instance.Localize("$msg_door_needkey", new string[]
                {
                    this.m_keyItem.m_itemData.m_shared.m_name
                }), 0, null);
                return(true);
            }
            character.Message(MessageHud.MessageType.Center, Localization.instance.Localize("$msg_door_usingkey", new string[]
            {
                this.m_keyItem.m_itemData.m_shared.m_name
            }), 0, null);
        }
        Vector3 normalized = (character.transform.position - base.transform.position).normalized;
        bool    flag       = Vector3.Dot(base.transform.forward, normalized) < 0f;

        this.m_nview.InvokeRPC("UseDoor", new object[]
        {
            flag
        });
        return(true);
    }
Esempio n. 28
0
    // Token: 0x06000C70 RID: 3184 RVA: 0x00059248 File Offset: 0x00057448
    public string GetHoverText()
    {
        if (!PrivateArea.CheckAccess(base.transform.position, 0f, false, false))
        {
            return(Localization.instance.Localize(this.m_name + "\n$piece_noaccess"));
        }
        int honeyLevel = this.GetHoneyLevel();

        if (honeyLevel > 0)
        {
            return(Localization.instance.Localize(string.Concat(new object[]
            {
                this.m_name,
                " ( ",
                this.m_honeyItem.m_itemData.m_shared.m_name,
                " x ",
                honeyLevel,
                " )\n[<color=yellow><b>$KEY_Use</b></color>] $piece_beehive_extract"
            })));
        }
        return(Localization.instance.Localize(this.m_name + " ( $piece_container_empty )\n[<color=yellow><b>$KEY_Use</b></color>] $piece_beehive_check"));
    }
Esempio n. 29
0
        /// <summary>
        /// Get all valid nearby chests
        /// </summary>
        public static List <Container> GetNearbyChests(GameObject target, float range, bool checkWard = true)
        {
            Collider[] hitColliders = Physics.OverlapSphere(target.transform.localPosition, range, LayerMask.GetMask(new string[] { "piece" }));

            // Order the found objects to select the nearest first instead of the farthest inventory.
            IOrderedEnumerable <Collider> orderedColliders = hitColliders.OrderBy(x => Vector3.Distance(x.gameObject.transform.position, target.transform.position));

            List <Container> validContainers = new List <Container>();

            foreach (var hitCollider in orderedColliders)
            {
                try
                {
                    Container foundContainer = hitCollider.GetComponentInParent <Container>();
                    bool      hasAccess      = foundContainer.CheckAccess(Player.m_localPlayer.GetPlayerID());
                    if (checkWard)
                    {
                        hasAccess = hasAccess && PrivateArea.CheckAccess(hitCollider.gameObject.transform.position, 0f, false, true);
                    }
                    var piece   = foundContainer.GetComponentInParent <Piece>();
                    var isVagon = foundContainer.GetComponentInParent <Vagon>() != null;
                    var isShip  = foundContainer.GetComponentInParent <Ship>() != null;
                    if (piece != null &&
                        piece.IsPlacedByPlayer() &&
                        !isVagon &&
                        !isShip &&
                        hasAccess &&
                        foundContainer.GetInventory() != null)
                    {
                        validContainers.Add(foundContainer);
                    }
                }
                catch { }
            }

            return(validContainers);
        }
            private static bool Prefix(Player __instance)
            {
                if (WorldofValheimZones.ServerMode)
                {
                    return(true);
                }
                bool    isInArea = false;
                Vector3 point    = __instance.transform.position;

                // Ward Check
                if (Client.Ward.Pickup && PrivateArea.CheckInPrivateArea(Player.m_localPlayer.transform.position, false))
                {
                    if (!PrivateArea.CheckAccess(Player.m_localPlayer.transform.position, 0f, false, false))
                    {
                        isInArea = true;
                        return(!isInArea);
                    }
                }
                if (Util.RestrictionCheck("noitempickup"))
                {
                    isInArea = true;
                }
                return(!isInArea);
            }