This popular sitcom is still one of our all-time favorites. While we know you have your favorite character from How I Met Your Motheryou probably also know what Hogwarts House they fit in, or even their MBTI.

However, we thought we'd appeal to your real inner nerd, and let you know what they might play as if they were to live inside a game of D&D. In case you're wondering what characters you share your own moral class with, you no longer have to. Here are the D&D moral alignments of the main cast.

RELATED: MBTI Of How I Met Your Mother Characters

Patrice - Lawful Good

Patrice is almost too nice for her own good. She always acts out of compassion and duty, and unfortunately for Robin, Patrice finds their friendship on the top of the list for both of these things.

She's incredibly righteous, and she will never take action if it means going against her moral code. She will always do what's best for others, but only if it's good and lawful. She's a pretty good friend, to say the very least.

Marshall Erikson - Neutral Good

Marshall is really on the line between Neutral Good and Lawful Neutral. However, we placed him here because he does often act based on his heart. Marshall adheres to the law for the most part, but he is also willing to bend the rules when he feels it is the best for everyone involved.

Marshall has a heart of gold, and is unarguably the sweetest character on the series. He always has the best intentions, and that's why we feel he has to be on the "good" alignment.

RELATED: How I Met Your Mother: Every Main Character, Ranked By Funniness

James - Chaotic Neutral

James also walks the line between Chaotic Neutral and Lawful Neutral. While this seems counter-intuitive, there's a lot of layers to this character. James has a good heart, and he cares strongly about those close to him.

However, he does cheat on his husband, which demonstrates that his freedom and goals are ultimately more important than his moral compass. While this makes him a Chaotic Neutral, we would also like to mention that his man is pretty kind, and definitely adheres to his own moral code.

Robin Scherbatsky - Lawful Neutral

Robin was another character that was difficult to place, but we feel confident sorting her here. Robin has honor, is trustworthy, and usually adheres to rules and guidelines. Robin also has a good heart, but she's also likely to follow her own code, and this is often somewhere in between good and evil.

She cares about others, but she often only acts altruistic for her close relationships. Robin is almost a true neutral, but we think she leans slightly towards the order of society.

Tracy McConnell - Lawful Good

Tracy is also one of the sweetest and most selfless characters on the series. She always acts with compassion, but she's also always the voice of reason in the madness of the other characters.

She will always do the right thing, and she knows that the right thing is always for the most good for the most people. She's pretty utilitarian, essentially, and has a heart of gold. That definitely fits her pretty well into this moral alignment.

Lily Aldrin - Neutral Evil

You might think that Lily is all sweet and innocent, but it turns out she fits into this class pretty well. This type of character is selfish, meaning that they often exploit situations for their own personal gain.

They are willing to step on toes to gain a direct benefit for themselves, but there is always a reason behind their actions. Essentially, she doesn't harm on purpose, but she's willing to do bad things to gain footing. For instance, sabotaging Ted's relationships that she doesn't like, or leaving Marshall for her artist dream. Pretty selfish, Lily, but her intentions were at least in the right.

Victoria - Lawful Neutral

Victoria believes pretty strongly in her own rules and traditions, and her personal code is stronger than any formal one. However, she is lawful, and she doesn't have any inclination for evil or law-breaking.

She adheres to her best interests but tries her hardest not to hurt anyone else or break any moral or formal laws. We know this doesn't always work out, but we know that Victoria does have good intentions, and puts her heart above all else.

RELATED: How I Met Your Mother: 5 Best Friendships (& 5 Worst)

Barney Stinson - Chaotic Neutral

It's pretty obvious that Barney doesn't always adhere to the natural ways of society. In fact, he's more than willing to bend rules - both formal and moral. He always follows his own heart, and that heart is usually set on freedom. He doesn't care for tradition, and the whole notion of "good" and "evil" usually comes last in Barney's books.

We know he has a good heart, but it usually shows itself in very chaotic forms.

Zoey - Chaotic Good

Zoey definitely has an inclination towards standing up to the bureaucracy. We know that she's pretty comfortable with bending rules and fighting back against lawful systems. However, she usually has the right intentions, and this makes her moral alignment sway to "good".

She has her eye on freedom and liberty, and while she has moral intentions, her methods are often pretty questionable. You'll remember when she blackmails Ted, and this is a pretty good example of her "chaotic" alignment.

Ted Mosby - Neutral Good

Ted is an interesting character, and it's probably not surprising that he's pretty neutral with the law. Ted cooperates with law and authority, but he's also more than willing to break the rules if he thinks it's for the best.

For instance, stealing a blue horn? He doesn't suffer the same internal conflict as a lawful good character would, but rather excuses his behavior as being for the best. His heart is always in the right place, but he's willing to do just about anything in order to follow it.

NEXT: D&D Alignments Of Friends Characters