Exemple #1
0
        /// <summary>
        /// Add ganger weapon (equip weapon to ganger)
        /// </summary>
        /// <param name="gangerId">Ganger Id</param>
        /// <param name="gangWeaponId">Ganger weapon</param>
        /// <returns>Added ganger weapon</returns>
        public GangerWeapon AddGangerWeapon(string gangerId, string gangWeaponId)
        {
            var ganger = _gangerProvider.GetByGangerId(gangerId);

            var gangWeapon = _weaponProvider.GetGangStash(ganger.GangId)
                             .FirstOrDefault(gw => gw.GangWeaponId == gangWeaponId);

            if (gangWeapon == null)
            {
                throw new ArgumentException($"GangWeapon with id {gangWeaponId} was not found.");
            }

            _weaponProvider.RemoveGangWeapon(gangWeaponId);

            var gangerWeapon = new GangerWeapon()
            {
                Cost     = gangWeapon.Cost,
                GangerId = ganger.GangerId,
                Weapon   = gangWeapon.Weapon,
            };

            return(_weaponProvider.AddGangerWeapon(gangerWeapon));
        }
Exemple #2
0
 /// <summary>
 /// Gets a ganger by ID
 /// </summary>
 /// <param name="id">Ganger Id</param>
 /// <returns>Ganger corresponding to the ID</returns>
 public Ganger GetGanger(string id)
 {
     return(_gangerProvider.GetByGangerId(id));
 }