public static WikiCard ParseItem(ValveSet set, ValveCard card) { var wcard = new WikiCard(set.set_info.set_id, card); wcard.SubCard = new WikiItem(wcard.Abilities, card); return(wcard); }
public static WikiCard ParseAbility(ValveSet set, ValveCard card) { var wcard = new WikiCard(set.set_info.set_id, card); wcard.SubCard = new WikiAbility(card); return(wcard); }
public string GenerateNewArticle(WikiCard card) { string result = $@"{TabTemplate} {CardInfobox} {SubcardInfobox} {CardStinger} {GenerateSections(Sections)} {GenerateCategories(Categories)} "; result = result.Replace("\r", ""); result = Regex.Replace(result, @"\n\n\n+", "\n\n\n").Trim(); if (Finalizer != null) { result = Finalizer(card, result); } return(result); }
public static string GetCardInfobox(WikiCard card) { return($@"{{{{Card Infobox | ID = {card.ID} | BaseID = {card.BaseID} | MarketplaceID = {card.MarketplaceID} | Name = {card.Name} | Aliases = {String.Join(",", card.Aliases)} | SetID = {card.SetID} | CardType = {card.CardType} | SubType = {card.SubType} | Rarity = {card.Rarity} | Color = {card.Color} | Abilities = {(card.Abilities.Count > 0 ? String.Join(",", card.Abilities.Select(x => x.Value.ID)) : "")} | TokenOf = {(card.TokenParents.Count > 0 ? String.Join(",", card.TokenParents.Select(x => x.ID)) : "")} | SignatureOf = {(card.SignatureOf.HasValue ? card.SignatureOf.ToString() : "")} | IsCollectable = {card.IsCollectable} | Text = {(String.IsNullOrWhiteSpace(card.Text) ? String.Join("\n", card?.Abilities.Select(x => x.Value.Text)) : card.Text)} | TextRaw = {card.TextRaw} | TextFormatted = {(String.IsNullOrWhiteSpace(card.TextFormatted) ? String.Join("\n", card?.Abilities.Select(x => x.Value.TextFormatted)) : card.TextFormatted)} | CardImage = {card.CardImage} | CardImageRaw = {card.CardImageRaw} | CardIcon = {card.CardIcon} | Illustrator = {card.Illustrator} | VoiceActor = {card.VoiceActor} | Lore = {card.Lore} | LoreFormatted = {card.LoreFormatted} | Keywords = {String.Join(",", card.Keywords.Keys)}}}}} "); }
public override void Transform(WikiCard card) { if (card.LoreFormatted == null) { return; } card.LoreFormatted = Regex.Replace(card.LoreFormatted, RegexString, Replacement); }
public virtual void Transform(WikiCard card) { if (card.Text == null) { Console.WriteLine($"Card {card.Name} has no text!"); return; } card.Text = Regex.Replace(card.Text, RegexString, Replacement); }
public void Transform(WikiCard card) { foreach (var ability in card.Abilities.Values) { if (ability.AbilityType == ArtifactAbilityType.Active) { if (card.CardType == ArtifactCardType.Creep) { ability.AbilityCardParent.CardIcon = "Creep_ability_active_icon.png"; } } else if (card.Keywords.ContainsKey(ArtifactKeyword.DeathEffect)) { ability.PassiveAbilityType = ArtifactPassiveAbilityType.Death; if (card.CardType == ArtifactCardType.Creep) { ability.AbilityCardParent.CardIcon = "Creep_ability_death_icon.png"; } } else if (card.Keywords.ContainsKey(ArtifactKeyword.ReactiveEffect)) { ability.PassiveAbilityType = ArtifactPassiveAbilityType.Reactive; if (card.CardType == ArtifactCardType.Creep) { ability.AbilityCardParent.CardIcon = "Creep_ability_reactive_icon.png"; } } else if (card.Keywords.ContainsKey(ArtifactKeyword.PlayEffect)) { ability.PassiveAbilityType = ArtifactPassiveAbilityType.Play; if (card.CardType == ArtifactCardType.Creep) { ability.AbilityCardParent.CardIcon = "Creep_ability_reactive_icon.png"; } } else { ability.PassiveAbilityType = ArtifactPassiveAbilityType.Continuous; card.Keywords.Add(ArtifactKeyword.ContinuousEffect, "process of elimination"); if (card.CardType == ArtifactCardType.Creep) { ability.AbilityCardParent.CardIcon = "Creep_ability_continuous_icon.png"; } } if (card.CardType == ArtifactCardType.Item || card.CardType == ArtifactCardType.Improvement) { ability.AbilityCardParent.CardIcon = card.CardIcon; } } //if(card.Keywords.ContainsKey(ArtifactKeyword.DeathEffect)) //{ // card. //} }
protected string Finalize(WikiCard card, string result) { if (card.VoiceOverLines.Count == 0) { return(GetEmptyResponseArticle(card)); } return(Regex.Replace(result, @"\n\n+", "\n\n")); }
protected override void TransformSingle(WikiCard card) { if (card.CardType == ArtifactCardType.Ability || card.CardType == ArtifactCardType.PassiveAbility) { var ability = card.SubCard as WikiAbility; ability.Text = card.Text; ability.TextFormatted = card.TextFormatted; } }
public override void Transform(WikiCard card) { Dictionary <string, string> newVO = new Dictionary <string, string>(); foreach (var pair in card.VoiceOverLines) { newVO[pair.Key] = Regex.Replace(pair.Value, RegexString, Replacement); } card.VoiceOverLines = newVO; }
protected override void TransformSingle(WikiCard card) { if (card.Rarity == ArtifactRarity.Basic || card.CardType == ArtifactCardType.Stronghold || card.CardType == ArtifactCardType.Pathing || card.CardType == ArtifactCardType.Ability || card.CardType == ArtifactCardType.PassiveAbility) { card.IsCollectable = false; } }
public static List <string> GetStandardCategories(WikiCard card, string typeCat, string setName) { return(new List <string>() { typeCat, card.Color.ToString(), card.Rarity.ToString(), card.IsCollectable ? "Collectable" : "Non-collectable", setName }); }
public override void Transform(WikiCard card) { if (card.Text != null) { card.Text = Regex.Replace(card.Text, RegexString, card.Name); } if (card.TextFormatted != null) { card.TextFormatted = Regex.Replace(card.TextFormatted, RegexString, card.Name); } }
public void Transform(WikiCard card) { card.Text = card.TextRaw; card.TextFormatted = card.TextRaw; card.Lore = card.LoreRaw; card.LoreFormatted = card.LoreRaw; foreach (var pair in card.VoiceOverLinesRaw) { card.VoiceOverLines[pair.Key] = pair.Value; } }
public static string GetTokenParents(WikiCard card) { string result = ""; foreach (var parent in card.TokenParents) { if (parent.CardType == ArtifactCardType.Ability || parent.CardType == ArtifactCardType.PassiveAbility) { var ability = parent.SubCard as WikiAbility; result += GetCardReference(ability.Parent.Name); } else { result += GetCardReference(parent.Name); } } return(result); }
public WikiHero(Dictionary <int, WikiAbility> abilities, int setID, ValveCard hero) : base(hero.card_id, hero.card_name["english"]) { Attack = hero.attack; Armor = hero.armor; Health = hero.hit_points; HeroIcon = WikiCard.GetImageName(setID, hero, "herocolor", extension: "png"); HeroIconRaw = WikiCard.GetImageName(setID, hero, "hero", extension: "png"); foreach (var reference in hero.references) { if (reference.ref_type == ArtifactReferenceType.Signature) { SignatureCardID = reference.card_id; } else { abilities[reference.card_id] = new WikiAbility(reference, null); } } }
public void Transform(WikiCard card) { if (card.TextRaw == null) { Console.WriteLine($"Card {card.Name} has no text!"); return; } var match = Regex.Match(card.TextRaw, @"\[activatedability\[\[color:ability\[Active ■(\d):]]"); if (match.Captures.Count > 0) { foreach (var ability in card.Abilities.Values) { if (ability.AbilityType == ArtifactAbilityType.Active) { ability.Cooldown = Int32.Parse(match.Groups[1].Value); } } } }
public override void Transform(WikiCard card) { if (card.TextRaw == null) { return; } if (!Regex.IsMatch(card.Text, RegexString) && !Regex.IsMatch(card.TextFormatted, RegexString)) { return; } string parent = ""; if (card.CardType == ArtifactCardType.Ability || card.CardType == ArtifactCardType.PassiveAbility) { parent = (card.SubCard as WikiAbility).Parent.Name; } //if(card.TokenParents.Count == 0) //{ // parent = card.TokenParent.Name; //} if (card.SignatureParent != null) { parent = card.SignatureParent.Name; } if (String.IsNullOrWhiteSpace(parent)) { throw new Exception("Couldn't find the parent name for some reason."); } card.Text = Regex.Replace(card.Text, RegexString, parent); card.TextFormatted = Regex.Replace(card.TextFormatted, RegexString, parent); }
public void Transform(WikiCard card) { foreach (var pair in KeywordTriggers) { foreach (string trigger in pair.Value) { if (String.IsNullOrWhiteSpace(trigger) || String.IsNullOrWhiteSpace(card.Text)) { continue; } var match = Regex.Match(card.Text, trigger); if (match.Success) { card.Keywords[pair.Key] = match.Value; } } } //if(card.Keywords.ContainsKey(ArtifactKeyword.DeathEffect)) //{ // card. //} }
protected abstract void TransformChildren(IDictionary <int, WikiCard> cards, WikiCard card);
protected abstract void TransformSingle(WikiCard card);
public void Transform(WikiCard card) { TransformSingle(card); }
public void Transform(IDictionary <int, WikiCard> cards, WikiCard card) { TransformSingle(card); TransformChildren(cards, card); }
public WikiArticleCombiner(WikiCard card) { Card = card; }
public OldLoreArticleCombiner(WikiCard card) : base(card) { }
protected WikiArticleGenerator(WikiCard card, ArtifactCardType type) { Card = card; CardType = type; }
protected override void TransformChildren(IDictionary <int, WikiCard> cards, WikiCard card) { }
protected override void TransformChildren(IDictionary <int, WikiCard> cards, WikiCard card) { foreach (var pair in card.References) { cards[pair.Key].IsCollectable = false; } }
public static string GetImageName(WikiCard card, string imageType, string language = "default", string extension = "jpg") { return($"{card.SetID.ToString("00")}_{ScrubString(card.Name)}_{card.ID}_{imageType}_{language}.{extension}"); }
public static string GetAudioName(WikiCard card, string audioType, string audioName, string extension = "mp3") { return($"{card.SetID.ToString("00")}_{ScrubString(card.Name)}_{card.ID}_{audioType}_{ScrubString(audioName)}.{extension}"); }