Bone Overlord.gif The Roost of the Graveborn Quest Spoiler!
Domine Graveborn: todos os bosses e mecânicas ilustradas!
Saiba mais ➔
Winter Tree.png Winter Update 2025
Acompanhe tudo sobre o Winter Update 2025!
Saiba mais ➔
Stag.gif The Order of the Stag Quest Spoiler!
Conheça Isle of Ada: sua quest, missões secundárias e todos os bosses!
Saiba mais ➔

Tibia Wiki:Hot Cuisine Calculator System/Codigo: mudanças entre as edições

De Tibia Wiki - A Enciclopédia do Tibia
Ir para navegação Ir para pesquisar
 
(66 revisões intermediárias pelo mesmo usuário não estão sendo mostradas)
Linha 1: Linha 1:
<pre id="hot_cuisine_system_html">
<pre id="hot_cuisine_system_html">
  <table class="main_table">
  <div class="hot-cuisine-panel">
        <tr>
    <div class="hot-cuisine-loading">
        <td style="height: 30px;" colspan="2">
        <img src="https://www.tibiawiki.com.br/images/c/ce/The_Epic_Wisdom.gif" /><br />
            <div id="title" class="titulo">Hot Cuisine Calculator System</div>
         <label>Loading...</label>
         </td>
         <span>@TibiaWiki</span>
         </tr>
    </div>
        <tr>
    <div class="hot-cuisine-players-panel">
        <td>
        <h2>Hot Cuisine</h2>
            <table style="width:100%;height:40px;">
        <div class="hot-cuisine-players-input-box">
                <tr>
            <label for="hot-cuisine-players-quantity-input">Quantidade de Personagens:</label>
                    <td style="width: 48%; vertical-align: top;">
            <input class="text-center" type="number" id="hot-cuisine-players-quantity-input" min="1" value="1">
                        <table style="width:100%;">
        </div>
                            <tr>
        <div class="hot-cuisine-players-list-box">
                                <td>
            <label for="hot-cuisine-players-list-select">Personagens:</label>
                                    <div id="title" class="titulo">Foods:</div>
            <select id="hot-cuisine-players-list-select" type="text" size="10">
                                    <div id="foodSelect">
            </select>
                                    </div>
        </div>
                                </td>
        <div class="hot-cuisine-players-input-box">
                            </tr>
            <label for="hot-cuisine-players-name-input">Nome do Personagem:</label>
                        </table> 
            <input type="text" id="hot-cuisine-players-name-input" value="Player 1" placeholder="Nome do Personagem...">
                    </td>
        </div>
                    <td style="width: 48%; vertical-align: top;">
        <div class="hot-cuisine-checkbox-boxes-flex">
                            <table style="height:100%;">
            <div class="hot-cuisine-checkbox-box">
                                <tr>
                <input id="hot-cuisine-checkbox-first-time" type="checkbox">
                                    <td style="height: 60px; vertical-align: top;">
                <label for="hot-cuisine-checkbox-first-time">Primeira vez</label>
                                        <div class="titulo">Quantidade de Personagens:</div>
            </div>
                                        <input type="number" id="qtdPlayers" name="qtdPlayers" value="1" min="1" oninput="updateQuantity()"><br>
            <div class="hot-cuisine-checkbox-box">
                                        <div style="height: 20px; margin-bottom: 5px; display: flex; align-items: center; justify-content: center; width: fit-content;">
                <input id="hot-cuisine-checkbox-player-done" type="checkbox">
                                            <input style="margin-top: 5px;" type="checkbox" id="first-time" name="first-time" value="first-time" onchange="updateQuantity()"/><label for="first-time">Primeira vez</label><br><br>
                <label for="hot-cuisine-checkbox-player-done">Terminado</label>
                                        </div>
            </div>
                                    </td>
        </div>
                                </tr>
        <button onclick="deletAllPlayers()">deletar personagens</button>
                                <tr>
    </div>
                                    <td style="width: 48%; vertical-align: top;">
    <div class="hot-cuisine-foods-panel">
                                        <div class="titulo">Ingredientes:</div>
        <h2>Foods</h2>
                                        <div class="ingredients-list" style="max-height: 360px; overflow: auto; vertical-align: top;">
        <div class="hot-cuisine-checkbox-box">
                                            <table style="max-width: 100%; max-height: 238px; overflow:auto;"><tbody id="ingredients"></tbody></table>
            <input id="hot-cuisine-checkbox-select-all-food" type="checkbox">
                                        </div>
            <label for="hot-cuisine-checkbox-select-all-food">Selecionar todas as Foods</label>
                                    </td>
        </div>
                                </tr>
        <div class="hot-cuisine-foods-list">
                            </table>
        </div>
                    </td>
    </div>
                </tr>
    <div class="hot-cuisine-selected-player-foods-panel">
            </table>
        <h2>Foods Selecionados</h2>
         </td>
        <label class="hot-cuisine-selected-player-label">Player: </label>
        </tr>
        <div class="hot-cuisine-selected-player-foods-list">
    </table>
        </div>
    </div>
    <div class="hot-cuisine-all-ingredients-list">
        <h2>Todos os Ingredientes</h2>
        <div class="hot-cuisine-checkbox-box">
            <input id="hot-cuisine-checkbox-select-show-all-ingredients" type="checkbox">
            <label for="hot-cuisine-checkbox-select-show-all-ingredients">Mostrar todos Ingredientes</label>
        </div>
        <div class="hot-cuisine-all-ingredients-list-items">
         </div>
    </div>
</div>
</pre>
</pre>


<pre id="hot_cuisine_system_css">
<pre id="hot_cuisine_system_css">
.main_table {
    .hot-cuisine-panel {
  border: #7B6E4C 1px solid;
        display: flex;
  background: #181E23;
        max-width: 1200px;
  margin: 2px;
        /* max-height: 500px; */
  -webkit-box-shadow: 0px 0px 10px 2px rgba(255, 255, 255, 1);
        position: relative;
  -moz-box-shadow: 0px 0px 10px 2px rgba(255, 255, 255, 1);
        border: 2px solid #a2a9b1;
  box-shadow: 0px 0px 10px 2px rgba(255, 255, 255, 1);
        background: #ffffff;
  font-family: Verdana, Arial, Times New Roman, sans-serif;
        border-radius: 5px;
  font-size: 13px;
        -webkit-box-shadow: 0px 0px 10px 2px rgba(255, 255, 255, 1);
  color: #B2A898;
        -moz-box-shadow: 0px 0px 10px 2px rgba(255, 255, 255, 1);
}
        box-shadow: 0px 0px 10px 2px rgba(255, 255, 255, 1);
        font-family: Verdana, Arial, Times New Roman, sans-serif;
        font-size: 13px;
        color: black;
    }
    .hot-cuisine-loading {
        z-index: 9999;
        background-color: rgba(255, 255, 255, 0.98);
        display: inline-block;
        border-radius: 3px;
        position: absolute;
        height: 100%;
        width: 100%;
        top: 0;
        left: 0;
        align-content: center;
        text-align: center;
    }


.titulo {
    .hot-cuisine-loading > label {
  position: relative;
        position: relative;
  margin: 1px 2px 0 2px;
        bottom: 0px;
  border: #7B6E4C 1px solid;
        text-align: center;   
  background: #11161A;
        font-size: math;
  padding: 0 auto;
        background: transparent;
  height: 24px;
    }
  line-height: 24px;
    .hot-cuisine-loading > span {
  text-align: center;
        text-align: center;
  font-weight: bold;
        align-content: center;
  font-size: 12px;
        background-color: #c7451d;
  cursor: default;
        height: 32px;
}
        width: 100%;
        position: absolute;
        bottom: 0px;
        left: 0px;
        text-align: center;   
        font-size: math;
        border-bottom-left-radius: 3px;
        border-bottom-right-radius: 3px;
    }
    .hot-cuisine-players-panel {
        background-color: #c7451d;
        width: 260px;
        border-top-left-radius: 3px;
        border-bottom-left-radius: 3px;
        padding: 10px 5px 5px 5px;
    }
    .hot-cuisine-players-panel > h2 {
        width: 100%;
        padding-bottom: 10px;
        text-align: center;
        color: white;
        border-bottom: 1px solid black;
        font-family: Verdana, Arial, Times New Roman, sans-serif;
    }
    .hot-cuisine-players-panel > .hot-cuisine-checkbox-boxes-flex {
        display: flex;
    }
    .hot-cuisine-players-panel > button {
        margin-top: 15px;
        width: 100%;
        height: 35px;
        font-weight: bold;
        border-radius: 5px;
        border: 1px solid #eae2e2;
    }
    .hot-cuisine-players-panel > button:hover {
        background-color: #eae2e2;
        border: 1px solid #eae2e2;
    }
    .hot-cuisine-players-input-box {
        height: 55px;
        margin-top: 5px;
    }
    .hot-cuisine-players-input-box > label {
        width: 100%;
        font-weight: bold;
        margin-left: 2px;
        color: white;
    }
    .hot-cuisine-players-input-box > input {
        width: 100%;
        height: 32px;
        margin-top: 5px;
        border: none;
        border-radius: 5px;
        font-weight: bold;
    }
    .hot-cuisine-players-input-box > input.text-center {
        text-align: center;
    }


.quantity-box {
    .hot-cuisine-players-list-box {
  position: relative;
        width: 100%;
  width: 34px;
        margin-top: 5px;
  margin: 1px 2px 0 2px;
    }
  border: #7B6E4C 1px solid;
    .hot-cuisine-players-list-box > label {
  background: #11161A;
        width: 100%;
  height: 15px;
        font-weight: bold;
  line-height: 15px;
        margin-left: 2px;
  text-align: center;
        color: white;
  font-weight: bold;
    }
  font-size: 12px;
    .hot-cuisine-players-list-box > select {
  cursor: default;
        width: 100%;
}
        margin-top: 5px;
        border: none;
        border-radius: 5px;
        padding: 5px;
    }


.title-box {
    .hot-cuisine-players-list-box > select > option {
  position: relative;
        width: 100%;
  margin: 1px 2px 0 2px;
        height: 15px;
  border: #7B6E4C 1px solid;
        font-weight: bold;
  background: #11161A;
        font-size: 12px;
  line-height: 50px;
    }
  text-align: center;
    .hot-cuisine-checkbox-box {
  font-weight: bold;
        width: 100%;
  font-size: 12px;
        margin-top: 10px;
  cursor: default;
        display: flex;
  height: 56px;
        align-items: center;
  width: 100%;
    }
}
    .hot-cuisine-checkbox-box > input {
        width: 20px;
        height: 20px;
        margin: 0px;
        border-radius: 5px;
        border: none;
    }
    .hot-cuisine-checkbox-box > label {
        height: 100%;
        margin-left: 5px;
        align-content: center;
        font-weight: bold;
    }
    .hot-cuisine-players-panel > div > .hot-cuisine-checkbox-box > label {
        color: #FFFFFF;
    }


#qtdPlayers {
    .hot-cuisine-foods-panel {
  background: #11161A;
        width: 300px;
  width: 273px;
        margin: 5px 0px 5px 0px;
  height: 18px;
        padding: 5px;
  margin: 5px 0px 0 2px;
        border-right: 1px solid #000000;
  padding: 1px 1px 1px 1px;
    }
  border: #CBB47A 1px solid;
    .hot-cuisine-foods-panel > h2 {
  border-collapse: separate;
        width: 100%;
  font-family: Verdana, Arial, Times New Roman, sans-serif;
        text-align: center;
  font-size: 13px;
        padding-bottom: 10px;
  color: #B2A898;
        border-bottom: 1px solid #000000;
}
        font-family: Verdana, Arial, Times New Roman, sans-serif;
    }
    .hot-cuisine-foods-panel > .hot-cuisine-checkbox-box > label {
        color: black;
    }
    .hot-cuisine-foods-list {
        width: 100%;
        margin-top: 25px;
    }
    .hot-cuisine-foods-list-item {
        width: 100%;
        display: flex;
    }
    .hot-cuisine-foods-list-item {
        width: 100%;
        display: flex;
        align-content: center;
    }
    .hot-cuisine-foods-list-item > input {
        width: 20px;
        height: 20px;
    }
    .hot-cuisine-foods-list-item > img {
        width: 25px;
        height: 25px;
    }
    .hot-cuisine-foods-list-item > label {
        height: 100%;
        margin-left: 5px;
        align-self: center;
        font-weight: bold;
    }
    .hot-cuisine-selected-player-foods-panel {
        width: 340px;
        margin: 5px 0px 5px 0px;
        padding: 5px;
        border-right: 1px solid #000000;
    }
    .hot-cuisine-selected-player-foods-panel > h2 {
        width: 100%;
        text-align: center;
        padding-bottom: 10px;
        border-bottom: 1px solid #000000;
        font-family: Verdana, Arial, Times New Roman, sans-serif;
    }
    .hot-cuisine-selected-player-label {
        font-weight: bold;
    }
    .hot-cuisine-selected-player-foods-list {
        width: 100%;
        /* height: 365px; */
        margin-top: 25px;
        overflow: auto;
    }
    .hot-cuisine-selected-player-foods-item-box-header {
        width: 100%;
        height: 55px;
        display: flex;
        align-items: center;
        border-bottom: 1px solid #eae2e2;
        padding-bottom: 5px;
    }
    .hot-cuisine-selected-player-foods-item-box-header > img {
        width: 25px;
        height: 25px;
    }
    .hot-cuisine-selected-player-foods-item-box-header > label {
        height: 100%;
        width: 200px;
        margin-left: 5px;
        text-align: left;
        align-self: center;
        font-weight: bold;
        align-content: center;


label {
    }
  background: transparent;
    .hot-cuisine-selected-player-foods-item-box-header > div {
  font-family: Verdana, Arial, Times New Roman, sans-serif;
        display: flex;
  font-size: 13px;
    }
  color: #B2A898;
    .hot-cuisine-selected-player-foods-item-box-header > div > input {
  display: inline-table;
        height: 30px;
}
        width: 55px;
        margin-left: 5px;
        align-self: center;
        text-align: center;
        font-weight: bold;
        border: 1px solid #eae2e2;
        border-radius: 5px;
    }
    .hot-cuisine-selected-player-foods-item-box-header > div > i {
        display: block;
        height: 30px;
        width: 40px;
        align-self: center;
        align-content: center;
        text-align: center;
        font-size: 15px;
        font-weight: bold;
        border: none;
        background-color: transparent;
    }
    .hot-cuisine-selected-player-foods-ingredients-box {
        display: flex;
        flex-shrink: 0;
        width: calc(100% - 20px);
        height: 55px;
        margin: 10px;
        padding-bottom: 5px;
        border-bottom: 1px solid #eae2e2;
    }
    .hot-cuisine-selected-player-foods-ingredients-box > label {
        display: block;
        width: calc(100% - 85px);
        height: 55px;
        margin: 5px;
        font-weight: bold;
        text-align: center;
        align-content: center;
    }
    .hot-cuisine-selected-player-foods-ingredients-box > button {
        min-width: 30px;
        height: 30px;
        background-color: #c7451d;
        border: 1px solid #000000;
        border-radius: 5px;
        align-self: center;
        font-size: 15px;
        font-weight: bold;
        color: white;
    }
    .hot-cuisine-selected-player-foods-ingredients-box > button:hover {
        background-color: #ff0000;
        font-size: 20px;
        color: #ffbf00;
    }
    .hot-cuisine-selected-player-foods-ingredients-box > div.img-quantity {
        background-color: #f3f3f3;
        display: block;
        text-align: center;
        width: 50px;
        height: 55px;
        border: 1px solid #000000;
        border-radius: 5px;
    }
    .hot-cuisine-selected-player-foods-ingredients-box > div.img-quantity > img {
        margin-top: 4px;
    }
    .hot-cuisine-selected-player-foods-ingredients-box > div.img-quantity > label {
        display: block;
        background-color: #c7451d;
        text-align: center;
        /* margin-top: 4px; */
        width: 100%;
        height: 18px;
        border-top: 1px solid #000000;
        border-bottom-left-radius: 3px;
        border-bottom-right-radius: 3px;
        font-weight: bold;
    }
    .hot-cuisine-selected-player-foods-item-box-ingredients {
        display: none;
    }


.link-system {
    .hot-cuisine-all-ingredients-list  {
     color: #CBB47A !important;
        width: 300px;
}
        margin: 5px 0px 5px 0px;
        padding: 5px;
    }
     .hot-cuisine-all-ingredients-list > h2 {
        width: 100%;
        text-align: center;
        padding-bottom: 10px;
        border-bottom: 1px solid #000000;
        font-family: Verdana, Arial, Times New Roman, sans-serif;
    }
    .hot-cuisine-all-ingredients-list-items {
        width: 100%;
        overflow: auto;
        margin-top: 25px;
    }
</pre>


#foodSelect, .ingredients-list {
<pre id="hot_cuisine_system_js">
  background: #11161A;
    var players = new Array();
  margin: 5px 2px 2px 2px;
    var isLoaded = false;
  padding: 10px;
    var updateQuantityPlayersOnLoad = () => {
  border: #CBB47A 1px solid;
        const quantityPlayersInput = document.getElementById('hot-cuisine-players-quantity-input');
  border-collapse: separate;
        quantityPlayersInput.value = players.length;
}
    }


input[type=checkbox] {
    var managePlayerOnList = (value) => {
  width: 20px;
        if (players.length > value) {
  height: 20px;
            players.pop(players.length - value);
}
        }
        for (let i = 0; i < value; i++) {
            if (players.find(iPlayer => iPlayer.id === i) == null) {
                const player = {
                    "id": i,
                    "name": "Player ".concat(i + 1),
                    "isFirstTime": false,
                    "isDone": false,
                    "selected": false,
                    "foods": new Object()
                }
                players.push(player);
            }
        }
        let player = (getSelectedPlayerIndex() === -1) ? setSelectedPlayerIndex(0) : players[getSelectedPlayerIndex()];
        selectPlayerUpdateComponents(player);


.ingrendient {
        updateSavedPlayers();
  position: relative;
    }
  margin: 1px 2px 0 2px;
  border: #7B6E4C 1px solid;
  background: #11161A;
  padding: 0 auto;
  height: 32px;
  width: 32px;
  text-align: center;
  cursor: default;
}


.image-box {
    var managerPlayerListOnComponent = (component) => {
  position: relative;
        let quantity = parseInt(component.value || 1);
  margin: 1px 2px 0 2px;
        if (quantity <= 0) {
  border: #7B6E4C 1px solid;
            component.value = 1;
  background: #11161A;
            quantity = 1;
  padding: 0 auto;
        }
  height: 34px;
        managePlayerOnList(quantity);
  width: 34px;
        createPlayerOnListComponent();
  text-align: center;
    }
  cursor: default;
}


.ingrendient {
    var createPlayerOnListComponent = () => {
  margin: 0 auto;
        const playerList = document.getElementById('hot-cuisine-players-list-select');
  width: 34px;
        if (playerList == null) {
}
            showAlert();
            return;
        }
        playerList.innerHTML = "";
        for (let i = 0; i < players.length; i++) {
            const option = createPlayerItemListCell(players[i]);
            playerList.appendChild(option);
        }
        if (playerList.children.length == null || playerList.children.length === 0) {
            showAlert();
            return;
        }
        const selectedPlayerIndex = getSelectedPlayerIndex();
        playerList.children[selectedPlayerIndex].setAttribute('selected', true);
    }


#qtdPlayers {
    var createPlayerItemListCell = (player) => {
  border: #7B6E4C 1px solid;
        const option = new Option((player.id + 1).toString().concat(": ").concat(player.name), player.name);
  background: #3d5361;
        option.setAttribute('list-index', player.id);
  height: 18px;
        option.setAttribute('is-first-time', player.isFirstTime);
  line-height: 18px;
 
  text-align: center;
        return option;
  display: inline-block;
    }
  vertical-align: top;
 
  white-space: nowrap;
    var selectPlayer = (component) => {
  font-family: Verdana, Arial, Times New Roman, sans-serif;
        const listOptions = Array.from(document.getElementsByTagName('option'));
  font-size: 13px;
        const selectedOptions = listOptions.filter(op => op.value === component.value);
  color: #B2A898;
        if (selectedOptions == null || selectedOptions.length === 0) {
}
            showAlert();
            return;
        }
        const selectedOption = selectedOptions[0];
        return setSelectedPlayerIndex(selectedOption.getAttribute("list-index"));
    }
    var selectPlayerUpdateComponents = (player) => {
        // Update Componenents
        const inputPlayerName = document.getElementById('hot-cuisine-players-name-input');
        const isFirstTimeCheckbox = document.getElementById('hot-cuisine-checkbox-first-time');
        const isDoneCheckbox = document.getElementById('hot-cuisine-checkbox-player-done');
 
        inputPlayerName.value = player.name;
        inputPlayerName.setAttribute('selected-player-id', player.id);
        isFirstTimeCheckbox.checked = player.isFirstTime;
        isFirstTimeCheckbox.setAttribute('player-id', player.id);
        isDoneCheckbox.checked = player.isDone;
        isDoneCheckbox.setAttribute('player-id', player.id);
 
        updateSelectedPlayerLabel(player.name);
    }
 
    var loadSelecedPlayerFoods = () => {
        const components = document.getElementsByClassName('hot-cuisine-selected-player-foods-list');
        if (components == null || Object.keys(components).length === 0) {
            showAlert();
            return;
        }
        const listDiv = components[0];
        listDiv.innerHTML = "";
 
        const playerFoods = players[getSelectedPlayerIndex()].foods;
        Object.keys(playerFoods).forEach(foodName => {
            const food = playerFoods[foodName];
            const itemList = createPlayerSelectedFoodsItem(food);
            listDiv.appendChild(itemList);
        });


/* Tooltip */
        loadAllIngredients();
    }


.tip2 {
    var changePlayerDataName = (component) => {
  background-color: #F2F2F2;
        const name = component.value;
  border-radius: 2px;
        players[getSelectedPlayerIndex()].name = name;
  box-shadow: 0 0 6px #B2B2B2;
  display: none;
  position: absolute;
  padding: 10px;
  z-index: 1;
}


.tooltip {
        updateSavedPlayers();
  position: relative;
    }
}


.tooltip,
    var updatePlayerDataName = (component) => {
.tooltip:hover + .tip2,
        const name = component.value;
.tip2:hover {
  display: block;
}
</pre>


<pre id="hot_cuisine_system_js">
        const listOptions = Array.from(document.getElementsByTagName('option'));
var version = "1.0";
         const selectedOptions = listOptions.filter(op => op.getAttribute('list-index') === component.getAttribute('selected-player-id'));
         const ingredients = {
        if (selectedOptions == null || selectedOptions.length === 0) {
            "Meat": {
             showAlert();
                "link": "https://www.tibiawiki.com.br/wiki/Meat",
             return;
                "image": "https://www.tibiawiki.com.br/images/5/58/Meat.gif"
            },
            "Potato": {
                "link": "https://www.tibiawiki.com.br/wiki/Potato",
                "image": "https://www.tibiawiki.com.br/images/f/fa/Potato.gif"
            },
            "Onion": {
                "link": "https://www.tibiawiki.com.br/wiki/Onion",
                "image": "https://www.tibiawiki.com.br/images/5/57/Onion.gif"
            },
            "Bulb of Garlic": {
                "link": "https://www.tibiawiki.com.br/wiki/Bulb_of_Garlic",
                "image": "https://www.tibiawiki.com.br/images/6/63/Bulb_of_Garlic.gif"
            },
            "Flour": {
                "link": "https://www.tibiawiki.com.br/wiki/Flour",
                "image": "https://www.tibiawiki.com.br/images/1/13/Flour.gif"
            },
            "Beer": {
                "link": "https://www.tibiawiki.com.br/wiki/Beer",
                "image": "https://www.tibiawiki.com.br/images/8/8b/Beer.gif"
            },
            "Hydra Tongue": {
                "link": "https://www.tibiawiki.com.br/wiki/Hydra_Tongue",
                "image": "https://www.tibiawiki.com.br/images/4/44/Hydra_Tongue.gif"
            },
            "Tomato": {
                "link": "https://www.tibiawiki.com.br/wiki/Tomato",
                "image": "https://www.tibiawiki.com.br/images/0/06/Tomato.gif"
            },
            "Cucumber": {
                "link": "https://www.tibiawiki.com.br/wiki/Cucumber",
                "image": "https://www.tibiawiki.com.br/images/5/51/Cucumber.gif"
             },
             "Egg": {
                "link": "https://www.tibiawiki.com.br/wiki/Egg",
                "image": "https://www.tibiawiki.com.br/images/e/ed/Egg.gif"
            },
            "Troll Green": {
                "link": "https://www.tibiawiki.com.br/wiki/Troll_Green",
                "image": "https://www.tibiawiki.com.br/images/e/e4/Troll_Green.gif"
            },
            "Wine": {
                "link": "https://www.tibiawiki.com.br/wiki/Wine",
                "image": "https://www.tibiawiki.com.br/images/1/15/Wine.gif"
            },
            "Bat": {
                "link": "https://www.tibiawiki.com.br/wiki/Bat",
                "image": "https://www.tibiawiki.com.br/images/b/b1/Dead_Bat.gif"
            },
            "Jalapeño Pepper": {
                "link": "https://www.tibiawiki.com.br/wiki/Jalapeño_Pepper",
                "image": "https://www.tibiawiki.com.br/images/d/d7/Jalape%C3%B1o_Pepper.gif"
            },
            "Brown Bread": {
                "link": "https://www.tibiawiki.com.br/wiki/Brown_Bread",
                "image": "https://www.tibiawiki.com.br/images/4/47/Brown_Bread.gif"
            },
            "Powder Herb": {
                "link": "https://www.tibiawiki.com.br/wiki/Powder_Herb",
                "image": "https://www.tibiawiki.com.br/images/e/e4/Powder_Herb.gif"
            },
            "Red Mushroom": {
                "link": "https://www.tibiawiki.com.br/wiki/Red_Mushroom",
                "image": "https://www.tibiawiki.com.br/images/9/96/Red_Mushroom.gif"
            },
            "Chicken": {
                "link": "https://www.tibiawiki.com.br/wiki/Chicken",
                "image": "https://www.tibiawiki.com.br/images/6/6f/Dead_Chicken.gif"
            },
            "Lemon": {
                "link": "https://www.tibiawiki.com.br/wiki/Lemon",
                "image": "https://www.tibiawiki.com.br/images/c/c2/Lemon.gif"
            },
            "Orange": {
                "link": "https://www.tibiawiki.com.br/wiki/Orange",
                "image": "https://www.tibiawiki.com.br/images/4/40/Orange.gif"
            },
            "Mango": {
                "link": "https://www.tibiawiki.com.br/wiki/Mango",
                "image": "https://www.tibiawiki.com.br/images/f/f2/Mango.gif"
            },
            "Coconut Milk": {
                "link": "https://www.tibiawiki.com.br/wiki/Coconut_Milk",
                "image": "https://www.tibiawiki.com.br/images/e/e4/Coconut_Milk.gif"
            },
            "Stone Herb": {
                "link": "https://www.tibiawiki.com.br/wiki/Stone_Herb",
                "image": "https://www.tibiawiki.com.br/images/d/da/Stone_Herb.gif"
            },
            "Bar of Chocolate": {
                "link": "https://www.tibiawiki.com.br/wiki/Bar_of_Chocolate",
                "image": "https://www.tibiawiki.com.br/images/c/c4/Bar_of_Chocolate.gif"
            },
            "Cream Cake": {
                "link": "https://www.tibiawiki.com.br/wiki/Cream_Cake",
                "image": "https://www.tibiawiki.com.br/images/9/97/Cream_Cake.gif"
            },
            "Banana": {
                "link": "https://www.tibiawiki.com.br/wiki/Banana",
                "image": "https://www.tibiawiki.com.br/images/4/4f/Banana.gif"
            },
            "Milk": {
                "link": "https://www.tibiawiki.com.br/wiki/Milk",
                "image": "https://www.tibiawiki.com.br/images/4/43/Milk.gif"
            },
            "Sling Herb": {
                "link": "https://www.tibiawiki.com.br/wiki/Sling_Herb",
                "image": "https://www.tibiawiki.com.br/images/7/72/Sling_Herb.gif"
            },
            "Star Herb": {
                "link": "https://www.tibiawiki.com.br/wiki/Star_Herb",
                "image": "https://www.tibiawiki.com.br/images/c/c5/Star_Herb.gif"
            },
            "Carrot": {
                "link": "https://www.tibiawiki.com.br/wiki/Carrot",
                "image": "https://www.tibiawiki.com.br/images/b/b5/Carrot.gif"
            },
            "Corncob": {
                "link": "https://www.tibiawiki.com.br/wiki/Corncob",
                "image": "https://www.tibiawiki.com.br/images/9/9b/Corncob.gif"
            },
            "Cheese": {
                "link": "https://www.tibiawiki.com.br/wiki/Cheese",
                "image": "https://www.tibiawiki.com.br/images/6/6a/Cheese.gif"
            },
            "White Mushroom": {
                "link": "https://www.tibiawiki.com.br/wiki/White_Mushroom",
                "image": "https://www.tibiawiki.com.br/images/e/ed/White_Mushroom.gif"
            },
            "Brown Mushroom": {
                "link": "https://www.tibiawiki.com.br/wiki/Brown_Mushroom",
                "image": "https://www.tibiawiki.com.br/images/e/ef/Brown_Mushroom.gif"
            },
            "Shadow Herb": {
                "link": "https://www.tibiawiki.com.br/wiki/Shadow_Herb",
                "image": "https://www.tibiawiki.com.br/images/1/15/Shadow_Herb.gif"
            },
            "Mead": {
                "link": "https://www.tibiawiki.com.br/wiki/Mead",
                "image": "https://www.tibiawiki.com.br/images/c/c1/Mead.gif"
            },
            "Ham": {
                "link": "https://www.tibiawiki.com.br/wiki/Ham",
                "image": "https://www.tibiawiki.com.br/images/e/e8/Ham.gif"
            },
            "Plum": {
                "link": "https://www.tibiawiki.com.br/wiki/Plum",
                "image": "https://www.tibiawiki.com.br/images/4/48/Plum.gif"
            },
            "Beetroot": {
                "link": "https://www.tibiawiki.com.br/wiki/Beetroot",
                "image": "https://www.tibiawiki.com.br/images/f/f0/Beetroot.gif"
            },
            "Pumpkin": {
                "link": "https://www.tibiawiki.com.br/wiki/Pumpkin",
                "image": "https://www.tibiawiki.com.br/images/c/cc/Pumpkin.gif"
            },
            "Northern Pike": {
                "link": "https://www.tibiawiki.com.br/wiki/Northern_Pike",
                "image": "https://www.tibiawiki.com.br/images/8/83/Northern_Pike.gif"
            },
            "Rainbow Trout": {
                "link": "https://www.tibiawiki.com.br/wiki/Rainbow_Trout",
                "image": "https://www.tibiawiki.com.br/images/5/51/Rainbow_Trout.gif"
            },
            "Green Perch": {
                "link": "https://www.tibiawiki.com.br/wiki/Green_Perch",
                "image": "https://www.tibiawiki.com.br/images/2/27/Green_Perch.gif"
            },
            "Shrimp": {
                "link": "https://www.tibiawiki.com.br/wiki/Shrimp",
                "image": "https://www.tibiawiki.com.br/images/8/8c/Shrimp.gif"
            },
            "Roll": {
                "link": "https://www.tibiawiki.com.br/wiki/Roll",
                "image": "https://www.tibiawiki.com.br/images/8/8f/Roll.gif"
            },
            "Fern": {
                "link": "https://www.tibiawiki.com.br/wiki/Fern",
                "image": "https://www.tibiawiki.com.br/images/5/5c/Fern.gif"
            },
            "Cookie": {
                "link": "https://www.tibiawiki.com.br/wiki/Cookie",
                "image": "https://www.tibiawiki.com.br/images/4/42/Cookie.gif"
            },
            "Peanut": {
                "link": "https://www.tibiawiki.com.br/wiki/Peanut",
                "image": "https://www.tibiawiki.com.br/images/4/43/Peanut.gif"
            },
            "Rice Ball": {
                "link": "https://www.tibiawiki.com.br/wiki/Rice_Ball",
                "image": "https://www.tibiawiki.com.br/images/0/00/Rice_Ball.gif"
            },
            "Sandcrawler Shell": {
                "link": "https://www.tibiawiki.com.br/wiki/Sandcrawler_Shell",
                "image": "https://www.tibiawiki.com.br/images/6/65/Sandcrawler_Shell.gif"
            },
            "Water": {
                "link": "https://www.tibiawiki.com.br/wiki/Water",
                "image": "https://www.tibiawiki.com.br/images/6/6a/Water_%28L%C3%ADquido%29.gif"
            },
            "Candy": {
                "link": "https://www.tibiawiki.com.br/wiki/Candy",
                "image": "https://www.tibiawiki.com.br/images/a/a7/Candy.gif"
            },
            "Candy Cane": {
                "link": "https://www.tibiawiki.com.br/wiki/Candy_Cane",
                "image": "https://www.tibiawiki.com.br/images/0/0d/Candy_Cane.gif"
            },
            "Gingerbreadman": {
                "link": "https://www.tibiawiki.com.br/wiki/Gingerbreadman",
                "image": "https://www.tibiawiki.com.br/images/4/4e/Gingerbreadman.gif"
            },
            "Flask of Demonic Blood": {
                "link": "https://www.tibiawiki.com.br/wiki/Flask_of_Demonic_Blood",
                "image": "https://www.tibiawiki.com.br/images/8/8c/Flask_of_Demonic_Blood.gif"
            },
            "Honeycomb": {
                "link": "https://www.tibiawiki.com.br/wiki/Honeycomb",
                "image": "https://www.tibiawiki.com.br/images/3/3e/Honeycomb.gif"
            },
            "Bottle of Bug Milk": {
                "link": "https://www.tibiawiki.com.br/wiki/Bottle_of_Bug_Milk",
                "image": "https://www.tibiawiki.com.br/images/e/e6/Bottle_of_Bug_Milk.gif"
            },
            "Bottle of Bug Milk": {
                "link": "https://www.tibiawiki.com.br/wiki/Bottle_of_Bug_Milk",
                "image": "https://www.tibiawiki.com.br/images/e/e6/Bottle_of_Bug_Milk.gif"
            },
            "Blessed Wooden Stake": {
                "link": "https://www.tibiawiki.com.br/wiki/Blessed_Wooden_Stake",
                "image": "https://www.tibiawiki.com.br/images/7/75/Blessed_Wooden_Stake.gif"
            }
         }
         }
        selectedOptions[0].value = name;
        const id = parseInt(component.getAttribute('selected-player-id')) + 1;
        selectedOptions[0].innerText = (id.toString()).concat(': ').concat(name);


         const foods = [
         updateSelectedPlayerLabel(name);
            {
    }
                "name": "Rotworm Stew",
                "link": "https://www.tibiawiki.com.br/wiki/Rotworm_Stew",
                "image": "https://www.tibiawiki.com.br/images/7/7a/Rotworm_Stew.gif",
                "ingredients": [
                    {
                        "name": "Meat",
                        "quantity": 2
                    },
                    {
                        "name": "Potato",
                        "quantity": 20
                    },
                    {
                        "name": "Onion",
                        "quantity": 1
                    },
                    {
                        "name": "Bulb of Garlic",
                        "quantity": 1
                    },
                    {
                        "name": "Flour",
                        "quantity": 5
                    },
                    {
                        "name": "Beer",
                        "quantity": 2
                    }
                ]
            },
            {
                "name": "Hydra Tongue",
                "link": "https://www.tibiawiki.com.br/wiki/Hydra_Tongue",
                "image": "https://www.tibiawiki.com.br/images/d/d3/Hydra_Tongue_Salad.gif",
                "ingredients": [
                    {
                        "name": "Hydra Tongue",
                        "quantity": 2
                    },
                    {
                        "name": "Tomato",
                        "quantity": 2
                    },
                    {
                        "name": "Cucumber",
                        "quantity": 1
                    },
                    {
                        "name": "Egg",
                        "quantity": 2
                    },
                    {
                        "name": "Troll Green",
                        "quantity": 1
                    },
                    {
                        "name": "Wine",
                        "quantity": 1
                    }
                ]
            },
            {
                "name": "Roasted Dragon Wings",
                "link": "https://www.tibiawiki.com.br/wiki/Roasted_Dragon_Wings",
                "image": "https://www.tibiawiki.com.br/images/e/ed/Roasted_Dragon_Wings.gif",
                "ingredients": [
                    {
                        "name": "Bat",
                        "quantity": 1
                    },
                    {
                        "name": "Jalapeño Pepper",
                        "quantity": 3
                    },
                    {
                        "name": "Brown Bread",
                        "quantity": 5
                    },
                    {
                        "name": "Egg",
                        "quantity": 2
                    },
                    {
                        "name": "Powder Herb",
                        "quantity": 1
                    },
                    {
                        "name": "Red Mushroom",
                        "quantity": 5
                    }
                ]
            },
            {
                "name": "Tropical Fried Terrorbird",
                "link": "https://www.tibiawiki.com.br/wiki/Tropical_Fried_Terrorbird",
                "image": "https://www.tibiawiki.com.br/images/0/02/Tropical_Fried_Terrorbird.gif",
                "ingredients": [
                    {
                        "name": "Chicken",
                        "quantity": 1
                    },
                    {
                        "name": "Lemon",
                        "quantity": 2
                    },
                    {
                        "name": "Orange",
                        "quantity": 2
                    },
                    {
                        "name": "Mango",
                        "quantity": 2
                    },
                    {
                        "name": "Coconut Milk",
                        "quantity": 2
                    },
                    {
                        "name": "Stone Herb",
                        "quantity": 1
                    }
                ]
            },
            {
                "name": "Banana Chocolate Shake",
                "link": "https://www.tibiawiki.com.br/wiki/Banana_Chocolate_Shake",
                "image": "https://www.tibiawiki.com.br/images/c/c7/Banana_Chocolate_Shake.gif",
                "ingredients": [
                    {
                        "name": "Bar of Chocolate",
                        "quantity": 1
                    },
                    {
                        "name": "Cream Cake",
                        "quantity": 1
                    },
                    {
                        "name": "Banana",
                        "quantity": 2
                    },
                    {
                        "name": "Milk",
                        "quantity": 2
                    },
                    {
                        "name": "Sling Herb",
                        "quantity": 1
                    },
                    {
                        "name": "Star Herb",
                        "quantity": 1
                    }
                ]
            },
            {
                "name": "Veggie Casserole",
                "link": "https://www.tibiawiki.com.br/wiki/Veggie_Casserole",
                "image": "https://www.tibiawiki.com.br/images/d/d9/Veggie_Casserole.gif",
                "ingredients": [
                    {
                        "name": "Carrot",
                        "quantity": 2
                    },
                    {
                        "name": "Tomato",
                        "quantity": 2
                    },
                    {
                        "name": "Corncob",
                        "quantity": 2
                    },
                    {
                        "name": "Cucumber",
                        "quantity": 2
                    },
                    {
                        "name": "Onion",
                        "quantity": 1
                    },
                    {
                        "name": "Bulb of Garlic",
                        "quantity": 1
                    },
                    {
                        "name": "Cheese",
                        "quantity": 1
                    },
                    {
                        "name": "White Mushroom",
                        "quantity": 20
                    },
                    {
                        "name": "Brown Mushroom",
                        "quantity": 5
                    }
                ]
            },
            {
                "name": "Filled Jalapeño Peppers",
                "link": "https://www.tibiawiki.com.br/wiki/Filled_Jalapeño_Peppers",
                "image": "https://www.tibiawiki.com.br/images/f/f2/Filled_Jalape%C3%B1o_Peppers.gif",
                "ingredients": [
                    {
                        "name": "Jalapeño Pepper",
                        "quantity": 10
                    },
                    {
                        "name": "Cheese",
                        "quantity": 2
                    },
                    {
                        "name": "Troll Green",
                        "quantity": 1
                    },
                    {
                        "name": "Shadow Herb",
                        "quantity": 1
                    },
                    {
                        "name": "Mead",
                        "quantity": 1
                    },
                    {
                        "name": "Egg",
                        "quantity": 2
                    }
                ]
            },
            {
                "name": "Blessed Steak",
                "link": "https://www.tibiawiki.com.br/wiki/Blessed_Steak",
                "image": "https://www.tibiawiki.com.br/images/a/a2/Blessed_Steak.gif",
                "ingredients": [
                    {
                        "name": "Ham",
                        "quantity": 1
                    },
                    {
                        "name": "Plum",
                        "quantity": 5
                    },
                    {
                        "name": "Onion",
                        "quantity": 1
                    },
                    {
                        "name": "Beetroot",
                        "quantity": 2
                    },
                    {
                        "name": "Pumpkin",
                        "quantity": 1
                    },
                    {
                        "name": "Jalapeño Pepper",
                        "quantity": 2
                    }
                ]
            },
            {
                "name": "Northern Fishburger",
                "link": "https://www.tibiawiki.com.br/wiki/Northern_Fishburger",
                "image": "https://www.tibiawiki.com.br/images/d/df/Northern_Fishburger.gif",               
                "ingredients": [
                    {
                        "name": "Northern Pike",
                        "quantity": 1
                    },
                    {
                        "name": "Rainbow Trout",
                        "quantity": 1
                    },
                    {
                        "name": "Green Perch",
                        "quantity": 1
                    },
                    {
                        "name": "Shrimp",
                        "quantity": 5
                    },
                    {
                        "name": "Roll",
                        "quantity": 2
                    },
                    {
                        "name": "Fern",
                        "quantity": 1
                    }
                ]
            },
            {
                "name": "Carrot Cake",
                "link": "https://www.tibiawiki.com.br/wiki/Carrot_Cake",
                "image": "https://www.tibiawiki.com.br/images/9/95/Carrot_Cake.gif",
                "ingredients": [
                    {
                        "name": "Carrot",
                        "quantity": 5
                    },
                    {
                        "name": "Milk",
                        "quantity": 1
                    },
                    {
                        "name": "Lemon",
                        "quantity": 1
                    },
                    {
                        "name": "Flour",
                        "quantity": 10
                    },
                    {
                        "name": "Egg",
                        "quantity": 2
                    },
                    {
                        "name": "Cookie",
                        "quantity": 10
                    },
                    {
                        "name": "Peanut",
                        "quantity": 2
                    }
                ]
            },
            {
                "name": "Coconut Shrimp Bake",
                "link": "https://www.tibiawiki.com.br/wiki/Coconut_Shrimp_Bake",
                "image": "https://www.tibiawiki.com.br/images/d/d1/Coconut_Shrimp_Bake.gif",
                "ingredients": [
                    {
                        "name": "Coconut Milk",
                        "quantity": 5
                    },
                    {
                        "name": "Brown Mushroom",
                        "quantity": 5
                    },
                    {
                        "name": "Red Mushroom",
                        "quantity": 5
                    },
                    {
                        "name": "Rice Ball",
                        "quantity": 10
                    },
                    {
                        "name": "Shrimp",
                        "quantity": 10
                    }
                ]
            },
            {
                "name": "Pot of Blackjack",
                "link": "https://www.tibiawiki.com.br/wiki/Pot_of_Blackjack",
                "image": "https://www.tibiawiki.com.br/images/1/1b/Pot_of_Blackjack.gif",
                "ingredients": [
                    {
                        "name": "Sandcrawler Shell",
                        "quantity": 5
                    },
                    {
                        "name": "Water",
                        "quantity": 2
                    },
                    {
                        "name": "Carrot",
                        "quantity": 20
                    },
                    {
                        "name": "Potato",
                        "quantity": 10
                    },
                    {
                        "name": "Jalapeño Pepper",
                        "quantity": 3
                    }
                ]
            },
            {
                "name": "Demonic Candy Balls",
                "link": "https://www.tibiawiki.com.br/wiki/Demonic_Candy_Balls",
                "image": "https://www.tibiawiki.com.br/images/1/19/Demonic_Candy_Ball.gif",
                "ingredients": [
                    {
                        "name": "Candy",
                        "quantity": 3
                    },
                    {
                        "name": "Candy Cane",
                        "quantity": 3
                    },
                    {
                        "name": "Bar of Chocolate",
                        "quantity": 2
                    },
                    {
                        "name": "Gingerbreadman",
                        "quantity": 15
                    },
                    {
                        "name": "Flask of Demonic Blood",
                        "quantity": 1
                    }
                ]
            },
            {
                "name": "Sweet Mangonaise Elixir",
                "link": "https://www.tibiawiki.com.br/wiki/Sweet_Mangonaise_Elixir",
                "image": "https://www.tibiawiki.com.br/images/f/f3/Sweet_Mangonaise_Elixir.gif",
                "ingredients": [
                    {
                        "name": "Egg",
                        "quantity": 40
                    },
                    {
                        "name": "Mango",
                        "quantity": 20
                    },
                    {
                        "name": "Honeycomb",
                        "quantity": 10
                    },
                    {
                        "name": "Bottle of Bug Milk",
                        "quantity": 1
                    },
                    {
                        "name": "Blessed Wooden Stake",
                        "quantity": 1
                    }
                ]
            }
        ];
        const selectedFoods = [];
        // Popula o Select de Items.
        var populateFoodSelect = () => {
            $("#foodSelect").empty();


            if (foods != null) { // Verifica se a lista de itens não é nula
    var updateSelectedPlayerLabel = (name) => {
                let id = 0;
        const labelComponents = document.getElementsByClassName('hot-cuisine-selected-player-label');
                $("#foodSelect").append("<div style=\"margin-top: 5px; height: 20px; margin-bottom: 5px; display: flex; align-items: center; justify-content: center; width: fit-content;\"><input type=\"checkbox\" id=\"food-00\" name=\"all-food\" value=\"all-food\" checked=\"true\" onchange=\"selectAllFoods(this)\"><label for=\"food-00\">Select All Foods</label></div><br><br>");
        if (labelComponents != null && Object.keys(labelComponents).length === 1) {
                foods.forEach( (item) => {
            labelComponents[0].innerText = "Player: ".concat(name);
                    $("#foodSelect").append("<div style=\"margin-top: 5px; height: 5px; margin-bottom: 5px; display: flex; align-items: center; justify-content: center; width: fit-content;\"><input type=\"checkbox\" id=\"food-" + id + "\" name=\"" + item.name + "\" value=\"" + item.name + "\" checked=\"true\" onchange=\"updateIngredients(this)\"><img style=\"width: 25px; height 25px;\" src=\""+ item.image + "\"/><label for=\"food-" + id + "\"> " + item.name + "</label></div><br>");
        }
                    id++;
    }
                    selectedFoods.push(item);
                });
                updateIngredientsGreed();
            }
        };


        var selectAllFoods = (checkbox) => {
    var changePlayerDataOptions = (component, type) => {
            clearArray(selectedFoods);
        const playerIndex = getSelectedPlayerIndex();
             let index = 0;
        if (type === 'first-time') {
             foods.forEach(() => {
             players[playerIndex].isFirstTime = component.checked;
                 let ckb = document.getElementById("food-" + index);
             Object.keys(players[playerIndex].foods).forEach(foodName => {
                ckb.checked = checkbox.checked;
                 players[playerIndex].foods[foodName].quantity = (isFirstTime()) ? 2 : 1;
                updateIngredients(ckb);
                index++;
             });
             });
         }
         }
        if (type === 'player-done') {
            players[playerIndex].isDone = component.checked;
        }
        updateSavedPlayers();
    }
    var loadFoodsList = (completion) => {
        const components = document.getElementsByClassName('hot-cuisine-foods-list');
        if (components == null || Object.keys(components).length === 0) {
            showAlert();
            return;
        }
        const divFoodList = components[0];
        divFoodList.innerHTML = "";
        for(let i = 0; i < foods.length; i++) {
            const itemList = createFoodItemList(foods[i], i);
            divFoodList.appendChild(itemList);
        }
        if (completion) {
            completion();
        }
    }
    var createFoodItemList = (food, index) => {
        const div = document.createElement('div');
        div.classList.add("hot-cuisine-foods-list-item");
        const checkbox = document.createElement('input');
        checkbox.setAttribute('type', 'checkbox');
        checkbox.setAttribute('id', 'food-'.concat(index));
        checkbox.addEventListener('change', function () {
            setSelectedPlayerFood(food, checkbox);
            selectFoodUpdateComponents(checkbox);
        });
        const img = document.createElement('img');
        img.setAttribute('src', food.image);
        const label = document.createElement('label');
        label.setAttribute('for', 'food-'.concat(index));
        label.innerText = food.name;
        div.appendChild(checkbox);
        div.appendChild(img);
        div.appendChild(label);
        return div;
    }
    var setSelectedPlayerFood = (food, component) => {
        const playerIndex = getSelectedPlayerIndex();
        if (component.checked) {
            food.quantity = isFirstTime() ? 2 : 1;
            players[playerIndex].foods[food.name] = food;
        } else {
            delete(players[playerIndex].foods[food.name]);
        }
        updateSavedPlayers();
    }
    var selectFoodUpdateComponents = (component) => {
        const checkboxSelectAll = document.getElementById('hot-cuisine-checkbox-select-all-food');
        const checkboxFirstTime = document.getElementById('hot-cuisine-checkbox-first-time');
        checkboxSelectAll.checked = false;
        checkboxFirstTime.checked = false;
        loadSelecedPlayerFoods();
    }
    var updateFoodsCheckboxComponents = () => {
        for(let i = 0; i < foods.length; i++) {
            const checked = (players[getSelectedPlayerIndex()].foods[foods[i].name]) ? true : false;
            document.getElementById('food-'.concat(i)).checked = checked; 
        }
        const checkboxSelectAllFood = document.getElementById('hot-cuisine-checkbox-select-all-food');
        checkboxSelectAllFood.checked = foods.length === Object.keys(players[getSelectedPlayerIndex()].foods).length;
    }
    var createPlayerSelectedFoodsItem = (food) => {
        const divBox = document.createElement('div');
        divBox.classList.add('hot-cuisine-selected-player-foods-item-box');
        const divBoxHeader = document.createElement('div');
        divBoxHeader.classList.add('hot-cuisine-selected-player-foods-item-box-header');
        const img = document.createElement('img');
        img.setAttribute('src', food.image);


         var updateIngredients = (checkbox) => {
         const label = document.createElement('label');
             let food = foods.find(food => food.name == checkbox.value);
        label.innerText = food.name;
             if (checkbox.checked) {
 
                selectedFoods.push(food);
        const divBoxQuantityToggle = document.createElement('div');
            } else {
 
                let index = selectedFoods.map(sFood => sFood.name).indexOf(food.name);
        const inputQuantity = document.createElement('input');
                 if (index > -1) { // only splice array when item is found
        inputQuantity.setAttribute('type', 'number');
                     selectedFoods.splice(index, 1); // 2nd parameter means remove one item only
        inputQuantity.setAttribute('min', 1);
        inputQuantity.setAttribute('max', 2);
        inputQuantity.value = food.quantity;
        inputQuantity.addEventListener('change', function () {
            updateFoodQuantity(inputQuantity, food);
            updateFoodQuantityComponents(inputQuantity, food);
        });
 
        const iBtn = document.createElement('i');
        iBtn.innerHTML = `<svg width="20px" height="20px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                    <path d="M5.70711 9.71069C5.31658 10.1012 5.31658 10.7344 5.70711 11.1249L10.5993 16.0123C11.3805 16.7927 12.6463 16.7924 13.4271 16.0117L18.3174 11.1213C18.708 10.7308 18.708 10.0976 18.3174 9.70708C17.9269 9.31655 17.2937 9.31655 16.9032 9.70708L12.7176 13.8927C12.3271 14.2833 11.6939 14.2832 11.3034 13.8927L7.12132 9.71069C6.7308 9.32016 6.09763 9.32016 5.70711 9.71069Z" fill="#0F0F0F"/>
                </svg>`;
        iBtn.addEventListener('click', function () {
             toggleIngredients(food, iBtn);
        });
 
        divBoxQuantityToggle.appendChild(inputQuantity);
        divBoxQuantityToggle.appendChild(iBtn);
 
        divBoxHeader.appendChild(img);
        divBoxHeader.appendChild(label);
        divBoxHeader.appendChild(divBoxQuantityToggle);
 
        const divBoxIngredients = createPlayerSelectedFoodsIngredientsList(food);
 
        divBox.appendChild(divBoxHeader);
        divBox.appendChild(divBoxIngredients);
 
        return divBox;
    }
 
    var createPlayerSelectedFoodsIngredientsList = (food) => {
 
        const divList = document.createElement('div');
        divList.id = 'ingrendients-food-'.concat(food.name.toLowerCase().replaceAll(' ', '-'));
        divList.classList.add('hot-cuisine-selected-player-foods-item-box-ingredients');
 
        food.ingredients.forEach(ingredient => {
            const ingredientDiv = createPlayerSelectedFoodsIngredientsListItem(ingredient, food.quantity);
             divList.appendChild(ingredientDiv);
        });
 
        return divList;
    }
 
    var createPlayerSelectedFoodsIngredientsListItem = (ingredient, foodQuantity) => {
 
        const divItem = document.createElement('div');
        divItem.classList.add('hot-cuisine-selected-player-foods-ingredients-box');
 
        const divImage = document.createElement('div');
        divImage.classList.add('img-quantity');
 
        const img = document.createElement('img');
        img.setAttribute('src', ingredientes[ingredient.name].image);
        img.setAttribute('alt', ingredient.name);
 
        const labelQuantity = document.createElement('label');
        labelQuantity.innerText = ingredient.quantity * foodQuantity;
 
        const lanelName = document.createElement('label');
        lanelName.innerText = ingredient.name;
 
        divImage.appendChild(img);
        divImage.appendChild(labelQuantity);
 
        divItem.appendChild(divImage);
        divItem.appendChild(lanelName);
 
        return divItem;
    }
 
    var selectAllFood = (component) => {
        const playerSelectedIndex = getSelectedPlayerIndex();
 
        if (component.checked) {
            foods.forEach(food => {
                const playerFood = { ...food };
                 if (players[playerSelectedIndex].foods[food.name] == null) {
                     playerFood.quantity = (isFirstTime()) ? 2 : 1;
                    players[playerSelectedIndex].foods[food.name] = playerFood;
                 }
                 }
             }
             });
             updateIngredientsGreed();
        } else {
            players[playerSelectedIndex].foods = new Object();
        }
        updateSavedPlayers();
    }
 
    var selectAllFoodUpdateComponents = (component) => {
        for (let i = 0; i< foods.length; i++) {
            document.getElementById('food-'.concat(i)).checked = component.checked;
        }
        loadSelecedPlayerFoods();
    }
 
    var updateFoodQuantity = (component, food) => {
        let quantity = component.value || 1;
        if (quantity < 1) {
            quantity = 1;
        }
        if (quantity > 2) {
            quantity = 2;
        }
        players[getSelectedPlayerIndex()].foods[food.name].quantity = quantity;
 
        updateSavedPlayers();
    }
 
    var loadAllIngredients = () => {
        const components = document.getElementsByClassName('hot-cuisine-all-ingredients-list-items');
        if (components == null || Object.keys(components).length === 0) {
            showAlert();
            return;
        }
        const component = components[0];
        component.innerHTML = "";
 
        const allIngredients = getAllInngredientsFromPlayers();
        Object.keys(allIngredients).forEach(ingredient => {
            const item = createIngredientsItemBox(allIngredients[ingredient]);
            component.appendChild(item);
        });
    }
 
    var createIngredientsItemBox = (ingredient) => {
 
        const divItem = document.createElement('div');
        divItem.classList.add('hot-cuisine-selected-player-foods-ingredients-box');
 
        const divImage = document.createElement('div');
        divImage.classList.add('img-quantity');
 
        const img = document.createElement('img');
        img.setAttribute('src', ingredientes[ingredient.name].image);
        img.setAttribute('alt', ingredient.name);
 
        const labelQuantity = document.createElement('label');
        labelQuantity.innerText = ingredient.quantity;
 
        const labelName = document.createElement('label');
        labelName.innerText = ingredient.name;
 
        const buttonRemove = document.createElement('button');
        buttonRemove.setAttribute('title', 'Remover Ingrediente da Lista.');
        buttonRemove.innerText = '✕';
        buttonRemove.addEventListener('click', function () {
             removeItemFromIngredientsList(divItem);
        });
 
        divImage.appendChild(img);
        divImage.appendChild(labelQuantity);
 
        divItem.appendChild(divImage);
        divItem.appendChild(labelName);
        divItem.appendChild(buttonRemove);
 
        return divItem;
    }
 
    var removeItemFromIngredientsList = (component) => {
        component.style.display = 'none';
    }
 
    var updateFoodQuantityComponents = (component, food) => {
        const divId = food.name.toLowerCase().replaceAll(' ', '-');
        const bodyDiv = document.getElementById('ingrendients-food-'.concat(divId));
 
        for(let i = 0; i < food.ingredients.length; i++) {
            bodyDiv.children[i].children[0].children[1].innerText = food.ingredients[i].quantity * component.value;
         }
         }
          
         loadAllIngredients();
         var updateQuantity = () => {
    }
             updateIngredientsGreed();
 
    var toggleIngredients = (food, btn) => {
        const divId = food.name.toLowerCase().replaceAll(' ', '-');
         const bodyDiv = document.getElementById('ingrendients-food-'.concat(divId));
 
        const currentDisplay = bodyDiv.style.display;
 
        bodyDiv.style.display = (currentDisplay === '' || currentDisplay === 'none') ? 'block' : 'none';
 
        const btnIcon = (bodyDiv.style.display === '' || bodyDiv.style.display === 'none') ? `<svg width="20px" height="20px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                    <path d="M5.70711 9.71069C5.31658 10.1012 5.31658 10.7344 5.70711 11.1249L10.5993 16.0123C11.3805 16.7927 12.6463 16.7924 13.4271 16.0117L18.3174 11.1213C18.708 10.7308 18.708 10.0976 18.3174 9.70708C17.9269 9.31655 17.2937 9.31655 16.9032 9.70708L12.7176 13.8927C12.3271 14.2833 11.6939 14.2832 11.3034 13.8927L7.12132 9.71069C6.7308 9.32016 6.09763 9.32016 5.70711 9.71069Z" fill="#0F0F0F"/>
                </svg>` : `<svg width="20px" height="20px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                    <path d="M18.2929 15.2893C18.6834 14.8988 18.6834 14.2656 18.2929 13.8751L13.4007 8.98766C12.6195 8.20726 11.3537 8.20757 10.5729 8.98835L5.68257 13.8787C5.29205 14.2692 5.29205 14.9024 5.68257 15.2929C6.0731 15.6835 6.70626 15.6835 7.09679 15.2929L11.2824 11.1073C11.673 10.7168 12.3061 10.7168 12.6966 11.1073L16.8787 15.2893C17.2692 15.6798 17.9024 15.6798 18.2929 15.2893Z" fill="#0F0F0F"/>
                </svg>`;
        btn.innerHTML = btnIcon;
    }
 
    var loadAllItens = async (completion) => {
        let baseURL = '';
        $('.hot-cuisine-loading label').text('Loading Imbuements and Itens for You, Adventurer!...');
        await Promise.all([
            loadData(baseURL, 'foods', 'HotCuisineFoods'),
            loadData(baseURL, 'ingredientes', 'HotCuisineIngredientes')
        ]).then((results) => {
             console.log("Load Done!");
            loadFoodsList();
            completion();
            $('.hot-cuisine-loading')[0].style.display = 'none';
        }).catch((error) => {
            showAlert();
            console.error('Error:', error);
        });
    }
 
    var loadData = async (baseURL, varName, path) => {
        return new Promise((resolve, reject) => {
            $.ajax({
                url: baseURL + '/index.php?title=Tibia_Wiki:' + path + '/json&action=raw',
                contentType: 'text/plain; charset=utf-8',
                type: 'GET',
                success: function(data) {
                    callbacks(data.replace(/<pre id="[^"]*">/gi, '').replace(/<\/pre>/gi, ''), varName);
                    resolve('Loaded: ' + varName);
                },
                error: function(error) {
                    // console.error(error);
                    reject(error);
                }
            });
        });
    }
 
    var showAlert = (message) => {
        alert(message || "Desculpe pela inconveniência!\n\nAlgo deu errado. Por favor, recarregue a página.");
    }
 
    var getSelectedPlayerIndex = () => {
        const playerSelected = players.find(player => player.selected);
        return players.indexOf(playerSelected);
    }
    var setSelectedPlayerIndex = (currentIndex) => {
        const beforeIndex = getSelectedPlayerIndex();
        if (beforeIndex > -1) {
            players[beforeIndex].selected = false;
         }
         }
        players[currentIndex].selected = true;
        updateSavedPlayers();
        return players[currentIndex];
    }


        var updateIngredientsGreed = () => {
    var getAllInngredientsFromPlayers = () => {
             let ingredientsList = {};
        const allIngredients = new Object();
             selectedFoods.forEach((food) => {
        players.forEach(player => {
                 food.ingredients.forEach((ingredient) => {
             const playerFoods = player.foods;
                     let mIngrediente = ingredientsList[ingredient.name];
             Object.keys(playerFoods).forEach(foodName => {
                     if (mIngrediente == null) {
                 playerFoods[foodName].ingredients.forEach(ingredient => {
                         ingredientsList[ingredient.name] = ingredient.quantity;
                    const food = playerFoods[foodName];
                    } else {
                     let quantity = ingredient.quantity;
                         ingredientsList[ingredient.name] = mIngrediente + ingredient.quantity;
                     if (food.quantity > 1) {
                         if (ingredient.name === 'Meat') {
                            console.log(quantity);
                        }
                         quantity += quantity;
                     }
                     }
                    if (allIngredients[ingredient.name] == null) {
                        allIngredients[ingredient.name] = new Object();
                        allIngredients[ingredient.name].name = ingredient.name;
                        allIngredients[ingredient.name].quantity = 0
                    }
                    allIngredients[ingredient.name].quantity = allIngredients[ingredient.name].quantity + quantity;
                 });
                 });
             });
             });
             updateList(ingredientsList);
        });
         };
        return allIngredients;
    }
 
    var showAllIngredients = (isShow) => {
        let contentHeight = document.getElementsByClassName('hot-cuisine-foods-list')[0].offsetHeight.toString().concat('px');
        if (isShow) {
             contentHeight = null;
        }
        document.getElementsByClassName('hot-cuisine-selected-player-foods-list')[0].style.height = contentHeight;
        document.getElementsByClassName('hot-cuisine-all-ingredients-list-items')[0].style.height = contentHeight;
        console.log(contentHeight);
        console.log(document.getElementsByClassName('hot-cuisine-selected-player-foods-list')[0].style.height);
         console.log(document.getElementsByClassName('hot-cuisine-all-ingredients-list-items')[0].style.height);
    }


        var updateList = (list) => {
    var isFirstTime = () => {
            let ingredientsListSorted = Object.entries(list).sort(([a,], [b,]) => {
        const playerIndex = getSelectedPlayerIndex();
                const nameA = a.toLowerCase();
        return players[playerIndex].isFirstTime;
                const nameB = b.toLowerCase();
    }


                if (nameA < nameB) {
    /* Players Hot Cuisine */
                    return -1;
    const hotCuisinePlayersKey = "tw-hot-cuisine-players";
                }
    var updateSavedPlayers = () => {
                if (nameA > nameB) {
        savePlayers();
                    return 1;
    }
                }
    var savePlayers = () => {
                return 0;
        let data = JSON.stringify(players);
            });
        localStorage.setItem(hotCuisinePlayersKey, data);
            document.getElementById("ingredients").innerHTML = "";
    }
            let quantity = (document.getElementById("first-time").checked) ? (Number(document.getElementById("qtdPlayers").value) * 2) : Number(document.getElementById("qtdPlayers").value);
 
            ingredientsListSorted.forEach((item) => {
    var getPlayers = () => {
                let key = item[0];
        const data = localStorage.getItem(hotCuisinePlayersKey);
                let value = item[1];
        if (data != null && data.length > 0) {
                $("#ingredients").append("<tr><td><div class=\"image-box\"><span class=\"tooltip\"><img style=\"width: 34px; height 34px;\" src=\""+ ingredients[key].image + "\" /></span><span class=\"tip2\" id=\"fonte3\"><a href=\"" + ingredients[key].link + "\" target=\"blank\">" + key + "</a></span></div><label class=\"quantity-box\">" + (Number(value) * quantity) + "</label></td><td style=\"width: 100%;\"><label class=\"title-box\"><a class=\"link-system\" href=\"" + ingredients[key].link + "\" target=\"blank\">" + key + "</a></label></td></tr>")
            let savedPlayers = JSON.parse(data);
             });
             return savedPlayers;
         }
         }
        return new Array();
    }


         var clearArray = (array) => {
    var deletePlayers = () => {
            while (array.length > 0) {
         localStorage.removeItem(hotCuisinePlayersKey);
                array.pop();
    }
             }
 
    var callbacks = (codigo, varName) => {
        if (codigo == null) {
            codigo = "";
        } else {
            console.log('Loaded:', varName);
             window[varName] = JSON.parse(codigo);
         }
         }
    }
    var deletAllPlayers = () => {
        deletePlayers();
        players = getPlayers();
        const quantityPlayersInput = document.getElementById('hot-cuisine-players-quantity-input');
        updateQuantityPlayersOnLoad();
        managerPlayerListOnComponent(quantityPlayersInput);
        loadSelecedPlayerFoods();
        updateFoodsCheckboxComponents();
    }
    var addEventListeners = () => {
        // Quantity Players
        const quantityPlayersInput = document.getElementById('hot-cuisine-players-quantity-input');
        quantityPlayersInput.addEventListener('input', () => {
            managerPlayerListOnComponent(quantityPlayersInput);
        });
        managerPlayerListOnComponent(quantityPlayersInput);
        const playerSelect = document.getElementById('hot-cuisine-players-list-select');
        playerSelect.addEventListener('change', function() {
            const player = selectPlayer(playerSelect);
            selectPlayerUpdateComponents(player);
            loadSelecedPlayerFoods();
            updateFoodsCheckboxComponents();
        }, false);
        loadSelecedPlayerFoods();
        updateFoodsCheckboxComponents();


         $(document).ready(function() {
         const inputPlayerName = document.getElementById('hot-cuisine-players-name-input');
             $("#title").text("Hot Cuisine Calculator System - " + version);
        inputPlayerName.addEventListener('input', () => {
             populateFoodSelect();
             changePlayerDataName(inputPlayerName);
             updatePlayerDataName(inputPlayerName);
         });
         });
        const isFirstTimeCheckbox = document.getElementById('hot-cuisine-checkbox-first-time');
        isFirstTimeCheckbox.addEventListener('change', function() {
            changePlayerDataOptions(isFirstTimeCheckbox, 'first-time');
            loadSelecedPlayerFoods();
        }, false);
        const isDoneCheckbox = document.getElementById('hot-cuisine-checkbox-player-done');
        isDoneCheckbox.addEventListener('change', function() {
            changePlayerDataOptions(isDoneCheckbox, 'player-done');
        }, false);
        const checkboxSelectAll = document.getElementById('hot-cuisine-checkbox-select-all-food');
        checkboxSelectAll.addEventListener('change', function() {
            selectAllFood(checkboxSelectAll);
            selectAllFoodUpdateComponents(checkboxSelectAll);
        }, false);
        const checkboxShowAllIngredients = document.getElementById('hot-cuisine-checkbox-select-show-all-ingredients');
        checkboxShowAllIngredients.addEventListener('change', function() {
            showAllIngredients(checkboxShowAllIngredients.checked);
        }, false);
    }
    $(document).ready(function () {
        loadAllItens(function () {
            loadFoodsList();
            players = getPlayers();
            updateQuantityPlayersOnLoad();
            addEventListeners();
        });
        const foodLists = document.getElementsByClassName('hot-cuisine-foods-list');
        const foodList = foodLists[0];
        /*const observer = new MutationObserver(function(mutationsList) {
          for (const mutation of mutationsList) {
              if (mutation.type === 'childList' && mutation.addedNodes.length > 0) {
                showAllIngredients(false);
              }
          }
        });*/
        const observer = new ResizeObserver(entries => {
            for (let entry of entries) {
                if (!isLoaded && document.getElementsByClassName('hot-cuisine-foods-list')[0].offsetHeight >= 370) {
                    isLoaded = true;
                    showAllIngredients(false);
                }
            }
        });
        observer.observe(foodList, { childList: true });
    });
</pre>
</pre>

Edição atual tal como às 02h27min de 5 de agosto de 2025

 <div class="hot-cuisine-panel">
    <div class="hot-cuisine-loading">
        <img src="https://www.tibiawiki.com.br/images/c/ce/The_Epic_Wisdom.gif" /><br />
        <label>Loading...</label>
        <span>@TibiaWiki</span>
    </div>
    <div class="hot-cuisine-players-panel">
        <h2>Hot Cuisine</h2>
        <div class="hot-cuisine-players-input-box">
            <label for="hot-cuisine-players-quantity-input">Quantidade de Personagens:</label>
            <input class="text-center" type="number" id="hot-cuisine-players-quantity-input" min="1" value="1">
        </div>
        <div class="hot-cuisine-players-list-box">
            <label for="hot-cuisine-players-list-select">Personagens:</label>
            <select id="hot-cuisine-players-list-select" type="text" size="10">
            </select>
        </div>
        <div class="hot-cuisine-players-input-box">
            <label for="hot-cuisine-players-name-input">Nome do Personagem:</label>
            <input type="text" id="hot-cuisine-players-name-input" value="Player 1" placeholder="Nome do Personagem...">
        </div>
        <div class="hot-cuisine-checkbox-boxes-flex">
            <div class="hot-cuisine-checkbox-box">
                <input id="hot-cuisine-checkbox-first-time" type="checkbox">
                <label for="hot-cuisine-checkbox-first-time">Primeira vez</label>
            </div>
            <div class="hot-cuisine-checkbox-box">
                <input id="hot-cuisine-checkbox-player-done" type="checkbox">
                <label for="hot-cuisine-checkbox-player-done">Terminado</label>
            </div>
        </div>
        <button onclick="deletAllPlayers()">deletar personagens</button>
    </div>
    <div class="hot-cuisine-foods-panel">
        <h2>Foods</h2>
        <div class="hot-cuisine-checkbox-box">
            <input id="hot-cuisine-checkbox-select-all-food" type="checkbox">
            <label for="hot-cuisine-checkbox-select-all-food">Selecionar todas as Foods</label>
        </div>
        <div class="hot-cuisine-foods-list">
        </div>
    </div>
    <div class="hot-cuisine-selected-player-foods-panel">
        <h2>Foods Selecionados</h2>
        <label class="hot-cuisine-selected-player-label">Player: </label>
        <div class="hot-cuisine-selected-player-foods-list">
        </div>
    </div>
    <div class="hot-cuisine-all-ingredients-list">
        <h2>Todos os Ingredientes</h2>
        <div class="hot-cuisine-checkbox-box">
            <input id="hot-cuisine-checkbox-select-show-all-ingredients" type="checkbox">
            <label for="hot-cuisine-checkbox-select-show-all-ingredients">Mostrar todos Ingredientes</label>
        </div>
        <div class="hot-cuisine-all-ingredients-list-items">
        </div>
    </div>
</div>
    .hot-cuisine-panel {
        display: flex;
        max-width: 1200px;
        /* max-height: 500px; */
        position: relative;
        border: 2px solid #a2a9b1;
        background: #ffffff;
        border-radius: 5px;
        -webkit-box-shadow: 0px 0px 10px 2px rgba(255, 255, 255, 1);
        -moz-box-shadow: 0px 0px 10px 2px rgba(255, 255, 255, 1);
        box-shadow: 0px 0px 10px 2px rgba(255, 255, 255, 1);
        font-family: Verdana, Arial, Times New Roman, sans-serif;
        font-size: 13px;
        color: black;
    }
    .hot-cuisine-loading {
        z-index: 9999;
        background-color: rgba(255, 255, 255, 0.98);
        display: inline-block;
        border-radius: 3px;
        position: absolute;
        height: 100%;
        width: 100%;
        top: 0;
        left: 0;
        align-content: center;
        text-align: center;
    }

    .hot-cuisine-loading > label {
        position: relative;
        bottom: 0px;
        text-align: center;     
        font-size: math;
        background: transparent;
    }
    .hot-cuisine-loading > span {
        text-align: center;
        align-content: center;
        background-color: #c7451d;
        height: 32px;
        width: 100%;
        position: absolute;
        bottom: 0px;
        left: 0px;
        text-align: center;     
        font-size: math;
        border-bottom-left-radius: 3px;
        border-bottom-right-radius: 3px;
    }
    .hot-cuisine-players-panel {
        background-color: #c7451d;
        width: 260px;
        border-top-left-radius: 3px;
        border-bottom-left-radius: 3px;
        padding: 10px 5px 5px 5px;
    }
    .hot-cuisine-players-panel > h2 {
        width: 100%;
        padding-bottom: 10px;
        text-align: center;
        color: white;
        border-bottom: 1px solid black;
        font-family: Verdana, Arial, Times New Roman, sans-serif;
    }
    .hot-cuisine-players-panel > .hot-cuisine-checkbox-boxes-flex {
        display: flex;
    }
    .hot-cuisine-players-panel > button {
        margin-top: 15px;
        width: 100%;
        height: 35px;
        font-weight: bold;
        border-radius: 5px;
        border: 1px solid #eae2e2;
    }
    .hot-cuisine-players-panel > button:hover {
        background-color: #eae2e2;
        border: 1px solid #eae2e2;
    }
    .hot-cuisine-players-input-box {
        height: 55px;
        margin-top: 5px;
    }
    .hot-cuisine-players-input-box > label {
        width: 100%;
        font-weight: bold;
        margin-left: 2px;
        color: white;
    }
    .hot-cuisine-players-input-box > input {
        width: 100%;
        height: 32px;
        margin-top: 5px;
        border: none;
        border-radius: 5px;
        font-weight: bold;
    }
    .hot-cuisine-players-input-box > input.text-center {
        text-align: center;
    }

    .hot-cuisine-players-list-box {
        width: 100%;
        margin-top: 5px;
    }
    .hot-cuisine-players-list-box > label {
        width: 100%;
        font-weight: bold;
        margin-left: 2px;
        color: white;
    }
    .hot-cuisine-players-list-box > select {
        width: 100%;
        margin-top: 5px;
        border: none;
        border-radius: 5px;
        padding: 5px;
    }

    .hot-cuisine-players-list-box > select > option {
        width: 100%;
        height: 15px;
        font-weight: bold;
        font-size: 12px;
    }
    .hot-cuisine-checkbox-box {
        width: 100%;
        margin-top: 10px;
        display: flex;
        align-items: center;
    }
    .hot-cuisine-checkbox-box > input {
        width: 20px;
        height: 20px;
        margin: 0px;
        border-radius: 5px;
        border: none;
    }
    .hot-cuisine-checkbox-box > label {
        height: 100%;
        margin-left: 5px;
        align-content: center;
        font-weight: bold;
    }
    .hot-cuisine-players-panel > div > .hot-cuisine-checkbox-box > label {
        color: #FFFFFF;
    }

    .hot-cuisine-foods-panel {
        width: 300px;
        margin: 5px 0px 5px 0px;
        padding: 5px;
        border-right: 1px solid #000000;
    }
    .hot-cuisine-foods-panel > h2 {
        width: 100%;
        text-align: center;
        padding-bottom: 10px;
        border-bottom: 1px solid #000000;
        font-family: Verdana, Arial, Times New Roman, sans-serif;
    }
    .hot-cuisine-foods-panel > .hot-cuisine-checkbox-box > label {
        color: black;
    }
    .hot-cuisine-foods-list {
        width: 100%;
        margin-top: 25px;
    }
    .hot-cuisine-foods-list-item {
        width: 100%;
        display: flex;
    }
    .hot-cuisine-foods-list-item {
        width: 100%;
        display: flex;
        align-content: center;
    }
    .hot-cuisine-foods-list-item > input {
        width: 20px;
        height: 20px;
    }
    .hot-cuisine-foods-list-item > img {
        width: 25px;
        height: 25px;
    }
    .hot-cuisine-foods-list-item > label {
        height: 100%;
        margin-left: 5px;
        align-self: center;
        font-weight: bold;
    }
    .hot-cuisine-selected-player-foods-panel {
        width: 340px;
        margin: 5px 0px 5px 0px;
        padding: 5px;
        border-right: 1px solid #000000;
    }
    .hot-cuisine-selected-player-foods-panel > h2 {
        width: 100%;
        text-align: center;
        padding-bottom: 10px;
        border-bottom: 1px solid #000000;
        font-family: Verdana, Arial, Times New Roman, sans-serif;
    }
    .hot-cuisine-selected-player-label {
        font-weight: bold;
    }
    .hot-cuisine-selected-player-foods-list {
        width: 100%;
        /* height: 365px; */
        margin-top: 25px;
        overflow: auto;
    }
    .hot-cuisine-selected-player-foods-item-box-header {
        width: 100%;
        height: 55px;
        display: flex;
        align-items: center;
        border-bottom: 1px solid #eae2e2;
        padding-bottom: 5px;
    }
    .hot-cuisine-selected-player-foods-item-box-header > img {
        width: 25px;
        height: 25px;
    }
    .hot-cuisine-selected-player-foods-item-box-header > label {
        height: 100%;
        width: 200px;
        margin-left: 5px;
        text-align: left;
        align-self: center;
        font-weight: bold;
        align-content: center;

    }
    .hot-cuisine-selected-player-foods-item-box-header > div {
        display: flex;
    }
    .hot-cuisine-selected-player-foods-item-box-header > div > input {
        height: 30px;
        width: 55px;
        margin-left: 5px;
        align-self: center;
        text-align: center;
        font-weight: bold;
        border: 1px solid #eae2e2;
        border-radius: 5px;
    }
    .hot-cuisine-selected-player-foods-item-box-header > div > i {
        display: block;
        height: 30px;
        width: 40px;
        align-self: center;
        align-content: center;
        text-align: center;
        font-size: 15px;
        font-weight: bold;
        border: none;
        background-color: transparent;
    }
    .hot-cuisine-selected-player-foods-ingredients-box {
        display: flex;
        flex-shrink: 0;
        width: calc(100% - 20px);
        height: 55px;
        margin: 10px;
        padding-bottom: 5px;
        border-bottom: 1px solid #eae2e2;
    }
    .hot-cuisine-selected-player-foods-ingredients-box > label {
        display: block;
        width: calc(100% - 85px);
        height: 55px;
        margin: 5px;
        font-weight: bold;
        text-align: center;
        align-content: center;
    }
    .hot-cuisine-selected-player-foods-ingredients-box > button {
        min-width: 30px;
        height: 30px;
        background-color: #c7451d;
        border: 1px solid #000000;
        border-radius: 5px;
        align-self: center;
        font-size: 15px;
        font-weight: bold;
        color: white;
    }
    .hot-cuisine-selected-player-foods-ingredients-box > button:hover {
        background-color: #ff0000;
        font-size: 20px;
        color: #ffbf00;
    }
    .hot-cuisine-selected-player-foods-ingredients-box > div.img-quantity {
        background-color: #f3f3f3;
        display: block;
        text-align: center;
        width: 50px;
        height: 55px;
        border: 1px solid #000000;
        border-radius: 5px;
    }
    .hot-cuisine-selected-player-foods-ingredients-box > div.img-quantity > img {
        margin-top: 4px;
    }
    .hot-cuisine-selected-player-foods-ingredients-box > div.img-quantity > label {
        display: block;
        background-color: #c7451d;
        text-align: center;
        /* margin-top: 4px; */
        width: 100%;
        height: 18px;
        border-top: 1px solid #000000;
        border-bottom-left-radius: 3px;
        border-bottom-right-radius: 3px;
        font-weight: bold;
    }
    .hot-cuisine-selected-player-foods-item-box-ingredients {
        display: none;
    }

    .hot-cuisine-all-ingredients-list  {
        width: 300px;
        margin: 5px 0px 5px 0px;
        padding: 5px;
    }
    .hot-cuisine-all-ingredients-list > h2 {
        width: 100%;
        text-align: center;
        padding-bottom: 10px;
        border-bottom: 1px solid #000000;
        font-family: Verdana, Arial, Times New Roman, sans-serif;
    }
    .hot-cuisine-all-ingredients-list-items {
        width: 100%;
        overflow: auto;
        margin-top: 25px;
    }
    var players = new Array();
    var isLoaded = false;
    var updateQuantityPlayersOnLoad = () => {
        const quantityPlayersInput = document.getElementById('hot-cuisine-players-quantity-input');
        quantityPlayersInput.value = players.length;
    }

    var managePlayerOnList = (value) => {
        if (players.length > value) {
            players.pop(players.length - value);
        }
        for (let i = 0; i < value; i++) {
            if (players.find(iPlayer => iPlayer.id === i) == null) {
                const player = {
                    "id": i,
                    "name": "Player ".concat(i + 1),
                    "isFirstTime": false,
                    "isDone": false,
                    "selected": false,
                    "foods": new Object()
                }
                players.push(player);
            }
        }
        let player = (getSelectedPlayerIndex() === -1) ? setSelectedPlayerIndex(0) : players[getSelectedPlayerIndex()];
        selectPlayerUpdateComponents(player);

        updateSavedPlayers();
    }

    var managerPlayerListOnComponent = (component) => {
        let quantity = parseInt(component.value || 1);
        if (quantity <= 0) {
            component.value = 1;
            quantity = 1;
        }
        managePlayerOnList(quantity);
        createPlayerOnListComponent();
    }

    var createPlayerOnListComponent = () => {
        const playerList = document.getElementById('hot-cuisine-players-list-select');
        if (playerList == null) {
            showAlert();
            return;
        }
        playerList.innerHTML = "";
        for (let i = 0; i < players.length; i++) {
            const option = createPlayerItemListCell(players[i]);
            playerList.appendChild(option);
        }
        if (playerList.children.length == null || playerList.children.length === 0) {
            showAlert();
            return;
        }
        const selectedPlayerIndex = getSelectedPlayerIndex();
        playerList.children[selectedPlayerIndex].setAttribute('selected', true);
    }

    var createPlayerItemListCell = (player) => {
        const option = new Option((player.id + 1).toString().concat(": ").concat(player.name), player.name);
        option.setAttribute('list-index', player.id);
        option.setAttribute('is-first-time', player.isFirstTime);

        return option;
    }

    var selectPlayer = (component) => {
        const listOptions = Array.from(document.getElementsByTagName('option'));
        const selectedOptions = listOptions.filter(op => op.value === component.value);
        if (selectedOptions == null || selectedOptions.length === 0) {
            showAlert();
            return;
        }
        const selectedOption = selectedOptions[0];
        return setSelectedPlayerIndex(selectedOption.getAttribute("list-index"));
    }
    var selectPlayerUpdateComponents = (player) => {
        // Update Componenents
        const inputPlayerName = document.getElementById('hot-cuisine-players-name-input');
        const isFirstTimeCheckbox = document.getElementById('hot-cuisine-checkbox-first-time');
        const isDoneCheckbox = document.getElementById('hot-cuisine-checkbox-player-done');

        inputPlayerName.value = player.name;
        inputPlayerName.setAttribute('selected-player-id', player.id);
        isFirstTimeCheckbox.checked = player.isFirstTime;
        isFirstTimeCheckbox.setAttribute('player-id', player.id);
        isDoneCheckbox.checked = player.isDone;
        isDoneCheckbox.setAttribute('player-id', player.id);

        updateSelectedPlayerLabel(player.name);
    }

    var loadSelecedPlayerFoods = () => {
        const components = document.getElementsByClassName('hot-cuisine-selected-player-foods-list');
        if (components == null || Object.keys(components).length === 0) {
            showAlert();
            return;
        }
        const listDiv = components[0];
        listDiv.innerHTML = "";

        const playerFoods = players[getSelectedPlayerIndex()].foods;
        Object.keys(playerFoods).forEach(foodName => {
            const food = playerFoods[foodName];
            const itemList = createPlayerSelectedFoodsItem(food);
            listDiv.appendChild(itemList);
        });

        loadAllIngredients();
    }

    var changePlayerDataName = (component) => {
        const name = component.value;
        players[getSelectedPlayerIndex()].name = name;

        updateSavedPlayers();
    }

    var updatePlayerDataName = (component) => {
        const name = component.value;

        const listOptions = Array.from(document.getElementsByTagName('option'));
        const selectedOptions = listOptions.filter(op => op.getAttribute('list-index') === component.getAttribute('selected-player-id'));
        if (selectedOptions == null || selectedOptions.length === 0) {
            showAlert();
            return;
        }
        selectedOptions[0].value = name;
        const id = parseInt(component.getAttribute('selected-player-id')) + 1;
        selectedOptions[0].innerText = (id.toString()).concat(': ').concat(name);

        updateSelectedPlayerLabel(name);
    }

    var updateSelectedPlayerLabel = (name) => {
        const labelComponents = document.getElementsByClassName('hot-cuisine-selected-player-label');
        if (labelComponents != null && Object.keys(labelComponents).length === 1) {
            labelComponents[0].innerText =  "Player: ".concat(name);
        }
    }

    var changePlayerDataOptions = (component, type) => {
        const playerIndex = getSelectedPlayerIndex();
        if (type === 'first-time') {
            players[playerIndex].isFirstTime = component.checked;
            Object.keys(players[playerIndex].foods).forEach(foodName => {
                players[playerIndex].foods[foodName].quantity = (isFirstTime()) ? 2 : 1;
            });
        }
        if (type === 'player-done') {
            players[playerIndex].isDone = component.checked;
        }
        updateSavedPlayers();
    }

    var loadFoodsList = (completion) => {
        const components = document.getElementsByClassName('hot-cuisine-foods-list');
        if (components == null || Object.keys(components).length === 0) {
            showAlert();
            return;
        }
        const divFoodList = components[0];
        divFoodList.innerHTML = "";
        for(let i = 0; i < foods.length; i++) {
            const itemList = createFoodItemList(foods[i], i);
            divFoodList.appendChild(itemList);
        }
        if (completion) {
            completion();
        }
    }

    var createFoodItemList = (food, index) => {
        const div = document.createElement('div');
        div.classList.add("hot-cuisine-foods-list-item");

        const checkbox = document.createElement('input');
        checkbox.setAttribute('type', 'checkbox');
        checkbox.setAttribute('id', 'food-'.concat(index));
        checkbox.addEventListener('change', function () {
            setSelectedPlayerFood(food, checkbox);
            selectFoodUpdateComponents(checkbox);
        });

        const img = document.createElement('img');
        img.setAttribute('src', food.image);

        const label = document.createElement('label');
        label.setAttribute('for', 'food-'.concat(index));
        label.innerText = food.name;

        div.appendChild(checkbox);
        div.appendChild(img);
        div.appendChild(label);

        return div;
    }

    var setSelectedPlayerFood = (food, component) => {
        const playerIndex = getSelectedPlayerIndex();
        if (component.checked) {
            food.quantity = isFirstTime() ? 2 : 1;
            players[playerIndex].foods[food.name] = food;
        } else {
            delete(players[playerIndex].foods[food.name]);
        }

        updateSavedPlayers();
    }

    var selectFoodUpdateComponents = (component) => {
        const checkboxSelectAll = document.getElementById('hot-cuisine-checkbox-select-all-food');
        const checkboxFirstTime = document.getElementById('hot-cuisine-checkbox-first-time');
        checkboxSelectAll.checked = false;
        checkboxFirstTime.checked = false;

        loadSelecedPlayerFoods();
    }

    var updateFoodsCheckboxComponents = () => {
        for(let i = 0; i < foods.length; i++) {
            const checked = (players[getSelectedPlayerIndex()].foods[foods[i].name]) ? true : false;
            document.getElementById('food-'.concat(i)).checked = checked;   
        }

        const checkboxSelectAllFood = document.getElementById('hot-cuisine-checkbox-select-all-food');
        checkboxSelectAllFood.checked = foods.length === Object.keys(players[getSelectedPlayerIndex()].foods).length;
    }

    var createPlayerSelectedFoodsItem = (food) => {
        const divBox = document.createElement('div');
        divBox.classList.add('hot-cuisine-selected-player-foods-item-box');

        const divBoxHeader = document.createElement('div');
        divBoxHeader.classList.add('hot-cuisine-selected-player-foods-item-box-header');

        const img = document.createElement('img');
        img.setAttribute('src', food.image);

        const label = document.createElement('label');
        label.innerText = food.name;

        const divBoxQuantityToggle = document.createElement('div');

        const inputQuantity = document.createElement('input');
        inputQuantity.setAttribute('type', 'number');
        inputQuantity.setAttribute('min', 1);
        inputQuantity.setAttribute('max', 2);
        inputQuantity.value = food.quantity;
        inputQuantity.addEventListener('change', function () {
            updateFoodQuantity(inputQuantity, food);
            updateFoodQuantityComponents(inputQuantity, food);
        });

        const iBtn = document.createElement('i');
        iBtn.innerHTML = `<svg width="20px" height="20px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                    <path d="M5.70711 9.71069C5.31658 10.1012 5.31658 10.7344 5.70711 11.1249L10.5993 16.0123C11.3805 16.7927 12.6463 16.7924 13.4271 16.0117L18.3174 11.1213C18.708 10.7308 18.708 10.0976 18.3174 9.70708C17.9269 9.31655 17.2937 9.31655 16.9032 9.70708L12.7176 13.8927C12.3271 14.2833 11.6939 14.2832 11.3034 13.8927L7.12132 9.71069C6.7308 9.32016 6.09763 9.32016 5.70711 9.71069Z" fill="#0F0F0F"/>
                </svg>`;
        iBtn.addEventListener('click', function () {
            toggleIngredients(food, iBtn);
        });

        divBoxQuantityToggle.appendChild(inputQuantity);
        divBoxQuantityToggle.appendChild(iBtn);

        divBoxHeader.appendChild(img);
        divBoxHeader.appendChild(label);
        divBoxHeader.appendChild(divBoxQuantityToggle);

        const divBoxIngredients = createPlayerSelectedFoodsIngredientsList(food);

        divBox.appendChild(divBoxHeader);
        divBox.appendChild(divBoxIngredients);

        return divBox;
    }

    var createPlayerSelectedFoodsIngredientsList = (food) => {

        const divList = document.createElement('div');
        divList.id = 'ingrendients-food-'.concat(food.name.toLowerCase().replaceAll(' ', '-'));
        divList.classList.add('hot-cuisine-selected-player-foods-item-box-ingredients');

        food.ingredients.forEach(ingredient => {
            const ingredientDiv = createPlayerSelectedFoodsIngredientsListItem(ingredient, food.quantity);
            divList.appendChild(ingredientDiv);
        });

        return divList;
    }

    var createPlayerSelectedFoodsIngredientsListItem = (ingredient, foodQuantity) => {

        const divItem = document.createElement('div');
        divItem.classList.add('hot-cuisine-selected-player-foods-ingredients-box');

        const divImage = document.createElement('div');
        divImage.classList.add('img-quantity');

        const img = document.createElement('img');
        img.setAttribute('src', ingredientes[ingredient.name].image);
        img.setAttribute('alt', ingredient.name);

        const labelQuantity = document.createElement('label');
        labelQuantity.innerText = ingredient.quantity * foodQuantity;

        const lanelName = document.createElement('label');
        lanelName.innerText = ingredient.name;

        divImage.appendChild(img);
        divImage.appendChild(labelQuantity);

        divItem.appendChild(divImage);
        divItem.appendChild(lanelName);

        return divItem;
    }

    var selectAllFood = (component) => {
        const playerSelectedIndex = getSelectedPlayerIndex();

        if (component.checked) {
            foods.forEach(food => {
                const playerFood = { ...food };
                if (players[playerSelectedIndex].foods[food.name] == null) {
                    playerFood.quantity = (isFirstTime()) ? 2 : 1;
                    players[playerSelectedIndex].foods[food.name] = playerFood;
                }
            });
        } else {
            players[playerSelectedIndex].foods = new Object();
        }
        updateSavedPlayers();
    }

    var selectAllFoodUpdateComponents = (component) => {
        for (let i = 0; i< foods.length; i++) {
            document.getElementById('food-'.concat(i)).checked = component.checked;
        }
        loadSelecedPlayerFoods();
    }

    var updateFoodQuantity = (component, food) => {
        let quantity = component.value || 1;
        if (quantity < 1) {
            quantity = 1;
        }
        if (quantity > 2) {
            quantity = 2;
        }
        players[getSelectedPlayerIndex()].foods[food.name].quantity = quantity;

        updateSavedPlayers();
    }

    var loadAllIngredients = () => {
        const components = document.getElementsByClassName('hot-cuisine-all-ingredients-list-items');
        if (components == null || Object.keys(components).length === 0) {
            showAlert();
            return;
        }
        const component = components[0];
        component.innerHTML = "";

        const allIngredients = getAllInngredientsFromPlayers();
        Object.keys(allIngredients).forEach(ingredient => {
            const item = createIngredientsItemBox(allIngredients[ingredient]);
            component.appendChild(item);
        });
    }

    var createIngredientsItemBox = (ingredient) => {

        const divItem = document.createElement('div');
        divItem.classList.add('hot-cuisine-selected-player-foods-ingredients-box');

        const divImage = document.createElement('div');
        divImage.classList.add('img-quantity');

        const img = document.createElement('img');
        img.setAttribute('src', ingredientes[ingredient.name].image);
        img.setAttribute('alt', ingredient.name);

        const labelQuantity = document.createElement('label');
        labelQuantity.innerText = ingredient.quantity;

        const labelName = document.createElement('label');
        labelName.innerText = ingredient.name;

        const buttonRemove = document.createElement('button');
        buttonRemove.setAttribute('title', 'Remover Ingrediente da Lista.');
        buttonRemove.innerText = '✕';
        buttonRemove.addEventListener('click', function () {
            removeItemFromIngredientsList(divItem);
        });

        divImage.appendChild(img);
        divImage.appendChild(labelQuantity);

        divItem.appendChild(divImage);
        divItem.appendChild(labelName);
        divItem.appendChild(buttonRemove);

        return divItem;
    }

    var removeItemFromIngredientsList = (component) => {
        component.style.display = 'none';
    }

    var updateFoodQuantityComponents = (component, food) => {
        const divId = food.name.toLowerCase().replaceAll(' ', '-');
        const bodyDiv = document.getElementById('ingrendients-food-'.concat(divId));

        for(let i = 0; i < food.ingredients.length; i++) {
            bodyDiv.children[i].children[0].children[1].innerText = food.ingredients[i].quantity * component.value;
        }
        loadAllIngredients();
    }

    var toggleIngredients = (food, btn) => {
        const divId = food.name.toLowerCase().replaceAll(' ', '-');
        const bodyDiv = document.getElementById('ingrendients-food-'.concat(divId));

        const currentDisplay = bodyDiv.style.display;

        bodyDiv.style.display = (currentDisplay === '' || currentDisplay === 'none') ? 'block' : 'none';

        const btnIcon = (bodyDiv.style.display === '' || bodyDiv.style.display === 'none') ? `<svg width="20px" height="20px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                    <path d="M5.70711 9.71069C5.31658 10.1012 5.31658 10.7344 5.70711 11.1249L10.5993 16.0123C11.3805 16.7927 12.6463 16.7924 13.4271 16.0117L18.3174 11.1213C18.708 10.7308 18.708 10.0976 18.3174 9.70708C17.9269 9.31655 17.2937 9.31655 16.9032 9.70708L12.7176 13.8927C12.3271 14.2833 11.6939 14.2832 11.3034 13.8927L7.12132 9.71069C6.7308 9.32016 6.09763 9.32016 5.70711 9.71069Z" fill="#0F0F0F"/>
                </svg>` : `<svg width="20px" height="20px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                    <path d="M18.2929 15.2893C18.6834 14.8988 18.6834 14.2656 18.2929 13.8751L13.4007 8.98766C12.6195 8.20726 11.3537 8.20757 10.5729 8.98835L5.68257 13.8787C5.29205 14.2692 5.29205 14.9024 5.68257 15.2929C6.0731 15.6835 6.70626 15.6835 7.09679 15.2929L11.2824 11.1073C11.673 10.7168 12.3061 10.7168 12.6966 11.1073L16.8787 15.2893C17.2692 15.6798 17.9024 15.6798 18.2929 15.2893Z" fill="#0F0F0F"/>
                </svg>`;
        btn.innerHTML = btnIcon;
    }

    var loadAllItens = async (completion) => {
        let baseURL = '';
        $('.hot-cuisine-loading label').text('Loading Imbuements and Itens for You, Adventurer!...');
        await Promise.all([
            loadData(baseURL, 'foods', 'HotCuisineFoods'),
            loadData(baseURL, 'ingredientes', 'HotCuisineIngredientes')
        ]).then((results) => {
            console.log("Load Done!");
            loadFoodsList();
            completion();
            $('.hot-cuisine-loading')[0].style.display = 'none';
        }).catch((error) => {
            showAlert();
            console.error('Error:', error);
        });
    }

    var loadData = async (baseURL, varName, path) => {
        return new Promise((resolve, reject) => {
            $.ajax({
                url: baseURL + '/index.php?title=Tibia_Wiki:' + path + '/json&action=raw',
                contentType: 'text/plain; charset=utf-8',
                type: 'GET',
                success: function(data) {
                    callbacks(data.replace(/<pre id="[^"]*">/gi, '').replace(/<\/pre>/gi, ''), varName);
                    resolve('Loaded: ' + varName);
                },
                error: function(error) {
                    // console.error(error);
                    reject(error);
                }
            });
        });
    }

    var showAlert = (message) => {
        alert(message || "Desculpe pela inconveniência!\n\nAlgo deu errado. Por favor, recarregue a página.");
    }

    var getSelectedPlayerIndex = () => {
        const playerSelected = players.find(player => player.selected);
        return players.indexOf(playerSelected);
    }
    var setSelectedPlayerIndex = (currentIndex) => {
        const beforeIndex = getSelectedPlayerIndex();
        if (beforeIndex > -1) {
            players[beforeIndex].selected = false;
        }
        players[currentIndex].selected = true;
        updateSavedPlayers();
        return players[currentIndex];
    }

    var getAllInngredientsFromPlayers = () => {
        const allIngredients = new Object();
        players.forEach(player => {
            const playerFoods = player.foods;
            Object.keys(playerFoods).forEach(foodName => {
                playerFoods[foodName].ingredients.forEach(ingredient => {
                    const food = playerFoods[foodName];
                    let quantity =  ingredient.quantity;
                    if (food.quantity > 1) {
                        if (ingredient.name === 'Meat') {
                            console.log(quantity);
                        }
                        quantity += quantity;
                    }
                    if (allIngredients[ingredient.name] == null) {
                        allIngredients[ingredient.name] = new Object();
                        allIngredients[ingredient.name].name = ingredient.name;
                        allIngredients[ingredient.name].quantity = 0
                    }
                    allIngredients[ingredient.name].quantity = allIngredients[ingredient.name].quantity + quantity;
                });
            });
        });
        return allIngredients;
    }

    var showAllIngredients = (isShow) => {
        let contentHeight = document.getElementsByClassName('hot-cuisine-foods-list')[0].offsetHeight.toString().concat('px');
        if (isShow) {
            contentHeight = null;
        }
        document.getElementsByClassName('hot-cuisine-selected-player-foods-list')[0].style.height = contentHeight;
        document.getElementsByClassName('hot-cuisine-all-ingredients-list-items')[0].style.height = contentHeight;
        console.log(contentHeight);
        console.log(document.getElementsByClassName('hot-cuisine-selected-player-foods-list')[0].style.height);
        console.log(document.getElementsByClassName('hot-cuisine-all-ingredients-list-items')[0].style.height);
    }

    var isFirstTime = () => {
        const playerIndex = getSelectedPlayerIndex();
        return players[playerIndex].isFirstTime;
    }

    /* Players Hot Cuisine */
    const hotCuisinePlayersKey = "tw-hot-cuisine-players";
    var updateSavedPlayers = () => {
        savePlayers();
    }
    var savePlayers = () => {
        let data = JSON.stringify(players);
        localStorage.setItem(hotCuisinePlayersKey, data);
    }

    var getPlayers = () => {
        const data = localStorage.getItem(hotCuisinePlayersKey);
        if (data != null && data.length > 0) {
            let savedPlayers = JSON.parse(data);
            return savedPlayers;
        }
        return new Array();
    }

    var deletePlayers = () => {
        localStorage.removeItem(hotCuisinePlayersKey);
    }

    var callbacks = (codigo, varName) => {
        if (codigo == null) {
            codigo = "";
        } else {
            console.log('Loaded:', varName);
            window[varName] = JSON.parse(codigo);
        }
    }

    var deletAllPlayers = () => {
        deletePlayers();
        players = getPlayers();
        const quantityPlayersInput = document.getElementById('hot-cuisine-players-quantity-input');
        updateQuantityPlayersOnLoad();
        managerPlayerListOnComponent(quantityPlayersInput);
        loadSelecedPlayerFoods();
        updateFoodsCheckboxComponents();
    }

    var addEventListeners = () => {
        // Quantity Players
        const quantityPlayersInput = document.getElementById('hot-cuisine-players-quantity-input');
        quantityPlayersInput.addEventListener('input', () => {
            managerPlayerListOnComponent(quantityPlayersInput);
        });
        managerPlayerListOnComponent(quantityPlayersInput);

        const playerSelect = document.getElementById('hot-cuisine-players-list-select');
        playerSelect.addEventListener('change', function() {
            const player = selectPlayer(playerSelect);
            selectPlayerUpdateComponents(player);
            loadSelecedPlayerFoods();
            updateFoodsCheckboxComponents();
        }, false);
        loadSelecedPlayerFoods();
        updateFoodsCheckboxComponents();

        const inputPlayerName = document.getElementById('hot-cuisine-players-name-input');
        inputPlayerName.addEventListener('input', () => {
            changePlayerDataName(inputPlayerName);
            updatePlayerDataName(inputPlayerName);
        });

        const isFirstTimeCheckbox = document.getElementById('hot-cuisine-checkbox-first-time');
        isFirstTimeCheckbox.addEventListener('change', function() {
            changePlayerDataOptions(isFirstTimeCheckbox, 'first-time');
            loadSelecedPlayerFoods();
        }, false);
        const isDoneCheckbox = document.getElementById('hot-cuisine-checkbox-player-done');
        isDoneCheckbox.addEventListener('change', function() {
            changePlayerDataOptions(isDoneCheckbox, 'player-done');
        }, false);

        const checkboxSelectAll = document.getElementById('hot-cuisine-checkbox-select-all-food');
        checkboxSelectAll.addEventListener('change', function() {
            selectAllFood(checkboxSelectAll);
            selectAllFoodUpdateComponents(checkboxSelectAll);
        }, false);

        const checkboxShowAllIngredients = document.getElementById('hot-cuisine-checkbox-select-show-all-ingredients');
        checkboxShowAllIngredients.addEventListener('change', function() {
            showAllIngredients(checkboxShowAllIngredients.checked);
        }, false);
    }
    $(document).ready(function () {
        loadAllItens(function () {
            loadFoodsList();
            players = getPlayers();
            updateQuantityPlayersOnLoad();
            addEventListeners();
        });
        const foodLists = document.getElementsByClassName('hot-cuisine-foods-list');
        const foodList = foodLists[0];
        /*const observer = new MutationObserver(function(mutationsList) {
           for (const mutation of mutationsList) {
              if (mutation.type === 'childList' && mutation.addedNodes.length > 0) {
                 showAllIngredients(false);
              }
           }
        });*/

        const observer = new ResizeObserver(entries => {
            for (let entry of entries) {
                 if (!isLoaded && document.getElementsByClassName('hot-cuisine-foods-list')[0].offsetHeight >= 370) {
                     isLoaded = true;
                     showAllIngredients(false);
                 }
            }
        });

        observer.observe(foodList, { childList: true });
    });