public override void OnDoubleClick( Mobile from )
{

if( m_Placer == null || m_Placer.Deleted )
m_Placer = from;

if( from.InRange( this.GetWorldLocation(), 10 ) )
{
if( m_Placer == null || from == m_Placer || from.AccessLevel >= AccessLevel.GameMaster )
{
Container c = m_Placer.Backpack;
Gold t = new Gold( m_Value );
if( c.TryDropItem( m_Placer, t, true ) )
{
this.Delete();
m_Placer.SendMessage( "The item disolves and gives you a refund" );
}
else
{
t.Delete();
m_Placer.SendMessage("For some reason, the refund didn't work! Please page a GM");
}
}
else
{
from.SendMessage( "Stay out of my yard!" );
}
}
else
{
from.SendMessage( "The item is too far away" );
}
}
        public override void OnDoubleClick(Mobile from)
        {
            if (m_Placer == null || m_Placer.Deleted)
            {
                m_Placer = from;
            }

            if (from.InRange(this.GetWorldLocation(), 10))
            {
                if (m_Placer == null || from == m_Placer || from.AccessLevel >= AccessLevel.GameMaster)
                {
                    Container c = m_Placer.Backpack;
                    Gold      t = new Gold(m_Value);
                    if (c.TryDropItem(m_Placer, t, true))
                    {
                        this.Delete();
                        m_Placer.SendMessage("The item disolves and gives you a refund");
                    }
                    else
                    {
                        t.Delete();
                        m_Placer.SendMessage("For some reason, the refund didn't work! Please page a GM");
                    }
                }
                else
                {
                    from.SendMessage("Stay out of my yard!");
                }
            }
            else
            {
                from.SendMessage("The item is too far away");
            }
        }
Beispiel #3
0
        public void ExpireContract()
        {
            BankBox box = m_Issuer.BankBox;

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

                int deposited = 0;

                int toAdd = m_Copper;

                Gold copper;

                while (toAdd > 60000)
                {
                    copper = new Gold(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 Gold(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.
             * }*/
        }
Beispiel #4
0
        public override void OnDoubleClick(Mobile from)
        {
            BankBox box = from.FindBankNoCreate();

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

                int deposited = 0;

                int toAdd = m_Worth;

                Gold gold;

                while (toAdd > 60000)
                {
                    gold = new Gold(60000);

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

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

                        break;
                    }
                }

                if (toAdd > 0)
                {
                    gold = new Gold(toAdd);

                    if (box.TryDropItem(from, gold, false))
                    {
                        deposited += toAdd;
                    }
                    else
                    {
                        gold.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.
            }
        }
Beispiel #5
0
        protected override void OnTick()
        {
            int  z      = n_Map.GetAverageZ(n_X, n_Y);
            bool canFit = n_Map.CanFit(n_X, n_Y, z, 6, false, false);

            for (int i = -3; !canFit && i <= 3; ++i)
            {
                canFit = n_Map.CanFit(n_X, n_Y, z + i, 6, false, false);

                if (canFit)
                {
                    z += i;
                }
            }

            if (!canFit)
            {
                return;
            }

            Gold g = new Gold(1);

            g.MoveToWorld(new Point3D(n_X, n_Y, z), n_Map);


            switch (Utility.Random(3))
            {
            case 0:                     // Fire column
            {
                Effects.SendLocationParticles(EffectItem.Create(g.Location, g.Map, EffectItem.DefaultDuration), 0x3709, 10, 30, 5052);
                Effects.PlaySound(g, g.Map, 0x208);
                DoDamage(g, n_MinDamage, n_MaxDamage);

                break;
            }

            case 1:                     // Explosion
            {
                Effects.SendLocationParticles(EffectItem.Create(g.Location, g.Map, EffectItem.DefaultDuration), 0x36BD, 20, 10, 5044);
                Effects.PlaySound(g, g.Map, 0x307);
                DoDamage(g, n_MinDamage, n_MaxDamage);

                break;
            }

            case 2:                     // Ball of fire
            {
                Effects.SendLocationParticles(EffectItem.Create(g.Location, g.Map, EffectItem.DefaultDuration), 0x36FE, 10, 10, 5052);
                DoDamage(g, n_MinDamage, n_MaxDamage);

                break;
            }
            }
            g.Delete();
        }
		public override void OnClick()
		{
			Container c = m_From.Backpack;
			Gold t = new Gold( value );
			if( c.TryDropItem( m_From, t, true ) )
			{
				m_Stair.Delete();
				m_From.SendMessage( "The item disolves and gives you a refund" );
			}
			else
			{
				t.Delete();
				m_From.SendMessage("For some reason, the refund didn't work!  Please page a GM");
			}
		}
        public static void TransferGold(Mobile m, Container c, GoldLedger ledger, string nametitle)
        {
            Item[] items = c.FindItemsByType(typeof(Gold));

            foreach (Gold ngold in items)
            {
                Gold gold = ngold as Gold;

                if (gold != null)
                {
                    if (ledger.Gold < 999999999)
                    {
                        double maxWeight = (WeightOverloading.GetMaxWeight(m));
                        if ((Mobile.BodyWeight + m.TotalWeight) < (maxWeight))
                        {
                            int golda = gold.Amount;
                            if ((gold.Amount + ledger.Gold) > 999999999)
                            {
                                golda = (999999999 - ledger.Gold);
                            }
                            double maxgold = golda;
                            if (ledger.d_WeightScale > 0)
                            {
                                maxgold = ((maxWeight - ((double)Mobile.BodyWeight + (double)m.TotalWeight)) / ledger.d_WeightScale);
                            }
                            if (golda > maxgold)
                            {
                                golda = (int)maxgold;
                            }
                            int GoldID = 0;
                            if (golda == 1)
                            {
                                GoldID = gold.ItemID;
                            }
                            else if (golda > 1 && golda < 6)
                            {
                                GoldID = gold.ItemID + 1;
                            }
                            else if (golda >= 6)
                            {
                                GoldID = gold.ItemID + 2;
                            }
                            if (golda < gold.Amount)
                            {
                                gold.Amount -= golda;
                            }
                            else
                            {
                                gold.Delete();
                            }
                            ledger.Gold += golda;
                            if (ledger.b_open && golda > 0)
                            {
                                m.CloseGump(typeof(GoldLedgerGump));
                                m.SendGump(new GoldLedgerGump(ledger));
                            }

                            if (golda > 0)
                            {
                                m.SendMessage(2125, "You loot {0} gold from {1} and deposit it into your gold ledger.", golda.ToString("#,0"), nametitle);
                                Effects.SendMovingEffect(c, m, GoldID, 5, 50, true, false);
                                m.PlaySound(0x2E6);
                            }
                        }
                    }
                }
            }
        }
        public static bool GiveRewardTo( PlayerMobile player )
        {
            Gold gold = new Gold( Utility.RandomMinMax( 250, 350 ) );

            if ( player.PlaceInBackpack( gold ) )
            {
                player.SendLocalizedMessage( 1054076 ); // You have been given some gold.
                return true;
            }
            else
            {
                gold.Delete();
                return false;
            }
        }
        private static void getGold(string charUID, Mobile pm)
        {
            int amount = 0; // montants d'or
            int bankboxAmount = 0;
            string backpack = getPlayerItemSerial(charUID, SphereFiles.backFile);   // sac du joueur
            string bankbox = getPlayerItemSerial(charUID, SphereFiles.bankFile);    // banque du joueur

            // On parcourt le fichier qui contient tous les enregistrements d'or
            foreach (string line in File.ReadAllLines(SphereFiles.goldFile))
            {
                if (line.StartsWith("AMOUNT="))
                    amount = Int32.Parse(line.Split('=')[1]);

                if (amount > 0 && line.StartsWith("CONT=") && line.Split('=')[1] == backpack)
                {
                    Item gold = new Gold(amount);
                    Container pack = pm.Backpack;

                    if (pack != null)
                        pack.DropItem(gold);
                    else
                        gold.Delete();

                    amount = 0;
                }
                else if (amount > 0 && line.StartsWith("CONT=") && line.Split('=')[1] == bankbox)
                {
                    bankboxAmount += amount;
                    amount = 0;
                    //Item gold = new Gold(amount);
                    //Container bank = pm.BankBox;

                    //if (bank != null)
                    //    bank.DropItem(gold);
                    //else
                    //    gold.Delete();
                }
            }

            if (bankboxAmount > 0)
            {
                Container bank = pm.BankBox;
                if (bank != null)
                {
                    BankCheck check = new BankCheck(bankboxAmount);
                    check.Name = "Or Banque";
                    bank.DropItem(check);
                }
            }
            bankboxAmount = 0;
        }
Beispiel #10
0
		public override void OnDoubleClick( Mobile from )
		{
			BankBox box = from.FindBankNoCreate();

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

				int deposited = 0;

				int toAdd = m_Worth;

				Gold gold;

				while ( toAdd > 60000 )
				{
					gold = new Gold( 60000 );

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

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

						break;
					}
				}

				if ( toAdd > 0 )
				{
					gold = new Gold( toAdd );

					if ( box.TryDropItem( from, gold, false ) )
					{
						deposited += toAdd;
					}
					else
					{
						gold.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.
			}
		}
Beispiel #11
0
        public override void OnDoubleClick(Mobile from)
        {
            BankBox box = from.BankBox;

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

                int deposited = 0;

                int toAdd = m_Worth;

                Gold gold;

                while (toAdd > 60000)
                {
                    gold = new Gold(60000);

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

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

                        break;
                    }
                }

                if (toAdd > 0)
                {
                    gold = new Gold(toAdd);

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

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

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

                PlayerMobile pm = from as PlayerMobile;

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

                    if (qs is Necro.DarkTidesQuest)
                    {
                        QuestObjective obj = qs.FindObjective(typeof(Necro.CashBankCheckObjective));

                        if (obj != null && !obj.Completed)
                        {
                            obj.Complete();
                        }
                    }

                    if (qs is Haven.UzeraanTurmoilQuest)
                    {
                        QuestObjective obj = qs.FindObjective(typeof(Haven.CashBankCheckObjective));

                        if (obj != null && !obj.Completed)
                        {
                            obj.Complete();
                        }
                    }
                }
            }
            else
            {
                from.SendLocalizedMessage(1047026);                   // That must be in your bank box to use it.
            }
        }
Beispiel #12
0
        public override bool OnGoldGiven( Mobile from, Gold 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.OnGoldGiven( from, dropped );
        }
		public static bool RefundForVine( Mobile m_From )
		{
			Container c = m_From.Backpack;
			Gold t = new Gold( ( m_VinePrice ) );
			
			if( c.TryDropItem( m_From, t, true ) )
			{
				m_From.SendMessage( "You have been refunded "+m_VinePrice.ToString()+" gold for the deleted vine." );
				
				return true;
			}
			else
			{
				t.Delete();
				m_From.SendMessage("For some reason, the refund didn't work!  Please page a GM");
				
				return false;
			}
		}
Beispiel #14
0
            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;

                            Gold copper;

                            while (toAdd > 60000)
                            {
                                copper = new Gold(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 Gold(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;
                }
            }
Beispiel #15
0
		public override void OnDoubleClick(Mobile from)
		{
			// This probably isn't OSI accurate, but we can't just make the quests redundant.
			// Double-clicking the BankCheck in your pack will now credit your account.

			var box = AccountGold.Enabled ? from.Backpack : from.FindBankNoCreate();

			if (box == null || !IsChildOf(box))
			{
				from.SendLocalizedMessage(AccountGold.Enabled ? 1080058 : 1047026); 
				// This must be in your backpack to use it. : That must be in your bank box to use it.
				return;
			}

			Delete();

			var deposited = 0;
			var toAdd = m_Worth;

			if (AccountGold.Enabled && from.Account != null && from.Account.DepositGold(toAdd))
			{
				deposited = toAdd;
				toAdd = 0;
			}

			if (toAdd > 0)
			{
				Gold gold;

				while (toAdd > 60000)
				{
					gold = new Gold(60000);

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

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

						break;
					}
				}

				if (toAdd > 0)
				{
					gold = new Gold(toAdd);

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

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

			// Gold was deposited in your account:
			from.SendLocalizedMessage(1042672, true, deposited.ToString("#,0"));

			var pm = from as PlayerMobile;

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

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

					if (obj != null && !obj.Completed)
					{
						obj.Complete();
					}
				}

				if (qs is UzeraanTurmoilQuest)
				{
					var obj = qs.FindObjective(typeof(Engines.Quests.Haven.CashBankCheckObjective));

					if (obj != null && !obj.Completed)
					{
						obj.Complete();
					}
				}
			}
		}
 public void Refund()
 {
     Gold toGive = new Gold(Price);
     if (Placer.BankBox.TryDropItem(Placer, toGive, false))
     {
         Delete();
         Placer.SendLocalizedMessage(1060397, toGive.Amount.ToString()); // ~1_AMOUNT~ gold has been deposited into your bank box.
     }
     else
     {
         toGive.Delete();
         Placer.SendMessage("Your bankbox is full!");
     }
 }
Beispiel #17
0
 public override bool OnGoldGiven(Mobile from, Gold dropped)
 {
     Direction = GetDirectionTo(from);
     SayTo(from, 1153420); // Oh, thank you dearie!
     dropped.Delete();
     return true;
 }
            public override void OnClick()
            {
                if (m_From.InRange(m_Fountain.GetWorldLocation(), 4))
                {
                    if (m_From.Backpack.ConsumeTotal(typeof(Gold), 1))
                    {
                        m_Fountain.Jackpot++;

                        switch (m_Fountain.MessageNum)
                        {
                        case MagicFountainAddon.FountainMessage.Cool: {
                            if (0.001 > Utility.RandomDouble())
                            {
                                Gold gold = new Gold();
                                gold.Amount = m_Fountain.Jackpot;                                         // no need to test, it's always at least 1

                                if (!m_From.AddToBackpack(gold))
                                {
                                    m_From.SendMessage("You toss a coin in ... and a shower of gold leaps back out of the fountain! But you can't hold it! You accidentally drop it back in the fountain, where it vanishes.");
                                    gold.Delete();
                                }
                                else
                                {
                                    m_From.SendMessage("You toss a coin in ... and a shower of gold leaps back out of the fountain!");
                                    m_Fountain.Jackpot = 0;
                                }
                            }
                            else if (0.001 > Utility.RandomDouble())
                            {
                                Gold gold = new Gold();
                                gold.Amount = m_Fountain.Jackpot;                                         // no need to test, it's always at least 1

                                if (!m_From.AddToBackpack(gold))
                                {
                                    m_From.SendMessage("You toss a coin in ... and a shower of gold leaps back out of the fountain! But you can't hold it! You accidentally drop it back in the fountain, where it vanishes.");
                                    gold.Delete();
                                }
                                else
                                {
                                    m_From.SendMessage("You toss a coin in ... and a shower of gold leaps back out of the fountain!");
                                    m_Fountain.Jackpot = 0;
                                }
                            }
                            else
                            {
                                m_From.SendMessage("You toss a coin in ... but nothing happens.");
                            }

                            break;
                        }


                        case MagicFountainAddon.FountainMessage.Warm: {
                            if (0.01 > Utility.RandomDouble())
                            {
                                Item item = null;

                                switch (Utility.RandomMinMax(1, 10))
                                {
                                case 1:  item = new TinkerTools();                              break;

                                case 2:  item = new Lockpick(3);                                break;

                                case 3:  item = new Pitchfork();                                break;

                                case 4:  item = new Dagger();                                   break;

                                case 5:  item = new Emerald();                                  break;

                                case 6:  item = new Ruby();                                     break;

                                case 7:  item = new Amber();                                    break;

                                case 8:  item = new Server.Engines.Mahjong.MahjongGame();       break;

                                case 9:  item = new SewingKit();                                break;

                                case 10: item = new SmithHammer();                              break;
                                }

                                if (!m_From.AddToBackpack(item))
                                {
                                    m_From.SendMessage("You toss a coin in ... and an item appears! But you can't hold it! You accidentally drop it back in the fountain, where it vanishes.");
                                    item.Delete();
                                }
                                else
                                {
                                    m_From.SendMessage("You toss a coin in ... and an item appears!");

                                    if (m_Fountain.Jackpot > 10)
                                    {
                                        m_Fountain.Jackpot = m_Fountain.Jackpot - 5;
                                    }
                                }
                            }
                            else if (0.001 > Utility.RandomDouble())
                            {
                                Gold gold = new Gold();
                                gold.Amount = m_Fountain.Jackpot;                                         // no need to test, it's always at least 1

                                if (!m_From.AddToBackpack(gold))
                                {
                                    m_From.SendMessage("You toss a coin in ... and a shower of gold leaps back out of the fountain! But you can't hold it! You accidentally drop it back in the fountain, where it vanishes.");
                                    gold.Delete();
                                }
                                else
                                {
                                    m_From.SendMessage("You toss a coin in ... and a shower of gold leaps back out of the fountain!");
                                    m_Fountain.Jackpot = 0;
                                }
                            }
                            else
                            {
                                m_From.SendMessage("You toss a coin in ... but nothing happens.");
                            }

                            break;
                        }


                        case MagicFountainAddon.FountainMessage.Clean: {
                            if (0.05 > Utility.RandomDouble())
                            {
                                Item food = null;

                                switch (Utility.RandomMinMax(1, 10))
                                {
                                case 1:  food = new Bacon();            break;

                                case 2:  food = new CookedBird();       break;

                                case 3:  food = new Ham();                      break;

                                case 4:  food = new Ribs();                     break;

                                case 5:  food = new Sausage();          break;

                                case 6:  food = new Cookies();          break;

                                case 7:  food = new Muffins(3);         break;

                                case 8:  food = new ApplePie();         break;

                                case 9:  food = new PeachCobbler();             break;

                                case 10: food = new Lime();             break;
                                }

                                if (!m_From.AddToBackpack(food))
                                {
                                    m_From.SendMessage("You toss a coin in ... and food appears! But you can't hold it! You accidentally drop it back in the fountain, where it vanishes.");
                                    food.Delete();
                                }
                                else
                                {
                                    m_From.SendMessage("You toss a coin in ... and food appears!");

                                    if (m_Fountain.Jackpot > 10)
                                    {
                                        m_Fountain.Jackpot = m_Fountain.Jackpot - 5;
                                    }
                                }
                            }
                            else if (0.001 > Utility.RandomDouble())
                            {
                                Gold gold = new Gold();
                                gold.Amount = m_Fountain.Jackpot;                                         // no need to test, it's always at least 1

                                if (!m_From.AddToBackpack(gold))
                                {
                                    m_From.SendMessage("You toss a coin in ... and a shower of gold leaps back out of the fountain! But you can't hold it! You accidentally drop it back in the fountain, where it vanishes.");
                                    gold.Delete();
                                }
                                else
                                {
                                    m_From.SendMessage("You toss a coin in ... and a shower of gold leaps back out of the fountain!");
                                    m_Fountain.Jackpot = 0;
                                }
                            }
                            else
                            {
                                m_From.SendMessage("You toss a coin in ... but nothing happens.");
                            }

                            break;
                        }

                        case MagicFountainAddon.FountainMessage.Calm: {
                            if (0.005 > Utility.RandomDouble())
                            {
                                Horse horse = new Horse();

                                horse.Map      = m_From.Map;
                                horse.Location = m_From.Location;

                                if ((m_From.Followers + horse.ControlSlots) <= m_From.FollowersMax)
                                {
                                    // set up the horse... =P
                                    horse.Controlled    = true;
                                    horse.ControlMaster = m_From;

                                    horse.OwnerAbandonTime = DateTime.MinValue;
                                    horse.BondingBegin     = DateTime.MinValue;

                                    horse.ControlOrder  = OrderType.Follow;
                                    horse.ControlTarget = m_From;
                                    horse.Owners.Add(m_From);                                                // seems to be new in 2.0
                                    // horse.Loyalty = PetLoyalty.WonderfullyHappy;  // doesn't work in 2.0 but seems unnecessary

                                    m_From.SendMessage("You toss a coin in ... and a horse appears!");
                                }
                                else
                                {
                                    m_From.SendMessage("You toss a coin in ... and a horse appears! But you have too many pets to control this one too. The horse runs off!");
                                    horse.Delete();
                                }

                                if (m_Fountain.Jackpot > 20)
                                {
                                    m_Fountain.Jackpot = m_Fountain.Jackpot - 10;
                                }
                            }
                            else if (0.001 > Utility.RandomDouble())
                            {
                                Gold gold = new Gold();
                                gold.Amount = m_Fountain.Jackpot;                                         // no need to test, it's always at least 1

                                if (!m_From.AddToBackpack(gold))
                                {
                                    m_From.SendMessage("You toss a coin in ... and a shower of gold leaps back out of the fountain! But you can't hold it! You accidentally drop it back in the fountain, where it vanishes.");
                                    gold.Delete();
                                }
                                else
                                {
                                    m_From.SendMessage("You toss a coin in ... and a shower of gold leaps back out of the fountain!");
                                    m_Fountain.Jackpot = 0;
                                }
                            }
                            else
                            {
                                m_From.SendMessage("You toss a coin in ... but nothing happens.");
                            }

                            break;
                        }


                        case MagicFountainAddon.FountainMessage.Fruit: {
                            if (0.05 > Utility.RandomDouble())
                            {
                                Item fruit = null;

                                switch (Utility.RandomMinMax(1, 10))
                                {
                                case 1:  fruit = new Watermelon();      break;

                                case 2:  fruit = new Apple();           break;

                                case 3:  fruit = new Pear();            break;

                                case 4:  fruit = new Peach();           break;

                                case 5:  fruit = new Lime();            break;

                                case 6:  fruit = new Lemon();           break;

                                case 7:  fruit = new Coconut();         break;

                                case 8:  fruit = new Grapes();          break;

                                case 9:  fruit = new Bananas();         break;

                                case 10: fruit = new Cantaloupe();      break;
                                }

                                if (!m_From.AddToBackpack(fruit))
                                {
                                    m_From.SendMessage("You toss a coin in ... and fruit appears! But you can't hold it! You accidentally drop it back in the fountain, where it vanishes.");
                                    fruit.Delete();
                                }
                                else
                                {
                                    m_From.SendMessage("You toss a coin in ... and fruit appears!");

                                    if (m_Fountain.Jackpot > 10)
                                    {
                                        m_Fountain.Jackpot = m_Fountain.Jackpot - 5;
                                    }
                                    else
                                    {
                                        m_Fountain.Jackpot = 0;
                                    }
                                }
                            }
                            else if (0.001 > Utility.RandomDouble())
                            {
                                Gold gold = new Gold();
                                gold.Amount = m_Fountain.Jackpot;                                         // no need to test, it's always at least 1

                                if (!m_From.AddToBackpack(gold))
                                {
                                    m_From.SendMessage("You toss a coin in ... and a shower of gold leaps back out of the fountain! But you can't hold it! You accidentally drop it back in the fountain, where it vanishes.");
                                    gold.Delete();
                                }
                                else
                                {
                                    m_From.SendMessage("You toss a coin in ... and a shower of gold leaps back out of the fountain!");
                                    m_Fountain.Jackpot = 0;
                                }
                            }
                            else
                            {
                                m_From.SendMessage("You toss a coin in ... but nothing happens.");
                            }

                            break;
                        }
                        }
                    }
                    else
                    {
                        m_From.SendMessage("You don't have a coin to toss in.");
                    }
                }
                else
                {
                    m_From.SendMessage("Get closer.");
                }
            }
Beispiel #19
0
        public override void OnDoubleClick(Mobile from)
        {
            if (this.Parent != null)
            {
                return;
            }

            // check the range between the player and weapon
            if (!from.InRange(this.Location, this.MinFiringRange) || from.Map != this.Map)
            {
                from.SendLocalizedMessage(500446); // That is too far away.
                return;
            }

            if (this.Storing)
            {
                from.SendMessage("{0} being stored", this.Name);
                return;
            }

            if (this.Projectile == null || this.Projectile.Deleted)
            {
                from.SendMessage("{0} empty", this.Name);
                return;
            }

            // check if the cannon is cool enough to fire
            if (this.NextFiring.Seconds > 0)
            {
                from.SendMessage("Not ready yet.");
                return;
            }

            //new way to fire
            Map map = Map;

            if (map == null)
            {
                return;
            }

            int rx = 0, ry = 0;

            if (Facing == 0)
            {
                rx = -1;
            }
            else if (Facing == 1)
            {
                ry = -1;
            }
            else if (Facing == 2)
            {
                rx = 1;
            }
            else if (Facing == 3)
            {
                ry = 1;
            }

            for (int i = 1; i <= 15; ++i)
            {
                int x = X + (i * rx);
                int y = Y + (i * ry);
                int z;

                for (int j = -16; j <= 16; ++j)
                {
                    z = from.Z + j;

                    Point3D currentLocation = new Point3D(x, y, z);
                    Item    goldToken       = new Gold(100);
                    goldToken.Visible  = false;
                    goldToken.Map      = Map;
                    goldToken.Location = currentLocation;

                    foreach (Item item in goldToken.GetItemsInRange(10))
                    {
                        if (item is BaseShip)
                        {
                            BaseShip target = (BaseShip)item;


                            //Console.WriteLine("attacking {0} at {1}:{2}", multiitem, tileloc, ((StaticTarget)targeted).Location);
                            // may have to reconsider the use tileloc vs target loc
                            //m_cannon.AttackTarget(from, multiitem, ((StaticTarget)targeted).Location);
                            if (target != this.Transport)
                            {
                                goldToken.Delete();
                                return;
                            }
                        }
                    }

                    goldToken.Delete();
                }

                z = map.GetAverageZ(x, y);


                Point3D currentLocation2 = new Point3D(x, y, z);
                Item    goldToken2       = new Gold(100);
                goldToken2.Visible  = false;
                goldToken2.Map      = Map;
                goldToken2.Location = currentLocation2;
                foreach (Item item in goldToken2.GetItemsInRange(10))
                {
                    if (item is BaseShip)
                    {
                        BaseShip target = (BaseShip)item;


                        //Console.WriteLine("attacking {0} at {1}:{2}", multiitem, tileloc, ((StaticTarget)targeted).Location);
                        // may have to reconsider the use tileloc vs target loc
                        //m_cannon.AttackTarget(from, multiitem, ((StaticTarget)targeted).Location);
                        if (target != this.Transport)
                        {
                            goldToken2.Delete();
                            return;
                        }
                    }
                }

                goldToken2.Delete();
            }
        }
        public static void GoldSweep(Mobile m, Gold gold)
        {
            Item item = m.Backpack.FindItemByType(typeof(GoldLedger));

            GoldLedger ledger = item as GoldLedger;

            if (ledger == null)
                return;

            if (!ledger.GoldSweeper || !GoldLedger.GoldSweeperAvailable)
                return;

            if (gold != null)
            {
                if (ledger.Gold < 999999999)
                {
                    double maxWeight = (WeightOverloading.GetMaxWeight(m));
                    if ((Mobile.BodyWeight + m.TotalWeight) < (maxWeight))
                    {
                        int golda = gold.Amount;
                        if ((gold.Amount + ledger.Gold) > 999999999)
                            golda = (999999999 - ledger.Gold);
                        double maxgold = golda;
                        if (ledger.d_WeightScale > 0)
                            maxgold = ((maxWeight - ((double)Mobile.BodyWeight + (double)m.TotalWeight)) / ledger.d_WeightScale);
                        if (golda > maxgold)
                            golda = (int)maxgold;
                        int GoldID = 0;
                        if (golda == 1)
                            GoldID = gold.ItemID;
                        else if (golda > 1 && golda < 6)
                            GoldID = gold.ItemID + 1;
                        else if (golda >= 6)
                            GoldID = gold.ItemID + 2;
                        if (golda < gold.Amount)
                            gold.Amount -= golda;
                        else
                            gold.Delete();
                        ledger.Gold += golda;
                        if (ledger.b_open && golda > 0)
                        {
                            m.CloseGump(typeof(GoldLedgerGump));
                            m.SendGump(new GoldLedgerGump(ledger));
                        }

                        if (golda > 0)
                        {
                            m.SendMessage(2125, "You deposit {0} gold into your gold ledger.", golda.ToString("#,0"));
                            if (!m.Mounted)
                                m.Animate(32, 5, 1, true, false, 0);
                            Effects.SendMovingEffect(gold, m, GoldID, 5, 50, true, false);
                            m.PlaySound(0x2E6);
                        }
                    }
                }}}}}
        public static void GoldSweep(Mobile m, Gold gold)
        {
            Item item = m.Backpack.FindItemByType(typeof(GoldLedger));

            GoldLedger ledger = item as GoldLedger;

            if (ledger == null)
            {
                return;
            }

            if (!ledger.GoldSweeper || !GoldLedger.GoldSweeperAvailable)
            {
                return;
            }

            if (gold != null)
            {
                if (ledger.Gold < 999999999)
                {
                    double maxWeight = (WeightOverloading.GetMaxWeight(m));
                    if ((Mobile.BodyWeight + m.TotalWeight) < (maxWeight))
                    {
                        int golda = gold.Amount;
                        if ((gold.Amount + ledger.Gold) > 999999999)
                        {
                            golda = (999999999 - ledger.Gold);
                        }
                        double maxgold = golda;
                        if (ledger.d_WeightScale > 0)
                        {
                            maxgold = ((maxWeight - ((double)Mobile.BodyWeight + (double)m.TotalWeight)) / ledger.d_WeightScale);
                        }
                        if (golda > maxgold)
                        {
                            golda = (int)maxgold;
                        }
                        int GoldID = 0;
                        if (golda == 1)
                        {
                            GoldID = gold.ItemID;
                        }
                        else if (golda > 1 && golda < 6)
                        {
                            GoldID = gold.ItemID + 1;
                        }
                        else if (golda >= 6)
                        {
                            GoldID = gold.ItemID + 2;
                        }
                        if (golda < gold.Amount)
                        {
                            gold.Amount -= golda;
                        }
                        else
                        {
                            gold.Delete();
                        }
                        ledger.Gold += golda;
                        if (ledger.b_open && golda > 0)
                        {
                            m.CloseGump(typeof(GoldLedgerGump));
                            m.SendGump(new GoldLedgerGump(ledger));
                        }

                        if (golda > 0)
                        {
                            m.SendMessage(2125, "You deposit {0} gold into your gold ledger.", golda.ToString("#,0"));
                            if (!m.Mounted)
                            {
                                m.Animate(32, 5, 1, true, false, 0);
                            }
                            Effects.SendMovingEffect(gold, m, GoldID, 5, 50, true, false);
                            m.PlaySound(0x2E6);
                        }
                    }
                }
            }
        }
		public static void GiveRewardTo( PlayerMobile player, ref bool bagOfSending, ref bool powderOfTranslocation, ref bool gold )
		{
			if ( bagOfSending )
			{
				Item reward = new BagOfSending();

				if ( player.PlaceInBackpack( reward ) )
				{
					player.SendLocalizedMessage( 1054074, "", 0x59 ); // You have been given a bag of sending.
					bagOfSending = false;
				}
				else
				{
					reward.Delete();
				}
			}

			if ( powderOfTranslocation )
			{
				Item reward = new PowderOfTranslocation( Utility.RandomMinMax( 10, 12 ) );

				if ( player.PlaceInBackpack( reward ) )
				{
					player.SendLocalizedMessage( 1054075, "", 0x59 ); // You have been given some powder of translocation.
					powderOfTranslocation = false;
				}
				else
				{
					reward.Delete();
				}
			}

			if ( gold )
			{
				Item reward = new Gold( Utility.RandomMinMax( 250, 350 ) );

				if ( player.PlaceInBackpack( reward ) )
				{
					player.SendLocalizedMessage( 1054076, "", 0x59 ); // You have been given some gold.
					gold = false;
				}
				else
				{
					reward.Delete();
				}
			}
		}
        public override bool OnGoldGiven(Mobile from, Gold dropped)
        {
                Direction = GetDirectionTo(from);
                if (!from.Female)
                {

                    if (dropped.Amount <= 9)

                        SayTo(from, "Thank you, but for that not even a goat would be at your service!");

                    if (dropped.Amount >= 10)
                    {
                        if (dropped.Amount <= 99 && dropped.Amount <= from.HitsMax - from.Hits)
                        {
                            from.Hits = dropped.Amount;
                        }

                        if (dropped.Amount <= 99 && dropped.Amount >= from.HitsMax - from.Hits)
                        {
                            from.Hits += from.HitsMax;
                        }

                        if (dropped.Amount >= 100)
                        {
                            from.SendMessage("You feel totally relaxed and painfree.");
                            from.Hits = from.HitsMax;
                            from.Mana = from.ManaMax;
                            from.Stam = from.StamMax;
                        }
                        SayTo(from, "Let me give you a relaxing massage.");
                        from.SendMessage("She gives you a nice treatment.");

                        switch (Utility.Random(6))
                        {
                            case 0:
                                {
                                    from.PlaySound(from.Female ? 811 : 1085);
                                    from.Say("oooh");
                                    break;
                                }
                            case 1:
                                {
                                    PlaySound(800);
                                    from.PlaySound(from.Female ? 800 : 1072);
                                    from.Emote("*kisses*");
                                    break;
                                }
                            case 2:
                                {
                                    from.PlaySound(from.Female ? 816 : 1090);
                                    from.Emote("*sighs*");
                                    break;
                                }
                            case 3:
                                {
                                    from.PlaySound(from.Female ? 823 : 1097);
                                    from.Say("yeah!");
                                    break;
                                }
                            case 4:
                                {
                                    from.PlaySound(from.Female ? 795 : 1067);
                                    from.Emote("*groans*");
                                    break;
                                }
                            case 5:
                                {
                                    from.PlaySound(from.Female ? 778 : 1049);
                                    from.Say("ah!");
                                    break;
                                }
                        }
                    }
                    dropped.Delete();
                    return true;
                }
                else
                {
                    SayTo(from, "Hey, leave me alone!");
                    from.SendMessage("She takes your money and turns around.");
                    return true;
                }
        
        }
Beispiel #24
0
       public override void OnDoubleClick(Mobile from)
        {			
            if (this.Parent != null)
                return;

            // check the range between the player and weapon
            if (!from.InRange(this.Location, this.MinFiringRange) || from.Map != this.Map)
            {
                from.SendLocalizedMessage(500446); // That is too far away.
                return;
            }

            if (this.Storing)
            {
                from.SendMessage("{0} being stored", this.Name);
                return;
            }

            if (this.Projectile == null || this.Projectile.Deleted)
            {
                from.SendMessage("{0} empty", this.Name);
                return;
            }

            // check if the cannon is cool enough to fire
            if (this.NextFiring.Seconds > 0)
            {
                from.SendMessage("Not ready yet.");
                return;
            }
			
			//new way to fire
			Map map = Map;

			if ( map == null )
				return;

			int rx = 0, ry = 0;

			if ( Facing == 0 )
				rx = -1;
			else if ( Facing == 1 )
				ry = -1;
			else if ( Facing == 2 )
				rx = 1;
			else if ( Facing == 3 )
				ry = 1;

			for ( int i = 1; i <= 15; ++i )
			{
				int x = X + (i*rx);
				int y = Y + (i*ry);
				int z;

				for ( int j = -16; j <= 16; ++j )
				{
					z = from.Z + j;

					Point3D currentLocation = new Point3D( x, y, z );
					Item goldToken = new Gold(100);
					goldToken.Visible = false;
					goldToken.Map = Map;
					goldToken.Location = currentLocation;
					
					foreach (Item item in goldToken.GetItemsInRange(10))
						if (item is BaseShip)
						{
							BaseShip target = (BaseShip) item;
																	

							//Console.WriteLine("attacking {0} at {1}:{2}", multiitem, tileloc, ((StaticTarget)targeted).Location);
							// may have to reconsider the use tileloc vs target loc
							//m_cannon.AttackTarget(from, multiitem, ((StaticTarget)targeted).Location);
							if (target != this.Transport)
							{
								goldToken.Delete();
								return;
							}
							
						}

					goldToken.Delete();
						
				}

				z = map.GetAverageZ( x, y );


				Point3D currentLocation2 = new Point3D( x, y, z );
				Item goldToken2 = new Gold(100);
				goldToken2.Visible = false;
				goldToken2.Map = Map;
				goldToken2.Location = currentLocation2;
				foreach (Item item in goldToken2.GetItemsInRange(10))
					if (item is BaseShip)
					{
						BaseShip target = (BaseShip) item;
																

						//Console.WriteLine("attacking {0} at {1}:{2}", multiitem, tileloc, ((StaticTarget)targeted).Location);
						// may have to reconsider the use tileloc vs target loc
						//m_cannon.AttackTarget(from, multiitem, ((StaticTarget)targeted).Location);												
						if (target != this.Transport)
						{
							goldToken2.Delete();
							return;
						}						
					}	
					
				goldToken2.Delete();
			}			
        }				
Beispiel #25
0
        public override void OnDoubleClick(Mobile from)
        {
            // This probably isn't OSI accurate, but we can't just make the quests redundant.
            // Double-clicking the BankCheck in your pack will now credit your account.

            Container box = AccountGold.Enabled ? from.Backpack : from.FindBankNoCreate();

            if (box == null || !IsChildOf(box))
            {
                from.SendLocalizedMessage(AccountGold.Enabled ? 1080058 : 1047026);
                // This must be in your backpack to use it. : That must be in your bank box to use it.
                return;
            }

            Delete();

            int deposited = 0;
            int toAdd     = m_Worth;

            if (AccountGold.Enabled && from.Account != null && from.Account.DepositGold(toAdd))
            {
                deposited = toAdd;
                toAdd     = 0;
            }

            if (toAdd > 0)
            {
                Gold gold;

                while (toAdd > 60000)
                {
                    gold = new Gold(60000);

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

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

                        break;
                    }
                }

                if (toAdd > 0)
                {
                    gold = new Gold(toAdd);

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

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

            // Gold was deposited in your account:
            from.SendLocalizedMessage(1042672, true, deposited.ToString("#,0"));
        }
Beispiel #26
0
        public override bool OnGoldGiven( Mobile from, Gold 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.UtcNow )
                {
                    SayTo( from, 501048 ); // You are too young to join my guild...
                }
                else if ( CheckCustomReqs( pm ) )
                {
                    SayWelcomeTo( from );

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

                    dropped.Delete();
                    return true;
                }

                return false;
            }

            return base.OnGoldGiven( from, dropped );
        }
Beispiel #27
0
        public override void OnDelete()
        {
            // if the game is in progress, then return all Entry fees
            if(GameInProgress)
            {
                GameBroadcast(100003,ChallengeName);  // "{0} cancelled"

                // go through the participants and return their fees and clear noto
                if(Participants != null)
                {
                    foreach(IChallengeEntry entry in Participants)
                    {
                        if(entry.Status == ChallengeStatus.Forfeit) continue;

                        Mobile from = entry.Participant;

                        // return the entry fee
                        if(from != null && from.BankBox != null && EntryFee > 0)
                        {
                            Item gold = new Gold(EntryFee);

                            if ( !from.BankBox.TryDropItem( from, gold, false ) )
        					{
        						gold.Delete();
        						from.AddToBackpack( new BankCheck( EntryFee ) );
        						XmlPoints.SendText(from, 100000, EntryFee); // "Entry fee of {0} gold has been returned to you."
        					} else
        					{
                                XmlPoints.SendText(from, 100001, EntryFee);  // "Entry fee of {0} gold has been returned to your bank account."
                            }
                        }

                        entry.Status = ChallengeStatus.None;
                    }

                    // clear all noto
                    foreach(IChallengeEntry entry in Participants)
                    {
                        RefreshNoto(entry.Participant);
                    }
                }
                
                EndGame();
            } else
            if(!GameCompleted)
            {
                // this is when a game is cancelled during setup
                GameBroadcast(100003,ChallengeName); // "{0} cancelled"
            }

            base.OnDelete();
        }
Beispiel #28
0
		public override bool OnGoldGiven( Mobile from, Gold dropped )
		{
			if ( from is PlayerMobile && dropped.Amount >= 500 )
			{
				PlayerMobile pm = (PlayerMobile)from;

				//reduce Timer by X for each 500 gold drop by 1/2 hour
				double timeReduced = 0;
				for(int i=500; i<=dropped.Amount; i+=500)
				{
					pm.ReduceKillTimersByHours(.5);
					timeReduced += .5;
				}

				Say( "My thanks!  We'll see what we can do about your time here" );
				from.SendMessage("Your time has been reduced by " + timeReduced + " hours.");

				dropped.Delete();
			}
			else
			{
				Say("My thanks, I'll be sure to use this wisely");
				dropped.Delete();
			}

			return true;
		}
Beispiel #29
0
		public virtual bool OnGoldGiven( Mobile from, Gold 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 gold?" );

				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;
		}
Beispiel #30
0
        public override void OnDoubleClick(Mobile from)
        {
            // This probably isn't OSI accurate, but we can't just make the quests redundant.
            // Double-clicking the BankCheck in your pack will now credit your account.

            var box = AccountGold.Enabled ? from.Backpack : from.FindBankNoCreate();

            if (box == null || !IsChildOf(box))
            {
                from.SendLocalizedMessage(AccountGold.Enabled ? 1080058 : 1047026);
                // This must be in your backpack to use it. : That must be in your bank box to use it.
                return;
            }

            Delete();

            var deposited = 0;
            var toAdd     = m_Worth;

            if (AccountGold.Enabled && from.Account != null && from.Account.DepositGold(toAdd))
            {
                deposited = toAdd;
                toAdd     = 0;
            }

            if (toAdd > 0)
            {
                Gold gold;

                while (toAdd > 60000)
                {
                    gold = new Gold(60000);

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

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

                        break;
                    }
                }

                if (toAdd > 0)
                {
                    gold = new Gold(toAdd);

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

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

            // Gold was deposited in your account:
            from.SendLocalizedMessage(1042672, true, deposited.ToString("#,0"));

            var pm = from as PlayerMobile;

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

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

                    if (obj != null && !obj.Completed)
                    {
                        obj.Complete();
                    }
                }

                if (qs is UzeraanTurmoilQuest)
                {
                    var obj = qs.FindObjective(typeof(Engines.Quests.Haven.CashBankCheckObjective));

                    if (obj != null && !obj.Completed)
                    {
                        obj.Complete();
                    }
                }
            }
        }
Beispiel #31
0
            protected override void OnTick()
            {
                int  z      = m_Map.GetAverageZ(m_X, m_Y);
                bool canFit = m_Map.CanFit(m_X, m_Y, z, 6, false, false);

                for (int i = -3; !canFit && i <= 3; ++i)
                {
                    canFit = m_Map.CanFit(m_X, m_Y, z + i, 6, false, false);

                    if (canFit)
                    {
                        z += i;
                    }
                }

                if (!canFit)
                {
                    return;
                }

                Item g = new Gold(100, 200); g.Delete();

                switch (Utility.Random(4))
                {
                case 0: g = new DDJewels(50, 100); break;

                case 1: g = new Gold(100, 200); break;

                case 2: g = new DDSilver(200, 300); break;

                case 3: g = new DDSilver(200, 300); break;
                }

                g.MoveToWorld(new Point3D(m_X, m_Y, z), m_Map);

                if (0.5 >= Utility.RandomDouble())
                {
                    switch (Utility.Random(3))
                    {
                    case 0:                             // Fire column
                    {
                        Effects.SendLocationParticles(EffectItem.Create(g.Location, g.Map, EffectItem.DefaultDuration), 0x3709, 10, 30, 5052);
                        Effects.PlaySound(g, g.Map, 0x208);

                        break;
                    }

                    case 1:                             // Explosion
                    {
                        Effects.SendLocationParticles(EffectItem.Create(g.Location, g.Map, EffectItem.DefaultDuration), 0x36BD, 20, 10, 5044);
                        Effects.PlaySound(g, g.Map, 0x307);

                        break;
                    }

                    case 2:                             // Ball of fire
                    {
                        Effects.SendLocationParticles(EffectItem.Create(g.Location, g.Map, EffectItem.DefaultDuration), 0x36FE, 10, 10, 5052);

                        break;
                    }
                    }
                }
            }
        public void EndAddGold(Mobile from, object obj)
        {
            from.CloseGump(typeof(GoldLedgerGump));

            if (obj is Item)
            {
                Item   item      = obj as Item;
                double maxWeight = (WeightOverloading.GetMaxWeight(from));
                int    golda     = 0;

                if (!this.IsChildOf(from.Backpack))
                {
                    from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
                    return;
                }
                if (!item.IsAccessibleTo(from))
                {
                    from.SendGump(new GoldLedgerGump(this));
                    from.SendLocalizedMessage(3000270); // That is not accessible.
                    return;
                }

                if (obj is Gold)
                {
                    Gold gold = obj as Gold;

                    golda = gold.Amount;
                    if ((gold.Amount + this.Gold) > 999999999)
                    {
                        golda = (999999999 - this.Gold);
                    }
                    double maxgold = golda;
                    if (this.d_WeightScale > 0 && gold.RootParent != from)
                    {
                        maxgold = ((maxWeight - ((double)Mobile.BodyWeight + (double)from.TotalWeight)) / this.d_WeightScale);
                    }
                    if (golda > maxgold)
                    {
                        golda = (int)maxgold;
                    }
                    if (golda < gold.Amount)
                    {
                        gold.Amount -= golda;
                    }
                    else
                    {
                        gold.Delete();
                    }

                    this.Gold += golda;

                    from.SendGump(new GoldLedgerGump(this));
                    from.SendMessage(2125, String.Format("You deposit {0} gold into your gold ledger.", golda.ToString("#,0")));
                    from.PlaySound(0x249);
                }
                else if (obj is BankCheck)
                {
                    BankCheck check = obj as BankCheck;

                    golda = check.Worth;
                    if ((check.Worth + this.Gold) > 999999999)
                    {
                        golda = (999999999 - this.Gold);
                    }
                    double maxgold = golda;
                    if (this.d_WeightScale > 0)
                    {
                        maxgold = ((maxWeight - ((double)Mobile.BodyWeight + (double)from.TotalWeight)) / this.d_WeightScale);
                    }
                    if (golda > maxgold)
                    {
                        golda = (int)maxgold;
                    }
                    if (golda < check.Worth)
                    {
                        check.Worth -= golda;
                    }
                    else
                    {
                        check.Delete();
                    }

                    this.Gold += golda;

                    from.SendGump(new GoldLedgerGump(this));
                    from.SendMessage(2125, String.Format("You deposit a bank check worth {0} gold into your gold ledger.", golda.ToString("#,0")));
                    from.PlaySound(0x249);
                }
                else if (obj is GoldLedger && obj != this)
                {
                    GoldLedger gledger = obj as GoldLedger;

                    golda = gledger.Gold;
                    if ((gledger.Gold + this.Gold) > 999999999)
                    {
                        golda = (999999999 - this.Gold);
                    }
                    double maxgold = golda;
                    if (this.d_WeightScale > 0)
                    {
                        maxgold = ((maxWeight - ((double)Mobile.BodyWeight + (double)from.TotalWeight)) / this.d_WeightScale);
                    }
                    if (golda > maxgold)
                    {
                        golda = (int)maxgold;
                    }
                    gledger.Gold -= golda;

                    this.Gold += golda;

                    from.SendGump(new GoldLedgerGump(this));
                    from.SendMessage(2125, String.Format("You transfer {0} gold into your gold ledger.", golda.ToString("#,0")));
                    from.PlaySound(0x249);
                }
                else
                {
                    from.SendGump(new GoldLedgerGump(this));
                    from.SendMessage(2125, "You can only deposit gold or bank checks into your gold ledger.");
                }
            }
            else
            {
                from.SendGump(new GoldLedgerGump(this));
                from.SendMessage(2125, "You can only deposit gold or bank checks into your gold ledger.");
            }

            from.SendMessage(2125, "Do you want to deposit anything else? (ESC to cancel)");
            from.Target = new AddGoldTarget(this);
        }
            protected override void OnTick()
            {
                int  z      = m_Map.GetAverageZ(m_X, m_Y);
                bool canFit = m_Map.CanFit(m_X, m_Y, z, 6, false, false);

                for (int i = -3; !canFit && i <= 3; ++i)
                {
                    canFit = m_Map.CanFit(m_X, m_Y, z + i, 6, false, false);

                    if (canFit)
                    {
                        z += i;
                    }
                }

                if (!canFit)
                {
                    return;
                }

                Item g = new Gold(100, 200); g.Delete();

                int r1 = (int)(Utility.RandomMinMax(80, 160) * (MyServerSettings.GetGoldCutRate() * .01));
                int r2 = (int)(Utility.RandomMinMax(200, 400) * (MyServerSettings.GetGoldCutRate() * .01));
                int r3 = (int)(Utility.RandomMinMax(400, 800) * (MyServerSettings.GetGoldCutRate() * .01));
                int r4 = (int)(Utility.RandomMinMax(800, 1200) * (MyServerSettings.GetGoldCutRate() * .01));
                int r5 = (int)(Utility.RandomMinMax(1200, 1600) * (MyServerSettings.GetGoldCutRate() * .01));

                switch (Utility.Random(21))
                {
                case 0: g = new Crystals(r1); break;

                case 1: g = new DDGemstones(r2); break;

                case 2: g = new DDJewels(r2); break;

                case 3: g = new DDGoldNuggets(r3); break;

                case 4: g = new Gold(r3); break;

                case 5: g = new Gold(r3); break;

                case 6: g = new Gold(r3); break;

                case 7: g = new DDSilver(r4); break;

                case 8: g = new DDSilver(r4); break;

                case 9: g = new DDSilver(r4); break;

                case 10: g = new DDSilver(r4); break;

                case 11: g = new DDSilver(r4); break;

                case 12: g = new DDSilver(r4); break;

                case 13: g = new DDCopper(r5); break;

                case 14: g = new DDCopper(r5); break;

                case 15: g = new DDCopper(r5); break;

                case 16: g = new DDCopper(r5); break;

                case 17: g = new DDCopper(r5); break;

                case 18: g = new DDCopper(r5); break;

                case 19: g = new DDCopper(r5); break;

                case 20: g = new DDCopper(r5); break;
                }

                g.MoveToWorld(new Point3D(m_X, m_Y, z), m_Map);

                if (0.5 >= Utility.RandomDouble())
                {
                    switch (Utility.Random(3))
                    {
                    case 0:                             // Fire column
                    {
                        Effects.SendLocationParticles(EffectItem.Create(g.Location, g.Map, EffectItem.DefaultDuration), 0x3709, 10, 30, 5052);
                        Effects.PlaySound(g, g.Map, 0x208);

                        break;
                    }

                    case 1:                             // Explosion
                    {
                        Effects.SendLocationParticles(EffectItem.Create(g.Location, g.Map, EffectItem.DefaultDuration), 0x36BD, 20, 10, 5044);
                        Effects.PlaySound(g, g.Map, 0x307);

                        break;
                    }

                    case 2:                             // Ball of fire
                    {
                        Effects.SendLocationParticles(EffectItem.Create(g.Location, g.Map, EffectItem.DefaultDuration), 0x36FE, 10, 10, 5052);

                        break;
                    }
                    }
                }
            }
Beispiel #34
0
		public static void CashCheck(Mobile from, BankCheck check)
		{
			BankBox box = from.BankBox;

			if (box != null)
			{
				int deposited = 0;
				int toAdd = check.Worth;

				check.Delete();
				Gold gold;

				while (toAdd > 60000)
				{
					gold = new Gold(60000);

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

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

						break;
					}
				}

				if (toAdd > 0)
				{
					gold = new Gold(toAdd);

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

						from.AddToBackpack(new BankCheck(toAdd));
					}
				}
			}
		}
Beispiel #35
0
        public override void OnDoubleClick(Mobile from)
        {
            BankBox box = from.FindBankNoCreate();

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

                int deposited = 0;

                int toAdd = this.m_Worth;

                Gold gold;

                while (toAdd > 60000)
                {
                    gold = new Gold(60000);

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

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

                        break;
                    }
                }

                if (toAdd > 0)
                {
                    gold = new Gold(toAdd);

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

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

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

                PlayerMobile pm = from as PlayerMobile;

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

                    if (qs is Necro.DarkTidesQuest)
                    {
                        QuestObjective obj = qs.FindObjective(typeof(Necro.CashBankCheckObjective));

                        if (obj != null && !obj.Completed)
                            obj.Complete();
                    }

                    if (qs is Haven.UzeraanTurmoilQuest)
                    {
                        QuestObjective obj = qs.FindObjective(typeof(Haven.CashBankCheckObjective));

                        if (obj != null && !obj.Completed)
                            obj.Complete();
                    }
                }
            }
            else
            {
                from.SendLocalizedMessage(1047026); // That must be in your bank box to use it.
            }
        }
Beispiel #36
0
		public virtual bool OnGoldGiven( Mobile from, Gold dropped )
		{
			if ( CheckTeachingMatch( from ) )
			{
				int goldtaken = Teach( m_Teaching, from, dropped.Amount / TeachScalar, true ) * TeachScalar;

				if ( goldtaken > 0 )
				{
					dropped.Consume( goldtaken );
					return dropped == null || dropped.Deleted || dropped.Amount <= 0;
				}
			}
			else if ( IsHumanInTown() )
			{
				Direction = GetDirectionTo( from );

				int oldSpeechHue = this.SpeechHue;

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

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

				from.Karma += Math.Max( dropped.Amount / 10, 100 );

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

				this.SpeechHue = oldSpeechHue;

				dropped.Delete();
				return true;
			}

			return false;
		}