예제 #1
0
        private void Init()
        {
            tbSlot1.Text       = c.GetSlot1().ToString();
            tbSlot2.Text       = c.GetSlot2().ToString();
            tbSlot3.Text       = c.GetSlot3().ToString();
            tbSlot4.Text       = c.GetSlot4().ToString();
            tbSlot5.Text       = c.GetSlot5().ToString();
            tbSlot6.Text       = c.GetSlot6().ToString();
            tbSlot7.Text       = c.GetSlot7().ToString();
            tbSlot8.Text       = c.GetSlot8().ToString();
            tbSlot9.Text       = c.GetSlot9().ToString();
            tbLevel.Text       = c.GetLevel().ToString();
            tbEXP.Text         = c.GetExp().ToString();
            tbMaxHP.Text       = c.GetMaxHealth().ToString();
            tbCurHP.Text       = c.GetCurrentHealth().ToString();
            tbTempHP.Text      = c.GetTempHp().ToString();
            tbProficiency.Text = c.CalcProfBonus().ToString();
            rtbAppearance.Document.Blocks.Clear();
            rtbBackstory.Document.Blocks.Clear();
            rtbBonds.Document.Blocks.Clear();
            rtbIdeals.Document.Blocks.Clear();
            rtbPersonality.Document.Blocks.Clear();
            rtbArmourProfs.Document.Blocks.Clear();
            rtbWepProfs.Document.Blocks.Clear();
            rtbFlaws.Document.Blocks.Clear();
            tbTitle.Text     = c.GetTitle();
            tbName.Text      = c.GetName();
            tbAge.Text       = c.GetAge();
            tbAlignment.Text = c.GetAlignment();
            rtbOtherProf.Document.Blocks.Clear();
            rtbOtherProf.Document.Blocks.Add(new Paragraph(new Run(c.GetMiscProf())));
            rtbAppearance.Document.Blocks.Add(new Paragraph(new Run(c.GetAppearance())));
            rtbBackstory.Document.Blocks.Add(new Paragraph(new Run(c.GetBackstory())));
            rtbBonds.Document.Blocks.Add(new Paragraph(new Run(c.GetBonds())));
            rtbIdeals.Document.Blocks.Add(new Paragraph(new Run(c.GetIdeals())));
            rtbPersonality.Document.Blocks.Add(new Paragraph(new Run(c.GetPersonality())));
            rtbWepProfs.Document.Blocks.Add(new Paragraph(new Run(cClass.GetWepProfs())));
            rtbArmourProfs.Document.Blocks.Add(new Paragraph(new Run(cClass.GetArmourProfs())));
            tbTitle.Text            = c.GetTitle();
            tbSize.Text             = c.GetSize();
            lbCarryCapacity.Content = "Carry capacity: " + totalItemWeight.ToString() + " / " + c.CalcCarryWeight().ToString();

            if (c.GetIsMale())
            {
                chMale.IsChecked = true;
            }
            if (c.GetIsFemale())
            {
                chFemale.IsChecked = true;
            }
            rtbFlaws.Document.Blocks.Add(new Paragraph(new Run(c.GetFlaws())));

            ItemLegend itemLegend    = new ItemLegend();
            ItemLegend equipedLegend = new ItemLegend();

            panelInv.Children.Add(itemLegend);
            panelEquiped.Children.Add(equipedLegend);

            foreach (Skill s in skills)
            {
                CheckBox cBox = new CheckBox();
                cBox.IsChecked = s.acquired;
                cBox.Content   = s.name;
                panelSkills.Children.Add(cBox);
            }

            foreach (Language l in langs)
            {
                CheckBox cbox = new CheckBox();
                cbox.IsChecked = l.acquired;
                cbox.Content   = l.name;
                panelLanguages.Children.Add(cbox);
            }

            UpdateSpells();

            money     = new MoneyManager(c, this);
            inventory = new InventoryManager(c, panelInv, lbCarryCapacity, panelEquiped, lbAttunements, money);

            UpdateStats();
            UpdateFeatureList();
            UpdateFeatList();
        }
        private void UpdateInventory()
        {
            // Making childeren : ^)
            stack.Children.Clear();
            stackEquip.Children.Clear();

            ItemLegend leg = new ItemLegend();

            stack.Children.Add(leg);
            leg = new ItemLegend();
            stackEquip.Children.Add(leg);

            ItemControl wep, arm, item;

            foreach (Weapon w in weapons)
            {
                w.SetItemType("Weapon");
                wep = new ItemControl(w);
                stack.Children.Add(wep);
            }

            foreach (Armour a in armours)
            {
                // a.SetItemType("Armour");
                arm = new ItemControl(a);
                stack.Children.Add(arm);
            }

            foreach (Item i in items)
            {
                i.SetItemType("Item");
                item = new ItemControl(i);
                stack.Children.Add(item);
            }

            foreach (Item i in equipedItems)
            {
                switch (i.GetType().Name)
                {
                default:
                    MessageBox.Show("NO ITEM TYPE - UPDATE INVENTORY");
                    break;

                case "Weapon":
                    wep = new ItemControl((Weapon)i);
                    stackEquip.Children.Add(wep);
                    break;

                case "Armour":
                    arm = new ItemControl((Armour)i);
                    stackEquip.Children.Add(arm);
                    break;

                case "Item":
                    item = new ItemControl(i);
                    stackEquip.Children.Add(item);
                    break;
                }
            }

            UpdateCarryCapacity();
            UpdateAttunements();
        }