import * as ui from "@minecraft/server-ui";
import { ActionFormData,  MessageFormData,  ModalFormData} from "@minecraft/server-ui";
import { world, Scoreboard, system, ItemStack, Player, MolangVariableMap, Entity, BlockPermutation, CommandPermissionLevel, CustomCommandParamType, CustomCommandStatus} from "@minecraft/server";



function getScore(entity, objective) {
    try {
        const obj = world.scoreboard.getObjective(objective);
        if (!obj) return null;

        const id = entity.scoreboardIdentity;
        if (!id) return null;

        return obj.getScore(id);
    } catch {
        return null;
    }
}
function setScore(entity, objective, value) {
    try {
        world.scoreboard.getObjective(objective)?.setScore(entity, value);
    } catch {}
}
function hasScore(entity, objective) {
    try {
        const obj = world.scoreboard.getObjective(objective);
        if (!obj) return false;

        const id = entity.scoreboardIdentity;
        if (!id) return false;

        return obj.getScore(id) !== undefined;
    } catch {
        return false;
    }
}


////////////////////////////////////////////////////////////////////////////////////////////////////////////////
world.afterEvents.itemUse.subscribe((eventData) => {
    if (eventData.itemStack.typeId === "well:bussola_alma") {
        let player = eventData.source;
        pet1(player);
    }
});
world.beforeEvents.itemUse.subscribe((eventData) => {
    if (eventData.itemStack?.typeId !== "well:teleporterapido") return;

    const player = eventData.source;

    // Executa a função do pergaminho sempre
    system.run(() => {
        player.runCommand("/function scripts_forms/pergaminho");
    });

    // 🔴 PRIORIDADE ABSOLUTA: ARENA
    if (player.hasTag("arena")) {
        system.run(() => arena_desistencia(player));
        return; // IGNORA TODAS AS OUTRAS TAGS
    }

    // Ações por tag (normal)
    const tagActions = {
        "novice": () => menulistwell(player),
        "novice1": () => menulistwell(player),
        "novice2": () => menulistwell(player),
        "novice3": () => menulistwell(player),
        "boss1": () => menulistwell(player),

        "adventure": () => menulistwell1(player),
        "adventure1": () => menulistwell1(player),
        "adventure2": () => menulistwell1(player),
        "adventure3": () => menulistwell1(player),
        "adventure4": () => menulistwell1(player),
        "boss2": () => menulistwell1(player),

        "master": () => menulistwell2(player),
        "master1": () => menulistwell2(player),
        "master2": () => menulistwell2(player),
        "boss3": () => menulistwell2(player),

        "hero": () => menulistwell3(player),
        "hero1": () => menulistwell3(player),
        "hero2": () => menulistwell3(player),
        "hero3": () => menulistwell3(player),
        "hero4": () => menulistwell3(player),

        "boss4": () => menulistwell4(player),
        "legendary": () => menulistwell4(player),

        "genero": () => genero(player)
    };

    // Verifica tags normalmente
    for (const tag in tagActions) {
        if (player.hasTag(tag)) {
            system.run(tagActions[tag]);
            break;
        }
    }
});
world.afterEvents.itemUse.subscribe((eventData) => {
    if (eventData.itemStack.typeId === "well:livro_do_mago") {
        let player = eventData.source;
        livro_do_mago(player);
    }
});
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
world.afterEvents.playerInteractWithEntity.subscribe(({player, target}) => {
    if (target.typeId === "well:bau_interface_allay") {
        {menu_allay_d2(player)}
    }
})
world.afterEvents.playerInteractWithEntity.subscribe(({player, target}) => {
    if (target.typeId === "well:bau_interface_lula") {
        {menu_lula_d2(player)}
    }
})
world.afterEvents.playerInteractWithEntity.subscribe(({player, target}) => {
    if (target.typeId === "well:bau_interface_zumbi") {
        {menu_zumbi_d2(player)}
    }
})
world.afterEvents.playerInteractWithEntity.subscribe(({player, target}) => {
    if (target.typeId === "well:bandeira_chunk") {
        {Chunk_menu_bandeira(player)}
    }
})
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
world.afterEvents.playerInteractWithEntity.subscribe(({player, target}) => {
    if (target.typeId === "well:mago_misterio") {
        {verificarSenha(player)}
    }
})
async function verificarSenha(player) {
    const senhaCorreta = "Abomination of the Swamp";

    const form = new ui.ModalFormData()
        .title({ "rawtext": [{ "translate": "missao.labirinto.npc" }] })
        //.body({ "rawtext": [{ "translate": "missao.labirinto.npc" }] })
        .textField({ "rawtext": [{ "translate": "senha.boss3.puzzle" }]}, { "rawtext": [{ "translate": "senha.boss3.text" }]});

    const result = await form.show(player);

    if (result.canceled) return;

    const senhaDigitada = result.formValues[0];

    if (senhaDigitada === senhaCorreta) {
        player.sendMessage({ "rawtext": [{ "translate": "senha.boss3.correta" }]});

        system.run(() => {
            // Executa a função desejada
            player.runCommand("function dungeon_combate_boss3");
        });
    } else {
        player.sendMessage({ "rawtext": [{ "translate": "senha.boss3.incorreta" }]});
    }
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
world.afterEvents.playerInteractWithEntity.subscribe(({ player, target }) => {
    const validTypeIds = [
        "well:chicken",
        "well:allay",
        "well:bat",
        "well:fox",
		"well:tatu",
        "well:frog",
        "well:horse",
        "well:ocelot",
        "well:pig",
        "well:rabbit",
        "well:navi",
		"well:navi_amarela", 
		"well:navi_dark", 
		"well:navi_vermelha", 
		"well:navi_verde", 
		"well:navi_rosa"
    ];

    if (validTypeIds.includes(target.typeId)) {
        const petId = getPetId(target.typeId, player.name);

        if (!petOwners[petId]) {
            // Define o dono do pet apenas se não tiver um dono
            setOwner(player, petId);
        }

        if (isPetOwner(player, petId)) {
            target.petId = petId;
            petmenugeral(player, petId, target);
        } else {
            player.sendMessage("Você não é o dono deste pet!");
        }
    }
});
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
export function pet1(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:petone");
    form.body("");
	form.button({ rawtext: [{ translate: "<<" }] });
    form.button({ rawtext: [{ translate: "select_class.ok" }] });
	form.button({ rawtext: [{ translate: ">>" }] });
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
			pet11(player)
        }
        if (result.selection == 1) {
            player.runCommand("/event entity @s well:allay_domado");
			player.runCommand("/clear @s well:bussola_alma 0 1");
			player.runCommand(`/tag @e[type=well:allay_domado, r=5] add ${petOwners[target.petId].ownerName}`);
        }
		if (result.selection == 2) {
			pet2(player)
        }
    });
}
export function pet2(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:pet2");
    form.body("");
	form.button({ rawtext: [{ translate: "<<" }] });
    form.button({ rawtext: [{ translate: "select_class.ok" }] });
	form.button({ rawtext: [{ translate: ">>" }] });
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
			pet1(player)
        }
        if (result.selection == 1) {
            player.runCommand("/event entity @s well:bat_domado");
			player.runCommand("/clear @s well:bussola_alma 0 1");
			player.runCommand(`/tag @e[type=well:bat_domado, r=5] add ${player.getName()}`);
        }
		if (result.selection == 2) {
			pet3(player)
        }
    });
}
export function pet3(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:pet3");
    form.body("");
	form.button({ rawtext: [{ translate: "<<" }] });
    form.button({ rawtext: [{ translate: "select_class.ok" }] });
	form.button({ rawtext: [{ translate: ">>" }] });
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
			pet2(player)
        }
        if (result.selection == 1) {
            player.runCommand("/event entity @s well:galinha_domada");
			player.runCommand("/clear @s well:bussola_alma 0 1");
			player.runCommand(`/tag @e[type=well:galinha_domada, r=5] add ${player.getName()}`);
        }
		if (result.selection == 2) {
			pet4(player)
        }
    });
}
export function pet4(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:pet4");
    form.body("");
	form.button({ rawtext: [{ translate: "<<" }] });
    form.button({ rawtext: [{ translate: "select_class.ok" }] });
	form.button({ rawtext: [{ translate: ">>" }] });
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
			pet3(player)
        }
        if (result.selection == 1) {
            player.runCommand("/event entity @s well:fada_domada");
			player.runCommand("/clear @s well:bussola_alma 0 1");
			player.runCommand(`/tag @e[type=well:fada_domada, r=5] add ${player.getName()}`);
        }
		if (result.selection == 2) {
			pet5(player)
        }
    });
}
export function pet5(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:pet5");
    form.body("");
	form.button({ rawtext: [{ translate: "<<" }] });
    form.button({ rawtext: [{ translate: "select_class.ok" }] });
	form.button({ rawtext: [{ translate: ">>" }] });
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
			pet4(player)
        }
        if (result.selection == 1) {
            player.runCommand("/event entity @s well:raposa_domada");
			player.runCommand("/clear @s well:bussola_alma 0 1");
			player.runCommand(`/tag @e[type=well:raposa_domada, r=5] add ${player.getName()}`);
        }
		if (result.selection == 2) {
			pet6(player)
        }
    });
}
export function pet6(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:pet6");
    form.body("");
	form.button({ rawtext: [{ translate: "<<" }] });
    form.button({ rawtext: [{ translate: "select_class.ok" }] });
	form.button({ rawtext: [{ translate: ">>" }] });
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
			pet5(player)
        }
        if (result.selection == 1) {
            player.runCommand("/event entity @s well:sapo_domado");
			player.runCommand("/clear @s well:bussola_alma 0 1");
			player.runCommand(`/tag @e[type=well:sapo_domado, r=5] add ${player.getName()}`);
        }
		if (result.selection == 2) {
			pet7(player)
        }
    });
}
export function pet7(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:pet7");
    form.body("");
	form.button({ rawtext: [{ translate: "<<" }] });
    form.button({ rawtext: [{ translate: "select_class.ok" }] });
	form.button({ rawtext: [{ translate: ">>" }] });
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
			pet6(player)
        }
        if (result.selection == 1) {
            player.runCommand("/event entity @s well:ocelot_domado");
			player.runCommand("/clear @s well:bussola_alma 0 1");
			player.runCommand(`/tag @e[type=well:ocelot_domado, r=5] add ${player.getName()}`);
        }
		if (result.selection == 2) {
			pet8(player)
        }
    });
}
export function pet8(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:pet8");
    form.body("");
	form.button({ rawtext: [{ translate: "<<" }] });
    form.button({ rawtext: [{ translate: "select_class.ok" }] });
	form.button({ rawtext: [{ translate: ">>" }] });
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
			pet7(player)
        }
        if (result.selection == 1) {
            player.runCommand("/event entity @s well:coelho_domado");
			player.runCommand("/clear @s well:bussola_alma 0 1");
			player.runCommand(`/tag @e[type=well:coelho_domado, r=5] add ${player.getName()}`);
        }
		if (result.selection == 2) {
			pet9(player)
        }
    });
}
export function pet9(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:pet9");
    form.body("");
	form.button({ rawtext: [{ translate: "<<" }] });
    form.button({ rawtext: [{ translate: "select_class.ok" }] });
	form.button({ rawtext: [{ translate: ">>" }] });
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
			pet8(player)
        }
        if (result.selection == 1) {
            player.runCommand("/event entity @s well:porco_domado");
			player.runCommand("/clear @s well:bussola_alma 0 1");
			player.runCommand(`/tag @e[type=well:porco_domado, r=5] add ${player.getName()}`);
        }
		if (result.selection == 2) {
			pet10(player)
        }
    });
}
export function pet10(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:pet10");
    form.body("");
	form.button({ rawtext: [{ translate: "<<" }] });
    form.button({ rawtext: [{ translate: "select_class.ok" }] });
	form.button({ rawtext: [{ translate: ">>" }] });
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
			pet9(player)
        }
        if (result.selection == 1) {
            player.runCommand("/event entity @s well:cavalo_domado");
			player.runCommand("/clear @s well:bussola_alma 0 1");
			player.runCommand(`/tag @e[type=well:cavalo_domado, r=5] add ${player.getName()}`);
        }
		if (result.selection == 2) {
			pet11(player)
        }
    });
}
export function pet11(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:pet11");
    form.body("");
	form.button({ rawtext: [{ translate: "<<" }] });
    form.button({ rawtext: [{ translate: "select_class.ok" }] });
	form.button({ rawtext: [{ translate: ">>" }] });
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
			pet10(player)
        }
        if (result.selection == 1) {
            player.runCommand("/event entity @s well:tatu_domado");
			player.runCommand("/clear @s well:bussola_alma 0 1");
			player.runCommand(`/tag @e[type=well:tatu_domado, r=5] add ${player.getName()}`);
        }
		if (result.selection == 2) {
			pet1(player)
        }
    });
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
export function skin_pet_allay(player) {
    let form = new ui.ActionFormData();
	form.title("pet_skins");
    form.body("");
    form.button({ rawtext: [{ translate: "§´Mascarado  15" }] }, "textures/ui/Pets_skins/allay/botoes/1.png" );
	form.button({ rawtext: [{ translate: "§´Ghost  5" }] }, "textures/ui/Pets_skins/allay/botoes/2.png" );
	form.button({ rawtext: [{ translate: "§´Ilusionista  10" }] }, "textures/ui/Pets_skins/allay/botoes/3.png" );
	form.button({ rawtext: [{ translate: "§´Ceifador  25" }] }, "textures/ui/Pets_skins/allay/botoes/4.png" );
	form.button({ rawtext: [{ translate: "§´Scorpion  30" }] }, "textures/ui/Pets_skins/allay/botoes/5.png" );
	form.button({ rawtext: [{ translate: "§´Happy  5" }] }, "textures/ui/Pets_skins/allay/botoes/6.png" );
    
    form.show(player).then((result) => {
        if (result.selection == 0) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=15..}] run event entity @e [type=well:allay, r=10, c=1] skin1")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=15..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=15..}] well:ruby 0 15")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..15}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..14}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		if (result.selection == 1) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=5..}] run event entity @e [type=well:allay, r=10, c=1] skin2")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=5..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=5..}] well:ruby 0 5")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..5}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..4}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		if (result.selection == 2) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=10..}] run event entity @e [type=well:allay, r=10, c=1] skin3")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=10..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=10..}] well:ruby 0 10")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..10}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..9}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		if (result.selection == 3) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=25..}] run event entity @e [type=well:allay, r=10, c=1] skin4")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=25..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=25..}] well:ruby 0 25")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..25}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..24}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		if (result.selection == 4) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=30..}] run event entity @e [type=well:allay, r=10, c=1] skin5")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=30..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=30..}] well:ruby 0 30")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..30}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..29}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		if (result.selection == 5) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=5..}] run event entity @e [type=well:allay, r=10, c=1] skin6")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=5..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=5..}] well:ruby 0 5")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..5}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..4}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		
    });
}
export function skin_pet_bat(player) {
    let form = new ui.ActionFormData();
	form.title("pet_skins");
    form.body("");
    form.button({ rawtext: [{ translate: "§´ Enderbat  5" }] }, "textures/ui/Pets_skins/bat/botoes/1.png" );
	form.button({ rawtext: [{ translate: "§´ Observador  10" }] }, "textures/ui/Pets_skins/bat/botoes/2.png" );
	form.button({ rawtext: [{ translate: "§´ Gligar  15" }] }, "textures/ui/Pets_skins/bat/botoes/3.png" );
	form.button({ rawtext: [{ translate: "§´ Zubat  30" }] }, "textures/ui/Pets_skins/bat/botoes/4.png" );
	form.button({ rawtext: [{ translate: "§´ Owl  10" }] }, "textures/ui/Pets_skins/bat/botoes/5.png" );
	form.button({ rawtext: [{ translate: "§´ Twitter  20" }] }, "textures/ui/Pets_skins/bat/botoes/6.png" );
    
    form.show(player).then((result) => {
        if (result.selection == 0) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=5..}] run event entity @e [type=well:bat, r=10, c=1] skin1")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=5..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=5..}] well:ruby 0 5")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..5}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..4}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		if (result.selection == 1) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=10..}] run event entity @e [type=well:bat, r=10, c=1] skin2")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=10..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=10..}] well:ruby 0 10")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..10}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..9}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		if (result.selection == 2) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=15..}] run event entity @e [type=well:bat, r=10, c=1] skin3")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=15..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=15..}] well:ruby 0 15")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..15}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..14}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		if (result.selection == 3) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=30..}] run event entity @e [type=well:bat, r=10, c=1] skin4")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=30..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=30..}] well:ruby 0 30")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..30}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..29}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		if (result.selection == 4) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=10..}] run event entity @e [type=well:bat, r=10, c=1] skin5")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=10..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=10..}] well:ruby 0 10")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..10}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..9}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		if (result.selection == 5) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=20..}] run event entity @e [type=well:bat, r=10, c=1] skin6")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=20..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=20..}] well:ruby 0 20")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..20}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..19}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		 
    });
}
export function skin_pet_chicken(player) {
    let form = new ui.ActionFormData();
	form.title("pet_skins");
    form.body("");
    form.button({ rawtext: [{ translate: "§´Red  45" }] }, "textures/ui/Pets_skins/chicken/botoes/1.png" );
	form.button({ rawtext: [{ translate: "§´Pesadelo  64" }] }, "textures/ui/Pets_skins/chicken/botoes/2.png" );
	form.button({ rawtext: [{ translate: "§´Goomba  30" }] }, "textures/ui/Pets_skins/chicken/botoes/3.png" );
	form.button({ rawtext: [{ translate: "§´FBI  20" }] }, "textures/ui/Pets_skins/chicken/botoes/4.png" );
	form.button({ rawtext: [{ translate: "§´Deadpool  10" }] }, "textures/ui/Pets_skins/chicken/botoes/5.png" );
	form.button({ rawtext: [{ translate: "§´Duck  15" }] }, "textures/ui/Pets_skins/chicken/botoes/6.png" );
    
    form.show(player).then((result) => {
        if (result.selection == 0) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=45..}] run event entity @e [type=well:chicken, r=10, c=1] skin1")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=45..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=45..}] well:ruby 0 45")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..45}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..44}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		if (result.selection == 1) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=64..}] run event entity @e [type=well:chicken, r=10, c=1] skin2")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=64..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=64..}] well:ruby 0 64")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..64}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..63}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		if (result.selection == 2) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=30..}] run event entity @e [type=well:chicken, r=10, c=1] skin3")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=30..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=30..}] well:ruby 0 30")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..30}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..29}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		if (result.selection == 3) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=20..}] run event entity @e [type=well:chicken, r=10, c=1] skin4")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=20..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=20..}] well:ruby 0 20")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..20}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..19}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		if (result.selection == 4) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=10..}] run event entity @e [type=well:chicken, r=10, c=1] skin5")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=10..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=10..}] well:ruby 0 10")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..10}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..9}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		if (result.selection == 5) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=15..}] run event entity @e [type=well:chicken, r=10, c=1] skin6")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=15..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=15..}] well:ruby 0 15")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..15}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..14}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		
    });
}
export function skin_pet_fada(player) {
    let form = new ui.ActionFormData();
	form.title("pet_skins");
    form.body("");
    form.button({ rawtext: [{ translate: "§´2D  10" }] }, "textures/items/navi_icon.png" );
	form.button({ rawtext: [{ translate: "§´Rose  10" }] }, "textures/ui/Pets_skins/fada/botoes/2.png" );
	form.button({ rawtext: [{ translate: "§´Green  10" }] }, "textures/ui/Pets_skins/fada/botoes/3.png" );
	form.button({ rawtext: [{ translate: "§´Red  10" }] }, "textures/ui/Pets_skins/fada/botoes/4.png" );
	form.button({ rawtext: [{ translate: "§´Black  10" }] }, "textures/ui/Pets_skins/fada/botoes/5.png" );
	form.button({ rawtext: [{ translate: "§´Yellow  10" }] }, "textures/ui/Pets_skins/fada/botoes/6.png" );
    
    form.show(player).then((result) => {
        if (result.selection == 0) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=10..}] run event entity @e [family=fadapet, r=10, c=1] skin1")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=10..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=10..}] well:ruby 0 10")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..10}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..9}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		if (result.selection == 1) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=10..}] run event entity @e [family=fadapet, r=10, c=1] skin2")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=10..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=10..}] well:ruby 0 10")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..10}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..9}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		if (result.selection == 2) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=10..}] run event entity @e [family=fadapet, r=10, c=1] skin3")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=10..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=10..}] well:ruby 0 10")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..10}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..9}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		if (result.selection == 3) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=10..}] run event entity @e [family=fadapet, r=10, c=1] skin4")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=10..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=10..}] well:ruby 0 10")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..10}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..9}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		if (result.selection == 4) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=10..}] run event entity @e [family=fadapet, r=10, c=1] skin5")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=10..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=10..}] well:ruby 0 10")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..10}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..9}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		if (result.selection == 5) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=10..}] run event entity @e [family=fadapet, r=10, c=1] skin6")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=10..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=10..}] well:ruby 0 10")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..10}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..9}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		
    });
}
export function skin_pet_fox(player) {
    let form = new ui.ActionFormData();
	form.title("pet_skins");
    form.body("");
    form.button({ rawtext: [{ translate: "§´§1Ártico  10" }] }, "textures/ui/Pets_skins/fox/botoes/1.png" );
	form.button({ rawtext: [{ translate: "§´§1Perry  15" }] }, "textures/ui/Pets_skins/fox/botoes/2.png" );
	form.button({ rawtext: [{ translate: "§´§1Style  45" }] }, "textures/ui/Pets_skins/fox/botoes/3.png" );
	form.button({ rawtext: [{ translate: "§´§1Guaxinim  20" }] }, "textures/ui/Pets_skins/fox/botoes/4.png" );
	form.button({ rawtext: [{ translate: "§´§1Zumbi  35" }] }, "textures/ui/Pets_skins/fox/botoes/5.png" );
	
	form.button({ rawtext: [{ translate: "§´§1???" }] }, "textures/ui/bestiario/Bloqueado/raposa" );
    
    form.show(player).then((result) => {
        if (result.selection == 0) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=45..}] run event entity @e [type=well:fox, r=10, c=1] skin1")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=45..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=45..}] well:ruby 0 45")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..45}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..44}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		if (result.selection == 1) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=64..}] run event entity @e [type=well:fox, r=10, c=1] skin2")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=64..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=64..}] well:ruby 0 64")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..64}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..63}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		if (result.selection == 2) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=30..}] run event entity @e [type=well:fox, r=10, c=1] skin3")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=30..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=30..}] well:ruby 0 30")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..30}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..29}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		if (result.selection == 3) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=20..}] run event entity @e [type=well:fox, r=10, c=1] skin4")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=20..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=20..}] well:ruby 0 20")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..20}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..19}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		if (result.selection == 4) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=10..}] run event entity @e [type=well:fox, r=10, c=1] skin5")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=10..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=10..}] well:ruby 0 10")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..10}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..9}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		
		if (result.selection == 5) {
		player.runCommand("execute as @p [r=5] run tellraw @p [r=5] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.update\" }]}")}
		
    });
}
export function skin_pet_frog(player) {
    let form = new ui.ActionFormData();
	form.title("pet_skins");
    form.body("");
    form.button({ rawtext: [{ translate: "§´§1Croagunk  20" }] }, "textures/ui/Pets_skins/frog/botoes/1.png" );
	form.button({ rawtext: [{ translate: "§´§1EnderFrog  10" }] }, "textures/ui/Pets_skins/frog/botoes/2.png" );
	form.button({ rawtext: [{ translate: "§´§1Suit  15" }] }, "textures/ui/Pets_skins/frog/botoes/3.png" );
	form.button({ rawtext: [{ translate: "§´§1Psicodélico  10" }] }, "textures/ui/Pets_skins/frog/botoes/4.png" );
	form.button({ rawtext: [{ translate: "§´§1Monstro  20" }] }, "textures/ui/Pets_skins/frog/botoes/5.png" );
	form.button({ rawtext: [{ translate: "§´§1  15" }] }, "textures/ui/Pets_skins/frog/botoes/6.png" );
    
    form.show(player).then((result) => {
        if (result.selection == 0) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=20..}] run event entity @e [type=well:frog, r=10, c=1] skin1")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=20..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=20..}] well:ruby 0 20")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..20}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..19}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		if (result.selection == 1) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=10..}] run event entity @e [type=well:frog, r=10, c=1] skin2")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=10..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=10..}] well:ruby 0 10")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..10}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..9}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		if (result.selection == 2) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=15..}] run event entity @e [type=well:frog, r=10, c=1] skin3")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=15..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=15..}] well:ruby 0 15")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..15}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..14}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		if (result.selection == 3) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=10..}] run event entity @e [type=well:frog, r=10, c=1] skin4")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=10..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=10..}] well:ruby 0 10")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..10}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..9}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		if (result.selection == 4) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=20..}] run event entity @e [type=well:frog, r=10, c=1] skin5")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=20..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=20..}] well:ruby 0 20")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..20}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..19}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		if (result.selection == 5) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=15..}] run event entity @e [type=well:frog, r=10, c=1] skin6")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=15..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=15..}] well:ruby 0 15")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..15}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..14}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		
    });
}
export function skin_pet_horse(player) {
    let form = new ui.ActionFormData();
	form.title("pet_skins");
    form.body("");
    form.button({ rawtext: [{ translate: "§´§1???" }] }, "textures/ui/bestiario/Bloqueado/equinos" );
	form.button({ rawtext: [{ translate: "§´§1???" }] }, "textures/ui/bestiario/Bloqueado/equinos" );
	form.button({ rawtext: [{ translate: "§´§1???" }] }, "textures/ui/bestiario/Bloqueado/equinos" );
	form.button({ rawtext: [{ translate: "§´§1???" }] }, "textures/ui/bestiario/Bloqueado/equinos" );
	form.button({ rawtext: [{ translate: "§´§1???" }] }, "textures/ui/bestiario/Bloqueado/equinos" );
	form.button({ rawtext: [{ translate: "§´§1???" }] }, "textures/ui/bestiario/Bloqueado/equinos" );
    
    form.show(player).then((result) => {
        if (result.selection == 0) {
        player.runCommand("execute as @p [r=5] run tellraw @p [r=5] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.update\" }]}")}
		if (result.selection == 1) {
        player.runCommand("execute as @p [r=5] run tellraw @p [r=5] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.update\" }]}")}
		if (result.selection == 2) {
        player.runCommand("execute as @p [r=5] run tellraw @p [r=5] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.update\" }]}")}
		if (result.selection == 3) {
        player.runCommand("execute as @p [r=5] run tellraw @p [r=5] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.update\" }]}")}
		if (result.selection == 4) {
        player.runCommand("execute as @p [r=5] run tellraw @p [r=5] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.update\" }]}")}
		if (result.selection == 5) {
        player.runCommand("execute as @p [r=5] run tellraw @p [r=5] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.update\" }]}")}
    });
}
export function skin_pet_ocelote(player) {
    let form = new ui.ActionFormData();
	form.title("pet_skins");
    form.body("");
    form.button({ rawtext: [{ translate: "" }] }, "textures/ui/Pets_skins/ocelote/botoes/1.png" );
	form.button({ rawtext: [{ translate: "" }] }, "textures/ui/Pets_skins/ocelote/botoes/2.png" );
	form.button({ rawtext: [{ translate: "" }] }, "textures/ui/Pets_skins/ocelote/botoes/3.png" );
	form.button({ rawtext: [{ translate: "" }] }, "textures/ui/Pets_skins/ocelote/botoes/4.png" );
	form.button({ rawtext: [{ translate: "" }] }, "textures/ui/Pets_skins/ocelote/botoes/5.png" );
	form.button({ rawtext: [{ translate: "" }] }, "textures/ui/Pets_skins/ocelote/botoes/6.png" );
    
    form.show(player).then((result) => {
        if (result.selection == 0) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=45..}] run event entity @e [type=well:ocelot, r=10, c=1] skin1")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=45..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=45..}] well:ruby 0 45")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..45}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..44}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		if (result.selection == 1) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=64..}] run event entity @e [type=well:ocelot, r=10, c=1] skin2")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=64..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=64..}] well:ruby 0 64")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..64}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..63}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		if (result.selection == 2) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=30..}] run event entity @e [type=well:ocelot, r=10, c=1] skin3")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=30..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=30..}] well:ruby 0 30")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..30}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..29}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		if (result.selection == 3) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=20..}] run event entity @e [type=well:ocelot, r=10, c=1] skin4")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=20..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=20..}] well:ruby 0 20")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..20}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..19}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		if (result.selection == 4) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=10..}] run event entity @e [type=well:ocelot, r=10, c=1] skin5")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=10..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=10..}] well:ruby 0 10")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..10}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..9}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		if (result.selection == 5) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=15..}] run event entity @e [type=well:ocelot, r=10, c=1] skin6")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=15..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=15..}] well:ruby 0 15")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..15}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..14}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		 
    });
}
export function skin_pet_pig(player) {
    let form = new ui.ActionFormData();
	form.title("pet_skins");
    form.body("");
    form.button({ rawtext: [{ translate: "§´§4Bulbasaur  45" }] }, "textures/ui/Pets_skins/pig/botoes/1.png" );
	form.button({ rawtext: [{ translate: "§´§4FBI  64" }] }, "textures/ui/Pets_skins/pig/botoes/2.png" );
	form.button({ rawtext: [{ translate: "§´§4Natal  30" }] }, "textures/ui/Pets_skins/pig/botoes/3.png" );
	form.button({ rawtext: [{ translate: "§´§4EnderPig  20" }] }, "textures/ui/Pets_skins/pig/botoes/4.png" );
	form.button({ rawtext: [{ translate: "§´§4Javali  10" }] }, "textures/ui/Pets_skins/pig/botoes/5.png" );
	form.button({ rawtext: [{ translate: "§´§4Jake  15" }] }, "textures/ui/Pets_skins/pig/botoes/6.png" );
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=45..}] run event entity @e [type=well:pig, r=10, c=1] skin1")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=45..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=45..}] well:ruby 0 45")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..45}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..44}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		if (result.selection == 1) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=64..}] run event entity @e [type=well:pig, r=10, c=1] skin2")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=64..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=64..}] well:ruby 0 64")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..64}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..63}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		if (result.selection == 2) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=30..}] run event entity @e [type=well:pig, r=10, c=1] skin3")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=30..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=30..}] well:ruby 0 30")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..30}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..29}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		if (result.selection == 3) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=20..}] run event entity @e [type=well:pig, r=10, c=1] skin4")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=20..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=20..}] well:ruby 0 20")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..20}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..19}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		if (result.selection == 4) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=10..}] run event entity @e [type=well:pig, r=10, c=1] skin5")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=10..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=10..}] well:ruby 0 10")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..10}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..9}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		if (result.selection == 5) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=15..}] run event entity @e [type=well:pig, r=10, c=1] skin6")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=15..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=15..}] well:ruby 0 15")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..15}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..14}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		
    });
}
export function skin_pet_rabbit(player) {
    let form = new ui.ActionFormData();
	form.title("pet_skins");
    form.body("");
    form.button({ rawtext: [{ translate: "" }] }, "textures/ui/Pets_skins/rabbit/botoes/1.png" );
	form.button({ rawtext: [{ translate: "" }] }, "textures/ui/Pets_skins/rabbit/botoes/2.png" );
	form.button({ rawtext: [{ translate: "" }] }, "textures/ui/Pets_skins/rabbit/botoes/3.png" );
	
	form.button({ rawtext: [{ translate: "§´§1???" }] }, "textures/ui/bestiario/Bloqueado/coelho" );
	form.button({ rawtext: [{ translate: "§´§1???" }] }, "textures/ui/bestiario/Bloqueado/coelho" );
	form.button({ rawtext: [{ translate: "§´§1???" }] }, "textures/ui/bestiario/Bloqueado/coelho" );
    
    form.show(player).then((result) => {
        if (result.selection == 0) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=45..}] run event entity @e [type=well:rabbit, r=10, c=1] skin1")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=45..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=45..}] well:ruby 0 45")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..45}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..44}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		if (result.selection == 1) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=64..}] run event entity @e [type=well:rabbit, r=10, c=1] skin2")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=64..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=64..}] well:ruby 0 64")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..64}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..63}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		if (result.selection == 2) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=30..}] run event entity @e [type=well:rabbit, r=10, c=1] skin3")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=30..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=30..}] well:ruby 0 30")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..30}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..29}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		if (result.selection == 3) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=20..}] run event entity @e [type=well:rabbit, r=10, c=1] skin4")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=20..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=20..}] well:ruby 0 20")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..20}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..19}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		
		if (result.selection == 4) {
		player.runCommand("execute as @p [r=5] run tellraw @p [r=5] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.update\" }]}")}
		if (result.selection == 5) {
        player.runCommand("execute as @p [r=5] run tellraw @p [r=5] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.update\" }]}")}
		
    });
}
export function skin_pet_tatu(player) {
    let form = new ui.ActionFormData();
	form.title("pet_skins");
    form.body("");
    form.button({ rawtext: [{ translate: "§´Redstone  10" }] }, "textures/ui/Pets_skins/tatu/botoes/1" );
	form.button({ rawtext: [{ translate: "§´Apple Worm  15" }] }, "textures/ui/Pets_skins/tatu/botoes/2" );
	form.button({ rawtext: [{ translate: "§´Ancient  35" }] }, "textures/ui/Pets_skins/tatu/botoes/3" );
	form.button({ rawtext: [{ translate: "§´Sculk  5" }] }, "textures/ui/Pets_skins/tatu/botoes/4" );
	form.button({ rawtext: [{ translate: "§´Enchant  20" }] }, "textures/ui/Pets_skins/tatu/botoes/5" );
	form.button({ rawtext: [{ translate: "§´Snnifer  3" }] }, "textures/ui/Pets_skins/tatu/botoes/6" );
    
    form.show(player).then((result) => {
        if (result.selection == 0) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=10..}] run event entity @e [type=well:tatu, r=10, c=1] skin1")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=10..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=10..}] well:ruby 0 10")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..10}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..9}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		if (result.selection == 1) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=15..}] run event entity @e [type=well:tatu, r=10, c=1] skin2")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=15..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=15..}] well:ruby 0 15")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..15}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..14}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		if (result.selection == 2) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=35..}] run event entity @e [type=well:tatu, r=10, c=1] skin3")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=35..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=35..}] well:ruby 0 35")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..35}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..34}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		if (result.selection == 3) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=5..}] run event entity @e [type=well:tatu, r=10, c=1] skin4")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=5..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=5..}] well:ruby 0 5")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..5}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..4}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		if (result.selection == 4) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=20..}] run event entity @e [type=well:tatu, r=10, c=1] skin5")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=20..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=20..}] well:ruby 0 20")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..20}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..19}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		if (result.selection == 5) {
        player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=3..}] run event entity @e [type=well:tatu, r=10, c=1] skin6")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=3..}] run clear @p [r=5, hasitem={item=well:ruby, quantity=3..}] well:ruby 0 3")
		player.runCommand("execute as @p [r=5, hasitem={item=well:ruby, quantity=..3}] run tellraw @p [r=5, hasitem={item=well:ruby, quantity=..2}] {\"rawtext\":[{ \"translate\":\"nao.pode.comprar.skin.ruby\" }]}")}
		
	});
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
let petOwners = {};
function getPetId(typeId, playerName) {
    return `${typeId}-${playerName}`;
}
function petmenugeral(player, petId, target) {
    if (!isPetOwner(player, petId)) {
        player.sendMessage("Você não é o dono deste pet!");
        return;
    }

    let form = new ui.ActionFormData();
    form.title("petmenugeral");
    form.body("");
    form.button({ rawtext: [{ translate: "menu.pet.renomear" }] }, "textures/items/name_tag.png");
    form.button({ rawtext: [{ translate: "menu.pet.sentar" }] }, "textures/ui/csb_faq_fox.png");
	form.button({ rawtext: [{ translate: "menu.pet.levantar" }] }, "textures/ui/csb_faq_horse.png");
    form.button({ rawtext: [{ translate: "menu.pet.skin" }] }, "textures/ui/csb_faq_pig.png");
    form.button({ rawtext: [{ translate: "menu.pet.acariciar" }] }, "textures/ui/health_boost_effect.png");
	form.button({ rawtext: [{ translate: "menu.pet.alimentar" }] }, "textures/ui/icon_cake.png");

    form.show(player).then((result) => {
        switch (result.selection) {
            case 0:
                petrename(player, target);
                break;
            case 1:
                
                player.runCommand("/function pet_menus/sentar");
                break;
				
			case 2:
			   
                player.runCommand("/function pet_menus/levantar");
                break;	
            //case 2:
            //    up_pet(player, target);
            //    break;
            //case 3:
            //    player.runCommand("function scripts_forms/dicas_missoes");
            //    break;
            case 3:
                // Chama a função de skin correspondente ao tipo de pet
                switch (target.typeId) {
                    case "well:allay":
                        skin_pet_allay(player);
                        break;
                    case "well:bat":
                        skin_pet_bat(player);
                        break;
					case "well:chicken":
                        skin_pet_chicken(player);
                        break;
					case "well:navi":
                        skin_pet_fada(player);
                        break;
						
						case "well:navi_amarela":
                        skin_pet_fada(player);
                        break;
						
						case "well:navi_dark":
                        skin_pet_fada(player);
                        break;
						
						case "well:navi_vermelha":
                        skin_pet_fada(player);
                        break;
						
						case "well:navi_verde":
                        skin_pet_fada(player);
                        break;
						
						case "well:navi_rosa":
                        skin_pet_fada(player);
                        break;
						
					case "well:fox":
                        skin_pet_fox(player);
                        break;
					case "well:frog":
                        skin_pet_frog(player);
                        break;
					case "well:horse":
                        skin_pet_horse(player);
                        break;
					case "well:ocelot":
                        skin_pet_ocelote(player);
                        break;
					case "well:pig":
                        skin_pet_pig(player);
                        break;
					case "well:rabbit":
                        skin_pet_rabbit(player);
                        break;
					case "well:tatu":
                        skin_pet_tatu(player);
                        break;

                    // Adicione os casos para outros tipos de pet conforme necessário
                    default:
                        // Mensagem de erro para tipos de pet não tratados
                        player.sendMessage("Skin não disponível para este tipo de pet.");
                        break;
                }
                break;
			case 4:
                player.runCommand("/event entity @e [family=pet, r=5] carinho");
				player.runCommand("/playanimation @s animation.humanoid.acariciar");
				
                break;	
            case 5:
                // Chama a função de skin correspondente ao tipo de pet
                switch (target.typeId) {
                    case "well:allay":
                        player.runCommand("event entity @e [type=well:allay, r=5] alimentacao");
                        break;
                    case "well:bat":
                        player.runCommand("event entity @e [type=well:bat, r=5] alimentacao");
                        break;
					case "well:chicken":
                        player.runCommand("event entity @e [type=well:chicken, r=5] alimentacao");
                        break;
					case "well:navi":
                        player.runCommand("event entity @e [type=well:navi, r=5] alimentacao");
                        break;
						
						case "well:navi_amarela":
                        player.runCommand("event entity @e [type=well:navi_amarela, r=5] alimentacao");
                        break;
						
						case "well:navi_dark":
                        player.runCommand("event entity @e [type=well:navi_dark, r=5] alimentacao");
                        break;
						
						case "well:navi_vermelha":
                        player.runCommand("event entity @e [type=well:navi_vermelha, r=5] alimentacao");
                        break;
						
						case "well:navi_verde":
                        player.runCommand("event entity @e [type=well:navi_verde, r=5] alimentacao");
                        break;
						
						case "well:navi_rosa":
                        player.runCommand("event entity @e [type=well:navi_rosa, r=5] alimentacao");
                        break;
						
					case "well:fox":
                        player.runCommand("event entity @e [type=well:fox, r=5] alimentacao");
                        break;
					case "well:frog":
                        player.runCommand("event entity @e [type=well:frog, r=5] alimentacao");
                        break;
					case "well:horse":
                        player.runCommand("event entity @e [type=well:horse, r=5] alimentacao");
                        break;
					case "well:ocelot":
                        player.runCommand("event entity @e [type=well:ocelot, r=5] alimentacao");
                        break;
					case "well:pig":
                        player.runCommand("event entity @e [type=well:pig, r=5] alimentacao");
                        break;
					case "well:rabbit":
                        player.runCommand("event entity @e [type=well:rabbit, r=5] alimentacao");
                        break;
					case "well:tatu":
                        player.runCommand("event entity @e [type=well:tatu, r=5] alimentacao");
                        break;

                    // Adicione os casos para outros tipos de pet conforme necessário
                    default:
                        // Mensagem de erro para tipos de pet não tratados
                        player.sendMessage("");
                        break;
                }
                break;
        }
    }).catch((error) => {
        console.error("Erro na exibição do formulário:", error);
    });
}
function setOwner(player, petId) {
    petOwners[petId] = { ownerName: player.name };
}
function isPetOwner(player, petId) {
    return petOwners[petId] && petOwners[petId].ownerName === player.name;
}
function updatePetNameTag(target) {
    if (petOwners[target.petId]) {
        const lines = target.nameTag.split("\n");
        const petName = lines[0] || ''; // Preserve the name part
        //target.nameTag = `${petName}\n§eDono: ${petOwners[target.petId].ownerName}`;
    }
}
function petrename(player, target) {
    if (!isPetOwner(player, target.petId)) {
        player.sendMessage("Você não é o dono deste pet!");
        return;
    }

    const form = new ui.ModalFormData();
    form.textField("name", "Renomear o pet");
    form.show(player).then((result) => {
        if (!result.canceled) {
            // Set the new name for the pet
            const oldName = target.nameTag.split("\n")[0]; // Preserve the existing name
            target.nameTag = `${result.formValues[0]}\n${target.nameTag.split("\n")[1] || ''}`;
            player.sendMessage(`§ePet renomeado para: ${result.formValues[0]}`);
            updatePetNameTag(target);
        }
    });
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
export function livro_do_mago(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:magaopagynaum");
    form.body("");
    form.button({ rawtext: [{ translate: ">>" }] }, "textures/ui/undoArrow.png");
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
			
			livro_do_mago1(player)
			
        }
    });
}
export function livro_do_mago1(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:magaopagynadois");
    form.body("");
    form.button({ rawtext: [{ translate: ">>" }] }, "textures/ui/undoArrow.png");
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
			
			livro_do_mago2(player)
        }
    });
}
export function livro_do_mago2(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:magaopagynatres");
    form.body("");
    form.button({ rawtext: [{ translate: ">>" }] }, "textures/ui/undoArrow.png");
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
			
			livro_do_mago(player)
        }
    });
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
export function menulistwell(player) {
    let form = new ui.ActionFormData();
    form.title("wellforced:pergaminho_menuum");
    form.body("");

    form.button({ rawtext: [{ translate: "missoes.menu" }] }, "textures/items/teleporterapido.png");
    form.button({ rawtext: [{ translate: "bestiario.menu" }] }, "textures/items/bestiario.png");
    form.button({ rawtext: [{ translate: "status.menu" }] }, "textures/ui/FriendsDiversity.png");
    form.button({ rawtext: [{ translate: "teleporte.menu" }] }, "textures/items/ender_pearl.png");
    form.button({ rawtext: [{ translate: "opcoes.menu" }] }, "textures/ui/settings_glyph_color_2x.png");
    form.button({ rawtext: [{ translate: "criadores.text" }] }, "textures/ui/Espadas.png");

    form.show(player).then((result) => {
        if (result.canceled) {
            player.runCommand("event entity @s remove_player_npc");
            return;
        }

        if (result.selection == 0) {
            player.runCommand("event entity @s remove_player_npc");
            menu_missao(player);
        }
        if (result.selection == 1) {
            player.runCommand("function scripts_forms/bestiario_menu");
        }
        if (result.selection == 2) {
            player.runCommand("event entity @s remove_player_npc");
			if (player.hasTag("novice") || player.hasTag("novice1") || player.hasTag("novice2") || player.hasTag("novice3") || player.hasTag("boss1")) {
                statusplayer(player);
            }
        }
        if (result.selection == 3) {
			player.runCommand("event entity @s remove_player_npc");
            teleporte_principal(player);
        }
        if (result.selection == 4) {
            opcoes_menu(player);
        }
        if (result.selection == 5) {
			player.runCommand("event entity @s remove_player_npc");
            creditos(player);
        }
    });
}
export function menulistwell1(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:pergaminho_menudois");
    form.body("");
	form.button({ rawtext: [ { translate: "missoes.menu" }]}, "textures/items/teleporterapido.png");
	form.button({ rawtext: [ { translate: "bestiario.menu" }]}, "textures/items/bestiario.png");
	form.button({ rawtext: [ { translate: "status.menu" }]}, "textures/ui/FriendsDiversity.png");
	form.button({ rawtext: [ { translate: "teleporte.menu" }]}, "textures/items/ender_pearl.png");
	form.button({ rawtext: [ { translate: "opcoes.menu" }]}, "textures/ui/settings_glyph_color_2x.png");
	
	form.button({ rawtext: [ { translate: "criadores.text" }]}, "textures/ui/Espadas.png");
    
    form.show(player).then((result) => {
		if (result.canceled) {
            player.runCommand("event entity @s remove_player_npc");
            return;
        }
        if (result.selection == 0) {
            player.runCommand("tag @p add contagem_remove_npc"); {menu_missao(player)}
        }
        if (result.selection == 1) {
            player.runCommand("/function scripts_forms/bestiario_menu");
        }
		if (result.selection == 2) {
            
			
			if (player.hasTag("adventure")) {
                statusplayer1(player);
            }
			if (player.hasTag("adventure1")) {
                statusplayer1(player);
            }
			if (player.hasTag("adventure2")) {
                statusplayer1(player);
            }
			if (player.hasTag("adventure3")) {
                statusplayer1(player);
            }
			if (player.hasTag("adventure4")) {
                statusplayer1(player);
            }
			if (player.hasTag("boss2")) {
                statusplayer1(player);
            }
			
			
        }
		if (result.selection == 3) {
            teleporte_principal(player);
        }
		if (result.selection == 4) {
            opcoes_menu(player);
        }
		if (result.selection == 5) {
            creditos(player);
        }
    });
}
export function menulistwell2(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:pergaminho_menutres");
    form.body("");
	form.button({ rawtext: [ { translate: "missoes.menu" }]}, "textures/items/teleporterapido.png");
	form.button({ rawtext: [ { translate: "bestiario.menu" }]}, "textures/items/bestiario.png");
	form.button({ rawtext: [ { translate: "status.menu" }]}, "textures/ui/FriendsDiversity.png");
	form.button({ rawtext: [ { translate: "teleporte.menu" }]}, "textures/items/ender_pearl.png");
	form.button({ rawtext: [ { translate: "opcoes.menu" }]}, "textures/ui/settings_glyph_color_2x.png");
	
	form.button({ rawtext: [ { translate: "criadores.text" }]}, "textures/ui/Espadas.png");
    
    form.show(player).then((result) => {
		if (result.canceled) {
            player.runCommand("event entity @s remove_player_npc");
            return;
        }
        if (result.selection == 0) {
            player.runCommand("tag @p add contagem_remove_npc"); {menu_missao(player)}
        }
        if (result.selection == 1) {
            player.runCommand("/function scripts_forms/bestiario_menu");
        }
		if (result.selection == 2) {
            
			if (player.hasTag("master")) {
                statusplayer2(player);
            }
			if (player.hasTag("master1")) {
                statusplayer2(player);
            }
			if (player.hasTag("master2")) {
                statusplayer2(player);
            }
			if (player.hasTag("boss3")) {
                statusplayer2(player);
            }
			
			
        }
		if (result.selection == 3) {
            teleporte_principal(player);
        }
		if (result.selection == 4) {
            opcoes_menu(player);
        }
		if (result.selection == 5) {
            creditos(player);
        }
    });
}
export function menulistwell3(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:pergaminho_menuquatro");
    form.body("");
	form.button({ rawtext: [ { translate: "missoes.menu" }]}, "textures/items/teleporterapido.png");
	form.button({ rawtext: [ { translate: "bestiario.menu" }]}, "textures/items/bestiario.png");
	form.button({ rawtext: [ { translate: "status.menu" }]}, "textures/ui/FriendsDiversity.png");
	form.button({ rawtext: [ { translate: "teleporte.menu" }]}, "textures/items/ender_pearl.png");
	form.button({ rawtext: [ { translate: "opcoes.menu" }]}, "textures/ui/settings_glyph_color_2x.png");
	
	form.button({ rawtext: [ { translate: "criadores.text" }]}, "textures/ui/Espadas.png");
    
    form.show(player).then((result) => {
		if (result.canceled) {
            player.runCommand("event entity @s remove_player_npc");
            return;
        }
        if (result.selection == 0) {
            player.runCommand("tag @p add contagem_remove_npc"); {menu_missao(player)}
        }
        if (result.selection == 1) {
            player.runCommand("/function scripts_forms/bestiario_menu");
        }
		if (result.selection == 2) {
            
			if (player.hasTag("hero")) {
                statusplayer3(player);
            }
			if (player.hasTag("hero1")) {
                statusplayer3(player);
            }
			if (player.hasTag("hero2")) {
                statusplayer3(player);
            }
			if (player.hasTag("hero3")) {
                statusplayer3(player);
            }
			
        }
		if (result.selection == 3) {
            teleporte_principal(player);
        }
		if (result.selection == 4) {
            opcoes_menu(player);
        }
		if (result.selection == 5) {
            creditos(player);
        }
    });
}
export function menulistwell4(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:pergaminho_menucinco");
    form.body("");
	form.button({ rawtext: [ { translate: "missoes.menu" }]}, "textures/items/teleporterapido.png");
	form.button({ rawtext: [ { translate: "bestiario.menu" }]}, "textures/items/bestiario.png");
	form.button({ rawtext: [ { translate: "status.menu" }]}, "textures/ui/FriendsDiversity.png");
	form.button({ rawtext: [ { translate: "teleporte.menu" }]}, "textures/items/ender_pearl.png");
	form.button({ rawtext: [ { translate: "opcoes.menu" }]}, "textures/ui/settings_glyph_color_2x.png");
	
	form.button({ rawtext: [ { translate: "criadores.text" }]}, "textures/ui/Espadas.png");
    
    form.show(player).then((result) => {
		if (result.canceled) {
            player.runCommand("event entity @s remove_player_npc");
            return;
        }
        if (result.selection == 0) {
            player.runCommand("tag @p add contagem_remove_npc"); {menu_missao(player)}
        }
        if (result.selection == 1) {
            player.runCommand("/function scripts_forms/bestiario_menu");
        }
		if (result.selection == 2) {
            
			if (player.hasTag("boss4")) {
                statusplayer4(player);
            }
			if (player.hasTag("legendary")) {
                statusplayer4(player);
            }
			
        }
		if (result.selection == 3) {
            teleporte_principal(player);
        }
		if (result.selection == 4) {
            opcoes_menu(player);
        }
		if (result.selection == 5) {
            creditos(player);
        }
    });
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
export function statusplayer(player) {
    let form = new ui.ActionFormData();
    form.title("wellforced:novice_status");
    form.body({
        rawtext: [
            { translate: "coleta_madeira.status" }, { text: `${getScore(player, "coleta_madeira")}` }, { text: "\n" },
            { translate: "mineiracao.status" }, { text: `${getScore(player, "mineiracao")}` }, { text: "\n" },
            { translate: "pescaria.status" }, { text: `${getScore(player, "pescaria")}` }, { text: "\n" },
            { translate: "agricultura.status" }, { text: `${getScore(player, "agricultura")}` },
			
			{ text: "\n" }, { text: "\n" },
			
			{ translate: "mortes_player.status" }, { text: `${getScore(player, "mortes")}` }, { text: "\n" },
			{ translate: "mortes_monstros.status" }, { text: `${getScore(player, "mortes_monstros")}` }
        ]
    });
    form.button({ rawtext: [{ translate: "menu.voltar" }] }, "textures/ui/undoArrow.png");
    form.button({ rawtext: [{ translate: "up.armaduras" }] }, "textures/items/well_armadura_divina.png");
    form.button({ rawtext: [{ translate: "up.ferramentas" }] }, "textures/items/pamobile/well_espada_ruby.png");
	//form.button({ rawtext: [{ translate: "up.classes.armas" }] }, "textures/ui/icon_best3.png");

    form.show(player).then((result) => {
        if (result.selection == 0) {
            if (player.hasTag("novice")) {
                menulistwell(player);
            }
			if (player.hasTag("novice1")) {
                menulistwell(player);
            }
			if (player.hasTag("novice2")) {
                menulistwell(player);
            }
			if (player.hasTag("novice3")) {
                menulistwell(player);
            }
			if (player.hasTag("boss1")) {
                menulistwell(player);
            }
			
        }
        if (result.selection == 1) {
            status_armadura(player)
        }
        if (result.selection == 2) {
            status_ferramentas(player)
        }
		
		//if (result.selection == 3) {
        //    {status_classe(player)}
		//	
        //}
    });
}
export function statusplayer1(player) {
    let form = new ui.ActionFormData();
    form.title("wellforced:adventure_status");
    form.body({
        rawtext: [
            { translate: "coleta_madeira.status" }, { text: `${getScore(player, "coleta_madeira")}` }, { text: "\n" },
            { translate: "mineiracao.status" }, { text: `${getScore(player, "mineiracao")}` }, { text: "\n" },
            { translate: "pescaria.status" }, { text: `${getScore(player, "pescaria")}` }, { text: "\n" },
            { translate: "agricultura.status" }, { text: `${getScore(player, "agricultura")}` },
			
			{ text: "\n" }, { text: "\n" },
			
			{ translate: "mortes_player.status" }, { text: `${getScore(player, "mortes")}` }, { text: "\n" },
			{ translate: "mortes_monstros.status" }, { text: `${getScore(player, "mortes_monstros")}` }
        ]
    });
    form.button({ rawtext: [{ translate: "menu.voltar" }] }, "textures/ui/undoArrow.png");
    form.button({ rawtext: [{ translate: "up.armaduras" }] }, "textures/items/well_armadura_divina.png");
    form.button({ rawtext: [{ translate: "up.ferramentas" }] }, "textures/items/pamobile/well_espada_ruby.png");
	//form.button({ rawtext: [{ translate: "up.classes.armas" }] }, "textures/ui/icon_best3.png");

    form.show(player).then((result) => {
        if (result.selection == 0) {
            
			if (player.hasTag("adventure")) {
                menulistwell1(player);
            }
			if (player.hasTag("adventure1")) {
                menulistwell1(player);
            }
			if (player.hasTag("adventure2")) {
                menulistwell1(player);
            }
			if (player.hasTag("adventure3")) {
                menulistwell1(player);
            }
			if (player.hasTag("adventure4")) {
                menulistwell1(player);
            }
			if (player.hasTag("boss2")) {
                menulistwell1(player);
            }
			
        }
        if (result.selection == 1) {
            status_armadura(player)
        }
        if (result.selection == 2) {
            status_ferramentas(player)
        }
		//if (result.selection == 3) {
        //    {status_classe(player)}
		//	
        //}
    });
}
export function statusplayer2(player) {
    let form = new ui.ActionFormData();
    form.title("wellforced:master_status");
    form.body({
        rawtext: [
            { translate: "coleta_madeira.status" }, { text: `${getScore(player, "coleta_madeira")}` }, { text: "\n" },
            { translate: "mineiracao.status" }, { text: `${getScore(player, "mineiracao")}` }, { text: "\n" },
            { translate: "pescaria.status" }, { text: `${getScore(player, "pescaria")}` }, { text: "\n" },
            { translate: "agricultura.status" }, { text: `${getScore(player, "agricultura")}` },
			
			{ text: "\n" }, { text: "\n" },
			
			{ translate: "mortes_player.status" }, { text: `${getScore(player, "mortes")}` }, { text: "\n" },
			{ translate: "mortes_monstros.status" }, { text: `${getScore(player, "mortes_monstros")}` }
        ]
    });
    form.button({ rawtext: [{ translate: "menu.voltar" }] }, "textures/ui/undoArrow.png");
    form.button({ rawtext: [{ translate: "up.armaduras" }] }, "textures/items/well_armadura_divina.png");
    form.button({ rawtext: [{ translate: "up.ferramentas" }] }, "textures/items/pamobile/well_espada_ruby.png");
	//form.button({ rawtext: [{ translate: "up.classes.armas" }] }, "textures/ui/icon_best3.png");

    form.show(player).then((result) => {
        if (result.selection == 0) {
            
			if (player.hasTag("master")) {
                menulistwell2(player);
            }
			if (player.hasTag("master1")) {
                menulistwell2(player);
            }
			if (player.hasTag("master2")) {
                menulistwell2(player);
            }
			if (player.hasTag("boss3")) {
                menulistwell2(player);
            }
			
        }
        if (result.selection == 1) {
            status_armadura(player)
        }
        if (result.selection == 2) {
            status_ferramentas(player)
        }
		//if (result.selection == 3) {
        //    {status_classe(player)}
		//	
        //}
    });
}
export function statusplayer3(player) {
    let form = new ui.ActionFormData();
    form.title("wellforced:hero_status");
    form.body({
        rawtext: [
            { translate: "coleta_madeira.status" }, { text: `${getScore(player, "coleta_madeira")}` }, { text: "\n" },
            { translate: "mineiracao.status" }, { text: `${getScore(player, "mineiracao")}` }, { text: "\n" },
            { translate: "pescaria.status" }, { text: `${getScore(player, "pescaria")}` }, { text: "\n" },
            { translate: "agricultura.status" }, { text: `${getScore(player, "agricultura")}` },
			
			{ text: "\n" }, { text: "\n" },
			
			{ translate: "mortes_player.status" }, { text: `${getScore(player, "mortes")}` }, { text: "\n" },
			{ translate: "mortes_monstros.status" }, { text: `${getScore(player, "mortes_monstros")}` }
        ]
    });
    form.button({ rawtext: [{ translate: "menu.voltar" }] }, "textures/ui/undoArrow.png");
    form.button({ rawtext: [{ translate: "up.armaduras" }] }, "textures/items/well_armadura_divina.png");
    form.button({ rawtext: [{ translate: "up.ferramentas" }] }, "textures/items/pamobile/well_espada_ruby.png");
	//form.button({ rawtext: [{ translate: "up.classes.armas" }] }, "textures/ui/icon_best3.png");

    form.show(player).then((result) => {
        if (result.selection == 0) {
            
			if (player.hasTag("hero")) {
                menulistwell3(player);
            }
			if (player.hasTag("hero1")) {
                menulistwell3(player);
            }
			if (player.hasTag("hero2")) {
                menulistwell3(player);
            }
			if (player.hasTag("hero3")) {
                menulistwell3(player);
            }
        }
        if (result.selection == 1) {
            status_armadura(player)
        }
        if (result.selection == 2) {
            status_ferramentas(player)
        }
		//if (result.selection == 3) {
        //    {status_classe(player)}
		//	
        //}
    });
}
export function statusplayer4(player) {
    let form = new ui.ActionFormData();
    form.title("wellforced:final_status");
    form.body({
        rawtext: [
            { translate: "coleta_madeira.status" }, { text: `${getScore(player, "coleta_madeira")}` }, { text: "\n" },
            { translate: "mineiracao.status" }, { text: `${getScore(player, "mineiracao")}` }, { text: "\n" },
            { translate: "pescaria.status" }, { text: `${getScore(player, "pescaria")}` }, { text: "\n" },
            { translate: "agricultura.status" }, { text: `${getScore(player, "agricultura")}` },
			
			{ text: "\n" }, { text: "\n" },
			
			{ translate: "mortes_player.status" }, { text: `${getScore(player, "mortes")}` }, { text: "\n" },
			{ translate: "mortes_monstros.status" }, { text: `${getScore(player, "mortes_monstros")}` }
        ]
    });
    form.button({ rawtext: [{ translate: "menu.voltar" }] }, "textures/ui/undoArrow.png");
    form.button({ rawtext: [{ translate: "up.armaduras" }] }, "textures/items/well_armadura_divina.png");
    form.button({ rawtext: [{ translate: "up.ferramentas" }] }, "textures/items/pamobile/well_espada_ruby.png");
	//form.button({ rawtext: [{ translate: "up.classes.armas" }] }, "textures/ui/icon_best3.png");

    form.show(player).then((result) => {
        if (result.selection == 0) {
            
			if (player.hasTag("boss4")) {
                menulistwell4(player);
            }
			if (player.hasTag("legendary")) {
                menulistwell4(player);
            }
        }
        if (result.selection == 1) {
            status_armadura(player)
        }
        if (result.selection == 2) {
            status_ferramentas(player)
        }
		//if (result.selection == 3) {
        //   {status_classe(player)}
		//	
        //}
    });
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
export function menu_lula_d2(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:bau_interface_lula_d2");
    form.body("");
    form.button({ rawtext: [{ translate: "ok" }] });
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        }
    });
}
export function menu_zumbi_d2(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:bau_interface_zumbi_d2");
    form.body("");
    form.button({ rawtext: [{ translate: "ok" }] });
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        }
    });
}
export function menu_allay_d2(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:bau_interface_allay_d2");
    form.body("");
    form.button({ rawtext: [{ translate: "ok" }] });
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        }
    });
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
export function missao1(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:missao1");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_missoes")}
		
		if (result.selection == 1) {
        resetmissao(player) }
    });
}
export function missao2(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:missao2");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_missoes")}
		
		if (result.selection == 1) {
        resetmissao(player) }
    });
}
export function missao3(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:missao3");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_missoes")}
		
		if (result.selection == 1) {
        resetmissao(player) }
    });
}
export function missao4(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:missao4");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_missoes")}
		
		if (result.selection == 1) {
        resetmissao(player) }
    });
}
export function missao5(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:missao5");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_missoes")}
		
		if (result.selection == 1) {
        resetmissao(player) }
    });
}
export function missao6(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:missao6");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_missoes")}
		
		if (result.selection == 1) {
        resetmissao(player) }
    });
}
export function missao7(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:missao7");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_missoes")}
		
		if (result.selection == 1) {
        resetmissao(player) }
    });
}
export function missao8(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:missao8");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_missoes")}
		
		if (result.selection == 1) {
        resetmissao(player) }
    });
}
export function missao9(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:missao9");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_missoes")}
		
		if (result.selection == 1) {
        resetmissao(player) }
    });
}
export function missao10(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:missao10");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_missoes")}
		
		if (result.selection == 1) {
        resetmissao(player) }
    });
}
export function missao11(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:missao11");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_missoes")}
		
		if (result.selection == 1) {
        resetmissao(player) }
    });
}
export function missao12(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:missao12");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_missoes")}
		
		if (result.selection == 1) {
        resetmissao(player) }
    });
}
export function missao13(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:missao13");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_missoes")}
		
		if (result.selection == 1) {
        resetmissao(player) }
    });
}
export function missao14(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:missao14");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_missoes")}
		
		if (result.selection == 1) {
        resetmissao(player) }
    });
}
export function missao15(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:missao15");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_missoes")}
		
		if (result.selection == 1) {
        resetmissao(player) }
    });
}
export function missao16(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:missao16");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_missoes")}
		
		if (result.selection == 1) {
        resetmissao(player) }
    });
}
export function missao17(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:missao17");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_missoes")}
		
		if (result.selection == 1) {
        resetmissao(player) }
    });
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
export function missao_boss1(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:missao_boss1");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "dungeon.reset" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_missoes")}
		
		if (result.selection == 1) {
        resetmissao_missao_boss1(player) }
    });
}
export function missao_boss2(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:missao_boss2");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "dungeon.reset" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_missoes")}
		
		if (result.selection == 1) {
        resetmissao_missao_boss2(player) }
    });
}
export function missao_boss3(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:missao_boss3");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "dungeon.reset" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_missoes")}
		
		if (result.selection == 1) {
        resetmissao_missao_boss3(player) }
    });
}
export function missao_boss4(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:missao_boss4");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "dungeon.reset" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_missoes")}
		
		if (result.selection == 1) {
        resetmissao_missao_boss4(player) }
    });
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
export function submissao0(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:subquestzero");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_submissoes")}
		
		if (result.selection == 1) {
        resetsubmissao(player) }
    });
}
export function submissao1(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:subquestum");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_submissoes")}
		
		if (result.selection == 1) {
        resetsubmissao(player) }
    });
}
export function submissao2(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:subquestdois");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_submissoes")}
		
		if (result.selection == 1) {
        resetsubmissao(player) }
    });
}
export function submissao3(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:subquesttres");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_submissoes")}
		
		if (result.selection == 1) {
        resetsubmissao(player) }
    });
}
export function submissao4(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:subquestquatro");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_submissoes")}
		
		if (result.selection == 1) {
        resetsubmissao(player) }
    });
}
export function submissao5(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:subquestcinco");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_submissoes")}
		
		if (result.selection == 1) {
        resetsubmissao(player) }
    });
}
export function submissao6(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:subquestseis");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_submissoes")}
		
		if (result.selection == 1) {
        resetsubmissao(player) }
    });
}
export function submissao7(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:subquestsete");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_submissoes")}
		
		if (result.selection == 1) {
        resetsubmissao(player) }
    });
}
export function submissao8(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:subquestoito");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_submissoes")}
		
		if (result.selection == 1) {
        resetsubmissao(player) }
    });
}
export function submissao9(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:subquestnove");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_submissoes")}
		
		if (result.selection == 1) {
        resetsubmissao(player) }
    });
}
export function submissao10(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:subquestdez");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_submissoes")}
		
		if (result.selection == 1) {
        resetsubmissao(player) }
    });
}
export function submissao11(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:subquestonze");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_submissoes")}
		
		if (result.selection == 1) {
        resetsubmissao(player) }
    });
}
export function submissao12(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:subquestdoze");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_submissoes")}
		
		if (result.selection == 1) {
        resetsubmissao(player) }
    });
}
export function submissao13(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:subquesttreze");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_submissoes")}
		
		if (result.selection == 1) {
        resetsubmissao(player) }
    });
}
export function submissao14(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:subquestquatorze");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_submissoes")}
		
		if (result.selection == 1) {
        resetsubmissao(player) }
    });
}
export function submissao15(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:subquestquinze");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_submissoes")}
		
		if (result.selection == 1) {
        resetsubmissao(player) }
    });
}
export function submissao16(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:subquestdesseseis");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_submissoes")}
		
		if (result.selection == 1) {
        resetsubmissao(player) }
    });
}
export function submissao17(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:subquestdessesete");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_submissoes")}
		
		if (result.selection == 1) {
        resetsubmissao(player) }
    });
}
export function submissao18(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:subquestydezoito");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_submissoes")}
		
		if (result.selection == 1) {
        resetsubmissao(player) }
    });
}
export function submissao19(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:subquestydezenove");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_submissoes")}
		
		if (result.selection == 1) {
        resetsubmissao(player) }
    });
}
export function submissao20(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:subquestvinte");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_submissoes")}
		
		if (result.selection == 1) {
        resetsubmissao(player) }
    });
}
export function submissao21(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:subquestyvinteum");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_submissoes")}
		
		if (result.selection == 1) {
        resetsubmissao(player) }
    });
}
export function submissao22(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:subquestyvintedois");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_submissoes")}
		
		if (result.selection == 1) {
        resetsubmissao(player) }
    });
}
export function submissao23(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:subquestyvintetres");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_submissoes")}
		
		if (result.selection == 1) {
        resetsubmissao(player) }
    });
}
export function submissao24(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:subquestyvintequatro");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_submissoes")}
		
		if (result.selection == 1) {
        resetsubmissao(player) }
    });
}
export function submissao25(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:subquestyvintecinco");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_submissoes")}
		
		if (result.selection == 1) {
        resetsubmissao(player) }
    });
}
export function submissao26(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:subquestyvinteseis");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_submissoes")}
		
		if (result.selection == 1) {
        resetsubmissao(player) }
    });
}
export function submissao27(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:subquestyvintesete");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_submissoes")}
		
		if (result.selection == 1) {
        resetsubmissao(player) }
    });
}
export function submissao28(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:subquestyvinteoito");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_submissoes")}
		
		if (result.selection == 1) {
        resetsubmissao(player) }
    });
}
export function submissao29(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:subquestvintenove");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_submissoes")}
		
		if (result.selection == 1) {
        resetsubmissao(player) }
    });
}
export function submissao30(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:subquesttrinta");
    form.body("");
    form.button({ rawtext: [{ translate: "dicas.menu" }]});
	form.button({ rawtext: [{ translate: "reset.missao" }]});
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("function scripts_forms/dicas_submissoes")}
		
		if (result.selection == 1) {
        resetsubmissao(player) }
    });
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
export function status_armadura(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:status_armaduras");
    form.body({
        rawtext: [
		    { text: "\n" }, { text: "\n" }, { text: "\n" },
            { text: "\n" }, { text: "\n" }, { text: "\n" }, { text: "\n" }, { text: "§l§5" },
			
            { text: `${getScore(player, "aranha")}` },{ translate: "status.do.jogador.chainmail" },
            { text: "\n" }, { text: "\n" }, { text: "§l§5" },
			
            { text: `${getScore(player, "bruxa")}` },{ translate: "status.do.jogador.gold" },
            { text: "\n" }, { text: "\n" }, { text: "§l§5" },
			
           { text: `${getScore(player, "zumbi")}` }, { translate: "status.do.jogador.iron" },
            { text: "\n" }, { text: "\n" }, { text: "§l§5" },
			
            { text: `${getScore(player, "esqueleto")}` },{ translate: "status.do.jogador.diamond" },
			{ text: "\n" }, { text: "\n" }, { text: "§l§5" },
			
           { text: `${getScore(player, "enderman")}` }, { translate: "status.do.jogador.netherite" },
			{ text: "\n" }, { text: "\n" }, { text: "§l§5" },
			
            { text: `${getScore(player, "esqueleto")}` }, { translate: "status.do.jogador.divino.armadura" }
			
        ]
    });
    form.button({ rawtext: [{ translate: "menu.voltar" }] }, "textures/ui/undoArrow.png");
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("")}
		
    });
}
export function status_ferramentas(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:status_ferramentas");
    form.body({
        rawtext: [
            { text: "\n" }, { text: "\n" },
            { translate: "menu.acao.jogador.painel.itens" },
            { text: "\n" }, { text: "\n" },
			{ translate: " " },
            { translate: "status.do.jogador.2" },
            { text: "\n" }, { text: "\n" },
			{ translate: " " },
            { translate: "status.do.jogador.3" },
            { text: "\n" }, { text: "\n" },
			{ translate: " " },
            { translate: "status.do.jogador.4" },
            { text: "\n" }, { text: "\n" },
			{ translate: " " },
            { translate: "status.do.jogador.5" },
			{ text: "\n" }, { text: "\n" },
			{ translate: " " },
            { translate: "status.do.jogador.6" },
			{ text: "\n" }, { text: "\n" },
			{ translate: " " },
            { translate: "status.do.jogador.espada_divina" }
			
        ]
    });
    form.button({ rawtext: [{ translate: "menu.voltar" }] }, "textures/ui/undoArrow.png");
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("")}
		
    });
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
export function Chunk_menu_bandeira(player) {
    let form = new ui.ActionFormData();
	form.title("§´Chunk Menu");
    form.body("");
    form.button({ rawtext: [{ translate: "ativar.marcacao"}] }, "textures/ui/toggle_on.png");
	form.button({ rawtext: [{ translate: "remover.marcacao"}] }, "textures/ui/toggle_off.png");
	form.button({ rawtext: [{ translate: "remover.bandeira"}] }, "textures/ui/realms_red_x.png"); 
    
    form.show(player).then((result) => {
        
		
		if (result.selection == 0) {
        player.runCommand("/scoreboard players set @e [type=well:bandeira_chunk, r=10] border 1");}
		
		if (result.selection == 1) {
        player.runCommand("/scoreboard players set @e [type=well:bandeira_chunk, r=10] border 0");}
		
		if (result.selection == 2) {
        player.runCommand("/event entity @e [type=well:bandeira_chunk, r=10] comando");}
		
    });
}
async function showTeleportForm(player) {
    const form = new ui.ModalFormData()
      .title({"rawtext": [{ "translate": "teleporte.pedra" }]})
      .textField( {"rawtext": [{ "translate": "coordenada.x" }]}, { "rawtext": [{ "translate": "admin.textField2" }]})
      .textField( {"rawtext": [{ "translate": "coordenada.y" }]}, { "rawtext": [{ "translate": "admin.textField2" }]})
      .textField( {"rawtext": [{ "translate": "coordenada.z" }]}, { "rawtext": [{ "translate": "admin.textField2" }]});
    const result = await form.show(player);
    if (result.canceled) return;
    if (result.formValues === undefined) return;
    player.teleport({
        x: parseInt(result.formValues[0]),
        y: parseInt(result.formValues[1]),
        z: parseInt(result.formValues[2])
    });
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
export function opcoes_menu(player) {
    let form = new ui.ActionFormData();
	form.title("opcoes_menu");
    form.body("");
	form.button("§´Camera", "textures/ui/dressing_room_capes.png");
	form.button({ rawtext: [{ translate: "menu.cinematica" }] }, "textures/ui/creative_icon.png");
	form.button({ rawtext: [{ translate: "menu.esquiva" }] }, "textures/ui/speed_effect.png");
	form.button({ rawtext: [{ translate: "menu.armadura.render" }] }, "textures/ui/armor_half.png");

    form.show(player).then((result) => {
        
		
		if (result.selection == 0) {
            camera(player);
        }
		
		if (result.selection == 1) {
            player.runCommand("/function scripts_forms/cinematica_opcoes");
        }
		
		if (result.selection == 2) {
            esquiva(player);
        }
		if (result.selection == 3) {
            render_armor(player);
        }
		
    });
}
export function render_armor(player) {
    let form = new ui.ActionFormData();
	form.title("esquiva");
    form.body({ rawtext: [{ translate: "opcoes.render_armor.title"}]});
    form.button({ rawtext: [{ translate: "opcoes.render_armor.ativada"}]}, "textures/ui/armor_full.png");
	form.button({ rawtext: [{ translate: "opcoes.render_armor.desativada"}]}, "textures/ui/armor_empty.png");
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("event entity @s remove_tamed_dummy_armor_invisible"); 
		player.runCommand("titleraw @s actionbar {\"rawtext\":[{ \"translate\":\"actionbar.armor.visivel\" }]}"); }
		
		if (result.selection == 1) {
        player.runCommand("event entity @s add_tamed_dummy_armor_invisible"); 
		player.runCommand("titleraw @s actionbar {\"rawtext\":[{ \"translate\":\"actionbar.armor.invisivel\" }]}"); }
		
    });
}
export function esquiva(player) {
    let form = new ui.ActionFormData();
	form.title("esquiva");
    form.body({ rawtext: [{ translate: "opcoes.esquiva.title"}]});
    form.button({ rawtext: [{ translate: "opcoes.esquiva.ativada"}]}, "textures/ui/check.png");
	form.button({ rawtext: [{ translate: "opcoes.esquiva.desativada"}]}, "textures/ui/realms_red_x.png");
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        player.runCommand("/function scripts_forms/esquiva_ativada"); }
		
		if (result.selection == 1) {
        player.runCommand("/function scripts_forms/esquiva_desativada"); }
		
    });
}
export function teleporte_principal(player) {
    let form = new ui.ActionFormData();
	form.title("teleporte_players");
    form.body("");
    form.button({ rawtext: [{ translate: "title.tp.player" }]}, "textures/ui/dressing_room_skins.png");
	form.button({ rawtext: [{ translate: "title.tp.cidades" }]}, "textures/ui/icon_recipe_nature.png");
	form.button({ rawtext: [{ translate: "title.tp.arena" }]}, "textures/ui/icon_recipe_equipment.png");
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        tpa(player) }
		
		if (result.selection == 1) {
        teleporte(player) }
		
		if (result.selection == 2) {
        tp_arena(player) }
    });
}
export function camera(player) {
    let form = new ui.ActionFormData();
	form.title("camera");
    form.body("");
	form.button({ rawtext: [{ translate: "camera.desativada" }] }, "textures/ui/realms_red_x.png");
    form.button({ rawtext: [{ translate: "camera.primeira" }] }, "textures/ui/sidebar_icons/dressing_room_animation.png");
	form.button({ rawtext: [{ translate: "camera.terceira" }] }, "textures/ui/sidebar_icons/dressing_room_capes.png");
	form.button({ rawtext: [{ translate: "camera.rpg" }] }, "textures/ui/icon_recipe_equipment.png");
	form.button({ rawtext: [{ translate: "camera.expansiva" }] }, "textures/ui/World.png");
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
            player.runCommand("/camera @s clear");
			player.runCommand("/scoreboard players set @s camera_rpg 0")
			//player.runCommand("/scoreboard players set @s camera_dragao 0");
        }
        if (result.selection == 1) {
            
			player.runCommand("/camera @s set minecraft:first_person")
			player.runCommand("/scoreboard players set @s camera_rpg 0");
			//player.runCommand("/scoreboard players set @s camera_dragao 0");
        }
		if (result.selection == 2) {
            player.runCommand("/camera @s set minecraft:third_person")
			player.runCommand("/scoreboard players set @s camera_rpg 0");
			//player.runCommand("/scoreboard players set @s camera_dragao 0");
        }
		if (result.selection == 3) {
            player.runCommand("/scoreboard players set @s camera_rpg 1")
			player.runCommand("/scoreboard players set @s camera_dragao 0");
        }
		if (result.selection == 4) {
            player.runCommand("/scoreboard players set @s camera_rpg 2")
			//player.runCommand("/scoreboard players set @s camera_dragao 0");
        }
    });
}
export function menu_missao(player) {
    let form = new ui.ActionFormData();
    form.title("wellforced:menudemissao");
    form.body("");
    form.button({ rawtext: [{ translate: "menu.ver.principaismissoes" }] }, "textures/items/book_enchanted.png");
    form.button({ rawtext: [{ translate: "menu.ver.submissoes" }] }, "textures/items/book_writable.png");

    form.show(player).then((result) => {
        if (result.selection == 0) {
            if (player.hasTag("novice")) {
                missao1(player);
            }  
			if (player.hasTag("novice1")) {
                missao2(player);
            }  
			if (player.hasTag("novice2")) {
                missao3(player);
            }  
			if (player.hasTag("novice3")) {
                missao4(player);
            }  
			if (player.hasTag("boss1")) {
                missao_boss1(player);
            }  
			if (player.hasTag("adventure")) {
                missao5(player);
            }  
			if (player.hasTag("adventure1")) {
                missao6(player);
            }  
			if (player.hasTag("adventure2")) {
                missao7(player);
            }  
			if (player.hasTag("adventure3")) {
                missao8(player);
            }  
			if (player.hasTag("adventure4")) {
                missao9(player);
            }  
			if (player.hasTag("boss2")) {
                missao_boss2(player);
            }  
			if (player.hasTag("master")) {
                missao10(player);
            }  
			if (player.hasTag("master1")) {
                missao11(player);
            }  
			if (player.hasTag("master2")) {
                missao12(player);
            }  
			if (player.hasTag("boss3")) {
                missao_boss3(player);
            }  
			if (player.hasTag("hero")) {
                missao13(player);
            }  
			if (player.hasTag("hero1")) {
                missao14(player);
            }  
			if (player.hasTag("hero2")) {
                missao15(player);
            }  
			if (player.hasTag("hero3")) {
                missao16(player);
            }  
			if (player.hasTag("hero4")) {
                missao17(player);
            }  
			if (player.hasTag("boss4")) {
                missao_boss4(player);
            }
        }

        if (result.selection == 1) {
			if (player.hasTag("subquest0")) {
                submissao0(player);
            }
            if (player.hasTag("subquest1")) {
                submissao1(player);
            }  
			if (player.hasTag("subquest2")) {
                submissao2(player);
            }  
			if (player.hasTag("subquest3")) {
                submissao3(player);
            }  
			if (player.hasTag("subquest4")) {
                submissao4(player);
            }  
			if (player.hasTag("subquest5")) {
                submissao5(player);
            }  
			if (player.hasTag("subquest6")) {
                submissao6(player);
            }  
			if (player.hasTag("subquest7")) {
                submissao7(player);
            }  
			if (player.hasTag("subquest8")) {
                submissao8(player);
            }  
			if (player.hasTag("subquest9")) {
                submissao9(player);
            }  
			if (player.hasTag("subquest10")) {
                submissao10(player);
            }  
			if (player.hasTag("subquest11")) {
                submissao11(player);
            }  
			if (player.hasTag("subquest12")) {
                submissao12(player);
            }  
			if (player.hasTag("subquest13")) {
                submissao13(player);
            }  
			if (player.hasTag("subquest14")) {
                submissao14(player);
            }  
			if (player.hasTag("subquest15")) {
                submissao15(player);
            }  
			if (player.hasTag("subquest16")) {
                submissao16(player);
            }  
			if (player.hasTag("subquest17")) {
                submissao17(player);
            }  
			if (player.hasTag("subquest18")) {
                submissao18(player);
            }  
			if (player.hasTag("subquest19")) {
                submissao19(player);
            }  
			if (player.hasTag("subquest20")) {
                submissao20(player);
            }  
			if (player.hasTag("subquest21")) {
                submissao21(player);
            }
			if (player.hasTag("subquest22")) {
                submissao22(player);
            }
			if (player.hasTag("subquest23")) {
                submissao23(player);
            }
			if (player.hasTag("subquest24")) {
                submissao24(player);
            }
			if (player.hasTag("subquest25")) {
                submissao25(player);
            }
			if (player.hasTag("subquest26")) {
                submissao26(player);
            }
			if (player.hasTag("subquest27")) {
                submissao27(player);
            }
			if (player.hasTag("subquest28")) {
                submissao28(player);
            }
			if (player.hasTag("subquest29")) {
                submissao29(player);
            }
			if (player.hasTag("subquest30")) {
                submissao30(player);
            }
        }
    });
}
export function creditos(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:menu_creditos");
    form.body("");
    form.button({ rawtext: [{ translate: "menu.voltar" }] }, "textures/ui/undoArrow.png");
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        }
    });
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
export function tp_arena(player) {
    let form = new MessageFormData();
    form.title({ rawtext: [{ translate: "tp.arena.title" }]});
    form.body({ rawtext: [{ translate: "dialogo.msg.arena.tp" }]});
    form.button1({ rawtext: [{ translate: "dialogo.nao" }]});
    form.button2({ rawtext: [{ translate: "dialogo.sim" }]});

    form.show(player).then(result => {
        if (result.selection === 0) {
            
            return;
        } else if (result.selection === 1) {
            player.runCommand("teleport @s 7000 220 7033");
			player.runCommand("spawnpoint @s 7000 220 7033");
			player.runCommand("tag @s add arena");
        }
    }).catch(error => {
        console.error(error, error.stack);
    });
}
export function arena_desistencia(player) {
    let form = new MessageFormData();
    form.title({ rawtext: [{ translate: "desistencia.arena.title" }]});
    form.body({ rawtext: [{ translate: "desistencia.msg.arena" }]});
    form.button1({ rawtext: [{ translate: "dialogo.nao" }]});
    form.button2({ rawtext: [{ translate: "dialogo.sim" }]});

    form.show(player).then(result => {
        if (result.selection === 0) {
            
            return;
        } else if (result.selection === 1) {
            player.runCommand("teleport @s 41 70 36");
			player.runCommand("spawnpoint @s 41 70 36");
			player.runCommand("tag @s remove arena");
			player.runCommand("scoreboard players set @s kills_arena 0");
			
			player.runCommand("stopsound @s");
		    player.runCommand("playsound FarLand @s");
		    player.runCommand("titleraw @s title {\"rawtext\":[{ \"translate\":\"title.farlands.msg\" }]}");
		    player.runCommand("titleraw @s subtitle {\"rawtext\":[{ \"translate\":\"title.welcome.msg\" }]}")
			
			
        }
    }).catch(error => {
        console.error(error, error.stack);
    });
}
export function teleporte(player) {
    let form = new ui.ActionFormData();
	form.title("teleporte");
    form.body("");
    form.button({ rawtext: [{ translate: "title.farlands.msg" }]}, "textures/items/totem.png");
	form.button({ rawtext: [{ translate: "title.mosscity.msg" }]}, "textures/items/itens_misticos/erva_gato.png");
	form.button({ rawtext: [{ translate: "title.glowstonecity.msg" }]}, "textures/items/itens_misticos/frasco_mana.png");
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
		player.runCommand("tickingarea add circle ~ ~ ~ 4 padrao")
		player.runCommand("tag @s add contagem_remove_npc")
		
		player.runCommand("stopsound @s")
		player.runCommand("playsound FarLand @s")
		player.runCommand("titleraw @s title {\"rawtext\":[{ \"translate\":\"title.farlands.msg\" }]}")
		player.runCommand("titleraw @s subtitle {\"rawtext\":[{ \"translate\":\"title.welcome.msg\" }]}")
		
		
		
		player.runCommand("tag @e [family=pet, r=10] add tp_pets_farlands")
		player.runCommand("execute in overworld run tp @s 41 70 36")
		player.runCommand("kill @e [type=item]")
		
		
		
		}
		
		if (result.selection == 1) {
		player.runCommand("function teleporte/tp_Moss")
		
		}
		
		if (result.selection == 2) {
		player.runCommand("function teleporte/tp_Glowstone")
		
		}
    });
}
function tpa(player) {
	const allPlayers = world.getAllPlayers().filter(p => p.name !== player.name);

	if (allPlayers.length === 0) {
		player.sendMessage({ "rawtext": [{ "translate": "menu.teleporte.sem.players" }]});
		player.playSound('random.hurt');
		return;
	}

	// Opção "vazia" no topo do dropdown
	const playerNames = [{ "rawtext": [{ "translate": "menu.teleporte.vazio" }] }].concat(
		allPlayers.map(p => ({ text: p.name }))
	);

	const form = new ModalFormData()
		.title({ "rawtext": [{ "translate": "menu.teleporte.players" }]})
		.dropdown({ "rawtext": [{ "translate": "menu.teleporte.escolher.players" }]}, playerNames)
		.toggle({ "rawtext": [{ "translate": "title.botao.toggle" }]}, { defaultValue: true });

	form.show(player).then(({ formValues, canceled, cancelationReason }) => {
		if (cancelationReason === 'UserBusy') return tpa(player);
		if (canceled || formValues === undefined) return;

		const dropdownIndex = formValues[0];
		const toggleValue = formValues[1];

		// ✅ Sempre executa o toggle, mesmo se o jogador não selecionar ninguém
		if (toggleValue) {
			player.runCommand(`scoreboard players set @s solicitacao_teleporte 1`);
			player.runCommand(`titleraw @s actionbar {\"rawtext\":[{ \"translate\":\"botao.solicitacao.desativada\"}]}`);
		} else {
			player.runCommand(`scoreboard players set @s solicitacao_teleporte 0`);
			player.runCommand(`titleraw @s actionbar {\"rawtext\":[{ \"translate\":\"botao.solicitacao.ativada\"}]}`);
		}

		// ❌ Jogador não selecionou ninguém
		if (dropdownIndex === 0) {
			player.sendMessage("§cVocê não selecionou nenhum jogador.");
			player.playSound('random.hurt');
			return;
		}

		const selectedPlayer = allPlayers[dropdownIndex - 1]; // Corrige índice

		if (!selectedPlayer) {
			player.sendMessage({ "rawtext": [{ "translate": "menu.teleporte.offline.players" }]});
			player.playSound('random.hurt');
			return;
		}

		// Verifica o scoreboard solicitacao_teleporte do jogador selecionado
		const scoreObj = world.scoreboard.getObjective("solicitacao_teleporte");
		if (!scoreObj) {
			player.sendMessage("§cScoreboard 'solicitacao_teleporte' não existe!");
			player.playSound('random.hurt');
			return;
		}

		const score = scoreObj.getScore(selectedPlayer) ?? 0;

		if (score !== 1) {
			player.sendMessage({
				rawtext: [
					{ text: `§c${selectedPlayer.name}` },
					{ translate: "score.solicitacao.negada" }
				]
			});
			player.playSound('random.hurt');
			return;
		}

		// Se passou na checagem, envia a solicitação
		requestTpa(player, selectedPlayer);
		selectedPlayer.playSound('random.toast');
		player.sendMessage({
			rawtext: [
				{ translate: "menu.teleporte.solicitacao.players" },
				{ text: ` ${selectedPlayer.name}` }
			]
		});
		player.playSound('random.pop', { volume: 5 });
	});
}
function requestTpa(sender, targetPlayer) {
	new MessageFormData()
		.title({ "rawtext": [{ "translate": "menu.teleporte.solicitacao.teleporte" }]})
		.body({ "rawtext": [{ text: ` ${sender.name}`}, { "translate": "menu.teleporte.solicitacao.mensagem" }]})
		.button1({ "rawtext": [{ "translate": "menu.teleporte.solicitacao.aceitar" }]})
		.button2({ "rawtext": [{ "translate": "menu.teleporte.solicitacao.recusar" }]})
		.show(targetPlayer).then((request) => {
			if (request.canceled && request.cancelationReason === 'UserBusy') requestTpa(sender, targetPlayer);
			if (request.canceled && request.cancelationReason === 'UserClosed') return;
			if (request.selection === 0) {
				sender.teleport(targetPlayer.location);
				sender.sendMessage({ "rawtext": [{ "translate": "menu.teleporte.aceitou.mensagem" }, { text: ` ${targetPlayer.name}` }]});
				system.runTimeout(() => {
					sender.playSound('mob.enderman.portal', {
						volume: 5
					})
				}, 10);
				targetPlayer.playSound('random.orb');
				targetPlayer.sendMessage({ "rawtext": [{ "translate": "menu.teleporte.aceitou.mensagem.console" }, { text: ` ${sender.name}` }]});
			} else if (request.selection === 1) {
				sender.sendMessage({"rawtext": [{ "translate": "menu.teleporte.msg.player" }, { text: ` ${targetPlayer.name} ` }, { translate: "menu.teleporte.aceitou.mensagem.console.negou" }]});
				sender.playSound('random.hurt');
				targetPlayer.sendMessage({ "rawtext": [{ "translate": "menu.teleporte.msg.player.negada" }, { text: ` ${sender.name}` }]});
				targetPlayer.playSound('note.hat');
			}
		});
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
export function genero(player) {
    let form = new ui.ActionFormData();
    form.title("wellforced:genero");
    form.body("");
    form.button({ rawtext: [{ translate: "opcoes.masculino" }]}, "textures/ui/icon_steve.png");
    form.button({ rawtext: [{ translate: "opcoes.feminino" }]}, "textures/ui/icon_alex.png");
    
    form.show(player).then((result) => {
        if (result === null) {
            // Se result for null, significa que o jogador fechou o formulário sem seleção
			player.runCommand("/tag @s add genero");
            genero(player); // Reabre o formulário
        } else {
            // Verifica a seleção feita pelo jogador
            if (result.selection == 0) {
                player.runCommand("/scoreboard players set @s genero 1");
                raca_mago(player); // Chama a próxima função após definir o gênero
            } else if (result.selection == 1) {
                player.runCommand("/scoreboard players set @s genero 2");
                raca_mago(player); // Chama a próxima função após definir o gênero
            }
        }
    });
}
export function raca_humana(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:raca_humana");
    form.body("");
    form.button({ rawtext: [{ translate: "<<" }] });
	form.button({ rawtext: [{ translate: "select_class.ok" }] });
	form.button({ rawtext: [{ translate: ">>" }] });
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        raca_mago(player) }
		
		//if (result.selection == 1) {
        //player.runCommand("/function classe/humano");}
		
		if (result.selection == 1) {
        player.runCommand("/function classe/humano");}
		
		if (result.selection == 2) {
        raca_elfo(player) }
    });
}
export function raca_elfo(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:raca_elfo");
    form.body("");
    form.button({ rawtext: [{ translate: "<<" }] });
	form.button({ rawtext: [{ translate: "select_class.ok" }] });
	form.button({ rawtext: [{ translate: ">>" }] });
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        raca_humana(player) }
		
		//if (result.selection == 1) {
        //player.runCommand("/function classe/elfo");}
		
		if (result.selection == 1) {
        raca_elfo(player) } //player.runCommand("/function classe/elfo");}
		
		if (result.selection == 2) {
        raca_mago(player) }
    });
}
export function raca_mago(player) {
    let form = new ui.ActionFormData();
	form.title("wellforced:raca_mago");
    form.body("");
    form.button({ rawtext: [{ translate: "<<" }] });
	form.button({ rawtext: [{ translate: "select_class.ok" }] });
	form.button({ rawtext: [{ translate: ">>" }] });
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        raca_elfo(player) }
		
		if (result.selection == 1) {
        player.runCommand("/function classe/mago");}
		
		if (result.selection == 2) {
        raca_humana(player) }
    });
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
export function cinematica1(player) {
    let form = new ui.ActionFormData();
	form.title("cinematica1");
    form.body("");
    form.button({ rawtext: [{ translate: ">>" }] });
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        cinematica2(player) }
    });
}
export function cinematica2(player) {
    let form = new ui.ActionFormData();
	form.title("cinematica2");
    form.body("");
    form.button({ rawtext: [{ translate: ">>" }] });
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        cinematica3(player) }
    });
}
export function cinematica3(player) {
    let form = new ui.ActionFormData();
	form.title("cinematica3");
    form.body("");
    form.button({ rawtext: [{ translate: ">>" }] });
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        cinematica4(player) }
    });
}
export function cinematica4(player) {
    let form = new ui.ActionFormData();
	form.title("cinematica4");
    form.body("");
    form.button({ rawtext: [{ translate: ">>" }] });
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        cinematica5(player) }
    });
}
export function cinematica5(player) {
    let form = new ui.ActionFormData();
	form.title("cinematica5");
    form.body("");
    form.button({ rawtext: [{ translate: ">>" }] });
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        cinematica6(player) }
    });
}
export function cinematica6(player) {
    let form = new ui.ActionFormData();
	form.title("cinematica6");
    form.body("");
    form.button({ rawtext: [{ translate: ">>" }] });
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        cinematica7(player) }
    });
}
export function cinematica7(player) {
    let form = new ui.ActionFormData();
	form.title("cinematica7");
    form.body("");
    form.button({ rawtext: [{ translate: ">>" }] });
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        cinematica8(player) }
    });
}
export function cinematica8(player) {
    let form = new ui.ActionFormData();
	form.title("cinematica8");
    form.body("");
    form.button({ rawtext: [{ translate: ">>" }] });
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        cinematica9(player) }
    });
}
export function cinematica9(player) {
    let form = new ui.ActionFormData();
	form.title("cinematica9");
    form.body("");
    form.button({ rawtext: [{ translate: ">>" }] });
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        cinematica10(player) }
    });
}
export function cinematica10(player) {
    let form = new ui.ActionFormData();
	form.title("cinematica10");
    form.body("");
    form.button({ rawtext: [{ translate: ">>" }] });
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        cinematica11(player) }
    });
}
export function cinematica11(player) {
    let form = new ui.ActionFormData();
	form.title("cinematica11");
    form.body("");
    form.button({ rawtext: [{ translate: ">>" }] });
    
    form.show(player).then((result) => {
        
		if (result.selection == 0) {
        genero(player) }
    });
}
