• jhawley
  • 53.6% (Neutral)
  • YAF Forumling Topic Starter
14 years ago
I'm a warcraft player, and my forum is specifically for that. I wanted a way to make the default class colors easy to tag in a post, so i added some bbcodes for them. These work ok, by what i really wanted to do is have some bbcode that does not have [] around it so it would just replace the words automatically with the colored html. the problem is, it throws a typeinitializer exception every time i try to make a bbcode without []. My guess is that there is a good reason for that, however i dont know what it is.

Is there any way to get it to work without the []? Here is the code that i have sofar. It works, but has the [] in it.

~line 70 just before r_bullet

        static private Regex r_Druid = new Regex(@"\[druid]", m_options);
        static private Regex r_Hunter = new Regex(@"\[hunter]", m_options);
        static private Regex r_Mage = new Regex(@"\[mage]", m_options);
        static private Regex r_Paladin = new Regex(@"\[paladin]", m_options);
        static private Regex r_Priest = new Regex(@"\[priest]", m_options);
        static private Regex r_Rogue = new Regex(@"\[rogue]", m_options);
        static private Regex r_Shaman = new Regex(@"\[shaman]", m_options);
        static private Regex r_Warlock = new Regex(@"\[warlock]", m_options);
        static private Regex r_Warrior = new Regex(@"\[warrior]", m_options);

~line 170 just before "// bullet":

                // class colors
                bbcode = r_Druid.Replace(bbcode, "<span style=\"color:#FF7D0A\">Druid</span>");
                bbcode = r_Hunter.Replace(bbcode, "<span style=\"color:#ABD473\">Hunter</span>");
                bbcode = r_Mage.Replace(bbcode, "<span style=\"color:#69CCF0\">Mage</span>");
                bbcode = r_Paladin.Replace(bbcode, "<span style=\"color:#F58CBA\">Paladin</span>");
                bbcode = r_Priest.Replace(bbcode, "<span style=\"color:#FFFFFF\">Priest</span>");
                bbcode = r_Rogue.Replace(bbcode, "<span style=\"color:#FFF569\">Rogue</span>");
                bbcode = r_Shaman.Replace(bbcode, "<span style=\"color:#2459FF\">Shaman</span>");
                bbcode = r_Warlock.Replace(bbcode, "<span style=\"color:#9482CA\">Warlock</span>");
                bbcode = r_Warrior.Replace(bbcode, "<span style=\"color:#C79C6E\">Warrior</span>");

  • jhawley
  • 53.6% (Neutral)
  • YAF Forumling Topic Starter
14 years ago
Oh and incase anyone is wondering i got the exact colors from WowWiki.com/Class_colors 
YAF Logo Copyright © YetAnotherForum.NET & Ingo Herbote. All rights reserved
About Us

The YAF.NET is an open source .NET forum project. YAF.NET is supported by an team of international developers who are build community by building community software.

Powered by Resharper Donate with PayPal button