Esempio n. 1
0
        /// <summary>
        /// This Method updates the Equipment and Items Grids
        /// </summary>
        private void UpdateGrids()
        {
            Item_Grid.Rows.Clear();
            Equipment_Grid.Rows.Clear();
            LIB.m_MainCharacterInfo.CarryingWeight = 0;
            foreach (var key in LIB.m_MainCharacterInfo.Items.Keys)
            {
                CLIB.Item_Class item  = LIB.m_MainCharacterInfo.Items[key];
                object[]        param = { item.Style, key, item.Quantity, item.Cost, item.Weight + " lb.", item.Description };
                Item_Grid.Rows.Add(param);
            }

            foreach (var key in LIB.m_MainCharacterInfo.Weapons.Keys)
            {
                CLIB.Weapon_Class weapon     = LIB.m_MainCharacterInfo.Weapons[key];
                string            properties = string.Join(", ", weapon.Properties.ToArray());
                object[]          param      = { weapon.Equipped, weapon.Style, key, weapon.Quantity, weapon.Cost, weapon.Damage, string.Empty, weapon.Weight + " lb.", properties };
                Equipment_Grid.Rows.Add(param);
            }

            foreach (var key in LIB.m_MainCharacterInfo.Armor.Keys)
            {
                CLIB.Armor_Class armor      = LIB.m_MainCharacterInfo.Armor[key];
                string           properties = string.Format(LC.ArmorProperties, armor.StrengthReq, armor.Disadvantage);
                object[]         param      = { armor.Equipped, armor.Style, key, armor.Quantity, armor.Cost, string.Empty, armor.ArmorClass, armor.Weight + " lb.", properties };
                Equipment_Grid.Rows.Add(param);
            }
            CALC.CarryWeight();
            Carry_TextBox.Text = LIB.m_MainCharacterInfo.CarryingWeight + " / " + LIB.m_MainCharacterInfo.CarryingCapacity + " lb.";
        }
        /// <summary>
        /// This Method updates the Equipment and Items Grids
        /// </summary>
        private void UpdateGrids()
        {
            Item_Grid.Rows.Clear();
            Equipment_Grid.Rows.Clear();
            foreach (var key in LIB.m_MainCharacterInfo.Item_List)
            {
                CLIB.Item_Class item  = LIB.m_MainCharacterInfo.Items[key];
                object[]        param = { key, item.Cost, item.Weight, item.Description };
                Item_Grid.Rows.Add(param);
            }

            foreach (var key in LIB.m_MainCharacterInfo.Weapon_List)
            {
                CLIB.Weapon_Class weapon = LIB.m_MainCharacterInfo.Weapons[key];

                string properties = string.Join(", ", weapon.Properties.ToArray());

                object[] param = { weapon.Equipped, "Weapon", key, weapon.Cost, weapon.Damage, string.Empty, weapon.Weight + " lb.", properties };
                Equipment_Grid.Rows.Add(param);
            }

            foreach (var key in LIB.m_MainCharacterInfo.Armor_List)
            {
                CLIB.Armor_Class armor      = LIB.m_MainCharacterInfo.Armor[key];
                string           properties = "Strength Required: " + armor.StrengthReq + Environment.NewLine + "Stealth Disadvantage: " + armor.Disadvantage;
                object[]         param      = { armor.Equipped, "Armor", key, armor.Cost, string.Empty, armor.ArmorClass, armor.Weight + " lb.", properties };
                Equipment_Grid.Rows.Add(param);
            }
        }
Esempio n. 3
0
        private void AddArmorNode(string itemName, CLIB.Armor_Class item)
        {
            var itemNode =
                new XElement(LC.Armor,
                             new XElement(LC.Name, itemName),
                             new XElement(LC.Cost, item.Cost),
                             new XElement(LC.Weight, item.Weight),
                             new XElement(LC.Style, item.Style),
                             new XElement(LC.Description, item.Description),
                             new XElement(LC.Quantity, item.Quantity),
                             new XElement(LC.ArmorClass, item.ArmorClass),
                             new XElement(LC.StrengthReq, item.StrengthReq),
                             new XElement(LC.Disadvantage, item.Disadvantage),
                             new XElement(LC.Equipped, item.Equipped));

            itemNodes.Add(itemNode);
        }
Esempio n. 4
0
        private void PopulateArmor(XmlDocument xDoc)
        {
            XmlNode     itemsNode = xDoc.GetElementsByTagName(LC.Items)[0];
            XmlNodeList armor     = itemsNode.SelectNodes(LC.Armor);

            foreach (XmlNode armorNode in armor)
            {
                string           name = armorNode.SelectSingleNode(LC.Name).InnerText;
                CLIB.Armor_Class item = new CLIB.Armor_Class
                {
                    Cost         = armorNode.SelectSingleNode(LC.Cost).InnerText,
                    Weight       = Convert.ToDouble(armorNode.SelectSingleNode(LC.Weight).InnerText),
                    Style        = armorNode.SelectSingleNode(LC.Style).InnerText,
                    Equipped     = Convert.ToBoolean(armorNode.SelectSingleNode(LC.Equipped).InnerText),
                    ArmorClass   = armorNode.SelectSingleNode(LC.ArmorClass).InnerText,
                    StrengthReq  = Convert.ToInt32(armorNode.SelectSingleNode(LC.StrengthReq).InnerText),
                    Disadvantage = Convert.ToBoolean(armorNode.SelectSingleNode(LC.Disadvantage).InnerText)
                };
                m_ArmorData.Add(name, item);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// This method calculates the characters carrying weight
        /// </summary>
        public static void CarryWeight()
        {
            LIB.m_MainCharacterInfo.CarryingWeight = 0;
            foreach (var key in LIB.m_MainCharacterInfo.Items.Keys)
            {
                CLIB.Item_Class item = LIB.m_MainCharacterInfo.Items[key];
                LIB.m_MainCharacterInfo.CarryingWeight += item.Weight * item.Quantity;
            }

            foreach (var key in LIB.m_MainCharacterInfo.Weapons.Keys)
            {
                CLIB.Weapon_Class weapon = LIB.m_MainCharacterInfo.Weapons[key];
                LIB.m_MainCharacterInfo.CarryingWeight += weapon.Weight * weapon.Quantity;
            }

            foreach (var key in LIB.m_MainCharacterInfo.Armor.Keys)
            {
                CLIB.Armor_Class armor = LIB.m_MainCharacterInfo.Armor[key];
                LIB.m_MainCharacterInfo.CarryingWeight += armor.Weight * armor.Quantity;
            }
        }
 private void PopulateGrid(Dictionary <string, CLIB.Armor_Class> ArmorDictionary, Dictionary <string, CLIB.Weapon_Class> WeaponDictionary)
 {
     BuyEquipment_Grid.Rows.Clear();
     if (ArmorDictionary.Keys.Count > 0)
     {
         foreach (var key in ArmorDictionary.Keys)
         {
             CLIB.Armor_Class armor      = ArmorDictionary[key];
             string           properties = string.Format(LC.ArmorProperties, armor.StrengthReq, armor.Disadvantage);
             object[]         param      = { false, armor.Style, key, armor.Quantity, armor.Cost, string.Empty, armor.ArmorClass, armor.Weight + " lb.", properties };
             BuyEquipment_Grid.Rows.Add(param);
         }
     }
     if (WeaponDictionary.Keys.Count > 0)
     {
         foreach (var key in WeaponDictionary.Keys)
         {
             CLIB.Weapon_Class weapon     = WeaponDictionary[key];
             string            properties = string.Join(", ", weapon.Properties.ToArray());
             object[]          param      = { false, weapon.Style, key, weapon.Quantity, weapon.Cost, weapon.Damage, string.Empty, weapon.Weight + " lb.", properties };
             BuyEquipment_Grid.Rows.Add(param);
         }
     }
 }