Esempio 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." );

                Silver silver = new Silver( 5, 25 );

                silver.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." );
            }
        }
Esempio n. 2
0
    // Use this for initialization
    void Start()
    {
        apple   = PlayerPrefs.GetInt("tier1", 0);
        cherry  = PlayerPrefs.GetInt("tier2", 0);
        grape   = PlayerPrefs.GetInt("tier3", 0);
        ToSpawn = Random.Range(1, 10);

        if (ToSpawn == 1)
        {
            Gold.SetActive(true);
        }
        if (ToSpawn == 2)
        {
            Silver.SetActive(true);
        }
        if (ToSpawn == 3 && apple == 1)
        {
            Apple.SetActive(true);
        }
        if (ToSpawn == 4 && cherry == 1)
        {
            Grape.SetActive(true);
        }
        if (ToSpawn == 5 && grape == 1)
        {
            Cherry.SetActive(true);
        }
    }
Esempio n. 3
0
            public Account(string owner)
            {
                // New accounts are 'Silver' by default

                Owner = owner;
                State = new Silver(0.0, this);
            }
Esempio n. 4
0
        public override string ToString()
        {
            var goldString   = Gold != 0 ? Gold.ToString() + "g " : "";
            var silverString = Silver != 0 ? Silver.ToString() + "s " : "";
            var copperString = Copper != 0 ? Copper.ToString() + "c " : "";

            return(String.Format("{0}{1}{2}", goldString, silverString, copperString));
        }
        public void TestManualCarWithInternationalLicense()
        {
            Policy silver = new Silver();

            silver.DrivingLicense = LicenseType.International;
            silver = new ManualCar(silver);
            Assert.AreEqual("Silver Policy, Manual car $340.49", $"{silver.GetDescription()} ${silver.GetCost()}");
        }
Esempio n. 6
0
        [InlineData(PlayerType.White, "7b", "7a")] //"NotMoveBackAsWhitePlayer"
        public void NotAllowIllegalMoves(PlayerType player, string positionFrom, string positionTo)
        {
            var silver = new Silver(player, positionFrom);

            var isMoveLegal = silver.IsMoveLegal(positionTo);

            Assert.False(isMoveLegal);
        }
Esempio n. 7
0
        public override string ToString()
        {
            var goldString   = Gold != 0 ? Gold.ToString() + "g " : "";
            var silverString = Silver != 0 ? Silver.ToString() + "s " : "";
            var copperString = Copper != 0 ? Copper.ToString() + "c " : "";

            return($"{goldString}{silverString}{copperString}");
        }
Esempio n. 8
0
 public string ToString(IFormatProvider provider)
 {
     return
         (Platinum.ToString(provider) + "p " +
          Gold.ToString(provider) + "g " +
          Silver.ToString(provider) + "s " +
          Copper.ToString(provider) + "c");
 }
Esempio n. 9
0
        [InlineData(PlayerType.White, "5e", "6d")] //"BeAbleToMoveBackRightAsWhitePlayer"
        public void AllowValidMoves(PlayerType player, string positionFrom, string positionTo)
        {
            var silver = new Silver(player, positionFrom);

            var isMoveLegal = silver.IsMoveLegal(positionTo);

            Assert.True(isMoveLegal);
        }
Esempio n. 10
0
 public static bool wantsToCraftOnObject(Player p, int item, int craftObject)
 {
     if (craftObject == CLAY_TABLE)
     {
         if (item == CLAY)
         {
             resetCrafting(p);
             Clay.displayClayOptions(p, 1);
             p.setTemporaryAttribute("craftType", 1);
             return(true);
         }
         else
         {
             for (int j = 0; j < CLAY_ITEMS.Length; j++)
             {
                 if (item == (int)CLAY_ITEMS[j][0])
                 {
                     p.getPackets().sendMessage("This item must now be baked in a clay oven.");
                     return(true);
                 }
             }
         }
     }
     else if (craftObject == CLAY_OVEN)
     {
         if (craftObject == CLAY)
         {
             p.getPackets().sendMessage("This clay must be moulded into an item first.");
             return(true);
         }
         for (int j = 0; j < CLAY_ITEMS.Length; j++)
         {
             if (item == (int)CLAY_ITEMS[j][0])
             {
                 resetCrafting(p);
                 Clay.displayClayOptions(p, 2);
                 p.setTemporaryAttribute("craftType", 2);
                 return(true);
             }
         }
     }
     else if (craftObject == 11666)
     { // Furnace
         if (item == GOLD_BAR)
         {
             Jewellery.displayJewelleryInterface(p);
             return(true);
         }
         else if (item == SILVER_BAR)
         {
             Silver.displaySilverOptions(p);
             return(true);
         }
     }
     return(false);
 }
Esempio n. 11
0
        public void Setup()
        {
            Mock <IRandom> random = new Mock <IRandom>();

            random.Setup(e => e.Next(6, 9)).Returns(1);
            random.Setup(e => e.Next(9, 12)).Returns(2);
            random.Setup(e => e.Next(12, 15)).Returns(3);
            GlobalReference.GlobalValues.Random = random.Object;
            material = new Silver();
        }
Esempio n. 12
0
 public static List <Card> VictoryAndTreasures()
 {
     return(new List <Card>
     {
         Copper.Get(),
         Silver.Get(),
         Gold.Get(),
         Estate.Get(),
         Duchy.Get(),
         Province.Get()
     });
 }
Esempio n. 13
0
 private static List <Pile> VictoryAndTreasures(bool two)
 {
     return(new List <Pile>
     {
         new Pile(Copper.Get(), 60),
         new Pile(Silver.Get(), 40),
         new Pile(Gold.Get(), 30),
         new Pile(Estate.Get(), two ? 8 : 12),
         new Pile(Duchy.Get(), two ? 8 : 12),
         new Pile(Province.Get(), two ? 8 : 12)
     });
 }
Esempio n. 14
0
        private void SetLobbyUi()
        {
            _playerInformationPannel = GameObject.Find("Player Information Panel");
            _nickname = _playerInformationPannel.transform.GetChild(0).GetComponent <Text>();
            _gold     = _playerInformationPannel.transform.GetChild(1).GetComponent <Text>();
            _silver   = _playerInformationPannel.transform.GetChild(2).GetComponent <Text>();
            _bronze   = _playerInformationPannel.transform.GetChild(3).GetComponent <Text>();

            _nickname.text = Nickname;
            _gold.text     = Gold.ToString();
            _silver.text   = Silver.ToString();
            _bronze.text   = Bronze.ToString();
        }
Esempio n. 15
0
        //---------------------------------
        public StrongString GetForServer()
        {
            StrongString myString =
                Coupon.GetForServer() + InCharSeparator +   // 1
                Diamond.GetForServer() + InCharSeparator +  // 2
                Stone.GetForServer() + InCharSeparator +    // 3
                Silver.GetForServer() + InCharSeparator +   // 4
                Coin.GetForServer() + InCharSeparator +     // 5
                Mana.GetForServer() + InCharSeparator +     // 6
                MP.GetForServer() + InCharSeparator;        // 7

            return(myString);
        }
Esempio n. 16
0
        /**<summary>Saves the xml to be modified for use in Terraria.</summary>*/
        public static void SaveXmlConfiguration()
        {
            try {
                string configPath = Path.Combine(Patcher.ExeDirectory, CoinReplacer.ConfigName);

                XmlDocument doc = new XmlDocument();
                doc.AppendChild(doc.CreateXmlDeclaration("1.0", "UTF-8", null));

                XmlElement replacer = doc.CreateElement("RupeeReplacer");
                doc.AppendChild(replacer);

                XmlElement element = doc.CreateElement("CopperCoin");
                element.SetAttribute("Color", Copper.ToString());
                replacer.AppendChild(element);

                element = doc.CreateElement("SilverCoin");
                element.SetAttribute("Color", Silver.ToString());
                replacer.AppendChild(element);

                element = doc.CreateElement("GoldCoin");
                element.SetAttribute("Color", Gold.ToString());
                replacer.AppendChild(element);

                element = doc.CreateElement("PlatinumCoin");
                element.SetAttribute("Color", Platinum.ToString());
                replacer.AppendChild(element);


                element = doc.CreateElement("CoinGun");
                element.SetAttribute("Enabled", CoinGun.ToString());
                replacer.AppendChild(element);

                element = doc.CreateElement("LuckyCoin");
                element.SetAttribute("Enabled", LuckyCoin.ToString());
                replacer.AppendChild(element);

                element = doc.CreateElement("CoinRing");
                element.SetAttribute("Enabled", CoinRing.ToString());
                replacer.AppendChild(element);

                element = doc.CreateElement("CoinPortal");
                element.SetAttribute("Enabled", CoinPortal.ToString());
                replacer.AppendChild(element);

                doc.Save(configPath);
            }
            catch (Exception ex) {
                throw new Exception("Failed to save " + CoinReplacer.ConfigName, ex);
            }
        }
Esempio n. 17
0
 public Buff()
 {
     silver   = new Silver();
     pldA     = new PldA();
     pldB     = new PldB();
     leap130  = new LEAP130();
     leap300  = new LEAP300();
     clientDa = new ClientDaOPC();
     clientDa.UpdateOpcLEAP130 += ClientDa_UpdateOpcLEAP130;
     clientDa.UpdateOpcLEAP300 += ClientDa_UpdateOpcLEAP300;
     clientDa.UpdateOpcPldA    += ClientDa_UpdateOpcPldA;
     clientDa.UpdateOpcPldB    += ClientDa_UpdateOpcPldB;
     clientDa.UpdateOpcSilver  += ClientDa_UpdateOpcSilver;
 }
Esempio n. 18
0
        public void LiskovSubstitutionTest()
        {
            var golden  = new Golden();
            var silver  = new Silver();
            var enquiry = new Enquiry();

            var list = new List <Customer> {
                golden, silver, enquiry
            };

            foreach (var customer in list)
            {
                customer.Add();
            }
        }
Esempio n. 19
0
        private void statusSilverScan(Silver silver)
        {
            if (silver.procesStart != silver.SendFlags[32] && silver.procesStart)
            {
                if (!silver.SendFlags[31])
                {
                    bot.SendMessageChat("SILVER: " + "Процесс запущен" + "\n");
                    silver.SendFlags[31] = true;
                }
            }
            else
            {
                silver.SendFlags[31] = false;
            }
            if (silver.procesStart != silver.SendFlags[32] && !silver.procesStart)
            {
                if (!silver.SendFlags[33])
                {
                    bot.SendMessageChat("SILVER: " + "Процесс остановлен" + "\n");
                    silver.SendFlags[33] = true;
                }
            }
            else
            {
                silver.SendFlags[33] = false;
            }
            silver.SendFlags[33] = silver.procesStart;

            int min = Convert.ToInt32((silver.lengthSet - silver.length) * 60 / (silver.speed));

            if (min < 11 && min > 0)
            {
                if (!silver.SendFlags[34])
                {
                    bot.SendMessageChat("SILVER: " + "Процесс завершится через " + min + " минут" + "\n");
                    silver.SendFlags[34] = true;
                }
            }
            else
            {
                silver.SendFlags[34] = false;
            }
        }
		public override bool OnDragDrop( Mobile from, Item dropped )
		{
			if ( !( dropped is FactionSilver ) )
			{
				from.SendMessage( "You can only drop old faction silver here." );
				return false;
			}
			else
			{
				if ( from.Backpack != null )
				{
					Silver silver = new Silver( ((FactionSilver)dropped).Amount );
					from.Backpack.DropItem( silver );
					dropped.Delete();
					from.SendMessage( "You successfully converted the old silver to new silver!" );
				}
				else
					from.SendMessage( "Where is your backpack?!" );
				return true;
			}
		}
Esempio n. 21
0
        public override void GenerateResources()
        {
            Random rnd = new Random();

            //Si pas de ressource, on regenère de 0
            if (Resources.Count == 0)
            {
                Wood w = new Wood(rnd.Next(0, 10));
                base.Resources.Add(w);

                Stone s = new Stone(rnd.Next(0, 30));
                base.Resources.Add(s);

                Water wa = new Water(rnd.Next(0, 10));
                base.Resources.Add(wa);

                Coal co = new Coal(rnd.Next(0, 30));
                base.Resources.Add(co);

                Copper cop = new Copper(rnd.Next(0, 30));
                base.Resources.Add(cop);

                Gold go = new Gold(rnd.Next(0, 5));
                base.Resources.Add(go);

                Iron ir = new Iron(rnd.Next(0, 30));
                base.Resources.Add(ir);

                Silver si = new Silver(rnd.Next(0, 10));
                base.Resources.Add(si);
            }
            else
            {
                foreach (Resource r in Resources)
                {
                    r.Quantity += r.Quantity / 2;
                }
            }
        }
Esempio n. 22
0
        public static GameObject BuildGameObject(XmlElement element)
        {
            string type = element.GetAttribute("type");

            switch (type)
            {
            case "money": return(Money.Build(element));

            case "wood": return(Wood.Build(element));

            case "weapon": return(Weapon.Build(element));

            case "coal": return(Coal.Build(element));

            case "copper": return(Copper.Build(element));

            case "gold": return(Gold.Build(element));

            case "iron": return(Iron.Build(element));

            case "silver": return(Silver.Build(element));

            case "leather": return(Leather.Build(element));

            case "meat": return(Meat.Build(element));

            case "sand": return(Sand.Build(element));

            case "stone": return(Stone.Build(element));

            case "water": return(Water.Build(element));

            case "wheat": return(Wheat.Build(element));

            default: return(null);
            }
        }
        public static void Main(string[] args)
        {
            Policy basic = new Basic();

            Console.WriteLine($"{basic.GetDescription()}, ${basic.GetCost()}");

            Policy plus = new Plus();

            Console.WriteLine($"{plus.GetDescription()}, ${plus.GetCost()}");

            Policy silver = new Silver();

            Console.WriteLine($"{silver.GetDescription()}, ${silver.GetCost()}");

            Policy gold = new Gold();

            Console.WriteLine($"{gold.GetDescription()}, ${gold.GetCost()}");

            Policy policy1 = new Gold();

            policy1 = new AutomaticCar(policy1);
            policy1 = new BigEngine(policy1);
            policy1 = new RedColor(policy1);
            policy1 = new YoungDriver(policy1);
            Console.WriteLine($"{policy1.GetDescription()}, ${policy1.GetCost()}");

            Policy policy2 = new Plus();

            policy2 = new AdditionalDriver(policy2);
            policy2 = new AdditionalDriver(policy2); //second additional driver
            policy2 = new RedColor(policy2);
            policy2 = new ManualCar(policy2);
            Console.WriteLine($"{policy2.GetDescription()}, ${policy2.GetCost()}");

            Console.ReadLine();
        }
Esempio n. 24
0
        public void SaveMoney()
        {
            try
            {
                using (SqlConnection con = new SqlConnection(Properties.Settings.Default.DBConnection))
                {
                    string sql = "INSERT INTO tblMoney(Platinum, Gold, Electrum, Silver, Copper) ";
                    sql += "VALUES (" + Platinum.ToString() + ", " + Gold.ToString() + ", " + Electrum.ToString() + ", " + Silver.ToString() + ", " + Copper.ToString() + ")";

                    SqlCommand cmd = new SqlCommand(sql, con);
                    con.Close();
                    cmd.Connection.Open();
                    cmd.ExecuteNonQuery();
                    con.Close();
                }
            }
            catch
            {
            }
        }
Esempio n. 25
0
        public void GenerateEnvrionemnt()
        {
            int    col       = 0;
            int    row       = 0;
            int    maxnoitem = ConfigManager.MaxEnemyPerRoom;
            Random random    = ConfigManager.RandomGen;

            int          numofIem;
            string       key        = null;
            Monster      monsterobj = null;
            Globin       globinobj  = null;
            Gold         goldobj    = null;
            Silver       silverobj  = null;
            HealthPotion healthpobj = null;

            //Generate Gold In Room
            //maxnoitem = random.Next(1, ConfigManager.MaxGoldItemPerRoom);
            maxnoitem = ConfigManager.MaxGoldItemPerRoom;
            for (numofIem = 0; numofIem < maxnoitem; numofIem++)
            {
                while (true)
                {
                    col = random.Next(((RoomMap.RoomWidth - RoomMap.RoomEffectiveWidth) / 2) + 1,
                                      ((RoomMap.RoomWidth - RoomMap.RoomEffectiveWidth) / 2) + RoomMap.RoomEffectiveWidth - 1);

                    row = random.Next(0, RoomMap.RoomHeight - 1);

                    if (Room_Map.IsEmpty(col, row))
                    {
                        key = col + "-" + row;
                        if (!ItemsHashTable.ContainsKey(key))
                        {
                            goldobj = new Gold("Gold Bar", col + PlayUIWorldMap.mapBoxColPos, row + PlayUIWorldMap.mapBoxRowPos, key);
                            ItemsHashTable.Add(key, goldobj);
                            TotalGoldItem++;
                            TotalItem++;
                            break;
                        }
                    }
                }
            }

            //Generate Silver In Room
            //maxnoitem = random.Next(1, ConfigManager.MaxSilverItemPerRoom);
            maxnoitem = ConfigManager.MaxSilverItemPerRoom;
            for (numofIem = 0; numofIem < maxnoitem; numofIem++)
            {
                while (true)
                {
                    col = random.Next(((RoomMap.RoomWidth - RoomMap.RoomEffectiveWidth) / 2) + 1,
                                      ((RoomMap.RoomWidth - RoomMap.RoomEffectiveWidth) / 2) + RoomMap.RoomEffectiveWidth - 1);

                    row = random.Next(0, RoomMap.RoomHeight - 1);

                    if (Room_Map.IsEmpty(col, row))
                    {
                        key = col + "-" + row;
                        if (!ItemsHashTable.ContainsKey(key))
                        {
                            silverobj = new Silver("Silver Coin", col + PlayUIWorldMap.mapBoxColPos, row + PlayUIWorldMap.mapBoxRowPos, key);
                            ItemsHashTable.Add(key, silverobj);
                            TotalSilverItem++;
                            TotalItem++;
                            break;
                        }
                    }
                }
            }


            //Generate Health Potion In Room
            //maxnoitem = random.Next(1, ConfigManager.MaxHealthPotionPerRoom);
            maxnoitem = ConfigManager.MaxHealthPotionPerRoom;
            for (numofIem = 0; numofIem < maxnoitem; numofIem++)
            {
                while (true)
                {
                    col = random.Next(((RoomMap.RoomWidth - RoomMap.RoomEffectiveWidth) / 2) + 1,
                                      ((RoomMap.RoomWidth - RoomMap.RoomEffectiveWidth) / 2) + RoomMap.RoomEffectiveWidth - 1);

                    row = random.Next(0, RoomMap.RoomHeight - 1);

                    if (Room_Map.IsEmpty(col, row))
                    {
                        key = col + "-" + row;
                        if (!ItemsHashTable.ContainsKey(key))
                        {
                            healthpobj = new HealthPotion("Health Potion",
                                                          col + PlayUIWorldMap.mapBoxColPos, row + PlayUIWorldMap.mapBoxRowPos, key);
                            ItemsHashTable.Add(key, healthpobj);
                            TotalHealthPotionItem++;
                            TotalItem++;
                            break;
                        }
                    }
                }
            }

            //Enemies are not item.
            //Generate different Enimies type
            //maxnoitem = random.Next(1, ConfigManager.MaxMonsterPerRoom);
            maxnoitem = ConfigManager.MaxMonsterPerRoom;
            //Monster first
            for (numofIem = 0; numofIem < maxnoitem; numofIem++)
            {
                /*
                 * col = random.Next(
                 *  ((RoomMap.RoomWidth - RoomMap.RoomEffectiveWidth) / 2) + 1,
                 *  ((RoomMap.RoomWidth - RoomMap.RoomEffectiveWidth) / 2) + RoomMap.RoomEffectiveWidth - 1);
                 *
                 * row = random.Next(0, RoomMap.RoomHeight - 1);
                 */
                while (true)
                {
                    col = random.Next(((RoomMap.RoomWidth - RoomMap.RoomEffectiveWidth) / 2) + 1,
                                      ((RoomMap.RoomWidth - RoomMap.RoomEffectiveWidth) / 2) + RoomMap.RoomEffectiveWidth - 1);

                    row = random.Next(0, RoomMap.RoomHeight - 1);

                    if (Room_Map.IsEmpty(col, row))
                    {
                        //key = (col + PlayUIWorldMap.mapBoxColPos)+ "-" + (row + PlayUIWorldMap.mapBoxRowPos);
                        key = col + "-" + row;

                        if (!ItemsHashTable.ContainsKey(key))
                        {
                            monsterobj = new Monster(col + PlayUIWorldMap.mapBoxColPos, row + PlayUIWorldMap.mapBoxRowPos, key, Room_Map);
                            //ItemsHashTable.Add(key, monsterobj);
                            MonsterList.Add(monsterobj);

                            break;
                        }
                    }
                }
            }

            //maxnoitem = random.Next(1, ConfigManager.MaxGlobinPerRoom);
            maxnoitem = ConfigManager.MaxGlobinPerRoom;
            // Globin
            for (numofIem = 0; numofIem < maxnoitem; numofIem++)
            {
                /*
                 * col = random.Next(
                 *  ((RoomMap.RoomWidth - RoomMap.RoomEffectiveWidth) / 2) + 1,
                 *  ((RoomMap.RoomWidth - RoomMap.RoomEffectiveWidth) / 2) + RoomMap.RoomEffectiveWidth - 1);
                 *
                 * row = random.Next(0, RoomMap.RoomHeight - 1);
                 */
                while (true)
                {
                    col = random.Next(((RoomMap.RoomWidth - RoomMap.RoomEffectiveWidth) / 2) + 1,
                                      ((RoomMap.RoomWidth - RoomMap.RoomEffectiveWidth) / 2) + RoomMap.RoomEffectiveWidth - 1);

                    row = random.Next(0, RoomMap.RoomHeight - 1);

                    if (Room_Map.IsEmpty(col, row))
                    {
                        //key = (col + PlayUIWorldMap.mapBoxColPos)+ "-" + (row + PlayUIWorldMap.mapBoxRowPos);
                        key = col + "-" + row;

                        if (!ItemsHashTable.ContainsKey(key))
                        {
                            globinobj = new Globin(col + PlayUIWorldMap.mapBoxColPos, row + PlayUIWorldMap.mapBoxRowPos, key, Room_Map);
                            //ItemsHashTable.Add(key, globinobj);
                            GlobinList.Add(globinobj);
                            break;
                        }
                    }
                }
            }
        }
Esempio n. 26
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

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

            if (m_Vendor.IsOwner(from))
            {
                m_Vendor.SayTo(from, 503212);                   // You own this shop, just take what you want.
                return;
            }

            if (info.ButtonID == 1)
            {
                if (!m_VI.Valid)
                {
                    m_Vendor.SayTo(from, 503216);                       // You can't buy that.
                    return;
                }

                int totalGold = 0;

                if (from.Backpack != null)
                {
                    totalGold += from.Backpack.GetAmount(typeof(Gold));
                }

                if (from.BankBox != null)
                {
                    totalGold += from.BankBox.GetAmount(typeof(Gold));
                }

                if (totalGold < m_VI.Price)
                {
                    m_Vendor.SayTo(from, 503205);                       // You cannot afford this item.
                }
                else if (!from.PlaceInBackpack(m_VI.Item))
                {
                    m_Vendor.SayTo(from, 503204);                       // You do not have room in your backpack for this.
                }
                else
                {
                    int leftPrice = m_VI.Price;

                    if (from.Backpack != null)
                    {
                        Container cont = from.Backpack;

                        int    silvtotal = 0;
                        Item[] silvers   = cont.FindItemsByType(typeof(Silver), true);
                        foreach (Silver silver in silvers)
                        {
                            silvtotal += silver.Amount;
                            silver.Delete();
                        }

                        Gold money = new Gold();
                        cont.AddItem(money);
                        money.Amount = silvtotal / 10;
                        if (silvtotal - money.Amount > 0)
                        {
                            Silver change = new Silver();
                            cont.AddItem(change);
                            change.Amount = silvtotal - (money.Amount * 10);
                        }

                        leftPrice -= from.Backpack.ConsumeUpTo(typeof(Gold), leftPrice);
                    }

                    if (leftPrice > 0 && from.BankBox != null)
                    {
                        from.BankBox.ConsumeUpTo(typeof(Gold), leftPrice);
                    }

                    m_Vendor.HoldGold += m_VI.Price;

                    from.SendLocalizedMessage(503201);                       // You take the item.
                }
            }
            else
            {
                from.SendLocalizedMessage(503207);                   // Cancelled purchase.
            }
        }
Esempio n. 27
0
 private void UpdateAmount()
 {
     StringsToCurrency(Gold.ToString(), Silver.ToString(), Copper.ToString());
 }
        private void handleEnterAmount(Player player, Packet packet)
        {
            if (player.getTemporaryAttribute("interfaceVariable") == null)
            {
                player.getPackets().sendMessage("An error occured, please try again.");
                return;
            }
            EnterVariable var       = (EnterVariable)player.getTemporaryAttribute("interfaceVariable");
            int           craftType = (int)(player.getTemporaryAttribute("craftType") == null ? -1 : (int)player.getTemporaryAttribute("craftType")); // 'Category' of item to craft
            int           amount    = packet.readInt();

            switch (var.getInterfaceId())
            {
            case 675:                 // Jewellery crafting
                Jewellery.makeJewellery(player, var.getSlot(), amount, true);
                break;

            case 304:                                                                                                                                   // Dragonhide crafting.
                int leatherType = (int)(player.getTemporaryAttribute("leatherCraft") == null ? -1 : (int)player.getTemporaryAttribute("leatherCraft")); // Type of leather to craft.
                switch (var.getSlot())
                {
                case 0:
                    if (leatherType != -1)
                    {
                        Leather.craftDragonHide(player, 1, 0, leatherType, true);                                     // Body
                        break;
                    }
                    else if (craftType == 6)                                     // Ball of wool
                    {
                        Spinning.craftSpinning(player, amount, 0, true);
                        break;
                    }
                    break;

                case 1:
                    if (craftType == 6)                                   // Bowstring
                    {
                        Spinning.craftSpinning(player, amount, 1, true);
                        break;
                    }
                    break;

                case 2:
                    if (craftType == 6)                                    // Crossbow string
                    {
                        Spinning.craftSpinning(player, amount, 2, true);
                        break;
                    }
                    break;

                case 4:
                    Leather.craftDragonHide(player, 1, 4, leatherType, true);                                 // Vambraces
                    break;

                case 8:
                    Leather.craftDragonHide(player, 1, 8, leatherType, true);                                 // Chaps
                    break;
                }
                break;

            case 303:
                switch (var.getSlot())
                {
                case 120:                             // Unholy symbol
                    Silver.newSilverItem(player, amount, var.getSlot(), true);
                    break;

                case 121:                             // Tiara
                    Silver.newSilverItem(player, amount, var.getSlot(), true);
                    break;
                }
                break;

            case 154:                 // Craft normal leather.
                if (var.getSlot() >= 28 && var.getSlot() <= 34)
                {
                    Leather.craftNormalLeather(player, var.getSlot(), amount, true);
                    break;
                }
                break;

            case 542:                 // Glassblowing.
                switch (var.getSlot())
                {
                case 40:                             // Make X beer glass.
                    Glass.craftGlass(player, amount, 0, true);
                    break;

                case 41:                             // Make X candle lantern.
                    Glass.craftGlass(player, amount, 1, true);
                    break;

                case 42:                             // Make X oil lamp.
                    Glass.craftGlass(player, amount, 2, true);
                    break;

                case 38:                             // Make X vial.
                    Glass.craftGlass(player, amount, 3, true);
                    break;

                case 44:                             // Make X Fishbowl
                    Glass.craftGlass(player, amount, 4, true);
                    break;

                case 39:                             // Make X orb.
                    Glass.craftGlass(player, amount, 5, true);
                    break;

                case 43:                             // Make X lantern lens
                    Glass.craftGlass(player, amount, 6, true);
                    break;

                case 45:                             // Make X dorgeshuun light orb.
                    Glass.craftGlass(player, amount, 7, true);
                    break;
                }
                break;

            case 763:                 // Bank inventory - X.
                player.getBank().setLastXAmount(amount);
                player.getBank().deposit(var.getSlot(), amount);
                player.getBank().refreshBank();
                break;

            case 762:                 // Bank - X.
                player.getBank().setLastXAmount(amount);
                player.getBank().withdraw(var.getSlot(), amount);
                player.getBank().refreshBank();
                break;

            case 336:                 // Trade/stake inventory - trade X.
                if (player.getTrade() != null)
                {
                    player.getTrade().tradeItem(var.getSlot(), amount);
                    break;
                }
                if (player.getDuel() != null)
                {
                    player.getDuel().stakeItem(var.getSlot(), amount);
                    break;
                }
                break;

            case 631:
                if (player.getDuel() != null)
                {
                    player.getDuel().removeItem(var.getSlot(), amount);
                    break;
                }
                break;

            case 335:                 // Trade/stake interface - remove X.
                player.getTrade().removeItem(var.getSlot(), amount);
                break;

            case 620:                 // Shop - buy X.
                player.getShopSession().buyItem(var.getSlot(), amount);
                break;

            case 105:     //Grand Exchange custom quantity and price inputs.
                switch (var.getSlot())
                {
                case 0:         //custom enter quantity
                    player.getGESession().setCustomAmount(amount);
                    break;

                case 1:         //custom enter per price
                    player.getGESession().setCustomPrice(amount);
                    break;
                }
                break;

            case 305:                 // What would you like to make? - 4 options
                if (player.getTemporaryAttribute("fletchType") == null)
                {
                    return;
                }
                int logType = (int)player.getTemporaryAttribute("fletchType");
                switch (var.getSlot())
                {
                case 0:
                    MakeBows.cutLog(player, amount, logType, 0, (player.getTemporaryAttribute("stringingBow") == null ? false : (bool)player.getTemporaryAttribute("stringingBow")), true);
                    break;

                case 1:
                    MakeBows.cutLog(player, amount, logType, 1, (player.getTemporaryAttribute("stringingBow") == null ? false : (bool)player.getTemporaryAttribute("stringingBow")), true);
                    break;

                case 2:
                    MakeBows.cutLog(player, amount, 0, 2, false, true);
                    break;

                case 3:
                    MakeBows.cutLog(player, amount, 0, 3, false, true);
                    break;
                }
                break;

            case 306:                 // What would you like to make? - 5 options
                switch (var.getSlot())
                {
                case 0:
                    Clay.craftClay(player, amount, craftType, var.getSlot(), true);
                    break;

                case 1:
                    Clay.craftClay(player, amount, craftType, var.getSlot(), true);
                    break;

                case 2:
                    Clay.craftClay(player, amount, craftType, var.getSlot(), true);
                    break;

                case 3:
                    Clay.craftClay(player, amount, craftType, var.getSlot(), true);
                    break;

                case 4:
                    Clay.craftClay(player, amount, craftType, var.getSlot(), true);
                    break;
                }
                break;

            case 309:                                           // What would you like to make - 1 option
                if (var.getSlot() >= 50 && var.getSlot() <= 60) // Cut gem
                {
                    Jewellery.cutGem(player, craftType, amount, true);
                    break;
                }
                else if (var.getSlot() >= 100 && var.getSlot() <= 110)                         // String amulet
                {
                    Jewellery.stringAmulet(player, craftType, amount, true);
                    break;
                }
                switch (var.getSlot())
                {
                case 0:
                    MakeXbow.createXbow(player, amount, (int)(player.getTemporaryAttribute("bowType2") == null ? -1 : (int)player.getTemporaryAttribute("bowType2")), (bool)(player.getTemporaryAttribute("stringingBow") == null ? false :(bool)player.getTemporaryAttribute("stringingBow")), true);
                    break;

                case 1:
                    MakeBows.cutLog(player, amount, (int)(player.getTemporaryAttribute("fletchType") == null ? -1 : (int)player.getTemporaryAttribute("fletchType")), (int)(player.getTemporaryAttribute("bowType") == null ? -1 : (int)player.getTemporaryAttribute("bowType")), true, true);
                    break;

                case 2:
                    Herblore.grindIngredient(player, amount, true);
                    break;

                case 3:
                    Herblore.makeUnfinishedPotion(player, amount, true);
                    break;

                case 4:
                    Herblore.completePotion(player, amount, true);
                    break;

                case 5:
                    Cooking.cookItem(player, amount, true, player.getTemporaryAttribute("cookingFireLocation") != null);
                    break;

                case 6:
                    MakeAmmo.makeBoltTip(player, (int)(player.getTemporaryAttribute("boltTips") == null ? -1 : (int)player.getTemporaryAttribute("boltTips")), amount, true);
                    break;
                }
                break;

            case 311:                 // Smelting interface
                switch (var.getSlot())
                {
                case 13:                             // Bronze
                    Smelting.smeltOre(player, var.getSlot(), true, amount);
                    break;

                case 17:                             // Blurite
                    Smelting.smeltOre(player, var.getSlot(), true, amount);
                    break;

                case 21:                             // Iron
                    Smelting.smeltOre(player, var.getSlot(), true, amount);
                    break;

                case 25:                             // Silver
                    Smelting.smeltOre(player, var.getSlot(), true, amount);
                    break;

                case 29:                             // Steel
                    Smelting.smeltOre(player, var.getSlot(), true, amount);
                    break;

                case 33:                             // Gold
                    Smelting.smeltOre(player, var.getSlot(), true, amount);
                    break;

                case 37:                             // Mithril
                    Smelting.smeltOre(player, var.getSlot(), true, amount);
                    break;

                case 41:                             // Adamant
                    Smelting.smeltOre(player, var.getSlot(), true, amount);
                    break;

                case 45:                             // Rune
                    Smelting.smeltOre(player, var.getSlot(), true, amount);
                    break;
                }
                break;

            case 300:                 // Smithing interface.
                if (player.getTemporaryAttribute("smithingItem") == null)
                {
                    return;
                }
                SmithBar item = (SmithBar)player.getTemporaryAttribute("smithingItem");
                if (item != null)
                {
                    item.setAmount(amount);
                }
                Smithing.smithItem(player, var.getSlot(), amount, false);
                break;
            }
            player.removeTemporaryAttribute("interfaceVariable");
        }
Esempio n. 29
0
        public void Have_P_AsShortName()
        {
            var silver = new Silver(PlayerType.Black, "7i");

            Assert.Equal('S', silver.ShortName);
        }
Esempio n. 30
0
        public void TestPrintElectronShellCfg_All()
        {
            IElement testSubject;;

            testSubject = new Hydrogen();
            Console.WriteLine($"Hydrogen {testSubject.PrintElectronShellCfg()}");
            testSubject = new Helium();
            Console.WriteLine($"Helium {testSubject.PrintElectronShellCfg()}");
            testSubject = new Lithium();
            Console.WriteLine($"Lithium {testSubject.PrintElectronShellCfg()}");
            testSubject = new Beryllium();
            Console.WriteLine($"Beryllium {testSubject.PrintElectronShellCfg()}");
            testSubject = new Boron();
            Console.WriteLine($"Boron {testSubject.PrintElectronShellCfg()}");
            testSubject = new Carbon();
            Console.WriteLine($"Carbon {testSubject.PrintElectronShellCfg()}");
            testSubject = new Nitrogen();
            Console.WriteLine($"Nitrogen {testSubject.PrintElectronShellCfg()}");
            testSubject = new Oxygen();
            Console.WriteLine($"Oxygen {testSubject.PrintElectronShellCfg()}");
            testSubject = new Fluorine();
            Console.WriteLine($"Fluorine {testSubject.PrintElectronShellCfg()}");
            testSubject = new Neon();
            Console.WriteLine($"Neon {testSubject.PrintElectronShellCfg()}");
            testSubject = new Sodium();
            Console.WriteLine($"Sodium {testSubject.PrintElectronShellCfg()}");
            testSubject = new Magnesium();
            Console.WriteLine($"Magnesium {testSubject.PrintElectronShellCfg()}");
            testSubject = new Aluminum();
            Console.WriteLine($"Aluminum {testSubject.PrintElectronShellCfg()}");
            testSubject = new Silicon();
            Console.WriteLine($"Silicon {testSubject.PrintElectronShellCfg()}");
            testSubject = new Phosphorus();
            Console.WriteLine($"Phosphorus {testSubject.PrintElectronShellCfg()}");
            testSubject = new Sulfur();
            Console.WriteLine($"Sulfur {testSubject.PrintElectronShellCfg()}");
            testSubject = new Chlorine();
            Console.WriteLine($"Chlorine {testSubject.PrintElectronShellCfg()}");
            testSubject = new Argon();
            Console.WriteLine($"Argon {testSubject.PrintElectronShellCfg()}");
            testSubject = new Potassium();
            Console.WriteLine($"Potassium {testSubject.PrintElectronShellCfg()}");
            testSubject = new Calcium();
            Console.WriteLine($"Calcium {testSubject.PrintElectronShellCfg()}");
            testSubject = new Scandium();
            Console.WriteLine($"Scandium {testSubject.PrintElectronShellCfg()}");
            testSubject = new Titanium();
            Console.WriteLine($"Titanium {testSubject.PrintElectronShellCfg()}");
            testSubject = new Vanadium();
            Console.WriteLine($"Vanadium {testSubject.PrintElectronShellCfg()}");
            testSubject = new Chromium();
            Console.WriteLine($"Chromium {testSubject.PrintElectronShellCfg()}");
            testSubject = new Manganese();
            Console.WriteLine($"Manganese {testSubject.PrintElectronShellCfg()}");
            testSubject = new Iron();
            Console.WriteLine($"Iron {testSubject.PrintElectronShellCfg()}");
            testSubject = new Cobalt();
            Console.WriteLine($"Cobalt {testSubject.PrintElectronShellCfg()}");
            testSubject = new Nickel();
            Console.WriteLine($"Nickel {testSubject.PrintElectronShellCfg()}");
            testSubject = new Copper();
            Console.WriteLine($"Copper {testSubject.PrintElectronShellCfg()}");
            testSubject = new Zinc();
            Console.WriteLine($"Zinc {testSubject.PrintElectronShellCfg()}");
            testSubject = new Gallium();
            Console.WriteLine($"Gallium {testSubject.PrintElectronShellCfg()}");
            testSubject = new Germanium();
            Console.WriteLine($"Germanium {testSubject.PrintElectronShellCfg()}");
            testSubject = new Arsenic();
            Console.WriteLine($"Arsenic {testSubject.PrintElectronShellCfg()}");
            testSubject = new Selenium();
            Console.WriteLine($"Selenium {testSubject.PrintElectronShellCfg()}");
            testSubject = new Bromine();
            Console.WriteLine($"Bromine {testSubject.PrintElectronShellCfg()}");
            testSubject = new Krypton();
            Console.WriteLine($"Krypton {testSubject.PrintElectronShellCfg()}");
            testSubject = new Rubidium();
            Console.WriteLine($"Rubidium {testSubject.PrintElectronShellCfg()}");
            testSubject = new Strontium();
            Console.WriteLine($"Strontium {testSubject.PrintElectronShellCfg()}");
            testSubject = new Yttrium();
            Console.WriteLine($"Yttrium {testSubject.PrintElectronShellCfg()}");
            testSubject = new Zirconium();
            Console.WriteLine($"Zirconium {testSubject.PrintElectronShellCfg()}");
            testSubject = new Niobium();
            Console.WriteLine($"Niobium {testSubject.PrintElectronShellCfg()}");
            testSubject = new Molybdenum();
            Console.WriteLine($"Molybdenum {testSubject.PrintElectronShellCfg()}");
            testSubject = new Technetium();
            Console.WriteLine($"Technetium {testSubject.PrintElectronShellCfg()}");
            testSubject = new Ruthenium();
            Console.WriteLine($"Ruthenium {testSubject.PrintElectronShellCfg()}");
            testSubject = new Rhodium();
            Console.WriteLine($"Rhodium {testSubject.PrintElectronShellCfg()}");
            testSubject = new Palladium();
            Console.WriteLine($"Palladium {testSubject.PrintElectronShellCfg()}");
            testSubject = new Silver();
            Console.WriteLine($"Silver {testSubject.PrintElectronShellCfg()}");
            testSubject = new Cadmium();
            Console.WriteLine($"Cadmium {testSubject.PrintElectronShellCfg()}");
            testSubject = new Indium();
            Console.WriteLine($"Indium {testSubject.PrintElectronShellCfg()}");
            testSubject = new Tin();
            Console.WriteLine($"Tin {testSubject.PrintElectronShellCfg()}");
            testSubject = new Antimony();
            Console.WriteLine($"Antimony {testSubject.PrintElectronShellCfg()}");
            testSubject = new Tellurium();
            Console.WriteLine($"Tellurium {testSubject.PrintElectronShellCfg()}");
            testSubject = new Iodine();
            Console.WriteLine($"Iodine {testSubject.PrintElectronShellCfg()}");
            testSubject = new Xenon();
            Console.WriteLine($"Xenon {testSubject.PrintElectronShellCfg()}");
            testSubject = new Cesium();
            Console.WriteLine($"Cesium {testSubject.PrintElectronShellCfg()}");
            testSubject = new Barium();
            Console.WriteLine($"Barium {testSubject.PrintElectronShellCfg()}");
        }
Esempio n. 31
0
        protected virtual void DrawPolygonBody(Body body, Silver.Weight.Raw.Shapes.Polygon polygon)
        {
            System.Windows.Shapes.Polygon poly = body.UserData as System.Windows.Shapes.Polygon;
            ROVector2f[] points = polygon.GetVertices(body.GetPosition(), body.Rotation);
            if (poly == null)
            {
                poly = new System.Windows.Shapes.Polygon();

                poly.StrokeThickness = 2;
                poly.Stroke = new SolidColorBrush(Colors.Yellow);

                PointCollection pts = new PointCollection();

                for (int i = 0; i < points.Length; i++)
                {

                    pts[i] = new Point((double)points[i].X, (double)points[i].Y);

                }
                poly.Points = pts;
                canvas.Children.Add(poly);
                body.UserData = poly;
            }
            else
            {
                PointCollection pts = new PointCollection();
                for (int i = 0; i < points.Length; i++)
                {
                    pts[i] = new Point((double)points[i].X, (double)points[i].Y);
                }
                poly.Points = pts;
            }
        }
Esempio n. 32
0
		public int AwardSilver(Mobile mob, int silver)
		{
			if (silver <= 0 || mob is BaseVendor)
			{
				return 0;
			}

			int tithed = (silver * Tithe) / 100;

			Silver += tithed;

			silver = silver - tithed;

			if (silver > 0)
			{
				var s = new Silver(silver);

				mob.AddToBackpack(s);

				if (mob is PlayerMobile)
				{
					Conquests.CheckProgress<ItemConquest>((PlayerMobile)mob, s);
				}
			}

			return silver;
		}
Esempio n. 33
0
 private void DrawLineBody(Body body, Silver.Weight.Raw.Shapes.Line line)
 {
     System.Windows.Shapes.Line line1 = MakeLine(new Vector2f(line.X1, line.X2), new Vector2f(line.X2,line.Y2), 1, Colors.White);
     canvas.Children.Add(line1);
 }
Esempio n. 34
0
        public override void OnSpeech( SpeechEventArgs e )
        {
            if( !e.Handled && e.Mobile.InRange(this.Location, 12) )
            {
                for( int i = 0; i < e.Keywords.Length; ++i )
                {
                    int keyword = e.Keywords[i];

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

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

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

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

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

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

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

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

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

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

                                BankBox box = e.Mobile.FindBankNoCreate();

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

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

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

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

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

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

                                e.Mobile.BankBox.Open();

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

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

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

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

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

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

                                //        BankBox box = e.Mobile.BankBox;

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

                                break;
                            }
                    }
                }

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

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

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

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

                                coin.Delete();
                            });

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

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

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

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

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

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

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

            base.OnSpeech(e);
        }
Esempio n. 35
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;
        }
Esempio n. 36
0
 internal override void ShowCard(string s,int x,int y)
 {
     PlayCard a = new PlayCard();
     switch (s)
     {
         case "銅貨":
             a = new Cooper(ShowField, ShowHand, this);
             break;
         case "銀貨":
             a = new Silver(ShowField, ShowHand, this);
             break;
         case "金貨":
             a = new Gold(ShowField, ShowHand, this);
             break;
         case "屋敷":
             a = new Mansion(ShowField, ShowHand, this);
             break;
         case "公領":
             a = new Landtag(ShowField, ShowHand, this);
             break;
         case "属州":
             a = new Province(ShowField, ShowHand, this);
             break;
         case "地下貯蔵庫":
             a = new UndergroundRepository(ShowField, ShowHand, this);
             break;
         case "市場":
             a = new Market(this);
             break;
         case "民兵":
             a = new Militia(ShowField, ShowHand, this);
             break;
         case "鉱山":
             a = new Mine(ShowField, ShowHand, this);
             break;
         case "堀":
             a = new Moat(this);
             break;
         case "鍛冶屋":
             a = new Smithy(this);
             break;
         case "村":
             a = new Village(this);
             break;
         case "木こり":
             a = new Woodcutter(this);
             break;
         case "改築":
             a = new Remodel(this);
             break;
         case "工房":
             a = new Workshop(this);
             break;
     }
     a.Location = new System.Drawing.Point(x,y);
     a.Size = new System.Drawing.Size(70, 110);
     a.Name = s;
     a.SizeMode = PictureBoxSizeMode.StretchImage;
     a.Image = global::dominion.Properties.Resources.back;
     form1.Controls.Add(a);
     a.BringToFront();
     ShowHand.Add(a);
     a.ChangePointPara(880 + 20 * ShowHand.Count, 10 + 120 * num);
     for (int i = 0; i < ShowHand.Count; i++)
     {
         ShowHand[i].Refresh();
     }
     ShowDeck.Refresh();
 }
        protected override void OnTarget(Mobile from, object targeted)
        {
            if( targeted == null || !(targeted  is Item) )
                return;

            if (_guardPost == null)
            {
                //Guard post stage
                if (!(targeted is KinGuardPost))
                {
                    from.SendMessage("You may only fund guard posts");
                    return;
                }

                //Grab guardpost
                KinGuardPost gp = targeted as KinGuardPost;
                if (gp == null) return;

                //Verify owner
                KinCityData data = KinCityManager.GetCityData(gp.City);
                if( data == null )
                {
                    from.SendMessage("That guard post does not appear to be a valid part of a faction city");
                    return;
                }

                //Owner or city leader can fund
                if (gp.Owner != from && gp.Owner != data.CityLeader )
                {
                    from.SendMessage("That guard post does not belong to you");
                    return;
                }

                from.SendMessage("Select the silver you wish to fund it with");

                //Issue new target
                from.Target = new KinGuardPostFundTarget(gp);
            }
            else
            {
                Silver silver = targeted as Silver;
              //Silver stage
                if (silver == null)
                {
                    from.SendMessage("You may only fund the guard post with silver");
                    return;
                }
                if (!from.Backpack.Items.Contains(targeted))
                {
                    from.SendMessage("The silver must be in your backpack");
                }
                if (from.GetDistanceToSqrt(_guardPost.Location) > 3)
                {
                    from.SendMessage("You are not close enough to the guard post");
                    return;
                }

                //Verify owner
                KinCityData data = KinCityManager.GetCityData(_guardPost.City);
                if (data == null)
                {
                    from.SendMessage("That guard post does not appear to be a valid part of a faction city");
                    return;
                }

                //check again that the guard post exists and they are the owner
                if (_guardPost.Deleted || (_guardPost.Owner != from && _guardPost.Owner != data.CityLeader))
                {
                    from.SendMessage("The guard post no longer or exists or you are no longer the rightful owner");
                    return;
                }

                int amount = silver.Amount;

                if (amount <= 0)
                {
                    //should be impossible
                    from.SendMessage("Your guard post was not successfully funded");
                    return;
                }

                //Fund guardpost
                silver.Delete();
                _guardPost.Silver += amount;
                //if( !_guardPost.Running ) _guardPost.Running = true;
                from.SendMessage("Your guard post was successfully funded with {0} silver",amount);
            }
        }
Esempio n. 38
0
        private void errSilverScan(Silver pld)
        {
            try
            {
                string   Name   = "SILVER";
                BitArray bitArr = new BitArray(BitConverter.GetBytes(pld.errReel));
                //if (bitArr[0])
                //{
                //    if (!pld.SendFlags[0])
                //    {
                //        bot.SendMessageChat(Name + " : " + "Emergency stop from reel unit" + "\n");
                //        pld.SendFlags[0] = true;
                //    }

                //}
                //else
                //{
                //    pld.SendFlags[0] = false;
                //}
                if (bitArr[1])
                {
                    if (!pld.SendFlags[1])
                    {
                        bot.SendMessageChat(Name + " : " + "Emargancy stop" + "\n");
                        pld.SendFlags[1] = true;
                    }
                }
                else
                {
                    pld.SendFlags[1] = false;
                }
                //if (bitArr[2])
                //{
                //    if (!pld.SendFlags[2])
                //    {
                //        bot.SendMessageChat(Name + " : " + "Left reel servo driver warning" + "\n");
                //        pld.SendFlags[2] = true;
                //    }

                //}
                //else
                //{
                //    pld.SendFlags[2] = false;
                //}
                if (bitArr[3])
                {
                    if (!pld.SendFlags[3])
                    {
                        bot.SendMessageChat(Name + " : " + "Servo driver left fault" + "\n");
                        pld.SendFlags[3] = true;
                    }
                }
                else
                {
                    pld.SendFlags[3] = false;
                }

                if (bitArr[4])
                {
                    if (!pld.SendFlags[4])
                    {
                        bot.SendMessageChat(Name + " : " + "Servo driver rigth fault" + "\n");
                        pld.SendFlags[4] = true;
                    }
                }
                else
                {
                    pld.SendFlags[4] = false;
                }

                if (bitArr[5])
                {
                    if (!pld.SendFlags[5])
                    {
                        bot.SendMessageChat(Name + " : " + "Left tension unit over load" + "\n");
                        pld.SendFlags[5] = true;
                    }
                }
                else
                {
                    pld.SendFlags[5] = false;
                }

                if (bitArr[6])
                {
                    if (!pld.SendFlags[6])
                    {
                        bot.SendMessageChat(Name + " : " + "Right tension unit over load" + "\n");
                        pld.SendFlags[6] = true;
                    }
                }
                else
                {
                    pld.SendFlags[6] = false;
                }
                //if (bitArr[7])
                //{
                //    if (!pld.SendFlags[7])
                //    {
                //        bot.SendMessageChat(Name + " : " + "Target NC unit error" + "\n");
                //        pld.SendFlags[7] = true;
                //    }
                //}
                //else
                //{
                //    pld.SendFlags[7] = false;
                //}
                //if (bitArr[8])
                //{
                //    if (!pld.SendFlags[8])
                //    {
                //        bot.SendMessageChat(Name + " : " + "Rotation window NC unit error" + "\n");
                //        pld.SendFlags[8] = true;
                //    }
                //}
                //else
                //{
                //    pld.SendFlags[8] = false;
                //}
                //if (bitArr[9])
                //{
                //    if (!pld.SendFlags[9])
                //    {
                //        bot.SendMessageChat(Name + " : " + "Laser NC unit error" + "\n");
                //        pld.SendFlags[9] = true;
                //    }
                //}
                //else
                //{
                //    pld.SendFlags[9] = false;
                //}

                if (bitArr[10])
                {
                    if (!pld.SendFlags[10])
                    {
                        bot.SendMessageChat(Name + " : " + "Tape was cut" + "\n");
                        pld.SendFlags[10] = true;
                    }
                }
                else
                {
                    pld.SendFlags[10] = false;
                }

                //if (bitArr[11])
                //{
                //    if (!pld.SendFlags[11])
                //    {
                //        bot.SendMessageChat(Name + " : " + "Scan unit disconnected" + "\n");
                //        pld.SendFlags[11] = true;
                //    }
                //}
                //else
                //{
                //    pld.SendFlags[11] = false;
                //}

                if (bitArr[12])
                {
                    if (!pld.SendFlags[12])
                    {
                        bot.SendMessageChat(Name + " : " + "Vacuum system disconnected" + "\n");
                        pld.SendFlags[12] = true;
                    }
                }
                else
                {
                    pld.SendFlags[12] = false;
                }

                //if (bitArr[13])
                //{
                //    if (!pld.SendFlags[13])
                //    {
                //        bot.SendMessageChat(Name + " : " + "PLD2 system disconnected" + "\n");
                //        pld.SendFlags[13] = true;
                //    }
                //}
                //else
                //{
                //    pld.SendFlags[13] = false;
                //}

                //if (bitArr[14])
                //{
                //    if (!pld.SendFlags[14])
                //    {
                //        bot.SendMessageChat(Name + " : " + "PLD1 system disconnected" + "\n");
                //        pld.SendFlags[14] = true;
                //    }
                //}
                //else
                //{
                //    pld.SendFlags[14] = false;
                //}

                var bitArr2 = new BitArray(BitConverter.GetBytes(pld.errVacuum));



                if (bitArr2[0])
                {
                    if (!pld.SendFlags[15])
                    {
                        bot.SendMessageChat(Name + " : " + "Air pressure to low" + "\n");
                        pld.SendFlags[15] = true;
                    }
                }
                else
                {
                    pld.SendFlags[15] = false;
                }

                if (bitArr2[1])
                {
                    if (!pld.SendFlags[16])
                    {
                        bot.SendMessageChat(Name + " : " + "Trip a therminal for RP1" + "\n");
                        pld.SendFlags[16] = true;
                    }
                }
                else
                {
                    pld.SendFlags[16] = false;
                }

                if (bitArr2[2])
                {
                    if (!pld.SendFlags[17])
                    {
                        bot.SendMessageChat(Name + " : " + "TMP error" + "\n");
                        pld.SendFlags[17] = true;
                    }
                }
                else
                {
                    pld.SendFlags[17] = false;
                }

                if (bitArr2[3])
                {
                    if (!pld.SendFlags[18])
                    {
                        bot.SendMessageChat(Name + " : " + "Rough vacuum time out" + "\n");
                        pld.SendFlags[18] = true;
                    }
                }
                else
                {
                    pld.SendFlags[18] = false;
                }

                if (bitArr2[4])
                {
                    if (!pld.SendFlags[19])
                    {
                        bot.SendMessageChat(Name + " : " + "Vacuum system error" + "\n");
                        pld.SendFlags[19] = true;
                    }
                }
                else
                {
                    pld.SendFlags[19] = false;
                }
                if (bitArr2[5])
                {
                    if (!pld.SendFlags[20])
                    {
                        bot.SendMessageChat(Name + " : " + "Chamber pressure too higth" + "\n");
                        pld.SendFlags[20] = true;
                    }
                }
                else
                {
                    pld.SendFlags[20] = false;
                }

                if (bitArr2[6])
                {
                    if (!pld.SendFlags[21])
                    {
                        bot.SendMessageChat(Name + " : " + "APC motion error" + "\n");
                        pld.SendFlags[21] = true;
                    }
                }
                else
                {
                    pld.SendFlags[21] = false;
                }
                if (bitArr2[7])
                {
                    if (!pld.SendFlags[22])
                    {
                        bot.SendMessageChat(Name + " : " + "Target NC unit error" + "\n");
                        pld.SendFlags[22] = true;
                    }
                }
                else
                {
                    pld.SendFlags[22] = false;
                }
                if (bitArr2[8])
                {
                    if (!pld.SendFlags[23])
                    {
                        bot.SendMessageChat(Name + " : " + "Rotation window NC unit error" + "\n");
                        pld.SendFlags[23] = true;
                    }
                }
                else
                {
                    pld.SendFlags[23] = false;
                }
                if (bitArr2[9])
                {
                    if (!pld.SendFlags[24])
                    {
                        bot.SendMessageChat(Name + " : " + "Heater  coolant stopted" + "\n");
                        pld.SendFlags[24] = true;
                    }
                }
                else
                {
                    pld.SendFlags[24] = false;
                }
                if (bitArr2[10])
                {
                    if (!pld.SendFlags[25])
                    {
                        bot.SendMessageChat(Name + " : " + "Tape was cut" + "\n");
                        pld.SendFlags[25] = true;
                    }
                }
                else
                {
                    pld.SendFlags[25] = false;
                }

                if (bitArr2[11])
                {
                    if (!pld.SendFlags[26])
                    {
                        bot.SendMessageChat(Name + " : " + "Heater power supply error" + "\n");
                        pld.SendFlags[26] = true;
                    }
                }
                else
                {
                    pld.SendFlags[26] = false;
                }

                if (bitArr2[12])
                {
                    if (!pld.SendFlags[27])
                    {
                        bot.SendMessageChat(Name + " : " + "Temp controller error" + "\n");
                        pld.SendFlags[27] = true;
                    }
                }
                else
                {
                    pld.SendFlags[27] = false;
                }

                if (bitArr2[13])
                {
                    if (!pld.SendFlags[28])
                    {
                        bot.SendMessageChat(Name + " : " + "Heater burnout" + "\n");
                        pld.SendFlags[28] = true;
                    }
                }
                else
                {
                    pld.SendFlags[28] = false;
                }

                if (bitArr2[14])
                {
                    if (!pld.SendFlags[29])
                    {
                        bot.SendMessageChat(Name + " : " + "PLD1 system disconnected" + "\n");
                        pld.SendFlags[29] = true;
                    }
                }
                else
                {
                    pld.SendFlags[29] = false;
                }
                if (bitArr2[15])
                {
                    if (!pld.SendFlags[30])
                    {
                        bot.SendMessageChat(Name + " : " + "Emergency stop from vacuum unit" + "\n");
                        pld.SendFlags[30] = true;
                    }
                }
                else
                {
                    pld.SendFlags[30] = false;
                }
            }
            catch
            {
            }
        }