Esempio n. 1
0
        private static void WriteSpellLinesMethod()
        {
            writer.WriteLine("SpellLine[] lines;");
            writer.WriteLine();

            for (var i = 0; i < Maps.Length; i++)
            {
                var map  = Maps[i];
                var clss = (ClassId)i;

                if (map != null)
                {
                    var listCount = map.Count;
                    var s         = 0;

                    writer.WriteMap((clss != 0 ? clss.ToString() : "Other") + " (" + listCount + ")");
                    writer.WriteLine("lines = new SpellLine[]");
                    writer.OpenBracket();

                    foreach (var set in map.Values)
                    {
                        var spells   = set.ToList();
                        var lineName = GetSpellLineName(spells.First());

                        spells.Sort((a, b) => a.Id.CompareTo(b.Id));                                    // first sort by rank and then by id
                        spells.Sort((a, b) => a.Rank.CompareTo(b.Rank));

                        writer.WriteLine("new SpellLine(SpellLineId." + lineName + ", ");
                        writer.IndentLevel++;
                        var j = 0;
                        foreach (var spell in spells)
                        {
                            j++;
                            writer.WriteIndent("SpellHandler.Get(SpellId." + spell.SpellId + ")");
                            if (j < set.Count)
                            {
                                writer.WriteLine(",");
                            }
                        }
                        writer.IndentLevel--;
                        writer.Write(")");
                        if (s < listCount - 1)
                        {
                            writer.WriteLine(",");
                        }
                        ++s;
                    }
                    writer.CloseBracket(true);
                    writer.WriteLine("AddSpellLines(ClassId.{0}, lines);", clss);
                    writer.WriteEndMap();
                    writer.WriteLine();
                }
            }
        }