\ExplSyntaxOn

\bool_if:NT \l__rpg_layout_bool
{
  \RequirePackage{titletoc}

  % Makes the TOC go to section depth
  \setcounter{tocdepth}{2}

  \titlecontents{part}
    [0pt] % left
    { \addvspace{.06in} \RpgFontTocPart } % above-code
    {\partname\ \thecontentslabel :~ } % numbered-entry-format
    {} % numberless-entry-format
    {} % filler-page-format
    [ \addvspace{-.03in} \titleline{ \color{titlegold} \titlerule[1pt] } \addvspace{.05in } ] % below-code

  \titlecontents{chapter}
    [0pt] % left
    { \addvspace{.1in} \RpgFontTocChapter } % above-code
    { \tocchapapp\ \thecontentslabel :~ } % numbered-entry-format
    {} % numberless-entry-format
    {\titlerule*{.}\contentspage} % filler-page-format

  \titlecontents{section}
    [0pt] % left
    {\RpgFontTocSection} % above-code
    {\thecontentslabel :~ } % numbered-entry-format
    {} % numberless-entry-format
    {\titlerule*{.}\contentspage} % filler-page-format

  \newcommand\tocchapapp{\tocchapterabbreviationname}
  \g@addto@macro\appendix{%
    \addtocontents{toc}{\protect\renewcommand{\protect\@chapapp}{\appendixname}}%
    \addtocontents{toc}{\protect\renewcommand{\protect\tocchapapp}{\appendixname}}%
  }
}
