diff --git a/src/www.mtgdb.info/www.mtgdb.info.userprefs b/src/www.mtgdb.info/www.mtgdb.info.userprefs index 7e8f997..74571a5 100644 --- a/src/www.mtgdb.info/www.mtgdb.info.userprefs +++ b/src/www.mtgdb.info/www.mtgdb.info.userprefs @@ -1,17 +1,24 @@  - + - + - + - - - + + + - + + + + + + + + diff --git a/src/www.mtgdb.info/www.mtgdb.info/Content/javascript/mtgdb.info.js b/src/www.mtgdb.info/www.mtgdb.info/Content/javascript/mtgdb.info.js index 94ab942..64b10bd 100644 --- a/src/www.mtgdb.info/www.mtgdb.info/Content/javascript/mtgdb.info.js +++ b/src/www.mtgdb.info/www.mtgdb.info/Content/javascript/mtgdb.info.js @@ -108,7 +108,7 @@ $(document).ready(function() { $('.label-legality, .set-tab a').tooltip(); - $('.search-result, .binder-card, .my-card, .set-link').popover({trigger:'hover',html:true}); + $('.search-result, .binder-card, .my-card, .set-link, .deck-card').popover({trigger:'hover',html:true}); $('#check-yes').change(function(){ $chk = $(this).is(':checked'); diff --git a/src/www.mtgdb.info/www.mtgdb.info/Models/Deck.cs b/src/www.mtgdb.info/www.mtgdb.info/Models/Deck.cs index 37727e5..5bcd14d 100644 --- a/src/www.mtgdb.info/www.mtgdb.info/Models/Deck.cs +++ b/src/www.mtgdb.info/www.mtgdb.info/Models/Deck.cs @@ -54,16 +54,7 @@ public Deck () "Planeswalker" }); - Types.Add("land", new List(){ - "Artifact Land", - "Basic Land", - "Basic Snow Land", - "Land", - "Legendary Land", - "Legendary Snow Land", - "Snow Land" - }); - + Types.Add("instant", new List(){ "Instant", "Interrupt", @@ -80,10 +71,35 @@ public Deck () "Enchant Creature", "Enchant Player", "Enchantment", - "Legendary Enchantment" + "Legendary Enchantment", + "Legendary Enchantment Artifact", + "Snow Enchantment", + "Tribal Enchantment", + "World Enchantment" }); + Types.Add("artifact", new List(){ + "Artifact", + "Legendary Artifact", + "Snow Artifact", + "Tribal Artifact" + }); + + Types.Add("land", new List(){ + "Artifact Land", + "Basic Land", + "Basic Snow Land", + "Land", + "Legendary Land", + "Legendary Snow Land", + "Snow Land" + }); + Types.Add("other", new List(){ + "Conspiracy", + "Eaturecray", + "Scariest Creature You'll Ever See" + }); } public void SetCards(int [] mvids) @@ -102,7 +118,6 @@ public void SetCards(int [] mvids) } } - Cards = deckCard.Select(c => new DeckCard { MultiverseId = c.Key, Amount = c.Value }).ToList(); @@ -124,8 +139,7 @@ public void SetSideBar(int [] mvids) deckCard.Add(mvid,1); } } - - + SideBar = deckCard.Select(c => new DeckCard { MultiverseId = c.Key, Amount = c.Value }).ToList(); @@ -148,23 +162,30 @@ public Card[] GetCards() public Card[] GetCards(string type) { + List cards = new List(); + if(Cards != null) { int [] multiverseIds = Cards .Select(x => x.MultiverseId) .ToArray(); - return mtgDb.GetCards(multiverseIds) - .Where(x => x.Type.ToLower() == type.ToLower()) + Card [] all = mtgDb.GetCards(multiverseIds) .ToArray(); + + foreach(string t in this.Types[type.ToLower()]) + { + cards.AddRange(all + .Where(x => x.Type.ToLower() == t.ToLower())); + } } - return null; + return cards.ToArray(); } public Card[] GetSideBarCards() { - if(Cards != null) + if(SideBar != null) { int [] multiverseIds = SideBar .Select(x => x.MultiverseId) @@ -180,6 +201,19 @@ public int CardCount(int multiverseId) { DeckCard card = this.Cards.Find(x => x.MultiverseId == multiverseId); + + if(card != null) + { + return card.Amount; + } + + return 0; + } + + public int SideBarCardCount(int multiverseId) + { + DeckCard card = + this.SideBar.Find(x => x.MultiverseId == multiverseId); if(card != null) { diff --git a/src/www.mtgdb.info/www.mtgdb.info/Views/About.cshtml b/src/www.mtgdb.info/www.mtgdb.info/Views/About.cshtml index b7d91f8..1af2d89 100644 --- a/src/www.mtgdb.info/www.mtgdb.info/Views/About.cshtml +++ b/src/www.mtgdb.info/www.mtgdb.info/Views/About.cshtml @@ -10,7 +10,7 @@ - + @@ -331,4 +331,7 @@
  • Twitter

  • +
  • +

    Chat Room

    +
  • diff --git a/src/www.mtgdb.info/www.mtgdb.info/Views/Deck/Deck.cshtml b/src/www.mtgdb.info/www.mtgdb.info/Views/Deck/Deck.cshtml index e5042ea..39b333d 100644 --- a/src/www.mtgdb.info/www.mtgdb.info/Views/Deck/Deck.cshtml +++ b/src/www.mtgdb.info/www.mtgdb.info/Views/Deck/Deck.cshtml @@ -15,11 +15,14 @@ -
    -
    - @if(@Model.Deck != null && @Model.Deck.Cards.Count > 0) +
    +@foreach(string type in new string[]{"creature", "instant", "sorcery", "enchantment", "artifact", "land", "other"}) +{ + if(@Model.Deck != null && Model.Deck.GetCards(type).Length > 0) { - foreach(var card in Model.Deck.GetCards()) +
    +

    @type

    + @foreach(var card in Model.Deck.GetCards(type)) { int repeat = (int)System.Math.Ceiling(@Model.Deck.CardCount(card.Id) / 4.0); for(int times = 0; times < repeat; times++) @@ -27,6 +30,38 @@ int top = 0; string topStyle = string.Format("{0}px;", top); int max = @Model.Deck.CardCount(card.Id) - (times * 4); +
    +
    + + + @for(int i = 1; (i < max && i < 4); i++ ) + { + top = i * -70; + topStyle = string.Format("{0}px;", top); + + } +
    +
    + } + } +
    +
    + } +} +

    diff --git a/src/www.mtgdb.info/www.mtgdb.info/test.dec b/src/www.mtgdb.info/www.mtgdb.info/test.dec index 6d3909e..29f027c 100644 --- a/src/www.mtgdb.info/www.mtgdb.info/test.dec +++ b/src/www.mtgdb.info/www.mtgdb.info/test.dec @@ -17,9 +17,6 @@ 2 Koth of the Hammer 1 Sword of Body and Mind - - - SB: 1 Basilisk Collar SB: 4 Cunning Sparkmage SB: 3 Mark of Mutiny