示例#1
0
 public Card(HearthDb.Card dbCard)
 {
     _dbCard       = dbCard;
     Id            = dbCard.Id;
     Count         = 1;
     PlayerClass   = HearthDbConverter.ConvertClass(dbCard.Class);
     Rarity        = dbCard.Rarity;
     Type          = HearthDbConverter.CardTypeConverter(dbCard.Type);
     Name          = dbCard.GetLocName(Locale.enUS);
     Cost          = dbCard.Cost;
     LocalizedName = dbCard.GetLocName(SelectedLanguage);
     Text          = dbCard.GetLocText(SelectedLanguage);
     EnglishText   = dbCard.GetLocText(Locale.enUS);
     Attack        = dbCard.Attack;
     Health        = dbCard.Health;
     Race          = HearthDbConverter.RaceConverter(dbCard.Race);
     Durability    = dbCard.Durability > 0 ? (int?)dbCard.Durability : null;
     Mechanics     = dbCard.Mechanics;
     Artist        = dbCard.ArtistName;
     Set           = HearthDbConverter.SetConverter(dbCard.Set);
     foreach (var altLangStr in Config.Instance.AlternativeLanguages)
     {
         if (Enum.TryParse(altLangStr, out Locale altLang))
         {
             AlternativeNames.Add(dbCard.GetLocName(altLang));
             AlternativeTexts.Add(dbCard.GetLocText(altLang));
         }
     }
     _loaded = true;
 }
示例#2
0
        void Add(Index Index)
        {
            if (!_index.ContainsValue(Index.Card.HDTCard.Id))
            {
                HearthDb.Card DbCard = HearthDb.Cards.GetFromDbfId(Index.Card.HDTCard.DbfIf);

                string name = "";
                string text = "";
                name = DbCard.Name?.ToLower();
                text = DbCard.Text?.ToLower();

                string locName = "";
                string locText = "";

                if (Enum.TryParse(Config.Instance.SelectedLanguage, out Locale lang))
                {
                    locName = DbCard.GetLocName(lang)?.ToLower();
                    locText = DbCard.GetLocText(lang)?.ToLower();
                }

                _sb.Append(locName).Append(name).Append(locText).Append(text);
                _index.Add(_sb.ToString(), Index.Card.HDTCard.Id);
                _sb.Clear();

                _indexObjects.Add(Index.Card.HDTCard.Id, new List <Index>());
            }

            _indexObjects[Index.Card.HDTCard.Id].Add(Index);
        }
示例#3
0
 public Card(HearthDb.Card dbCard, bool baconCard = false)
 {
     _dbCard       = dbCard;
     Id            = dbCard.Id;
     Count         = 1;
     PlayerClass   = HearthDbConverter.ConvertClass(dbCard.Class);
     Rarity        = dbCard.Rarity;
     Type          = HearthDbConverter.CardTypeConverter(dbCard.Type);
     Name          = dbCard.GetLocName(Locale.enUS);
     Cost          = dbCard.Cost;
     LocalizedName = dbCard.GetLocName(SelectedLanguage);
     Text          = dbCard.GetLocText(SelectedLanguage);
     EnglishText   = dbCard.GetLocText(Locale.enUS);
     Attack        = dbCard.Attack;
     Health        = dbCard.Health;
     Race          = HearthDbConverter.RaceConverter(dbCard.Race);
     Durability    = dbCard.Durability > 0 ? (int?)dbCard.Durability : null;
     Mechanics     = dbCard.Mechanics;
     Artist        = dbCard.ArtistName;
     Set           = HearthDbConverter.SetConverter(dbCard.Set);
     BaconCard     = baconCard;
     _loaded       = true;
 }