JSFiddle - React, Tailwind, and code Playground
JavaScript
////////////record start time
var getTimeOnStart = new Date();
var TimeOnStart = getTimeOnStart.getTime();
console.log(TimeOnStart);
function timePlayed() {
var getCurrentTime = new Date();
var currentTime = getCurrentTime.getTime();
///Time played in hours
var timePlayed = (currentTime - TimeOnStart) / 3600000;
return timePlayed;
}
var startXP = functon() {
var a = skills[0][Player.Mods.Expbar.set_skill].xp;
return a;
}
////
function ExpPerHour() {
var currentXP = skills[0][Player.Mods.Expbar.set_skill].xp; /// should have updated when this gets called again
var gainedXP = currentXP - startXP;
var ExpPerHour = gainedXP / timePlayed();
console.log(Math.floor(ExpPerHour) + " EXP/H");
console.log(gainedXP + " XP gained so far");
console.log(Math.floor(timePlayed() * 1000) + "seconds");
return ExpPerHour;
}
socket.on("message", function (data) {
if (typeof data === "object" && data.action) {
if (data.action == "skills") {
ExpPerHour();
}
}
});