Esempio n. 1
0
		public virtual bool CheckAtDestination()
		{
			EDI dest = GetDestination();

			if( dest == null )
				return false;

			Mobile escorter = GetEscorter();

			if( escorter == null )
				return false;

			if( dest.Contains( Location ) )
			{
				Say( 1042809, escorter.Name ); // We have arrived! I thank thee, ~1_PLAYER_NAME~! I have no further need of thy services. Here is thy pay.

				// not going anywhere
				m_Destination = null;
				m_DestinationString = null;

				Container cont = escorter.Backpack;

				if( cont == null )
					cont = escorter.BankBox;

				Copper cc = new Copper( 90, 180 );

				if( !cont.TryDropItem( escorter, cc, false ) )
					cc.MoveToWorld( escorter.Location, escorter.Map );

				StopFollow();
				SetControlMaster( null );
				m_EscortTable.Remove( escorter );
				BeginDelete();

				Misc.Titles.AwardFame( escorter, 10, true );

				bool gainedPath = false;

				PlayerMobile pm = escorter as PlayerMobile;

				if( pm != null )
				{
					if( pm.CompassionGains > 0 && DateTime.Now > pm.NextCompassionDay )
					{
						pm.NextCompassionDay = DateTime.MinValue;
						pm.CompassionGains = 0;
					}

					if( pm.CompassionGains >= 5 ) // have already gained 5 times in one day, can gain no more
					{
						pm.SendLocalizedMessage( 1053004 ); // You must wait about a day before you can gain in compassion again.
					}
					else if( VirtueHelper.Award( pm, VirtueName.Compassion, 200, ref gainedPath ) )
					{
						if( gainedPath )
							pm.SendLocalizedMessage( 1053005 ); // You have achieved a path in compassion!
						else
							pm.SendLocalizedMessage( 1053002 ); // You have gained in compassion.

						pm.NextCompassionDay = DateTime.Now + TimeSpan.FromDays( 1.0 ); // in one day CompassionGains gets reset to 0
						++pm.CompassionGains;
					}
					else
					{
						pm.SendLocalizedMessage( 1053003 ); // You have achieved the highest path of compassion and can no longer gain any further.
					}
				}

				return true;
			}

			return false;
		}
Esempio n. 2
0
        public virtual bool OnCopperGiven( Mobile from, Copper dropped )
        {
            if( CheckTeachingMatch(from) )
            {
                if( Teach(m_Teaching, from, dropped.Amount, true) )
                {
                    dropped.Delete();
                    return true;
                }
            }
            else if( IsHumanInTown() )
            {
                Direction = GetDirectionTo(from);

                int oldSpeechHue = this.SpeechHue;

                this.SpeechHue = 0x23F;
                SayTo(from, "Thou art giving me coin?");

                if( dropped.Amount >= 400 )
                    SayTo(from, "'Tis a noble gift.");
                else
                    SayTo(from, "Money is always welcome.");

                this.SpeechHue = 0x3B2;
                SayTo(from, 501548); // I thank thee.

                this.SpeechHue = oldSpeechHue;

                dropped.Delete();
                return true;
            }

            return false;
        }
			protected override void OnTick()
			{
				m_AContract.m_TimeLeft = m_AContract.m_TimeLeft - 1;

				if ( m_AContract.m_TimeLeft > 0 )
				{
					if ( m_AContract.m_Debug == true ) m_ContractTimer = new ExpireContractDebugTimer(m_AContract.m_TimeLeft, m_AContract);
					else  m_ContractTimer = new ExpireContractTimer(m_AContract.m_TimeLeft, m_AContract);
					m_ContractTimer.Start();
					
				}
				else
				{
					if (m_AContract.m_Issuer != null ) 
					{
						BankBox box = m_AContract.m_Issuer.BankBox;
						if ( box != null )
						{

							int deposited = 0;

							int toAdd = m_AContract.m_Copper;

							Copper copper;

							while ( toAdd > 60000 )
							{
								copper = new Copper( 60000 );

								if ( box.TryDropItem( m_AContract.m_Issuer, copper, false ) )
								{
									toAdd -= 60000;
									deposited += 60000;
								}
								else
								{
									copper.Delete();

									m_AContract.m_Issuer.AddToBackpack( new BankCheck( toAdd) );
									toAdd = 0;

									break;
								}
							}

							if ( toAdd > 0 )
							{
								copper = new Copper( toAdd );

								if ( box.TryDropItem( m_AContract.m_Issuer, copper, false ) )
								{
									deposited += toAdd;
								}
								else
								{
									copper.Delete();

									m_AContract.m_Issuer.AddToBackpack( new BankCheck( toAdd ) );
								}
							}

							// Gold was deposited in your account:
							m_AContract.m_Issuer.SendLocalizedMessage( 1042672, true, " " + deposited.ToString() );

						}
						/*else
						{
							//from.SendLocalizedMessage( 1047026 ); // That must be in your bank box to use it.
						}*/
		

					}

					m_AContract.m_Expired = true;
				}
			}
			public void ExpireContract()
			{
				BankBox box = m_Issuer.BankBox;

				if ( box != null )
				{
					Delete();

					int deposited = 0;

					int toAdd = m_Copper;

					Copper copper;

					while ( toAdd > 60000 )
					{
						copper = new Copper( 60000 );

						if ( box.TryDropItem( m_Issuer, copper, false ) )
						{
							toAdd -= 60000;
							deposited += 60000;
						}
						else
						{
							copper.Delete();

							m_Issuer.AddToBackpack( new BankCheck( toAdd ) );
							toAdd = 0;

							break;
						}
					}

					if ( toAdd > 0 )
					{
						copper = new Copper( toAdd );

						if ( box.TryDropItem( m_Issuer, copper, false ) )
						{
							deposited += toAdd;
						}
						else
						{
							copper.Delete();

							m_Issuer.AddToBackpack( new BankCheck( toAdd ) );
						}
					}

					// Gold was deposited in your account:
					m_Issuer.SendLocalizedMessage( 1042672, true, " " + deposited.ToString() );

				}
				/*else
				{
					//from.SendLocalizedMessage( 1047026 ); // That must be in your bank box to use it.
				}*/
			}
Esempio n. 5
0
		public override void OnDoubleClick( Mobile from )
		{
			BankBox box = from.FindBankNoCreate();

			if ( box != null && IsChildOf( box ) )
			{
				Delete();

				int deposited = 0;

				int toAdd = m_Worth;

				Copper copper;

				while ( toAdd > 60000 )
				{
					copper = new Copper( 60000 );

					if ( box.TryDropItem( from, copper, false ) )
					{
						toAdd -= 60000;
						deposited += 60000;
					}
					else
					{
						copper.Delete();

						from.AddToBackpack( new BankCheck( toAdd ) );
						toAdd = 0;

						break;
					}
				}

				if ( toAdd > 0 )
				{
					copper = new Copper( toAdd );

					if ( box.TryDropItem( from, copper, false ) )
					{
						deposited += toAdd;
					}
					else
					{
						copper.Delete();

						from.AddToBackpack( new BankCheck( toAdd ) );
					}
				}

				// Gold was deposited in your account:
				from.SendLocalizedMessage( 1042672, true, " " + deposited.ToString() );
			}
			else
			{
				from.SendLocalizedMessage( 1047026 ); // That must be in your bank box to use it.
			}
		}
Esempio n. 6
0
		public override bool OnCopperGiven( Mobile from, Copper dropped )
		{
			string message = "Are you trying to bribe me to win?";
			this.Say( message );
			return false;
		}
Esempio n. 7
0
        public override void OnSpeech( SpeechEventArgs e )
        {
            if( !e.Handled && e.Mobile.InRange(this.Location, 12) )
            {
                for( int i = 0; i < e.Keywords.Length; ++i )
                {
                    int keyword = e.Keywords[i];

                    switch( keyword )
                    {
                        case 0x0000: // *withdraw*
                            {
                                //e.Handled = true;

                                //if( e.Mobile.Criminal )
                                //{
                                //    this.Say( 500389 ); // I will not do business with a criminal!
                                //    break;
                                //}

                                //string[] split = e.Speech.Split( ' ' );

                                //if( split.Length >= 2 )
                                //{
                                //    int amount;

                                //    try
                                //    {
                                //        amount = Convert.ToInt32( split[1] );
                                //    }
                                //    catch
                                //    {
                                //        break;
                                //    }

                                //    if( amount > 5000 )
                                //    {
                                //        this.Say( 500381 ); // Thou canst not withdraw so much at one time!
                                //    }
                                //    else if( amount > 0 )
                                //    {
                                //        BankBox box = e.Mobile.FindBankNoCreate();

                                //        if( box == null || !box.ConsumeTotal( typeof( Gold ), amount ) )
                                //        {
                                //            this.Say( 500384 ); // Ah, art thou trying to fool me? Thou hast not so much gold!
                                //        }
                                //        else
                                //        {
                                //            e.Mobile.AddToBackpack( new Gold( amount ) );

                                //            this.Say( 1010005 ); // Thou hast withdrawn gold from thy account.
                                //        }
                                //    }
                                //}

                                break;
                            }
                        case 0x0001: // *balance*
                            {
                                e.Handled = true;

                                if( e.Mobile.Criminal )
                                {
                                    this.Say(500389); // I will not do business with a criminal!
                                    break;
                                }

                                BankBox box = e.Mobile.FindBankNoCreate();

                                //if( box != null )
                                //    this.Say( 1042759, box.TotalGold.ToString() ); // Thy current bank balance is ~1_AMOUNT~ gold.
                                //else
                                //    this.Say( 1042759, "0" ); // Thy current bank balance is ~1_AMOUNT~ gold.

                                if( box != null )
                                {
                                    Item[] coins = box.FindItemsByType(new Type[] { CurrencySystem.typeofCopper, CurrencySystem.typeofSilver, CurrencySystem.typeofGold });
                                    int gold = 0, silver = 0, copper = 0;

                                    for( int c = 0; c < coins.Length; c++ )
                                    {
                                        if( coins[c].GetType() == CurrencySystem.typeofCopper ) copper += coins[c].Amount;
                                        else if( coins[c].GetType() == CurrencySystem.typeofSilver ) silver += coins[c].Amount;
                                        else if( coins[c].GetType() == CurrencySystem.typeofGold ) gold += coins[c].Amount;
                                    }

                                    Say(String.Format("Thy current bank balance is {0} gold, {1} silver, and {2} copper.", gold, silver, copper));
                                }
                                else
                                {
                                    Say("Thy bank box doth not have any coins.");
                                }

                                break;
                            }
                        case 0x0002: // *bank*
                            {
                                e.Handled = true;

                                if( e.Mobile.Criminal )
                                {
                                    this.Say(500378); // Thou art a criminal and cannot access thy bank box.
                                    break;
                                }

                                e.Mobile.BankBox.Open();

                                break;
                            }
                        case 0x0003: // *check*
                            {
                                //e.Handled = true;

                                //if( e.Mobile.Criminal )
                                //{
                                //    this.Say( 500389 ); // I will not do business with a criminal!
                                //    break;
                                //}

                                //string[] split = e.Speech.Split( ' ' );

                                //if( split.Length >= 2 )
                                //{
                                //    int amount;

                                //    try
                                //    {
                                //        amount = Convert.ToInt32( split[1] );
                                //    }
                                //    catch
                                //    {
                                //        break;
                                //    }

                                //    if( amount < 5000 )
                                //    {
                                //        this.Say( 1010006 ); // We cannot create checks for such a paltry amount of gold!
                                //    }
                                //    else if( amount > 1000000 )
                                //    {
                                //        this.Say( 1010007 ); // Our policies prevent us from creating checks worth that much!
                                //    }
                                //    else
                                //    {
                                //        BankCheck check = new BankCheck( amount );

                                //        BankBox box = e.Mobile.BankBox;

                                //        if( !box.TryDropItem( e.Mobile, check, false ) )
                                //        {
                                //            this.Say( 500386 ); // There's not enough room in your bankbox for the check!
                                //            check.Delete();
                                //        }
                                //        else if( !box.ConsumeTotal( typeof( Gold ), amount ) )
                                //        {
                                //            this.Say( 500384 ); // Ah, art thou trying to fool me? Thou hast not so much gold!
                                //            check.Delete();
                                //        }
                                //        else
                                //        {
                                //            this.Say( 1042673, AffixType.Append, amount.ToString(), "" ); // Into your bank box I have placed a check in the amount of:
                                //        }
                                //    }
                                //}

                                break;
                            }
                    }
                }

                if( e.Speech.ToLower().IndexOf("exchange") > -1 )
                {
                    BankBox box = e.Mobile.FindBankNoCreate();

                    if( box != null )
                    {
                        int cc = 0, sc = 0, gc = 0;
                        Point3D ccLoc = Point3D.Zero, scLoc = Point3D.Zero, gcLoc = Point3D.Zero;

                        List<BaseCoin> coins = box.FindItemsByType<BaseCoin>();

                        coins.ForEach(
                            delegate( BaseCoin coin )
                            {
                                if( coin.GetType() == CurrencySystem.typeofCopper )
                                {
                                    cc += coin.Amount;
                                    ccLoc = coin.Location;
                                }
                                else if( coin.GetType() == CurrencySystem.typeofSilver )
                                {
                                    sc += coin.Amount;
                                    scLoc = coin.Location;
                                }
                                else if( coin.GetType() == CurrencySystem.typeofGold )
                                {
                                    gc += coin.Amount;
                                    gcLoc = coin.Location;
                                }

                                coin.Delete();
                            });

                        int[] newAmts = CurrencySystem.Compress(cc, sc, gc);

                        if( newAmts[0] > 0 )
                        {
                            Copper copper = new Copper(newAmts[0]);

                            box.AddItem(copper);
                            copper.Location = ccLoc;
                        }

                        if( newAmts[1] > 0 )
                        {
                            Silver silver = new Silver(newAmts[1]);

                            box.DropItem(silver);
                            silver.Location = scLoc;
                        }

                        if( newAmts[2] > 0 )
                        {
                            Gold gold = new Gold(newAmts[2]);

                            box.DropItem(gold);
                            gold.Location = gcLoc;
                        }
                    }
                }
            }

            base.OnSpeech(e);
        }
Esempio n. 8
0
		public override bool OnCopperGiven( Mobile from, Copper dropped )
		{
			if( from is PlayerMobile && dropped.Amount == 700 )
			{
				PlayerMobile pm = (PlayerMobile)from;

				if( pm.NpcGuild == NpcGuild.ThievesGuild )
				{
					from.AddToBackpack( new DisguiseKit() );

					dropped.Delete();
					return true;
				}
			}

			return base.OnCopperGiven( from, dropped );
		}
Esempio n. 9
0
        public override bool OnCopperGiven( Mobile from, Copper dropped )
        {
            if( from is PlayerMobile && dropped.Amount == JoinCost )
            {
                PlayerMobile pm = (PlayerMobile)from;

                if( pm.NpcGuild == this.NpcGuild )
                {
                    SayTo(from, 501047); // Thou art already a member of our guild.
                }
                else if( pm.NpcGuild != NpcGuild.None )
                {
                    SayTo(from, 501046); // Thou must resign from thy other guild first.
                }
                else if( pm.GameTime < JoinGameAge || (pm.CreationTime + JoinAge) > DateTime.Now )
                {
                    SayTo(from, 501048); // You are too young to join my guild...
                }
                else if( CheckCustomReqs(pm) )
                {
                    SayWelcomeTo(from);

                    pm.NpcGuild = this.NpcGuild;
                    pm.NpcGuildJoinTime = DateTime.Now;
                    pm.NpcGuildGameTime = pm.GameTime;

                    dropped.Delete();
                    return true;
                }

                return false;
            }

            return base.OnCopperGiven(from, dropped);
        }