local Q=game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")local h=require((Q:WaitForChild("\080\114\111\106\101\099\116")):WaitForChild("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101"))local N=h:GetResource("\071\097\109\101\068\097\116\097\046\073\116\101\109\046\073\116\101\109\115")local H=h:GetResource("\071\097\109\101\082\101\112\108\105\099\097\116\105\111\110\046\068\117\110\103\101\111\110\082\101\112\108\105\099\097\116\105\111\110\046\083\116\097\114\116\068\117\110\103\101\111\110")local O=h:GetResource("\071\097\109\101\082\101\112\108\105\099\097\116\105\111\110\046\068\117\110\103\101\111\110\082\101\112\108\105\099\097\116\105\111\110\046\069\110\100\068\117\110\103\101\111\110")local U=h:GetResource("\071\097\109\101\082\101\112\108\105\099\097\116\105\111\110\046\068\117\110\103\101\111\110\082\101\112\108\105\099\097\116\105\111\110\046\068\105\115\112\108\097\121\082\101\119\097\114\100")local T=h:GetResource("\071\097\109\101\082\101\112\108\105\099\097\116\105\111\110\046\068\117\110\103\101\111\110\082\101\112\108\105\099\097\116\105\111\110\046\068\105\115\112\108\097\121\077\101\115\115\097\103\101")local J=h:GetResource("\085\073\046\073\116\101\109\065\119\097\114\100\065\110\105\109\097\116\105\111\110")local t=h:GetResource("\085\073\046\073\116\101\109\073\099\111\110")local P=Instance.new("\083\099\114\101\101\110\071\117\105")P.Name="\068\117\110\103\101\111\110\086\105\101\119"P.DisplayOrder=2 P.Parent=script.Parent local b=Instance.new("\084\101\120\116\076\097\098\101\108")b.BackgroundTransparency=1 b.Size=UDim2.new(1,0,.075,0)b.Font=Enum.Font.Antique b.Text="\084\114\105\099\107 \111\102 \084\114\101\097\116\033"b.TextColor3=Color3.new(.99607843137255,.76862745098039,.035294117647059)b.TextScaled=true b.Visible=false b.Parent=P local B=Instance.new("\084\101\120\116\076\097\098\101\108")B.BackgroundTransparency=1 B.Size=UDim2.new(1,0,.06,0)B.Position=UDim2.new(0,0,.075,0)B.Font=Enum.Font.Antique B.Text="\080\105\099\107 \097 \099\104\101\115\116\046\046\046 \066\101 \099\097\114\101\102\117\108\033"B.TextColor3=Color3.new(.066666666666667,.42352941176471,.003921568627451)B.TextScaled=true B.Visible=false B.Parent=P local L=Instance.new("\084\101\120\116\076\097\098\101\108")L.Visible=false L.BackgroundTransparency=1 L.Size=UDim2.new(.8,0,.6,0)L.Position=UDim2.new(.1,0,.2,0)L.Font=Enum.Font.Antique L.TextWrapped=true L.TextColor3=Color3.new(1,1,1)L.TextSize=P.AbsoluteSize.Y*.05 L.Parent=P;(P:GetPropertyChangedSignal("\065\098\115\111\108\117\116\101\083\105\122\101")):Connect(function()L.TextSize=P.AbsoluteSize.Y*.05 end)local K=Instance.new("\073\109\097\103\101\076\097\098\101\108")K.AnchorPoint=Vector2.new(.5,.5)K.BackgroundTransparency=1 K.Position=UDim2.new(.5,0,-0.5,0)K.Size=UDim2.new(.44903225806452,0,.3,0)K.SizeConstraint=Enum.SizeConstraint.RelativeYY K.Image="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\051\051\057\052\048\052\052"K.Parent=P local W=Instance.new("\070\114\097\109\101")W.BackgroundTransparency=1 W.AnchorPoint=Vector2.new(.5,.5)W.Position=UDim2.new(.50431034482759,0,.51290322580645,0)W.Size=UDim2.new(.32258064516129,0,.32258064516129,0)W.SizeConstraint=Enum.SizeConstraint.RelativeYY W.Parent=K local g=t.new()g:SetParent(W)local u=Instance.new("\084\101\120\116\076\097\098\101\108")u.BackgroundTransparency=1 u.Size=UDim2.new(.7,0,.10322580645161,0)u.Position=UDim2.new(.15,0,.81,0)u.Font=Enum.Font.Antique u.Text="\073\116\101\109"u.TextColor3=Color3.new(.99607843137255,.76862745098039,.035294117647059)u.TextScaled=true u.Parent=K H.OnClientEvent:Connect(function(Q,h,N,H)if H=="\084\114\101\097\115\117\114\101"then b.Visible=true B.Visible=true end end)O.OnClientEvent:Connect(function()b.Visible=false B.Visible=false end)U.OnClientEvent:Connect(function(Q)local h=N[Q]if h then g:SetItem(Q)u.Text=h.DisplayName K:TweenPosition(UDim2.new(.5,0,.5,0),"\073\110\079\117\116","\081\117\097\100",.5,true,function()wait(4.5)J.DisplayItemAwardFromFrame(Q,W)K:TweenPosition(UDim2.new(.5,0,-0.5,0),"\073\110\079\117\116","\081\117\097\100",.5)end)end end)T.OnClientEvent:Connect(function(Q)L.Text=Q L.Visible=true wait(5)L.Visible=false end)
--[[
TheNexusAvenger

Displays informations about the dungeon.
--]]

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local ReplicatedStorageProject = require(ReplicatedStorage:WaitForChild("Project"):WaitForChild("ReplicatedStorage"))

local Items = ReplicatedStorageProject:GetResource("GameData.Item.Items")
local StartDungeon = ReplicatedStorageProject:GetResource("GameReplication.DungeonReplication.StartDungeon")
local EndDungeon = ReplicatedStorageProject:GetResource("GameReplication.DungeonReplication.EndDungeon")
local DisplayReward = ReplicatedStorageProject:GetResource("GameReplication.DungeonReplication.DisplayReward")
local DisplayMessage = ReplicatedStorageProject:GetResource("GameReplication.DungeonReplication.DisplayMessage")
local ItemAwardAnimation = ReplicatedStorageProject:GetResource("UI.ItemAwardAnimation")
local ItemIcon = ReplicatedStorageProject:GetResource("UI.ItemIcon")



--Create the ScreenGui.
local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Name = "DungeonView"
ScreenGui.DisplayOrder = 2
ScreenGui.Parent = script.Parent

--Create the chest selection messages.
local TreasureTopText = Instance.new("TextLabel")
TreasureTopText.BackgroundTransparency = 1
TreasureTopText.Size = UDim2.new(1,0,0.075,0)
TreasureTopText.Font = Enum.Font.Antique
TreasureTopText.Text = "Trick of Treat!"
TreasureTopText.TextColor3 = Color3.new(254/255,196/255,9/255)
TreasureTopText.TextScaled = true
TreasureTopText.Visible = false
TreasureTopText.Parent = ScreenGui

local TreasureBottomText = Instance.new("TextLabel")
TreasureBottomText.BackgroundTransparency = 1
TreasureBottomText.Size = UDim2.new(1,0,0.06,0)
TreasureBottomText.Position = UDim2.new(0,0,0.075,0)
TreasureBottomText.Font = Enum.Font.Antique
TreasureBottomText.Text = "Pick a chest... Be careful!"
TreasureBottomText.TextColor3 = Color3.new(17/255,108/255,1/255)
TreasureBottomText.TextScaled = true
TreasureBottomText.Visible = false
TreasureBottomText.Parent = ScreenGui

--Create the item awarding messages.
local MessageText = Instance.new("TextLabel")
MessageText.Visible = false
MessageText.BackgroundTransparency = 1
MessageText.Size = UDim2.new(0.8,0,0.6,0)
MessageText.Position = UDim2.new(0.1,0,0.2,0)
MessageText.Font = Enum.Font.Antique
MessageText.TextWrapped = true
MessageText.TextColor3 = Color3.new(1,1,1)
MessageText.TextSize = ScreenGui.AbsoluteSize.Y * 0.05
MessageText.Parent = ScreenGui
ScreenGui:GetPropertyChangedSignal("AbsoluteSize"):Connect(function()
    MessageText.TextSize = ScreenGui.AbsoluteSize.Y * 0.05
end)

local Background = Instance.new("ImageLabel")
Background.AnchorPoint = Vector2.new(0.5,0.5)
Background.BackgroundTransparency = 1
Background.Position = UDim2.new(0.5,0,-0.5,0)
Background.Size = UDim2.new(0.3 * (464/310),0,0.3,0)
Background.SizeConstraint = Enum.SizeConstraint.RelativeYY
Background.Image = "rbxassetid://133394044"
Background.Parent = ScreenGui

local ItemIconAdorn = Instance.new("Frame")
ItemIconAdorn.BackgroundTransparency = 1
ItemIconAdorn.AnchorPoint = Vector2.new(0.5,0.5)
ItemIconAdorn.Position = UDim2.new(0.5 + (2/464),0,0.5 + (4/310),0)
ItemIconAdorn.Size = UDim2.new(100/310,0,100/310,0)
ItemIconAdorn.SizeConstraint = Enum.SizeConstraint.RelativeYY
ItemIconAdorn.Parent = Background

local AwardIcon = ItemIcon.new()
AwardIcon:SetParent(ItemIconAdorn)

local ItemAwardText = Instance.new("TextLabel")
ItemAwardText.BackgroundTransparency = 1
ItemAwardText.Size = UDim2.new(0.7,0,32/310,0)
ItemAwardText.Position = UDim2.new(0.15,0,0.81,0)
ItemAwardText.Font = Enum.Font.Antique
ItemAwardText.Text = "Item"
ItemAwardText.TextColor3 = Color3.new(254/255,196/255,9/255)
ItemAwardText.TextScaled = true
ItemAwardText.Parent = Background



--Connect the events.
StartDungeon.OnClientEvent:Connect(function(_,_,_,Type)
    if Type == "Treasure" then
        TreasureTopText.Visible = true
        TreasureBottomText.Visible = true
    end
end)

EndDungeon.OnClientEvent:Connect(function()
    TreasureTopText.Visible = false
    TreasureBottomText.Visible = false
end)

DisplayReward.OnClientEvent:Connect(function(ItemName)
    local ItemData = Items[ItemName]
    if ItemData then
        --Set the display.
        AwardIcon:SetItem(ItemName)
        ItemAwardText.Text = ItemData.DisplayName

        --Show and hide the display.
        Background:TweenPosition(UDim2.new(0.5,0,0.5,0),"InOut","Quad",0.5,true,function()
            wait(4.5)
            ItemAwardAnimation.DisplayItemAwardFromFrame(ItemName,ItemIconAdorn)
            Background:TweenPosition(UDim2.new(0.5,0,-0.5,0),"InOut","Quad",0.5)
        end)
    end
end)

DisplayMessage.OnClientEvent:Connect(function(Message)
    MessageText.Text = Message
    MessageText.Visible = true
    wait(5)
    MessageText.Visible = false
end)