import { EquipmentSlot} from "@minecraft/server";
import { ActionFormData } from "@minecraft/server-ui";

const weapon = {
    name: 'skill_book',
    display_name: "Skill Book",
    dual_wield: "none",
    type: "book",
    block_damage: 45,
    cd: 8,
    cmbname: "dch_cmb",
    setCore(player, item) {
        const fades = new ActionFormData()
            .title('clash')
            .body('')
            .button(`dual_wield_longsword`)
            .button(`super_jump`)
            .show(player)
            .then(result => {
            if (result.selection === 0) {
                item.setLore(["dual_wield_longsword"])
                player.getComponent('equippable')?.setEquipment(EquipmentSlot.Mainhand, item)
            }
            if (result.selection === 1) {
                item.setLore(["super_jump"])
                player.getComponent('equippable')?.setEquipment(EquipmentSlot.Mainhand, item)
            }
        })
    },
    book_select(player, item) {
        const fades = new ActionFormData()
            .title('clash')
            .body('')
            .button(`dual_wield_longsword`)
            .button(`super_jump`)
            .show(player)
            .then(result => {
            if (result.selection === 0) {
                item.setLore(["dual_wield_longsword"])
                player.getComponent('equippable')?.setEquipment(EquipmentSlot.Mainhand, item)
            }
            if (result.selection === 1) {
                item.setLore(["super_jump"])
                player.getComponent('equippable')?.setEquipment(EquipmentSlot.Mainhand, item)
            }
        })
    }
}

export default weapon


