ChestControl.CPlayer.HasAccessToChest C# (CSharp) Method

HasAccessToChest() public method

public HasAccessToChest ( int id ) : bool
id int
return bool
        public bool HasAccessToChest(int id)
        {
            return UnlockedChests.Contains(id);
        }

Usage Example

示例#1
0
文件: Chest.cs 项目: jordsti/TPulse
        /*public void SetChestItems(Terraria.Item[] items)
         * {
         *  Terraria.Main.chest[ID].item = items;
         * }*/

        public bool IsOpenFor(CPlayer player)
        {
            if (!IsLocked()) //if chest not locked skip all checks
            {
                return(true);
            }

            if (!tPulse.Players[player.Index].IsLoggedIn) //if player isn't logged in, and chest is protected, don't allow access
            {
                return(false);
            }

            if (IsOwnerConvert(player)) //if player is owner then skip checks
            {
                return(true);
            }

            if (HashedPassword != "")            //this chest is passworded, so check if user has unlocked this chest
            {
                if (player.HasAccessToChest(ID)) //has unlocked this chest
                {
                    return(true);
                }
            }

            if (IsRegionLocked()) //if region lock then check region
            {
                var x = (int)Position.X;
                var y = (int)Position.Y;

                if (tPulse.Regions.InArea(x, y))                                     //if not in area disable region lock
                {
                    if (tPulse.Regions.CanBuild(x, y, tPulse.Players[player.Index])) //if can build in area
                    {
                        return(true);
                    }
                }
                else
                {
                    regionLock(false);
                }
            }
            return(false);
        }
All Usage Examples Of ChestControl.CPlayer::HasAccessToChest