From 1fb30875a9cbecbce86da51ac3ce3201330b0510 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Majdand=C5=BEi=C4=87?= Date: Sat, 23 Mar 2024 01:07:50 +0100 Subject: [PATCH] Add afk and battlepass timer for easier battle pass experience --- FreshShit/AfkTimer/event.lua | 14 ++++++++++++++ FreshShit/AfkTimer/event2.lua | 8 ++++++++ FreshShit/AfkTimer/event2duration.lua | 4 ++++ FreshShit/AfkTimer/export | 1 + FreshShit/AfkTimer/init.lua | 2 ++ FreshShit/BattlePassTimer/event.lua | 16 ++++++++++++++++ FreshShit/BattlePassTimer/event2.lua | 4 ++++ FreshShit/BattlePassTimer/event2duration.lua | 4 ++++ FreshShit/BattlePassTimer/export | 1 + FreshShit/BattlePassTimer/init.lua | 14 ++++++++++++++ 10 files changed, 68 insertions(+) create mode 100644 FreshShit/AfkTimer/event.lua create mode 100644 FreshShit/AfkTimer/event2.lua create mode 100644 FreshShit/AfkTimer/event2duration.lua create mode 100644 FreshShit/AfkTimer/export create mode 100644 FreshShit/AfkTimer/init.lua create mode 100644 FreshShit/BattlePassTimer/event.lua create mode 100644 FreshShit/BattlePassTimer/event2.lua create mode 100644 FreshShit/BattlePassTimer/event2duration.lua create mode 100644 FreshShit/BattlePassTimer/export create mode 100644 FreshShit/BattlePassTimer/init.lua diff --git a/FreshShit/AfkTimer/event.lua b/FreshShit/AfkTimer/event.lua new file mode 100644 index 0000000..34610ea --- /dev/null +++ b/FreshShit/AfkTimer/event.lua @@ -0,0 +1,14 @@ +-- CHAT_MSG_SYSTEM +function(e, msg) + if msg == nil then return false end + if string.find(msg, "You are now Away") then + aura_env.KickTime = GetTime() + 25 * 60 + aura_env.AfkSince = GetTime() + return true + end + if string.find(msg, "You are no longer Away") then + aura_env.KickTime = 0 + aura_env.AfkSince = 0 + return false + end +end \ No newline at end of file diff --git a/FreshShit/AfkTimer/event2.lua b/FreshShit/AfkTimer/event2.lua new file mode 100644 index 0000000..17f349a --- /dev/null +++ b/FreshShit/AfkTimer/event2.lua @@ -0,0 +1,8 @@ +-- TICKER_500 +function(e) + local timeToKick = aura_env.KickTime - GetTime() + if timeToKick > 0 and timeToKick < 60 then + WeakAuras.ScanEvents("PLAY_SOUND", "Interface\\Sounds\\quack.ogg") + end + return timeToKick > 0 +end \ No newline at end of file diff --git a/FreshShit/AfkTimer/event2duration.lua b/FreshShit/AfkTimer/event2duration.lua new file mode 100644 index 0000000..807a91c --- /dev/null +++ b/FreshShit/AfkTimer/event2duration.lua @@ -0,0 +1,4 @@ +-- TICKER_500 +function(e) + return math.floor(GetTime() - aura_env.AfkSince), math.floor(aura_env.KickTime - aura_env.AfkSince), 1 +end \ No newline at end of file diff --git a/FreshShit/AfkTimer/export b/FreshShit/AfkTimer/export new file mode 100644 index 0000000..e7b1f05 --- /dev/null +++ b/FreshShit/AfkTimer/export @@ -0,0 +1 @@ +!DFvBVPnsq4)lr6KsURGWaH0kD9KietHwceX60goHmEXEnSxm7s9UMK0p4F73SVySjnPnnF4(Wjsm2dZm7SZ(mpZyFhFpF0gFuK6p4wXwC6TFHgjx7p2PH95jXXcI8g)XGG7npOV)Hk3JzHR5PxXPmPpQN7yp3PwRNYLyjLZ0QDGKl5reFu3R9M4JwIdVDvkpJf1JNWtHyzSJYIXn1xBPV22VFN32(02N50(ToVRPZPT64hx70w(WAktPRwrsfgl92lqF7dBHfkmti5WEvKTKSJWKOS4y69(Of96I8wG86ofunkl1eTiNtBabSwtF0acobYj7T9QuI2w0vUJgv46fRPQnKKUHezTuajJbD9wCj6dlqZqEUxQYbKKKHrQivwgv1QLh8ivZ)yCglufnhtEtEWgXQtY)yEG5dnwljp49VppGrtYdKRjS8GuImlf(ogNii5bew0H2iG8cBv9ykl6yWEWVhnJNLhGtbTz87Yd6Eh(HJoX6V92w8bdjOfe2U6FIgERhSvHiip4deP6(JbZ(J8GMNMh875bDA8dmVB8Tikl8XM)DguSFKPzKYF9xDBLhKWzaA41T7EX7JgpF8BopoCdax2JDmyulCJH3qS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xiu2UbtzVCTHXGPI1Vy9LMEZMaDFKP3ZuDmgXxy70FE5Ksp7SYpZSXhgyc18ivbvDJIMWeZ3pxZ8ljruCXClNZVhWyDtjmSwIAcMQX1s9dgNUCFLMpQzDNo1B5J2bNNTBQo69)3p \ No newline at end of file diff --git a/FreshShit/AfkTimer/init.lua b/FreshShit/AfkTimer/init.lua new file mode 100644 index 0000000..fcaa922 --- /dev/null +++ b/FreshShit/AfkTimer/init.lua @@ -0,0 +1,2 @@ +aura_env.KickTime = 0 +aura_env.AfkSince = 0 \ No newline at end of file diff --git a/FreshShit/BattlePassTimer/event.lua b/FreshShit/BattlePassTimer/event.lua new file mode 100644 index 0000000..5fb4767 --- /dev/null +++ b/FreshShit/BattlePassTimer/event.lua @@ -0,0 +1,16 @@ +-- PLAYER_ENTERING_WORLD PLAYER_LEAVING_WORLD +function(e) + if WeakAurasSaved.Cyka.LoginInfo[UnitName("player")] == nil then WeakAurasSaved.Cyka.LoginInfo[UnitName("player")] = {} end + local index = #WeakAurasSaved.Cyka.LoginInfo[UnitName("player")] + + if e == "PLAYER_ENTERING_WORLD" then + WeakAurasSaved.Cyka.LoginInfo[UnitName("player")][index + 1] = {LoginTime = GetTime()} + if WeakAurasSaved.Cyka.LoginInfo[UnitName("player")][index] ~= nil then + WeakAurasSaved.Cyka.LoginInfo[UnitName("player")][index].LogoutTime = GetTime() + end + elseif e == "PLAYER_LEAVING_WORLD" then + WeakAurasSaved.Cyka.LoginInfo[UnitName("player")][index].LogoutTime = GetTime() + end +end + +--/run WeakAuras.ScanEvents("PLAYER_ENTERING_WORLD") \ No newline at end of file diff --git a/FreshShit/BattlePassTimer/event2.lua b/FreshShit/BattlePassTimer/event2.lua new file mode 100644 index 0000000..6bbeef1 --- /dev/null +++ b/FreshShit/BattlePassTimer/event2.lua @@ -0,0 +1,4 @@ +-- TICKER_1000 +function(e) + return true +end \ No newline at end of file diff --git a/FreshShit/BattlePassTimer/event2duration.lua b/FreshShit/BattlePassTimer/event2duration.lua new file mode 100644 index 0000000..437f7a6 --- /dev/null +++ b/FreshShit/BattlePassTimer/event2duration.lua @@ -0,0 +1,4 @@ +-- TICKER_1000 +function(e) + return math.floor(aura_env.CalculateOnlineTime()), 7200, 1 +end \ No newline at end of file diff --git a/FreshShit/BattlePassTimer/export b/FreshShit/BattlePassTimer/export new file mode 100644 index 0000000..31948b4 --- /dev/null +++ b/FreshShit/BattlePassTimer/export @@ -0,0 +1 @@ +!DFvB3PTnu4)lzNDoWzJmmqs6(q)aH4uiJAYb700U2AqyldQXiXKLjq3Q)TVREXVqiTLKTZ(WoKawYxDFtspp3RVLVNV7sF3q5FWJjRq87ULekw47y10mEuuucw8wFhycuQybJpALGWOjWke(UB1V335KMsbObGaxZiu4v9SD8ShBuZyMajxMsp7mZRzHyF3U34nY3Dgk4U5CwknShlMXbt4yjxHtl13TvF3X)YtFrNt6CMvNxy9RTSoP9P(rnoPT0DeCY85yEIELEftOEC7kWqbPjcge0jPZWRXuHBAuezJV7KEDD9M461DSxUqtwqKUMGSeltrPCDe4A57QwkeIlqISPVgNKGMJl151CSsNUxBpCyPjB0iB61d7(o7XtuPMboVAYTJgp8IIPhA39nLZEvuknqAYA46zxLnv)HeLn9wm6UUG)K4IwJdpU327qhpKnNqhqJyV)gkr4GwIRD0Qy0wm)O6FmB6lFz2ukjoBQybM(80q20)8lztX0WsNjMfGaDsOH4nkj(HNUIVA3ydR91JE0m1rg)Vyf5FEYM99gF(NYMAzcoL8EWUTA4RWc5Z1Q)L9T2ZApqBrWwz)1o7f7P9)HX0hLcXsf7hj7BQD2mXXj4hzhyNdL)BVbCioRYj1E6vnA8l80QNFp2narTL36sQ9voZuxI4GJJheAaTuxst8DFcxglWe0OiM7)PuZdgmckeIgBKcrSVRoAbWd8maNXtT2(2dV(YBgQfQeFsaFaCUNnMLXt6JrXaa(3gl6IcSmjMK3GE)geVwnB28RG5WXIuoK1xIelookMX41qGkMGPRpUhkoingjWJOXekwV5v)NZMEwRMnHFSu7DLj9kw7XtQvHlpCxtWtXglTd6TrBpsY2nKK8jLkxJLuxBHVud80IPiMGDeqssaJojOcLKLIsYsrjzjPKGVLYrfyoff)gGcsr216uPMjl1zBjhRaXfL7SugfxsTyYdjyWCWzvqHlre6HlDeHsswCWYlKeU8kmTx(IoNDw7t70SzNoN2YcQba4v7uH9TsOgItqcPMX(Z2PuH3PP4tNngp3uNGHkwzE55gWQtG)lpWJ3iMKSafYU)T51tyLVaqtY3BKs)4pUYm8a2tuYfXKNSS3SIdC13J2UJn)M1AurjAPFxUh2WkFECCKPMhDzmfM0L8z5rOMMPwtsiZIX(NBgVt5sdCCuGox6LxhvHLYx)NGZYKOTLLwXL1qH9u5eNro25R8TpCLsNrJ(41hUsn6gVHdaXfY48zTbi()6gW4bVQ))T7aDkVCaP6zmEOKXq)RXdvxulMlrfuDkgh89tFgjRe)MzWHYcxD)Jueh4FVmngQk52fe4wDUemtG0rJySatMVqvVVVBmdPACinbdoXYziHglahO6SinwqYXAdIrjj7nRksEWKcdAY5XayUP5GlUqzKUHY8poeh(A0gPP0zNl5aTRo362BSTTZdfgWqbH5k8iVQOqAK9cam52ykhE9ajoEeka)HEiydNo)Ce)d3mOr5OgUYfyygsumnMtoBQSZR0AH67BsDTnNjuMYoE9ndYMEEmIENrUEF)7uFMbCAMwYyQJZSG15KoN1STKBLauHNJeIy81qUxYldXBQCw2fC2O6O7T3mhinKzpOMdKaPU0FVUbqD)CXRwONfcZiYCDPneQ0uL4(9jHHyOwch73iVsW4eGh3uFr)rJh87JC86ouPJqsLEhrb5dkOfvANOiidztmC3NxwtWxPW7dP9MDBG57wb)tRJPh0D0vFRQJuYwult99AMsKltZYxfX4ztV7NLDAjngb8hYkeHNu7jx3D9SPHShVLgPY3PE8dTtLcxw)a0tvT90vJs9R7Y6XAhb6a5jzLYUfom9Vt7ovhuugPu1QYiRwpLgvQKLXG(lN03T1XwNECBF31WfLoTKxp9)7p \ No newline at end of file diff --git a/FreshShit/BattlePassTimer/init.lua b/FreshShit/BattlePassTimer/init.lua new file mode 100644 index 0000000..6b2b529 --- /dev/null +++ b/FreshShit/BattlePassTimer/init.lua @@ -0,0 +1,14 @@ +if WeakAurasSaved.Cyka == nil then WeakAurasSaved.Cyka = {} end +if WeakAurasSaved.Cyka.LoginInfo == nil then WeakAurasSaved.Cyka.LoginInfo = {} end + +aura_env.CalculateOnlineTime = function() + local time = 0 + for k, info in ipairs(WeakAurasSaved.Cyka.LoginInfo[UnitName("player")]) do + if info.LogoutTime ~= nil then + time = time + (info.LogoutTime - info.LoginTime) + else + time = time + (GetTime() - info.LoginTime) + end + end + return time +end