2 lines
11 KiB
JavaScript
2 lines
11 KiB
JavaScript
import{D as c}from"./Dropdown-Cks-nQIq.js";import{n as p}from"./index-DDNMzpZj.js";const u={components:{Dropdown:c},props:{object:{type:Object,required:!0}},data(){return{restriction_elem:[],restriction_weapon:[],restriction_race:[]}},methods:{addRestriction(s,t){t.length===0?(this.$delete(this.object.restriction,s),Object.keys(this.object.restriction).length===0&&this.$delete(this.object,"restriction")):(this.object.hasOwnProperty("restriction")||this.$set(this.object,"restriction",{}),this.$set(this.object.restriction,s,t))},linkRestrictions(){this.object.hasOwnProperty("restriction")&&(this.object.restriction.hasOwnProperty("element")&&(this.restriction_elem=this.object.restriction.element),this.object.restriction.hasOwnProperty("weapon")&&(this.restriction_weapon=this.object.restriction.weapon),this.object.restriction.hasOwnProperty("race")&&(this.restriction_race=this.object.restriction.race))}},computed:{getObjectJSON:{get(){return JSON.stringify(this.object)},set(s){for(let[t,e]of Object.entries(JSON.parse(s)))this.$set(this.object,t,e);this.linkRestrictions()}}},watch:{"object.percent.1"(){this.object.percent[1]||this.$delete(this.object.percent,"1")},"object.percent.10"(){this.object.percent[10]||this.$delete(this.object.percent,"10")},"object.percent.15"(){this.object.percent[15]||this.$delete(this.object.percent,"15")},"object.percent.20"(){this.object.percent[20]||this.$delete(this.object.percent,"20")},restriction_elem(){this.addRestriction("element",this.restriction_elem)},restriction_weapon(){this.addRestriction("weapon",this.restriction_weapon)},restriction_race(){this.addRestriction("race",this.restriction_race)}},mounted(){this.linkRestrictions()}};var _=function(){var t=this,e=t._self._c;return e("div",{staticClass:"flex flex-row grow items-center text-sm"},[e("span",{staticClass:"flex flex-col items-center"},[t._v(" 1 "),e("input",{directives:[{name:"model",rawName:"v-model.number",value:t.object.percent[1],expression:"object.percent['1']",modifiers:{number:!0}}],staticClass:"input mr-1",staticStyle:{width:"6ch"},domProps:{value:t.object.percent[1]},on:{input:function(a){a.target.composing||t.$set(t.object.percent,"1",t._n(a.target.value))},blur:function(a){return t.$forceUpdate()}}})]),e("span",{staticClass:"flex flex-col items-center"},[t._v("10 "),e("input",{directives:[{name:"model",rawName:"v-model.number",value:t.object.percent[10],expression:"object.percent['10']",modifiers:{number:!0}}],staticClass:"input mr-1",staticStyle:{width:"6ch"},domProps:{value:t.object.percent[10]},on:{input:function(a){a.target.composing||t.$set(t.object.percent,"10",t._n(a.target.value))},blur:function(a){return t.$forceUpdate()}}})]),e("span",{staticClass:"flex flex-col items-center"},[t._v("15 "),e("input",{directives:[{name:"model",rawName:"v-model.number",value:t.object.percent[15],expression:"object.percent['15']",modifiers:{number:!0}}],staticClass:"input mr-1",staticStyle:{width:"6ch"},domProps:{value:t.object.percent[15]},on:{input:function(a){a.target.composing||t.$set(t.object.percent,"15",t._n(a.target.value))},blur:function(a){return t.$forceUpdate()}}})]),e("span",{staticClass:"flex flex-col items-center"},[t._v("20 "),e("input",{directives:[{name:"model",rawName:"v-model.number",value:t.object.percent[20],expression:"object.percent['20']",modifiers:{number:!0}}],staticClass:"input mr-1",staticStyle:{width:"6ch"},domProps:{value:t.object.percent[20]},on:{input:function(a){a.target.composing||t.$set(t.object.percent,"20",t._n(a.target.value))},blur:function(a){return t.$forceUpdate()}}})]),e("span",{staticClass:"flex flex-col items-center"},[t._v(" Aura "),e("dropdown",{staticClass:"w-24 mr-1",model:{value:t.object.aura_type,callback:function(a){t.$set(t.object,"aura_type",a)},expression:"object.aura_type"}},[e("option",{attrs:{value:"ex"}},[t._v("ex")]),e("option",{attrs:{value:"elemental"}},[t._v("elemental")]),e("option",{attrs:{value:"normal"}},[t._v("normal")]),e("option",{attrs:{value:"optimus"}},[t._v("optimus")]),e("option",{attrs:{value:"omega"}},[t._v("omega")]),e("option",{attrs:{value:"seraphic"}},[t._v("seraphic")]),e("option",{attrs:{value:"mysterious"}},[t._v("mysterious")])])],1),e("span",{staticClass:"flex flex-col items-center"},[t._v(" Stat "),e("dropdown",{staticClass:"w-24 mr-1",model:{value:t.object.stat,callback:function(a){t.$set(t.object,"stat",a)},expression:"object.stat"}},[e("option",{attrs:{value:"atk"}},[t._v("atk")]),e("option",{attrs:{value:"atk_cap"}},[t._v("atk_cap")]),e("option",{attrs:{value:"hp"}},[t._v("hp")]),e("option",{attrs:{value:"da"}},[t._v("da")]),e("option",{attrs:{value:"ta"}},[t._v("ta")]),e("option",{attrs:{value:"crit"}},[t._v("crit")]),e("option",{attrs:{value:"ca_dmg"}},[t._v("ca_dmg")]),e("option",{attrs:{value:"ca_cap"}},[t._v("ca_cap")]),e("option",{attrs:{value:"chainburst_dmg"}},[t._v("chainburst_dmg")]),e("option",{attrs:{value:"chainburst_cap"}},[t._v("chainburst_cap")]),e("option",{attrs:{value:"stamina"}},[t._v("stamina")]),e("option",{attrs:{value:"enmity"}},[t._v("enmity")]),e("option",{attrs:{value:"supplemental_dmg"}},[t._v("supplemental_dmg")])])],1),e("select",{directives:[{name:"model",rawName:"v-model",value:t.restriction_elem,expression:"restriction_elem"}],staticClass:"select w-24",attrs:{multiple:"",size:"6"},on:{change:function(a){var i=Array.prototype.filter.call(a.target.options,function(r){return r.selected}).map(function(r){var n="_value"in r?r._value:r.value;return n});t.restriction_elem=a.target.multiple?i:i[0]}}},[e("option",{attrs:{value:"fire"}},[t._v("Fire")]),e("option",{attrs:{value:"water"}},[t._v("Water")]),e("option",{attrs:{value:"earth"}},[t._v("Earth")]),e("option",{attrs:{value:"wind"}},[t._v("Wind")]),e("option",{attrs:{value:"light"}},[t._v("Light")]),e("option",{attrs:{value:"dark"}},[t._v("Dark")])]),e("select",{directives:[{name:"model",rawName:"v-model",value:t.restriction_weapon,expression:"restriction_weapon"}],staticClass:"select w-24",attrs:{multiple:"",size:"6"},on:{change:function(a){var i=Array.prototype.filter.call(a.target.options,function(r){return r.selected}).map(function(r){var n="_value"in r?r._value:r.value;return n});t.restriction_weapon=a.target.multiple?i:i[0]}}},[e("option",{attrs:{value:"axe"}},[t._v("Axe")]),e("option",{attrs:{value:"bow"}},[t._v("Bow")]),e("option",{attrs:{value:"dagger"}},[t._v("Dagger")]),e("option",{attrs:{value:"gun"}},[t._v("Gun")]),e("option",{attrs:{value:"harp"}},[t._v("Harp")]),e("option",{attrs:{value:"katana"}},[t._v("Katana")]),e("option",{attrs:{value:"melee"}},[t._v("Melee")]),e("option",{attrs:{value:"sabre"}},[t._v("Sabre")]),e("option",{attrs:{value:"spear"}},[t._v("Spear")]),e("option",{attrs:{value:"staff"}},[t._v("Staff")])]),e("select",{directives:[{name:"model",rawName:"v-model",value:t.restriction_race,expression:"restriction_race"}],staticClass:"select w-24",attrs:{multiple:"",size:"6"},on:{change:function(a){var i=Array.prototype.filter.call(a.target.options,function(r){return r.selected}).map(function(r){var n="_value"in r?r._value:r.value;return n});t.restriction_race=a.target.multiple?i:i[0]}}},[e("option",{attrs:{value:"human"}},[t._v("Human")]),e("option",{attrs:{value:"draph"}},[t._v("Draph")]),e("option",{attrs:{value:"erune"}},[t._v("Erune")]),e("option",{attrs:{value:"harvin"}},[t._v("Harvin")]),e("option",{attrs:{value:"primal"}},[t._v("Primal")]),e("option",{attrs:{value:"unknown"}},[t._v("Unknown")])]),e("textarea",{directives:[{name:"model",rawName:"v-model.lazy",value:t.getObjectJSON,expression:"getObjectJSON",modifiers:{lazy:!0}}],staticClass:"text-primary bg-tertiary font-mono grow",attrs:{rows:"7",spellcheck:"false"},domProps:{value:t.getObjectJSON},on:{change:function(a){t.getObjectJSON=a.target.value}}})])},v=[],d=p(u,_,v,!1,null,null);const m=d.exports,h={components:{WeaponProps:m,Dropdown:c},head:{title:"Granblue.Party - Admin",desc:"",image:"",keywords:""},data(){return{message:[],hide_skill_job_weapon:!0}},methods:{saveData(){let s={data:[]};this.message.forEach(t=>{t.data?s.data.push([t.skilldataid,{data:t.data}]):s.data.push([t.skilldataid,null])}),this.axios.post("/admin/weapons",s).then(t=>this.$store.dispatch("addMessage",{message:"Saved"})).catch(t=>this.$store.dispatch("addAxiosErrorMessage",t))},addProp(s){s.data||this.$set(s,"data",[]),s.data.push({percent:{}})},removeProp(s){s.data&&(s.data.pop(),s.data.length===0&&this.$delete(s,"data"))},hideNonEmptySkills(){this.message.forEach(s=>{s.data!==null&&this.$set(s,"hide",!0)})}},computed:{getSkills(){return this.message.flatMap(s=>s.hide===!0||s.icon==="ws_skill_blank.png"||s.icon==="ws_skill_job_weapon.png"&&this.hide_skill_job_weapon===!0?[]:[s])}},mounted(){this.axios.get("/admin/weapons").then(s=>{for(let t of s.data)t.data&&(t.data=t.data.data);this.message=s.data}).catch(s=>this.$store.dispatch("addAxiosErrorMessage",s))}};var b=function(){var t=this,e=t._self._c;return e("div",{staticClass:"flex flex-col"},[e("div",{staticClass:"flex flex-row flex-wrap items-center mb-4"},[e("a",{staticClass:"mr-4",attrs:{href:"/admin"}},[t._v("Up")]),e("button",{staticClass:"btn btn-white mr-4",on:{click:function(a){return t.saveData()}}},[t._v("Save")]),e("button",{staticClass:"btn btn-white mr-4",on:{click:function(a){return t.hideNonEmptySkills()}}},[t._v("Hide")]),e("input",{directives:[{name:"model",rawName:"v-model",value:t.hide_skill_job_weapon,expression:"hide_skill_job_weapon"}],attrs:{type:"checkbox",id:"hide_skill_job_weapon"},domProps:{checked:Array.isArray(t.hide_skill_job_weapon)?t._i(t.hide_skill_job_weapon,null)>-1:t.hide_skill_job_weapon},on:{change:function(a){var i=t.hide_skill_job_weapon,r=a.target,n=!!r.checked;if(Array.isArray(i)){var l=null,o=t._i(i,l);r.checked?o<0&&(t.hide_skill_job_weapon=i.concat([l])):o>-1&&(t.hide_skill_job_weapon=i.slice(0,o).concat(i.slice(o+1)))}else t.hide_skill_job_weapon=n}}}),e("label",{attrs:{for:"hide_skill_job_weapon"}},[t._v("hide_skill_job_weapon")])]),t._v(" Skills: "+t._s(t.getSkills.length)+" "),t._l(t.getSkills,function(a,i){return e("div",{key:a.skillname+a.icon,staticClass:"flex flex-row items-center mb-4 gap-2 border-b-2"},[e("span",[t._v(t._s(i))]),e("span",[e("img",{staticStyle:{"min-width":"20px",width:"30px"},attrs:{src:"/img/weapon_skills/"+a.icon}})]),e("span",[t._v(" "+t._s(a.skillname)),e("br"),t._v(" "+t._s(a.icon)+" "),a.boost?e("span",[e("br"),t._v(t._s(a.boost))]):t._e()]),a.weapons?e("span",{staticClass:"w-32"},[e("a",{attrs:{href:"https://gbf.wiki/"+a.weapons[0].nameen,target:"_blank"}},[t._v(" Wiki link "),e("br")]),e("span",[e("dropdown",{staticClass:"w-32",attrs:{value:"0"}},t._l(a.weapons,function(r,n){return e("option",{key:a.skillname+n+a.icon+r.weaponid,domProps:{value:n}},[t._v(" "+t._s(r.nameen)+" ")])}),0),t._v(" "+t._s(a.weapons.length)+" ")],1)]):t._e(),e("span",[e("button",{staticClass:"btn btn-blue btn-sm",on:{click:function(r){return t.addProp(a)}}},[t._v("+")])]),e("span",{staticClass:"flex grow"},[a.data?e("span",{staticClass:"flex flex-col grow gap-y-2"},t._l(a.data,function(r,n){return e("weapon-props",{key:n,attrs:{object:r}})}),1):t._e()]),e("span",[e("button",{staticClass:"btn btn-blue btn-sm",on:{click:function(r){return t.removeProp(a)}}},[t._v("-")])])])})],2)},f=[],w=p(h,b,f,!1,null,null);const k=w.exports;export{k as default};
|