Inheritance: Resource
Exemplo n.º 1
0
		public void Carve( Mobile from, Item item )
		{
			Effects.PlaySound( GetWorldLocation(), Map, 0x48F );
			Effects.SendLocationEffect( GetWorldLocation(), Map, 0x3728, 10, 10, 0, 0 );

			if ( 0.3 > Utility.RandomDouble() )
			{
				if ( ItemID == 0xF7E )
					from.SendMessage( "You destroy the bone." );
				else
					from.SendMessage( "You destroy the bone pile." );

				Gold gold = new Gold( 25, 100 );

				gold.MoveToWorld( GetWorldLocation(), Map );

				Delete();

				m_Timer.Stop();
			}
			else
			{
				if ( ItemID == 0xF7E )
					from.SendMessage( "You damage the bone." );
				else
					from.SendMessage( "You damage the bone pile." );
			}
		}
Exemplo n.º 2
0
	void Start() {
		rb2d = GetComponent<Rigidbody2D> ();
		left = GameObject.Find ("LeftWall").transform.position.x + 1f;
		right = GameObject.Find ("RightWall").transform.position.x - 1f;
		bottom = GameObject.Find ("Floor").transform.position.y + 1f;
		top = GameObject.Find ("Ceiling").transform.position.y - 1f;
		counter = GameObject.FindObjectOfType<Gold> ();
	}
Exemplo n.º 3
0
        public override void Update()
        {
            base.Update();

            if (this.CycleCounter % 2 == 0 && this.CycleCounter != 0)
            {
                var gold = new Gold();
                this.AddResource(gold);
                this.ResourceCycle = 0;
            }
            if (this.CycleCounter % 3 == 0 && this.CycleCounter != 0)
            {
                var archer = new Archer();
                this.AddUnit(archer);
                this.Engine.DB.AddUnit(archer);
                this.UnitCycle = 0;
            }
        }
Exemplo n.º 4
0
            protected override void OnTick()
            {
                var z      = m_Map.GetAverageZ(m_X, m_Y);
                var canFit = m_Map.CanFit(m_X, m_Y, z, 6, false, false);

                for (var 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;
                }

                var g = new Gold(750, 1250);

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

                if (Utility.RandomDouble() <= 0.5)
                {
                    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;
                    }
                    }
                }
            }
Exemplo n.º 5
0
        private void FillChest()
        {
            int       RaresDropped = 0;
            LogHelper Logger       = new LogHelper("PirateChampChest.log", false);

            // 25 piles * 1200 = 30K gold
            for (int ix = 0; ix < 25; ix++)
            {               // force the separate piles
                Gold gold = new Gold(800, 1200);
                gold.Stackable = false;
                m_MetalChest.DropItem(gold);
                gold.Stackable = true;
            }

            // "a smelly old mackerel"
            if (Utility.RandomChance(10))
            {
                Item ii;
                ii        = new BigFish();
                ii.Name   = "a smelly old mackerel";
                ii.Weight = 5;
                m_MetalChest.DropItem(ii);
                RaresDropped++;
                Logger.Log(LogType.Item, ii);
            }

            // single gold ingot weight 12
            if (Utility.RandomChance(10 * 2))
            {
                Item ii;
                if (Utility.RandomBool())
                {
                    ii = new Item(7145);
                }
                else
                {
                    ii = new Item(7148);
                }

                ii.Weight = 12;
                m_MetalChest.DropItem(ii);
                RaresDropped++;
                Logger.Log(LogType.Item, ii);
            }

            // 3 gold ingots 12*3
            if (Utility.RandomChance(5 * 2))
            {
                Item ii;
                if (Utility.RandomBool())
                {
                    ii = new Item(7146);
                }
                else
                {
                    ii = new Item(7149);
                }

                ii.Weight = 12 * 3;
                m_MetalChest.DropItem(ii);
                RaresDropped++;
                Logger.Log(LogType.Item, ii);
            }

            // 5 gold ingots 12*5
            if (Utility.RandomChance(1 * 2))
            {
                Item ii;
                if (Utility.RandomBool())
                {
                    ii = new Item(7147);
                }
                else
                {
                    ii = new Item(7150);
                }

                ii.Weight = 12 * 5;
                m_MetalChest.DropItem(ii);
                RaresDropped++;
                Logger.Log(LogType.Item, ii);
            }

            // single silver ingot weight 6
            if (Utility.RandomChance(10 * 2))
            {
                Item ii;
                if (Utility.RandomBool())
                {
                    ii = new Item(7157);
                }
                else
                {
                    ii = new Item(7160);
                }

                ii.Weight = 6;
                m_MetalChest.DropItem(ii);
                RaresDropped++;
                Logger.Log(LogType.Item, ii);
            }

            // 3 silver ingots 6*3
            if (Utility.RandomChance(5 * 2))
            {
                Item ii;
                if (Utility.RandomBool())
                {
                    ii = new Item(7158);
                }
                else
                {
                    ii = new Item(7161);
                }

                ii.Weight = 6 * 3;
                m_MetalChest.DropItem(ii);
                RaresDropped++;
                Logger.Log(LogType.Item, ii);
            }

            // 5 silver ingots 6*5
            if (Utility.RandomChance(1 * 2))
            {
                Item ii;
                if (Utility.RandomBool())
                {
                    ii = new Item(7159);
                }
                else
                {
                    ii = new Item(7162);
                }

                ii.Weight = 6 * 5;
                m_MetalChest.DropItem(ii);
                RaresDropped++;
                Logger.Log(LogType.Item, ii);
            }

            // rolled map w1
            if (Utility.RandomChance(20 * 2))
            {
                Item ii;
                if (Utility.RandomBool())
                {
                    ii = new Item(5357);
                }
                else
                {
                    ii = new Item(5358);
                }

                ii.Weight = 1;
                m_MetalChest.DropItem(ii);
                RaresDropped++;
                Logger.Log(LogType.Item, ii);
            }

            // ship plans
            if (Utility.RandomChance(10 * 2))
            {
                Item ii;
                if (Utility.RandomBool())
                {
                    ii = new Item(5361);
                }
                else
                {
                    ii = new Item(5362);
                }

                ii.Weight = 1;
                m_MetalChest.DropItem(ii);
                RaresDropped++;
                Logger.Log(LogType.Item, ii);
            }

            // ship model
            if (Utility.RandomChance(5 * 2))
            {
                Item ii;
                if (Utility.RandomBool())
                {
                    ii = new Item(5363);
                }
                else
                {
                    ii = new Item(5364);
                }

                ii.Weight = 3;
                m_MetalChest.DropItem(ii);
                RaresDropped++;
                Logger.Log(LogType.Item, ii);
            }

            // "scale shield" w6
            if (Utility.RandomChance(1))
            {
                Item ii;
                if (Utility.RandomBool())
                {
                    ii = new Item(7110);
                }
                else
                {
                    ii = new Item(7111);
                }

                ii.Name   = "scale shield";
                ii.Weight = 6;
                m_MetalChest.DropItem(ii);
                RaresDropped++;
                Logger.Log(LogType.Item, ii);
            }

            // level 5 chest regs & gems
            TreasureMapChest.PackRegs(m_MetalChest, 5 * 10);
            TreasureMapChest.PackGems(m_MetalChest, 5 * 5);

            // level 5 magic items
            DungeonTreasureChest.PackMagicItem(m_MetalChest, 3, 3, 0.20);
            DungeonTreasureChest.PackMagicItem(m_MetalChest, 3, 3, 0.10);
            DungeonTreasureChest.PackMagicItem(m_MetalChest, 3, 3, 0.05);

            // an a level 5 treasure map
            m_MetalChest.DropItem(new TreasureMap(5, Map.Felucca));

            Logger.Log(LogType.Text, string.Format("There were a total of {0} rares dropped.", RaresDropped));
            Logger.Finish();
        }
Exemplo n.º 6
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;

                Gold g = new Gold( 10, 20 );

                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;
                        }
                    }
                }
            }
Exemplo n.º 7
0
        public virtual bool CheckAtDestination()
        {
            EDI dest = GetDestination();

            if (dest == null)
            {
                return(false);
            }

            Mobile escorter = GetEscorter();

            if (escorter == null)
            {
                return(false);
            }

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

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

                Container cont = escorter.Backpack;

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

                Gold gold;

                if (escorter is TeiravonMobile)
                {
                    TeiravonMobile m_Escorter = (TeiravonMobile)escorter;

                    int exp = Utility.RandomMinMax(5000, 15000);
                    Misc.Titles.AwardExp(m_Escorter, exp);
                    gold = new Gold(10, 50);

                    m_Escorter.SendMessage("You have gained {0} experience.", exp);
                }
                else
                {
                    gold = new Gold(500, 1000);
                }

                if (cont == null || !cont.TryDropItem(escorter, gold, false))
                {
                    gold.MoveToWorld(escorter.Location, escorter.Map);
                }

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

                /*
                 * Misc.Titles.AwardFame( escorter, 10, true );
                 *
                 * bool gainedPath = false;
                 *
                 * PlayerMobile pm = escorter as PlayerMobile;
                 *
                 * if ( pm != null )
                 * {
                 *      if ( pm.CompassionGains > 0 && DateTime.Now > pm.NextCompassionDay )
                 *      {
                 *              pm.NextCompassionDay = DateTime.MinValue;
                 *              pm.CompassionGains = 0;
                 *      }
                 *
                 *      if ( pm.CompassionGains >= 5 ) // have already gained 5 points in one day, can gain no more
                 *      {
                 *              pm.SendLocalizedMessage( 1053004 ); // You must wait about a day before you can gain in compassion again.
                 *      }
                 *      else if ( VirtueHelper.Award( pm, VirtueName.Compassion, 1, ref gainedPath ) )
                 *      {
                 *              if ( gainedPath )
                 *                      pm.SendLocalizedMessage( 1053005 ); // You have achieved a path in compassion!
                 *              else
                 *                      pm.SendLocalizedMessage( 1053002 ); // You have gained in compassion.
                 *
                 *              pm.NextCompassionDay = DateTime.Now + TimeSpan.FromDays( 1.0 ); // in one day CompassionGains gets reset to 0
                 ++pm.CompassionGains;
                 *      }
                 *      else
                 *      {
                 *              pm.SendLocalizedMessage( 1053003 ); // You have achieved the highest path of compassion and can no longer gain any further.
                 *      }
                 * }
                 */
                return(true);
            }

            return(false);
        }
Exemplo n.º 8
0
        public virtual Heap Drop(Item item, int cell)
        {
            if (Dungeon.IsChallenged(Challenges.NO_FOOD) && item is Food)
            {
                item = new Gold(item.Price());
            }
            else if (Dungeon.IsChallenged(Challenges.NO_ARMOR) && item is Armor)
            {
                item = new Gold(item.Price());
            }
            else if (Dungeon.IsChallenged(Challenges.NO_HEALING) && item is PotionOfHealing)
            {
                item = new Gold(item.Price());
            }

            if ((map[cell] == Terrain.ALCHEMY) && !(item is Plant.Seed))
            {
                int n;
                do
                {
                    n = cell + NEIGHBOURS8[pdsharp.utils.Random.Int(8)];
                } while (map[n] != Terrain.EMPTY_SP);
                cell = n;
            }

            var heap = heaps[cell];

            if (heap == null)
            {
                heap     = new Heap();
                heap.Pos = cell;
                if (map[cell] == Terrain.CHASM || (Dungeon.Level != null && pit[cell]))
                {
                    GameScene.Discard(heap);
                }
                else
                {
                    heaps.Add(cell, heap);
                    GameScene.Add(heap);
                }
            }
            else
            if (heap.HeapType == Heap.Type.LockedChest || heap.HeapType == Heap.Type.CrystalChest)
            {
                int n;
                do
                {
                    n = cell + NEIGHBOURS8[pdsharp.utils.Random.Int(8)];
                }while (!passable[n] && !avoid[n]);

                return(Drop(item, n));
            }

            heap.Drop(item);

            if (Dungeon.Level != null)
            {
                Press(cell, null);
            }

            return(heap);
        }
Exemplo n.º 9
0
 public void AddGold(Gold gold)
 {
     UI_Control.AddLog(gold.getValue() + " 골드를 획득하였다.");
     ((Gold)equip [4]).incAmount (gold.getValue());
     ui_control.SetGold (((Gold)equip[4]).getValue());
 }
Exemplo n.º 10
0
 // implementación potencialmente bugosa
 public void addGold(Gold gold)
 {
     string name = "gold" + objects.Count;
     gold._name  = name;
     objects[name] = gold;
 }
Exemplo n.º 11
0
 public async Task <IActionResult> GetEstimation(Gold gold)
 {
     return(Ok(await userInterface.GetEstimationAsync(gold)));
 }
Exemplo n.º 12
0
        public string ToXmlString()
        {
            XmlDocument playerData = new XmlDocument();

            //Create the top-level node
            XmlNode player = playerData.CreateElement("Player");

            playerData.AppendChild(player);

            //Create the "Stats" child node to hold the other player stats nodes
            XmlNode stats = playerData.CreateElement("Stats");

            player.AppendChild(stats);

            //Create the child nodes for the "Stats" nodes
            XmlNode currentHitPoints = playerData.CreateElement("CurrentHitPoints");

            currentHitPoints.AppendChild(playerData.CreateTextNode(CurrentHitPoints.ToString()));
            stats.AppendChild(currentHitPoints);

            XmlNode maximumHitPoints = playerData.CreateElement("MaximumHitPoints");

            maximumHitPoints.AppendChild(playerData.CreateTextNode(MaximumHitPoints.ToString()));
            stats.AppendChild(maximumHitPoints);

            XmlNode gold = playerData.CreateElement("Gold");

            gold.AppendChild(playerData.CreateTextNode(Gold.ToString()));
            stats.AppendChild(gold);

            XmlNode experiencePoints = playerData.CreateElement("ExperiencePoints");

            experiencePoints.AppendChild(playerData.CreateTextNode(ExperiencePoints.ToString()));
            stats.AppendChild(experiencePoints);

            XmlNode currentLocation = playerData.CreateElement("CurrentLocation");

            currentLocation.AppendChild(playerData.CreateTextNode(CurrentLocation.ID.ToString()));
            stats.AppendChild(currentLocation);

            if (CurrentWeapon != null)
            {
                XmlNode currentWeapon = playerData.CreateElement("CurrentWeapon");
                currentWeapon.AppendChild(playerData.CreateTextNode(CurrentWeapon.ID.ToString()));
                stats.AppendChild(currentWeapon);
            }

            //Create the "InventoryItems" child node to hold each InventoryItem node
            XmlNode inventoryItems = playerData.CreateElement("InventoryItems");

            player.AppendChild(inventoryItems);

            //Create an "InventoryItem" node for each item in the player inventory
            foreach (InventoryItem item in this.Inventory)
            {
                XmlNode inventoryItem = playerData.CreateElement("InventoryItem");

                XmlAttribute idAttribute = playerData.CreateAttribute("ID");
                idAttribute.Value = item.Details.ID.ToString();
                inventoryItem.Attributes.Append(idAttribute);

                XmlAttribute quantityAttribute = playerData.CreateAttribute("Quantity");
                quantityAttribute.Value = item.Quantity.ToString();
                inventoryItem.Attributes.Append(quantityAttribute);

                inventoryItems.AppendChild(inventoryItem);
            }

            //Create the "PlayerQuests" child node to hold each PlayerQuest node
            XmlNode playerQuests = playerData.CreateElement("PlayerQuests");

            player.AppendChild(playerQuests);

            //Create a "PlayerQuest" node for each quest the player has acquired
            foreach (PlayerQuest quest in this.Quests)
            {
                XmlNode playerQuest = playerData.CreateElement("PlayerQuest");

                XmlAttribute idAttribute = playerData.CreateAttribute("ID");
                idAttribute.Value = quest.Details.ID.ToString();
                playerQuest.Attributes.Append(idAttribute);

                XmlAttribute isCompletedAttribute = playerData.CreateAttribute("IsCompleted");
                isCompletedAttribute.Value = quest.IsCompleted.ToString();
                playerQuest.Attributes.Append(isCompletedAttribute);

                playerQuests.AppendChild(playerQuest);
            }
            return(playerData.InnerXml); //The XML document, as a string, so we can save the data to disk
        }
Exemplo n.º 13
0
 private void Awake()
 {
     instance = this;
 }
        public static void LedgeGold_OnCommand(CommandEventArgs e)
        {
            //generate a list of all items in the backpack
            List <Item> packitems = RecurseFindItemsInPack(e.Mobile.Backpack);

            Item       item   = e.Mobile.Backpack.FindItemByType(typeof(GoldLedger));
            GoldLedger ledger = item as GoldLedger;

            if (ledger == null)
            {
                e.Mobile.SendMessage(33, "No gold ledger found.");
                return;
            }
            else
            {
                foreach (Item pitem in packitems)
                {
                    if (pitem is Gold)
                    {
                        Gold gold = pitem as Gold;

                        if (gold != null)
                        {
                            if (ledger.Gold < 999999999)
                            {
                                int golda = gold.Amount;
                                if ((gold.Amount + ledger.Gold) > 999999999)
                                {
                                    golda = (999999999 - ledger.Gold);
                                }
                                double maxgold = golda;
                                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)
                                {
                                    e.Mobile.CloseGump(typeof(GoldLedgerGump));
                                    e.Mobile.SendGump(new GoldLedgerGump(ledger));
                                }
                                if (golda > 0)
                                {
                                    e.Mobile.SendMessage(2125, "You ledger the gold");
                                    Effects.SendMovingEffect(e.Mobile.Backpack, e.Mobile, GoldID, 5, 50, true, false);
                                    e.Mobile.PlaySound(0x2E6);
                                }
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 15
0
        public static bool Deposit( Mobile from, int amount )
        {
            BankBox box = from.FindBankNoCreate();
            if( box == null )
                return false;

            List<Item> items = new List<Item>();

            while( amount > 0 )
            {
                Item item;
                if( amount < 5000 )
                {
                    item = new Gold(amount);
                    amount = 0;
                }
                else if( amount <= 1000000 )
                {
                    item = new BankCheck(amount);
                    amount = 0;
                }
                else
                {
                    item = new BankCheck(1000000);
                    amount -= 1000000;
                }

                if( box.TryDropItem(from, item, false) )
                {
                    items.Add(item);
                }
                else
                {
                    item.Delete();
                    foreach( Item curItem in items )
                    {
                        curItem.Delete();
                    }

                    return false;
                }
            }

            return true;
        }
Exemplo n.º 16
0
        public override void OnSpeech( SpeechEventArgs e )
        {
            if( !e.Handled && e.Mobile.InRange(this.Location, 12) )
            {
                for( int i = 0; i < e.Keywords.Length; ++i )
                {
                    int keyword = e.Keywords[i];

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

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

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

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

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

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

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

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

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

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

                                BankBox box = e.Mobile.FindBankNoCreate();

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

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

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

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

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

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

                                e.Mobile.BankBox.Open();

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

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

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

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

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

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

                                //        BankBox box = e.Mobile.BankBox;

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

                                break;
                            }
                    }
                }

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

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

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

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

                                coin.Delete();
                            });

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

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

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

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

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

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

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

            base.OnSpeech(e);
        }
Exemplo n.º 17
0
        public static void Deposit( Container cont, int amount )
        {
            while( amount > 0 )
            {
                Item item;

                if( amount < 5000 )
                {
                    item = new Gold(amount);
                    amount = 0;
                }
                else if( amount <= 1000000 )
                {
                    item = new BankCheck(amount);
                    amount = 0;
                }
                else
                {
                    item = new BankCheck(1000000);
                    amount -= 1000000;
                }

                cont.DropItem(item);
            }
        }
Exemplo n.º 18
0
        public static bool DetectSomething(Item item, Mobile m, bool skillCheck)
        {
            bool   foundAnyone = false;
            string sTrap;

            bool foundIt = false;

            if (m.CheckSkill(SkillName.DetectHidden, 0, 125))
            {
                foundIt = true;
            }
            else if ((AosAttributes.GetValue(m, AosAttribute.NightSight) > 0 || m.LightLevel > 0) && 1 == Utility.RandomMinMax(1, 20))
            {
                foundIt = true;
            }

            if (m is PlayerMobile && m.Alive && (!skillCheck || foundIt))
            {
                if (item is BaseTrap)
                {
                    BaseTrap trap = (BaseTrap)item;

                    if (trap is FireColumnTrap)
                    {
                        sTrap = "(fire column trap)";
                    }
                    else if (trap is FlameSpurtTrap)
                    {
                        sTrap = "(fire spurt trap)";
                    }
                    else if (trap is GasTrap)
                    {
                        sTrap = "(poison gas trap)";
                    }
                    else if (trap is GiantSpikeTrap)
                    {
                        sTrap = "(giant spike trap)";
                    }
                    else if (trap is MushroomTrap)
                    {
                        sTrap = "(odd mushroom)";
                    }
                    else if (trap is SawTrap)
                    {
                        sTrap = "(saw blade trap)";
                    }
                    else if (trap is SpikeTrap)
                    {
                        sTrap = "(spike trap)";
                    }
                    else if (trap is StoneFaceTrap)
                    {
                        sTrap = "(stone face trap)";
                    }
                    else
                    {
                        sTrap = "";
                    }

                    Effects.SendLocationParticles(EffectItem.Create(item.Location, item.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, 5024);
                    Effects.PlaySound(item.Location, item.Map, 0x1FA);
                    m.SendMessage("There is a trap nearby! " + sTrap + "");
                    foundAnyone = true;
                }
                else if (item is BaseDoor && (item.ItemID == 0x35E ||
                                              item.ItemID == 0xF0 ||
                                              item.ItemID == 0xF2 ||
                                              item.ItemID == 0x326 ||
                                              item.ItemID == 0x324 ||
                                              item.ItemID == 0x32E ||
                                              item.ItemID == 0x32C ||
                                              item.ItemID == 0x314 ||
                                              item.ItemID == 0x316 ||
                                              item.ItemID == 0x31C ||
                                              item.ItemID == 0x31E ||
                                              item.ItemID == 0xE8 ||
                                              item.ItemID == 0xEA ||
                                              item.ItemID == 0x34C ||
                                              item.ItemID == 0x356 ||
                                              item.ItemID == 0x35C ||
                                              item.ItemID == 0x354 ||
                                              item.ItemID == 0x344 ||
                                              item.ItemID == 0x346 ||
                                              item.ItemID == 0x34E ||
                                              item.ItemID == 0x334 ||
                                              item.ItemID == 0x336 ||
                                              item.ItemID == 0x33C ||
                                              item.ItemID == 0x33E))
                {
                    Effects.SendLocationParticles(EffectItem.Create(item.Location, item.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, 5024);
                    Effects.PlaySound(item.Location, item.Map, 0x1FA);
                    m.SendMessage("There is a hidden door nearby!");
                    foundAnyone = true;
                }
                else if (item is HiddenTrap)
                {
                    string textSay = "There is a hidden floor trap somewhere nearby!";
                    if (Server.Misc.Worlds.IsOnSpaceship(item.Location, item.Map))
                    {
                        textSay = "There is a dangerous area nearby!";
                    }
                    Effects.SendLocationParticles(EffectItem.Create(item.Location, item.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, 5024);
                    Effects.PlaySound(item.Location, item.Map, 0x1FA);
                    m.SendMessage(textSay);
                    foundAnyone = true;
                }
                else if (item is HiddenChest)
                {
                    m.SendMessage("Your eye catches something nearby.");
                    Map map = m.Map;
                    string where = Server.Misc.Worlds.GetRegionName(m.Map, m.Location);

                    int money = Utility.RandomMinMax(100, 200);

                    int level = (int)(m.Skills[SkillName.DetectHidden].Value / 10);
                    if (level < 1)
                    {
                        level = 1;
                    }
                    if (level > 10)
                    {
                        level = 10;
                    }

                    switch (Utility.RandomMinMax(1, level))
                    {
                    case 1: level = 1; break;

                    case 2: level = 2; break;

                    case 3: level = 3; break;

                    case 4: level = 4; break;

                    case 5: level = 5; break;

                    case 6: level = 6; break;

                    case 7: level = 7; break;

                    case 8: level = 8; break;

                    case 9: level = 9; break;

                    case 10: level = 10; break;
                    }

                    if (Utility.RandomMinMax(1, 3) > 1)
                    {
                        Item coins = new Gold((money * level));

                        if (Server.Misc.Worlds.IsOnSpaceship(item.Location, item.Map))
                        {
                            coins.Delete(); coins = new DDXormite(); coins.Amount = (int)((money * level) / 3);
                        }
                        else if (Server.Misc.Worlds.GetMyWorld(item.Map, item.Location, item.X, item.Y) == "the Underworld")
                        {
                            coins.Delete(); coins = new DDJewels(); coins.Amount = (int)((money * level) / 2);
                        }
                        else if (Utility.RandomMinMax(1, 100) > 99)
                        {
                            coins.Delete(); coins = new DDGemstones(); coins.Amount = (int)((money * level) / 2);
                        }
                        else if (Utility.RandomMinMax(1, 100) > 95)
                        {
                            coins.Delete(); coins = new DDGoldNuggets(); coins.Amount = (int)((money * level));
                        }
                        else if (Utility.RandomMinMax(1, 100) > 80)
                        {
                            coins.Delete(); coins = new DDSilver(); coins.Amount = (int)((money * level) * 5);
                        }
                        else if (Utility.RandomMinMax(1, 100) > 60)
                        {
                            coins.Delete(); coins = new DDCopper(); coins.Amount = (int)((money * level) * 10);
                        }

                        Point3D loc = item.Location;
                        coins.MoveToWorld(loc, map);
                        Effects.SendLocationParticles(EffectItem.Create(coins.Location, coins.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, 5024);
                        Effects.PlaySound(coins.Location, coins.Map, 0x1FA);
                    }
                    else
                    {
                        HiddenBox mBox = new HiddenBox(level, where, m);

                        Point3D loc = item.Location;
                        mBox.MoveToWorld(loc, map);
                        Effects.SendLocationParticles(EffectItem.Create(mBox.Location, mBox.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, 5024);
                        Effects.PlaySound(mBox.Location, mBox.Map, 0x1FA);
                    }

                    foundAnyone = true;
                    item.Delete();
                }
            }
            return(foundAnyone);
        }
Exemplo n.º 19
0
 public void AddGold(Gold gold)
 {
     golds.Add(gold);
 }
Exemplo n.º 20
0
        public static int DepositUpTo( Mobile from, int amount )
        {
            BankBox box = from.FindBankNoCreate();
            if( box == null )
                return 0;

            int amountLeft = amount;
            while( amountLeft > 0 )
            {
                Item item;
                int amountGiven;

                if( amountLeft < 5000 )
                {
                    item = new Gold(amountLeft);
                    amountGiven = amountLeft;
                }
                else if( amountLeft <= 1000000 )
                {
                    item = new BankCheck(amountLeft);
                    amountGiven = amountLeft;
                }
                else
                {
                    item = new BankCheck(1000000);
                    amountGiven = 1000000;
                }

                if( box.TryDropItem(from, item, false) )
                {
                    amountLeft -= amountGiven;
                }
                else
                {
                    item.Delete();
                    break;
                }
            }

            return amount - amountLeft;
        }
Exemplo n.º 21
0
 public void RemoveGold(Gold gold)
 {
     golds.Remove(gold);
 }
Exemplo n.º 22
0
 public ChartStats()
 {
     GoldStats = new Gold();
 }
Exemplo n.º 23
0
 public void UpdateLabel()
 {
     labHighestScore.Text = "最高分 : " + HighestScore.ToString();
     labGold.Text         = "金币 : " + Gold.ToString();
 }
Exemplo n.º 24
0
 public void RemoveGold(Gold gold)
 {
     // Remove the gold from the world at the specified location.
     Logger.DebugFormat("Removing {0} qty {1} id {2}", gold.Name, gold.Amount, gold.Id);
     NotifyNearbyAoiDeparture(gold);
     EntityTree.Remove(gold);
     Objects.Remove(gold);
 }
Exemplo n.º 25
0
 static void Main(string[] args)
 {
     //Hvozdyk add
     Gold card = new Gold();
Exemplo n.º 26
0
                protected override void OnTick()
                {
                    Container theirPack = m_Target.Backpack;

                    double badKarmaChance = 0.5 - ((double)m_From.Karma / 8570);

                    if (theirPack == null && m_Target.Race != Race.Elf)
                    {
                        m_From.SendLocalizedMessage(500404); // They seem unwilling to give you any money.
                    }
                    else if (m_From.Karma < 0 && badKarmaChance > Utility.RandomDouble())
                    {
                        m_Target.PublicOverheadMessage(MessageType.Regular, m_Target.SpeechHue, 500406);
                        // Thou dost not look trustworthy... no gold for thee today!
                    }
                    else if (m_From.CheckTargetSkill(SkillName.Begging, m_Target, 0.0, 100.0))
                    {
                        if (m_Target.Race != Race.Elf)
                        {
                            int toConsume = theirPack.GetAmount(typeof(Gold)) / 10;
                            int max       = 10 + (m_From.Fame / 2500);

                            if (max > 14)
                            {
                                max = 14;
                            }
                            else if (max < 10)
                            {
                                max = 10;
                            }

                            if (toConsume > max)
                            {
                                toConsume = max;
                            }

                            if (toConsume > 0)
                            {
                                int consumed = theirPack.ConsumeUpTo(typeof(Gold), toConsume);

                                if (consumed > 0)
                                {
                                    m_Target.PublicOverheadMessage(MessageType.Regular, m_Target.SpeechHue, 500405);
                                    // I feel sorry for thee...

                                    Gold gold = new Gold(consumed);

                                    m_From.AddToBackpack(gold);
                                    m_From.PlaySound(gold.GetDropSound());

                                    if (m_From.Karma > -3000)
                                    {
                                        int toLose = m_From.Karma + 3000;

                                        if (toLose > 40)
                                        {
                                            toLose = 40;
                                        }

                                        Titles.AwardKarma(m_From, -toLose, true);
                                    }
                                }
                                else
                                {
                                    m_Target.PublicOverheadMessage(MessageType.Regular, m_Target.SpeechHue, 500407);
                                    // I have not enough money to give thee any!
                                }
                            }
                            else
                            {
                                m_Target.PublicOverheadMessage(MessageType.Regular, m_Target.SpeechHue, 500407);
                                // I have not enough money to give thee any!
                            }
                        }
                        else
                        {
                            double chance     = Utility.RandomDouble();
                            Item   reward     = new Gold(1);
                            string rewardName = "";
                            if (chance >= .99)
                            {
                                int rand = Utility.Random(8);

                                if (rand == 0)
                                {
                                    reward     = new BegBedRoll();
                                    rewardName = "a bedroll";
                                }
                                else if (rand == 1)
                                {
                                    reward     = new BegCookies();
                                    rewardName = "a plate of cookies.";
                                }
                                else if (rand == 2)
                                {
                                    reward     = new BegFishSteak();
                                    rewardName = "a fish steak.";
                                }
                                else if (rand == 3)
                                {
                                    reward     = new BegFishingPole();
                                    rewardName = "a fishing pole.";
                                }
                                else if (rand == 4)
                                {
                                    reward     = new BegFlowerGarland();
                                    rewardName = "a flower garland.";
                                }
                                else if (rand == 5)
                                {
                                    reward     = new BegSake();
                                    rewardName = "a bottle of Sake.";
                                }
                                else if (rand == 6)
                                {
                                    reward     = new BegTurnip();
                                    rewardName = "a turnip.";
                                }
                                else if (rand == 7)
                                {
                                    reward     = new BegWine();
                                    rewardName = "a Bottle of wine.";
                                }
                                else if (rand == 8)
                                {
                                    reward     = new BegWinePitcher();
                                    rewardName = "a Pitcher of wine.";
                                }
                            }
                            else if (chance >= .76)
                            {
                                int rand = Utility.Random(6);

                                if (rand == 0)
                                {
                                    reward     = new BegStew();
                                    rewardName = "a bowl of stew.";
                                }
                                else if (rand == 1)
                                {
                                    reward     = new BegCheeseWedge();
                                    rewardName = "a wedge of cheese.";
                                }
                                else if (rand == 2)
                                {
                                    reward     = new BegDates();
                                    rewardName = "a bunch of dates.";
                                }
                                else if (rand == 3)
                                {
                                    reward     = new BegLantern();
                                    rewardName = "a lantern.";
                                }
                                else if (rand == 4)
                                {
                                    reward     = new BegLiquorPitcher();
                                    rewardName = "a Pitcher of liquor";
                                }
                                else if (rand == 5)
                                {
                                    reward     = new BegPizza();
                                    rewardName = "pizza";
                                }
                                else if (rand == 6)
                                {
                                    reward     = new BegShirt();
                                    rewardName = "a shirt.";
                                }
                            }
                            else if (chance >= .25)
                            {
                                int rand = Utility.Random(1);

                                if (rand == 0)
                                {
                                    reward     = new BegFrenchBread();
                                    rewardName = "french bread.";
                                }
                                else
                                {
                                    reward     = new BegWaterPitcher();
                                    rewardName = "a Pitcher of water.";
                                }
                            }

                            m_Target.Say(1074854);                            // Here, take this...
                            m_From.AddToBackpack(reward);
                            m_From.SendLocalizedMessage(1074853, rewardName); // You have been given ~1_name~

                            if (m_From.Karma > -3000)
                            {
                                int toLose = m_From.Karma + 3000;

                                if (toLose > 40)
                                {
                                    toLose = 40;
                                }

                                Titles.AwardKarma(m_From, -toLose, true);
                            }
                        }
                    }

                    else
                    {
                        m_Target.SendLocalizedMessage(500404); // They seem unwilling to give you any money.
                    }


                    m_From.NextSkillTime = Core.TickCount + 10000;
                }
Exemplo n.º 27
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;
                }

                Gold g = new Gold(500, 1000);

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

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

                        break;
                    }

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

                        break;
                    }

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

                        break;
                    }

                    case 3:                             // Greater Heal 1
                    {
                        Effects.SendLocationParticles(EffectItem.Create(g.Location, g.Map, EffectItem.DefaultDuration), 0x375A, 10, 20, 9966);
                        Effects.PlaySound(g, g.Map, 0x5C8);                           // etherealvoyage

                        break;
                    }

                    case 4:                             // Greater Heal 2
                    {
                        Effects.SendLocationParticles(EffectItem.Create(g.Location, g.Map, EffectItem.DefaultDuration), 0x37B9, 10, 30, 9502);
                        Effects.PlaySound(g, g.Map, 0x5C6);                           // essenceofwind
                        break;
                    }

                    case 5:                             // Greater Heal 3
                    {
                        Effects.SendLocationParticles(EffectItem.Create(g.Location, g.Map, EffectItem.DefaultDuration), 0x376A, 10, 20, 9961);

                        break;
                    }

                    case 6:                             // Greater Heal 4
                    {
                        Effects.SendLocationParticles(EffectItem.Create(g.Location, g.Map, EffectItem.DefaultDuration), 0x37C4, 10, 30, 9502);

                        break;
                    }
                    }
                }
            }
Exemplo n.º 28
0
        /// <summary>
        /// Creates a new card based on how many cards have already been made.
        /// </summary>
        /// <param name="card">
        /// The name of the card to be created.
        /// </param>
        /// <returns>
        /// The new created card.
        /// </returns>
        public static Card CreateCard(CardName card)
        {
            Contract.Requires(card != CardName.Backside & card != CardName.Empty);

            Contract.Ensures(Contract.Result<Card>().Name == card);

            Card c;
            switch (card)
            {
                case CardName.Copper:
                    c = new Copper();
                    break;
                case CardName.Silver:
                    c = new Silver();
                    break;
                case CardName.Gold:
                    c = new Gold();
                    break;
                case CardName.Curse:
                    c = new Curse();
                    break;
                case CardName.Estate:
                    c = new Estate();
                    break;
                case CardName.Duchy:
                    c = new Duchy();
                    break;
                case CardName.Province:
                    c = new Province();
                    break;
                case CardName.Gardens:
                    c = new Gardens();
                    break;
                case CardName.Cellar:
                    c = new Cellar();
                    break;
                case CardName.Chapel:
                    c = new Chapel();
                    break;
                case CardName.Chancellor:
                    c = new Chancellor();
                    break;
                case CardName.Village:
                    c = new Village();
                    break;
                case CardName.Woodcutter:
                    c = new Woodcutter();
                    break;
                case CardName.Workshop:
                    c = new Workshop();
                    break;
                case CardName.Feast:
                    c = new Feast();
                    break;
                case CardName.Moneylender:
                    c = new Moneylender();
                    break;
                case CardName.Remodel:
                    c = new Remodel();
                    break;
                case CardName.Smithy:
                    c = new Smithy();
                    break;
                case CardName.ThroneRoom:
                    c = new ThroneRoom();
                    break;
                case CardName.CouncilRoom:
                    c = new CouncilRoom();
                    break;
                case CardName.Festival:
                    c = new Festival();
                    break;
                case CardName.Laboratory:
                    c = new Laboratory();
                    break;
                case CardName.Library:
                    c = new Library();
                    break;
                case CardName.Market:
                    c = new Market();
                    break;
                case CardName.Mine:
                    c = new Mine();
                    break;
                case CardName.Adventurer:
                    c = new Adventurer();
                    break;
                case CardName.Bureaucrat:
                    c = new Bureaucrat();
                    break;
                case CardName.Militia:
                    c = new Militia();
                    break;
                case CardName.Spy:
                    c = new Spy();
                    break;
                case CardName.Thief:
                    c = new Thief();
                    break;
                case CardName.Witch:
                    c = new Witch();
                    break;
                case CardName.Moat:
                    c = new Moat();
                    break;
                default:
                    throw new NotImplementedException("Tried to create a card that was not implemented when CardFactory was last updated.");
            }

            c.Initialize(card, CardsMade[card]);
            CardsMade[card] += 1;
            createdCards.Add(c, true);
            return c;
        }
Exemplo n.º 29
0
 private void Awake()
 {
     gold = FindObjectOfType <Gold>();
 }
Exemplo n.º 30
0
    private Tile Create(TileType type)
    {
        switch (type)
        {
        case (TileType.Hero):
        {
            int heroX = rando.Next(0, width);                      //get random width

            int heroY = rando.Next(0, height);                     //get random height

            while ((mapArray[heroX, heroY] is EmptyTile) == false) //while the tile is already taken, create a random X and Y position
            {
                heroX = rando.Next(0, width);                      //get random width

                heroY = rando.Next(0, height);                     //get random height
            }

            Hero tempHero = new Hero(heroX, heroY, 20, 20);

            return(tempHero);
        }

        case (TileType.Enemy):
        {
            int gobX = rando.Next(0, width);                     //get random width

            int gobY = rando.Next(0, height);                    //get random height

            while ((mapArray[gobX, gobY] is EmptyTile) == false) //while the tile is already taken, create a random X and Y position
            {
                gobX = rando.Next(0, width);                     //get random width

                gobY = rando.Next(0, height);                    //get random height
            }

            Random randEnemy = new Random(Guid.NewGuid().GetHashCode());          //use randomseed to get a new random value each time
                                                                                  // from joppiesaus on Aug 16 at 6:54 on stack overflow
                                                                                  //https://stackoverflow.com/questions/1785744/how-do-i-seed-a-random-class-to-avoid-getting-duplicate-random-values
                                                                                  //Accessed 10 October 2020
            for (int i = 0; i < 2; ++i)
            {
                int getRandEnemy = randEnemy.Next(0, 3);          //coinflip between goblin and mage each time //added leaders for POE

                if (getRandEnemy == 1)
                {
                    Goblin tempGob = new Goblin(gobX, gobY, 10, 1);

                    return(tempGob);
                }
                else if (getRandEnemy == 2)
                {
                    Mage tempMage = new Mage(gobX, gobY, 5, 5);

                    return(tempMage);
                }
                else
                {
                    Leader tempLeader = new Leader(gobX, gobY, Player);

                    return(tempLeader);
                }
            }

            return(null);
        }

        case (TileType.Gold):
        {
            int goldX = rando.Next(0, width);                      //get random width

            int goldY = rando.Next(0, height);                     //get random height

            while ((mapArray[goldX, goldY] is EmptyTile) == false) //while the tile is already taken, create a random X and Y position
            {
                goldX = rando.Next(0, width);                      //get random width

                goldY = rando.Next(0, height);                     //get random height
            }

            Gold tempGold = new Gold(goldX, goldY);

            return(tempGold);
        }

        case (TileType.Weapon):
        {
            int weaponX = rando.Next(0, width);

            int weaponY = rando.Next(0, height);

            while ((mapArray[weaponX, weaponY] is EmptyTile) == false)
            {
                weaponX = rando.Next(0, width);

                weaponY = rando.Next(0, height);
            }

            Random randWeapon = new Random(Guid.NewGuid().GetHashCode());


            int getrandWeapon = randWeapon.Next(0, 4);

            if (getrandWeapon == 0)
            {
                RangedWeapon tempweapon = new RangedWeapon(weaponX, weaponY, RangedWeapon.Types.Rifle);

                return(tempweapon);
            }
            else if (getrandWeapon == 1)
            {
                RangedWeapon tempweapon = new RangedWeapon(weaponX, weaponY, RangedWeapon.Types.Longbow);

                return(tempweapon);
            }
            else if (getrandWeapon == 2)
            {
                MeleeWeapon tempweapon = new MeleeWeapon(weaponX, weaponY, MeleeWeapon.Types.Dagger);

                return(tempweapon);
            }
            else
            {
                MeleeWeapon tempweapon = new MeleeWeapon(weaponX, weaponY, MeleeWeapon.Types.Longsword);

                return(tempweapon);
            }
        }

        default:
            break;
        }
        return(null);
    }
Exemplo n.º 31
0
                protected override void OnTick()
                {
                    Container theirPack = m_Target.Backpack;

                    if (theirPack == null)
                    {
                        m_From.SendLocalizedMessage(500404); // They seem unwilling to give you any money.
                    }
                    else if (m_From.CheckTargetSkill(SkillName.Begging, m_Target, 0.0, 120.0, 1.0))
                    {
                        int toConsume = theirPack.GetAmount(typeof(Gold)) / 10;
                        int max       = 10 + (m_From.Fame / 2500);

                        if (max > 14)
                        {
                            max = 14;
                        }

                        else if (max < 10)
                        {
                            max = 10;
                        }

                        if (toConsume > max)
                        {
                            toConsume = max;
                        }

                        if (toConsume > 0)
                        {
                            int consumed = theirPack.ConsumeUpTo(typeof(Gold), toConsume);

                            if (consumed > 0)
                            {
                                m_Target.PublicOverheadMessage(MessageType.Regular, m_Target.SpeechHue, 500405); // I feel sorry for thee...

                                Gold gold = new Gold(consumed);

                                m_From.AddToBackpack(gold);

                                //TEST: REDO

                                /*
                                 * if (m_From.Skills.Begging.Value == 100)
                                 * {
                                 *  var randomNumber = Utility.RandomMinMax(1, 100);
                                 *
                                 *  if (randomNumber <= 75) //75% chance
                                 *  {
                                 *      switch (Utility.Random(2))
                                 *      {
                                 *          case 0: m_From.AddToBackpack(new Pitcher(BeverageType.Water)); break;
                                 *
                                 *          default: m_From.AddToBackpack(new FrenchBread()); break;
                                 *      }
                                 *  }
                                 *
                                 *  else if (randomNumber <= 99) //24% chance
                                 *  {
                                 *      switch (Utility.Random(7))
                                 *      {
                                 *          case 0: m_From.AddToBackpack(new Lantern()); break;
                                 *          case 1: m_From.AddToBackpack(new CheesePizza()); break;
                                 *          case 2: m_From.AddToBackpack(new WoodenBowlOfStew()); break;
                                 *          case 3: m_From.AddToBackpack(new CheeseWedge()); break;
                                 *          case 4: m_From.AddToBackpack(new Dates()); break;
                                 *          case 5: m_From.AddToBackpack(new Shirt()); break;
                                 *
                                 *          default: m_From.AddToBackpack(new Pitcher(BeverageType.Liquor)); break;
                                 *      }
                                 *  }
                                 *
                                 *  else // 1% chance
                                 *  {
                                 *      switch (Utility.RandomMinMax(1, 6))
                                 *      {
                                 *          case 1: m_From.AddToBackpack(new Bedroll()); break;
                                 *          case 2: m_From.AddToBackpack(new Pitcher(BeverageType.Wine)); break;
                                 *          case 3: m_From.AddToBackpack(new BeverageBottle(BeverageType.Wine)); break;
                                 *          case 4: m_From.AddToBackpack(new FlowerGarland()); break;
                                 *          case 5: m_From.AddToBackpack(new FishingPole()); break;
                                 *          case 6: m_From.AddToBackpack(new Turnip()); break;
                                 *      }
                                 *  }
                                 * }
                                 */

                                m_From.PlaySound(gold.GetDropSound());

                                if (m_From.Karma > -3000)
                                {
                                    int toLose = m_From.Karma + 3000;

                                    if (toLose > 40)
                                    {
                                        toLose = 40;
                                    }

                                    FameKarmaTitles.AwardKarma(m_From, -toLose, true);
                                }
                            }

                            else
                            {
                                m_Target.PublicOverheadMessage(MessageType.Regular, m_Target.SpeechHue, 500407); // I have not enough money to give thee any!
                            }
                        }

                        else
                        {
                            m_Target.PublicOverheadMessage(MessageType.Regular, m_Target.SpeechHue, 500407); // I have not enough money to give thee any!
                        }
                        m_From.NextSkillTime = Core.TickCount + (int)(SkillCooldown.BeggingSuccessCooldown * 1000);
                    }

                    else
                    {
                        m_From.SendLocalizedMessage(500404); // They seem unwilling to give you any money.
                        m_From.NextSkillTime = Core.TickCount + (int)(SkillCooldown.BeggingFailureCooldown * 1000);
                    }
                }
Exemplo n.º 32
0
    void Start()
    {
        if (File.Exists(Application.persistentDataPath + "/Gold.dat"))
        {
            BinaryFormatter bf       = new BinaryFormatter();
            FileStream      goldf    = File.Open(Application.persistentDataPath + "/Gold.dat", FileMode.Open);
            Gold            goldData = (Gold)bf.Deserialize(goldf);
            goldf.Close();
            Map2  = goldData.Map2;
            Map3  = goldData.Map3;
            Map4  = goldData.Map4;
            Map5  = goldData.Map5;
            Map6  = goldData.Map6;
            Map7  = goldData.Map7;
            Map8  = goldData.Map8;
            Map9  = goldData.Map9;
            Map10 = goldData.Map10;
            Debug.Log(goldData.gold);
            click.gold = goldData.gold;
            Gems.gems  = goldData.gems;
        }
        if (File.Exists(Application.persistentDataPath + "/playerInfoSilverMine.dat"))
        {
            BinaryFormatter      bf             = new BinaryFormatter();
            FileStream           playerInfo     = File.Open(Application.persistentDataPath + "/playerInfoSilverMine.dat", FileMode.Open);
            PlayerDataSilverMine playerInfoData = (PlayerDataSilverMine)bf.Deserialize(playerInfo);
            playerInfo.Close();
            Seconds           = System.DateTime.Now.Second;
            Minutes           = System.DateTime.Now.Minute;
            Hours             = System.DateTime.Now.Hour;
            Day               = System.DateTime.Now.DayOfYear;
            Total             = Seconds + Minutes * 60 + Hours * 60 * 60;
            differenceSeconds = Total - playerInfoData.Total;

            for (int i = 0; i < 10; i++)
            {
                Items [i].count = playerInfoData.itemsArrayCount [i];
            }

            for (int i = 0; i < 10; i++)
            {
                Items [i].cost = playerInfoData.itemsArrayCost [i];
            }

            for (int i = 0; i < 10; i++)
            {
                Upgrades [i].count = playerInfoData.upgradesArrayCount [i];
            }

            for (int i = 0; i < 10; i++)
            {
                Upgrades [i].cost = playerInfoData.upgradesArrayCost [i];
            }

            Bank.AwayGoldMultiplier = playerInfoData.AwayGoldMultiplier;

            click.goldPerClick = playerInfoData.goldPerClick;
            GPS.goldPerSecond  = playerInfoData.goldPerSecond;

            if (playerInfoData.Day < Day)
            {
                differenceDays = Day - playerInfoData.Day;
                click.gold     = click.gold + ((playerInfoData.goldPerSecond * ((24 - playerInfoData.Hours + Hours) * 60 * 60) * differenceDays) + ((playerInfoData.goldPerSecond * ((24 - playerInfoData.Hours + Hours) * 60 * 60) * differenceDays) * (Bank.AwayGoldMultiplier) / 100));
                awayGold.text  = CurrencyConverter.Instance.GetCurrencyIntoString(((playerInfoData.goldPerSecond * ((24 - playerInfoData.Hours + Hours) * 60 * 60) * differenceDays) + ((playerInfoData.goldPerSecond * ((24 - playerInfoData.Hours + Hours) * 60 * 60) * differenceDays) * (Bank.AwayGoldMultiplier) / 100)), true) + " gold";
            }
            else
            {
                click.gold    = (click.gold + (playerInfoData.goldPerSecond * differenceSeconds) + ((playerInfoData.goldPerSecond * differenceSeconds) * (Bank.AwayGoldMultiplier) / 100));
                awayGold.text = CurrencyConverter.Instance.GetCurrencyIntoString(((playerInfoData.goldPerSecond * differenceSeconds) + ((playerInfoData.goldPerSecond * differenceSeconds) * (Bank.AwayGoldMultiplier) / 100)), true) + " gold";
            }
        }
        if (click.gold == 0)
        {
            AwayGold.gameObject.SetActive(false);
            Continue.gameObject.SetActive(false);
        }
        else
        {
            AwayGold.gameObject.SetActive(true);
            Continue.gameObject.SetActive(true);
        }
        if (File.Exists(Application.persistentDataPath + "/ResearchTimeSilverMine.dat"))
        {
            BinaryFormatter      bf               = new BinaryFormatter();
            FileStream           researchTime     = File.Open(Application.persistentDataPath + "/ResearchTimeSilverMine.dat", FileMode.Open);
            PlayerDataSilverMine researchTimeData = (PlayerDataSilverMine)bf.Deserialize(researchTime);
            researchTime.Close();

            Debug.Log("Researches [0].count" + Researches [0].count);
            Debug.Log("Researches [1].count" + Researches [1].count);
            Researches [0].count = researchTimeData.researchCount0;
            Researches [1].count = researchTimeData.researchCount1;
            Researches [2].count = researchTimeData.researchCount2;
            Researches [3].count = researchTimeData.researchCount3;
            Researches [4].count = researchTimeData.researchCount4;
            Researches [5].count = researchTimeData.researchCount5;
            Researches [6].count = researchTimeData.researchCount6;
            Researches [7].count = researchTimeData.researchCount7;
            Researches [8].count = researchTimeData.researchCount8;
            Researches [9].count = researchTimeData.researchCount9;
            Debug.Log("Researches [0].startTime" + Researches [0].startTime);
            Debug.Log("Researches [1].startTime" + Researches [1].startTime);
            Researches [0].startTime = researchTimeData.researchTime0;
            Researches [1].startTime = researchTimeData.researchTime1;
            Researches [2].startTime = researchTimeData.researchTime2;
            Researches [3].startTime = researchTimeData.researchTime3;
            Researches [4].startTime = researchTimeData.researchTime4;
            Researches [5].startTime = researchTimeData.researchTime5;
            Researches [6].startTime = researchTimeData.researchTime6;
            Researches [7].startTime = researchTimeData.researchTime7;
            Researches [8].startTime = researchTimeData.researchTime8;
            Researches [9].startTime = researchTimeData.researchTime9;
            if (researchTimeData.researchTime0 > 0)
            {
                if (Total - researchTimeData.researchTime0 >= 600 && Researches [0].done == false)
                {
                    GPS.goldPerSecond   = GPS.goldPerSecond * 2;
                    Researches [0].done = true;
                }
            }
            if (researchTimeData.researchTime1 > 0)
            {
                if (Total - researchTimeData.researchTime1 >= 900 && Researches [1].done == false)
                {
                    click.goldPerClick  = click.goldPerClick * 2;
                    Researches [1].done = true;
                }
            }
            if (researchTimeData.researchTime2 > 0)
            {
                if (Total - researchTimeData.researchTime2 >= 900 && Researches [2].done == false)
                {
                    click.goldPerClick  = click.goldPerClick * 3;
                    Researches [2].done = true;
                }
            }
            if (researchTimeData.researchTime3 > 0)
            {
                if (Total - researchTimeData.researchTime3 >= 1200 && Researches [3].done == false)
                {
                    GPS.goldPerSecond   = GPS.goldPerSecond * 2;
                    click.goldPerClick  = click.goldPerClick * 2;
                    Researches [3].done = true;
                }
            }
            if (researchTimeData.researchTime4 > 0)
            {
                if (Total - researchTimeData.researchTime4 >= 3600 && Researches [4].done == false)
                {
                    GPS.goldPerSecond   = GPS.goldPerSecond * 10;
                    Researches [4].done = true;
                }
            }
            if (researchTimeData.researchTime5 > 0)
            {
                if (Total - researchTimeData.researchTime5 >= 9000 && Researches [5].done == false)
                {
                    Upgrades [0].cost   = Upgrades [0].cost - (Upgrades [0].cost * 0.1f);
                    Upgrades [1].cost   = Upgrades [1].cost - (Upgrades [1].cost * 0.1f);
                    Upgrades [2].cost   = Upgrades [2].cost - (Upgrades [2].cost * 0.1f);
                    Upgrades [3].cost   = Upgrades [3].cost - (Upgrades [3].cost * 0.1f);
                    Upgrades [4].cost   = Upgrades [4].cost - (Upgrades [4].cost * 0.1f);
                    Upgrades [5].cost   = Upgrades [5].cost - (Upgrades [5].cost * 0.1f);
                    Upgrades [6].cost   = Upgrades [6].cost - (Upgrades [6].cost * 0.1f);
                    Upgrades [7].cost   = Upgrades [7].cost - (Upgrades [7].cost * 0.1f);
                    Upgrades [8].cost   = Upgrades [8].cost - (Upgrades [8].cost * 0.1f);
                    Upgrades [9].cost   = Upgrades [9].cost - (Upgrades [9].cost * 0.1f);
                    Researches [5].done = true;
                }
            }
            if (researchTimeData.researchTime6 > 0)
            {
                if (Total - researchTimeData.researchTime6 >= 18000 && Researches [6].done == false)
                {
                    GPS.goldPerSecond   = GPS.goldPerSecond * 4;
                    click.goldPerClick  = click.goldPerClick * 4;
                    Researches [6].done = true;
                }
            }
            if (researchTimeData.researchTime7 > 0)
            {
                if (Total - researchTimeData.researchTime7 >= 21000 && Researches [7].done == false)
                {
                    click.goldPerClick  = click.goldPerClick * 50;
                    Researches [7].done = true;
                }
            }
            if (researchTimeData.researchTime8 > 0)
            {
                if (Total - researchTimeData.researchTime8 >= 30000 && Researches [8].done == false)
                {
                    Upgrades [0].cost   = Upgrades [0].cost - (Upgrades [0].cost * 0.5f);
                    Upgrades [1].cost   = Upgrades [1].cost - (Upgrades [1].cost * 0.5f);
                    Upgrades [2].cost   = Upgrades [2].cost - (Upgrades [2].cost * 0.5f);
                    Upgrades [3].cost   = Upgrades [3].cost - (Upgrades [3].cost * 0.5f);
                    Upgrades [4].cost   = Upgrades [4].cost - (Upgrades [4].cost * 0.5f);
                    Upgrades [5].cost   = Upgrades [5].cost - (Upgrades [5].cost * 0.5f);
                    Upgrades [6].cost   = Upgrades [6].cost - (Upgrades [6].cost * 0.5f);
                    Upgrades [7].cost   = Upgrades [7].cost - (Upgrades [7].cost * 0.5f);
                    Upgrades [8].cost   = Upgrades [8].cost - (Upgrades [8].cost * 0.5f);
                    Upgrades [9].cost   = Upgrades [9].cost - (Upgrades [9].cost * 0.5f);
                    Researches [8].done = true;
                }
            }
            if (researchTimeData.researchTime9 > 0)
            {
                if (Total - researchTimeData.researchTime9 >= 36000 && Researches [9].done == false)
                {
                    GPS.goldPerSecond   = GPS.goldPerSecond * 4;
                    Researches [9].done = true;
                }
            }
        }
    }
Exemplo n.º 33
0
                protected override void OnTick()
                {
                    Container theirPack = m_Target.Backpack;

                    double badKarmaChance = 0.5 - ((double)m_From.Karma / 8570);

                    if (theirPack == null)
                    {
                        m_From.SendLocalizedMessage(500404);                           // They seem unwilling to give you any money.
                    }
                    else if (m_From.Karma < 0 && badKarmaChance > Utility.RandomDouble())
                    {
                        m_Target.PublicOverheadMessage(MessageType.Regular, m_Target.SpeechHue, 500406);                           // Thou dost not look trustworthy... no gold for thee today!
                    }
                    else if (m_From.CheckTargetSkill(SkillName.Begging, m_Target, 0.0, 100.0))
                    {
                        int toConsume = theirPack.GetAmount(typeof(Gold)) / 10;
                        int max       = 10 + (m_From.Fame / 2500);

                        if (max > 14)
                        {
                            max = 14;
                        }
                        else if (max < 10)
                        {
                            max = 10;
                        }

                        if (toConsume > max)
                        {
                            toConsume = max;
                        }

                        if (toConsume > 0)
                        {
                            int consumed = theirPack.ConsumeUpTo(typeof(Gold), toConsume);

                            if (consumed > 0)
                            {
                                m_Target.PublicOverheadMessage(MessageType.Regular, m_Target.SpeechHue, 500405);                                   // I feel sorry for thee...

                                Gold gold = new Gold(consumed);

                                m_From.AddToBackpack(gold);
                                m_From.PlaySound(gold.GetDropSound());

                                if (m_From.Karma > -3000)
                                {
                                    int toLose = m_From.Karma + 3000;

                                    if (toLose > 40)
                                    {
                                        toLose = 40;
                                    }

                                    Titles.AwardKarma(m_From, -toLose, true);
                                }
                            }
                            else
                            {
                                m_Target.PublicOverheadMessage(MessageType.Regular, m_Target.SpeechHue, 500407);                                   // I have not enough money to give thee any!
                            }
                        }
                        else
                        {
                            m_Target.PublicOverheadMessage(MessageType.Regular, m_Target.SpeechHue, 500407);                               // I have not enough money to give thee any!
                        }
                    }
                    else
                    {
                        m_Target.SendLocalizedMessage(500404);                           // They seem unwilling to give you any money.
                    }

                    m_From.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(10.0);
                }
Exemplo n.º 34
0
        public virtual bool CheckAtDestination()
        {
            EDI dest = GetDestination();

            if (dest == null)
            {
                return(false);
            }

            Mobile escorter = GetEscorter();

            if (escorter == null)
            {
                return(false);
            }

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


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

                Container cont = escorter.Backpack;

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

                Gold gold = new Gold(500, 1000);

                if (cont == null || !cont.TryDropItem(escorter, gold, false))
                {
                    gold.MoveToWorld(escorter.Location, escorter.Map);
                }

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

                bool gainedPath = false;

                PlayerMobile pm = escorter as PlayerMobile;

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

                    if (pm.CompassionGains >= 5)                       // have already gained 5 points in one day, can gain no more
                    {
                        pm.SendLocalizedMessage(1053004);              // You must wait about a day before you can gain in compassion again.
                    }
                    else if (VirtueHelper.Award(pm, VirtueName.Compassion, 1, ref gainedPath))
                    {
                        if (gainedPath)
                        {
                            pm.SendLocalizedMessage(1053005);                               // You have achieved a path in compassion!
                        }
                        else
                        {
                            pm.SendLocalizedMessage(1053002);                               // You have gained in compassion.
                        }
                        pm.NextCompassionDay = DateTime.UtcNow + TimeSpan.FromDays(1.0);    // in one day CompassionGains gets reset to 0
                        ++pm.CompassionGains;
                    }
                    else
                    {
                        pm.SendLocalizedMessage(1053003);                           // You have achieved the highest path of compassion and can no longer gain any further.
                    }
                }

                XmlQuest.RegisterEscort(this, escorter);

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

                return(true);
            }

            return(false);
        }
Exemplo n.º 35
0
        static void GenerateGold()
        {
            /* Тук се генерира златото, прави се просто проверка дали полето е 
             * свободно, ако е слага символ * и вдига броя на златните кюлчета с 1
             * */
            for (int cols = 0; cols < MazeHeight; cols++)
            {
                for (int rows = 1; rows < MazeWidth; rows++)
                {
                    if (maze.IsThereTunnel(rows, cols))
                    {
                        Gold newToken = new Gold(rows, cols);
                        goldTokens.Add(newToken);                    
                    }
                }
            }

            DrawGold();
        }
Exemplo n.º 36
0
        public string SaveXml()
        {
            XmlDocument data = new XmlDocument();

            XmlNode playerData = data.CreateElement("Player");

            data.AppendChild(playerData);

            XmlNode stats = data.CreateElement("Stats");

            playerData.AppendChild(stats);

            XmlNode name = data.CreateElement("Name");

            name.AppendChild(data.CreateTextNode(Name));

            XmlNode currentHp = data.CreateElement("CurrentHitPoint");

            currentHp.AppendChild(data.CreateTextNode(CurrentHitPoint.ToString()));

            XmlNode gold = data.CreateElement("Gold");

            gold.AppendChild(data.CreateTextNode(Gold.ToString()));

            XmlNode currentExp = data.CreateElement("CurrentEXP");

            currentExp.AppendChild(data.CreateTextNode(CurrentEXP.ToString()));

            XmlNode currentLevel = data.CreateElement("CurrentLevel");

            currentLevel.AppendChild(data.CreateTextNode(CurrentLevel.ToString()));

            XmlNode maxHp = data.CreateElement("MaxHitPoint");

            maxHp.AppendChild(data.CreateTextNode(MaximumHitPoint.ToString()));

            XmlNode maxExp = data.CreateElement("MaxExp");

            maxExp.AppendChild(data.CreateTextNode(MaximumEXP.ToString()));

            XmlNode currentLocation = data.CreateElement("CurrentLocationId");

            currentLocation.AppendChild(data.CreateTextNode(CurrentLocation.ID.ToString()));

            XmlNode inventory = data.CreateElement("Inventory");

            playerData.AppendChild(inventory);

            foreach (InventoryItem inventoryItem in Inventory)
            {
                XmlNode xmlItem = inventoryItem.XmlNode(data);
                inventory.AppendChild(xmlItem);
            }


            XmlNode quests = data.CreateElement("Quests");

            playerData.AppendChild(quests);

            foreach (PlayerQuest playerQuest in Quests)
            {
                XmlNode xmlQuest = playerQuest.XmlNode(data);
                quests.AppendChild(xmlQuest);
            }

            stats.AppendChild(name);
            stats.AppendChild(currentHp);
            stats.AppendChild(gold);
            stats.AppendChild(currentExp);
            stats.AppendChild(currentLevel);
            stats.AppendChild(maxHp);
            stats.AppendChild(maxExp);
            stats.AppendChild(currentLocation);

            return(data.InnerXml);
        }
Exemplo n.º 37
0
 // mob drop golds
 public static void DropLootOnMobDeath(Room room, Mob mob)
 {
     Gold gold = new Gold(mob.x, mob.y);
     room.lootList.Add(gold);
     room.AddChild(gold);
 }
Exemplo n.º 38
0
 public void AddResourse(Gold gold, Resources res)
 {
     gold.Apply(res.count.Value);
 }
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            PlayerMobile from = (PlayerMobile)sender.Mobile;

            Handeling.AddTimer.Stop();

            switch (info.ButtonID)
            {
            case 0:
            {
                Handeling.Caller.SendMessage(String.Format("{0} has declined the duel.", from.Name));
                Handeling.Caller.SendGump(new RVSSetup_ParticipantSetup(Handeling, TeamID));
                break;
            }

            case 1:
            {
                if (Handeling.BuyIn > 0)
                {
                    if (!HasGold(from, Handeling.BuyIn))
                    {
                        from.SendMessage("You do not have enough money to buy into this duel.");
                        from.SendGump(new RVSSetup_AddParticipant(Handeling, TeamID, Index));
                        return;
                    }
                    else
                    {
                        Item i = CheckForGoldSources(from, Handeling.BuyIn);

                        if (i is Gold)
                        {
                            i.Amount -= Handeling.BuyIn;
                        }
                        else
                        {
                            BankCheck check = (BankCheck)i;
                            check.Worth -= Handeling.BuyIn;
                        }

                        if (i.Amount <= 0)
                        {
                            i.Delete();
                            return;
                        }

                        if (i is BankCheck)
                        {
                            BankCheck check = (BankCheck)i;

                            if (check.Worth > 0)
                            {
                                if (check.Worth < 5000)
                                {
                                    if (check.Parent is BankBox)
                                    {
                                        BankBox box = (BankBox)check.Parent;

                                        Gold g = new Gold(check.Worth);
                                        box.DropItem(g);

                                        check.Delete();
                                    }

                                    if (check.Parent is Backpack)
                                    {
                                        Backpack pack = (Backpack)check.Parent;

                                        Gold g = new Gold(check.Worth);
                                        pack.DropItem(g);

                                        check.Delete();
                                    }
                                }
                            }
                            else
                            {
                                check.Delete();
                            }
                        }
                        from.SendMessage("The buy in funds for the duel have been paid.");
                    }
                }

                Handeling.Caller.SendMessage(String.Format("{0} has accepted the duel.", from.Name));
                Handeling.Teams[TeamID].Players[Index] = from;
                Handeling.Teams[TeamID].Accepted.Add((PlayerMobile)from, false);

                Handeling.Caller.SendGump(new RVSSetup_ParticipantSetup(Handeling, TeamID));
                break;
            }

            case 2:
            {
                Handeling.Caller.SendMessage(String.Format("{0} has declined the duel.", from.Name));
                Handeling.Caller.SendGump(new RVSSetup_ParticipantSetup(Handeling, TeamID));
                break;
            }
            }
        }
Exemplo n.º 40
0
 // For player gold changed
 public void IHasChanged(GamePlayer gamePlayer, Gold gold)
 {
     OnPlayerGoldHasChanged.Invoke();
 }
Exemplo n.º 41
0
        public static bool Deposit(Mobile from, int amount, bool message = false)
        {
            // If for whatever reason the TOL checks fail, we should still try old methods for depositing currency.
            if (AccountGold.Enabled && from.Account != null && from.Account.DepositGold(amount))
            {
                if (message)
                {
                    from.SendLocalizedMessage(1042763, amount.ToString("N0", System.Globalization.CultureInfo.GetCultureInfo("en-US"))); // ~1_AMOUNT~ gold was deposited in your account.
                }
                return(true);
            }

            BankBox box = from.Player ? from.BankBox : from.FindBankNoCreate();

            if (box == null)
            {
                return(false);
            }

            List <Item> items = new List <Item>();

            while (amount > 0)
            {
                Item item;
                if (amount < 5000)
                {
                    item   = new Gold(amount);
                    amount = 0;
                }
                else if (amount <= 1000000)
                {
                    item   = new BankCheck(amount);
                    amount = 0;
                }
                else
                {
                    item    = new BankCheck(1000000);
                    amount -= 1000000;
                }

                if (box.TryDropItem(from, item, false))
                {
                    items.Add(item);
                }
                else
                {
                    item.Delete();
                    foreach (Item curItem in items)
                    {
                        curItem.Delete();
                    }

                    return(false);
                }
            }

            if (message)
            {
                from.SendLocalizedMessage(1042763, amount.ToString("N0", System.Globalization.CultureInfo.GetCultureInfo("en-US"))); // ~1_AMOUNT~ gold was deposited in your account.
            }
            return(true);
        }
Exemplo n.º 42
0
    public override void initChild(int charCode_)
    {
        ui_control = GameObject.Find ("UI Manager").GetComponent<UI_Control> ();
        ui_control.SetPlayer (GetComponent<Player> ());

        charCode = charCode_;
        coolTime = new int[5]{0,0,0,0,0};
        playerLevel = 1;
        currExp = 0;
        fullExp = Config.requiredExp [playerLevel - 1];
        for(int i = 0 ; i < Config.inventoryRow * Config.inventoryCol;i++){
            drink[i] = null;

        }
        for(int i = 0 ; i < Config.inventoryRow * Config.inventoryCol;i++){
            equip[i] = null;
        }
        equip [4] = new Gold ();
        equip [4].init (-1, 0, 0);
    }
Exemplo n.º 43
0
        public void EndInvasion(InvasionEventSink.InvasionEndedEventArgs.InvasionEndedReason Reason)
        {
            m_InvasionStarted = false;

            List <InvasionSpawn> ToDelete = new List <InvasionSpawn>();

            for (int i = 0; i < m_SpawnList.Count; ++i)
            {
                ToDelete.Add((InvasionSpawn)m_SpawnList[i]);
            }

            foreach (Mobile m in World.Mobiles.Values)
            {
                if (m is InvasionSpawn)
                {
                    if (((InvasionSpawn)m).Controller == this)
                    {
                        ToDelete.Add((InvasionSpawn)m);
                    }
                }
            }

            for (int i = 0; i < ToDelete.Count; ++i)
            {
                InvasionSpawn deleting = (InvasionSpawn)ToDelete[i];
                deleting.Delete();
            }

            if (Reason == InvasionEventSink.InvasionEndedEventArgs.InvasionEndedReason.KillCountReached)
            {
                Console.WriteLine("Player Count:" + m_Players.Count.ToString());
                IEnumerator key = m_Players.Keys.GetEnumerator();
                for (int i = 0; i < m_Players.Count; ++i)
                {
                    key.MoveNext();
                    int kills   = (int)m_Players[(PlayerMobile)key.Current];
                    int percent = (kills / m_RequiredKillCount) * 100;
                    if (percent > 100)
                    {
                        percent = 100;
                    }

                    int reward = (percent * m_Reward) / 100;

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

                    if (reward > 60000)
                    {
                        reward = 60000;
                    }

                    Console.WriteLine("Kills:" + kills.ToString());
                    Console.WriteLine("Percent:" + percent.ToString());

                    Item givenreward;
                    if (reward >= 5000)
                    {
                        givenreward = new BankCheck(reward);
                    }
                    else
                    {
                        givenreward = new Gold(reward);
                    }

                    BankBox bank = (BankBox)((PlayerMobile)key.Current).BankBox;
                    bank.AddItem(givenreward);

                    ((PlayerMobile)key.Current).SendMessage(String.Format("The invasion has ended! You have been rewarded {0}gp!", reward.ToString()));
                }
            }

            m_SpawnList.Clear();
            m_SpawnList = null;

            m_Players.Clear();
            m_Players = null;
            m_Kills   = 0;

            InvasionEventSink.OnInvasionEnded(new InvasionEventSink.InvasionEndedEventArgs(this, Reason));
        }
Exemplo n.º 44
0
		public virtual bool AddHire( Mobile m, Gold pay )
		{
			Mobile owner = GetOwner();

			if( owner != null )
			{
				Console.Write( "BaseHire.AddHire() {0} Owner.Name = ", this.Name );
				Console.WriteLine( owner.Name );
				m.SendLocalizedMessage( 1043283, owner.Name ); // I am following ~1_NAME~.
				return false;
			}

			if( SetControlMaster( m ) )
			{
				m_IsHired = true;
				HireTable[m] = this;
				m_RemainingPay += pay.Amount;
				m_PayTimer.Start();
				SayTo( m, 1043258, string.Format( "{0}", (pay.Amount / m_PayRate) ) );//"I thank thee for paying me. I will work for thee for ~1_NUMBER~ days.", (int)item.Amount / m_PayRate );
				return true;
			}

			return false;
		}
Exemplo n.º 45
0
 public override bool OnGoldGiven(Mobile from, Gold dropped)
 {
     return(false);
 }
Exemplo n.º 46
0
        public static bool WithdrawPackAndBank(Mobile from, int amount)
        {
            int         totalGold = 0;
            List <Gold> packgold;

            //BankCheck[] packchecks;
            Gold[]      bankgold;
            BankCheck[] bankchecks;

            if (from.Backpack != null)
            {
                packgold = from.Backpack.FindItemsByType <Gold>();
                //packchecks = from.Backpack.FindItemsByType<BankCheck>( false ); //They are only blessed on the top layer.

                for (int i = 0; i < packgold.Count; i++)
                {
                    totalGold += packgold[i].Amount;
                }

                //for ( int i = 0;i < packchecks.Length; i++ )
                //	totalGold += packchecks[i].Worth;
            }
            else
            {
                packgold = new List <Gold>();
                //packchecks = new BankCheck[0];
            }

            if (totalGold < amount)
            {
                totalGold += Banker.GetBalance(from, out bankgold, out bankchecks);
            }
            else
            {
                bankgold   = new Gold[0];
                bankchecks = new BankCheck[0];
            }

            if (totalGold >= amount)
            {
                for (int i = 0; amount > 0 && i < packgold.Count; ++i)
                {
                    int consume = Math.Min(packgold[i].Amount, amount);
                    packgold[i].Consume(consume);
                    amount -= consume;
                }

/*
 *                              for ( int i = 0; amount > 0 && i < packchecks.Count; ++i )
 *                              {
 *                                      int consume = Math.Min( packchecks[i].Worth, amount );
 *                                      packchecks[i].ConsumeWorth( consume );
 *                                      amount -= consume;
 *                              }
 */
                Banker.WithdrawUpTo(from, amount, bankgold, bankchecks);

                return(true);
            }

            return(false);
        }
Exemplo n.º 47
0
        public override IResources CreateResource()
        {
            Gold resource = new Gold();

            return(resource);
        }
Exemplo n.º 48
0
    /*	public void makeDrink (Item sc_drink, Vector3 drinkPos){
        //todo 미리 뿌려져있는 술과 겹쳐지게 해야함.
        TileInfo ti = boardManager._Stage [currStage].get_tileInfo ()[((int)drinkPos.y), ((int)drinkPos.x)];
        GameObject go_drink = Instantiate (Resources.Load ("Image_Drink/" + Config.spriteName_Item[sc_drink.GetItemCode()], typeof(GameObject))) as GameObject;
        go_drink.transform.position = drinkPos;
        ti.i.Add (sc_drink);					//Tile Info에 등록
    }*/
    public void makeItemGO(int itemType, Vector3 itemPos, string resourceName)
    {
        TileInfo ti = boardManager._Stage [currStage].get_tileInfo ()[((int)itemPos.y), ((int)itemPos.x)];

        if (itemType < 0) {																			//골드일 경우
            GameObject go_gold = Instantiate (Resources.Load (resourceName, typeof(GameObject))) as GameObject;
            go_gold.GetComponent<ObjectID> ().secondCode = -itemType;
            go_gold.transform.position = itemPos;
            go_gold.GetComponent<SpriteRenderer> ().sortingOrder = ti.i.Count+ti.d.Count;			//소팅 레이어 등록
            Gold sc_gold = new Gold ();
            sc_gold.SetGameObject (go_gold);
            sc_gold.init (-1, -itemType, 0);
        //			Debug.Log("make Item in " + itemPos.x + "," + itemPos.y);
            ti.i.Add (sc_gold);		//Tile Info에 드랍 골드 등록
        } else {
            switch(itemType){
            case 0:			//drink
                Debug.Log("Can't make drink here");
                break;
            case 1:			//weapon
                GameObject go_weapon = Instantiate (Resources.Load (resourceName, typeof(GameObject))) as GameObject;
                go_weapon.transform.position = itemPos;
                go_weapon.GetComponent<SpriteRenderer> ().sortingOrder = ti.i.Count+ti.d.Count;		//소팅 레이어 등록
                Weapon sc_weapon = new Weapon();
                sc_weapon.SetGameObject (go_weapon);
                ObjectID weaponId = go_weapon.GetComponent<ObjectID>();
                sc_weapon.init (weaponId.firstCode, weaponId.secondCode, weaponId.thirdCode);
                ti.i.Add (sc_weapon);		//Tile Info에 등록
                break;
            case 2:			//accessory
                GameObject go_acce = Instantiate (Resources.Load (resourceName, typeof(GameObject))) as GameObject;
                go_acce.transform.position = itemPos;
                go_acce.GetComponent<SpriteRenderer> ().sortingOrder = ti.i.Count+ti.d.Count;		//소팅 레이어 등록
                Accessory sc_acce = new Accessory();
                sc_acce.SetGameObject (go_acce);
                ObjectID acceId = go_acce.GetComponent<ObjectID>();
                sc_acce.init (acceId.firstCode, acceId.secondCode, acceId.thirdCode);
                ti.i.Add (sc_acce);		//Tile Info에 등록
                break;
            case 3:			//snack
                GameObject go_snack = Instantiate (Resources.Load (resourceName, typeof(GameObject))) as GameObject;
                go_snack.transform.position = itemPos;
                go_snack.GetComponent<SpriteRenderer> ().sortingOrder = ti.i.Count+ti.d.Count;		//소팅 레이어 등록
                Snack sc_snack = new Snack();
                sc_snack.SetGameObject (go_snack);
                ObjectID snackId = go_snack.GetComponent<ObjectID>();
                sc_snack.init (snackId.firstCode, snackId.secondCode, snackId.thirdCode);
                ti.i.Add (sc_snack);		//Tile Info에 등록
                break;
            case 4:			//alcoholBag
                GameObject go_abg = Instantiate (Resources.Load (resourceName, typeof(GameObject))) as GameObject;
                go_abg.transform.position = itemPos;
                go_abg.GetComponent<SpriteRenderer> ().sortingOrder = ti.i.Count+ti.d.Count;		//소팅 레이어 등록
                AlcoholBag sc_abg = new AlcoholBag();
                sc_abg.SetGameObject (go_abg);
                ObjectID abgId = go_abg.GetComponent<ObjectID>();
                sc_abg.init (abgId.firstCode, abgId.secondCode, abgId.thirdCode);
                ti.i.Add (sc_abg);			//Tile Info에 등록
                break;
            case 5:			//alcoholBottle
                GameObject go_abt = Instantiate (Resources.Load (resourceName, typeof(GameObject))) as GameObject;
                go_abt.transform.position = itemPos;
                go_abt.GetComponent<SpriteRenderer> ().sortingOrder = ti.i.Count+ti.d.Count;		//소팅 레이어 등록
                AlcoholBottle sc_abt = new AlcoholBottle();
                sc_abt.SetGameObject (go_abt);
                ObjectID abtId = go_abt.GetComponent<ObjectID>();
                sc_abt.init (abtId.firstCode, abtId.secondCode, abtId.thirdCode);
                ti.i.Add (sc_abt);			//Tile Info에 등록
                break;
            }
        }
    }
Exemplo n.º 49
0
 public void AddGold(int x, int y, Gold gold)
 {
     Logger.DebugFormat("{0}, {1}, {2} qty {3} id {4}",
         x, y, gold.Name, gold.Amount, gold.Id);
     if (gold == null)
     {
         Logger.DebugFormat("Item is null, aborting");
         return;
     }
     // Add the gold to the world at the given location.
     gold.X = (byte)x;
     gold.Y = (byte)y;
     gold.Map = this;
     EntityTree.Add(gold);
     Objects.Add(gold);
     NotifyNearbyAoiEntry(gold);
 }