public override void OnResponse( NetState sender, RelayInfo info )
		{
			int id = info.ButtonID;

			if ( m_PetSummonBall.Deleted || id <= 0 )
				return;

			id --;

			ArrayList pets = GetPetList( m_Mobile );

			if ( id < pets.Count && id >= 0 )
			{
				if ( m_Mobile.BankBox.ConsumeTotal( typeof( Gold ), 75000 ) )
				{
					m_PetSummonBall.UseCharge();
					SufferSkillLoss( (Mobile)pets[id], 10 );
					((Mobile)pets[id]).MoveToWorld( m_Mobile.Location, m_Mobile.Map );
					m_Mobile.SendMessage( "You pay the fee and your pet is returned to you. Your pet has suffered some skills from the travel." );
				}
				else
				{
					m_Mobile.SendMessage( "You need 75,000 gold in your bank to return your pet." );
				}
			}
		}
        public override void OnResponse( NetState sender, RelayInfo info )
        {
            if ( info.ButtonID == 1 )
            {
                if ( !RewardSystem.HasAccess( m_From, m_Entry ) )
                    return;

                Item item = m_Entry.Construct();

                if ( item != null )
                {
                    if ( RewardSystem.ConsumeRewardPoint( m_From ) )
                        m_From.AddToBackpack( item );
                    else
                        item.Delete();
                }
            }

            int cur, max;

            RewardSystem.ComputeRewardInfo( m_From, out cur, out max );

            if ( cur < max )
                m_From.SendGump( new RewardNoticeGump( m_From ) );
        }
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            switch(info.ButtonID)
            {
                case 0:
                {

                    break;
                }
                case 1:
                {
                    from.SendGump(new TournamentInfoGump(from, t));
                    break;
                }
                case 2:
                {
                    t.Date = t.Date.AddHours(1);
                    from.SendGump(new TournamentTimeGump(from, t));
                    break;
                }
                case 3:
                {
                    t.Date = t.Date.AddHours(-1);
                    from.SendGump(new TournamentTimeGump(from, t));
                    break;
                }
                case 4:
                {
                    t.Date = t.Date.AddMinutes(1);
                    from.SendGump(new TournamentTimeGump(from, t));
                    break;
                }
                case 5:
                {
                    t.Date = t.Date.AddMinutes(-1);
                    from.SendGump(new TournamentTimeGump(from, t));
                    break;
                }
                case 6:
                {
                    t.Date = t.Date.AddHours(12);
                    from.SendGump(new TournamentTimeGump(from, t));
                    break;
                }
                case 7:
                {
                    t.Date = t.Date.AddMinutes(15);
                    from.SendGump(new TournamentTimeGump(from, t));
                    break;
                }
                case 8:
                {
                    t.Date = t.Date.AddMinutes(-15);
                    from.SendGump(new TournamentTimeGump(from, t));
                    break;
                }
            }
        }
示例#4
0
        public override void OnResponse( NetState state, RelayInfo info )
        {
            Mobile from = state.Mobile;

            if ( info.ButtonID == 1 )
            {
                if ( m_crop != null && !m_crop.Deleted )
                {
                    if ( m_crop is WheatCrop )
                        ((WheatCrop)m_crop).UpRoot( m_Owner );
                    else if ( m_crop is CottonCrop )
                        ((CottonCrop)m_crop).UpRoot( m_Owner );
                    else if ( m_crop is CarrotCrop )
                        ((CarrotCrop)m_crop).UpRoot( m_Owner );
                    else if ( m_crop is FlaxCrop )
                        ((FlaxCrop)m_crop).UpRoot( m_Owner );
                    else if ( m_crop is LettuceCrop )
                        ((LettuceCrop)m_crop).UpRoot( m_Owner );
                    else if ( m_crop is OnionCrop )
                        ((OnionCrop)m_crop).UpRoot( m_Owner );
                    else if ( m_crop is GarlicCrop )
                        ((GarlicCrop)m_crop).UpRoot( m_Owner );
                    else if ( m_crop is CabbageCrop )
                        ((CabbageCrop)m_crop).UpRoot( m_Owner );
                    else if ( m_crop is CornCrop )
                        ((CornCrop)m_crop).UpRoot( m_Owner );
                }
            }
        }
        public override void OnResponse(NetState state, RelayInfo info)
        {
            string bookName = "";
            try
            {
                for (int x = 0; x < 51; x++)
                {
                    bookName = GetString(info, x + 100);
                    if (!(string.IsNullOrEmpty(bookName)) && bookName.Length > 0) Book.Books[x].Name = bookName;
                    else Book.Books[x].Name = string.Format("Book #{0}", ((int)(x + 1)).ToString());
                }
            }
            catch(Exception e)
            {
                Console.WriteLine("Caught Exception in MasterRunebookGump, during the 'for' loop.");
                Console.WriteLine(e.ToString());
            }
            Mobile from = state.Mobile;
            try
            {

                if (info.ButtonID > 0)
                    from.SendGump(new InternalRunebookGump(from, Book.Books[info.ButtonID - 16], Book, info.ButtonID - 16));
            }
            catch (Exception e)
            {
                Console.WriteLine("Caught Exception in MasterRunebookGump, when sending new InternalRunebookGump.");
                Console.WriteLine(e.ToString());
            }
        }
示例#6
0
 public override void OnResponse(NetState sender, RelayInfo info)
 {
     if (info.ButtonID == 3)
         m_From.SendGump(new VirtuesVicesGump(m_From, m_Page + 1, X, Y));
     else if (info.ButtonID == 2)
         m_From.SendGump(new VirtuesVicesGump(m_From, m_Page - 1, X, Y));
 }
示例#7
0
		public override void OnResponse( NetState state, RelayInfo info )
		{
			m_Mobile.SendGump( new PageResponseGump( m_Mobile, m_Name, m_Text ) );

			//m_Mobile.SendMessage( 0x482, "{0} tells you:", m_Name );
			//m_Mobile.SendMessage( 0x482, m_Text );
		}
示例#8
0
        public override void OnResponse(NetState sender, RelayInfo relayInfo)
        {
            int index = relayInfo.ButtonID - 1;

            if (index >= 0 && index < this.m_Names.Length)
            {
                try
                {
                    MethodInfo info = this.m_Property.PropertyType.GetMethod("Parse", new Type[] { typeof(string) });

                    CommandLogging.LogChangeProperty(this.m_Mobile, this.m_Object, this.m_Property.Name, this.m_Names[index]);

                    if (info != null)
                        this.m_Property.SetValue(this.m_Object, info.Invoke(null, new object[] { this.m_Names[index] }), null);
                    else if (this.m_Property.PropertyType == typeof(Enum) || this.m_Property.PropertyType.IsSubclassOf(typeof(Enum)))
                        this.m_Property.SetValue(this.m_Object, Enum.Parse(this.m_Property.PropertyType, this.m_Names[index], false), null);
                }
                catch
                {
                    this.m_Mobile.SendMessage("An exception was caught. The property may not have changed.");
                }
            }

            this.m_Mobile.SendGump(new XmlPropertiesGump(this.m_Mobile, this.m_Object, this.m_Stack, this.m_List, this.m_Page));
        }
        public override void OnResponse( NetState sender, RelayInfo info )
        {
            Item item = m_Addon as Item;

            if ( item == null || item.Deleted )
                return;

            if ( info.ButtonID == (int) Buttons.Confirm )
            {
                Mobile m = sender.Mobile;
                BaseHouse house = BaseHouse.FindHouseAt( m );

                if ( house != null && house.IsOwner( m ) )
                {
                    if ( m.InRange( item.Location, 2 ) )
                    {
                        Item deed = m_Addon.Deed;

                        if ( deed != null )
                        {
                            m.AddToBackpack( deed );
                            house.Addons.Remove( item );
                            item.Delete();
                        }
                    }
                    else
                        m.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
                }
                else
                    m.SendLocalizedMessage( 1049784 ); // You can only re-deed this decoration if you are the house owner or originally placed the decoration.
            }
        }
示例#10
0
        public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
        {
            Mobile pm = ( Mobile )sender.Mobile;

            if( pm == null )
                return;

            switch (info.ButtonID)
            {
                case 2:
                    {
                        TextRelay text = info.GetTextEntry( 1 );

                        if (text == null || text.Text == "")
                        {
                            pm.CloseGump(typeof(AccountSearch));
                            pm.SendGump(new AccountSearch());
                            return;
                        }

                        ArrayList authors = new ArrayList();

                        if (ForumCore.AuthorExists( out authors, text.Text))
                        {
                            pm.CloseGump( typeof(AccountListingGump));
                            pm.SendGump( new AccountListingGump( authors, 0 ) );
                        }
                        else
                        {
                            pm.SendMessage("Either that player does not exist, or no posts have been made by that player.");
                        }
                        break;
                    }
            }
        }
		public override void OnResponse(NetState state, RelayInfo info)
		{
			if (duel == null)
				return;

			if (info.ButtonID == (int)Buttons.Button1)
			{

				if (duel.Player1.BankBox == null || duel.Player1.BankBox.GetAmount(typeof(Gold), true) < duel.Wager)
				{
					duel.Player1.SendMessage("Challenge canceled, you don't have enough gold in your bank box");
				}
				else if (duel.MaxDex < duel.Player1.Dex)
				{
					duel.Player1.SendMessage("Challenge canceled, you have too high dex for this challenge.");
				}
				else
				{

					duel.Player1.SendGump(new WaitGump(duel));
					duel.Player2.SendGump(new ChallengedGump(duel));
				}


			}
			else if (info.ButtonID == (int)Buttons.Button2)
			{
				duel.Player1.SendMessage("The challenge has been canceled.");

			}

		}
示例#12
0
        public override void OnResponse( GameClient sender, RelayInfo info )
        {
            PlayerMobile pm = sender.Mobile as PlayerMobile;

            if ( pm == null )
                return;

            if ( !pm.InRange( m_Owner.Location, 5 ) )
                return;

            switch ( info.ButtonID )
            {
                case 2: // Yes, and do not ask me again
                    {
                        pm.DisabledPvpWarning = true;
                        pm.SendLocalizedMessage( 1113796 ); // You may use your avatar's context menu to re-enable the warning later.

                        goto case 1;
                    }
                case 1: // Yes, I wish to proceed
                    {
                        BaseCreature.TeleportPets( pm, m_Owner.PointDest, m_Owner.MapDest );
                        pm.MoveToWorld( m_Owner.PointDest, m_Owner.MapDest );

                        break;
                    }
                case 0: // No, I do not wish to proceed
                    {
                        break;
                    }
            }
        }
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            if (m_Deed.Deleted || !m_Deed.IsChildOf(sender.Mobile.Backpack))
                return;

            switch (info.ButtonID)
            {
                case (int)Buttons.Exit:
                    return;
                case (int)Buttons.Add:
                    m_Deed.BeginCombine(sender.Mobile);
                    return;
                case (int)Buttons.PlaceInHouse:
                    if (m_Deed.NumOfPartsAdded > 0)
                    {
                        m_Deed.PlaceInHouse(sender.Mobile);
                        return;
                    }
                    else
                        sender.Mobile.SendMessage("You cannot add the pentagram to a house without any parts in the deed.");
                    break;
            }

            sender.Mobile.SendGump(new BloodPentagramPartGump(sender.Mobile, m_Deed));
        }
示例#14
0
		public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
		{
			if ( ! AuctionSystem.Running )
			{
				sender.Mobile.SendMessage( AuctionConfig.MessageHue, AuctionSystem.ST[ 15 ] );
				return;
			}

			switch( info.ButtonID )
			{
				case 0:

					if ( m_Callback != null )
					{
						try { m_Callback.DynamicInvoke( new object[] { sender.Mobile } ); }
						catch {}
					}
					break;

				case 1: // View your auctions

					sender.Mobile.SendGump( new AuctionListing( sender.Mobile, AuctionSystem.GetAuctions( sender.Mobile ), false, false ) );
					break;

				case 2: // View your bids

					sender.Mobile.SendGump( new AuctionListing( sender.Mobile, AuctionSystem.GetBids( sender.Mobile ), false, false ) );
					break;

				case 3: // View your pendencies

					sender.Mobile.SendGump( new AuctionListing( sender.Mobile, AuctionSystem.GetPendencies( sender.Mobile ), false, false ) );
					break;
			}
		}
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile m = sender.Mobile;

            if (info.ButtonID == 1)
            {
                if (m.InRange(m_Healer, 16))
                {
                    if (info.IsSwitched(0) && Banker.Withdraw(m, m_Price))
                    {
                        Timer.DelayCall(TimeSpan.FromSeconds(10.0), new TimerStateCallback(PaidRes), m);
                        m.Frozen = true;
                    }

                    else
                    {
                        m.Resurrect();
                        m.PlaySound(0x214);
                        m.FixedEffect(0x376A, 10, 16);
                    }
                }
                else
                    m.SendMessage("You have wandered to far off to gain any benefits from the healers practices.");
            }
        }
示例#16
0
		public override void OnResponse( NetState sender, RelayInfo info )
		{
			if ( info.ButtonID == 0 )
			{
				m_From.SendLocalizedMessage( 501235, "", 0x35 ); // Help request aborted.
			}
			else
			{
				TextRelay entry = info.GetTextEntry( 0 );
				string text = ( entry == null ? "" : entry.Text.Trim() );

				if ( text.Length == 0 )
				{
					m_From.SendMessage( 0x35, "You must enter a description." );
					m_From.SendGump( new PagePromptGump( m_From, m_Type ) );
				}
				else
				{
					m_From.SendLocalizedMessage( 501234, "", 0x35 ); /* The next available Counselor/Game Master will respond as soon as possible.
																	  * Please check your Journal for messages every few minutes.
																	  */

					PageQueue.Enqueue( new PageEntry( m_From, text, m_Type ) );
				}
			}
		}
示例#17
0
        public override void OnResponse( NetState sender, RelayInfo info )
        {
            Mobile from = sender.Mobile;
            if ( info.ButtonID == 0 ) // close
                return;
            if ( m_Item1.RootParent != from || m_Item2.RootParent != from )
            {
                from.SendMessage( "The items you wish to combine must be in your backpack." );
                return;
            }

            if ( m_Item1 is IDynamicStackable )
            {
                if ( m_Item1.Amount + m_Item2.Amount > 60000 )
                    from.SendMessage( "You cannot make a single stack of more than 60000 items." );
                else
                    (m_Item1 as IDynamicStackable).AcceptedStack( from, m_Item2 );
                return;
            }
            else
            {
                from.SendMessage( "Error, one of the items is not a dynamic stackable item" );
                return;
            }
        }
示例#18
0
		public override void OnResponse( NetState sender, RelayInfo info )
		{
			if ( info.ButtonID == 1 )
			{
				try
				{
					if ( m_From.AccessLevel >= AccessLevel.GameMaster )
					{
						TextRelay text = info.GetTextEntry( 0 );

						if ( text != null )
						{
							m_Skill.Base = Convert.ToDouble( text.Text );
							CommandLogging.LogChangeProperty( m_From, m_Target, String.Format( "{0}.Base", m_Skill ), m_Skill.Base.ToString() );
						}
					}
					else
					{
						m_From.SendMessage( "You may not change that." );
					}

					m_From.SendGump( new SkillsGump( m_From, m_Target, m_Selected ) );
				}
				catch
				{
					m_From.SendMessage( "Bad format. ###.# expected." );
					m_From.SendGump( new EditSkillGump( m_From, m_Target, m_Skill, m_Selected ) );
				}
			}
			else
			{
				m_From.SendGump( new SkillsGump( m_From, m_Target, m_Selected ) );
			}
		}
		public override void OnResponse( NetState sender, RelayInfo info )
		{
			int index = info.ButtonID - 1;

			if ( index >= 0 && index < m_SellList.Length )
			{
				HairstylistBuyInfo buyInfo = m_SellList[index];

				try
				{
					object[] origArgs = buyInfo.GumpArgs;
					object[] args = new object[origArgs.Length];

					for ( int i = 0; i < args.Length; ++i )
					{
						if ( origArgs[i] == Price )
							args[i] = 0;
						else if ( origArgs[i] == From )
							args[i] = m_Merc;
						else if ( origArgs[i] == Merc )
							args[i] = m_From;
						else
							args[i] = origArgs[i];
					}

					m_From.SendGump( Activator.CreateInstance( buyInfo.GumpType, args ) as Gump );
				}
				catch {}
			}
		}
示例#20
0
		public List<string> CreateArray( RelayInfo info, Mobile from )
		{
			List<string> creaturesName = new List<string>();

			for ( int i = 0;  i < 13; i++ )
			{
				TextRelay te = info.GetTextEntry( i );

				if ( te != null )
				{
					string str = te.Text;

					if ( str.Length > 0 )
					{
						str = str.Trim();

						string t = Spawner.ParseType( str );

						Type type = ScriptCompiler.FindTypeByName( t );

						if ( type != null )
							creaturesName.Add( str );
						else
							from.SendMessage( "{0} is not a valid type name.", t );
					}
				}
			}

			return creaturesName;
		}
示例#21
0
		public ArrayList CreateArray( RelayInfo info, Mobile from )
		{
			ArrayList subSpawnerD = new ArrayList();

			for ( int i = 0;  i < 15; i++ )
			{
				TextRelay te = info.GetTextEntry( i );

				if ( te != null )
				{
					string str = te.Text;

					if ( str.Length > 0 )
					{
						str = str.Trim();

						Type type = SpawnerType.GetType( str );

						if ( type != null )
							subSpawnerD.Add( str );
						else
							from.SendMessage( "{0} is not a valid type name.", str );
					}
				}
			}

			return subSpawnerD;
		}
      		public override void OnResponse( NetState state, RelayInfo info ) 
      		{ 
			Mobile from = state.Mobile; 

			if ( from == null )
				return;

        		if ( info.ButtonID == 1 )
         		{
				from.SendGump( new CityCitizenGump( m_Stone, from ) );
			}

        		if ( info.ButtonID == 2 )
         		{
				PlayerMobile pm = (PlayerMobile)from;
				pm.City = null;
				pm.CityTitle = null;
				pm.ShowCityTitle = false;

				m_Stone.Citizens.Remove( from );
				from.SendMessage( "You have left the city." );

				foreach ( Mobile m in m_Stone.Citizens )
				{
					m.SendMessage( "CITY MESSAGE: {0} has left the city.", from.Name );
				}
			}
		}
        public override void OnResponse( NetState state, RelayInfo info )
        {
            Mobile from = state.Mobile;

            if( info.IsSwitched( (int)Buttons.rdoYesJoin ) )
            {
                if( ScavengerSignup.signupEnabled && from is PlayerMobile )
                {
                    ScavengerBasket newBasket = new ScavengerBasket( (PlayerMobile)from );
                    if( !from.Backpack.CheckHold( from, newBasket, false ) )
                    {
                        from.SendMessage( "Your backpack is too full to even consider entering this event!" );
                        newBasket.Delete();
                        return;
                    }

                    from.AddToBackpack( newBasket );
                    ScavengerSignup.ScavengerBaskets.Add( newBasket );
                    from.SendMessage( "You are now entered in the scavenger hunt. Use the supplied basket to gather the scavenger items!" );
                }
                else
                {
                    from.SendMessage( "You have waited too long and signup for the scavenger hunt has ended" );
                }
            }
            else
            {
                from.SendMessage( "You have not been entered into the scavenger hunt event" );
            }
        }
示例#24
0
		public override void OnResponse(NetState state, RelayInfo info)
		{
			Mobile from = state.Mobile;
			
			switch(info.ButtonID)
			{
				default:
				case 0: break;
				case 1: 
					from.SendGump(new StallLeasingGump(from, m_Plot));
					from.SendGump(new BazaarInformationGump(-1, 1150391));
					break;
				case 2: // SEE TOP BIDS
					from.SendGump(new TopBidsGump(from, m_Plot));
					break;
				case 3: // MY STALL LEASE
                    if (m_Plot.IsOwner(from))
                        from.SendGump(new MyStallLeaseGump(from, m_Plot));
                    else
                        from.SendLocalizedMessage(1150685); // You are currently viewing a stall that you are not leasing. In order to set up or modify your stall, please use that stall's sign.
					break;
				case 4: // MY STALL BID
					from.SendGump(new StallBidGump(from, m_Plot));
					break;
				case 5: // MY BID MATCHING
					if(m_Plot.IsOwner(from))
                        from.SendGump(new MatchBidGump(from, m_Plot));
					else
						from.SendLocalizedMessage(1150685); // You are currently viewing a stall that you are not leasing. In order to set up or modify your stall, please use that stall's sign.
					break;
			}
		}
示例#25
0
		public override void OnResponse( NetState sender, RelayInfo info )
		{
			PlayerMobile pm = sender.Mobile as PlayerMobile;

			if( !IsMember( pm, guild ) )
				return;

			switch( info.ButtonID )
			{
				case 1:
				{
					pm.SendGump( new GuildInfoGump( pm, guild ) );
					break;
				}
				case 2:
				{
					pm.SendGump( new GuildRosterGump( pm, guild ) );
					break;
				}
				case 3:
				{
					pm.SendGump( new GuildDiplomacyGump( pm, guild ) );
					break;
				}
			}
		}
      		public override void OnResponse( NetState state, RelayInfo info ) 
      		{ 
			Mobile from = state.Mobile; 

			if ( from == null )
				return;

        		if ( info.ButtonID == 0 ) // Close
         		{
				from.SendGump( new CityManagementGump( m_Stone, from ) );
			}

        		if ( info.ButtonID == 1 ) // Previous page
         		{
         			if ( m_ListPage > 0 )
					from.SendGump( new ChangeCitizenTitleGump( m_Stone, m_ListPage - 1, m_List, m_CountList ) );
			}

        		if ( info.ButtonID == 2 ) // Next page
         		{ 
         			if ( (m_ListPage + 1) * 7 < m_List.Count )
					from.SendGump( new ChangeCitizenTitleGump( m_Stone, m_ListPage + 1, m_List, m_CountList ) );
			}

        		if ( info.ButtonID >= 100 && info.ButtonID <= 999 ) // Decline
         		{
				Mobile mob = m_List[ info.ButtonID - 100 ] as Mobile;
				
				from.SendMessage( "Please enter the members new title, You are limited to 25 charactors or less." );
				from.Prompt = new CitizenTitleChangePrompt( m_Stone, mob, from );
			}
		}
示例#27
0
        public override void OnResponse( Server.Network.NetState sender, RelayInfo info )
        {
            int val, type, index;
            DecodeButtonId(info.ButtonID, out val, out type, out index);

            if( val < 0 )
                return;

            switch( type )
            {
                case 1:
                    {
                        switch( index )
                        {
                            case 0: //purchase
                                {
                                    Market.BuyItem(sender.Mobile, _entry);
                                    break;
                                }
                            case 1: //go back
                                {
                                    sender.Mobile.CloseGump(typeof(MarketDetailsGump));
                                    break;
                                }
                        }

                        break;
                    }
            }
        }
示例#28
0
        public void OnResponse(Server.Network.NetState sender, Server.Gumps.RelayInfo info)
        {
            Mobile    from = sender.Mobile;
            TMSS4Skin skin = sk;

            SkillReportsHelper.EnableSelectionReport = info.IsSwitched(2000);
            SkillReportsHelper.EnableProfileReport   = info.IsSwitched(1000);
            //PluginSaver.SavePluginSettings(this);
            Dictionary <string, object> args = new Dictionary <string, object>();

            if (skin != null)
            {
                args.Add("Skin", skin);
            }
            else
            {
                SkillSettings.DoTell("Reports: Skin is null.");
            }
            if (from != null)
            {
                args.Add("Mobile", from);
            }
            else
            {
                SkillSettings.DoTell("Reports: From is null.");
            }
            from.SendGump(new TMQueryPage("Main Menu", args));
        }
示例#29
0
        public override void OnResponse( GameClient state, RelayInfo info )
        {
            Mobile from = state.Mobile;

            switch ( info.ButtonID )
            {
                case 0:
                    {
                        from.SendLocalizedMessage( 501235, "", 0x35 ); // Help request aborted.

                        break;
                    }
                case 1:
                    {
                        from.SendGump( new TargetInvolvedPlayersGump( text, m_Type, "", "", "" ) );

                        break;
                    }
                case 2:
                    {
                        from.SendGump( new TypeNamesOfInvolvedPlayersGump( text, m_Type, "", "", "" ) );

                        break;
                    }
                case 3:
                    {
                        from.SendGump( new SelectNamesOfInvolvedPlayersFromListGump( text, m_Type ) );

                        break;
                    }
            }
        }
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            if (info.ButtonID != m_CorrectChoice)
            {
                if (m_GumpOwner.AntiMacroTimeCheck < (DateTime.Now - TimeSpan.FromHours(24)))
                {
                    m_GumpOwner.AntiMacroFailed = 1;
                    m_GumpOwner.AntiMacroTimeCheck = DateTime.Now;
                }
                else
                    m_GumpOwner.AntiMacroFailed++;

                m_GumpOwner.Kill();

                if (m_GumpOwner.AntiMacroFailed >= 3)
                {
                    m_GumpOwner.SendAsciiMessage("You failed the gump too many times and have been moved to a secure location.");
                    m_GumpOwner.Location = new Point3D(2567, 448, 0);
                    m_GumpOwner.Map = Map.Felucca;
                    m_GumpOwner.AntiMacroFailed = 0;
                }
            }
            else
                m_GumpOwner.AntiMacroFailed = 0;

            //m_GumpOwner.Frozen = false;
            m_GumpOwner.CloseGump(typeof(OldAntiMacroGump));
            m_GumpOwner.AntiMacroGump = false;

            if (m_MacroTimer != null)
            {
                m_MacroTimer.Stop();
                m_MacroTimer = null;
            }
        }
		public override void OnResponse( Server.Network.NetState sender, RelayInfo info )
		{
			if ( info.ButtonID == 2 )
			{
				if ( !m_Pet.Deleted && m_Pet.Controlled && m_From == m_Pet.ControlMaster && m_From.CheckAlive() && m_Pet.CheckControlChance( m_From ) )
				{
					if ( m_Pet.Map == m_From.Map )
					{
						if ( m_RangeCheck == true && !m_Pet.InRange( m_From, 14 ) )
						{
							m_From.SendMessage( "You are too far away from your pet." );
							return;
						}

						m_Pet.ControlTarget = null;
						m_Pet.ControlOrder = OrderType.Release;
						//Pix: added kick to Obey because when we added the ability to release a 'lost'
						// pet, if there were no players around, the pet would not release until a player
						// got in range of the pet.  This wasn't an issue before because there was 
						// a range check involved so there was always a player around when releasing the pet.
						m_Pet.AIObject.Obey();
						BaseHire m_Hire = m_Pet as BaseHire;	//added by Old Salty from here . . .
						if ( m_Hire != null && m_Hire.IsHired ) 
						{
							m_Hire.IsHired = false;
						}										//. . . to here
					}
				}
			}
		}
示例#32
0
 public virtual void OnResponse(RelayInfo info)
 {
 }
示例#33
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile m_from = sender.Mobile;


            List <PaintingConsumer> testList = new List <PaintingConsumer>();

            switch (info.ButtonID)
            {
            case 0://Male Portrait
                if (HadNeededItems(m_from, PaintingType.Portrait_Male))
                {
                    m_from.SendMessage("Target the person you wish to paint.");
                    m_from.Target = new PortraitTarget(PaintConsumers.FirstOrDefault(x => x.PaintType == PaintingType.Portrait_Male));
                }
                break;

            case 1://Female Portrait
                if (HadNeededItems(m_from, PaintingType.Portrait_Male))
                {
                    m_from.SendMessage("Target the person you wish to paint.");
                    m_from.Target = new PortraitTarget(PaintConsumers.FirstOrDefault(x => x.PaintType == PaintingType.Portrait_Female));
                }
                break;


            case 2://Small Still Life 1
                if (HadNeededItems(m_from, PaintingType.Portrait_Male))
                {
                    m_from.SendMessage("Target the object you wish to paint.");
                    m_from.Target = new ObjectTarget(PaintConsumers.FirstOrDefault(x => x.PaintType == PaintingType.Still_Small1));
                }
                break;

            case 3://Small Still Life 2
                if (HadNeededItems(m_from, PaintingType.Portrait_Male))
                {
                    m_from.SendMessage("Target the object you wish to paint.");
                    m_from.Target = new ObjectTarget(PaintConsumers.FirstOrDefault(x => x.PaintType == PaintingType.Still_Small2));
                }
                break;

            case 4://Large Still Life 1
                if (HadNeededItems(m_from, PaintingType.Portrait_Male))
                {
                    m_from.SendMessage("Target the object you wish to paint.");
                    m_from.Target = new ObjectTarget(PaintConsumers.FirstOrDefault(x => x.PaintType == PaintingType.Still_Large1));
                }
                break;

            case 5://Large Still Life 2
                if (HadNeededItems(m_from, PaintingType.Portrait_Male))
                {
                    m_from.SendMessage("Target the object you wish to paint.");
                    m_from.Target = new ObjectTarget(PaintConsumers.FirstOrDefault(x => x.PaintType == PaintingType.Still_Large2));
                }
                break;

            case 6://Abstract Painting 1
                if (HadNeededItems(m_from, PaintingType.Portrait_Male))
                {
                    m_from.SendMessage("Target the object you wish to paint.");
                    m_from.Target = new AbstractTarget(PaintConsumers.FirstOrDefault(x => x.PaintType == PaintingType.Abstract_One));
                }
                break;

            case 7://Abstract Painting 2
                if (HadNeededItems(m_from, PaintingType.Portrait_Male))
                {
                    m_from.SendMessage("Target the object you wish to paint.");
                    m_from.Target = new AbstractTarget(PaintConsumers.FirstOrDefault(x => x.PaintType == PaintingType.Abstract_Two));
                }
                break;

            case 8://Abstract Painting 3
                if (HadNeededItems(m_from, PaintingType.Portrait_Male))
                {
                    m_from.SendMessage("Target the object you wish to paint.");
                    m_from.Target = new AbstractTarget(PaintConsumers.FirstOrDefault(x => x.PaintType == PaintingType.Abstract_Three));
                }
                break;
            }
        }
示例#34
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile         from    = state.Mobile;
            PlayerMobile   pm      = from as PlayerMobile;
            ImbuingContext context = Imbuing.GetContext(from);

            m_Item = context.LastImbued;

            int buttonNum  = 0;
            int buttonRNum = 0;

            if ((info.ButtonID > 0 && info.ButtonID < 10000) || info.ButtonID == 10099)
            {
                buttonNum = 0;
            }
            else if (info.ButtonID > 20004)
            {
                buttonNum = 30000;
            }
            else if ((info.ButtonID > 10100) && (info.ButtonID < 10300))
            {
                buttonNum  = 10101;
                buttonRNum = info.ButtonID - 10100;
            }
            else
            {
                buttonNum = info.ButtonID;
            }

            switch (buttonNum)
            {
            case 0:
            {
                // = Close/Cancel
                break;
            }

            case 10001:
            {
                context.ImbMenu_Cat = 1;

                from.SendGump(new ImbuingGumpB(from, context.LastImbued));
                break;
            }

            case 10002:
            {
                context.ImbMenu_Cat = 2;

                from.SendGump(new ImbuingGumpB(from, context.LastImbued));
                break;
            }

            case 10003:
            {
                context.ImbMenu_Cat = 3;

                from.SendGump(new ImbuingGumpB(from, context.LastImbued));
                break;
            }

            case 10004:
            {
                context.ImbMenu_Cat = 4;

                from.SendGump(new ImbuingGumpB(from, context.LastImbued));
                break;
            }

            case 10005:
            {
                context.ImbMenu_Cat = 5;

                from.SendGump(new ImbuingGumpB(from, context.LastImbued));
                break;
            }

            case 10006:
            {
                context.ImbMenu_Cat = 6;

                from.SendGump(new ImbuingGumpB(from, context.LastImbued));
                break;
            }

            case 10007:
            {
                context.ImbMenu_Cat = 7;

                from.SendGump(new ImbuingGumpB(from, context.LastImbued));
                break;
            }

            case 10008:
            {
                context.ImbMenu_Cat = 8;

                from.SendGump(new ImbuingGumpB(from, context.LastImbued));
                break;
            }

            case 10009:
            {
                context.ImbMenu_Cat = 9;

                from.SendGump(new ImbuingGumpB(from, context.LastImbued));
                break;
            }

            case 10010:
            {
                context.ImbMenu_Cat = 10;

                from.SendGump(new ImbuingGumpB(from, context.LastImbued));
                break;
            }

            case 10011:
            {
                context.ImbMenu_Cat = 11;

                from.SendGump(new ImbuingGumpB(from, context.LastImbued));
                break;
            }

            case 10012:
            {
                context.ImbMenu_Cat = 12;

                from.SendGump(new ImbuingGumpB(from, context.LastImbued));
                break;
            }

            case 10013:
            {
                context.ImbMenu_Cat = 13;

                from.SendGump(new ImbuingGumpB(from, context.LastImbued));
                break;
            }

            case 10014:
            {
                context.ImbMenu_Cat = 14;

                from.SendGump(new ImbuingGumpB(from, context.LastImbued));
                break;
            }

            case 10099:                      // = Cancel
            {
                break;
            }

            case 10101:      // = Proceed to Attribute Intensity Menu [ImbuingC.cs]
            {
                context.Imbue_Mod = buttonRNum;

                from.SendGump(new ImbuingGumpC(from, context.LastImbued, buttonRNum, -1));
                break;
            }
            }
            return;
        }
示例#35
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from    = state.Mobile;
            int    cheveux = from.HairItemID;

            switch (info.ButtonID)
            {
            case 1:
            {
                if (cheveux == 0x203d)
                {
                    from.SendMessage("Vos cheveux sont déja attachés");
                    break;
                }

                else
                {
                    from.SendMessage("Vous attachez vos cheveux ");
                    from.PlaySound(0x57);
                    from.HairItemID = 0x203D;

                    break;
                }
            }

            case 2:
            {
                if (cheveux == 0x203c)
                {
                    from.SendMessage("Vos cheveux sont déja détachés");
                    break;
                }

                else
                {
                    from.SendMessage("Vous détachez vos cheveux ");
                    from.PlaySound(0x57);
                    from.HairItemID = 0x203c;

                    break;
                }
            }

            case 3:
            {
                if (cheveux == 0x2049)
                {
                    from.SendMessage("Vos cheveux sont déja tressés");
                    break;
                }

                else
                {
                    from.SendMessage("Vous tressez vos cheveux ");
                    from.PlaySound(0x57);
                    from.HairItemID = 0x2049;

                    break;
                }
            }
            }
        }
示例#36
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from     = state.Mobile;
            int    newstart = 1;
            int    buttonID = info.ButtonID;
            int    itemID   = m_itemID;

            if (info == null || state == null || from == null)
            {
                return;
            }

            switch (info.ButtonID)
            {
            case 10050:
            {
                from.CloseGump(typeof(ViewHuesGump));
                from.SendGump(new ViewHueGump(from, 0));
                break;
            }

            case 10004:
            {
                from.CloseGump(typeof(ViewHuesGump));
                TextRelay entry = info.GetTextEntry(10);

                try { itemID = Convert.ToInt32(entry.Text); }
                catch { }
                if (itemID < 1)
                {
                    itemID = 4011;
                }
                else if (itemID > -0)
                {
                    m_itemID = itemID;
                }

                from.SendGump(new ViewHuesGump(from, newstart, m_itemID));
                break;
            }

            case 10003:
            {
                from.CloseGump(typeof(ViewHuesGump));
                break;
            }

            case 10002:
            {
                if ((m_newstart + 30) > Total_HUES)
                {
                    from.CloseGump(typeof(ViewHuesGump));
                    from.SendGump(new ViewHuesGump(from, 2971, m_itemID));
                }
                else
                {
                    from.CloseGump(typeof(ViewHuesGump));
                    from.SendGump(new ViewHuesGump(from, m_newstart + 30, m_itemID));
                }
                break;
            }

            case 10001:
            {
                if ((m_newstart - 30) < 1)
                {
                    from.CloseGump(typeof(ViewHuesGump));
                    from.SendGump(new ViewHuesGump(from, 1, m_itemID));
                }
                else
                {
                    from.CloseGump(typeof(ViewHuesGump));
                    from.SendGump(new ViewHuesGump(from, m_newstart - 30, m_itemID));
                }

                break;
            }

            case 10000:
            {
                from.CloseGump(typeof(ViewHuesGump));
                TextRelay entry = info.GetTextEntry(20);

                try { newstart = Convert.ToInt32(entry.Text); }
                catch { }
                if (newstart < 1)
                {
                    newstart = 1;
                }
                else if (newstart > 2971)
                {
                    newstart = 2971;
                }

                from.SendGump(new ViewHuesGump(from, newstart, m_itemID));
                break;
            }

            default:
            {
                if (buttonID <= 0)
                {
                    from.SendGump(new ViewHuesGump(from, m_newstart, m_itemID));
                }
                else
                {
                    if (info.IsSwitched(5000))
                    {
                        CommandSystem.Handle(from, String.Format("{0}{1} {2}", CommandSystem.Prefix, mSetHue, buttonID));
                        from.SendGump(new ViewHuesGump(from, m_newstart, m_itemID));
                        info.IsSwitched(5000);
                    }
                    else
                    {
                        CommandSystem.Handle(from, String.Format("{0}{1} {2}", CommandSystem.Prefix, SetHue, buttonID));
                        from.SendGump(new ViewHuesGump(from, m_newstart, m_itemID));
                    }
                }
                break;
            }
            }
        }
示例#37
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            switch (info.ButtonID)
            {
            case 0:                     // Closed
            {
                return;
            }

            case 1:                     // Previous
            {
                if (m_Page > 0)
                {
                    from.SendGump(new WhoGump(from, m_Mobiles, m_Page - 1));
                }

                break;
            }

            case 2:                     // Next
            {
                if ((m_Page + 1) * EntryCount < m_Mobiles.Count)
                {
                    from.SendGump(new WhoGump(from, m_Mobiles, m_Page + 1));
                }

                break;
            }

            default:
            {
                int index = (m_Page * EntryCount) + (info.ButtonID - 3);

                if (index >= 0 && index < m_Mobiles.Count)
                {
                    Mobile m = m_Mobiles[index];

                    if (m.Deleted)
                    {
                        from.SendMessage("That player has deleted their character.");
                        from.SendGump(new WhoGump(from, m_Mobiles, m_Page));
                    }
                    else if (m.NetState == null)
                    {
                        from.SendMessage("That player is no longer online.");
                        from.SendGump(new WhoGump(from, m_Mobiles, m_Page));
                    }
                    else if (m == from || !m.Hidden || from.AccessLevel >= m.AccessLevel || (m is PlayerMobile && ((PlayerMobile)m).VisibilityList.Contains(from)))
                    {
                        from.SendGump(new ClientGump(from, m.NetState));
                    }
                    else
                    {
                        from.SendMessage("You cannot see them.");
                        from.SendGump(new WhoGump(from, m_Mobiles, m_Page));
                    }
                }

                break;
            }
            }
        }
示例#38
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            if (!BaseCommand.IsAccessible(from, m_Object))
            {
                from.SendMessage("You may no longer access their properties.");
                return;
            }

            switch (info.ButtonID)
            {
            case 0:                     // Closed
            {
                if (m_Stack != null && m_Stack.Count > 0)
                {
                    object obj = m_Stack.Pop();

                    from.SendGump(new XmlPropertiesGump(from, obj, m_Stack, null));
                }

                break;
            }

            case 1:                     // Previous
            {
                if (m_Page > 0)
                {
                    from.SendGump(new XmlPropertiesGump(from, m_Object, m_Stack, m_List, m_Page - 1));
                }

                break;
            }

            case 2:                     // Next
            {
                if ((m_Page + 1) * EntryCount < m_List.Count)
                {
                    from.SendGump(new XmlPropertiesGump(from, m_Object, m_Stack, m_List, m_Page + 1));
                }

                break;
            }

            default:
            {
                int index = (m_Page * EntryCount) + (info.ButtonID - 3);

                if (index >= 0 && index < m_List.Count)
                {
                    PropertyInfo prop = m_List[index] as PropertyInfo;

                    if (prop == null)
                    {
                        return;
                    }

                    CPA attr = GetCPA(prop);

                    if (!prop.CanWrite || attr == null || from.AccessLevel < attr.WriteLevel)
                    {
                        return;
                    }

                    Type type = prop.PropertyType;

                    if (IsType(type, typeofMobile) || IsType(type, typeofItem))
                    {
                        from.SendGump(new XmlSetObjectGump(prop, from, m_Object, m_Stack, type, m_Page, m_List));
                    }
                    else if (IsType(type, typeofType))
                    {
                        from.Target = new XmlSetObjectTarget(prop, from, m_Object, m_Stack, type, m_Page, m_List);
                    }
                    else if (IsType(type, typeofPoint3D))
                    {
                        from.SendGump(new XmlSetPoint3DGump(prop, from, m_Object, m_Stack, m_Page, m_List));
                    }
                    else if (IsType(type, typeofPoint2D))
                    {
                        from.SendGump(new XmlSetPoint2DGump(prop, from, m_Object, m_Stack, m_Page, m_List));
                    }
                    else if (IsType(type, typeofTimeSpan))
                    {
                        from.SendGump(new XmlSetTimeSpanGump(prop, from, m_Object, m_Stack, m_Page, m_List));
                    }
                    else if (IsCustomEnum(type))
                    {
                        from.SendGump(new XmlSetCustomEnumGump(prop, from, m_Object, m_Stack, m_Page, m_List, GetCustomEnumNames(type)));
                    }
                    else if (IsType(type, typeofEnum))
                    {
                        from.SendGump(new XmlSetListOptionGump(prop, from, m_Object, m_Stack, m_Page, m_List, Enum.GetNames(type), GetObjects(Enum.GetValues(type))));
                    }
                    else if (IsType(type, typeofBool))
                    {
                        from.SendGump(new XmlSetListOptionGump(prop, from, m_Object, m_Stack, m_Page, m_List, m_BoolNames, m_BoolValues));
                    }
                    else if (IsType(type, typeofString) || IsType(type, typeofReal) || IsType(type, typeofNumeric))
                    {
                        from.SendGump(new XmlSetGump(prop, from, m_Object, m_Stack, m_Page, m_List));
                    }
                    else if (IsType(type, typeofPoison))
                    {
                        from.SendGump(new XmlSetListOptionGump(prop, from, m_Object, m_Stack, m_Page, m_List, m_PoisonNames, m_PoisonValues));
                    }
                    else if (IsType(type, typeofMap))
                    {
                        from.SendGump(new XmlSetListOptionGump(prop, from, m_Object, m_Stack, m_Page, m_List, Map.GetMapNames(), Map.GetMapValues()));
                    }
                    else if (IsType(type, typeofSkills) && m_Object is Mobile)
                    {
                        from.SendGump(new XmlPropertiesGump(from, m_Object, m_Stack, m_List, m_Page));
                        from.SendGump(new SkillsGump(from, (Mobile)m_Object));
                    }
                    else if (HasAttribute(type, typeofPropertyObject, true))
                    {
                        from.SendGump(new XmlPropertiesGump(from, prop.GetValue(m_Object, null), m_Stack, m_Object));
                    }
                }

                break;
            }
            }
        }
示例#39
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            switch (info.ButtonID)
            {
            case 1:
            {
                v_Counts = from.Kills;

                if (v_BankedGoldAmount >= 10000 && v_Counts >= 1 && v_LCounts < from.Kills)
                {
                    from.SendMessage("You have increased your bribe by 10,000gp!");

                    v_Bribe   = v_Bribe + 10000;
                    v_LCounts = v_LCounts + 1;

                    v_TotalCost = v_Bribe;
                    v_TotalLost = v_LCounts;

                    if (v_LCounts > 1)
                    {
                        v_s = "s";
                    }
                    else if (v_LCounts == 0)
                    {
                        v_s = "s";
                    }
                    else
                    {
                        v_s = "";
                    }

                    from.SendMessage("If you accept the bribe, you will lose " + v_LCounts + " count" + v_s + " (long term) and " + v_Bribe + " gp!");
                    from.SendGump(new GuardBribe(from, from.Kills, v_TotalCost, v_TotalLost));
                }
                else if (v_Counts == 0)
                {
                    from.SendMessage("Why would you bribe the guards? You have 0 counts!");
                }
                else if (v_BankedGoldAmount < 10000)
                {
                    from.SendMessage("You do not have enough gold in your bank to increase your bribe!");
                    from.SendGump(new GuardBribe(from, from.Kills, v_TotalCost, v_TotalLost));
                }
                else if (v_LCounts >= from.Kills)
                {
                    v_LCounts = from.Kills;

                    from.SendMessage("You cannot bribe off more counts than you have!");
                    from.SendGump(new GuardBribe(from, from.Kills, 0, 0));
                }
                else
                {
                    from.SendMessage("ERROR Insufficient gold?");
                }
            }
            break;

            case 0:
            {
                if (v_Bribe >= 10000)
                {
                    from.SendMessage("You have decreased your bribe by 10,000gp!");

                    v_Bribe   = v_Bribe - 10000;
                    v_LCounts = v_LCounts - 1;

                    v_TotalCost = v_Bribe;
                    v_TotalLost = v_LCounts;

                    if (v_LCounts > 1)
                    {
                        v_s = "s";
                    }
                    else if (v_LCounts == 0)
                    {
                        v_s = "s";
                    }
                    else
                    {
                        v_s = "";
                    }

                    from.SendMessage("If you accept the bribe, you will lose " + v_LCounts + " count" + v_s + " and " + v_Bribe + " gp!");
                    from.SendGump(new GuardBribe(from, from.Kills, v_TotalCost, v_TotalLost));
                }
                else
                {
                    from.SendMessage("You cannot decrease your bribe any further!");
                    from.SendGump(new GuardBribe(from, from.Kills, v_TotalCost, v_TotalLost));

                    v_Bribe   = 0;
                    v_LCounts = 0;
                }
            }
            break;

            case 2:
            {
                if (v_LCounts > 0)
                {
                    if (v_LCounts > 1)
                    {
                        v_s = "s";
                    }
                    else if (v_LCounts == 0)
                    {
                        v_s = "s";
                    }
                    else
                    {
                        v_s = "";
                    }

                    // Banker.Withdraw ( from, v_Bribe ); //Why doesn't this work?

                    BankBox box = from.BankBox;

                    if (box == null || !box.ConsumeTotal(typeof(Gold), v_Bribe))
                    {
                        from.SendMessage("ERROR Insufficient gold?");
                    }
                    else
                    {
                        from.Kills = v_Counts - v_LCounts;
                        from.SendMessage("You have bribed the guards and lost " + v_LCounts + " kill" + v_s + " (long term) and " + v_Bribe + " gp!");
                    }
                }
                else
                {
                    from.SendMessage("You have not offered a bribe!");
                }
            }
            break;

            case 3:
            {
                from.SendMessage("You decide not to offer a bribe!");
            }
            break;
            }
        }
示例#40
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = this.m_Owner;

            switch (info.ButtonID)
            {
            case 0:     // Closed
            {
                return;
            }

            case 1:     // Up
            {
                if (this.m_Category.Parent != null)
                {
                    int index = Array.IndexOf(this.m_Category.Parent.Nodes, this.m_Category) / EntryCount;

                    if (index < 0)
                    {
                        index = 0;
                    }

                    from.SendGump(new CategorizedAddGump(from, this.m_Category.Parent, index));
                }

                break;
            }

            case 2:     // Previous
            {
                if (this.m_Page > 0)
                {
                    from.SendGump(new CategorizedAddGump(from, this.m_Category, this.m_Page - 1));
                }

                break;
            }

            case 3:     // Next
            {
                if ((this.m_Page + 1) * EntryCount < this.m_Category.Nodes.Length)
                {
                    from.SendGump(new CategorizedAddGump(from, this.m_Category, this.m_Page + 1));
                }

                break;
            }

            default:
            {
                int index = (this.m_Page * EntryCount) + (info.ButtonID - 4);

                if (index >= 0 && index < this.m_Category.Nodes.Length)
                {
                    this.m_Category.Nodes[index].OnClick(from, this.m_Page);
                }

                break;
            }
            }
        }
示例#41
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            var from = state.Mobile;

            switch (info.ButtonID)
            {
            case 1:
            {
                if (m_Node.Parent != null)
                {
                    from.SendGump(new GoGump(0, from, m_Tree, m_Node.Parent));
                }

                break;
            }

            case 2:
            {
                if (m_Page > 0)
                {
                    from.SendGump(new GoGump(m_Page - 1, from, m_Tree, m_Node));
                }

                break;
            }

            case 3:
            {
                if ((m_Page + 1) * EntryCount < m_Node.Categories.Length + m_Node.Locations.Length)
                {
                    from.SendGump(new GoGump(m_Page + 1, from, m_Tree, m_Node));
                }

                break;
            }

            default:
            {
                var index = info.ButtonID - 4;

                if (index < 0)
                {
                    break;
                }

                if (index < m_Node.Categories.Length)
                {
                    from.SendGump(new GoGump(0, from, m_Tree, m_Node.Categories[index]));
                }
                else
                {
                    index -= m_Node.Categories.Length;
                    if (index < m_Node.Locations.Length)
                    {
                        from.MoveToWorld(m_Node.Locations[index].Location, m_Tree.Map);
                    }
                }

                break;
            }
            }
        }
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            object toSet;
            bool   shouldSet, shouldSend = true;
            object viewProps = null;

            switch (info.ButtonID)
            {
            case 0:                     // closed
            {
                m_Mobile.SendGump(new PropertiesGump(m_Mobile, m_Object, m_Stack, m_List, m_Page));

                toSet      = null;
                shouldSet  = false;
                shouldSend = false;

                break;
            }

            case 1:                     // Change by Target
            {
                m_Mobile.Target = new SetObjectTarget(m_Property, m_Mobile, m_Object, m_Stack, m_Type, m_Page, m_List);
                toSet           = null;
                shouldSet       = false;
                shouldSend      = false;
                break;
            }

            case 2:                     // Change by Serial
            {
                toSet      = null;
                shouldSet  = false;
                shouldSend = false;

                m_Mobile.SendMessage("Enter the serial you wish to find:");
                m_Mobile.Prompt = new InternalPrompt(m_Property, m_Mobile, m_Object, m_Stack, m_Type, m_Page, m_List);

                break;
            }

            case 3:                     // Nullify
            {
                toSet     = null;
                shouldSet = true;

                break;
            }

            case 4:                     // View Properties
            {
                toSet     = null;
                shouldSet = false;

                object obj = m_Property.GetValue(m_Object, null);

                if (obj == null)
                {
                    m_Mobile.SendMessage("The property is null and so you cannot view its properties.");
                }
                else if (!BaseCommand.IsAccessible(m_Mobile, obj))
                {
                    m_Mobile.SendMessage("You may not view their properties.");
                }
                else
                {
                    viewProps = obj;
                }

                break;
            }

            default:
            {
                toSet     = null;
                shouldSet = false;

                break;
            }
            }

            if (shouldSet)
            {
                try
                {
                    CommandLogging.LogChangeProperty(m_Mobile, m_Object, m_Property.Name, toSet == null?"(null)":toSet.ToString());
                    m_Property.SetValue(m_Object, toSet, null);
                    PropertiesGump.OnValueChanged(m_Object, m_Property, m_Stack);
                }
                catch
                {
                    m_Mobile.SendMessage("An exception was caught. The property may not have changed.");
                }
            }

            if (shouldSend)
            {
                m_Mobile.SendGump(new SetObjectGump(m_Property, m_Mobile, m_Object, m_Stack, m_Type, m_Page, m_List));
            }

            if (viewProps != null)
            {
                m_Mobile.SendGump(new PropertiesGump(m_Mobile, viewProps));
            }
        }
示例#43
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            var toSet     = Color.Empty;
            var shouldSet = false;

            var name = "";

            if (info.ButtonID == 1)
            {
                name = info.GetTextEntry(0).Text;
            }

            var rgb = "";

            if (info.ButtonID == 2)
            {
                rgb = info.GetTextEntry(1).Text;
            }

            var hex = "";

            if (info.ButtonID == 3)
            {
                hex = info.GetTextEntry(2).Text;
            }

            switch (info.ButtonID)
            {
            case 1:     // Name
            {
                var toapply = name != string.Empty
                            ? name
                            : m_OldColor.IsNamedColor
                                ? m_OldColor.Name
                                : m_OldColor.IsEmpty
                                    ? "Empty"
                                    : "";

                toSet = Color.FromName(toapply);

                shouldSet = true;
            }
            break;

            case 2:     // RGB
            {
                var toapply = rgb != string.Empty ? rgb : string.Format("{0},{1},{2}", m_OldColor.R, m_OldColor.G, m_OldColor.B);

                var args = toapply.Split(',');

                if (args.Length >= 3)
                {
                    byte r, g, b;

                    if (byte.TryParse(args[0], out r) && byte.TryParse(args[1], out g) && byte.TryParse(args[2], out b))
                    {
                        toSet     = Color.FromArgb(r, g, b);
                        shouldSet = true;
                    }
                }
            }
            break;

            case 3:     // Hex
            {
                var toapply = hex != string.Empty ? hex : string.Format("#{0:X6}", m_OldColor.ToArgb() & 0x00FFFFFF);

                int val;

                if (int.TryParse(toapply.TrimStart('#'), NumberStyles.HexNumber, CultureInfo.CurrentCulture, out val))
                {
                    toSet     = Color.FromArgb(val);
                    shouldSet = true;
                }
            }
            break;

            case 4:     // Empty
            {
                toSet     = Color.Empty;
                shouldSet = true;
            }
            break;
            }

            if (shouldSet)
            {
                try
                {
                    CommandLogging.LogChangeProperty(m_Mobile, m_Object, m_Property.Name, toSet.ToString());
                    m_Property.SetValue(m_Object, toSet, null);
                    PropertiesGump.OnValueChanged(m_Object, m_Property, m_Stack);
                }
                catch
                {
                    m_Mobile.SendMessage("An exception was caught. The property may not have changed.");
                }
            }

            m_Mobile.SendGump(new PropertiesGump(m_Mobile, m_Object, m_Stack, m_List, m_Page));
        }
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            int button = info.ButtonID;

            TextRelay[] textentries = info.TextEntries;

            switch (button)
            {
            // Delete
            case 2002:
                for (int i = 0; i < m_Vendor.ItemsForSale.Count; i++)
                {
                    if (((TradeVendor.ItemInfo)m_Vendor.ItemsForSale[i]).ItemSerial == m_Item.Serial)
                    {
                        m_Vendor.ItemsForSale.RemoveAt(i);
                        break;
                    }
                }

                m_Player.Backpack.AddItem(m_Item);

                m_Player.SendMessage("The item has been removed from inventory.");

                break;

            // Cancel
            case -1:

                break;

            // Okay
            case 2001:
                if (!m_BuyMode)
                {
                    #region Owner Setting Price
                    TradeVendor.ItemInfo iteminfo = new TradeVendor.ItemInfo();

                    iteminfo.ItemSerial = m_Item.Serial;

                    #region Gold & Silver
                    iteminfo.GoldCost   = GetTextEntry(textentries, 1030);
                    iteminfo.SilverCost = GetTextEntry(textentries, 1031);
                    #endregion

                    #region Ingots & Ores
                    iteminfo.IronIngotCost       = GetTextEntry(textentries, 1000);
                    iteminfo.DullCopperIngotCost = GetTextEntry(textentries, 1001);
                    iteminfo.ShadowIronIngotCost = GetTextEntry(textentries, 1002);
                    iteminfo.CopperIngotCost     = GetTextEntry(textentries, 1003);
                    iteminfo.BronzeIngotCost     = GetTextEntry(textentries, 1004);
                    iteminfo.GoldIngotCost       = GetTextEntry(textentries, 1005);
                    iteminfo.AgapiteIngotCost    = GetTextEntry(textentries, 1006);
                    iteminfo.VeriteIngotCost     = GetTextEntry(textentries, 1007);
                    iteminfo.ValoriteIngotCost   = GetTextEntry(textentries, 1008);
                    iteminfo.MithrilIngotCost    = GetTextEntry(textentries, 1009);
                    iteminfo.BloodrockIngotCost  = GetTextEntry(textentries, 1010);
                    iteminfo.SteelIngotCost      = GetTextEntry(textentries, 1011);
                    iteminfo.AdamantiteIngotCost = GetTextEntry(textentries, 1012);
                    iteminfo.IthilmarIngotCost   = GetTextEntry(textentries, 1013);

                    iteminfo.IronOreCost       = GetTextEntry(textentries, 1038);
                    iteminfo.DullCopperOreCost = GetTextEntry(textentries, 1039);
                    iteminfo.ShadowIronOreCost = GetTextEntry(textentries, 1040);
                    iteminfo.CopperOreCost     = GetTextEntry(textentries, 1041);
                    iteminfo.BronzeOreCost     = GetTextEntry(textentries, 1042);
                    iteminfo.GoldOreCost       = GetTextEntry(textentries, 1043);
                    iteminfo.AgapiteOreCost    = GetTextEntry(textentries, 1044);
                    iteminfo.VeriteOreCost     = GetTextEntry(textentries, 1045);
                    iteminfo.ValoriteOreCost   = GetTextEntry(textentries, 1032);
                    iteminfo.MithrilOreCost    = GetTextEntry(textentries, 1033);
                    iteminfo.BloodrockOreCost  = GetTextEntry(textentries, 1034);
                    iteminfo.SteelOreCost      = GetTextEntry(textentries, 1035);
                    iteminfo.AdamantiteOreCost = GetTextEntry(textentries, 1036);
                    iteminfo.IthilmarOreCost   = GetTextEntry(textentries, 1037);
                    #endregion

                    #region Hides & Scales
                    iteminfo.NormalHidesCost = GetTextEntry(textentries, 1046);
                    iteminfo.SpinedHidesCost = GetTextEntry(textentries, 1047);
                    iteminfo.HornedHidesCost = GetTextEntry(textentries, 1048);
                    iteminfo.BarbedHidesCost = GetTextEntry(textentries, 1049);

                    iteminfo.RedScalesCost    = GetTextEntry(textentries, 1050);
                    iteminfo.YellowScalesCost = GetTextEntry(textentries, 1051);
                    iteminfo.BlackScalesCost  = GetTextEntry(textentries, 1052);
                    iteminfo.GreenScalesCost  = GetTextEntry(textentries, 1053);
                    iteminfo.WhiteScalesCost  = GetTextEntry(textentries, 1054);
                    iteminfo.BlueScalesCost   = GetTextEntry(textentries, 1055);
                    #endregion

                    #region Logs & Boards
                    iteminfo.OakLogCost         = GetTextEntry(textentries, 1014);
                    iteminfo.PineLogCost        = GetTextEntry(textentries, 1015);
                    iteminfo.RedwoodLogCost     = GetTextEntry(textentries, 1016);
                    iteminfo.WhitePineLogCost   = GetTextEntry(textentries, 1017);
                    iteminfo.AshwoodLogCost     = GetTextEntry(textentries, 1018);
                    iteminfo.SilverBirchLogCost = GetTextEntry(textentries, 1019);
                    iteminfo.YewLogCost         = GetTextEntry(textentries, 1020);
                    iteminfo.BlackOakLogCost    = GetTextEntry(textentries, 1021);

                    iteminfo.OakBoardCost         = GetTextEntry(textentries, 1022);
                    iteminfo.PineBoardCost        = GetTextEntry(textentries, 1023);
                    iteminfo.RedwoodBoardCost     = GetTextEntry(textentries, 1024);
                    iteminfo.WhitePineBoardCost   = GetTextEntry(textentries, 1025);
                    iteminfo.AshwoodBoardCost     = GetTextEntry(textentries, 1026);
                    iteminfo.SilverBirchBoardCost = GetTextEntry(textentries, 1027);
                    iteminfo.YewBoardCost         = GetTextEntry(textentries, 1028);
                    iteminfo.BlackOakBoardCost    = GetTextEntry(textentries, 1029);
                    #endregion

                    #region Jewels
                    // Not Yet
                    #endregion

                    TradeVendor.ItemInfo m_Info = TradeVendor.ItemInfo.GetItemInfo(m_Item, m_Vendor.ItemsForSale);

                    if (m_Info != null)
                    {
                        m_Vendor.ItemsForSale.Remove(m_Info);
                    }

                    m_Vendor.ItemsForSale.Add(iteminfo);
                    m_Vendor.Backpack.AddItem(m_Item);
                    #endregion
                }
                else
                {
                    #region Player Buying Item
                    TradeVendor.ItemInfo m_Info        = TradeVendor.ItemInfo.GetItemInfo(m_Item, m_Vendor.ItemsForSale);
                    ArrayList            m_ConsumeType = new ArrayList();
                    ArrayList            m_ConsumeAmt  = new ArrayList();

                    if (m_Info != null)
                    {
                        if (m_Info.AdamantiteIngotCost > 0)
                        {
                            m_ConsumeType.Add(typeof(AdamantiteIngot)); m_ConsumeAmt.Add(m_Info.AdamantiteIngotCost);
                        }
                        if (m_Info.AdamantiteOreCost > 0)
                        {
                            m_ConsumeType.Add(typeof(AdamantiteOre)); m_ConsumeAmt.Add(m_Info.AdamantiteOreCost);
                        }
                        if (m_Info.AgapiteIngotCost > 0)
                        {
                            m_ConsumeType.Add(typeof(AgapiteIngot)); m_ConsumeAmt.Add(m_Info.AgapiteIngotCost);
                        }
                        if (m_Info.AgapiteOreCost > 0)
                        {
                            m_ConsumeType.Add(typeof(AgapiteOre)); m_ConsumeAmt.Add(m_Info.AgapiteOreCost);
                        }
                        if (m_Info.AshwoodBoardCost > 0)
                        {
                            m_ConsumeType.Add(typeof(AshwoodBoard)); m_ConsumeAmt.Add(m_Info.AshwoodBoardCost);
                        }
                        if (m_Info.AshwoodLogCost > 0)
                        {
                            m_ConsumeType.Add(typeof(AshwoodLog)); m_ConsumeAmt.Add(m_Info.AshwoodLogCost);
                        }
                        if (m_Info.BarbedHidesCost > 0)
                        {
                            m_ConsumeType.Add(typeof(BarbedHides)); m_ConsumeAmt.Add(m_Info.BarbedHidesCost);
                        }
                        if (m_Info.BlackOakBoardCost > 0)
                        {
                            m_ConsumeType.Add(typeof(BlackOakBoard)); m_ConsumeAmt.Add(m_Info.BlackOakBoardCost);
                        }
                        if (m_Info.BlackOakLogCost > 0)
                        {
                            m_ConsumeType.Add(typeof(BlackOakLog)); m_ConsumeAmt.Add(m_Info.BlackOakLogCost);
                        }
                        if (m_Info.BlackScalesCost > 0)
                        {
                            m_ConsumeType.Add(typeof(BlackScales)); m_ConsumeAmt.Add(m_Info.BlackScalesCost);
                        }
                        if (m_Info.BloodrockIngotCost > 0)
                        {
                            m_ConsumeType.Add(typeof(BloodrockIngot)); m_ConsumeAmt.Add(m_Info.BloodrockIngotCost);
                        }
                        if (m_Info.BloodrockOreCost > 0)
                        {
                            m_ConsumeType.Add(typeof(BloodrockOre)); m_ConsumeAmt.Add(m_Info.BloodrockOreCost);
                        }
                        if (m_Info.BlueScalesCost > 0)
                        {
                            m_ConsumeType.Add(typeof(BlueScales)); m_ConsumeAmt.Add(m_Info.BlueScalesCost);
                        }
                        if (m_Info.BronzeIngotCost > 0)
                        {
                            m_ConsumeType.Add(typeof(BronzeIngot)); m_ConsumeAmt.Add(m_Info.BronzeIngotCost);
                        }
                        if (m_Info.BronzeOreCost > 0)
                        {
                            m_ConsumeType.Add(typeof(BronzeOre)); m_ConsumeAmt.Add(m_Info.BronzeOreCost);
                        }
                        if (m_Info.CopperIngotCost > 0)
                        {
                            m_ConsumeType.Add(typeof(CopperIngot)); m_ConsumeAmt.Add(m_Info.CopperIngotCost);
                        }
                        if (m_Info.CopperOreCost > 0)
                        {
                            m_ConsumeType.Add(typeof(CopperOre)); m_ConsumeAmt.Add(m_Info.CopperOreCost);
                        }
                        if (m_Info.DullCopperIngotCost > 0)
                        {
                            m_ConsumeType.Add(typeof(DullCopperIngot)); m_ConsumeAmt.Add(m_Info.DullCopperIngotCost);
                        }
                        if (m_Info.DullCopperOreCost > 0)
                        {
                            m_ConsumeType.Add(typeof(DullCopperOre)); m_ConsumeAmt.Add(m_Info.DullCopperOreCost);
                        }
                        if (m_Info.GoldCost > 0)
                        {
                            m_ConsumeType.Add(typeof(Gold)); m_ConsumeAmt.Add(m_Info.GoldCost);
                        }
                        if (m_Info.GoldIngotCost > 0)
                        {
                            m_ConsumeType.Add(typeof(GoldIngot)); m_ConsumeAmt.Add(m_Info.GoldIngotCost);
                        }
                        if (m_Info.GoldOreCost > 0)
                        {
                            m_ConsumeType.Add(typeof(GoldOre)); m_ConsumeAmt.Add(m_Info.GoldOreCost);
                        }
                        if (m_Info.GreenScalesCost > 0)
                        {
                            m_ConsumeType.Add(typeof(GreenScales)); m_ConsumeAmt.Add(m_Info.GreenScalesCost);
                        }
                        if (m_Info.HornedHidesCost > 0)
                        {
                            m_ConsumeType.Add(typeof(HornedHides)); m_ConsumeAmt.Add(m_Info.HornedHidesCost);
                        }
                        if (m_Info.IronIngotCost > 0)
                        {
                            m_ConsumeType.Add(typeof(IronIngot)); m_ConsumeAmt.Add(m_Info.IronIngotCost);
                        }
                        if (m_Info.IronOreCost > 0)
                        {
                            m_ConsumeType.Add(typeof(IronOre)); m_ConsumeAmt.Add(m_Info.IronOreCost);
                        }
                        if (m_Info.IthilmarIngotCost > 0)
                        {
                            m_ConsumeType.Add(typeof(IthilmarIngot)); m_ConsumeAmt.Add(m_Info.IthilmarIngotCost);
                        }
                        if (m_Info.IthilmarOreCost > 0)
                        {
                            m_ConsumeType.Add(typeof(IthilmarOre)); m_ConsumeAmt.Add(m_Info.IthilmarOreCost);
                        }
                        if (m_Info.MithrilIngotCost > 0)
                        {
                            m_ConsumeType.Add(typeof(MithrilIngot)); m_ConsumeAmt.Add(m_Info.MithrilIngotCost);
                        }
                        if (m_Info.MithrilOreCost > 0)
                        {
                            m_ConsumeType.Add(typeof(MithrilOre)); m_ConsumeAmt.Add(m_Info.MithrilOreCost);
                        }
                        if (m_Info.NormalHidesCost > 0)
                        {
                            m_ConsumeType.Add(typeof(Hides)); m_ConsumeAmt.Add(m_Info.NormalHidesCost);
                        }
                        if (m_Info.OakBoardCost > 0)
                        {
                            m_ConsumeType.Add(typeof(Board)); m_ConsumeAmt.Add(m_Info.OakBoardCost);
                        }
                        if (m_Info.OakLogCost > 0)
                        {
                            m_ConsumeType.Add(typeof(Log)); m_ConsumeAmt.Add(m_Info.OakLogCost);
                        }
                        if (m_Info.PineBoardCost > 0)
                        {
                            m_ConsumeType.Add(typeof(PineBoard)); m_ConsumeAmt.Add(m_Info.PineBoardCost);
                        }
                        if (m_Info.PineLogCost > 0)
                        {
                            m_ConsumeType.Add(typeof(PineLog)); m_ConsumeAmt.Add(m_Info.PineLogCost);
                        }
                        if (m_Info.RedScalesCost > 0)
                        {
                            m_ConsumeType.Add(typeof(RedScales)); m_ConsumeAmt.Add(m_Info.RedScalesCost);
                        }
                        if (m_Info.RedwoodBoardCost > 0)
                        {
                            m_ConsumeType.Add(typeof(RedwoodBoard)); m_ConsumeAmt.Add(m_Info.RedwoodBoardCost);
                        }
                        if (m_Info.RedwoodLogCost > 0)
                        {
                            m_ConsumeType.Add(typeof(RedwoodLog)); m_ConsumeAmt.Add(m_Info.RedwoodLogCost);
                        }
                        if (m_Info.ShadowIronIngotCost > 0)
                        {
                            m_ConsumeType.Add(typeof(ShadowIronIngot)); m_ConsumeAmt.Add(m_Info.ShadowIronIngotCost);
                        }
                        if (m_Info.ShadowIronOreCost > 0)
                        {
                            m_ConsumeType.Add(typeof(ShadowIronOre)); m_ConsumeAmt.Add(m_Info.ShadowIronOreCost);
                        }
                        if (m_Info.SilverBirchBoardCost > 0)
                        {
                            m_ConsumeType.Add(typeof(SilverBirchBoard)); m_ConsumeAmt.Add(m_Info.SilverBirchBoardCost);
                        }
                        if (m_Info.SilverBirchLogCost > 0)
                        {
                            m_ConsumeType.Add(typeof(SilverBirchLog)); m_ConsumeAmt.Add(m_Info.SilverBirchLogCost);
                        }
                        if (m_Info.SilverCost > 0)
                        {
                            m_ConsumeType.Add(typeof(Silver)); m_ConsumeAmt.Add(m_Info.SilverCost);
                        }
                        if (m_Info.SpinedHidesCost > 0)
                        {
                            m_ConsumeType.Add(typeof(SpinedHides)); m_ConsumeAmt.Add(m_Info.SpinedHidesCost);
                        }
                        if (m_Info.SteelIngotCost > 0)
                        {
                            m_ConsumeType.Add(typeof(SteelIngot)); m_ConsumeAmt.Add(m_Info.SteelIngotCost);
                        }
                        if (m_Info.SteelOreCost > 0)
                        {
                            m_ConsumeType.Add(typeof(SteelOre)); m_ConsumeAmt.Add(m_Info.SteelOreCost);
                        }
                        if (m_Info.ValoriteIngotCost > 0)
                        {
                            m_ConsumeType.Add(typeof(ValoriteIngot)); m_ConsumeAmt.Add(m_Info.ValoriteIngotCost);
                        }
                        if (m_Info.ValoriteOreCost > 0)
                        {
                            m_ConsumeType.Add(typeof(ValoriteOre)); m_ConsumeAmt.Add(m_Info.ValoriteOreCost);
                        }
                        if (m_Info.VeriteIngotCost > 0)
                        {
                            m_ConsumeType.Add(typeof(VeriteIngot)); m_ConsumeAmt.Add(m_Info.VeriteIngotCost);
                        }
                        if (m_Info.VeriteOreCost > 0)
                        {
                            m_ConsumeType.Add(typeof(VeriteOre)); m_ConsumeAmt.Add(m_Info.VeriteOreCost);
                        }
                        if (m_Info.WhitePineBoardCost > 0)
                        {
                            m_ConsumeType.Add(typeof(WhitePineBoard)); m_ConsumeAmt.Add(m_Info.WhitePineBoardCost);
                        }
                        if (m_Info.WhitePineLogCost > 0)
                        {
                            m_ConsumeType.Add(typeof(WhitePineLog)); m_ConsumeAmt.Add(m_Info.WhitePineLogCost);
                        }
                        if (m_Info.WhiteScalesCost > 0)
                        {
                            m_ConsumeType.Add(typeof(WhiteScales)); m_ConsumeAmt.Add(m_Info.WhiteScalesCost);
                        }
                        if (m_Info.YellowScalesCost > 0)
                        {
                            m_ConsumeType.Add(typeof(YellowScales)); m_ConsumeAmt.Add(m_Info.YellowScalesCost);
                        }
                        if (m_Info.YewBoardCost > 0)
                        {
                            m_ConsumeType.Add(typeof(YewBoard)); m_ConsumeAmt.Add(m_Info.YewBoardCost);
                        }
                        if (m_Info.YewLogCost > 0)
                        {
                            m_ConsumeType.Add(typeof(YewLog)); m_ConsumeAmt.Add(m_Info.YewLogCost);
                        }

                        Type[] types = ( Type[] )m_ConsumeType.ToArray(typeof(Type));
                        int[]  amts  = ( int[] )m_ConsumeAmt.ToArray(typeof(int));

                        if (m_Player.Backpack.ConsumeTotal(types, amts, true) == -1)
                        {
                            m_Player.Backpack.AddItem(m_Item);
                            m_Vendor.ItemsForSale.Remove(m_Info);

                            for (int i = 0; i < m_ConsumeType.Count; i++)
                            {
                                Item item = (Item)Activator.CreateInstance(( Type )m_ConsumeType[i]);
                                item.Amount = ( int )m_ConsumeAmt[i];

                                m_Vendor.BankBox.AddItem(item);
                            }

                            m_Vendor.Say("Here you go!");
                        }
                        else
                        {
                            m_Player.SendMessage("You don't have the required resources for this.");
                        }
                    }
                    #endregion
                }

                break;

            // Help
            case 2000:
                m_Player.SendMessage("I wonder what this is supposed to do?");

                break;
            }
        }
示例#45
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;
            string temp;

            switch (info.ButtonID)
            {
            case 50:
                //ban an account;
                from.SendGump(new JailBanGump(js));
                break;

            case 10:
                temp = info.GetTextEntry(11).Text.Trim().ToLower();
                if (!(temp == "") && !(temp == null))
                {
                    JailSystem.ooclistCommand = temp;
                }
                temp = info.GetTextEntry(12).Text.Trim();
                if (!(temp == "") && !(temp == null))
                {
                    JailSystem.oocJailorName = temp;
                }

                temp = info.GetTextEntry(13).Text.Trim().ToLower();
                if (!(temp == "") && !(temp == null))
                {
                    try
                    {
                        JailSystem.oocwarns = Convert.ToInt32(temp);
                    }
                    catch
                    {
                        from.SendMessage("Bad number of OOC Warnings.");
                    }
                }
                goto case 2;

            case 11:
                JailSystem.blockOOCSpeech = !JailSystem.blockOOCSpeech;
                goto case 10;

            case 12:
                JailSystem.AllowStaffOOC = !JailSystem.AllowStaffOOC;
                goto case 10;

            case 15:
                //language section
                temp = info.GetTextEntry(12).Text.Trim();
                if (!(temp == "") && !(temp == null))
                {
                    JailSystem.foulJailorName = temp;
                }
                JailSystem.FoulMouthJailTimes.Sort();
                goto case 3;

            case 13:
                JailSystem.useLanguageFilter = !JailSystem.useLanguageFilter;
                goto case 3;

            case 14:
                JailSystem.allowStaffBadWords = !JailSystem.allowStaffBadWords;
                goto case 15;

            case 9:
                JailSystem.useOOCFilter = !JailSystem.useOOCFilter;
                goto case 2;

            //generenal section
            case 1:
                from.SendGump(new JailAdminGump(AdminJailGumpPage.General));
                break;

            case 2:
                from.SendGump(new JailAdminGump(AdminJailGumpPage.OOC));
                break;

            case 3:
                from.SendGump(new JailAdminGump(AdminJailGumpPage.Language));
                break;

            case 4:
                from.SendGump(new JailAdminGump(AdminJailGumpPage.Review));
                break;

            case 5:
                from.CloseGump(typeof(JailAdminGump));
                break;

            case 6:
                temp = info.GetTextEntry(1).Text.Trim().ToLower();
                if (!(temp == "") && !(temp == null))
                {
                    JailSystem.statusCommand = temp;
                }

                temp = info.GetTextEntry(2).Text.Trim().ToLower();
                if (!(temp == "") && !(temp == null))
                {
                    JailSystem.timeCommand = temp;
                }

                temp = info.GetTextEntry(3).Text.Trim();
                if (!(temp == "") && !(temp == null))
                {
                    JailSystem.JSName = temp;
                }
                goto case 1;

            case 7:
                JailSystem.useSmokingFootGear = !JailSystem.useSmokingFootGear;
                goto case 6;

            case 8:
                JailSystem.SingleFacetOnly = !JailSystem.SingleFacetOnly;
                goto case 6;

            case 20:
                if (JailSystem.jailMap == Map.Felucca)
                {
                    JailSystem.jailMap = Map.Trammel;
                }
                else if (JailSystem.jailMap == Map.Trammel)
                {
                    JailSystem.jailMap = Map.Ilshenar;
                }
                else if (JailSystem.jailMap == Map.Ilshenar)
                {
                    JailSystem.jailMap = Map.Malas;
                }
                else if (JailSystem.jailMap == Map.Malas)
                {
                    JailSystem.jailMap = Map.Felucca;
                }
                goto case 6;

            case 21:
                if (JailSystem.defaultReleaseFacet == Map.Felucca)
                {
                    JailSystem.defaultReleaseFacet = Map.Trammel;
                }
                else if (JailSystem.defaultReleaseFacet == Map.Trammel)
                {
                    JailSystem.defaultReleaseFacet = Map.Ilshenar;
                }
                else if (JailSystem.defaultReleaseFacet == Map.Ilshenar)
                {
                    JailSystem.defaultReleaseFacet = Map.Malas;
                }
                else if (JailSystem.defaultReleaseFacet == Map.Malas)
                {
                    JailSystem.defaultReleaseFacet = Map.Felucca;
                }
                //change facet
                goto case 6;

            case 22:
                //add cell
                try
                {
                    Point3D p = new Point3D(Convert.ToInt32(info.GetTextEntry(5).Text.Trim()), Convert.ToInt32(info.GetTextEntry(6).Text.Trim()), Convert.ToInt32(info.GetTextEntry(7).Text.Trim()));
                    if (JailSystem.cells.Contains(p))
                    {
                        from.SendMessage("Unable to add jail cell. It is already listed.");
                    }
                    else
                    {
                        JailSystem.cells.Add(p);
                    }
                }
                catch
                {
                    from.SendMessage("Unable to add jail cell. Bad x,y,z.");
                }
                goto case 6;

            case 23:
                //remove cell
                try
                {
                    Point3D p = new Point3D(Convert.ToInt32(info.GetTextEntry(5).Text.Trim()), Convert.ToInt32(info.GetTextEntry(6).Text.Trim()), Convert.ToInt32(info.GetTextEntry(7).Text.Trim()));
                    if (JailSystem.cells.Contains(p))
                    {
                        JailSystem.cells.Remove(p);
                    }
                    else
                    {
                        from.SendMessage("Unable to remove jail cell. Cell not listed.");
                    }
                }
                catch
                {
                    from.SendMessage("Unable to remove jail cell. Bad x,y,z.");
                }
                goto case 6;

            case 24:
                //add release
                try
                {
                    Point3D p = new Point3D(Convert.ToInt32(info.GetTextEntry(8).Text.Trim()), Convert.ToInt32(info.GetTextEntry(9).Text.Trim()), Convert.ToInt32(info.GetTextEntry(10).Text.Trim()));
                    if (JailSystem.defaultRelease.Contains(p))
                    {
                        from.SendMessage("Unable to add default release location. It is already listed.");
                    }
                    else
                    {
                        JailSystem.defaultRelease.Add(p);
                    }
                }
                catch
                {
                    from.SendMessage("Unable to add release location. Bad x,y,z.");
                }
                goto case 6;

            case 25:
                //remove release
                try
                {
                    Point3D p = new Point3D(Convert.ToInt32(info.GetTextEntry(8).Text.Trim()), Convert.ToInt32(info.GetTextEntry(9).Text.Trim()), Convert.ToInt32(info.GetTextEntry(10).Text.Trim()));
                    if (JailSystem.defaultRelease.Contains(p))
                    {
                        JailSystem.defaultRelease.Remove(p);
                    }
                    else
                    {
                        from.SendMessage("Release location not listed.");
                    }
                }
                catch
                {
                    from.SendMessage("Unable to remove release location. Bad x,y,z.");
                }
                goto case 6;

            case 26:
                //add foul word
                try
                {
                    temp = info.GetTextEntry(13).Text.ToLower().Trim();
                    if ((temp == "") || (temp == null))
                    {
                        from.SendMessage("Unable to add word");
                    }
                    else if (JailSystem.badWords.Contains(temp))
                    {
                        from.SendMessage("Word is already in the list.");
                    }
                    else
                    {
                        JailSystem.badWords.Add(temp);
                    }
                }
                catch
                {
                    from.SendMessage("Unable to add word");
                }
                goto case 15;

            case 27:
                //remove foul word
                try
                {
                    temp = info.GetTextEntry(13).Text.ToLower().Trim();
                    if ((temp == "") || (temp == null))
                    {
                        from.SendMessage("Unable to remove word");
                    }
                    else if (JailSystem.badWords.Contains(temp))
                    {
                        JailSystem.badWords.Remove(temp);
                    }
                    else
                    {
                        from.SendMessage("Word is not in the list.");
                    }
                }
                catch
                {
                    from.SendMessage("Unable to remove word");
                }
                goto case 15;

            case 28:
                //add jail term
                try
                {
                    TimeSpan p = new TimeSpan(Convert.ToInt32(info.GetTextEntry(8).Text.Trim()), Convert.ToInt32(info.GetTextEntry(9).Text.Trim()), Convert.ToInt32(info.GetTextEntry(10).Text.Trim()), 0, 0);
                    if (JailSystem.FoulMouthJailTimes.Contains(p))
                    {
                        from.SendMessage("Unable to add jail term. It is already listed.");
                    }
                    else
                    {
                        JailSystem.FoulMouthJailTimes.Add(p);
                    }
                }
                catch
                {
                    from.SendMessage("Unable to add jail term. Bad D,H,M.");
                }
                goto case 15;

            case 29:
                //remove jail term
                try
                {
                    TimeSpan p = new TimeSpan(Convert.ToInt32(info.GetTextEntry(8).Text.Trim()), Convert.ToInt32(info.GetTextEntry(9).Text.Trim()), Convert.ToInt32(info.GetTextEntry(10).Text.Trim()), 0, 0);
                    if (JailSystem.FoulMouthJailTimes.Contains(p))
                    {
                        JailSystem.FoulMouthJailTimes.Remove(p);
                    }
                    else
                    {
                        from.SendMessage("Jail term not listed.");
                    }
                }
                catch
                {
                    from.SendMessage("Unable to remove Jail term. Bad D,H,M.");
                }
                goto case 15;

            case 30:
                //add jail term
                try
                {
                    TimeSpan p = new TimeSpan(Convert.ToInt32(info.GetTextEntry(8).Text.Trim()), Convert.ToInt32(info.GetTextEntry(9).Text.Trim()), Convert.ToInt32(info.GetTextEntry(10).Text.Trim()), 0, 0);
                    if (JailSystem.oocJailTimes.Contains(p))
                    {
                        from.SendMessage("Unable to add jail term. It is already listed.");
                    }
                    else
                    {
                        JailSystem.oocJailTimes.Add(p);
                    }
                }
                catch
                {
                    from.SendMessage("Unable to add jail term. Bad D,H,M.");
                }
                goto case 10;

            case 31:
                //remove jail term
                try
                {
                    TimeSpan p = new TimeSpan(Convert.ToInt32(info.GetTextEntry(8).Text.Trim()), Convert.ToInt32(info.GetTextEntry(9).Text.Trim()), Convert.ToInt32(info.GetTextEntry(10).Text.Trim()), 0, 0);
                    if (JailSystem.oocJailTimes.Contains(p))
                    {
                        JailSystem.oocJailTimes.Remove(p);
                    }
                    else
                    {
                        from.SendMessage("Jail term not listed.");
                    }
                }
                catch
                {
                    from.SendMessage("Unable to remove Jail term. Bad D,H,M.");
                }
                goto case 10;

            case 32:
                //add ooc word
                try
                {
                    temp = info.GetTextEntry(14).Text.ToLower().Trim();
                    if ((temp == "") || (temp == null))
                    {
                        from.SendMessage("Unable to add word");
                    }
                    else if (JailSystem.oocWords.Contains(temp))
                    {
                        from.SendMessage("Word is already in the list.");
                    }
                    else
                    {
                        JailSystem.oocWords.Add(temp);
                    }
                }
                catch
                {
                    from.SendMessage("Unable to add word");
                }
                goto case 10;

            case 33:
                //remove ooc word
                try
                {
                    temp = info.GetTextEntry(14).Text.ToLower().Trim();
                    if ((temp == "") || (temp == null))
                    {
                        from.SendMessage("Unable to remove word");
                    }
                    else if (JailSystem.oocWords.Contains(temp))
                    {
                        JailSystem.oocWords.Remove(temp);
                    }
                    else
                    {
                        from.SendMessage("Word is not in the list.");
                    }
                }
                catch
                {
                    from.SendMessage("Unable to remove word");
                }
                goto case 10;

            case 34:
                //add ooc part
                try
                {
                    temp = info.GetTextEntry(15).Text.ToLower().Trim();
                    if ((temp == "") || (temp == null))
                    {
                        from.SendMessage("Unable to add word");
                    }
                    else if (JailSystem.oocParts.Contains(temp))
                    {
                        from.SendMessage("Word is already in the list.");
                    }
                    else
                    {
                        JailSystem.oocParts.Add(temp);
                    }
                }
                catch
                {
                    from.SendMessage("Unable to add word");
                }
                goto case 10;

            case 35:
                //remove ooc part
                try
                {
                    temp = info.GetTextEntry(15).Text.ToLower().Trim();
                    if ((temp == "") || (temp == null))
                    {
                        from.SendMessage("Unable to remove word");
                    }
                    else if (JailSystem.oocParts.Contains(temp))
                    {
                        JailSystem.oocParts.Remove(temp);
                    }
                    else
                    {
                        from.SendMessage("Word is not in the list.");
                    }
                }
                catch
                {
                    from.SendMessage("Unable to remove word");
                }
                goto case 10;

            case 41:
                js.forceRelease(from);
                from.SendGump(new JailAdminGump(m_page, m_subpage, m_id));
                break;

            case 42:
                js.AddDays(1);
                from.SendGump(new JailAdminGump(m_page, m_subpage, m_id));
                break;

            case 46:
                js.subtractDays(1);
                from.SendGump(new JailAdminGump(m_page, m_subpage, m_id));
                break;

            case 47:
                js.subtractDays(7);
                from.SendGump(new JailAdminGump(m_page, m_subpage, m_id));
                break;

            case 48:
                js.AddHours(1);
                from.SendGump(new JailAdminGump(m_page, m_subpage, m_id));
                break;

            case 49:
                js.subtractHours(1);
                from.SendGump(new JailAdminGump(m_page, m_subpage, m_id));
                break;

            case 43:
                js.AddDays(7);
                from.SendGump(new JailAdminGump(m_page, m_subpage, m_id));
                break;

            case 44:
                //previous button
                m_id--;
                if (m_id < 0)
                {
                    m_id = JailSystem.list.Count - 1;
                }
                from.SendGump(new JailAdminGump(m_page, m_subpage, m_id));
                break;

            case 45:
                //next button
                m_id++;
                if (m_id >= JailSystem.list.Count)
                {
                    m_id = 0;
                }
                from.SendGump(new JailAdminGump(m_page, m_subpage, m_id));
                break;

            default:
                break;
            }
            //from.CloseGump(typeof ( JailAdminGump ));
        }
示例#46
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (info.ButtonID == 1 && !m_House.Deleted)
            {
                if (m_House.IsOwner(m_Mobile))
                {
                    if (m_House.MovingCrate != null || m_House.InternalizedVendors.Count > 0)
                    {
                        m_Mobile.SendLocalizedMessage(1080455);                           // You can not resize your house at this time. Please remove all items fom the moving crate and try again.
                        return;
                    }
                    else if (!Guilds.Guild.NewGuildSystem && m_House.FindGuildstone() != null)
                    {
                        m_Mobile.SendLocalizedMessage(501389);                           // You cannot redeed a house with a guildstone inside.
                        return;
                    }

                    /*else if ( m_House.PlayerVendors.Count > 0 )
                     * {
                     *      m_Mobile.SendLocalizedMessage( 503236 ); // You need to collect your vendor's belongings before moving.
                     *      return;
                     * }*/
                    else if (m_House.HasRentedVendors && m_House.VendorInventories.Count > 0)
                    {
                        m_Mobile.SendLocalizedMessage(1062679);                           // You cannot do that that while you still have contract vendors or unclaimed contract vendor inventory in your house.
                        return;
                    }
                    else if (m_House.HasRentedVendors)
                    {
                        m_Mobile.SendLocalizedMessage(1062680);                           // You cannot do that that while you still have contract vendors in your house.
                        return;
                    }
                    else if (m_House.VendorInventories.Count > 0)
                    {
                        m_Mobile.SendLocalizedMessage(1062681);                           // You cannot do that that while you still have unclaimed contract vendor inventory in your house.
                        return;
                    }


                    if (m_Mobile.AccessLevel >= AccessLevel.GameMaster)
                    {
                        m_Mobile.SendMessage("You do not get a refund for your house as you are not a player");
                        m_House.RemoveKeys(m_Mobile);
                        m_House.Delete();
                    }
                    else
                    {
                        Item toGive = null;

                        if (m_House.IsAosRules)
                        {
                            if (m_House.Price > 0)
                            {
                                toGive = new BankCheck(m_House.Price);
                            }
                            else
                            {
                                toGive = m_House.GetDeed();
                            }
                        }
                        else
                        {
                            toGive = m_House.GetDeed();

                            if (toGive == null && m_House.Price > 0)
                            {
                                toGive = new BankCheck(m_House.Price);
                            }
                        }

                        if (toGive != null)
                        {
                            BankBox box = m_Mobile.BankBox;

                            if (box.TryDropItem(m_Mobile, toGive, false))
                            {
                                if (toGive is BankCheck)
                                {
                                    m_Mobile.SendLocalizedMessage(1060397, ((BankCheck)toGive).Worth.ToString());                                         // ~1_AMOUNT~ gold has been deposited into your bank box.
                                }
                                m_House.RemoveKeys(m_Mobile);
                                new TempNoHousingRegion(m_House, m_Mobile);
                                m_House.Delete();
                            }
                            else
                            {
                                toGive.Delete();
                                m_Mobile.SendLocalizedMessage(500390);                                   // Your bank box is full.
                            }
                        }
                        else
                        {
                            m_Mobile.SendMessage("Unable to refund house.");
                        }
                    }
                }
                else
                {
                    m_Mobile.SendLocalizedMessage(501320);                       // Only the house owner may do this.
                }
            }
            else if (info.ButtonID == 0)
            {
                m_Mobile.CloseGump(typeof(ConfirmHouseResize));
                m_Mobile.SendGump(new HouseGumpAOS(HouseGumpPageAOS.Customize, m_Mobile, m_House));
            }
        }
示例#47
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            switch (info.ButtonID)
            {
            case 0:
            {
                //Quit
                break;
            }

            case 101:
            {
                DoThis(from, "createworld");
                break;
            }

            case 102:
            {
                DoThis(from, "clearall");
                break;
            }

            case 103:
            {
                from.Say("SPAWNING UO Classic...");
                DoThis(from, "spawngen uoclassic/UOClassic.map");
                break;
            }

            case 104:
            {
                DoThis(from, "SpawnUOML");
                break;
            }

            case 105:
            {
                DoThis(from, "SpawnCurrent");
                break;
            }

            //DoThis( from106, "" );
            //DoThis( from107, "" );
            //DoThis( from108, "" );
            case 109:
            {
                DoThis(from, "spawngen unload 1000");
                break;
            }

            case 110:
            {
                DoThis(from, "UnloadUOML");
                break;
            }

            case 111:
            {
                DoThis(from, "UnloadCurrent");
                break;
            }

            //DoThis( from112, "" );
            //DoThis( from113, "" );
            //DoThis( from114, "" );
            case 115:
            {
                DoThis(from, "GenSeers");
                break;
            }

            case 116:
            {
                DoThis(from, "RemSeers");
                break;
            }

            case 117:
            {
                DoThis(from, "spawngen save");
                break;
            }

            case 118:
            {
                DoThis(from, "spawngen savebyhand");
                break;
            }

            case 119:
            {
                DoThis(from, "GumpSaveRegion");
                break;
            }

            case 120:
            {
                DoThis(from, "GumpSaveCoordinate");
                break;
            }

            case 121:
            {
                DoThis(from, "spawngen remove");
                break;
            }

            case 122:
            {
                DoThis(from, "spawngen cleanfacet");
                break;
            }

            case 123:
            {
                DoThis(from, "GumpRemoveID");
                break;
            }

            case 124:
            {
                DoThis(from, "GumpRemoveCoordinate");
                break;
            }

            case 125:
            {
                DoThis(from, "GumpRemoveRegion");
                break;
            }

            case 126:
            {
                DoThis(from, "SpawnEditor");
                break;
            }

            case 127:
            {
                DoThis(from, "RunUOSpawnerExporter");
                break;
            }

            case 128:
            {
                DoThis(from, "Add RegionControl");
                break;
            }
            }
        }
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (state == null || info == null || state.Mobile == null || this.m_gauntlet == null || this.m_gauntlet.Challenger == null)
            {
                return;
            }

            XmlPoints afrom = (XmlPoints)XmlAttach.FindAttachment(state.Mobile, typeof(XmlPoints));

            switch (info.ButtonID)
            {
            case 1:
                // refresh

                this.m_gauntlet.CheckForDisqualification();

                state.Mobile.SendGump(new DeathmatchGump(this.m_gauntlet, state.Mobile, this.viewpage));
                break;

            case 10:
                // Entry fee
                int       val = 0;
                TextRelay tr  = info.GetTextEntry(10);
                if (tr != null)
                {
                    try
                    {
                        val = int.Parse(tr.Text);
                    }
                    catch
                    {
                    }
                }
                this.m_gauntlet.EntryFee = val;

                this.m_gauntlet.ResetAcceptance();

                // update all the gumps
                RefreshAllGumps(this.m_gauntlet, true);

                state.Mobile.SendGump(new DeathmatchGump(this.m_gauntlet, state.Mobile, this.viewpage));
                break;

            case 12:
                // page up
                // try doing the default for non-participants
                int nplayers = 0;
                if (this.m_gauntlet.Participants != null)
                {
                    nplayers = this.m_gauntlet.Participants.Count;
                }

                int page = this.viewpage + 1;
                if (page > (int)(nplayers / this.PlayersPerPage))
                {
                    page = (int)(nplayers / this.PlayersPerPage);
                }

                foreach (DeathmatchGauntlet.ChallengeEntry entry in this.m_WorkingList)
                {
                    if (entry != null)
                    {
                        if (entry.Participant == state.Mobile)
                        {
                            entry.PageBeingViewed++;

                            if (entry.PageBeingViewed > (int)(nplayers / this.PlayersPerPage))
                            {
                                entry.PageBeingViewed = (int)(nplayers / this.PlayersPerPage);
                            }
                            page = entry.PageBeingViewed;
                            break;
                        }
                    }
                }

                state.Mobile.SendGump(new DeathmatchGump(this.m_gauntlet, state.Mobile, page));
                break;

            case 13:
                // page down
                // try doing the default for non-participants

                page = this.viewpage - 1;
                if (page < 0)
                {
                    page = 0;
                }
                foreach (DeathmatchGauntlet.ChallengeEntry entry in this.m_WorkingList)
                {
                    if (entry != null)
                    {
                        if (entry.Participant == state.Mobile)
                        {
                            entry.PageBeingViewed--;

                            if (entry.PageBeingViewed < 0)
                            {
                                entry.PageBeingViewed = 0;
                            }
                            page = entry.PageBeingViewed;
                            break;
                        }
                    }
                }

                state.Mobile.SendGump(new DeathmatchGump(this.m_gauntlet, state.Mobile, page));
                break;

            case 20:
                // arena size
                val = 0;
                tr  = info.GetTextEntry(20);
                if (tr != null)
                {
                    try
                    {
                        val = int.Parse(tr.Text);
                    }
                    catch
                    {
                    }
                }
                this.m_gauntlet.ArenaSize = val;

                this.m_gauntlet.ResetAcceptance();

                // update all the gumps
                RefreshAllGumps(this.m_gauntlet, true);

                state.Mobile.SendGump(new DeathmatchGump(this.m_gauntlet, state.Mobile, this.viewpage));
                break;

            case 30:
                // target score
                val = 0;
                tr  = info.GetTextEntry(30);
                if (tr != null)
                {
                    try
                    {
                        val = int.Parse(tr.Text);
                    }
                    catch
                    {
                    }
                }
                this.m_gauntlet.TargetScore = val;

                this.m_gauntlet.ResetAcceptance();

                // update all the gumps
                RefreshAllGumps(this.m_gauntlet, true);

                state.Mobile.SendGump(new DeathmatchGump(this.m_gauntlet, state.Mobile, this.viewpage));
                break;

            case 40:
                // match length
                double dval = 0;
                tr = info.GetTextEntry(40);
                if (tr != null)
                {
                    try
                    {
                        dval = double.Parse(tr.Text);
                    }
                    catch
                    {
                    }
                }
                this.m_gauntlet.MatchLength = TimeSpan.FromMinutes(dval);

                this.m_gauntlet.ResetAcceptance();

                // update all the gumps
                RefreshAllGumps(this.m_gauntlet, true);

                state.Mobile.SendGump(new DeathmatchGump(this.m_gauntlet, state.Mobile, this.viewpage));
                break;

            case 100:

                // add to Participants
                if (this.m_gauntlet.Participants == null)
                {
                    this.m_gauntlet.Participants = new ArrayList();
                }

                if (this.MaxTeamSize > 0 && this.m_gauntlet.Participants.Count >= this.MaxTeamSize)
                {
                    XmlPoints.SendText(state.Mobile, 100535);         // "Challenge is full!"
                }
                else
                {
                    state.Mobile.Target = new MemberTarget(this.m_gauntlet, this.m_gauntlet.Participants);
                }

                state.Mobile.SendGump(new DeathmatchGump(this.m_gauntlet, state.Mobile, this.viewpage));
                break;

            case 300:
                // Start game
                if (this.m_WorkingList == null)
                {
                    return;
                }

                bool complete = true;
                foreach (DeathmatchGauntlet.ChallengeEntry entry in this.m_WorkingList)
                {
                    if (entry != null)
                    {
                        Mobile m = entry.Participant;

                        if (m == null)
                        {
                            continue;
                        }

                        if (!this.m_gauntlet.CheckQualify(m))
                        {
                            complete = false;
                            break;
                        }

                        if (!entry.Accepted)
                        {
                            XmlPoints.SendText(this.m_gauntlet.Challenger, 100539, m.Name);      // "{0} has not accepted yet."
                            complete = false;
                            break;
                        }
                    }
                }

                if (this.m_WorkingList.Count < 2)
                {
                    XmlPoints.SendText(this.m_gauntlet.Challenger, 100540);      // "Insufficient number of players."
                    complete = false;
                }

                if (this.m_gauntlet.TargetScore <= 0 && this.m_gauntlet.MatchLength <= TimeSpan.Zero)
                {
                    XmlPoints.SendText(this.m_gauntlet.Challenger, 100568);      // "No valid end condition for match."
                    complete = false;
                }
                // copy all of the accepted entries to the final participants list

                if (complete)
                {
                    this.m_gauntlet.Participants = new ArrayList();

                    foreach (DeathmatchGauntlet.ChallengeEntry entry in this.m_WorkingList)
                    {
                        if (entry != null)
                        {
                            Mobile m = entry.Participant;

                            if (m == null)
                            {
                                continue;
                            }

                            // try to collect any entry fee
                            if (!this.m_gauntlet.CollectEntryFee(m, this.m_gauntlet.EntryFee))
                            {
                                continue;
                            }

                            // set up the challenge on each player
                            XmlPoints a = (XmlPoints)XmlAttach.FindAttachment(m, typeof(XmlPoints));
                            if (a != null)
                            {
                                a.ChallengeGame = this.m_gauntlet;
                            }

                            entry.Status = ChallengeStatus.Active;

                            this.m_gauntlet.Participants.Add(entry);
                        }
                    }

                    // and lock the game
                    this.m_gauntlet.StartGame();

                    // refresh all gumps
                    RefreshAllGumps(this.m_gauntlet, true);
                }
                else
                {
                    state.Mobile.SendGump(new DeathmatchGump(this.m_gauntlet, state.Mobile, this.viewpage));
                }

                break;

            default:
            {
                // forfeit buttons
                if (info.ButtonID >= 4000)
                {
                    int selection = info.ButtonID - 4000;

                    if (selection < this.m_WorkingList.Count)
                    {
                        DeathmatchGauntlet.ChallengeEntry entry = (DeathmatchGauntlet.ChallengeEntry) this.m_WorkingList[selection];

                        // find the master participants list entry with the same participant
                        if (this.m_gauntlet.Participants != null)
                        {
                            DeathmatchGauntlet.ChallengeEntry forfeitentry = null;

                            foreach (DeathmatchGauntlet.ChallengeEntry masterentry in this.m_gauntlet.Participants)
                            {
                                if (entry == masterentry)
                                {
                                    forfeitentry = masterentry;
                                    break;
                                }
                            }

                            // and remove it
                            if (forfeitentry != null)
                            {
                                forfeitentry.Status = ChallengeStatus.Forfeit;

                                // inform him that he has been kicked
                                this.m_gauntlet.Forfeit(forfeitentry.Participant);
                            }
                        }
                    }
                }
                // kick buttons
                if (info.ButtonID >= 2000)
                {
                    int selection = info.ButtonID - 2000;

                    if (selection < this.m_WorkingList.Count)
                    {
                        DeathmatchGauntlet.ChallengeEntry entry = (DeathmatchGauntlet.ChallengeEntry) this.m_WorkingList[selection];
                        // find the master participants list entry with the same participant
                        if (this.m_gauntlet.Participants != null)
                        {
                            DeathmatchGauntlet.ChallengeEntry kickentry = null;

                            foreach (DeathmatchGauntlet.ChallengeEntry masterentry in this.m_gauntlet.Participants)
                            {
                                if (entry == masterentry)
                                {
                                    kickentry = masterentry;
                                    break;
                                }
                            }

                            // and remove it
                            if (kickentry != null)
                            {
                                this.m_gauntlet.Participants.Remove(kickentry);

                                // refresh his gump and inform him that he has been kicked
                                if (kickentry.Participant != null)
                                {
                                    XmlPoints.SendText(kickentry.Participant, 100545, this.m_gauntlet.ChallengeName);         // "You have been kicked from {0}"
                                    kickentry.Participant.SendGump(new DeathmatchGump(this.m_gauntlet, kickentry.Participant, this.viewpage));
                                }
                            }
                        }

                        this.m_gauntlet.ResetAcceptance();
                    }

                    // refresh all gumps
                    RefreshAllGumps(this.m_gauntlet, true);
                    //state.Mobile.SendGump( new DeathmatchGump( m_gauntlet, state.Mobile));
                }
                else if (info.ButtonID >= 1000)
                {
                    int selection = info.ButtonID - 1000;
                    // set the acceptance flag of the participant
                    if (selection < this.m_WorkingList.Count)
                    {
                        DeathmatchGauntlet.ChallengeEntry entry = (DeathmatchGauntlet.ChallengeEntry) this.m_WorkingList[selection];

                        entry.Accepted = !entry.Accepted;
                    }

                    // refresh all gumps
                    RefreshAllGumps(this.m_gauntlet, true);
                    //state.Mobile.SendGump( new DeathmatchGump( m_gauntlet, state.Mobile));
                }

                break;
            }
            }
        }
示例#49
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            from.CloseGump <ResurrectGump>();;

            if (info.ButtonID == 1 || info.ButtonID == 2)
            {
                if (from.Map == null || !from.Map.CanFit(from.Location, 16, false, false))
                {
                    from.SendLocalizedMessage(502391);                       // Thou can not be resurrected there!
                    return;
                }

                if (m_Price > 0)
                {
                    if (info.IsSwitched(1))
                    {
                        if (Banker.Withdraw(from, m_Price))
                        {
                            from.SendLocalizedMessage(1060398, m_Price.ToString());                               // ~1_AMOUNT~ gold has been withdrawn from your bank box.
                            from.SendLocalizedMessage(1060022, Banker.GetBalance(from).ToString());               // You have ~1_AMOUNT~ gold in cash remaining in your bank box.
                        }
                        else
                        {
                            from.SendLocalizedMessage(1060020);                               // Unfortunately, you do not have enough cash in your bank to cover the cost of the healing.
                            return;
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1060019);                           // You decide against paying the healer, and thus remain dead.
                        return;
                    }
                }

                from.PlaySound(0x214);
                from.FixedEffect(0x376A, 10, 16);

                from.Resurrect();

                if (from.Fame > 0)
                {
                    int amount = from.Fame / 10;

                    Misc.Titles.AwardFame(from, -amount, true);
                }

                if (from.ShortTermMurders >= 5)
                {
                    double loss = (100.0 - (4.0 + @from.ShortTermMurders / 5.0)) / 100.0;                     // 5 to 15% loss

                    if (loss < 0.85)
                    {
                        loss = 0.85;
                    }
                    else if (loss > 0.95)
                    {
                        loss = 0.95;
                    }

                    if (from.RawStr * loss > 10)
                    {
                        from.RawStr = (int)(from.RawStr * loss);
                    }
                    if (from.RawInt * loss > 10)
                    {
                        from.RawInt = (int)(from.RawInt * loss);
                    }
                    if (from.RawDex * loss > 10)
                    {
                        from.RawDex = (int)(from.RawDex * loss);
                    }

                    for (int s = 0; s < from.Skills.Length; s++)
                    {
                        if (from.Skills[s].Base * loss > 35)
                        {
                            from.Skills[s].Base *= loss;
                        }
                    }
                }

                if (from.Alive && m_HitsScalar > 0)
                {
                    from.Hits = (int)(from.HitsMax * m_HitsScalar);
                }
            }
        }
示例#50
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            if (this.m_Book.Deleted || !from.InRange(this.m_Book.GetWorldLocation(), (Core.ML ? 3 : 1)) || !Multis.DesignContext.Check(from))
            {
                this.m_Book.Openers.Remove(from);
                return;
            }

            int buttonID = info.ButtonID;

            if (buttonID == 1) // Rename book
            {
                if (!this.m_Book.IsLockedDown || from.AccessLevel >= AccessLevel.GameMaster)
                {
                    from.SendLocalizedMessage(502414); // Please enter a title for the runebook:
                    from.Prompt = new InternalPrompt(this.m_Book);
                }
                else
                {
                    this.m_Book.Openers.Remove(from);

                    from.SendLocalizedMessage(502413, null, 0x35); // That cannot be done while the book is locked down.
                }
            }
            else
            {
                buttonID -= 2;

                int index = buttonID / 6;
                int type  = buttonID % 6;

                if (index >= 0 && index < this.m_Book.Entries.Count)
                {
                    RunebookEntry e = (RunebookEntry)this.m_Book.Entries[index];

                    switch (type)
                    {
                    case 0:     // Use charges
                    {
                        if (this.m_Book.CurCharges <= 0)
                        {
                            from.CloseGump(typeof(RunebookGump));
                            from.SendGump(new RunebookGump(from, this.m_Book));

                            from.SendLocalizedMessage(502412);         // There are no charges left on that item.
                        }
                        else
                        {
                            int  xLong = 0, yLat = 0;
                            int  xMins = 0, yMins = 0;
                            bool xEast = false, ySouth = false;

                            if (Sextant.Format(e.Location, e.Map, ref xLong, ref yLat, ref xMins, ref yMins, ref xEast, ref ySouth))
                            {
                                string location = String.Format("{0}° {1}'{2}, {3}° {4}'{5}", yLat, yMins, ySouth ? "S" : "N", xLong, xMins, xEast ? "E" : "W");
                                from.SendMessage(location);
                            }

                            this.m_Book.OnTravel();
                            new RecallSpell(from, this.m_Book, e, this.m_Book).Cast();

                            this.m_Book.Openers.Remove(from);
                        }

                        break;
                    }

                    case 1:     // Drop rune
                    {
                        if (!this.m_Book.IsLockedDown || from.AccessLevel >= AccessLevel.GameMaster)
                        {
                            this.m_Book.DropRune(from, e, index);

                            from.CloseGump(typeof(RunebookGump));
                            if (!Core.ML)
                            {
                                from.SendGump(new RunebookGump(from, this.m_Book));
                            }
                        }
                        else
                        {
                            this.m_Book.Openers.Remove(from);

                            from.SendLocalizedMessage(502413, null, 0x35);         // That cannot be done while the book is locked down.
                        }

                        break;
                    }

                    case 2:     // Set default
                    {
                        if (this.m_Book.CheckAccess(from))
                        {
                            this.m_Book.Default = e;

                            from.CloseGump(typeof(RunebookGump));
                            from.SendGump(new RunebookGump(from, this.m_Book));

                            from.SendLocalizedMessage(502417);         // New default location set.
                        }

                        break;
                    }

                    case 3:     // Recall
                    {
                        if (HasSpell(from, 31))
                        {
                            int  xLong = 0, yLat = 0;
                            int  xMins = 0, yMins = 0;
                            bool xEast = false, ySouth = false;

                            if (Sextant.Format(e.Location, e.Map, ref xLong, ref yLat, ref xMins, ref yMins, ref xEast, ref ySouth))
                            {
                                string location = String.Format("{0}° {1}'{2}, {3}° {4}'{5}", yLat, yMins, ySouth ? "S" : "N", xLong, xMins, xEast ? "E" : "W");
                                from.SendMessage(location);
                            }

                            this.m_Book.OnTravel();
                            new RecallSpell(from, null, e, null).Cast();
                        }
                        else
                        {
                            from.SendLocalizedMessage(500015);         // You do not have that spell!
                        }

                        this.m_Book.Openers.Remove(from);

                        break;
                    }

                    case 4:     // Gate
                    {
                        if (HasSpell(from, 51))
                        {
                            int  xLong = 0, yLat = 0;
                            int  xMins = 0, yMins = 0;
                            bool xEast = false, ySouth = false;

                            if (Sextant.Format(e.Location, e.Map, ref xLong, ref yLat, ref xMins, ref yMins, ref xEast, ref ySouth))
                            {
                                string location = String.Format("{0}° {1}'{2}, {3}° {4}'{5}", yLat, yMins, ySouth ? "S" : "N", xLong, xMins, xEast ? "E" : "W");
                                from.SendMessage(location);
                            }

                            this.m_Book.OnTravel();
                            new GateTravelSpell(from, null, e).Cast();
                        }
                        else
                        {
                            from.SendLocalizedMessage(500015);         // You do not have that spell!
                        }

                        this.m_Book.Openers.Remove(from);

                        break;
                    }

                    case 5:     // Sacred Journey
                    {
                        if (Core.AOS)
                        {
                            if (HasSpell(from, 209))
                            {
                                int  xLong = 0, yLat = 0;
                                int  xMins = 0, yMins = 0;
                                bool xEast = false, ySouth = false;

                                if (Sextant.Format(e.Location, e.Map, ref xLong, ref yLat, ref xMins, ref yMins, ref xEast, ref ySouth))
                                {
                                    string location = String.Format("{0}° {1}'{2}, {3}° {4}'{5}", yLat, yMins, ySouth ? "S" : "N", xLong, xMins, xEast ? "E" : "W");
                                    from.SendMessage(location);
                                }

                                this.m_Book.OnTravel();
                                new SacredJourneySpell(from, null, e, null).Cast();
                            }
                            else
                            {
                                from.SendLocalizedMessage(500015);         // You do not have that spell!
                            }
                        }

                        this.m_Book.Openers.Remove(from);

                        break;
                    }
                    }
                }
                else
                {
                    this.m_Book.Openers.Remove(from);
                }
            }
        }
示例#51
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            if (from != null && info.ButtonID == 1)
            {
                TextRelay relay;

                try
                {
                    for (int i = 0; i < 2; i++)
                    {
                        relay = info.GetTextEntry(100 + i);
                        double number = Double.Parse(relay.Text);
                        MagerySpell.SpeedTable[i] = number;
                    }
                }
                catch
                {
                    from.SendMessage("Couldn't parse speed entries.");
                }

                for (int row = 0; row < 8; row++)
                {
                    for (int column = 0; column < 3; column++)
                    {
                        relay = info.GetTextEntry(row * 3 + column);
                        if (relay != null)
                        {
                            string text = relay.Text.Trim();
                            try
                            {
                                int number = Int32.Parse(text);
                                if (number < 0)
                                {
                                    number = 0;
                                }

                                if (number > 99)
                                {
                                    number = 99;
                                }

                                MagerySpell.DamageTable[row * 3 + column] = number;
                            }
                            catch
                            {
                                from.SendMessage("Invalid textentry at column {0} on circle {1}.", column + 1, row + 1);
                            }
                        }
                    }
                }
                from.SendMessage("Saved spell damages. Saving to file...");
                try
                {
                    MagerySpell.SaveTables();
                    from.SendMessage("done.");
                }
                catch (Exception e)
                {
                    from.SendMessage("Couldn't save damage table: {0}", e.Message);
                }

                from.SendGump(new SpellAdminSetupGump());
            }
        }
示例#52
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            if (info.ButtonID == 1)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 1);
            }
            else if (info.ButtonID == 2)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 2);
            }
            else if (info.ButtonID == 3)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 3);
            }
            else if (info.ButtonID == 4)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 4);
            }
            else if (info.ButtonID == 5)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 5);
            }
            else if (info.ButtonID == 6)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 6);
            }
            else if (info.ButtonID == 7)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 7);
            }
            else if (info.ButtonID == 8)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 8);
            }
            else if (info.ButtonID == 9)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 9);
            }
            else if (info.ButtonID == 10)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 10);
            }
            else if (info.ButtonID == 11)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 11);
            }
            else if (info.ButtonID == 12)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 12);
            }
            else if (info.ButtonID == 13)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 13);
            }
            else if (info.ButtonID == 14)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 14);
            }
            else if (info.ButtonID == 15)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 15);
            }
            else if (info.ButtonID == 16)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 16);
            }
            else if (info.ButtonID == 17)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 17);
            }
            else if (info.ButtonID == 18)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 18);
            }
            else if (info.ButtonID == 19)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 19);
            }
            else if (info.ButtonID == 20)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 20);
            }
            else if (info.ButtonID == 21)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 21);
            }
            else if (info.ButtonID == 22)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 22);
            }
            else if (info.ButtonID == 23)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 23);
            }
            else if (info.ButtonID == 24)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 24);
            }
            else if (info.ButtonID == 25)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 25);
            }
            else if (info.ButtonID == 26)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 26);
            }
            else if (info.ButtonID == 27)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 27);
            }
            else if (info.ButtonID == 28)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 28);
            }
            else if (info.ButtonID == 29)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 29);
            }
            else if (info.ButtonID == 30)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 30);
            }
            else if (info.ButtonID == 31)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 31);
            }
            else if (info.ButtonID == 32)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 32);
            }
            else if (info.ButtonID == 33)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 33);
            }
            else if (info.ButtonID == 34)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 34);
            }
            else if (info.ButtonID == 35)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 35);
            }
            else if (info.ButtonID == 36)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 36);
            }
            else if (info.ButtonID == 37)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 37);
            }
            else if (info.ButtonID == 38)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 38);
            }
            else if (info.ButtonID == 39)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 39);
            }
            else if (info.ButtonID == 40)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 40);
            }
            else if (info.ButtonID == 41)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 41);
            }
            else if (info.ButtonID == 42)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 42);
            }
            else if (info.ButtonID == 43)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 43);
            }
            else if (info.ButtonID == 44)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 44);
            }
            else if (info.ButtonID == 45)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 45);
            }
            else if (info.ButtonID == 46)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 46);
            }
            else if (info.ButtonID == 47)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 47);
            }
            else if (info.ButtonID == 48)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 48);
            }
            else if (info.ButtonID == 49)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 49);
            }
            else if (info.ButtonID == 50)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 50);
            }
            else if (info.ButtonID == 51)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 51);
            }
            else if (info.ButtonID == 52)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 52);
            }
            else if (info.ButtonID == 53)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 53);
            }
            else if (info.ButtonID == 54)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 54);
            }
            else if (info.ButtonID == 55)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 55);
            }
            else if (info.ButtonID == 56)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 56);
            }
            else if (info.ButtonID == 57)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 57);
            }
            else if (info.ButtonID == 58)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 58);
            }
            else if (info.ButtonID == 59)
            {
                MusicPlaylistFunctions.UpdatePlaylist(from, 59);
            }
            else if (info.ButtonID > 100)
            {
                Server.Misc.MusicPlaylistFunctions.PlayMusicFile(from, (info.ButtonID - 100));
            }

            if (info.ButtonID < 1)
            {
                from.SendGump(new Server.Engines.Help.HelpGump(from, 12));
            }
            else
            {
                from.SendGump(new MusicPlaylist(from));
            }
        }
示例#53
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            int index = info.ButtonID - 1;

            if (index == -1)
            {
                m_Mobile.SendGump(new PropertiesGump(m_Mobile, m_Object, m_Stack, m_List, m_Page));
            }
            else if (index >= 0 && index < 4)
            {
                if (m_Monster == null)
                    LoadLists();

                ModelBodyType type;
                ArrayList list;

                switch (index)
                {
                    default:
                    case 0:
                        type = ModelBodyType.Monsters;
                        list = m_Monster;
                        break;
                    case 1:
                        type = ModelBodyType.Animals;
                        list = m_Animal;
                        break;
                    case 2:
                        type = ModelBodyType.Sea;
                        list = m_Sea;
                        break;
                    case 3:
                        type = ModelBodyType.Human;
                        list = m_Human;
                        break;
                }

                m_Mobile.SendGump(new SetBodyGump(m_Property, m_Mobile, m_Object, m_Stack, m_Page, m_List, 0, list, type));
            }
            else if (m_OurList != null)
            {
                index -= 4;

                if (index == 0 && m_OurPage > 0)
                {
                    m_Mobile.SendGump(
                        new SetBodyGump(m_Property, m_Mobile, m_Object, m_Stack, m_Page, m_List, m_OurPage - 1, m_OurList, m_OurType));
                }
                else if (index == 1 && ((m_OurPage + 1) * 12) < m_OurList.Count)
                {
                    m_Mobile.SendGump(
                        new SetBodyGump(m_Property, m_Mobile, m_Object, m_Stack, m_Page, m_List, m_OurPage + 1, m_OurList, m_OurType));
                }
                else
                {
                    index -= 2;

                    if (index >= 0 && index < m_OurList.Count)
                    {
                        try
                        {
                            InternalEntry entry = (InternalEntry)m_OurList[index];

                            CommandLogging.LogChangeProperty(m_Mobile, m_Object, m_Property.Name, entry.Body.ToString());
                            m_Property.SetValue(m_Object, entry.Body, null);
                            PropertiesGump.OnValueChanged(m_Object, m_Property, m_Stack);
                        }
                        catch
                        {
                            m_Mobile.SendMessage("An exception was caught. The property may not have changed.");
                        }

                        m_Mobile.SendGump(
                            new SetBodyGump(m_Property, m_Mobile, m_Object, m_Stack, m_Page, m_List, m_OurPage, m_OurList, m_OurType));
                    }
                }
            }
        }
示例#54
0
文件: Gump.cs 项目: favesc/ServUO
 public virtual void OnResponse(NetState sender, RelayInfo info)
 {
 }
示例#55
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Point3D toSet;
            bool    shouldSet, shouldSend;

            switch (info.ButtonID)
            {
            case 1:                     // Current location
            {
                toSet      = m_Mobile.Location;
                shouldSet  = true;
                shouldSend = true;

                break;
            }

            case 2:                     // Pick location
            {
                m_Mobile.Target = new InternalTarget(m_Property, m_Mobile, m_Object, m_Stack, m_Page, m_List);

                toSet      = Point3D.Zero;
                shouldSet  = false;
                shouldSend = false;

                break;
            }

            case 3:                     // Use values
            {
                TextRelay x = info.GetTextEntry(0);
                TextRelay y = info.GetTextEntry(1);
                TextRelay z = info.GetTextEntry(2);

                toSet      = new Point3D(x == null ? 0 : Utility.ToInt32(x.Text), y == null ? 0 : Utility.ToInt32(y.Text), z == null ? 0 : Utility.ToInt32(z.Text));
                shouldSet  = true;
                shouldSend = true;

                break;
            }

            default:
            {
                toSet      = Point3D.Zero;
                shouldSet  = false;
                shouldSend = true;

                break;
            }
            }

            if (shouldSet)
            {
                try
                {
                    Server.Scripts.Commands.CommandLogging.LogChangeProperty(m_Mobile, m_Object, m_Property.Name, toSet.ToString());
                    m_Property.SetValue(m_Object, toSet, null);
                    PropertiesGump.OnValueChanged(m_Object, m_Property, m_Stack);
                }
                catch
                {
                    m_Mobile.SendMessage("An exception was caught. The property may not have changed.");
                }
            }

            if (shouldSend)
            {
                m_Mobile.SendGump(new PropertiesGump(m_Mobile, m_Object, m_Stack, m_List, m_Page));
            }
        }
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            switch (info.ButtonID)
            {
            case 0:                     // Closed or Canceled
            {
                break;
            }

            case 10:
            {
                DoBegin(from);
                DoThis(from, "DecorateSE");
                DoEnd(from);
                break;
            }

            case 11:
            {
                DoBegin(from);
                DoThis(from, "DecorateML");
                DoEnd(from);
                DoThis(from, "TelMake ML");
                break;
            }

            case 12:
            {
                DoBegin(from);
                DoThis(from, "DecorateKRfirstAge");
                DoEnd(from);
                DoThis(from, "TelMake ML");
                DoThis(from, "TelMake KR1");
                DoThis(from, "SignDel KR1");
                break;
            }

            case 13:
            {
                DoBegin(from);
                DoThis(from, "DecorateKRsecondAge");
                DoEnd(from);
                DoKRPackage(from);
                break;
            }

            case 14:
            {
                DoBegin(from);
                DoThis(from, "DecorateSA");
                DoEnd(from);
                DoKRPackage(from);
                DoThis(from, "TelMake SA");
                break;
            }

            case 15:
            {
                DoBegin(from);
                DoThis(from, "DecorateHSfirstAge");
                DoEnd(from);
                DoKRPackage(from);
                DoThis(from, "TelMake SA");
                break;
            }

            case 16:
            {
                DoBegin(from);
                DoThis(from, "DecorateHSsecondAge");
                DoEnd(from);
                DoKRPackage(from);
                DoThis(from, "TelMake SA");
                break;
            }
            }
        }
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            if (!m_Vendor.CanInteractWith(from, false))
            {
                return;
            }

            if (m_Vendor.IsOwner(from))
            {
                m_Vendor.SayTo(from, 503212);                   // You own this shop, just take what you want.
                return;
            }

            if (info.ButtonID == 1)
            {
                m_Vendor.Say(from.Name);

                if (!m_VI.Valid || !m_VI.Item.IsChildOf(m_Vendor.Backpack))
                {
                    m_Vendor.SayTo(from, 503216);                       // You can't buy that.
                    return;
                }

                int totalGold = 0;

                if (from.Backpack != null)
                {
                    totalGold += from.Backpack.GetAmount(typeof(Gold));
                }

                totalGold += Banker.GetBalance(from);

                if (totalGold < m_VI.Price)
                {
                    m_Vendor.SayTo(from, 503205);                       // You cannot afford this item.
                }
                else if (!from.PlaceInBackpack(m_VI.Item))
                {
                    m_Vendor.SayTo(from, 503204);                       // You do not have room in your backpack for this.
                }
                else
                {
                    int leftPrice = m_VI.Price;

                    if (from.Backpack != null)
                    {
                        leftPrice -= from.Backpack.ConsumeUpTo(typeof(Gold), leftPrice);
                    }

                    if (leftPrice > 0)
                    {
                        Banker.Withdraw(from, leftPrice);
                    }

                    m_Vendor.HoldGold += m_VI.Price;

                    from.SendLocalizedMessage(503201);                       // You take the item.
                }
            }
            else
            {
                from.SendLocalizedMessage(503207);                   // Cancelled purchase.
            }
        }
示例#58
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            BaseCreature bc1 = (BaseCreature)m_Pet1;
            BaseCreature bc2 = (BaseCreature)m_Pet2;

            Mobile cm1 = bc1.ControlMaster;
            Mobile cm2 = bc2.ControlMaster;

            if (from == null)
            {
                return;
            }

            //Baby Stat Table
            if (info.ButtonID == 1)
            {
                from.CloseGump(typeof(BreedingAcceptGump));
                //from.CloseGump( typeof( BabyStatTableGump ) );

                from.SendGump(new BreedingAcceptGump(m_Pet1, m_Pet2));
                //from.SendGump( new BabyStatTableGump( m_Pet1, m_Pet2 ) );
            }

            //Accept
            if (info.ButtonID == 2)
            {
                Mobile breeder = new Mobile();

                Mobile owner = new Mobile();

                int ai = 0;

                if (bc1.AI == AIType.AI_Mage && bc2.AI == AIType.AI_Mage)
                {
                    ai = 1;
                }
                if (bc1.AI == AIType.AI_Melee && bc2.AI == AIType.AI_Melee)
                {
                    ai = 2;
                }

                int xstr = bc1.RawStr + bc2.RawStr;
                int xdex = bc1.RawDex + bc2.RawDex;
                int xint = bc1.RawInt + bc2.RawInt;

                int xhits = bc1.HitsMax + bc2.HitsMax;
                int xstam = bc1.StamMax + bc2.StamMax;
                int xmana = bc1.ManaMax + bc2.ManaMax;

                int xphys = bc1.PhysicalResistance + bc2.PhysicalResistance;
                int xfire = bc1.FireResistance + bc2.FireResistance;
                int xcold = bc1.ColdResistance + bc2.ColdResistance;
                int xnrgy = bc1.EnergyResistance + bc2.EnergyResistance;
                int xpois = bc1.PoisonResistance + bc2.PoisonResistance;

                int xdmin = bc1.DamageMin + bc2.DamageMin;
                int xdmax = bc1.DamageMax + bc2.DamageMax;

                int xmlev = bc1.Level + bc2.Level;

                int newStr = xstr / 2;
                int newDex = xdex / 2;
                int newInt = xint / 2;

                int newHits = xhits / 2;
                int newStam = xstam / 2;
                int newMana = xmana / 2;

                int newPhys = xphys / 2;
                int newFire = xfire / 2;
                int newCold = xcold / 2;
                int newNrgy = xnrgy / 2;
                int newPois = xpois / 2;

                int newDmin = xdmin / 2;
                int newDmax = xdmax / 2;

                int newMlev = xmlev / 2;

                int babyStr  = newStr + Utility.RandomMinMax(0, 1);
                int babyDex  = newDex + Utility.RandomMinMax(0, 1);
                int babyInt  = newInt + Utility.RandomMinMax(0, 1);
                int babyHits = newHits + Utility.RandomMinMax(0, 2);
                int babyStam = newStam + Utility.RandomMinMax(0, 2);
                int babyMana = newMana + Utility.RandomMinMax(0, 2);

                int babyPhys = newPhys + Utility.RandomMinMax(0, 2);
                int babyFire = newFire + Utility.RandomMinMax(0, 2);
                int babyCold = newCold + Utility.RandomMinMax(0, 2);
                int babyNrgy = newNrgy + Utility.RandomMinMax(0, 2);
                int babyPois = newPois + Utility.RandomMinMax(0, 2);

                int babyDmin = newDmin;
                int babyDmax = newDmax;

                int babyMlev = newMlev + Utility.RandomMinMax(1, 3);

                int stats     = babyStr + babyDex + babyInt + babyHits + babyStam + babyMana + babyPhys + babyFire + babyCold + babyNrgy + babyPois + babyDmin + babyDmax + babyMlev;
                int newPrice  = stats * 3;
                int babyPrice = newPrice;
                int chance    = stats;

                if (chance <= 1500)
                {
                    chance = 1500;
                }

                if (babyStr >= FSATS.NormalSTR)
                {
                    babyStr = FSATS.NormalSTR;
                }

                if (babyDex >= FSATS.NormalDEX)
                {
                    babyDex = FSATS.NormalDEX;
                }

                if (babyInt >= FSATS.NormalINT)
                {
                    babyInt = FSATS.NormalINT;
                }

                if (babyPhys >= FSATS.NormalPhys)
                {
                    babyPhys = FSATS.NormalPhys;
                }

                if (babyFire >= FSATS.NormalFire)
                {
                    babyFire = FSATS.NormalFire;
                }

                if (babyCold >= FSATS.NormalCold)
                {
                    babyCold = FSATS.NormalCold;
                }

                if (babyNrgy >= FSATS.NormalEnergy)
                {
                    babyNrgy = FSATS.NormalEnergy;
                }

                if (babyPois >= FSATS.NormalPoison)
                {
                    babyPois = FSATS.NormalPoison;
                }

                if (babyDmin >= FSATS.NormalMinDam)
                {
                    babyDmin = FSATS.NormalMinDam;
                }

                if (babyDmax >= FSATS.NormalMaxDam)
                {
                    babyDmax = FSATS.NormalMaxDam;
                }

                if (babyMlev >= 60)
                {
                    babyMlev = 60;
                }

                foreach (Mobile m in from.GetMobilesInRange(5))
                {
                    if (m is AnimalBreeder)
                    {
                        breeder = m;
                    }

                    if (m == cm1)
                    {
                        owner = m;
                    }
                }

                if (breeder == null)
                {
                    from.SendMessage("You must be near an animal breeder in order to breed your pet.");

                    if (cm1 != null)
                    {
                        cm1.SendMessage("The owner of the other pet is too far away from the animal breeder.");
                    }
                }
                else if (owner == null)
                {
                    from.SendMessage("The owner of the other pet is not near by.");

                    if (cm1 != null)
                    {
                        cm1.SendMessage("You are to far away from the other pet owner.");
                    }
                }
                else if (Utility.Random(chance) < 1500)
                {
                    if (cm1 != null)                       //Generate Claim Ticket One
                    {
                        PetClaimTicket pct = new PetClaimTicket();
                        pct.AI    = ai;
                        pct.Owner = cm1;
                        pct.Pet   = m_Pet1;
                        pct.Str   = babyStr;
                        pct.Dex   = babyDex;
                        pct.Int   = babyInt;
                        pct.Hits  = babyHits;
                        pct.Stam  = babyStam;
                        pct.Mana  = babyMana;
                        pct.Phys  = babyPhys;
                        pct.Fire  = babyFire;
                        pct.Cold  = babyCold;
                        pct.Nrgy  = babyNrgy;
                        pct.Pois  = babyPois;
                        pct.Dmin  = babyDmin;
                        pct.Dmax  = babyDmax;
                        pct.Mlev  = babyMlev;
                        pct.Gen   = bc1.Generation;
                        pct.Price = babyPrice;
                        cm1.AddToBackpack(pct);

                        breeder.SayTo(cm1, "Ill hold onto your pet for you while its mating.");
                        breeder.SayTo(cm1, "Return here in three days and the show me that claim ticket i gave to you.");
                        cm1.SendMessage("They have accepted your offer.");

                        bc1.ControlTarget = null;
                        bc1.ControlOrder  = OrderType.Stay;
                        bc1.Internalize();

                        bc1.SetControlMaster(null);
                    }

                    if (cm2 != null)                       //Generate Claim Ticket One
                    {
                        PetClaimTicket pct = new PetClaimTicket();
                        pct.AI    = ai;
                        pct.Owner = cm2;
                        pct.Pet   = m_Pet2;
                        pct.Str   = babyStr;
                        pct.Dex   = babyDex;
                        pct.Int   = babyInt;
                        pct.Hits  = babyHits;
                        pct.Stam  = babyStam;
                        pct.Mana  = babyMana;
                        pct.Phys  = babyPhys;
                        pct.Fire  = babyFire;
                        pct.Cold  = babyCold;
                        pct.Nrgy  = babyNrgy;
                        pct.Pois  = babyPois;
                        pct.Dmin  = babyDmin;
                        pct.Dmax  = babyDmax;
                        pct.Mlev  = babyMlev;
                        pct.Gen   = bc2.Generation;
                        pct.Price = babyPrice;
                        cm2.AddToBackpack(pct);

                        breeder.SayTo(cm2, "Ill hold onto your pet for you while its mating.");
                        breeder.SayTo(cm2, "Return here in three days and the show me that claim ticket i gave to you.");
                        cm2.SendMessage("You accept their offer.");

                        bc2.ControlTarget = null;
                        bc2.ControlOrder  = OrderType.Stay;
                        bc2.Internalize();

                        bc2.SetControlMaster(null);
                    }

                    if (bc1 != null || bc2 != null)
                    {
                        bc1.MatingDelay = DateTime.UtcNow + TimeSpan.FromHours(144.0);
                        bc2.MatingDelay = DateTime.UtcNow + TimeSpan.FromHours(144.0);
                    }
                }
                else
                {
                    if (cm1 != null && cm2 != null)
                    {
                        cm1.SendMessage("Breeding Failed: It is hard to successfully mate to strong pets together, You will have to wait twelve hours to try again.");
                        cm2.SendMessage("Breeding Failed: It is hard to successfully mate to strong pets together, You will have to wait twelve hours to try again.");
                        bc1.MatingDelay = DateTime.UtcNow + TimeSpan.FromHours(12.0);
                        bc2.MatingDelay = DateTime.UtcNow + TimeSpan.FromHours(12.0);
                    }
                }
            }

            //Decline
            if (info.ButtonID == 3)
            {
                from.SendMessage("You have declined thier offer.");

                if (cm1 != null)
                {
                    cm1.SendMessage("They have declined your offer");
                }
            }
        }
示例#59
0
        private string GetString(RelayInfo info, int id)
        {
            TextRelay t = info.GetTextEntry(id);

            return(t == null ? null : t.Text.Trim());
        }
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (m_Vendor.Deleted)
            {
                return;
            }

            Mobile from = state.Mobile;

            if (m_Vendor is PlayerVendor && !((PlayerVendor)m_Vendor).CanInteractWith(from, true))
            {
                return;
            }

            if (info.ButtonID == 0)
            {
                if (m_Vendor is PlayerVendor)                   // do nothing for barkeeps
                {
                    m_Vendor.Direction = m_Vendor.GetDirectionTo(from);
                    m_Vendor.Animate(32, 5, 1, true, false, 0);                      //bow
                    m_Vendor.SayTo(from, 1043310 + Utility.Random(12));              // a little random speech
                }
            }
            else if (info.ButtonID == 1 && info.Switches.Length > 0)
            {
                int cnum = info.Switches[0];
                int cat  = cnum % 256;
                int ent  = cnum >> 8;

                if (cat < Categories.Length && cat >= 0)
                {
                    if (ent < Categories[cat].Entries.Length && ent >= 0)
                    {
                        Item item = m_Vendor.FindItemOnLayer(Categories[cat].Layer);

                        if (item != null)
                        {
                            item.Delete();
                        }

                        List <Item> items = m_Vendor.Items;

                        for (int i = 0; item == null && i < items.Count; ++i)
                        {
                            Item checkitem = items[i];
                            Type type      = checkitem.GetType();

                            for (int j = 0; item == null && j < Categories[cat].Entries.Length; ++j)
                            {
                                if (type == Categories[cat].Entries[j].Type)
                                {
                                    item = checkitem;
                                }
                            }
                        }

                        if (item != null)
                        {
                            item.Delete();
                        }

                        if (Categories[cat].Layer == Layer.FacialHair)
                        {
                            if (m_Vendor.Female)
                            {
                                from.SendLocalizedMessage(1010639);                                   // You cannot place facial hair on a woman!
                            }
                            else
                            {
                                int hue = m_Vendor.FacialHairHue;

                                m_Vendor.FacialHairItemID = 0;
                                m_Vendor.ProcessDelta();                                 // invalidate item ID for clients

                                m_Vendor.FacialHairItemID = Categories[cat].Entries[ent].ItemID;
                                m_Vendor.FacialHairHue    = hue;
                            }
                        }
                        else if (Categories[cat].Layer == Layer.Hair)
                        {
                            int hue = m_Vendor.HairHue;

                            m_Vendor.HairItemID = 0;
                            m_Vendor.ProcessDelta();                             // invalidate item ID for clients

                            m_Vendor.HairItemID = Categories[cat].Entries[ent].ItemID;
                            m_Vendor.HairHue    = hue;
                        }
                        else
                        {
                            item = Categories[cat].Entries[ent].Create();

                            if (item != null)
                            {
                                item.Layer = Categories[cat].Layer;

                                if (!m_Vendor.EquipItem(item))
                                {
                                    item.Delete();
                                }
                            }
                        }

                        from.SendGump(new PlayerVendorCustomizeGump(m_Vendor, from));
                    }
                }
                else
                {
                    cat -= 100;

                    if (cat < 100)
                    {
                        if (cat < Categories.Length && cat >= 0)
                        {
                            CustomCategory category = Categories[cat];

                            if (category.Layer == Layer.Hair)
                            {
                                new PVHairHuePicker(false, m_Vendor, from).SendTo(state);
                            }
                            else if (category.Layer == Layer.FacialHair)
                            {
                                new PVHairHuePicker(true, m_Vendor, from).SendTo(state);
                            }
                            else
                            {
                                Item item = null;

                                List <Item> items = m_Vendor.Items;

                                for (int i = 0; item == null && i < items.Count; ++i)
                                {
                                    Item checkitem = items[i];
                                    Type type      = checkitem.GetType();

                                    for (int j = 0; item == null && j < category.Entries.Length; ++j)
                                    {
                                        if (type == category.Entries[j].Type)
                                        {
                                            item = checkitem;
                                        }
                                    }
                                }

                                if (item != null)
                                {
                                    new PVHuePicker(item, m_Vendor, from).SendTo(state);
                                }
                            }
                        }
                    }
                    else
                    {
                        cat -= 100;

                        if (cat < Categories.Length && cat >= 0)
                        {
                            CustomCategory category = Categories[cat];

                            if (category.Layer == Layer.Hair)
                            {
                                m_Vendor.HairItemID = 0;
                            }
                            else if (category.Layer == Layer.FacialHair)
                            {
                                m_Vendor.FacialHairItemID = 0;
                            }
                            else
                            {
                                Item item = null;

                                List <Item> items = m_Vendor.Items;

                                for (int i = 0; item == null && i < items.Count; ++i)
                                {
                                    Item checkitem = items[i];
                                    Type type      = checkitem.GetType();

                                    for (int j = 0; item == null && j < category.Entries.Length; ++j)
                                    {
                                        if (type == category.Entries[j].Type)
                                        {
                                            item = checkitem;
                                        }
                                    }
                                }

                                if (item != null)
                                {
                                    item.Delete();
                                }
                            }

                            from.SendGump(new PlayerVendorCustomizeGump(m_Vendor, from));
                        }
                    }
                }
            }
        }