public void BuildClusters(List<Program.Item> items) { List<Cluster>[] Clusters = new List<Cluster>[13] { new List<Cluster>(), new List<Cluster>(), new List<Cluster>(), new List<Cluster>(), new List<Cluster>(), new List<Cluster>(), new List<Cluster>(), new List<Cluster>(), new List<Cluster>(), new List<Cluster>(), new List<Cluster>(), new List<Cluster>(), new List<Cluster>() }; List<Cluster>[] RefinedClusters = new List<Cluster>[13] { new List<Cluster>(), new List<Cluster>(), new List<Cluster>(), new List<Cluster>(), new List<Cluster>(), new List<Cluster>(), new List<Cluster>(), new List<Cluster>(), new List<Cluster>(), new List<Cluster>(), new List<Cluster>(), new List<Cluster>(), new List<Cluster>() }; bool isRefined = false; foreach (Program.Item item in items) { Cluster cluster = new Cluster(); if (Regex.IsMatch(item.Name, "Faded", RegexOptions.IgnoreCase)) { cluster.Type = "Faded"; } else if (Regex.IsMatch(item.Name, "Bright", RegexOptions.IgnoreCase)) { cluster.Type = "Bright"; } else if (Regex.IsMatch(item.Name, "Shiny", RegexOptions.IgnoreCase)) { cluster.Type = "Shining"; } if (item.QL == 300) { isRefined = true; cluster.MaxQL = 300; cluster.Name = item.Name; cluster.HighID = item.AOID; cluster.LowID = item.AOID - 1; cluster.Location = Regex.Match(item.Name, @"\(.*\)", RegexOptions.IgnoreCase).Value.Trim(new char[] { '(', ')' }); string skill = Regex.Match(item.Name, @".*Refined", RegexOptions.IgnoreCase).Value; cluster.Skill = skill.Remove(skill.Count() - 8).Trim(); if (Regex.IsMatch(cluster.Name, "NanoCluster of Nano Regeneration", RegexOptions.IgnoreCase)) { if (Regex.IsMatch(cluster.Name, "Faded", RegexOptions.IgnoreCase)) { cluster.Location = "Feet"; cluster.Type = "Faded"; } else if (Regex.IsMatch(cluster.Name, "Bright", RegexOptions.IgnoreCase)) { cluster.Location = "Right-Arm"; cluster.Type = "Bright"; } else if (Regex.IsMatch(cluster.Name, "Shining", RegexOptions.IgnoreCase)) { cluster.Location = "Right-Wrist"; cluster.Type = "Shining"; } cluster.Skill = "Nano Regeneration"; } #region Switch switch (cluster.Location.ToLower()) { case "eye": RefinedClusters[0].Add(cluster); break; case "head": RefinedClusters[1].Add(cluster); break; case "ear": RefinedClusters[2].Add(cluster); break; case "right-arm": RefinedClusters[3].Add(cluster); break; case "chest": RefinedClusters[4].Add(cluster); break; case "left-arm": RefinedClusters[5].Add(cluster); break; case "right-wrist": RefinedClusters[6].Add(cluster); break; case "waist": RefinedClusters[7].Add(cluster); break; case "left-wrist": RefinedClusters[8].Add(cluster); break; case "right-hand": RefinedClusters[9].Add(cluster); break; case "leg": RefinedClusters[10].Add(cluster); break; case "left-hand": RefinedClusters[11].Add(cluster); break; case "feet": RefinedClusters[12].Add(cluster); break; } #endregion } else if (item.QL == 200) { isRefined = false; cluster.MaxQL = 200; cluster.Name = item.Name; cluster.HighID = item.AOID; cluster.LowID = item.AOID - 1; cluster.Location = Regex.Match(item.Name, @"\(.*\)", RegexOptions.IgnoreCase).Value.Trim(new char[] { '(', ')' }); if (!Regex.IsMatch(item.Name, "Jobe", RegexOptions.IgnoreCase)) { string skill = Regex.Match(item.Name, @".*Cluster", RegexOptions.IgnoreCase).Value; cluster.Skill = skill.Remove(skill.Count() - 7).Trim(); } else { cluster.isJobe = true; string skill = Regex.Match(item.Name, @".*Jobe Cluster", RegexOptions.IgnoreCase).Value; cluster.Skill = skill.Remove(skill.Count() - 12).Trim(); } if (Regex.IsMatch(cluster.Name, "NanoCluster of Nano Regeneration", RegexOptions.IgnoreCase)) { if (Regex.IsMatch(cluster.Name, "Faded", RegexOptions.IgnoreCase)) { cluster.Location = "Feet"; cluster.Type = "Faded"; } else if (Regex.IsMatch(cluster.Name, "Bright", RegexOptions.IgnoreCase)) { cluster.Location = "Right-Arm"; cluster.Type = "Bright"; } else if (Regex.IsMatch(cluster.Name, "Shining", RegexOptions.IgnoreCase)) { cluster.Location = "Right-Wrist"; cluster.Type = "Shining"; } cluster.Skill = "Nano Regeneration"; } #region Switch switch (cluster.Location.ToLower()) { case "eye": Clusters[0].Add(cluster); break; case "head": Clusters[1].Add(cluster); break; case "ear": Clusters[2].Add(cluster); break; case "right-arm": Clusters[3].Add(cluster); break; case "chest": Clusters[4].Add(cluster); break; case "left-arm": Clusters[5].Add(cluster); break; case "right-wrist": Clusters[6].Add(cluster); break; case "waist": Clusters[7].Add(cluster); break; case "left-wrist": Clusters[8].Add(cluster); break; case "right-hand": Clusters[9].Add(cluster); break; case "leg": Clusters[10].Add(cluster); break; case "left-hand": Clusters[11].Add(cluster); break; case "feet": Clusters[12].Add(cluster); break; } #endregion } } if (!isRefined) { Program.EyeClusters = Clusters[0]; Program.HeadClusters = Clusters[1]; Program.EarClusters = Clusters[2]; Program.RightArmClusters = Clusters[3]; Program.ChestClusters = Clusters[4]; Program.LeftArmClusters = Clusters[5]; Program.RightWristClusters = Clusters[6]; Program.WaistClusters = Clusters[7]; Program.LeftWristClusters = Clusters[8]; Program.RightHandClusters = Clusters[9]; Program.LegClusters = Clusters[10]; Program.LeftHandClusters = Clusters[11]; Program.FeetClusters = Clusters[12]; } if (isRefined) { Program.RefinedEyeClusters = RefinedClusters[0]; Program.RefinedHeadClusters = RefinedClusters[1]; Program.RefinedEarClusters = RefinedClusters[2]; Program.RefinedRightArmClusters = RefinedClusters[3]; Program.RefinedChestClusters = RefinedClusters[4]; Program.RefinedLeftArmClusters = RefinedClusters[5]; Program.RefinedRightWristClusters = RefinedClusters[6]; Program.RefinedWaistClusters = RefinedClusters[7]; Program.RefinedLeftWristClusters = RefinedClusters[8]; Program.RefinedRightHandClusters = RefinedClusters[9]; Program.RefinedLegClusters = RefinedClusters[10]; Program.RefinedLeftHandClusters = RefinedClusters[11]; Program.RefinedFeetClusters = RefinedClusters[12]; } }
public Tradeskill(Cluster cluster, Implant implant, Implant result) { StreamWriter sw = new StreamWriter(Environment.CurrentDirectory + @"\implants.txt", true, Encoding.GetEncoding("windows-1252")); sw.AutoFlush = true; string skills = "160"; string percent = string.Empty; string bump = ""; switch (cluster.Type) { case "Faded": if (cluster.isJobe == true) bump = "200"; else bump = "100"; break; case "Bright": if (cluster.isJobe == true) bump = "300"; else bump = "200"; break; case "Shining": if (cluster.isJobe == true) bump = "400"; else bump = "300"; break; } int minxp = 50; int maxxp = 50; int range; var l1 = from m in NPMult where m.Key == cluster.Skill select m; var l2 = from m in Type where m.Key == cluster.Type select m; percent = Math.Round(l1.ElementAt(0).Value * l2.ElementAt(0).Value).ToString(); if (cluster.MaxQL == 200) { minxp = 5; maxxp = 1000; } else { minxp = 1005; maxxp = 1500; } if (cluster.Type == "Faded") { range = 18; } else if (cluster.Type == "Bright") { range = 16; } else { range = 14; } // COLS: // SrcHighID // TgtHighID // SrcName // TgtName // ResName // ResLowID // ResHighID // SkillsIds // SkillReqs // SkillBumps // MaxBump // MinXP // MaxXP switch (cluster.Skill) { case "% Add All Def.": case "% Add All Off": case "% Add. Xp": case "Nano Formula Interrupt Modifier": case "Skill Time Lock Modifier": { if (cluster.Type == "Faded") { skills += ",162"; percent += ",325"; bump += "," + bump; } else if (cluster.Type == "Bright") { skills += ",162"; percent += ",475"; bump += "," + bump; } else if (cluster.Type == "Shining") { skills += ",162"; percent += ",625"; bump += "," + bump; } } break; case "% Add. Chem. Dam.": case "% Add. Energy Dam.": case "% Add. Fire Dam.": case "% Add. Melee Dam.": case "% Add. Poison Dam.": case "% Add. Proj. Dam.": case "% Add.Rad. Dam.": case "Shield Chemical AC": case "Shield Cold AC": case "Shield Energy AC": case "Shield Fire AC": case "Shield Melee AC": case "Shield Poison AC": case "Shield Projectile AC": case "Shield Radiation AC": case "Nano Point Cost Modifier": { if (cluster.Type == "Faded") { skills += ",157"; percent += ",325"; bump += "," + bump; } else if (cluster.Type == "Bright") { skills += ",157"; percent += ",475"; bump += "," + bump; } else if (cluster.Type == "Shining") { skills += ",157"; percent += ",625"; bump += "," + bump; } } break; case "Heal Delta": { if (cluster.Type == "Faded") { skills += ",159"; percent += ",325"; bump += "," + bump; } else if (cluster.Type == "Bright") { skills += ",159"; percent += ",475"; bump += "," + bump; } else if (cluster.Type == "Shining") { skills += ",159"; percent += ",625"; bump += "," + bump; } } break; case "Nano Regeneration": { if (cluster.Type == "Faded") { skills += ",159"; percent += ",275"; bump += "," + bump; } else if (cluster.Type == "Bright") { skills += ",159"; percent += ",400"; bump += "," + bump; } else if (cluster.Type == "Shining") { skills += ",159"; percent += ",525"; bump += "," + bump; } } break; case "Max NCU": { if (cluster.Type == "Faded") { skills += ",161"; percent += ",325"; bump += "," + bump; } else if (cluster.Type == "Bright") { skills += ",161"; percent += ",475"; bump += "," + bump; } else if (cluster.Type == "Shining") { skills += ",161"; percent += ",625"; bump += "," + bump; } } break; case "RangeInc. NF": { if (cluster.Type == "Faded") { skills = "160"; percent = "325"; } else if (cluster.Type == "Bright") { skills = "160"; percent = "475"; } else if (cluster.Type == "Shining") { skills = "160"; percent = "625"; } } break; case "RangeInc. Weapon": { // WS if (cluster.Type == "Faded") { skills += ",158"; percent += ",325"; bump += "," + bump; } else if (cluster.Type == "Bright") { skills += ",158"; percent += ",475"; bump += "," + bump; } else if (cluster.Type == "Shining") { skills += ",158"; percent += ",625"; bump += "," + bump; } } break; default: break; } sw.WriteLine("INSERT INTO `tradeskill` VALUES (" + cluster.HighID + "," + implant.HighID + ",0," + "\'" + result.LowID + "," + result.HighID + "\'," + range + ",3,\"" + skills + "\",\"" + percent + "\",\"" + bump + "\",5," + minxp + "," + maxxp + ",1);"); sw.Close(); sw.Dispose(); }
static void Main(string[] args) { XmlReader reader = XmlReader.Create(new FileStream(Environment.CurrentDirectory + @"\Items.xml", FileMode.Open, FileAccess.Read)); while (reader.Read()) { if (reader.Name == "Item") { Item item = new Item(); reader.MoveToAttribute("AOID"); item.AOID = Convert.ToInt32(reader.Value); reader.MoveToAttribute("Name"); item.Name = reader.Value; reader.MoveToAttribute("QL"); item.QL = Convert.ToInt32(reader.Value); reader.MoveToAttribute("ItemType"); item.Type = reader.Value; while (reader.Read()) { if (reader.Name == "Description") { item.Description = reader.ReadElementString(); if (item.Type == "Implant") { if (Regex.IsMatch(item.Description, "Shining NanoCluster", RegexOptions.IgnoreCase)) { if (Regex.IsMatch(item.Name, "Refined", RegexOptions.IgnoreCase)) { RefinedImplants.Add(item); } else Implants.Add(item); } } else if (item.Type == "Misc" && Regex.IsMatch(item.Description, "can be used with any.*?implant", RegexOptions.IgnoreCase)) { if (Regex.IsMatch(item.Name, "Refined", RegexOptions.IgnoreCase)) { RefinedClusters.Add(item); } else Clusters.Add(item); } break; } } while (reader.Name != "Item") { reader.Read(); } } } Cluster c = new Cluster(); c.BuildClusters(Clusters); c.BuildClusters(RefinedClusters); Implant i = new Implant(); i.BuildImplants(Implants); i.BuildImplants(RefinedImplants); Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("==============CLUSTERS=============="); Console.WriteLine(); Console.WriteLine("Eye Clusters:\t\t\t{0}", EyeClusters.Count); Console.WriteLine("Refined Eye Clusters:\t\t{0}", RefinedEyeClusters.Count); Console.WriteLine("Head Clusters:\t\t\t{0}", HeadClusters.Count); Console.WriteLine("Refined Head Clusters:\t\t{0}", RefinedHeadClusters.Count); Console.WriteLine("Ear Clusters:\t\t\t{0}", EarClusters.Count); Console.WriteLine("Refined Ear Clusters:\t\t{0}", RefinedEarClusters.Count); Console.WriteLine("Right-Arm Clusters:\t\t{0}", RightArmClusters.Count); Console.WriteLine("Refined Right-Arm Clusters:\t{0}", RefinedRightArmClusters.Count); Console.WriteLine("Chest Clusters:\t\t\t{0}", ChestClusters.Count); Console.WriteLine("Refined Chest Clusters:\t\t{0}", RefinedChestClusters.Count); Console.WriteLine("Left-Arm Clusters:\t\t{0}", LeftArmClusters.Count); Console.WriteLine("Refined Left-Arm Clusters:\t{0}", RefinedLeftArmClusters.Count); Console.WriteLine("Right-Wrist Clusters:\t\t{0}", RightWristClusters.Count); Console.WriteLine("Refined Right-Wrist Clusters:\t{0}", RefinedRightWristClusters.Count); Console.WriteLine("Waist Clusters:\t\t\t{0}", WaistClusters.Count); Console.WriteLine("Refined Waist Clusters:\t\t{0}", RefinedWaistClusters.Count); Console.WriteLine("Left-Wrist Clusters:\t\t{0}", LeftWristClusters.Count); Console.WriteLine("Refined Left-Wrist Clusters:\t{0}", RefinedLeftWristClusters.Count); Console.WriteLine("Right-Hand Clusters:\t\t{0}", RightHandClusters.Count); Console.WriteLine("Refined Right-Hand Clusters:\t{0}", RefinedRightHandClusters.Count); Console.WriteLine("Leg Clusters:\t\t\t{0}", LegClusters.Count); Console.WriteLine("Refined Leg Clusters:\t\t{0}", RefinedLegClusters.Count); Console.WriteLine("Left-Hand Clusters:\t\t{0}", LeftHandClusters.Count); Console.WriteLine("Refined Left-Hand Clusters:\t{0}", RefinedLeftHandClusters.Count); Console.WriteLine("Feet Clusters:\t\t\t{0}", FeetClusters.Count); Console.WriteLine("Refined Feet Clusters:\t\t{0}", RefinedFeetClusters.Count); Console.WriteLine(); Console.WriteLine("==============CLUSTERS=============="); Console.WriteLine(); Console.WriteLine("==============IMPLANTS=============="); Console.WriteLine(); Console.WriteLine("Eye Implants:\t\t\t{0}", EyeImplants.Count); Console.WriteLine("Refined Eye Implants:\t\t{0}", RefinedEyeImplants.Count); Console.WriteLine("Head Implants:\t\t\t{0}", HeadImplants.Count); Console.WriteLine("Refined Head Implants:\t\t{0}", RefinedHeadImplants.Count); Console.WriteLine("Ear Implants:\t\t\t{0}", EarImplants.Count); Console.WriteLine("Refined Ear Implants:\t\t{0}", RefinedEarImplants.Count); Console.WriteLine("Right-Arm Implants:\t\t{0}", RightArmImplants.Count); Console.WriteLine("Refined Right-Arm Implants:\t{0}", RefinedRightArmImplants.Count); Console.WriteLine("Chest Implants:\t\t\t{0}", ChestImplants.Count); Console.WriteLine("Refined Chest Implants:\t\t{0}", RefinedChestImplants.Count); Console.WriteLine("Left-Arm Implants:\t\t{0}", LeftArmImplants.Count); Console.WriteLine("Refined Left-Arm Implants:\t{0}", RefinedLeftArmImplants.Count); Console.WriteLine("Right-Wrist Implants:\t\t{0}", RightWristImplants.Count); Console.WriteLine("Refined Right-Wrist Implants:\t{0}", RefinedRightWristImplants.Count); Console.WriteLine("Waist Implants:\t\t\t{0}", WaistImplants.Count); Console.WriteLine("Refined Waist Implants:\t\t{0}", RefinedWaistImplants.Count); Console.WriteLine("Left-Wrist Implants:\t\t{0}", LeftWristImplants.Count); Console.WriteLine("Refined Left-Wrist Implants:\t{0}", RefinedLeftWristImplants.Count); Console.WriteLine("Right-Hand Implants:\t\t{0}", RightHandImplants.Count); Console.WriteLine("Refined Right-Hand Implants:\t{0}", RefinedRightHandImplants.Count); Console.WriteLine("Leg Implants:\t\t\t{0}", LegImplants.Count); Console.WriteLine("Refined Leg Implants:\t\t{0}", RefinedLegImplants.Count); Console.WriteLine("Left-Hand Implants:\t\t{0}", LeftHandImplants.Count); Console.WriteLine("Refined Left-Hand Implants:\t{0}", RefinedLeftHandImplants.Count); Console.WriteLine("Feet Implants:\t\t\t{0}", FeetImplants.Count); Console.WriteLine("Refined Feet Implants:\t\t{0}", RefinedFeetImplants.Count); Console.WriteLine(); Console.WriteLine("==============IMPLANTS=============="); Console.ResetColor(); Console.WriteLine(); Builder.Disassemble(EyeImplants); Builder.Disassemble(HeadImplants); Builder.Disassemble(EarImplants); Builder.Disassemble(RightArmImplants); Builder.Disassemble(ChestImplants); Builder.Disassemble(LeftArmImplants); Builder.Disassemble(RightWristImplants); Builder.Disassemble(WaistImplants); Builder.Disassemble(LeftWristImplants); Builder.Disassemble(RightHandImplants); Builder.Disassemble(LegImplants); Builder.Disassemble(LeftHandImplants); Builder.Disassemble(FeetImplants); Builder.PopulateDictionary(); Tradeskill.PopulateTypes(); Tradeskill.PopulateNanoProgrammingMultiplier(); //Builder.Build(EyeClusters, EyeImplants); //Builder.Build(RefinedEyeClusters, RefinedEyeImplants); //Builder.Build(HeadClusters, HeadImplants); //Builder.Build(RefinedHeadClusters, RefinedHeadImplants); //Builder.Build(EarClusters, EarImplants); //Builder.Build(RefinedEarClusters, RefinedEarImplants); //Builder.Build(RightArmClusters, RightArmImplants); //Builder.Build(RefinedRightArmClusters, RefinedRightArmImplants); //Builder.Build(ChestClusters, ChestImplants); //Builder.Build(RefinedChestClusters, RefinedChestImplants); //Builder.Build(LeftArmClusters, LeftArmImplants); //Builder.Build(RefinedLeftArmClusters, RefinedLeftArmImplants); //Builder.Build(RightWristClusters, RightWristImplants); //Builder.Build(RefinedRightWristClusters, RefinedRightWristImplants); //Builder.Build(WaistClusters, WaistImplants); //Builder.Build(RefinedWaistClusters, RefinedWaistImplants); //Builder.Build(LeftWristClusters, LeftWristImplants); //Builder.Build(RefinedLeftWristClusters, RefinedLeftWristImplants); //Builder.Build(RightHandClusters, RightHandImplants); //Builder.Build(RefinedRightHandClusters, RefinedRightHandImplants); //Builder.Build(LegClusters, LegImplants); //Builder.Build(RefinedLegClusters, RefinedLegImplants); //Builder.Build(LeftHandClusters, LeftHandImplants); //Builder.Build(RefinedLeftHandClusters, RefinedLeftHandImplants); //Builder.Build(FeetClusters, FeetImplants); //Builder.Build(RefinedFeetClusters, RefinedFeetImplants); Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("\nComplete..."); Console.ResetColor(); reader.Close(); Console.ReadLine(); }