Пример #1
0
        public IActionResult BuyCards(long X, long playerID)
        {
            HeroActionCard theCard = GetCardFromShop(X);

            _data.AddCardToCollection(playerID, theCard);
            _data.DeleteCardFromShop(theCard);
            Player current = Player.AssemblePlayer(playerID, _data);

            return(RedirectToAction("CardTrader", current));
        }
Пример #2
0
        public IActionResult CreateCard(string cardName, string rarity, int playSpeed, string actionText, int manaCost, int healthCost, int timeCost, string target, int physAtk, bool slashing, int slashBleed, int slashBleedDuration, bool piercing, int pierceArmor, bool bludgeon, int bludegonLower, int bludegonLowerDuration, bool shield, int shieldArmor, int shieldResistance, int shieldDuration, int magicAtk, bool fire, int fireBurn, int fireBurnDuration, bool electric, int electricSpeed, bool ice, int iceSlow, int iceSlowDurability, bool earth, int earthAbsorb, bool holy, int holyHeal, bool dark, int darkSteal, bool taunt, bool dispel, int multi, int mana, string requires, string subRequires, bool hitModify, int hitModifyPhys, int hitModifyMagic, int HitModifyDuration)
        {
            HeroActionCard newCard = new HeroActionCard
            {
                CardName              = cardName,
                PlaySpeed             = playSpeed,
                ActionText            = actionText,
                ManaCost              = manaCost,
                HealthCost            = healthCost,
                TimeCost              = timeCost,
                Target                = target,
                PhysAtk               = physAtk,
                Slashing              = slashing,
                SlashBleed            = slashBleed,
                SlashBleedDuration    = slashBleedDuration,
                Piercing              = piercing,
                PierceArmor           = pierceArmor,
                Bludgeon              = bludgeon,
                BludgeonLower         = bludegonLower,
                BludegonLowerDuration = bludegonLowerDuration,
                Shield                = shield,
                ShieldArmor           = shieldArmor,
                ShieldResistance      = shieldResistance,
                ShieldDuration        = shieldDuration,
                MagicAtk              = magicAtk,
                Fire             = fire,
                FireBurn         = fireBurn,
                FireBurnDuration = fireBurnDuration,
                Electric         = electric,
                ElectricSpeed    = electricSpeed,
                Ice               = ice,
                IceSlow           = iceSlow,
                IceSlowDurability = iceSlowDurability,
                Earth             = earth,
                EarthAbsorb       = earthAbsorb,
                Holy              = holy,
                HolyHeal          = holyHeal,
                Dark              = dark,
                DarkSteal         = darkSteal,
                Taunt             = taunt,
                Dispel            = dispel,
                MultiCast         = multi,
                Mana              = mana
            };

            using (IDbConnection db = new SqlConnection("Server=7RP7Q13\\SQLEXPRESS;Database=HeroCards;user id=csharp;password=abc123"))
            {
                db.Query($"Insert Into [HeroActionCard] (CardName, Rarity, PlaySpeed, ActionText, ManaCost, HealthCost, TimeCost, Target, PhysAtk, Slashing, SlashBleed, SlashBleedDuration, Piercing, PierceArmor, Bludgeon, BludgeonLower, BludgeonLowerDuration, Shield, ShieldArmor, ShieldResistance, ShieldDuration, MagicAtk, Fire, FireBurn, FireBurnDuration, Electric, ElectricSpeed, Ice, IceSlow, IceSlowDurability, Earth, EarthAbsorb, Holy, HolyHeal, Dark, DarkSteal, Taunt, Dispel, MultiCast, ManaManipulate, Requires, SubRequirment, HitModify, HitModifyPhys, HitModifyMagic, HitModifyDuration) Values ('{cardName}','{rarity}','{playSpeed}','{actionText}','{manaCost}','{healthCost}','{timeCost}','{target}','{physAtk}','{slashing}','{slashBleed}','{slashBleedDuration}','{piercing}','{pierceArmor}','{bludgeon}','{bludegonLower}','{bludegonLowerDuration}','{shield}','{shieldArmor}','{shieldResistance}','{shieldDuration}','{magicAtk}','{fire}','{fireBurn}','{fireBurnDuration}','{electric}','{electricSpeed}','{ice}','{iceSlow}','{iceSlowDurability}','{earth}','{earthAbsorb}','{holy}','{holyHeal}','{dark}','{darkSteal}','{taunt}','{dispel}','{multi}','{mana}','{requires}','{subRequires}','{hitModify}','{hitModifyPhys}','{hitModifyMagic}','{HitModifyDuration}')");
            }

            return(View(newCard));
        }
Пример #3
0
        public HeroActionCard GetCardFromShop(long ShopID)
        {
            List <HeroActionCard> ShopCards = _data.AllShopCards();
            HeroActionCard        theCard   = new HeroActionCard();

            foreach (HeroActionCard card in ShopCards)
            {
                if (card.ShopCardID == ShopID)
                {
                    theCard = card;
                }
            }
            return(theCard);
        }
Пример #4
0
        public HeroActionCard GetCardFromLibrary(long cardID)
        {
            List <HeroActionCard> cards   = GetLibrary();
            HeroActionCard        theCard = new HeroActionCard();

            foreach (HeroActionCard card in cards)
            {
                if (card.card_id == cardID)
                {
                    theCard = card;
                }
            }
            return(theCard);
        }
Пример #5
0
 public void DeleteCardFromShop(HeroActionCard card)
 {
     db.Query($"Delete from ShopCards where ShopCardID = {card.ShopCardID}");
 }
Пример #6
0
 public void AddCardToShop(HeroActionCard card)
 {
     db.Query($"insert into ShopCards (card_id) Values ({card.card_id})");
 }
Пример #7
0
 public void AddCardToCollection(long playerID, HeroActionCard card)
 {
     db.Query($"insert into CardCollection (playerID, cardID, card_level) Values ('{playerID}', '{card.card_id}', 1)");
 }