feat: add scripts
This commit is contained in:
@ -1,4 +0,0 @@
|
||||
# Scripts for Arena of Valor
|
||||
Scripts I created for this game, thats it. (Not cheating scripts in-game tho)
|
||||
## Scripts
|
||||
+ [AWC_AutoSpin.sh](./AWC_AutoSpin.sh) - Auto spin the wheel in AWC website (Works in Vietnamese AOV only, other region need to tweak some string into their language)
|
||||
@ -1,139 +0,0 @@
|
||||
if (!window.location.href.startsWith("https://apl2022.lienquan.garena.vn")) {
|
||||
console.error("This script is for https://apl2022.lienquan.garena.vn only.");
|
||||
}
|
||||
|
||||
async function getCurrentUser() {
|
||||
const rsp = await fetch('/graphql', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
operationName: "getUser",
|
||||
query: `
|
||||
query getUser {
|
||||
getUser {
|
||||
id
|
||||
name
|
||||
icon
|
||||
profile {
|
||||
id
|
||||
...Profile
|
||||
__typename
|
||||
}
|
||||
__typename
|
||||
}
|
||||
}
|
||||
|
||||
fragment Profile on Profile {
|
||||
tcid
|
||||
clicks
|
||||
totalClicks
|
||||
dailyClicks
|
||||
claimedGift
|
||||
currentGift
|
||||
receivedServerGift
|
||||
subMissions
|
||||
claimedDailyGift
|
||||
date
|
||||
item {
|
||||
id
|
||||
name
|
||||
type
|
||||
image
|
||||
limitation
|
||||
currentClaimed
|
||||
__typename
|
||||
}
|
||||
sentWish
|
||||
__typename
|
||||
}
|
||||
`,
|
||||
variables: {},
|
||||
}),
|
||||
})
|
||||
if (!rsp.ok) {
|
||||
throw `Failed to get current user info`
|
||||
}
|
||||
return (await rsp.json()).data.getUser;
|
||||
}
|
||||
|
||||
async function postClick(amount) {
|
||||
const rsp = await fetch('/graphql', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
operationName: "doDailyClick",
|
||||
query: `
|
||||
mutation doDailyClick($clicks: Int!) {
|
||||
dailyClick(clicks: $clicks) {
|
||||
id
|
||||
...Profile
|
||||
__typename
|
||||
}
|
||||
}
|
||||
|
||||
fragment Profile on Profile {
|
||||
tcid
|
||||
clicks
|
||||
totalClicks
|
||||
dailyClicks
|
||||
claimedGift
|
||||
currentGift
|
||||
receivedServerGift
|
||||
subMissions
|
||||
claimedDailyGift
|
||||
date
|
||||
item {
|
||||
id
|
||||
name
|
||||
type
|
||||
image
|
||||
limitation
|
||||
currentClaimed
|
||||
__typename
|
||||
}
|
||||
sentWish
|
||||
__typename
|
||||
}
|
||||
`,
|
||||
variables: {
|
||||
clicks: amount,
|
||||
},
|
||||
}),
|
||||
})
|
||||
if (!rsp.ok) {
|
||||
throw `Failed to post click request with amount ${amount}`
|
||||
}
|
||||
}
|
||||
|
||||
async function main() {
|
||||
console.log("Fetching user information...");
|
||||
let user;
|
||||
try {
|
||||
user = await getCurrentUser();
|
||||
} catch(e) {
|
||||
console.error(e);
|
||||
return;
|
||||
}
|
||||
console.log(`Hello, ${user.name}!`);
|
||||
console.log("Calculating remaining clicks needed...");
|
||||
const clicksNeeded = 1000 - user.profile.dailyClicks;
|
||||
if (clicksNeeded == 0) {
|
||||
console.warn("You've already clicked enough for a day :D");
|
||||
return;
|
||||
}
|
||||
console.log(`Clicks needed: ${clicksNeeded}`);
|
||||
console.log("Sending click request...");
|
||||
try {
|
||||
postClick(clicksNeeded);
|
||||
} catch(e) {
|
||||
console.error(e);
|
||||
return;
|
||||
}
|
||||
console.log("Success! Please reload page to see the changes.");
|
||||
}
|
||||
|
||||
main()
|
||||
@ -1,114 +0,0 @@
|
||||
// Fetch jQuery
|
||||
await fetch("https://code.jquery.com/jquery-3.6.0.min.js").then(x => x.text()).then(y => eval(y))
|
||||
// Wait for jQuery to be loaded.
|
||||
{
|
||||
// From https://stackoverflow.com/a/53914092
|
||||
class ClassWatcher {
|
||||
|
||||
constructor(targetNode, classToWatch, classAddedCallback, classRemovedCallback) {
|
||||
this.targetNode = targetNode
|
||||
this.classToWatch = classToWatch
|
||||
this.classAddedCallback = classAddedCallback
|
||||
this.classRemovedCallback = classRemovedCallback
|
||||
this.observer = null
|
||||
this.lastClassState = targetNode.classList.contains(this.classToWatch)
|
||||
|
||||
this.init()
|
||||
}
|
||||
|
||||
init() {
|
||||
this.observer = new MutationObserver(this.mutationCallback)
|
||||
this.observe()
|
||||
}
|
||||
|
||||
observe() {
|
||||
this.observer.observe(this.targetNode, { attributes: true })
|
||||
}
|
||||
|
||||
disconnect() {
|
||||
this.observer.disconnect()
|
||||
}
|
||||
|
||||
mutationCallback = mutationsList => {
|
||||
for(let mutation of mutationsList) {
|
||||
if (mutation.type === 'attributes' && mutation.attributeName === 'class') {
|
||||
let currentClassState = mutation.target.classList.contains(this.classToWatch)
|
||||
if(this.lastClassState !== currentClassState) {
|
||||
this.lastClassState = currentClassState
|
||||
if(currentClassState) {
|
||||
this.classAddedCallback()
|
||||
}
|
||||
else {
|
||||
this.classRemovedCallback()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var disableChest = false
|
||||
function clickFirstButtonByClassName(className) {
|
||||
let btn = document.getElementsByClassName(className)[0]
|
||||
if (!(typeof btn === "undefined")) {
|
||||
btn.dispatchEvent(new MouseEvent("click"));
|
||||
}
|
||||
}
|
||||
// Click the spin button
|
||||
function spin() {
|
||||
clickFirstButtonByClassName("wheel__main--note")
|
||||
if (!disableChest) {
|
||||
clickFirstButtonByClassName("chest")
|
||||
}
|
||||
}
|
||||
|
||||
function pickCard() {
|
||||
let teams = document.getElementsByClassName("popup-draw__card")
|
||||
for (let i = 0; i < 3; i++) {
|
||||
teams[i].dispatchEvent(new MouseEvent("click"));
|
||||
}
|
||||
setTimeout(() => jQuery(".ReactModal__Overlay").trigger("click"), 2000)
|
||||
}
|
||||
// Check for dialog message then close
|
||||
function closeSwalDialog() {
|
||||
clickFirstButtonByClassName("swal2-close")
|
||||
if (document.getElementsByClassName("swal2-close").length > 0) {
|
||||
setTimeout(closeSwalDialog, 100);
|
||||
}
|
||||
}
|
||||
|
||||
function Swal2Dialog() {
|
||||
if (document.getElementsByClassName("popup-draw__card").length > 0) {
|
||||
pickCard()
|
||||
}
|
||||
else {
|
||||
let swal2msg = document.getElementsByClassName("popup-alert__message")
|
||||
if (swal2msg.length > 0) {
|
||||
console.log(swal2msg[0].innerHTML)
|
||||
if (swal2msg[0].innerHTML == "Đã đạt đến giới hạn Rương đếm ngược hàng ngày") {
|
||||
disableChest = true
|
||||
}
|
||||
else if (swal2msg[0].innerHTML == "Bạn đã hết lượt quay trong ngày") {
|
||||
closeAutoFarm()
|
||||
}
|
||||
}
|
||||
}
|
||||
closeSwalDialog()
|
||||
}
|
||||
|
||||
// Watch for SweetAlert 2
|
||||
let swal2Watcher = new ClassWatcher(document.body, 'swal2-shown', Swal2Dialog, spin);
|
||||
|
||||
function closeAutoFarm() {
|
||||
swal2Watcher.disconnect()
|
||||
}
|
||||
|
||||
spin()
|
||||
// Disable window change
|
||||
jQuery("window").off("mouseup")
|
||||
jQuery("document").off("visibilitychange")
|
||||
// Remove video player (so it isnt annoying to me and save CPU by a lot)
|
||||
Array.from(document.getElementsByTagName("iframe")).forEach((iframe) => {
|
||||
iframe.remove()
|
||||
})
|
||||
}
|
||||
@ -1,9 +1,12 @@
|
||||
# Scripts for [Cities: Skylines](https://www.citiesskylines.com/)
|
||||
|
||||
Scripts I created for this game, thats it.
|
||||
|
||||
### Scripts
|
||||
+ [NotParadoxLauncher_Win_Proton.sh](./NotParadoxLauncher_Win_Proton.sh) - Install [Not Paradox Launcher] to Cities: Skylines (Windows version running in Linux using Proton)
|
||||
+ [Win_Proton_dowser_patch.sh](./Win_Proton_dowser_patch.sh) - Replace dowser.exe with Cities.exe so the game can launch without using bloated launcher (for CS Windows version running in Proton)
|
||||
|
||||
- [NotParadoxLauncher_Win_Proton.sh](./NotParadoxLauncher_Win_Proton.sh) - Install [Not Paradox Launcher] to Cities: Skylines (Windows version running in Linux using Proton)
|
||||
- [Win_Proton_dowser_patch.sh](./Win_Proton_dowser_patch.sh) - Replace dowser.exe with Cities.exe so the game can launch without using bloated launcher (for CS Windows version running in Proton)
|
||||
|
||||
#### Note
|
||||
These script I created for my friend because I don't play this game, so if it has any problem then feel free to open a issue, thanks.
|
||||
|
||||
These script I created for my friend because I don't play this game, so if it has any problem then feel free to open a issue, thanks.
|
||||
|
||||
@ -1,58 +1,71 @@
|
||||
# leagueoflinux scripts
|
||||
|
||||
## `sulaunchhelper2.sh`
|
||||
|
||||
This script is a wrapper for `sulaunchhelper2.py` for use with Lutris pre-game launch script.
|
||||
|
||||
### Installation
|
||||
|
||||
> This script no longer wraps `syscall_check.sh`, if you need to execute that script alongside this one, I recommend you to take a look at [preloader.sh](../../../apps/Lutris#preloadersh)
|
||||
|
||||
+ To install you must have `sulaunchhelper2.py` present, if not you can execute these to quickly download them (to current directory):
|
||||
- To install you must have `sulaunchhelper2.py` present, if not you can execute these to quickly download them (to current directory):
|
||||
|
||||
```sh
|
||||
curl -OL https://raw.githubusercontent.com/CakeTheLiar/launchhelper/master/sulaunchhelper2.py
|
||||
chmod +x sulaunchhelper2.py
|
||||
```
|
||||
+ Then to download `sulaunchhelper2.sh` itself:
|
||||
|
||||
- Then to download `sulaunchhelper2.sh` itself:
|
||||
|
||||
```sh
|
||||
curl -OL https://gitlab.com/tretrauit/scripts/-/raw/main/games/LoL/linux/sulaunchhelper2.sh
|
||||
chmod +x sulaunchhelper2.sh
|
||||
```
|
||||
+ After that, copy all these files to the game prefix you want to use, then in Lutris:
|
||||
- Set pre-launch script in Lutris to where `sulaunchhelper2.sh` is located.
|
||||
- Disable **Wait for pre-launch script completion**
|
||||
- Enable **Disable Lutris Runtime**
|
||||
> Failure to do above steps will result in Zenity can't show necessary messages dialog so LoL UI can't launch properly.
|
||||
+ Enjoy your LoL experience :P
|
||||
|
||||
- After that, copy all these files to the game prefix you want to use, then in Lutris: - Set pre-launch script in Lutris to where `sulaunchhelper2.sh` is located. - Disable **Wait for pre-launch script completion** - Enable **Disable Lutris Runtime**
|
||||
> Failure to do above steps will result in Zenity can't show necessary messages dialog so LoL UI can't launch properly.
|
||||
- Enjoy your LoL experience :P
|
||||
|
||||
## [`discord_rpc.sh`](../../../apps/Lutris#discord_rpcsh)
|
||||
+ This script will bridge Discord RPC from LoL prefix to your linux Discord.
|
||||
> Note: The script in current directory [`discord_rpc.sh`](./discord_rpc.sh) is modified from the script mentioned above to work properly with `sulaunchhelper2.sh`,
|
||||
the installation is the same **except** when installing the script itself, execute this instead:
|
||||
|
||||
- This script will bridge Discord RPC from LoL prefix to your linux Discord.
|
||||
> Note: The script in current directory [`discord_rpc.sh`](./discord_rpc.sh) is modified from the script mentioned above to work properly with `sulaunchhelper2.sh`,
|
||||
> the installation is the same **except** when installing the script itself, execute this instead:
|
||||
|
||||
```sh
|
||||
curl -OL https://gitlab.com/tretrauit/scripts/-/raw/main/games/LoL/linux/discord_rpc.sh
|
||||
chmod +x discord_rpc.sh
|
||||
```
|
||||
|
||||
## Deprecated
|
||||
|
||||
### `garena_wrapper.sh`
|
||||
|
||||
> Garena no longer owns LoL so to play LoL you need to use Rito Client.
|
||||
|
||||
This script automates the launching of [lol.py](https://github.com/nhubaotruong/league-of-legends-linux-garena-script) (LoL in Garena client) so you don't have to manually do it ;)
|
||||
|
||||
#### Installation
|
||||
|
||||
> This script no longer wraps `syscall_check.sh`, if you need to execute that script alongside this one, I recommend you to take a look at [`preloader.sh`](../../../apps/Lutris#preloadersh)
|
||||
If you plan to use `preloader.sh` then I **highly recommend you** to **disable logging**, because **lol.py and `preloader.sh` will log your token to ./preloader/preloader_garena_wrapper.sh.log if you keep it enabled**, hence your account may get compromised.
|
||||
> If you plan to use `preloader.sh` then I **highly recommend you** to **disable logging**, because **lol.py and `preloader.sh` will log your token to ./preloader/preloader_garena_wrapper.sh.log if you keep it enabled**, hence your account may get compromised.
|
||||
|
||||
You need to follow steps in `lol.py` repository to properly config your LoL prefix.
|
||||
+ To install you must have `lol.py` present, if not you can execute these to quickly download them (to current directory):
|
||||
|
||||
- To install you must have `lol.py` present, if not you can execute these to quickly download them (to current directory):
|
||||
|
||||
```sh
|
||||
curl -OL https://raw.githubusercontent.com/nhubaotruong/league-of-legends-linux-garena-script/main/lol.py
|
||||
chmod +x lol.py
|
||||
```
|
||||
+ Then to download `garena_wrapper.sh` itself:
|
||||
|
||||
- Then to download `garena_wrapper.sh` itself:
|
||||
|
||||
```sh
|
||||
curl -OL https://gitlab.com/tretrauit/scripts/-/raw/main/games/LoL/linux/garena_wrapper.sh
|
||||
chmod +x garena_wrapper.sh
|
||||
```
|
||||
+ After that, copy all these files to the game prefix you want to use, then in Lutris:
|
||||
- Set pre-launch script in Lutris to where `garena_wrapper.sh` is located.
|
||||
- Disable **Wait for pre-launch script completion**
|
||||
- Enable **Disable Lutris Runtime**
|
||||
> Failure to do above steps will result in Zenity can't show necessary messages dialog so LoL UI may not launch properly (it'll still launch if you use `sulaunchhelper2.sh` and have installed it correctly).
|
||||
+ Enjoy your Garena LoL experience :P
|
||||
|
||||
- After that, copy all these files to the game prefix you want to use, then in Lutris: - Set pre-launch script in Lutris to where `garena_wrapper.sh` is located. - Disable **Wait for pre-launch script completion** - Enable **Disable Lutris Runtime**
|
||||
> Failure to do above steps will result in Zenity can't show necessary messages dialog so LoL UI may not launch properly (it'll still launch if you use `sulaunchhelper2.sh` and have installed it correctly).
|
||||
- Enjoy your Garena LoL experience :P
|
||||
|
||||
Reference in New Issue
Block a user