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

2 lines
11 KiB
JavaScript

import{n as d,U as r}from"./index-DDNMzpZj.js";import{C as u}from"./Checkbox-Dc2UYqO9.js";const n=new r.LocalStorageMgt("CalcDread"),a=[{name:"1★",cost_ap:20,cost_ep:2,honor:320,token_host:18,token_join:20,token_1:14,token_2:0,token_3:0},{name:"2★",cost_ap:30,cost_ep:2,honor:788,token_host:28,token_join:22,token_1:20,token_2:0,token_3:0},{name:"3★",cost_ap:40,cost_ep:2,honor:3730,token_host:50,token_join:25,token_1:22,token_2:15,token_3:8},{name:"4★",cost_ap:50,cost_ep:3,honor:20330,token_host:72,token_join:40,token_1:34,token_2:26,token_3:18},{name:"5★",cost_ap:50,cost_ep:3,honor:41e4,token_host:115,token_join:80,token_1:48,token_2:40,token_3:28},{name:"Lvl 95",cost_ap:0,cost_ep:3,honor:11855,token_host:55,token_join:30,token_1:26,token_2:18,token_3:10},{name:"Lvl 135",cost_ap:0,cost_ep:3,honor:11855,token_host:100,token_join:60,token_1:44,token_2:34,token_3:24},{name:"Lvl 175",cost_ap:0,cost_ep:3,honor:75e3,token_host:160,token_join:110,token_1:68,token_2:54,token_3:38}],c={components:{Checkbox:u},head:{title:"Granblue.Party - Dread Barrage Calculator",desc:"Calculator for Dread Barrage tokens",image:"https://www.granblue.party/img/card_index.jpg",keywords:"Granblue Fantasy, GBF, Dread Barrage, tokens, eternals, valor badge"},data(){return{boxes_needed:20,boxes_opened:0,tokens_explained:"",tokens_obtained:0,tokens_total:0,show_fight:[!1,!0,!0,!0,!0,!0,!0,!0],time_loading:1,time_fight:[0,0,0,0,0],show_host:!0,show_join:!0,show_result_2nd:!1,show_result_3rd:!1,show_result_other:!0}},methods:{showFight(s){this.$set(this.show_fight,s,!this.show_fight[s])},getFightData(s){let e=[];const t=1+(s.token_2>0&&this.show_result_2nd?1:0)+(s.token_3>0&&this.show_result_3rd?1:0)+(this.show_result_other?1:0);return this.show_host&&(e.push({type:"Host",type_rows:t,finish:"MVP",token:s.token_host+s.token_join+s.token_1,cost_ap:s.cost_ap}),s.token_2>0&&this.show_result_2nd&&e.push({finish:"2nd",token:s.token_host+s.token_join+s.token_2,cost_ap:s.cost_ap}),s.token_3>0&&this.show_result_3rd&&e.push({finish:"3rd",token:s.token_host+s.token_join+s.token_3,cost_ap:s.cost_ap}),this.show_result_other&&e.push({finish:"",token:s.token_host+s.token_join,cost_ap:s.cost_ap})),this.show_join&&(e.push({type:"Join",type_rows:t,finish:"MVP",token:s.token_join+s.token_1,cost_ep:s.cost_ep}),s.token_2>0&&this.show_result_2nd&&e.push({finish:"2nd",token:s.token_join+s.token_2,cost_ep:s.cost_ep}),s.token_3>0&&this.show_result_3rd&&e.push({finish:"3rd",token:s.token_join+s.token_3,cost_ep:s.cost_ep}),this.show_result_other&&e.push({finish:"",token:s.token_join,cost_ep:s.cost_ep})),e.length>0&&(e[0].name=s.name,e[0].name_rows=t*(this.show_host&&this.show_join?2:1)),e},getFightTime(s,e){const t=parseInt(this.time_fight[e],10),o=parseInt(this.time_loading,10);if(t<1)return"";const _=s.token_host+s.token_join+s.token_1,i=Math.ceil(this.tokens_needed/_)*(t+o),l=Math.ceil(3600*this.tokens_needed/i),h=Math.ceil(3600*(this.tokens_needed/_*s.cost_ap)/i);return{total_time:r.toReadableTime(i),token_per_hour:l,ap_per_hour:h}}},computed:{getData(){return a.flatMap((s,e)=>this.show_fight[e]?this.getFightData(s):[])},getFights(){return a.slice(0,5).map((s,e)=>({name:s.name,...this.getFightTime(s,e)}))},getFightNames(){return a.map(s=>s.name)},getBoxesNeeded(){return parseInt(this.boxes_needed,10)},getBoxesOpened(){return parseInt(this.boxes_opened,10)},getTokensObtained(){return parseInt(this.tokens_obtained,10)},getProgress(){let s=(100-this.tokens_needed/this.tokens_total*100).toFixed(2);return this.tokens_total==0?100 .toFixed(2):s},tokens_needed(){let s=0,e=this.getBoxesNeeded-this.getBoxesOpened;this.tokens_explained="",e===1?this.tokens_explained=e+" box = (":e>1&&(this.tokens_explained=e+" boxes = (");let t=!1;if(this.getBoxesOpened===0&&e>0&&(s+=1600,e--,this.tokens_explained+="1600",t=!0),this.getBoxesOpened<4&&e>0){const o=Math.min(3,e,4-this.getBoxesOpened);s+=2404*o,e-=o,this.tokens_explained+=(t?" + ":"")+o+"x2404",t=!0}if(this.getBoxesOpened<20&&e>0){const o=Math.min(16,e,20-this.getBoxesOpened);s+=2e3*o,e-=o,this.tokens_explained+=(t?" + ":"")+o+"x2000",t=!0}if(this.getBoxesOpened<40&&e>0){const o=Math.min(20,e,40-this.getBoxesOpened);s+=1e4*o,e-=o,this.tokens_explained+=(t?" + ":"")+o+"x10000",t=!0}return e>0&&(s+=15e3*e,this.tokens_explained+=(t?" + ":"")+e+"x15000"),this.tokens_total=s,this.tokens_explained&&(this.tokens_explained+=" tokens)"),this.getTokensObtained>0&&(s-=this.getTokensObtained,this.tokens_total>0&&(this.tokens_explained+=" - "+this.getTokensObtained,this.getTokensObtained>1?this.tokens_explained+=" tokens obtained":this.tokens_explained+=" token obtained")),Math.max(0,s)}},watch:{show_fight(){n.setValue("show_fight",this)},show_host(){n.setValue("show_host",this)},show_join(){n.setValue("show_join",this)},tokens_obtained(){n.setValue("tokens_obtained",this)},boxes_needed(){n.setValue("boxes_needed",this)},boxes_opened(){n.setValue("boxes_opened",this)},show_result_2nd(){n.setValue("show_result_2nd",this)},show_result_3rd(){n.setValue("show_result_3rd",this)},show_result_other(){n.setValue("show_result_other",this)},time_loading(){n.setValue("time_loading",this)},time_fight(){n.setValue("time_fight",this)}},mounted(){n.getValue(this,"show_fight"),n.getValue(this,"show_host"),n.getValue(this,"show_join"),n.getValue(this,"boxes_needed"),n.getValue(this,"boxes_opened"),n.getValue(this,"tokens_obtained"),n.getValue(this,"show_result_2nd"),n.getValue(this,"show_result_3rd"),n.getValue(this,"show_result_other"),n.getValue(this,"time_loading"),n.getValue(this,"time_fight")}};var p=function(){var e=this,t=e._self._c;return t("div",{staticClass:"flex flex-col flex-wrap items-center"},[t("h1",{staticClass:"mb-8"},[e._v("Dread Barrage Calculator")]),t("div",{staticClass:"flex flex-col gap-x-4"},[t("span",{staticClass:"flex flex-row flex-wrap items-center gap-4"},[t("label",[e._v("Boxes needed "),t("input",{directives:[{name:"model",rawName:"v-model.lazy",value:e.boxes_needed,expression:"boxes_needed",modifiers:{lazy:!0}}],staticClass:"input input-sm",staticStyle:{width:"7ch"},attrs:{type:"number",min:"1"},domProps:{value:e.boxes_needed},on:{change:function(o){e.boxes_needed=o.target.value}}})]),t("label",[e._v("Already opened "),t("input",{directives:[{name:"model",rawName:"v-model.lazy",value:e.boxes_opened,expression:"boxes_opened",modifiers:{lazy:!0}}],staticClass:"input input-sm",staticStyle:{width:"7ch"},attrs:{type:"number",min:"0"},domProps:{value:e.boxes_opened},on:{change:function(o){e.boxes_opened=o.target.value}}})])]),t("span",{staticClass:"flex flex-row flex-wrap items-center gap-4"},[t("label",[e._v("Tokens obtained "),t("input",{directives:[{name:"model",rawName:"v-model.lazy",value:e.tokens_obtained,expression:"tokens_obtained",modifiers:{lazy:!0}}],staticClass:"input input-sm",staticStyle:{width:"10ch"},attrs:{type:"number",min:"0"},domProps:{value:e.tokens_obtained},on:{change:function(o){e.tokens_obtained=o.target.value}}})]),t("span",[e._v("Progress: "+e._s(e.getProgress)+"%")])])]),t("div",{staticClass:"flex flex-col gap-x-4 mb-8"},[t("span",[e._v(e._s(e.tokens_explained))]),t("span",{staticClass:"text-lg font-bold"},[e._v("Tokens needed: "+e._s(e.tokens_needed))])]),t("h2",{staticClass:"mb-4"},[e._v("Farming time calculator (input in seconds):")]),t("div",{staticClass:"overflow-y-auto w-full"},[t("table",{staticClass:"table bg-secondary table-px w-auto ml-auto mr-auto mb-8"},[e._m(0),t("tbody",[t("tr",[t("td",[e._v("Loading")]),t("td",[t("input",{directives:[{name:"model",rawName:"v-model.lazy",value:e.time_loading,expression:"time_loading",modifiers:{lazy:!0}}],staticClass:"input input-sm",staticStyle:{width:"7ch"},attrs:{type:"number",min:"0"},domProps:{value:e.time_loading},on:{change:function(o){e.time_loading=o.target.value}}})]),t("td"),t("td"),t("td")]),e._l(e.getFights,function(o,_){return t("tr",{key:_},[t("td",[e._v(e._s(o.name))]),t("td",[t("input",{directives:[{name:"model",rawName:"v-model.lazy",value:e.time_fight[_],expression:"time_fight[index]",modifiers:{lazy:!0}}],staticClass:"input input-sm",staticStyle:{width:"7ch"},attrs:{type:"number",min:"1"},domProps:{value:e.time_fight[_]},on:{change:function(i){return e.$set(e.time_fight,_,i.target.value)}}})]),t("td",[e._v(e._s(o.total_time))]),t("td",[e._v(e._s(o.token_per_hour))]),t("td",[e._v(e._s(o.ap_per_hour))])])})],2)])]),t("div",{staticClass:"flex flex-row flex-wrap items-center gap-4"},[t("span",{staticClass:"flex flex-row flex-wrap btn-group items-center"},[t("span",{staticClass:"mr-2"},[e._v("Fight")]),e._l(e.getFightNames,function(o,_){return t("button",{key:_,staticClass:"btn btn-sm",class:e.show_fight[_]?"btn-blue":"btn-white",on:{click:function(i){return e.showFight(_)}}},[e._v(" "+e._s(o)+" ")])})],2),t("span",{staticClass:"flex flex-row flex-wrap btn-group items-center"},[t("span",{staticClass:"mr-2"},[e._v("Type")]),t("button",{staticClass:"btn btn-sm",class:e.show_host?"btn-blue":"btn-white",on:{click:function(o){e.show_host=!e.show_host}}},[e._v(" Host ")]),t("button",{staticClass:"btn btn-sm",class:e.show_join?"btn-blue":"btn-white",on:{click:function(o){e.show_join=!e.show_join}}},[e._v(" Join ")])])]),t("div",{staticClass:"flex flex-row flex-wrap mb-4 items-center gap-4"},[e._v(" Show results for "),t("checkbox",{staticClass:"ordinal",model:{value:e.show_result_2nd,callback:function(o){e.show_result_2nd=o},expression:"show_result_2nd"}},[e._v("2nd")]),t("checkbox",{staticClass:"ordinal",model:{value:e.show_result_3rd,callback:function(o){e.show_result_3rd=o},expression:"show_result_3rd"}},[e._v("3rd")]),t("checkbox",{model:{value:e.show_result_other,callback:function(o){e.show_result_other=o},expression:"show_result_other"}},[e._v("Other")])],1),t("div",{staticClass:"overflow-y-auto w-full"},[t("table",{staticClass:"table table-striped bg-secondary table-px w-auto ml-auto mr-auto"},[t("thead",[t("tr",[t("th",[e._v("Name")]),e.show_host&&e.show_join?t("th"):e._e(),e.show_result_2nd||e.show_result_3rd||e.show_result_other?t("th"):e._e(),t("th",[e._v("Tokens")]),e.show_host?t("th",[e._v("Tokens/AP")]):e._e(),e.show_join?t("th",[e._v("Tokens/EP")]):e._e(),t("th",[e._v("Fights")]),e.show_host?t("th",[e._v("Pots")]):e._e(),e.show_join?t("th",[e._v("Berries")]):e._e()])]),t("tbody",e._l(e.getData,function(o,_){return t("tr",{key:_},[o.name?t("td",{staticClass:"is-td-vcentered bg-secondary",attrs:{rowspan:o.name_rows}},[e._v(e._s(o.name))]):e._e(),o.type&&e.show_host&&e.show_join?t("td",{staticClass:"is-td-vcentered bg-secondary",attrs:{rowspan:o.type_rows}},[e._v(e._s(o.type))]):e._e(),e.show_result_2nd||e.show_result_3rd||e.show_result_other?t("td",[e._v(e._s(o.finish))]):e._e(),t("td",[e._v(e._s(o.token))]),e.show_host?t("td",[e._v(e._s(o.cost_ap?(o.token/o.cost_ap).toFixed(2):""))]):e._e(),e.show_join?t("td",[e._v(e._s(o.cost_ep?(o.token/o.cost_ep).toFixed(2):""))]):e._e(),t("td",[e._v(e._s(Math.ceil(e.tokens_needed/o.token)))]),e.show_host?t("td",[e._v(e._s(o.cost_ap>0?Math.ceil(e.tokens_needed/o.token*(o.cost_ap/75)):""))]):e._e(),e.show_join?t("td",[e._v(e._s(o.cost_ep>0?Math.ceil(e.tokens_needed/o.token*o.cost_ep):""))]):e._e()])}),0)])])])},k=[function(){var s=this,e=s._self._c;return e("thead",[e("tr",[e("th",[s._v("Name")]),e("th",[s._v("Time")]),e("th",[s._v("Total")]),e("th",[s._v("Tokens/hour")]),e("th",[s._v("AP/hour")])])])}],m=d(c,p,k,!1,null,null);const x=m.exports;export{x as default};