1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
local pray = {}
local explain
pray.activeprayers = {}
function pray:DrawOnDPanel(panel)
print("Attempted to draw prayer panel")
--Active grid
local agrid = vgui.Create("DGrid",panel)
agrid:SetCols(4)
local w = ((ScrW()/4) - 10) / 4
agrid:SetHeight(w)
agrid:SetColWide(w)
agrid:SetRowHeight(w)
for i=1,4 do
local rec = vgui.Create("DImageButton",agrid)
rec:SetText("F"..i)
rec:SetSize(w,w)
rec.DoClick = function(s)
local ap = self.activeprayers[i]
explain:SetText(ap ~= nil and ap.Description or "Select a prayer")
end
agrid:AddItem(rec)
end
agrid:Dock(TOP)
--Explanation of spells
local explainpanel = vgui.Create("DPanel",panel)
explainpanel:SetHeight(w*2)
explainpanel:Dock(TOP)
explainpanel:SetText("This panel will explain information about a hovered skill")
explain = vgui.Create("DLabel",explainpanel)
explain:Dock(FILL)
explain:SetDark(true)
--All spells we know
local scroll = vgui.Create( "DScrollPanel", panel )
scroll:Dock( FILL )
local grid = vgui.Create("DGrid",scroll)
grid:SetCols(4)
grid:SetColWide(w)
grid:SetRowHeight(w)
for k,v in pairs(self.track) do
local rec = vgui.Create("DImageButton",grid)
rec:SetText(v.Name)
rec:SetSize(w,w)
if(v.DoOnPanel) then
v:DoOnPanel(rec)
end
grid:AddItem(rec)
end
end
--Rebind f1, f2, f3, f4 to prayers
local prayerhooks = {
["gm_showhelp"] = 1,
["gm_showteam"] = 2,
["gm_showspare1"] = 3,
["gm_showspare2"] = 4
}
hook.Add("PlayerBindPress", function( ply, bind, pressed )
local phn = prayerhooks[bind]
if phn == nil then return end
local pap = pray.activeprayers[phn]
if pap == nil then return end
pap:pray()
end)
return pray
|