Esempio n. 1
2
            public InternalTimer(Mobile m)
                : base(TimeSpan.FromMinutes(1.0))
            {
                this.m_Mobile = m;

                this.Priority = TimerPriority.OneSecond;
            }
Esempio n. 2
2
        public override void OnCancel( Mobile from )
        {
            if ( GuildMenu.BadLeader( m_Mobile, m_Guild ) )
                return;

            m_Mobile.SendMenu( new GuildmasterMenu( m_Mobile, m_Guild ) );
        }
        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
        }
Esempio n. 4
2
			public ResurrectEntry( Mobile mobile, Item item ) : base( 6195, ResurrectRange )
			{
				m_Mobile = mobile;
				m_Item = item;

				Enabled = !m_Mobile.Alive;
			}
Esempio n. 5
1
        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 ) );
        }
        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." );
            }
        }
 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 );
 }
Esempio n. 8
1
		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 );
			}
		}
		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;
		}
Esempio n. 10
1
        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));
        }
Esempio n. 11
1
        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!
            }
        }
Esempio n. 12
1
		public override bool OnMoveOver( Mobile m )
		{
			if ( Active )
				m.InstanceID = m_DestInstance;

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

			if ( 0.40 >= Utility.RandomDouble() ) // 40% chance to clone itself.
				AddClonedOoze( attacker, 0.25 );
		}
Esempio n. 14
1
        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 "";
        }
Esempio n. 15
1
 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;
 }
		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;
		}
Esempio n. 17
1
            public StealingTarget( Mobile thief )
                : base(1, false, TargetFlags.None)
            {
                m_Thief = thief;

                AllowNonlocal = true;
            }
Esempio n. 18
1
        public static bool LegalGrappling( Mobile mob )
        {
            if( mob == null || mob.Deleted || !mob.Alive || mob.Blessed )
                return false;

            return true;
        }
Esempio n. 19
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 ) );
                }
            }
        }
Esempio n. 20
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;
                    }
                }
            }
        }
Esempio n. 21
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;
			}
		}
Esempio n. 22
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 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;
				
			

		}
Esempio n. 24
0
        public override void AddCustomContextEntries( Mobile from, List<ContextMenuEntry> list )
        {
            if ( from.Alive )
                list.Add( new AskAboutFutureEntry( from, this ) );

            base.AddCustomContextEntries( from, list );
        }
Esempio n. 25
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);
 }
        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 );
        }
Esempio n. 27
0
 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 ) );
 }
Esempio n. 28
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;
		}
Esempio n. 29
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;
			}
		}
Esempio n. 30
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"));
         }
     }
 }
Esempio n. 31
0
        public override int HandleNotoriety(Server.Mobile source, Server.Mobile target)
        {
            if (source is PlayerMobile && target is PlayerMobile)
            {
                if (((PlayerMobile)source).Region is PvPRegion && ((PlayerMobile)target).Region is PvPRegion)
                {
                    return(Notoriety.Enemy);
                }
                if (((PlayerMobile)source).Region is PvPStagingRegion && ((PlayerMobile)target).Region is PvPRegion)
                {
                    return(Notoriety.Invulnerable);
                }
                if (((PlayerMobile)source).Region is PvPRegion && ((PlayerMobile)target).Region is PvPStagingRegion)
                {
                    return(Notoriety.Invulnerable);
                }
            }

            return(base.HandleNotoriety(source, target));
        }
Esempio n. 32
0
        public override bool AllowHarmful(Server.Mobile source, Server.Mobile target)
        {
            if (source is PlayerMobile && target is PlayerMobile)
            {
                if (source == target)
                {
                    return(false);
                }
                if (((PlayerMobile)source).Region is PvPRegion && ((PlayerMobile)target).Region is PvPRegion)
                {
                    return(true);
                }
                if (((PlayerMobile)source).Region is PvPStagingRegion && ((PlayerMobile)target).Region is PvPRegion)
                {
                    return(false);
                }
                if (((PlayerMobile)source).Region is PvPRegion && ((PlayerMobile)target).Region is PvPStagingRegion)
                {
                    return(false);
                }
            }

            return(base.AllowHarmful(source, target));
        }
Esempio n. 33
0
        public static bool Handle(Mobile from, string text, MessageType type = MessageType.Regular)
        {
            if (!text.StartsWith(Prefix) && type != MessageType.Command)
            {
                return(false);
            }

            if (type != MessageType.Command)
            {
                text = text.Substring(Prefix.Length);
            }

            int indexOf = text.IndexOf(' ');

            string command;

            string[] args;
            string   argString;

            if (indexOf >= 0)
            {
                argString = text.Substring(indexOf + 1);

                command = text.Substring(0, indexOf);
                args    = Split(argString);
            }
            else
            {
                argString = "";
                command   = text.ToLower();
                args      = new string[0];
            }

            Entries.TryGetValue(command, out CommandEntry entry);

            if (entry != null)
            {
                if (from.AccessLevel >= entry.AccessLevel)
                {
                    if (entry.Handler != null)
                    {
                        CommandEventArgs e = new CommandEventArgs(from, command, argString, args);
                        entry.Handler(e);
                        EventSink.InvokeCommand(e);
                    }
                }
                else
                {
                    if (from.AccessLevel <= BadCommandIgnoreLevel)
                    {
                        return(false);
                    }

                    from.SendMessage("You do not have access to that command.");
                }
            }
            else
            {
                if (from.AccessLevel <= BadCommandIgnoreLevel)
                {
                    return(false);
                }

                from.SendMessage("That is not a valid command.");
            }

            return(true);
        }
Esempio n. 34
0
		public static void Parse( Mobile from )
		{
			string vendor_path = Path.Combine( Core.BaseDirectory, "Data/Common.map" );
			m_Count = 0;

			if ( File.Exists( vendor_path ) )
			{
				ArrayList list = new ArrayList();
				from.SendMessage( "Generating Vendors..." );

				using ( StreamReader ip = new StreamReader( vendor_path ) )
				{
					string line;

					while ( (line = ip.ReadLine()) != null )
					{
						int indexOf = line.IndexOf( ':' );

						if ( indexOf == -1 )
							continue;

						string type = line.Substring( 0, ++indexOf ).Trim();
						string sub = line.Substring( indexOf ).Trim();

						string[] split = sub.Split( ' ' );

						if ( split.Length < 3 )
							continue;

						split = new string[]{ type, split[0], split[1], split[2] };

						switch(split[0].ToLower()) 
						{
							case "-healer:":
								PlaceNPC( split[1], split[2], split[3], "Healer", "HealerGuildmaster" );
								break;
							case "-baker:":
								PlaceNPC( split[1], split[2], split[3], "Baker" );
								break;
							case "-vet:":
								PlaceNPC( split[1], split[2], split[3], "Veterinarian" );
								break;
							case "-gypsymaiden:":
								PlaceNPC( split[1], split[2], split[3], "GypsyMaiden" );
								break;
							case "-gypsybank:":
								PlaceNPC( split[1], split[2], split[3], "GypsyBanker" );
								break;
							case "-bank:":
								PlaceNPC( split[1], split[2], split[3], "Banker", "Minter" );
								break;
							case "-inn:":
								PlaceNPC( split[1], split[2], split[3], "Innkeeper" );
								break;
							case "-provisioner:":
								PlaceNPC( split[1], split[2], split[3], "Provisioner", "Cobbler" );
								break;
							case "-tailor:":
								PlaceNPC( split[1], split[2], split[3], "Tailor", "Weaver", "TailorGuildmaster" );
								break;
							case "-tavern:":
								PlaceNPC( split[1], split[2], split[3], "Tavernkeeper", "Waiter", "Cook", "Barkeeper" );
								break;
							case "-reagents:":
								PlaceNPC( split[1], split[2], split[3], "Herbalist", "Alchemist", "CustomHairstylist" );
								break;
							case "-fortuneteller:":
								PlaceNPC( split[1], split[2], split[3], "FortuneTeller" );
								break;
							case "-holymage:":
								PlaceNPC( split[1], split[2], split[3], "HolyMage" );
								break;
							case "-chivalrykeeper:":
								PlaceNPC( split[1], split[2], split[3], "KeeperOfChivalry" );
								break;
							case "-mage:":
								PlaceNPC( split[1], split[2], split[3], "Mage", "Alchemist", "MageGuildmaster" );
								break;
							case "-arms:":
								PlaceNPC( split[1], split[2], split[3], "Armorer", "Weaponsmith" );
								break;
							case "-tinker:":
								PlaceNPC( split[1], split[2], split[3], "Tinker", "TinkerGuildmaster" );
								break;
							case "-gypsystable:":
								PlaceNPC( split[1], split[2], split[3], "GypsyAnimalTrainer" );
								break;
							case "-stable:":
								PlaceNPC( split[1], split[2], split[3], "AnimalTrainer" );
								break;
							case "-blacksmith:":
								PlaceNPC( split[1], split[2], split[3], "Blacksmith", "BlacksmithGuildmaster" );
								break;
							case "-bowyer:":
							case "-fletcher:":
								PlaceNPC( split[1], split[2], split[3], "Bowyer" );
								break;
							case "-carpenter:":
								PlaceNPC( split[1], split[2], split[3], "Carpenter", "Architect", "RealEstateBroker" );
								break;
							case "-butcher:":
								PlaceNPC( split[1], split[2], split[3], "Butcher" );
								break;
							case "-jeweler:":
								PlaceNPC( split[1], split[2], split[3], "Jeweler" );
								break;
							case "-tanner:":
								PlaceNPC( split[1], split[2], split[3], "Tanner", "Furtrader" );
								break;
							case "-bard:":
								PlaceNPC( split[1], split[2], split[3], "Bard", "BardGuildmaster" );
								break;
							case "-market:":
								PlaceNPC( split[1], split[2], split[3], "Butcher", "Farmer" );
								break;
							case "-library:":
								PlaceNPC( split[1], split[2], split[3], "Scribe" );
								break;
							case "-shipwright:":
								PlaceNPC( split[1], split[2], split[3], "Shipwright", "Mapmaker" );
								break;
							case "-docks:":
								PlaceNPC( split[1], split[2], split[3], "Fisherman" );
								break;

							case "-beekeeper:":
								PlaceNPC( split[1], split[2], split[3], "Beekeeper" );
								break;
							
							
								// Guilds & Misc
							case "-tinkers guild:":
								PlaceNPC( split[1], split[2], split[3], "TinkerGuildmaster" );
								break;
							case "-blacksmiths guild:":
								PlaceNPC( split[1], split[2], split[3], "BlacksmithGuildmaster" );
								break;
							case "-sorcerors guild:":
								PlaceNPC( split[1], split[2], split[3], "MageGuildmaster" );
								break;
							case "-customs:": break;
							case "-painter:": break;
							case "-theater:": break;
							case "-warriors guild:":
								PlaceNPC( split[1], split[2], split[3], "WarriorGuildmaster" );
								break;
							case "-archers guild:":
								PlaceNPC( split[1], split[2], split[3], "RangerGuildmaster" );
								break;
							case "-thieves guild:":
								PlaceNPC( split[1], split[2], split[3], "ThiefGuildmaster" );
								break;
							case "-miners guild:":
								PlaceNPC( split[1], split[2], split[3], "MinerGuildmaster" );
								break;
							case "-fishermans guild:":
								PlaceNPC( split[1], split[2], split[3], "FisherGuildmaster" );
								break;
							case "-merchants guild:":
								PlaceNPC( split[1], split[2], split[3], "MerchantGuildmaster" );
								break;
							case "-illusionists guild:": break;
							case "-armourers guild:": break;
							case "-sorcerers guild:": break;
							case "-mages guild:":
								PlaceNPC( split[1], split[2], split[3], "MageGuildmaster" );
								break;
							case "-weapons guild:": break;
							case "-bardic guild:":
								PlaceNPC( split[1], split[2], split[3], "BardGuildmaster" );
								break;
							case "-rogues guild:":
								break;

								// Skip
							case "+landmark:":
							case "-point of interest:":
							case "+shrine:":
							case "+moongate:":
							case "+dungeon:":
							case "+scenic:":
							case "-gate:":
							case "+Body of Water:":
							case "+ruins:":
							case "+teleporter:":
							case "+Terrain:":
							case "-exit:":
							case "-bridge:":
							case "-other:":
							case "+champion:":
							case "-stairs:":
							case "-guild:":
							case "+graveyard:":
							case "+Island:":
							case "+town:":
								break;
							/*default:
								Console.WriteLine(split[0]);
								break;*/
						}
					}
				}
				from.SendMessage( "Done, added {0} spawners",m_Count );
			}
			else
			{
				from.SendMessage( "{0} not found!", vendor_path );
			}
		}
Esempio n. 35
0
 public static void RemoveMobile(Mobile m)
 {
     m_Mobiles.Remove(m.Serial);
 }
Esempio n. 36
0
        public static void Load()
        {
            if (m_Loaded)
            {
                return;
            }

            m_Loaded      = true;
            m_LoadingType = null;

            Console.Write("World: Loading...");

            Stopwatch watch = Stopwatch.StartNew();

            m_Loading = true;

            _addQueue    = new Queue <IEntity>();
            _deleteQueue = new Queue <IEntity>();

            int mobileCount = 0, itemCount = 0, guildCount = 0;

            object[] ctorArgs = new object[1];

            List <ItemEntry>   items   = new List <ItemEntry>();
            List <MobileEntry> mobiles = new List <MobileEntry>();
            List <GuildEntry>  guilds  = new List <GuildEntry>();

            if (File.Exists(MobileIndexPath) && File.Exists(MobileTypesPath))
            {
                using (FileStream idx = new FileStream(MobileIndexPath, FileMode.Open, FileAccess.Read, FileShare.Read)) {
                    BinaryReader idxReader = new BinaryReader(idx);

                    using (FileStream tdb = new FileStream(MobileTypesPath, FileMode.Open, FileAccess.Read, FileShare.Read)) {
                        BinaryReader tdbReader = new BinaryReader(tdb);

                        List <object[]> types = ReadTypes(tdbReader);

                        mobileCount = idxReader.ReadInt32();

                        m_Mobiles = new Dictionary <Serial, Mobile>(mobileCount);

                        for (int i = 0; i < mobileCount; ++i)
                        {
                            int  typeID = idxReader.ReadInt32();
                            int  serial = idxReader.ReadInt32();
                            long pos    = idxReader.ReadInt64();
                            int  length = idxReader.ReadInt32();

                            object[] objs = types[typeID];

                            if (objs == null)
                            {
                                continue;
                            }

                            Mobile          m        = null;
                            ConstructorInfo ctor     = ( ConstructorInfo )objs[0];
                            string          typeName = ( string )objs[1];

                            try {
                                ctorArgs[0] = ( Serial )serial;
                                m           = ( Mobile )(ctor.Invoke(ctorArgs));
                            } catch {
                            }

                            if (m != null)
                            {
                                mobiles.Add(new MobileEntry(m, typeID, typeName, pos, length));
                                AddMobile(m);
                            }
                        }

                        tdbReader.Close();
                    }

                    idxReader.Close();
                }
            }
            else
            {
                m_Mobiles = new Dictionary <Serial, Mobile>();
            }

            if (File.Exists(ItemIndexPath) && File.Exists(ItemTypesPath))
            {
                using (FileStream idx = new FileStream(ItemIndexPath, FileMode.Open, FileAccess.Read, FileShare.Read)) {
                    BinaryReader idxReader = new BinaryReader(idx);

                    using (FileStream tdb = new FileStream(ItemTypesPath, FileMode.Open, FileAccess.Read, FileShare.Read)) {
                        BinaryReader tdbReader = new BinaryReader(tdb);

                        List <object[]> types = ReadTypes(tdbReader);

                        itemCount = idxReader.ReadInt32();

                        m_Items = new Dictionary <Serial, Item>(itemCount);

                        for (int i = 0; i < itemCount; ++i)
                        {
                            int  typeID = idxReader.ReadInt32();
                            int  serial = idxReader.ReadInt32();
                            long pos    = idxReader.ReadInt64();
                            int  length = idxReader.ReadInt32();

                            object[] objs = types[typeID];

                            if (objs == null)
                            {
                                continue;
                            }

                            Item            item     = null;
                            ConstructorInfo ctor     = ( ConstructorInfo )objs[0];
                            string          typeName = ( string )objs[1];

                            try {
                                ctorArgs[0] = ( Serial )serial;
                                item        = ( Item )(ctor.Invoke(ctorArgs));
                            } catch {
                            }

                            if (item != null)
                            {
                                items.Add(new ItemEntry(item, typeID, typeName, pos, length));
                                AddItem(item);
                            }
                        }

                        tdbReader.Close();
                    }

                    idxReader.Close();
                }
            }
            else
            {
                m_Items = new Dictionary <Serial, Item>();
            }

            if (File.Exists(GuildIndexPath))
            {
                using (FileStream idx = new FileStream(GuildIndexPath, FileMode.Open, FileAccess.Read, FileShare.Read)) {
                    BinaryReader idxReader = new BinaryReader(idx);

                    guildCount = idxReader.ReadInt32();

                    CreateGuildEventArgs createEventArgs = new CreateGuildEventArgs(-1);
                    for (int i = 0; i < guildCount; ++i)
                    {
                        idxReader.ReadInt32();                        //no typeid for guilds
                        int  id     = idxReader.ReadInt32();
                        long pos    = idxReader.ReadInt64();
                        int  length = idxReader.ReadInt32();

                        createEventArgs.Id = id;
                        BaseGuild guild = EventSink.InvokeCreateGuild(createEventArgs);
                        if (guild != null)
                        {
                            guilds.Add(new GuildEntry(guild, pos, length));
                        }
                    }

                    idxReader.Close();
                }
            }

            bool      failedMobiles = false, failedItems = false, failedGuilds = false;
            Type      failedType   = null;
            Serial    failedSerial = Serial.Zero;
            Exception failed       = null;
            int       failedTypeID = 0;

            if (File.Exists(MobileDataPath))
            {
                using (FileStream bin = new FileStream(MobileDataPath, FileMode.Open, FileAccess.Read, FileShare.Read)) {
                    BinaryFileReader reader = new BinaryFileReader(new BinaryReader(bin));

                    for (int i = 0; i < mobiles.Count; ++i)
                    {
                        MobileEntry entry = mobiles[i];
                        Mobile      m     = entry.Mobile;

                        if (m != null)
                        {
                            reader.Seek(entry.Position, SeekOrigin.Begin);

                            try {
                                m_LoadingType = entry.TypeName;
                                m.Deserialize(reader);

                                if (reader.Position != (entry.Position + entry.Length))
                                {
                                    throw new Exception(String.Format("***** Bad serialize on {0} *****", m.GetType()));
                                }
                            } catch (Exception e) {
                                mobiles.RemoveAt(i);

                                failed        = e;
                                failedMobiles = true;
                                failedType    = m.GetType();
                                failedTypeID  = entry.TypeID;
                                failedSerial  = m.Serial;

                                break;
                            }
                        }
                    }

                    reader.Close();
                }
            }

            if (!failedMobiles && File.Exists(ItemDataPath))
            {
                using (FileStream bin = new FileStream(ItemDataPath, FileMode.Open, FileAccess.Read, FileShare.Read)) {
                    BinaryFileReader reader = new BinaryFileReader(new BinaryReader(bin));

                    for (int i = 0; i < items.Count; ++i)
                    {
                        ItemEntry entry = items[i];
                        Item      item  = entry.Item;

                        if (item != null)
                        {
                            reader.Seek(entry.Position, SeekOrigin.Begin);

                            try {
                                m_LoadingType = entry.TypeName;
                                item.Deserialize(reader);

                                if (reader.Position != (entry.Position + entry.Length))
                                {
                                    throw new Exception(String.Format("***** Bad serialize on {0} *****", item.GetType()));
                                }
                            } catch (Exception e) {
                                items.RemoveAt(i);

                                failed       = e;
                                failedItems  = true;
                                failedType   = item.GetType();
                                failedTypeID = entry.TypeID;
                                failedSerial = item.Serial;

                                break;
                            }
                        }
                    }

                    reader.Close();
                }
            }

            m_LoadingType = null;

            if (!failedMobiles && !failedItems && File.Exists(GuildDataPath))
            {
                using (FileStream bin = new FileStream(GuildDataPath, FileMode.Open, FileAccess.Read, FileShare.Read)) {
                    BinaryFileReader reader = new BinaryFileReader(new BinaryReader(bin));

                    for (int i = 0; i < guilds.Count; ++i)
                    {
                        GuildEntry entry = guilds[i];
                        BaseGuild  g     = entry.Guild;

                        if (g != null)
                        {
                            reader.Seek(entry.Position, SeekOrigin.Begin);

                            try {
                                g.Deserialize(reader);

                                if (reader.Position != (entry.Position + entry.Length))
                                {
                                    throw new Exception(String.Format("***** Bad serialize on Guild {0} *****", g.Id));
                                }
                            } catch (Exception e) {
                                guilds.RemoveAt(i);

                                failed       = e;
                                failedGuilds = true;
                                failedType   = typeof(BaseGuild);
                                failedTypeID = g.Id;
                                failedSerial = g.Id;

                                break;
                            }
                        }
                    }

                    reader.Close();
                }
            }

            if (failedItems || failedMobiles || failedGuilds)
            {
                Console.WriteLine("An error was encountered while loading a saved object");

                Console.WriteLine(" - Type: {0}", failedType);
                Console.WriteLine(" - Serial: {0}", failedSerial);

                if (!Core.Service)
                {
                    Console.WriteLine("Delete the object? (y/n)");

                    if (Console.ReadKey(true).Key == ConsoleKey.Y)
                    {
                        if (failedType != typeof(BaseGuild))
                        {
                            Console.WriteLine("Delete all objects of that type? (y/n)");

                            if (Console.ReadKey(true).Key == ConsoleKey.Y)
                            {
                                if (failedMobiles)
                                {
                                    for (int i = 0; i < mobiles.Count;)
                                    {
                                        if (mobiles[i].TypeID == failedTypeID)
                                        {
                                            mobiles.RemoveAt(i);
                                        }
                                        else
                                        {
                                            ++i;
                                        }
                                    }
                                }
                                else if (failedItems)
                                {
                                    for (int i = 0; i < items.Count;)
                                    {
                                        if (items[i].TypeID == failedTypeID)
                                        {
                                            items.RemoveAt(i);
                                        }
                                        else
                                        {
                                            ++i;
                                        }
                                    }
                                }
                            }
                        }

                        SaveIndex <MobileEntry>(mobiles, MobileIndexPath);
                        SaveIndex <ItemEntry>(items, ItemIndexPath);
                        SaveIndex <GuildEntry>(guilds, GuildIndexPath);
                    }

                    Console.WriteLine("After pressing return an exception will be thrown and the server will terminate.");
                    Console.ReadLine();
                }
                else
                {
                    Console.WriteLine("An exception will be thrown and the server will terminate.");
                }

                throw new Exception(String.Format("Load failed (items={0}, mobiles={1}, guilds={2}, type={3}, serial={4})", failedItems, failedMobiles, failedGuilds, failedType, failedSerial), failed);
            }

            EventSink.InvokeWorldLoad();

            m_Loading = false;

            ProcessSafetyQueues();

            foreach (Item item in m_Items.Values)
            {
                if (item.Parent == null)
                {
                    item.UpdateTotals();
                }

                item.ClearProperties();
            }

            foreach (Mobile m in m_Mobiles.Values)
            {
                m.UpdateRegion();                 // Is this really needed?
                m.UpdateTotals();

                m.ClearProperties();
            }

            watch.Stop();

            Console.WriteLine("done ({1} items, {2} mobiles) ({0:F2} seconds)", watch.Elapsed.TotalSeconds, m_Items.Count, m_Mobiles.Count);
        }
Esempio n. 37
0
		public virtual bool OnMoveInto(Mobile m, Direction d, Point3D newLocation, Point3D oldLocation)
		{
			return (m.WalkRegion == null || AcceptsSpawnsFrom(m.WalkRegion));
		}
Esempio n. 38
0
		public virtual void OnEnter(Mobile m)
		{ }
Esempio n. 39
0
		public virtual void OnExit(Mobile m)
		{ }
Esempio n. 40
0
 public virtual void GetContextMenuEntries(Mobile from, List<Server.ContextMenus.ContextMenuEntry> list, Item item)
 {
 }