Files
granblue-party/dist/assets/Sandbox-DOId_fJ2.js
2026-04-13 07:15:44 +00:00

2 lines
6.3 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import{n as u,U as n}from"./index-DDNMzpZj.js";import{C as c,B as m}from"./CalcBulletsList-xEJ6eQa2.js";import{C as g}from"./CalcPreviewList-DA8bWgJp.js";import{D as h}from"./Dropdown-Cks-nQIq.js";import"./StatInput-BU1s-zba.js";const r=new n.LocalStorageMgt("CalcBullets"),f={components:{CalcBulletsList:c,CalcPreviewList:g,Dropdown:h},head:{title:"Granblue.Party - Bullets Calculator",desc:"Calculator for Bullets farming",image:"https://www.granblue.party/img/card_index.jpg",keywords:"Granblue Fantasy, GBF, Bullet, farm, gun, gunslinger, soldier, Parabellum, Rifle, Cartridge, Aetherial"},data(){return{displayList:0,show_bullets_craft:!0,show_bullets_stock:!1,bullets_craft:{},bullets_stock:{},items_quantity:{}}},methods:{addBulletToCraft(e){this.bullets_craft.hasOwnProperty(e.image)?this.$set(this.bullets_craft,e.image,this.bullets_craft[e.image]+1):this.$set(this.bullets_craft,e.image,1)},removeBulletFromCraft(e){this.bullets_craft.hasOwnProperty(e.image)&&this.bullets_craft[e.image]>0&&this.$set(this.bullets_craft,e.image,this.bullets_craft[e.image]-1)},getBulletToCraftCount(e){return this.bullets_craft.hasOwnProperty(e.image)?this.bullets_craft[e.image]:0},addBulletToStock(e){this.bullets_stock.hasOwnProperty(e.image)?this.$set(this.bullets_stock,e.image,this.bullets_stock[e.image]+1):this.$set(this.bullets_stock,e.image,1)},removeBulletFromStock(e){this.bullets_stock.hasOwnProperty(e.image)&&this.bullets_stock[e.image]>0&&this.$set(this.bullets_stock,e.image,this.bullets_stock[e.image]-1)},getStockOfBullet(e){return this.bullets_stock.hasOwnProperty(e.image)?this.bullets_stock[e.image]:0},getQuantityForItem(e){return this.items_quantity.hasOwnProperty(e.image)?this.items_quantity[e.image]:0},setQuantityForItem(e,t){this.$set(this.items_quantity,e.image,t)}},computed:{getBullets(){return m},getBulletsByName(){let e={};return this.getBullets.forEach(t=>t.bullets.forEach(l=>e[l.image]=l)),e},getComponentsPerBullet(){let e={};return this.getBullets.forEach(t=>t.bullets.forEach(l=>e[l.image]=l.items)),e},getBulletsToCraft(){return Object.entries(this.bullets_craft).flatMap(([e,t])=>t>0?this.getBulletsByName[e]:[]).sort((e,t)=>e.image>t.image)},getBulletsInStock(){return Object.entries(this.bullets_stock).flatMap(([e,t])=>t>0?this.getBulletsByName[e]:[]).sort((e,t)=>e.image>t.image)},getComponents(){let e={},t=n.copy(this.bullets_stock);const l=(s,i=1)=>{for(let a of s)this.getComponentsPerBullet.hasOwnProperty(a.image)?t.hasOwnProperty(a.image)&&t[a.image]>0?t[a.image]--:l(this.getComponentsPerBullet[a.image],a.quantity*i):e.hasOwnProperty(a.image)?e[a.image].quantity+=a.quantity*i:(e[a.image]=n.copy(a),e[a.image].quantity*=i)};for(const[s,i]of Object.entries(this.bullets_craft))for(let a=0;a<i;a++)t.hasOwnProperty(s)&&t[s]>0?t[s]--:l(this.getComponentsPerBullet[s]);return Object.values(e).sort((s,i)=>{const a=s.name.split(" "),o=i.name.split(" ");return a[a.length-1]!==o[o.length-1]?a[a.length-1]>o[o.length-1]:s.name>i.name})}},watch:{displayList(){r.setValue("displayList",this)},show_bullets_craft(){r.setValue("show_bullets_craft",this)},show_bullets_stock(){r.setValue("show_bullets_stock",this)},bullets_craft:{handler(){r.setValue("bullets_craft",this)},deep:!0},bullets_stock:{handler(){r.setValue("bullets_stock",this)},deep:!0},items_quantity:{handler(){r.setValue("items_quantity",this)},deep:!0}},mounted(){r.getValue(this,"displayList"),r.getValue(this,"show_bullets_craft"),r.getValue(this,"show_bullets_stock"),r.getValue(this,"bullets_stock"),r.getValue(this,"bullets_craft"),r.getValue(this,"items_quantity")}};var _=function(){var t=this,l=t._self._c;return l("div",{staticClass:"flex flex-col flex-wrap gap-4 items-center"},[l("h1",[t._v("Bullets Calculator")]),l("div",{staticClass:"flex flex-row flex-wrap gap-4 items-center"},[l("label",[t._v("Display bullets:  "),l("dropdown",{model:{value:t.displayList,callback:function(s){t.displayList=t._n(s)},expression:"displayList"}},[l("option",{domProps:{value:0}},[t._v("Grid")]),l("option",{domProps:{value:1}},[t._v("List")])])],1)]),l("calc-bullets-list",{attrs:{bullets:t.getBullets,showBullets:t.show_bullets_craft,displayList:t.displayList,header:"Bullets to craft",explainer:"These are bullets you intend to craft.",getBullet:t.getBulletToCraftCount,addBullet:t.addBulletToCraft,removeBullet:t.removeBulletFromCraft},on:{"update:showBullets":s=>t.show_bullets_craft=s}}),l("calc-bullets-list",{attrs:{bullets:t.getBullets,showBullets:t.show_bullets_stock,displayList:t.displayList,header:"Bullets in stock",explainer:"These are bullets you currently have in stock. They will be deduced from the materials you need to farm.",getBullet:t.getStockOfBullet,addBullet:t.addBulletToStock,removeBullet:t.removeBulletFromStock},on:{"update:showBullets":s=>t.show_bullets_stock=s}}),t.getBulletsInStock.length>0?l("h2",[t._v("In stock")]):t._e(),l("div",{staticClass:"flex flex-row flex-wrap w-full lg:w-1/2"},t._l(t.getBulletsInStock,function(s){return l("div",{staticClass:"tooltip-parent cursor-pointer",on:{click:function(i){return t.removeBulletFromStock(s)}}},[l("img",{attrs:{src:"/img/item/"+s.image+".jpg",width:"60px",title:s.name}}),l("span",{staticClass:"tooltip"},[t._v(" "+t._s(s.name)+" ")]),t.getStockOfBullet(s)>0?l("div",{staticClass:"absolute text-center w-5 top-1 left-1 z-10 rounded-full text-xs leading-5 tracking-tight bg-tertiary text-primary"},[t._v(" "+t._s(t.getStockOfBullet(s))+" ")]):t._e()])}),0),t.getBulletsToCraft.length>0?l("h2",[t._v("Currently farming")]):t._e(),l("div",{staticClass:"flex flex-row flex-wrap w-full lg:w-1/2"},t._l(t.getBulletsToCraft,function(s){return l("div",{staticClass:"tooltip-parent cursor-pointer",on:{click:function(i){return t.removeBulletFromCraft(s)}}},[l("img",{attrs:{src:"/img/item/"+s.image+".jpg",width:"60px",title:s.name}}),l("span",{staticClass:"tooltip"},[t._v(" "+t._s(s.name)+" ")]),t.getBulletToCraftCount(s)>0?l("div",{staticClass:"absolute text-center w-5 top-1 left-1 z-10 rounded-full text-xs leading-5 tracking-tight bg-tertiary text-primary"},[t._v(" "+t._s(t.getBulletToCraftCount(s))+" ")]):t._e()])}),0),t.getComponents.length>0?l("div",t._l(t.getComponents,function(s,i){return l("calc-preview-list",{key:i,attrs:{tag:s.image,name:s.name,quantity:t.getQuantityForItem(s),max:s.quantity,animated:!1},on:{"update:quantity":a=>t.setQuantityForItem(s,a)}})}),1):l("div",[t._v(" Nothing to farm ")])],1)},p=[],d=u(f,_,p,!1,null,null);const b=d.exports;export{b as default};