Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions src/Employee.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,22 @@
// @description try to take over the world!
// @match https://www.logitycoon.com/eu1/index.php?a=employees_select&e=*
// @match https://www.logitycoon.com/eu1/index.php?a=employees_sleep&e=*
// @grant none
// @grant GM_log
// @downloadURL https://raw.githubusercontent.com/CheatGaming/LogiTycoon/main/Employee.js
// ==/UserScript==

(function() {
'use strict';
(function () {
"use strict";

//Sleeping because of entering URL. Close window.
window.close();
function script() {
const sleep = document.querySelector(`button[onclick="employeesleep()"]`);

if (sleep === null) {
window.close();
} else {
sleep.click();
}
}

script();
})();
136 changes: 76 additions & 60 deletions src/Employees.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,78 +5,94 @@
// @version 0.1
// @description try to take over the world!
// @match https://www.logitycoon.com/eu1/index.php?a=employees
// @grant none
// @grant GM_log
// @downloadURL https://raw.githubusercontent.com/CheatGaming/LogiTycoon/main/Employees.js
// ==/UserScript==

(function() {
'use strict';
let employees = [];
(function () {
"use strict";

function OpenNewTab(id){
window.open('https://www.logitycoon.com/eu1/index.php?a=employees_sleep&e=' + id, '_blank');
}
let employees = [];

function AutoRefresh( t ) {
setTimeout("location.reload(true);", t);
}
function OpenNewTab(id) {
window.open(
"https://www.logitycoon.com/eu1/index.php?a=employees_select&e=" + id,
"_blank"
);
}

function ParseInnerText(t, percentIndex, actionIndex) {
if(!!t){
let split = t.split('\t');
console.log(split);
return {
action: split[actionIndex],
percent: split[percentIndex]
};
}
return {};
function AutoRefresh(t) {
setTimeout("location.reload(true);", t);
}

function ParseInnerText(t, percentIndex, actionIndex) {
if (!!t) {
let split = t.split("\t");
return {
action: split[actionIndex],
percent: split[percentIndex],
};
}
return {};
}

function Sleep(employee){
if(employee.action !== 'Nothing'){
return;
}
if(employee.percent === '100 %'){
return;
}
OpenNewTab(employee.id);
function Sleep(employee) {
if (employee.action !== "Nothing") {
return;
}
if (employee.percent === "100 %") {
return;
}
OpenNewTab(employee.id);
}

$($('table')[0]).children('tbody')
.children('tr')
.each((i,e) => {
let status = ParseInnerText(e.innerText,4,6);
employees.push({
id: $(e).children('td').children('a').attr('href').split('=')[2],
action: status.action,
percent: status.percent
});
})
$($("table")[0])
.children("tbody")
.children("tr")
.each((i, e) => {
let status = ParseInnerText(e.innerText, 4, 6);
let info = {
id: $(e).children("td").children("a").attr("href").split("=")[2],
action: status.action,
percent: status.percent,
};
if (info.percent !== "100%" && info.action === "Nothing") {
employees.push(info);
}
});

$($('table')[1]).children('tbody')
.children('tr')
.each((i,e) => {
let status = ParseInnerText(e.innerText,4,5);
employees.push({
id: $(e).children('td').children('a').attr('href').split('=')[2],
action: status.action,
percent: status.percent
});
})
$($("table")[1])
.children("tbody")
.children("tr")
.each((i, e) => {
let status = ParseInnerText(e.innerText, 4, 5);
let info = {
id: $(e).children("td").children("a").attr("href").split("=")[2],
action: status.action,
percent: status.percent,
};
if (info.percent !== "100%" && info.action === "Nothing") {
employees.push(info);
}
});

$($('table')[4]).children('tbody')
.children('tr')
.each((i,e) => {
let status = ParseInnerText(e.innerText,3,4);
employees.push({
id: $(e).children('td').children('a').attr('href').split('=')[2],
action: status.action,
percent: status.percent
});
})
$($("table")[3])
.children("tbody")
.children("tr")
.each((i, e) => {
let status = ParseInnerText(e.innerText, 3, 4);
let info = {
id: $(e).children("td").children("a").attr("href").split("=")[2],
action: status.action,
percent: status.percent,
};
if (info.percent !== "100%" && info.action === "Nothing") {
employees.push(info);
}
});

employees.forEach(Sleep);
console.log(employees);
employees.forEach(Sleep);

AutoRefresh(11000);
AutoRefresh(30000);
})();
112 changes: 63 additions & 49 deletions src/Garage.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,59 +5,73 @@
// @version 0.5
// @description try to take over the world!
// @match https://www.logitycoon.com/eu1/index.php?a=garage
// @grant none
// @grant GM_log
// @downloadURL https://raw.githubusercontent.com/CheatGaming/LogiTycoon/main/Garage.js
// @require https://raw.githubusercontent.com/CheatGaming/LogiTycoon/main/src/shared/Utils.js
// ==/UserScript==

(function() {
'use strict';
let trucks = [];
let trailers = [];

function onlyUnique(value, index, self) {
return self.indexOf(value) === index;
}

function Open(){
$('.mt-action-row').each((i,e) => {
let isNothing = $(e).find('.mt-action-desc')[0].innerText.includes('Nothing');
let isTruck = $(e).find('.mt-action-author')[0].innerText.includes('Truck');
let isTrailer = $(e).find('.mt-action-author')[0].innerText.includes('Trailer');
let id = $(e).find('input[value=Information]').attr('onclick').split('=')[3].split("'")[0];
let percent = $(e).find('b:contains(%)')[0].innerText;

if(isNothing && percent !== '100 %'){
if(isTruck){
trucks.push(id);
}
if(isTrailer){
trailers.push(id);
}
}
})

trucks = trucks.filter(onlyUnique);
trailers = trailers.filter(onlyUnique);

trucks.forEach(id => {
Utils.Open.truck(id);
})

trailers.forEach(id => {
Utils.Open.trailer(id);
})

if(windows.length > 0) {
setInterval(() => {
if(Utils.Status.windows.every(w => w.closed)){
Utils.Refresh();
}
}, 500);
} else {
Utils.Refresh(10000);
(function () {
"use strict";
let trucks = [];
let trailers = [];

function onlyUnique(value, index, self) {
return self.indexOf(value) === index;
}

function Open() {
$(".mt-action-row").each((i, e) => {
let isNothing = $(e)
.find(".mt-action-desc")[0]
.innerText.includes("Nothing");
let isTruck = $(e)
.find(".mt-action-author")[0]
.innerText.includes("Truck");
let isTrailer = $(e)
.find(".mt-action-author")[0]
.innerText.includes("Trailer");
let id = $(e)
.find("input[value=Information]")
.attr("onclick")
.split("=")[3]
.split("'")[0];
let percent = $(e).find("b:contains(%)")[0].innerText;

if (isNothing && percent !== "100 %") {
if (isTruck) {
trucks.push(id);
}
if (isTrailer) {
trailers.push(id);
}
}
}
});

trucks = trucks.filter(onlyUnique);
trailers = trailers.filter(onlyUnique);

console.log(trailers);
// Loop through the trucks array
trucks.forEach((truck) => {
// Get the button with the matching value
const button = document.querySelector(
`button[name="repairtruck"][value="${truck}"]`
);
// Click the button
button.click();
});

trailers.forEach((id) => {
const repair = document.querySelector(
`button[name="repairtrailer"][value="${id}"]`
);
repair.click();
});

setTimeout(function () {
window.location.reload();
}, 30000);
}

Open();
Open();
})();