Esempio n. 1
0
        public void Run()
        {
            GameDataLists gameDataLists = new GameDataLists();

            gameDataLists.Load(@"..\..\..\datasource\export\exd-all\");

            bool result = true;

            result = result && ValidateCardIds(gameDataLists);
            result = result && ValidateNpcIds(gameDataLists);
            result = result && gameDataLists.Link();
            if (result)
            {
                var mapRuleByCodeName     = BuildRuleNameMap();
                var mapCardTypeByCodeName = BuildCardTypes();

                result = result && ExportRuleNames(gameDataLists.rules, mapRuleByCodeName);
                result = result && ExportCardTypes(gameDataLists.cardTypes, mapCardTypeByCodeName);
                result = result && UpdateCards(gameDataLists, mapCardTypeByCodeName);
                result = result && UpdateNpcs(gameDataLists, mapRuleByCodeName);
                result = result && UpdateTournaments(gameDataLists, mapRuleByCodeName);
            }

            if (result)
            {
                LocalizationDB.Get().Save();
                TriadCardDB.Get().Save();
                TriadNpcDB.Get().Save();
                TriadTournamentDB.Get().Save();
            }

            Logger.WriteLine(result ? "Done." : "Aborted");
        }
Esempio n. 2
0
 public TriadGameModifierSuddenDeath()
 {
     RuleName            = "Sudden Death";
     LocRuleName         = LocalizationDB.Get().FindOrAddLocString(ELocStringType.RuleName, 4);
     bHasLastRedReminder = true;
     Features            = EFeature.AllPlaced;
 }
Esempio n. 3
0
 public TriadGameModifierPlus()
 {
     RuleName    = "Plus";
     LocRuleName = LocalizationDB.Get().FindOrAddLocString(ELocStringType.RuleName, 8);
     bAllowCombo = true;
     Features    = EFeature.CaptureNei | EFeature.CardPlaced;
 }
Esempio n. 4
0
 public string ToLocalizedString()
 {
     return(string.Format("[{0}] {1} {2} [{3}, {4}, {5}, {6}]",
                          Id, Name.GetLocalized(),
                          new string('*', (int)Rarity + 1),
                          Sides[0], Sides[1], Sides[2], Sides[3],
                          (Type != ETriadCardType.None) ? " [" + LocalizationDB.Get().LocCardTypes[(int)Type] + "]" : ""));
 }
Esempio n. 5
0
 public TriadNpc(int id, List <TriadGameModifier> rules, List <TriadCard> rewards, TriadDeck deck)
 {
     Id          = id;
     Name        = LocalizationDB.Get().FindOrAddLocString(ELocStringType.NpcName, id);
     LocationMap = LocalizationDB.Get().FindOrAddLocString(ELocStringType.NpcLocation, id);
     Rules       = rules;
     Rewards     = rewards;
     Deck        = deck;
 }
Esempio n. 6
0
 public TriadNpc(int id, List <TriadGameModifier> rules, List <TriadCard> rewards, int[] cardsAlways, int[] cardsPool)
 {
     Id          = id;
     Name        = LocalizationDB.Get().FindOrAddLocString(ELocStringType.NpcName, id);
     LocationMap = LocalizationDB.Get().FindOrAddLocString(ELocStringType.NpcLocation, id);
     Rules       = rules;
     Rewards     = rewards;
     Deck        = new TriadDeck(cardsAlways, cardsPool);
 }
Esempio n. 7
0
        private Dictionary <string, ETriadCardType> BuildCardTypes()
        {
            var typeMap = new Dictionary <string, ETriadCardType>();

            LocalizationDB locDB = LocalizationDB.Get();

            for (int idx = 0; idx < locDB.LocCardTypes.Count; idx++)
            {
                typeMap.Add(locDB.LocCardTypes[idx].GetCodeName(), (ETriadCardType)idx);
            }

            return(typeMap);
        }
Esempio n. 8
0
        public TriadCard(int id, string iconPath, ETriadCardRarity rarity, ETriadCardType type, int numUp, int numDown, int numLeft, int numRight, int sortOrder, int group)
        {
            Id       = id;
            Name     = LocalizationDB.Get().FindOrAddLocString(ELocStringType.CardName, id);
            IconPath = iconPath;
            Rarity   = rarity;
            Type     = type;
            Sides    = new int[4] {
                numUp, numLeft, numDown, numRight
            };
            SameNumberId = -1;
            SortOrder    = sortOrder;
            Group        = group;

            if (group != 0 && SortOrder < 1000)
            {
                SortOrder += 1000;
            }
        }
Esempio n. 9
0
        private bool ExportRuleNames(List <GameDataRule> gameDataRules, Dictionary <string, TriadGameModifier> ruleMap)
        {
            var ruleCodeNames = new List <string>();

            foreach (var ruleInfo in gameDataRules)
            {
                ruleCodeNames.Add(ruleInfo.Name.GetCodeName());
            }

            LocalizationDB locDB = LocalizationDB.Get();

            {
                TriadGameModifierNone ruleNone = new TriadGameModifierNone();
                locDB.LocRuleNames[ruleNone.GetLocalizationId()].Text[LocalizationDB.CodeLanguageIdx] = "";
            }

            foreach (var kvp in ruleMap)
            {
                var matchGameData = gameDataRules.Find(x => (x.Name.GetCodeName() == kvp.Key));
                if (matchGameData == null)
                {
                    Logger.WriteLine("FAILED rule export, no match for: {0}", kvp.Key);
                    return(false);
                }

                locDB.LocRuleNames[kvp.Value.GetLocalizationId()].Text = matchGameData.Name.Text;
                ruleCodeNames.Remove(kvp.Key);
            }

            if (ruleCodeNames.Count > 0)
            {
                Logger.WriteLine("FAILED rule export, not assigned: {0}", string.Join(", ", ruleCodeNames));
                return(false);
            }

            return(true);
        }
Esempio n. 10
0
        private bool ExportCardTypes(List <GameDataCardType> gameDataCardTypes, Dictionary <string, ETriadCardType> typeMap)
        {
            var typeCodeNames = new List <string>();

            foreach (var typeInfo in gameDataCardTypes)
            {
                typeCodeNames.Add(typeInfo.Type.GetCodeName());
            }

            LocalizationDB locDB = LocalizationDB.Get();

            foreach (var kvp in typeMap)
            {
                if (kvp.Value == ETriadCardType.None)
                {
                    continue;
                }

                var matchGameData = gameDataCardTypes.Find(x => (x.Type.GetCodeName() == kvp.Key));
                if (matchGameData == null)
                {
                    Logger.WriteLine("FAILED card type export, no match for: {0}", kvp.Key);
                    return(false);
                }

                locDB.mapCardTypes[kvp.Value].Text = matchGameData.Type.Text;
                typeCodeNames.Remove(kvp.Key);
            }

            if (typeCodeNames.Count > 0)
            {
                Logger.WriteLine("FAILED card type export, not assigned: {0}", string.Join(", ", typeCodeNames));
                return(false);
            }

            return(true);
        }
Esempio n. 11
0
 public TriadGameModifierOrder()
 {
     RuleName              = "Order";
     LocRuleName           = LocalizationDB.Get().FindOrAddLocString(ELocStringType.RuleName, 11);
     bIsDeckOrderImportant = true; Features = EFeature.FilterNext;
 }
Esempio n. 12
0
 public TriadTournament(int id, List <TriadGameModifier> rules)
 {
     Id    = id;
     Name  = LocalizationDB.Get().FindOrAddLocString(ELocStringType.TournamentName, id);
     Rules = rules;
 }
Esempio n. 13
0
 public TriadGameModifierNone()
 {
     RuleName    = "None";
     LocRuleName = LocalizationDB.Get().FindOrAddLocString(ELocStringType.RuleName, 0);
 }
Esempio n. 14
0
 public TriadGameModifierThreeOpen()
 {
     RuleName    = "Three Open";
     LocRuleName = LocalizationDB.Get().FindOrAddLocString(ELocStringType.RuleName, 3);
     SpecialMod  = ETriadGameSpecialMod.SelectVisible3;
 }
Esempio n. 15
0
 public TriadGameModifierRoulette()
 {
     RuleName    = "Roulette";
     LocRuleName = LocalizationDB.Get().FindOrAddLocString(ELocStringType.RuleName, 1);
     SpecialMod  = ETriadGameSpecialMod.RandomizeRule;
 }
Esempio n. 16
0
 public TriadGameModifierRandom()
 {
     RuleName    = "Random";
     LocRuleName = LocalizationDB.Get().FindOrAddLocString(ELocStringType.RuleName, 14);
     SpecialMod  = ETriadGameSpecialMod.RandomizeBlueDeck;
 }
Esempio n. 17
0
 public TriadGameModifierDraft()
 {
     RuleName    = "Draft";
     LocRuleName = LocalizationDB.Get().FindOrAddLocString(ELocStringType.RuleName, 15);
 }
Esempio n. 18
0
 public TriadGameModifierSwap()
 {
     RuleName    = "Swap";
     LocRuleName = LocalizationDB.Get().FindOrAddLocString(ELocStringType.RuleName, 13);
     SpecialMod  = ETriadGameSpecialMod.SwapCards;
 }
Esempio n. 19
0
 public TriadGameModifierChaos()
 {
     RuleName    = "Chaos";
     LocRuleName = LocalizationDB.Get().FindOrAddLocString(ELocStringType.RuleName, 12);
     SpecialMod  = ETriadGameSpecialMod.BlueCardSelection;
 }
Esempio n. 20
0
 public TriadGameModifierReverse()
 {
     RuleName    = "Reverse";
     LocRuleName = LocalizationDB.Get().FindOrAddLocString(ELocStringType.RuleName, 5);
     Features    = EFeature.CaptureMath;
 }
Esempio n. 21
0
 public TriadGameModifierDescention()
 {
     RuleName    = "Descension";
     LocRuleName = LocalizationDB.Get().FindOrAddLocString(ELocStringType.RuleName, 10);
     Features    = EFeature.CardPlaced | EFeature.PostCapture;
 }
Esempio n. 22
0
 public TriadGameModifierFallenAce()
 {
     RuleName    = "Fallen Ace";
     LocRuleName = LocalizationDB.Get().FindOrAddLocString(ELocStringType.RuleName, 6);
     Features    = EFeature.CaptureWeights;
 }