Beispiel #1
0
            public Ammunition GetAmmunition(ItemId <Ammunition> id, bool notNull = false)
            {
                if (_database._ammunitionMap.TryGetValue(id.Value, out var item))
                {
                    return(item);
                }
                var serializable = _content.GetAmmunition(id.Value);

                if (serializable != null && !serializable.Disabled)
                {
                    return(Ammunition.Create(serializable, this));
                }

                var value = Ammunition.DefaultValue;

                if (notNull && value == null)
                {
                    throw new DatabaseException("Data not found " + id);
                }
                return(value);
            }
Beispiel #2
0
            public void Load()
            {
                foreach (var item in _content.AmmunitionObsoleteList)
                {
                    if (!item.Disabled && !_database._ammunitionObsoleteMap.ContainsKey(item.Id))
                    {
                        AmmunitionObsolete.Create(item, this);
                    }
                }
                foreach (var item in _content.ComponentList)
                {
                    if (!item.Disabled && !_database._componentMap.ContainsKey(item.Id))
                    {
                        Component.Create(item, this);
                    }
                }
                foreach (var item in _content.ComponentModList)
                {
                    if (!item.Disabled && !_database._componentModMap.ContainsKey(item.Id))
                    {
                        ComponentMod.Create(item, this);
                    }
                }
                foreach (var item in _content.ComponentStatsList)
                {
                    if (!item.Disabled && !_database._componentStatsMap.ContainsKey(item.Id))
                    {
                        ComponentStats.Create(item, this);
                    }
                }
                foreach (var item in _content.DeviceList)
                {
                    if (!item.Disabled && !_database._deviceMap.ContainsKey(item.Id))
                    {
                        Device.Create(item, this);
                    }
                }
                foreach (var item in _content.DroneBayList)
                {
                    if (!item.Disabled && !_database._droneBayMap.ContainsKey(item.Id))
                    {
                        DroneBay.Create(item, this);
                    }
                }
                foreach (var item in _content.FactionList)
                {
                    if (!item.Disabled && !_database._factionMap.ContainsKey(item.Id))
                    {
                        Faction.Create(item, this);
                    }
                }
                foreach (var item in _content.SatelliteList)
                {
                    if (!item.Disabled && !_database._satelliteMap.ContainsKey(item.Id))
                    {
                        Satellite.Create(item, this);
                    }
                }
                foreach (var item in _content.SatelliteBuildList)
                {
                    if (!item.Disabled && !_database._satelliteBuildMap.ContainsKey(item.Id))
                    {
                        SatelliteBuild.Create(item, this);
                    }
                }
                foreach (var item in _content.ShipList)
                {
                    if (!item.Disabled && !_database._shipMap.ContainsKey(item.Id))
                    {
                        Ship.Create(item, this);
                    }
                }
                foreach (var item in _content.ShipBuildList)
                {
                    if (!item.Disabled && !_database._shipBuildMap.ContainsKey(item.Id))
                    {
                        ShipBuild.Create(item, this);
                    }
                }
                foreach (var item in _content.SkillList)
                {
                    if (!item.Disabled && !_database._skillMap.ContainsKey(item.Id))
                    {
                        Skill.Create(item, this);
                    }
                }
                foreach (var item in _content.TechnologyList)
                {
                    if (!item.Disabled && !_database._technologyMap.ContainsKey(item.Id))
                    {
                        Technology.Create(item, this);
                    }
                }
                foreach (var item in _content.CharacterList)
                {
                    if (!item.Disabled && !_database._characterMap.ContainsKey(item.Id))
                    {
                        Character.Create(item, this);
                    }
                }
                foreach (var item in _content.FleetList)
                {
                    if (!item.Disabled && !_database._fleetMap.ContainsKey(item.Id))
                    {
                        Fleet.Create(item, this);
                    }
                }
                foreach (var item in _content.LootList)
                {
                    if (!item.Disabled && !_database._lootMap.ContainsKey(item.Id))
                    {
                        LootModel.Create(item, this);
                    }
                }
                foreach (var item in _content.QuestList)
                {
                    if (!item.Disabled && !_database._questMap.ContainsKey(item.Id))
                    {
                        QuestModel.Create(item, this);
                    }
                }
                foreach (var item in _content.QuestItemList)
                {
                    if (!item.Disabled && !_database._questItemMap.ContainsKey(item.Id))
                    {
                        QuestItem.Create(item, this);
                    }
                }
                foreach (var item in _content.AmmunitionList)
                {
                    if (!item.Disabled && !_database._ammunitionMap.ContainsKey(item.Id))
                    {
                        Ammunition.Create(item, this);
                    }
                }
                foreach (var item in _content.BulletPrefabList)
                {
                    if (!item.Disabled && !_database._bulletPrefabMap.ContainsKey(item.Id))
                    {
                        BulletPrefab.Create(item, this);
                    }
                }
                foreach (var item in _content.VisualEffectList)
                {
                    if (!item.Disabled && !_database._visualEffectMap.ContainsKey(item.Id))
                    {
                        VisualEffect.Create(item, this);
                    }
                }
                foreach (var item in _content.WeaponList)
                {
                    if (!item.Disabled && !_database._weaponMap.ContainsKey(item.Id))
                    {
                        Weapon.Create(item, this);
                    }
                }

                foreach (var item in _content.Images)
                {
                    if (!_database._images.ContainsKey(item.Key))
                    {
                        _database._images.Add(item.Key, item.Value);
                    }
                }

                foreach (var item in _content.AudioClips)
                {
                    if (!_database._audioClips.ContainsKey(item.Key))
                    {
                        _database._audioClips.Add(item.Key, item.Value);
                    }
                }

                foreach (var item in _content.Localizations)
                {
                    if (!_database._localizations.ContainsKey(item.Key))
                    {
                        _database._localizations.Add(item.Key, item.Value);
                    }
                }

                if (_database.DatabaseSettings == null)
                {
                    _database.DatabaseSettings = DatabaseSettings.Create(_content.DatabaseSettings ?? new Serializable.DatabaseSettingsSerializable {
                        ItemType = Enums.ItemType.DatabaseSettings
                    }, this);
                }
                if (_database.ExplorationSettings == null)
                {
                    _database.ExplorationSettings = ExplorationSettings.Create(_content.ExplorationSettings ?? new Serializable.ExplorationSettingsSerializable {
                        ItemType = Enums.ItemType.ExplorationSettings
                    }, this);
                }
                if (_database.GalaxySettings == null)
                {
                    _database.GalaxySettings = GalaxySettings.Create(_content.GalaxySettings ?? new Serializable.GalaxySettingsSerializable {
                        ItemType = Enums.ItemType.GalaxySettings
                    }, this);
                }
                if (_database.ShipSettings == null)
                {
                    _database.ShipSettings = ShipSettings.Create(_content.ShipSettings ?? new Serializable.ShipSettingsSerializable {
                        ItemType = Enums.ItemType.ShipSettings
                    }, this);
                }
            }
        public Ammunition CreatePlayerAmmunitions(int playerId)
        {
            try
            {
                var ammunition = new Ammunition();
                using (var mySqlClient = SqlDatabaseManager.GetClient())
                {
                    var queryRow = mySqlClient.ExecuteQueryRow("SELECT * FROM player_ammo WHERE PLAYER_ID=" + playerId);

                    ammunition.Create("ammunition_laser_lcb-10", intConv(queryRow["LCB_10"]));
                    ammunition.Create("ammunition_laser_mcb-25", intConv(queryRow["MCB_25"]));
                    ammunition.Create("ammunition_laser_mcb-50", intConv(queryRow["MCB_50"]));
                    ammunition.Create("ammunition_laser_ucb-100", intConv(queryRow["UCB_100"]));
                    ammunition.Create("ammunition_laser_sab-50", intConv(queryRow["SAB_50"]));
                    ammunition.Create("ammunition_laser_rsb-75", intConv(queryRow["RSB_75"]));
                    ammunition.Create("ammunition_laser_cbo-100", intConv(queryRow["CBO_100"]));
                    ammunition.Create("ammunition_laser_job-100", intConv(queryRow["JOB_100"]));
                    ammunition.Create("ammunition_rocket_r-310", intConv(queryRow["R_310"]));
                    ammunition.Create("ammunition_rocket_plt-2026", intConv(queryRow["PLT_2026"]));
                    ammunition.Create("ammunition_rocket_plt-2021", intConv(queryRow["PLT_2021"]));
                    ammunition.Create("ammunition_rocket_plt-3030", intConv(queryRow["PLT_3030"]));
                    ammunition.Create("ammunition_specialammo_pld-8", intConv(queryRow["PLD_8"]));
                    ammunition.Create("ammunition_specialammo_dcr-250", intConv(queryRow["DCR_250"]));
                    ammunition.Create("ammunition_specialammo_wiz-x", intConv(queryRow["WIZ_X"]));
                    ammunition.Create("ammunition_specialammo_emp-01", intConv(queryRow["EMP_01"]));
                    ammunition.Create("ammunition_rocket_bdr-1211", intConv(queryRow["BDR_1211"]));
                    ammunition.Create("ammunition_rocketlauncher_hstrm-01", intConv(queryRow["HSTRM_01"]));
                    ammunition.Create("ammunition_rocketlauncher_ubr-100", intConv(queryRow["UBR_100"]));
                    ammunition.Create("ammunition_rocketlauncher_eco-10", intConv(queryRow["ECO_10"]));
                    ammunition.Create("ammunition_rocketlauncher_sar-01", intConv(queryRow["SAR_01"]));
                    ammunition.Create("ammunition_rocketlauncher_sar-02", intConv(queryRow["SAR_02"]));
                    ammunition.Create("ammunition_mine_acm-01", intConv(queryRow["ACM_01"]));
                    ammunition.Create("ammunition_mine_empm-01", intConv(queryRow["EMP_M01"]));
                    ammunition.Create("ammunition_mine_slm-01", intConv(queryRow["SL_M01"]));
                    ammunition.Create("ammunition_mine_ddm-01", intConv(queryRow["DD_M01"]));
                    ammunition.Create("ammunition_mine_sabm-01", intConv(queryRow["SAB_M01"]));
                    ammunition.Create("ammunition_firework_fwx-s", intConv(queryRow["FWX_S"]));
                    ammunition.Create("ammunition_firework_fwx-m", intConv(queryRow["FWX_M"]));
                    ammunition.Create("ammunition_firework_fwx-l", intConv(queryRow["FWX_L"]));
                }
                return(ammunition);
            }
            catch (Exception)
            {
                Out.QuickLog("Critical error occured", LogKeys.ERROR_LOG);
            }
            return(null);
        }