Exemplo n.º 1
0
        public void AddCard(
            IMagicCardDefinition cardDefinition,
            int quantity,
            MagicGrade grade,
            MagicLanguage language,
            bool isFoil,
            bool updateTotals)
        {
            var binderCard = new MagicBinderCard()
            {
                CardId   = cardDefinition.CardId,
                Grade    = grade,
                Language = language,
                IsFoil   = isFoil,
                Quantity = quantity
            };

            var viewModel = new MagicBinderCardViewModel(cardDefinition, binderCard);

            _sortedCards.Add(binderCard.RowId, viewModel);
            _cards.Add(viewModel);
            _magicCollection.Cards.Add(binderCard);

            viewModel.PriceChanged += Card_PriceChanged;

            if (updateTotals)
            {
                CalculateTotals();
            }
        }
Exemplo n.º 2
0
        public static T LootSet(MagicGrade index)
        {
            T tobj;

            m_LootSets.TryGetValue(index, out tobj);
            return(tobj);
        }
Exemplo n.º 3
0
 private static void Add(MagicGrade index, T obj)
 {
     if (Exists(index))
     {
         Console.WriteLine(String.Format("Loot: Attempted to add {0}.  This index already exists.", index));
     }
     else
     {
         m_LootSets.Add(index, obj);
     }
 }
Exemplo n.º 4
0
 public void Write(
     string fileName,
     IEnumerable <IMagicBinderCardViewModel> cards,
     MagicLanguage language,
     MagicGrade grade)
 {
     Write(
         fileName,
         cards,
         language,
         grade,
         new Func <IMagicBinderCardViewModel, int>((card) => card.Quantity));
 }
Exemplo n.º 5
0
        public void AddCards(
            IEnumerable <FoundMagicCardViewModel> cards,
            MagicGrade grade,
            MagicLanguage language,
            bool isFoil)
        {
            foreach (var card in cards)
            {
                AddCard(
                    card.Definition,
                    card.Quantity,
                    card.Grade.HasValue ? card.Grade.Value : grade,
                    card.Language.HasValue ? card.Language.Value : language,
                    isFoil,
                    false);
            }

            CalculateTotals();
        }
Exemplo n.º 6
0
        public void Write(
            string fileName,
            IEnumerable <IMagicBinderCardViewModel> cards,
            MagicLanguage language,
            MagicGrade grade,
            Func <IMagicBinderCardViewModel, int> quantitySelector)
        {
            var outputCsv = new CsvWriter(File.CreateText(fileName));

            outputCsv.WriteField("Count");
            outputCsv.WriteField("Name");
            outputCsv.WriteField("Edition");
            outputCsv.WriteField("Foil");
            outputCsv.WriteField("Language");
            outputCsv.WriteField("Condition");
            outputCsv.WriteField("Comment");
            outputCsv.NextRecord();

            string             lastSetCode = "";
            MagicSetDefinition definition  = null;

            foreach (var card in cards)
            {
                if (lastSetCode != card.Definition.SetCode)
                {
                    lastSetCode = card.Definition.SetCode;
                    definition  = StaticMagicData.SetDefinitionsBySetCode[lastSetCode];
                }

                outputCsv.WriteField(quantitySelector(card));
                outputCsv.WriteField(PatchCardName(card.NameEN), true);
                outputCsv.WriteField(PatchSetName(definition.Name.Replace("Magic: The Gathering�Conspiracy", "Conspiracy")), true);
                outputCsv.WriteField(card.IsFoil ? "foil" : null);
                outputCsv.WriteField(card.Language.HasValue ? card.Language.Value.ToString() : language.ToString());
                outputCsv.WriteField(card.Grade.HasValue ? card.Grade.Value.ToCsv() : grade.ToCsv());
                outputCsv.WriteField(card.Comment);
                outputCsv.NextRecord();
            }

            outputCsv.Dispose();
        }
Exemplo n.º 7
0
        public static void GetMagicMinMax(MagicGrade grade, out int min, out int max)
        {
            switch (grade)
            {
            default: min = 0; max = 0; break;

            case MagicGrade.NonMagical: min = 0; max = 0; break;

            case MagicGrade.NonetoLowest: min = 0; max = 60; break;

            case MagicGrade.NonetoLower: min = 10; max = 70; break;

            case MagicGrade.NonetoMedium: min = 20; max = 80; break;

            case MagicGrade.NonetoHigh: min = 30; max = 90; break;

            case MagicGrade.NonetoHighest30: min = 30; max = 100; break;

            case MagicGrade.NonetoHighest40: min = 40; max = 100; break;

            case MagicGrade.NonetoHighest45: min = 45; max = 100; break;

            case MagicGrade.NonetoHighest49: min = 49; max = 100; break;

            case MagicGrade.LowesttoHighest: min = 50; max = 100; break;

            case MagicGrade.LowertoHighest60: min = 60; max = 100; break;

            case MagicGrade.LowertoHighest65: min = 65; max = 100; break;

            case MagicGrade.LowtoHighest70: min = 70; max = 100; break;

            case MagicGrade.LowtoHighest74: min = 74; max = 100; break;

            case MagicGrade.MediumtoHighest: min = 75; max = 100; break;

            case MagicGrade.HightoHighest: min = 89; max = 100; break;
            }
        }
Exemplo n.º 8
0
		public static void GetMagicMinMax( MagicGrade grade, out int min, out int max )
		{
			switch ( grade )
			{
				default: min = 0; max = 0; break;
				case MagicGrade.NonMagical: min = 0; max = 0; break;
				case MagicGrade.NonetoLowest: min = 0; max = 60; break;
				case MagicGrade.NonetoLower: min = 10; max = 70; break;
				case MagicGrade.NonetoMedium: min = 20; max = 80; break;
				case MagicGrade.NonetoHigh: min = 30; max = 90; break;
				case MagicGrade.NonetoHighest30: min = 30; max = 100; break;
				case MagicGrade.NonetoHighest40: min = 40; max = 100; break;
				case MagicGrade.NonetoHighest45: min = 45; max = 100; break;
				case MagicGrade.NonetoHighest49: min = 49; max = 100; break;

				case MagicGrade.LowesttoHighest: min = 50; max = 100; break;
				case MagicGrade.LowertoHighest60: min = 60; max = 100; break;
				case MagicGrade.LowertoHighest65: min = 65; max = 100; break;
				case MagicGrade.LowtoHighest70: min = 70; max = 100; break;
				case MagicGrade.LowtoHighest74: min = 74; max = 100; break;
				case MagicGrade.MediumtoHighest: min = 75; max = 100; break;
				case MagicGrade.HightoHighest: min = 89; max = 100; break;
			}
		}
 public SpellbookRegsLootBagSet(int minc, int maxc, bool random, int mina, int maxa, double bookChance, MagicGrade grade) : base(minc, maxc, random, mina, maxa)
 {
     m_SpellbookGrade = grade;
     m_BookChance     = bookChance;
 }
 public SpellbookRegsLootBagSet(int amount, double bookChance, MagicGrade grade) : base(amount, amount)
 {
     m_SpellbookGrade = grade;
     m_BookChance     = bookChance;
 }
 public SpellbookRegsLootBagSet(double bookChance, MagicGrade grade) : base(60)
 {
     m_SpellbookGrade = grade;
     m_BookChance     = bookChance;
 }
		public SpellbookRegsLootBagSet( int minc, int maxc, bool random, int mina, int maxa, double bookChance, MagicGrade grade ) : base( minc, maxc, random, mina, maxa )
		{
			m_SpellbookGrade = grade;
			m_BookChance = bookChance;
		}
		public SpellbookRegsLootBagSet( int amount, double bookChance, MagicGrade grade ) : base( amount, amount )
		{
			m_SpellbookGrade = grade;
			m_BookChance = bookChance;
		}
		public SpellbookRegsLootBagSet( double bookChance, MagicGrade grade ) : base( 60 )
		{
			m_SpellbookGrade = grade;
			m_BookChance = bookChance;
		}
Exemplo n.º 15
0
 public static bool Exists(MagicGrade index)
 {
     return(m_LootSets.ContainsKey(index));
 }