Merge pull request #1 from danilotitato/develop

Random Hour implementation
This commit is contained in:
Lea
2023-03-02 01:13:36 +01:00
committed by GitHub
8 changed files with 251 additions and 479 deletions
+13 -19
View File
@@ -1,5 +1,6 @@
// Happy Hour
var happy_hour = true // set to true or false, to enable/disable the happy hours function
var random_hour = true
var randHappy = false // only works if happy_hour = true
var scheduleHappy = false // only works if happy_hour = true
@@ -13,6 +14,7 @@ var bulk_enabled = false
//Shortcuts
var pauseShort = "ctrl+alt+p"
var happyHourShort = "ctrl+alt+h"
var randomHourShort = "ctrl+alt+r"
// Login Data
var twitch_channel_name = ""
@@ -59,24 +61,16 @@ var seconds_added_per_chests = 30
// General Twitch, Streamlabs And StreamElements Config for Happy Hour
var seconds_added_per_sub_prime_happy = 85
var seconds_added_per_sub_tier1_happy = 85
var seconds_added_per_sub_tier2_happy = 300
var seconds_added_per_sub_tier3_happy = 960
var factor_t1 = 1.5
var factor_t2 = 1.75
var factor_t3 = 2.0
var factor_bits = 1.5
var factor_donations = 1.5
var seconds_added_per_resub_prime_happy = 85
var seconds_added_per_resub_tier1_happy = 85
var seconds_added_per_resub_tier2_happy = 300
var seconds_added_per_resub_tier3_happy = 960
var seconds_added_per_giftsub_tier1_happy = 85
var seconds_added_per_giftsub_tier2_happy = 300
var seconds_added_per_giftsub_tier3_happy = 960
var seconds_added_per_bits_happy = 60
// Streamlabs And StreamElements Config
var seconds_added_per_donation_happy = 60
// Streamloots Config
var seconds_added_per_chests_happy = 60
// General Twitch, Streamlabs And StreamElements Config for Random Hour
var range_t1 = [0.5, 2]
var range_t2 = [1.0, 3]
var range_t3 = [2.0, 5]
var range_bits = [0.5, 2]
var range_donations = [0.5, 2]
+3 -3
View File
@@ -44,9 +44,9 @@ body {
visibility: hidden;
}
#HappyHourText {
#SpecialHourText {
opacity: 0;
font-size: 2.8rem;
font-size: 2.5rem;
display: flex;
justify-content: center;
align-items: center;
@@ -71,7 +71,7 @@ body {
height: 100%;
} */
#HappyHourHTML {
#SpecialHourHTML {
top:-200px;
position: relative;
}
+4 -4
View File
@@ -23,10 +23,10 @@
<div id="textDiv">
<p id="timeText">00:00:00</p>
</div>
<div id="HappyHourHTML">
<p id="HappyHourText">Happy Hour Activated!</p>
<!-- <p id="HappyHourDeactive">Happy Hour Deactivated :(</p>
<p id="HappyHourError">Happy Hour not available D:</p> -->
<div id="SpecialHourHTML">
<p id="SpecialHourText">Happy Hour Activated!</p>
<!-- <p id="SpecialHourDeactive">Happy Hour Deactivated :(</p>
<p id="SpecialHourError">Happy Hour not available D:</p> -->
</div>
<canvas id="canvas"></canvas>
</div>
+33 -109
View File
@@ -34,59 +34,65 @@ if (streamelements_token !== "") {
function onEvent(data) {
logObject("StreamElements", data);
if (!countdownEnded && !happy_hour_active) {
if (!countdownEnded) {
let factor_t1_local = (happy_hour_active ? factor_t1 : 1) * (random_hour_active ? randomInRangeNoRounding(...range_t1): 1);
let factor_t2_local = (happy_hour_active ? factor_t2 : 1) * (random_hour_active ? randomInRangeNoRounding(...range_t2): 1);
let factor_t3_local = (happy_hour_active ? factor_t3 : 1) * (random_hour_active ? randomInRangeNoRounding(...range_t3): 1);
let factor_bits_local = (happy_hour_active ? factor_bits : 1) * (random_hour_active ? randomInRangeNoRounding(...range_bits): 1);
let factor_donations_local = (happy_hour_active ? factor_donations : 1) * (random_hour_active ? randomInRangeNoRounding(...range_donations): 1);
if ((data['listener'] === "subscriber-latest") && subEnable) {
if (data['event']['gifted'] || data['event']['bulkGifted']) {
let amount;
if (data['event']['gifted']) amount = 1;
else amount = data['event']['amount'];
if (data['event']['tier'] == "prime" || data['event']['tier'] == "1000") {
addTime(endingTime, seconds_added_per_giftsub_tier1 * amount);
logMessage("StreamElements", `Added ${seconds_added_per_giftsub_tier1 * amount} Seconds Because ${data['event']['name']} Gifted ${amount} Tier 1 Subs`);
addTime(endingTime, seconds_added_per_giftsub_tier1 * amount * factor_t1_local);
logMessage("StreamElements", `Added ${seconds_added_per_giftsub_tier1 * amount * factor_t1_local} Seconds Because ${data['event']['name']} Gifted ${amount} Tier 1 Subs`);
}
else if (data['event']['tier'] == "2000") {
addTime(endingTime, seconds_added_per_giftsub_tier2 * amount);
logMessage("StreamElements", `Added ${seconds_added_per_giftsub_tier2 * amount} Seconds Because ${data['event']['name']} Gifted ${amount} Tier 2 Subs`);
addTime(endingTime, seconds_added_per_giftsub_tier2 * amount * factor_t2_local);
logMessage("StreamElements", `Added ${seconds_added_per_giftsub_tier2 * amount * factor_t2_local} Seconds Because ${data['event']['name']} Gifted ${amount} Tier 2 Subs`);
}
else if (data['event']['tier'] == "3000") {
addTime(endingTime, seconds_added_per_giftsub_tier3 * amount);
logMessage("StreamElements", `Added ${seconds_added_per_giftsub_tier3 * amount} Seconds Because ${data['event']['name']} Gifted ${amount} Tier 3 Subs`);
addTime(endingTime, seconds_added_per_giftsub_tier3 * amount * factor_t3_local);
logMessage("StreamElements", `Added ${seconds_added_per_giftsub_tier3 * amount * factor_t3_local} Seconds Because ${data['event']['name']} Gifted ${amount} Tier 3 Subs`);
}
}
else if (data['event']['amount'] != "1") {
if (data['event']['tier'] == "prime") {
addTime(endingTime, seconds_added_per_resub_prime);
logMessage("StreamElements", `Added ${seconds_added_per_resub_prime} Seconds Because ${data['event']['name']} ReSubscribed With Prime`);
addTime(endingTime, seconds_added_per_resub_prime * factor_t1_local);
logMessage("StreamElements", `Added ${seconds_added_per_resub_prime * factor_t1_local} Seconds Because ${data['event']['name']} ReSubscribed With Prime`);
}
else if (data['event']['tier'] == "1000") {
addTime(endingTime, seconds_added_per_resub_tier1);
logMessage("StreamElements", `Added ${seconds_added_per_resub_tier1} Seconds Because ${data['event']['name']} ReSubscribed With Tier 1`);
addTime(endingTime, seconds_added_per_resub_tier1 * factor_t1_local);
logMessage("StreamElements", `Added ${seconds_added_per_resub_tier1 * factor_t1_local} Seconds Because ${data['event']['name']} ReSubscribed With Tier 1`);
}
else if (data['event']['tier'] == "2000") {
addTime(endingTime, seconds_added_per_resub_tier2);
logMessage("StreamElements", `Added ${seconds_added_per_resub_tier2} Seconds Because ${data['event']['name']} ReSubscribed With Tier 2`);
addTime(endingTime, seconds_added_per_resub_tier2 * factor_t2_local);
logMessage("StreamElements", `Added ${seconds_added_per_resub_tier2 * factor_t2_local} Seconds Because ${data['event']['name']} ReSubscribed With Tier 2`);
}
else if (data['event']['tier'] == "3000") {
addTime(endingTime, seconds_added_per_resub_tier3);
logMessage("StreamElements", `Added ${seconds_added_per_resub_tier3} Seconds Because ${data['event']['name']} ReSubscribed With Tier 3`);
addTime(endingTime, seconds_added_per_resub_tier3 * factor_t3_local);
logMessage("StreamElements", `Added ${seconds_added_per_resub_tier3 * factor_t3_local} Seconds Because ${data['event']['name']} ReSubscribed With Tier 3`);
}
}
else {
if (data['event']['tier'] == "prime") {
addTime(endingTime, seconds_added_per_sub_prime);
logMessage("StreamElements", `Added ${seconds_added_per_sub_prime} Seconds Because ${data['event']['name']} Subscribed With Prime`);
addTime(endingTime, seconds_added_per_sub_prime * factor_t1_local);
logMessage("StreamElements", `Added ${seconds_added_per_sub_prime * factor_t1_local} Seconds Because ${data['event']['name']} Subscribed With Prime`);
}
else if (data['event']['tier'] == "1000") {
addTime(endingTime, seconds_added_per_sub_tier1);
logMessage("StreamElements", `Added ${seconds_added_per_sub_tier1} Seconds Because ${data['event']['name']} Subscribed With Tier 1`);
addTime(endingTime, seconds_added_per_sub_tier1 * factor_t1_local);
logMessage("StreamElements", `Added ${seconds_added_per_sub_tier1 * factor_t1_local} Seconds Because ${data['event']['name']} Subscribed With Tier 1`);
}
else if (data['event']['tier'] == "2000") {
addTime(endingTime, seconds_added_per_sub_tier2);
logMessage("StreamElements", `Added ${seconds_added_per_sub_tier2} Seconds Because ${data['event']['name']} Subscribed With Tier 2`);
addTime(endingTime, seconds_added_per_sub_tier2 * factor_t2_local);
logMessage("StreamElements", `Added ${seconds_added_per_sub_tier2 * factor_t2_local} Seconds Because ${data['event']['name']} Subscribed With Tier 2`);
}
else if (data['event']['tier'] == "3000") {
addTime(endingTime, seconds_added_per_sub_tier3);
logMessage("StreamElements", `Added ${seconds_added_per_sub_tier3} Seconds Because ${data['event']['name']} Subscribed With Tier 3`);
addTime(endingTime, seconds_added_per_sub_tier3 * factor_t3_local);
logMessage("StreamElements", `Added ${seconds_added_per_sub_tier3 * factor_t3_local} Seconds Because ${data['event']['name']} Subscribed With Tier 3`);
}
}
if (!users.includes(data['event']['name'])) {
@@ -97,8 +103,8 @@ if (streamelements_token !== "") {
else if ((data['listener'] === "cheer-latest") && bitEnable) {
if (data['event']['amount'] >= min_amount_of_bits) {
let times = Math.floor(data['event']['amount']/min_amount_of_bits);
addTime(endingTime, seconds_added_per_bits * times);
logMessage("StreamElements", `Added ${seconds_added_per_bits * times} Seconds Because ${data['event']['name']} Donated ${data['event']['amount']} Bits`);
addTime(endingTime, seconds_added_per_bits * times * factor_bits_local);
logMessage("StreamElements", `Added ${seconds_added_per_bits * times * factor_bits_local} Seconds Because ${data['event']['name']} Donated ${data['event']['amount']} Bits`);
if (!users.includes(data['event']['name'])) {
users.push(data['event']['name']);
}
@@ -108,90 +114,8 @@ if (streamelements_token !== "") {
else if ((data['listener'] === "tip-latest") && donationEnable) {
if (data['event']['amount'] >= min_donation_amount) {
let times = Math.floor(data['event']['amount']/min_donation_amount);
addTime(endingTime, seconds_added_per_donation * times);
logMessage("StreamElements", `Added ${seconds_added_per_donation * times} Seconds Because ${data['event']['name']} Donated ${data['event']['amount']}$`);
if (!users.includes(data['event']['name'])) {
users.push(data['event']['name']);
}
}
}
}
else if (!countdownEnded && happy_hour_active) {
if ((data['listener'] === "subscriber-latest") && subEnable) {
if (data['event']['gifted'] || data['event']['bulkGifted']) {
let amount;
if (data['event']['gifted']) amount = 1;
else amount = data['event']['amount'];
if (data['event']['tier'] == "prime" || data['event']['tier'] == "1000") {
addTime(endingTime, seconds_added_per_giftsub_tier1_happy * amount);
logMessage("StreamElements", `Added ${seconds_added_per_giftsub_tier1_happy * amount} Seconds Because ${data['event']['name']} Gifted ${amount} Tier 1 Subs`);
}
else if (data['event']['tier'] == "2000") {
addTime(endingTime, seconds_added_per_giftsub_tier2_happy * amount);
logMessage("StreamElements", `Added ${seconds_added_per_giftsub_tier2_happy * amount} Seconds Because ${data['event']['name']} Gifted ${amount} Tier 2 Subs`);
}
else if (data['event']['tier'] == "3000") {
addTime(endingTime, seconds_added_per_giftsub_tier3_happy * amount);
logMessage("StreamElements", `Added ${seconds_added_per_giftsub_tier3_happy * amount} Seconds Because ${data['event']['name']} Gifted ${amount} Tier 3 Subs`);
}
}
else if (data['event']['amount'] != "1") {
if (data['event']['tier'] == "prime") {
addTime(endingTime, seconds_added_per_resub_prime_happy);
logMessage("StreamElements", `Added ${seconds_added_per_resub_prime_happy} Seconds Because ${data['event']['name']} ReSubscribed With Prime`);
}
else if (data['event']['tier'] == "1000") {
addTime(endingTime, seconds_added_per_resub_tier1_happy);
logMessage("StreamElements", `Added ${seconds_added_per_resub_tier1_happy} Seconds Because ${data['event']['name']} ReSubscribed With Tier 1`);
}
else if (data['event']['tier'] == "2000") {
addTime(endingTime, seconds_added_per_resub_tier2_happy);
logMessage("StreamElements", `Added ${seconds_added_per_resub_tier2_happy} Seconds Because ${data['event']['name']} ReSubscribed With Tier 2`);
}
else if (data['event']['tier'] == "3000") {
addTime(endingTime, seconds_added_per_resub_tier3_happy);
logMessage("StreamElements", `Added ${seconds_added_per_resub_tier3_happy} Seconds Because ${data['event']['name']} ReSubscribed With Tier 3`);
}
}
else {
if (data['event']['tier'] == "prime") {
addTime(endingTime, seconds_added_per_sub_prime_happy);
logMessage("StreamElements", `Added ${seconds_added_per_sub_prime_happy} Seconds Because ${data['event']['name']} Subscribed With Prime`);
}
else if (data['event']['tier'] == "1000") {
addTime(endingTime, seconds_added_per_sub_tier1_happy);
logMessage("StreamElements", `Added ${seconds_added_per_sub_tier1_happy} Seconds Because ${data['event']['name']} Subscribed With Tier 1`);
}
else if (data['event']['tier'] == "2000") {
addTime(endingTime, seconds_added_per_sub_tier2_happy);
logMessage("StreamElements", `Added ${seconds_added_per_sub_tier2_happy} Seconds Because ${data['event']['name']} Subscribed With Tier 2`);
}
else if (data['event']['tier'] == "3000") {
addTime(endingTime, seconds_added_per_sub_tier3_happy);
logMessage("StreamElements", `Added ${seconds_added_per_sub_tier3_happy} Seconds Because ${data['event']['name']} Subscribed With Tier 3`);
}
}
if (!users.includes(data['event']['name'])) {
users.push(data['event']['name']);
}
}
else if ((data['listener'] === "cheer-latest") && bitEnable) {
if (data['event']['amount'] >= min_amount_of_bits) {
let times = Math.floor(data['event']['amount']/min_amount_of_bits);
addTime(endingTime, seconds_added_per_bits_happy * times);
logMessage("StreamElements", `Added ${seconds_added_per_bits_happy * times} Seconds Because ${data['event']['name']} Donated ${data['event']['amount']} Bits`);
if (!users.includes(data['event']['name'])) {
users.push(data['event']['name']);
}
}
}
else if ((data['listener'] === "tip-latest") && donationEnable) {
if (data['event']['amount'] >= min_donation_amount) {
let times = Math.floor(data['event']['amount']/min_donation_amount);
addTime(endingTime, seconds_added_per_donation_happy * times);
logMessage("StreamElements", `Added ${seconds_added_per_donation_happy * times} Seconds Because ${data['event']['name']} Donated ${data['event']['amount']}$`);
addTime(endingTime, seconds_added_per_donation * times * factor_donations_local);
logMessage("StreamElements", `Added ${seconds_added_per_donation * times * factor_donations_local} Seconds Because ${data['event']['name']} Donated ${data['event']['amount']}$`);
if (!users.includes(data['event']['name'])) {
users.push(data['event']['name']);
}
+68 -162
View File
@@ -7,171 +7,90 @@ if (streamlabs_token !== "") {
socket.on("event", (event) => {
logObject("Streamlabs", event);
let factor_t1_local = (happy_hour_active ? factor_t1 : 1) * (random_hour_active ? randomInRangeNoRounding(...range_t1): 1);
let factor_t2_local = (happy_hour_active ? factor_t2 : 1) * (random_hour_active ? randomInRangeNoRounding(...range_t2): 1);
let factor_t3_local = (happy_hour_active ? factor_t3 : 1) * (random_hour_active ? randomInRangeNoRounding(...range_t3): 1);
let factor_bits_local = (happy_hour_active ? factor_bits : 1) * (random_hour_active ? randomInRangeNoRounding(...range_bits): 1);
let factor_donations_local = (happy_hour_active ? factor_donations : 1) * (random_hour_active ? randomInRangeNoRounding(...range_donations): 1);
if (event.type == "subscription" && !event.message[0].gifter) {
if (!countdownEnded && subEnable) {
if(!happy_hour_active){
if (event.message[0].sub_plan == "1000") {
addTime(endingTime, seconds_added_per_sub_tier1);
logMessage("Streamlabs", `Added ${seconds_added_per_sub_tier1} Seconds Because ${event.message[0].name} Subscribed With Tier 1`);
}
else if (event.message[0].sub_plan == "2000") {
addTime(endingTime, seconds_added_per_sub_tier2);
logMessage("Streamlabs", `Added ${seconds_added_per_sub_tier2} Seconds Because ${event.message[0].name} Subscribed With Tier 2`);
}
else if (event.message[0].sub_plan == "3000") {
addTime(endingTime, seconds_added_per_sub_tier3);
logMessage("Streamlabs", `Added ${seconds_added_per_sub_tier3} Seconds Because ${event.message[0].name} Subscribed With Tier 3`);
}
else {
addTime(endingTime, seconds_added_per_sub_prime);
logMessage("Streamlabs", `Added ${seconds_added_per_sub_prime} Seconds Because ${event.message[0].name} Subscribed With Prime`);
}
if (!users.includes(event.message[0].name)) {
users.push(event.message[0].name);
}
if (event.message[0].sub_plan == "1000") {
addTime(endingTime, seconds_added_per_sub_tier1 * factor_t1_local);
logMessage("Streamlabs", `Added ${seconds_added_per_sub_tier1 * factor_t1_local} Seconds Because ${event.message[0].name} Subscribed With Tier 1`);
}
else if(!happy_hour_active){
if (event.message[0].sub_plan == "1000") {
addTime(endingTime, seconds_added_per_sub_tier1_happy);
logMessage("Streamlabs", `Added ${seconds_added_per_sub_tier1_happy} Seconds Because ${event.message[0].name} Subscribed With Tier 1`);
}
else if (event.message[0].sub_plan == "2000") {
addTime(endingTime, seconds_added_per_sub_tier2_happy);
logMessage("Streamlabs", `Added ${seconds_added_per_sub_tier2_happy} Seconds Because ${event.message[0].name} Subscribed With Tier 2`);
}
else if (event.message[0].sub_plan == "3000") {
addTime(endingTime, seconds_added_per_sub_tier3_happy);
logMessage("Streamlabs", `Added ${seconds_added_per_sub_tier3_happy} Seconds Because ${event.message[0].name} Subscribed With Tier 3`);
}
else {
addTime(endingTime, seconds_added_per_sub_prime_happy);
logMessage("Streamlabs", `Added ${seconds_added_per_sub_prime_happy} Seconds Because ${event.message[0].name} Subscribed With Prime`);
}
if (!users.includes(event.message[0].name)) {
users.push(event.message[0].name);
}
else if (event.message[0].sub_plan == "2000") {
addTime(endingTime, seconds_added_per_sub_tier2 * factor_t2_local);
logMessage("Streamlabs", `Added ${seconds_added_per_sub_tier2 * factor_t2_local} Seconds Because ${event.message[0].name} Subscribed With Tier 2`);
}
else if (event.message[0].sub_plan == "3000") {
addTime(endingTime, seconds_added_per_sub_tier3 * factor_t3_local);
logMessage("Streamlabs", `Added ${seconds_added_per_sub_tier3 * factor_t3_local} Seconds Because ${event.message[0].name} Subscribed With Tier 3`);
}
else {
addTime(endingTime, seconds_added_per_sub_prime * factor_t1_local);
logMessage("Streamlabs", `Added ${seconds_added_per_sub_prime * factor_t1_local} Seconds Because ${event.message[0].name} Subscribed With Prime`);
}
if (!users.includes(event.message[0].name)) {
users.push(event.message[0].name);
}
}
}
else if (event.type == "resub" && !event.message[0].gifter) {
if (!countdownEnded && subEnable) {
if(!happy_hour_active){
if (event.message[0].sub_plan == "1000") {
addTime(endingTime, seconds_added_per_resub_tier1);
logMessage("Streamlabs", `Added ${seconds_added_per_resub_tier1} Seconds Because ${event.message[0].name} ReSubscribed With Tier 1`);
}
else if (event.message[0].sub_plan == "2000") {
addTime(endingTime, seconds_added_per_resub_tier2);
logMessage("Streamlabs", `Added ${seconds_added_per_resub_tier2} Seconds Because ${event.message[0].name} ReSubscribed With Tier 2`);
}
else if (event.message[0].sub_plan == "3000") {
addTime(endingTime, seconds_added_per_resub_tier3);
logMessage("Streamlabs", `Added ${seconds_added_per_resub_tier3} Seconds Because ${event.message[0].name} ReSubscribed With Tier 3`);
}
else {
addTime(endingTime, seconds_added_per_resub_prime);
logMessage("Streamlabs", `Added ${seconds_added_per_resub_prime} Seconds Because ${event.message[0].name} ReSubscribed With Prime`);
}
if (!users.includes(event.message[0].name)) {
users.push(event.message[0].name);
}
if (event.message[0].sub_plan == "1000") {
addTime(endingTime, seconds_added_per_resub_tier1 * factor_t1_local);
logMessage("Streamlabs", `Added ${seconds_added_per_resub_tier1 * factor_t1_local} Seconds Because ${event.message[0].name} ReSubscribed With Tier 1`);
}
else if(!happy_hour_active){
if (event.message[0].sub_plan == "1000") {
addTime(endingTime, seconds_added_per_resub_tier1_happy);
logMessage("Streamlabs", `Added ${seconds_added_per_resub_tier1_happy} Seconds Because ${event.message[0].name} ReSubscribed With Tier 1`);
}
else if (event.message[0].sub_plan == "2000") {
addTime(endingTime, seconds_added_per_resub_tier2_happy);
logMessage("Streamlabs", `Added ${seconds_added_per_resub_tier2_happy} Seconds Because ${event.message[0].name} ReSubscribed With Tier 2`);
}
else if (event.message[0].sub_plan == "3000") {
addTime(endingTime, seconds_added_per_resub_tier3_happy);
logMessage("Streamlabs", `Added ${seconds_added_per_resub_tier3_happy} Seconds Because ${event.message[0].name} ReSubscribed With Tier 3`);
}
else {
addTime(endingTime, seconds_added_per_resub_prime_happy);
logMessage("Streamlabs", `Added ${seconds_added_per_resub_prime_happy} Seconds Because ${event.message[0].name} ReSubscribed With Prime`);
}
if (!users.includes(event.message[0].name)) {
users.push(event.message[0].name);
}
else if (event.message[0].sub_plan == "2000") {
addTime(endingTime, seconds_added_per_resub_tier2 * factor_t2_local);
logMessage("Streamlabs", `Added ${seconds_added_per_resub_tier2 * factor_t2_local} Seconds Because ${event.message[0].name} ReSubscribed With Tier 2`);
}
else if (event.message[0].sub_plan == "3000") {
addTime(endingTime, seconds_added_per_resub_tier3 * factor_t3_local);
logMessage("Streamlabs", `Added ${seconds_added_per_resub_tier3 * factor_t3_local} Seconds Because ${event.message[0].name} ReSubscribed With Tier 3`);
}
else {
addTime(endingTime, seconds_added_per_resub_prime * factor_t1_local);
logMessage("Streamlabs", `Added ${seconds_added_per_resub_prime * factor_t1_local} Seconds Because ${event.message[0].name} ReSubscribed With Prime`);
}
if (!users.includes(event.message[0].name)) {
users.push(event.message[0].name);
}
}
}
else if (event.message[0].gifter) {
if (!countdownEnded && subEnable) {
if(!happy_hour_active){
if (event.message[0].sub_plan == "1000") {
addTime(endingTime, seconds_added_per_giftsub_tier1);
logMessage("Streamlabs", `Added ${seconds_added_per_giftsub_tier1} Seconds Because ${event.message[0].gifter} Gifted A Tier 1 Sub`);
}
else if (event.message[0].sub_plan == "2000") {
addTime(endingTime, seconds_added_per_giftsub_tier2);
logMessage("Streamlabs", `Added ${seconds_added_per_giftsub_tier2} Seconds Because ${event.message[0].gifter} Gifted A Tier 2 Sub`);
}
else if (event.message[0].sub_plan == "3000") {
addTime(endingTime, seconds_added_per_giftsub_tier3);
logMessage("Streamlabs", `Added ${seconds_added_per_giftsub_tier3} Seconds Because ${event.message[0].gifter} Gifted A Tier 3 Sub`);
}
else {
addTime(endingTime, seconds_added_per_giftsub_tier1);
logMessage("Streamlabs", `Added ${seconds_added_per_giftsub_tier1} Seconds Because ${event.message[0].gifter} Gifted A Tier 1 Sub`);
}
if (!users.includes(event.message[0].name)) {
users.push(event.message[0].name);
}
if (event.message[0].sub_plan == "1000") {
addTime(endingTime, seconds_added_per_giftsub_tier1 * factor_t1_local);
logMessage("Streamlabs", `Added ${seconds_added_per_giftsub_tier1 * factor_t1_local} Seconds Because ${event.message[0].gifter} Gifted A Tier 1 Sub`);
}
else if(happy_hour_active){
if (event.message[0].sub_plan == "1000") {
addTime(endingTime, seconds_added_per_giftsub_tier1_happy);
logMessage("Streamlabs", `Added ${seconds_added_per_giftsub_tier1_happy} Seconds Because ${event.message[0].gifter} Gifted A Tier 1 Sub`);
}
else if (event.message[0].sub_plan == "2000") {
addTime(endingTime, seconds_added_per_giftsub_tier2_happy);
logMessage("Streamlabs", `Added ${seconds_added_per_giftsub_tier2_happy} Seconds Because ${event.message[0].gifter} Gifted A Tier 2 Sub`);
}
else if (event.message[0].sub_plan == "3000") {
addTime(endingTime, seconds_added_per_giftsub_tier3_happy);
logMessage("Streamlabs", `Added ${seconds_added_per_giftsub_tier3_happy} Seconds Because ${event.message[0].gifter} Gifted A Tier 3 Sub`);
}
else {
addTime(endingTime, seconds_added_per_giftsub_tier1_happy);
logMessage("Streamlabs", `Added ${seconds_added_per_giftsub_tier1_happy} Seconds Because ${event.message[0].gifter} Gifted A Tier 1 Sub`);
}
if (!users.includes(event.message[0].name)) {
users.push(event.message[0].name);
}
else if (event.message[0].sub_plan == "2000") {
addTime(endingTime, seconds_added_per_giftsub_tier2 * factor_t2_local);
logMessage("Streamlabs", `Added ${seconds_added_per_giftsub_tier2 * factor_t2_local} Seconds Because ${event.message[0].gifter} Gifted A Tier 2 Sub`);
}
else if (event.message[0].sub_plan == "3000") {
addTime(endingTime, seconds_added_per_giftsub_tier3 * factor_t3_local);
logMessage("Streamlabs", `Added ${seconds_added_per_giftsub_tier3 * factor_t3_local} Seconds Because ${event.message[0].gifter} Gifted A Tier 3 Sub`);
}
if (!users.includes(event.message[0].name)) {
users.push(event.message[0].name);
}
}
}
else if (event.type == "donation") {
if (!countdownEnded && donationEnable) {
if(!happy_hour_active){
let dono = parseInt(event.message[0].amount);
let currency = event.message[0].currency;
if (dono >= min_donation_amount) {
let times = Math.floor(dono/min_donation_amount);
addTime(endingTime, seconds_added_per_donation * times);
logMessage("Streamlabs", `Added ${seconds_added_per_donation * times} Seconds Because ${event.message[0].name} Donated ${dono} ${currency}`);
if (!users.includes(event.message[0].name)) {
users.push(event.message[0].name);
}
}
}
else if(happy_hour_active){
let dono = parseInt(event.message[0].amount);
let currency = event.message[0].currency;
if (dono >= min_donation_amount) {
let times = Math.floor(dono/min_donation_amount);
addTime(endingTime, seconds_added_per_donation_happy * times);
logMessage("Streamlabs", `Added ${seconds_added_per_donation_happy * times} Seconds Because ${event.message[0].name} Donated ${dono} ${currency}`);
if (!users.includes(event.message[0].name)) {
users.push(event.message[0].name);
}
let dono = parseInt(event.message[0].amount);
let currency = event.message[0].currency;
if (dono >= min_donation_amount) {
let times = Math.floor(dono/min_donation_amount);
addTime(endingTime, seconds_added_per_donation * times * factor_donations_local);
logMessage("Streamlabs", `Added ${seconds_added_per_donation * times} Seconds Because ${event.message[0].name} Donated ${dono} ${currency}`);
if (!users.includes(event.message[0].name)) {
users.push(event.message[0].name);
}
}
}
@@ -179,26 +98,13 @@ if (streamlabs_token !== "") {
else if (event.type == "bits") {
if (!countdownEnded && donationEnable) {
if(!happy_hour_active){
let bits = parseInt(event.message[0].amount);
if (bits >= min_amount_of_bits) {
let times = Math.floor(bits/min_amount_of_bits);
addTime(endingTime, seconds_added_per_bits * times);
logMessage("Streamlabs", `Added ${seconds_added_per_bits * times} Seconds Because ${event.message[0].name} Donated ${bits} Bits`);
if (!users.includes(event.message[0].name)) {
users.push(event.message[0].name);
}
}
}
else if(happy_hour_active){
let bits = parseInt(event.message[0].amount);
if (bits >= min_amount_of_bits) {
let times = Math.floor(bits/min_amount_of_bits);
addTime(endingTime, seconds_added_per_bits_happy * times);
logMessage("Streamlabs", `Added ${seconds_added_per_bits_happy * times} Seconds Because ${event.message[0].name} Donated ${bits} Bits`);
if (!users.includes(event.message[0].name)) {
users.push(event.message[0].name);
}
let bits = parseInt(event.message[0].amount);
if (bits >= min_amount_of_bits) {
let times = Math.floor(bits/min_amount_of_bits);
addTime(endingTime, seconds_added_per_bits * times);
logMessage("Streamlabs", `Added ${seconds_added_per_bits * times * factor_bits_local} Seconds Because ${event.message[0].name} Donated ${bits} Bits`);
if (!users.includes(event.message[0].name)) {
users.push(event.message[0].name);
}
}
}
+71 -135
View File
@@ -12,45 +12,27 @@ if (twitch_channel_name !== "") {
client.on('subscription', (channel, username, methods, message, userstate) => {
if (!countdownEnded && subEnable) {
if(!happy_hour_active){
switch (methods['plan']) {
case "Prime":
addTime(endingTime, seconds_added_per_sub_prime);
logMessage("Twitch", `Added ${seconds_added_per_sub_prime} Seconds Because ${username} Subscribed With Prime`);
break;
case "1000":
addTime(endingTime, seconds_added_per_sub_tier1);
logMessage("Twitch", `Added ${seconds_added_per_sub_tier1} Seconds Because ${username} Subscribed With Tier 1`);
break;
case "2000":
addTime(endingTime, seconds_added_per_sub_tier2);
logMessage("Twitch", `Added ${seconds_added_per_sub_tier2} Seconds Because ${username} Subscribed With Tier 2`);
break;
case "3000":
addTime(endingTime, seconds_added_per_sub_tier3);
logMessage("Twitch", `Added ${seconds_added_per_sub_tier3} Seconds Because ${username} Subscribed With Tier 3`);
break;
}
}
else if(happy_hour_active){
switch (methods['plan']) {
case "Prime":
addTime(endingTime, seconds_added_per_sub_prime_happy);
logMessage("Twitch", `Added ${seconds_added_per_sub_prime_happy} Seconds Because ${username} Subscribed With Prime`);
break;
case "1000":
addTime(endingTime, seconds_added_per_sub_tier1_happy);
logMessage("Twitch", `Added ${seconds_added_per_sub_tier1_happy} Seconds Because ${username} Subscribed With Tier 1`);
break;
case "2000":
addTime(endingTime, seconds_added_per_sub_tier2_happy);
logMessage("Twitch", `Added ${seconds_added_per_sub_tier2_happy} Seconds Because ${username} Subscribed With Tier 2`);
break;
case "3000":
addTime(endingTime, seconds_added_per_sub_tier3_happy);
logMessage("Twitch", `Added ${seconds_added_per_sub_tier3_happy} Seconds Because ${username} Subscribed With Tier 3`);
break;
}
let factor_t1_local = (happy_hour_active ? factor_t1 : 1) * (random_hour_active ? randomInRangeNoRounding(...range_t1): 1);
let factor_t2_local = (happy_hour_active ? factor_t2 : 1) * (random_hour_active ? randomInRangeNoRounding(...range_t2): 1);
let factor_t3_local = (happy_hour_active ? factor_t3 : 1) * (random_hour_active ? randomInRangeNoRounding(...range_t3): 1);
switch (methods['plan']) {
case "Prime":
addTime(endingTime, seconds_added_per_sub_prime * factor_t1_local);
logMessage("Twitch", `Added ${seconds_added_per_sub_prime * factor_t1_local} Seconds Because ${username} Subscribed With Prime`);
break;
case "1000":
addTime(endingTime, seconds_added_per_sub_tier1 * factor_t1_local);
logMessage("Twitch", `Added ${seconds_added_per_sub_tier1 * factor_t1_local} Seconds Because ${username} Subscribed With Tier 1`);
break;
case "2000":
addTime(endingTime, seconds_added_per_sub_tier2 * factor_t2_local);
logMessage("Twitch", `Added ${seconds_added_per_sub_tier2 * factor_t2_local} Seconds Because ${username} Subscribed With Tier 2`);
break;
case "3000":
addTime(endingTime, seconds_added_per_sub_tier3 * factor_t3_local);
logMessage("Twitch", `Added ${seconds_added_per_sub_tier3 * factor_t3_local} Seconds Because ${username} Subscribed With Tier 3`);
break;
}
if (!users.includes(username)) {
users.push(username);
@@ -60,45 +42,27 @@ if (twitch_channel_name !== "") {
client.on('resub', (channel, username, months, message, userstate, methods) => {
if (!countdownEnded && subEnable) {
if(!happy_hour_active){
switch (methods['plan']) {
case "Prime":
addTime(endingTime, seconds_added_per_resub_prime);
logMessage("Twitch", `Added ${seconds_added_per_resub_prime} Seconds Because ${username} ReSubscribed With Prime`);
break;
case "1000":
addTime(endingTime, seconds_added_per_resub_tier1);
logMessage("Twitch", `Added ${seconds_added_per_resub_tier1} Seconds Because ${username} ReSubscribed With Tier 1`);
break;
case "2000":
addTime(endingTime, seconds_added_per_resub_tier2);
logMessage("Twitch", `Added ${seconds_added_per_resub_tier2} Seconds Because ${username} ReSubscribed With Tier 2`);
break;
case "3000":
addTime(endingTime, seconds_added_per_resub_tier3);
logMessage("Twitch", `Added ${seconds_added_per_resub_tier3} Seconds Because ${username} ReSubscribed With Tier 3`);
break;
}
}
else if(happy_hour_active){
switch (methods['plan']) {
case "Prime":
addTime(endingTime, seconds_added_per_resub_prime_happy);
logMessage("Twitch", `Added ${seconds_added_per_resub_prime_happy} Seconds Because ${username} ReSubscribed With Prime`);
break;
case "1000":
addTime(endingTime, seconds_added_per_resub_tier1_happy);
logMessage("Twitch", `Added ${seconds_added_per_resub_tier1_happy} Seconds Because ${username} ReSubscribed With Tier 1`);
break;
case "2000":
addTime(endingTime, seconds_added_per_resub_tier2_happy);
logMessage("Twitch", `Added ${seconds_added_per_resub_tier2_happy} Seconds Because ${username} ReSubscribed With Tier 2`);
break;
case "3000":
addTime(endingTime, seconds_added_per_resub_tier3_happy);
logMessage("Twitch", `Added ${seconds_added_per_resub_tier3_happy} Seconds Because ${username} ReSubscribed With Tier 3`);
break;
}
let factor_t1_local = (happy_hour_active ? factor_t1 : 1) * (random_hour_active ? randomInRangeNoRounding(...range_t1): 1);
let factor_t2_local = (happy_hour_active ? factor_t2 : 1) * (random_hour_active ? randomInRangeNoRounding(...range_t2): 1);
let factor_t3_local = (happy_hour_active ? factor_t3 : 1) * (random_hour_active ? randomInRangeNoRounding(...range_t3): 1);
switch (methods['plan']) {
case "Prime":
addTime(endingTime, seconds_added_per_resub_prime * factor_t1_local);
logMessage("Twitch", `Added ${seconds_added_per_resub_prime * factor_t1_local} Seconds Because ${username} ReSubscribed With Prime`);
break;
case "1000":
addTime(endingTime, seconds_added_per_resub_tier1 * factor_t1_local);
logMessage("Twitch", `Added ${seconds_added_per_resub_tier1 * factor_t1_local} Seconds Because ${username} ReSubscribed With Tier 1`);
break;
case "2000":
addTime(endingTime, seconds_added_per_resub_tier2 * factor_t2_local);
logMessage("Twitch", `Added ${seconds_added_per_resub_tier2 * factor_t2_local} Seconds Because ${username} ReSubscribed With Tier 2`);
break;
case "3000":
addTime(endingTime, seconds_added_per_resub_tier3 * factor_t3_local);
logMessage("Twitch", `Added ${seconds_added_per_resub_tier3 * factor_t3_local} Seconds Because ${username} ReSubscribed With Tier 3`);
break;
}
if (!users.includes(username)) {
users.push(username);
@@ -108,45 +72,27 @@ if (twitch_channel_name !== "") {
client.on('subgift', (channel, username, months, recipient, methods, userstate) => {
if (!countdownEnded && subEnable) {
if(!happy_hour_active){
switch (methods['plan']) {
case "Prime":
addTime(endingTime, seconds_added_per_giftsub_prime);
logMessage("Twitch", `Added ${seconds_added_per_giftsub_prime} Seconds Because ${username} gifted Sub With Prime`);
break;
case "1000":
addTime(endingTime, seconds_added_per_giftsub_tier1);
logMessage("Twitch", `Added ${seconds_added_per_giftsub_tier1} Seconds Because ${username} gifted Sub With Tier 1`);
break;
case "2000":
addTime(endingTime, seconds_added_per_giftsub_tier2);
logMessage("Twitch", `Added ${seconds_added_per_giftsub_tier2} Seconds Because ${username} gifted Sub With Tier 2`);
break;
case "3000":
addTime(endingTime, seconds_added_per_giftsub_tier3);
logMessage("Twitch", `Added ${seconds_added_per_giftsub_tier3} Seconds Because ${username} gifted Sub With Tier 3`);
break;
}
}
else if(happy_hour_active){
switch (methods['plan']) {
case "Prime":
addTime(endingTime, seconds_added_per_giftsub_prime_happy);
logMessage("Twitch", `Added ${seconds_added_per_giftsub_prime_happy} Seconds Because ${username} gifted Sub With Prime`);
break;
case "1000":
addTime(endingTime, seconds_added_per_giftsub_tier1_happy);
logMessage("Twitch", `Added ${seconds_added_per_giftsub_tier1_happy} Seconds Because ${username} gifted Sub With Tier 1`);
break;
case "2000":
addTime(endingTime, seconds_added_per_giftsub_tier2_happy);
logMessage("Twitch", `Added ${seconds_added_per_giftsub_tier2_happy} Seconds Because ${username} gifted Sub With Tier 2`);
break;
case "3000":
addTime(endingTime, seconds_added_per_giftsub_tier3_happy);
logMessage("Twitch", `Added ${seconds_added_per_giftsub_tier3_happy} Seconds Because ${username} gifted Sub With Tier 3`);
break;
}
let factor_t1_local = (happy_hour_active ? factor_t1 : 1) * (random_hour_active ? randomInRangeNoRounding(...range_t1): 1);
let factor_t2_local = (happy_hour_active ? factor_t2 : 1) * (random_hour_active ? randomInRangeNoRounding(...range_t2): 1);
let factor_t3_local = (happy_hour_active ? factor_t3 : 1) * (random_hour_active ? randomInRangeNoRounding(...range_t3): 1);
switch (methods['plan']) {
case "Prime":
addTime(endingTime, seconds_added_per_giftsub_prime * factor_t1_local);
logMessage("Twitch", `Added ${seconds_added_per_giftsub_prime * factor_t1_local} Seconds Because ${username} gifted Sub With Prime`);
break;
case "1000":
addTime(endingTime, seconds_added_per_giftsub_tier1 * factor_t1_local);
logMessage("Twitch", `Added ${seconds_added_per_giftsub_tier1 * factor_t1_local} Seconds Because ${username} gifted Sub With Tier 1`);
break;
case "2000":
addTime(endingTime, seconds_added_per_giftsub_tier2 * factor_t2_local);
logMessage("Twitch", `Added ${seconds_added_per_giftsub_tier2 * factor_t2_local} Seconds Because ${username} gifted Sub With Tier 2`);
break;
case "3000":
addTime(endingTime, seconds_added_per_giftsub_tier3 * factor_t3_local);
logMessage("Twitch", `Added ${seconds_added_per_giftsub_tier3 * factor_t3_local} Seconds Because ${username} gifted Sub With Tier 3`);
break;
}
if (!users.includes(username)) {
users.push(username);
@@ -156,24 +102,14 @@ if (twitch_channel_name !== "") {
client.on('cheer', (channel, userstate, message) => {
if (!countdownEnded && bitEnable) {
if(!happy_hour_active){
if (userstate.bits >= min_amount_of_bits) {
let times = Math.floor(userstate.bits/min_amount_of_bits);
addTime(endingTime, seconds_added_per_bits * times);
logMessage("Twitch", `Added ${seconds_added_per_bits * times} Seconds Because ${userstate['display-name']} Donated ${userstate.bits} Bits`);
if (!users.includes(userstate['display-name'])) {
users.push(userstate['display-name']);
}
}
}
if(happy_hour_active){
if (userstate.bits >= min_amount_of_bits) {
let times = Math.floor(userstate.bits/min_amount_of_bits);
addTime(endingTime, seconds_added_per_bits_happy * times);
logMessage("Twitch", `Added ${seconds_added_per_bits_happy * times} Seconds Because ${userstate['display-name']} Donated ${userstate.bits} Bits`);
if (!users.includes(userstate['display-name'])) {
users.push(userstate['display-name']);
}
let factor_bits_local = (happy_hour_active ? factor_bits : 1) * (random_hour_active ? randomInRangeNoRounding(...range_bits): 1);
if (userstate.bits >= min_amount_of_bits) {
let times = Math.floor(userstate.bits/min_amount_of_bits);
addTime(endingTime, seconds_added_per_bits * times * factor_bits_local);
logMessage("Twitch", `Added ${seconds_added_per_bits * times} Seconds Because ${userstate['display-name']} Donated ${userstate.bits} Bits`);
if (!users.includes(userstate['display-name'])) {
users.push(userstate['display-name']);
}
}
}
+6
View File
@@ -6,6 +6,10 @@ const randomInRange = (min, max) => {
return Math.floor(Math.random() * (max - min)) + min;
};
const randomInRangeNoRounding = (min, max) => {
return Math.random() * (max - min) + min;
};
const logMessage = (module, message) => {
console.log(`[${module}]: ${message}`);
};
@@ -13,3 +17,5 @@ const logMessage = (module, message) => {
const logObject = (module, object) => {
console.log(`[${module}]: `, object);
};
+52 -46
View File
@@ -5,6 +5,7 @@ var initialMinutes;
var initialSeconds;
var paused = false;
var happy_hour_active = false;
var random_hour_active = false;
var initialHoursLocal = window.localStorage.getItem('initialHours')
if(initialHoursLocal !== null) {
@@ -96,52 +97,56 @@ Mousetrap.bind(pauseShort, function(e) {
});
Mousetrap.bind(happyHourShort, async function(e){
if(happy_hour){
happyHourFunc()
}
else {
logMessage("Core", "Happy Hour is not available")
document.getElementById("HappyHourText").innerHTML = "Happy Hour error";
document.getElementById("HappyHourText").animate({opacity: [ 0, 1 ], easing: [ 'ease-in', 'ease-out' ],}, 500);
document.getElementById("HappyHourText").style.opacity = "1";
document.getElementById("HappyHourHTML").animate({top: [ "-200px", "-250px" ], easing: [ 'ease-in', 'ease-out' ],}, 500);
document.getElementById("HappyHourHTML").style.top = "-250px";
await sleep(5000)
document.getElementById("HappyHourText").animate({opacity: [ 1, 0 ], easing: [ 'ease-in', 'ease-out' ],}, 500);
document.getElementById("HappyHourText").style.opacity = "0";
}
specialHourHandler('Happy');
});
async function happyHourFunc(){
if(!happy_hour_active){
logMessage("Core","Happy Hour activated");
happy_hour_active = true;
document.getElementById("HappyHourText").innerHTML = "Happy Hour Activated!";
document.getElementById("HappyHourText").animate({opacity: [ 0, 1 ], easing: [ 'ease-in', 'ease-out' ],}, 500);
document.getElementById("HappyHourText").style.opacity = "1";
document.getElementById("HappyHourHTML").animate({top: [ "-200px", "-250px" ], easing: [ 'ease-in', 'ease-out' ],}, 500);
document.getElementById("HappyHourHTML").style.top = "-250px";
document.getElementById("container").style.backgroundImage = "-webkit-linear-gradient(-45deg, transparent 33%, rgba(0, 0, 0, .1) 33%, rgba(0,0, 0, .1) 66%, transparent 66%), -webkit-linear-gradient(top, rgba(255, 255, 255, .25), rgba(0, 0, 0, .25)), url(https://drive.google.com/uc?id=1oduFlPg84O1DliM5FsLvJJsnwZ4m1Vpm), -webkit-linear-gradient(left, #0074cc, #a700cc)";
await sleep(10000)
document.getElementById("HappyHourText").animate({opacity: [ 1, 0 ], easing: [ 'ease-in', 'ease-out' ],}, 500);
document.getElementById("HappyHourText").style.opacity = "0";
Mousetrap.bind(randomHourShort, async function(e){
specialHourHandler('Random');
});
async function specialHourHandler(type){
if((type === 'Happy' && happy_hour) || (type === 'Random' && random_hour)){
specialHourFunc(type)
}
else if(happy_hour_active){
logMessage("Core", "Happy Hour deactivated")
clearTimeout(happyHourFunc)
happy_hour_active = false;
document.getElementById("HappyHourText").innerHTML = "Happy Hour Deactivated";
document.getElementById("HappyHourText").animate({opacity: [ 0, 1 ], easing: [ 'ease-in', 'ease-out' ],}, 500);
document.getElementById("HappyHourText").style.opacity = "1";
document.getElementById("HappyHourHTML").animate({top: [ "-200px", "-250px" ], easing: [ 'ease-in', 'ease-out' ],}, 500);
document.getElementById("HappyHourHTML").style.top = "-250px";
document.getElementById("container").style.backgroundImage = "-webkit-linear-gradient(-45deg, transparent 33%, rgba(0, 0, 0, .1) 33%, rgba(0,0, 0, .1) 66%, transparent 66%), -webkit-linear-gradient(top, rgba(255, 255, 255, .25), rgba(0, 0, 0, .25)), -webkit-linear-gradient(left, #0074cc, #a700cc)";
else {
logMessage("Core", `${type} Hour is not available`)
document.getElementById("SpecialHourText").innerHTML = `${type} Hour error`;
document.getElementById("SpecialHourText").animate({opacity: [ 0, 1 ], easing: [ 'ease-in', 'ease-out' ],}, 500);
document.getElementById("SpecialHourText").style.opacity = "1";
document.getElementById("SpecialHourHTML").animate({top: [ "-200px", "-250px" ], easing: [ 'ease-in', 'ease-out' ],}, 500);
document.getElementById("SpecialHourHTML").style.top = "-250px";
await sleep(5000)
document.getElementById("HappyHourText").animate({opacity: [ 1, 0 ], easing: [ 'ease-in', 'ease-out' ],}, 500);
document.getElementById("HappyHourText").style.opacity = "0";
document.getElementById("SpecialHourText").animate({opacity: [ 1, 0 ], easing: [ 'ease-in', 'ease-out' ],}, 500);
document.getElementById("SpecialHourText").style.opacity = "0";
}
}
async function specialHourFunc(type){
let activate = ((type === 'Happy' && !happy_hour_active) || (type === 'Random' && !random_hour_active));
let toggleText = activate ? 'Activated' : 'Deactivated';
logMessage("Core", `${type} Hour ${toggleText}`);
if (type === 'Happy') happy_hour_active = activate;
if (type === 'Random') random_hour_active = activate;
let animation = (happy_hour_active || random_hour_active) ? ', url(https://drive.google.com/uc?id=1oduFlPg84O1DliM5FsLvJJsnwZ4m1Vpm)' : '';
document.getElementById("SpecialHourText").innerHTML = `${type} Hour ${toggleText}!`;
document.getElementById("SpecialHourText").animate({opacity: [ 0, 1 ], easing: [ 'ease-in', 'ease-out' ],}, 500);
document.getElementById("SpecialHourText").style.opacity = "1";
document.getElementById("SpecialHourHTML").animate({top: [ "-200px", "-250px" ], easing: [ 'ease-in', 'ease-out' ],}, 500);
document.getElementById("SpecialHourHTML").style.top = "-250px";
document.getElementById("container").style.backgroundImage = `-webkit-linear-gradient(-45deg, transparent 33%, rgba(0, 0, 0, .1) 33%, rgba(0,0, 0, .1) 66%, transparent 66%), -webkit-linear-gradient(top, rgba(255, 255, 255, .25), rgba(0, 0, 0, .25))${animation}, -webkit-linear-gradient(left, #0074cc, #a700cc)`;
await sleep(activate ? 5000 : 10000);
document.getElementById("SpecialHourText").animate({opacity: [ 1, 0 ], easing: [ 'ease-in', 'ease-out' ],}, 500);
document.getElementById("SpecialHourText").style.opacity = "0";
}
let countdownEnded = false;
let users = [];
@@ -198,8 +203,8 @@ function randomHappy(){
if(!happy_hour_active){
if((getRandomInt(0,10000) == 127)){
logMessage("RandomHappy","It's not rigged!")
happyHourFunc()
setTimeout(happyHourFunc, 3600000)
specialHourFunc()
setTimeout(specialHourFunc, 3600000)
}
setTimeout(randomHappy,1000)
}
@@ -211,8 +216,8 @@ function scheduleHappyFunc(){
if(now.getUTCHours() == scheduleHappyHour){
if(now.getUTCMinutes() == 00){
logMessage("Schedule","It's time!")
happyHourFunc()
setTimeout(happyHourFunc, 3600000)
specialHourFunc()
setTimeout(specialHourFunc, 3600000)
setTimeout(scheduleHappyFunc, 36000000)
}
}
@@ -225,18 +230,19 @@ var addedTimeCounter;
var timeoutID;
const addTime = async (time, s) => {
let addedTime = Math.floor(s);
if(!bulk_enabled) {
endingTimeBeforeCounter = time;
addedTimeCounter = s;
addedTimeCounter = addedTime;
addTimeInternal();
return;
}
if(firstSub) {
firstSub = false;
endingTimeBeforeCounter = time;
addedTimeCounter = s;
addedTimeCounter = addedTime;
} else {
addedTimeCounter += s;
addedTimeCounter += addedTime;
window.clearTimeout(timeoutID);
}
timeoutID = window.setTimeout(addTimeInternal, 1000);