Exemplo n.º 1
0
        private void FormatTalentText(OutputBuilder outputBuilder)
        {
            var talentQueue = new Queue <Talent>();

            foreach (var gameTalent in talents)
            {
                // Find out what talent name is the longest
                if (gameTalent.Name.Length > longestTalentName)
                {
                    longestTalentName = gameTalent.Name.Length;
                }

                talentQueue.Enqueue(gameTalent);
            }

            var rows = talents.Count / 4;

            try
            {
                for (var i = 0; i < rows; i++)
                {
                    var talent1 = WrmChargenCommon.FormatToColumn(longestTalentName, talentQueue.Dequeue().Name);
                    var talent2 = WrmChargenCommon.FormatToColumn(longestTalentName, talentQueue.Dequeue().Name);
                    var talent3 = WrmChargenCommon.FormatToColumn(longestTalentName, talentQueue.Dequeue().Name);
                    var talent4 = WrmChargenCommon.FormatToColumn(longestTalentName, talentQueue.Dequeue().Name);
                    outputBuilder.AppendLine($"{talent1}  {talent2}  {talent3}  {talent4}");
                }

                if ((rows % 4) > 0)
                {
                    var columns = rows - (rows * 4);

                    switch (columns)
                    {
                    case 1:
                        var talentcolumn1 = WrmChargenCommon.FormatToColumn(longestTalentName, talentQueue.Dequeue().Name);
                        outputBuilder.AppendLine($"{talentcolumn1}");
                        break;

                    case 2:
                        var tk1 = WrmChargenCommon.FormatToColumn(longestTalentName, talentQueue.Dequeue().Name);
                        var tk2 = WrmChargenCommon.FormatToColumn(longestTalentName, talentQueue.Dequeue().Name);
                        outputBuilder.AppendLine($"{tk1}  {tk2}");
                        break;

                    case 3:
                        var tkl1 = WrmChargenCommon.FormatToColumn(longestTalentName, talentQueue.Dequeue().Name);
                        var tkl2 = WrmChargenCommon.FormatToColumn(longestTalentName, talentQueue.Dequeue().Name);
                        var tkl3 = WrmChargenCommon.FormatToColumn(longestTalentName, talentQueue.Dequeue().Name);
                        outputBuilder.AppendLine($"{tkl1}  {tkl2}  {tkl3}");
                        break;
                    }
                }
            }
            catch
            {
                // ignored
            }
        }
Exemplo n.º 2
0
        private void FormatRaceText(OutputBuilder outputBuilder)
        {
            var raceQueue = new Queue <GameRace>();
            var rows      = gameRaces.Count / 4;

            foreach (var gameRace in gameRaces)
            {
                // Find out what skill name is the longest
                if (gameRace.Name.Length > longestRaceName)
                {
                    longestRaceName = gameRace.Name.Length;
                }

                raceQueue.Enqueue(gameRace);
            }

            try
            {
                for (var i = 0; i < rows; i++)
                {
                    var race1 = WrmChargenCommon.FormatToColumn(longestRaceName, raceQueue.Dequeue().Name);
                    var race2 = WrmChargenCommon.FormatToColumn(longestRaceName, raceQueue.Dequeue().Name);
                    var race3 = WrmChargenCommon.FormatToColumn(longestRaceName, raceQueue.Dequeue().Name);
                    var race4 = WrmChargenCommon.FormatToColumn(longestRaceName, raceQueue.Dequeue().Name);
                    outputBuilder.AppendLine($"{race1}  {race2}  {race3}  {race4}");
                }

                if (gameRaces.Count % 4 > 0)
                {
                    var columns = gameRaces.Count - (rows * 4);

                    switch (columns)
                    {
                    case 1:
                        var racecolumn1 = WrmChargenCommon.FormatToColumn(longestRaceName, raceQueue.Dequeue().Name);
                        outputBuilder.AppendLine($"{racecolumn1}");
                        break;

                    case 2:
                        var rc   = WrmChargenCommon.FormatToColumn(longestRaceName, raceQueue.Dequeue().Name);
                        var rcc1 = WrmChargenCommon.FormatToColumn(longestRaceName, raceQueue.Dequeue().Name);
                        outputBuilder.AppendLine($"{rc}  {rcc1}");
                        break;

                    case 3:
                        var rc1 = WrmChargenCommon.FormatToColumn(longestRaceName, raceQueue.Dequeue().Name);
                        var rc2 = WrmChargenCommon.FormatToColumn(longestRaceName, raceQueue.Dequeue().Name);
                        var rc3 = WrmChargenCommon.FormatToColumn(longestRaceName, raceQueue.Dequeue().Name);
                        outputBuilder.AppendLine($"{rc1}  {rc2}  {rc3}");
                        break;
                    }
                }
            }
            catch (Exception)
            {
                // ignored
            }
        }
Exemplo n.º 3
0
        private string FormatSkillText()
        {
            var skillQueue       = new Queue();
            var text             = new StringBuilder();
            int rows             = this.gameSkills.Count / 4;
            var longestSkillName = 0;

            foreach (var gameSkill in this.gameSkills)
            {
                // Find out what skill name is the longest
                if (gameSkill.Name.Length > longestSkillName)
                {
                    longestSkillName = gameSkill.Name.Length;
                }

                skillQueue.Enqueue(gameSkill);
            }

            // TODO: The columns calculations and such look wrong...
            for (int i = 0; i < rows; i++)
            {
                string skill1 = WrmChargenCommon.FormatToColumn(longestSkillName, ((GameSkill)skillQueue.Dequeue()).Name);
                string skill2 = WrmChargenCommon.FormatToColumn(longestSkillName, ((GameSkill)skillQueue.Dequeue()).Name);
                string skill3 = WrmChargenCommon.FormatToColumn(longestSkillName, ((GameSkill)skillQueue.Dequeue()).Name);
                string skill4 = WrmChargenCommon.FormatToColumn(longestSkillName, ((GameSkill)skillQueue.Dequeue()).Name);
                text.AppendFormat("{0}  {1}  {2}  {3}" + Environment.NewLine, skill1, skill2, skill3, skill4);
            }

            if ((this.gameSkills.Count % 4) > 0)
            {
                int columns = this.gameSkills.Count - (rows * 4);
                switch (columns)
                {
                case 1:
                    string skillcolumn1 = WrmChargenCommon.FormatToColumn(longestSkillName, ((GameSkill)skillQueue.Dequeue()).Name);
                    text.AppendFormat("{0}" + Environment.NewLine, skillcolumn1);
                    break;

                case 2:
                    string sk1 = WrmChargenCommon.FormatToColumn(longestSkillName, ((GameSkill)skillQueue.Dequeue()).Name);
                    string sk2 = WrmChargenCommon.FormatToColumn(longestSkillName, ((GameSkill)skillQueue.Dequeue()).Name);
                    text.AppendFormat("{0}  {1}" + Environment.NewLine, sk1, sk2);
                    break;

                case 3:
                    string skl1 = WrmChargenCommon.FormatToColumn(longestSkillName, ((GameSkill)skillQueue.Dequeue()).Name);
                    string skl2 = WrmChargenCommon.FormatToColumn(longestSkillName, ((GameSkill)skillQueue.Dequeue()).Name);
                    string skl3 = WrmChargenCommon.FormatToColumn(longestSkillName, ((GameSkill)skillQueue.Dequeue()).Name);
                    text.AppendFormat("{0}  {1}  {2}" + Environment.NewLine, skl1, skl2, skl3);
                    break;
                }
            }

            text.Append(Environment.NewLine);
            return(text.ToString());
        }
Exemplo n.º 4
0
        private void FormatSkillText(OutputBuilder outputBuilder)
        {
            var skillQueue       = new Queue();
            int rows             = gameSkills.Count / 4;
            var longestSkillName = 0;

            foreach (var gameSkill in gameSkills)
            {
                // Find out what skill name is the longest
                if (gameSkill.Name.Length > longestSkillName)
                {
                    longestSkillName = gameSkill.Name.Length;
                }

                skillQueue.Enqueue(gameSkill);
            }

            // TODO: The columns calculations and such look wrong...
            for (int i = 0; i < rows; i++)
            {
                string skill1 = WrmChargenCommon.FormatToColumn(longestSkillName, ((GameSkill)skillQueue.Dequeue()).Name);
                string skill2 = WrmChargenCommon.FormatToColumn(longestSkillName, ((GameSkill)skillQueue.Dequeue()).Name);
                string skill3 = WrmChargenCommon.FormatToColumn(longestSkillName, ((GameSkill)skillQueue.Dequeue()).Name);
                string skill4 = WrmChargenCommon.FormatToColumn(longestSkillName, ((GameSkill)skillQueue.Dequeue()).Name);
                outputBuilder.AppendLine($"{skill1}  {skill2}  {skill3}  {skill4}");
            }

            if ((gameSkills.Count % 4) > 0)
            {
                int columns = gameSkills.Count - (rows * 4);
                switch (columns)
                {
                case 1:
                    string skillcolumn1 = WrmChargenCommon.FormatToColumn(longestSkillName, ((GameSkill)skillQueue.Dequeue()).Name);
                    outputBuilder.AppendLine($"{skillcolumn1}");
                    break;

                case 2:
                    string sk1 = WrmChargenCommon.FormatToColumn(longestSkillName, ((GameSkill)skillQueue.Dequeue()).Name);
                    string sk2 = WrmChargenCommon.FormatToColumn(longestSkillName, ((GameSkill)skillQueue.Dequeue()).Name);
                    outputBuilder.AppendLine($"{sk1}  {sk2}");
                    break;

                case 3:
                    string skl1 = WrmChargenCommon.FormatToColumn(longestSkillName, ((GameSkill)skillQueue.Dequeue()).Name);
                    string skl2 = WrmChargenCommon.FormatToColumn(longestSkillName, ((GameSkill)skillQueue.Dequeue()).Name);
                    string skl3 = WrmChargenCommon.FormatToColumn(longestSkillName, ((GameSkill)skillQueue.Dequeue()).Name);
                    outputBuilder.AppendLine($"{skl1}  {skl2}  {skl3}");
                    break;
                }
            }
        }
Exemplo n.º 5
0
        private string FormatTalentText()
        {
            var talentQueue = new Queue <Talent>();
            var text        = new StringBuilder();

            foreach (var gameTalent in this.talents)
            {
                // Find out what talent name is the longest
                if (gameTalent.Name.Length > this.longestTalentName)
                {
                    this.longestTalentName = gameTalent.Name.Length;
                }

                talentQueue.Enqueue(gameTalent);
            }

            int rows = this.talents.Count / 4;

            try
            {
                for (int i = 0; i < rows; i++)
                {
                    string talent1 = WrmChargenCommon.FormatToColumn(this.longestTalentName, talentQueue.Dequeue().Name);
                    string talent2 = WrmChargenCommon.FormatToColumn(this.longestTalentName, talentQueue.Dequeue().Name);
                    string talent3 = WrmChargenCommon.FormatToColumn(this.longestTalentName, talentQueue.Dequeue().Name);
                    string talent4 = WrmChargenCommon.FormatToColumn(this.longestTalentName, talentQueue.Dequeue().Name);
                    text.AppendFormat("{0}  {1}  {2}  {3}" + Environment.NewLine, talent1, talent2, talent3, talent4);
                }

                if ((rows % 4) > 0)
                {
                    int columns = rows - (rows * 4);

                    switch (columns)
                    {
                    case 1:
                        string talentcolumn1 = WrmChargenCommon.FormatToColumn(this.longestTalentName, talentQueue.Dequeue().Name);
                        text.AppendFormat("{0}" + Environment.NewLine, talentcolumn1);
                        break;

                    case 2:
                        string tk1 = WrmChargenCommon.FormatToColumn(this.longestTalentName, talentQueue.Dequeue().Name);
                        string tk2 = WrmChargenCommon.FormatToColumn(this.longestTalentName, talentQueue.Dequeue().Name);
                        text.AppendFormat("{0}  {1}" + Environment.NewLine, tk1, tk2);
                        break;

                    case 3:
                        string tkl1 = WrmChargenCommon.FormatToColumn(this.longestTalentName, talentQueue.Dequeue().Name);
                        string tkl2 = WrmChargenCommon.FormatToColumn(this.longestTalentName, talentQueue.Dequeue().Name);
                        string tkl3 = WrmChargenCommon.FormatToColumn(this.longestTalentName, talentQueue.Dequeue().Name);
                        text.AppendFormat("{0}  {1}  {2}" + Environment.NewLine, tkl1, tkl2, tkl3);
                        break;
                    }
                }
            }
            catch
            {
            }

            text.Append(Environment.NewLine);
            return(text.ToString());
        }
Exemplo n.º 6
0
        private void FormatRaceText()
        {
            var raceQueue = new Queue <GameRace>();
            var text      = new StringBuilder();
            int rows      = this.gameRaces.Count / 4;

            foreach (var gameRace in this.gameRaces)
            {
                // Find out what skill name is the longest
                if (gameRace.Name.Length > this.longestRaceName)
                {
                    this.longestRaceName = gameRace.Name.Length;
                }

                raceQueue.Enqueue(gameRace);
            }

            try
            {
                for (int i = 0; i < rows; i++)
                {
                    string race1 = WrmChargenCommon.FormatToColumn(this.longestRaceName, raceQueue.Dequeue().Name);
                    string race2 = WrmChargenCommon.FormatToColumn(this.longestRaceName, raceQueue.Dequeue().Name);
                    string race3 = WrmChargenCommon.FormatToColumn(this.longestRaceName, raceQueue.Dequeue().Name);
                    string race4 = WrmChargenCommon.FormatToColumn(this.longestRaceName, raceQueue.Dequeue().Name);
                    text.AppendFormat("{0}  {1}  {2}  {3}" + Environment.NewLine, race1, race2, race3, race4);
                }

                if ((this.gameRaces.Count % 4) > 0)
                {
                    int columns = this.gameRaces.Count - (rows * 4);

                    switch (columns)
                    {
                    case 1:
                        string racecolumn1 = WrmChargenCommon.FormatToColumn(this.longestRaceName, raceQueue.Dequeue().Name);
                        text.AppendFormat("{0}" + Environment.NewLine, racecolumn1);
                        break;

                    case 2:
                        string rc   = WrmChargenCommon.FormatToColumn(this.longestRaceName, raceQueue.Dequeue().Name);
                        string rcc1 = WrmChargenCommon.FormatToColumn(this.longestRaceName, raceQueue.Dequeue().Name);
                        text.AppendFormat("{0}  {1}" + Environment.NewLine, rc, rcc1);
                        break;

                    case 3:
                        string rc1 = WrmChargenCommon.FormatToColumn(this.longestRaceName, raceQueue.Dequeue().Name);
                        string rc2 = WrmChargenCommon.FormatToColumn(this.longestRaceName, raceQueue.Dequeue().Name);
                        string rc3 = WrmChargenCommon.FormatToColumn(this.longestRaceName, raceQueue.Dequeue().Name);
                        text.AppendFormat("{0}  {1}  {2}" + Environment.NewLine, rc1, rc2, rc3);
                        break;
                    }
                }
            }
            catch (Exception)
            {
            }

            text.Append(Environment.NewLine);

            this.formattedRaces = text.ToString();
        }
Exemplo n.º 7
0
        private void FormatSkillText()
        {
            var skillQueue = new Queue();
            var game       = GameSystemController.Instance;
            var text       = new StringBuilder();
            int rows       = game.GameSkills.Count / 4;

            foreach (var gameSkill in game.GameSkills)
            {
                // Find out what skill name is the longest
                if (gameSkill.Name.Length > this.longestSkillName)
                {
                    this.longestSkillName = gameSkill.Name.Length;
                }

                skillQueue.Enqueue(gameSkill);
            }

            try
            {
                for (int i = 0; i < rows; i++)
                {
                    string skill1 = WrmChargenCommon.FormatToColumn(this.longestSkillName, ((GameSkill)skillQueue.Dequeue()).Name);
                    string skill2 = WrmChargenCommon.FormatToColumn(this.longestSkillName, ((GameSkill)skillQueue.Dequeue()).Name);
                    string skill3 = WrmChargenCommon.FormatToColumn(this.longestSkillName, ((GameSkill)skillQueue.Dequeue()).Name);
                    string skill4 = WrmChargenCommon.FormatToColumn(this.longestSkillName, ((GameSkill)skillQueue.Dequeue()).Name);
                    text.AppendFormat("{0}  {1}  {2}  {3}" + Environment.NewLine, skill1, skill2, skill3, skill4);
                }

                if ((game.GameSkills.Count % 4) > 0)
                {
                    int columns = game.GameSkills.Count - (rows * 4);

                    switch (columns)
                    {
                    case 1:
                        string skillcolumn1 = WrmChargenCommon.FormatToColumn(this.longestSkillName, ((GameSkill)skillQueue.Dequeue()).Name);
                        text.AppendFormat("{0}" + Environment.NewLine, skillcolumn1);
                        break;

                    case 2:
                        string sk  = WrmChargenCommon.FormatToColumn(this.longestSkillName, ((GameSkill)skillQueue.Dequeue()).Name);
                        string sk1 = WrmChargenCommon.FormatToColumn(this.longestSkillName, ((GameSkill)skillQueue.Dequeue()).Name);
                        text.AppendFormat("{0}  {1}" + Environment.NewLine, sk, sk);
                        break;

                    case 3:
                        string skl1 = WrmChargenCommon.FormatToColumn(this.longestSkillName, ((GameSkill)skillQueue.Dequeue()).Name);
                        string skl2 = WrmChargenCommon.FormatToColumn(this.longestSkillName, ((GameSkill)skillQueue.Dequeue()).Name);
                        string skl3 = WrmChargenCommon.FormatToColumn(this.longestSkillName, ((GameSkill)skillQueue.Dequeue()).Name);
                        text.AppendFormat("{0}  {1}  {2}" + Environment.NewLine, skl1, skl2, skl3);
                        break;
                    }
                }
            }
            catch
            {
            }

            text.Append(Environment.NewLine);

            this.formattedSkills = text.ToString();
        }