Esempio n. 1
0
        private void FinalizeWeapon(Loot loot)
        {
            int    weaponTypeRoll = RollDie(8);
            string weaponType     = "simple";

            if (weaponTypeRoll == 8)
            {
                weaponType = "racial";
            }
            else if (weaponTypeRoll == 7)
            {
                weaponType = "exotic";
            }
            else if (weaponTypeRoll > 2)
            {
                weaponType = "martial";
            }

            XmlNodeList candidates = TreasureTable.SelectNodes(string.Format("/treasure/weapons/weapon[@type='{0}']", weaponType));
            XmlNode     weapon     = RollRandomLoot(candidates);

            int enchantLimit = 0, enchantment = 0;

            EnchantmentCalculator(loot.Tier, out enchantLimit, out enchantment);

            string material  = RollMaterial(weapon, loot);
            string enchanted = loot.Enchanted ? "Enchanted " : "";

            loot.FullName = string.Format("+{0} {1}{2}{3}", enchantment, enchanted, material, weapon.InnerText.Trim());
        }
Esempio n. 2
0
        private void FinalizeWondrousItem(Loot loot, bool onlySpellcaster)
        {
            string query = string.Format("/treasure/trinkets/trinket[@tier={0}]", loot.Tier > 20 ? 20 : loot.Tier);

            if (onlySpellcaster)
            {
                query = string.Format("/treasure/trinkets/trinket[@tier={0} and @flags='S']", loot.Tier > 20 ? 20 : loot.Tier);
            }

            XmlNodeList candidates   = TreasureTable.SelectNodes(query);
            XmlNode     wondrousItem = RollRandomLoot(candidates);

            if (wondrousItem == null)
            {
                return;
            }

            loot.FullName    = wondrousItem.FirstChild.InnerText.Trim();
            loot.Description = wondrousItem.SelectSingleNode("description").InnerText.Trim();
            loot.Cost        = wondrousItem.Attributes["cost"].Value;
            switch (wondrousItem.Attributes["slot"].Value)
            {
            case "L":
                loot.Slot = "waist";
                break;

            case "B":
                loot.Slot = "feet";
                break;

            case "C":
                loot.Slot = "back";
                break;

            case "A":
                loot.Slot = "torso";
                break;

            case "G":
                loot.Slot = "hands";
                break;

            case "H":
                loot.Slot = "head";
                break;

            case "T":
                loot.Slot = "trinket";
                break;
            }
        }
Esempio n. 3
0
        private void FinalizeShield(Loot loot)
        {
            XmlNodeList candidates = TreasureTable.SelectNodes(string.Format("/treasure/shields/shield"));
            XmlNode     shield     = RollRandomLoot(candidates);

            int enchantLimit = 0, enchantment = 0;

            EnchantmentCalculator(loot.Tier, out enchantLimit, out enchantment);

            string material  = RollMaterial(shield, loot);
            string enchanted = loot.Enchanted ? "Enchanted " : "";

            loot.FullName = string.Format("+{0} {1}{2}{3}", enchantment, enchanted, material, shield.InnerText.Trim());
        }
Esempio n. 4
0
        private void FinalizeJewelry(Loot loot, bool onlySpellcaster)
        {
            string query = string.Format("/treasure/jewelry/jewel[@tier={0}]", loot.Tier > 20 ? 20 : loot.Tier);

            if (onlySpellcaster)
            {
                query = string.Format("/treasure/jewelry/jewel[@tier={0} and @flags='S']", loot.Tier > 20? 20 : loot.Tier);
            }

            XmlNodeList candidates = TreasureTable.SelectNodes(query);
            XmlNode     jewelry    = RollRandomLoot(candidates);

            if (jewelry == null)
            {
                return;
            }

            loot.FullName    = jewelry.FirstChild.InnerText.Trim();
            loot.Description = jewelry.SelectSingleNode("description").InnerText.Trim();
            loot.Cost        = jewelry.Attributes["cost"].Value;
        }