Added item system & item rarity

master
AlmTech Software 5 years ago
parent ab0598a4a9
commit da067dedfe
  1. 4
      gamemode/engine/derma/lib/cl_menu_theme.lua
  2. 7
      gamemode/engine/derma/menus/menu_charinfo.lua
  3. 10
      gamemode/engine/lib/sh_items.lua
  4. 6
      gamemode/settings/sh_items.lua
  5. 8
      gamemode/settings/sh_settings.lua

@ -135,9 +135,9 @@ function theme.pagetext( p )
surface.DrawRect( 0, 0, w, h ) surface.DrawRect( 0, 0, w, h )
end end
function theme.itempanel( p ) function theme.itempanel( p, rarecolor )
local w, h = p:GetSize() local w, h = p:GetSize()
surface.SetDrawColor( 0, 0, 0, 120 ) surface.SetDrawColor( rarecolor || Color( 0, 0, 0, 120 ) )
surface.DrawRect( 0, 0, w, h ) surface.DrawRect( 0, 0, w, h )
if( p:IsHovered() ) then if( p:IsHovered() ) then

@ -105,10 +105,7 @@ function menu.open( dt )
local itemframe = vgui.Create( "DPanel", inv ) -- container for all of the item panels local itemframe = vgui.Create( "DPanel", inv ) -- container for all of the item panels
itemframe:SetSize( inv:GetSize() ) itemframe:SetSize( inv:GetSize() )
itemframe:SetPos( 0, 0 ) itemframe:SetPos( 0, 0 )
itemframe.Paint = function( self, w, h ) itemframe.Paint = function( self, w, h ) end
surface.SetDrawColor( 0, 0, 0, 0 )
surface.DrawRect( 0, 0, w, h )
end
for ii=1, maxW * maxH, 1 do -- create all of the item panels for ii=1, maxW * maxH, 1 do -- create all of the item panels
if( ii != 1 ) then count = count + 1 end if( ii != 1 ) then count = count + 1 end
@ -131,7 +128,7 @@ function menu.open( dt )
itempanels[ii].x, itempanels[ii].y = itempanels[ii]:GetPos() itempanels[ii].x, itempanels[ii].y = itempanels[ii]:GetPos()
itempanels[ii].Paint = function( self ) itempanels[ii].Paint = function( self )
theme.itempanel( self ) theme.itempanel( self, Quantum.Rarity.Rare.color )
end end
end end

@ -10,12 +10,12 @@ Quantum.Items = {}
function Quantum.Item.Create( id, args ) function Quantum.Item.Create( id, args )
local item = { local item = {
name = args.name, -- items name name = args.name || "ERROR", -- items name
desc = args.desc, -- items description desc = args.desc || "ERROR: Some idiot forgot to give this item a description.", -- items description
icon = args.icon, -- items icon icon = args.icon, -- items icon
stack = args.stack, -- items max stack size stack = args.stack || false, -- items max stack size
soulbound = args.soulbound, -- if item could be dropped/traded to other players soulbound = args.soulbound || true, -- if item could be dropped/traded to other players
rarity = args.rarity, -- rarity of the item rarity = args.rarity || Quantum.Rarity.Trash, -- rarity of the item
usefunction = args.usefunction, -- use function usefunction = args.usefunction, -- use function
consumefunction = args.consumefunction, --consume function consumefunction = args.consumefunction, --consume function
equipfunction = args.equipfunction -- equip function equipfunction = args.equipfunction -- equip function

@ -0,0 +1,6 @@
-- __ _ _______ _ __
-- / / /\ | | |__ __| | | \ \
-- / / / \ | |_ __ ___ | | ___ ___| |__ \ \
-- < < / /\ \ | | '_ ` _ \| |/ _ \/ __| '_ \ > >
-- \ \ / ____ \| | | | | | | | __/ (__| | | | / /
-- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/

@ -22,6 +22,14 @@ Quantum.Money = {
Surfix = "" Surfix = ""
} }
Quantum.Rarity = {
Trash = { txt = "Trash", color = Color( 100, 100, 100, 100 ) },
Common = { txt = "Common", color = Color( 250, 250, 250, 100 ) },
Rare = { txt = "Rare", color = Color( 48, 163, 230, 100 ) },
Epic = { txt = "Epic", color = Color( 220, 90, 90, 100 ) },
Legendary = { txt = "Legendary", color = Color( 235, 125, 52, 100 ) }
}
Quantum.Models = { Quantum.Models = {
NPC = {}, NPC = {},
Player = { Player = {

Loading…
Cancel
Save