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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
|
local col = nrequire("colortheme.lua")
local svg = nrequire("cl_svg.lua")
local com = nrequire("cl_common.lua")
local inv = {}
local width, height = (ScrW() / 4) - 25, ScrH()
local iconsize = width / 5
local ringmat = svg.MaterialFromSVG("materials/svg/delapouite/originals/svg/000000/transparent/ring.svg")
--Positions for the eqipment inventory
local eqp = {
["Head"] = {
x = (width / 2) - (iconsize / 2),
y = 0,
img = svg.MaterialFromSVG("materials/svg/lorc/originals/svg/000000/transparent/cracked-helm.svg"),
},
["Shoulders"] = {
x = (width / 2) - (iconsize / 2),
y = iconsize,
img = svg.MaterialFromSVG("materials/svg/skoll/originals/svg/000000/transparent/pauldrons.svg")
},
["Chest"] = {
x = width / 2,
y = iconsize * 2,
img = svg.MaterialFromSVG("materials/svg/willdabeast/deviations/svg/000000/transparent/chain-mail.svg")
},
["Back"] = {
x = (width / 2) - iconsize,
y = iconsize * 2,
img = svg.MaterialFromSVG("materials/svg/lorc/originals/svg/000000/transparent/knapsack.svg"),
},
["Arms"] = {
x = (width / 2) - (iconsize / 2),
y = iconsize * 3,
img = svg.MaterialFromSVG("materials/svg/skoll/originals/svg/000000/transparent/bracers.svg")
},
["Belt"] = {
x = (width / 2) - (iconsize * 1.5),
y = iconsize * 3,
img = svg.MaterialFromSVG("materials/svg/lucasms/equipment/svg/000000/transparent/belt.svg")
},
["Gloves"] = {
x = (width / 2) + (iconsize / 2),
y = iconsize * 3,
img = svg.MaterialFromSVG("materials/svg/delapouite/originals/svg/000000/transparent/gloves.svg")
},
["Left Hand"] = {
x = width / 2,
y = iconsize * 4,
img = svg.MaterialFromSVG("materials/svg/sbed/originals/svg/000000/transparent/shield.svg")
},
["Right Hand"] = {
x = (width / 2) - iconsize,
y = iconsize * 4,
img = svg.MaterialFromSVG("materials/svg/delapouite/originals/svg/000000/transparent/thor-hammer.svg")
},
["Legs"] = {
x = (width / 2) - iconsize,
y = iconsize * 5,
img = svg.MaterialFromSVG("materials/svg/irongamer/originals/svg/000000/transparent/armored-pants.svg")
},
["Feet"] = {
x = width / 2,
y = iconsize * 5,
img = svg.MaterialFromSVG("materials/svg/lorc/originals/svg/000000/transparent/boots.svg"),
},
["Ring 1"] = {
x = 0,
y = iconsize,
img = ringmat
},
["Ring 2"] = {
x = width - iconsize,
y = iconsize,
img = ringmat
},
["Ring 3"] = {
x = 0,
y = iconsize * 2.5,
img = ringmat
},
["Ring 4"] = {
x = width - iconsize,
y = iconsize * 2.5,
img = ringmat
},
["Ring 5"] = {
x = 0,
y = iconsize * 4,
img = ringmat
},
["Ring 6"] = {
x = width - iconsize,
y = iconsize * 4,
img = ringmat
},
}
inv.DrawOnDPanel = function(self,panel)
print("Drawing equipment on panel")
local prox = {}
for k,v in pairs(eqp) do
local pn = vgui.Create("DButton",panel)
pn:SetSize(iconsize,iconsize)
pn:SetPos(v.x,v.y)
pn.info = {}
pn.info.owner = LocalPlayer()
pn.info.id = self.id
pn.info.pos = {k}
pn.info.inv = self
pn:Droppable("item")
pn:Receiver("item",com.generatereceiver(),{"one","two","three"})
if self.equiped[k] then --We have something equiped!
if self.equiped[k].GetOptions then
pn.DoClick = function()
local dm = DermaMenu()
com.CreateMenuFor(dm,self.equiped[k].GetOptions())
dm:Open()
end
end
print("Found something equiped in ", k)
if self.equiped[k].OnEqpPaint then
pn.Paint = self.equiped[k].OnEqpPaint
else
pn.Paint = function(tp,w,h)
draw.RoundedBox( 8, 0, 0, w, h, Color( 255, 0, 0 ) )
end
end
else --We don't have something equiped!
print("Nothing was equiped in ", k)
if v.img and v.img.material then
local c = col.ui.border
pn.Paint = function(tp,w,h)
surface.SetDrawColor(c.r,c.g,c.b)
surface.DrawOutlinedRect(0, 0, w, h)
surface.SetDrawColor(255,255,255)
surface.SetMaterial( v.img.material )
surface.DrawTexturedRect( 0, 0, w, h )
end
else
pn.Paint = function(tp,w,h)
draw.RoundedBox( 8, 0, 0, w, h, Color( 0, 0, 0 ) )
end
end
end
prox[k] = pn
end
prox.Put = function(self,position,item)
print("Put was called!",position,item)
PrintTable(position)
PrintTable(item)
assert(self[position[1]] ~= nil, "Tried to put an item into an unknown slot!")
if item.GetOptions then
self[position[1]].DoClick = function()
local dm = DermaMenu()
com.CreateMenuFor(dm,item.GetOptions())
dm:Open()
end
end
if item.OnEqpPaint then
self[position[1]].Paint = item.OnEqpPaint
else
self[position[1]].Paint = function(tp,w,h)
draw.RoundedBox( 8, 0, 0, w, h, Color( 255, 0, 0 ) )
end
end
self[position[1]]:Droppable("item")
end
prox.Remove = function(self,position)
local pn = self[position[1]]
pn.DoClick = function() end
local c = col.ui.border
pn.Paint = function(self,w,h)
surface.SetDrawColor(c.r,c.g,c.b)
surface.DrawOutlinedRect(0, 0, w, h)
surface.SetDrawColor(255,255,255)
surface.SetMaterial( eqp[position[1]].img.material )
surface.DrawTexturedRect( 0, 0, w, h )
end
print("Remove was called!",position)
pn:Droppable("none")
end
return prox
end
return inv
|