public override void OnDoubleClick( Mobile from )
        {

        	if ( !IsChildOf (from.Backpack))
        		{
				from.SendMessage( "In order to make a wish and crush the coal with your hands, it must be in your backpack." );
        	    }
        	else
        	{
        	
        	Effects.PlaySound( from, from.Map, 0x2E3 );
        	if( Utility.Random( 100 ) < 100 ) 
			       
         			switch ( Utility.Random( 3 ) )
			{ 

				case 0: from.AddToBackpack( new Diamond(Utility.RandomList(   6 ,  7 , 8 , 8 , 9 , 10 ) ) );
				{
				from.SendMessage( "You use all your brute strength - and turn the Magical Coal into Diamonds." );
				}
					break;
				case 1: from.AddToBackpack( new SantasGiftBag2009() ); 
				{
				from.SendMessage( "You promise to be good next year - and the Magical Coal hears your words and gives you a gift." );
				}
				    break;
				case 2: from.AddToBackpack( new ShazzysBest() ); 
				{
				from.SendMessage( "You promise to be EXTRA good next year - and the Magical Coal hears your words and gives you a gift." );
				}
					break;	
			}			
				this.Delete();
        	}
		}
示例#2
0
		public override void OnDoubleClick( Mobile from )
		{
			if( from.InRange( this.GetWorldLocation(), 1 ) )
			{
				
				if ( m_UsesRemaining == 1 )
				{
					from.AddToBackpack( new HoneyComb() );
					InvalidateProperties();
					from.SendMessage( "As you pull out the last honeycomb the beehive collapses" );
					this.Delete();
				}
				else
				{
					from.AddToBackpack( new HoneyComb() );
					m_UsesRemaining -= 1;
					InvalidateProperties();
					from.SendMessage( "You take a honeycomb out of the beehive." );
					
				}
			}
			else 
  			{ 
			from.SendMessage( "You are too far away from the beehive." ); 
			return; 
  			} 
		}
        public override void OnDoubleClick(Mobile from)
        {
            MerlinsStaff Staff = from.FindItemOnLayer(Layer.TwoHanded) as MerlinsStaff;

            if (Parent != from)
            {
                from.SendMessage("You remember that you must equip the staff to summon a portal to Merlin");
            }
            else
            {
                Item marker1 = from.Backpack.FindItemByType(typeof(Marker1));
                if (marker1 != null)
                {
                    marker1.Delete();

                    from.AddToBackpack(new Marker2());
                    from.AddToBackpack(new Tablet());
                    from.FixedParticles(0x3709, 1, 30, 9904, 1108, 6, EffectLayer.RightFoot);
                    from.SendGump(new MerlinsQuestGump6(from));
                    from.SendMessage("Muahahahaha!!!! You fool!");
                    Talon2 tl = new Talon2();
                    tl.Map = from.Map;
                    tl.Location = from.Location;
                    Delete();
                }
                else
                {
                    from.SendMessage("You have no right to have this staff!!!!");
                }
            }
        }
      public override void OnDoubleClick( Mobile from ) 
      { 
         Container pack = from.Backpack; 

	if( from.InRange( this.GetWorldLocation(), 1 ) )
	{

         if (pack != null && pack.ConsumeTotal( typeof( HoneyComb ), 1 ) ) 
         { 
            from.SendMessage( "*You centrifuge the honeycomb and separate honey and wax*" ); 
                
               { 
					
                from.AddToBackpack( new RawBeeswax() ); 
                from.AddToBackpack( new JarHoney() );
               } 
         } 

         else 
         { 
            from.SendMessage( "You need a honeycomb to use in this kettle" ); 
            return; 
         } 
      } 



         else 
         { 
            from.SendMessage( "You are too far away from this" ); 
            return; 
         } 

	}
示例#5
0
        public static void GivePowerScrollTo( Mobile m, PowerScroll ps )
        {
            if( ps == null || m == null )	//sanity
                return;

            m.SendLocalizedMessage( 1049524 ); // You have received a scroll of power!

            if( !Core.SE || m.Alive )
                m.AddToBackpack( ps );
            else
            {
                if( m.Corpse != null && !m.Corpse.Deleted )
                    m.Corpse.DropItem( ps );
                else
                    m.AddToBackpack( ps );
            }

            if( m is PlayerMobile )
            {
                PlayerMobile pm = (PlayerMobile)m;

                for( int j = 0; j < pm.JusticeProtectors.Count; ++j )
                {
                    Mobile prot = pm.JusticeProtectors[j];

                    if( prot.Map != m.Map || prot.Kills >= 5 || prot.Criminal || !JusticeVirtue.CheckMapRegion( m, prot ) )
                        continue;

                    int chance = 0;

                    switch( VirtueHelper.GetLevel( prot, VirtueName.Justice ) )
                    {
                        case VirtueLevel.Seeker: chance = 60; break;
                        case VirtueLevel.Follower: chance = 80; break;
                        case VirtueLevel.Knight: chance = 100; break;
                    }

                    if( chance > Utility.Random( 100 ) )
                    {
                        PowerScroll powerScroll = new PowerScroll( ps.Skill, ps.Value );

                        prot.SendLocalizedMessage( 1049368 ); // You have been rewarded for your dedication to Justice!

                        if( !Core.SE || prot.Alive )
                            prot.AddToBackpack( powerScroll );
                        else
                        {
                            if( prot.Corpse != null && !prot.Corpse.Deleted )
                                prot.Corpse.DropItem( powerScroll );
                            else
                                prot.AddToBackpack( powerScroll );
                        }
                    }
                }
            }
        }
示例#6
0
		public virtual void Dismiss( Mobile owner )
		{
			RemoveAttendant( owner );

			if ( m_BindedToPlayer )
				owner.AddToBackpack( new PersonalAttendantDeed( owner ) );
			else
				owner.AddToBackpack( new PersonalAttendantDeed() );
			
			Delete();
		}
		public override void OnDoubleClick( Mobile from )
		{
			from.SendMessage( 53, "ERROR: Addon no longer in use. A new addon deed has been added to your backpack" );
			
			if ( this.ItemID == 0x14E7 )
				from.AddToBackpack( new NewHitchingPostEastDeed() );
			else if ( this.ItemID == 0x14E8 )
				from.AddToBackpack( new NewHitchingPostSouthDeed() );

			this.Delete();
		}
示例#8
0
        public override bool OnMoveOver( Mobile m )
        {
            PlayerMobile pm = m as PlayerMobile;

            if ( pm == null )
                return false;

            QuestSystem qs = pm.Quest;

            if ( qs != null && qs is HaochisTrialsQuest )
            {
                if ( qs.IsObjectiveInProgress( typeof( RetrieveKatanaObjective ) ) )
                {
                    QuestObjective obj = qs.FindObjective( typeof( RetrieveKatanaObjective ) );

                    if ( obj != null )
                        obj.Complete();

                    qs.AddConversation( new SpotSwordConversation() );

                    m.AddToBackpack( new DaimyoHaochisKatana() );

                    qs.AddObjective( new GiveSwordDaimyoObjective() );
                }

                if ( qs.IsObjectiveInProgress( typeof( GiveSwordDaimyoObjective ) ) )
                {
                    List<Item> list = m.Backpack.Items;

                    DaimyoHaochisKatana katana = null;

                    for ( int i = 0; i < list.Count; i++ )
                    {
                        if ( list[i] is DaimyoHaochisKatana )
                        {
                            katana = list[i] as DaimyoHaochisKatana;

                            break;
                        }
                    }

                    if ( katana == null )
                    {
                        qs.AddConversation( new SpotSwordConversation() );

                        m.AddToBackpack( new DaimyoHaochisKatana() );
                    }
                }
            }

            return true;
        }
示例#9
0
        public override void OnDoubleClick(Mobile from)
        {
            if ( RootParent == from || ( from.InRange( GetWorldLocation(), 3 ) && from.InLOS( GetWorldLocation() ) ) )
            {
                if ( !Unrolled )
                {
                    Unroll();
                    MoveToWorld( from.Location, from.Map );
                }
                else if ( ItemID == 0x0A55 )
                {
                    if ( Parent == null )
                    {
                        IPooledEnumerable eable = from.GetItemsInRange( 7 );
                        Campfire fire = null;
                        foreach ( Item item in eable )
                        {
                            if ( item is Campfire )
                            {
                                fire = (Campfire)item;
                                break;
                            }
                        }
                        eable.Free();

                        if ( fire != null )
                        {
                            if ( fire.CanLogout( from ) )
                                new BedRollLogoutMenu().SendTo( from.NetState );
                            else
                                from.SendAsciiMessage( "Your camp is not yet secure." );
                        }
                        else
                        {
                            Roll();
                            from.AddToBackpack( this );
                        }
                    }
                    else
                    {
                        // is in a container (not on ground)
                        Roll();
                        from.AddToBackpack( this );
                    }
                }
            }
            else
            {
                from.SendAsciiMessage( "You must be closer to use that." );
            }
        }
      		public override void OnDoubleClick( Mobile from ) 
      		{
			if ( !IsChildOf( from.Backpack ) )
			{
                from.SendLocalizedMessage(1042001);
            }
            else
            {
/////////////////Prize Cincture Deed
                switch (Utility.Random(8))
                {
                    case 0: from.AddToBackpack(new AmberCincture()); break;
                    case 1: from.AddToBackpack(new AzureCincture()); break;
                    case 2: from.AddToBackpack(new GoldCincture()); break;
                    case 3: from.AddToBackpack(new IndigoCincture()); break;
                    case 4: from.AddToBackpack(new IvoryCincture()); break;
                    case 5: from.AddToBackpack(new JadeCincture()); break;
                    case 6: from.AddToBackpack(new SilverCincture()); break;
                    case 7: from.AddToBackpack(new CrimsonCincture()); break;
                    
                }
                this.Delete();
			}

		}
		public override void OnDoubleClick( Mobile m )

		{
			Item a = m.Backpack.FindItemByType( typeof(ReinforcedHinge) );
			if ( a != null )
			{	
			Item b = m.Backpack.FindItemByType( typeof(SturdyAxle) );
			if ( b != null )
			{
			Item c = m.Backpack.FindItemByType( typeof(SteelGears) );
			if ( c != null )
			{
			Item d = m.Backpack.FindItemByType( typeof(GemOfControl) );
			if ( d != null )
			{						
				m.AddToBackpack( new CompletedSeafarerToolKit() );
				a.Delete();
				b.Delete();
				c.Delete();
				d.Delete();				
				m.SendMessage( "You place the items into the tool kit for a Completed Seafarer's Tool Kit!" );
				this.Delete();
			}
			}
			}
			}			
				else
			{
				m.SendMessage( "You are missing some parts." );
			}
		}		
 public override void OnDoubleClick(Mobile m)
 {
     Item[] a = m.Backpack.FindItemsByType(typeof(Whey));
     // are there at least 10 elements in the returned array?
     if (a != null && a.Length >= 10)
     {
        
         Item b = m.Backpack.FindItemByType(typeof(EmptyWheyBowl));
         if (b != null)
                 {
                     // delete the first 10 of them
                     for (int i = 0; i < 10; i++) a[i].Delete();
                     b.Delete();
                     
                     // one pile of curd
                     m.AddToBackpack(new Curd());
                     m.SendMessage("At last I have enough whey to make a curd! Now to finish the bowl of curds and whey.");
                 }
             
         }
         else
         {
             m.SendMessage("You must have more whey");
         }
     }
        public override void OnDoubleClick(Mobile from)
        {
                Container backpack = from.Backpack;

                CopperIngot item1 = (CopperIngot)backpack.FindItemByType(typeof(CopperIngot));   
     
             if (item1 != null)                
             {  
          
                BaseIngot m_Ore1 = item1 as BaseIngot;

                int toConsume = m_Ore1.Amount;

                if ( ( m_Ore1.Amount > 499 ) && ( m_Ore1.Amount < 501 ) ) 
                {
                   m_Ore1.Delete();
                   from.SendMessage("You've successfully converted the Metal.");                    
                   from.AddToBackpack(new VeriteIngot(500)); 
                   this.Delete();

                }
                else if ( ( m_Ore1.Amount < 500 ) || ( m_Ore1.Amount > 500 ) )
                {
                      from.SendMessage("You can only convert 500 Copper Ingots at a time.");
                }
              }
             else
             {
                      from.SendMessage("There isn't Copper Ingots in your Backpack.");
             }                 
 
        }
	public override void OnDoubleClick( Mobile m )

		{	
			Item [] a = m.Backpack.FindItemsByType( typeof( GreenApple ) );
			// are there at least 10 elements in the returned array?
			if ( a!= null && a.Length >= 10)
			{

			Item b = m.Backpack.FindItemByType( typeof( EmptyRedsBasket ) );
			if ( b != null )

			{
				// delete the first 10 of them
				for(int i=0;i<10;i++) a[i].Delete();
				b.Delete();

				// and add the full basket of green apples
				m.AddToBackpack( new FruitBasket() );
				m.SendMessage("The basket is full, hurry back to Massie for your reward!");
			}
			}

			else
			{
				m.SendMessage( "Massie's grandmother needs lots of green apples. There is still room for more..." );
			}
		}
示例#15
0
        public static void GiveArtifactTo(Mobile m)
        {
            var item = Activator.CreateInstance(m_Artifacts[Utility.Random(m_Artifacts.Length)]) as Item;

            if (item == null)
            {
                return;
            }

            if (m.AddToBackpack(item))
            {
                m.SendLocalizedMessage(1072223); // An item has been placed in your backpack.
                m.SendLocalizedMessage(1062317);
                    // For your valor in combating the fallen beast, a special artifact has been bestowed on you.
            }
            else if (m.BankBox.TryDropItem(m, item, false))
            {
                m.SendLocalizedMessage(1072224); // An item has been placed in your bank box.
                m.SendLocalizedMessage(1062317);
                    // For your valor in combating the fallen beast, a special artifact has been bestowed on you.
            }
            else
            {
                // Item was placed at feet by m.AddToBackpack
                m.SendLocalizedMessage(1072523);
                    // You find an artifact, but your backpack and bank are too full to hold it.
            }
        }
示例#16
0
        public override void OnDoubleClick(Mobile from)
        {
            if (from.AccessLevel > AccessLevel.Player)
            {
                from.SendAsciiMessage("Drop items in here for players to receive.");
                DisplayTo(from);
                return;
            }
            if (!IsChildOf(from.Backpack))
            {
                from.SendAsciiMessage("The scroll must be in your backpack when used.");
                return;
            }

            Internalize(); //So you don't get overweight
            Item[] items = FindItemsByType(typeof (Item), true);
            bool inBank = false;
            foreach (Item item in items)
            {
                if (!from.AddToBackpack(item))
                {
                    from.BankBox.DropItem(item);
                    inBank = true;
                }
            }

            from.SendAsciiMessage("The scroll summons treasures into your pack as you unravel it!");
            if (inBank)
                from.SendAsciiMessage("You are overweight, the treasures were added to your bank");

            Delete();
        }
示例#17
0
			public void Carve( Mobile from, Item item )
			{
				from.SendMessage( "You chop up the roots of the ginseng plant, gathering a handful of useful lengths." );
				from.AddToBackpack( new Ginseng( Utility.RandomMinMax( 8, 15 ) ) );

				Delete();
			}
		public override void OnDoubleClick( Mobile m )

		{
			Item a = m.Backpack.FindItemByType( typeof(EnchantedShovelHead) );
			if ( a != null )
			{	
			Item b = m.Backpack.FindItemByType( typeof(EnchantedShovelArm) );
			if ( b != null )
			{
			Item c = m.Backpack.FindItemByType( typeof(EnchantedShovelHandle) );
			if ( c != null )
			{
			
				m.AddToBackpack( new UnchargedEnchantedShovel() );
				a.Delete();
				b.Delete();
				c.Delete();
				m.SendMessage( "The Box Glows and Spits Out A Shovel" );
				this.Delete();
			}
			}
				else
			{
				m.SendMessage( "Are You Not Forgetting Something?" );
		}
		}
		}
        private void SelectIngots_Callback( Mobile from, object targeted )
        {
            Item item = targeted as Item;

            if ( item == null )
                return;

            if ( !this.IsChildOf( from.Backpack ) )
                from.SendLocalizedMessage( 1062334 ); // This item must be in your backpack to be used.
            else if ( !item.IsChildOf( from.Backpack ) )
                from.SendLocalizedMessage( 1062334 ); // This item must be in your backpack to be used.
            else if ( item.Amount != 500 )
                from.SendLocalizedMessage( 1113046 ); // You can only convert five hundred ingots at a time.
            else if ( item.GetType() != AcceptedType )
                from.SendLocalizedMessage( 1113047 ); // This elixir isn't made for that type of metal.
            else
            {
                Item ingots = ConstructIngots();

                from.AddToBackpack( ingots );
                ingots.Location = item.Location;

                item.Delete();
                this.Delete();

                from.SendLocalizedMessage( 1113048 ); // You've successfully converted the metal.
            }
        }
示例#20
0
		public void Carve( Mobile from, Item item )
		{
			from.SendMessage( "You slice several of the leaves off the nightshade plant." );
			from.AddToBackpack( new Nightshade( Utility.RandomMinMax( 8, 15 ) ) );

			Delete();
		}
示例#21
0
        public override void OnDoubleClick( Mobile from )
        {
            if ( from.InRange( this.Location, 1 ) )
            {
                if ( !from.Mounted )
                {
                    Flower flower = Activator.CreateInstance( Ingredient ) as Flower;
                    if ( flower != null )
                    {
                        Server.Spells.SpellHelper.Turn( from, this );
                        from.Animate( 32, 5, 1, true, false, 0 );
                        from.PlaySound( 79 );

                        from.SendMessage( "You have picked the flower." );
                        flower.Hue = this.Hue;
                        from.AddToBackpack( flower );
                        ((PlayerMobile)from).Crafting = true;
                        Misc.LevelSystem.AwardMinimumXP( (PlayerMobile)from, 1 );
                        ((PlayerMobile)from).Crafting = false;
                        Delete();
                    }
                }
                else
                    from.SendMessage( "You can't do that while mounted." );
            }
            else
                from.SendMessage( "You are too far away." );
        }
示例#22
0
		public override void OnDoubleClick( Mobile from )
		{
			from.SendMessage( "You yank the ginseng from the ground." );
			from.AddToBackpack( new GinsengRootCrop() );

			Delete();
		}
示例#23
0
        public void OnTarget(Mobile from, object obj)
        {
            if (!(obj is AlchemyVial))
            {
                from.SendMessage("Chauffer cette solution ne vous servira à rien");
                return;
            }

            AlchemyVial vial = (AlchemyVial)obj;

            if (vial.AlchemyLiquidType == LiquidType.None)
            {
                from.SendMessage("Votre fiole est vide");
                return;
            }

            if (vial.AlchemyLiquidType != LiquidType.ChangelingBlood)
            {
                from.SendMessage("Il ne servirait à rien de tenter de faire chauffer cette éprouvette");
                return;
            }

            if (!from.CheckSkill(SkillName.Alchemy,20,90))
            {
                from.SendMessage("L'éprouvette explose!");
                from.Hits -= 5;
                return;
            }

            from.SendMessage("Le liquide bout et se transforme. Vous le versez lentement dans une autre éprouvette");
            vial.Consume();
            from.AddToBackpack(new MorphBase());
        }
示例#24
0
		public override void OnDoubleClick( Mobile m )

		{
			Item a = m.Backpack.FindItemByType( typeof(EnchantedRope) );
			if ( a != null )
			{	
			Item b = m.Backpack.FindItemByType( typeof(GlowingShipModel) );
			if ( b != null )
			{
			Item c = m.Backpack.FindItemByType( typeof(SacredAnchor) );
			if ( c != null )
			{
			Item d = m.Backpack.FindItemByType( typeof(SpecialSeaMap) );
			if ( d != null )
			{						
				m.AddToBackpack( new MasterOfTheSeaChest() );
				a.Delete();
				b.Delete();
				c.Delete();
				d.Delete();				
				m.SendMessage( "You place the artifacts into the Sea Chest for a Full Master of the Sea Chest!" );
				this.Delete();
			}
			}
			}
			}			
				else
			{
				m.SendMessage( "You are missing some artifacts." );
			}
		}		
示例#25
0
        protected override void OnTarget( Mobile from, object target )
        {
            if( target is BaseCreature )
            {
                BaseCreature pet = (BaseCreature)target;

                if( !from.InRange(m_Post.GetWorldLocation(), 2) )
                {
                    from.SendMessage("You must be closer to the post.");
                    from.Target = new unHitchTarget(m_Post);
                }
                else if( pet.Body.IsHuman )
                    from.SendMessage("The person looks at you in disgust.");
                else if( pet.ControlMaster != from )
                    from.SendMessage("That is not your pet.");
                else if( pet.Combatant != null && pet.InRange(pet.Combatant, 12) )
                    from.SendMessage("You cannot do that while your pet is fighting.");
                else if( pet.Controlled == true && pet.ControlMaster == from )
                {
                    string untie = String.Format("*unties {0} pet*", from.Female == true ? "her" : "his");

                    if( pet.Blessed == true )
                    {
                        pet.Blessed = false;
                        pet.CantWalk = false;
                        pet.ControlOrder = OrderType.Come;

                        from.LocalOverheadMessage(MessageType.Regular, from.EmoteHue, false, untie);
                        from.SendMessage("You have unhitched your pet.");
                        from.AddToBackpack(new HitchingRope());
                    }
                }
            }
        }
示例#26
0
文件: Origami.cs 项目: Godkong/RunUO
		public override void OnDoubleClick( Mobile from )
		{
			if ( !IsChildOf( from.Backpack ) )
			{
				from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
			}
			else
			{
				this.Delete();

				Item i = null;

				switch ( Utility.Random( (from.BAC >= 5) ? 6 : 5) )
				{
					case 0: i = new OrigamiButterfly();	break;
					case 1: i = new OrigamiSwan();		break;
					case 2: i = new OrigamiFrog();		break;
					case 3: i = new OrigamiShape();		break;
					case 4: i = new OrigamiSongbird();	break;
					case 5: i = new OrigamiFish();		break;
				}

				if( i != null )
					from.AddToBackpack( i );

				from.SendLocalizedMessage( 1070822 ); // You fold the paper into an interesting shape.
			}
		}
示例#27
0
		public void Carve( Mobile from, Item item )
		{
			from.SendMessage( "You slice off many strands of the silky material and bundle them up for later use." );
			from.AddToBackpack( new SpidersSilk( Utility.Random( 10, 30 ) ) );

			Delete();
		}
		public override void OnDoubleClick( Mobile m )

		{
			Item d = m.Backpack.FindItemByType( typeof(SigilofMinax) );
			if ( d != null )
			{	
				Item c = m.Backpack.FindItemByType( typeof(SigilofLloth) );
				if ( c != null )
				{
					Item n = m.Backpack.FindItemByType( typeof(SigilofGoat) );
					if ( n != null )
					{
						Item p = m.Backpack.FindItemByType( typeof(SigilofTreefolk) );
						if ( p != null )
						{
							m.AddToBackpack( new BraceletofMinax() );
							d.Delete();
							c.Delete();
							n.Delete();
							p.Delete();
							m.SendMessage( "The four Sigils of the Minaxian Minions and Minax herself have been United!" );
						}
					}
					else
					{
						m.SendMessage( "You Are Missing Something..." );
					}
				}
			}
			
		}
		public override void OnDoubleClick( Mobile m )

		{
			Item a = m.Backpack.FindItemByType( typeof(ArrianasDiamond) );
			if ( a != null )
			{	
			Item b = m.Backpack.FindItemByType( typeof(ArrianasClips) );
			if ( b != null )
			{
			Item c = m.Backpack.FindItemByType( typeof(ArrianasHoops) );
			if ( c != null )
			{
			
				m.AddToBackpack( new DiamondHoopEarrings() );
				a.Delete();
				b.Delete();
				c.Delete();
				m.SendMessage( "You Combine the knowledge of Arriana's ancestry into a Heirloom" );
				this.Delete();
			}
			}
				else
			{
				m.SendMessage( "You are missing something..." );
		}
		}
		}
        public override void OnDoubleClick(Mobile m)
        {

            Item e = m.Backpack.FindItemByType(typeof(AncientSmeltingBox));

            if (e != null)
            {

                Item a = m.Backpack.FindItemByType(typeof(SosarianOre));
                Item b = m.Backpack.FindItemByType(typeof(EnergizerCrystal));
                Item c = m.Backpack.FindItemByType(typeof(StarMetalFragments));
                Item d = m.Backpack.FindItemByType(typeof(SpecialCharcoal));


                if (e == null || e.Amount < 1 || a == null || a.Amount < 1 || b == null || b.Amount < 1 || c == null || c.Amount < 1 || d == null || d.Amount < 1)
                {
                    m.SendMessage("You are missing something...");
                }

                else
                {
                    m.AddToBackpack(new EnergizedSosarianIngots());
                    a.Delete();
                    b.Delete();
                    c.Delete();
                    d.Delete();
                    m.SendMessage("You Combine the items into the Energized Sosarian Ingots");
                    this.Delete();
                }

            }
        }
示例#31
0
文件: shrink.cs 项目: Jascen/UOSmart
        public static bool Shrink(Mobile from, object targ, bool restricted)
        {
            String errorString           = null;
            int    errorLocalizedMessage = 0;

            if (from == targ)
            {
                errorString = "You can't shrink yourself!";
            }
            else if (!(targ is BaseCreature))
            {
                errorString = "You can't shrink that!";
            }
            else
            {
                BaseCreature t = (BaseCreature)targ;

                #region Shrink Restrictions
                if (!restricted)
                {
                    //Don't check anything if not a restricted Shrink
                }
                else if (t.Summoned)
                {
                    errorString = "You cannot shrink summoned creatures.";
                }
                else if (t.Poisoned)
                {
                    errorString = "You cannot shrink your pet while it is poisoned.";
                }
                else if (t.Combatant != null && t.InRange(t.Combatant, 12) && t.Map == t.Combatant.Map)
                {
                    errorString = "You cannot shrink your pet while it is in combat.";
                }
                else if (!(t.Controlled && t.ControlMaster == from))
                {
                    errorLocalizedMessage = 1042562;                            //That is not your pet!
                    errorString           = "That is not your pet!";
                }
                else if ((t is PackLlama || t is PackHorse || t is Beetle) && (t.Backpack != null && t.Backpack.Items.Count > 0))
                {
                    errorLocalizedMessage = 1042563;                     //Unload the pet first
                    errorString           = "Unload the pet first";
                }
                #endregion

                ShrinkItem shrunkenPet = new ShrinkItem(t);

                if ((errorString == null) && (errorLocalizedMessage == 0))
                {
                    //If no errors, proceed.

                    if (from != null)
                    {
                        from.SendMessage("You shrink the pet");
                        if (!from.AddToBackpack(shrunkenPet))
                        {
                            shrunkenPet.MoveToWorld(new Point3D(from.X, from.Y, from.Z), from.Map);
                            from.SendMessage("Your backpack is full so the shrunken pet falls to the ground");
                        }
                    }
                    else
                    {
                        shrunkenPet.MoveToWorld(new Point3D(t.X, t.Y, t.Z), t.Map);                              // place shrunken pet at current location
                    }

                    t.Controlled = true;                        //To make it so It won't still be a part of a spawner.

                    SendAway(t);

                    return(true);
                }
            }

            if (from != null)              //if From is NOT null, send error Message.
            {
                if (errorLocalizedMessage != 0)
                {
                    from.SendLocalizedMessage(errorLocalizedMessage);
                }
                else
                {
                    from.SendMessage(errorString);
                }
            }
            return(false);
        }
示例#32
0
        public override void OnDoubleClick(Mobile from)
        {
            if (from is PlayerMobile)
            {
                Region reg  = Region.Find(from.Location, from.Map);
                Item   tome = from.FindItemOnLayer(Layer.Talisman);

                if (!IsChildOf(from.Backpack) && tome != this)
                {
                    from.SendLocalizedMessage(1060640);                       // The item must be in your backpack to use it.
                }
                else if (CodexOwner != from)
                {
                    from.SendMessage("This Codex does not belong to you so it vanishes!");
                    bool remove = true;
                    foreach (Account a in Accounts.GetAccounts())
                    {
                        if (a == null)
                        {
                            break;
                        }

                        int index = 0;

                        for (int i = 0; i < a.Length; ++i)
                        {
                            Mobile m = a[i];

                            if (m == null)
                            {
                                continue;
                            }

                            if (m == CodexOwner)
                            {
                                m.AddToBackpack(this);
                                remove = false;
                            }

                            ++index;
                        }
                    }
                    if (remove)
                    {
                        this.Delete();
                    }
                }
                else if (HasConvexLense == 0 || HasConcaveLense == 0)
                {
                    from.SendSound(0x55);
                    from.CloseGump(typeof(LenseGump));
                    from.SendGump(new LenseGump(this, 0));
                }
                else if (!reg.IsPartOf("the Chamber of the Codex"))
                {
                    from.SendSound(0x55);
                    from.CloseGump(typeof(LenseGump));
                    from.SendGump(new LenseGump(this, 1));
                }
                else
                {
                    from.SendSound(0x55);
                    from.CloseGump(typeof(CodexGump));
                    from.SendGump(new CodexGump(this));
                }
            }
        }
示例#33
0
        private void GiveMagicItems()
        {
            ArrayList toGive = new ArrayList();

            ArrayList list = m_mobile.Aggressors;

            for (int i = 0; i < list.Count; ++i)
            {
                AggressorInfo info = (AggressorInfo)list[i];

                if (info.Attacker.Player && info.Attacker.Alive && (DateTime.Now - info.LastCombatTime) < TimeSpan.FromSeconds(30.0) && !toGive.Contains(info.Attacker))
                {
                    toGive.Add(info.Attacker);
                }
            }

            list = m_mobile.Aggressed;
            for (int i = 0; i < list.Count; ++i)
            {
                AggressorInfo info = (AggressorInfo)list[i];

                if (info.Defender.Player && info.Defender.Alive && (DateTime.Now - info.LastCombatTime) < TimeSpan.FromSeconds(30.0) && !toGive.Contains(info.Defender))
                {
                    toGive.Add(info.Defender);
                }
            }

            if (toGive.Count == 0)
            {
                return;
            }

            // Randomize
            for (int i = 0; i < toGive.Count; ++i)
            {
                int    rand = Utility.Random(toGive.Count);
                object hold = toGive[i];
                toGive[i]    = toGive[rand];
                toGive[rand] = hold;
            }

            for (int i = 0; i < CoreChamp.AmountOfMagicLoot; ++i)
            {
                int    level;
                double random = Utility.RandomDouble();

                if (0.1 >= random)
                {
                    level = CoreChamp.MaxMagicDropLevel;                        // Vanquishing Weapons/Invulnerability Armor
                }
                else if (0.4 >= random)
                {
                    level = (CoreChamp.MinMagicDropLevel + CoreChamp.MaxMagicDropLevel) / 2;                            // Power Weapons/Fortification Armor
                }
                else
                {
                    level = CoreChamp.MinMagicDropLevel;                        // Force Weapons/Hardening Armor
                }
                Mobile m = (Mobile)toGive[i % toGive.Count];

                Item reward;
                if (Utility.RandomBool())
                {
                    reward = CreateWeapon(level);
                }
                else
                {
                    reward = CreateArmor(level);
                }

                if (reward != null)
                {
                    m.SendMessage("You have received a magic item!");
                    m.AddToBackpack(reward);
                }
            }
        }