Blue-Eyes White Dragon: Difference between revisions
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
<?php | |||
const CSS_VERSION = 96; | |||
$id = intval($_GET['id']); | |||
require_once '../../api/lib/mobile_detect.php'; | |||
$detect = new Mobile_Detect; | |||
$isMobile = 'false'; | |||
if ($detect->isMobile() && !($detect->isTablet())) { | |||
$isMobile = 'true'; | |||
} | |||
require_once '../../api/database.inc.php'; | |||
$mysqli = Database::get(); | |||
$card = []; | |||
if (!($stmt = $mysqli->prepare('SELECT name, description, ot, alias, type, atk, def, level, race, attribute, category, genre, ocgdate, tcgdate, tcgplayer, cardmarket FROM cards WHERE id = ?')) | |||
|| !$stmt->bind_param('i', $id) | |||
|| !$stmt->execute()) { | |||
echo "error 1"; | |||
} | |||
if (!$stmt->bind_result($card['name'], $card['description'], $card['ot'], $card['alias'], $card['type'], $card['atk'], $card['def'], $card['level'], $card['race'], $card['attribute'], $card['category'], $card['genre'], $card['ocgdate'], $card['tcgdate'], $card['tcgplayer'], $card['cardmarket']) || !$stmt->fetch()) { | |||
$stmt->close(); | |||
echo "error 2"; | |||
} | |||
$stmt->close(); | |||
//Set Card Type | |||
$type = ""; | |||
if ($card['type'] & 0x01) | |||
$type = "Monster"; | |||
else if ($card['type'] & 0x02) | |||
$type = "Spell"; | |||
else if ($card['type'] & 0x04) | |||
$type = "Trap"; | |||
//Set Card Types | |||
$types = ""; | |||
if ($card['type'] & 0x10) | |||
addCardType("Normal"); | |||
if ($card['type'] & 0x20) | |||
addCardType("Effect"); | |||
if ($card['type'] & 0x40) | |||
addCardType("Fusion"); | |||
if ($card['type'] & 0x80) | |||
addCardType("Ritual"); | |||
if ($card['type'] & 0x100) | |||
addCardType("Trap Monster"); | |||
if ($card['type'] & 0x200) | |||
addCardType("Spirit"); | |||
if ($card['type'] & 0x400) | |||
addCardType("Union"); | |||
if ($card['type'] & 0x800) | |||
addCardType("Gemini"); | |||
if ($card['type'] & 0x1000) | |||
addCardType("Tuner"); | |||
if ($card['type'] & 0x2000) | |||
addCardType("Synchro"); | |||
if ($card['type'] & 0x4000) | |||
addCardType("Token"); | |||
if ($card['type'] & 0x10000) | |||
addCardType("Quick Play"); | |||
if ($card['type'] & 0x20000) | |||
addCardType("Continuous"); | |||
if ($card['type'] & 0x40000) | |||
addCardType("Equip"); | |||
if ($card['type'] & 0x80000) | |||
addCardType("Field"); | |||
if ($card['type'] & 0x100000) | |||
addCardType("Counter"); | |||
if ($card['type'] & 0x200000) | |||
addCardType("Flip"); | |||
if ($card['type'] & 0x400000) | |||
addCardType("Toon"); | |||
if ($card['type'] & 0x800000) | |||
addCardType("XYZ"); | |||
if ($card['type'] & 0x1000000) | |||
addCardType("Pendulum"); | |||
if ($card['type'] & 0x2000000) | |||
addCardType("Special Summon"); | |||
if ($card['type'] & 0x4000000) | |||
addCardType("Link"); | |||
function addCardType($type) { | |||
global $types; | |||
if ($types === "") | |||
$types = $type; | |||
else | |||
$types .= "," . $type; | |||
} | |||
//Set Card Race | |||
$race = ""; | |||
if ($card['race'] & 0x1) | |||
$race = "Warrior"; | |||
else if ($card['race'] & 0x2) | |||
$race = "Spellcaster"; | |||
else if ($card['race'] & 0x4) | |||
$race = "Fairy"; | |||
else if ($card['race'] & 0x8) | |||
$race = "Fiend"; | |||
else if ($card['race'] & 0x10) | |||
$race = "Zombie"; | |||
else if ($card['race'] & 0x20) | |||
$race = "Machine"; | |||
else if ($card['race'] & 0x40) | |||
$race = "Aqua"; | |||
else if ($card['race'] & 0x80) | |||
$race = "Pyro"; | |||
else if ($card['race'] & 0x100) | |||
$race = "Rock"; | |||
else if ($card['race'] & 0x200) | |||
$race = "Winged Beast"; | |||
else if ($card['race'] & 0x400) | |||
$race = "Plant"; | |||
else if ($card['race'] & 0x800) | |||
$race = "Insect"; | |||
else if ($card['race'] & 0x1000) | |||
$race = "Thunder"; | |||
else if ($card['race'] & 0x2000) | |||
$race = "Dragon"; | |||
else if ($card['race'] & 0x4000) | |||
$race = "Beast"; | |||
else if ($card['race'] & 0x8000) | |||
$race = "Beast-Warrior"; | |||
else if ($card['race'] & 0x10000) | |||
$race = "Dinosaur"; | |||
else if ($card['race'] & 0x20000) | |||
$race = "Fish"; | |||
else if ($card['race'] & 0x40000) | |||
$race = "Sea Serpent"; | |||
else if ($card['race'] & 0x80000) | |||
$race = "Reptile"; | |||
else if ($card['race'] & 0x100000) | |||
$race = "Psychic"; | |||
else if ($card['race'] & 0x200000) | |||
$race = "Divine-Beast"; | |||
else if ($card['race'] & 0x400000) | |||
$race = "Creator God"; | |||
else if ($card['race'] & 0x800000) | |||
$race = "Wyrm"; | |||
else if ($card['race'] & 0x1000000) | |||
$race = "Cyberse"; | |||
else if ($card['race'] & 0x2000000) | |||
$race = "Cyborg "; | |||
else if ($card['race'] & 0x4000000) | |||
$race = "Magical Knight"; | |||
else if ($card['race'] & 0x8000000) | |||
$race = "High Dragon"; | |||
else if ($card['race'] & 0x10000000) | |||
$race = "Omega Psychic"; | |||
else if ($card['race'] & 0x20000000) | |||
$race = "Celestial Warrior"; | |||
else if ($card['race'] & 0x40000000) | |||
$race = "Galaxy"; | |||
//Set Card Attribute | |||
$attribute = ""; | |||
if ($card['attribute'] & 0x01) | |||
$attribute = "Earth"; | |||
else if ($card['attribute'] & 0x02) | |||
$attribute = "Water"; | |||
else if ($card['attribute'] & 0x04) | |||
$attribute = "Fire"; | |||
else if ($card['attribute'] & 0x08) | |||
$attribute = "Wind"; | |||
else if ($card['attribute'] & 0x10) | |||
$attribute = "Light"; | |||
else if ($card['attribute'] & 0x20) | |||
$attribute = "Dark"; | |||
else if ($card['attribute'] & 0x40) | |||
$attribute = "Divine"; | |||
//Set Card Attack | |||
$attack = $card['atk']; | |||
if ($card['atk'] === -2) | |||
$attack = "?"; | |||
//Set Card Defense | |||
$defense = $card['def']; | |||
if ($card['def'] === -2) | |||
$defense = "?"; | |||
//Set Pendulum Scales | |||
$lScale = ($card['level'] >> 0x18) & 0xff; | |||
$rScale = ($card['level'] >> 0x10) & 0xff; | |||
$scales = $lScale . "/" . $rScale; | |||
//Set Link Markers | |||
$linkMarkers = ""; | |||
if ($card['def'] & 0x01) | |||
$linkMarkers .= "↙"; | |||
if ($card['def'] & 0x02) | |||
$linkMarkers .= "↓"; | |||
if ($card['def'] & 0x04) | |||
$linkMarkers .= "↘"; | |||
if ($card['def'] & 0x08) | |||
$linkMarkers .= "←"; | |||
if ($card['def'] & 0x20) | |||
$linkMarkers .= "→"; | |||
if ($card['def'] & 0x40) | |||
$linkMarkers .= "↖"; | |||
if ($card['def'] & 0x80) | |||
$linkMarkers .= "↑"; | |||
if ($card['def'] & 0x100) | |||
$linkMarkers .= "↗"; | |||
//Set TCG Release Date | |||
$tcgReleaseDate = "Not Released"; | |||
if ($card['tcgdate'] < 253401955200) | |||
$tcgReleaseDate = date("M d, Y", $card['tcgdate']); | |||
//Set OCG Release Date | |||
$ocgReleaseDate = "Not Released"; | |||
if ($card['ocgdate'] < 253401955200) | |||
$ocgReleaseDate = date("M d, Y", $card['ocgdate']); | |||
$shortDescription = substr($card['description'], 0, 120); | |||
$descriptionWords = explode( " ", $shortDescription ); | |||
array_splice( $descriptionWords, -1 ); | |||
$shortDescription = implode( " ", $descriptionWords ); | |||
?> | |||
<!doctype html> | |||
<html> | <html> | ||
< | <head> | ||
< | <meta charset="utf-8"> | ||
<meta name="description" content="<?php echo $card['name']; ?> - <?php echo $shortDescription; ?>"> | |||
<meta name="keywords" content="yugioh, deck, decks, card, cards, free, game, duel"> | |||
<title><?php echo $card['name']; ?> - Yu-Gi-Oh! Card - Dueling Nexus</title> | |||
<link rel="shortcut icon" href="/favicon.ico"> | |||
<link rel="stylesheet" href="style/cards.css?v=<?php echo CSS_VERSION; ?>"> | |||
<script src="../../lib/jquery-2.1.3.min.js"></script> | |||
<script> | |||
$(document).ready(function(){ | |||
var JS_VERSION = 384; | |||
var id = <?php echo $id ?>; | |||
if (id > 120000000) | |||
$("#alternative-arts").hide(); | |||
$("#card-image").attr("src", "https://cdn.statically.io/gh/The-Olacaryn-Nebulae/TheOlacarynNebulae/638f749/" + id + ".jpg"); | |||
$.getJSON("../../assets/data/cards.json?v=" + JS_VERSION, function(data) { | |||
for (let i = 0; i < data['cards'].length; ++i) { | |||
if (data['cards'][i].id === id) { | |||
setCardType(<?php echo $card['type'] ?>, data['cards'][i].rac); | |||
setCardTypes(<?php echo $card['type'] ?>, "<?php echo $types ?>"); | |||
setArchtype(data['cards'][i].sc); | |||
setAlternativeArts(data['cards'][i].als); | |||
loadPacks(data['cards'][i].als); | |||
getBanlistStatus(); | |||
getRelatedCards(data['cards'][i].als, data['cards'][i].sc); | |||
break; | |||
} | |||
} | |||
}); | |||
var isMobile = <?php echo $isMobile; ?>; | |||
if (isMobile) { | |||
$("#navbar").css("height", "150px"); | |||
$(".topnav").css("width", "150px"); | |||
$(".topnav").css("font-size", "1.5vh"); | |||
$(".topnav").css("line-height", "120px"); | |||
$("#navbar-logo").css("width", "250px"); | |||
$("#navbar-logo").css("left", "475px"); | |||
$("#card-search-container").css("margin-right", "10px"); | |||
$("#card-search-input").css("height", "50px"); | |||
$("#card-search-input").css("min-width", "350px"); | |||
$("#card-search-input").css("display", "block"); | |||
$("#card-search-input").css("font-size", "30px"); | |||
$("#card-name-search-button").css("font-size", "30px"); | |||
$("#card-name-search-button").css("width", "50%"); | |||
$("#card-name-search-button").css("margin-left", "50%"); | |||
$("#card-name-search-button").css("height", "60px"); | |||
$("#card-container").css("width", "100%"); | |||
$("#card-image").css("width", "90%"); | |||
$("#card-image").css("margin-top", "5%"); | |||
$("#card-image").css("margin-left", "5%"); | |||
$("#card-image").css("height", "131%"); | |||
$("#alternative-arts").css("width", "90.45%"); | |||
$("#alternative-arts").css("max-width", "90.45%"); | |||
$("#alternative-arts").css("padding-left", "0px"); | |||
$("#alternative-arts").css("margin-left", "5%"); | |||
$("#alternative-card-image").css("width", "19.5%"); | |||
$("#alternative-card-image").css("margin-right", "0.5%"); | |||
$("#card-data").css("width", "94%"); | |||
$("#card-data").css("margin-left", "3%"); | |||
$("#card-name").css("font-size", "3vh"); | |||
$("#card-name").css("line-height", "5vh"); | |||
$("#card-data-table").css("font-size", "2vh"); | |||
$("#card-type-label").css("width", "35%"); | |||
$("#card-type-label").css("height", "4vh"); | |||
$("#card-types-label").css("height", "4vh"); | |||
$("#card-race-label").css("height", "4vh"); | |||
$("#card-attribute-label").css("height", "4vh"); | |||
$("#card-level-label").css("height", "4vh"); | |||
$("#card-attack-label").css("height", "4vh"); | |||
$("#card-defense-label").css("height", "4vh"); | |||
$("#card-pendulum-scales-label").css("height", "4vh"); | |||
$("#card-link-level-label").css("height", "4vh"); | |||
$("#card-link-arrows-label").css("height", "4vh"); | |||
$("#card-id-label").css("height", "4vh"); | |||
$("#card-archetypes-label").css("height", "4vh"); | |||
$("#card-tcg-release-label").css("height", "4vh"); | |||
$("#card-ocg-release-label").css("height", "4vh"); | |||
$("#tcg-status").css("font-size", "2vh"); | |||
$("#tcg-status").css("width", "40%"); | |||
$("#tcg-status").css("margin-left", "5%"); | |||
$("#ocg-status").css("font-size", "2vh"); | |||
$("#ocg-status").css("width", "40%"); | |||
$("#ocg-status").css("margin-left", "5%"); | |||
$("#card-description-label").css("font-size", "2vh"); | |||
$("#card-description-data").css("font-size", "1vh"); | |||
$("#card-description-data").css("padding", "20px"); | |||
$("#find-decks").css("font-size", "2vh"); | |||
$("#find-decks").css("height", "7vh"); | |||
$("#find-decks").css("float", "left"); | |||
$("#buy-card-tcgplayer").css("font-size", "2vh"); | |||
$("#buy-card-tcgplayer").css("height", "7vh"); | |||
$("#buy-card-tcgplayer").css("float", "left"); | |||
$("#buy-card-cardmarket").css("font-size", "2vh"); | |||
$("#buy-card-cardmarket").css("height", "7vh"); | |||
$("#buy-card-cardmarket").css("float", "left"); | |||
$("#card-packs-tcg-title").css("font-size", "2vh"); | |||
$("#card-packs-ocg-title").css("font-size", "2vh"); | |||
$(".card-pack-title").css("font-size", "2vh"); | |||
$("#card-pack").css("font-size", "2vh"); | |||
$("#card-packs-tcg-show-all").css("font-size", "2vh"); | |||
$("#card-packs-tcg-show-all").css("padding-top", "30px"); | |||
$("#card-packs-tcg-show-all").css("padding-bottom", "30px"); | |||
$("#card-packs-tcg-show-all").css("padding-left", "30px"); | |||
$("#card-packs-tcg-show-all").css("padding-right", "30px"); | |||
$("#card-packs-ocg-show-all").css("font-size", "2vh"); | |||
$("#card-packs-ocg-show-all").css("padding-top", "30px"); | |||
$("#card-packs-ocg-show-all").css("padding-bottom", "30px"); | |||
$("#card-packs-ocg-show-all").css("padding-left", "30px"); | |||
$("#card-packs-ocg-show-all").css("padding-right", "30px"); | |||
$("#related-cards").css("font-size", "2vh"); | |||
$("#footer").css("font-size", "1.5vh"); | |||
} | |||
setCardType = function(type, race) { | |||
console.log(race); | |||
if (type & 0x02) { | |||
$("#card-type-data").html("Spell"); | |||
$(".if-not-spell").hide(); | |||
} else if (type & 0x04) { | |||
$("#card-type-data").html("Trap"); | |||
if (typeof(race) === "undefined") | |||
$(".if-not-trap").hide(); | |||
} | |||
} | |||
setCardTypes = function(type, types) { | |||
if (type & 0x800000) | |||
$("#card-level-label").html("Rank"); | |||
if (!(type & 0x1000000)) | |||
$(".if-pendulum").hide(); | |||
if (type & 0x4000000) | |||
$(".if-not-link").hide() | |||
else | |||
$(".if-link").hide() | |||
if (types == "") | |||
$("#card-types").hide(); | |||
} | |||
setArchtype = function(archetype) { | |||
if (!archetype) { | |||
$("#card-archetypes").hide(); | |||
return; | |||
} | |||
let cardArchetypes = archetype.toString().split(","); | |||
$.getJSON("../../assets/data/archtypes.json?v=" + JS_VERSION, function(data) { | |||
let archetypes = data['archtypes']; | |||
for (let i = 0; i < data['archtypes'].length; ++i) { | |||
if (cardArchetypes.includes(data['archtypes'][i].id.toString())) { | |||
addArchetype(data['archtypes'][i].name); | |||
} | |||
} | |||
}); | |||
} | |||
addArchetype = function(archetype) { | |||
if ($("#card-archetypes-data").html() === "") | |||
$("#card-archetypes-data").html(archetype); | |||
else | |||
$("#card-archetypes-data").html($("#card-archetypes-data").html() + ", " + archetype); | |||
} | |||
setAlternativeArts = function(alias) { | |||
let mainId = id; | |||
let totalAlternativeCardImageCount = 0; | |||
if (alias) { | |||
mainId = alias; | |||
let alternativeCardImage = $("#alternative-card-image").clone().appendTo($("#alternative-arts")); | |||
alternativeCardImage.attr("src", "https://cdn.statically.io/gh/The-Olacaryn-Nebulae/TheOlacarynNebulae/638f749/" + alias + ".jpg"); | |||
alternativeCardImage.click(function() { | |||
$("#card-image").attr("src", "https://cdn.statically.io/gh/The-Olacaryn-Nebulae/TheOlacarynNebulae/638f749/" + alias + ".jpg"); | |||
}); | |||
totalAlternativeCardImageCount++; | |||
} | |||
$.getJSON("../../assets/data/cards.json?v=" + JS_VERSION, function(data) { | |||
for (let i = 0; i < data['cards'].length; ++i) { | |||
if (data['cards'][i].als === mainId) { | |||
alternativeCardImage = $("#alternative-card-image").clone().appendTo($("#alternative-arts")); | |||
alternativeCardImage.attr("src", "https://cdn.statically.io/gh/The-Olacaryn-Nebulae/TheOlacarynNebulae/638f749/" + data['cards'][i].id + ".jpg"); | |||
alternativeCardImage.click(function() { | |||
$("#card-image").attr("src", "https://cdn.statically.io/gh/The-Olacaryn-Nebulae/TheOlacarynNebulae/638f749/" + data['cards'][i].id + ".jpg"); | |||
}); | |||
totalAlternativeCardImageCount++; | |||
} | |||
} | |||
if (totalAlternativeCardImageCount > 0 && mainId !== alias) { | |||
alternativeCardImage = $("#alternative-card-image").clone().prependTo($("#alternative-arts")); | |||
alternativeCardImage.attr("src", "https://cdn.statically.io/gh/The-Olacaryn-Nebulae/TheOlacarynNebulae/638f749/" + id + ".jpg"); | |||
alternativeCardImage.click(function() { | |||
$("#card-image").attr("src", "https://cdn.statically.io/gh/The-Olacaryn-Nebulae/TheOlacarynNebulae/638f749/" + id + ".jpg"); | |||
}); | |||
totalAlternativeCardImageCount++; | |||
} | |||
}) | |||
} | |||
class Pack { | |||
constructor(id, abbr, name, ocgdate, tcgdate) { | |||
this.id = id; | |||
this.abbr = abbr; | |||
this.name = name; | |||
this.ocgdate = ocgdate; | |||
this.tcgdate = tcgdate; | |||
} | |||
} | |||
let packList = []; | |||
loadPacks = function(alias) { | |||
$.getJSON("../../assets/data/packs.json?v=" + JS_VERSION, function(data) { | |||
for (let i = 0; i < data['packs'].length; ++i) | |||
packList.push(new Pack(data['packs'][i].id, data['packs'][i].abbr, data['packs'][i].name, data['packs'][i].ocgdate, data['packs'][i].tcgdate)); | |||
loadCardPacks(alias); | |||
}) | |||
} | |||
loadCardPacks = function(alias) { | |||
cardId = id; | |||
if (alias) | |||
cardId = alias; | |||
$.getJSON("../../assets/data/relations.json?v=" + JS_VERSION, function(data) { | |||
let tcgPacks = 0; | |||
let ocgPacks = 0; | |||
for (let i = 0; i < data['relations'].length; ++i) { | |||
if (data['relations'][i].cardId === cardId) { | |||
for (let j = 0; j < packList.length; ++j) { | |||
if (packList[j].id === data['relations'][i].packId) { | |||
if (packList[j].tcgdate < 253401955200) { | |||
let pack = $("#card-pack").clone().appendTo($("#card-packs-tcg-table")); | |||
pack.find("#card-pack-abbr").html(packList[j].abbr); | |||
pack.find("#card-pack-name").html(packList[j].name); | |||
let tcgDate = new Date(packList[j].tcgdate * 1000); | |||
pack.find("#card-pack-release-date").html(tcgDate.toLocaleDateString('en-us', {year:"numeric", month:"short", day:"numeric"})); | |||
if (tcgPacks < 3) | |||
pack.show(); | |||
else | |||
pack.addClass("pack-hidden-tcg"); | |||
tcgPacks++; | |||
} | |||
if (packList[j].ocgdate < 253401955200) { | |||
let pack = $("#card-pack").clone().appendTo($("#card-packs-ocg-table")); | |||
pack.find("#card-pack-abbr").html(packList[j].abbr); | |||
pack.find("#card-pack-name").html(packList[j].name); | |||
let ocgDate = new Date(packList[j].ocgdate * 1000); | |||
pack.find("#card-pack-release-date").html(ocgDate.toLocaleDateString('en-us', {year:"numeric", month:"short", day:"numeric"})); | |||
if (ocgPacks < 3) | |||
pack.show(); | |||
else | |||
pack.addClass("pack-hidden-ocg"); | |||
ocgPacks++; | |||
} | |||
} | |||
} | |||
} | |||
} | |||
if (tcgPacks > 0) { | |||
$("#card-packs-tcg-title").show(); | |||
$("#card-packs-tcg-table").show(); | |||
if (tcgPacks > 3) | |||
$("#card-packs-tcg-show-all").show(); | |||
} | |||
if (ocgPacks > 0) { | |||
if (tcgPacks > 0) | |||
$("#card-packs-ocg-title").css("margin-top", "35px"); | |||
$("#card-packs-ocg-title").show(); | |||
$("#card-packs-ocg-table").show(); | |||
if (ocgPacks > 3) | |||
$("#card-packs-ocg-show-all").show(); | |||
} | |||
}) | |||
} | |||
let tcgPacksShown = false; | |||
$("#card-packs-tcg-show-all").click(function() { | |||
if (tcgPacksShown) { | |||
$(".pack-hidden-tcg").hide(); | |||
$("#card-packs-tcg-show-all").html("Show All"); | |||
tcgPacksShown = false; | |||
} else { | |||
$(".pack-hidden-tcg").show(); | |||
$("#card-packs-tcg-show-all").html("Hide Packs"); | |||
tcgPacksShown = true; | |||
} | |||
}); | |||
let ocgPacksShown = false; | |||
$("#card-packs-ocg-show-all").click(function() { | |||
if (ocgPacksShown) { | |||
$(".pack-hidden-ocg").hide(); | |||
$("#card-packs-ocg-show-all").html("Show All"); | |||
ocgPacksShown = false; | |||
} else { | |||
$(".pack-hidden-ocg").show(); | |||
$("#card-packs-ocg-show-all").html("Hide Packs"); | |||
ocgPacksShown = true; | |||
} | |||
}); | |||
getBanlistStatus = function() { | |||
$.getJSON("../../assets/data/banlists.json?v=" + JS_VERSION, function(data) { | |||
for (let i = 0; i < data['banlists'].length; ++i) { | |||
if (data['banlists'][i].name.includes("TCG")) { | |||
let status = "TCG Status: Unlimited"; | |||
let bannedIds = data['banlists'][i].bannedIds.toString().split(","); | |||
for (let i = 0; i < bannedIds.length; ++i) { | |||
if (bannedIds[i] == id) | |||
status = "TCG Status: Banned"; | |||
} | |||
let limitedIds = data['banlists'][i].limitedIds.toString().split(","); | |||
for (let i = 0; i < limitedIds.length; ++i) { | |||
if (limitedIds[i] == id) | |||
status = "TCG Status: Limited"; | |||
} | |||
let semiLimitedIds = data['banlists'][i].semiLimitedIds.toString().split(","); | |||
for (let i = 0; i < semiLimitedIds.length; ++i) { | |||
if (semiLimitedIds[i] == id) | |||
status = "TCG Status: Semi-Limited"; | |||
} | |||
$("#tcg-status").html(status); | |||
if (status === "TCG Status: Unlimited") { | |||
$("#tcg-status").css("color", "#000000"); | |||
$("#tcg-status").css("background-color", "#05FF01"); | |||
} else if (status === "TCG Status: Semi-Limited") { | |||
$("#tcg-status").css("color", "#000000"); | |||
$("#tcg-status").css("background-color", "#FEE100"); | |||
} else if (status === "TCG Status: Limited") { | |||
$("#tcg-status").css("color", "#FFFFFF"); | |||
$("#tcg-status").css("background-color", "#EF7619"); | |||
} else if (status === "TCG Status: Banned") { | |||
$("#tcg-status").css("color", "#FFFFFF"); | |||
$("#tcg-status").css("background-color", "#F00000"); | |||
} | |||
} | |||
if (data['banlists'][i].name.includes("OCG")) { | |||
let status = "OCG Status: Unlimited"; | |||
let bannedIds = data['banlists'][i].bannedIds.toString().split(","); | |||
for (let i = 0; i < bannedIds.length; ++i) { | |||
if (bannedIds[i] == id) | |||
status = "OCG Status: Banned"; | |||
} | |||
let limitedIds = data['banlists'][i].limitedIds.toString().split(","); | |||
for (let i = 0; i < limitedIds.length; ++i) { | |||
if (limitedIds[i] == id) | |||
status = "OCG Status: Limited"; | |||
} | |||
let semiLimitedIds = data['banlists'][i].semiLimitedIds.toString().split(","); | |||
for (let i = 0; i < semiLimitedIds.length; ++i) { | |||
if (semiLimitedIds[i] == id) | |||
status = "OCG Status: Semi-Limited"; | |||
} | |||
$("#ocg-status").html(status); | |||
if (status === "OCG Status: Unlimited") { | |||
$("#ocg-status").css("color", "#000000"); | |||
$("#ocg-status").css("background-color", "#05FF01"); | |||
} else if (status === "OCG Status: Semi-Limited") { | |||
$("#ocg-status").css("color", "#000000"); | |||
$("#ocg-status").css("background-color", "#FEE100"); | |||
} else if (status === "OCG Status: Limited") { | |||
$("#ocg-status").css("color", "#FFFFFF"); | |||
$("#ocg-status").css("background-color", "#EF7619"); | |||
} else if (status === "OCG Status: Banned") { | |||
$("#ocg-status").css("color", "#FFFFFF"); | |||
$("#ocg-status").css("background-color", "#F00000"); | |||
} | |||
} | |||
} | |||
}) | |||
} | |||
let cards; | |||
getRelatedCards = function(alias, archetypes) { | |||
$.getJSON("../../assets/data/cards_en.json?v=" + JS_VERSION, function(data) { | |||
cards = data['texts']; | |||
for (let i = 0; i < data['texts'].length; ++i) { | |||
$('#cards-datalist').append($("<option>").attr('value', data['texts'][i].n).text(data['texts'][i].n)); | |||
} | |||
let cardAlias = -1; | |||
if (alias) | |||
cardAlias = alias; | |||
if (!archetypes) | |||
return; | |||
let cardArchetypes = archetypes.toString().split(","); | |||
let relatedImages = []; | |||
$.getJSON("../../assets/data/cards.json?v=" + JS_VERSION, function(data) { | |||
let relatedCards = 0; | |||
let relatedCardsCounter = 0; | |||
for (let i = 0; i < data['cards'].length; ++i) { | |||
if (data['cards'][i].id !== id && !data['cards'][i].als && data['cards'][i].id !== cardAlias) { | |||
if (data['cards'][i].sc) { | |||
let selectedArchetypes = data['cards'][i].sc.toString().split(","); | |||
for (let j = 0; j < selectedArchetypes.length; ++j) { | |||
if (cardArchetypes.includes(selectedArchetypes[j]) && !relatedImages.includes(data['cards'][i].id)) { | |||
relatedImages.push(data['cards'][i].id); | |||
let relatedCardImage = $("#related-card-image").clone().appendTo($("#related-cards")); | |||
relatedCardImage.attr("src", "https://cdn.statically.io/gh/The-Olacaryn-Nebulae/TheOlacarynNebulae/638f749/" + data['cards'][i].id + ".jpg"); | |||
let relatedCardImageLink = "https://duelingnexus.com/browse/cards/" + data['cards'][i].id; | |||
for (let k = 0; k < cards.length; ++k) { | |||
if (cards[k].id === data['cards'][i].id) { | |||
relatedCardImageLink += "-" + cards[i].n.replace(/ /g, "-").replace(/[^a-zA-Z0-9-]/g, ""); | |||
break; | |||
} | |||
} | |||
relatedCardImage.click(function() { | |||
window.open(relatedCardImageLink, "_blank").focus(); | |||
}); | |||
relatedCards++; | |||
relatedCardsCounter++; | |||
if (relatedCardsCounter !== 1) | |||
relatedCardImage.css("margin-left", "0.8%"); | |||
if (relatedCardsCounter === 6) | |||
relatedCardsCounter = 0; | |||
} | |||
} | |||
} | |||
} | |||
if (relatedCards == 12) | |||
break; | |||
} | |||
if (relatedCards > 0) { | |||
$("#related-cards").show(); | |||
} | |||
}); | |||
}); | |||
} | |||
$("#find-decks").click(function() { | |||
window.open("https://duelingnexus.com/browse/yugioh-deck/index.php?cardId=" + id, "_blank").focus(); | |||
}); | |||
$("#buy-card-tcgplayer").click(function() { | |||
window.open("https://www.tcgplayer.com/search/yugioh/product?productLineName=yugioh&q=" + "<?php echo $card['name']; ?>".replace(/ /g, "+"), "_blank").focus(); | |||
}); | |||
$("#buy-card-cardmarket").click(function() { | |||
window.open("https://www.cardmarket.com/en/YuGiOh/Cards/" + "<?php echo $card['name']; ?>".replace(/ /g, "-"), "_blank").focus(); | |||
}); | |||
$("#navbar-logo").click(function() { | |||
window.open("https://duelingnexus.com", "_blank").focus(); | |||
}); | |||
$("#card-name-search-button").click(function() { | |||
for (let i = 0; i < cards.length; ++i) { | |||
if (cards[i].n === $("#card-search-input").val()) { | |||
window.open("https://duelingnexus.com/browse/cards/" + cards[i].id + "-" + cards[i].n.replace(/ /g, "-").replace(/[^a-zA-Z0-9-]/g, ""), "_blank").focus(); | |||
break; | |||
} | |||
} | |||
}); | |||
}); | |||
</script> | |||
</head> | |||
<body style="overflow: visible;"> | |||
<script type="text/javascript"> | |||
var _paq = _paq || []; | |||
_paq.push(['trackPageView']); | |||
_paq.push(['enableLinkTracking']); | |||
_paq.push(['enableHeartBeatTimer', 30]); | |||
(function() { | |||
var u="/flower/"; | |||
_paq.push(['setTrackerUrl', u+'flower.nexus']); | |||
_paq.push(['setSiteId', '1']); | |||
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; | |||
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'flower.js'; s.parentNode.insertBefore(g,s); | |||
})(); | |||
</script> | |||
<div id="card-page"> | |||
<div id="navbar"> | |||
<img id="navbar-logo" src="../../../assets/images/logo-full.png"> | |||
<a id= "duel_nav" class="topnav" href="https://duelingnexus.com">Duel</a> | |||
<a id= "deck_nav" class="topnav" href="https://duelingnexus.com/browse/yugioh-deck">Decks</a> | |||
<div id="card-search-container"> | |||
<input id="card-search-input" type="text" list="cards-datalist" placeholder="Enter Card Name..."> | |||
<button id="card-name-search-button">Search</button> | |||
<datalist id="cards-datalist"></datalist> | |||
</div> | |||
</div> | |||
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5258574472184148" | |||
crossorigin="anonymous"></script> | |||
<!-- Yu-Gi-Oh! Card Page Ad --> | |||
<ins class="adsbygoogle" | |||
style="display:block" | |||
data-ad-client="ca-pub-5258574472184148" | |||
data-ad-slot="1133449190" | |||
data-ad-format="auto" | |||
data-full-width-responsive="true"></ins> | |||
<script> | |||
(adsbygoogle = window.adsbygoogle || []).push({}); | |||
</script> | |||
<div id="card-container"> | |||
<img id="card-image" src=""> | |||
<div id="alternative-arts"></div> | |||
<img id="alternative-card-image" src=""> | |||
</div> | |||
<div id="card-data"> | |||
<p id="card-name"><?php echo $card['name']; ?></p> | |||
<table id="card-data-table"> | |||
<tr id="card-type"><td id="card-type-label">Card Type:</td><td id="card-type-data"><?php echo $type; ?></td></tr> | |||
<tr id="card-types"><td id="card-types-label">Category:</td><td id="card-types-data"><?php echo $types; ?></td></tr> | |||
<tr id="card-race" class="if-not-spell if-not-trap"><td id="card-race-label">Type:</td><td id="card-race-data"><?php echo $race; ?></td></tr> | |||
<tr id="card-attribute" class="if-not-spell if-not-trap"><td id="card-attribute-label">Attribute:</td><td id="card-attribute-data"><?php echo $attribute; ?></td></tr> | |||
<tr id="card-level" class="if-not-link if-not-spell if-not-trap"><td id="card-level-label">Level:</td><td id="card-level-data">★<?php echo $card['level'] & 0xFF; ?></td></tr> | |||
<tr id="card-attack" class="if-not-spell if-not-trap"><td id="card-attack-label">Attack:</td><td id="card-attack-data"><?php echo $attack; ?></td></tr> | |||
<tr id="card-defense" class="if-not-link if-not-spell if-not-trap"><td id="card-defense-label">Defense:</td><td id="card-defense-data"><?php echo $defense; ?></td></tr> | |||
<tr id="card-pendulum-scales" class="if-pendulum"><td id="card-pendulum-scales-label">Pendulum Scales:</td><td id="card-pendulum-scales-data"><?php echo $scales; ?></td></tr> | |||
<tr id="card-link-level" class="if-link"><td id="card-link-level-label">Link Rating:</td><td id="card-link-level-data"><?php echo $card['level'] & 0xFF; ?></td></tr> | |||
<tr id="card-link-arrows" class="if-link"><td id="card-link-arrows-label">Link Arrows:</td><td id="card-link-arrows-data"><?php echo $linkMarkers; ?></td></tr> | |||
<tr id="card-id"><td id="card-id-label">ID:</td><td id="card-id-data"><?php echo $id; ?></td></tr> | |||
<tr id="card-archetypes"><td id="card-archetypes-label">Archetypes:</td><td id="card-archetypes-data"></td></tr> | |||
<tr id="card-tcg-release"><td id="card-tcg-release-label">TCG Release:</td><td id="card-tcg-release-data"><?php echo $tcgReleaseDate ?></td></tr> | |||
<tr id="card-ocg-release"><td id="card-ocg-release-label">OCG Release:</td><td id="card-ocg-release-data"><?php echo $ocgReleaseDate ?></td></tr> | |||
</table> | |||
<p id="tcg-status" class="banlist-status"></p> | |||
<p id="ocg-status" class="banlist-status"></p> | |||
<p id="card-description-label" class="card-data-span">Description:</p> | |||
<p id="card-description-data"><?php echo $card['description']; ?></p> | |||
<div id="card-container-buttons"><button id="find-decks" class="card-container-button">Find in Decks</button><button id="buy-card-tcgplayer" class="card-container-button">Buy on TCGplayer</button><button id="buy-card-cardmarket" class="card-container-button">Buy on Cardmarket</button></div> | |||
</div> | |||
<div id="card-packs"> | |||
<p id="card-packs-tcg-title" class="sets-title" hidden>TCG Sets</p> | |||
<table id="card-packs-tcg-table" class="card-packs-table" hidden> | |||
<tr class="card-pack-title"><th id="card-pack-abbr-title">ID</th><th id="card-pack-name-title">Name</th><th id="card-pack-release-date-title">Release Date</th></tr> | |||
<tr id="card-pack" hidden><td id="card-pack-abbr"></td><td id="card-pack-name"></td><td id="card-pack-release-date"></td></tr> | |||
</table> | |||
<button id="card-packs-tcg-show-all" class="show-all-packs-button" hidden>Show All</button> | |||
<p id="card-packs-ocg-title" class="sets-title" hidden>OCG Sets</p> | |||
<table id="card-packs-ocg-table" class="card-packs-table" hidden> | |||
<tr class="card-pack-title"><th id="card-pack-abbr-title">ID</th><th id="card-pack-name-title">Name</th><th id="card-pack-release-date-title">Release Date</th></tr> | |||
<tr id="card-pack" hidden><td id="card-pack-abbr"></td><td id="card-pack-name"></td><td id="card-pack-release-date"></td></tr> | |||
</table> | |||
<button id="card-packs-ocg-show-all" class="show-all-packs-button" hidden>Show All</button> | |||
</div> | |||
<div id="related-cards" hidden> | |||
<p>Related Cards</p> | |||
</div> | </div> | ||
<img id="related-card-image" src=""> | |||
< | <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5258574472184148" | ||
crossorigin="anonymous"></script> | |||
<!-- Yu-Gi-Oh! Card Page Ad --> | |||
<ins class="adsbygoogle" | |||
style="display:block" | |||
data-ad-client="ca-pub-5258574472184148" | |||
data-ad-slot="1133449190" | |||
data-ad-format="auto" | |||
data-full-width-responsive="true"></ins> | |||
<script> | |||
(adsbygoogle = window.adsbygoogle || []).push({}); | |||
</script> | |||
<div id="footer"> | |||
Dueling Nexus is the best free to play Yu-Gi-Oh! online game, updated daily, with all cards available for free. Dueling Nexus has the largest database of Yu-Gi-Oh! decks in the world. To import a deck, head over to <a class="no-decoration" href="https://duelingnexus.com/browse/yugioh-deck" target="_blank">yugioh deck</a> and search for any deck name you would like, or use our advanced filter options. | |||
</div> | </div> | ||
</div> | </div> | ||
</ | </body> | ||
</html> | </html> | ||
Revision as of 09:39, 17 May 2023
<?php
const CSS_VERSION = 96;
$id = intval($_GET['id']);
require_once '../../api/lib/mobile_detect.php'; $detect = new Mobile_Detect; $isMobile = 'false'; if ($detect->isMobile() && !($detect->isTablet())) { $isMobile = 'true'; }
require_once '../../api/database.inc.php';
$mysqli = Database::get();
$card = [];
if (!($stmt = $mysqli->prepare('SELECT name, description, ot, alias, type, atk, def, level, race, attribute, category, genre, ocgdate, tcgdate, tcgplayer, cardmarket FROM cards WHERE id = ?')) || !$stmt->bind_param('i', $id)
|| !$stmt->execute()) {
echo "error 1"; }
if (!$stmt->bind_result($card['name'], $card['description'], $card['ot'], $card['alias'], $card['type'], $card['atk'], $card['def'], $card['level'], $card['race'], $card['attribute'], $card['category'], $card['genre'], $card['ocgdate'], $card['tcgdate'], $card['tcgplayer'], $card['cardmarket']) || !$stmt->fetch()) {
$stmt->close(); echo "error 2";
} $stmt->close();
//Set Card Type $type = ""; if ($card['type'] & 0x01) $type = "Monster"; else if ($card['type'] & 0x02) $type = "Spell"; else if ($card['type'] & 0x04) $type = "Trap";
//Set Card Types $types = ""; if ($card['type'] & 0x10) addCardType("Normal"); if ($card['type'] & 0x20) addCardType("Effect"); if ($card['type'] & 0x40) addCardType("Fusion"); if ($card['type'] & 0x80) addCardType("Ritual"); if ($card['type'] & 0x100) addCardType("Trap Monster"); if ($card['type'] & 0x200) addCardType("Spirit"); if ($card['type'] & 0x400) addCardType("Union"); if ($card['type'] & 0x800) addCardType("Gemini"); if ($card['type'] & 0x1000) addCardType("Tuner"); if ($card['type'] & 0x2000) addCardType("Synchro"); if ($card['type'] & 0x4000) addCardType("Token"); if ($card['type'] & 0x10000) addCardType("Quick Play"); if ($card['type'] & 0x20000) addCardType("Continuous"); if ($card['type'] & 0x40000) addCardType("Equip"); if ($card['type'] & 0x80000) addCardType("Field"); if ($card['type'] & 0x100000) addCardType("Counter"); if ($card['type'] & 0x200000) addCardType("Flip"); if ($card['type'] & 0x400000) addCardType("Toon"); if ($card['type'] & 0x800000) addCardType("XYZ"); if ($card['type'] & 0x1000000) addCardType("Pendulum"); if ($card['type'] & 0x2000000) addCardType("Special Summon"); if ($card['type'] & 0x4000000) addCardType("Link");
function addCardType($type) { global $types;
if ($types === "") $types = $type; else $types .= "," . $type; }
//Set Card Race $race = ""; if ($card['race'] & 0x1) $race = "Warrior"; else if ($card['race'] & 0x2) $race = "Spellcaster"; else if ($card['race'] & 0x4) $race = "Fairy"; else if ($card['race'] & 0x8) $race = "Fiend"; else if ($card['race'] & 0x10) $race = "Zombie"; else if ($card['race'] & 0x20) $race = "Machine"; else if ($card['race'] & 0x40) $race = "Aqua"; else if ($card['race'] & 0x80) $race = "Pyro"; else if ($card['race'] & 0x100) $race = "Rock"; else if ($card['race'] & 0x200) $race = "Winged Beast"; else if ($card['race'] & 0x400) $race = "Plant"; else if ($card['race'] & 0x800) $race = "Insect"; else if ($card['race'] & 0x1000) $race = "Thunder"; else if ($card['race'] & 0x2000) $race = "Dragon"; else if ($card['race'] & 0x4000) $race = "Beast"; else if ($card['race'] & 0x8000) $race = "Beast-Warrior"; else if ($card['race'] & 0x10000) $race = "Dinosaur"; else if ($card['race'] & 0x20000) $race = "Fish"; else if ($card['race'] & 0x40000) $race = "Sea Serpent"; else if ($card['race'] & 0x80000) $race = "Reptile"; else if ($card['race'] & 0x100000) $race = "Psychic"; else if ($card['race'] & 0x200000) $race = "Divine-Beast"; else if ($card['race'] & 0x400000) $race = "Creator God"; else if ($card['race'] & 0x800000) $race = "Wyrm"; else if ($card['race'] & 0x1000000) $race = "Cyberse"; else if ($card['race'] & 0x2000000) $race = "Cyborg "; else if ($card['race'] & 0x4000000) $race = "Magical Knight"; else if ($card['race'] & 0x8000000) $race = "High Dragon"; else if ($card['race'] & 0x10000000) $race = "Omega Psychic"; else if ($card['race'] & 0x20000000) $race = "Celestial Warrior"; else if ($card['race'] & 0x40000000) $race = "Galaxy";
//Set Card Attribute $attribute = ""; if ($card['attribute'] & 0x01) $attribute = "Earth"; else if ($card['attribute'] & 0x02) $attribute = "Water"; else if ($card['attribute'] & 0x04) $attribute = "Fire"; else if ($card['attribute'] & 0x08) $attribute = "Wind"; else if ($card['attribute'] & 0x10) $attribute = "Light"; else if ($card['attribute'] & 0x20) $attribute = "Dark"; else if ($card['attribute'] & 0x40) $attribute = "Divine";
//Set Card Attack $attack = $card['atk']; if ($card['atk'] === -2) $attack = "?";
//Set Card Defense $defense = $card['def']; if ($card['def'] === -2) $defense = "?";
//Set Pendulum Scales $lScale = ($card['level'] >> 0x18) & 0xff; $rScale = ($card['level'] >> 0x10) & 0xff; $scales = $lScale . "/" . $rScale;
//Set Link Markers $linkMarkers = ""; if ($card['def'] & 0x01) $linkMarkers .= "↙"; if ($card['def'] & 0x02) $linkMarkers .= "↓"; if ($card['def'] & 0x04) $linkMarkers .= "↘"; if ($card['def'] & 0x08) $linkMarkers .= "←"; if ($card['def'] & 0x20) $linkMarkers .= "→"; if ($card['def'] & 0x40) $linkMarkers .= "↖"; if ($card['def'] & 0x80) $linkMarkers .= "↑"; if ($card['def'] & 0x100) $linkMarkers .= "↗";
//Set TCG Release Date $tcgReleaseDate = "Not Released"; if ($card['tcgdate'] < 253401955200) $tcgReleaseDate = date("M d, Y", $card['tcgdate']);
//Set OCG Release Date $ocgReleaseDate = "Not Released"; if ($card['ocgdate'] < 253401955200) $ocgReleaseDate = date("M d, Y", $card['ocgdate']);
$shortDescription = substr($card['description'], 0, 120); $descriptionWords = explode( " ", $shortDescription ); array_splice( $descriptionWords, -1 ); $shortDescription = implode( " ", $descriptionWords ); ?>
<!doctype html>
| Card Type: | |
| Category: | |
| Type: | |
| Attribute: | |
| Level: | ★ |
| Attack: | |
| Defense: | |
| Pendulum Scales: | |
| Link Rating: | |
| Link Arrows: | |
| ID: | |
| Archetypes: | |
| TCG Release: | |
| OCG Release: |
Description:
TCG Sets
| ID | Name | Release Date |
|---|---|---|
OCG Sets
| ID | Name | Release Date |
|---|---|---|
