Exemplo 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 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.";
        }
Exemplo n.º 2
0
        private void AddItemNode(string itemName, CLIB.Item item)
        {
            var itemNode =
                new XElement(LC.Item,
                             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));

            itemNodes.Add(itemNode);
        }
 private void PopulateGrid(Dictionary <string, CLIB.Item> ItemDictionary)
 {
     BuyItems_Grid.Rows.Clear();
     foreach (var key in ItemDictionary.Keys)
     {
         CLIB.Item item = ItemDictionary[key];
         if (item.Cost != string.Empty)
         {
             object[] param = { false, item.Style, key, item.Quantity, item.Cost, item.Weight + " lb.", item.Description };
             BuyItems_Grid.Rows.Add(param);
         }
     }
 }
Exemplo n.º 4
0
        private void GatherItemData(XmlDocument xDoc)
        {
            XmlNode     itemsNode = xDoc.GetElementsByTagName(LC.Items)[0];
            XmlNodeList items     = itemsNode.SelectNodes(LC.Item);

            foreach (XmlNode itemNode in items)
            {
                string    name = itemNode.SelectSingleNode(LC.Name).InnerText;
                CLIB.Item item = new CLIB.Item
                {
                    Cost        = itemNode.SelectSingleNode(LC.Cost).InnerText,
                    Weight      = Convert.ToDouble(itemNode.SelectSingleNode(LC.Weight).InnerText),
                    Style       = itemNode.SelectSingleNode(LC.Style).InnerText,
                    Description = itemNode.SelectSingleNode(LC.Description).InnerText,
                    Quantity    = Convert.ToInt32(itemNode.SelectSingleNode(LC.Quantity).InnerText)
                };
                m_ItemData.Add(name, item);
            }
        }
Exemplo 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 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;
            }
        }