XoXFaby

Untitled

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