Esempio n. 1
0
 public override void OnDoubleClick( Mobile from )
 {
     if ( m_Game != null )
     {
         if ( m_Game.OpenJoin )
         {
             if ( m_Game.IsInGame( from ) )
             {
                 from.SendGump( new GameTeamSelector( m_Game ) );
             }
             else
             {
                 if ( from.AccessLevel == AccessLevel.Player )
                     from.SendGump( new GameJoinGump( m_Game, m_GameName ) );
                 else
                     from.SendMessage( "It might not be wise for staff to be playing..." );
             }
         }
         else
         {
             from.SendMessage( "{0} join is closed.", m_GameName );
         }
     }
     else
     {
         from.SendMessage( "This stone must be linked to a game stone.  Please contact a game master." );
     }
 }
Esempio n. 2
0
		protected override void OnTargetFinish( Mobile from )
		{
			if ( m_Type == typeof( Type ) )
				from.SendGump( new PropertiesGump( m_Mobile, m_Object, m_Stack, m_List, m_Page ) );
			else
				from.SendGump( new SetObjectGump( m_Property, m_Mobile, m_Object, m_Stack, m_Type, m_Page, m_List ) );
		}
Esempio n. 3
0
        public override void OnDoubleClick(Mobile from)
        {
            if (Filled)
            {
                if (from.InRange(this, 3) && from.InLOS(this))
                {
                    from.SendAsciiMessage("You look at the Tombstone");
                    from.PlaySound(47);
                    from.SendGump(new GraveGump());
                }
                else if (IsChildOf(from.Backpack))
                {
                    from.SendAsciiMessage("You look at the Tombstone");
                    from.PlaySound(47);
                    from.SendGump(new GraveGump());
                }
                else
                {
                    from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
                }
            }

            if (!(Filled))
            {
                if (!IsChildOf(from.Backpack))
                    from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
                else
                {
                    from.Target = new InternalTarget(this);
                    from.SendAsciiMessage("This tombstone is blank!");
                    from.SendAsciiMessage("Target a players head to bury them.");
                }
            }
        }
Esempio n. 4
0
		public override void OnDoubleClick(Mobile m)
		{
			if (!m.InRange(GetWorldLocation(), 2) || ValorRewardController.Instance == null)
			{
				return;
			}
			m.CloseGump(typeof(ValorBoardGump));
			m.CloseGump(typeof(ValorBoardGumpBritish));
			m.CloseGump(typeof(ValorBoardGumpSide));
			m.SendGump(new ValorBoardGumpBritish());
			m.SendGump(new ValorBoardGump(ValorRewardController.Instance, 0, null, null, null, false));
			m.SendGump(new ValorBoardGumpSide(m, m, ValorRewardController.Instance));
		}
Esempio n. 5
0
			protected override void OnTarget(Mobile from, object targeted)
			{
				if (m_Item.Deleted)
				{
					return;
				}

				if (targeted is Item && !((Item)targeted).IsStandardLoot())
				{
					// Scissors can not be used on that to produce anything.
					// from.SendLocalizedMessage(502440); 

					if (targeted is IScissorable)
					{
						from.SendGump(new BlessedClothingCutGump((IScissorable)targeted, m_Item));
					}
					else
					{
						from.SendLocalizedMessage(502440);
					}
				}
				else if (m_Item.EraAOS && targeted == from)
				{
					// That doesn't seem like the smartest thing to do.
					// That was an encounter you don't wish to repeat.
					// Ha! You missed!
					from.SendLocalizedMessage(1062845 + Utility.Random(3));
				}
				else if (m_Item.EraSE && Utility.RandomDouble() > 0.20 && (from.Direction & Direction.Running) != 0 &&
						 DateTime.UtcNow - from.LastMoveTime < from.ComputeMovementSpeed(from.Direction))
				{
					// Didn't your parents ever tell you not to run with scissors in your hand?!
					from.SendLocalizedMessage(1063305);
				}
				else if (targeted is Item && !((Item)targeted).Movable)
				{
					if (targeted is IScissorable && (targeted is PlagueBeastInnard || targeted is PlagueBeastMutationCore))
					{
						var obj = (IScissorable)targeted;

						if (obj.Scissor(from, m_Item))
						{
							from.PlaySound(0x248);
						}
					}
				}
				else if (targeted is IScissorable)
				{
					var obj = (IScissorable)targeted;

					if (obj.Scissor(from, m_Item))
					{
						from.PlaySound(0x248);
					}
				}
				else
				{
					from.SendLocalizedMessage(502440); // Scissors can not be used on that to produce anything.
				}
			}
		public override void OnDoubleClick(Mobile from)
		{
			if (m_Statue != null)
			{
				from.SendGump(new CharacterPlinthGump(m_Statue));
			}
		}
Esempio n. 7
0
			protected override void OnTarget( Mobile from, object targeted )
			{
				if(from == null) return;

                PlayerMobile pm = targeted as PlayerMobile;
                if (pm != null && from.AccessLevel <= pm.AccessLevel)
                {
                    from.SendAsciiMessage("You can only do this to staff with lower privs");
                    return;
                }

				// does it have an xmldialog attachment?
				XmlDialog xd = XmlAttach.FindAttachment(targeted, typeof(XmlDialog)) as XmlDialog;

			    if(xd == null)
				{
					from.SendMessage("Target has no XmlDialog attachment");

					// TODO: ask whether they would like to add one
					from.SendGump( new XmlConfirmAddGump(from, targeted));

					return;
				}

				from.SendGump( new XmlEditDialogGump(from, true, xd, -1, 0, null, false, null, 0, 0));
			}
Esempio n. 8
0
 protected override void OnTarget(Mobile from, object targeted)
 {
     if (m_Tool != null && (targeted is Cloth || targeted is BoltOfCloth || targeted is BaseLeather))
         from.SendGump(new CraftGump(from, DefTailoring.CraftSystem, m_Tool, null));
     else
         from.SendAsciiMessage("You cant use this on that!");
 }
Esempio n. 9
0
        public override void OnDoubleClick(Mobile from)
        {
            if (this.Parent != null || !this.VerifyMove(from))
                return;

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

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

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

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

                    if (entry != null && entry.Safe)
                        from.SendGump(new LogoutGump(entry, this));
                }
            }
        }
Esempio n. 10
0
		public override void OnDoubleClick( Mobile from )
		{
			if ( IsChildOf( from.Backpack ) )
				from.SendGump( new CommandBookGump( from, this ) );
			else
				from.SendLocalizedMessage( 1042001 ); // must be in your pack for you to use it.
		}
Esempio n. 11
0
		public override void OnDoubleClick( Mobile from )
		{
			ttt = this;
			if( IsChildOf( from.Backpack ) )
			{
				fromBackpack = true;
				from.SendGump( new SelectGump( from, ttt ) );
			}
			else if( IsChildOf( from.BankBox ) )
			{
				fromBackpack = false;
				from.SendGump( new SelectGump( from, ttt ) );
			}
			else
				from.SendMessage( "This item has to either be in your backpack or bank" );
		}
Esempio n. 12
0
        public override void OnDoubleClick(Mobile from)
        {
            // Scriptiz : comment un int peut-il être null? ^^
            //if (from.HairItemID == null ) return;

            if (! ((from.BodyValue == 0x190) || (from.BodyValue == 0x191) ) )
            {
                from.SendMessage("Désolé, vous ne semblez pas morphologiquements compatible");
                return;
            }
            
            
            if ( !IsChildOf(from.Backpack) )
            {
                from.SendMessage("Ce serait beaucoup plus pratique s'il était sur vous");
                return ;
            }



            if ((from.HairItemID == 0x203C) || (from.HairItemID == 0x203D) || (from.HairItemID == 0x2049)) // respectivement cheveux longs, queue de cheval, tresses
            
                from.SendGump( new GrubanCheveuxGump() );

               
            else
            
                from.SendMessage("Désolé, il va falloir les laisser pousser un peu");
            
            
        }
		public override void OnDoubleClick( Mobile from )
		{
			if ( !from.InRange( GetWorldLocation(), 2 ) )
				from.SendLocalizedMessage( 500446 ); // That is too far away.
			else
				from.SendGump( new SkillStoneGump( this, from, 0 ) );
		}
        public override void OnDoubleClick(Mobile from)
        {
            if (IsChildOf(from.Backpack))
            {
                from.SendGump(new ScrollOfAbraxusGump());

                var pm = from as PlayerMobile;

                if (pm != null)
                {
                    var qs = pm.Quest;

                    if (qs is DarkTidesQuest)
                    {
                        var obj = qs.FindObjective(typeof (ReadAbraxusScrollObjective));

                        if (obj != null && !obj.Completed)
                            obj.Complete();
                    }
                }
            }
            else
            {
                from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
            }
        }
Esempio n. 15
0
		public override void OnDoubleClickSecureTrade( Mobile from )
		{
			if ( !from.InRange( GetWorldLocation(), 2 ) )
			{
				from.SendLocalizedMessage( 500446 ); // That is too far away.
			}
			else if ( m_Entries.Count == 0 )
			{
				from.SendLocalizedMessage( 1062381 ); // The book is empty.
			}
			else
			{
				from.SendGump( new BOBGump( (PlayerMobile)from, this ) );

				SecureTradeContainer cont = GetSecureTradeCont();

				if ( cont != null )
				{
					SecureTrade trade = cont.Trade;

					if ( trade != null && trade.From.Mobile == from )
						trade.To.Mobile.SendGump( new BOBGump( (PlayerMobile)(trade.To.Mobile), this ) );
					else if ( trade != null && trade.To.Mobile == from )
						trade.From.Mobile.SendGump( new BOBGump( (PlayerMobile)(trade.From.Mobile), this ) );
				}
			}
		}
Esempio n. 16
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is DyeTub)
                {
                    DyeTub tub = (DyeTub)targeted;

                    if (tub.Redyable)
                    {
                        if (tub.CustomHuePicker == null)
                            from.SendHuePicker(new InternalPicker(tub));
                        else
                            from.SendGump(new CustomHuePickerGump(from, tub.CustomHuePicker, new CustomHuePickerCallback(SetTubHue), tub));
                    }
                    else if (tub is BlackDyeTub)
                    {
                        from.SendLocalizedMessage(1010092); // You can not use this on a black dye tub.
                    }
                    else
                    {
                        from.SendMessage("That dye tub may not be redyed.");
                    }
                }
                else
                {
                    from.SendLocalizedMessage(500857); // Use this on a dye tub.
                }
            }
Esempio n. 17
0
 }// a house placement tool
 public override void OnDoubleClick(Mobile from)
 {
     if (this.IsChildOf(from.Backpack))
         from.SendGump(new HousePlacementCategoryGump(from));
     else
         from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
 }
Esempio n. 18
0
 private static void SendMessage(Mobile m)
 {
     Account acct = (Account)m.Account;
     m.CloseGump(typeof(MotDGump));
     m.SendGump(new MotDGump(m, LastMessage));
     acct.SetTag("MotD", "true");
 }
Esempio n. 19
0
        public override bool OnMoveOver( Mobile m )
        {
            if(m_refresh) {
                m.PlaySound( 0x214 );
                m.FixedEffect( 0x376A, 10, 16 );

                m.Resurrect();

                m.Hits = m.HitsMax;
                m.Stam = m.Dex;
                m.Mana = m.Int;
            } else {
                if ( !m.Alive && m.Map != null && m.Map.CanFit( m.Location, 16, false, false ) )
                {
                    m.PlaySound( 0x214 );
                    m.FixedEffect( 0x376A, 10, 16 );

                    m.CloseGump( typeof( ResurrectGump ) );
                    m.SendGump( new ResurrectGump( m ) );
                }
                else
                {
                    m.SendLocalizedMessage( 502391 ); // Thou can not be resurrected there!
                }
            }

            return false;
        }
        	public override void OnDoubleClick( Mobile from )
		{
			if ( from.Backpack == null || !IsChildOf( from.Backpack ) )
				from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
			else
				from.SendGump( new MemberAcceptGump( from, this ) );
		}
Esempio n. 21
0
        public override void OnDoubleClick(Mobile from)
        {
            base.OnDoubleClick(from);
            from.CloseGump(typeof(XmlQuestStatusGump));

            from.SendGump(new XmlQuestStatusGump(this, this.TitleString));
        }
Esempio n. 22
0
			protected override void OnTarget(Mobile from, object targeted)
			{
				if (from != null)
				{
					if (targeted != null && targeted is PlayerMobile)
					{
						PlayerMobile pm = (PlayerMobile)targeted;
						DuelPoints dp = null;

						if (DuelController.PointsTable.TryGetValue(pm.Serial, out dp))
						{
							from.SendGump(new DuelPlayerInfoGump(dp));
						}
						else
						{
							if (from == pm)
								from.SendMessage(53, "You have no dueling record.");
							else
								from.SendMessage(53, "That player has no dueling record.");
						}
					}
					else
					{
						from.SendMessage(32, "That's not a player!");
					}
				}
			}
Esempio n. 23
0
        public static void ApplyHungerStatMod(Mobile m)
        {
            if (m is PlayerMobile && m.AccessLevel == AccessLevel.Player)
            {
                m.CloseGump(typeof(HungerGump));
                m.SendGump(new HungerGump(m));
            }

            int HungerModStr = 0;

            if (m.Hunger == 0)
                HungerModStr = 0;
            else if (m.Hunger < 4)
                HungerModStr = 1;
            else if (m.Hunger < 8)
                HungerModStr = 2;
            else if (m.Hunger < 12)
                HungerModStr = 3;
            else if (m.Hunger < 16)
                HungerModStr = 4;
            else if (m.Hunger <= 20)
                HungerModStr = 5;

            m.AddStatMod(new StatMod(StatType.Str, "HungerModStr", HungerModStr, TimeSpan.Zero));
        }
Esempio n. 24
0
		public bool UseGate( Mobile m )
		{
			if ( m.Criminal )
			{
				m.SendLocalizedMessage( 1005561, "", 0x22 ); // Thou'rt a criminal and cannot escape so easily.
				return false;
			}
			else if ( SpellHelper.CheckCombat( m ) )
			{
				m.SendLocalizedMessage( 1005564, "", 0x22 ); // Wouldst thou flee during the heat of battle??
				return false;
			}
			else if ( m.Spell != null )
			{
				m.SendLocalizedMessage( 1049616 ); // You are too busy to do that at the moment.
				return false;
			}
			else
			{
				m.CloseGump( typeof( MoongateGump ) );
				m.SendGump( new MoongateGump( m, this ) );

				if ( !m.Hidden || m.AccessLevel == AccessLevel.Player )
					Effects.PlaySound( m.Location, m.Map, 0x20E );

				return true;
			}
		}
Esempio n. 25
0
		protected override void OnTargetFinish( Mobile from )
		{
			if ( !m_Plant.Deleted && m_Plant.PlantStatus < PlantStatus.DecorativePlant && m_Plant.PlantStatus != PlantStatus.BowlOfDirt && from.InRange( m_Plant.GetWorldLocation(), 3 ) && m_Plant.IsUsableBy( from ) )
			{
				from.SendGump( new ReproductionGump( m_Plant ) );
			}
		}
		public override void OnDoubleClick( Mobile from )
		{
			if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) )
				return;
			
			if ( m_UsesRemaining > 0 )
			{
				from.SendLocalizedMessage( 1072357 ); // Select an object to engrave.
				from.Target = new TargetWeapon( this );
			}
			else 
			{
				if ( from.Skills.Tinkering.Value == 0 )
				{
					from.SendLocalizedMessage( 1076179 ); // Since you have no tinkering skill, you will need to find an NPC tinkerer to repair this for you.					
				}
				else if ( from.Skills.Tinkering.Value < 75.0 )
				{		
					from.SendLocalizedMessage( 1076178 ); // Your tinkering skill is too low to fix this yourself.  An NPC tinkerer can help you repair this for a fee.
				}
				else
				{					
					Item diamond = from.Backpack.FindItemByType( typeof( BlueDiamond ) );	
					
					if ( diamond != null )
						from.SendGump( new ConfirmGump( this, null ) );	
					else					
						from.SendLocalizedMessage( 1076166 ); // You do not have a blue diamond needed to recharge the engraving tool.	
				}
				
				from.SendLocalizedMessage( 1076163 ); // There are no charges left on this engraving tool.
			}		
		}
Esempio n. 27
0
 public override void OnDoubleClick(Mobile from)
 {
     if (this.IsChildOf(from.Backpack))
         from.SendGump(new ConfirmBreakCrystalGump(this));
     else
         from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
 }
Esempio n. 28
0
        public override void OnDoubleClickSecureTrade(Mobile from)
        {
            if (!from.InRange(GetWorldLocation(), 2))
            {
                from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
            }
            else if (m_Entries.Count == 0)
            {
                from.SendLocalizedMessage(1062381); // The book is empty.
            }
            else
            {
                from.SendGump(new BOBGump((PlayerMobile)from, this));

                SecureTradeContainer cont = GetSecureTradeCont();

                if (cont != null)
                {
                    SecureTrade trade = cont.Trade;

                    if (trade != null && trade.From.Mobile == from)
                        trade.To.Mobile.SendGump(new BOBGump((PlayerMobile)(trade.To.Mobile), this));
                    else if (trade != null && trade.To.Mobile == from)
                        trade.From.Mobile.SendGump(new BOBGump((PlayerMobile)(trade.From.Mobile), this));
                }
            }
        }
Esempio n. 29
0
			protected override void OnTarget( Mobile from, object o )
			{
				if ( !BaseCommand.IsAccessible( from, o ) )
					from.SendMessage( "That is not accessible." );
				else
					from.SendGump( new PropertiesGump( from, o ) );
			}
Esempio n. 30
0
		public override void OnDoubleClick( Mobile from )
		{
			if ( from.AccessLevel >= AccessLevel.Seer )
				from.SendGump( new GuideGump( this, path ) );
			else
				base.OnDoubleClick( from );
		}
Esempio n. 31
0
 public void OnCompleted(Action continuation)
 {
     if (!IsCompleted && BodyId == -1)
     {
         Continuation = continuation;
         m_Caster?.SendGump(this);
     }
     else
     {
         continuation();
     }
 }
Esempio n. 32
0
 public override void OnClick(Mobile from, int page)
 {
     from.SendGump(new CategorizedAddGump(from, this, 0));
 }
Esempio n. 33
0
        public override void OnResponse(GameClient state, RelayInfo info)
        {
            Mobile from = m_Owner;

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

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

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

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

                break;
            }

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

                break;
            }

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

                break;
            }

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

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

                break;
            }
            }
        }
Esempio n. 34
0
        public static void EventSink_Speech(SpeechEventArgs e)
        {
            Mobile from = e.Mobile;

            if (e.Speech.ToLower().IndexOf("showladder") != -1)
            {
                if (m_Enabled)
                {
                    if (from != null)
                    {
                        if (m_Infos.ContainsKey(from.Serial))
                        {
                            DuelInfo info = m_Infos[from.Serial];

                            from.NonlocalOverheadMessage(Server.Network.MessageType.Regular, 1161, true, String.Format("I have {0} win{1} and {2} loss{3}.", info.Wins, (info.Wins != 1 ? "s" : ""), info.Losses, (info.Losses != 1 ? "es" : "")));
                            from.LocalOverheadMessage(Server.Network.MessageType.Regular, 1161, true, String.Format("I have {0} win{1} and {2} loss{3}.", info.Wins, (info.Wins != 1 ? "s" : ""), info.Losses, (info.Losses != 1 ? "es" : "")));
                        }
                        else
                        {
                            from.NonlocalOverheadMessage(Server.Network.MessageType.Regular, 1161, true, String.Format("I have not participated in any duels yet."));
                            from.LocalOverheadMessage(Server.Network.MessageType.Regular, 1161, true, String.Format("You have not participated in any duels yet."));
                        }
                    }
                }
                else
                {
                    from.SendMessage("The dueling system has been disabled.");
                }
            }

            if (e.Speech.ToLower().IndexOf("bank") != -1)
            {
                if (FindDuel(from) != null)
                {
                    e.Handled = true;
                    return;
                }
            }

            if (e.Speech.ToLower().IndexOf("top 10") != -1)
            {
                if (m_Enabled)
                {
                    from.CloseGump(typeof(TopTenGump));
                    from.SendGump(new TopTenGump(from));
                }
                else
                {
                    from.SendMessage("The dueling system has been disabled");
                }
            }

            if (e.Speech.ToLower().IndexOf("i wish to duel") != -1)
            {
                if (m_Enabled)
                {
                    if (from == null)
                    {
                        return;
                    }

                    if (!CanDuel(from))
                    {
                        return;
                    }

                    Duel duel = new Duel(from, null);

                    m_Duels.Add(duel);

                    duel.State = DuelState.Setup;

                    from.CloseGump(typeof(PlayerDuelAcceptGump));
                    from.CloseGump(typeof(PlayerDuelGump));
                    from.SendGump(new PlayerDuelGump(duel));
                }
                else
                {
                    from.SendMessage("The dueling system has been disabled.");
                }
            }
        }
Esempio n. 35
0
 protected override void OnTick()
 {
     m_Victim.SendGump(new ReportMurdererGump(m_Killers));
 }
Esempio n. 36
0
 public virtual void SendGump(Mobile from)
 {
     from.SendGump(new CampingSkillScrollGump(from, from, this));
 }
Esempio n. 37
0
            protected override void OnTick()
            {
                m_iCount++;

                m_From.DisruptiveAction();

                if (m_iCount < m_iCountMax)
                {
                    m_CraftSystem.PlayCraftEffect(m_From);
                }
                else
                {
                    m_From.EndAction <CraftSystem>();

                    var badCraft = m_CraftSystem.CanCraft(m_From, m_Tool, m_CraftItem.ItemType);

                    if (badCraft > 0)
                    {
                        if (m_Tool?.Deleted == false && m_Tool.UsesRemaining > 0)
                        {
                            m_From.SendGump(new CraftGump(m_From, m_CraftSystem, m_Tool, badCraft));
                        }
                        else
                        {
                            m_From.SendLocalizedMessage(badCraft);
                        }

                        return;
                    }

                    var quality = 1;

                    m_CraftItem.CheckSkills(m_From, m_TypeRes, m_CraftSystem, ref quality, out _, false);

                    var context = m_CraftSystem.GetContext(m_From);

                    if (context == null)
                    {
                        return;
                    }

                    if (typeof(CustomCraft).IsAssignableFrom(m_CraftItem.ItemType))
                    {
                        try
                        {
                            m_CraftItem.ItemType.CreateInstance <CustomCraft>(
                                m_From,
                                m_CraftItem,
                                m_CraftSystem,
                                m_TypeRes,
                                m_Tool,
                                quality
                                )?.EndCraftAction();
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine(e);
                        }

                        return;
                    }

                    var makersMark = false;

                    if (quality == 2 && m_From.Skills[m_CraftSystem.MainSkill].Base >= 100.0)
                    {
                        makersMark = m_CraftItem.IsMarkable(m_CraftItem.ItemType);
                    }

                    if (makersMark && context.MarkOption == CraftMarkOption.PromptForMark)
                    {
                        m_From.SendGump(
                            new QueryMakersMarkGump(
                                quality,
                                m_From,
                                m_CraftItem,
                                m_CraftSystem,
                                m_TypeRes,
                                m_Tool
                                )
                            );
                    }
                    else
                    {
                        if (context.MarkOption == CraftMarkOption.DoNotMark)
                        {
                            makersMark = false;
                        }

                        m_CraftItem.CompleteCraft(quality, makersMark, m_From, m_CraftSystem, m_TypeRes, m_Tool, null);
                    }
                }
            }
Esempio n. 38
0
        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 (m_Vendor is PlayerBarkeeper && !((PlayerBarkeeper)m_Vendor).IsOwner(from))
            {
                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));
                        }
                    }
                }
            }
        }
Esempio n. 39
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            if (info.ButtonID == 1 || info.ButtonID == 2) // See goods or Customize
            {
                m_Vendor.CheckTeleport(from);
            }

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

            switch (info.ButtonID)
            {
            case 1:     // See goods
            {
                m_Vendor.OpenBackpack(from);

                break;
            }

            case 2:     // Customize
            {
                from.SendGump(new NewPlayerVendorCustomizeGump(m_Vendor));

                break;
            }

            case 3:     // Rename Shop
            {
                m_Vendor.RenameShop(from);

                break;
            }

            case 4:     // Rename Vendor
            {
                m_Vendor.Rename(from);

                break;
            }

            case 5:     // Open Paperdoll
            {
                m_Vendor.DisplayPaperdollTo(from);

                break;
            }

            case 6:     // Collect Gold
            {
                m_Vendor.CollectGold(from);

                break;
            }

            case 7:     // Dismiss Vendor
            {
                m_Vendor.Dismiss(from);

                break;
            }
            }
        }
Esempio n. 40
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile m = sender.Mobile;

            _TextRelays = CreateList(info.TextEntries);

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

            case 1:
            {
                _Info.Skin++;
                m.SendGump(new ToolbarEdit(_Info, _Expanded));
                break;
            }

            case 2:
            {
                _Info.Skin--;
                m.SendGump(new ToolbarEdit(_Info, _Expanded));
                break;
            }

            case 3:
            {
                _Info.Rows++;
                m.SendGump(new ToolbarEdit(_Info, _Expanded));
                break;
            }

            case 4:
            {
                _Info.Rows--;
                m.SendGump(new ToolbarEdit(_Info, _Expanded));
                break;
            }

            case 5:
            {
                _Info.Collumns++;
                m.SendGump(new ToolbarEdit(_Info, _Expanded));
                break;
            }

            case 6:
            {
                _Info.Collumns--;
                m.SendGump(new ToolbarEdit(_Info, _Expanded));
                break;
            }

            case 9:                     // Default
            {
                var toolbarinfo = ToolbarInfo.DefaultEntries(m.AccessLevel);
                CombineEntries(toolbarinfo);
                toolbarinfo.AddRange(AnalyzeEntries(toolbarinfo.Count));
                _Info.Entries = toolbarinfo;
                m.SendGump(new ToolbarEdit(_Info, _Expanded));
                break;
            }

            case 10:                     // Okay
                goto case 12;

            case 11:                     // Cancel
                goto case 0;

            case 12:                     // Apply
            {
                ToolbarModule module = m.GetModule(typeof(ToolbarModule)) as ToolbarModule ?? new ToolbarModule(m);

                module.ToolbarInfo.Entries = AnalyzeEntries();

                module.ToolbarInfo.Phantom = info.IsSwitched(21);
                module.ToolbarInfo.Stealth = info.IsSwitched(23);
                module.ToolbarInfo.Reverse = info.IsSwitched(25);
                module.ToolbarInfo.Lock    = info.IsSwitched(27);

                if (info.ButtonID == 12)
                {
                    m.SendGump(new ToolbarEdit(_Info, _Expanded));
                }

                m.CloseGump(typeof(ToolbarGump));
                m.SendGump(new ToolbarGump(module.ToolbarInfo, m));

                break;
            }

            case 18:
            {
                _Info.Font++;
                m.SendGump(new ToolbarEdit(_Info, _Expanded));
                break;
            }

            case 19:
            {
                _Info.Font--;
                m.SendGump(new ToolbarEdit(_Info, _Expanded));
                break;
            }

            case 20:
            {
                m.SendGump(new ToolbarEdit(_Info, _Expanded));
                m.SendMessage(2101, "Phantom mode turns the toolbar semi-transparent.");
                break;
            }

            case 22:
            {
                m.SendGump(new ToolbarEdit(_Info, _Expanded));
                m.SendMessage(2101, "Stealth mode makes the toolbar automatically minimize when you click a button.");
                break;
            }

            case 24:
            {
                m.SendGump(new ToolbarEdit(_Info, _Expanded));
                m.SendMessage(2101, "Reverse mode puts the minimize bar above the toolbar instead of below.");
                break;
            }

            case 26:
            {
                m.SendGump(new ToolbarEdit(_Info, _Expanded));
                m.SendMessage(2101, "Lock mode disables closing the toolbar with right-click.");
                break;
            }

            case 28:                     // Expand
            {
                m.SendGump(new ToolbarEdit(_Info, !_Expanded));
                m.SendMessage(2101, "Expanded view {0}activated.", _Expanded ? "de" : "");
                break;
            }
            }
        }
Esempio n. 41
0
 public override void OnDoubleClick(Mobile from)
 {
     from.CloseGump(typeof(HolidayTreeChoiceGump));
     from.SendGump(new HolidayTreeChoiceGump(from, this));
 }
Esempio n. 42
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

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

            case 1:     // prefix
                from.SendGump(new ItemNameGump(m_ToReforge, m_Tool, m_Options, m_Prefix, m_Suffix, true));
                break;

            case 2:     // suffix
                from.SendGump(new ItemNameGump(m_ToReforge, m_Tool, m_Options, m_Prefix, m_Suffix, false));
                break;

            case 3:     // Reforge Item
            {
                if (!RunicReforging.CanReforge(from, m_ToReforge, m_Tool.CraftSystem))
                {
                    return;
                }

                int totalCharges = GetTotalCharges();

                if (m_Tool.UsesRemaining >= totalCharges)
                {
                    CraftResourceInfo resInfo = CraftResources.GetInfo(m_Tool.Resource);

                    if (resInfo == null)
                    {
                        return;
                    }

                    CraftAttributeInfo attrs = resInfo.AttributeInfo;

                    int min      = 10;
                    int max      = 80;
                    int maxprops = 5;

                    if (attrs != null)
                    {
                        min = attrs.RunicMinIntensity;
                        max = attrs.RunicMaxIntensity;

                        maxprops = Utility.RandomMinMax(attrs.RunicMinAttributes, attrs.RunicMaxAttributes);
                    }

                    if (min < 10)
                    {
                        min = 10;
                    }
                    if (max > 100)
                    {
                        max = 100;
                    }

                    int budget = GetBudget(ref maxprops);

                    ReforgedPrefix prefix = ReforgedPrefix.None;
                    ReforgedSuffix suffix = ReforgedSuffix.None;

                    if ((m_Options & ReforgingOption.GrandArtifice) != 0)
                    {
                        if (0.8 > Utility.RandomDouble())
                        {
                            maxprops++;
                        }

                        // choosing name 1
                        if ((m_Options & ReforgingOption.InspiredArtifice) != 0)
                        {
                            prefix = m_Prefix;

                            if (prefix == ReforgedPrefix.None)
                            {
                                from.SendLocalizedMessage(1152287);         // Re-forging failed. You did not choose a name! Please try again.
                                return;
                            }
                        }
                        else
                        {
                            // Not choosing name 1 or 2
                            if ((m_Options & ReforgingOption.SublimeArtifice) == 0)
                            {
                                // random prefix AND suffix
                                if ((m_Options & ReforgingOption.ExaltedArtifice) != 0)
                                {
                                    prefix = RunicReforging.ChooseRandomPrefix(m_ToReforge);
                                    suffix = RunicReforging.ChooseRandomSuffix(m_ToReforge, m_Prefix);
                                }
                                else         // random prefix OR suffix
                                {
                                    if (0.5 > Utility.RandomDouble())
                                    {
                                        prefix = RunicReforging.ChooseRandomPrefix(m_ToReforge);
                                    }
                                    else
                                    {
                                        suffix = RunicReforging.ChooseRandomSuffix(m_ToReforge, m_Prefix);
                                    }
                                }
                            }
                        }
                    }

                    if ((m_Options & ReforgingOption.ExaltedArtifice) != 0)
                    {
                        if ((m_Options & ReforgingOption.SublimeArtifice) != 0)
                        {
                            suffix = m_Suffix;

                            if (suffix == ReforgedSuffix.None)
                            {
                                from.SendLocalizedMessage(1152287);         // Re-forging failed. You did not choose a name! Please try again.
                                return;
                            }
                        }
                        else
                        {
                            suffix = RunicReforging.ChooseRandomSuffix(m_ToReforge, m_Prefix);
                            budget = Math.Min(800, budget + 50);
                        }
                    }

                    // 50% chance to switch prefix/suffix around
                    if ((prefix != ReforgedPrefix.None || suffix != ReforgedSuffix.None) && 0.5 > Utility.RandomDouble())
                    {
                        int pre = (int)prefix;
                        int suf = (int)suffix;

                        prefix = (ReforgedPrefix)suf;
                        suffix = (ReforgedSuffix)pre;
                    }

                    RunicReforging.ApplyReforgedProperties(m_ToReforge, prefix, suffix, true, budget, min, max, maxprops, 0, m_Tool, m_Options);

                    OnAfterReforged(m_ToReforge);
                    from.SendLocalizedMessage(1152286);         // You re-forge the item!
                    //from.FixedParticles(0x374A, 10, 30, 5021, EffectLayer.Head);
                    from.PlaySound(0x665);

                    m_Tool.UsesRemaining -= totalCharges;

                    if (m_Tool.UsesRemaining <= 0)
                    {
                        m_Tool.Delete();
                        from.SendLocalizedMessage(1044038);         // You have worn out your tool!
                    }
                }

                break;
            }

            case 4:
                from.SendGump(new ReforgingHelpGump());
                break;

            default:     // Option
            {
                ReforgingOption option = Options[info.ButtonID - 100];

                if (HasMetPrerequisite(option))
                {
                    if ((m_Options & option) == 0)
                    {
                        m_Options |= option;

                        if (m_Prefix != ReforgedPrefix.None && !RunicReforging.HasSelection((int)m_Prefix, m_ToReforge, m_Tool, m_Options, -1, -1))
                        {
                            m_Prefix         = ReforgedPrefix.None;
                            m_Context.Prefix = ReforgedPrefix.None;
                        }

                        if (m_Suffix != ReforgedSuffix.None && !RunicReforging.HasSelection((int)m_Suffix, m_ToReforge, m_Tool, m_Options, -1, -1))
                        {
                            m_Suffix         = ReforgedSuffix.None;
                            m_Context.Suffix = ReforgedSuffix.None;
                        }
                    }
                    else
                    {
                        m_Options ^= option;
                        InvalidatePrerequisite(option);
                    }

                    m_Context.Contexts[m_Tool] = m_Options;
                }

                from.SendGump(new RunicReforgingGump(from, m_ToReforge, m_Tool));
                break;
            }
            }
        }
Esempio n. 43
0
        public void CompleteCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CustomCraft customCraft)
        {
            int badCraft = craftSystem.CanCraft(from, tool, m_Type);

            if (badCraft > 0)
            {
                if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
                {
                    from.SendGump(new CraftGump(from, craftSystem, tool, badCraft));
                }
                else
                {
                    from.SendLocalizedMessage(badCraft);
                }

                return;
            }

            int    checkResHue = 0, checkMaxAmount = 0;
            object checkMessage = null;

            // Not enough resource to craft it
            if (!ConsumeRes(from, typeRes, craftSystem, ref checkResHue, ref checkMaxAmount, ConsumeType.None, ref checkMessage))
            {
                if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
                {
                    from.SendGump(new CraftGump(from, craftSystem, tool, checkMessage));
                }

                else if (checkMessage is int && (int)checkMessage > 0)
                {
                    from.SendLocalizedMessage((int)checkMessage);
                }

                else if (checkMessage is string)
                {
                    from.SendMessage((string)checkMessage);
                }

                return;
            }

            else if (!ConsumeAttributes(from, ref checkMessage, false))
            {
                if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
                {
                    from.SendGump(new CraftGump(from, craftSystem, tool, checkMessage));
                }

                else if (checkMessage is int && (int)checkMessage > 0)
                {
                    from.SendLocalizedMessage((int)checkMessage);
                }

                else if (checkMessage is string)
                {
                    from.SendMessage((string)checkMessage);
                }

                return;
            }

            bool toolBroken = false;

            int ignored    = 1;
            int endquality = 1;

            bool allRequiredSkills = true;

            if (CheckSkills(from, typeRes, craftSystem, ref ignored, ref allRequiredSkills))
            {
                // Resource
                int resHue    = 0;
                int maxAmount = 0;

                object message = null;

                // Not enough resource to craft it
                if (!ConsumeRes(from, typeRes, craftSystem, ref resHue, ref maxAmount, ConsumeType.All, ref message))
                {
                    if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
                    {
                        from.SendGump(new CraftGump(from, craftSystem, tool, message));
                    }

                    else if (message is int && (int)message > 0)
                    {
                        from.SendLocalizedMessage((int)message);
                    }

                    else if (message is string)
                    {
                        from.SendMessage((string)message);
                    }

                    return;
                }

                else if (!ConsumeAttributes(from, ref message, true))
                {
                    if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
                    {
                        from.SendGump(new CraftGump(from, craftSystem, tool, message));
                    }

                    else if (message is int && (int)message > 0)
                    {
                        from.SendLocalizedMessage((int)message);
                    }

                    else if (message is string)
                    {
                        from.SendMessage((string)message);
                    }

                    return;
                }

                tool.UsesRemaining--;

                if (craftSystem is DefBlacksmithy)
                {
                    AncientSmithyHammer hammer = from.FindItemOnLayer(Layer.OneHanded) as AncientSmithyHammer;

                    if (hammer != null && hammer != tool)
                    {
                        hammer.UsesRemaining--;

                        if (hammer.UsesRemaining < 1)
                        {
                            hammer.Delete();
                        }
                    }
                }

                if (tool.UsesRemaining < 1)
                {
                    toolBroken = true;
                }

                if (toolBroken)
                {
                    tool.Delete();
                }

                int num = 0;

                Item item;

                if (customCraft != null)
                {
                    item = customCraft.CompleteCraft(out num);
                }

                else if (typeof(MapItem).IsAssignableFrom(ItemType) && from.Map != Map.Trammel && from.Map != Map.Felucca)
                {
                    item = new IndecipherableMap();
                    from.SendLocalizedMessage(1070800); // The map you create becomes mysteriously indecipherable.
                }

                else
                {
                    item = Activator.CreateInstance(ItemType) as Item;
                }

                if (item != null)
                {
                    if (item is ICraftable)
                    {
                        endquality = ((ICraftable)item).OnCraft(quality, makersMark, from, craftSystem, typeRes, tool, this, resHue);

                        //TEST: CHECK THIS
                        if (craftSystem is DefCarpentry)
                        {
                            item.Hue = resHue;
                        }
                    }

                    else if (item.Hue == 0 && resHue != 0)
                    {
                        item.Hue = resHue;
                    }

                    if (maxAmount > 0)
                    {
                        if (!item.Stackable && item is IUsesRemaining)
                        {
                            ((IUsesRemaining)item).UsesRemaining *= maxAmount;
                        }

                        else
                        {
                            item.Amount = maxAmount;
                        }
                    }

                    item.CraftedBy   = from;
                    item.CrafterName = from.RawName;
                    item.ItemGroup   = ItemGroupType.Crafted;

                    if (m_Count > 1)
                    {
                        if (item.Stackable)
                        {
                            item.Amount = m_Count;
                            from.AddToBackpack(item);
                        }

                        else
                        {
                            for (int a = 0; a < m_Count; a++)
                            {
                                Item duplicate = Dupe.DupeItem(item);

                                if (duplicate != null)
                                {
                                    from.AddToBackpack(duplicate);
                                }
                            }
                        }
                    }

                    else
                    {
                        from.AddToBackpack(item);
                    }

                    if (from.AccessLevel > AccessLevel.Player)
                    {
                        CommandLogging.WriteLine(from, "Crafting {0} with craft system {1}", CommandLogging.Format(item), craftSystem.GetType().Name);
                    }
                }

                if (num == 0)
                {
                    num = craftSystem.PlayEndingEffect(from, false, true, toolBroken, endquality, makersMark, this);
                }

                bool queryFactionImbue = false;

                int availableSilver = 0;

                if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
                {
                    from.SendGump(new CraftGump(from, craftSystem, tool, num));
                }

                else if (num > 0)
                {
                    from.SendLocalizedMessage(num);
                }
            }

            else if (!allRequiredSkills)
            {
                if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
                {
                    from.SendGump(new CraftGump(from, craftSystem, tool, 1044153));
                }

                else
                {
                    from.SendLocalizedMessage(1044153); // You don't have the required skills to attempt this item.
                }
            }

            else
            {
                ConsumeType consumeType = (UseAllRes ? ConsumeType.Half : ConsumeType.All);

                int resHue    = 0;
                int maxAmount = 0;

                object message = null;

                // Not enough resource to craft it
                if (!ConsumeRes(from, typeRes, craftSystem, ref resHue, ref maxAmount, consumeType, ref message, true))
                {
                    if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
                    {
                        from.SendGump(new CraftGump(from, craftSystem, tool, message));
                    }

                    else if (message is int && (int)message > 0)
                    {
                        from.SendLocalizedMessage((int)message);
                    }

                    else if (message is string)
                    {
                        from.SendMessage((string)message);
                    }

                    return;
                }

                tool.UsesRemaining--;

                if (tool.UsesRemaining < 1)
                {
                    toolBroken = true;
                }

                if (toolBroken)
                {
                    tool.Delete();
                }

                int num = craftSystem.PlayEndingEffect(from, true, true, toolBroken, endquality, false, this);

                if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
                {
                    from.SendGump(new CraftGump(from, craftSystem, tool, num));
                }

                else if (num > 0)
                {
                    from.SendLocalizedMessage(num);
                }
            }
        }
Esempio n. 44
0
            protected override void OnTick()
            {
                m_iCount++;

                m_From.DisruptiveAction();

                if (m_iCount < m_iCountMax)
                {
                    m_CraftSystem.PlayCraftEffect(m_From);
                }

                else
                {
                    m_From.EndAction(typeof(CraftSystem));

                    int badCraft = m_CraftSystem.CanCraft(m_From, m_Tool, m_CraftItem.m_Type);

                    if (badCraft > 0)
                    {
                        if (m_Tool != null && !m_Tool.Deleted && m_Tool.UsesRemaining > 0)
                        {
                            m_From.SendGump(new CraftGump(m_From, m_CraftSystem, m_Tool, badCraft));
                        }

                        else
                        {
                            m_From.SendLocalizedMessage(badCraft);
                        }

                        return;
                    }

                    int  quality           = 1;
                    bool allRequiredSkills = true;

                    m_CraftItem.CheckSkills(m_From, m_TypeRes, m_CraftSystem, ref quality, ref allRequiredSkills, false);

                    CraftContext context = m_CraftSystem.GetContext(m_From);

                    if (context == null)
                    {
                        return;
                    }

                    if (typeof(CustomCraft).IsAssignableFrom(m_CraftItem.ItemType))
                    {
                        CustomCraft cc = null;

                        try { cc = Activator.CreateInstance(m_CraftItem.ItemType, new object[] { m_From, m_CraftItem, m_CraftSystem, m_TypeRes, m_Tool, quality }) as CustomCraft; }
                        catch { }

                        if (cc != null)
                        {
                            cc.EndCraftAction();
                        }

                        return;
                    }

                    bool makersMark = false;

                    if (quality == 2 && m_From.Skills[m_CraftSystem.MainSkill].Base >= 100.0)
                    {
                        makersMark = m_CraftItem.IsMarkable(m_CraftItem.ItemType);
                    }

                    if (makersMark && context.MarkOption == CraftMarkOption.PromptForMark)
                    {
                        m_From.SendGump(new QueryMakersMarkGump(quality, m_From, m_CraftItem, m_CraftSystem, m_TypeRes, m_Tool));
                    }

                    else
                    {
                        if (context.MarkOption == CraftMarkOption.DoNotMark)
                        {
                            makersMark = false;
                        }

                        m_CraftItem.CompleteCraft(quality, makersMark, m_From, m_CraftSystem, m_TypeRes, m_Tool, null);
                    }
                }
            }
Esempio n. 45
0
        public void EndCombine(Mobile from, object o)
        {
            if (o is Item && ((Item)o).IsChildOf(from.Backpack))
            {
                Type objectType = o.GetType();
                Item item       = o as Item;

                if (this.m_AmountCur >= this.m_AmountMax)
                {
                    from.SendLocalizedMessage(1045166); // The maximum amount of requested items have already been combined to this deed.
                }
                else if (this.m_Type == null || (objectType != this.m_Type && !objectType.IsSubclassOf(this.m_Type)) /*|| (!(o is BaseWeapon) && !(o is BaseArmor) && !(o is BaseClothing))*/)
                {
                    from.SendLocalizedMessage(1045169); // The item is not in the request.
                }
                else
                {
                    BulkMaterialType material = BulkMaterialType.None;

                    if (o is IResource)
                    {
                        material = GetMaterial(((IResource)o).Resource);
                    }

                    if (material != this.m_Material)
                    {
                        from.SendLocalizedMessage(1157310);  // The item is not made from the requested resource.
                    }
                    //daat99 OWLTR start - custom resource

                    /*
                     * if (m_Material >= BulkMaterialType.DullCopper && m_Material <= BulkMaterialType.Platinum && material != m_Material)
                     * {
                     * from.SendLocalizedMessage(1045168); // The item is not made from the requested ore.
                     * }
                     * else if (m_Material >= BulkMaterialType.Spined && m_Material <= BulkMaterialType.Ethereal && material != m_Material)
                     * {
                     * from.SendLocalizedMessage(1049352); // The item is not made from the requested leather type.
                     * }
                     * else if (m_Material >= BulkMaterialType.OakWood && m_Material <= BulkMaterialType.Petrified && material != m_Material)
                     * {
                     * from.SendMessage("The item is not made from the requested wood type."); // The item is not made from the requested leather type.
                     * }
                     */
                    //daat99 OWLTR end - custom resource
                    else
                    {
                        bool isExceptional = false;

                        if (o is IQuality)
                        {
                            isExceptional = (((IQuality)o).Quality == ItemQuality.Exceptional);
                        }

                        if (this.m_RequireExceptional && !isExceptional)
                        {
                            from.SendLocalizedMessage(1045167); // The item must be exceptional.
                        }
                        else
                        {
                            if (item.Amount > 1)
                            {
                                if (AmountCur + item.Amount > AmountMax)
                                {
                                    from.SendLocalizedMessage(1157222); // You have provided more than which has been requested by this deed.
                                    return;
                                }
                                else
                                {
                                    AmountCur += item.Amount;
                                    item.Delete();
                                }
                            }
                            else
                            {
                                item.Delete();
                                ++this.AmountCur;
                            }

                            from.SendLocalizedMessage(1045170); // The item has been combined with the deed.

                            from.SendGump(new SmallBODGump(from, this));

                            if (this.m_AmountCur < this.m_AmountMax)
                            {
                                this.BeginCombine(from);
                            }
                        }
                    }
                }
            }
            else
            {
                from.SendLocalizedMessage(1045158); // You must have the item in your backpack to target it.
            }
        }
Esempio n. 46
0
        public void Craft(Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool)
        {
            if (!tool.IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1044263); //The tool must be on your person to use.
                return;
            }

            if (from.BeginAction(typeof(CraftSystem)))
            {
                if (RequiredExpansion == Expansion.None || (from.NetState != null && from.NetState.SupportsExpansion(RequiredExpansion)))
                {
                    bool   allRequiredSkills = true;
                    double chance            = GetSuccessChance(from, typeRes, craftSystem, false, ref allRequiredSkills);

                    if (allRequiredSkills && chance >= 0.0)
                    {
                        if (this.Recipe == null || !(from is PlayerMobile) || ((PlayerMobile)from).HasRecipe(this.Recipe))
                        {
                            int badCraft = craftSystem.CanCraft(from, tool, m_Type);

                            if (badCraft <= 0)
                            {
                                int    resHue    = 0;
                                int    maxAmount = 0;
                                object message   = null;

                                if (ConsumeRes(from, typeRes, craftSystem, ref resHue, ref maxAmount, ConsumeType.None, ref message))
                                {
                                    message = null;

                                    if (ConsumeAttributes(from, ref message, false))
                                    {
                                        CraftContext context = craftSystem.GetContext(from);

                                        if (context != null)
                                        {
                                            context.OnMade(this);
                                        }

                                        int iMin    = craftSystem.MinCraftEffect;
                                        int iMax    = (craftSystem.MaxCraftEffect - iMin) + 1;
                                        int iRandom = Utility.Random(iMax);
                                        iRandom += iMin + 1;
                                        new InternalTimer(from, craftSystem, this, typeRes, tool, iRandom).Start();
                                    }

                                    else
                                    {
                                        from.EndAction(typeof(CraftSystem));
                                        from.SendGump(new CraftGump(from, craftSystem, tool, message));
                                    }
                                }

                                else
                                {
                                    from.EndAction(typeof(CraftSystem));
                                    from.SendGump(new CraftGump(from, craftSystem, tool, message));
                                }
                            }

                            else
                            {
                                from.EndAction(typeof(CraftSystem));
                                from.SendGump(new CraftGump(from, craftSystem, tool, badCraft));
                            }
                        }

                        else
                        {
                            from.EndAction(typeof(CraftSystem));
                            from.SendGump(new CraftGump(from, craftSystem, tool, 1072847)); // You must learn that recipe from a scroll.
                        }
                    }

                    else
                    {
                        from.EndAction(typeof(CraftSystem));
                        from.SendGump(new CraftGump(from, craftSystem, tool, 1044153)); // You don't have the required skills to attempt this item.
                    }
                }

                else
                {
                    from.EndAction(typeof(CraftSystem));
                    from.SendGump(new CraftGump(from, craftSystem, tool, RequiredExpansionMessage(RequiredExpansion))); //The {0} expansion is required to attempt this item.
                }
            }

            else
            {
                from.SendLocalizedMessage(500119); // You must wait to perform another action
            }
        }
Esempio n. 47
0
            public override void OnResponse(NetState sender, RelayInfo info)
            {
                if (info.ButtonID == 0 || m_Stone.IsEmpty)
                {
                    return;
                }

                Mobile from = sender.Mobile;

                if (!m_Stone.CheckUse(from))
                {
                    return;
                }

                if (info.ButtonID == 1) // Remove skill points
                {
                    from.SendGump(new ConfirmRemovalGump(m_Stone));
                    return;
                }

                SkillName skill      = m_Stone.Skill;
                double    skillValue = m_Stone.SkillValue;
                Skill     fromSkill  = from.Skills[m_Stone.Skill];

                /* If we have, say, 88.4 in our skill and the stone holds 100, we need
                 * 11.6 free points. Also, if we're below our skillcap by, say, 8.2 points,
                 * we only need 11.6 - 8.2 = 3.4 points.
                 */
                int requiredAmount = (int)(skillValue * 10) - fromSkill.BaseFixedPoint - (from.SkillsCap - from.SkillsTotal);

                bool cannotAbsorb = false;

                if (fromSkill.Lock != SkillLock.Up)
                {
                    cannotAbsorb = true;
                }
                else if (requiredAmount > 0)
                {
                    int available = 0;

                    for (int i = 0; i < from.Skills.Length; ++i)
                    {
                        if (from.Skills[i].Lock != SkillLock.Down)
                        {
                            continue;
                        }

                        available += from.Skills[i].BaseFixedPoint;
                    }

                    if (requiredAmount > available)
                    {
                        cannotAbsorb = true;
                    }
                }

                if (cannotAbsorb)
                {
                    // <CENTER>Unable to Absorb Selected Skill from Soulstone</CENTER>

                    /* You cannot absorb the selected skill from the Soulstone at this time. The selected
                     * skill may be locked or set to lower in your skill menu. You may also be at your
                     * total skill cap.  Click on "Skills" in your paperdoll menu to check your
                     * raise/locked/lower settings and your total skills.  Make any needed adjustments,
                     * then click "Continue". If you do not wish to transfer the selected skill at this
                     * time, click "Cancel".
                     */

                    from.SendGump(new ErrorGump(m_Stone, 1070717, 1070716));
                    return;
                }

                if (skillValue > fromSkill.Cap)
                {
                    // <CENTER>Unable to Absorb Selected Skill from Soulstone</CENTER>

                    /* The amount of skill stored in this stone exceeds your individual skill cap for
                     * that skill.  In order to retrieve the skill points stored in this stone, you must
                     * obtain a Power Scroll of the appropriate type and level in order to increase your
                     * skill cap.  You cannot currently retrieve the skill points stored in this stone.
                     */

                    from.SendGump(new ErrorGump(m_Stone, 1070717, 1070715));
                    return;
                }

                if (fromSkill.Base >= skillValue)
                {
                    // <CENTER>Unable to Absorb Selected Skill from Soulstone</CENTER>

                    /* You cannot transfer the selected skill to the Soulstone at this time. The selected
                     * skill has a skill level higher than what is stored in the Soulstone.
                     */

                    // Wrong message?!

                    from.SendGump(new ErrorGump(m_Stone, 1070717, 1070802));
                    return;
                }

                #region Scroll of ALacrity
                PlayerMobile pm = from as PlayerMobile;
                if (pm.AcceleratedStart > DateTime.UtcNow)
                {
                    // <CENTER>Unable to Absorb Selected Skill from Soulstone</CENTER>

                    /*You may not use a soulstone while your character is under the effects of a Scroll of Alacrity.*/

                    // Wrong message?!

                    from.SendGump(new ErrorGump(m_Stone, 1070717, 1078115));
                    return;
                }
                #endregion

                if (requiredAmount > 0)
                {
                    for (int i = 0; i < from.Skills.Length; ++i)
                    {
                        if (from.Skills[i].Lock != SkillLock.Down)
                        {
                            continue;
                        }

                        if (requiredAmount >= from.Skills[i].BaseFixedPoint)
                        {
                            requiredAmount     -= from.Skills[i].BaseFixedPoint;
                            from.Skills[i].Base = 0.0;
                        }
                        else
                        {
                            from.Skills[i].BaseFixedPoint -= requiredAmount;
                            break;
                        }
                    }
                }

                fromSkill.Base     = skillValue;
                m_Stone.SkillValue = 0.0;

                from.SendLocalizedMessage(1070713); // You have successfully absorbed the Soulstone's skill points.

                m_Stone.LastUserName = from.Name;

                Effects.SendLocationParticles(EffectItem.Create(from.Location, from.Map, EffectItem.DefaultDuration), 0, 0, 0, 0, 0, 5060, 0);
                Effects.PlaySound(from.Location, from.Map, 0x243);

                Effects.SendMovingParticles(new Entity(Server.Serial.Zero, new Point3D(from.X - 6, from.Y - 6, from.Z + 15), from.Map), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100);

                Effects.SendTargetParticles(from, 0x375A, 35, 90, 0x00, 0x00, 9502, (EffectLayer)255, 0x100);

                if (m_Stone is SoulstoneFragment)
                {
                    SoulstoneFragment frag = m_Stone as SoulstoneFragment;

                    if (--frag.UsesRemaining <= 0)
                    {
                        from.SendLocalizedMessage(1070974); // You have used up your soulstone fragment.
                    }
                }
            }
        public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            switch (info.ButtonID)
            {
            case 1:                     // Search
            {
                TextRelay te    = info.GetTextEntry(0);
                string    match = (te == null ? "" : te.Text.Trim());

                if (match.Length < 3)
                {
                    from.SendMessage("Invalid search string.");
                    from.SendGump(new XmlPartialCategorizedAddGump(from, match, m_Page, m_SearchResults, false, m_EntryIndex, m_Gump));
                }
                else
                {
                    from.SendGump(new XmlPartialCategorizedAddGump(from, match, 0, Match(match), true, m_EntryIndex, m_Gump));
                }

                break;
            }

            case 2:                     // Previous page
            {
                if (m_Page > 0)
                {
                    from.SendGump(new XmlPartialCategorizedAddGump(from, m_SearchString, m_Page - 1, m_SearchResults, true, m_EntryIndex, m_Gump));
                }

                break;
            }

            case 3:                     // Next page
            {
                if ((m_Page + 1) * 10 < m_SearchResults.Count)
                {
                    from.SendGump(new XmlPartialCategorizedAddGump(from, m_SearchString, m_Page + 1, m_SearchResults, true, m_EntryIndex, m_Gump));
                }

                break;
            }

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

                if (index >= 0 && index < m_SearchResults.Count)
                {
                    Type type = ((SearchEntry)m_SearchResults[index]).EntryType;

                    if (m_Gump is XmlAddGump && type != null)
                    {
                        XmlAddGump m_XmlAddGump = (XmlAddGump)m_Gump;
                        if (type != null && m_XmlAddGump.defs != null && m_XmlAddGump.defs.NameList != null &&
                            m_EntryIndex >= 0 && m_EntryIndex < m_XmlAddGump.defs.NameList.Length)
                        {
                            m_XmlAddGump.defs.NameList[m_EntryIndex] = type.Name;
                            XmlAddGump.Refresh(from, true);
                        }
                    }
                    else
                    if (m_Spawner != null && type != null)
                    {
                        XmlSpawnerGump xg = m_Spawner.SpawnerGump;

                        if (xg != null)
                        {
                            xg.Rentry          = new XmlSpawnerGump.ReplacementEntry();
                            xg.Rentry.Typename = type.Name;
                            xg.Rentry.Index    = m_EntryIndex;
                            xg.Rentry.Color    = 0x1436;

                            Timer.DelayCall(TimeSpan.Zero, new TimerStateCallback(XmlSpawnerGump.Refresh_Callback), new object[] { from });
                            //from.CloseGump(typeof(XmlSpawnerGump));
                            //from.SendGump( new XmlSpawnerGump(xg.m_Spawner, xg.X, xg.Y, xg.m_ShowGump, xg.xoffset, xg.page, xg.Rentry) );
                        }
                    }
                }

                break;
            }
            }
        }
Esempio n. 49
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            if (m_From.AccessLevel < AccessLevel.Administrator)
            {
                return;
            }

            if (m_Response == null)
            {
                int index = info.ButtonID - 1;

                if (index == 0)
                {
                    PredefinedResponse resp = new PredefinedResponse("", "");

                    ArrayList list = PredefinedResponse.List;
                    list.Add(resp);

                    m_From.SendGump(new PredefGump(m_From, resp));
                }
                else
                {
                    --index;

                    int type = index % 3;
                    index /= 3;

                    ArrayList list = PredefinedResponse.List;

                    if (index >= 0 && index < list.Count)
                    {
                        PredefinedResponse resp = (PredefinedResponse)list[index];

                        switch (type)
                        {
                        case 0:     // edit
                        {
                            m_From.SendGump(new PredefGump(m_From, resp));
                            break;
                        }

                        case 1:     // move up
                        {
                            if (index > 0)
                            {
                                list.RemoveAt(index);
                                list.Insert(index - 1, resp);

                                PredefinedResponse.Save();
                                m_From.SendGump(new PredefGump(m_From, null));
                            }

                            break;
                        }

                        case 2:     // move down
                        {
                            if (index < (list.Count - 1))
                            {
                                list.RemoveAt(index);
                                list.Insert(index + 1, resp);

                                PredefinedResponse.Save();
                                m_From.SendGump(new PredefGump(m_From, null));
                            }

                            break;
                        }
                        }
                    }
                }
            }
            else
            {
                ArrayList list = PredefinedResponse.List;

                switch (info.ButtonID)
                {
                case 1:
                {
                    list.Remove(m_Response);

                    PredefinedResponse.Save();
                    m_From.SendGump(new PredefGump(m_From, null));
                    break;
                }

                case 2:
                {
                    TextRelay te = info.GetTextEntry(0);

                    if (te != null)
                    {
                        m_Response.Title = te.Text;
                    }

                    PredefinedResponse.Save();
                    m_From.SendGump(new PredefGump(m_From, m_Response));

                    break;
                }

                case 3:
                {
                    TextRelay te = info.GetTextEntry(1);

                    if (te != null)
                    {
                        m_Response.Message = te.Text;
                    }

                    PredefinedResponse.Save();
                    m_From.SendGump(new PredefGump(m_From, m_Response));

                    break;
                }
                }
            }
        }
 public virtual void SendGump(Mobile from)
 {
     from.SendGump(new VeterinarySkillScrollGump(from, from, this));
 }
Esempio n. 51
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 InternalMobilesGump(from, m_Names, m_Page - 1));
                }

                break;
            }

            case 2:                     // Next
            {
                if ((m_Page + 1) * EntryCount < m_Names.Count)
                {
                    if (from != null)
                    {
                        from.SendGump(new InternalMobilesGump(from, m_Names, m_Page + 1));
                    }
                }
                break;
            }

            case 3:                     // Wipe All Listed
            {
                from.SendGump(new WipeAllGump(from, m_Names));
                break;
            }

            default:
            {
                int  index    = (m_Page * EntryCount) + (info.ButtonID - 4);
                bool deleting = index < 1000;
                if (!deleting)
                {
                    index -= 1000;
                }

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

                    if (s.Deleted)
                    {
                        from.SendMessage("That mobile no longer exists.");
                        from.SendGump(new InternalMobilesGump(from, m_Names, m_Page));
                    }
                    else
                    {
                        if (deleting)
                        {
                            from.SendGump(new DeleteGump(from, m_Names, index));
                        }
                    }
                }

                break;
            }
            }
        }
Esempio n. 52
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            int index = info.ButtonID - 1;

            if (index >= 0 && index < m_Entries.Length)
            {
                SummonFamiliarEntry entry = m_Entries[index];

                double necro  = m_From.Skills[SkillName.Necromancy].Value;
                double spirit = m_From.Skills[SkillName.SpiritSpeak].Value;

                BaseCreature check = (BaseCreature)SummonFamiliarSpell.Table[m_From];

                #region Dueling
                if (m_From is PlayerMobile && ((PlayerMobile)m_From).DuelContext != null && !((PlayerMobile)m_From).DuelContext.AllowSpellCast(m_From, m_Spell))
                {
                }
                #endregion
                else if (check != null && !check.Deleted)
                {
                    m_From.SendLocalizedMessage(1061605);                       // You already have a familiar.
                }
                else if (necro < entry.ReqNecromancy || spirit < entry.ReqSpiritSpeak)
                {
                    // That familiar requires ~1_NECROMANCY~ Necromancy and ~2_SPIRIT~ Spirit Speak.
                    m_From.SendLocalizedMessage(1061606, String.Format("{0:F1}\t{1:F1}", entry.ReqNecromancy, entry.ReqSpiritSpeak));

                    m_From.CloseGump(typeof(SummonFamiliarGump));
                    m_From.SendGump(new SummonFamiliarGump(m_From, SummonFamiliarSpell.Entries, m_Spell));
                }
                else if (entry.Type == null)
                {
                    m_From.SendMessage("That familiar has not yet been defined.");

                    m_From.CloseGump(typeof(SummonFamiliarGump));
                    m_From.SendGump(new SummonFamiliarGump(m_From, SummonFamiliarSpell.Entries, m_Spell));
                }
                else
                {
                    try
                    {
                        BaseCreature bc = (BaseCreature)Activator.CreateInstance(entry.Type);

                        bc.Skills.MagicResist = m_From.Skills.MagicResist;

                        if (BaseCreature.Summon(bc, m_From, m_From.Location, -1, TimeSpan.FromDays(1.0)))
                        {
                            m_From.FixedParticles(0x3728, 1, 10, 9910, EffectLayer.Head);
                            bc.PlaySound(bc.GetIdleSound());
                            SummonFamiliarSpell.Table[m_From] = bc;
                        }
                    }
                    catch
                    {
                    }
                }
            }
            else
            {
                m_From.SendLocalizedMessage(1061825);                   // You decide not to summon a familiar.
            }
        }
Esempio n. 53
0
        private static bool CheckResponse(Gump gump, Mobile m, int id)
        {
            if (m == null || !m.Player)
            {
                return(true);
            }

            TownHouse th = null;

            ArrayList list = new ArrayList();

            foreach (Item item in m.GetItemsInRange(20))
            {
                if (item is TownHouse)
                {
                    list.Add(item);
                }
            }

            foreach (TownHouse t in list)
            {
                if (t.Owner == m)
                {
                    th = t;
                    break;
                }
            }

            if (th == null || th.ForSaleSign == null)
            {
                return(true);
            }

            if (gump is HouseGumpAOS)
            {
                int val = id - 1;

                if (val < 0)
                {
                    return(true);
                }

                int type  = val % 15;
                int index = val / 15;

                if (th.ForSaleSign.ForcePublic && type == 3 && index == 12 && th.Public)
                {
                    m.SendMessage("This house cannot be private.");
                    m.SendGump(gump);
                    return(false);
                }

                if (th.ForSaleSign.ForcePrivate && type == 3 && index == 13 && !th.Public)
                {
                    m.SendMessage("This house cannot be public.");
                    m.SendGump(gump);
                    return(false);
                }

                if (th.ForSaleSign.NoTrade && type == 6 && index == 1)
                {
                    m.SendMessage("This house cannot be traded.");
                    m.SendGump(gump);
                    return(false);
                }
            }
            else if (gump is HouseGump)
            {
                if (th.ForSaleSign.ForcePublic && id == 17 && th.Public)
                {
                    m.SendMessage("This house cannot be private.");
                    m.SendGump(gump);
                    return(false);
                }

                if (th.ForSaleSign.ForcePrivate && id == 17 && !th.Public)
                {
                    m.SendMessage("This house cannot be public.");
                    m.SendGump(gump);
                    return(false);
                }

                if (th.ForSaleSign.NoTrade && id == 14)
                {
                    m.SendMessage("This house cannot be traded.");
                    m.SendGump(gump);
                    return(false);
                }
            }

            return(true);
        }
Esempio n. 54
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            if (info.ButtonID == 0 || m_Plant.Deleted || m_Plant.PlantStatus != PlantStatus.Stage9)
            {
                return;
            }

            if (info.ButtonID == 3 && !from.InRange(m_Plant.GetWorldLocation(), 3))
            {
                from.LocalOverheadMessage(MessageType.Regular, 0x3E9, 500446);                   // That is too far away.
                return;
            }

            if (!m_Plant.IsUsableBy(from))
            {
                m_Plant.LabelTo(from, 1061856);                   // You must have the item in your backpack or locked down in order to use it.
                return;
            }

            switch (info.ButtonID)
            {
            case 1:                     // Cancel
            {
                from.SendGump(new ReproductionGump(m_Plant));

                break;
            }

            case 2:                                        // Help
            {
                from.Send(new DisplayHelpTopic(70, true)); // DECORATIVE MODE

                from.SendGump(new SetToDecorativeGump(m_Plant));

                break;
            }

            case 3:                     // Ok
            {
                m_Plant.PlantStatus = PlantStatus.DecorativePlant;
                m_Plant.LabelTo(from, 1053077);                           // You prune the plant. This plant will no longer produce resources or seeds, but will require no upkeep.

                if (!m_Plant.RequiresUpkeep || m_Plant.MaginciaPlant)
                {
                    m_Plant.Movable = true;

                    if (m_Plant is MaginciaPlantItem)
                    {
                        ((MaginciaPlantItem)m_Plant).SetToDecorative = DateTime.Now;
                    }

                    if (from.Backpack != null)
                    {
                        from.Backpack.TryDropItem(from, m_Plant, false);
                    }

                    if (m_Plant is RaisedGardenPlantItem)
                    {
                        RaisedGardenPlantItem rp = m_Plant as RaisedGardenPlantItem;

                        if (rp.Component != null)
                        {
                            rp.Component.Plant = null;
                            rp.Component       = null;
                        }
                    }
                }

                break;
            }
            }
        }
Esempio n. 55
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

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

            switch (info.ButtonID)
            {
            case 0:     // CLOSE
            {
                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

                break;
            }

            case 1:     // Female/Male
            {
                if (m_Vendor.Female)
                {
                    m_Vendor.BodyValue = 400;
                    m_Vendor.Female    = false;
                }
                else
                {
                    m_Vendor.BodyValue = 401;
                    m_Vendor.Female    = true;

                    m_Vendor.FacialHairItemID = 0;
                }

                from.SendGump(new NewPlayerVendorCustomizeGump(m_Vendor));

                break;
            }

            case 2:     // Remove hair
            {
                m_Vendor.HairItemID = 0;

                from.SendGump(new NewPlayerVendorCustomizeGump(m_Vendor));

                break;
            }

            case 3:     // Color hair
            {
                if (m_Vendor.HairItemID > 0)
                {
                    new PVHuePicker(m_Vendor, false, from).SendTo(from.NetState);
                }
                else
                {
                    from.SendGump(new NewPlayerVendorCustomizeGump(m_Vendor));
                }

                break;
            }

            case 4:     // Remove beard
            {
                m_Vendor.FacialHairItemID = 0;

                from.SendGump(new NewPlayerVendorCustomizeGump(m_Vendor));

                break;
            }

            case 5:     // Color beard
            {
                if (m_Vendor.FacialHairItemID > 0)
                {
                    new PVHuePicker(m_Vendor, true, from).SendTo(from.NetState);
                }
                else
                {
                    from.SendGump(new NewPlayerVendorCustomizeGump(m_Vendor));
                }

                break;
            }

            default:
            {
                int hairhue = 0;

                if ((info.ButtonID & 0x100) != 0)         // Hair style selected
                {
                    int index = info.ButtonID & 0xFF;

                    if (index >= m_HairStyles.Length)
                    {
                        return;
                    }

                    HairOrBeard hairStyle = m_HairStyles[index];

                    hairhue = m_Vendor.HairHue;

                    m_Vendor.HairItemID = 0;
                    m_Vendor.ProcessDelta();

                    m_Vendor.HairItemID = hairStyle.ItemID;

                    m_Vendor.HairHue = hairhue;

                    from.SendGump(new NewPlayerVendorCustomizeGump(m_Vendor));
                }
                else if ((info.ButtonID & 0x200) != 0)         // Beard style selected
                {
                    if (m_Vendor.Female)
                    {
                        return;
                    }

                    int index = info.ButtonID & 0xFF;

                    if (index >= m_BeardStyles.Length)
                    {
                        return;
                    }

                    HairOrBeard beardStyle = m_BeardStyles[index];

                    hairhue = m_Vendor.FacialHairHue;

                    m_Vendor.FacialHairItemID = 0;
                    m_Vendor.ProcessDelta();

                    m_Vendor.FacialHairItemID = beardStyle.ItemID;

                    m_Vendor.FacialHairHue = hairhue;

                    from.SendGump(new NewPlayerVendorCustomizeGump(m_Vendor));
                }

                break;
            }
            }
        }
Esempio n. 56
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            if (from == null)
            {
                return;
            }
            if (from.Deleted)
            {
                return;
            }
            if (player == null)
            {
                return;
            }
            if (player.Deleted)
            {
                return;
            }

            bool resendGump = false;

            ChatPersistance.CheckAndCreateWorldChatAccountEntry(player);

            int m_PageNumber = player.m_WorldChatAccountEntry.m_PlayersSquelchedPage;

            int TotalPlayersSquelched = player.m_WorldChatAccountEntry.m_PlayersSquelched.Count;

            int m_TotalPages = (int)(Math.Ceiling((double)TotalPlayersSquelched / (double)EntriesPerPage));

            if (m_TotalPages == 0)
            {
                m_TotalPages = 1;
            }

            if (m_PageNumber < 1)
            {
                m_PageNumber = 1;
            }

            if (m_PageNumber > m_TotalPages)
            {
                m_PageNumber = m_TotalPages;
            }

            player.m_WorldChatAccountEntry.m_PlayersSquelchedPage = m_PageNumber;

            //Filter By Name
            if (info.ButtonID == 1)
            {
                if (player.m_WorldChatAccountEntry.m_FilterMode != WorldChatAccountEntry.FilterMode.Name)
                {
                    player.m_WorldChatAccountEntry.m_FilterMode           = WorldChatAccountEntry.FilterMode.Name;
                    player.m_WorldChatAccountEntry.m_PlayersSquelchedPage = 1;

                    ChatPersistance.SortSquelchedPlayersByName(player.m_WorldChatAccountEntry);
                }

                resendGump = true;
            }

            //Filter By Date Squelched
            if (info.ButtonID == 2)
            {
                if (player.m_WorldChatAccountEntry.m_FilterMode != WorldChatAccountEntry.FilterMode.Date)
                {
                    player.m_WorldChatAccountEntry.m_FilterMode           = WorldChatAccountEntry.FilterMode.Date;
                    player.m_WorldChatAccountEntry.m_PlayersSquelchedPage = 1;

                    ChatPersistance.SortSquelchedPlayersByDate(player.m_WorldChatAccountEntry);
                }

                resendGump = true;
            }

            //Previous
            if (info.ButtonID == 3)
            {
                if (player.m_WorldChatAccountEntry.m_PlayersSquelchedPage > 1)
                {
                    player.m_WorldChatAccountEntry.m_PlayersSquelchedPage--;
                }

                resendGump = true;
            }

            //Next
            if (info.ButtonID == 4)
            {
                if (player.m_WorldChatAccountEntry.m_PlayersSquelchedPage < m_TotalPages)
                {
                    player.m_WorldChatAccountEntry.m_PlayersSquelchedPage++;
                }

                resendGump = true;
            }

            //Enable World Chat
            if (info.ButtonID == 5)
            {
                player.m_WorldChatAccountEntry.Enabled = !player.m_WorldChatAccountEntry.Enabled;

                if (player.m_WorldChatAccountEntry.Enabled)
                {
                    player.SendMessage("WorldChat is now enabled.");
                }

                else
                {
                    player.SendMessage("WorldChat is now disabled. You will no longer hear WorldChat messages.");
                }

                resendGump = true;
            }

            //Add
            if (info.ButtonID == 6)
            {
                player.SendMessage("Please enter the name of the player to add to your World Chat Ignore List.");
                player.Prompt = new WorldChatSquelchPlayerPrompt(player);

                resendGump = true;
            }

            //Set Font Color
            if (info.ButtonID == 7)
            {
                if (player.NetState != null)
                {
                    from.CloseGump(typeof(WorldChatGump));
                    from.SendGump(new WorldChatGump(player));

                    new WorldChatGlobalTextHuePicker(player).SendTo(player.NetState);

                    return;
                }
            }

            //Remove Entry
            if (info.ButtonID >= 10 && info.ButtonID <= 19)
            {
                PlayerSquelchEntry squelchEntry = null;

                int entryIndex = (m_PageNumber - 1) * EntriesPerPage + (info.ButtonID - 10);

                if (entryIndex < player.m_WorldChatAccountEntry.m_PlayersSquelched.Count)
                {
                    player.m_WorldChatAccountEntry.m_PlayersSquelched.RemoveAt(entryIndex);
                }

                resendGump = true;
            }

            //Squelch By Account
            if (info.ButtonID >= 20 && info.ButtonID <= 29)
            {
                PlayerSquelchEntry squelchEntry = null;

                int entryIndex = (m_PageNumber - 1) * EntriesPerPage + (info.ButtonID - 20);

                if (entryIndex < player.m_WorldChatAccountEntry.m_PlayersSquelched.Count)
                {
                    squelchEntry = player.m_WorldChatAccountEntry.m_PlayersSquelched[entryIndex];
                    squelchEntry.m_SquelchEntireAccount = !squelchEntry.m_SquelchEntireAccount;
                }

                resendGump = true;
            }

            //--------------------

            if (resendGump)
            {
                from.CloseGump(typeof(WorldChatGump));
                from.SendGump(new WorldChatGump(player));
            }
        }
Esempio n. 57
0
        public override void OnDoubleClick(Mobile from)
        {
            if (m_sower == null || m_sower.Deleted)
            {
                m_sower = from;
            }

            if (from.Mounted && !CropHelper.CanWorkMounted)
            {
                from.SendMessage("You cannot harvest a crop while mounted.");
                return;
            }

            if (DateTime.Now > lastpicked.AddSeconds(3))               // 3 seconds between picking
            {
                lastpicked = DateTime.Now;

                int tailorValue = (int)from.Skills[SkillName.Tailoring].Value / 20;
                if (tailorValue == 0)
                {
                    from.SendMessage("You have no idea how to harvest this crop.");
                    return;
                }

                if (from.InRange(this.GetWorldLocation(), 1))
                {
                    if (m_yield < 1)
                    {
                        from.SendMessage("There is nothing here to harvest.");

                        if (PlayerCanDestroy && !(m_sower.AccessLevel > AccessLevel.Counselor))
                        {
                            UpRootGump g = new UpRootGump(from, this);
                            from.SendGump(g);
                        }
                    }
                    else                     //check skill and sower
                    {
                        from.Direction = from.GetDirectionTo(this);

                        from.Animate(from.Mounted ? 29:32, 5, 1, true, false, 0);

                        if (from == m_sower)
                        {
                            tailorValue *= 2;
                            m_lastvisit  = DateTime.Now;
                        }

                        if (tailorValue > m_yield)
                        {
                            tailorValue = m_yield + 1;
                        }

                        int pick = Utility.Random(tailorValue);
                        if (pick == 0)
                        {
                            from.SendMessage("You do not manage to harvest any crops.");
                            return;
                        }

                        m_yield -= pick;
                        from.SendMessage("You pick {0} bundle{1} of flax!", pick, (pick == 1 ? "" : "s"));

                        double chance = Utility.RandomDouble(); // chance to get a seed is 20%
                        if (0.20 > chance)
                        {
                            from.AddToBackpack(new FlaxSeed(1));
                            from.SendMessage("You found a seed!");
                        }

                        //PublicOverheadMessage( MessageType.Regular, 0x3BD, false, string.Format( "{0}", m_yield ));
                        ((Item)this).ItemID = pickedGraphic;

                        Flax crop = new Flax(pick);
                        from.AddToBackpack(crop);

                        chance = Utility.RandomDouble(); // chance to pull out plant is 10%
                        if ((0.10 > chance) && !(m_sower.AccessLevel > AccessLevel.Counselor))
                        {
                            from.SendMessage("You accidently pull the flax plant out of the ground!");
                            regrowTimer.Stop();
                            this.Delete();
                            return;
                        }

                        if (SowerPickTime != TimeSpan.Zero && m_lastvisit + SowerPickTime < DateTime.Now && !(m_sower.AccessLevel > AccessLevel.Counselor))
                        {
                            this.UpRoot(from);
                            return;
                        }

                        if (!regrowTimer.Running)
                        {
                            regrowTimer.Start();
                        }
                    }
                }
                else
                {
                    from.SendMessage("You are too far away to harvest anything.");
                }
            }
        }
Esempio n. 58
0
        /*public override void OnDoubleClick(Mobile from)
         *      {
         *              if(from.InRange(this.Location, 3) && from.Backpack != null)
         *              {
         *                      WarehouseContainer container = MaginciaBazaar.ClaimContainer(from);
         *
         *                      if(container != null)
         *                              TryTransferItems(from, container);
         *              }
         *      }*/

        public void TryTransfer(Mobile from, StorageEntry entry)
        {
            if (entry == null)
            {
                return;
            }

            int fees = entry.Funds;

            if (fees < 0)
            {
                int owed = fees * -1;
                SayTo(from, String.Format("It looks like you owe {0}gp as back fees. How much would you like to pay now?", owed.ToString("###,###,###")));
                from.Prompt = new BackfeePrompt(this, entry);
                return;
            }

            if (!TryPayFunds(from, entry))
            {
                from.SendGump(new BazaarInformationGump(1150681, 1150678)); // Some personal possessions that were equipped on the broker still remain in storage, because your backpack cannot hold them. Please free up space in your backpack and return to claim these items.
                return;
            }

            if (entry.Creatures.Count > 0)
            {
                List <BaseCreature> list = new List <BaseCreature>(entry.Creatures);

                foreach (BaseCreature bc in list)
                {
                    if (from.Stabled.Count < AnimalTrainer.GetMaxStabled(from))
                    {
                        bc.Blessed      = false;
                        bc.ControlOrder = OrderType.Stay;
                        bc.Internalize();
                        bc.IsStabled = true;
                        bc.Loyalty   = BaseCreature.MaxLoyalty; // Wonderfully happy
                        from.Stabled.Add(bc);
                        bc.SetControlMaster(null);
                        bc.SummonMaster = null;

                        entry.RemovePet(bc);
                    }
                    else
                    {
                        from.SendGump(new BazaarInformationGump(1150681, 1150678)); // Some personal possessions that were equipped on the broker still remain in storage, because your backpack cannot hold them. Please free up space in your backpack and return to claim these items.
                        return;
                    }
                }

                ColUtility.Free(list);
            }

            if (entry.CommodityTypes.Count > 0)
            {
                Dictionary <Type, int> copy = new Dictionary <Type, int>(entry.CommodityTypes);

                foreach (KeyValuePair <Type, int> commodities in copy)
                {
                    Type type = commodities.Key;
                    int  amt  = commodities.Value;

                    if (!GiveItems(from, type, amt, entry))
                    {
                        from.SendGump(new BazaarInformationGump(1150681, 1150678)); // Some personal possessions that were equipped on the broker still remain in storage, because your backpack cannot hold them. Please free up space in your backpack and return to claim these items.
                        return;
                    }
                }

                copy.Clear();
            }

            entry.CommodityTypes.Clear();
            ColUtility.Free(entry.Creatures);

            from.SendGump(new BazaarInformationGump(1150681, 1150677)); // There are no longer any items or funds in storage for your former bazaar stall. Thank you for your diligence in recovering your possessions.
            MaginciaBazaar.RemoveFromStorage(from);
        }
Esempio n. 59
0
        private static void EventSink_Speech(SpeechEventArgs e)
        {
            Mobile from = e.Mobile;

            int[] keywords = e.Keywords;

            for (int i = 0; i < keywords.Length; ++i)
            {
                switch (keywords[i])
                {
                case 0x00E4:                         // *i wish to access the city treasury*
                {
                    Town town = Town.FromRegion(from.Region);

                    if (town == null || !town.IsFinance(from) || !from.Alive)
                    {
                        break;
                    }

                    if (FactionGump.Exists(from))
                    {
                        from.SendLocalizedMessage(1042160);                                           // You already have a faction menu open.
                    }
                    else if (town.Owner != null && from is PlayerMobile)
                    {
                        from.SendGump(new FinanceGump((PlayerMobile)from, town.Owner, town));
                    }

                    break;
                }

                case 0x0ED:                         // *i am sheriff*
                {
                    Town town = Town.FromRegion(from.Region);

                    if (town == null || !town.IsSheriff(from) || !from.Alive)
                    {
                        break;
                    }

                    if (FactionGump.Exists(from))
                    {
                        from.SendLocalizedMessage(1042160);                                           // You already have a faction menu open.
                    }
                    else if (town.Owner != null)
                    {
                        from.SendGump(new SheriffGump((PlayerMobile)from, town.Owner, town));
                    }

                    break;
                }

                case 0x00EF:                         // *you are fired*
                {
                    Town town = Town.FromRegion(from.Region);

                    if (town == null)
                    {
                        break;
                    }

                    if (town.IsFinance(from) || town.IsSheriff(from))
                    {
                        town.BeginOrderFiring(from);
                    }

                    break;
                }

                case 0x00E5:                         // *i wish to resign as finance minister*
                {
                    PlayerState pl = PlayerState.Find(from);

                    if (pl != null && pl.Finance != null)
                    {
                        pl.Finance.Finance = null;
                        from.SendLocalizedMessage(1005081);                                           // You have been fired as Finance Minister
                    }

                    break;
                }

                case 0x00EE:                         // *i wish to resign as sheriff*
                {
                    PlayerState pl = PlayerState.Find(from);

                    if (pl != null && pl.Sheriff != null)
                    {
                        pl.Sheriff.Sheriff = null;
                        from.SendLocalizedMessage(1010270);                                           // You have been fired as Sheriff
                    }

                    break;
                }

                case 0x00E9:                         // *what is my faction term status*
                {
                    PlayerState pl = PlayerState.Find(from);

                    if (pl != null && pl.IsLeaving)
                    {
                        if (Faction.CheckLeaveTimer(from))
                        {
                            break;
                        }

                        TimeSpan remaining = (pl.Leaving + Faction.LeavePeriod) - DateTime.UtcNow;

                        if (remaining.TotalDays >= 1)
                        {
                            from.SendLocalizedMessage(1042743, remaining.TotalDays.ToString("N0"));                                                 // Your term of service will come to an end in ~1_DAYS~ days.
                        }
                        else if (remaining.TotalHours >= 1)
                        {
                            from.SendLocalizedMessage(1042741, remaining.TotalHours.ToString("N0"));                                                 // Your term of service will come to an end in ~1_HOURS~ hours.
                        }
                        else
                        {
                            from.SendLocalizedMessage(1042742);                                               // Your term of service will come to an end in less than one hour.
                        }
                    }
                    else if (pl != null)
                    {
                        from.SendLocalizedMessage(1042233);                                           // You are not in the process of quitting the faction.
                    }

                    break;
                }

                case 0x00EA:                         // *message faction*
                {
                    Faction faction = Faction.Find(from);

                    if (faction == null || !faction.IsCommander(from))
                    {
                        break;
                    }

                    if (from.AccessLevel == AccessLevel.Player && !faction.FactionMessageReady)
                    {
                        from.SendLocalizedMessage(1010264);                                           // The required time has not yet passed since the last message was sent
                    }
                    else
                    {
                        faction.BeginBroadcast(from);
                    }

                    break;
                }

                case 0x00EC:                         // *showscore*
                {
                    PlayerState pl = PlayerState.Find(from);

                    if (pl != null)
                    {
                        Timer.DelayCall(TimeSpan.Zero, new TimerStateCallback(ShowScore_Sandbox), pl);
                    }

                    break;
                }

                case 0x0178:                         // i honor your leadership
                {
                    Faction faction = Faction.Find(from);

                    if (faction != null)
                    {
                        faction.BeginHonorLeadership(from);
                    }

                    break;
                }
                }
            }
        }
        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 OnlineGump(from, m_Mobiles, m_Page - 1));
                }

                break;
            }

            case 2:                     // Next
            {
                if ((m_Page + 1) * EntryCount < m_Mobiles.Count)
                {
                    from.SendGump(new OnlineGump(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 = (Mobile)m_Mobiles[index];

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

                break;
            }
            }
        }