Impl give weapon

This commit is contained in:
mingjun97 2022-05-04 23:00:20 -07:00
parent bf897c1e14
commit 2c0937fcc7
7 changed files with 73 additions and 5 deletions

View File

@ -3,9 +3,13 @@
<head>
<link rel="stylesheet" type="text/css" href="../styles/cheat.css" />
<link rel="stylesheet" href="../styles/picnic.css">
<script type="text/javascript" src="../scripts/cheat/quickcommand.js"></script>
<script type="text/javascript" src="../scripts/cheat.js"></script>
<script type="text/javascript" src="../scripts/parent.js"></script>
<script type="text/javascript" src="../scripts/cheat/data.js"></script>
<script type="text/javascript" src="../scripts/cheat/quickcommand.js"></script>
<script type="text/javascript" src="../scripts/cheat/weapon.js"></script>
</head>
<body>
<div class="container">

View File

@ -8,6 +8,8 @@ document.addEventListener("DOMContentLoaded", ()=> {
}
console.log(e.target);
}
genQuickCommand();
// genQuickCommand();
genWeapon();
document.getElementById("tab-1").onclick = genQuickCommand;
document.getElementById("tab-3").onclick = genWeapon;
});

1
scripts/cheat/data.js Normal file

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,6 @@
qucick_command = [
{name: "Heal All Characters", command: "heal", args: []},
{name: "Get current position", command: "position", args: []},
{name: "Give Mora", command: "give 202", args: [
{type: "number", default: 100000, width: 145}
]},
@ -18,6 +19,16 @@ qucick_command = [
]},
{name: "Give all items", command: "giveall", args: []},
{name: "Clear all items", command: "clear all", args: []},
{name: "Set talent E", command: "talent e", args: [
{type: "number", default: 10, width: 60}
]},
{name: "Set talent Q", command: "talent q", args: [
{type: "number", default: 10, width: 60}
]},
{name: "Set talent N", command: "talent n", args: [
{type: "number", default: 10, width: 60}
]},
]
function genQuickCommand() {

50
scripts/cheat/weapon.js Normal file
View File

@ -0,0 +1,50 @@
function genWeapon() {
var panel = document.getElementById("panel");
panel.innerHTML = `<div class="form">
<h2>Send Weapon to you</h2>
<label for="weapon-id">Weapon Name:</label>
<div style="display: flex;">
<select id="weapon-filter" style="flex: 2">
<option value="0"> Filter:All </option>
<option value="1"> Filter:Gray </option>
<option value="2"> Filter:Green </option>
<option value="3"> Filter:Blue </option>
<option value="4"> Filter:Purple </option>
<option value="5"> Filter:Orange </option>
</select>
<select id="weapon-id" style="flex: 4; margin-left: 0.5em"> </select>
</div>
<label for="amount">Amount:</label><input type="number" id="amount" name="amount" value=1 />
<label for="level">Level:</label><input type="number" id="level" name="level" value=90 />
<label for="refine">Refine:</label><input type="number" id="refine" name="refine" value=5 />
<button id="execute">Send</button>
</div>`;
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;
console.log(filter);
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);
}
});
}

View File

@ -1,4 +1,4 @@
async function sendCommand(payload, method="invoke", background=false) {
async function sendCommand(payload, method="invoke", background=false, persistent="auto") {
const parent = window.parent
return await parent.sendCommand(payload, method, background)
return await parent.sendCommand(payload, method, background, persistent)
}

View File

@ -14,7 +14,7 @@
margin-left: 3em;
display: flex;
flex-direction: column;
min-width: 70vw;
width: 70vw;
overflow-y: auto;
}