Skip to content
This repository has been archived by the owner on Sep 12, 2023. It is now read-only.

Commit

Permalink
another commit for issue #62
Browse files Browse the repository at this point in the history
  • Loading branch information
ontehfritz committed Jun 25, 2014
1 parent cc65eee commit 9378841
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 44 deletions.
21 changes: 14 additions & 7 deletions src/www.mtgdb.info/www.mtgdb.info.userprefs
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
<Properties>
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
<MonoDevelop.Ide.Workbench ActiveDocument="www.mtgdb.info/Views/Deck/Deck.cshtml">
<MonoDevelop.Ide.Workbench ActiveDocument="www.mtgdb.info/Helpers/Render.cs">
<Files>
<File FileName="www.mtgdb.info/Views/Card.cshtml" Line="24" Column="6" />
<File FileName="www.mtgdb.info/Views/Card.cshtml" Line="1" Column="1" />
<File FileName="www.mtgdb.info/Views/Deck/Deck.cshtml" Line="28" Column="18" />
<File FileName="www.mtgdb.info/Modules/DeckViewerModule.cs" Line="1" Column="1" />
<File FileName="www.mtgdb.info/Models/Views/DeckModel.cs" Line="7" Column="46" />
<File FileName="www.mtgdb.info/Models/Views/DeckModel.cs" Line="1" Column="1" />
<File FileName="www.mtgdb.info/Models/Views/DecksModel.cs" Line="1" Column="1" />
<File FileName="www.mtgdb.info/Models/Deck.cs" Line="114" Column="14" />
<File FileName="www.mtgdb.info/Views/_Cards.cshtml" Line="1" Column="76" />
<File FileName="www.mtgdb.info/Views/Deck/_Cards.cshtml" Line="2" Column="1" />
<File FileName="www.mtgdb.info/Models/Deck.cs" Line="67" Column="53" />
<File FileName="www.mtgdb.info/Views/_Cards.cshtml" Line="1" Column="1" />
<File FileName="www.mtgdb.info/Views/Deck/_Cards.cshtml" Line="1" Column="1" />
<File FileName="www.mtgdb.info/Views/_Sets.cshtml" Line="1" Column="1" />
<File FileName="www.mtgdb.info/Views/Book.cshtml" Line="50" Column="59" />
<File FileName="www.mtgdb.info/Views/Book.cshtml" Line="1" Column="1" />
<File FileName="www.mtgdb.info/Helpers/MtgFile.cs" Line="1" Column="1" />
<File FileName="www.mtgdb.info/Helpers/Html.cs" Line="1" Column="1" />
<File FileName="www.mtgdb.info/Helpers/ErrorUtility.cs" Line="1" Column="1" />
<File FileName="www.mtgdb.info/Helpers/Email.cs" Line="1" Column="1" />
<File FileName="www.mtgdb.info/Helpers/Bind.cs" Line="1" Column="1" />
<File FileName="www.mtgdb.info/Helpers/Render.cs" Line="1" Column="1" />
<File FileName="www.mtgdb.info/Content/css/mtgdb.css" Line="735" Column="21" />
</Files>
</MonoDevelop.Ide.Workbench>
<MonoDevelop.Ide.DebuggingService.Breakpoints>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
70 changes: 52 additions & 18 deletions src/www.mtgdb.info/www.mtgdb.info/Models/Deck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,7 @@ public Deck ()
"Planeswalker"
});

Types.Add("land", new List<string>(){
"Artifact Land",
"Basic Land",
"Basic Snow Land",
"Land",
"Legendary Land",
"Legendary Snow Land",
"Snow Land"
});


Types.Add("instant", new List<string>(){
"Instant",
"Interrupt",
Expand All @@ -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<string>(){
"Artifact",
"Legendary Artifact",
"Snow Artifact",
"Tribal Artifact"
});

Types.Add("land", new List<string>(){
"Artifact Land",
"Basic Land",
"Basic Snow Land",
"Land",
"Legendary Land",
"Legendary Snow Land",
"Snow Land"
});

Types.Add("other", new List<string>(){
"Conspiracy",
"Eaturecray",
"Scariest Creature You'll Ever See"
});
}

public void SetCards(int [] mvids)
Expand All @@ -102,7 +118,6 @@ public void SetCards(int [] mvids)
}
}


Cards = deckCard.Select(c => new DeckCard {
MultiverseId = c.Key, Amount = c.Value
}).ToList();
Expand All @@ -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();
Expand All @@ -148,23 +162,30 @@ public Card[] GetCards()

public Card[] GetCards(string type)
{
List<Card> cards = new List<Card>();

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)
Expand All @@ -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)
{
Expand Down
5 changes: 4 additions & 1 deletion src/www.mtgdb.info/www.mtgdb.info/Views/About.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHLwYJKoZIhvcNAQcEoIIHIDCCBxwCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiB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9gwDQYJKoZIhvcNAQEBBQAEgYCQOeUhnIJuGkLzKfbcFRGIx1IPITNXEVRgAXYMqHRPWV6ajTaWOa49DCh9YHIaYuPS3rrNFQi5XhYYev4gXa3vwli3GmKqyp/xPicLRqbAOZCtRvSZLqRFBXHTDQRycmwJGysJqo1ao60hbweOH2KrlDM8BKV6YnPSgzbWd4TnDw==-----END PKCS7-----
">
<input class="donate" type="image" src="http://api.mtgdb.info/content/images/donate.png" name="submit" alt="PayPal - The safer, easier way to pay online!">
<input class="donate" type="image" src="https://api.mtgdb.info/content/images/donate.png" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>

Expand Down Expand Up @@ -331,4 +331,7 @@
<li>
<h3><a href="https://twitter.com/mtgdb"><i class="fa fa-twitter"></i> Twitter</a></h3>
</li>
<li>
<h3><a href="https://jabbr.net/#/rooms/mtgdbinfo"><i class="fa fa-comment"></i> Chat Room</a></h3>
</li>
</ul>
54 changes: 40 additions & 14 deletions src/www.mtgdb.info/www.mtgdb.info/Views/Deck/Deck.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,53 @@
<button type="submit" class="btn btn-primary btn-lg">Render</button>
</form>
</div>
<div style="float:left;border: 1px solid black;margin-left: 20px;width:800px;" id="deck">
<div id="creatures">
@if(@Model.Deck != null && @Model.Deck.Cards.Count > 0)
<div style="float:left;margin-left: 20px;width:800px;" id="deck">
@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())
<div id="@type">
<h4>@type</h4>
@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++)
{
int top = 0;
string topStyle = string.Format("{0}px;", top);
int max = @Model.Deck.CardCount(card.Id) - (times * 4);
<div style="float:left;margin-left:10px;">
<div style="position:relative;height:140px;" class="deck-card" data-container="body" data-toggle="popover" data-placement="right"
data-content="<image src='@card.CardImage' />" data-title="@card.Name">

<image src="@card.CardImage" style="position:relative;width:65px;height:87px; z-index: 0;display:block;" />
@for(int i = 1; (i < max && i < 4); i++ )
{
top = i * -70;
topStyle = string.Format("{0}px;", top);
<image src="@card.CardImage"
style="position:relative;width:65px;height:87px; z-index: @i; display: block;top:@topStyle" />
}
</div>
</div>
}
}
<br style="clear:both;" />
</div>
}
}
<div id="sidebar">
@if(@Model.Deck != null && @Model.Deck.SideBar.Count > 0)
{
<h1>Side Bar</h1>
foreach(var card in Model.Deck.GetSideBarCards())
{
int repeat = (int)System.Math.Ceiling(@Model.Deck.SideBarCardCount(card.Id) / 4.0);
for(int times = 0; times < repeat; times++)
{
int top = 0;
string topStyle = string.Format("{0}px;", top);
int max = @Model.Deck.SideBarCardCount(card.Id) - (times * 4);
<div style="float:left;margin-left:10px;">
<div style="position:relative;height:140px;">
<image src="@card.CardImage" style="position:relative;width:65px;height:87px; z-index: 0;display:block;"/>
Expand All @@ -42,17 +77,8 @@
}
}
}

<br style="clear:both;" />
</div>
<div id="spells">
</div>
<div id="artifacts">
</div>
<div id="other">
</div>
<div id="lands">
</div>
</div>
</div>
</div>
<br style="clear:both;" />
Expand Down
3 changes: 0 additions & 3 deletions src/www.mtgdb.info/www.mtgdb.info/test.dec
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9378841

Please sign in to comment.