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

发送武器

`; updateWeaponList(); document.getElementById("weapon-filter").onchange = updateWeaponList; document.getElementById("execute").onclick = () => { var weaponId = document.getElementById("weapon-id").value; var amount = document.getElementById("amount").value; var level = document.getElementById("level").value; var refine = document.getElementById("refine").value; sendCommand(`give ${weaponId} ${amount} ${level} ${refine}`); } } function updateWeaponList() { var filter = document.getElementById("weapon-filter").value; var select = document.getElementById("weapon-id"); select.innerHTML = ""; weapon_list.forEach(element => { if (filter == 0 || element.level == filter){ var o = document.createElement("option"); o.innerText = `${element.name} - ${element.id}`; ; o.value = element.id; select.appendChild(o); } }); }