Пример #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 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 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 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.";
        }
Пример #2
0
        private void AddArmorNode(string itemName, CLIB.Armor 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);
        }
Пример #3
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 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 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 armor = LIB.m_MainCharacterInfo.Armor[key];
                LIB.m_MainCharacterInfo.CarryingWeight += armor.Weight * armor.Quantity;
            }
        }
Пример #4
0
        private void GatherArmorData(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 item = new CLIB.Armor
                {
                    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),
                    Quantity     = Convert.ToInt32(armorNode.SelectSingleNode(LC.Quantity).InnerText)
                };
                m_ArmorData.Add(name, item);
            }
        }
Пример #5
0
 private void PopulateGrid(Dictionary <string, CLIB.Armor> ArmorDictionary, Dictionary <string, CLIB.Weapon> WeaponDictionary)
 {
     BuyEquipment_Grid.Rows.Clear();
     if (ArmorDictionary.Keys.Count > 0)
     {
         foreach (var key in ArmorDictionary.Keys)
         {
             CLIB.Armor 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 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);
         }
     }
 }