예제 #1
0
		public override void AddContents( BaseContainer cont, Mobile creature, out int contentValue )
		{
			base.AddContents( cont, creature, out contentValue );

			if ( m_RuneChance > Utility.RandomDouble() )
				cont.DropItem( new RecallRune() );

			int scrollcount = Utility.RandomMinMax( MinAmount / 25, MaxAmount / 8 );

			for ( int i = 0; i < scrollcount; i++ )
			{
				if ( (m_RuneChance / 3.0) > Utility.RandomDouble() )
				{
					Item item = null;
					switch ( Utility.Random( 5 ) )
					{
						default:
						case 0: case 1: case 2: item = new RecallScroll(); break;
						case 3: item = new MarkScroll(); break;
						case 4: item = new GateTravelScroll(); break;
					}

					cont.DropItem( item );
				}
			}
		}
        public void AddCharges(Mobile User, Item target)
        {
            GateTravelScroll scrolls = target as GateTravelScroll;

            if (scrolls != null)
            {
                if (scrolls.RootParentEntity == User)
                {
                    if (Charges < 1000)
                    {
                        User.Send(new PlaySound(0x249, GetWorldLocation()));

                        int amount = scrolls.Amount;

                        if (amount > (1000 - Charges))
                        {
                            scrolls.Consume(1000 - Charges);
                            Charges = 1000;
                            User.SendMessage(54, "You have fully charged the crystal portal.");
                        }
                        else
                        {
                            Charges += amount;
                            scrolls.Delete();
                            User.SendMessage(54, "You have added " + amount + " charge(s) to the crystal portal.");
                        }
                    }
                    else
                    {
                        User.SendMessage(54, "This crystal portal cannot hold more charges.");
                    }
                }
                else
                {
                    User.SendMessage(54, "You must have the gate travel scrolls in your backpack to charge the crystal portal.");
                }
            }
            else
            {
                User.SendMessage(54, "You must use gate travel scrolls to charge the crystal portal!");
            }
        }