import { world, system } from "@minecraft/server";

const ITEM_LORE = {
    "pm_m8:charged_punch": "Titan Eight only",
    "pm_m8:continuous_strike": "Titan Eight only",
    "pm_m8:jump_act": "Titan Eight only",
    "pm_m8:jump_boost_monster8": "Titan Eight only",
    "pm_m8:movement_speed_boost": "Titan Eight only",
    "pm_m8:roar_monster8": "Titan Eight only",
    "pm_m8:titan_fist": "Titan Eight only",
    "pm_m8:transformation": "Transform between Titan Eight and Human",
    "pm_m8:ultimate": "Titan Eight only",

    "pm_m8:battle_hardened": "Pyroclasm Armor Required",
    "pm_m8:charged_attack": "Juggernaut Armor Required",
    "pm_m8:frost": "Inferno Exoskeleton Armor Required",
    "pm_m8:glide": "Cyclone Suit Required",
    "pm_m8:jump_boost": "Any Combat Suit Required",
    "pm_m8:mode_switch": "Sword-Blaster Combination Required",
    "pm_m8:multiple_hits": "Pyroclasm Armor Required",
    "pm_m8:regeneration": "Any Combat Suit Required",
    "pm_m8:speed": "Any Combat Suit Required",
    "pm_m8:sprint_collision": "Cyclone / Juggernaut Armor Required",
    "pm_m8:strength": "Any Combat Suit Required",
};
function addLore(player) {
    var inventory = player.getComponent("minecraft:inventory");
    for (let i = 0; i < inventory.container.size; i++) {
        var item = inventory.container.getItem(i);
        if (item && ITEM_LORE[item.typeId] && !item.getDynamicProperty("cg:initialized")) {
            var temp = item.clone(),
            lore = ITEM_LORE[temp.typeId];
            lore && temp.setLore(["§r§6" + lore]),
            temp.setDynamicProperty("cg:initialized", !0),
            inventory.container.setItem(i, temp)
        }
    }
}

// system.runInterval(() => {
//     for (const player of world.getAllPlayers()) {

//         addLore(player)
//     }
// }, 10)