bug fix
This commit is contained in:
parent
e1a7c248b8
commit
3d021a9d13
10
css/main.css
10
css/main.css
|
|
@ -26,14 +26,8 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#bottom-right {
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
position: absolute;
|
|
||||||
}
|
|
||||||
|
|
||||||
#bottom-left {
|
#bottom-left {
|
||||||
left: 5px;
|
right: 5px;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
position: absolute;
|
position: fixed;
|
||||||
}
|
}
|
||||||
|
|
@ -58,6 +58,6 @@
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
<div id="container">
|
<div id="container">
|
||||||
<div class="ui-widget" id="bottom-left">Inspiration Pyramidalist<br>© MasterGordon & Ph3nix</div>
|
<div class="ui-widget" id="bottom-left">Thanks to Pyramidalist and his community<br>© MasterGordon & Ph3nix</div>
|
||||||
</div>
|
</div>
|
||||||
</html>
|
</html>
|
||||||
121
js/main.js
121
js/main.js
|
|
@ -21,28 +21,43 @@ itemsRequest.onload = function() {
|
||||||
}
|
}
|
||||||
itemsRequest.send()
|
itemsRequest.send()
|
||||||
|
|
||||||
|
|
||||||
function loadHTML() {
|
function loadHTML() {
|
||||||
$("#menu li ul").empty()
|
$("#menu li ul").empty()
|
||||||
$("#k_other").empty()
|
$("#k_other").empty()
|
||||||
for (var i = 0; i < allItemsArray.length; i++) {
|
for (var i = 0; i < allItemsArray.length; i++) {
|
||||||
if (!('disabled' in allItemsArray[i])) {
|
if (!('disabled' in allItemsArray[i])) {
|
||||||
//$("#itemtoadd").append("<option value=\""+allItemsArray[i].id+"\">" + allItemsArray[i].name + "</option>")
|
// $("#itemtoadd").append("<option
|
||||||
$("#k_"+allItemsArray[i].type).append("<li><div class=\"additem\" id=\"add"+ allItemsArray[i].id +"\">" + allItemsArray[i].name + "</div></li>")
|
// value=\""+allItemsArray[i].id+"\">" + allItemsArray[i].name +
|
||||||
|
// "</option>")
|
||||||
|
$("#k_" + allItemsArray[i].type).append(
|
||||||
|
"<li><div class=\"additem\" id=\"add" + allItemsArray[i].id
|
||||||
|
+ "\">" + allItemsArray[i].name + "</div></li>")
|
||||||
} else {
|
} else {
|
||||||
// console.log(allItemsArray[i].name+" disabled. Not loading")
|
// console.log(allItemsArray[i].name+" disabled. Not loading")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$(".additem").click(function() {
|
$(".additem")
|
||||||
|
.click(
|
||||||
|
function() {
|
||||||
var id = parseInt($(this).attr("id").substring(3, 99))
|
var id = parseInt($(this).attr("id").substring(3, 99))
|
||||||
console.log(id)
|
console.log(id)
|
||||||
var tagid = 'item_' + id
|
var tagid = 'item_' + id
|
||||||
if ($('#' + tagid).length) {
|
if ($('#' + tagid).length) {
|
||||||
console.log(id + " allready exists!")
|
console.log(id + " allready exists!")
|
||||||
return
|
return
|
||||||
|
|
||||||
}
|
}
|
||||||
$("#tocraft").append('<input id="'+tagid+'" name="value"><label id="lable_'+tagid+'" style="margin-top: 3px;" class="ui-widget" for="'+tagid+'"> '+getItemFromId(id).name+'<br></label>')
|
$("#tocraft")
|
||||||
|
.append(
|
||||||
|
'<input id="'
|
||||||
|
+ tagid
|
||||||
|
+ '" name="value"><label id="lable_'
|
||||||
|
+ tagid
|
||||||
|
+ '" style="margin-top: 3px;" class="ui-widget" for="'
|
||||||
|
+ tagid + '"> '
|
||||||
|
+ getItemFromId(id).name
|
||||||
|
+ '<br></label>')
|
||||||
$("#" + tagid).spinner({
|
$("#" + tagid).spinner({
|
||||||
min : 0,
|
min : 0,
|
||||||
numberFormat : "n",
|
numberFormat : "n",
|
||||||
|
|
@ -89,7 +104,9 @@ function getItemFromId(index){
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
$( document ).ready(function() {
|
$(document)
|
||||||
|
.ready(
|
||||||
|
function() {
|
||||||
// SEITE HAT GELADEN
|
// SEITE HAT GELADEN
|
||||||
|
|
||||||
$("#itemtoadd").selectmenu()
|
$("#itemtoadd").selectmenu()
|
||||||
|
|
@ -97,43 +114,79 @@ $( document ).ready(function() {
|
||||||
$("#calc").button()
|
$("#calc").button()
|
||||||
|
|
||||||
// BUTTONS
|
// BUTTONS
|
||||||
$(".additem").click(function() {
|
$(".additem")
|
||||||
|
.click(
|
||||||
|
function() {
|
||||||
var id = $("#itemtoadd").val()
|
var id = $("#itemtoadd").val()
|
||||||
console.log("Adding " + id + "...")
|
console.log("Adding " + id + "...")
|
||||||
var tagid = 'item_' + id
|
var tagid = 'item_' + id
|
||||||
if ($('#' + tagid).length) {
|
if ($('#' + tagid).length) {
|
||||||
console.log(id+" allready exists!")
|
console.log(id
|
||||||
|
+ " allready exists!")
|
||||||
return
|
return
|
||||||
|
|
||||||
}
|
}
|
||||||
$("#tocraft").append('<input id="'+tagid+'" name="value"><label id="lable_'+tagid+'" style="margin-top: 3px;" class="ui-widget" for="'+tagid+'"> '+getItemFromId(id).name+'<br></label>')
|
$("#tocraft")
|
||||||
$("#"+tagid).spinner({
|
.append(
|
||||||
|
'<input id="'
|
||||||
|
+ tagid
|
||||||
|
+ '" name="value"><label id="lable_'
|
||||||
|
+ tagid
|
||||||
|
+ '" style="margin-top: 3px;" class="ui-widget" for="'
|
||||||
|
+ tagid
|
||||||
|
+ '"> '
|
||||||
|
+ getItemFromId(id).name
|
||||||
|
+ '<br></label>')
|
||||||
|
$("#" + tagid)
|
||||||
|
.spinner(
|
||||||
|
{
|
||||||
min : 0,
|
min : 0,
|
||||||
numberFormat : "n",
|
numberFormat : "n",
|
||||||
change: function( event, ui ) {
|
change : function(
|
||||||
if($("#"+tagid).spinner( "value" )==0){
|
event, ui) {
|
||||||
$("#"+tagid).spinner( "destroy" )
|
if ($(
|
||||||
$("#"+tagid).remove()
|
"#"
|
||||||
$("#lable_"+tagid).remove()
|
+ tagid)
|
||||||
|
.spinner(
|
||||||
|
"value") == 0) {
|
||||||
|
$(
|
||||||
|
"#"
|
||||||
|
+ tagid)
|
||||||
|
.spinner(
|
||||||
|
"destroy")
|
||||||
|
$(
|
||||||
|
"#"
|
||||||
|
+ tagid)
|
||||||
|
.remove()
|
||||||
|
$(
|
||||||
|
"#lable_"
|
||||||
|
+ tagid)
|
||||||
|
.remove()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$("#" + tagid).val(1)
|
$("#" + tagid).val(1)
|
||||||
})
|
})
|
||||||
|
|
||||||
$("#calc").click(function() {
|
$("#calc")
|
||||||
|
.click(
|
||||||
|
function() {
|
||||||
requieredCount = []
|
requieredCount = []
|
||||||
requieredItems = []
|
requieredItems = []
|
||||||
for (var i = 0; i < newid; i++) {
|
for (var i = 0; i < newid; i++) {
|
||||||
var tag = "#item_" + i;
|
var tag = "#item_" + i;
|
||||||
if ($(tag).length) {
|
if ($(tag).length) {
|
||||||
var item = allItemsArray[i]
|
var item = allItemsArray[i]
|
||||||
for(var n=0;n<$(tag).spinner("value");n++){
|
for (var n = 0; n < $(tag)
|
||||||
|
.spinner("value"); n++) {
|
||||||
for (var j = 0; j < item.crafting.length; j++) {
|
for (var j = 0; j < item.crafting.length; j++) {
|
||||||
if(requieredItems.indexOf(item.crafting[j])==-1){
|
if (requieredItems
|
||||||
|
.indexOf(item.crafting[j]) == -1) {
|
||||||
requieredCount[requieredItems.length] = 1
|
requieredCount[requieredItems.length] = 1
|
||||||
requieredItems[requieredItems.length] = item.crafting[j]
|
requieredItems[requieredItems.length] = item.crafting[j]
|
||||||
} else {
|
} else {
|
||||||
requieredCount[requieredItems.indexOf(item.crafting[j])]++
|
requieredCount[requieredItems
|
||||||
|
.indexOf(item.crafting[j])]++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -148,13 +201,23 @@ function updateoutput() {
|
||||||
$("#output").empty()
|
$("#output").empty()
|
||||||
for (var i = 0; i < requieredItems.length; i++) {
|
for (var i = 0; i < requieredItems.length; i++) {
|
||||||
if (allItems[requieredItems[i]]) {
|
if (allItems[requieredItems[i]]) {
|
||||||
$("#output").append("<span id=\""+i+"\" class=\"ui-widget outputitem splitable\">" +requieredCount[i]+"x "+allItems[requieredItems[i]].name+ "</span><br>")
|
$("#output").append(
|
||||||
|
"<span id=\"" + i
|
||||||
|
+ "\" class=\"ui-widget outputitem splitable\">"
|
||||||
|
+ requieredCount[i] + "x "
|
||||||
|
+ allItems[requieredItems[i]].name + "</span><br>")
|
||||||
} else {
|
} else {
|
||||||
$("#output").append("<span id=\""+i+"\" class=\"ui-widget outputitem notsplitable\">" +requieredCount[i]+"x "+requieredItems[i]+ "</span><br>")
|
$("#output").append(
|
||||||
|
"<span id=\"" + i
|
||||||
|
+ "\" class=\"ui-widget outputitem notsplitable\">"
|
||||||
|
+ requieredCount[i] + "x " + requieredItems[i]
|
||||||
|
+ "</span><br>")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$(".outputitem").click(function() {
|
$(".outputitem")
|
||||||
|
.click(
|
||||||
|
function() {
|
||||||
console.log($(this).attr('id'))
|
console.log($(this).attr('id'))
|
||||||
var index = parseInt($(this).attr('id'))
|
var index = parseInt($(this).attr('id'))
|
||||||
var itemid = requieredItems[index]
|
var itemid = requieredItems[index]
|
||||||
|
|
@ -170,19 +233,25 @@ function updateoutput() {
|
||||||
if (item.count)
|
if (item.count)
|
||||||
count = 1 / item.count
|
count = 1 / item.count
|
||||||
|
|
||||||
if(requieredItems.indexOf(item.crafting[j])==-1){
|
if (requieredItems
|
||||||
|
.indexOf(item.crafting[j]) == -1) {
|
||||||
requieredCount[requieredItems.length] = count
|
requieredCount[requieredItems.length] = count
|
||||||
requieredItems[requieredItems.length] = item.crafting[j]
|
requieredItems[requieredItems.length] = item.crafting[j]
|
||||||
console.log("-1")
|
console.log("-1")
|
||||||
} else {
|
} else {
|
||||||
requieredCount[requieredItems.indexOf(item.crafting[j])] += count
|
requieredCount[requieredItems
|
||||||
|
.indexOf(item.crafting[j])] += count
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (var i = 0; i < requieredCount.length; i++) {
|
for (var i = 0; i < requieredCount.length; i++) {
|
||||||
requieredCount[i]=Math.ceil(requieredCount[i])
|
requieredCount[i] = Math
|
||||||
}
|
.ceil(requieredCount[i])
|
||||||
}
|
}
|
||||||
|
$('#' + index).fadeOut(300)
|
||||||
|
setTimeout(function() {
|
||||||
updateoutput()
|
updateoutput()
|
||||||
|
}, 300)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -2,5 +2,5 @@
|
||||||
|
|
||||||
"type":"tools",
|
"type":"tools",
|
||||||
"name": "Axe of the Wyvern",
|
"name": "Axe of the Wyvern",
|
||||||
"crafting": ["Diamond_axe", "Draconium Ingot", "Draconium Ingot", "wyvern_core", "wyvern_energy_core"]
|
"crafting": ["diamond_axe", "Draconium Ingot", "Draconium Ingot", "wyvern_core", "wyvern_energy_core"]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,5 +3,5 @@
|
||||||
"type":"other",
|
"type":"other",
|
||||||
"name": "Block of Emerald",
|
"name": "Block of Emerald",
|
||||||
"disabled": true,
|
"disabled": true,
|
||||||
"crafting": ["emerald", "emerald", "emerald", "emerald", "emerald", "emerald", "emerald", "emerald", "emerald"]
|
"crafting": ["Emerald", "Emerald", "Emerald", "Emerald", "Emerald", "Emerald", "Emerald", "Emerald", "Emerald"]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,5 +2,5 @@
|
||||||
|
|
||||||
"type":"tools",
|
"type":"tools",
|
||||||
"name": "Draconic Hoe",
|
"name": "Draconic Hoe",
|
||||||
"crafting": ["Diamond_hoe", "awakened_draconium_ingot", "awakened_draconium_ingot", "awakened_core", "draconic_energy_core"]
|
"crafting": ["diamond_hoe", "awakened_draconium_ingot", "awakened_draconium_ingot", "awakened_core", "draconic_energy_core"]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,5 +3,5 @@
|
||||||
"type":"other",
|
"type":"other",
|
||||||
"name": "Eye of Ender",
|
"name": "Eye of Ender",
|
||||||
"disabled": true,
|
"disabled": true,
|
||||||
"crafting": ["ender_pearl", "blaze_powder"]
|
"crafting": ["Ender Pearl", "blaze_powder"]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,5 +3,5 @@
|
||||||
"type":"other",
|
"type":"other",
|
||||||
"name": "Golden Apple",
|
"name": "Golden Apple",
|
||||||
"disabled": true,
|
"disabled": true,
|
||||||
"crafting": ["apple", "Gold Ingot", "Gold Ingot", "Gold Ingot", "Gold Ingot", "Gold Ingot", "Gold Ingot", "Gold Ingot", "Gold Ingot"]
|
"crafting": ["Apple", "Gold Ingot", "Gold Ingot", "Gold Ingot", "Gold Ingot", "Gold Ingot", "Gold Ingot", "Gold Ingot", "Gold Ingot"]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,5 +2,5 @@
|
||||||
|
|
||||||
"type":"tools",
|
"type":"tools",
|
||||||
"name": "Pickaxe of the Wyvern",
|
"name": "Pickaxe of the Wyvern",
|
||||||
"crafting": ["Diamond_pickaxe", "Draconium Ingot", "Draconium Ingot", "wyvern_core", "wyvern_energy_core"]
|
"crafting": ["diamond_pickaxe", "Draconium Ingot", "Draconium Ingot", "wyvern_core", "wyvern_energy_core"]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,5 +2,5 @@
|
||||||
|
|
||||||
"type":"tools",
|
"type":"tools",
|
||||||
"name": "Shovel of the Wyvern",
|
"name": "Shovel of the Wyvern",
|
||||||
"crafting": ["Diamond_shovel", "Draconium Ingot", "Draconium Ingot", "wyvern_core", "wyvern_energy_core"]
|
"crafting": ["diamond_shovel", "Draconium Ingot", "Draconium Ingot", "wyvern_core", "wyvern_energy_core"]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,5 +2,5 @@
|
||||||
|
|
||||||
"type":"tools",
|
"type":"tools",
|
||||||
"name": "Sword of the Wyvern",
|
"name": "Sword of the Wyvern",
|
||||||
"crafting": ["Diamond_sword", "Draconium Ingot", "Draconium Ingot", "wyvern_core", "wyvern_energy_core"]
|
"crafting": ["diamond_sword", "Draconium Ingot", "Draconium Ingot", "wyvern_core", "wyvern_energy_core"]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"type": "upgrades",
|
"type": "upgrades",
|
||||||
"name": "Upgrade Tier Basic",
|
"name": "Upgrade Tier Basic",
|
||||||
"crafting": ["diamond", "diamond", "draconic_core", "golden_apple", "golden_apple", "eye_of_ender", "eye_of_ender"]
|
"crafting": ["Diamond", "Diamond", "draconic_core", "golden_apple", "golden_apple", "eye_of_ender", "eye_of_ender"]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"type": "upgrades",
|
"type": "upgrades",
|
||||||
"name": "Upgrade Tier Chaotic",
|
"name": "Upgrade Tier Chaotic",
|
||||||
"crafting": ["wyvern_core", "wyvern_core", "awakened_core", "awakened_core", "dragon_egg", "dragon_egg", "chaotic_core"]
|
"crafting": ["wyvern_core", "wyvern_core", "awakened_core", "awakened_core", "Dragon Egg", "Dragon Egg", "chaotic_core"]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"type": "upgrades",
|
"type": "upgrades",
|
||||||
"name": "Upgrade Tier Wyvern",
|
"name": "Upgrade Tier Wyvern",
|
||||||
"crafting": ["nether_star", "nether_star", "draconic_core", "draconic_core", "emerald", "emerald", "wyvern_core"]
|
"crafting": ["nether_star", "nether_star", "draconic_core", "draconic_core", "Emerald", "Emerald", "wyvern_core"]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue