Beispiel #1
0
		public static void OnVirtueUsed( Mobile from )
		{
			if ( !from.CheckAlive() )
				return;

			PlayerMobile protector = from as PlayerMobile;

			if ( protector == null )
				return;

			if ( !VirtueHelper.IsSeeker( protector, VirtueName.Justice ) )
			{
				protector.SendLocalizedMessage( 1049610 ); // You must reach the first path in this virtue to invoke it.
			}
			else if ( !protector.CanBeginAction( typeof( JusticeVirtue ) ) )
			{
				protector.SendLocalizedMessage( 1049370 ); // You must wait a while before offering your protection again.
			}
			else if ( protector.JusticeProtectors.Count > 0 )
			{
				protector.SendLocalizedMessage( 1049542 ); // You cannot protect someone while being protected.
			}
			else if ( protector.Map != Map.Felucca )
			{
				protector.SendLocalizedMessage( 1049372 ); // You cannot use this ability here.
			}
			else
			{
				protector.BeginTarget( 14, false, TargetFlags.None, new TargetCallback( OnVirtueTargeted ) );
				protector.SendLocalizedMessage( 1049366 ); // Choose the player you wish to protect.
			}
		}
		public override void GetContextMenuEntries( Mobile from, List<ContextMenuEntry> list )
		{
			base.GetContextMenuEntries( from, list );

			if ( from.CheckAlive() && IsChildOf( from.Backpack ) )
				list.Add( new NameBookEntry( from, this ) );
		}
Beispiel #3
0
        public void BeginStable( Mobile from )
        {
            if ( Deleted || !from.CheckAlive() )
                return;

                SayTo( from, true, "Which bunny wouldst thou like to stable here?");

                from.Target = new StableTarget( this );
        }
Beispiel #4
0
 public virtual void EndRelease( Mobile from )
 {
     if ( from == null || (!Deleted && Controlled && from == ControlMaster && from.CheckAlive()) )
     {
         Effects.SendLocationParticles( EffectItem.Create( Location, Map, EffectItem.DefaultDuration ), 0x3728, 1, 13, 2100, 3, 5042, 0 );
         PlaySound( 0x201 );
         Delete();
     }
 }
        public void BeginRepair(Mobile from)
        {
            if (Deleted || !from.CheckAlive())
                return;

            SayTo(from, "What do you want me to repair?");

            from.Target = new RepairTarget(this);

        }
      public void BeginPetSale( Mobile from ) 
      { 
         if ( Deleted || !from.CheckAlive() ) 
            return; 

         SayTo( from, "Which one of my reindeer have you found?" ); 

         from.Target = new PetSaleTarget( this ); 
         
      } 
Beispiel #7
0
        public static void ThirstDecay( Mobile m )
        {
            //kaltar
            //if ( m != null && m.Thirst >= 1 )
            //	m.Thirst -= 1;

            #region kaltar
            if ( m != null && m.CheckAlive()) {
                m.Hunger -= 1;
            }
            #endregion
        }
Beispiel #8
0
        public static void ApplyInsuranceChanges( Mobile from, ItemInsuranceInfo[] arInfo )
        {
            if ( !from.CheckAlive() )
                return;

            foreach ( ItemInsuranceInfo info in arInfo )
            {
                if ( info.Toggled )
                {
                    Item item = info.Item;

                    if ( !item.IsChildOf( from ) )
                    {
                        from.SendLocalizedMessage( 1060871, String.Empty, 0x23 ); // You can only insure items that you have equipped or that are in your backpack
                    }
                    else if ( item.Insured )
                    {
                        item.Insured = false;
                        from.SendLocalizedMessage( 1060874, String.Empty, 0x35 ); // You cancel the insurance on the item
                    }
                    else
                    {
                        if ( !item.PayedInsurance )
                        {
                            int cost = info.GetCost();

                            if ( Banker.Withdraw( from, cost ) )
                            {
                                from.SendLocalizedMessage( 1060398, cost.ToString() ); // ~1_AMOUNT~ gold has been withdrawn from your bank box.
                                item.PayedInsurance = true;
                            }
                            else
                            {
                                from.SendLocalizedMessage( 1061079, String.Empty, 0x23 ); // You lack the funds to purchase the insurance
                                continue;
                            }
                        }

                        item.Insured = true;
                        from.SendLocalizedMessage( 1060873, String.Empty, 0x23 ); // You have insured the item
                    }
                }
            }
        }
Beispiel #9
0
        public override bool OnBuyItems( Mobile buyer, ArrayList list )
        {
            if ( !IsActiveSeller )
                return false;

            if ( !buyer.CheckAlive() )
                return false;

            if ( !CheckVendorAccess( buyer ) )
            {
                Say( 501522 ); //I shall not treat with scum like thee!
                return false;
            }

            VendorEntry[] buyInfo = (VendorEntry[])m_CustomBuyList.ToArray( typeof( VendorEntry ) );
            int totalCost = 0;
            ArrayList validBuy = new ArrayList( list.Count );
            Container cont;
            bool bought = false;
            bool fromBank = false;
            bool fullPurchase = true;
            int controlSlots = buyer.FollowersMax - buyer.Followers;

            foreach ( BuyItemResponse buy in list )
            {
                Serial ser = buy.Serial;
                int amount = buy.Amount;

                if ( ser.IsItem )
                {
                    Item item = World.FindItem( ser );

                    if ( item == null )
                    {
                        this.Say( "I am sorry. I could not find in the stock the item you wish to buy." );
                        continue;
                    }

                    if ( item.RootParent == this )
                    {
                        if ( amount > item.Amount )
                            amount = item.Amount;

                        if ( amount <= 0 )
                            continue;

                        foreach ( VendorEntry entry in buyInfo )
                        {
                            if ( entry.Type == item.GetType() )
                            {
                                totalCost += entry.Price * amount;
                                validBuy.Add( buy );
                                break;
                            }
                        }
                    }
                }
            }

            if ( fullPurchase && validBuy.Count == 0 )
                SayTo( buyer, 500190 ); //Thou hast bought nothing!
            else if ( validBuy.Count == 0 )
                SayTo( buyer, 500187 ); //Your order cannot be fulfilled, please try again.

            if ( validBuy.Count == 0 )
                return false;

            bought = ( buyer.AccessLevel >= AccessLevel.GameMaster );

            cont = buyer.Backpack;
            if ( !bought && cont != null )
            {
                if ( cont.ConsumeTotal( typeof( Copper ), totalCost ) )
                    bought = true;
                else if ( totalCost < 2000 )
                    SayTo( buyer, 500192 ); //Begging thy pardon, but thou casnt afford that.
            }

            if ( !bought && totalCost >= 2000 )
            {
                cont = buyer.BankBox;
                if ( cont != null && cont.ConsumeTotal( typeof( Copper ), totalCost ) )
                {
                    bought = true;
                    fromBank = true;
                }
                else
                {
                    SayTo( buyer, 500191 ); //Begging thy pardon, but thy bank account lacks these funds.
                }
            }

            if ( !bought )
                return false;
            else
                buyer.PlaySound( 0x32 );

            cont = buyer.Backpack;
            if ( cont == null )
                cont = buyer.BankBox;

            foreach ( BuyItemResponse buy in validBuy )
            {
                Serial ser = buy.Serial;
                int amount = buy.Amount;

                if ( amount < 1 )
                    continue;

                if ( ser.IsItem )
                {
                    Item item = World.FindItem( ser );

                    if ( item == null )
                        continue;

                    GenericBuyInfo gbi = LookupDisplayObject( item );

                    if ( gbi != null )
                    {
                        ProcessValidPurchase( amount, gbi, buyer, cont );
                    }
                    else
                    {
                        if ( amount > item.Amount )
                            amount = item.Amount;

                        foreach ( VendorEntry entry in buyInfo )
                        {
                            if ( item.GetType() == entry.Type )
                            {
                                Item buyItem;
                                if ( amount >= item.Amount )
                                {
                                    buyItem = item;
                                }
                                else
                                {
                                    buyItem = Mobile.LiftItemDupe( item, item.Amount - amount );

                                    if ( buyItem == null )
                                        buyItem = item;
                                }

                                if ( cont == null || !cont.TryDropItem( buyer, buyItem, false ) )
                                    buyItem.MoveToWorld( buyer.Location, buyer.Map );

                                break;
                            }
                        }
                    }
                }
            }

            if( buyer.AccessLevel == AccessLevel.Player )
            {
                cont = this.BuyPack;

                if( this is Treasurer && ( (Treasurer)this ).Nation != Nation.None && ( ( ( (Treasurer)this ).Treasury != null && !( (Treasurer)this ).Treasury.Deleted ) || ( (Treasurer)this ).AssignTreasury() ) )
                {
                    cont = ( (Treasurer)this ).Treasury;
                }

                Copper copper = new Copper();
                copper.Amount = totalCost;

                if( cont is BaseContainer )
                    ( (BaseContainer)cont ).DropAndStack( copper );
            }

            if ( fullPurchase )
            {
                if ( buyer.AccessLevel >= AccessLevel.GameMaster )
                    SayTo( buyer, true, "I would not presume to charge thee anything.  Here are the goods you requested." );
                else if ( fromBank )
                    SayTo( buyer, true, "The total of thy purchase is {0} copper, which has been withdrawn from your bank account.  My thanks for the patronage.", totalCost );
                else
                    SayTo( buyer, true, "The total of thy purchase is {0} copper.  My thanks for the patronage.", totalCost );
            }
            else
            {
                if ( buyer.AccessLevel >= AccessLevel.GameMaster )
                    SayTo( buyer, true, "I would not presume to charge thee anything.  Unfortunately, I could not sell you all the goods you requested." );
                else if ( fromBank )
                    SayTo( buyer, true, "The total of thy purchase is {0} copper, which has been withdrawn from your bank account.  My thanks for the patronage.  Unfortunately, I could not sell you all the goods you requested.", totalCost );
                else
                    SayTo( buyer, true, "The total of thy purchase is {0} copper.  My thanks for the patronage.  Unfortunately, I could not sell you all the goods you requested.", totalCost );
            }

            return true;
        }
Beispiel #10
0
        public static void Valor(Mobile from, object targeted)
        {
            if (!from.CheckAlive())
            {
                return;
            }

            ChampionIdol targ = targeted as ChampionIdol;

            if (targ == null)
            {
                return;
            }

            VirtueLevel level = VirtueHelper.GetLevel(from, VirtueName.Valor);

            int current = from.Virtues.GetValue((int)VirtueName.Valor);

            if (targ.Spawn.IsValorUsed)
            {
                from.SendLocalizedMessage(1054038);                   // The Champion of this region has already been challenged!
                return;
            }

            if (!targ.Spawn.Active)
            {
                if (level >= VirtueLevel.Knight)
                {
                    targ.Spawn.Active = true;

                    if (targ.Spawn.RandomizeType)
                    {
                        switch (Utility.Random(5))
                        {
                        case 0:
                            targ.Spawn.Type = ChampionSpawnType.VerminHorde;
                            break;

                        case 1:
                            targ.Spawn.Type = ChampionSpawnType.UnholyTerror;
                            break;

                        case 2:
                            targ.Spawn.Type = ChampionSpawnType.ColdBlood;
                            break;

                        case 3:
                            targ.Spawn.Type = ChampionSpawnType.Abyss;
                            break;

                        case 4:
                            targ.Spawn.Type = ChampionSpawnType.Arachnid;
                            break;
                        }
                    }

                    // It's strange, but at OSI Valor not only activate spawn but also increase 2-4 levels on it.
                    // If counts of increased levels less than 4, champion spawn can be used with Valor again for advance level.
                    int candles = Utility.RandomMinMax(2, 4);
                    targ.Spawn.Level = candles;
                    if (candles > 3)
                    {
                        targ.Spawn.IsValorUsed = true;
                    }

                    // on Stratics written:
                    // The player will sacrifice a large portion of his Valor in order to activate a champion spawn shrine.
                    // Really, player become Follower of Valor instead Knight
                    from.Virtues.SetValue((int)VirtueName.Valor, 29);

                    // Your challenge is heard by the Champion of this region! Beware its wrath!
                    targ.PublicOverheadMessage(Network.MessageType.Regular, 0x3B2, 1054037, "");

                    from.SendLocalizedMessage(1054040);                       // You have lost some Valor.
                }
                else
                {
                    from.SendLocalizedMessage(1054036);                       // You must be a Knight of Valor to summon the champion's spawn in this manner!
                }
            }
            else
            {
                if (targ.Spawn.Champion == null)
                {
                    if (CheckValor(targ.Spawn, from))
                    {
                        int sacrifice_advance_level = 0;

                        if (targ.Spawn.Level < 5)
                        {
                            sacrifice_advance_level = 5;
                        }

                        if (targ.Spawn.Level >= 5 && targ.Spawn.Level < 10)
                        {
                            sacrifice_advance_level = 10;
                        }

                        if (targ.Spawn.Level >= 10 && targ.Spawn.Level < 15)
                        {
                            sacrifice_advance_level = 15;
                        }

                        if (sacrifice_advance_level > current)
                        {
                            sacrifice_advance_level = current;
                        }

                        targ.Spawn.Level += 1;

                        from.Virtues.SetValue((int)VirtueName.Valor, current - sacrifice_advance_level);

                        // Your challenge is heard by the Champion of this region! Beware its wrath!
                        targ.PublicOverheadMessage(Network.MessageType.Regular, 0x3B2, 1054037, "");

                        from.SendLocalizedMessage(1054040);                           // You have lost some Valor.

                        targ.Spawn.IsValorUsed = true;
                    }
                    else
                    {
                        from.SendLocalizedMessage(1054039);                           // The Champion of this region ignores your challenge. You must further prove your valor.
                    }

                    if (targ.Spawn.Level >= 15 && level >= VirtueLevel.Knight)
                    {
                        if (0.03 >= Utility.RandomDouble())                           // TODO: verify
                        {
                            // Your challenge is heard by the Champion of this region! Beware its wrath!
                            targ.PublicOverheadMessage(Network.MessageType.Regular, 0x3B2, 1054037, "");

                            targ.Spawn.SpawnChampion();

                            from.Virtues.SetValue((int)VirtueName.Valor, 0);

                            from.SendLocalizedMessage(1054040);                               // You have lost some Valor.

                            targ.Spawn.IsValorUsed = true;
                        }
                        else
                        {
                            from.SendLocalizedMessage(1054039);                               // The Champion of this region ignores your challenge. You must further prove your valor.
                        }
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1054038);                       // The Champion of this region has already been challenged!
                }
            }
        }
Beispiel #11
0
		public void EndStable( Mobile from, BaseCreature pet )
		{
			if ( Deleted || !from.CheckAlive() )
				return;

			if ( !pet.Controlled || pet.ControlMaster != from )
			{
				SayTo( from, 1042562 ); // You do not own that pet!
			}
			//Pix: 10/7/2004 - allow dead pets to be stabled.
			//else if ( pet.IsDeadPet )
			//{
			//	SayTo( from, 1049668 ); // Living pets only, please.
			//}
			else if ( pet.Summoned )
			{
				SayTo( from, 502673 ); // I can not stable summoned creatures.
			}
			else if ( pet.IOBFollower ) // Don't stable IOB Bretheren
			{
				SayTo( from, "You can't stable your bretheren!" );
			}
			else if ( pet.Body.IsHuman )
			{
				SayTo( from, 502672 ); // HA HA HA! Sorry, I am not an inn.
			}
			else if ( (pet is PackLlama || pet is PackHorse || pet is Beetle) && (pet.Backpack != null && pet.Backpack.Items.Count > 0) )
			{
				SayTo( from, 1042563 ); // You need to unload your pet.
			}
			else if ( pet.Combatant != null && pet.InRange( pet.Combatant, 12 ) && pet.Map == pet.Combatant.Map )
			{
				SayTo( from, 1042564 ); // I'm sorry.  Your pet seems to be busy.
			}
			else if ( from.Stabled.Count >= GetMaxStabled( from ) )
			{
				SayTo( from, 1042565 ); // You have too many pets in the stables!
			}
			else
			{
				Container bank = from.BankBox;

				if ( bank != null && bank.ConsumeTotal( typeof( Gold ), 30 ) )
				{
					pet.ControlTarget = null;
					pet.ControlOrder = OrderType.Stay;
					pet.Internalize();

					pet.SetControlMaster( null );
					pet.SummonMaster = null;

					pet.IsStabled = true;
					from.Stabled.Add( pet );

					SayTo( from, 502679 ); // Very well, thy pet is stabled. Thou mayst recover it by saying 'claim' to me. In one real world week, I shall sell it off if it is not claimed!
				}
				else
				{
					SayTo( from, 502677 ); // But thou hast not the funds in thy bank account!
				}
			}
		}
Beispiel #12
0
		public void EndClaimList( Mobile from, BaseCreature pet )
		{
			if ( pet == null || pet.Deleted || from.Map != this.Map || !from.InRange( this, 14 ) || !from.Stabled.Contains( pet ) || !from.CheckAlive() )
				return;

			if ( (from.Followers + pet.ControlSlots) <= from.FollowersMax )
			{
				pet.SetControlMaster( from );

				if ( pet.Summoned )
					pet.SummonMaster = from;

				pet.ControlTarget = from;
				pet.ControlOrder = OrderType.Follow;

				pet.MoveToWorld( from.Location, from.Map );

				pet.IsStabled = false;
				from.Stabled.Remove( pet );

				SayTo( from, 1042559 ); // Here you go... and good day to you!
			}
			else
			{
				SayTo( from, 1049612, pet.Name ); // ~1_NAME~ remained in the stables because you have too many followers.
			}
		}
        public void BeginCustomize( Mobile m )
        {
            if ( !m.CheckAlive() )
                return;

            RelocateEntities();

            foreach ( Item item in GetItems() )
            {
                item.Location = BanLocation;
            }

            foreach ( Mobile mobile in GetMobiles() )
            {
                if ( mobile != m )
                    mobile.Location = BanLocation;
            }

            DesignContext.Add( m, this );
            m.Send( new BeginHouseCustomization( this ) );

            if ( m.NetState != null )
                SendInfoTo( m.NetState );

            DesignState.SendDetailedInfoTo( m.NetState );
        }
Beispiel #14
0
		public void EndConfirmTransfer( Mobile from, Mobile to )
		{
			if ( Deleted || !from.CheckAlive() || !IsOwner( from ) )
				return;

			if ( NewVendorSystem && HasPersonalVendors )
			{
				from.SendLocalizedMessage( 1062467 ); // You cannot trade this house while you still have personal vendors inside.
			}
			else if ( DecayLevel == DecayLevel.DemolitionPending )
			{
				from.SendLocalizedMessage( 1005321 ); // This house has been marked for demolition, and it cannot be transferred.
			}
			else if ( from == to )
			{
				from.SendLocalizedMessage( 1005330 ); // You cannot transfer a house to yourself, silly.
			}
			else if ( to.Player )
			{
				if ( BaseHouse.HasAccountHouse( to ) )
				{
					from.SendLocalizedMessage( 501388 ); // You cannot transfer ownership to another house owner or co-owner!
				}
				else if ( CheckTransferPosition( from, to ) )
				{
					NetState fromState = from.NetState, toState = to.NetState;

					if ( fromState != null && toState != null )
					{
						if ( from.HasTrade )
						{
							from.SendLocalizedMessage( 1062071 ); // You cannot trade a house while you have other trades pending.
						}
						else if ( to.HasTrade )
						{
							to.SendLocalizedMessage( 1062071 ); // You cannot trade a house while you have other trades pending.
						}
						else if( !to.Alive )
						{
							// TODO: Check if the message is correct.
							from.SendLocalizedMessage( 1062069 ); // You cannot transfer this house to that person.
						}
						else
						{
							Container c = fromState.AddTrade( toState );

							c.DropItem( new TransferItem( this ) );
						}
					}
				}
			}
			else
			{
				from.SendLocalizedMessage( 501384 ); // Only a player can own a house!
			}
		}
Beispiel #15
0
			public override void OnSecureTrade( Mobile from, Mobile to, Mobile newOwner, bool accepted )
			{
				if ( Deleted )
					return;

				Delete();

				if ( m_House == null || m_House.Deleted || !m_House.IsOwner( from ) || !from.CheckAlive() || !to.CheckAlive() )
					return;
				

				if ( !accepted )
					return;

				from.SendLocalizedMessage( 501338 ); // You have transferred ownership of the house.
				to.SendLocalizedMessage( 501339 ); /* You are now the owner of this house.
													* The house's co-owner, friend, ban, and access lists have been cleared.
													* You should double-check the security settings on any doors and teleporters in the house.
													*/

				m_House.RemoveKeys( from );
				m_House.Owner = to;
				m_House.Bans.Clear();
				m_House.Friends.Clear();
				m_House.CoOwners.Clear();
				m_House.ChangeLocks( to );
				m_House.LastTraded = DateTime.Now;
			}
Beispiel #16
0
        public override void VendorSell( Mobile from )
        {
            if ( !IsActiveBuyer )
                return;

            if ( !from.CheckAlive() )
                return;

            if ( !CheckVendorAccess( from ) )
            {
                Say( 501522 ); //I shall not treat with scum like thee!
                return;
            }

            Container pack = from.Backpack;

            if ( pack != null )
            {
                VendorEntry[] info = (VendorEntry[])m_CustomSellList.ToArray( typeof( VendorEntry ) );

                Hashtable table = new Hashtable();

                foreach ( VendorEntry entry in info )
                {
                    Item[] items = pack.FindItemsByType( entry.Type );

                    foreach ( Item item in items )
                    {
                        if ( item is Container && ((Container)item).Items.Count != 0 )
                            continue;

                        if ( item.IsStandardLoot() && item.Movable )
                            table[item] = new SellItemState( item, entry.Price, item.Name );
                    }
                }

                if ( table.Count > 0 )
                {
                    SendPacksTo( from );

                    from.Send( new VendorSellList( this, table ) );
                }
                else
                {
                    Say( true, "You have nothing I would be interested in." );
                }
            }
        }
Beispiel #17
0
        public override bool OnSellItems( Mobile seller, ArrayList list )
        {
            if ( !IsActiveBuyer )
                return false;

            if ( !seller.CheckAlive() )
                return false;

            if ( !CheckVendorAccess( seller ) )
            {
                Say( 501522 ); // I shall not treat with scum like thee!
                return false;
            }

            VendorEntry[] info = (VendorEntry[])m_CustomSellList.ToArray( typeof( VendorEntry ) );
            int GiveCopper = 0;
            int Sold = 0;
            Container cont;
            ArrayList delete = new ArrayList();
            ArrayList drop = new ArrayList();
            int vendorcopper = 0;

            if( this.Backpack != null )
            {
                foreach( Item item in this.Backpack.Items )
                {
                    if( item is Copper )
                        vendorcopper += item.Amount;
                }
            }

            else
            {
                Backpack backpack = new Backpack();
                this.AddItem( backpack );
            }

            foreach ( SellItemResponse resp in list )
            {
                if ( resp.Item.RootParent != seller || resp.Amount <= 0 || !resp.Item.IsStandardLoot() || !resp.Item.Movable || (resp.Item is Container && ((Container)resp.Item).Items.Count != 0) )
                    continue;

                foreach( VendorEntry entry in info )
                {
                    if ( resp.Item.GetType() == entry.Type )
                    {
                        Sold++;
                        break;
                    }
                }
            }

            if ( Sold > MaxSell )
            {
                SayTo( seller, true, "You may only sell {0} items at a time!", MaxSell );
                return false;
            }
            else if ( Sold == 0 )
            {
                return true;
            }

            foreach ( SellItemResponse resp in list )
            {
                if ( resp.Item.RootParent != seller || resp.Amount <= 0 || !resp.Item.IsStandardLoot() || !resp.Item.Movable || (resp.Item is Container && ((Container)resp.Item).Items.Count != 0) )
                    continue;

                foreach( VendorEntry entry in info )
                {
                    if ( resp.Item.GetType() == entry.Type )
                    {
                        int amount = resp.Amount;

                        if ( amount > resp.Item.Amount )
                            amount = resp.Item.Amount;

                        GiveCopper += entry.Price * amount;
                        break;
                    }
                }
            }

            if( GiveCopper > vendorcopper )
            {
                this.SayTo( seller, "I apologize, but I do not have that much copper." );
                return false;
            }

            foreach ( SellItemResponse resp in list )
            {
                if ( resp.Item.RootParent != seller || resp.Amount <= 0 || !resp.Item.IsStandardLoot() || !resp.Item.Movable || (resp.Item is Container && ((Container)resp.Item).Items.Count != 0) )
                    continue;

                foreach( VendorEntry entry in info )
                {
                    if ( resp.Item.GetType() == entry.Type )
                    {
                        int amount = resp.Amount;

                        if ( amount > resp.Item.Amount )
                            amount = resp.Item.Amount;

                        cont = this.BuyPack;

                        if( this is Treasurer && ( (Treasurer)this ).Nation != Nation.None && ( ( ( (Treasurer)this ).Treasury != null && !( (Treasurer)this ).Treasury.Deleted ) || ( (Treasurer)this ).AssignTreasury() ) )
                            cont = ( (Treasurer)this ).Treasury;

                        if ( amount < resp.Item.Amount )
                        {
                            Item item = Mobile.LiftItemDupe( resp.Item, resp.Item.Amount - amount );

                            if ( item != null )
                            {
                                item.SetLastMoved();
                                if( cont is BaseContainer )
                                    ( (BaseContainer)cont ).DropAndStack( item );
                            }
                            else
                            {
                                resp.Item.SetLastMoved();
                                if( cont is BaseContainer )
                                    ( (BaseContainer)cont ).DropAndStack( resp.Item );
                            }
                        }
                        else
                        {
                            resp.Item.SetLastMoved();
                            if( cont is BaseContainer )
                                ( (BaseContainer)cont ).DropAndStack( resp.Item );
                        }
                    }
                }
            }

            this.Backpack.ConsumeTotal( typeof( Copper ), GiveCopper );

            if ( GiveCopper > 0 )
            {
                while ( GiveCopper > 60000 )
                {
                    seller.AddToBackpack( new Copper( 60000 ) );
                    GiveCopper -= 60000;
                }

                seller.AddToBackpack( new Copper( GiveCopper ) );
                seller.PlaySound( 0x0037 ); //Copper dropping sound
            }

            return true;
        }
Beispiel #18
0
        public static void Sacrifice(Mobile from, object targeted)
        {
            if (!from.CheckAlive())
            {
                return;
            }

            if (!(from is PlayerMobile pm))
            {
                return;
            }

            if (!(targeted is Mobile targ))
            {
                return;
            }

            if (!ValidateCreature(targ))
            {
                from.SendLocalizedMessage(1052014); // You cannot sacrifice your fame for that creature.
            }
            else if (targ.Hits * 100 / Math.Max(targ.HitsMax, 1) < 90)
            {
                from.SendLocalizedMessage(1052013); // You cannot sacrifice for this monster because it is too damaged.
            }
            else if (from.Hidden)
            {
                from.SendLocalizedMessage(1052015); // You cannot do that while hidden.
            }
            else if (VirtueHelper.IsHighestPath(from, VirtueName.Sacrifice))
            {
                from.SendLocalizedMessage(1052068); // You have already attained the highest path in this virtue.
            }
            else if (from.Fame < 2500)
            {
                from.SendLocalizedMessage(1052017); // You do not have enough fame to sacrifice.
            }
            else if (DateTime.UtcNow < pm.LastSacrificeGain + GainDelay)
            {
                from.SendLocalizedMessage(1052016); // You must wait approximately one day before sacrificing again.
            }
            else
            {
                int toGain;

                if (from.Fame < 5000)
                {
                    toGain = 500;
                }
                else if (from.Fame < 10000)
                {
                    toGain = 1000;
                }
                else
                {
                    toGain = 2000;
                }

                from.Fame = 0;

                // I have seen the error of my ways!
                targ.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1052009);

                from.SendLocalizedMessage(1052010); // You have set the creature free.

                Timer.DelayCall(TimeSpan.FromSeconds(1.0), targ.Delete);

                pm.LastSacrificeGain = DateTime.UtcNow;

                var gainedPath = false;

                if (VirtueHelper.Award(from, VirtueName.Sacrifice, toGain, ref gainedPath))
                {
                    if (gainedPath)
                    {
                        from.SendLocalizedMessage(1052008); // You have gained a path in Sacrifice!

                        if (pm.AvailableResurrects < 3)
                        {
                            ++pm.AvailableResurrects;
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1054160); // You have gained in sacrifice.
                    }
                }

                from.SendLocalizedMessage(1052016); // You must wait approximately one day before sacrificing again.
            }
        }
Beispiel #19
0
        public override void VendorBuy( Mobile from )
        {
            if ( !IsActiveSeller )
                return;

            if ( !from.CheckAlive() )
                return;

            if ( !CheckVendorAccess( from ) )
            {
                Say( 501522 ); //I shall not treat with scum like thee!
                return;
            }

            int count = 0;
            ArrayList list;
            VendorEntry[] buyInfo = (VendorEntry[])m_CustomBuyList.ToArray( typeof( VendorEntry ) );

            list = new ArrayList( buyInfo.Length );

            Container cont = this.BuyPack;

            ArrayList opls = new ArrayList();

            List<Item> playerItems = cont.Items;

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

                int price = 0;
                string name = null;

                foreach( VendorEntry entry in buyInfo )
                {
                    if ( item.GetType() == entry.Type )
                    {
                        price = entry.Price;
                        name = entry.ItemName;
                        break;
                    }
                }

                if ( name != null && list.Count < 250 )
                {
                    list.Add( new BuyItemState( name, cont.Serial, item.Serial, price, item.Amount, item.ItemID, item.Hue ) );
                    count++;

                    opls.Add( item.PropertyList );
                }
            }

            if ( list.Count > 0 )
            {
                list.Sort( new BuyItemStateComparer() );

                SendPacksTo( from );

                from.Send( new VendorBuyContent( list ) );
                from.Send( new VendorBuyList( this, list ) );
                from.Send( new DisplayBuyList( this ) );
                from.Send( new MobileStatusExtended( from ) ); //make sure their copper amount is sent

                for ( int i = 0; i < opls.Count; ++i )
                    from.Send( opls[i] as Packet );

                SayTo( from, "Greetings. Have a look around." );
            }
        }
Beispiel #20
0
            public override void OnSecureTrade( Mobile from, Mobile to, Mobile newOwner, bool accepted )
            {
                if( Deleted )
                    return;

                Delete();

                if( m_Creature == null || m_Creature.Deleted || m_Creature.ControlMaster != from || !from.CheckAlive() || !to.CheckAlive() )
                    return;

                if( from.Map != m_Creature.Map || !from.InRange( m_Creature, 14 ) )
                    return;

                if( accepted )
                {
                    if( m_Creature.SetControlMaster( to ) )
                    {
                        if( m_Creature.Summoned )
                            m_Creature.SummonMaster = to;

                        m_Creature.ControlTarget = to;
                        m_Creature.ControlOrder = OrderType.Follow;

                        m_Creature.BondingBegin = DateTime.MinValue;
                        m_Creature.OwnerAbandonTime = DateTime.MinValue;
                        m_Creature.IsBonded = false;

                        m_Creature.PlaySound( m_Creature.GetIdleSound() );

                        string args = String.Format( "{0}\t{1}\t{2}", from.Name, m_Creature.Name, to.Name );

                        from.SendLocalizedMessage( 1043253, args ); // You have transferred your pet to ~3_GETTER~.
                        to.SendLocalizedMessage( 1043252, args ); // ~1_NAME~ has transferred the allegiance of ~2_PET_NAME~ to you.
                    }
                }
            }
Beispiel #21
0
			public override bool AllowSecureTrade( Mobile from, Mobile to, Mobile newOwner, bool accepted )
			{
				if ( !base.AllowSecureTrade( from, to, newOwner, accepted ) )
					return false;
				else if ( !accepted )
					return true;

				if ( Deleted || m_House == null || m_House.Deleted || !m_House.IsOwner( from ) || !from.CheckAlive() || !to.CheckAlive() )
					return false;

				if ( BaseHouse.HasAccountHouse( to ) )
				{
					from.SendLocalizedMessage( 501388 ); // You cannot transfer ownership to another house owner or co-owner!
					return false;
				}

				return m_House.CheckTransferPosition( from, to );
			}
Beispiel #22
0
        public static bool UseSkill( Mobile from, int skillID )
        {
            if ( !from.CheckAlive() )
                return false;
            else if ( !from.Region.OnSkillUse( from, skillID ) )
                return false;
            else if ( !from.AllowSkillUse( (SkillName)skillID ) )
                return false;

            if ( skillID >= 0 && skillID < SkillInfo.Table.Length )
            {
                SkillInfo info = SkillInfo.Table[skillID];

                if ( info.Callback != null )
                {
                    if ( from.NextSkillTime <= DateTime.Now && from.Spell == null )
                    {
                        from.DisruptiveAction();

                        from.NextSkillTime = DateTime.Now + info.Callback( from );

                        return true;
                    }
                    else
                    {
                        from.SendSkillMessage();
                    }
                }
                else
                {
                    from.SendLocalizedMessage( 500014 ); // That skill cannot be used directly.
                }
            }

            return false;
        }
Beispiel #23
0
		public void BeginConfirmTransfer( Mobile from, Mobile to )
		{
			if ( Deleted || !from.CheckAlive() || !IsOwner( from ) )
				return;

			if ( NewVendorSystem && HasPersonalVendors )
			{
				from.SendLocalizedMessage( 1062467 ); // You cannot trade this house while you still have personal vendors inside.
			}
			else if ( DecayLevel == DecayLevel.DemolitionPending )
			{
				from.SendLocalizedMessage( 1005321 ); // This house has been marked for demolition, and it cannot be transferred.
			}
			else if ( from == to )
			{
				from.SendLocalizedMessage( 1005330 ); // You cannot transfer a house to yourself, silly.
			}
			else if ( to.Player )
			{
				if ( BaseHouse.HasAccountHouse( to ) )
				{
					from.SendLocalizedMessage( 501388 ); // You cannot transfer ownership to another house owner or co-owner!
				}
				else if ( CheckTransferPosition( from, to ) )
				{
					from.SendLocalizedMessage( 1005326 ); // Please wait while the other player verifies the transfer.

					if ( HasRentedVendors )
					{
						/* You are about to be traded a home that has active vendor contracts.
						 * While there are active vendor contracts in this house, you
						 * <strong>cannot</strong> demolish <strong>OR</strong> customize the home.
						 * When you accept this house, you also accept landlordship for every
						 * contract vendor in the house.
						 */
						to.SendGump( new WarningGump( 1060635, 30720, 1062487, 32512, 420, 280, new WarningGumpCallback( ConfirmTransfer_Callback ), from ) );
					}
					else
					{
						to.CloseGump( typeof( Gumps.HouseTransferGump ) );
						to.SendGump( new Gumps.HouseTransferGump( from, to, this ) );
					}
				}
			}
			else
			{
				from.SendLocalizedMessage( 501384 ); // Only a player can own a house!
			}
		}
Beispiel #24
0
		public void EndClaimList( Mobile from, BaseCreature pet )
		{
			if ( pet == null || pet.Deleted || from.Map != this.Map || !from.Stabled.Contains( pet ) || !from.CheckAlive() )
				return;
			
			if ( !from.InRange( this, 14 ) )
			{
				from.SendLocalizedMessage( 500446 ); // That is too far away.
				return;
			}

			if ( CanClaim( from, pet ) )
			{
				DoClaim( from, pet );

				from.Stabled.Remove( pet );

                if (from is PlayerMobile)
                    ((PlayerMobile)from).AutoStabled.Remove(pet);
			}
			else
			{
				SayTo( from, 1049612, pet.Name ); // ~1_NAME~ remained in the stables because you have too many followers.
			}
		}
		public bool CanInteractWith( Mobile from, bool ownerOnly )
		{
			if ( !from.CanSee( this ) || !Utility.InUpdateRange( from, this ) || !from.CheckAlive() )
				return false;

			if ( ownerOnly )
				return IsOwner( from );

			if ( House != null && House.IsBanned( from ) && !IsOwner( from ) )
			{
				from.SendLocalizedMessage( 1062674 ); // You can't shop from this home as you have been banned from this establishment.
				return false;
			}

			return true;
		}
Beispiel #26
0
		public void BeginStable( Mobile from )
		{
			if ( Deleted || !from.CheckAlive() )
				return;

			Container bank = from.FindBankNoCreate();
			
			if ( ( from.Backpack == null || from.Backpack.GetAmount( typeof( Gold ) ) < 30 ) && ( bank == null || bank.GetAmount( typeof( Gold ) ) < 30 ) )
			{
				SayTo( from, 1042556 ); // Thou dost not have enough gold, not even in thy bank account.
			}
			else
			{
				/* I charge 30 gold per pet for a real week's stable time.
				 * I will withdraw it from thy bank account.
				 * Which animal wouldst thou like to stable here?
				 */
				from.SendLocalizedMessage(1042558);

				from.Target = new StableTarget( this );
			}
		}
Beispiel #27
0
		public void BeginClaimList( Mobile from )
		{
			if ( Deleted || !from.CheckAlive() )
				return;

			ArrayList list = new ArrayList();

			for ( int i = 0; i < from.Stabled.Count; ++i )
			{
				BaseCreature pet = from.Stabled[i] as BaseCreature;

				if ( pet == null || pet.Deleted )
				{
					pet.IsStabled = false;
					from.Stabled.RemoveAt( i );
					--i;
					continue;
				}

				list.Add( pet );
			}

			if ( list.Count > 0 )
				from.SendGump( new ClaimListGump( this, from, list ) );
			else
				SayTo( from, 502671 ); // But I have no animals stabled with me at the moment!
		}
Beispiel #28
0
		public void EndStable( Mobile from, BaseCreature pet )
		{
			if ( Deleted || !from.CheckAlive() )
				return;

			if ( pet.Body.IsHuman )
			{
				SayTo( from, 502672 ); // HA HA HA! Sorry, I am not an inn.
			}
			else if ( !pet.Controlled )
			{
				SayTo( from, 1048053 ); // You can't stable that!
			}
			else if ( pet.ControlMaster != from )
			{
				SayTo( from, 1042562 ); // You do not own that pet!
			}
			else if ( pet.IsDeadPet )
			{
				SayTo( from, 1049668 ); // Living pets only, please.
			}
			else if ( pet.Summoned )
			{
				SayTo( from, 502673 ); // I can not stable summoned creatures.
			}
            /*
			else if ( pet.Allured )
			{
				SayTo( from, 1048053 ); // You can't stable that!
			}
*/
			else if ( (pet is PackLlama || pet is PackHorse || pet is Beetle) && (pet.Backpack != null && pet.Backpack.Items.Count > 0) )
			{
				SayTo( from, 1042563 ); // You need to unload your pet.
			}
			else if ( pet.Combatant != null && pet.InRange( pet.Combatant, 12 ) && pet.Map == pet.Combatant.Map )
			{
				SayTo( from, 1042564 ); // I'm sorry.  Your pet seems to be busy.
			}
			else if ( from.Stabled.Count >= GetMaxStabled( from ) )
			{
				SayTo( from, 1042565 ); // You have too many pets in the stables!
			}
			else
			{
				Container bank = from.FindBankNoCreate();

				if ( ( from.Backpack != null && from.Backpack.ConsumeTotal( typeof( Gold ), 30 ) ) || ( bank != null && bank.ConsumeTotal( typeof( Gold ), 30 ) ) )
				{
					pet.ControlTarget = null;
					pet.ControlOrder = OrderType.Stay;
					pet.Internalize();

					pet.SetControlMaster( null );
					pet.SummonMaster = null;

					pet.IsStabled = true;
                    pet.StabledBy = from;

					if ( Core.SE )	
						pet.Loyalty = BaseCreature.MaxLoyalty; // Wonderfully happy

					from.Stabled.Add( pet );

					SayTo( from, Core.AOS ? 1049677 : 502679 ); // [AOS: Your pet has been stabled.] Very well, thy pet is stabled. Thou mayst recover it by saying 'claim' to me. In one real world week, I shall sell it off if it is not claimed!
				}
				else
				{
					SayTo( from, 502677 ); // But thou hast not the funds in thy bank account!
				}
			}
		}
Beispiel #29
0
		public void BeginStable( Mobile from )
		{
			if ( Deleted || !from.CheckAlive() )
				return;

			if ( from.Stabled.Count >= GetMaxStabled( from ) )
			{
				SayTo( from, 1042565 ); // You have too many pets in the stables!
			}
			else
			{
				SayTo( from, 1042558 ); /* I charge 30 gold per pet for a real week's stable time.
										 * I will withdraw it from thy bank account.
										 * Which animal wouldst thou like to stable here?
										 */

				from.Target = new StableTarget( this );
			}
		}
Beispiel #30
0
		public void Claim( Mobile from, string petName )
		{
			if ( Deleted || !from.CheckAlive() )
				return;

			bool claimed = false;
			int stabled = 0;
			
			bool claimByName = ( petName != null );

			for ( int i = 0; i < from.Stabled.Count; ++i )
			{
				BaseCreature pet = from.Stabled[i] as BaseCreature;

				if ( pet == null || pet.Deleted )
				{
					pet.IsStabled = false;
                    pet.StabledBy = null;
					from.Stabled.RemoveAt( i );
					--i;
					continue;
				}

				++stabled;

				if ( claimByName && !Insensitive.Equals( pet.Name, petName ) )
					continue;

				if ( CanClaim( from, pet ) )
				{
					DoClaim( from, pet );

					from.Stabled.RemoveAt( i );

                    if (from is PlayerMobile)
                        ((PlayerMobile)from).AutoStabled.Remove(pet);

					--i;

					claimed = true;
				}
				else
				{
					SayTo( from, 1049612, pet.Name ); // ~1_NAME~ remained in the stables because you have too many followers.
				}
			}

			if ( claimed )
				SayTo( from, 1042559 ); // Here you go... and good day to you!
			else if ( stabled == 0 )
				SayTo( from, 502671 ); // But I have no animals stabled with me at the moment!
			else if ( claimByName )
				BeginClaimList( from );
		}
Beispiel #31
0
		public void Claim( Mobile from )
		{
			if ( Deleted || !from.CheckAlive() )
				return;

			bool claimed = false;
			int stabled = 0;

			for ( int i = 0; i < from.Stabled.Count; ++i )
			{
				BaseCreature pet = from.Stabled[i] as BaseCreature;

				if ( pet == null || pet.Deleted )
				{
					pet.IsStabled = false;
					from.Stabled.RemoveAt( i );
					--i;
					continue;
				}

				++stabled;

				if ( (from.Followers + pet.ControlSlots) <= from.FollowersMax )
				{
					pet.SetControlMaster( from );

					if ( pet.Summoned )
						pet.SummonMaster = from;

					pet.ControlTarget = from;
					pet.ControlOrder = OrderType.Follow;

					pet.MoveToWorld( from.Location, from.Map );

					pet.IsStabled = false;
					from.Stabled.RemoveAt( i );
					--i;

					claimed = true;
				}
				else
				{
					SayTo( from, 1049612, pet.Name ); // ~1_NAME~ remained in the stables because you have too many followers.
				}
			}

			if ( claimed )
				SayTo( from, 1042559 ); // Here you go... and good day to you!
			else if ( stabled == 0 )
				SayTo( from, 502671 ); // But I have no animals stabled with me at the moment!
		}
Beispiel #32
0
			public override void OnResponse( Mobile from, string text )
			{
				if ( text.Length > 40 )
					text = text.Substring( 0, 40 );

				if ( from.CheckAlive() && m_Book.IsChildOf( from.Backpack ) )
				{
					m_Book.BookName = Utility.FixHtml( text.Trim() );

					from.SendLocalizedMessage( 1062480 ); // The bulk order book's name has been changed.
				}
			}