Skip to content

Commit

Permalink
Merge pull request #697 from distributive/main
Browse files Browse the repository at this point in the history
Updated the name of the organisation
  • Loading branch information
plural authored Sep 30, 2022
2 parents d524345 + 14ba267 commit 36a8a78
Show file tree
Hide file tree
Showing 6 changed files with 165 additions and 165 deletions.
312 changes: 156 additions & 156 deletions app/Resources/views/Banlists/banlists.html.twig
Original file line number Diff line number Diff line change
@@ -1,156 +1,156 @@
{% extends '/layout.html.twig' %}

{% block title %}Ban Lists{% endblock %}

{% block body %}
{% include '/Scripts/api.html.twig' %}
{% include '/Scripts/panels.html.twig' %}
<div class="container" id="banlists">
<h1>{{ block('title') }}</h1>
<div>
<p>There are currently three official <a href="{{ path('formats') }}">formats</a> supported by NISEI: Startup, Standard, and Eternal. This page displays the ban lists for each.</p>
<h2>Explanation</h2>
<ul>
<li><b>Banned:</b> You cannot include any copies of a banned card in your deck.</li>
<li><b>Points:</b> Including any number of copies of a card with points in Eternal adds points to your deck. Eternal decks must have 7 points or fewer.</li>
<li><b>Restricted (deprecated):</b> You may include up to a full playset of only one restricted card.</li>
<li><b>Universal Influence (deprecated):</b> Cards with universal influence cost additional influence to include in a deck.</li>
<li><b>Identity Influence Reduction (deprecated):</b> These cards reduce your identity's influence limit by 1 for each copy (to a minimum of 1).</li>
</ul>
<p>See <a href="https://nisei.net/players/supported-formats/">NISEI's Supported Formats page</a> for more information.</p>
</div>
<hr>
<div id="restrictions-root" role="tabpanel" style="display: none;">
<!-- Nav tabs -->
<ul class="nav nav-pills nav-justified" role="tablist" style="margin-bottom:20px">
<li role="presentation"><a href="#tab-pane-startup" role="tab" data-toggle="tab">Startup</a></li>
<li role="presentation" class="active"><a href="#tab-pane-standard" role="tab" data-toggle="tab">Standard</a></li>
<li role="presentation"><a href="#tab-pane-eternal" role="tab" data-toggle="tab">Eternal</a></li>
</ul>
<hr>
<!-- Tab panes -->
<div class="tab-content">
<div role="tabpanel" class="tab-pane" id="tab-pane-startup"></div>
<div role="tabpanel" class="tab-pane active" id="tab-pane-standard"></div>
<div role="tabpanel" class="tab-pane" id="tab-pane-eternal"></div>
</div>
</div>

<noscript>
<p class="text-center">Please enable JavaScript to view this page fully.</p>
<hr>
</noscript>
</div>

<script>
// Takes a list of cards and an object mapping integers to lists of card IDs
// Returns a new object with the cards in place of their IDs
function makeCardMap(cards, obj) {
return Object.keys(obj).reduce(function(newObj, key) {
newObj[key] = cards.filter(card => obj[key].includes(card.id));
return newObj
}, {});
}
// Creates a list of cards with the given header
function generateList(header, cards, pre='') {
if (pre.length > 0) {
pre = `<li>${pre}</li>`;
}
return cards.reduce((text, card) => {
return text + `<li><a href="${cardToLatestPrintingLink(card)}">${card.attributes.title}</a></li>`;
}, `<li><strong>${header}</strong><ul>${pre}`) + '</ul></li>';
}
async function buildBanlistsView() {
// Unhide the restrictions view (accounting for browsers with JS disabled)
$('#restrictions-root').show();
// Add a temporary loading indicator
$('.tab-pane').append(loading_icon);
// Load data from API
const desiredFormats = ['startup', 'standard', 'eternal'];
const [formats, cards, restrictions] = await Promise.all([
fetchData(`{{ v3_api_url }}/api/v3/public/formats`).then(fs => fs.filter(f => desiredFormats.includes(f.id))),
fetchCards(`?include=card_subtypes&filter[search]=in_restriction:true`, 250).then(splitBySide),
fetchData(`{{ v3_api_url }}/api/v3/public/restrictions?sort=-date_start`)
]);
// Remove the loading indicator
$('.temp-loading').remove();
// Add each format to the page
formats.forEach(f => {
const jqPane = $(`#tab-pane-${f.id}`);
const formatRestrictions = restrictions.filter(r => f.attributes.restriction_ids.includes(r.id));
if (formatRestrictions.length == 0) {
jqPane.append(`<p>No cards are currently banned in ${f.attributes.name}. Have a blast!</p>`);
} else {
const panelList = new PanelList(jqPane, null, false, "toggle", "search");
formatRestrictions.forEach(r => {
const active = r.id == f.attributes.active_restriction_id;
const visible = active || r.id == formatRestrictions[0].id;
// Create panel
const panel = panelList.createPanel(r.id, visible);
panel.addHeader(r.attributes.name);
panel.addSubheader(`<a href=${Routing.generate('cards_find', {type:'find', 'view':'list', 'q':`b!${r.id.replaceAll('_', '-')}`})}>${r.attributes.size} cards</a>. Start Date: ${r.attributes.date_start}.`);
// Get content data
const v = r.attributes.verdicts;
// Lists (bans, restricted cards, global penalty cards)
const [corpBan, runnerBan] = cards.map(cs => cs.filter(card => v.banned?.includes(card.id)));
const [corpRes, runnerRes] = cards.map(cs => cs.filter(card => v.restricted?.includes(card.id)));
const [corpPen, runnerPen] = cards.map(cs => cs.filter(card => v.global_penalty?.includes(card.id)));
// Mappings (points, universal faction costs)
const [corpUFC, runnerUFC] = cards.map(cs => makeCardMap(cs, v.universal_faction_cost));
const [corpPts, runnerPts] = cards.map(cs => makeCardMap(cs, v.points));
// Add body
panel.addBody();
panel.addBodyContent(`<div class="container-fluid"><div class="row flex-fill"><div class="col-md-6"><h3>Corp Cards</h3><ul class="corp"></ul></div><div class="col-md-6"><h3>Runner Cards</h3><ul class="runner"></ul></div></div></div>`);
// Generate corp restrictions
const jqCorp = panel.body.find('ul.corp');
// Bans (banned subtypes (i.e. currents) are removed beforehand to reduce length)
if (corpBan.length > 0) {
if (r.attributes.banned_subtypes.length > 0) { // NOTE: currently hardcoded to only be currents
const pre = `All cards with the <strong><a href="${Routing.generate('cards_find', {type:'find', 'view':'list', 'q':'s:current d:corp'})}">Current</a></strong> subtype.`;
jqCorp.append(generateList('Banned', removeCurrents(corpBan), pre));
} else {
jqCorp.append(generateList('Banned', corpBan));
}
}
// The others
if (corpRes.length > 0) { jqCorp.append(generateList('Restricted', corpRes)); }
Object.keys(corpUFC).sort().reverse().forEach(p => { jqCorp.append(generateList(`+${p} Universal Influence`, corpUFC[p])); });
if (corpPen.length > 0) { jqCorp.append(generateList('Identity Influence Reduction', corpPen)); }
Object.keys(corpPts).sort().reverse().forEach(p => { jqCorp.append(generateList(`${p} ${p == 1 ? 'Point' : 'Points'}`, corpPts[p])); });
// Generate runner restrictions
const jqRunner = panel.body.find('ul.runner');
// Bans (banned subtypes (i.e. currents) are removed beforehand to reduce length)
if (runnerBan.length > 0) {
if (r.attributes.banned_subtypes.length > 0) { // NOTE: currently hardcoded to only be currents
const pre = `All cards with the <strong><a href="${Routing.generate('cards_find', {type:'find', 'view':'list', 'q':'s:current d:runner'})}">Current</a></strong> subtype.`;
jqRunner.append(generateList('Banned', removeCurrents(runnerBan), pre));
} else {
jqRunner.append(generateList('Banned', runnerBan));
}
}
// The others
if (runnerRes.length > 0) { jqRunner.append(generateList('Restricted', runnerRes)); }
Object.keys(runnerUFC).sort().reverse().forEach(p => { jqRunner.append(generateList(`+${p} Universal Influence`, runnerUFC[p])); });
if (runnerPen.length > 0) { jqRunner.append(generateList('Identity Influence Reduction', runnerPen)); }
Object.keys(runnerPts).sort().reverse().forEach(p => { jqRunner.append(generateList(`${p} ${p == 1 ? 'Point' : 'Points'}`, runnerPts[p])); });
});
}
});
}
// Create the banlists view on load
buildBanlistsView();
</script>
{% endblock %}
{% extends '/layout.html.twig' %}

{% block title %}Ban Lists{% endblock %}

{% block body %}
{% include '/Scripts/api.html.twig' %}
{% include '/Scripts/panels.html.twig' %}
<div class="container" id="banlists">
<h1>{{ block('title') }}</h1>
<div>
<p>There are currently three official <a href="{{ path('formats') }}">formats</a> supported by Null Signal Games: Startup, Standard, and Eternal. This page displays the ban lists for each.</p>
<h2>Explanation</h2>
<ul>
<li><b>Banned:</b> You cannot include any copies of a banned card in your deck.</li>
<li><b>Points:</b> Including any number of copies of a card with points in Eternal adds points to your deck. Eternal decks must have 7 points or fewer.</li>
<li><b>Restricted (deprecated):</b> You may include up to a full playset of only one restricted card.</li>
<li><b>Universal Influence (deprecated):</b> Cards with universal influence cost additional influence to include in a deck.</li>
<li><b>Identity Influence Reduction (deprecated):</b> These cards reduce your identity's influence limit by 1 for each copy (to a minimum of 1).</li>
</ul>
<p>See <a href="https://nullsignal.games/players/supported-formats/">Null Signal Games' Supported Formats page</a> for more information.</p>
</div>
<hr>
<div id="restrictions-root" role="tabpanel" style="display: none;">
<!-- Nav tabs -->
<ul class="nav nav-pills nav-justified" role="tablist" style="margin-bottom:20px">
<li role="presentation"><a href="#tab-pane-startup" role="tab" data-toggle="tab">Startup</a></li>
<li role="presentation" class="active"><a href="#tab-pane-standard" role="tab" data-toggle="tab">Standard</a></li>
<li role="presentation"><a href="#tab-pane-eternal" role="tab" data-toggle="tab">Eternal</a></li>
</ul>
<hr>
<!-- Tab panes -->
<div class="tab-content">
<div role="tabpanel" class="tab-pane" id="tab-pane-startup"></div>
<div role="tabpanel" class="tab-pane active" id="tab-pane-standard"></div>
<div role="tabpanel" class="tab-pane" id="tab-pane-eternal"></div>
</div>
</div>

<noscript>
<p class="text-center">Please enable JavaScript to view this page fully.</p>
<hr>
</noscript>
</div>

<script>
// Takes a list of cards and an object mapping integers to lists of card IDs
// Returns a new object with the cards in place of their IDs
function makeCardMap(cards, obj) {
return Object.keys(obj).reduce(function(newObj, key) {
newObj[key] = cards.filter(card => obj[key].includes(card.id));
return newObj
}, {});
}
// Creates a list of cards with the given header
function generateList(header, cards, pre='') {
if (pre.length > 0) {
pre = `<li>${pre}</li>`;
}
return cards.reduce((text, card) => {
return text + `<li><a href="${cardToLatestPrintingLink(card)}">${card.attributes.title}</a></li>`;
}, `<li><strong>${header}</strong><ul>${pre}`) + '</ul></li>';
}
async function buildBanlistsView() {
// Unhide the restrictions view (accounting for browsers with JS disabled)
$('#restrictions-root').show();
// Add a temporary loading indicator
$('.tab-pane').append(loading_icon);
// Load data from API
const desiredFormats = ['startup', 'standard', 'eternal'];
const [formats, cards, restrictions] = await Promise.all([
fetchData(`{{ v3_api_url }}/api/v3/public/formats`).then(fs => fs.filter(f => desiredFormats.includes(f.id))),
fetchCards(`?include=card_subtypes&filter[search]=in_restriction:true`, 250).then(splitBySide),
fetchData(`{{ v3_api_url }}/api/v3/public/restrictions?sort=-date_start`)
]);
// Remove the loading indicator
$('.temp-loading').remove();
// Add each format to the page
formats.forEach(f => {
const jqPane = $(`#tab-pane-${f.id}`);
const formatRestrictions = restrictions.filter(r => f.attributes.restriction_ids.includes(r.id));
if (formatRestrictions.length == 0) {
jqPane.append(`<p>No cards are currently banned in ${f.attributes.name}. Have a blast!</p>`);
} else {
const panelList = new PanelList(jqPane, null, false, "toggle", "search");
formatRestrictions.forEach(r => {
const active = r.id == f.attributes.active_restriction_id;
const visible = active || r.id == formatRestrictions[0].id;
// Create panel
const panel = panelList.createPanel(r.id, visible);
panel.addHeader(r.attributes.name);
panel.addSubheader(`<a href=${Routing.generate('cards_find', {type:'find', 'view':'list', 'q':`b!${r.id.replaceAll('_', '-')}`})}>${r.attributes.size} cards</a>. Start Date: ${r.attributes.date_start}.`);
// Get content data
const v = r.attributes.verdicts;
// Lists (bans, restricted cards, global penalty cards)
const [corpBan, runnerBan] = cards.map(cs => cs.filter(card => v.banned?.includes(card.id)));
const [corpRes, runnerRes] = cards.map(cs => cs.filter(card => v.restricted?.includes(card.id)));
const [corpPen, runnerPen] = cards.map(cs => cs.filter(card => v.global_penalty?.includes(card.id)));
// Mappings (points, universal faction costs)
const [corpUFC, runnerUFC] = cards.map(cs => makeCardMap(cs, v.universal_faction_cost));
const [corpPts, runnerPts] = cards.map(cs => makeCardMap(cs, v.points));
// Add body
panel.addBody();
panel.addBodyContent(`<div class="container-fluid"><div class="row flex-fill"><div class="col-md-6"><h3>Corp Cards</h3><ul class="corp"></ul></div><div class="col-md-6"><h3>Runner Cards</h3><ul class="runner"></ul></div></div></div>`);
// Generate corp restrictions
const jqCorp = panel.body.find('ul.corp');
// Bans (banned subtypes (i.e. currents) are removed beforehand to reduce length)
if (corpBan.length > 0) {
if (r.attributes.banned_subtypes.length > 0) { // NOTE: currently hardcoded to only be currents
const pre = `All cards with the <strong><a href="${Routing.generate('cards_find', {type:'find', 'view':'list', 'q':'s:current d:corp'})}">Current</a></strong> subtype.`;
jqCorp.append(generateList('Banned', removeCurrents(corpBan), pre));
} else {
jqCorp.append(generateList('Banned', corpBan));
}
}
// The others
if (corpRes.length > 0) { jqCorp.append(generateList('Restricted', corpRes)); }
Object.keys(corpUFC).sort().reverse().forEach(p => { jqCorp.append(generateList(`+${p} Universal Influence`, corpUFC[p])); });
if (corpPen.length > 0) { jqCorp.append(generateList('Identity Influence Reduction', corpPen)); }
Object.keys(corpPts).sort().reverse().forEach(p => { jqCorp.append(generateList(`${p} ${p == 1 ? 'Point' : 'Points'}`, corpPts[p])); });
// Generate runner restrictions
const jqRunner = panel.body.find('ul.runner');
// Bans (banned subtypes (i.e. currents) are removed beforehand to reduce length)
if (runnerBan.length > 0) {
if (r.attributes.banned_subtypes.length > 0) { // NOTE: currently hardcoded to only be currents
const pre = `All cards with the <strong><a href="${Routing.generate('cards_find', {type:'find', 'view':'list', 'q':'s:current d:runner'})}">Current</a></strong> subtype.`;
jqRunner.append(generateList('Banned', removeCurrents(runnerBan), pre));
} else {
jqRunner.append(generateList('Banned', runnerBan));
}
}
// The others
if (runnerRes.length > 0) { jqRunner.append(generateList('Restricted', runnerRes)); }
Object.keys(runnerUFC).sort().reverse().forEach(p => { jqRunner.append(generateList(`+${p} Universal Influence`, runnerUFC[p])); });
if (runnerPen.length > 0) { jqRunner.append(generateList('Identity Influence Reduction', runnerPen)); }
Object.keys(runnerPts).sort().reverse().forEach(p => { jqRunner.append(generateList(`${p} ${p == 1 ? 'Point' : 'Points'}`, runnerPts[p])); });
});
}
});
}
// Create the banlists view on load
buildBanlistsView();
</script>
{% endblock %}
2 changes: 1 addition & 1 deletion app/Resources/views/Default/donators.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<h1>The Gracious Donators</h1>
<p class="lead">NetrunnerDB wouldn't be the same without them. Many, many thanks.</p>
<p>This website is ad-free due to the generous donations of our generous Patreon supporters. Thank you all! We are working on new supporter perks as of October 2021, so please stay tuned!</p>
<p>To become a Donator and help run the site, you can use <a href="https://paypal.me/niseiproject">Paypal</a> or join the Project NISEI <a href="https://www.patreon.com/NISEI">Patreon</a>.</p>
<p>To become a Donator and help run the site, you can use <a href="https://paypal.me/niseiproject">Paypal</a> or join the Null Signal Games <a href="https://www.patreon.com/NullSignalGames">Patreon</a>.</p>
<ul>
{% for donator in donators %}
<li>
Expand Down
4 changes: 2 additions & 2 deletions app/Resources/views/Formats/formats.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

<div class="row">
<div class="col-sm-12">
<h2>NISEI Supported Formats</h2>
<h2>Null Signal Games' Supported Formats</h2>
<p>Card Pools and links to deck searches legal in those formats.</p>
<p>See <a href="https://nisei.net/players/supported-formats/">NISEI's Supported Formats page</a> for more information.</p>
<p>See <a href="https://nullsignal.games/players/supported-formats/">Null Signal Games' Supported Formats page</a> for more information.</p>
</div>
</div>

Expand Down
8 changes: 4 additions & 4 deletions app/Resources/views/layout.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@
</ul>

<p>
Designed and built by <a href="//twitter.com/alsciende">@alsciende</a>. Maintained by <a href="http://nisei.net/">NISEI</a>.
Designed and built by <a href="//twitter.com/alsciende">@alsciende</a>. Maintained by <a href="http://nullsignal.games/">Null Signal Games</a>.
</p>

<p>
Expand All @@ -224,14 +224,14 @@
You may contribute by giving money on <a href="https://paypal.me/niseiproject">Paypal</a>. (Please add a note with your username so that we can add you to the <a href="{{ path('donators') }}">Donators</a> list.)
</p>
<p>
Alternatively, you can check out the Project NISEI <a href="https://www.patreon.com/join/NISEI">Patreon</a>.
<a href="https://www.patreon.com/join/NISEI" class="patreon-button"><img src=" {{ asset('/become_a_patron_button.png') }} " height="40" alt="Become a Patron of NISEI!"/></a>
Alternatively, you can check out the Null Signal Games <a href="https://www.patreon.com/join/NullSignalGames">Patreon</a>.
<a href="https://www.patreon.com/join/NullSignalGames" class="patreon-button"><img src=" {{ asset('/become_a_patron_button.png') }} " height="40" alt="Become a Patron of Null Signal Games!"/></a>
</ul>

</p>

<p style="color:#333">
The information presented on this site about Android: Netrunner, both literal and graphical, is copyrighted by Fantasy Flight Games and/or NISEI.
The information presented on this site about Android: Netrunner, both literal and graphical, is copyrighted by Fantasy Flight Games and/or Null Signal Games.
</p>
<p style="color:#333">
This website is not produced, endorsed, supported, or affiliated with Fantasy Flight Games.
Expand Down
Loading

0 comments on commit 36a8a78

Please sign in to comment.