WIP reliquary cheating

This commit is contained in:
mingjun97 2022-05-08 21:20:23 -07:00
parent 2c0937fcc7
commit 65b22f4629
8 changed files with 170 additions and 7 deletions

View File

@ -9,6 +9,8 @@
<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>
<script type="text/javascript" src="../scripts/cheat/avatar.js"></script>
<script type="text/javascript" src="../scripts/cheat/reli.js"></script>
</head>
<body>
@ -21,7 +23,7 @@
<input id='tab-3' type='radio' name='tabgroupB'>
<label class="pseudo button toggle" for="tab-3">Weapon</label>
<input id='tab-4' type='radio' name='tabgroupB'>
<label class="pseudo button toggle" for="tab-4">Item</label>
<label class="pseudo button toggle" for="tab-4">Reliquary</label>
<input id='tab-5' type='radio' name='tabgroupB'>
<label class="pseudo button toggle" for="tab-5">Misc</label>
</div>

View File

@ -6,10 +6,13 @@ document.addEventListener("DOMContentLoaded", ()=> {
if (e.target != toolset && e.target.tagName == "LABEL") {
panel.innerHTML = ""; // clear the panel
}
console.log(e.target);
}
// genQuickCommand();
genWeapon();
genQuickCommand();
// genWeapon();
// genAvatar();
// genReli();
document.getElementById("tab-1").onclick = genQuickCommand;
document.getElementById("tab-2").onclick = genAvatar;
document.getElementById("tab-3").onclick = genWeapon;
document.getElementById("tab-4").onclick = genReli;
});

56
scripts/cheat/avatar.js Normal file
View File

@ -0,0 +1,56 @@
function genAvatar() {
var panel = document.getElementById("panel");
panel.innerHTML = `<div class="form">
<h2>Send Character to you</h2>
<label for="character-id">Character Name:</label>
<div style="display: flex;">
<select id="character-filter" style="flex: 2">
<option value="0"> Filter:All </option>
<option value="Electric"> Filter:Electric </option>
<option value="Ice"> Filter:Ice </option>
<option value="Wind"> Filter:Wind </option>
<option value="Water"> Filter:Water </option>
<option value="Fire"> Filter:Fire </option>
<option value="Rock"> Filter:Rock </option>
<option value="Grass"> Filter:Grass </option>
</select>
<select id="character-id" style="flex: 4; margin-left: 0.5em"> </select>
</div>
<label for="level">Level:</label><input type="number" id="level" name="level" value=1 />
<label for="amount">Constellation(Will be sent as ITEM):</label><input type="number" id="amount" name="amount" value=0 />
<button id="execute">Send</button>
</div>`;
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);
}
});
}

File diff suppressed because one or more lines are too long

94
scripts/cheat/reli.js Normal file
View File

@ -0,0 +1,94 @@
var filterMethod = "set";
function genReli() {
var panel = document.getElementById("panel");
panel.innerHTML = `<div class="form">
<h2>Send Reli to you(Still WIP)</h2>
<label>Reliquary Name:</label>
<div> Search by:
<input id="by-set" type="radio" name="filter_type" checked /> <label for="by-set" class="checkable">Set</label>
<input id="by-name" type="radio" name="filter_type" /> <label for="by-name" class="checkable">Name</label>
</div>
<div style="display: flex;" id="search-box" class="search-box">
<div style="flex: 2">
<select id="reli-set" class="by-set">
<option value="0">All</option>
</select>
<input id="reli-search" type="text" class="hidden by-name" placeholder="Reliquary Name" />
</div>
<div style="flex: 4; margin-left: 0.5em">
<select id="reli-select" class="by-set">
</select>
<div class="by-name" id="name-list">
</div>
</div>
</div>
<input id="reli-id" type="text" style="display: none;" />
<label for="level">Level:</label><input type="number" id="level" name="level" value=20 />
<div>
<label for="main-prop">Main Props:</label>
<select id="main-prop"> </select>
<input type="checkbox" id="main-percent" name="main-percent" /> <label> %</label>
</div>
<button id="execute">Send</button>
</div>`;
var filter = document.getElementById("reli-set");
reli_list.forEach(reli => {
var o = document.createElement("option");
o.value = reli.id;
o.innerText = reli.name;
filter.appendChild(o);
})
updateReliList();
document.getElementById("reli-set").onchange = updateReliList;
document.getElementById("by-set").onchange = () => {
Array.prototype.forEach.call(document.getElementsByClassName("by-set"),(e)=> {
e.classList.remove("hidden");
});
Array.prototype.forEach.call(document.getElementsByClassName("by-name"),(e)=> {
e.classList.add("hidden");
});
document.getElementById("search-box").style.height = "3em";
};
document.getElementById("by-name").onchange = () => {
Array.prototype.forEach.call(document.getElementsByClassName("by-name"),(e)=> {
e.classList.remove("hidden");
});
Array.prototype.forEach.call(document.getElementsByClassName("by-set"),(e)=> {
e.classList.add("hidden");
});
document.getElementById("search-box").style.height = "20em";
};
document.getElementById("execute").onclick = () => {
var reliId = document.getElementById("reli-id").value;
var level = document.getElementById("level").value;
sendCommand(`giveart ${reliId} ${level+1}`);
}
}
function updateReliList() {
if (filterMethod == "set") {
var filter = document.getElementById("reli-set").value;
var select = document.getElementById("reli-select");
select.innerHTML = "";
reli_list.forEach(element => {
if (filter == 0 || element.id == filter){
element.contains.forEach(item => {
var o = document.createElement("option");
o.innerText = `${item.name} - ${item.id}`; ;
o.value = item.id;
select.appendChild(o);
})
}
});
}
}
function updatePropList(mainPropId, appendPropId) {
}

View File

@ -34,7 +34,6 @@ function genWeapon() {
function updateWeaponList() {
var filter = document.getElementById("weapon-filter").value;
console.log(filter);
var select = document.getElementById("weapon-id");
select.innerHTML = "";
weapon_list.forEach(element => {

View File

@ -1,8 +1,9 @@
var DEBUG = true;
async function sendCommand(payload, method="invoke", background=false, persistent="auto") {
let key = new window.URLSearchParams(window.location.search).get("k");
let url = '/mojoplus/api';
let data = JSON.stringify({ "k": key, "request": method, "payload": payload });
if (DEBUG) console.log(payload);
let response = await fetch(url, {
method: 'POST',
headers: {

View File

@ -16,6 +16,7 @@
flex-direction: column;
width: 70vw;
overflow-y: auto;
overflow-x: hidden;
}
.commandGroup {
@ -48,3 +49,8 @@ hr.solid {
.hidden {
display: none;
}
.search-box {
height: 3em;
transition: all ease-in-out 0.5s;
}