C# (CSharp) Server. Mobile Code Examples

C# (CSharp) Server.Mobile - 30 examples found. These are the top rated real world C# (CSharp) examples of Server.Mobile extracted from open source projects. You can rate examples to help us improve the quality of examples
Example #1
0
        public static bool LegalGrappling( Mobile mob )
        {
            if( mob == null || mob.Deleted || !mob.Alive || mob.Blessed )
                return false;

            return true;
        }
Example #2
0
            public InternalTimer(Mobile m)
                : base(TimeSpan.FromMinutes(1.0))
            {
                this.m_Mobile = m;

                this.Priority = TimerPriority.OneSecond;
            }
 public MarrowQuestGump( Mobile owner )
     : base(50,50)
 {
     //----------------------------------------------------------------------------------------------------
     AddPage( 0 );AddImageTiled(  54, 33, 369, 400, 2624 );AddAlphaRegion( 54, 33, 369, 400 );AddImageTiled( 416, 39, 44, 389, 203 );
     //--------------------------------------Window size bar--------------------------------------------
     AddImage( 97, 49, 9005 );AddImageTiled( 58, 39, 29, 390, 10460 );AddImageTiled( 412, 37, 31, 389, 10460 );
     AddBackground(85, 30, 329, 408, 3500);
     AddLabel( 140, 60, 0x34, "Marrow's Task" );
     //----------------------/----------------------------------------------/
     AddHtml( 107, 140, 300, 230, " < BODY > " +
     "<BASEFONT COLOR=YELLOW>Hello there, might you be interested in<BR>" +
     "<BASEFONT COLOR=YELLOW>helping me with a little task?<BR>" +
     "<BASEFONT COLOR=YELLOW><BR>" +
     "<BASEFONT COLOR=YELLOW>I am researching a new type of potion<BR>" +
     "<BASEFONT COLOR=YELLOW>and I need some reptile bones to finish<BR>" +
     "<BASEFONT COLOR=YELLOW>my tests.  As you can see though, I am <BR>" +
     "<BASEFONT COLOR=YELLOW>no fighter and cannot get them myself.<BR>" +
     "<BASEFONT COLOR=YELLOW><BR>" +
     "<BASEFONT COLOR=YELLOW>Although my research has made my coin <BR>" +
     "<BASEFONT COLOR=YELLOW>purse rather light these days I will be<BR>" +
     "<BASEFONT COLOR=YELLOW>sure to reward you with something.  I<BR>" +
     "<BASEFONT COLOR=YELLOW>just need 20 bones, that should be <BR>" +
     "<BASEFONT COLOR=YELLOW>plenty.  You should be able to find<BR>" +
     "<BASEFONT COLOR=YELLOW>some right outside of town.  Thanks!<BR>" +
     "</BODY>", false, true);
     //----------------------/----------------------------------------------/
     AddImage( 430, 9, 10441);AddImageTiled( 40, 38, 17, 391, 9263 );AddImage( 6, 25, 10421 );AddImage( 34, 12, 10420 );AddImageTiled( 94, 25, 342, 15, 10304 );AddImageTiled( 40, 427, 415, 16, 10304 );AddImage( -10, 314, 10402 );AddImage( 56, 150, 10411 );AddImage( 155, 120, 2103 );AddImage( 136, 84, 96 );AddButton( 225, 390, 0xF7, 0xF8, 0, GumpButtonType.Reply, 0 );
 }
        public RewardConfirmGump( Mobile from, RewardEntry entry )
            : base(0, 0)
        {
            m_From = from;
            m_Entry = entry;

            from.CloseGump( typeof( RewardConfirmGump ) );

            AddPage( 0 );

            AddBackground( 10, 10, 500, 300, 2600 );

            AddHtmlLocalized( 30, 55, 300, 35, 1006000, false, false ); // You have selected:

            if ( entry.NameString != null )
                AddHtml( 335, 55, 150, 35, entry.NameString, false, false );
            else
                AddHtmlLocalized( 335, 55, 150, 35, entry.Name, false, false );

            AddHtmlLocalized( 30, 95, 300, 35, 1006001, false, false ); // This will be assigned to this character:
            AddLabel( 335, 95, 0, from.Name );

            AddHtmlLocalized( 35, 160, 450, 90, 1006002, true, true ); // Are you sure you wish to select this reward for this character?  You will not be able to transfer this reward to another character on another shard.  Click 'ok' below to confirm your selection or 'cancel' to go back to the selection screen.

            AddButton( 60, 265, 4005, 4007, 1, GumpButtonType.Reply, 0 );
            AddHtmlLocalized( 95, 266, 150, 35, 1006044, false, false ); // Ok

            AddButton( 295, 265, 4017, 4019, 0, GumpButtonType.Reply, 0 );
            AddHtmlLocalized( 330, 266, 150, 35, 1006045, false, false ); // Cancel
        }
        protected override void OnTarget( Mobile from, object targeted )
        {
            try
            {
                if ( m_Type == typeof( Type ) )
                    targeted = targeted.GetType();
                else if ( (m_Type == typeof( BaseAddon ) || m_Type.IsAssignableFrom( typeof( BaseAddon ) )) && targeted is AddonComponent )
                    targeted = ((AddonComponent)targeted).Addon;

                if ( m_Type.IsAssignableFrom( targeted.GetType() ) )
                {
                    Server.Scripts.Commands.CommandLogging.LogChangeProperty( m_Mobile, m_Object, m_Property.Name, targeted.ToString() );
                    m_Property.SetValue( m_Object, targeted, null );
                    PropertiesGump.OnValueChanged( m_Object, m_Property, m_Stack );
                }
                else
                {
                    m_Mobile.SendMessage( "That cannot be assigned to a property of type : {0}", m_Type.Name );
                }
            }
            catch
            {
                m_Mobile.SendMessage( "An exception was caught. The property may not have changed." );
            }
        }
Example #6
0
		public override void OnDoubleClick( Mobile from )
		{
			if ( !from.InRange( this.GetWorldLocation(), 2 ) || !from.InLOS( this ) )
			{
				from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that
			}
			else if ( Visible && ( ItemID == 4656 || ItemID == 4702 ) && DateTime.Now >= m_NextUse )
			{
				Point3D p = this.GetWorldLocation();

				if ( 1 > Utility.Random( Math.Max( Math.Abs( from.X - p.X ), Math.Abs( from.Y - p.Y ) ) ) )
				{
					Effects.PlaySound( from.Location, from.Map, from.GetHurtSound() );
					from.PublicOverheadMessage( MessageType.Regular, from.SpeechHue, true, "Ouch!" );
					Spells.SpellHelper.Damage( TimeSpan.FromSeconds( 0.5 ), from, Utility.Dice( 2, 10, 5 ) );
				}

				Effects.PlaySound( this.GetWorldLocation(), this.Map, 0x387 );

				Timer.DelayCall( TimeSpan.FromSeconds( 0.25 ), new TimerCallback( Down1 ) );
				Timer.DelayCall( TimeSpan.FromSeconds( 0.50 ), new TimerCallback( Down2 ) );

				Timer.DelayCall( TimeSpan.FromSeconds( 5.00 ), new TimerCallback( BackUp ) );

				m_NextUse = DateTime.Now + TimeSpan.FromSeconds( 10.0 );
			}
		}
Example #7
0
        public override void OnCancel( Mobile from )
        {
            if ( GuildMenu.BadLeader( m_Mobile, m_Guild ) )
                return;

            m_Mobile.SendMenu( new GuildmasterMenu( m_Mobile, m_Guild ) );
        }
Example #8
0
        public Data(Mobile m)
        {
            c_Mobile = m;

            c_Friends = new ArrayList();
            c_Ignores = new ArrayList();
            c_Messages = new ArrayList();
            c_GIgnores = new ArrayList();
            c_GListens = new ArrayList();
            c_IrcIgnores = new ArrayList();
            c_Sounds = new Hashtable();
            c_PerPage = 10;
            c_SystemC = 0x161;
            c_GlobalMC = 0x26;
            c_GlobalCC = 0x47E;
            c_GlobalGC = 0x44;
            c_GlobalFC = 0x17;
            c_GlobalWC = 0x3;
            c_StaffC = 0x3B4;
            c_MsgC = 0x480;
            c_AwayMsg = "";
            c_Signature = "";
            c_BannedUntil = DateTime.Now;

            if (m.AccessLevel >= AccessLevel.Administrator)
                c_GlobalAccess = true;

            s_Datas[m] = this;

            foreach (Channel c in Channel.Channels)
                if (c.NewChars)
                    c.Join(m);
        }
 public override bool AllowHarmful( Mobile from, Mobile target )
 {
     if (Contains(from.Location) && Contains(target.Location)) // only when both are inside the region
         return true;
     else
         return false;
 }
Example #10
0
        private static string GetAccountDuration( Mobile m )
        {
            Account a = m.Account as Account;

            if ( a == null )
                return "";

            TimeSpan ts = DateTime.Now - a.Created;

            string v;

            if ( Format( ts.TotalDays, "This account is {0} day{1} old.", out v ) )
                return v;

            if ( Format( ts.TotalHours, "This account is {0} hour{1} old.", out v ) )
                return v;

            if ( Format( ts.TotalMinutes, "This account is {0} minute{1} old.", out v ) )
                return v;

            if ( Format( ts.TotalSeconds, "This account is {0} second{1} old.", out v ) )
                return v;

            return "";
        }
		public override bool OnMoveOver( Mobile m )
		{
			if( !m_AllowCreatures && !m.Player )
				return true;
			
			if( m.Alive)
					{
					m.SendMessage( "You must be dead to use this portal." );
					m.Say("Duh... I am not dead... Hello? Use a Rune book..");
					m.PlaySound( 0x440 );
					return true;
					}
			if( m_TelePets)
				{
				Server.Mobiles.BaseCreature.TeleportPets( m, m_DestLoc, m_DestMap );
				}
				
				m.Say("Have mercy on my soul.");
				World.Broadcast( 32, true, "A Darkening chime is heard throughout the land as Dracula has consumed another victim. May {0} rest in peace.", m.Name );
				m.PlaySound(0x1F7);

				m.MoveToWorld( m_DestLoc, m_DestMap );

				return false;
				
			

		}
		public const int OverloadAllowance = 4; // We can be four stones overweight without getting fatigued

		public static int GetMaxWeight( Mobile m )
		{
			//return ((( Core.ML && m.Race == Race.Human) ? 100 : 40 ) + (int)(3.5 * m.Str));
			//Moved to core virtual method for use there

			return m.MaxWeight;
		}
Example #13
0
            public StealingTarget( Mobile thief )
                : base(1, false, TargetFlags.None)
            {
                m_Thief = thief;

                AllowNonlocal = true;
            }
		public override bool OnMoveOver( Mobile m )
		{

			if ( m == null || m.Deleted || m.Backpack == null || m.Backpack.Deleted )
				return true;

			if ( Active && m_itemType != null )
			{
				if ( !Creatures && !m.Player )
					return true;

				m_item = m.Backpack.FindItemByType(m_itemType, true);
				if ( m_item != null )
				{
					StartTeleport(m);
					return false;
				}
				else
				{
					if ( m_Message != null && m != null)
						m.SendMessage(m_Message);
				}


			}
			return true;
		}
		public override void OnGotMeleeAttack( Mobile attacker )
		{
			base.OnGotMeleeAttack( attacker );

			if ( 0.40 >= Utility.RandomDouble() ) // 40% chance to clone itself.
				AddClonedOoze( attacker, 0.25 );
		}
Example #16
0
		public override bool OnMoveOver( Mobile m )
		{
			if ( Active )
				m.InstanceID = m_DestInstance;

			return base.OnMoveOver( m );
		}
Example #17
0
 public override void OnSingleClick(Mobile from)
 {
     if (this.Name != null)
     {
         if (Amount >= 2)
         {
             from.Send(new AsciiMessage(Serial, ItemID, MessageType.Label, 0, 3, "", Amount + " " + this.Name));
         }
         else
         {
             from.Send(new AsciiMessage(Serial, ItemID, MessageType.Label, 0, 3, "", this.Name));
         }
     }
     else
     {
         if (Amount >= 2)
         {
             from.Send(new AsciiMessage(Serial, ItemID, MessageType.Label, 0, 3, "", Amount + " axles with gears"));
         }
         else
         {
             from.Send(new AsciiMessage(Serial, ItemID, MessageType.Label, 0, 3, "", "an axle with gears"));
         }
     }
 }
Example #18
0
        public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
        {
            base.GetContextMenuEntries(from, list);

            if(m_Plot != null && m_Plot.Active)
                list.Add(new RecallRuneEntry(from, this));
        }
Example #19
0
		public override void GiveGift( Mobile mob )
		{
			GiftBox box = new GiftBox();

			box.DropItem( new MistletoeDeed() );
			box.DropItem( new PileOfGlacialSnow() );
			box.DropItem( new LightOfTheWinterSolstice() );

			int random = Utility.Random( 100 );

			if ( random < 60 )
				box.DropItem( new DecorativeTopiary() );
			else if ( random < 84 )
				box.DropItem( new FestiveCactus() );
			else
				box.DropItem( new SnowyTree() );

			switch ( GiveGift( mob, box ) )
			{
				case GiftResult.Backpack:
					mob.SendMessage( 0x482, "Happy Holidays from the team!  Gift items have been placed in your backpack." );
					break;
				case GiftResult.BankBox:
					mob.SendMessage( 0x482, "Happy Holidays from the team!  Gift items have been placed in your bank box." );
					break;
			}
		}
Example #20
0
        public void DoCure( Mobile from )
        {
            bool cure = false;

            CureLevelInfo[] info = LevelInfo;

            for ( int i = 0; i < info.Length; ++i )
            {
                CureLevelInfo li = info[i];

                if ( li.Poison == from.Poison && Scale( from, li.Chance ) > Utility.RandomDouble() )
                {
                    cure = true;
                    break;
                }
            }

            if ( cure && from.CurePoison( from ) )
            {
                from.SendAsciiMessage( "You feel cured of poison!" ); // You feel cured of poison!

                from.FixedEffect( 0x373A, 10, 15 );
                from.PlaySound( 0x1E0 );
            }
            else if ( !cure )
            {
                from.SendAsciiMessage( "That potion was not strong enough to cure your ailment!" ); // That potion was not strong enough to cure your ailment!
            }
        }
Example #21
0
        public override void OnResponse( Mobile from, string text )
        {
            if ( GuildMenu.BadLeader( m_Mobile, m_Guild ) )
                return;

            text = text.Trim();

            if ( text.Length > 40 )
                text = text.Substring( 0, 40 );

            if ( text.Length > 0 )
            {
                if ( Guild.FindByName( text ) != null )
                {
                    m_Mobile.SendAsciiMessage( "{0} conflicts with the name of an existing guild.", text );
                }
                else
                {
                    m_Guild.Name = text;
                    m_Guild.GuildTextMessage( String.Format("The name of your guild has changed: {0}", text) ); // The name of your guild has changed:
                }
            }

            m_Mobile.SendMenu( new GuildmasterMenu( m_Mobile, m_Guild ) );
        }
Example #22
0
		public override void OnGaveMeleeAttack( Mobile defender )
		{
			base.OnGaveMeleeAttack( defender );

			if ( 0.1 > Utility.RandomDouble() && !IsStunned( defender ) )
			{
				/* Lightning Fist
				 * Cliloc: 1070839
				 * Effect: Type: "3" From: "0x57D4F5B" To: "0x0" ItemId: "0x37B9" ItemIdName: "glow" FromLocation: "(884 715, 10)" ToLocation: "(884 715, 10)" Speed: "10" Duration: "5" FixedDirection: "True" Explode: "False"
				 * Damage: 35-65, 100% energy, resistable
				 * Freezes for 4 seconds
				 * Effect cannot stack
				 */

				defender.FixedEffect( 0x37B9, 10, 5 );
				defender.SendLocalizedMessage( 1070839 ); // The creature attacks with stunning force!
 
				// This should be done in place of the normal attack damage.
				//AOS.Damage( defender, this, Utility.RandomMinMax( 35, 65 ), 0, 0, 0, 0, 100 );

				defender.Frozen = true; 

				ExpireTimer timer = new ExpireTimer( defender, TimeSpan.FromSeconds( 4.0 ) );
				timer.Start();
				m_Table[defender] = timer;
			}
		}
Example #23
0
		public override bool Use( Mobile from ) {
			Faction ourFaction = Faction.Find( from );

			bool used = false;

			foreach ( Mobile mob in from.GetMobilesInRange( 8 ) ) {
				if ( mob.Player && !mob.Alive && from.InLOS( mob ) ) {
					if ( Faction.Find( mob ) != ourFaction ) {
						continue;
					}

					BaseHouse house = BaseHouse.FindHouseAt( mob );

					if ( house == null || ( house.IsFriend( from ) || house.IsFriend( mob ) ) ) {
						Faction.ClearSkillLoss( mob );

						mob.SendGump( new ResurrectGump( mob, from, ResurrectMessage.Generic ) );
						used = true;
					}
				}
			}

			if ( used ) {
				from.LocalOverheadMessage( Server.Network.MessageType.Regular, 2219, false, "The urn shatters as you invoke its power." );
				from.PlaySound( 64 );

				Effects.PlaySound( from.Location, from.Map, 1481 );
			}

			return used;
		}
Example #24
0
        private static void AddPants( Mobile m, int pantsHue )
        {
            int hue = Utility.ClipDyedHue( pantsHue & 0x3FFF );

            if ( m.Race == Race.Elf )
            {
                EquipItem( new ElvenPants( hue ), true );
            }
            else
            {
                if ( m.Female )
                {
                    switch ( Utility.Random( 2 ) )
                    {
                        case 0: EquipItem( new Skirt( hue ), true ); break;
                        case 1: EquipItem( new Kilt( hue ), true ); break;
                    }
                }
                else
                {
                    switch ( Utility.Random( 2 ) )
                    {
                        case 0: EquipItem( new LongPants( hue ), true ); break;
                        case 1: EquipItem( new ShortPants( hue ), true ); break;
                    }
                }
            }
        }
 protected override void OnTargetFinish( Mobile from )
 {
     if ( m_Type == typeof( Type ) )
         from.SendGump( new PropertiesGump( m_Mobile, m_Object, m_Stack, m_List, m_Page ) );
     else
         from.SendGump( new SetObjectGump( m_Property, m_Mobile, m_Object, m_Stack, m_Type, m_Page, m_List ) );
 }
Example #26
0
        public override void OnDoubleClick( Mobile from )
        {
            if ( this.Parent != null || !this.VerifyMove( from ) )
                return;

            if ( !from.InRange( this, 2 ) )
            {
                from.LocalOverheadMessage( MessageType.Regular, 0x3B2, true, "I can't reach that." ); // I can't reach that.
                return;
            }

            if ( this.ItemID == 0xA57 ) // rolled
            {
                Direction dir = PlayerMobile.GetDirection4( from.Location, this.Location );

                if ( dir == Direction.North || dir == Direction.South )
                    this.ItemID = 0xA55;
                else
                    this.ItemID = 0xA56;
            }
            else // unrolled
            {
                this.ItemID = 0xA57;

                if ( !from.HasGump( typeof( LogoutGump ) ) )
                {
                    CampfireEntry entry = Campfire.GetEntry( from );

                    if ( entry != null && entry.Safe )
                        from.SendGump( new LogoutGump( entry, this ) );
                }
            }
        }
Example #27
0
			public ResurrectEntry( Mobile mobile, Item item ) : base( 6195, ResurrectRange )
			{
				m_Mobile = mobile;
				m_Item = item;

				Enabled = !m_Mobile.Alive;
			}
Example #28
0
        public override void AddCustomContextEntries( Mobile from, List<ContextMenuEntry> list )
        {
            if ( from.Alive )
                list.Add( new AskAboutFutureEntry( from, this ) );

            base.AddCustomContextEntries( from, list );
        }
        public override void OnDoubleClick( Mobile from )
        {
            PlayerMobile pm = from as PlayerMobile;

            if ( pm != null && pm.InRange( GetWorldLocation(), 2 ) )
            {
                QuestSystem qs = pm.Quest;

                if ( qs is DarkTidesQuest )
                {
                    QuestObjective obj = qs.FindObjective( typeof( FindCallingScrollObjective ) );

                    if ( (obj != null && !obj.Completed) || DarkTidesQuest.HasLostCallingScroll( from ) )
                    {
                        Item scroll = new KronusScroll();

                        if ( pm.PlaceInBackpack( scroll ) )
                        {
                            pm.SendLocalizedMessage( 1060120, "", 0x41 ); // You rummage through the scrolls until you find the Scroll of Calling.  You quickly put it in your pack.

                            if ( obj != null && !obj.Completed )
                                obj.Complete();
                        }
                        else
                        {
                            pm.SendLocalizedMessage( 1060148, "", 0x41 ); // You were unable to take the scroll.
                            scroll.Delete();
                        }
                    }
                }
            }

            base.OnDoubleClick( from );
        }
Example #30
0
 public override void OnDoubleClick(Mobile from)
 {
     if (!IsChildOf(from.Backpack))
         from.SendAsciiMessage("That must be in your pack for you to use it.");
     else
         from.Target = new CarpentryTarget(this);
 }