Doublexp doubleskill.png Double Exp & Skill: Matar monstros rende o dobro de pontos de experiência. O progresso de skills é duas vezes mais rápido! Doublexp doubleskill.png
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
Linha 1: Linha 1:
<pre id="hot_cuisine_system_html">
<pre id="hot_cuisine_system_html">
  <body>
  <div class="hot-cuisine-panel">
    <div class="main_div side-by-side">
    <div class="hot-cuisine-loading">
        <div class="loading">
        <img src="https://www.tibiawiki.com.br/images/c/ce/The_Epic_Wisdom.gif" /><br />
            <img src="https://www.tibiawiki.com.br/images/c/ce/The_Epic_Wisdom.gif" /><br />
        <label>Loading...</label>
            <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="15">
            </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>
         <div class="menu">
         <div class="hot-cuisine-checkbox-boxes-flex">
             <div class="title-menu">
             <div class="hot-cuisine-checkbox-box">
                 <h4 id="hot-title" class="titulo">Calculadora da Hot Cuisine</h4>
                 <input id="hot-cuisine-checkbox-first-time" type="checkbox">
                <label for="hot-cuisine-checkbox-first-time">Primeira vez</label>
             </div>
             </div>
             <br>
             <div class="hot-cuisine-checkbox-box">
            <div class="subtitulo">
                <input id="hot-cuisine-checkbox-player-done" type="checkbox">
                 <h5 style="color: #ffffff;">Foods:</h5>
                 <label for="hot-cuisine-checkbox-player-done">Termiado</label>
             </div>
             </div>
            <br>
            <div id="foodSelect">
            </div>
            <div id="hot-version" class="version"></div>
         </div>
         </div>
         <div class="content side-by-side">
         <button onclick="deletAllPlayers()">deletar persoagens</button>
            <div class="subtitulo">
    </div>
                <h5>Quantidade de Personagens:</h5>
    <div class="hot-cuisine-foods-panel">
            </div>
        <h2>Foods</h2>
            <input type="number" id="qtdPlayers" name="qtdPlayers" value="1" min="1" oninput="updateQuantity()"><br>
        <div class="hot-cuisine-checkbox-box">
            <div class="first-time-box">
            <input id="hot-cuisine-checkbox-select-all-food" type="checkbox">
                <input 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-select-all-food">Selecionar todas as Foods</label>
            </div>
        </div>
            <div class="ingredients-box">
        <div class="hot-cuisine-foods-list">
                <div class="display-flex border-bottom border-top">
        </div>
                    <div class="subtitulo side-by-side">
    </div>
                        <h5>Ingredientes:</h5>
    <div class="hot-cuisine-selected-player-foods-panel">
                    </div>
        <h2>Foods Selecionados</h2>
                    <div class="side-by-side">
        <label class="hot-cuisine-selected-player-label">Player: </label>
                        <button class="button-update-ingredients" onclick="reloadIngredients()">&#10226; Refresh List</button>
        <div class="hot-cuisine-selected-player-foods-list">
                    </div>
        </div>
                </div>
    </div>
                <div class="ingredients-list-container">
    <div class="hot-cuisine-all-ingredients-list">
                    <ul id="ingredients" class="ingredients-list">
        <h2>Todos os Ingredientes</h2>
                    </ul>
        <div class="hot-cuisine-checkbox-box">
                </div>
            <input id="hot-cuisine-checkbox-select-show-all-ingredients" type="checkbox">
            </div>
            <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>
     </div>
</div>
</pre>
</pre>


<pre id="hot_cuisine_system_css">
<pre id="hot_cuisine_system_css">
     .main_div {
     .hot-cuisine-panel {
        display: flex;
        max-width: 1200px;
        /* max-height: 500px; */
         position: relative;
         position: relative;
        display: flex;
        width: 600px;
        border-radius: 5px;
         border: 2px solid #a2a9b1;
         border: 2px solid #a2a9b1;
         background: #ffffff;
         background: #ffffff;
         margin: 2px;
         border-radius: 5px;
         -webkit-box-shadow: 0px 0px 10px 2px rgba(255, 255, 255, 1);
         -webkit-box-shadow: 0px 0px 10px 2px rgba(255, 255, 255, 1);
         -moz-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);
         box-shadow: 0px 0px 10px 2px rgba(255, 255, 255, 1);
         font-family: Verdana, Arial, Times New Roman, sans-serif;
         font-family: Verdana, Arial, Times New Roman, sans-serif;
         color: #000000;
         font-size: 13px;
         border-spacing: 0px;
         color: black;
     }
     }
 
     .hot-cuisine-loading {
     .display-flex {
        z-index: 9999;
         display: flex;
        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;
     }
     }


     .border-top {
     .hot-cuisine-loading > label {
         border-top: 1px solid black;
         position: relative;
        bottom: 0px;
        text-align: center;   
        font-size: math;
        background: transparent;
     }
     }
 
    .hot-cuisine-loading > span {
     .border-bottom {
        text-align: center;
         border-bottom: 1px solid black;
        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 {
     .side-by-side {
        flex: 1;
        /* Distribute available space equally */
    }
 
    .container-flex {
        display: flex;
        /* Use flexbox for the container */
    }
 
    .menu {
         background-color: #c7451d;
         background-color: #c7451d;
         color: #ffffff;
         width: 260px;
         float: left;
         border-top-left-radius: 3px;
        max-width: 280px;
        padding: 10px;
         border-bottom-left-radius: 3px;
         border-bottom-left-radius: 3px;
         border-top-left-radius: 3px;
         padding: 10px 5px 5px 5px;
     }
     }
 
     .hot-cuisine-players-panel > h2 {
     .title-menu {
         width: 100%;
         width: 100%;
        padding-bottom: 10px;
        text-align: center;
        color: white;
         border-bottom: 1px solid black;
         border-bottom: 1px solid black;
     }
     }
 
     .hot-cuisine-players-panel > .hot-cuisine-checkbox-boxes-flex {
     .title-menu>h4 {
         display: flex;
         color: #ffffff;
     }
     }
 
     .hot-cuisine-players-panel > button {
     .titulo {
         margin-top: 15px;
        position: relative;
         width: 100%;
         margin: 0px;
         height: 35px;
        padding: 0;
         height: 24px;
         line-height: 24px;
        text-align: center;
         font-weight: bold;
         font-weight: bold;
         /* font-size: 12px; */
         border-radius: 5px;
         cursor: default;
         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 {
     .titulo>h4 {
        width: 100%;
         color: #fff
        font-weight: bold;
        margin-left: 2px;
         color: white;
     }
     }
 
     .hot-cuisine-players-input-box > input {
     .subtitulo {
        float: left;
         width: 100%;
         width: 100%;
         margin-left: 5px;
        height: 32px;
         margin-top: 5px;
        border: none;
        border-radius: 5px;
        font-weight: bold;
     }
     }
 
     .hot-cuisine-players-input-box > input.text-center {
     .subtitulo>h5 {
         text-align: center;
         float: left;
        margin-top: 1em;
        margin-bottom: 1em;
     }
     }


     #foodSelect {
     .hot-cuisine-players-list-box {
         height: 700px;
         width: 100%;
        margin-top: 5px;
     }
     }
 
     .hot-cuisine-players-list-box > label {
     .quantity-box {
         width: 100%;
        border-bottom-left-radius: 5px;
        height: 22px;
         line-height: 15px;
         font-weight: bold;
         font-weight: bold;
         border-right: 1px solid #cccccc;
         margin-left: 2px;
         border-top: 1px solid #cccccc;
         color: white;
        text-align: center;
    }
         cursor: default;
    .hot-cuisine-players-list-box > select {
         font-size: 12px;
         width: 100%;
         justify-content: center;
         margin-top: 5px;
         align-items: center;
         border: none;
         display: flex;
         border-radius: 5px;
         padding: 5px;
     }
     }


     .title-box {
     .hot-cuisine-players-list-box > select > option {
         line-height: 60px;
         width: 100%;
         text-align: center;
         height: 15px;
         font-weight: bold;
         font-weight: bold;
         font-size: 12px;
         font-size: 12px;
        cursor: default;
        height: 60px;
        width: calc(100% - 95px);
     }
     }
 
     .hot-cuisine-checkbox-box {
     .food-title {
         width: 100%;
         background: transparent;
         margin-top: 5px;
         font-size: 13px;
         display: flex;
         font-weight: bold;
         align-items: center;
         display: inline-table;
     }
     }
 
     .hot-cuisine-checkbox-box > input {
     .link-system {
         width: 20px;
         color: black !important;
        height: 20px;
    }
         margin: 0px;
 
    .ingredients-list-container {
         max-height: 665px;
         border-radius: 5px;
         border-radius: 5px;
        overflow: auto;
        overflow-x: hidden;
        /* Hide horizontal scrollbar */
         border: none;
         border: none;
     }
     }
 
     .hot-cuisine-checkbox-box > label {
     .ingredients-list {
         height: 100%;
         list-style: none;
         margin-left: 5px;
         /* Remove default list bullet points */
         align-content: center;
         padding: 5px;
         font-weight: bold;
         margin: 0.3em 1em 0 1em !important;
     }
     }
 
     .hot-cuisine-players-panel > div > .hot-cuisine-checkbox-box > label {
     .ingredients-list li {
         color: #FFFFFF;
        height: 60px;
        background-color: #f0f0f0;
        border: 1px solid #ccc;
        margin-bottom: 5px;
        border-radius: 5px;
         border-left: 4px solid #c7451d;
     }
     }


     input[type=checkbox] {
     .hot-cuisine-foods-panel {
         width: 20px;
         width: 300px;
         height: 20px;
         margin: 5px 0px 5px 0px;
        padding: 5px;
        border-right: 1px solid #000000;
     }
     }
 
     .hot-cuisine-foods-panel > h2 {
     .image-box {
         width: 100%;
        border-right: 1px solid #cccccc;
        border-top-left-radius: 5px;
         padding: 0 auto;
         text-align: center;
         text-align: center;
         cursor: default;
         padding-bottom: 10px;
        border-bottom: 1px solid #000000;
     }
     }
 
     .hot-cuisine-foods-panel > .hot-cuisine-checkbox-box > label {
     #qtdPlayers {
        border: black 1px solid;
        border-radius: 5px;
        border-left: #c7451d 5px solid;
        background: #f8f8f8;
        border-collapse: separate;
        width: calc(100% - 20px);
        height: 24px;
        margin: 0px 5px 0px 5px;
        padding: 1px 1px 1px 1px;
        line-height: 18px;
        text-align: center;
        display: inline-block;
        vertical-align: top;
        white-space: nowrap;
        /* font-family: Verdana, Arial, Times New Roman, sans-serif; */
        font-size: 13px;
         color: black;
         color: black;
     }
     }
 
     .hot-cuisine-foods-list {
     #qtdPlayers:hover,
        width: 100%;
    #qtdPlayers:focus-visible {
         margin-top: 25px;
         outline: none;
     }
     }
 
     .hot-cuisine-foods-list-item {
     .first-time-box {
         width: 100%;
         height: 20px;
        margin-top: 5px;
        margin-bottom: 5px;
         display: flex;
         display: flex;
        margin-left: 5px;
        align-items: center;
     }
     }
 
     .hot-cuisine-foods-list-item {
     .food-option {
         width: 100%;
         float: left;
        margin-top: 5px;
        margin-bottom: 5px;
         display: flex;
         display: flex;
         align-items: center;
         align-content: center;
         justify-content: center;
    }
         width: fit-content;
    .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 {
    /* Tooltip */
         height: 100%;
     .tip {
         margin-left: 5px;
        font-family: Verdana, Arial, Times New Roman, sans-serif;
         align-self: center;
        font-size: 12px;
         font-weight: bold;
        ;
         background-color: #ffffff;
         border-radius: 2px;
         box-shadow: 0 0 6px #888;
         display: none;
        position: absolute;
        padding: 10px;
        z-index: 1;
        color: #000;
     }
     }
 
     .hot-cuisine-selected-player-foods-panel {
     .tooltip {
         width: 340px;
         position: relative;
        margin: 5px 0px 5px 0px;
        padding: 5px;
        border-right: 1px solid #000000;
     }
     }
 
     .hot-cuisine-selected-player-foods-panel > h2 {
     .tooltip,
        width: 100%;
    .tooltip:hover+.tip,
        text-align: center;
    .tip:hover {
        padding-bottom: 10px;
         display: block;
         border-bottom: 1px solid #000000;
     }
     }
 
     .hot-cuisine-selected-player-label {
    /* Buttons */
     .button-copy {
        font-size: 10px;
        background-color: transparent;
        color: #ffbf00;
        border-width: 0px;
        border: 1px solid #ffbf00;
        border-radius: 13px;
        width: 15px;
        height: 15px;
        line-height: 15px;
         font-weight: bold;
         font-weight: bold;
         text-align: center;
    }
         justify-content: center;
    .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;
         align-items: center;
         display: flex;
         border-bottom: 1px solid #eae2e2;
        padding-bottom: 5px;
     }
     }
 
     .hot-cuisine-selected-player-foods-item-box-header > img {
     .button-copy:hover {
         width: 25px;
         width: 25px;
         height: 25px;
         height: 25px;
        background-color: #990000;
     }
     }
    .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;


     .button-delete {
    }
     .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-size: 15px;
         font-weight: bold;
         font-weight: bold;
         border-top-right-radius: 3px;
         border: none;
        border-bottom-right-radius: 3px;
        background-color: transparent;
         background-color: #c7451d;
    }
         color: #ffffff;
    .hot-cuisine-selected-player-foods-ingredients-box {
         border-width: 0px;
         display: flex;
         display: inline;
         flex-shrink: 0;
         float: right;
         width: calc(100% - 20px);
         height: 60px;
         height: 55px;
         width: 60px;
         margin: 10px;
         padding-bottom: 5px;
         border-bottom: 1px solid #eae2e2;
     }
     }
 
     .hot-cuisine-selected-player-foods-ingredients-box > label {
     .button-delete:hover {
        display: block;
         font-size: 20px;
         width: calc(100% - 85px);
         background-color: darkred;
        height: 55px;
         color: #ffbf00;
        margin: 5px;
         border-width: 0px;
         font-weight: bold;
         text-align: center;
         align-content: center;
     }
     }
 
     .hot-cuisine-selected-player-foods-ingredients-box > button {
     .button-update-ingredients {
         min-width: 30px;
         width: 75%;
         height: 30px;
         height: 100%;
         background-color: #c7451d;
         float: right;
        border: 1px solid #000000;
        border-radius: 5px;
        align-self: center;
         font-size: 15px;
         font-size: 15px;
        background-color: #c7451d;
        color: #ffffff;
        border-width: 0px;
         font-weight: bold;
         font-weight: bold;
        color: white;
     }
     }
 
     .hot-cuisine-selected-player-foods-ingredients-box > button:hover {
     .button-update-ingredients:hover {
         background-color: #ff0000;
         font-size: 15px;
         font-size: 20px;
         background-color: #990000;
         color: #ffbf00;
         color: #ffbf00;
        border-width: 0px;
     }
     }
 
     .hot-cuisine-selected-player-foods-ingredients-box > div.img-quantity {
    /* labels */
         background-color: #f3f3f3;
     .inspect-label {
         display: block;
         margin: 5px;
        line-height: 15px;
        font-size: 15px;
         font-weight: bold;
         text-align: center;
         text-align: center;
         justify-content: center;
         width: 50px;
         align-items: center;
         height: 55px;
         color: #ffbf00;
         border: 1px solid #000000;
        border-radius: 5px;
     }
     }
     .inspect-label > .link-system {
     .hot-cuisine-selected-player-foods-ingredients-box > div.img-quantity > img {
         color: #ffbf00 !important;
         margin-top: 4px;
        text-decoration: none;
     }
     }
 
     .hot-cuisine-selected-player-foods-ingredients-box > div.img-quantity > label {
     .version {
        display: block;
        background-color: #c7451d;
         text-align: center;
         text-align: center;
         padding: 5px;
         /* margin-top: 4px; */
         margin-top: 15px;
         width: 100%;
         border-top: 1px solid black;
        height: 18px;
         font-size: 12px;
         border-top: 1px solid #000000;
         border-bottom-left-radius: 3px;
        border-bottom-right-radius: 3px;
         font-weight: bold;
         font-weight: bold;
    }
    .hot-cuisine-selected-player-foods-item-box-ingredients {
        display: none;
     }
     }


     .loading {
     .hot-cuisine-all-ingredients-list  {
         background-color: rgba(255, 255, 255, 0.8);
         width: 300px;
         display: flex;
         margin: 5px 0px 5px 0px;
         justify-content: center;
         padding: 5px;
        align-items: center;
    }
        -webkit-border-radius: 5px;
    .hot-cuisine-all-ingredients-list > h2 {
        -moz-border-radius: 5px;
        border-radius: 3px;
        position: absolute;
        height: 100%;
         width: 100%;
         width: 100%;
         top: 0;
         text-align: center;
         left: 0;
         padding-bottom: 10px;
        border-bottom: 1px solid #000000;
     }
     }
 
     .hot-cuisine-all-ingredients-list-items {
     .loading>label {
        position: absolute;
        bottom: 0;
        display: grid;
        text-align: center;
        align-items: center;
        height: 30px;
         width: 100%;
         width: 100%;
         background-color: #c7451d;
         overflow: auto;
         font-size: math;
         margin-top: 25px;
     }
     }
</pre>
</pre>


<pre id="hot_cuisine_system_js">
<pre id="hot_cuisine_system_js">
var hot_version = "v2.0.1";
var players = new Array();
         const ingredients = {
    var updateQuantityPlayersOnLoad = () => {
            "Meat": {
         const quantityPlayersInput = document.getElementById('hot-cuisine-players-quantity-input');
                "link": "https://www.tibiawiki.com.br/wiki/Meat",
        quantityPlayersInput.value = players.length;
                "image": "https://www.tibiawiki.com.br/images/5/58/Meat.gif"
    }
            },
 
            "Potato": {
    var managePlayerOnList = (value) => {
                "link": "https://www.tibiawiki.com.br/wiki/Potato",
        if (players.length > value) {
                "image": "https://www.tibiawiki.com.br/images/f/fa/Potato.gif"
             players.pop(players.length - value);
            },
        }
            "Onion": {
        for (let i = 0; i < value; i++) {
                "link": "https://www.tibiawiki.com.br/wiki/Onion",
             if (players.find(iPlayer => iPlayer.id === i) == null) {
                "image": "https://www.tibiawiki.com.br/images/5/57/Onion.gif"
                 const player = {
            },
                    "id": i,
            "Bulb of Garlic": {
                    "name": "Player ".concat(i + 1),
                "link": "https://www.tibiawiki.com.br/wiki/Bulb_of_Garlic",
                    "isFirstTime": false,
                "image": "https://www.tibiawiki.com.br/images/6/63/Bulb_of_Garlic.gif"
                    "isDone": false,
            },
                    "selected": false,
            "Flour": {
                    "foods": new Object()
                "link": "https://www.tibiawiki.com.br/wiki/Flour",
                 }
                "image": "https://www.tibiawiki.com.br/images/1/13/Flour.gif"
                 players.push(player);
             },
            "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"
            },
            "Salt": {
                "link": "https://www.tibiawiki.com.br/wiki/Salt",
                "image": "https://www.tibiawiki.com.br/images/8/8a/Salt.gif"
            },
            "Dragonfruit": {
                "link": "https://www.tibiawiki.com.br/wiki/Dragonfruit",
                "image": "https://www.tibiawiki.com.br/images/3/3d/Dragonfruit.gif"
            },
            "Taiyaki": {
                "link": "https://www.tibiawiki.com.br/wiki/Taiyaki",
                "image": "https://www.tibiawiki.com.br/images/3/3d/Taiyaki.gif"
            },
            "Young Lich Worm": {
                "link": "https://www.tibiawiki.com.br/wiki/Young_Lich_Worm",
                "image": "https://www.tibiawiki.com.br/images/f/f2/Young_Lich_Worm.gif"
             }
             }
         }
         }
        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();
    }


        const foods = [
    var createPlayerOnListComponent = () => {
            {
        const playerList = document.getElementById('hot-cuisine-players-list-select');
                "name": "Rotworm Stew",
        if (playerList == null) {
                "link": "https://www.tibiawiki.com.br/index.php?title=Rotworm_Stew",
             showAlert();
                "image": "https://www.tibiawiki.com.br/images/7/7a/Rotworm_Stew.gif",
             return;
                "ingredients": [
        }
                    {
        playerList.innerHTML = "";
                        "name": "Meat",
        for (let i = 0; i < players.length; i++) {
                        "quantity": 2
             const option = createPlayerItemListCell(players[i]);
                    },
             playerList.appendChild(option);
                    {
        }
                        "name": "Potato",
        if (playerList.children.length == null || playerList.children.length === 0) {
                        "quantity": 20
             showAlert();
                    },
             return;
                    {
        }
                        "name": "Onion",
        const selectedPlayerIndex = getSelectedPlayerIndex();
                        "quantity": 1
        playerList.children[selectedPlayerIndex].setAttribute('selected', true);
                    },
    }
                    {
 
                        "name": "Bulb of Garlic",
    var createPlayerItemListCell = (player) => {
                        "quantity": 1
        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);
                        "name": "Flour",
 
                        "quantity": 5
        return option;
                    },
    }
                    {
 
                        "name": "Beer",
    var selectPlayer = (component) => {
                        "quantity": 2
        const listOptions = Array.from(document.getElementsByTagName('option'));
                    }
        const selectedOptions = listOptions.filter(op => op.value === component.value);
                ]
        if (selectedOptions == null || selectedOptions.length === 0) {
             },
            showAlert();
             {
            return;
                "name": "Hydra Tongue Salad",
        }
                "link": "https://www.tibiawiki.com.br/index.php?title=Hydra_Tongue_Salad",
        const selectedOption = selectedOptions[0];
                "image": "https://www.tibiawiki.com.br/images/d/d3/Hydra_Tongue_Salad.gif",
        return setSelectedPlayerIndex(selectedOption.getAttribute("list-index"));
                "ingredients": [
    }
                    {
    var selectPlayerUpdateComponents = (player) => {
                        "name": "Hydra Tongue",
        // Update Componenents
                        "quantity": 2
        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');
                        "name": "Tomato",
 
                        "quantity": 2
        inputPlayerName.value = player.name;
                    },
        inputPlayerName.setAttribute('selected-player-id', player.id);
                    {
        isFirstTimeCheckbox.checked = player.isFirstTime;
                        "name": "Cucumber",
        isFirstTimeCheckbox.setAttribute('player-id', player.id);
                        "quantity": 1
        isDoneCheckbox.checked = player.isDone;
                    },
        isDoneCheckbox.setAttribute('player-id', player.id);
                    {
 
                        "name": "Egg",
        updateSelectedPlayerLabel(player.name);
                        "quantity": 2
    }
                    },
 
                    {
    var loadSelecedPlayerFoods = () => {
                        "name": "Troll Green",
        const components = document.getElementsByClassName('hot-cuisine-selected-player-foods-list');
                        "quantity": 1
        if (components == null || Object.keys(components).length === 0) {
                    },
             showAlert();
                    {
             return;
                        "name": "Wine",
        }
                        "quantity": 1
        const listDiv = components[0];
                    }
        listDiv.innerHTML = "";
                ]
 
             },
        const playerFoods = players[getSelectedPlayerIndex()].foods;
            {
        Object.keys(playerFoods).forEach(foodName => {
                "name": "Roasted Dragon Wings",
             const food = playerFoods[foodName];
                "link": "https://www.tibiawiki.com.br/index.php?title=Roasted_Dragon_Wings",
             const itemList = createPlayerSelectedFoodsItem(food);
                "image": "https://www.tibiawiki.com.br/images/e/ed/Roasted_Dragon_Wings.gif",
             listDiv.appendChild(itemList);
                "ingredients": [
        });
                    {
 
                        "name": "Bat",
        loadAllIngredients();
                        "quantity": 1
    }
                    },
 
                    {
    var changePlayerDataName = (component) => {
                        "name": "Jalapeño Pepper",
        const name = component.value;
                        "quantity": 3
        players[getSelectedPlayerIndex()].name = name;
                    },
 
                    {
        updateSavedPlayers();
                        "name": "Brown Bread",
    }
                        "quantity": 5
 
                    },
    var updatePlayerDataName = (component) => {
                    {
        const name = component.value;
                        "name": "Egg",
 
                        "quantity": 2
        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) {
                        "name": "Powder Herb",
            showAlert();
                        "quantity": 1
             return;
                    },
         }
                    {
         selectedOptions[0].value = name;
                        "name": "Red Mushroom",
         const id = parseInt(component.getAttribute('selected-player-id')) + 1;
                        "quantity": 5
         selectedOptions[0].innerText = (id.toString()).concat(': ').concat(name);
                    }
                ]
             },
            {
                "name": "Tropical Fried Terrorbird",
                "link": "https://www.tibiawiki.com.br/index.php?title=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/index.php?title=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/index.php?title=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/index.php?title=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/index.php?title=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/index.php?title=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/index.php?title=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/index.php?title=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/index.php?title=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/index.php?title=Demonic_Candy_Ball",
                "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/index.php?title=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
                    }
                ]
            },
            {
                "name": "Zaoan Sauce",
                "link": "https://www.tibiawiki.com.br/wiki/Zaoan_Sauce",
                "image": "https://www.tibiawiki.com.br/images/e/e7/Zaoan_Sauce.gif",
                "ingredients": [
                    {
                        "name": "Salt",
                        "quantity": 1
                    },
                    {
                        "name": "Dragonfruit",
                        "quantity": 1
                    },
                    {
                        "name": "Coconut Milk",
                        "quantity": 2
                    },
                    {
                        "name": "Taiyaki",
                        "quantity": 1
                    },
                    {
                        "name": "Young Lich Worm",
                        "quantity": 1
                    }
                ]
             }
         ];
         const selectedFoods = [];
         const deletedIngredients = [];
         var promises = [];
        // Popula o Select de Items.
        var populateFoodSelect = async () => {
            $("#foodSelect").empty();


            if (foods != null) { // Verifica se a lista de itens não é nula
        updateSelectedPlayerLabel(name);
                let id = 0;
    }
                $("#foodSelect").append("<div class=\"food-option\" style=\"margin-bottom: 25px;\"><input type=\"checkbox\" id=\"food-00\" name=\"all-food\" value=\"all-food\" checked=\"true\" onchange=\"selectAllFoods(this)\"><label class=\"food-title\" for=\"food-00\">Select All Foods</label></div><br><br>");
                foods.forEach((item) => {
                    let attrib = item.attrib;
                    let itemName = item.name;
                    let image = "<img style=\"width: 25px; height: 25px;\" src=\"" + item.image + "\"/>";
                    let tooltip = "<span class=\"tooltip\"><div class=\"inspect-label\"> ⓘ </div></span><span class=\"tip\" id=\"fonte3\">Abrir.</span>"
                    let buttonCopy = "<span class=\"tooltip\"><button class=\"button-copy\" onclick=\"copyName('" + itemName + "')\">⎘</button></span><span class=\"tip\" id=\"fonte3\">Copy Food Name.</span>"
                    if (attrib != null && !attrib.isEmpty) {
                        tooltip = "<span class=\"tooltip\"><div class=\"inspect-label\"><a class=\"link-system\" href=\"" + item.link + "\" target=\"blank\"> ⓘ </a> </div></span><span class=\"tip\" id=\"fonte3\">" + attrib + "</span>";
                    }
                    $("#foodSelect").append("<div class=\"food-option\"><input type=\"checkbox\" id=\"food-" + id + "\" name=\"" + item.name + "\" value=\"" + item.name + "\" checked=\"true\" onchange=\"updateIngredients(this)\">" + image + "<label class=\"food-title\" for=\"food-" + id + "\"> " + item.name + "</label>" + tooltip + buttonCopy + "</div><br><br>");
                    id++;
                    selectedFoods.push(item);
                });
                updateIngredientsGreed();
            }
        };


        var copyName = async (name) => {
    var updateSelectedPlayerLabel = (name) => {
            try {
        const labelComponents = document.getElementsByClassName('hot-cuisine-selected-player-label');
                await navigator.clipboard.writeText(name + " - yes");
        if (labelComponents != null && Object.keys(labelComponents).length === 1) {
                console.log('Name copied to clipboard successfully!');
            labelComponents[0].innerText =  "Player: ".concat(name);
            } catch (error) {
                console.error('Failed to copy name: ', error);
            }
         }
         }
    }


        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, true);
                index++;
             });
             });
         }
         }
        if (type === 'player-done') {
            players[playerIndex].isDone = component.checked;
        }
        updateSavedPlayers();
    }


        var checkSelectionBoxies = () => {
    var loadFoodsList = () => {
            let index = 0;
        const components = document.getElementsByClassName('hot-cuisine-foods-list');
            let selectedArr = [];
        if (components == null || Object.keys(components).length === 0) {
            foods.forEach(() => {
            showAlert();
                let ckb = document.getElementById("food-" + index);
            return;
                if (ckb.checked) {
        }
                    selectedArr.push(ckb);
        const divFoodList = components[0];
                }
        divFoodList.innerHTML = "";
                index++;
        for(let i = 0; i < foods.length; i++) {
            });
            const itemList = createFoodItemList(foods[i], i);
            if (selectedArr.length == foods.length) {
             divFoodList.appendChild(itemList);
                document.getElementById("food-00").checked = true;
             } else {
                document.getElementById("food-00").checked = false;
            }
         }
         }
    }
    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);
        });


         var updateIngredients = (checkbox, isAll) => {
         const img = document.createElement('img');
            let food = foods.find(food => food.name == checkbox.value);
        img.setAttribute('src', food.image);
            if (checkbox.checked) {
 
                selectedFoods.push(food);
        const label = document.createElement('label');
            } else {
        label.setAttribute('for', 'food-'.concat(index));
                let index = selectedFoods.map(sFood => sFood.name).indexOf(food.name);
        label.innerText = food.name;
                if (index > -1) { // only splice array when item is found
 
                    selectedFoods.splice(index, 1); // 2nd parameter means remove one item only
        div.appendChild(checkbox);
                }
        div.appendChild(img);
            }
        div.appendChild(label);
            updateIngredientsGreed();
 
            if (isAll == null || !isAll) {
        return div;
                checkSelectionBoxies();
    }
             }
 
    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]);
         }
         }


         var updateQuantity = () => {
         updateSavedPlayers();
             updateIngredientsGreed();
    }
 
    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;  
         }
         }


         var updateIngredientsGreed = () => {
         const checkboxSelectAllFood = document.getElementById('hot-cuisine-checkbox-select-all-food');
            let ingredientsList = {};
        checkboxSelectAllFood.checked = foods.length === Object.keys(players[getSelectedPlayerIndex()].foods).length;
            selectedFoods.forEach((food) => {
    }
                food.ingredients.forEach((ingredient) => {
 
                    let mIngrediente = ingredientsList[ingredient.name];
    var createPlayerSelectedFoodsItem = (food) => {
                     if (mIngrediente == null) {
        const divBox = document.createElement('div');
                        ingredientsList[ingredient.name] = ingredient.quantity;
        divBox.classList.add('hot-cuisine-selected-player-foods-item-box');
                    } else {
 
                        ingredientsList[ingredient.name] = mIngrediente + ingredient.quantity;
        const divBoxHeader = document.createElement('div');
                    }
        divBoxHeader.classList.add('hot-cuisine-selected-player-foods-item-box-header');
                });
 
            });
        const img = document.createElement('img');
            if (deletedIngredients.length > 0) {
        img.setAttribute('src', food.image);
                deletedIngredients.forEach((ingredient) => {
 
                    delete ingredientsList[ingredient];
        const label = document.createElement('label');
                })
        label.innerText = food.name;
            }
 
            updateList(ingredientsList);
        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 updateList = (list) => {
    var selectAllFood = (component) => {
            let ingredientsListSorted = Object.entries(list).sort(([a,], [b,]) => {
        const playerSelectedIndex = getSelectedPlayerIndex();
                const nameA = a.toLowerCase();
                const nameB = b.toLowerCase();


                 if (nameA < nameB) {
        if (component.checked) {
                     return -1;
            foods.forEach(food => {
                const playerFood = { ...food };
                 if (players[playerSelectedIndex].foods[food.name] == null) {
                     playerFood.quantity = (isFirstTime()) ? 2 : 1;
                    players[playerSelectedIndex].foods[food.name] = playerFood;
                 }
                 }
                if (nameA > nameB) {
                    return 1;
                }
                return 0;
            });
            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) => {
                let key = item[0];
                let value = item[1];
                let buttonDelete = "<button class=\"button-delete tooltip \" onclick=\"deleteIngredient('" + key + "')\">✕</button><span class=\"tip\" id=\"fonte3\">Comprado, remover da lista.</span>"
                let imageBox = "<div class=\"\"><div class=\"image-box\"><img style=\"width: 34px; height 34px;\" src=\"" + ingredients[key].image + "\" /></div><div class=\"quantity-box\">" + (Number(value) * quantity) + "</div></div>";
                $("#ingredients").append("<li><div class=\"container-flex\">" + imageBox + "<div class=\"title-box \"><a class=\"link-system\" href=\"" + ingredients[key].link + "\" target=\"blank\">" + key + "</a></div>" + buttonDelete + "</div></li>")
             });
             });
        } else {
            players[playerSelectedIndex].foods = new Object();
         }
         }
        updateSavedPlayers();
    }


        var deleteIngredient = (name) => {
    var selectAllFoodUpdateComponents = (component) => {
            if (!deletedIngredients.includes(name)) {
        for (let i = 0; i< foods.length; i++) {
                deletedIngredients.push(name);
            document.getElementById('food-'.concat(i)).checked = component.checked;
            }
            updateIngredientsGreed();
         }
         }
        loadSelecedPlayerFoods();
    }


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


         var clearArray = (array) => {
         updateSavedPlayers();
            while (array.length > 0) {
    }
                array.pop();
 
             }
    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;


         var getAttributions = async () => {
         bodyDiv.style.display = (currentDisplay === '' || currentDisplay === 'none') ? 'block' : 'none';


             foods.forEach((food) => {
        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">
                 requestAtrributions(food);
                    <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 executedPromises = async () => {
    var showAlert = (message) => {
            await Promise.all(promises);
        alert(message || "Desculpe pela inconveniência!\n\nAlgo deu errado. Por favor, recarregue a página.");
    }


            clearArray(selectedFoods);
    var getSelectedPlayerIndex = () => {
            populateFoodSelect();
        const playerSelected = players.find(player => player.selected);
            $('.loading').css("display", "none");
        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 requestAtrributions = async (food) => {
    var getAllInngredientsFromPlayers = () => {
             try {
        const allIngredients = new Object();
                 $.ajax({
        players.forEach(player => {
                     url: food.link + '&action=raw',
             const playerFoods = player.foods;
                     type: 'GET',
            Object.keys(playerFoods).forEach(foodName => {
                     cors: true ,
                 playerFoods[foodName].ingredients.forEach(ingredient => {
                    contentType:'application/json',
                     const food = playerFoods[foodName];
                    secure: true,
                     let quantity =  ingredient.quantity;
                    headers: {
                     if (food.quantity > 1) {
                         'Access-Control-Allow-Origin': '*',
                         if (ingredient.name === 'Meat') {
                        'Accept': '*/*',
                            console.log(quantity);
                        'Accept-Encoding': 'gzip, deflate, br',
                        }
                        'Accept-Language': 'en-US,en;q=0.5',
                         quantity += quantity;
                        'Connection': 'keep-alive'
                    }, success: function (codigo) {
                        promises.push(callbacks(codigo, food));
                    }, error: function (error) {
                         promises.push(callbacks(null, food));
                     }
                     }
                    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;
                 });
                 });
             }catch (error) {
             });
                console.log(error);
        });
             }
        return allIngredients;
    }
 
    var showAllIngredients = (component) => {
        const contentHeight = (component.checked) ? null : document.getElementsByClassName('hot-cuisine-foods-list')[0].offsetHeight;
        document.getElementsByClassName('hot-cuisine-selected-player-foods-list')[0].style.height = contentHeight;
        document.getElementsByClassName('hot-cuisine-all-ingredients-list-items')[0].style.height = contentHeight;
    }
 
    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 = async (codigo, food) => {
    var callbacks = (codigo, varName) => {
            if (codigo == null) {
        if (codigo == null) {
                codigo = "";
            codigo = "";
            }
        } else {
             let dplArr = codigo.split("| ");
             console.log('Loaded:', varName);
            let attrib = dplArr.find(str => str.includes("attrib"));
            window[varName] = JSON.parse(codigo);
            attrib = (attrib == null) ? "Abrir food" : attrib;
            if (attrib != null && !attrib.isEmpty) {
                if (attrib != "Abrir food") {
                    attrib = attrib.split("= ")[1].replace(/\[/g, '').replace(/\]/g, '');
                }
                let index = foods.findIndex((item) => item.name === food.name);
                if (index > -1) {
                    foods[index].attrib = attrib;
                }
            }
            executedPromises();
         }
         }
    }
    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);
        }, false);
    }
    $(document).ready(function () {
        loadAllItens(function () {
            loadFoodsList();
            players = getPlayers();
            updateQuantityPlayersOnLoad();
            addEventListeners();


        $(document).ready(function () {
            const contentHeight = document.getElementsByClassName('hot-cuisine-foods-list')[0].offsetHeight;
            $("#hot-version").text(hot_version);
             document.getElementsByClassName('hot-cuisine-selected-player-foods-list')[0].style.height = contentHeight;
             clearArray(selectedFoods);
             document.getElementsByClassName('hot-cuisine-all-ingredients-list-items')[0].style.height = contentHeight;
             clearArray(deletedIngredients);
            $('.loading').css("display", "flex");
            getAttributions();
            // populateFoodSelect();
         });
         });
    });
</pre>
</pre>

Edição das 00h04min de 4 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="15">
            </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">Termiado</label>
            </div>
        </div>
        <button onclick="deletAllPlayers()">deletar persoagens</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;
    }
    .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: 5px;
        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;
    }
    .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;
    }
    .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;
    }
    .hot-cuisine-all-ingredients-list-items {
        width: 100%;
        overflow: auto;
        margin-top: 25px;
    }
var players = new Array();
    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 = () => {
        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);
        }
    }

    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 = (component) => {
        const contentHeight = (component.checked) ? null : document.getElementsByClassName('hot-cuisine-foods-list')[0].offsetHeight;
        document.getElementsByClassName('hot-cuisine-selected-player-foods-list')[0].style.height = contentHeight;
        document.getElementsByClassName('hot-cuisine-all-ingredients-list-items')[0].style.height = contentHeight;
    }

    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);
        }, false);
    }
    $(document).ready(function () {
        loadAllItens(function () {
            loadFoodsList();
            players = getPlayers();
            updateQuantityPlayersOnLoad();
            addEventListeners();

            const contentHeight = document.getElementsByClassName('hot-cuisine-foods-list')[0].offsetHeight;
            document.getElementsByClassName('hot-cuisine-selected-player-foods-list')[0].style.height = contentHeight;
            document.getElementsByClassName('hot-cuisine-all-ingredients-list-items')[0].style.height = contentHeight;
        });
    });