public static string exportLootTemplates(List <Loot> templates) { string output = "// File generated by Pol-Item-lootgroups tool\r\n\r\n\r\n"; foreach (var template in templates) { output += "lootgroup " + template.Name + "\r\n"; output += "{\r\n"; // check if there is gold and if it's valid if (Dice.isValidDiceString(template.Gold)) { output += "\t// gold \r\n"; output += "\tgold\t" + template.Gold + "\r\n"; } output += "\r\n\t// general loot variables\r\n"; if (template.MagicQuality > 0) { output += "\tmagic_quality\t" + template.MagicQuality.ToString() + "\r\n"; } if (template.ChestChance > 0) { output += "\tchest_chance\t" + template.ChestChance + "\r\n"; output += "\tchest_quality\t" + template.ChestQuality + "\r\n"; } // add specific items if (template.items.Count() > 0) { output += "\r\n\t// specific items\r\n"; foreach (var item in template.items) { if (Dice.isValidDiceString(item.UpToHowMuchDropped)) { output += "\tItem\t" + item.Name + "\t" + item.UpToHowMuchDropped + "\t" + item.ChanceOfDropPerItem + "\r\n"; } } } if (template.randItemFromGroup.Count() > 0) { output += "\r\n\t// random items out of group\r\n"; foreach (var item in template.randItemFromGroup) { if (Dice.isValidDiceString(item.UpToHowMuchDropped)) { output += "\tRandom\t" + item.Name + "\t" + item.UpToHowMuchDropped + "\t" + item.ChanceOfDropPerItem.ToString() + "\r\n"; } } } if (template.randMagicItemFromGroup.Count > 0) { output += "\r\n\t// random magic items out of group\r\n"; foreach (var item in template.randMagicItemFromGroup) { output += "\tmagic_group\t" + item.Name + "\t" + item.ChanceOfDrop.ToString() + "\r\n"; } } if (template.skillBooks.Count > 0) { output += "\r\n\t// skillbooks \r\n"; foreach (var book in template.skillBooks) { output += "\tskillbook\t" + book.skillTier.ToString() + "\t" + book.ChanceOfDrop.ToString() + "\r\n"; } } if (template.cutUps.Count > 0) { output += "\r\n\t// drops when mob is cut \r\n"; foreach (var item in template.cutUps) { output += "\tcutup\t" + item.ItemName + "\t" + item.Amount + "\r\n"; } } output += "\r\n\r\n"; if (template.Head == 1) { output += "\tHead\t1\r\n"; } else { output += "\tHead\t0\r\n"; } if (template.Blood == 1) { output += "\tBlood\t1\r\n"; } else { output += "\tBlood\t0\r\n"; } output += "}\r\n\r\n"; } return(output); }