private static void ImportStandardSets(StandardSets standardSets, Guid jurisdictionsKey) { foreach (var standardSet in standardSets) { ImportStndardSet(jurisdictionsKey, standardSet); } }
static Cards() { // Fetch all cards. Card[] cards = Load(); // Set cards (without behaviours) AllCards = (from c in cards select new { Key = c.Id, Value = c }).ToDictionary(x => x.Key, x => x.Value); //fill standart dictionary Enum.GetValues(typeof(CardClass)).Cast <CardClass>().ToList().ForEach(heroClass => { Standard.Add(heroClass, All.Where(c => c.Collectible && (c.Class == heroClass || c.Class == CardClass.NEUTRAL && c.MultiClassGroup == 0 || c.MultiClassGroup == 1 && (c.Class == CardClass.NEUTRAL || c.Class == CardClass.HUNTER || c.Class == CardClass.PALADIN || c.Class == CardClass.WARRIOR) || c.MultiClassGroup == 2 && (c.Class == CardClass.NEUTRAL || c.Class == CardClass.DRUID || c.Class == CardClass.ROGUE || c.Class == CardClass.SHAMAN) || c.MultiClassGroup == 3 && (c.Class == CardClass.NEUTRAL || c.Class == CardClass.MAGE || c.Class == CardClass.PRIEST || c.Class == CardClass.WARLOCK)) && c.Type != CardType.HERO && StandardSets.Contains(c.Set)).ToList().AsReadOnly()); //Log.Debug($"-> [{heroClass}] - {Standard[heroClass].Count} cards."); }); //Log.Debug("AllStandard:"); AllStandard = All.Where(c => c.Collectible && c.Type != CardType.HERO && StandardSets.Contains(c.Set)).ToList().AsReadOnly(); // Add Powers // Add enchants //CoreCardsGen.Load(); }
public static string Statistics() { var standard = All.Where(c => c.Collectible && StandardSets.Contains(c.Set)); var implemented = standard.Where(p => p.Implemented) .GroupBy(p => p.Set) .Select(t => new { Key = t.Key, Count = t.Count() }); var all = standard .GroupBy(p => p.Set) .Select(t => new { Key = t.Key, Count = t.Count() }); var str = string.Empty; var totImpl = 0; var totCards = 0; foreach (var set in StandardSets) { var impl = implemented.FirstOrDefault(p => p.Key == set).Count; totImpl += impl; var tot = all.FirstOrDefault(p => p.Key == set).Count; str += $"{set} => {impl * 100 / tot}% from {tot} Cards\n"; totCards += tot; } str += $"Total => {totImpl * 100 / totCards}% from {totCards} Cards\n"; return(str); }
static Cards() { // Fetch all cards. var cardLoader = new CardLoader(); Card[] cards = cardLoader.Load(); //string json = File.ReadAllText(CardLoader.Path + @"SabberStone\HSProtoSim\Loader\Data\cardData.json"); //string json = File.ReadAllText(Environment.CurrentDirectory + @"\cardData.json"); //var cards = JsonConvert.DeserializeObject<IEnumerable<Card>>(Resources.cardDataJson); //File.WriteAllText(CardLoader.Path + @"SabberStone\HSProtoSim\Loader\Data\cardDataJson.txt", JsonConvert.SerializeObject(cards, Formatting.Indented)); // Set as card definitions Data = new CardContainer(); Data.Load(cards); //Log.Debug("Standard:"); //Enum.GetValues(typeof(CardClass)).Cast<CardClass>().ToList().ForEach(heroClass => for (int i = 0; i < HeroClasses.Length; i++) { CardClass heroClass = HeroClasses[i]; Standard.Add(heroClass, All.Where(c => c.Collectible && (c.Class == heroClass || c.Class == CardClass.NEUTRAL && c.MultiClassGroup == 0 || c.MultiClassGroup == 1 && (c.Class == CardClass.NEUTRAL || c.Class == CardClass.HUNTER || c.Class == CardClass.PALADIN || c.Class == CardClass.WARRIOR) || c.MultiClassGroup == 2 && (c.Class == CardClass.NEUTRAL || c.Class == CardClass.DRUID || c.Class == CardClass.ROGUE || c.Class == CardClass.SHAMAN) || c.MultiClassGroup == 3 && (c.Class == CardClass.NEUTRAL || c.Class == CardClass.MAGE || c.Class == CardClass.PRIEST || c.Class == CardClass.WARLOCK)) && c.Type != CardType.HERO && StandardSets.Contains(c.Set)).ToList().AsReadOnly()); //Log.Debug($"-> [{heroClass}] - {Standard[heroClass].Count} cards."); //}); } //Log.Debug("AllStandard:"); AllStandard = All.Where(c => c.Collectible && c.Type != CardType.HERO && StandardSets.Contains(c.Set)).ToList().AsReadOnly(); //Log.Debug("Wild:"); Enum.GetValues(typeof(CardClass)).Cast <CardClass>().ToList().ForEach(heroClass => { Wild.Add(heroClass, All.Where(c => c.Collectible && (c.Class == heroClass || c.Class == CardClass.NEUTRAL && c.MultiClassGroup == 0 || c.MultiClassGroup == 1 && (c.Class == CardClass.NEUTRAL || c.Class == CardClass.HUNTER || c.Class == CardClass.PALADIN || c.Class == CardClass.WARRIOR) || c.MultiClassGroup == 2 && (c.Class == CardClass.NEUTRAL || c.Class == CardClass.DRUID || c.Class == CardClass.ROGUE || c.Class == CardClass.SHAMAN) || c.MultiClassGroup == 3 && (c.Class == CardClass.NEUTRAL || c.Class == CardClass.MAGE || c.Class == CardClass.PRIEST || c.Class == CardClass.WARLOCK)) && c.Type != CardType.HERO).ToList().AsReadOnly()); //Log.Debug($"-> [{heroClass}] - {Wild[heroClass].Count} cards."); }); //Log.Debug("AllWild:"); AllWild = All.Where(c => c.Collectible && c.Type != CardType.HERO).ToList().AsReadOnly(); StandardCostMinionCards = AllStandard.Where(c => c.Type == CardType.MINION).GroupBy(c => c.Cost).ToDictionary(g => g.Key, g => g.ToList()); WildCostMinionCards = AllWild.Where(c => c.Type == CardType.MINION).GroupBy(c => c.Cost).ToDictionary(g => g.Key, g => g.ToList()); }
/// <summary> /// Returns a string with the card implementation statistics. /// </summary> /// <returns></returns> public static string Statistics() { IEnumerable <Card> standard = All.Where(c => c.Collectible && StandardSets.Contains(c.Set)); IEnumerable <Card> wild = All.Where(c => c.Collectible); var implemented = standard.Where(p => p.Implemented) .GroupBy(p => p.Set) .Select(t => new { Key = t.Key, Count = t.Count() }); var implementedWild = wild.Where(p => p.Implemented) .GroupBy(p => p.Set) .Select(t => new { Key = t.Key, Count = t.Count() }); var all = standard .GroupBy(p => p.Set) .Select(t => new { Key = t.Key, Count = t.Count() }); var allWild = wild .GroupBy(p => p.Set) .Select(t => new { Key = t.Key, Count = t.Count() }); string str = String.Empty; int totImpl = 0; int totCards = 0; foreach (CardSet set in StandardSets) { int impl = implemented.FirstOrDefault(p => p.Key == set).Count; totImpl += impl; int tot = all.FirstOrDefault(p => p.Key == set).Count; str += $"{CardSetToName(set)} => {impl * 100 / tot}% from {tot} Cards\n"; totCards += tot; } str += $"Total Standard => {totImpl * 100 / totCards}% from {totCards} Cards\n"; str += "\n"; totImpl = 0; totCards = 0; foreach (CardSet set in WildSets) { int impl = implementedWild.FirstOrDefault(p => p.Key == set).Count; totImpl += impl; int tot = allWild.FirstOrDefault(p => p.Key == set).Count; str += $"{CardSetToName(set)} => {impl * 100 / tot}% from {tot} Cards\n"; totCards += tot; } str += $"Total Wild => {totImpl * 100 / totCards}% from {totCards} Cards\n"; return(str); }
/// <summary> /// Returns a string with the card implementation statistics. /// </summary> /// <returns></returns> public static string Statistics() { IEnumerable <Card> standard = All.Where(c => c.Collectible && StandardSets.Contains(c.Set)); IEnumerable <Card> wild = All.Where(c => c.Collectible); var implemented = standard.Where(p => p.Implemented) .GroupBy(p => p.Set) .Select(t => new { Key = t.Key, Count = t.Count() }); var implementedWild = wild.Where(p => p.Implemented) .GroupBy(p => p.Set) .Select(t => new { Key = t.Key, Count = t.Count() }); var all = standard .GroupBy(p => p.Set) .Select(t => new { Key = t.Key, Count = t.Count() }); var allWild = wild .GroupBy(p => p.Set) .Select(t => new { Key = t.Key, Count = t.Count() }); var str = new StringBuilder(); int totImpl = 0; int totCards = 0; foreach (CardSet set in StandardSets) { int impl = implemented.FirstOrDefault(p => p.Key == set)?.Count ?? 0; totImpl += impl; int tot = all.FirstOrDefault(p => p.Key == set).Count; str.AppendLine($"{CardSetToName(set)} => {impl * 100 / tot}% from {tot} Cards"); totCards += tot; } str.AppendLine($"Total Standard => {totImpl * 100 / totCards}% from {totCards} Cards"); str.AppendLine(); totImpl = 0; totCards = 0; foreach (CardSet set in WildSets) { int impl = implementedWild.FirstOrDefault(p => p.Key == set)?.Count ?? 0; totImpl += impl; int tot = allWild.FirstOrDefault(p => p.Key == set).Count; str.AppendLine($"{CardSetToName(set)} => {impl * 100 / tot}% from {tot} Cards"); totCards += tot; } str.AppendLine($"Total Wild => {totImpl * 100 / totCards}% from {totCards} Cards"); IEnumerable <IGrouping <CardSet, Card> > notImplementedStandard = standard .Where(c => !c.Implemented) .GroupBy(c => c.Set); str.AppendLine("### Not yet implemented standard cards"); foreach (IGrouping <CardSet, Card> group in notImplementedStandard) { str.AppendLine($"#### {CardSetToName(group.Key)}"); foreach (Card c in group) { str.AppendLine($"- [{c.Id}] {c.Name}"); } } str.AppendLine(); IEnumerable <IGrouping <CardSet, Card> > notImplementedWild = wild .Where(c => !c.Implemented) .GroupBy(c => c.Set) .Where(c => WildSets.Contains(c.Key) && !StandardSets.Contains(c.Key)); str.AppendLine("### Not yet implemented wild cards"); foreach (IGrouping <CardSet, Card> group in notImplementedWild) { str.AppendLine($"#### {CardSetToName(group.Key)}"); foreach (Card c in group) { str.AppendLine($"- [{c.Id}] {c.Name}"); } } return(str.ToString()); }
static Cards() { // Fetch all cards. var cardLoader = new CardLoader(); Card[] cards = cardLoader.Load(); //string json = File.ReadAllText(CardLoader.Path + @"SabberStone\HSProtoSim\Loader\Data\cardData.json"); //string json = File.ReadAllText(Environment.CurrentDirectory + @"\cardData.json"); //var cards = JsonConvert.DeserializeObject<IEnumerable<Card>>(Resources.cardDataJson); //File.WriteAllText(CardLoader.Path + @"SabberStone\HSProtoSim\Loader\Data\cardDataJson.txt", JsonConvert.SerializeObject(cards, Formatting.Indented)); // Set as card definitions Data = new CardContainer(); Data.Load(cards); //Log.Debug("Standard:"); //Enum.GetValues(typeof(CardClass)).Cast<CardClass>().ToList().ForEach(heroClass => for (int i = 0; i < HeroClasses.Length; i++) { CardClass heroClass = HeroClasses[i]; Standard.Add(heroClass, All.Where(c => c.Collectible && (c.Class == heroClass || c.Class == CardClass.NEUTRAL && c.MultiClassGroup == 0 || c.MultiClassGroup == 1 && (c.Class == CardClass.NEUTRAL || c.Class == CardClass.HUNTER || c.Class == CardClass.PALADIN || c.Class == CardClass.WARRIOR) || c.MultiClassGroup == 2 && (c.Class == CardClass.NEUTRAL || c.Class == CardClass.DRUID || c.Class == CardClass.ROGUE || c.Class == CardClass.SHAMAN) || c.MultiClassGroup == 3 && (c.Class == CardClass.NEUTRAL || c.Class == CardClass.MAGE || c.Class == CardClass.PRIEST || c.Class == CardClass.WARLOCK)) && c.Type != CardType.HERO && StandardSets.Contains(c.Set)).ToList().AsReadOnly()); //Log.Debug($"-> [{heroClass}] - {Standard[heroClass].Count} cards."); //}); } //Log.Debug("AllStandard:"); AllStandard = All.Where(c => c.Collectible && c.Type != CardType.HERO && StandardSets.Contains(c.Set)).ToList().AsReadOnly(); //Log.Debug("Wild:"); Enum.GetValues(typeof(CardClass)).Cast <CardClass>().ToList().ForEach(heroClass => { Wild.Add(heroClass, All.Where(c => c.Collectible && (c.Class == heroClass || c.Class == CardClass.NEUTRAL && c.MultiClassGroup == 0 || c.MultiClassGroup == 1 && (c.Class == CardClass.NEUTRAL || c.Class == CardClass.HUNTER || c.Class == CardClass.PALADIN || c.Class == CardClass.WARRIOR) || c.MultiClassGroup == 2 && (c.Class == CardClass.NEUTRAL || c.Class == CardClass.DRUID || c.Class == CardClass.ROGUE || c.Class == CardClass.SHAMAN) || c.MultiClassGroup == 3 && (c.Class == CardClass.NEUTRAL || c.Class == CardClass.MAGE || c.Class == CardClass.PRIEST || c.Class == CardClass.WARLOCK)) && c.Type != CardType.HERO).ToList().AsReadOnly()); //Log.Debug($"-> [{heroClass}] - {Wild[heroClass].Count} cards."); }); //Log.Debug("AllWild:"); AllWild = All.Where(c => c.Collectible && c.Type != CardType.HERO).ToList().AsReadOnly(); StandardCostMinionCards = AllStandard.Where(c => c.Type == CardType.MINION).GroupBy(c => c.Cost).ToDictionary(g => g.Key, g => g.ToList()); WildCostMinionCards = AllWild.Where(c => c.Type == CardType.MINION).GroupBy(c => c.Cost).ToDictionary(g => g.Key, g => g.ToList()); // Temporary fix for Lotus Assassin Data.Cards["CFM_634"].Stealth = true; Data.Cards["CFM_634"].Tags.Add(GameTag.STEALTH, 1); // Basic Totems BasicTotems = new[] { FromId("NEW1_009"), // Healing Totem FromId("CS2_050"), // Searing Totem FromId("CS2_051"), // Stoneclaw Totem FromId("CS2_052") // Wraith of Air Totem }; // filtered out cards ... cosmetic purpose Data.Cards.Remove("HERO_01c"); // HERO Deathwing }