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

2 lines
8.5 KiB
JavaScript

import{n as _,U as r}from"./index-DDNMzpZj.js";import{C as h}from"./Checkbox-Dc2UYqO9.js";const n=new r.LocalStorageMgt("CalcEvent"),i=[{name:"Very Hard",cost_ap:20,cost_meat:0,cost_ep:1,token_host:6,token_join:11,token_1:6},{name:"Extreme",cost_ap:30,cost_meat:3,cost_ep:3,token_host:20,token_join:16,token_1:12},{name:"Impossible",cost_ap:40,cost_meat:5,cost_ep:3,token_host:44,token_join:28,token_1:24}],l={components:{Checkbox:h},head:{title:"Granblue.Party - New Event Calculator",desc:"Calculator for new Event tokens and boxes",image:"https://www.granblue.party/img/card_calcevent.jpg",keywords:"Event, boxes, tokens, Token Draw, calculator, crystals"},data(){return{boxes_needed:20,boxes_opened:0,tokens_explained:"",tokens_obtained:0,tokens_total:0,nightmare_rate:4,show_fight:[!0,!0,!0],show_host:!0,show_join:!0,add_nightmare:!1}},methods:{showFight(o){this.$set(this.show_fight,o,!this.show_fight[o])},getFightData(o){let e=[];return this.show_host&&(e.push({name:o.name,name_rows:4/(this.show_join?1:2),honor:o.honor,honor_rows:4/(this.show_join?1:2),type:"Host",type_rows:2,finish:"MVP",token:o.token_host+o.token_join+o.token_1+(this.add_nightmare?this.getNightmareEarn:0),cost_ap:o.cost_ap,cost_meat:o.cost_meat}),e.push({finish:"",token:o.token_host+o.token_join+(this.add_nightmare?this.getNightmareEarn:0),cost_ap:o.cost_ap,cost_meat:o.cost_meat})),this.show_join&&(e.push({type:"Join",type_rows:2,finish:"MVP",token:o.token_join+o.token_1,cost_ep:o.cost_ep}),this.show_host||(e[e.length-1].name=o.name,e[e.length-1].name_rows=2),e.push({finish:"",token:o.token_join,cost_ep:o.cost_ep})),e}},computed:{getData(){return i.flatMap((o,e)=>this.show_fight[e]?this.getFightData(o):[])},getFightNames(){return i.map(o=>o.name)},getBoxesNeeded(){return parseInt(this.boxes_needed,10)},getBoxesOpened(){return parseInt(this.boxes_opened,10)},getTokensObtained(){return parseInt(this.tokens_obtained,10)},getProgress(){let o=(100-this.tokens_needed/this.tokens_total*100).toFixed(2);return this.tokens_total==0?100 .toFixed(2):o},getNightmareEarn(){return this.nightmare_rate<1?0:100/this.nightmare_rate},tokens_needed(){let o=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&&(o+=1198,e--,this.tokens_explained+="1198",t=!0),this.getBoxesOpened<2&&e>0&&(o+=1598,e--,this.tokens_explained+=(t?" + ":"")+"1598",t=!0),this.getBoxesOpened<3&&e>0&&(o+=1998,e--,this.tokens_explained+=(t?" + ":"")+"1998",t=!0),this.getBoxesOpened<20&&e>0){const s=Math.min(17,e,20-this.getBoxesOpened);o+=2110*s,e-=s,this.tokens_explained+=(t?" + ":"")+s+"x2110",t=!0}return e>0&&(o+=2104*e,this.tokens_explained+=(t?" + ":"")+e+"x2104"),this.tokens_total=o,this.tokens_explained&&(this.tokens_explained+=" tokens)"),this.getTokensObtained>0&&(o-=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,o)}},watch:{boxes_needed(){n.setValue("boxes_needed",this)},boxes_opened(){n.setValue("boxes_opened",this)},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)},nightmare_rate(){n.setValue("nightmare_rate",this)},add_nightmare(){n.setValue("add_nightmare",this)}},mounted(){n.getValue(this,"boxes_needed"),n.getValue(this,"boxes_opened"),n.getValue(this,"show_fight"),n.getValue(this,"show_host"),n.getValue(this,"show_join"),n.getValue(this,"tokens_obtained"),n.getValue(this,"nightmare_rate"),n.getValue(this,"add_nightmare")}};var d=function(){var e=this,t=e._self._c;return t("div",{staticClass:"flex flex-col items-center"},[t("h1",{staticClass:"mb-8"},[e._v("New Event tokens Calculator")]),t("div",{staticClass:"flex flex-col mb-8 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(s){e.boxes_needed=s.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(s){e.boxes_opened=s.target.value}}})]),t("span",[e._v("Progress: "+e._s(e.getProgress)+"%")])]),t("span",{staticClass:"flex flex-row flex-wrap items-center"},[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(s){e.tokens_obtained=s.target.value}}})])]),t("span",[e._v(" A Nightmare fight appears on average once every "),t("input",{directives:[{name:"model",rawName:"v-model.lazy",value:e.nightmare_rate,expression:"nightmare_rate",modifiers:{lazy:!0}}],staticClass:"input input-sm",staticStyle:{width:"5ch"},attrs:{type:"number",min:"0"},domProps:{value:e.nightmare_rate},on:{change:function(s){e.nightmare_rate=s.target.value}}}),e._v(" raids ")]),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("div",{staticClass:"flex flex-row flex-wrap mb-4 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(s,a){return t("button",{key:a,staticClass:"btn btn-sm",class:e.show_fight[a]?"btn-blue":"btn-white",on:{click:function(m){return e.showFight(a)}}},[e._v(" "+e._s(s)+" ")])})],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(s){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(s){e.show_join=!e.show_join}}},[e._v(" Join ")])]),t("checkbox",{model:{value:e.add_nightmare,callback:function(s){e.add_nightmare=s},expression:"add_nightmare"}},[e._v("Include Nightmare tokens to sum")])],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")]),t("th"),t("th"),t("th",[e._v("Tokens")]),e.show_host?t("th",[e._v("Tokens/AP")]):e._e(),e.show_host?t("th",[e._v("Tokens/meat")]):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("Meats")]):e._e(),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(s,a){return t("tr",{key:a},[s.name?t("td",{staticClass:"is-td-vcentered",attrs:{rowspan:s.name_rows}},[e._v(e._s(s.name))]):e._e(),s.type?t("td",{staticClass:"is-td-vcentered",attrs:{rowspan:s.type_rows}},[e._v(e._s(s.type))]):e._e(),t("td",[e._v(e._s(s.finish))]),t("td",[e._v(e._s(+s.token.toFixed(2)))]),e.show_host?t("td",[e._v(e._s(s.cost_ap?(s.token/s.cost_ap).toFixed(2):""))]):e._e(),e.show_host?t("td",[e._v(e._s(s.cost_meat?(s.token/s.cost_meat).toFixed(2):""))]):e._e(),e.show_join?t("td",[e._v(e._s(s.cost_ep?(s.token/s.cost_ep).toFixed(2):""))]):e._e(),t("td",[e._v(e._s(Math.ceil(e.tokens_needed/s.token)))]),e.show_host?t("td",[e._v(e._s(s.cost_meat>0?Math.ceil(e.tokens_needed/s.token*s.cost_meat):""))]):e._e(),e.show_host?t("td",[e._v(e._s(s.cost_ap>0?Math.ceil(e.tokens_needed/s.token*(s.cost_ap/75)):""))]):e._e(),e.show_join?t("td",[e._v(e._s(s.cost_ep>0?Math.ceil(e.tokens_needed/s.token*s.cost_ep):""))]):e._e()])}),0)])]),e._m(0)])},c=[function(){var o=this,e=o._self._c;return e("span",{staticClass:"pt-4"},[e("h2",[o._v("Additional information")]),e("ul",{staticClass:"list-disc ml-4"},[e("li",[o._v("You might need up to 14 additional tokens for carried over Damascus Crystals in boxes 4 to 10")]),e("li",[o._v("Each daily mission gives an additional 200 tokens")]),e("li",[o._v("Nightmare quest can only appear after raids you've hosted")])])])}],p=_(l,d,c,!1,null,null);const g=p.exports;export{g as default};