Ejemplo n.º 1
0
        private static DropRareEntry TryGetRareTable(BdatStringItem row)
        {
            var entry = new DropRareEntry();

            if (row is null)
            {
                return(entry);
            }

            entry.CrystalRate = int.Parse(row["crystal_per"].ValueString);
            entry.WeaponRate  = int.Parse(row["wpn_per"].ValueString);
            entry.EquipRate   = int.Parse(row["equip_per"].ValueString);
            entry.ArtsRate    = int.Parse(row["arts_per"].ValueString);

            for (int i = 0; i < MaxLotItems; i++)
            {
                var item = GetCrystalEntry(row, i);
                if (item == null)
                {
                    break;
                }

                entry.Crystals.Add(item);
            }

            for (int i = 0; i < MaxLotItems; i++)
            {
                var item = GetWeaponEntry(row, i);
                if (item == null)
                {
                    break;
                }

                entry.Weapons.Add(item);
            }

            for (int i = 0; i < MaxLotItems; i++)
            {
                var item = GetArmorEntry(row, i);
                if (item == null)
                {
                    break;
                }

                entry.Armor.Add(item);
            }

            for (int i = 0; i < MaxLotItems; i++)
            {
                var item = GetArtBookEntry(row, i);
                if (item == null)
                {
                    break;
                }

                entry.ArtBooks.Add(item);
            }

            return(entry);
        }
Ejemplo n.º 2
0
        private static void CalculateRareDropRates(DropRareEntry entry)
        {
            int lotTotal = entry.CrystalRate + entry.WeaponRate + entry.EquipRate + entry.ArtsRate;

            entry.CrystalDropRate = (double)entry.CrystalRate / lotTotal;
            entry.WeaponDropRate  = (double)entry.WeaponRate / lotTotal;
            entry.EquipDropRate   = (double)entry.EquipRate / lotTotal;
            entry.ArtsDropRate    = (double)entry.ArtsRate / lotTotal;

            var crystals     = entry.Crystals;
            int crystalTotal = crystals.Sum(x => x.Rate);

            foreach (var item in crystals)
            {
                item.LotDropRate   = (double)item.Rate / crystalTotal;
                item.TotalDropRate = item.LotDropRate * entry.CrystalDropRate;
            }

            var weapons     = entry.Weapons;
            int weaponTotal = weapons.Sum(x => x.Rate);

            foreach (var item in weapons)
            {
                item.LotDropRate   = (double)item.Rate / weaponTotal;
                item.TotalDropRate = item.LotDropRate * entry.WeaponDropRate;
            }

            var equips     = entry.Armor;
            int equipTotal = equips.Sum(x => x.Rate);

            foreach (var item in equips)
            {
                item.LotDropRate   = (double)item.Rate / equipTotal;
                item.TotalDropRate = item.LotDropRate * entry.EquipDropRate;
            }

            var arts      = entry.ArtBooks;
            int artsTotal = arts.Sum(x => x.Rate);

            foreach (var item in arts)
            {
                item.LotDropRate   = (double)item.Rate / artsTotal;
                item.TotalDropRate = item.LotDropRate * entry.ArtsDropRate;
            }
        }