XoXFaby

Untitled

Sep 9th, 2014
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 59.57 KB | None | 0 0
  1. if SERVER then
  2. AddCSLuaFile()
  3. else
  4.  
  5. --hook.Add("PostGamemodeLoaded", "FancyPants_EquipmentMenu", function()
  6.  
  7. surface.CreateFont( "DermaDefaultBold100",
  8. {
  9. font = "Tahoma",
  10. size = 100,
  11. antialias = true,
  12. weight = 800
  13. })
  14. surface.CreateFont( "DermaDefaultBold60",
  15. {
  16. font = "Tahoma",
  17. size = 60,
  18. antialias = true,
  19. weight = 800
  20. })
  21.  
  22. local function ItemIsWeapon(item) return not tonumber(item.id) end
  23. local function CanCarryWeapon(item) return LocalPlayer():CanCarryType(item.kind) end
  24.  
  25. local Equipment = nil
  26. function GetEquipmentForRole(role)
  27. -- need to build equipment cache?
  28. if not Equipment then
  29. -- start with all the non-weapon goodies
  30. local tbl = table.Copy(EquipmentItems)
  31.  
  32. -- find buyable weapons to load info from
  33. for k, v in pairs(weapons.GetList()) do
  34. if v and v.CanBuy then
  35. local data = v.EquipMenuData or {}
  36. local base = {
  37. id = WEPS.GetClass(v),
  38. name = v.PrintName or "Unnamed",
  39. limited = v.LimitedStock,
  40. kind = v.Kind or WEAPON_NONE,
  41. slot = (v.Slot or 0) + 1,
  42. material = v.Icon or "VGUI/ttt/icon_id",
  43. -- the below should be specified in EquipMenuData, in which case
  44. -- these values are overwritten
  45. type = "Type not specified",
  46. model = "models/weapons/w_bugbait.mdl",
  47. desc = "No description specified."
  48. };
  49.  
  50. -- Force material to nil so that model key is used when we are
  51. -- explicitly told to do so (ie. material is false rather than nil).
  52. if data.modelicon then
  53. base.material = nil
  54. end
  55.  
  56. table.Merge(base, data)
  57.  
  58. -- add this buyable weapon to all relevant equipment tables
  59. for _, r in pairs(v.CanBuy) do
  60. table.insert(tbl[r], base)
  61. end
  62. end
  63. end
  64.  
  65. -- mark custom items
  66. for r, is in pairs(tbl) do
  67. for _, i in pairs(is) do
  68. if i and i.id then
  69. i.custom = not table.HasValue(DefaultEquipment[r], i.id)
  70. end
  71. end
  72. end
  73.  
  74. Equipment = tbl
  75. end
  76.  
  77. return Equipment and Equipment[role] or {}
  78. end
  79.  
  80. function NewCMenu()
  81.  
  82. local r = GetRoundState()
  83. if r == ROUND_ACTIVE and not (LocalPlayer():GetTraitor() or LocalPlayer():GetDetective()) then
  84. return
  85. elseif r == ROUND_POST or r == ROUND_PREP then
  86. CLSCORE:Reopen()
  87. return
  88. end
  89.  
  90. if IsValid(eqframe) then
  91. eqframe:Remove()
  92. return
  93. end
  94.  
  95. ----- Settings
  96.  
  97. local dat = { Settings = { Uncat = false, Hidecus = false, Memory = false }, Favourites = {} }
  98.  
  99. local set = file.Read("ttt_menu_settings.txt", "DATA")
  100. if set != nil then
  101. local dec = util.JSONToTable( set )
  102.  
  103. if dec != nil and type(dec) == "table" then
  104. table.Merge( dat, dec )
  105. end
  106. end
  107.  
  108. eqframe = vgui.Create("DFrame")
  109. eqframe:SetTitle( "" )
  110. eqframe:SetSize( 500, 364 )
  111. eqframe:Center()
  112. eqframe:SetDraggable( false )
  113. eqframe:MakePopup()
  114. eqframe.Settings = table.Copy(dat)
  115. eqframe.Close = function( s )
  116. s:Remove()
  117.  
  118. local cod = util.TableToJSON(s.Settings)
  119. file.Write( "ttt_menu_settings.txt", cod )
  120. end
  121.  
  122. eqframe.Sheets = {"ITEMS", "RADAR", "DISGUISE", "RADIO", "TRANSFER", "CLOSE"}
  123. eqframe.Windows = {}
  124. eqframe.Buttons = {}
  125. eqframe.Buttons2 = {}
  126.  
  127. local ip = 0
  128.  
  129. for k, v in pairs(eqframe.Sheets) do
  130.  
  131. local b = 83
  132.  
  133. if v == "ITEMS" or v == "CLOSE" then b = 84 end
  134.  
  135. but = vgui.Create("DButton", eqframe)
  136. but:SetPos( ip, 0 )
  137. but:SetSize( b, 30 )
  138. but.Text = v
  139. but.HoverOn = 0
  140. but.Hover = 0
  141. but:SetText("")
  142. but.Paint = function( s, w, h )
  143. draw.RoundedBox( 0, 0, 0, w, h, Color( 255, 0, 255, 255 ) )
  144.  
  145. if b == 83 then
  146. draw.RoundedBox( 0, 1, 2, w-2, h-4, eqframe.Color1 )
  147. elseif v == "ITEMS" then
  148. draw.RoundedBox( 0, 2, 2, w-3, h-4, eqframe.Color1 )
  149. elseif v == "CLOSE" then
  150. draw.RoundedBox( 0, 1, 2, w-3, h-4, eqframe.Color1 )
  151. end
  152.  
  153. local col = Color( 15, 15, 15, 255 )
  154.  
  155. if eqframe.Selected == s then
  156. s.Hover = math.Clamp( s.Hover + FrameTime() * 5, 0, 1 )
  157. col = Color(15 + 205 * s.Hover, 15 + 205 * s.Hover, 15 + 205 * s.Hover, 255)
  158. else
  159. s.Hover = math.Clamp( s.Hover - FrameTime() * 5, 0, 1 )
  160. col = Color(15 + 205 * s.Hover, 15 + 205 * s.Hover, 15 + 205 * s.Hover, 255)
  161. end
  162.  
  163. draw.SimpleText(s.Text, "DermaDefaultBold", w/2, h/2-1, col, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  164. draw.RoundedBox( 0, 0, 0, w, h, Color( 15, 15, 15, 100 - 100 * s.Hover ) )
  165.  
  166. if s:GetDisabled() == false then
  167. if s:IsHovered() then
  168. s.HoverOn = math.Clamp( s.HoverOn + FrameTime() * 5, 0, 1 )
  169. else
  170. s.HoverOn = math.Clamp( s.HoverOn - FrameTime() * 5, 0, 1 )
  171. end
  172. draw.RoundedBox( 0, 0, 0, w, h, Color( 15, 15, 15, 50 - 50 * s.HoverOn ) )
  173. else
  174. draw.RoundedBox( 0, 0, 0, w, h, Color( 15, 15, 15, 200 ) )
  175. end
  176. end
  177. but.Think = function( s )
  178.  
  179. local ply = LocalPlayer()
  180.  
  181. if v == "RADAR" then
  182. if ply:HasEquipmentItem(EQUIP_RADAR) then
  183. eqframe.Buttons2[v]:SetDisabled(false)
  184. else
  185. eqframe.Buttons2[v]:SetDisabled(true)
  186. end
  187. elseif v == "DISGUISE" then
  188. if ply:HasEquipmentItem(EQUIP_DISGUISE) then
  189. eqframe.Buttons2[v]:SetDisabled(false)
  190. else
  191. eqframe.Buttons2[v]:SetDisabled(true)
  192. end
  193. elseif v == "RADIO" then
  194. if (IsValid(ply.radio) or ply:HasWeapon("weapon_ttt_radio")) then
  195. eqframe.Buttons2[v]:SetDisabled(false)
  196. else
  197. eqframe.Buttons2[v]:SetDisabled(true)
  198. end
  199. elseif v == "TRANSFER" then
  200. if LocalPlayer():GetCredits() > 0 then
  201. eqframe.Buttons2[v]:SetDisabled(false)
  202. else
  203. eqframe.Buttons2[v]:SetDisabled(true)
  204. end
  205. end
  206. end
  207. but.DoClick = function( s )
  208. if v == "CLOSE" then
  209. eqframe:Close()
  210. return
  211. end
  212.  
  213. if eqframe.Selected != s then
  214. eqframe.Selected = s
  215.  
  216. for i, o in pairs(eqframe.Windows) do
  217. o:SetVisible(false)
  218. end
  219. if IsValid(eqframe.Windows[v]) then
  220. eqframe.Windows[v]:SetVisible(true)
  221. end
  222. end
  223. end
  224.  
  225. if b != 84 then
  226. but:SetDisabled(true)
  227. end
  228.  
  229. table.insert(eqframe.Buttons, but)
  230. eqframe.Buttons2[v] = but
  231.  
  232. ip = ip + b
  233. end
  234.  
  235. eqframe.Color1 = Color(50,70,100,255)
  236. eqframe.Equipment = GetEquipmentForRole(LocalPlayer():GetRole())
  237. eqframe.Categories = {}
  238.  
  239. for k, v in pairs(eqframe.Equipment) do
  240. if !table.HasValue( eqframe.Categories, v.type ) then
  241. table.insert( eqframe.Categories, v.type )
  242. end
  243. end
  244.  
  245. ---------------------
  246.  
  247. eqframe.ItemPanel = vgui.Create("DPanel", eqframe)
  248. eqframe.ItemPanel:SetPos( 0, 28 )
  249. eqframe.ItemPanel:SetSize( 500, 336 )
  250. eqframe.ItemPanel.Paint = function( s, w, h )
  251.  
  252. draw.RoundedBox( 0, 0, 0, w, h, Color( 60, 60, 60, 255 ) )
  253.  
  254. draw.RoundedBox( 0, 0, 32, w, 184, Color( 40, 40, 40, 255 ) )
  255. end
  256.  
  257. eqframe.ItemPanel.Items = vgui.Create("DPanelList", eqframe.ItemPanel)
  258. eqframe.ItemPanel.Items:SetPos( 128, 32 )
  259. eqframe.ItemPanel.Items:SetSize( 372, 184 )
  260. eqframe.ItemPanel.Items:EnableVerticalScrollbar( true )
  261. eqframe.ItemPanel.Items:EnableHorizontal( true )
  262. eqframe.ItemPanel.Items:SetPadding( 4 )
  263. eqframe.ItemPanel.Items:SetSpacing( 4 )
  264. eqframe.ItemPanel.Items.Selected = nil
  265. eqframe.ItemPanel.Items.Paint = function( s, w, h )
  266. surface.SetDrawColor( 15, 15, 15, 255 )
  267. surface.DrawOutlinedRect( -1, -1, w, h+2)
  268. surface.DrawOutlinedRect( -1, -1, w+1, h+2)
  269.  
  270. /*local w2 = 18
  271.  
  272. if s.VBar:IsVisible() then w2 = 44 end
  273.  
  274. if !s.VBar:IsVisible() then
  275. draw.RoundedBox( 0, 8, 8, w-w2, h-16, Color(0, 0, 0, 255) )
  276. end
  277.  
  278. surface.SetMaterial(eqframe.ItemPanel.Items.Grad)
  279. surface.SetDrawColor(0,0,0,255)
  280.  
  281. //surface.DrawTexturedRectRotated( w/2 - (w-8)/2, h/2, h-16, 8, 270)
  282. //surface.DrawTexturedRectRotated( w/2 + (w-8)/2 - 2 - (w2-18), h/2, h-16, 8, 90)
  283. surface.DrawTexturedRectRotated( w/2 - (w2/2) + 8, h/2 - (h-8)/2, w-(w2), 8, 180)
  284. surface.DrawTexturedRectRotated( w/2 - (w2/2) + 8, h/2 + (h-8)/2, w-(w2), 8, 0)*/
  285.  
  286. end
  287. eqframe.ItemPanel.Items.pnlCanvas.Paint = function( s, w, h )
  288.  
  289. /*if s:GetParent().VBar:IsVisible() then
  290. draw.RoundedBox( 0, 8, 8, w-44, h-16, Color(0, 0, 0, 255) )
  291. end*/
  292. end
  293. eqframe.ItemPanel.Items.PerformLayout = function(s)
  294.  
  295. local Wide = s:GetWide()
  296. local YPos = 0
  297.  
  298. if ( !s.Rebuild ) then
  299. debug.Trace()
  300. end
  301.  
  302. s:Rebuild()
  303.  
  304. if ( s.VBar && !m_bSizeToContents ) then
  305. s.VBar:SetPos( s:GetWide() - 28, 4 )
  306. s.VBar:SetSize( 22, s:GetTall() - 8 )
  307. s.VBar:SetUp( s:GetTall(), s.pnlCanvas:GetTall() )
  308. YPos = s.VBar:GetOffset()
  309. end
  310.  
  311. s.pnlCanvas:SetPos( 0, YPos )
  312. s.pnlCanvas:SetWide( Wide )
  313.  
  314. s:Rebuild()
  315.  
  316. if ( s:GetAutoSize() ) then
  317. s:SetTall( s.pnlCanvas:GetTall() )
  318. s.pnlCanvas:SetPos( 0, 0 )
  319. end
  320.  
  321. end
  322. eqframe.ItemPanel.Items.VBar.Paint = function( s, w, h )
  323. draw.RoundedBox( 0, 0, 0, w, h, Color(15, 15, 15, 255) )
  324. draw.RoundedBox( 0, 8, 0, w-16, h, Color(50, 50, 50, 255) )
  325. end
  326. eqframe.ItemPanel.Items.VBar.btnDown.Hover = 0
  327. eqframe.ItemPanel.Items.VBar.btnDown.Paint = function( s, w, h )
  328.  
  329. if s:IsHovered() or eqframe.ItemPanel.Items.Selected == s then
  330. s.Hover = math.Clamp( s.Hover + FrameTime() * 5, 0, 1 )
  331. elseif s:IsHovered() == false and eqframe.ItemPanel.Items.Selected != s then
  332. s.Hover = math.Clamp( s.Hover - FrameTime() * 5, 0, 1 )
  333. end
  334.  
  335. draw.RoundedBox( 0, 0, 0, w, h, Color(15, 15, 15, 255) )
  336. draw.RoundedBox( 0, 2, 0, w-4, h-2, Color(50 + 25 * s.Hover, 50 + 25 * s.Hover, 50 + 25 * s.Hover, 255) )
  337.  
  338. local arrow = {{ },{ },{ }}
  339.  
  340. arrow[1]["x"] = 4
  341. arrow[1]["y"] = 8
  342.  
  343. arrow[2]["x"] = w - 4
  344. arrow[2]["y"] = 8
  345.  
  346. arrow[3]["x"] = w/2
  347. arrow[3]["y"] = 18
  348.  
  349. local x, y = s:GetPos()
  350. surface.SetMaterial( eqframe.ItemPanel.Items.White )
  351. surface.SetDrawColor( 150 + s.Hover * 70, 150 + s.Hover * 70, 150 + s.Hover * 70, 255 )
  352. surface.DrawPoly( arrow )
  353. end
  354. eqframe.ItemPanel.Items.VBar.btnUp.Hover = 0
  355. eqframe.ItemPanel.Items.VBar.btnUp.Paint = function( s, w, h )
  356.  
  357. if s:IsHovered() or eqframe.ItemPanel.Items.Selected == s then
  358. s.Hover = math.Clamp( s.Hover + FrameTime() * 5, 0, 1 )
  359. elseif s:IsHovered() == false and eqframe.ItemPanel.Items.Selected != s then
  360. s.Hover = math.Clamp( s.Hover - FrameTime() * 5, 0, 1 )
  361. end
  362.  
  363. draw.RoundedBox( 0, 0, 0, w, h, Color(15, 15, 15, 255) )
  364. draw.RoundedBox( 0, 2, 2, w-4, h-2, Color(50 + 25 * s.Hover, 50 + 25 * s.Hover, 50 + 25 * s.Hover, 255) )
  365.  
  366. local arrow = {{ },{ },{ }}
  367.  
  368. arrow[1]["x"] = 4
  369. arrow[1]["y"] = 16
  370.  
  371. arrow[2]["x"] = w/2
  372. arrow[2]["y"] = 6
  373.  
  374. arrow[3]["x"] = w - 4
  375. arrow[3]["y"] = 16
  376.  
  377. local x, y = s:GetPos()
  378. surface.SetMaterial( eqframe.ItemPanel.Items.White )
  379. surface.SetDrawColor( 150 + s.Hover * 70, 150 + s.Hover * 70, 150 + s.Hover * 70, 255 )
  380. surface.DrawPoly( arrow )
  381. end
  382. eqframe.ItemPanel.Items.VBar.btnGrip.Hover = 0
  383. eqframe.ItemPanel.Items.VBar.btnGrip.Paint = function( s, w, h )
  384.  
  385. if s:IsHovered() or eqframe.ItemPanel.Items.Selected == s then
  386. s.Hover = math.Clamp( s.Hover + FrameTime() * 5, 0, 1 )
  387. elseif s:IsHovered() == false and eqframe.ItemPanel.Items.Selected != s then
  388. s.Hover = math.Clamp( s.Hover - FrameTime() * 5, 0, 1 )
  389. end
  390.  
  391. draw.RoundedBox( 0, 0, 0, w, h, Color(0, 0, 0, 255) )
  392. draw.RoundedBox( 0, 2, 0, w-4, h, Color(50 + 25 * s.Hover, 50 + 25 * s.Hover, 50 + 25 * s.Hover, 255) )
  393. end
  394.  
  395. eqframe.ItemPanel.Items.Grad = Material("vgui/gradient_down")
  396. eqframe.ItemPanel.Items.Custom = Material("vgui/ttt/custom_marker")
  397. eqframe.ItemPanel.Items.White = Material("vgui/white")
  398. eqframe.ItemPanel.Items.Tick = Material("icon16/tick.png")
  399. eqframe.ItemPanel.Items.Heart = Material("icon16/heart.png")
  400.  
  401. eqframe.ItemPanel.InfoPanel = vgui.Create("DPanel", eqframe.ItemPanel)
  402. eqframe.ItemPanel.InfoPanel:SetPos( 128, 216 )
  403. eqframe.ItemPanel.InfoPanel:SetSize( 372, 120 )
  404. eqframe.ItemPanel.InfoPanel.CName = {" credits.", " credit.", "no credits."}
  405. eqframe.ItemPanel.InfoPanel.Paint = function( s, w, h )
  406. surface.SetDrawColor( 15, 15, 15, 255 )
  407. surface.DrawOutlinedRect( -1, 0, w, h)
  408. surface.DrawOutlinedRect( -1, 1, w+1, h-2)
  409.  
  410. draw.RoundedBox( 0, 208, 0, 2, h, Color(15, 15, 15, 255) )
  411.  
  412. if IsValid(eqframe.ItemPanel.Items.Selected) then
  413.  
  414. local tab = eqframe.ItemPanel.Items.Selected.Table
  415.  
  416. -----
  417.  
  418. local c = LocalPlayer():GetCredits()
  419.  
  420. if c > 0 then
  421. if c > 1 then
  422. draw.SimpleText("O", "DermaDefault", 210 + 15, 10, Color(15,250,15,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_BOTTOM)
  423. draw.SimpleText(("You have "..c..s.CName[1]), "DermaDefault", 210 + 30, 10, Color(220,220,220,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_BOTTOM)
  424. else
  425. draw.SimpleText("O", "DermaDefault", 210 + 15, 10, Color(15,250,15,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_BOTTOM)
  426. draw.SimpleText(("You have "..c..s.CName[2]), "DermaDefault", 210 + 30, 10, Color(220,220,220,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_BOTTOM)
  427. end
  428. else
  429. draw.SimpleText("X", "DermaDefault", 210 + 15, 10, Color(250,15,15,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_BOTTOM)
  430. draw.SimpleText(("You have "..s.CName[3]), "DermaDefault", 210 + 30, 10, Color(220,220,220,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_BOTTOM)
  431. end
  432.  
  433. -----
  434.  
  435. if ItemIsWeapon(tab) and (not CanCarryWeapon(tab)) then
  436. draw.SimpleText("X", "DermaDefault", 210 + 15, 32, Color(250,15,15,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_BOTTOM)
  437. draw.SimpleText("Slot "..tab.slot.." is not empty.", "DermaDefault", 210 + 30, 32, Color(220,220,220,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_BOTTOM)
  438. elseif (not ItemIsWeapon(tab)) and LocalPlayer():HasEquipmentItem(tab.id) then
  439. draw.SimpleText("X", "DermaDefault", 210 + 15, 32, Color(250,15,15,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_BOTTOM)
  440. draw.SimpleText("You already have this item.", "DermaDefault", 210 + 30, 32, Color(220,220,220,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_BOTTOM)
  441. else
  442. draw.SimpleText("O", "DermaDefault", 210 + 15, 32, Color(15,250,15,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_BOTTOM)
  443. draw.SimpleText("You can carry this item.", "DermaDefault", 210 + 30, 32, Color(220,220,220,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_BOTTOM)
  444. end
  445.  
  446. -----
  447.  
  448. if tab.limited and LocalPlayer():HasBought(tostring(tab.id)) then
  449. draw.SimpleText("X", "DermaDefault", 210 + 15, 54, Color(250,15,15,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_BOTTOM)
  450. draw.SimpleText("Item is out of stock.", "DermaDefault", 210 + 30, 54, Color(220,220,220,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_BOTTOM)
  451. else
  452. draw.SimpleText("O", "DermaDefault", 210 + 15, 54, Color(15,250,15,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_BOTTOM)
  453. draw.SimpleText("Item is in stock.", "DermaDefault", 210 + 30, 54, Color(220,220,220,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_BOTTOM)
  454. end
  455.  
  456. end
  457. end
  458.  
  459. eqframe.ItemPanel.InfoPanel.Name = vgui.Create("DLabel", eqframe.ItemPanel.InfoPanel)
  460. eqframe.ItemPanel.InfoPanel.Name:SetPos( 10, 10 )
  461. eqframe.ItemPanel.InfoPanel.Name:SizeToContents()
  462. eqframe.ItemPanel.InfoPanel.Name:SetText("")
  463. eqframe.ItemPanel.InfoPanel.Name.Hover = 0
  464. eqframe.ItemPanel.InfoPanel.Name.PaintOver = function(s, w, h)
  465. if s.Hover < 1 then
  466. s.Hover = math.Clamp( s.Hover + FrameTime() * 5, 0, 1 )
  467. s:SetTextColor( Color( 220, 220, 220, 255 * s.Hover ) )
  468. end
  469. end
  470.  
  471. eqframe.ItemPanel.InfoPanel.Desc = vgui.Create("DLabel", eqframe.ItemPanel.InfoPanel)
  472. eqframe.ItemPanel.InfoPanel.Desc:SetPos( 10, 32 )
  473. eqframe.ItemPanel.InfoPanel.Desc:SetSize( 200, 80 )
  474. eqframe.ItemPanel.InfoPanel.Desc:SetText("")
  475. eqframe.ItemPanel.InfoPanel.Desc:SetAutoStretchVertical(true)
  476. eqframe.ItemPanel.InfoPanel.Desc.Hover = 0
  477. eqframe.ItemPanel.InfoPanel.Desc.PaintOver = function(s, w, h)
  478. if s.Hover < 1 then
  479. s.Hover = math.Clamp( s.Hover + FrameTime() * 5, 0, 1 )
  480. s:SetTextColor( Color( 220, 220, 220, 255 * s.Hover ) )
  481. end
  482. end
  483.  
  484. eqframe.ItemPanel.InfoPanel.Buy = vgui.Create("DButton", eqframe.ItemPanel.InfoPanel)
  485. eqframe.ItemPanel.InfoPanel.Buy:SetPos( 260, 80 )
  486. eqframe.ItemPanel.InfoPanel.Buy:SetSize( 100, 30 )
  487. eqframe.ItemPanel.InfoPanel.Buy:SetText("")
  488. eqframe.ItemPanel.InfoPanel.Buy.HoverOn = 0
  489. eqframe.ItemPanel.InfoPanel.Buy.Hover = 0
  490. eqframe.ItemPanel.InfoPanel.Buy.Hover1 = 0
  491. eqframe.ItemPanel.InfoPanel.Buy.Hover2 = 0
  492. eqframe.ItemPanel.InfoPanel.Buy.Hover3 = 0
  493. eqframe.ItemPanel.InfoPanel.Buy.Paint = function( s, w, h )
  494.  
  495. draw.RoundedBox( 0, 0, 0, w, h, Color( 15, 15, 15, 255 ) )
  496. draw.RoundedBox( 0, 2, 2, w-4, h-4, eqframe.Color1 )
  497.  
  498. local col1, col2, col3
  499.  
  500. if IsValid(eqframe.ItemPanel.Items.Selected) then
  501.  
  502. local tab = eqframe.ItemPanel.Items.Selected.Table
  503.  
  504. local c = LocalPlayer():GetCredits()
  505.  
  506. if c > 0 then
  507. col1 = true
  508. end
  509.  
  510. if ItemIsWeapon(tab) and (not CanCarryWeapon(tab)) then
  511. elseif (not ItemIsWeapon(tab)) and LocalPlayer():HasEquipmentItem(tab.id) then
  512. else
  513. col2 = true
  514. end
  515.  
  516. if tab.limited and LocalPlayer():HasBought(tostring(tab.id)) then
  517. else
  518. col3 = true
  519. end
  520.  
  521. end
  522.  
  523. if col1 then
  524. s.Hover1 = math.Clamp( s.Hover1 + FrameTime() * 5, 0, 1 )
  525. else
  526. s.Hover1 = math.Clamp( s.Hover1 - FrameTime() * 5, 0, 1 )
  527. end
  528.  
  529. if col2 then
  530. s.Hover2 = math.Clamp( s.Hover2 + FrameTime() * 5, 0, 1 )
  531. else
  532. s.Hover2 = math.Clamp( s.Hover2 - FrameTime() * 5, 0, 1 )
  533. end
  534.  
  535. if col3 then
  536. s.Hover3 = math.Clamp( s.Hover3 + FrameTime() * 5, 0, 1 )
  537. else
  538. s.Hover3 = math.Clamp( s.Hover3 - FrameTime() * 5, 0, 1 )
  539. end
  540.  
  541. local a1, a2, a3 = (15 + (col1 and 205 * s.Hover1 or 0)), (15 + (col2 and 205 * s.Hover2 or 0)), (15 + (col3 and 205 * s.Hover3 or 0))
  542.  
  543. draw.RoundedBox( 0, 5, 5, 10, 20, Color( a1, a1, a1, 255 ) )
  544. draw.RoundedBox( 0, 17, 5, 10, 20, Color( a2, a2, a2, 255 ) )
  545. draw.RoundedBox( 0, 29, 5, 10, 20, Color( a3, a3, a3, 255 ) )
  546.  
  547. local arrow = {{ },{ },{ }}
  548.  
  549. arrow[1]["x"] = 41
  550. arrow[1]["y"] = 5
  551.  
  552. arrow[2]["x"] = 51
  553. arrow[2]["y"] = 15
  554.  
  555. arrow[3]["x"] = 41
  556. arrow[3]["y"] = 25
  557.  
  558. surface.SetMaterial( eqframe.ItemPanel.Items.White )
  559.  
  560. local col = Color( 15, 15, 15, 255 )
  561.  
  562. if col1 and col2 and col3 then
  563. s.Hover = math.Clamp( s.Hover + FrameTime() * 5, 0, 1 )
  564. col = Color(15 + 205 * s.Hover, 15 + 205 * s.Hover, 15 + 205 * s.Hover, 255)
  565. else
  566. s.Hover = math.Clamp( s.Hover - FrameTime() * 5, 0, 1 )
  567. col = Color(15 + 205 * s.Hover, 15 + 205 * s.Hover, 15 + 205 * s.Hover, 255)
  568. end
  569.  
  570. surface.SetDrawColor( col )
  571. surface.DrawPoly( arrow )
  572.  
  573. draw.SimpleText("BUY", "DermaDefaultBold", w-15, h/2-1, col, TEXT_ALIGN_RIGHT, TEXT_ALIGN_CENTER)
  574.  
  575. draw.RoundedBox( 0, 0, 0, w, h, Color( 15, 15, 15, 100 - 100 * s.Hover ) )
  576.  
  577. if s:IsHovered() then
  578. s.HoverOn = math.Clamp( s.HoverOn + FrameTime() * 5, 0, 1 )
  579. else
  580. s.HoverOn = math.Clamp( s.HoverOn - FrameTime() * 5, 0, 1 )
  581. end
  582. draw.RoundedBox( 0, 0, 0, w, h, Color( 15, 15, 15, 50 - 50 * s.HoverOn ) )
  583.  
  584. end
  585. eqframe.ItemPanel.InfoPanel.Buy.Think = function( s, w, h )
  586. if eqframe.ItemPanel.Items.Selected == nil then
  587. s:SetDisabled(true)
  588. else
  589. s:SetDisabled(false)
  590. end
  591. end
  592. eqframe.ItemPanel.InfoPanel.Buy.DoClick = function( s )
  593.  
  594. local col1, col2, col3
  595.  
  596. if IsValid(eqframe.ItemPanel.Items.Selected) then
  597.  
  598. local tab = eqframe.ItemPanel.Items.Selected.Table
  599.  
  600. local c = LocalPlayer():GetCredits()
  601.  
  602. if c > 0 then
  603. col1 = true
  604. end
  605.  
  606. if ItemIsWeapon(tab) and (not CanCarryWeapon(tab)) then
  607. elseif (not ItemIsWeapon(tab)) and LocalPlayer():HasEquipmentItem(tab.id) then
  608. else
  609. col2 = true
  610. end
  611.  
  612. if tab.limited and LocalPlayer():HasBought(tostring(tab.id)) then
  613. else
  614. col3 = true
  615. end
  616.  
  617. if col1 and col2 and col3 then
  618.  
  619. RunConsoleCommand("ttt_order_equipment", tab.id)
  620. eqframe:Close()
  621.  
  622. end
  623. end
  624. end
  625.  
  626. eqframe.ItemPanel.InfoPanel.Fav = vgui.Create("DButton", eqframe.ItemPanel.InfoPanel)
  627. eqframe.ItemPanel.InfoPanel.Fav:SetPos( 220, 80 )
  628. eqframe.ItemPanel.InfoPanel.Fav:SetSize( 40, 30 )
  629. eqframe.ItemPanel.InfoPanel.Fav:SetText("")
  630. eqframe.ItemPanel.InfoPanel.Fav.HoverOn = 0
  631. eqframe.ItemPanel.InfoPanel.Fav.Hover = 0
  632. eqframe.ItemPanel.InfoPanel.Fav.Paint = function( s, w, h )
  633. draw.RoundedBox( 0, 0, 0, w, h, Color( 15, 15, 15, 255 ) )
  634. draw.RoundedBox( 0, 2, 2, w-2, h-4, eqframe.Color1 )
  635.  
  636. local col = Color( 15, 15, 15, 255 )
  637.  
  638. if eqframe.ItemPanel.Items.Selected != nil and table.HasValue(eqframe.Settings["Favourites"], eqframe.ItemPanel.Items.Selected.Table.id ) then
  639. s.Hover = math.Clamp( s.Hover + FrameTime() * 5, 0, 1 )
  640. col = Color(15 + 205 * s.Hover, 15 + 205 * s.Hover, 15 + 205 * s.Hover, 255)
  641. else
  642. s.Hover = math.Clamp( s.Hover - FrameTime() * 5, 0, 1 )
  643. col = Color(15 + 205 * s.Hover, 15 + 205 * s.Hover, 15 + 205 * s.Hover, 255)
  644. end
  645.  
  646. draw.SimpleText("+FAV", "DermaDefaultBold", w/2+1, h/2-1, col, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  647.  
  648. draw.RoundedBox( 0, 0, 0, w, h, Color( 15, 15, 15, 100 - 100 * s.Hover ) )
  649.  
  650. if s:IsHovered() then
  651. s.HoverOn = math.Clamp( s.HoverOn + FrameTime() * 5, 0, 1 )
  652. else
  653. s.HoverOn = math.Clamp( s.HoverOn - FrameTime() * 5, 0, 1 )
  654. end
  655. draw.RoundedBox( 0, 0, 0, w, h, Color( 15, 15, 15, 50 - 50 * s.HoverOn ) )
  656.  
  657. end
  658. eqframe.ItemPanel.InfoPanel.Fav.Think = function( s, w, h )
  659. if eqframe.ItemPanel.Items.Selected == nil then
  660. s:SetDisabled(true)
  661. else
  662. s:SetDisabled(false)
  663. end
  664. end
  665. eqframe.ItemPanel.InfoPanel.Fav.DoClick = function( s )
  666. if eqframe.ItemPanel.Items.Selected != nil then
  667. local ik = nil
  668. for k, v in pairs(eqframe.Settings["Favourites"]) do
  669. if v == eqframe.ItemPanel.Items.Selected.Table.id then
  670. ik = k
  671. break
  672. end
  673. end
  674.  
  675. if ik == nil then
  676. table.insert(eqframe.Settings["Favourites"], eqframe.ItemPanel.Items.Selected.Table.id)
  677. else
  678. table.remove(eqframe.Settings["Favourites"], ik)
  679. if eqframe.ItemPanel.CategoryList.Selected and eqframe.ItemPanel.CategoryList.Selected.Text == "FAVOURITES" then
  680. eqframe.ItemPanel.Items:RebuildItems(true)
  681. end
  682. end
  683. end
  684. end
  685.  
  686. eqframe.ItemPanel.CategoryList = vgui.Create("DPanelList", eqframe.ItemPanel)
  687. eqframe.ItemPanel.CategoryList:SetPos( 0, 32 )
  688. eqframe.ItemPanel.CategoryList:SetSize( 128, 184 )
  689. eqframe.ItemPanel.CategoryList:EnableVerticalScrollbar( true )
  690. eqframe.ItemPanel.CategoryList:SetPadding( 4 )
  691. eqframe.ItemPanel.CategoryList:SetSpacing( 4 )
  692. eqframe.ItemPanel.CategoryList.Selected = nil
  693. eqframe.ItemPanel.CategoryList.Paint = function( s, w, h )
  694. surface.SetDrawColor( 15, 15, 15, 255 )
  695. surface.DrawOutlinedRect( 0, -1, w-1, h+2)
  696. surface.DrawOutlinedRect( 1, -1, w-1, h+2)
  697. end
  698. eqframe.ItemPanel.CategoryList.PerformLayout = function(s)
  699.  
  700. local Wide = s:GetWide()
  701. local YPos = 0
  702.  
  703. if ( !s.Rebuild ) then
  704. debug.Trace()
  705. end
  706.  
  707. s:Rebuild()
  708.  
  709. if ( s.VBar && !m_bSizeToContents ) then
  710. s.VBar:SetPos( s:GetWide() - 28, 4 )
  711. s.VBar:SetSize( 22, s:GetTall() - 8 )
  712. s.VBar:SetUp( s:GetTall(), s.pnlCanvas:GetTall() )
  713. YPos = s.VBar:GetOffset()
  714. if s.VBar:IsVisible() then Wide = Wide - 28 end
  715. end
  716.  
  717. s.pnlCanvas:SetPos( 0, YPos )
  718. s.pnlCanvas:SetWide( Wide )
  719.  
  720. s:Rebuild()
  721.  
  722. if ( s:GetAutoSize() ) then
  723. s:SetTall( s.pnlCanvas:GetTall() )
  724. s.pnlCanvas:SetPos( 0, 0 )
  725. end
  726.  
  727. end
  728. eqframe.ItemPanel.CategoryList.VBar.Paint = function( s, w, h )
  729. draw.RoundedBox( 0, 0, 0, w, h, Color(15, 15, 15, 255) )
  730. draw.RoundedBox( 0, 8, 0, w-16, h, Color(50, 50, 50, 255) )
  731. end
  732. eqframe.ItemPanel.CategoryList.VBar.btnDown.Hover = 0
  733. eqframe.ItemPanel.CategoryList.VBar.btnDown.Paint = function( s, w, h )
  734.  
  735. if s:IsHovered() or eqframe.ItemPanel.Items.Selected == s then
  736. s.Hover = math.Clamp( s.Hover + FrameTime() * 5, 0, 1 )
  737. elseif s:IsHovered() == false and eqframe.ItemPanel.Items.Selected != s then
  738. s.Hover = math.Clamp( s.Hover - FrameTime() * 5, 0, 1 )
  739. end
  740.  
  741. draw.RoundedBox( 0, 0, 0, w, h, Color(15, 15, 15, 255) )
  742. draw.RoundedBox( 0, 2, 0, w-4, h-2, Color(50 + 25 * s.Hover, 50 + 25 * s.Hover, 50 + 25 * s.Hover, 255) )
  743.  
  744. local arrow = {{ },{ },{ }}
  745.  
  746. arrow[1]["x"] = 4
  747. arrow[1]["y"] = 8
  748.  
  749. arrow[2]["x"] = w - 4
  750. arrow[2]["y"] = 8
  751.  
  752. arrow[3]["x"] = w/2
  753. arrow[3]["y"] = 18
  754.  
  755. local x, y = s:GetPos()
  756. surface.SetMaterial( eqframe.ItemPanel.Items.White )
  757. surface.SetDrawColor( 150 + s.Hover * 70, 150 + s.Hover * 70, 150 + s.Hover * 70, 255 )
  758. surface.DrawPoly( arrow )
  759. end
  760. eqframe.ItemPanel.CategoryList.VBar.btnUp.Hover = 0
  761. eqframe.ItemPanel.CategoryList.VBar.btnUp.Paint = function( s, w, h )
  762.  
  763. if s:IsHovered() or eqframe.ItemPanel.Items.Selected == s then
  764. s.Hover = math.Clamp( s.Hover + FrameTime() * 5, 0, 1 )
  765. elseif s:IsHovered() == false and eqframe.ItemPanel.Items.Selected != s then
  766. s.Hover = math.Clamp( s.Hover - FrameTime() * 5, 0, 1 )
  767. end
  768.  
  769. draw.RoundedBox( 0, 0, 0, w, h, Color(15, 15, 15, 255) )
  770. draw.RoundedBox( 0, 2, 2, w-4, h-2, Color(50 + 25 * s.Hover, 50 + 25 * s.Hover, 50 + 25 * s.Hover, 255) )
  771.  
  772. local arrow = {{ },{ },{ }}
  773.  
  774. arrow[1]["x"] = 4
  775. arrow[1]["y"] = 16
  776.  
  777. arrow[2]["x"] = w/2
  778. arrow[2]["y"] = 6
  779.  
  780. arrow[3]["x"] = w - 4
  781. arrow[3]["y"] = 16
  782.  
  783. local x, y = s:GetPos()
  784. surface.SetMaterial( eqframe.ItemPanel.Items.White )
  785. surface.SetDrawColor( 150 + s.Hover * 70, 150 + s.Hover * 70, 150 + s.Hover * 70, 255 )
  786. surface.DrawPoly( arrow )
  787. end
  788. eqframe.ItemPanel.CategoryList.VBar.btnGrip.Hover = 0
  789. eqframe.ItemPanel.CategoryList.VBar.btnGrip.Paint = function( s, w, h )
  790.  
  791. if s:IsHovered() or eqframe.ItemPanel.Items.Selected == s then
  792. s.Hover = math.Clamp( s.Hover + FrameTime() * 5, 0, 1 )
  793. elseif s:IsHovered() == false and eqframe.ItemPanel.Items.Selected != s then
  794. s.Hover = math.Clamp( s.Hover - FrameTime() * 5, 0, 1 )
  795. end
  796.  
  797. draw.RoundedBox( 0, 0, 0, w, h, Color(0, 0, 0, 255) )
  798. draw.RoundedBox( 0, 2, 0, w-4, h, Color(50 + 25 * s.Hover, 50 + 25 * s.Hover, 50 + 25 * s.Hover, 255) )
  799. end
  800.  
  801. for k, v in pairs(eqframe.Categories) do
  802.  
  803. local nam = v
  804. if string.Left(nam, 5) == "item_" then nam = string.Right(nam, string.len(nam)-5) end
  805.  
  806. local cat = vgui.Create("Button")
  807. cat:SetText("")
  808. cat:SetSize( 108, 30 )
  809. cat.Hover = 0
  810. cat.HoverOn = 0
  811. cat.Category = v
  812. cat.Text = string.upper(nam)
  813. cat.Paint = function( s, w, h )
  814. draw.RoundedBox( 0, 0, 0, w, h, Color( 15, 15, 15, 255 ) )
  815. draw.RoundedBox( 0, 2, 2, w-4, h-4, eqframe.Color1 )
  816.  
  817. local col = Color( 15, 15, 15, 255 )
  818.  
  819. if eqframe.ItemPanel.CategoryList.Selected == s then
  820. s.Hover = math.Clamp( s.Hover + FrameTime() * 5, 0, 1 )
  821. col = Color(15 + 205 * s.Hover, 15 + 205 * s.Hover, 15 + 205 * s.Hover, 255)
  822. else
  823. s.Hover = math.Clamp( s.Hover - FrameTime() * 5, 0, 1 )
  824. col = Color(15 + 205 * s.Hover, 15 + 205 * s.Hover, 15 + 205 * s.Hover, 255)
  825. end
  826.  
  827. draw.SimpleText(s.Text, "DermaDefaultBold", w/2, h/2-1, col, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  828.  
  829. draw.RoundedBox( 0, 0, 0, w, h, Color( 15, 15, 15, 100 - 100 * s.Hover ) )
  830.  
  831. if s:IsHovered() then
  832. s.HoverOn = math.Clamp( s.HoverOn + FrameTime() * 5, 0, 1 )
  833. else
  834. s.HoverOn = math.Clamp( s.HoverOn - FrameTime() * 5, 0, 1 )
  835. end
  836. draw.RoundedBox( 0, 0, 0, w, h, Color( 15, 15, 15, 50 - 50 * s.HoverOn ) )
  837.  
  838. end
  839. cat.DoClick = function( s )
  840. local prev = eqframe.ItemPanel.CategoryList.Selected
  841. eqframe.ItemPanel.CategoryList.Selected = s
  842. if eqframe.Settings["Settings"]["Uncat"] == false or (IsValid(prev) and prev.Text == "FAVOURITES") then
  843. eqframe.ItemPanel.Items:RebuildItems()
  844. end
  845. end
  846.  
  847. eqframe.ItemPanel.CategoryList:AddItem(cat)
  848. end
  849.  
  850. eqframe.ItemPanel.FavPanel = vgui.Create("DPanel", eqframe.ItemPanel)
  851. eqframe.ItemPanel.FavPanel:SetPos( 0, 216 )
  852. eqframe.ItemPanel.FavPanel:SetSize( 128, 120 )
  853. eqframe.ItemPanel.FavPanel.Paint = function( s, w, h )
  854. surface.SetDrawColor( 15, 15, 15, 255 )
  855. surface.DrawOutlinedRect( 0, 0, w, h )
  856. surface.DrawOutlinedRect( 1, 1, w-2, h-2 )
  857. end
  858.  
  859. eqframe.ItemPanel.FavPanel.Check1 = vgui.Create( "DCheckBoxLabel", eqframe.ItemPanel.FavPanel )
  860. eqframe.ItemPanel.FavPanel.Check1:SetPos( 10, 10 )
  861. eqframe.ItemPanel.FavPanel.Check1:SetText( "Uncategorized?" )
  862. eqframe.ItemPanel.FavPanel.Check1:SizeToContents()
  863. eqframe.ItemPanel.FavPanel.Check1.Button.Hover = 0
  864. eqframe.ItemPanel.FavPanel.Check1.Button.Paint = function( s, w, h )
  865. draw.RoundedBox( 0, 0, 0, w, h, Color(15, 15, 15, 255) )
  866. draw.RoundedBox( 0, 2, 2, w-4, h-4, eqframe.Color1 )
  867.  
  868. if s:GetChecked() then
  869. s.Hover = math.Clamp( s.Hover + FrameTime() * 5, 0, 1 )
  870. else
  871. s.Hover = math.Clamp( s.Hover - FrameTime() * 5, 0, 1 )
  872. end
  873.  
  874. draw.RoundedBox( 0, 0, 0, w, h, Color( 15, 15, 15, 100 - 100 * s.Hover ) )
  875. draw.SimpleText("X", "DermaDefaultBold", w/2, h/2-1, Color(15, 15, 15, 255 * s.Hover), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  876.  
  877. end
  878. eqframe.ItemPanel.FavPanel.Check1.OnChange = function( s, val )
  879. eqframe.Settings["Settings"]["Uncat"] = val
  880. if eqframe.ItemPanel.CategoryList.Selected and eqframe.ItemPanel.CategoryList.Selected.Text != "FAVOURITES" then
  881. eqframe.ItemPanel.Items:RebuildItems()
  882. end
  883. end
  884. if eqframe.Settings["Settings"]["Uncat"] then
  885. eqframe.ItemPanel.FavPanel.Check1:SetChecked(true)
  886. end
  887.  
  888. eqframe.ItemPanel.FavPanel.Check2 = vgui.Create( "DCheckBoxLabel", eqframe.ItemPanel.FavPanel )
  889. eqframe.ItemPanel.FavPanel.Check2:SetPos( 10, 32 )
  890. eqframe.ItemPanel.FavPanel.Check2:SetText( "Hide customs?" )
  891. eqframe.ItemPanel.FavPanel.Check2:SizeToContents()
  892. eqframe.ItemPanel.FavPanel.Check2.Button.Hover = 0
  893. eqframe.ItemPanel.FavPanel.Check2.Button.Paint = function( s, w, h )
  894. draw.RoundedBox( 0, 0, 0, w, h, Color(15, 15, 15, 255) )
  895. draw.RoundedBox( 0, 2, 2, w-4, h-4, eqframe.Color1 )
  896.  
  897. if s:GetChecked() then
  898. s.Hover = math.Clamp( s.Hover + FrameTime() * 5, 0, 1 )
  899. else
  900. s.Hover = math.Clamp( s.Hover - FrameTime() * 5, 0, 1 )
  901. end
  902.  
  903. draw.RoundedBox( 0, 0, 0, w, h, Color( 15, 15, 15, 100 - 100 * s.Hover ) )
  904. draw.SimpleText("X", "DermaDefaultBold", w/2, h/2-1, Color(15, 15, 15, 255 * s.Hover), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  905.  
  906. end
  907. eqframe.ItemPanel.FavPanel.Check2.OnChange = function( s, val )
  908. eqframe.Settings["Settings"]["Hidecus"] = val
  909. if eqframe.ItemPanel.CategoryList.Selected and eqframe.ItemPanel.CategoryList.Selected.Text != "FAVOURITES" then
  910. eqframe.ItemPanel.Items:RebuildItems()
  911. end
  912. end
  913. if eqframe.Settings["Settings"]["Hidecus"] then
  914. eqframe.ItemPanel.FavPanel.Check2:SetChecked(true)
  915. end
  916.  
  917. eqframe.ItemPanel.FavPanel.Check3 = vgui.Create( "DCheckBoxLabel", eqframe.ItemPanel.FavPanel )
  918. eqframe.ItemPanel.FavPanel.Check3:SetPos( 10, 54 )
  919. eqframe.ItemPanel.FavPanel.Check3:SetText( "Memory window?" )
  920. eqframe.ItemPanel.FavPanel.Check3:SizeToContents()
  921. eqframe.ItemPanel.FavPanel.Check3.Button.Hover = 0
  922. eqframe.ItemPanel.FavPanel.Check3.Button.Paint = function( s, w, h )
  923. draw.RoundedBox( 0, 0, 0, w, h, Color(15, 15, 15, 255) )
  924. draw.RoundedBox( 0, 2, 2, w-4, h-4, eqframe.Color1 )
  925.  
  926. if s:GetChecked() then
  927. s.Hover = math.Clamp( s.Hover + FrameTime() * 5, 0, 1 )
  928. else
  929. s.Hover = math.Clamp( s.Hover - FrameTime() * 5, 0, 1 )
  930. end
  931.  
  932. draw.RoundedBox( 0, 0, 0, w, h, Color( 15, 15, 15, 100 - 100 * s.Hover ) )
  933. draw.SimpleText("X", "DermaDefaultBold", w/2, h/2-1, Color(15, 15, 15, 255 * s.Hover), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  934.  
  935. end
  936. eqframe.ItemPanel.FavPanel.Check3.OnChange = function( s, val )
  937. eqframe.Settings["Settings"]["Memory"] = val
  938. end
  939. if eqframe.Settings["Settings"]["Memory"] then
  940. eqframe.ItemPanel.FavPanel.Check3:SetChecked(true)
  941. end
  942.  
  943. eqframe.ItemPanel.FavPanel.Button = vgui.Create("DButton", eqframe.ItemPanel.FavPanel)
  944. eqframe.ItemPanel.FavPanel.Button:SetPos( 10, 80 )
  945. eqframe.ItemPanel.FavPanel.Button:SetSize( 108, 30 )
  946. eqframe.ItemPanel.FavPanel.Button.Text = "FAVOURITES"
  947. eqframe.ItemPanel.FavPanel.Button.HoverOn = 0
  948. eqframe.ItemPanel.FavPanel.Button.Hover = 0
  949. eqframe.ItemPanel.FavPanel.Button:SetText("")
  950. eqframe.ItemPanel.FavPanel.Button.Paint = function( s, w, h )
  951. draw.RoundedBox( 0, 0, 0, w, h, Color( 15, 15, 15, 255 ) )
  952. draw.RoundedBox( 0, 2, 2, w-4, h-4, eqframe.Color1 )
  953.  
  954. local col = Color( 15, 15, 15, 255 )
  955.  
  956. if eqframe.ItemPanel.CategoryList.Selected == s then
  957. s.Hover = math.Clamp( s.Hover + FrameTime() * 5, 0, 1 )
  958. col = Color(15 + 205 * s.Hover, 15 + 205 * s.Hover, 15 + 205 * s.Hover, 255)
  959. else
  960. s.Hover = math.Clamp( s.Hover - FrameTime() * 5, 0, 1 )
  961. col = Color(15 + 205 * s.Hover, 15 + 205 * s.Hover, 15 + 205 * s.Hover, 255)
  962. end
  963.  
  964. draw.SimpleText(s.Text, "DermaDefaultBold", w/2, h/2-1, col, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  965. draw.RoundedBox( 0, 0, 0, w, h, Color( 15, 15, 15, 100 - 100 * s.Hover ) )
  966.  
  967. if s:IsHovered() then
  968. s.HoverOn = math.Clamp( s.HoverOn + FrameTime() * 5, 0, 1 )
  969. else
  970. s.HoverOn = math.Clamp( s.HoverOn - FrameTime() * 5, 0, 1 )
  971. end
  972. draw.RoundedBox( 0, 0, 0, w, h, Color( 15, 15, 15, 50 - 50 * s.HoverOn ) )
  973. end
  974. eqframe.ItemPanel.FavPanel.Button.DoClick = function( s )
  975. if eqframe.ItemPanel.CategoryList.Selected != s then
  976. eqframe.ItemPanel.CategoryList.Selected = s
  977. eqframe.ItemPanel.Items:RebuildItems(true)
  978. else
  979. if table.Count(eqframe.ItemPanel.CategoryList.Items) > 0 then
  980. eqframe.ItemPanel.CategoryList.Items[1]:DoClick()
  981. end
  982. eqframe.ItemPanel.Items:RebuildItems()
  983. end
  984. end
  985.  
  986. eqframe.ItemPanel.Search = vgui.Create("DPanel", eqframe.ItemPanel)
  987. eqframe.ItemPanel.Search:SetPos( 0, 0 )
  988. eqframe.ItemPanel.Search:SetSize( 500, 32 )
  989. eqframe.ItemPanel.Search.Paint = function( s, w, h )
  990.  
  991. surface.SetDrawColor( 15, 15, 15, 255 )
  992. surface.DrawOutlinedRect( 0, 0, w, h )
  993. surface.DrawOutlinedRect( 1, 1, w-2, h-2 )
  994.  
  995. draw.RoundedBox( 0, 126, 0, 2, h, Color(15, 15, 15, 255) )
  996. draw.RoundedBox( 0, 466, 0, 2, h, Color(15, 15, 15, 255) )
  997.  
  998.  
  999. draw.SimpleText("SEARCH FOR:", "DermaDefaultBold", 64, h/2-1, col, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  1000.  
  1001. end
  1002.  
  1003. eqframe.ItemPanel.Search.Textbox = vgui.Create("DTextEntry", eqframe.ItemPanel.Search)
  1004. eqframe.ItemPanel.Search.Textbox:SetDrawBackground( false )
  1005. eqframe.ItemPanel.Search.Textbox:SetFont( "DermaDefaultBold" )
  1006. eqframe.ItemPanel.Search.Textbox:SetMultiline(false)
  1007. eqframe.ItemPanel.Search.Textbox:SetTextColor( Color( 220, 220, 220, 255 ) )
  1008. eqframe.ItemPanel.Search.Textbox:SetPos(130,2)
  1009. eqframe.ItemPanel.Search.Textbox:SetSize(336,28)
  1010. eqframe.ItemPanel.Search.Textbox.OnTextChanged = function( s, a, b, c )
  1011. if eqframe.ItemPanel.CategoryList.Selected and eqframe.ItemPanel.CategoryList.Selected.Text != "FAVOURITES" then
  1012. eqframe.ItemPanel.Items:RebuildItems()
  1013. elseif eqframe.ItemPanel.CategoryList.Selected and eqframe.ItemPanel.CategoryList.Selected.Text == "FAVOURITES" then
  1014. eqframe.ItemPanel.Items:RebuildItems(true)
  1015. end
  1016. end
  1017.  
  1018. eqframe.ItemPanel.Search.TextboxB = vgui.Create("DButton", eqframe.ItemPanel.Search)
  1019. eqframe.ItemPanel.Search.TextboxB:SetPos(130,2)
  1020. eqframe.ItemPanel.Search.TextboxB:SetSize(336,28)
  1021. eqframe.ItemPanel.Search.TextboxB:SetText("")
  1022. eqframe.ItemPanel.Search.TextboxB.Paint = function() end
  1023. eqframe.ItemPanel.Search.TextboxB.DoClick = function(s)
  1024. eqframe:SetKeyboardInputEnabled(true)
  1025. eqframe.ItemPanel.Search.Textbox:RequestFocus()
  1026. s:SetVisible(false)
  1027. end
  1028.  
  1029. eqframe.ItemPanel.Search.Button = vgui.Create("DButton", eqframe.ItemPanel.Search)
  1030. eqframe.ItemPanel.Search.Button:SetPos( 468, 2 )
  1031. eqframe.ItemPanel.Search.Button:SetSize( 30, 28 )
  1032. eqframe.ItemPanel.Search.Button.Text = "X"
  1033. eqframe.ItemPanel.Search.Button.Hover = 0
  1034. eqframe.ItemPanel.Search.Button:SetText("")
  1035. eqframe.ItemPanel.Search.Button.Paint = function( s, w, h )
  1036.  
  1037. draw.RoundedBox( 0, 0, 0, w, h, eqframe.Color1 )
  1038.  
  1039. local col = Color( 15, 15, 15, 255 )
  1040.  
  1041. if s:IsHovered() then
  1042. s.Hover = math.Clamp( s.Hover + FrameTime() * 5, 0, 1 )
  1043. col = Color(15 + 205 * s.Hover, 15 + 205 * s.Hover, 15 + 205 * s.Hover, 255)
  1044. else
  1045. s.Hover = math.Clamp( s.Hover - FrameTime() * 5, 0, 1 )
  1046. col = Color(15 + 205 * s.Hover, 15 + 205 * s.Hover, 15 + 205 * s.Hover, 255)
  1047. end
  1048.  
  1049. draw.SimpleText(s.Text, "DermaDefaultBold", w/2, h/2-1, col, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  1050.  
  1051. draw.RoundedBox( 0, 0, 0, w, h, Color( 15, 15, 15, 100 - 100 * s.Hover ) )
  1052.  
  1053. end
  1054. eqframe.ItemPanel.Search.Button.DoClick = function( s )
  1055. eqframe.ItemPanel.Search.Textbox:SetValue("")
  1056. if eqframe.ItemPanel.CategoryList.Selected and eqframe.ItemPanel.CategoryList.Selected.Text != "FAVOURITES" then
  1057. eqframe.ItemPanel.Items:RebuildItems()
  1058. elseif eqframe.ItemPanel.CategoryList.Selected and eqframe.ItemPanel.CategoryList.Selected.Text == "FAVOURITES" then
  1059. eqframe.ItemPanel.Items:RebuildItems(true)
  1060. end
  1061. eqframe.ItemPanel.Search.Textbox:RequestFocus()
  1062. end
  1063.  
  1064. eqframe.ItemPanel.Items.RebuildItems = function( s, fav )
  1065.  
  1066. eqframe.ItemPanel.Items.VBar:SetScroll(0)
  1067. eqframe.ItemPanel.Items.Selected = nil
  1068.  
  1069. eqframe.ItemPanel.InfoPanel.Name:SetText( "" )
  1070. eqframe.ItemPanel.InfoPanel.Name.Hover = 0
  1071. eqframe.ItemPanel.InfoPanel.Name:SizeToContents()
  1072.  
  1073. eqframe.ItemPanel.InfoPanel.Desc:SetText( "" )
  1074. eqframe.ItemPanel.InfoPanel.Desc.Hover = 0
  1075.  
  1076. for k, v in pairs(eqframe.ItemPanel.Items.Items) do
  1077. v:Remove()
  1078. end
  1079.  
  1080. for k, v in pairs(eqframe.Equipment) do
  1081.  
  1082. local filter = eqframe.ItemPanel.Search.Textbox:GetValue()
  1083. local name = (LANG.GetRawTranslation( (v.name) ) or (v.name or ""))
  1084.  
  1085. if filter != nil and filter != "" then
  1086. if string.find(name, filter) == nil then
  1087. continue
  1088. end
  1089. end
  1090.  
  1091. if !fav then
  1092.  
  1093. if eqframe.Settings["Settings"]["Uncat"] then
  1094. if eqframe.Settings["Settings"]["Hidecus"] and v.custom then
  1095. continue
  1096. end
  1097. else
  1098. if eqframe.ItemPanel.CategoryList.Selected and eqframe.ItemPanel.CategoryList.Selected.Category == v.type then
  1099. if eqframe.Settings["Settings"]["Hidecus"] and v.custom then
  1100. continue
  1101. end
  1102. else
  1103. continue
  1104. end
  1105. end
  1106. else
  1107. if table.HasValue(eqframe.Settings["Favourites"], v.id) == false then
  1108. continue
  1109. end
  1110. end
  1111.  
  1112. local item = vgui.Create("DButton")
  1113. item:SetSize( 64, 64 )
  1114. item:SetText("")
  1115. item.Table = v
  1116. item.Hover = 0
  1117. item.Icon = Material(item.Table.material)
  1118. item.Paint = function( s, w, h )
  1119.  
  1120. if s:IsHovered() or eqframe.ItemPanel.Items.Selected == s then
  1121. s.Hover = math.Clamp( s.Hover + FrameTime() * 5, 0, 1 )
  1122. elseif s:IsHovered() == false and eqframe.ItemPanel.Items.Selected != s then
  1123. s.Hover = math.Clamp( s.Hover - FrameTime() * 5, 0, 1 )
  1124. end
  1125.  
  1126. draw.RoundedBox( 0, 0, 0, w, h, Color(20, 20, 20, 225) )
  1127.  
  1128. surface.SetMaterial(s.Icon)
  1129. surface.SetDrawColor(255,255,255,230 + 25 * s.Hover)
  1130. surface.DrawTexturedRect( 0, 0, w, h )
  1131.  
  1132. if eqframe.ItemPanel.Items.Selected == s then
  1133. draw.RoundedBox( 0, 2, 2, w - 4, 2, Color(255, 255, 20, 225) )
  1134. draw.RoundedBox( 0, 2, h-4, w - 4, 2, Color(255, 255, 20, 225) )
  1135. draw.RoundedBox( 0, 2, 4, 2, h-8, Color(255, 255, 20, 225) )
  1136. draw.RoundedBox( 0, w-4, 4, 2, h-8, Color(255, 255, 20, 225) )
  1137. end
  1138.  
  1139. if s.Table.slot then
  1140. draw.RoundedBox( 6, 4, 4, 14, 14, Color(225,25,25,230 + 25 * s.Hover) )
  1141. draw.SimpleText(s.Table.slot, "DermaDefaultBold", 11, 10, Color(15, 50, 50, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  1142. end
  1143.  
  1144. if !fav and table.HasValue(eqframe.Settings["Favourites"], s.Table.id) then
  1145. draw.RoundedBox( 6, 4, h-18, 14, 14, Color(225,185,225,230 + 25 * s.Hover) )
  1146. surface.SetMaterial(eqframe.ItemPanel.Items.Heart)
  1147. surface.SetDrawColor(15, 50, 50, 230 + 25 * s.Hover)
  1148. surface.DrawTexturedRect( 7, h - 15, 8, 8 )
  1149. end
  1150.  
  1151. if s.Table.custom then
  1152. surface.SetMaterial(eqframe.ItemPanel.Items.Custom)
  1153. surface.SetDrawColor(255,255,255,230 + 25 * s.Hover)
  1154. surface.DrawTexturedRect( w - 20, h - 20, 16, 16 )
  1155. end
  1156.  
  1157. surface.SetMaterial(eqframe.ItemPanel.Items.Grad)
  1158. surface.SetDrawColor(0,0,0,255 - 25 * s.Hover)
  1159. surface.DrawTexturedRectRotated( w/2 - (w-16)/2, h/2, w, 16, 90)
  1160. surface.DrawTexturedRectRotated( w/2 + (w-16)/2, h/2, w, 16, 270)
  1161. surface.DrawTexturedRectRotated( w/2, h/2 + (h-16)/2, w, 16, 180)
  1162. surface.DrawTexturedRectRotated( w/2, h/2 - (h-16)/2, w, 16, 0)
  1163.  
  1164. local col1, col2, col3
  1165.  
  1166. local tab = s.Table
  1167.  
  1168. local c = LocalPlayer():GetCredits()
  1169.  
  1170. if c > 0 then
  1171. col1 = true
  1172. end
  1173.  
  1174. if ItemIsWeapon(tab) and (not CanCarryWeapon(tab)) then
  1175. elseif (not ItemIsWeapon(tab)) and LocalPlayer():HasEquipmentItem(tab.id) then
  1176. else
  1177. col2 = true
  1178. end
  1179.  
  1180. if tab.limited and LocalPlayer():HasBought(tostring(tab.id)) then
  1181. else
  1182. col3 = true
  1183. end
  1184.  
  1185. if !col1 or !col2 or !col3 then
  1186. draw.RoundedBox(0, 0, 0, w, h, Color(15,15,15,230))
  1187. end
  1188.  
  1189. end
  1190. item.DoClick = function(s)
  1191. eqframe.ItemPanel.Items.Selected = s
  1192.  
  1193. eqframe.ItemPanel.InfoPanel.Name:SetText( (LANG.GetRawTranslation( (s.Table.name) ) or (s.Table.name or "")) )
  1194. eqframe.ItemPanel.InfoPanel.Name:SetTextColor( Color(220, 220, 220, 0) )
  1195. eqframe.ItemPanel.InfoPanel.Name.Hover = 0
  1196. eqframe.ItemPanel.InfoPanel.Name:SizeToContents()
  1197.  
  1198. eqframe.ItemPanel.InfoPanel.Desc:SetText( (LANG.GetRawTranslation( (s.Table.desc) ) or (s.Table.desc or "")) )
  1199. eqframe.ItemPanel.InfoPanel.Desc:SetTextColor( Color(220, 220, 220, 0) )
  1200. eqframe.ItemPanel.InfoPanel.Desc.Hover = 0
  1201. end
  1202. eqframe.ItemPanel.Items:AddItem( item )
  1203. end
  1204. end
  1205.  
  1206. if table.Count(eqframe.ItemPanel.CategoryList.Items) > 0 then
  1207. eqframe.ItemPanel.CategoryList.Items[1]:DoClick()
  1208. end
  1209.  
  1210. eqframe.ItemPanel.Items:RebuildItems()
  1211. eqframe.ItemPanel:SetVisible(false)
  1212. eqframe.Windows["ITEMS"] = eqframe.ItemPanel
  1213. ---------------------
  1214.  
  1215. -- Item control
  1216. eqframe.Windows["RADAR"] = RADAR.CreateMenu(eqframe, eqframe)
  1217. eqframe.Windows["RADAR"]:SetPos(0, 28)
  1218. eqframe.Windows["RADAR"]:SetSize( 500, 336 )
  1219. eqframe.Windows["RADAR"]:SetVisible(false)
  1220.  
  1221. eqframe.Windows["DISGUISE"] = DISGUISE.CreateMenu(eqframe)
  1222. eqframe.Windows["DISGUISE"]:SetPos(0, 28)
  1223. eqframe.Windows["DISGUISE"]:SetSize( 500, 336 )
  1224. eqframe.Windows["DISGUISE"]:SetVisible(false)
  1225.  
  1226. -- Weapon/item control
  1227. eqframe.Windows["RADIO"] = TRADIO.CreateMenu(eqframe)
  1228. eqframe.Windows["RADIO"]:SetPos(0, 28)
  1229. eqframe.Windows["RADIO"]:SetSize( 500, 336 )
  1230. eqframe.Windows["RADIO"]:SetVisible(false)
  1231.  
  1232. -- Credit transferring
  1233.  
  1234. eqframe.Windows["TRANSFER"] = CreateTransferMenu(eqframe)
  1235. eqframe.Windows["TRANSFER"]:SetPos(0, 28)
  1236. eqframe.Windows["TRANSFER"]:SetSize( 500, 336 )
  1237. eqframe.Windows["TRANSFER"]:SetVisible(false)
  1238.  
  1239.  
  1240. if table.Count(eqframe.Buttons) > 0 then
  1241. eqframe.Buttons[1]:DoClick()
  1242. end
  1243.  
  1244. eqframe:SetKeyboardInputEnabled(false)
  1245.  
  1246. end
  1247. concommand.Add("ttt_cl_traitorpopup", NewCMenu)
  1248.  
  1249. ---------------
  1250.  
  1251. function RADAR.CreateMenu(parent, frame)
  1252. local w, h = parent:GetSize()
  1253.  
  1254. local dform = vgui.Create("DPanel", parent)
  1255. dform:StretchToParent(0,0,0,28)
  1256. dform.Paint = function(s, w, h)
  1257. draw.RoundedBox( 0, 0, 0, w, h, Color( 40, 40, 40, 255 ) )
  1258. end
  1259.  
  1260. local bw, bh = 100, 25
  1261. local dscan = vgui.Create("DButton", dform)
  1262. dscan:SetSize(dform:GetWide(), dform:GetTall()/2)
  1263. dscan:SetText("")
  1264. dscan.Text = string.upper(LANG.GetTranslation("radar_scan"))
  1265. dscan.Hover = 0
  1266. dscan.HoverOn = 0
  1267. dscan.Think = function(s)
  1268. if RADAR.enable or not LocalPlayer():HasEquipmentItem(EQUIP_RADAR) then
  1269. s:SetDisabled(true)
  1270. else
  1271. s:SetDisabled(false)
  1272. end
  1273. end
  1274. dscan.Paint = function(s, w, h)
  1275. draw.RoundedBox( 0, 0, 0, 74, h, Color( 15, 15, 15, 255 ) )
  1276. draw.RoundedBox( 0, 2, 2, 70, h-3, eqframe.Color1 )
  1277.  
  1278. draw.RoundedBox( 0, w-74, 0, 74, h, Color( 15, 15, 15, 255 ) )
  1279. draw.RoundedBox( 0, w-72, 2, 70, h-3, eqframe.Color1 )
  1280.  
  1281. draw.RoundedBox( 0, 74, 0, w-148, h-18, Color( 15, 15, 15, 255 ) )
  1282. draw.RoundedBox( 0, 72, 2, w-144, h-22, eqframe.Color1 )
  1283.  
  1284. local col = Color( 15, 15, 15, 255 )
  1285.  
  1286. if s:GetDisabled() == false then
  1287. s.Hover = math.Clamp( s.Hover + FrameTime() * 5, 0, 1 )
  1288. col = Color(15 + 205 * s.Hover, 15 + 205 * s.Hover, 15 + 205 * s.Hover, 255)
  1289. else
  1290. s.Hover = math.Clamp( s.Hover - FrameTime() * 5, 0, 1 )
  1291. col = Color(15 + 205 * s.Hover, 15 + 205 * s.Hover, 15 + 205 * s.Hover, 255)
  1292. end
  1293.  
  1294. draw.SimpleText(s.Text, "DermaDefaultBold60", w/2, h/2-1, col, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  1295.  
  1296. draw.RoundedBox( 0, 0, 0, w, h-20, Color( 15, 15, 15, 100 - 100 * s.Hover ) )
  1297. draw.RoundedBox( 0, 0, h-20, 72, 20, Color( 15, 15, 15, 100 - 100 * s.Hover ) )
  1298. draw.RoundedBox( 0, w-72, h-20, 72, 20, Color( 15, 15, 15, 100 - 100 * s.Hover ) )
  1299.  
  1300. if s:IsHovered() then
  1301. s.HoverOn = math.Clamp( s.HoverOn + FrameTime() * 5, 0, 1 )
  1302. else
  1303. s.HoverOn = math.Clamp( s.HoverOn - FrameTime() * 5, 0, 1 )
  1304. end
  1305.  
  1306. draw.RoundedBox( 0, 0, 0, w, h-20, Color( 15, 15, 15, 50 - 50 * s.HoverOn ) )
  1307. draw.RoundedBox( 0, 0, h-20, 72, 20, Color( 15, 15, 15, 50 - 50 * s.HoverOn ) )
  1308. draw.RoundedBox( 0, w-72, h-20, 72, 20, Color( 15, 15, 15, 50 - 50 * s.HoverOn ) )
  1309. end
  1310. dscan.DoClick = function(s)
  1311. s:SetDisabled(true)
  1312. RunConsoleCommand("ttt_radar_scan")
  1313. frame:Close()
  1314. end
  1315.  
  1316. local dlabel = vgui.Create("DLabel", dform)
  1317. dlabel:SetPos( dform:GetWide()/2 - 160, dform:GetTall()/2 - 26 )
  1318. dlabel:SetSize( 340, 50 )
  1319. dlabel:SetFont( "DermaDefaultBold" )
  1320. dlabel:SetText( string.upper(LANG.GetParamTranslation("radar_help", {num = RADAR.duration})) )
  1321. dlabel:SetWrap(true)
  1322. dlabel:CenterHorizontal()
  1323.  
  1324. local but = vgui.Create("DButton", dform)
  1325. but.Value = RADAR.repeating
  1326. but:SetPos(0, dform:GetTall()/2)
  1327. but:SetSize(dform:GetWide(), dform:GetTall()/2)
  1328. but:SetText("")
  1329. but.Text = "AUTO-REPEAT:"
  1330. but.Hover = 0
  1331. but.HoverOn = 0
  1332. but.Paint = function(s, w, h)
  1333. draw.RoundedBox( 0, 0, 0, 74, h, Color( 15, 15, 15, 255 ) )
  1334. draw.RoundedBox( 0, 2, 1, 70, h-3, eqframe.Color1 )
  1335.  
  1336. draw.RoundedBox( 0, w-74, 0, 74, h, Color( 15, 15, 15, 255 ) )
  1337. draw.RoundedBox( 0, w-72, 1, 70, h-3, eqframe.Color1 )
  1338.  
  1339. draw.RoundedBox( 0, 74, 18, w-148, h-18, Color( 15, 15, 15, 255 ) )
  1340. draw.RoundedBox( 0, 72, 20, w-144, h-22, eqframe.Color1 )
  1341.  
  1342. local col = Color( 15, 15, 15, 255 )
  1343.  
  1344. if s.Value then
  1345. s.Hover = math.Clamp( s.Hover + FrameTime() * 5, 0, 1 )
  1346. col = Color(15 + 205 * s.Hover, 15 + 205 * s.Hover, 15 + 205 * s.Hover, 255)
  1347. else
  1348. s.Hover = math.Clamp( s.Hover - FrameTime() * 5, 0, 1 )
  1349. col = Color(15 + 205 * s.Hover, 15 + 205 * s.Hover, 15 + 205 * s.Hover, 255)
  1350. end
  1351.  
  1352. draw.SimpleText(s.Text, "DermaDefaultBold60", w/2, h/2-1-30, col, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  1353. draw.SimpleText(s.Value and "ON" or "OFF", "DermaDefaultBold60", w/2, h/2-1+30, col, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  1354.  
  1355. draw.RoundedBox( 0, 0,20, w, h-20, Color( 15, 15, 15, 100 - 100 * s.Hover ) )
  1356. draw.RoundedBox( 0, 0, 0, 72, 20, Color( 15, 15, 15, 100 - 100 * s.Hover ) )
  1357. draw.RoundedBox( 0, w-72, 0, 72, 20, Color( 15, 15, 15, 100 - 100 * s.Hover ) )
  1358.  
  1359. if s:IsHovered() then
  1360. s.HoverOn = math.Clamp( s.HoverOn + FrameTime() * 5, 0, 1 )
  1361. else
  1362. s.HoverOn = math.Clamp( s.HoverOn - FrameTime() * 5, 0, 1 )
  1363. end
  1364.  
  1365. draw.RoundedBox( 0, 0, 20, w, h-20, Color( 15, 15, 15, 50 - 50 * s.HoverOn ) )
  1366. draw.RoundedBox( 0, 0, 0, 72, 20, Color( 15, 15, 15, 50 - 50 * s.HoverOn ) )
  1367. draw.RoundedBox( 0, w-72, 0, 72, 20, Color( 15, 15, 15, 50 - 50 * s.HoverOn ) )
  1368. end
  1369. but.DoClick = function( s )
  1370. RADAR.repeating = !s.Value
  1371. end
  1372. but.Think = function( s )
  1373. s.Value = RADAR.repeating
  1374. end
  1375.  
  1376. /*local dcheck = vgui.Create("DCheckBoxLabel", dform)
  1377. dcheck:SetText(trans("radar_auto"))
  1378. dcheck:SetIndent(5)
  1379. dcheck:SetValue(RADAR.repeating)
  1380. dcheck.OnChange = function(s, val)
  1381. RADAR.repeating = val
  1382. end*/
  1383.  
  1384. dform:SetVisible(true)
  1385.  
  1386. return dform
  1387. end
  1388.  
  1389. ---------------
  1390.  
  1391. function DISGUISE.CreateMenu(parent)
  1392. local dform = vgui.Create("DPanel", parent)
  1393. dform:StretchToParent( 0, 0, 0, 28 )
  1394. dform.Paint = function( s, w, h )
  1395. end
  1396.  
  1397. local but = vgui.Create("DButton", dform)
  1398. but:StretchToParent( 0, 0, 0, 0 )
  1399. but.Value = LocalPlayer():GetNWBool("disguised", false) and 1 or 0
  1400. but.HoverOn = 0
  1401. but.Hover = 0
  1402. but:SetText("")
  1403. but.Paint = function( s, w, h )
  1404. draw.RoundedBox( 0, 0, 0, w, h, Color( 15, 15, 15, 255 ) )
  1405. draw.RoundedBox( 0, 2, 2, w-4, h-4, eqframe.Color1 or Color( 50, 70, 100, 255 ) )
  1406.  
  1407. local col = Color( 15, 15, 15, 255 )
  1408.  
  1409. if s.Value == 1 then
  1410. s.Hover = math.Clamp( s.Hover + FrameTime() * 5, 0, 1 )
  1411. col = Color(15 + 205 * s.Hover, 15 + 205 * s.Hover, 15 + 205 * s.Hover, 255)
  1412. else
  1413. s.Hover = math.Clamp( s.Hover - FrameTime() * 5, 0, 1 )
  1414. col = Color(15 + 205 * s.Hover, 15 + 205 * s.Hover, 15 + 205 * s.Hover, 255)
  1415. end
  1416.  
  1417. draw.SimpleText("DISGUISE:", "DermaDefaultBold100", w/2, h/2-1-50, col, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  1418. draw.SimpleText(s.Value == 1 and "ON" or "OFF", "DermaDefaultBold100", w/2, h/2-1+50, col, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  1419. draw.RoundedBox( 0, 0, 0, w, h, Color( 15, 15, 15, 100 - 100 * s.Hover ) )
  1420.  
  1421. if s:IsHovered() then
  1422. s.HoverOn = math.Clamp( s.HoverOn + FrameTime() * 5, 0, 1 )
  1423. else
  1424. s.HoverOn = math.Clamp( s.HoverOn - FrameTime() * 5, 0, 1 )
  1425. end
  1426. draw.RoundedBox( 0, 0, 0, w, h, Color( 15, 15, 15, 50 - 50 * s.HoverOn ) )
  1427. end
  1428. but.DoClick = function( s )
  1429. RunConsoleCommand("ttt_set_disguise", tostring(s.Value == 1 and 0 or 1))
  1430. end
  1431. but.Think = function( s )
  1432. s.Value = LocalPlayer():GetNWBool("disguised", false) and 1 or 0
  1433. end
  1434.  
  1435. return dform
  1436. end
  1437.  
  1438. ---------------
  1439.  
  1440. TRADIO = {}
  1441.  
  1442. local sound_names = {
  1443. scream ="radio_button_scream",
  1444. explosion="radio_button_expl",
  1445. pistol ="radio_button_pistol",
  1446. m16 ="radio_button_m16",
  1447. deagle ="radio_button_deagle",
  1448. mac10 ="radio_button_mac10",
  1449. shotgun ="radio_button_shotgun",
  1450. rifle ="radio_button_rifle",
  1451. huge ="radio_button_huge",
  1452. beeps ="radio_button_c4",
  1453. burning ="radio_button_burn",
  1454. footsteps="radio_button_steps"
  1455. };
  1456.  
  1457. local smatrix = {
  1458. {"scream", "burning", "explosion"},
  1459. {"footsteps", "pistol", "shotgun"},
  1460. {"mac10", "deagle", "m16"},
  1461. {"rifle", "huge", "beeps"}
  1462. };
  1463.  
  1464. local function PlayRadioSound(snd)
  1465. local r = LocalPlayer().radio
  1466. if IsValid(r) then
  1467. RunConsoleCommand("ttt_radio_play", tostring(r:EntIndex()), snd)
  1468. end
  1469. end
  1470.  
  1471. local function ButtonClickPlay(s) PlayRadioSound(s.snd) end
  1472.  
  1473. local function CreateSoundBoard(parent)
  1474. local b = vgui.Create("DPanel", parent)
  1475.  
  1476. b:SetPaintBackground(false)
  1477.  
  1478. local bh, bw = 60, 120
  1479. local m = 4
  1480. local ver = #smatrix
  1481. local hor = #smatrix[1]
  1482.  
  1483. local x, y = 0, 0
  1484. for ri, row in ipairs(smatrix) do
  1485. local rj = ri - 1 -- easier for computing x,y
  1486. for rk, snd in ipairs(row) do
  1487. local rl = rk - 1
  1488. y = (rj * m) + (rj * bh)
  1489. x = (rl * m) + (rl * bw)
  1490.  
  1491. local but = vgui.Create("DButton", b)
  1492. but:SetPos(x, y)
  1493. but:SetSize(bw, bh)
  1494. but:SetText("")
  1495. but.Text = string.upper(LANG.GetTranslation(sound_names[snd]))
  1496. but.snd = snd
  1497. but.DoClick = ButtonClickPlay
  1498. but.Hover = 0
  1499. but.HoverOn = 0
  1500. but.Paint = function(s, w, h)
  1501. draw.RoundedBox( 0, 0, 0, w, h, Color( 15, 15, 15, 255 ) )
  1502. draw.RoundedBox( 0, 2, 2, w-4, h-4, eqframe.Color1 )
  1503.  
  1504. local col = Color( 15, 15, 15, 255 )
  1505.  
  1506. if s:GetDisabled() == false then
  1507. s.Hover = math.Clamp( s.Hover + FrameTime() * 5, 0, 1 )
  1508. col = Color(15 + 205 * s.Hover, 15 + 205 * s.Hover, 15 + 205 * s.Hover, 255)
  1509. else
  1510. s.Hover = math.Clamp( s.Hover - FrameTime() * 5, 0, 1 )
  1511. col = Color(15 + 205 * s.Hover, 15 + 205 * s.Hover, 15 + 205 * s.Hover, 255)
  1512. end
  1513.  
  1514. draw.SimpleText(s.Text, "DermaDefaultBold", w/2, h/2-1, col, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  1515.  
  1516. draw.RoundedBox( 0, 0, 0, w, h, Color( 15, 15, 15, 100 - 100 * s.Hover ) )
  1517.  
  1518. if s:IsHovered() then
  1519. s.HoverOn = math.Clamp( s.HoverOn + FrameTime() * 5, 0, 1 )
  1520. else
  1521. s.HoverOn = math.Clamp( s.HoverOn - FrameTime() * 5, 0, 1 )
  1522. end
  1523.  
  1524. draw.RoundedBox( 0, 0, 0, w, h, Color( 15, 15, 15, 50 - 50 * s.HoverOn ) )
  1525. end
  1526. end
  1527. end
  1528.  
  1529. b:SetSize(bw * hor + m * (hor - 1), bh * ver + m * (ver - 1))
  1530. b:SetPos(m, 50)
  1531. b:CenterHorizontal()
  1532.  
  1533. return b
  1534. end
  1535.  
  1536. function TRADIO.CreateMenu(parent)
  1537. local w, h = parent:GetSize()
  1538.  
  1539. local wrap = vgui.Create("DPanel", parent)
  1540. wrap:SetSize(w, h)
  1541. wrap.Paint = function( s, w, h )
  1542. draw.RoundedBox( 0, 0, 0, w, h, Color( 15, 15, 15, 255 ) )
  1543. draw.RoundedBox( 0, 2, 2, w-4, h-4, Color( 60, 60, 60, 255 ) )
  1544.  
  1545. draw.RoundedBox( 0, 0, 50, w, 252, Color( 15, 15, 15, 255 ) )
  1546. draw.RoundedBox( 0, 2, 52, w-4, 248, Color( 40, 40, 40, 255 ) )
  1547. end
  1548.  
  1549. local dhelp = vgui.Create("DLabel", wrap)
  1550. dhelp:SetFont("DermaDefaultBold")
  1551. dhelp:SetText(string.upper(LANG.GetTranslation("radio_help")))
  1552. dhelp:SetTextColor(Color(220,220,220,255))
  1553.  
  1554. local board = CreateSoundBoard(wrap)
  1555.  
  1556. dhelp:SizeToContents()
  1557. dhelp:SetPos(10, 20)
  1558. dhelp:CenterHorizontal()
  1559.  
  1560. return wrap
  1561. end
  1562.  
  1563. ---------------
  1564.  
  1565. function CreateTransferMenu(parent)
  1566. local dform = vgui.Create("DPanel", parent)
  1567. dform:StretchToParent(0,0,0,28)
  1568. dform.Paint = function( s, w, h )
  1569. draw.RoundedBox( 0, 0, 0, w, h, Color( 15, 15, 15, 255 ) )
  1570. draw.RoundedBox( 0, 2, 2, w-4, h-4, Color( 60, 60, 60, 255 ) )
  1571.  
  1572. draw.RoundedBox( 0, 0, 50, w, 252, Color( 15, 15, 15, 255 ) )
  1573. draw.RoundedBox( 0, 2, 52, w-4, 248, Color( 40, 40, 40, 255 ) )
  1574. end
  1575.  
  1576. local dhelp = vgui.Create("DLabel", dform)
  1577. dhelp:SetFont("DermaDefaultBold")
  1578. dhelp:SetText(string.upper(LANG.GetParamTranslation("xfer_help", {role = LocalPlayer():GetRoleString()})))
  1579. dhelp:SetTextColor(Color(220,220,220,255))
  1580. dhelp:SizeToContents()
  1581. dhelp:SetPos(10, 20)
  1582. dhelp:CenterHorizontal()
  1583.  
  1584. local pl = vgui.Create("DPanelList", dform)
  1585. pl:SetPos( (dform:GetWide()-368)/2, 50 )
  1586. pl:SetSize( 368, 252 )
  1587. pl.Paint = function( s, w, h )
  1588. end
  1589.  
  1590. local plist = vgui.Create("DPanelList", pl)
  1591. plist:SetPos( 0, 0 )
  1592. plist:SetSize( 368, 252 )
  1593. plist:EnableVerticalScrollbar( true )
  1594. plist:SetPadding( 4 )
  1595. plist:SetSpacing( 4 )
  1596. plist.Paint = function( s, w, h )
  1597. end
  1598. plist.PerformLayout = function(s)
  1599.  
  1600. local Wide = s:GetWide()
  1601. local YPos = 0
  1602.  
  1603. if ( !s.Rebuild ) then
  1604. debug.Trace()
  1605. end
  1606.  
  1607. s:Rebuild()
  1608.  
  1609. if ( s.VBar && !m_bSizeToContents ) then
  1610. s.VBar:SetPos( s:GetWide() - 28, 4 )
  1611. s.VBar:SetSize( 22, s:GetTall() - 8 )
  1612. s.VBar:SetUp( s:GetTall(), s.pnlCanvas:GetTall() )
  1613. YPos = s.VBar:GetOffset()
  1614. if s.VBar:IsVisible() then Wide = Wide - 28 end
  1615. end
  1616.  
  1617. s.pnlCanvas:SetPos( 0, YPos )
  1618. s.pnlCanvas:SetWide( Wide )
  1619.  
  1620. s:Rebuild()
  1621.  
  1622. if ( s:GetAutoSize() ) then
  1623. s:SetTall( s.pnlCanvas:GetTall() )
  1624. s.pnlCanvas:SetPos( 0, 0 )
  1625. end
  1626.  
  1627. end
  1628. plist.VBar.Paint = function( s, w, h )
  1629. draw.RoundedBox( 0, 0, 0, w, h, Color(15, 15, 15, 255) )
  1630. draw.RoundedBox( 0, 8, 0, w-16, h, Color(50, 50, 50, 255) )
  1631. end
  1632. plist.VBar.btnDown.Hover = 0
  1633. plist.VBar.btnDown.Paint = function( s, w, h )
  1634.  
  1635. if s:IsHovered() or eqframe.ItemPanel.Items.Selected == s then
  1636. s.Hover = math.Clamp( s.Hover + FrameTime() * 5, 0, 1 )
  1637. elseif s:IsHovered() == false and eqframe.ItemPanel.Items.Selected != s then
  1638. s.Hover = math.Clamp( s.Hover - FrameTime() * 5, 0, 1 )
  1639. end
  1640.  
  1641. draw.RoundedBox( 0, 0, 0, w, h, Color(15, 15, 15, 255) )
  1642. draw.RoundedBox( 0, 2, 0, w-4, h-2, Color(50 + 25 * s.Hover, 50 + 25 * s.Hover, 50 + 25 * s.Hover, 255) )
  1643.  
  1644. local arrow = {{ },{ },{ }}
  1645.  
  1646. arrow[1]["x"] = 4
  1647. arrow[1]["y"] = 8
  1648.  
  1649. arrow[2]["x"] = w - 4
  1650. arrow[2]["y"] = 8
  1651.  
  1652. arrow[3]["x"] = w/2
  1653. arrow[3]["y"] = 18
  1654.  
  1655. local x, y = s:GetPos()
  1656. surface.SetMaterial( eqframe.ItemPanel.Items.White )
  1657. surface.SetDrawColor( 150 + s.Hover * 70, 150 + s.Hover * 70, 150 + s.Hover * 70, 255 )
  1658. surface.DrawPoly( arrow )
  1659. end
  1660. plist.VBar.btnUp.Hover = 0
  1661. plist.VBar.btnUp.Paint = function( s, w, h )
  1662.  
  1663. if s:IsHovered() or eqframe.ItemPanel.Items.Selected == s then
  1664. s.Hover = math.Clamp( s.Hover + FrameTime() * 5, 0, 1 )
  1665. elseif s:IsHovered() == false and eqframe.ItemPanel.Items.Selected != s then
  1666. s.Hover = math.Clamp( s.Hover - FrameTime() * 5, 0, 1 )
  1667. end
  1668.  
  1669. draw.RoundedBox( 0, 0, 0, w, h, Color(15, 15, 15, 255) )
  1670. draw.RoundedBox( 0, 2, 2, w-4, h-2, Color(50 + 25 * s.Hover, 50 + 25 * s.Hover, 50 + 25 * s.Hover, 255) )
  1671.  
  1672. local arrow = {{ },{ },{ }}
  1673.  
  1674. arrow[1]["x"] = 4
  1675. arrow[1]["y"] = 16
  1676.  
  1677. arrow[2]["x"] = w/2
  1678. arrow[2]["y"] = 6
  1679.  
  1680. arrow[3]["x"] = w - 4
  1681. arrow[3]["y"] = 16
  1682.  
  1683. local x, y = s:GetPos()
  1684. surface.SetMaterial( eqframe.ItemPanel.Items.White )
  1685. surface.SetDrawColor( 150 + s.Hover * 70, 150 + s.Hover * 70, 150 + s.Hover * 70, 255 )
  1686. surface.DrawPoly( arrow )
  1687. end
  1688. plist.VBar.btnGrip.Hover = 0
  1689. plist.VBar.btnGrip.Paint = function( s, w, h )
  1690.  
  1691. if s:IsHovered() or eqframe.ItemPanel.Items.Selected == s then
  1692. s.Hover = math.Clamp( s.Hover + FrameTime() * 5, 0, 1 )
  1693. elseif s:IsHovered() == false and eqframe.ItemPanel.Items.Selected != s then
  1694. s.Hover = math.Clamp( s.Hover - FrameTime() * 5, 0, 1 )
  1695. end
  1696.  
  1697. draw.RoundedBox( 0, 0, 0, w, h, Color(0, 0, 0, 255) )
  1698. draw.RoundedBox( 0, 2, 0, w-4, h, Color(50 + 25 * s.Hover, 50 + 25 * s.Hover, 50 + 25 * s.Hover, 255) )
  1699. end
  1700.  
  1701. local r = LocalPlayer():GetRole()
  1702. for _, p in pairs(player.GetAll()) do
  1703. if IsValid(p) and p:IsActiveRole(r) and p != LocalPlayer() then
  1704. local plypl = vgui.Create("DPanel")
  1705. plypl:SetSize( 100, 30 )
  1706. plypl.ply = p
  1707. plypl.Name = p:GetName()
  1708. plypl.UID = p:UniqueID()
  1709. plypl.Paint = function( s, w, h )
  1710. if !IsValid(s.ply) or !s.ply:IsActiveRole(r) or s.ply == LocalPlayer() then return end
  1711.  
  1712. draw.RoundedBox( 0, 0, 0, w, h, Color( 15, 15, 15, 255 ) )
  1713. draw.RoundedBox( 0, 2, 2, w-4, h-4, Color( 60, 60, 60, 255 ) )
  1714.  
  1715. draw.SimpleText(s.Name, "DermaDefaultBold", 10, h/2-1, Color(220,220,220,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  1716. //draw.SimpleText("HAS "..s.ply:GetCredits().. " CREDITS", "DermaDefaultBold", 250, h/2-1, Color(220,220,220,255), TEXT_ALIGN_RIGHT, TEXT_ALIGN_CENTER)
  1717. end
  1718. plypl.Think = function(s)
  1719. local r = LocalPlayer():GetRole()
  1720. if !IsValid(s.ply) or !s.ply:IsActiveRole(r) or s.ply == LocalPlayer() then
  1721. s:Remove()
  1722. end
  1723. end
  1724.  
  1725. local giveb = vgui.Create("DButton", plypl)
  1726. giveb:SetSize(100, 30)
  1727. giveb:SetPos(260, 0)
  1728. giveb:SetText("")
  1729. giveb.Text = "GIVE 1 CREDIT"
  1730. giveb.Hover = 0
  1731. giveb.HoverOn = 0
  1732. giveb.Think = function( s )
  1733. if LocalPlayer():GetCredits() > 0 then
  1734. s:SetDisabled(false)
  1735. else
  1736. s:SetDisabled(true)
  1737. end
  1738. end
  1739. giveb.DoClick = function( s )
  1740. RunConsoleCommand("ttt_transfer_credits", tostring(plypl.UID) or "-1", "1")
  1741. end
  1742. giveb.Paint = function(s, w, h)
  1743. draw.RoundedBox( 0, 0, 0, w, h, Color( 15, 15, 15, 255 ) )
  1744. draw.RoundedBox( 0, 2, 2, w-4, h-4, eqframe.Color1 )
  1745.  
  1746. local col = Color( 15, 15, 15, 255 )
  1747.  
  1748. if s:GetDisabled() == false then
  1749. s.Hover = math.Clamp( s.Hover + FrameTime() * 5, 0, 1 )
  1750. col = Color(15 + 205 * s.Hover, 15 + 205 * s.Hover, 15 + 205 * s.Hover, 255)
  1751. else
  1752. s.Hover = math.Clamp( s.Hover - FrameTime() * 5, 0, 1 )
  1753. col = Color(15 + 205 * s.Hover, 15 + 205 * s.Hover, 15 + 205 * s.Hover, 255)
  1754. end
  1755.  
  1756. draw.SimpleText(s.Text, "DermaDefaultBold", w/2, h/2-1, col, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  1757.  
  1758. draw.RoundedBox( 0, 0, 0, w, h, Color( 15, 15, 15, 100 - 100 * s.Hover ) )
  1759.  
  1760. if s:IsHovered() then
  1761. s.HoverOn = math.Clamp( s.HoverOn + FrameTime() * 5, 0, 1 )
  1762. else
  1763. s.HoverOn = math.Clamp( s.HoverOn - FrameTime() * 5, 0, 1 )
  1764. end
  1765.  
  1766. draw.RoundedBox( 0, 0, 0, w, h, Color( 15, 15, 15, 50 - 50 * s.HoverOn ) )
  1767. end
  1768.  
  1769. plist:AddItem(plypl)
  1770. end
  1771. end
  1772.  
  1773. hook.Add("TTTEndRound", "CloseFancyPants", function()
  1774. if IsValid(eqframe) then
  1775. eqframe:Remove()
  1776. end
  1777. end)
  1778.  
  1779. return dform
  1780. end
  1781. --end)
  1782. end
Advertisement
Add Comment
Please, Sign In to add comment