Esempio n. 1
0
        public override void OnDoubleClick(Mobile from)
        {
            if (!IsChildOf(from))
            {
                from.SendAsciiMessage("That must be in your backpack to use it.");
                return;
            }

            Target t;
            int    number;

            if (m_KeyVal != 0)
            {
                number = 501662;                 // What shall I use this key on?
                t      = new UnlockTarget(this);
            }
            else
            {
                number = 501663;                 // This key is a key blank
                t      = new CopyTarget(this);
            }

            from.SendLocalizedMessage(number);
            from.Target = t;
        }
Esempio n. 2
0
        public override void OnDoubleClick(Mobile from)
        {
            if (!this.IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(501661);                   // That key is unreachable.
                return;
            }

            Target t;
            int    number;

            if (m_KeyVal != 0)
            {
                number = 501662;                 // What shall I use this key on?
                t      = new UnlockTarget(this);
            }
            else
            {
                number = 501663;                 // This key is a key blank. Which key would you like to make a copy of?
                t      = new CopyTarget(this);
            }

            from.SendLocalizedMessage(number);
            from.Target = t;
        }
Esempio n. 3
0
        public override void OnDoubleClick(Mobile from)
        {
            Target t;
            int    number;

            if (m_KeyVal != 0)
            {
                number = 501662;                 // What shall I use this key on?
                t      = new UnlockTarget(this);
            }
            else
            {
                number = 501663;                 // This key is a key blank. Which key would you like to make a copy of?
                t      = new CopyTarget(this);
            }

            from.SendLocalizedMessage(number);
            from.Target = t;
        }
Esempio n. 4
0
        public override void OnDoubleClick(Mobile from)
        {
            Target t;
            string number;

            if (m_KeyVal != 0)
            {
                number = "What shall I use this key on?";
                t      = new UnlockTarget(this);
            }
            else
            {
                number = "This key is a key blank. Which key would you like to make a copy of?";
                t      = new CopyTarget(this);
            }

            from.SendAsciiMessage(number);
            from.Target = t;
        }
Esempio n. 5
0
        public override void OnDoubleClick(Mobile from)
        {
            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(501661); // That key is unreachable.
                return;
            }

            Target t;

            if (m_KeyVal != 0)
            {
                from.SendAsciiMessage("Select the item to use the key on.");
                t = new UnlockTarget(this);
            }
            else
            {
                from.SendAsciiMessage("This key is a key blank. Which key would you like to make a copy of?");
                t = new CopyTarget(this);
            }

            from.Target = t;
        }
Esempio n. 6
0
		public override void OnDoubleClick( Mobile from )
		{
			Target t;
			int number;

			if ( m_KeyVal != 0 )
			{
				number = 501662; // What shall I use this key on?
				t = new UnlockTarget( this );
			}
			else
			{
				number = 501663; // This key is a key blank. Which key would you like to make a copy of?
				t = new CopyTarget( this );
			}

			from.SendLocalizedMessage( number );
			from.Target = t;
		}
Esempio n. 7
0
		public override void OnDoubleClick( Mobile from )
		{
			if ( !this.IsChildOf( from.Backpack ) )
			{
				from.SendLocalizedMessage( 501661 ); // That key is unreachable.
				return;
			}

			Target t;
			int number;

			if ( m_KeyVal != 0 )
			{
				number = 501662; // What shall I use this key on?
				t = new UnlockTarget( this );
			}
			else
			{
				number = 501663; // This key is a key blank. Which key would you like to make a copy of?
				t = new CopyTarget( this );
			}

			from.SendLocalizedMessage( number );
			from.Target = t;
		}
Esempio n. 8
0
        public override void OnDoubleClick( Mobile from )
        {
            Target t;
            string number;

            if ( m_KeyVal != 0 )
            {
                number = "What shall I use this key on?";
                t = new UnlockTarget( this );
            }
            else
            {
                number = "This key is a key blank. Which key would you like to make a copy of?";
                t = new CopyTarget( this );
            }

            from.SendAsciiMessage( number );
            from.Target = t;
        }
Esempio n. 9
0
        public override void OnDoubleClick(Mobile from)
        {
            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(501661); // That key is unreachable.
                return;
            }

            Target t;

            if (m_KeyVal != 0)
            {
                from.SendAsciiMessage("Select the item to use the key on.");
                t = new UnlockTarget(this);
            }
            else
            {
                from.SendAsciiMessage("This key is a key blank. Which key would you like to make a copy of?");
                t = new CopyTarget(this);
            }

            from.Target = t;
        }
Esempio n. 10
0
        /// <summary>
        /// Resolves the copy operations
        /// </summary>
        /// <param name="operation">The <see cref="Operation"/></param>
        private void ResolveCopy(Operation operation)
        {
            if (!operation.OperationKind.IsCopyOperation())
            {
                return;
            }

            var options = new CopyInfoOptions
            {
                CopyKind   = CopyKind.Deep,
                KeepOwner  = operation.OperationKind == OperationKind.Copy || operation.OperationKind == OperationKind.CopyKeepValues,
                KeepValues = operation.OperationKind == OperationKind.CopyKeepValues || operation.OperationKind == OperationKind.CopyKeepValuesChangeOwner
            };

            var sourcepoco      = operation.OriginalThing.QuerySourceThing();
            var sourceIteration = sourcepoco.GetContainerOfType <Iteration>();

            var source = new CopySource
            {
                Thing = new CopyReference {
                    Iid = operation.OriginalThing.Iid, ClassKind = operation.OriginalThing.ClassKind
                },
                TopContainer = new CopyReference {
                    Iid = sourcepoco.TopContainer.Iid, ClassKind = sourcepoco.TopContainer.ClassKind
                },
                IterationId = sourceIteration?.Iid
            };

            var poco = operation.ModifiedThing.QuerySourceThing();

            if (poco.Container == null)
            {
                throw new InvalidOperationException("The container cannot be null.");
            }

            var targetIteration = poco.GetContainerOfType <Iteration>();
            var target          = new CopyTarget
            {
                Container = new CopyReference {
                    Iid = poco.Container.Iid, ClassKind = poco.Container.ClassKind
                },
                TopContainer = new CopyReference {
                    Iid = poco.TopContainer.Iid, ClassKind = poco.TopContainer.ClassKind
                },
                IterationId = targetIteration?.Iid
            };

            var copyInfo = new CopyInfo
            {
                Source  = source,
                Target  = target,
                Options = options
            };

            if (targetIteration != null)
            {
                var participation = this.session.OpenIterations.FirstOrDefault(x => x.Key.Iid == targetIteration.Iid).Value;
                copyInfo.ActiveOwner = participation.Item1?.Iid ?? Guid.Empty;
            }

            this.Copy.Add(copyInfo);
        }
Esempio n. 11
0
        public override void OnDoubleClick( Mobile from )
        {
            if ( !IsChildOf( from ) )
            {
                from.SendAsciiMessage( "That must be in your backpack to use it." );
                return;
            }

            Target t;
            int number;
            if ( m_KeyVal != 0 )
            {
                number = 501662; // What shall I use this key on?
                t = new UnlockTarget( this );
            }
            else
            {
                number = 501663; // This key is a key blank
                t = new CopyTarget( this );
            }

            from.SendLocalizedMessage( number );
            from.Target = t;
        }