diff --git a/dist/js/calculator.js b/dist/js/calculator.js index e0bf93e..e65793b 100644 --- a/dist/js/calculator.js +++ b/dist/js/calculator.js @@ -33,7 +33,7 @@ function buildJSON(item, models) { for (let i = 0; i < models.length; i++) { const model = models[i]; - const damage = i + 1 / itemDamages[item]; + const damage = (i + 1) / itemDamages[item]; json['overrides'][i + 1] = { 'predicate': { diff --git a/dist/js/calculator.min.js b/dist/js/calculator.min.js index 4d8cf85..e6b6006 100644 --- a/dist/js/calculator.min.js +++ b/dist/js/calculator.min.js @@ -1 +1 @@ -function buildJSON(e,t){const a={parent:"item/handheld"};a.textures={layer0:"item/"+e},a.overrides=[],a.overrides[0]={predicate:{damaged:0,damage:0},model:"item/"+e};for(let d=0;d input.attr('min')) { input.attr('value', (currentVal - 1).toString()); } @@ -77,12 +75,8 @@ $(document).ready(function () { form.on("submit", function (e) { e.preventDefault(); - //Get selected item + //Get selected item and amount of models const selectedItem = item.val(); - - //Get amount of items - const fieldName = $('.btn-number').attr('data-field'); - const input = $("input[name='" + fieldName + "']"); const currentVal = parseInt(input.attr('value')); //Build models array diff --git a/dist/js/scripts.min.js b/dist/js/scripts.min.js index 33e5815..f672160 100644 --- a/dist/js/scripts.min.js +++ b/dist/js/scripts.min.js @@ -1 +1 @@ -$(document).ready(function(){function t(){const t=["red_car","blue_car","green_car","orange_car","blue_bicycle","red_bicycle","green_bicycle","orange_bicycle"];return t[Math.floor(Math.random()*t.length)]}const e=$("#calculatorForm"),a=$("#formItems"),n=$("#item"),r=$("#itemcount"),i=$("#items"),o=$("#content"),l=$("#copyButton"),c=$("#downloadButton"),u=$("#minus"),s=$("#plus"),d=$("input[name='quant']");u.click(function(t){const e=parseInt(d.attr("value"));isNaN(e)?d.attr("value","0"):(console.log("#iteminput"+e),e>d.attr("min")&&d.attr("value",(e-1).toString()),e-1==d.attr("min")&&$(this).attr("disabled",!0),$("#iteminput"+e).remove())}),s.click(function(e){const a=parseInt(d.attr("value"));if(isNaN(a))d.attr("value","0");else{if(a1?u.prop("disabled",!1):u.prop("disabled",!0),i.append('
')}}),n.change(function(){if(""!==this.value){a.show();const t=itemDamages[this.value];r.prop("max",t),s.prop("disabled",!1)}else a.hide()}),e.on("submit",function(t){t.preventDefault();const e=n.val(),a=$(".btn-number").attr("data-field"),r=$("input[name='"+a+"']"),i=parseInt(r.attr("value")),l=[];for(let t=0;td.attr("min")&&d.attr("value",(e-1).toString()),e-1==d.attr("min")&&$(this).attr("disabled",!0),$("#iteminput"+e).remove())}),u.click(function(e){const a=parseInt(d.attr("value"));if(isNaN(a))d.attr("value","0");else{if(a1?s.prop("disabled",!1):s.prop("disabled",!0),i.append('
')}}),n.change(function(){if(""!==this.value){a.show();const t=itemDamages[this.value];r.prop("max",t),u.prop("disabled",!1)}else a.hide()}),e.on("submit",function(t){t.preventDefault();const e=n.val(),a=parseInt(d.attr("value")),r=[];for(let t=0;t