Exemplo n.º 1
0
    public static WeaponsData Read(Stream data)
    {
        var weapons = new WeaponsData();

        weapons.ReadData(data);
        return(weapons);
    }
Exemplo n.º 2
0
        private void Awake()
        {
            Instance = this;

            playerData  = FindObjectOfType <PlayerData>();
            weaponsData = FindObjectOfType <WeaponsData>();
        }
Exemplo n.º 3
0
 private void Start()
 {
     PlayerPrefs.DeleteAll();
     cash = 500;
     selectedWeaponIndex     = 0;
     store.hasWeapon         = 1;
     weapons.playerHasWeapon = false;
     weaponsManager.weapons[0].playerHasWeapon = true;
     playerWeaponAmount = 0;
     for (int i = 1; i < weaponsManager.weapons.Count; i++)
     {
         weaponsManager.weapons[i].playerHasWeapon = false;
         weaponsManager.weapons[i].ammoPrice       = weaponsManager.weapons[i].startAmmoPrice;
     }
     playerWeaponAmount = 2;
     playerWeaponAmount = 0;
     weaponSlot1        = 0;
     storeUI.SetActive(false);
     Cursor.visible          = false;
     cash                    = PlayerPrefs.GetInt("Cash", 500);
     store                   = FindObjectOfType <Store>().GetComponent <Store>();
     weaponsManager          = this.GetComponent <WeaponsManager>();
     selectedWeaponIndex     = PlayerPrefs.GetInt("SelectedWeaponIndex", 0);
     weapons                 = weaponsManager.weapons[0];
     weapons.clipSize        = weapons.fullClipSize;
     weapons.reserveAmmoSize = weapons.fullReserveAmmoSize;
     nessaHealth             = this.GetComponent <NessaHealth>();
 }
Exemplo n.º 4
0
    private List <InventoryItem> PopulateItemsForSale(InventoryItemType type)
    {
        var items   = new List <InventoryItem>();
        var nbItems = 3;

        if (Random.Range(0, 100) < 5)
        {
            nbItems = 6;
        }
        else if (Random.Range(0, 100) < 15)
        {
            nbItems = 5;
        }
        else if (Random.Range(0, 100) < 30)
        {
            nbItems = 4;
        }
        for (int i = 0; i < nbItems; ++i)
        {
            if (type == InventoryItemType.Weapon)
            {
                items.Add(WeaponsData.GetRandomWeapon());
            }
            else if (type == InventoryItemType.Skill)
            {
                items.Add(SkillsData.GetRandomSkill());
            }
            else if (type == InventoryItemType.Item)
            {
                items.Add(ItemsData.GetRandomItem());
            }
        }
        return(items);
    }
Exemplo n.º 5
0
    private ResourceFilesData()
    {
        ArmorData        armorData;
        WeaponsData      weaponsData;
        MiscData         miscData;
        ItemStatCostData itemStatCostData;

        using (Stream s = GetResource("ItemStatCost.txt"))
        {
            itemStatCostData = ItemStatCostData.Read(s);
        }
        using (Stream s = GetResource("Armor.txt"))
        {
            armorData = ArmorData.Read(s);
        }
        using (Stream s = GetResource("Weapons.txt"))
        {
            weaponsData = WeaponsData.Read(s);
        }
        using (Stream s = GetResource("Misc.txt"))
        {
            miscData = MiscData.Read(s);
        }

        MetaData = new MetaData(itemStatCostData, new ItemsData(armorData, weaponsData, miscData));
    }
    private void RandomizeWeapon()
    {
        var idWeapon = Constants.LastEndActionClickedName.Contains("0") ? 0 : 1;
        var weapon   = _character.Weapons[idWeapon];

        weapon.WeaponParts = WeaponsData.CreateWeaponPartsFromTypeSubType(weapon.Type, Random.Range(0, WeaponsData.WeaponTypeNames[weapon.Type.GetHashCode()].Length), weapon.NbSkinParts);
        _instantiator.LoadWeaponSkin(weapon, _tabs[idWeapon + 1].transform.Find("SkinContainerWeapon" + idWeapon).gameObject);
    }
Exemplo n.º 7
0
    private void PositiveDelegate()
    {
        InventoryItem tmpItem = _itemType == InventoryItemType.Weapon ? _character.Weapons[_selectedItem] : (InventoryItem)_character.Skills[_selectedItem];

        if (_itemType == InventoryItemType.Weapon)
        {
            var weapon            = (Weapon)_mainItem;
            var notSelectedWeapon = _selectedItem == 0 ? 1 : 0;
            //GreatSword check
            if ((weapon.Type == WeaponType.GreatSword && !WeaponsData.IsSmallWeapon(_character.Weapons[notSelectedWeapon].Type)) ||
                (_character.Weapons[notSelectedWeapon].Type == WeaponType.GreatSword && !WeaponsData.IsSmallWeapon(weapon.Type)))
            {
                _instantiator.NewSnack("Great Swords can only be equipped with small weapons.");
                NegativeDelegate();
                return;
            }
            _character.Weapons[_selectedItem] = weapon;
            DisplayItem(_character.Weapons[_selectedItem]);
        }
        else
        {
            var skill = (Skill)_mainItem;
            if (skill.Type == SkillType.Racial && _character.Race != skill.Race)
            {
                _instantiator.NewSnack("You do not have the proper race to use this skill");
                NegativeDelegate();
                return;
            }
            _character.Skills[_selectedItem] = skill;
            DisplayItem(_character.Skills[_selectedItem]);
        }
        _character.Inventory[_mainItemId] = tmpItem;
        DisplayItem(_character.Inventory[_mainItemId], true);
        _positiveButton.GetComponent <BoxCollider2D>().enabled = false;
        Invoke(nameof(AfterSwitch), 0.5f);
        _containersPositions = new List <Vector3>();
        if (_itemType == InventoryItemType.Weapon)
        {
            _containersPositions.Add(_weaponContainers[0].transform.position);
            _containersPositions.Add(_weaponContainers[1].transform.position);
            _weaponContainers[0].transform.position = _containersPositions[1];
            _weaponContainers[1].transform.position = _containersPositions[0];
        }
        else
        {
            _containersPositions.Add(_skillContainers[0].transform.position);
            _containersPositions.Add(_skillContainers[1].transform.position);
            _skillContainers[0].transform.position = _containersPositions[1];
            _skillContainers[1].transform.position = _containersPositions[0];
        }
        _isSwitching = true;
    }
Exemplo n.º 8
0
        public static void ReadWeapons(int WeaponsID_List)
        {
            GetSelectedWeaponsData = new WeaponsData();
            int selectedWeaponsOffset = WeaponsDataOffset + (WeaponsID_List * 12);

            OffsetToWeaponsSelected = selectedWeaponsOffset;

            selectedWeaponsOffset           += 3;
            GetSelectedWeaponsData.Price     = Kernel[selectedWeaponsOffset++];
            GetSelectedWeaponsData.Item1     = Kernel[selectedWeaponsOffset++];
            GetSelectedWeaponsData.Quantity1 = Kernel[selectedWeaponsOffset++];
            GetSelectedWeaponsData.Item2     = Kernel[selectedWeaponsOffset++];
            GetSelectedWeaponsData.Quantity2 = Kernel[selectedWeaponsOffset++];
            GetSelectedWeaponsData.Item3     = Kernel[selectedWeaponsOffset++];
            GetSelectedWeaponsData.Quantity3 = Kernel[selectedWeaponsOffset++];
            GetSelectedWeaponsData.Item4     = Kernel[selectedWeaponsOffset++];
            GetSelectedWeaponsData.Quantity4 = Kernel[selectedWeaponsOffset++];
        }
Exemplo n.º 9
0
    //  DWARF  //
    public static Character GetBaseDwarf(CharacterGender gender, bool isPlayer = false)
    {
        var tmpChar = new Character()
        {
            Race                  = CharacterRace.Dwarf,
            StrongAgainst         = CharacterRace.Orc,
            StrongIn              = MapType.Mines,
            Diet                  = Diet.Omnivorous,
            HpMax                 = 350,
            PaMax                 = 6,
            PmMax                 = 2,
            LevelingHealthPercent = 10,
            LevelingDamagePercent = 20,
            FavWeapons            = new List <WeaponType> {
                WeaponType.Hammer, WeaponType.Axe
            },
            Weapons = new List <Weapon> {
                WeaponsData.GetWeaponFromType(WeaponType.Hammer, isPlayer),
                WeaponsData.GetWeaponFromType(WeaponType.Axe, isPlayer)
            },
            SkillsTypes = new List <SkillType> {
                SkillType.Racial, SkillType.NotRatial
            },
            Skills = new List <Skill> {
                Random.Range(0, 2) == 0 ? SkillsData.GetSkillFromName(SkillsData.DwarfSkillsNames[0]) :
                SkillsData.GetSkillFromName(SkillsData.DwarfSkillsNames[1])
            },
            BodyParts = CreateBodyPartsFromRace(CharacterRace.Human, gender),
            Inventory = new List <InventoryItem> {
                ItemsData.GetRandomItem(isPlayer)
            },
            InventoryPlace          = 4,
            WeightLimit             = 60,
            SleepHoursNeeded        = 7,
            SleepRestorationPercent = 75,
            RunAwayPercent          = 10,
            LootPercent             = 50,
            CritChancePercent       = 0
        };

        HandleGreatSword(tmpChar);
        return(tmpChar);
    }
Exemplo n.º 10
0
    //  ORC  //
    public static Character GetBaseOrc(CharacterGender gender, bool isPlayer = false)
    {
        var tmpChar = new Character()
        {
            Race                  = CharacterRace.Orc,
            StrongAgainst         = CharacterRace.Human,
            StrongIn              = MapType.Mountains,
            Diet                  = Diet.Herbivorous,
            HpMax                 = 500,
            PaMax                 = 6,
            PmMax                 = 1,
            LevelingHealthPercent = 25,
            LevelingDamagePercent = 5,
            FavWeapons            = new List <WeaponType> {
                WeaponType.GreatSword, WeaponType.Gauntlets
            },
            Weapons = new List <Weapon> {
                WeaponsData.GetWeaponFromType(WeaponType.GreatSword, isPlayer),
                WeaponsData.GetWeaponFromType(WeaponType.Gauntlets, isPlayer)
            },
            SkillsTypes = new List <SkillType> {
                SkillType.Racial, SkillType.NotRatial
            },
            Skills = new List <Skill> {
                Random.Range(0, 2) == 0 ? SkillsData.GetSkillFromName(SkillsData.OrcSkillsNames[0]) :
                SkillsData.GetSkillFromName(SkillsData.OrcSkillsNames[1])
            },
            BodyParts = CreateBodyPartsFromRace(CharacterRace.Human, gender),
            Inventory = new List <InventoryItem> {
                ItemsData.GetRandomItem(isPlayer)
            },
            InventoryPlace          = 3,
            WeightLimit             = 80,
            SleepHoursNeeded        = 12,
            SleepRestorationPercent = 100,
            RunAwayPercent          = 15,
            LootPercent             = 15,
            CritChancePercent       = 0
        };

        HandleGreatSword(tmpChar);
        return(tmpChar);
    }
Exemplo n.º 11
0
 private static void HandleGreatSword(Character tmpChar)
 {
     if (tmpChar.Weapons[0].Type == WeaponType.GreatSword && !WeaponsData.IsSmallWeapon(tmpChar.Weapons[1].Type))
     {
         if (tmpChar.Race == CharacterRace.Human || tmpChar.Race == CharacterRace.Dwarf)
         {
             tmpChar.Weapons[1] = null;
             tmpChar.Weapons[1] = WeaponsData.GetWeaponFromType(WeaponsData.GetRandomSmallWeaponType(), isBase: true);
         }
         else
         {
             tmpChar.Weapons[1] = null;
             tmpChar.Weapons[1] = WeaponsData.GetWeaponFromType(tmpChar.FavWeapons[1], isBase: true);
         }
     }
     else if (tmpChar.Weapons[1].Type == WeaponType.GreatSword)
     {
         tmpChar.Weapons[1] = null;
         tmpChar.Weapons[1] = WeaponsData.GetWeaponFromType(WeaponsData.GetRandomSmallWeaponType(), canBeAnythingAndGreatSword: false);
     }
 }
Exemplo n.º 12
0
 public ItemsData(ArmorData armorData, WeaponsData weaponsData, MiscData miscData)
 {
     ArmorData   = armorData;
     WeaponsData = weaponsData;
     MiscData    = miscData;
 }
Exemplo n.º 13
0
    private void Update()
    {
        nessaHealthText.text    = "Health: " + nessaHealth.nessaHealth;
        amountOfSauceText.text  = "x" + sauceAmountOfHealing;
        gunSelectedText.text    = weaponsManager.weapons[selectedWeaponIndex].name;
        attackDamage            = weaponsManager.weapons[selectedWeaponIndex].damage;
        gunSelectedImage.sprite = weaponsManager.weapons[selectedWeaponIndex].artWork;
        ammo.text = weaponsManager.weapons[selectedWeaponIndex].clipSize.ToString() + "/" + weaponsManager.weapons[selectedWeaponIndex].reserveAmmoSize.ToString();
        nessaHealth.healthBar.fillAmount = nessaHealth.nessaHealth / nessaHealth.startNessaHealth;
        if (weaponsManager.weapons[selectedWeaponIndex].name != "Nothing")
        {
            gunSelectedImage.gameObject.SetActive(true);
            ammo.gameObject.SetActive(true);
            gunSelectedImage.sprite = weaponsManager.weapons[selectedWeaponIndex].artWork;
            ammo.text = weaponsManager.weapons[selectedWeaponIndex].clipSize.ToString() + "/" + weaponsManager.weapons[selectedWeaponIndex].reserveAmmoSize.ToString();
        }
        else
        {
            gunSelectedImage.gameObject.SetActive(false);
            ammo.gameObject.SetActive(false);
        }

        if (stillPlaying)
        {
            startTime += Time.deltaTime;
        }
        roundText.text = "Round: " + rounds;
        if (nessaHealth.nessaHealth <= 0)
        {
            listOfSounds[0].gameObject.SetActive(true);
            DeathScreen();
        }

        if (Cursor.visible && storeUI.activeSelf)
        {
            crosshair.SetActive(false);
            canShoot = false;
        }
        else
        {
            crosshair.SetActive(true);
            canShoot = true;
        }
        if (weapons.clipSize == 0)
        {
            needToReload = true;
        }
        if (Input.GetKeyDown(KeyCode.LeftShift) && !isPaused || Input.GetKeyDown(KeyCode.RightShift) && !isPaused)
        {
            if (storeUI.activeSelf)
            {
                store.Back();
                Cursor.visible = false;
                AudioSource.PlayClipAtPoint(pressButtonSound, FindObjectOfType <Camera>().transform.position, 0.5f);
            }
            else
            {
                AudioSource.PlayClipAtPoint(pressButtonSound, FindObjectOfType <Camera>().transform.position, 0.5f);
                Shop();
            }
        }
        if (Input.GetKeyDown(KeyCode.R) && !isPaused)
        {
            StartCoroutine(Reload());
        }
        if (Input.GetKeyDown(KeyCode.Escape) && !isPaused)
        {
            Pause();
            AudioSource.PlayClipAtPoint(pressButtonSound, FindObjectOfType <Camera>().transform.position, 0.5f);
        }
        else if (Input.GetKeyDown(KeyCode.Escape) && isPaused)
        {
            Resume();
            AudioSource.PlayClipAtPoint(pressButtonSound, FindObjectOfType <Camera>().transform.position, 0.5f);
        }
        if (Input.GetKeyDown(KeyCode.Tab) && !upgradesPanelMenu.activeSelf)
        {
            UpgradeMenu();
            AudioSource.PlayClipAtPoint(pressButtonSound, FindObjectOfType <Camera>().transform.position, 0.5f);
        }
        else if (Input.GetKeyDown(KeyCode.Tab) && upgradesPanelMenu.activeSelf)
        {
            upgradesPanelMenu.SetActive(false);
            AudioSource.PlayClipAtPoint(pressButtonSound, FindObjectOfType <Camera>().transform.position, 0.5f);
            Cursor.visible = false;
            Time.timeScale = 1f;
        }



        if (Input.GetKeyDown(KeyCode.Alpha1) || justBought && selectedWeaponIndex == weaponSlot1)
        {
            if (playerWeaponAmount == 0) //player has bought nothing so far
            {
                selectedWeaponIndex = 0;
                weaponSlot1         = 0;
            }
            else if (playerWeaponAmount == 1)      //player has 1 weapon
            {
                selectedWeaponIndex = weaponSlot1; //selected weapon is whatever is in slot 1
            }
            else if (playerWeaponAmount == 2)      //player has 2 weapons
            {
                selectedWeaponIndex = weaponSlot1; //selected weapon is whatever is in slot 1
            }
            if (weaponsManager.weapons[selectedWeaponIndex].playerHasWeapon)
            {
                weapons = weaponsManager.weapons[selectedWeaponIndex];
                if (weapons.reserveAmmoSize < 0)
                {
                    weapons.reserveAmmoSize = 0;
                }
            }
        }
        else if (Input.GetKeyDown(KeyCode.Alpha2) && playerWeaponAmount > 1 || justBought && playerWeaponAmount > 1) //player has full slots
        {
            selectedWeaponIndex = weaponSlot2;
            if (weaponsManager.weapons[selectedWeaponIndex].playerHasWeapon) //if player bought the weapon
            {
                weapons = weaponsManager.weapons[selectedWeaponIndex];       //current weapon is that weapon
                if (weapons.reserveAmmoSize < 0)
                {
                    weapons.reserveAmmoSize = 0;
                }
            }
        }

        PlayerPrefs.SetInt("SelectedWeaponIndex", selectedWeaponIndex);
        PlayerPrefs.SetInt("Cash", cash);
        cashText.text      = "Cash: " + cash.ToString();
        storeCashText.text = "Cash: " + cash.ToString();
    }
Exemplo n.º 14
0
        private void ApplyNewValues()
        {
            if (cbInfiniteStasis.Checked)
            {
                MiscData.Stasis = float.MaxValue;
            }
            MiscData.Flags[(byte)Flags.InfiniteAmmo] = cbInfiniteAmmo.Checked ? (byte)1 : (byte)0;
            MiscData.Nodes           = (uint)nudNodes.Value;
            MiscData.ActiveSuit      = (ItemDescriptor)cbActiveSuit.SelectedValue;
            NewInventoryData.Credits = (uint)nudCredits.Value;

            NewInventoryData.WriteData(DataStream);
            NewWeaponsData.WriteData(DataStream);
            NewSafeData.WriteData(DataStream);
            NewShopData.WriteData(DataStream);
            MiscData.WriteData(DataStream);

            #region Fix size bytes
            var origSize = (uint)(OriginalInventoryData.GetDataSize() + OriginalSafeData.GetDataSize() + OriginalShopData.GetDataSize() + OriginalWeaponsData.GetDataSize());
            var newSize  = (uint)(NewInventoryData.GetDataSize() + NewSafeData.GetDataSize() + NewShopData.GetDataSize() + NewWeaponsData.GetDataSize());

            DataStream.Seek(0x28BC, SeekOrigin.Begin);
            var totalDataChunkSize = DataStream.ReadUInt32();

            var itemsBlockPos = DataStream.SearchForBytePattern(MagicStuff.ItemBlockMagic) + MagicStuff.ItemBlockMagic.Length;
            DataStream.Seek(itemsBlockPos, SeekOrigin.Begin);
            var itemsBlockSize = DataStream.ReadUInt32();

            // 1st size to fix
            DataStream.Seek(0x28BC, SeekOrigin.Begin);
            DataStream.WriteUInt32(totalDataChunkSize - origSize + newSize);

            // 2nd size to fix
            DataStream.Seek(itemsBlockPos, SeekOrigin.Begin);
            DataStream.WriteUInt32(itemsBlockSize - origSize + newSize);
            #endregion

            OriginalInventoryData = new InventoryData
            {
                Unk1    = NewInventoryData.Unk1,
                Credits = NewInventoryData.Credits,
                Items   = NewInventoryData.Items
            };
            OriginalSafeData = new SafeData
            {
                SafeCapacity = NewSafeData.SafeCapacity,
                Unk1         = NewSafeData.Unk1,
                Items        = NewSafeData.Items
            };
            OriginalShopData = new ShopData
            {
                Unk1  = NewShopData.Unk1,
                Items = NewShopData.Items
            };
            OriginalWeaponsData = new WeaponsData
            {
                ActiveSlots = NewWeaponsData.ActiveSlots,
                Unk1        = NewWeaponsData.Unk1,
                Items       = NewWeaponsData.Items
            };
        }
Exemplo n.º 15
0
        private void LoadFileData()
        {
            Cursor = Cursors.WaitCursor;

            Metadata              = null;
            DataStream            = null;
            MC02Header            = null;
            OriginalInventoryData = null;
            NewInventoryData      = null;
            OriginalSafeData      = null;
            NewSafeData           = null;
            OriginalShopData      = null;
            NewShopData           = null;
            OriginalWeaponsData   = null;
            NewWeaponsData        = null;
            MiscData              = null;

            try
            {
                using (var fs = File.OpenRead(SaveFilePath))
                {
                    DataStream = new MemoryStream();
                    fs.CopyTo(DataStream);
                }

                if (!ValidateSaveFile())
                {
                    return;
                }

                DataStream.Seek(0x2034, SeekOrigin.Begin);
                var meta  = DataStream.ReadUnicodeString();
                var re    = new Regex(@"^\D*(\d{1,2})\D*(\d{1,2})\D*(\d{1,2})\D*(\d{1,2})\D*(\d{1,2})\D*(\d{1,2})\D*(\d{1,2})\D*$");
                var match = re.Match(meta);
                if (match.Success)
                {
                    Metadata = new FileMetadata
                    {
                        Slot          = match.Groups[1].Value,
                        HoursPlayed   = match.Groups[2].Value,
                        MinutesPlayed = match.Groups[3].Value,
                        SecondsPlayed = match.Groups[4].Value,
                        Difficulty    = match.Groups[5].Value,
                        Chapter       = match.Groups[6].Value,
                        Round         = match.Groups[7].Value
                    };
                }

                OriginalInventoryData = new InventoryData(DataStream);
                NewInventoryData      = new InventoryData
                {
                    Unk1    = OriginalInventoryData.Unk1,
                    Credits = OriginalInventoryData.Credits,
                    Items   = new List <InventoryEntity>(OriginalInventoryData.Items)
                };
                OriginalSafeData = new SafeData(DataStream);
                NewSafeData      = new SafeData
                {
                    SafeCapacity = OriginalSafeData.SafeCapacity,
                    Unk1         = OriginalSafeData.Unk1,
                    Items        = new List <SafeEntity>(OriginalSafeData.Items)
                };
                OriginalShopData = new ShopData(DataStream);
                NewShopData      = new ShopData
                {
                    Unk1  = OriginalShopData.Unk1,
                    Items = new List <ShopEntity>(OriginalShopData.Items)
                };
                OriginalWeaponsData = new WeaponsData(DataStream);
                NewWeaponsData      = new WeaponsData
                {
                    ActiveSlots = OriginalWeaponsData.ActiveSlots,
                    Unk1        = OriginalWeaponsData.Unk1,
                    Items       = new List <WeaponEntity>(OriginalWeaponsData.Items)
                };
                MiscData = new MiscData(DataStream);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Sorry, an error occurred while reading from file", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            finally
            {
                Cursor = Cursors.Default;
            }
        }
Exemplo n.º 16
0
 public void Init()
 {
     LevelData   = AssetDatabase.LoadAssetAtPath <LevelData>(LevelDataPath);
     CarsData    = AssetDatabase.LoadAssetAtPath <CarsData>(CarsDataPath);
     WeaponsData = AssetDatabase.LoadAssetAtPath <WeaponsData>(WeaponsDataPath);
 }
Exemplo n.º 17
0
        public ItemsForm(InventoryData inventoryData, SafeData safeData, ShopData shopData, WeaponsData weaponsData)
        {
            InitializeComponent();

            GuidStoplist = new List <Guid>();

            InventoryData = inventoryData;
            SafeData      = safeData;
            ShopData      = shopData;
            WeaponsData   = weaponsData;

            var dsInventory = GetInventoryDataSource();
            var dsWeapons   = GetWeaponsDataSource();
            var dsSafe      = GetSafeDataSource();
            var dsShop      = GetShopDataSource();

            if (InventoryData != null)
            {
                foreach (var item in InventoryData.Items)
                {
                    dgvInventory.Rows.Add(
                        item.Slot,
                        item.Descriptor,
                        item.Quantity);
                }
            }

            if (WeaponsData != null)
            {
                for (int i = 0; i < 4; i++)
                {
                    var item = WeaponsData.Items.FirstOrDefault(it => it.Slot == i);
                    dgvWeapons.Rows.Add(
                        i,
                        item?.Descriptor ?? ItemDescriptor.Empty,
                        item?.Quantity ?? 0);
                }
            }

            if (SafeData != null)
            {
                foreach (var item in SafeData.Items)
                {
                    dgvSafe.Rows.Add(
                        item.Slot,
                        item.Descriptor,
                        item.Quantity);
                }
            }

            if (ShopData != null)
            {
                foreach (var item in ShopData.Items)
                {
                    dgvShop.Rows.Add(item.Descriptor);
                }
            }

            colInventoryName.DisplayMember = "Value";
            colInventoryName.ValueMember   = "Key";
            colInventoryName.DataSource    = new BindingSource(dsInventory, null);

            colWeaponsName.DisplayMember = "Value";
            colWeaponsName.ValueMember   = "Key";
            colWeaponsName.DataSource    = new BindingSource(dsWeapons.OrderBy(d => d.Value), null);

            colSafeName.DisplayMember = "Value";
            colSafeName.ValueMember   = "Key";
            colSafeName.DataSource    = new BindingSource(dsSafe, null);

            colShopName.DisplayMember = "Value";
            colShopName.ValueMember   = "Key";
            colShopName.DataSource    = new BindingSource(dsShop, null);
        }