view ObjectiveTracker/Schema.lua @ 42:c73051785f19

Added tag r42-release for changeset 7a65ed86e4dd
author Nenue
date Mon, 25 Apr 2016 03:32:34 -0400
parents 92534dc793f2
children 756e8aeb040b
line wrap: on
line source
--- ${PACKAGE_NAME}
-- @file-author@
-- @project-revision@ @project-hash@
-- @file-revision@ @file-hash@
-- Created: 4/15/2016 11:36 PM

local B = select(2,...).frame
local T = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
local setmetatable, type, rawset = setmetatable, type, rawset
local print = B.print('Schema')
local lprint = B.print('Layout')
local oprint = B.print('Objectives')
T.defaults.Schema = setmetatable({}, {
  __newindex = function(schemas,layerName, layerTable)
    -- tracker/block/line
    if type(layerTable) == 'table' then

      print('adding layer', layerName)
      for k,v in pairs(layerTable) do
        print('  incorporated schema', k)
        if type(v) == 'table' and k ~= 'default' then
          setmetatable(v, {
            __index = function(schemaTable, key)
              print('  substituting default "'..tostring(schemas[layerName].default[key])..'" for |cFF00FFFF', layerName..'|r.|cFF0088FF'..k..'|r.'..key)
              return schemas[layerName].default[key]
            end
          })
        end
      end
      rawset(schemas, layerName, setmetatable(layerTable, {
        __newindex = function(layerTable, schemaName, schemaTable)
          -- schema table
          if type(schemaTable) == 'table' then
            print('adding schema', schemaName, 'to', layerName, 'layers')


            rawset(layerTable, schemaName, setmetatable(schemaTable, {
              __index = function(schemaTable, key)
                print('  substituting default "'..tostring(schemas[layerName].default[key])..'" for |cFF00FFFF', layerName..'|r.|cFF0088FF'..schemaName..'|r.'..key)
                rawset(schemaTable, key, schemas[layerName].default[key])
                return schemas[layerName].default[key]
              end
            }))
          end
        end,
      }))
    end
  end
})

T.defaults.Schema.tracker = {
  default = {
    headerbg = {'VERTICAL', 1, 1, 0.5, 0.5, 1, 1, 0.5, 0},
    headerFont = {[[Interface\Addons\SharedMedia_MyMedia\font\XOIREQE.TTF]], 13, 'OUTLINE'},
    headerHeight = 16,
    headerSpacing = 0,
    headerColor = {1,1,1,1},
    blockSpacing = 1,
  }
}
T.defaults.Schema.block = {
  default = {
    titleColor = {1, 1, 1, 1},
    titlebg = {'HORIZONTAL', 1, 0, .7, 0,    1, 0, .7, .125},
    textbg = {'HORIZONTAL', 0, 0, 0, 0,      0, 0, 0, 0.4 },
    selectionbg = {'HORIZONTAL', 1, 1, 1, 0, 1, 1, 1, 0.225},
    titleFont = {[[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 16, 'OUTLINE'},
    textFont = {[[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Regular.ttf]], 16, 'OUTLINE'},
    titleIndent = 4,
    titleSpacing = 3,
    selectionIndent = 5,
    textIndent = 3,
    textSpacing = 3,
    rewardSize = 24,
  },
  achievement = {
    titleColor = {0, 0.7, 1, 1},
  },
  achievement_account = {
    titleColor = {.35, 0.7, 1, 1},
  },
  daily = {
    titleColor = {0, 0.7, 1, 1},
    titlebg = {'HORIZONTAL', 0, .7, 1, 0,  0, 1, .7, .125},
    textbg = {'HORIZONTAL', 0, .7, 1, 0,    0, 1, .7, .1},
  },
  weekly = {
    titleColor = {.25, 0.7, 1, 1},
    titlebg = {'HORIZONTAL', 0, .35, .7, 0,   0, .35, .7, .125},
    textbg = {'HORIZONTAL', 0, .35, .7, .0,     0, .35, .7, .075 },
  },
  account = {
    titlebg = {'HORIZONTAL', .1, .1, .1, 0, .1, .1, .1, .125},
    textbg = {'HORIZONTAL', .1, .1, .1, 0, .1, .1, .1, .085 },
  },
  -- alliance
  faction_1 = {
    titlebg = {'HORIZONTAL', .2, .4, 1, 0.4, .2, .4, 1, .085 },
    textbg = {'HORIZONTAL', .2, .4, 1, 0.4, .2, .4, 1, .085 },
  },
  -- horde
  faction_2 = {
    titlebg = {'HORIZONTAL', .6, 0, 0.4, 0.4,  .6, 0, 0.4, .085 },
    textbg = {'HORIZONTAL', .6, 0, 0.4, 0.4,   .6, 0, 0.4, .085 },
  }
}
T.defaults.Schema.line = {
  default  = {
    textColor = {1, 1, 1},
    textSpacing = 3,
    textIndent = 3,
  },
  completed = {
    textColor = {.5, 1, .5}
  },
  failed = {
    textColor = {1,.25,.25 }
  },
  autocomplete = {
    textColor = {.5,1,1 }
  },
  object = {
    textColor = {0,1,1}
  },
  monster = {
    textColor = {1,1,0}
  },
  item = {
    textColor = {1,.75,.75}
  },
  achievement_complete = {
    textColor = {1, 1, 1, 1},
  },
  achievement = {
    textColor = {0.5, 0.85, 1, 1},
  },
  achievement_account = {
    textColor = {.4, 0.7, 1, 1},
  },
}
T.defaults.Schema.widget = {
  progressbar = {

  },
  timer = {

  }
}

T.defaults.Schema.statusbar = {
  default = {
    textFont = {[[Interface\Addons\SharedMedia_MyMedia\font\XOIREQE.TTF]], 11, 'OUTLINE'},
    textColor = {1,1,1,1},
  }
}