예제 #1
0
        public static UnlockResults Unlock(WorldObject target, string keyCode)
        {
            string myLockCode = GetLockCode(target);

            if (myLockCode == null)
            {
                return(UnlockResults.IncorrectKey);
            }

            if (target.IsOpen ?? false)
            {
                return(UnlockResults.Open);
            }

            if (keyCode == myLockCode)
            {
                if (!target.IsLocked ?? false)
                {
                    return(UnlockResults.AlreadyUnlocked);
                }

                target.IsLocked = false;
                var updateProperty = new GameMessagePublicUpdatePropertyBool(target, PropertyBool.Locked, target.IsLocked ?? false);
                var sound          = new GameMessageSound(target.Guid, Sound.LockSuccess, 1.0f);
                target.EnqueueBroadcast(updateProperty, sound);
                return(UnlockResults.UnlockSuccess);
            }
            return(UnlockResults.IncorrectKey);
        }
예제 #2
0
파일: Player_House.cs 프로젝트: Dimmae/ACE
        public void HandleActionSetHooksVisible(bool visible)
        {
            //Console.WriteLine($"{Name}.HandleActionSetHooksVisible({visible})");

            var visibleStr = visible ? "visible" : "invisible";

            Session.Network.EnqueueSend(new GameMessageSystemChat($"Your hooks are set to {visibleStr}.", ChatMessageType.Broadcast));

            var house = GetHouse();

            if (visible == (house.HouseHooksVisible ?? true))
            {
                return;
            }

            house.HouseHooksVisible = visible;

            var state = PhysicsState.Ethereal | PhysicsState.IgnoreCollisions;

            if (!visible)
            {
                state |= PhysicsState.NoDraw;
            }

            foreach (var hook in house.Hooks.Where(i => i.Inventory.Count == 0))
            {
                var setState = new GameMessageSetState(hook, state);
                var update   = new GameMessagePublicUpdatePropertyBool(hook, PropertyBool.UiHidden, !visible);

                house.SlumLord.EnqueueBroadcast(setState, update);
            }
        }
예제 #3
0
파일: Lock.cs 프로젝트: jacobtipp/trACE
        public static UnlockResults Unlock(WorldObject target, Key key, string keyCode = null)
        {
            if (keyCode == null)
            {
                keyCode = key?.KeyCode;
            }

            string myLockCode = GetLockCode(target);

            if (myLockCode == null)
            {
                return(UnlockResults.IncorrectKey);
            }

            if (target.IsOpen)
            {
                return(UnlockResults.Open);
            }

            // there is only 1 instance of an 'opens all' key in PY16 data, 'keysonicscrewdriver'
            // which uses keyCode '_bohemund's_magic_key_'

            // when LSD added the rare skeleton key (keyrarevolatileuniversal),
            // they used PropertyBool.OpensAnyLock, which appears to have been used for something else in retail on Writables:

            // https://github.com/ACEmulator/ACE-World-16PY/blob/master/Database/3-Core/9%20WeenieDefaults/SQL/Key/Key/09181%20Sonic%20Screwdriver.sql
            // https://github.com/ACEmulator/ACE-World-16PY/search?q=OpensAnyLock

            if (keyCode != null && (keyCode.Equals(myLockCode, StringComparison.OrdinalIgnoreCase) || keyCode.Equals("_bohemund's_magic_key_")) ||
                key != null && key.OpensAnyLock)
            {
                if (!target.IsLocked)
                {
                    return(UnlockResults.AlreadyUnlocked);
                }

                target.IsLocked = false;
                var updateProperty = new GameMessagePublicUpdatePropertyBool(target, PropertyBool.Locked, target.IsLocked);
                var sound          = new GameMessageSound(target.Guid, Sound.LockSuccess, 1.0f);
                target.EnqueueBroadcast(updateProperty, sound);
                return(UnlockResults.UnlockSuccess);
            }
            return(UnlockResults.IncorrectKey);
        }