if not SERVER then return end
-- Meta Tables
ply = FindMetaTable("Player")

--////////////////////////
-- This adds the specific Metal Bar Type and amount too our Sold metal bar table
function ply:zrms_AddMetalBarsSold(mType, mAmount)
    self.zrms_SoldBars = self.zrms_SoldBars or {}
    self.zrms_SoldBars["Iron"] = self.zrms_SoldBars["Iron"] or 0
    self.zrms_SoldBars["Bronze"] = self.zrms_SoldBars["Bronze"] or 0
    self.zrms_SoldBars["Silver"] = self.zrms_SoldBars["Silver"] or 0
    self.zrms_SoldBars["Gold"] = self.zrms_SoldBars["Gold"] or 0
    self.zrms_SoldBars[mType] = self.zrms_SoldBars[mType] + mAmount
end

-- This gives us a table of all the metal bars the player has sold
function ply:zrms_GetMetalBarsSold()
    self.zrms_SoldBars = self.zrms_SoldBars or {}
    self.zrms_SoldBars["Iron"] = self.zrms_SoldBars["Iron"] or 0
    self.zrms_SoldBars["Bronze"] = self.zrms_SoldBars["Bronze"] or 0
    self.zrms_SoldBars["Silver"] = self.zrms_SoldBars["Silver"] or 0
    self.zrms_SoldBars["Gold"] = self.zrms_SoldBars["Gold"] or 0

    return self.zrms_SoldBars
end

concommand.Add("zrms_debug_GetSoldBars", function(aply, cmd, args)
    PrintTable(aply:zrms_GetMetalBarsSold())
end)

--////////////////////////
-- This gives us a table of all the stored MetalBars the player has
function ply:zrms_GetMetalBars()
    self.zrms_Bars = self.zrms_Bars or {}
    self.zrms_Bars["Iron"] = self.zrms_Bars["Iron"] or 0
    self.zrms_Bars["Bronze"] = self.zrms_Bars["Bronze"] or 0
    self.zrms_Bars["Silver"] = self.zrms_Bars["Silver"] or 0
    self.zrms_Bars["Gold"] = self.zrms_Bars["Gold"] or 0

    return self.zrms_Bars
end

-- This Resets the Players MetalBars
function ply:zrms_ResetMetalBars()
    self.zrms_Bars = self.zrms_Bars or {}
    self.zrms_Bars["Iron"] = 0
    self.zrms_Bars["Bronze"] = 0
    self.zrms_Bars["Silver"] = 0
    self.zrms_Bars["Gold"] = 0
end

-- This Adds the specific metal bar too the player
function ply:zrms_AddMetalBar(mType, mAmount)
    self.zrms_Bars = self.zrms_Bars or {}
    self.zrms_Bars[mType] = (self.zrms_Bars[mType] or 0) + mAmount
end
