コード例 #1
0
ファイル: KeyRing.cs プロジェクト: Crome696/ServUO
        public void Add(Key key)
        {
            key.Internalize();
            this.m_Keys.Add(key);

            this.UpdateItemID();
        }
コード例 #2
0
		public KeyInfo( Key key )
		{
			m_KeyVal = key.KeyValue;
			m_Description = key.Description;
			m_MaxRange = key.MaxRange;
			m_Link = key.Link;
			m_Type = (KeyType)key.ItemID;
		}
コード例 #3
0
ファイル: LockableContainer.cs プロジェクト: Godkong/Origins
        public int OnCraft( int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue )
        {
            if ( from.CheckSkill( SkillName.Tinkering, -5.0, 15.0 ) )
            {
                from.SendAsciiMessage( "Your tinker skill was sufficient to make the item lockable." ); // Your tinker skill was sufficient to make the item lockable.

                Key key = new Key( KeyType.Copper, Key.RandomValue() );

                KeyValue = key.KeyValue;
                DropItem( key );

                double tinkering = from.Skills[SkillName.Tinkering].Value;
                int level = (int)(tinkering * 0.8);

                RequiredSkill = level - 4;
                LockLevel = level - 14;
                MaxLockLevel = level + 35;

                if ( LockLevel == 0 )
                    LockLevel = -1;
                else if ( LockLevel > 95 )
                    LockLevel = 95;

                if ( RequiredSkill > 95 )
                    RequiredSkill = 95;

                if ( MaxLockLevel > 95 )
                    MaxLockLevel = 95;
            }
            else
            {
                //from.SendAsciiMessage( "Your tinker skill was insufficient to make the item lockable." ); // Your tinker skill was insufficient to make the item lockable.
            }

            return 1;
        }
コード例 #4
0
		public uint CreateKeys( Mobile m )
		{
			uint value = Key.RandomValue();

			if ( !IsAosRules )
			{
				Key packKey = new Key( KeyType.Gold );
				Key bankKey = new Key( KeyType.Gold );

				packKey.KeyValue = value;
				bankKey.KeyValue = value;

				packKey.LootType = LootType.Newbied;
				bankKey.LootType = LootType.Newbied;

				BankBox box = m.BankBox;

				if ( !box.TryDropItem( m, bankKey, false ) )
					bankKey.Delete();

				m.AddToBackpack( packKey );
			}

			return value;
		}
コード例 #5
0
			public UnlockTarget( Key key ) : base( key.MaxRange, false, TargetFlags.None )
			{
				m_Key = key;
				CheckLOS = false;
			}
コード例 #6
0
ファイル: BaseHouse.cs プロジェクト: Godkong/RunUO
        public uint CreateTentKeys(Mobile m)
        {
            uint value = Key.RandomValue();

            m_KeyOwner = value;

            if (!IsAosRules)
            {

                Key packKey = new Key(KeyType.Iron);
                Key bankKey = new Key(KeyType.Iron);

                packKey.KeyValue = value;
                bankKey.KeyValue = value;

                packKey.LootType = LootType.Regular;
                bankKey.LootType = LootType.Regular;

                BankBox box = m.BankBox;

                if (box == null || !box.TryDropItem(m, bankKey, false))
                    bankKey.Delete();
                else
                    m.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, "A house key is now in my safety deposit box."); // A ship's key is now in my safety deposit box.

                if (m.AddToBackpack(packKey))
                    m.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, "A house key is now in my backpack."); // A ship's key is now in my backpack.
                else
                    m.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, "A house key is now at my feet."); // A ship's key is now at my feet.
            }

            return value;
        }
コード例 #7
0
			protected override void OnTarget( Mobile from, object targeted )
			{
				if ( targeted == m_KeyRing )
				{
					from.SendLocalizedMessage( 501685 ); // You open the keyring.
					m_KeyRing.ItemID = 0x1011;

					foreach( KeyInfo k in m_KeyRing.Keys )
					{
						Key key = new Key( k.type, k.KeyValue, k.Link );
						key.Description = k.Description;
						from.AddToBackpack( key );
					}

					m_KeyRing.Keys.Clear();
				}
				else if ( targeted is ILockable )
				{
					ILockable o = (ILockable)targeted;
					bool KeyMatched = false;

					foreach( KeyInfo key in m_KeyRing.Keys )
					{
						if ( key.KeyValue == o.KeyValue )
						{
							KeyMatched = true;
							break;
						}
					}

					if ( KeyMatched )
					{
						if ( o is BaseDoor && !((BaseDoor)o).UseLocks() )
						{
							from.SendLocalizedMessage( 1008140 ); // You do not have a key for that.
						}
						else
						{
							o.Locked = !o.Locked;

							if ( o is LockableContainer )
							{
								LockableContainer cont = (LockableContainer)o;

								if ( cont.LockLevel == -255 )
									cont.LockLevel = cont.RequiredSkill - 10;
							}

							if ( targeted is Item )
							{
								Item item = (Item)targeted;

								if ( o.Locked )
									item.SendLocalizedMessageTo( from, 1048000 ); // You lock it
								else
									item.SendLocalizedMessageTo( from, 1048001 ); // You unlock it.
							}
						}
					}
					else
					{
						from.SendLocalizedMessage( 1008140 ); // You do not have a key for that.
					}
				}
				else
				{
					from.SendLocalizedMessage( 501666 ); // You can't unlock that!
				}
			}
コード例 #8
0
ファイル: Key.cs プロジェクト: proxeeus/UORebirth
 public UnlockTarget(Key key) : base(key.MaxRange, false, TargetFlags.None)
 {
     m_Key    = key;
     CheckLOS = false;
 }
コード例 #9
0
        public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue)
        {
			if(makersMark)
			{
				Crafter = from;
			}
            if (from.CheckSkill(SkillName.Tinkering, -5.0, 15.0))
            {
                from.SendLocalizedMessage(500636); // Your tinker skill was sufficient to make the item lockable.

                Key key = new Key(KeyType.Copper, Key.RandomValue());

                this.KeyValue = key.KeyValue;
                this.DropItem(key);

                double tinkering = from.Skills[SkillName.Tinkering].Value;
                int level = (int)(tinkering * 0.8);

                this.RequiredSkill = level - 4;
                this.LockLevel = level - 14;
                this.MaxLockLevel = level + 35;

                if (this.LockLevel == 0)
                    this.LockLevel = -1;
                else if (this.LockLevel > 95)
                    this.LockLevel = 95;

                if (this.RequiredSkill > 95)
                    this.RequiredSkill = 95;

                if (this.MaxLockLevel > 95)
                    this.MaxLockLevel = 95;
            }
            else
            {
                from.SendLocalizedMessage(500637); // Your tinker skill was insufficient to make the item lockable.
            }

            return 1;
        }
コード例 #10
0
        public uint CreateKeys(Mobile m)
        {
            uint value = Key.RandomValue();

            Key packKey = new Key(KeyType.Copper);
            Key bankKey = new Key(KeyType.Copper);

            packKey.KeyValue = value;
            bankKey.KeyValue = value;

            m_HouseKeyVal = value;

            packKey.LootType = LootType.Regular;
            bankKey.LootType = LootType.Regular;

            BankBox box = m.BankBox;

            if (!box.TryDropItem(m, bankKey, false))
                bankKey.Delete();

            m.AddToBackpack(packKey);

            return value;
        }
コード例 #11
0
ファイル: BaseDoor.cs プロジェクト: jizzyjim/16Below
        public virtual void Use(Mobile from)
        {
            if (this.m_Locked && !this.m_Open && this.UseLocks())
            {
                if (from.AccessLevel >= AccessLevel.GameMaster)
                {
                    from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 502502); // That is locked, but you open it with your godly powers.
                    //from.Send( new MessageLocalized( Serial, ItemID, MessageType.Regular, 0x3B2, 3, 502502, "", "" ) ); // That is locked, but you open it with your godly powers.
                }
                else if (Key.ContainsKey(from.Backpack, this.KeyValue))
                {
                    from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 501282); // You quickly unlock, open, and relock the door
                }
                else if (this.IsInside(from))
                {
                    from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 501280); // That is locked, but is usable from the inside.
                }
                else
                {
                    if (this.Hue == 0x44E && this.Map == Map.Malas) // doom door into healer room in doom
                    {
                        this.SendLocalizedMessageTo(from, 1060014); // Only the dead may pass.
                    }
                    else
                    {
                        from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 502503); // That is locked.
                    }
                    return;
                }
            }

            if (this.m_Open && !this.IsFreeToClose())
            {
                return;
            }

            if (this.m_Open)
            {
                this.OnClosed(from);
            }
            else
            {
                this.OnOpened(from);
            }

            if (this.UseChainedFunctionality)
            {
                bool open = !this.m_Open;

                List <BaseDoor> list = this.GetChain();

                for (int i = 0; i < list.Count; ++i)
                {
                    list[i].Open = open;
                }
            }
            else
            {
                this.Open = !this.m_Open;

                BaseDoor link = this.Link;

                if (this.m_Open && link != null && !link.Open)
                {
                    link.Open = true;
                }
            }
        }
コード例 #12
0
		public int OnCraft( int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, IBaseTool tool, CraftItem craftItem, int resHue )
		{
			if ( from.CheckSkill( SkillName.Tinkering, -5.0, 15.0 ) )
			{
				from.SendLocalizedMessage( 500636 ); // Your tinker skill was sufficient to make the item lockable.

				Key key = new Key( KeyType.Copper, Key.RandomValue() );

				KeyValue = key.KeyValue;
				DropItem( key );

				double tinkering = from.Skills[SkillName.Tinkering].Value;
				int level = (int)(tinkering * 0.8);

				RequiredSkill = level - 4;
				LockLevel = level - 14;
				MaxLockLevel = level + 35;

				if ( LockLevel == 0 )
					LockLevel = -1;
				else if ( LockLevel > 95 )
					LockLevel = 95;

				if ( RequiredSkill > 95 )
					RequiredSkill = 95;

				if ( MaxLockLevel > 95 )
					MaxLockLevel = 95;

                // A tinker trapped box should not explode until it is armed with a key
                Armed = false;
			}
			else
			{
				from.SendLocalizedMessage( 500637 ); // Your tinker skill was insufficient to make the item lockable.
			}
            
            // The lockable containers never took material color into account, so this fixes it
            Type resourceType = typeRes;

            if (resourceType == null)
            {
                resourceType = craftItem.Resources.GetAt(0).ItemType;
            }

            var resource = CraftResources.GetFromType(resourceType);

            CraftContext context = craftSystem.GetContext(from);

            if (context != null && context.DoNotColor)
            {
                Hue = 0;
            }
            else
            {
                Hue = CraftResources.GetHue(resource);
            }

			return 1;            
		}
コード例 #13
0
ファイル: KeysCommands.cs プロジェクト: greeduomacro/vivre-uo
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is BaseHouseDoor)
                {
                    from.SendMessage("Ce n'est pas conseillé de faire ceci sur une porte de maison...");
                    return;
                }

                BaseDoor door = targeted as BaseDoor;

                if (door == null)
                {
                    from.SendMessage("Vous devez cibler une porte et non un " + targeted.GetType().Name);
                    return;
                }

                if (door.KeyValue != 0)
                {
                    from.SendMessage("La porte possède déjà un KeyValue !");
                    return;
                }

                door.KeyValue = (uint)door.Serial.Value;

                Bag keysBag = new Bag();
                keysBag.Hue = Utility.RandomDyedHue();
                for (int i = 1; i <= m_Quantity; i++)
                {
                    Key k = new Key(door.KeyValue);
                    keysBag.DropItem(k);
                }

                if (keysBag.Items.Count > 0)
                    from.Backpack.AddItem(keysBag);
                else
                    keysBag.Delete();
            }
コード例 #14
0
ファイル: KeysCommands.cs プロジェクト: greeduomacro/vivre-uo
 public BindDoorTarget(Key k)
     : base(10, false, TargetFlags.None)
 {
     m_Key = k;
 }
コード例 #15
0
ファイル: Key.cs プロジェクト: proxeeus/UORebirth
 public CopyTarget(Key key) : base(3, false, TargetFlags.None)
 {
     m_Key = key;
 }
コード例 #16
0
        public override void OnDoubleClick(Mobile from)
        {
            if (!IsChildOf(from.Backpack))
            {
                from.SendAsciiMessage("That must be in your pack for you to use it.");                   // That must be in your pack for you to use it.
            }
            else if (from.AccessLevel >= AccessLevel.GameMaster)
            {
                from.SendAsciiMessage("Your godly powers allow you to place this vendor whereever you wish.");                   // Your godly powers allow you to place this vendor whereever you wish.

                Mobile v = new PlayerVendor(from, BaseHouse.FindHouseAt(from));

                v.Direction = from.Direction & Direction.Mask;
                v.MoveToWorld(from.Location, from.Map);

                v.SayTo(from, true, "Ah! it feels good to be working again.");                   // Ah! it feels good to be working again.

                this.Delete();
            }
            else
            {
                BaseHouse house = BaseHouse.FindHouseAt(from);

                if (house == null)
                {
                    from.SendAsciiMessage("Vendors can only be placed in houses.");                       // Vendors can only be placed in houses.
                }
                else if (!Key.ContainsKey(from.Backpack, house.keyValue))
                {
                    from.SendAsciiMessage("You can only place this in a house that you own!");
                }

                /*else if ( !BaseHouse.NewVendorSystem && !house.IsFriend( from ) )
                 * {
                 *  from.SendAsciiMessage("You can only place this in a house that you own!"); // You must ask the owner of this building to name you a friend of the household in order to place a vendor here.
                 * }
                 * else if ( BaseHouse.NewVendorSystem && !house.IsOwner( from ) )
                 * {
                 *  from.SendAsciiMessage("You can only place this in a house that you own!"); // Only the house owner can directly place vendors.  Please ask the house owner to offer you a vendor contract so that you may place a vendor in this house.
                 * }
                 * else if ( !house.Public || !house.CanPlaceNewVendor() )
                 * {
                 *  from.SendAsciiMessage( "You cannot place this vendor or barkeep.  Make sure the house is public and has sufficient storage available." ); // You cannot place this vendor or barkeep.  Make sure the house is public and has sufficient storage available.
                 * }*/
                else
                {
                    bool vendor, contract;
                    BaseHouse.IsThereVendor(from.Location, from.Map, out vendor, out contract);

                    if (vendor)
                    {
                        from.SendAsciiMessage("You cannot place a vendor at this location."); // You cannot place a vendor or barkeep at this location.
                    }
                    else if (contract)
                    {
                        from.SendLocalizedMessage(1062678); // You cannot place a vendor or barkeep on top of a rental contract!
                    }
                    else
                    {
                        Mobile v = new PlayerVendor(from, house);

                        v.Direction = from.Direction & Direction.Mask;
                        v.MoveToWorld(from.Location, from.Map);

                        v.SayTo(from, true, "Ah! it feels good to be working again."); // Ah! it feels good to be working again.

                        this.Delete();
                    }
                }
            }
        }
コード例 #17
0
ファイル: Keyring.cs プロジェクト: cynricthehun/UOLegends
            protected override void OnTarget( Mobile from, object targeted )
            {
                if ( targeted == m_keyring )
                {
                    for( int i = 0; i < m_keyring.m_Keys.Count; i++ )
                    {
                        KeyringEntry entry = m_keyring.m_Keys[i] as KeyringEntry;
                        Key key = new Key();
                        key.KeyValue = entry.KeyValue;
                        key.Link = entry.Link;
                        key.MaxRange = entry.MaxRange;
                        key.ItemID = entry.ItemID;
                        key.LootType = entry.LootType;
                        key.Description = entry.Description;
                        from.AddToBackpack( key );
                        m_keyring.ItemID = 0x1011;
                        m_keyring.Weight = 1;
                    }
                    m_keyring.m_Keys.Clear();
                }
                else if ( targeted is ILockable )
                {
                    ILockable o = (ILockable)targeted;

                    for( int i = 0; i < m_keyring.m_Keys.Count; i++ )
                    {
                        KeyringEntry entry = m_keyring.m_Keys[i] as KeyringEntry;

                        if ( o.KeyValue == entry.KeyValue )
                        {
                            if ( o is BaseDoor && !((BaseDoor)o).UseLocks() )
                            {
                                from.SendAsciiMessage( "This key doesn't seem to unlock that." );
                            }
                            else
                            {
                                o.Locked = !o.Locked;
                                Didit = true;

                                if ( o is LockableContainer )
                                {
                                    LockableContainer cont = (LockableContainer)o;

                                    if ( cont.LockLevel == -255 )
                                        cont.LockLevel = cont.RequiredSkill - 10;
                                }

                                if ( targeted is Item )
                                {
                                    Item item = (Item)targeted;

                                    if ( o.Locked )
                                        item.SendAsciiMessageTo( from, "You lock it." );
                                    else
                                        item.SendAsciiMessageTo( from, "You unlock it." );
                                }
                            }
                        }
                    }

                    if ( !Didit )
                        from.SendAsciiMessage( "No key seems to unlock that." );
                }
                else
                {
                    from.SendAsciiMessage( "You can't unlock that!" );
                }
            }
コード例 #18
0
ファイル: KeyRing.cs プロジェクト: Ravenwolfe/xrunuo
            protected override void OnTarget( Mobile from, object targeted )
            {
                if ( targeted == m_KeyRing )
                {
                    from.SendLocalizedMessage( 501685 ); // You open the keyring.

                    m_KeyRing.ItemID = 0x1011;

                    foreach ( KeyInfo k in m_KeyRing.Keys )
                    {
                        Key key = new Key( k.type, k.KeyValue, k.Link );

                        key.Description = k.Description;

                        from.AddToBackpack( key );
                    }

                    m_KeyRing.Keys.Clear();
                }
                else if ( targeted is Item )
                {
                    Item item = (Item) targeted;

                    ILockable locker = targeted as ILockable;

                    if ( locker != null )
                    {
                        bool IsMatch = false;

                        foreach ( KeyInfo key in m_KeyRing.Keys )
                        {
                            if ( key.KeyValue == locker.KeyValue )
                            {
                                IsMatch = true;

                                break;
                            }
                        }

                        if ( IsMatch )
                        {
                            if ( locker.Locked )
                            {
                                locker.Locked = false;

                                item.SendLocalizedMessageTo( from, 1008137, item.Name ); // Unlocked :
                            }
                            else
                            {
                                locker.Locked = true;

                                item.SendLocalizedMessageTo( from, 1008136, item.Name ); // Locked :
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage( 1008140 ); // You do not have a key for that.
                        }
                    }
                    else
                    {
                        item.SendLocalizedMessageTo( from, 1008140 ); // You do not have a key for that.
                    }
                }
                else if ( targeted is Mobile )
                {
                    Mobile m = targeted as Mobile;

                    m.Say( 1008140 ); // You do not have a key for that.
                }
            }
コード例 #19
0
ファイル: BaseBoat.cs プロジェクト: justdanofficial/khaeros
        public uint CreateKeys( Mobile m )
        {
            uint value = Key.RandomValue();

            Key packKey = new Key( KeyType.Gold, value, this );
            packKey.MaxRange = 10;
            packKey.Name = "a ship key";

            if ( m.AddToBackpack( packKey ) )
                m.LocalOverheadMessage( MessageType.Regular, 0x3B2, 502485 ); // A ship's key is now in my backpack.
            else
                m.LocalOverheadMessage( MessageType.Regular, 0x3B2, 502483 ); // A ship's key is now at my feet.

            return value;
        }
コード例 #20
0
ファイル: Carpentry.cs プロジェクト: FreeReign/Rebirth-Repack
        private void OnTargetLoc( Mobile from, object target, object item )
        {
            object loc = null;
            if ( target is LandTarget )
                loc = ((LandTarget)target).Location;
            else if ( target is StaticTarget )
                loc = ((StaticTarget)target).Location;
            else if ( target is Item )
                loc = ((Item)target).Location;
            else if ( target is Mobile )
                loc = ((Mobile)target).Location;

            if ( loc == null )
            {
                from.SendAsciiMessage( "You cannot create that there." );
                return;
            }

            Item made = (Item)item;
            if ( from.Map.CanFit( (Point3D)loc, made.ItemData.Height, true, true ) )
            {
                made.MoveToWorld( (Point3D)loc, from.Map );
                if ( made is LockableContainer )
                {
                    if ( from.Skills[SkillName.Tinkering].Value >= Utility.Random( 100 ) )
                    {
                        LockableContainer cont = (LockableContainer)made;
                        Key key = new Key( KeyType.Copper, Key.RandomValue() );

                        cont.LockLevel = (int)(from.Skills[SkillName.Tinkering].Value/2)-15;
                        if ( cont.LockLevel < 1 )
                            cont.LockLevel = 1;
                        cont.MaxLockLevel = cont.LockLevel + 30;
                        cont.RequiredSkill = cont.LockLevel;

                        cont.KeyValue = key.KeyValue;
                        cont.DropItem( key );

                        from.SendAsciiMessage( "Your tinker skill was sufficient to make the item lockable." );
                    }
                }
            }
            else
            {
                from.SendAsciiMessage( "You cannot create that there." );
                made.Delete();
            }
        }
コード例 #21
0
		public int OnCraft( int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue )
		{		
			Type resourceType = typeRes;

			if ( resourceType == null )
				resourceType = craftItem.Ressources.GetAt( 0 ).ItemType;

			Resource = CraftResources.GetFromType( resourceType );
			
			if ( from.CheckSkill( SkillName.Tinkering, -5.0, 15.0 ) )
			{
				from.SendLocalizedMessage( 500636 ); // Your tinker skill was sufficient to make the item lockable.

				Key key = new Key( KeyType.Copper, Key.RandomValue() );

				KeyValue = key.KeyValue;
				DropItem( key );

				double tinkering = from.Skills[SkillName.Tinkering].Value;
				int level = (int)(tinkering * 0.8);

				RequiredSkill = level - 4;
				LockLevel = level - 14;
				MaxLockLevel = level + 35;

				if ( LockLevel == 0 )
					LockLevel = -1;
				else if ( LockLevel > 95 )
					LockLevel = 95;

				if ( RequiredSkill > 95 )
					RequiredSkill = 95;

				if ( MaxLockLevel > 95 )
					MaxLockLevel = 95;
			}
			else
			{
				from.SendLocalizedMessage( 500637 ); // Your tinker skill was insufficient to make the item lockable.
			}

			return 1;
		}
コード例 #22
0
ファイル: BaseBoat.cs プロジェクト: FreeReign/Rebirth-Repack
        public uint CreateKeys( Mobile m )
        {
            uint value = Key.RandomValue();

            Key packKey = new Key( KeyType.Gold, value, this );
            Key bankKey = new Key( KeyType.Gold, value, this );

            packKey.MaxRange = 10;
            bankKey.MaxRange = 10;

            BankBox box = m.BankBox;

            if ( box == null || !box.TryDropItem( m, bankKey, false ) )
                bankKey.Delete();
            else
                m.SendLocalizedMessage( 502484 ); // A ship's key is now in my safety deposit box.

            if ( m.AddToBackpack( packKey ) )
                m.SendLocalizedMessage( 502485 ); // A ship's key is now in my backpack.
            else
                m.SendLocalizedMessage( 502483 ); // A ship's key is now at my feet.

            return value;
        }
コード例 #23
0
ファイル: Key.cs プロジェクト: proxeeus/UORebirth
 public RenamePrompt(Key key)
 {
     m_Key = key;
 }
コード例 #24
0
		public override int OnCraft( int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue )
		{
			if ( from.CheckSkill( SkillName.Tinkering, -5.0, 15.0 ) )
			{
				from.SendLocalizedMessage( 500636 ); // Your tinker skill was sufficient to make the item lockable.

				Key key = new Key( KeyType.Copper, Key.RandomValue() );

				KeyValue = key.KeyValue;
				DropItem( key );

				double tinkering = from.Skills[SkillName.Tinkering].Value;
				int level = (int)(tinkering * 0.8);

				RequiredSkill = level - 4;
				LockLevel = level - 14;
				MaxLockLevel = level + 35;

				if ( LockLevel == 0 )
					LockLevel = -1;
				else if ( LockLevel > 95 )
					LockLevel = 95;

				if ( RequiredSkill > 95 )
					RequiredSkill = 95;

				if ( MaxLockLevel > 95 )
					MaxLockLevel = 95;
			}
			else
			{
				from.SendLocalizedMessage( 500637 ); // Your tinker skill was insufficient to make the item lockable.
			}
			
			#region Mondain's Legacy
			return base.OnCraft( quality, makersMark, from, craftSystem, typeRes, tool, craftItem, resHue );
			#endregion
		}
コード例 #25
0
        public TentSouthAddon( Mobile from )
        {
            this.Owner = from;
            AddonComponent ac;
            ac = new AddonComponent( 734 );
            AddComponent( ac, 3, 3, 0 );
            ac = new AddonComponent( 735 );
            AddComponent( ac, 2, 3, 0 );
            ac = new AddonComponent( 736 );
            AddComponent( ac, 3, 2, 0 );
            ac = new AddonComponent( 736 );
            AddComponent( ac, 3, 1, 0 );
            ac = new AddonComponent( 736 );
            AddComponent( ac, 3, 0, 0 );
            ac = new AddonComponent( 739 );
            AddComponent( ac, 3, -2, 0 );
            ac = new AddonComponent( 740 );
            AddComponent( ac, 2, -2, 0 );
            ac = new AddonComponent( 743 );
            AddComponent( ac, 1, -2, 0 );
            ac = new AddonComponent( 743 );
            AddComponent( ac, -1, -2, 0 );
            ac = new AddonComponent( 737 );
            AddComponent( ac, -2, -2, 0 );
            ac = new AddonComponent( 742 );
            AddComponent( ac, -2, -1, 0 );
            ac = new AddonComponent( 742 );
            AddComponent( ac, -2, 0, 0 );
            ac = new AddonComponent( 742 );
            AddComponent( ac, -2, 1, 0 );
            ac = new AddonComponent( 1635 );
            ac.Hue = 1341;
            AddComponent( ac, 3, 3, 25 );
            ac = new AddonComponent( 1633 );
            ac.Hue = 1341;
            AddComponent( ac, 3, 1, 25 );
            ac = new AddonComponent( 1632 );
            ac.Hue = 1341;
            AddComponent( ac, 1, 3, 25 );
            ac = new AddonComponent( 1630 );
            ac.Hue = 1341;
            AddComponent( ac, 0, 1, 25 );
            ac = new AddonComponent( 1631 );
            ac.Hue = 1341;
            AddComponent( ac, 1, 0, 25 );
            ac = new AddonComponent( 1636 );
            ac.Hue = 1341;
            AddComponent( ac, 3, 0, 25 );
            ac = new AddonComponent( 1637 );
            ac.Hue = 1341;
            AddComponent( ac, 0, 0, 25 );
            ac = new AddonComponent( 1638 );
            ac.Hue = 1341;
            AddComponent( ac, 0, 3, 25 );
            ac = new AddonComponent( 743 );
            AddComponent( ac, 0, -2, 0 );
            ac = new AddonComponent( 742 );
            AddComponent( ac, -2, 2, 0 );
            ac = new AddonComponent( 736 );
            AddComponent( ac, 3, -1, 0 );
            ac = new AddonComponent( 735 );
            AddComponent( ac, -1, 3, 0 );
            ac = new AddonComponent( 738 );
            AddComponent( ac, -2, 3, 0 );
            ac = new AddonComponent( 1633 );
            ac.Hue = 1341;
            AddComponent( ac, 3, 2, 25 );
            ac = new AddonComponent( 1632 );
            ac.Hue = 1341;
            AddComponent( ac, 2, 3, 25 );
            ac = new AddonComponent( 1630 );
            ac.Hue = 1341;
            AddComponent( ac, 0, 2, 25 );
            ac = new AddonComponent( 1631 );
            ac.Hue = 1341;
            AddComponent( ac, 2, 0, 25 );
            ac = new AddonComponent( 1635 );
            ac.Hue = 1341;
            AddComponent( ac, 2, 2, 28 );
            ac = new AddonComponent( 1636 );
            ac.Hue = 1341;
            AddComponent( ac, 2, 1, 28 );
            ac = new AddonComponent( 1637 );
            ac.Hue = 1341;
            AddComponent( ac, 1, 1, 28 );
            ac = new AddonComponent( 1638 );
            ac.Hue = 1341;
            AddComponent( ac, 1, 2, 28 );
            ac = new AddonComponent( 4012 );
            ac.Light = LightType.Circle150;
            AddComponent( ac, 1, 5, 0 );

            uint keyvalue = Convert.ToUInt32( 2 * Utility.RandomMinMax( 1, 4999 ) );
            WoodenBox pack = new WoodenBox();
            pack.MoveToWorld( this.Owner.Location );
            pack.Map = this.Owner.Map;
            pack.Y -= 1;
            pack.X -= 1;
            pack.Movable = false;
            pack.KeyValue = keyvalue;
            pack.LockLevel = 95;
            pack.RequiredSkill = 95;
            pack.ItemID = 0x9AA;

            Key key = new Key();
            key.KeyValue = keyvalue;
            pack.DropItem( key );
            this.Box = pack;

            Bedroll bedroll = new Bedroll();
            bedroll.MoveToWorld( this.Owner.Location );
            bedroll.Map = this.Owner.Map;
            bedroll.Y += 1;
            bedroll.Z -= 1;
            bedroll.ItemID = 0xA56;
            bedroll.Movable = false;
            this.Bedroll = bedroll;
        }
コード例 #26
0
			public RenamePrompt( Key key )
			{
				m_Key = key;
			}
コード例 #27
0
        public override void OnDoubleClick( Mobile from )
        {
            if( from == null || !from.InRange( this.Location, 2 ) || !from.InLOS( this.Location ) || !from.Alive || from.Paralyzed )
            {
                from.SendMessage( "You are too far away." );
                return;
            }

            if( m_Owner == null )
            {
                bool haschest = false;

                foreach( Item item in from.GetItemsInRange( 10 ) )
                {
                    if( item is BaseStorageContainer )
                    {
                        BaseStorageContainer cont = item as BaseStorageContainer;

                        if( cont.Owner == from )
                            haschest = true;
                    }
                }

                if( haschest )
                {
                    from.SendMessage( "You already have a storage box in this area." );
                    return;
                }

                Container pack = from.Backpack;

                if ( !pack.ConsumeTotal( typeof( Copper ), m_Price ) )
                {
                    from.SendMessage( "You need to be carrying " + m_Price + " copper coins in order to purchase this storage box." );
                }

                else
                {
                    m_Owner = from;
                    m_OwnersName = from.Name;

                    if( m_OwnersName.EndsWith( "s" ) )
                        m_OwnersName = m_OwnersName + "'";

                    else
                        m_OwnersName = m_OwnersName + "'s";

                    this.Name = "" + m_OwnersName + " Storage Box";

                    Key key = new Key();

                    uint newlock = Key.RandomValue();
                    this.KeyValue = newlock;
                    this.Locked = true;
                    key.KeyValue = newlock;
                    pack.DropItem( key );
                    this.LastRent = DateTime.Now;
                    from.SendMessage( "A key to the storage box has been placed in your backpack and " + m_Price + " copper coins have been charged from you." );

                    Copper copper = new Copper( m_Price );

                    if( this.Nation != Nation.None && this.AssignTreasury() )
                    {
                        if( this.Treasury is BaseContainer )
                            ( (BaseContainer)this.Treasury ).DropAndStack( copper );
                    }
                }
            }

            else
                base.OnDoubleClick( from );
        }
コード例 #28
0
			public CopyTarget( Key key ) : base( 3, false, TargetFlags.None )
			{
				m_Key = key;
			}
コード例 #29
0
ファイル: TheOneBob.cs プロジェクト: zerodowned/angelisland
        public override void GenerateLoot()
        {
            int phrase = Utility.Random(2);
            switch (phrase)
            {
                case 0: this.Say(true, "Bobs for Bob!"); break;
                case 1: this.Say(true, "Bob will rise!"); break;
            }

            // make the magic key
            Key key = new Key(KeyType.Magic);
            key.KeyValue = Key.RandomValue();

            // make the magic box
            MagicBox MagicBox = new MagicBox();
            MagicBox.Movable = true;
            MagicBox.KeyValue = key.KeyValue;
            MagicBox.DropItem(key);

            PackItem(MagicBox);

            // add bob's pillow
            Item pillow = new Item(Utility.RandomList(5029, 5030, 5031, 5032, 5033, 5034, 5035, 5036, 5037, 5038));
            pillow.Hue = 23;
            pillow.Name = "Pillow of The One Bob";
			pillow.Weight = 1.0; 

            PackItem(pillow);
        }
コード例 #30
0
ファイル: Key.cs プロジェクト: FreeReign/forkuo
 public RenamePrompt(Key key)
 {
     this.m_Key = key;
 }
コード例 #31
0
		public override Item CompleteCraft( out int _check ) {
			_check = Verify( this.Door );

			if( _check == 0 ) {
				int level = (int)(From.Skills.Tinkering.Value);
				uint KeyValue;

				Key key = new Key( KeyType.Iron, Key.RandomValue() );

				KeyValue = key.KeyValue;
				From.AddToBackpack( key );

				From.PlaySound( 0x3A4 );
				From.SendMessage( "You successfully install the lock." );

				Door.HasLock = true;
				Door.RequiredSkill = level - 20;
				Door.MaxLockLevel = level;
				Door.LockLevel = level - 10;
				Door.KeyValue = KeyValue;

				if( Door.Link != null ) {

					Door.Link.HasLock = true;
					Door.Link.RequiredSkill = level - 20;
					Door.Link.MaxLockLevel = level;
					Door.Link.LockLevel = level - 10;
					Door.Link.KeyValue = KeyValue;
				}
			}

			return null;
		}
コード例 #32
0
ファイル: BaseBoat.cs プロジェクト: PepeBiondi/runsa
		public uint CreateKeys( Mobile m )
		{
			uint value = Key.RandomValue();

			Key packKey = new Key( KeyType.Gold, value, this );
			Key bankKey = new Key( KeyType.Gold, value, this );

			packKey.MaxRange = 10;
			bankKey.MaxRange = 10;

			packKey.Name = "a ship key";
			bankKey.Name = "a ship key";

			BankBox box = m.BankBox;

			if ( !box.TryDropItem( m, bankKey, false ) )
				bankKey.Delete();
			else
				m.LocalOverheadMessage( MessageType.Regular, 0x3B2, 502484 ); // A ship's key is now in my safety deposit box.

			if ( m.AddToBackpack( packKey ) )
				m.LocalOverheadMessage( MessageType.Regular, 0x3B2, 502485 ); // A ship's key is now in my backpack.
			else
				m.LocalOverheadMessage( MessageType.Regular, 0x3B2, 502483 ); // A ship's key is now at my feet.

			return value;
		}
コード例 #33
0
ファイル: CraftItem.cs プロジェクト: zerodowned/angelisland
		public void CompleteCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool)
		{
			int badCraft = craftSystem.CanCraft(from, tool, m_Type);

			if (badCraft > 0)
			{
				if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
					from.SendGump(new CraftGump(from, craftSystem, tool, badCraft));
				else
					from.SendLocalizedMessage(badCraft);

				return;
			}

			int checkResHue = 0, checkMaxAmount = 0;
			object checkMessage = null;

			// Not enough resource to craft it
			if (!ConsumeRes(from, typeRes, craftSystem, ref checkResHue, ref checkMaxAmount, ConsumeType.None, ref checkMessage))
			{
				if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
					from.SendGump(new CraftGump(from, craftSystem, tool, checkMessage));
				else if (checkMessage is int && (int)checkMessage > 0)
					from.SendLocalizedMessage((int)checkMessage);
				else if (checkMessage is string)
					from.SendMessage((string)checkMessage);

				return;
			}
			else if (!ConsumeAttributes(from, ref checkMessage, false))
			{
				if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
					from.SendGump(new CraftGump(from, craftSystem, tool, checkMessage));
				else if (checkMessage is int && (int)checkMessage > 0)
					from.SendLocalizedMessage((int)checkMessage);
				else if (checkMessage is string)
					from.SendMessage((string)checkMessage);

				return;
			}

			bool toolBroken = false;
			int ignored = 1;
			int endquality = 1;
			bool allRequiredSkills = true;

			// pla, 01/04/07
			// -----------------------------------------------------------------
			// Additional checks required here to prevent skill gain exploit with special dye tubs.               
			if (craftSystem is DefAlchemy && (ItemType == typeof(SpecialDyeTub) || ItemType == typeof(SpecialDye)))
			{
				// note here that if lighten or darken was chosen, there will always be at least one special tub,
				// as it's set as a resource requirement.
				if (m_NameString == "> Darken the mix" || m_NameString == "> Lighten the mix")
				{
					// darken/lighten requires a special tub
					// Get list of all special tubs
					Item[] sdtubs = ((Container)from.Backpack).FindItemsByType(typeof(SpecialDyeTub), true);
					SpecialDyeTub sdtub;

					if (sdtubs.Length == 0)
					{
						//should be impossible as in reqs
						return;
					}
					else if (sdtubs.Length == 1)
					{
						// in this case we have just one tub.  This means we will leave skill gain and execution to the 
						// standard craft code below.  However, we need to first check if the tub can be lightened/darkened,
						// and if not then return to prevent skill gain with no resource use.
						sdtub = (SpecialDyeTub)sdtubs[0];
						if (sdtub != null)
						{
							if (m_NameString == "> Darken the mix")
							{
								if (!sdtub.CanDarken)
								{
									from.SendMessage("You attempt to darken the mix, but it will go no darker.");
									from.SendGump(new CraftGump(from, craftSystem, tool, 0));
									return;
								}
							}
							else
							{
								if (!sdtub.CanLighten)
								{
									from.SendMessage("You attempt to lighten the mix, but it will go no lighter.");
									from.SendGump(new CraftGump(from, craftSystem, tool, 0));
									return;
								}
							}
						}

					}
					else if (sdtubs.Length > 1)
					{
						// in this case we have more than one possible tub to select so we hand execution over to the target.
						//target also deals with all skill gain and failure/tool use etc.
						int resHue = 0;
						int maxAmount = 0;
						object message = null;
						from.SendMessage("Select the dye tub you wish to use for the process.");
						from.Target = new SpecialDyeTubTarget(this, typeRes, craftSystem, ref resHue, ref maxAmount, ref message, m_NameString, (m_NameString == "> Darken the mix" ? 1 : 2), tool);
						//and now return to prevent the rest of the code executing
						return;
					}
				}
				else
				{
					// Create/append dye.  This can either add to a same coloured special tub, or a fresh non-special tub.
					// So first we find all the valid tubs...
					Item[] dtubs = ((Container)from.Backpack).FindItemsByType(typeof(DyeTub), true);

					int iFound = 0;
					if (dtubs.Length > 0)
					{
						for (int i = 0; i < dtubs.Length; i++)
						{
							if (dtubs[i] is SpecialDyeTub)
							{
								// Is the same color?
								if (((SpecialDyeTub)dtubs[i]).StoredColorName == m_NameString && ((SpecialDyeTub)dtubs[i]).Uses < 100 && !((SpecialDyeTub)dtubs[i]).Prepped)
								{
									iFound++;
								}
							}
							else
							{
								iFound++;
							}
						}
					}

					if (iFound == 0)
					{
						from.SendMessage("You need a fresh dye tub or one that is not yet full and of the same color as the dye you are preparing.");
						from.SendGump(new CraftGump(from, craftSystem, tool, 0));
						return;
					}
					else if (iFound == 1)
					{
						// once again if no target is required then we just let it fall through
					}
					else if (iFound > 1)
					{
						//ok in this case we found more than one valid tub so hand execution over to the target and end
						int resHue = 0;
						int maxAmount = 0;
						object message = null;
						from.SendMessage("Select the dye tub you wish to use for the process.");
						from.Target = new SpecialDyeTubTarget(this, typeRes, craftSystem, ref resHue, ref maxAmount, ref message, m_NameString, 0, tool);
						return;
					}
				}
			} // ----------------------------------------------------------------- /

			//This check is where skill is (possibly) gained!  
			//PLA: 04/06/09 - Prevent skillgain from special tubs entirely
			if (!(craftSystem is DefAlchemy && (ItemType == typeof(SpecialDyeTub) || ItemType == typeof(SpecialDye))))
			{
				CheckSkills(from, typeRes, craftSystem, ref ignored, ref allRequiredSkills);
			}

			if (quality >= 0)
			{
				// Resource
				int resHue = 0;
				int maxAmount = 0;

				object message = null;

				ConsumeType ct = ConsumeType.All;

				// erl: if this is special dye, forget about consumption for now
				// ..
				if (craftSystem is DefAlchemy && (ItemType == typeof(SpecialDyeTub) || ItemType == typeof(SpecialDye)))
					ct = ConsumeType.None;
				// ..

				// Not enough resource to craft it				ha
				if (!ConsumeRes(from, typeRes, craftSystem, ref resHue, ref maxAmount, ct, ref message))
				{
					if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
						from.SendGump(new CraftGump(from, craftSystem, tool, message));
					else if (message is int && (int)message > 0)
						from.SendLocalizedMessage((int)message);
					else if (message is string)
						from.SendMessage((string)message);

					return;
				}

				if (!ConsumeAttributes(from, ref message, true))
				{
					if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
						from.SendGump(new CraftGump(from, craftSystem, tool, message));
					else if (message is int && (int)message > 0)
						from.SendLocalizedMessage((int)message);
					else if (message is string)
						from.SendMessage((string)message);

					return;
				}

				tool.UsesRemaining--;

				if (tool.UsesRemaining < 1)
					toolBroken = true;

				if (toolBroken)
					tool.Delete();

				// Adam: this is it. Make the item
				Item item = Activator.CreateInstance(ItemType) as Item;


				bool bTinkerTrap = false;

				if (item != null)
				{
					// Adam: mark it as PlayerCrafted
					item.PlayerCrafted = true;

					if (item is BaseWeapon)
					{
						BaseWeapon weapon = (BaseWeapon)item;
						weapon.Quality = (WeaponQuality)quality;
						endquality = quality;

						if (makersMark)
							weapon.Crafter = from;

						// Adam: one day we can obsolete and and use item.PlayerCrafted
						// erl: 10 Nov 05: that day is today!
						// weapon.PlayerConstructed = true;

						/*if ( Core.AOS )
						{
							Type resourceType = typeRes;

							if ( resourceType == null )
								resourceType = Ressources.GetAt( 0 ).ItemType;

							weapon.Resource = CraftResources.GetFromType( resourceType );

							CraftContext context = craftSystem.GetContext( from );

							if ( context != null && context.DoNotColor )
								weapon.Hue = 0;

							if ( tool is BaseRunicTool )
								((BaseRunicTool)tool).ApplyAttributesTo( weapon );

							if ( quality == 2 )
							{
								if ( weapon.Attributes.WeaponDamage > 35 )
									weapon.Attributes.WeaponDamage -= 20;
								else
									weapon.Attributes.WeaponDamage = 15;
							}
						}
						else
						*/
						if (tool is BaseRunicTool)
						{
							Type resourceType = typeRes;

							if (resourceType == null)
								resourceType = Ressources.GetAt(0).ItemType;

							CraftResource thisResource = CraftResources.GetFromType(resourceType);

							if (thisResource == ((BaseRunicTool)tool).Resource)
							{
								weapon.Resource = thisResource;

								CraftContext context = craftSystem.GetContext(from);

								if (context != null && context.DoNotColor)
									weapon.Hue = 0;

								switch (thisResource)
								{
									case CraftResource.DullCopper:
										{
											weapon.Identified = true;
											weapon.DurabilityLevel = WeaponDurabilityLevel.Durable;
											weapon.AccuracyLevel = WeaponAccuracyLevel.Accurate;
											break;
										}
									case CraftResource.ShadowIron:
										{
											weapon.Identified = true;
											weapon.DurabilityLevel = WeaponDurabilityLevel.Durable;
											weapon.DamageLevel = WeaponDamageLevel.Ruin;
											break;
										}
									case CraftResource.Copper:
										{
											weapon.Identified = true;
											weapon.DurabilityLevel = WeaponDurabilityLevel.Fortified;
											weapon.DamageLevel = WeaponDamageLevel.Ruin;
											weapon.AccuracyLevel = WeaponAccuracyLevel.Surpassingly;
											break;
										}
									case CraftResource.Bronze:
										{
											weapon.Identified = true;
											weapon.DurabilityLevel = WeaponDurabilityLevel.Fortified;
											weapon.DamageLevel = WeaponDamageLevel.Might;
											weapon.AccuracyLevel = WeaponAccuracyLevel.Surpassingly;
											break;
										}
									case CraftResource.Gold:
										{
											weapon.Identified = true;
											weapon.DurabilityLevel = WeaponDurabilityLevel.Indestructible;
											weapon.DamageLevel = WeaponDamageLevel.Force;
											weapon.AccuracyLevel = WeaponAccuracyLevel.Eminently;
											break;
										}
									case CraftResource.Agapite:
										{
											weapon.Identified = true;
											weapon.DurabilityLevel = WeaponDurabilityLevel.Indestructible;
											weapon.DamageLevel = WeaponDamageLevel.Power;
											weapon.AccuracyLevel = WeaponAccuracyLevel.Eminently;
											break;
										}
									case CraftResource.Verite:
										{
											weapon.Identified = true;
											weapon.DurabilityLevel = WeaponDurabilityLevel.Indestructible;
											weapon.DamageLevel = WeaponDamageLevel.Power;
											weapon.AccuracyLevel = WeaponAccuracyLevel.Exceedingly;
											break;
										}
									case CraftResource.Valorite:
										{
											weapon.Identified = true;
											weapon.DurabilityLevel = WeaponDurabilityLevel.Indestructible;
											weapon.DamageLevel = WeaponDamageLevel.Vanq;
											weapon.AccuracyLevel = WeaponAccuracyLevel.Supremely;
											break;
										}
								}
							}
						}
					}
					else if (item is BaseArmor)
					{
						BaseArmor armor = (BaseArmor)item;
						armor.Quality = (ArmorQuality)quality;
						endquality = quality;

						if (makersMark)
							armor.Crafter = from;

						Type resourceType = typeRes;

						if (resourceType == null)
							resourceType = Ressources.GetAt(0).ItemType;

						armor.Resource = CraftResources.GetFromType(resourceType);

						// Adam: one day we can obsolete and and use item.PlayerCrafted
						// erl: 10 Nov 05: that day is today!
						// armor.PlayerConstructed = true;

						CraftContext context = craftSystem.GetContext(from);

						if (context != null && context.DoNotColor)
							armor.Hue = 0;

						if (quality == 2)
							armor.DistributeBonuses((tool is BaseRunicTool ? 6 : 14));

						if (Core.AOS && tool is BaseRunicTool)
							((BaseRunicTool)tool).ApplyAttributesTo(armor);
					}
					else if (item is FullBookcase || item is FullBookcase2 || item is FullBookcase3)
					{
						// Does it now become a ruined bookcase? 5% chance.

						if (Utility.RandomDouble() > 0.95)
						{
							from.SendMessage("You craft the bookcase, but it is ruined.");

							item.Delete();
							item = new RuinedBookcase();
							item.Movable = true;
						}
						else
							from.SendMessage("You finish the bookcase and fill it with books.");

						// Consume single charge from scribe pen...

						Item[] spens = ((Container)from.Backpack).FindItemsByType(typeof(ScribesPen), true);

						if (--((ScribesPen)spens[0]).UsesRemaining == 0)
						{
							from.SendMessage("You have worn out your tool!");
							spens[0].Delete();
						}

					}
					else if (item is DragonBardingDeed)
					{
						DragonBardingDeed deed = (DragonBardingDeed)item;

						deed.Exceptional = (quality >= 2);
						endquality = quality;

						if (makersMark)
							deed.Crafter = from;

						Type resourceType = typeRes;

						if (resourceType == null)
							resourceType = Ressources.GetAt(0).ItemType;

						deed.Resource = CraftResources.GetFromType(resourceType);

						CraftContext context = craftSystem.GetContext(from);

						if (context != null && context.DoNotColor)
							deed.Hue = 0;
					}
					else if (item is BaseInstrument)
					{
						BaseInstrument instrument = (BaseInstrument)item;

						instrument.Quality = (InstrumentQuality)quality;
						endquality = quality;

						if (makersMark)
							instrument.Crafter = from;
					}
					else if (item is BaseJewel)
					{
						BaseJewel jewel = (BaseJewel)item;

						Type resourceType = typeRes;
						endquality = quality;

						if (resourceType == null)
							resourceType = Ressources.GetAt(0).ItemType;

						jewel.Resource = CraftResources.GetFromType(resourceType);

						if (1 < Ressources.Count)
						{
							resourceType = Ressources.GetAt(1).ItemType;

							if (resourceType == typeof(StarSapphire))
								jewel.GemType = GemType.StarSapphire;
							else if (resourceType == typeof(Emerald))
								jewel.GemType = GemType.Emerald;
							else if (resourceType == typeof(Sapphire))
								jewel.GemType = GemType.Sapphire;
							else if (resourceType == typeof(Ruby))
								jewel.GemType = GemType.Ruby;
							else if (resourceType == typeof(Citrine))
								jewel.GemType = GemType.Citrine;
							else if (resourceType == typeof(Amethyst))
								jewel.GemType = GemType.Amethyst;
							else if (resourceType == typeof(Tourmaline))
								jewel.GemType = GemType.Tourmaline;
							else if (resourceType == typeof(Amber))
								jewel.GemType = GemType.Amber;
							else if (resourceType == typeof(Diamond))
								jewel.GemType = GemType.Diamond;
						}

						if (makersMark)
							jewel.Crafter = from;

						jewel.Quality = (JewelQuality)quality;
					}
					else if (item is BaseClothing)
					{
						BaseClothing clothing = (BaseClothing)item;
						clothing.Quality = (ClothingQuality)quality;
						endquality = quality;

						if (makersMark)
							clothing.Crafter = from;

						// Adam: one day we can obsolete and and use item.PlayerCrafted
						// erl: 10 Nov 05: that day is today!
						// clothing.PlayerConstructed = true;

						if (item is BaseShoes)
						{
							BaseShoes shoes = (BaseShoes)item;

							if (shoes.Resource != CraftResource.None)
							{
								Type resourceType = typeRes;

								if (resourceType == null)
									resourceType = Ressources.GetAt(0).ItemType;

								shoes.Resource = CraftResources.GetFromType(resourceType);

								CraftContext context = craftSystem.GetContext(from);

								if (context != null && context.DoNotColor)
									shoes.Hue = 0;
							}
							else
							{
								shoes.Hue = resHue;
							}
						}
						else if ((item is BaseGloves) && (resHue == 0))
						{
							clothing.Hue = 1001;
							// Rhi: The default color for cloth gloves should be white, 
							// not the leather gloves color, which is what it will be if the hue is 0.
						}
						else
						{
							clothing.Hue = resHue;
						}

						// erl: give clothing initial hitpoint values
						// ..

						int iMax = clothing.InitMaxHits;
						int iMin = clothing.InitMinHits;

						if (clothing.Quality == ClothingQuality.Exceptional)
						{

							// Add 50% to both

							iMax = (iMax * 3) / 2; // Fixed order of precedence bug
							iMin = (iMin * 3) / 2;

							// make exceptional clothes newbied

							clothing.LootType = LootType.Newbied;
						}
						else if (clothing.Quality == ClothingQuality.Low)
						{
							// Lose 20% to both

							iMax = (iMax * 4) / 5; // Fixed order of precedence bug
							iMin = (iMin * 4) / 5;
						}

						clothing.HitPoints = clothing.MaxHitPoints = (short)Utility.RandomMinMax(iMin, iMax);

						// ..

					}
					else if (item is BaseTool || item is BaseHarvestTool && quality == 2)
					{
						endquality = quality;

						if (item is BaseTool)
							((BaseTool)item).UsesRemaining *= 3;
						else
							((BaseHarvestTool)item).UsesRemaining *= 3;
					}
					else if (item is MapItem)
					{
						((MapItem)item).CraftInit(from);
					}
					else if (item is LockableContainer)
					{
						if (from.CheckSkill(SkillName.Tinkering, -5.0, 15.0))
						{
							LockableContainer cont = (LockableContainer)item;

							from.SendLocalizedMessage(500636); // Your tinker skill was sufficient to make the item lockable.

							Key key = new Key(KeyType.Copper, Key.RandomValue());

							cont.KeyValue = key.KeyValue;
							cont.DropItem(key);
							/*
														double tinkering = from.Skills[SkillName.Tinkering].Value;
														int level = (int)(tinkering * 0.8);

														cont.RequiredSkill = level - 4;
														cont.LockLevel = level - 14;
														cont.MaxLockLevel = level + 35;

														if ( cont.LockLevel == 0 )
															cont.LockLevel = -1;
														else if ( cont.LockLevel > 95 )
															cont.LockLevel = 95;

														if ( cont.RequiredSkill > 95 )
															cont.RequiredSkill = 95;

														if ( cont.MaxLockLevel > 95 )
															cont.MaxLockLevel = 95;
							Commented out by darva to try new tinker lock strength code.*/

							double tinkering = from.Skills[SkillName.Tinkering].Value;
							int level = (int)(tinkering);
							cont.RequiredSkill = 36;
							if (level >= 65)
								cont.RequiredSkill = 76;
							if (level >= 80)
								cont.RequiredSkill = 84;
							if (level >= 90)
								cont.RequiredSkill = 92;
							if (level >= 100)
								cont.RequiredSkill = 100;
							cont.LockLevel = cont.RequiredSkill - 10;
							cont.MaxLockLevel = cont.RequiredSkill + 40;


						}
						else
						{
							from.SendLocalizedMessage(500637); // Your tinker skill was insufficient to make the item lockable.
						}
					}
					else if (item is Runebook)
					{
						int charges = 5 + quality + (int)(from.Skills[SkillName.Inscribe].Value / 30);
						endquality = quality;

						if (charges > 10)
							charges = 10;

						((Runebook)item).MaxCharges = charges;

						if (makersMark)
							((Runebook)item).Crafter = from;

						((Runebook)item).Quality = (RunebookQuality)quality;
					}
					else if (item is Bola)
					{
						Bola b = (Bola)item;
						b.Quality = (WeaponQuality)quality;
						endquality = quality;

						if (makersMark)
							b.Crafter = from;
					}
					else if (item.Hue == 0)
					{
						item.Hue = resHue;
					}

					if (maxAmount > 0)
						item.Amount = maxAmount;

					// **********************************************

					if (craftSystem is DefAlchemy && item is BasePotion)
					{
						BasePotion pot = (BasePotion)item;

						Container pack = from.Backpack;

						if (pack != null)
						{
							Item[] kegs = pack.FindItemsByType(typeof(PotionKeg), true);

							for (int i = 0; i < kegs.Length; ++i)
							{
								PotionKeg keg = kegs[i] as PotionKeg;

								if (keg == null)
									continue;

								if (keg.Held <= 0 || keg.Held >= 100)
									continue;

								if (keg.Type != pot.PotionEffect)
									continue;

								++keg.Held;
								item.Delete();
								item = new Bottle();

								endquality = -1; // signal placed in keg

								break;
							}
						}
					}
					if (craftSystem is DefAlchemy && (item is SpecialDye || item is SpecialDyeTub))
					{
						// Which special dye tub do we want to use?

						Item[] sdtubs = ((Container)from.Backpack).FindItemsByType(typeof(SpecialDyeTub), true);
						SpecialDyeTub sdtub;

						if (m_NameString == "> Darken the mix" || m_NameString == "> Lighten the mix" && sdtubs.Length > 0)
						{
							sdtub = (SpecialDyeTub)sdtubs[0];

							if (sdtubs.Length > 1)
							{
								// Pla, 04/01/07
								// This code will never be called now but left it in for sanity.
								// -----------------------------------------------------------------
								// Let the target take over from here
								//from.Target = new SpecialDyeTubTarget( this, typeRes, craftSystem, ref resHue, ref maxAmount, ref message, ref item, m_NameString, (m_NameString == "> Darken the mix" ? 1 : 2) );
								//from.SendMessage("Select the dye tub you wish to use for the process.");
							}
							else
							{
								int iConsume = 0;

								if (m_NameString == "> Darken the mix")
								{
									if (sdtub.DarkenMix())
									{
										from.SendMessage("You darken the mix with black pearl...");
										double dCalc = sdtub.Uses;
										dCalc /= 5;
										iConsume = ((int)dCalc) + 1;
									}
									else //pla: This will never happen now
										from.SendMessage("You attempt to darken the mix, but it will go no darker.");

								}
								else
								{
									if (sdtub.LightenMix())
									{
										from.SendMessage("You lighten the mix with sulfurous ash...");
										double dCalc = sdtub.Uses;
										dCalc /= 5;
										iConsume = ((int)dCalc) + 1;
									}
									else //pla: This will never happen now
										from.SendMessage("You attempt to lighten the mix, but it will go no lighter.");
								}

								for (int i = 0; i < iConsume; i++)
									ConsumeRes(from, typeRes, craftSystem, ref resHue, ref maxAmount, ConsumeType.All, ref message);

								from.PlaySound(0x242);
							}
						}
						else
						{
							// Make sure they've got a regular dye tub / a special one of the same color

							Item[] dtub = ((Container)from.Backpack).FindItemsByType(typeof(DyeTub), true);
							DyeTub dt = null;

							int iFound = 0;

							if (dtub.Length > 0)
							{
								for (int i = 0; i < dtub.Length; i++)
								{
									if (dtub[i] is SpecialDyeTub)
									{
										// Is the same color?
										if (((SpecialDyeTub)dtub[i]).StoredColorName == m_NameString && ((SpecialDyeTub)dtub[i]).Uses < 100 && !((SpecialDyeTub)dtub[i]).Prepped)
										{
											dt = (DyeTub)dtub[i];
											iFound++;
										}

										continue;
									}
									else
									{
										dt = (DyeTub)dtub[i];
										iFound++;
									}
								}
							}

							sdtub = (SpecialDyeTub)item;

							if (dt == null)
							{
								from.SendMessage("You need a fresh dye tub or one that is not yet full and of the same color as the dye you are preparing.");
								sdtub.Delete();
							}
							else
							{
								if (iFound > 1)
								{
									// Pla, 04/01/07
									// This code will never be called now but left it in for sanity
									// -----------------------------------------------------------------
									// Let the target take over from here
									//from.Target = new SpecialDyeTubTarget( this, typeRes, craftSystem, ref resHue, ref maxAmount, ref message, ref item, m_NameString, 0 );
									//from.SendMessage("Select the dye tub you wish to use for the process.");
								}
								else
								{

									if (dt is SpecialDyeTub)
									{
										sdtub.Delete();
										((SpecialDyeTub)dt).Uses++;
										from.SendMessage("You mix the dye and add it to an existing batch.");
									}
									else
									{
										sdtub.StoreColor(m_NameString);
										dt.Delete();
										from.SendMessage("You successfully mix the dye.");
										from.AddToBackpack(item);
									}
									ConsumeRes(from, typeRes, craftSystem, ref resHue, ref maxAmount, ConsumeType.All, ref message);
								}
							}
						}
					}

					if (craftSystem is DefTinkering &&
						item is BaseTinkerTrap)
					{
						//Need to send target cursor to target
						//the trappable container
						bTinkerTrap = true;

						int power = (int)from.Skills[SkillName.Tinkering].Value + Utility.Random(0, 15);
						if (power <= 10) power = 10;
						((BaseTinkerTrap)item).Power = power;
						from.SendMessage("Target the container you wish to trap.");
						from.Target = new TrappableContainerTarget(this, item, craftSystem, toolBroken, tool);
					}

					if (!bTinkerTrap && (!(item is SpecialDyeTub || item is SpecialDye)))
					{
						from.AddToBackpack(item);
					}

					//from.PlaySound( 0x57 );
				}

				if (!bTinkerTrap)
				{
					int num = craftSystem.PlayEndingEffect(from, false, true, toolBroken, endquality, makersMark, this);

					if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
						from.SendGump(new CraftGump(from, craftSystem, tool, num));
					else if (num > 0)
						from.SendLocalizedMessage(num);
				}
			}
			else if (!allRequiredSkills)
			{
				if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
					from.SendGump(new CraftGump(from, craftSystem, tool, 1044153));
				else
					from.SendLocalizedMessage(1044153); // You don't have the required skills to attempt this item.
			}
			else
			{

				ConsumeType consumeType = (UseAllRes ? ConsumeType.Fail : ConsumeType.Half);
				int resHue = 0;
				int maxAmount = 0;

				object message = null;

				// Not enough resource to craft it
				if (!ConsumeRes(from, typeRes, craftSystem, ref resHue, ref maxAmount, consumeType, ref message))
				{
					if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
						from.SendGump(new CraftGump(from, craftSystem, tool, message));
					else if (message is int && (int)message > 0)
						from.SendLocalizedMessage((int)message);
					else if (message is string)
						from.SendMessage((string)message);

					return;
				}

				tool.UsesRemaining--;

				if (tool.UsesRemaining < 1)
					toolBroken = true;

				if (toolBroken)
					tool.Delete();

				// SkillCheck failed.
				int num = craftSystem.PlayEndingEffect(from, true, true, toolBroken, endquality, false, this);

				if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
					from.SendGump(new CraftGump(from, craftSystem, tool, num));
				else if (num > 0)
					from.SendLocalizedMessage(num);
			}
		}
コード例 #34
0
        protected override void OnTarget(Mobile from, object target) // Override the protected OnTarget() for our feature
        {
            if (target is BaseDoor)
            {
                BaseDoor door = target as BaseDoor;
                BaseHouse h1 = BaseHouse.FindHouseAt(door);
                BaseHouse h2 = BaseHouse.FindHouseAt(from);
                if (h1 == null || h1 != h2)
                {
                    from.SendLocalizedMessage(502094); // You must be in your house to do this.
                    return;
                }
                else if (h1.IsOwner(from) == false)
                {
                    from.SendLocalizedMessage(501303); // Only the house owner may change the house locks.
                    return;
                }

                // don't remove old keys because you will endup removing the main house keys
                //  we need to single this door out somehow
                // Key.RemoveKeys( from, oldKeyValue );

                // make the keys
                uint keyValue = Key.RandomValue();
                Key packKey = new Key(KeyType.Gold);
                Key bankKey = new Key(KeyType.Gold);
                packKey.KeyValue = keyValue;
                bankKey.KeyValue = keyValue;
                BankBox box = from.BankBox;
                if (box == null || !box.TryDropItem(from, bankKey, false))
                    bankKey.Delete();
                from.AddToBackpack(packKey);

                // rekey door
                door.KeyValue = keyValue;

                from.SendMessage("The lock on this door has been changed, and new master key has been placed in your bank and your backpack.");
                m_Deed.Delete(); // Delete the deed                
            }
            else
            {
                from.SendMessage("That is not a door.");
            }
        }
コード例 #35
0
ファイル: KeyRing.cs プロジェクト: FreeReign/imaginenation
		public void Add( Key key, Mobile m )
		{
			key.Internalize();
			m_Keys.Add( key );

            m.PlaySound(740);

			UpdateItemID();
		}