예제 #1
0
        public static void DumpItems()
        {
            StringBuilder total = new StringBuilder();

            foreach (var kvp in DataBuffer.EquipBuffer.OrderBy(x => x.Key))
            {
                if (kvp.Key >= 1000000 && kvp.Value.Name != null && kvp.Value.Name.Length > 0)
                {
                    total.Append(kvp.Key);
                    total.Append("|");
                    total.Append(kvp.Value.Name.Replace("\n", ""));
                    total.Append(Environment.NewLine);
                }
            }
            foreach (var kvp in DataBuffer.ItemBuffer.OrderBy(x => x.Key))
            {
                if (kvp.Key >= 1000000 && kvp.Value.Name != null && kvp.Value.Name.Length > 0)
                {
                    total.Append(kvp.Key);
                    total.Append("|");
                    total.Append(kvp.Value.Name.Replace("\n", ""));
                    total.Append(Environment.NewLine);
                }
            }
            FileLogging.Log("items.txt", total.ToString());
            ServerConsole.Info("Finished dumping items");
        }
예제 #2
0
        /// <summary>
        /// Dumps all skill names and ID's sorted and categorized by job to a txt file.
        /// </summary>
        public static void DumpSkillConstants()
        {
            StringBuilder total = new StringBuilder();

            foreach (var kvp in JobConstants.JobIdNamePairs)
            {
                total.Append("    public static class " + kvp.Value + "\n    {\n");
                Dictionary <string, int> skills    = new Dictionary <string, int>();
                List <WzCharacterSkill>  jobSkills = DataBuffer.GetCharacterSkillListByJob(kvp.Key);
                jobSkills = jobSkills.OrderBy(x => x.SkillId % 1000).ToList();
                foreach (var skill in jobSkills)
                {
                    if (skill.Name == null || skill.Name.Length == 0)
                    {
                        continue;
                    }
                    string newName = skill.Name;
                    int    count   = 0;
                    while (skills.ContainsKey(newName))
                    {
                        if (int.TryParse(newName.Substring(newName.Length - 1, 1), out count))
                        {
                            count++;
                            newName = newName.Substring(0, newName.Length - 1) + count.ToString();
                        }
                        else
                        {
                            newName += "2";
                        }
                    }
                    skills.Add(newName, skill.SkillId);
                }
                foreach (var skill in skills)
                {
                    total.Append("        public const int " + skill.Key.ToUpper().Replace(' ', '_').Replace('-', '_').Replace("+", "").Replace('/', '_').Replace(@"'", "").Replace(",", "").Replace(":", "").Replace("(", "").Replace(")", "").Replace("_-_", "_").Replace("__", "_").Replace("__", "_") + " = " + skill.Value + ";\n");
                }
                total.Append("    }\n\n");
            }
            FileLogging.Log("skills.txt", total.ToString());
            ServerConsole.Info("Finished dumping SkillConstants.");
        }