public static Weapon GetWeaponByName(string name)
        {
            WeaponService _weaponService = new WeaponService(EquipmentGlobals.ConnectionString);
            weapon        tempWeapon     = _weaponService.GetWeaponByName(name);

            return(MapThisToWeaponObject(tempWeapon));
        }
        public static Weapon GetWeapons(Hero fightingHero)
        {
            var           serviceProvider3 = DIConfiguration.ConfigurazioneWeapon();
            WeaponService weaponService    = serviceProvider3.GetService <WeaponService>();

            Console.WriteLine("Le armi a tua disposizione sono:");

weapon:
            //List<Weapon> weapons = new List<Weapon>;
            var weapons = weaponService.GetAllWeapons(fightingHero);

            for (int i = 0; i < weapons.Count(); i++)
            {
                Console.WriteLine("{0} - {1}", i, weapons[i].name);
            }

            Console.WriteLine("Inserisci il numero dell'arma che hai scelto:");
            try
            {
                int    index = Convert.ToInt32(Console.ReadLine());
                Weapon w     = weapons[index];
                Console.WriteLine("Il tuo personaggio è un {0} di nome {1} la cui arma è {2}", fightingHero.classPerson, fightingHero.name, w.name);
                return(w);
            }
            catch (Exception e)
            {
                Console.WriteLine("Inserimento non valido");
                goto weapon;
            }
        }
Beispiel #3
0
        // SERVICE
        private WeaponService GetArmourService()
        {
            var userId  = User.Identity.GetUserId();
            var service = new WeaponService(userId);

            return(service);
        }
Beispiel #4
0
 private void armory()
 {
     try
     {
         var result = WeaponService.UpgradeWeapon(_userId);
         resultLabel.Text = result.Message;
         updateStatistics(result.Hero);
     }
     catch (Exception exception)
     {
         resultLabel.Text = formatErrorMessage(exception.Message);
     }
 }
Beispiel #5
0
        private static void Main(string[] args)
        {
            var player       = ClassService.GetBase("Human Barbarian", BaseClass.Barbarian, true, new Stat(), WeaponClass.Club);
            var enemy        = ClassService.GetBase("Kobold Cleric", BaseClass.Cleric, true, new Stat(), WeaponClass.Unarmed);
            var playerWeapon = WeaponService.GetWeapon("Club", WeaponClass.Club);
            var enemyWeapon  = WeaponService.GetWeapon("Dagger", WeaponClass.Dagger);

            Helper.Program.DisplayCharacters.DisplayCharacter(player);
            Helper.Program.DisplayCharacters.DisplayCharacter(enemy);

            var combatService = new CombatService(player, enemy, playerWeapon, enemyWeapon);

            Console.ReadLine();
        }
Beispiel #6
0
        public IHttpActionResult GetWeaponById(int weaponId)
        {
            WeaponService weaponService = CreateWeaponService();
            var           weapon        = weaponService.GetWeaponById(weaponId);

            if (weapon.HistoryId != null)
            {
                weapon.HistoryURL = "https://" + HttpContext.Current.Request.Url.Authority + "/api/History?HistoryId=" + weapon.HistoryId;
            }

            if (weapon.GameId != null)
            {
                weapon.GameURL = "https://" + HttpContext.Current.Request.Url.Authority + "/api/Game?GameId=" + weapon.GameId;
            }
            return(Ok(weapon));
        }
Beispiel #7
0
        public IHttpActionResult GetWeaponsByGameId(int gameId)
        {
            WeaponService weaponService = CreateWeaponService();
            var           weapons       = weaponService.GetWeaponByGameId(gameId);

            foreach (WeaponListItem h in weapons)
            {
                if (h.HistoryId != null)
                {
                    h.HistoryURL = "https://" + HttpContext.Current.Request.Url.Authority + "/api/History?HistoryId=" + h.HistoryId;
                }

                if (h.GameId != null)
                {
                    h.GameURL = "https://" + HttpContext.Current.Request.Url.Authority + "/api/Game?GameId=" + h.GameId;
                }
            }
            return(Ok(weapons));
        }
Beispiel #8
0
        //-----------------------------------------------------------------------------------------------------------
        private void btnReset_Click(object sender, EventArgs e)
        {
            string from    = ctlTip.Text;
            string quality = ctlQuality.Text;

            weaponService = new WeaponService();
            var weapon = new List <Weapon>();

            if (quality == "Всё")
            {
                if (from == "Всё")
                {
                    weaponService.GetListWeapon(weapon, "ОружиеКолющее");
                    weaponService.GetListWeapon(weapon, "ОружиеРубящее");
                    weaponService.GetListWeapon(weapon, "ОружиеУдарное");
                    weaponService.GetListWeapon(weapon, "ОружиеПодЗаказ");
                }
                else
                {
                    weaponService.GetListWeapon(weapon, from);
                }
            }
            else
            {
                if (from == "Всё")
                {
                    weaponService.GetListWeapon(weapon, quality, "ОружиеКолющее");
                    weaponService.GetListWeapon(weapon, quality, "ОружиеРубящее");
                    weaponService.GetListWeapon(weapon, quality, "ОружиеУдарное");
                    weaponService.GetListWeapon(weapon, quality, "ОружиеПодЗаказ");
                }
                else
                {
                    weaponService.GetListWeapon(weapon, quality, from);
                }
            }
            dgvWeapon.DataSource = weapon.AsReadOnly();
        }
 public DataInputController(IWeaponService weaponService)
 {
     this._weaponService = new WeaponService(weaponService);
 }
Beispiel #10
0
 public WeaponController(WeaponService ws)
 {
     _wepServ = ws;
 }
Beispiel #11
0
        private WeaponService CreateWeaponService()
        {
            var weaponService = new WeaponService();

            return(weaponService);
        }
Beispiel #12
0
        public void GiveMaxClipAmmo()
        {
            var weapon = WeaponService.GetWeaponFromWeaponEnumOrNull(WeaponEnum);

            CurrentClipAmmo = weapon.MaxClipAmmo;
        }
Beispiel #13
0
 public Weapon GetWeapon()
 {
     return(WeaponService.GetWeaponFromWeaponEnumOrNull(WeaponEnum));
 }