SHARE
TWEET

RHS 2019 EggHunt module script

NAZOR Apr 6th, 2019 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --SynapseX Decompiler
  2.  
  3. local module = {}
  4. local Create = require(game.ReplicatedStorage.Modules.Create)
  5. local ScreenController = require(game.ReplicatedStorage.Modules.ScreenController)
  6. local Tween = require(game.ReplicatedStorage.Modules.Tween)
  7. local Util = require(game.ReplicatedStorage.Modules.Util)
  8. local ButtonColors = require(game.ReplicatedStorage.Modules.ButtonColors)
  9. local Hotbar = require(game.ReplicatedStorage.Systems.Hotbar)
  10. local EggHunt2019
  11. local Translator = require(game.ReplicatedStorage.Modules.Translator)
  12. local Timetable = require(game.ReplicatedStorage.Systems.Timetable)
  13. local localPlayer
  14. local frame = script.Parent.Frame
  15. local window = frame.Window
  16. local windowObject
  17. local isOpen = frame.Visible
  18. local isSmall = script.Parent.Parent.Name == "Small"
  19. if isSmall then
  20.     window.AnchorPoint = Vector2.new(0.5, 0.5)
  21.     window.Position = UDim2.new(0.5, 0, 0.5, 0)
  22.     window.Size = UDim2.new(1, -8, 1, -8)
  23. end
  24. local function get(name, parent)
  25.     return (parent or frame):FindFirstChild(name, true) or error("Cannot find `" .. tostring(name) .. "` (" .. typeof(name) .. ") in " .. (parent or frame):GetFullName())
  26. end
  27. local header = window.Header
  28. function module:ShowEggHunt()
  29.     local cards
  30.     cards = EggHunt2019:GetReportCards(localPlayer)
  31.     for cardName, cardInfo in next, cards, nil do
  32.         local cardGui = get(cardName, get("EggProgress"))
  33.         local missingVisible = not cardInfo.grade and true or false
  34.         local partialVisible = not missingVisible and not cardInfo.check
  35.         local completeVisible = cardInfo.check
  36.         local mainGuiName = missingVisible and "Missing" or partialVisible and "Partial" or completeVisible and "Complete"
  37.         get("Missing", cardGui).Visible = missingVisible
  38.         get("Partial", cardGui).Visible = partialVisible
  39.         get("Complete", cardGui).Visible = completeVisible
  40.         if cardInfo.grade then
  41.             get("GradeLabel", get(mainGuiName, cardGui)).Text = cardInfo.grade
  42.         end
  43.         Translator:FormatImageWithFallback(get("Logo", cardGui), EggHunt2019.GuiInfo[cardName].logo, EggHunt2019.GuiInfo[cardName].fallback)
  44.     end
  45.     local hasEgg = EggHunt2019:DoesPlayerHaveEgg(localPlayer)
  46.     if hasEgg then
  47.         get("BaseBackground", get("EggProgress")).ImageTransparency = 0.9
  48.         get("Win", get("EggProgress")).Visible = true
  49.         print("dbg:", "WON EGG!")
  50.     else
  51.         get("BaseBackground", get("EggProgress")).ImageTransparency = 0.4
  52.         get("Win", get("EggProgress")).Visible = false
  53.         print("dbg:", "HAS NOT WON EGG!")
  54.     end
  55. end
  56. function module:Init()
  57.     localPlayer = game.Players.LocalPlayer
  58.     EggHunt2019 = require(game.ReplicatedStorage.Modules.EggHunt2019)
  59. end
  60. function module:Start()
  61.     windowObject = Create.Create(isSmall and "FullscreenMobileWindow" or "Window", {rbx = window})
  62.     Create.Create("PressyButton", {
  63.         rbx = header.Close
  64.     })
  65.     header.Close.CaptureButton.MouseButton1Click:connect(module.Close)
  66.     local teleportButton = frame:FindFirstChild("TeleportButton", true)
  67.     Create.Create("PressyButton", {rbx = teleportButton})
  68.     teleportButton.CaptureButton.MouseButton1Click:Connect(function()
  69.         Timetable:Teleport("Minigame Arena")
  70.     end)
  71.     Util.FastSpawn(function()
  72.         EggHunt2019:WaitUntilEnabled()
  73.         Hotbar:AddButtonToHotbar("EggHunt2019", {
  74.             clickCallback = module.Toggle,
  75.             foreground = "rbxassetid://2956411726",
  76.             index = 100
  77.         })
  78.         EggHunt2019:WaitUntilDisabled()
  79.         Hotbar:RemoveButtonFromHotbar("EggHunt2019")
  80.     end)
  81. end
  82. function module:IsOpen()
  83.     return isOpen
  84. end
  85. function module:Open()
  86.     windowObject:Open()
  87.     if not isOpen then
  88.         frame.Visible = true
  89.         isOpen = true
  90.         self:ShowEggHunt()
  91.         if isSmall then
  92.             ScreenController.MobileHUDLock:Lock("EggHunt2019")
  93.             windowObject:Open()
  94.         end
  95.     end
  96. end
  97. function module:Close()
  98.     windowObject:Close()
  99.     frame.Visible = false
  100.     isOpen = false
  101.     if isSmall then
  102.         ScreenController.MobileHUDLock:Unlock("EggHunt2019")
  103.         windowObject:Close()
  104.     end
  105. end
  106. function module:Toggle()
  107.     if isOpen then
  108.         module:Close()
  109.     else
  110.         module:Open()
  111.     end
  112. end
  113. return module
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top