function genAvatar() { var panel = document.getElementById("panel"); panel.innerHTML = `

Send Character to you

`; updateCharacterList(); document.getElementById("character-filter").onchange = updateCharacterList; document.getElementById("execute").onclick = () => { var characterId = document.getElementById("character-id").value; var amount = document.getElementById("amount").value; var level = document.getElementById("level").value; if (characterId){ sendCommand(`givechar ${characterId} ${level}`); if (amount > 0) { sendCommand(`give ${characterId % 1000 + 1100} ${amount}`); } } } } function updateCharacterList() { var filter = document.getElementById("character-filter").value; var select = document.getElementById("character-id"); select.innerHTML = ""; console.log(filter); avatar_list.forEach(element => { if (filter == 0 || element.element == filter){ var o = document.createElement("option"); o.innerText = `${element.name} - ${element.id}`; ; o.value = element.id; select.appendChild(o); } }); }