Added obtain info to Icon Kit

This commit is contained in:
GDColon 2021-01-14 12:02:38 -05:00
parent 8f4da00d03
commit 5c98087a1f
8 changed files with 185 additions and 6 deletions

View file

@ -404,6 +404,12 @@ input:focus, select:focus, textarea:focus, button:focus {
background: transparent;
}
.iconHover {
transform: scale(1.075);
background-color: rgb(255, 255, 255, 0.2);
border-radius: 10px;
}
.popup {
position: fixed;
display: none;

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View file

@ -38,6 +38,7 @@
</div>
<img id="iconkitlogo" src="../assets/iconkit.png" height=50px; style="margin: 7px 0;"><br>
<h2 style="margin: 5 auto 0 auto; display: none" id="howto"><span style='color: #aaaaaa'>(hover over an icon for info)</span></h2>
<div id="iconbox" style="min-height: 145px; display: inline-flex">
<img id="loading" src="../assets/loading.png" class="spin" height=85px; style="display: flex; align-self: center">
@ -50,9 +51,10 @@
<button class="blankButton menuButton" id="downloadIcon" title="Download icon"><a id="downloadLink" download="cube_1.png" href=""><img src="../assets/iconkitbuttons/save.png" width=60px></a></button>
<button class="blankButton menuButton" id="getUserIcon" title="Get player icon"><img src="../assets/iconkitbuttons/steal.png" width=60px></button>
<button class="blankButton menuButton" id="randomIcon" title="Random Icon"><img src="../assets/iconkitbuttons/shuffle.png" width=60px></button>
<button class="blankButton menuButton" id="unlockIcon" title="Unlock details"><img id="lock" src="../assets/iconkitbuttons/unlock.png" width=60px></button>
</div>
<div id="iconTabs"></div><br>
<div id="iconKitParent" class="iconKit">
<div id="iconKitParent" class="iconKit noDarken">
<div id="iconprogressbar">
<div id="iconloading"></div>
</div>
@ -113,6 +115,11 @@ let enableGlow = 0
let imagesLoaded = 0
let totalLoaded = 0
let shops = ["", "Scratch's ", "community "]
let achievements = []
let shopIcons = []
let unlockMode = false
if (mobile) $('#logo').attr('width', '80%');
let iconSettings = (localStorage.iconkit || "").split(",")
@ -188,7 +195,7 @@ fetch('./api/icons').then(res => {
iconStuff.colorOrder.forEach(function (p, n) {
if (iconSettings.includes("sort")) p = n;
colTypes.forEach(c => {
$(`#col${c}`).append(`<button col=${p} class="blankButton color${c}" title="Color ${p}" id="col${c}-${p}"><img src="../assets/previewicons/color_${p}.png" width=50px></button>`)
$(`#col${c}`).append(`<button col=${p} colType=color${c} class="blankButton color${c}" title="Color ${p}" id="col${c}-${p}"><img src="../assets/previewicons/color_${p}.png" width=50px></button>`)
})
})
$('#col1').append("<span style='min-width: 10px'></span>")
@ -234,8 +241,7 @@ fetch('./api/icons').then(res => {
var img = $(this).children().first()
img.attr('src', img.attr('src').replace('_off', '_on'));
$('#iconKitParent').each(function(x, y) {
$(this).children().not('#iconprogressbar').hide()})
$('#iconKitParent').each(function(x, y) { $(this).children().not('#iconprogressbar').hide() })
if ($(forms).html() == "") appendIcon(filterIcon(form), form)
@ -401,6 +407,49 @@ fetch('./api/icons').then(res => {
else $("#result").removeClass("squareIcon")
localStorage.iconkit = checkedSettings.join(",")
})
$('#unlockIcon').click(function() {
if (!achievements.length) {
fetch('./api/achievements').then(res => { res.json().then(x => {
achievements = x.achievements
shopIcons = x.shopIcons
unlockMode = true
$('#lock').attr('src', $('#lock').attr('src').replace('.png', '_on.png'));
$('#howto').show();
})})
}
else {
unlockMode = !unlockMode
if (unlockMode) { $('#lock').attr('src', $('#lock').attr('src').replace('.png', '_on.png')); $('#howto').show() }
else { $('#lock').attr('src', $('#lock').attr('src').replace('_on.png', '.png')); $('#howto').hide() }
}
})
$(document).on('mouseover', '.iconButton, .color1, .color2', function () {
if (unlockMode && achievements.length) {
$(this).addClass('iconHover')
let form = $(this).attr('form') || $(this).attr('colType')
let iconNumber = $(this).attr('num') || $(this).attr('col')
if (iconNumber == 1 || ((form == "cube") && iconNumber <= 4) || ((form.startsWith('color')) && iconNumber <= 3)) return $('#howto').html("Always unlocked")
else if (iconNumber == miniIcon && form == "cube") return $('#howto').html("Legacy mini icon, enable in GD settings")
else if (iconNumber == 13 && form == "cube") return $('#howto').html("Click lock on icon kit")
let foundAch = achievements.find(x => x.rewardType == form && x.rewardID == +iconNumber)
let foundMerch = shopIcons.find(x => x.type == form && x.icon == +iconNumber)
if (foundAch) $('#howto').html(foundAch.description.replace("Demon difficulty", "Demon"))
else if (foundMerch) $('#howto').html(`Purchase in ${shops[foundMerch.shop]}shop for <span style="color: aqua">${foundMerch.price}</span> orbs`)
else $('#howto').html("<span style='color: #aaaaaa'>(no info available)</span>")
}
})
$(document).on('mouseleave', '.iconButton, .color1, .color2', function () {
$(this).removeClass('iconHover')
$('#howto').html("<span style='color: #aaaaaa'>(hover over an icon for info)</span>")
})
})
$("#fetchUser").click(function () {

View file

@ -36,6 +36,7 @@ let gdIcons = fs.readdirSync('./assets/previewicons')
let sampleIcons = require('./misc/sampleIcons.json')
let achievements = require('./misc/achievements.json')
let achievementTypes = require('./misc/achievementTypes.json')
let shopIcons = require('./misc/shops.json')
let colorList = require('./icons/colors.json')
let forms = { "player": "cube", "bird": "ufo", "dart": "wave" }
let assetPage = fs.readFileSync('./html/assets.html', 'utf8')
@ -210,7 +211,7 @@ app.get("/:id", function(req, res) { app.run.level(app, req, res) })
// MISC
app.get("/icon/:text", function(req, res) { app.run.icon(app, req, res) })
app.get("/api/achievements", function(req, res) { res.send({achievements, types: achievementTypes, colors: colorList }) })
app.get("/api/achievements", function(req, res) { res.send({achievements, types: achievementTypes, shopIcons, colors: colorList }) })
app.get('/api/icons', function(req, res) {
let sample = [JSON.stringify(sampleIcons[Math.floor(Math.random() * sampleIcons.length)].slice(1))]
res.send({icons: gdIcons, colors: colorList, colorOrder, whiteIcons, sample});

View file

@ -38,7 +38,7 @@
"name": "SMJS",
"ign": "SMJSGaming",
"youtube": ["https://youtube.com/channel/UCwEsWDs9kGN2vvoiNTJKdaQ", "youtube"],
"twitter": ["https://instagram.com/smjs_gaming", "instagram"],
"twitter": ["https://twitter.com/SMJS90708001", "twitter"],
"github": ["https://github.com/SMJSGaming", "github"]
},

View file

@ -2,11 +2,13 @@
[ "Default", 1, 0, 3, 0 ],
[ "GD Logo", 2, 11, 3, 0 ],
[ "Meltdown Logo", 70, 9, 11, 1 ],
[ "Subzero Logo", 145, 4, 3, 1 ],
[ "Mushroom", 49, 9, 12, 0 ],
[ "Meat Boy", 61, 9, 12, 0 ],
[ "Shy Guy", 51, 9, 12, 0 ],
[ "Creeper", 42, 20, 15, 0 ],
[ "Companion Cube", 47, 12, 19, 0 ],
[ "Missing Texture", 23, 7, 15, 0 ],
[ "AdvyStyles", 25, 12, 3, 0 ],
[ "AeonAir", 109, 29, 3, 0 ],
@ -18,6 +20,7 @@
[ "envylol", 73, 20, 1, 1],
[ "EVW", 28, 12, 9, 0 ],
[ "Flub", 25, 3, 12, 1 ],
[ "GD Jaden", 74, 13, 12, 1 ],
[ "Juniper", 98, 40, 12, 1 ],
[ "Knobbelboy", 37, 10, 14, 0 ],
[ "Knots", 50, 40, 3, 1 ],

120
misc/shops.json Normal file
View file

@ -0,0 +1,120 @@
[
{"icon": 79, "type": "cube", "price": 500, "shop": 0},
{"icon": 77, "type": "cube", "price": 1000, "shop": 0},
{"icon": 86, "type": "cube", "price": 1000, "shop": 0},
{"icon": 73, "type": "cube", "price": 1000, "shop": 0},
{"icon": 102, "type": "cube", "price": 1000, "shop": 0},
{"icon": 107, "type": "cube", "price": 1000, "shop": 0},
{"icon": 27, "type": "ship", "price": 2000, "shop": 0},
{"icon": 25, "type": "ufo", "price": 2000, "shop": 0},
{"icon": 23, "type": "ufo", "price": 2500, "shop": 0},
{"icon": 20, "type": "ball", "price": 1000, "shop": 0},
{"icon": 19, "type": "ball", "price": 1500, "shop": 0},
{"icon": 21, "type": "wave", "price": 500, "shop": 0},
{"icon": 2, "type": "spider", "price": 2000, "shop": 0},
{"icon": 12, "type": "robot", "price": 3000, "shop": 0},
{"icon": 8, "type": "deathEffect", "price": 7000, "shop": 0},
{"icon": 11, "type": "deathEffect", "price": 7000, "shop": 0},
{"icon": 18, "type": "wave", "price": 2000, "shop": 1},
{"icon": 94, "type": "cube", "price": 3000, "shop": 1},
{"icon": 85, "type": "cube", "price": 2500, "shop": 1},
{"icon": 96, "type": "cube", "price": 2000, "shop": 1},
{"icon": 4, "type": "cube", "price": 1000, "shop": 1},
{"icon": 14, "type": "robot", "price": 3000, "shop": 1},
{"icon": 21, "type": "ufo", "price": 4000, "shop": 1},
{"icon": 3, "type": "spider", "price": 3000, "shop": 1},
{"icon": 25, "type": "ball", "price": 2000, "shop": 1},
{"icon": 13, "type": "deathEffect", "price": 10000, "shop": 1},
{"icon": 35, "type": "color1", "price": 1000, "shop": 0},
{"icon": 36, "type": "color1", "price": 1000, "shop": 0},
{"icon": 39, "type": "color1", "price": 1000, "shop": 1},
{"icon": 40, "type": "color1", "price": 1000, "shop": 1},
{"icon": 39, "type": "color2", "price": 1000, "shop": 0},
{"icon": 32, "type": "color2", "price": 1000, "shop": 1},
{"icon": 41, "type": "color2", "price": 1000, "shop": 1},
{"icon": 5, "type": "trail", "price": 4000, "shop": 0},
{"icon": 6, "type": "trail", "price": 4000, "shop": 0},
{"icon": 7, "type": "trail", "price": 4000, "shop": 1},
{"icon": 117, "type": "cube", "price": 4000, "shop": 2},
{"icon": 118, "type": "cube", "price": 2000, "shop": 2},
{"icon": 119, "type": "cube", "price": 2000, "shop": 2},
{"icon": 120, "type": "cube", "price": 4000, "shop": 2},
{"icon": 121, "type": "cube", "price": 2000, "shop": 2},
{"icon": 122, "type": "cube", "price": 2000, "shop": 2},
{"icon": 123, "type": "cube", "price": 6000, "shop": 2},
{"icon": 124, "type": "cube", "price": 8000, "shop": 2},
{"icon": 125, "type": "cube", "price": 4000, "shop": 2},
{"icon": 126, "type": "cube", "price": 2000, "shop": 2},
{"icon": 127, "type": "cube", "price": 6000, "shop": 2},
{"icon": 128, "type": "cube", "price": 8000, "shop": 2},
{"icon": 129, "type": "cube", "price": 6000, "shop": 2},
{"icon": 130, "type": "cube", "price": 4000, "shop": 2},
{"icon": 131, "type": "cube", "price": 4000, "shop": 2},
{"icon": 132, "type": "cube", "price": 4000, "shop": 2},
{"icon": 133, "type": "cube", "price": 8000, "shop": 2},
{"icon": 134, "type": "cube", "price": 6000, "shop": 2},
{"icon": 135, "type": "cube", "price": 6000, "shop": 2},
{"icon": 30, "type": "ball", "price": 4000, "shop": 2},
{"icon": 31, "type": "ball", "price": 6000, "shop": 2},
{"icon": 32, "type": "ball", "price": 6000, "shop": 2},
{"icon": 33, "type": "ball", "price": 2000, "shop": 2},
{"icon": 34, "type": "ball", "price": 4000, "shop": 2},
{"icon": 35, "type": "ball", "price": 8000, "shop": 2},
{"icon": 36, "type": "ball", "price": 6000, "shop": 2},
{"icon": 37, "type": "ball", "price": 2000, "shop": 2},
{"icon": 38, "type": "ball", "price": 2000, "shop": 2},
{"icon": 36, "type": "ship", "price": 2000, "shop": 2},
{"icon": 37, "type": "ship", "price": 2000, "shop": 2},
{"icon": 38, "type": "ship", "price": 6000, "shop": 2},
{"icon": 39, "type": "ship", "price": 2000, "shop": 2},
{"icon": 40, "type": "ship", "price": 4000, "shop": 2},
{"icon": 41, "type": "ship", "price": 4000, "shop": 2},
{"icon": 42, "type": "ship", "price": 6000, "shop": 2},
{"icon": 43, "type": "ship", "price": 2000, "shop": 2},
{"icon": 44, "type": "ship", "price": 6000, "shop": 2},
{"icon": 45, "type": "ship", "price": 8000, "shop": 2},
{"icon": 46, "type": "ship", "price": 4000, "shop": 2},
{"icon": 47, "type": "ship", "price": 6000, "shop": 2},
{"icon": 48, "type": "ship", "price": 4000, "shop": 2},
{"icon": 29, "type": "ufo", "price": 6000, "shop": 2},
{"icon": 30, "type": "ufo", "price": 6000, "shop": 2},
{"icon": 31, "type": "ufo", "price": 4000, "shop": 2},
{"icon": 32, "type": "ufo", "price": 6000, "shop": 2},
{"icon": 33, "type": "ufo", "price": 4000, "shop": 2},
{"icon": 34, "type": "ufo", "price": 2000, "shop": 2},
{"icon": 35, "type": "ufo", "price": 2000, "shop": 2},
{"icon": 24, "type": "wave", "price": 2000, "shop": 2},
{"icon": 25, "type": "wave", "price": 4000, "shop": 2},
{"icon": 26, "type": "wave", "price": 2000, "shop": 2},
{"icon": 27, "type": "wave", "price": 2000, "shop": 2},
{"icon": 28, "type": "wave", "price": 6000, "shop": 2},
{"icon": 29, "type": "wave", "price": 6000, "shop": 2},
{"icon": 30, "type": "wave", "price": 4000, "shop": 2},
{"icon": 31, "type": "wave", "price": 6000, "shop": 2},
{"icon": 32, "type": "wave", "price": 2000, "shop": 2},
{"icon": 33, "type": "wave", "price": 6000, "shop": 2},
{"icon": 18, "type": "robot", "price": 2000, "shop": 2},
{"icon": 19, "type": "robot", "price": 6000, "shop": 2},
{"icon": 20, "type": "robot", "price": 2000, "shop": 2},
{"icon": 21, "type": "robot", "price": 4000, "shop": 2},
{"icon": 22, "type": "robot", "price": 6000, "shop": 2},
{"icon": 23, "type": "robot", "price": 2000, "shop": 2},
{"icon": 24, "type": "robot", "price": 6000, "shop": 2},
{"icon": 25, "type": "robot", "price": 4000, "shop": 2},
{"icon": 11, "type": "spider", "price": 4000, "shop": 2},
{"icon": 12, "type": "spider", "price": 6000, "shop": 2},
{"icon": 13, "type": "spider", "price": 4000, "shop": 2},
{"icon": 14, "type": "spider", "price": 8000, "shop": 2},
{"icon": 15, "type": "spider", "price": 2000, "shop": 2},
{"icon": 16, "type": "spider", "price": 6000, "shop": 2},
{"icon": 140, "type": "cube", "price": 3000, "shop": 0},
{"icon": 109, "type": "cube", "price": 4000, "shop": 0},
{"icon": 113, "type": "cube", "price": 4000, "shop": 0},
{"icon": 40, "type": "ball", "price": 4000, "shop": 0},
{"icon": 35, "type": "wave", "price": 4000, "shop": 0},
{"icon": 33, "type": "color1", "price": 1000, "shop": 0},
{"icon": 28, "type": "color2", "price": 1000, "shop": 0},
{"icon": 136, "type": "cube", "price": 5000, "shop": 1},
{"icon": 110, "type": "cube", "price": 5000, "shop": 1},
{"icon": 16, "type": "deathEffect", "price": 15000, "shop": 1}
]