AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
Common.cpp File Reference
#include "Common.h"

Go to the source code of this file.

Functions

bool IsLocaleValid (std::string const &locale)
 
LocaleConstant GetLocaleByName (std::string const &name)
 
const std::string GetNameByLocaleConstant (LocaleConstant localeConstant)
 
void CleanStringForMysqlQuery (std::string &str)
 

Variables

char const * localeNames [TOTAL_LOCALES]
 
AccountFlagName const accountFlagNames [MAX_ACCOUNT_FLAG]
 

Function Documentation

◆ CleanStringForMysqlQuery()

void CleanStringForMysqlQuery ( std::string &  str)
98{
99 std::string::size_type n = 0;
100 while ((n = str.find('\\')) != str.npos) { str.erase(n, 1); }
101 while ((n = str.find('"')) != str.npos) { str.erase(n, 1); }
102 while ((n = str.find('\'')) != str.npos) { str.erase(n, 1); }
103}

Referenced by WorldSession::HandleMailTakeItem(), WorldSession::HandleSendMail(), and Map::LogEncounterFinished().

◆ GetLocaleByName()

◆ GetNameByLocaleConstant()

const std::string GetNameByLocaleConstant ( LocaleConstant  localeConstant)
88{
89 if (localeConstant < TOTAL_LOCALES)
90 {
91 return localeNames[localeConstant];
92 }
93
94 return "enUS"; // Default value for unsupported or invalid LocaleConstant
95}

References localeNames, and TOTAL_LOCALES.

Referenced by server_commandscript::HandleServerMotdCommand().

◆ IsLocaleValid()

bool IsLocaleValid ( std::string const &  locale)
70{
71 for (int i = 0; i < TOTAL_LOCALES; ++i)
72 if (locale == localeNames[i])
73 return true;
74
75 return false;
76}

References localeNames, and TOTAL_LOCALES.

Referenced by autobroadcast_commandscript::HandleAutobroadcastLocaleCommand(), server_commandscript::HandleServerSetMotdCommand(), and MotdMgr::LoadMotdLocale().

Variable Documentation

◆ accountFlagNames

AccountFlagName const accountFlagNames[MAX_ACCOUNT_FLAG]
34{
35 { "ACCOUNT_FLAG_GM", "GM" },
36 { "ACCOUNT_FLAG_NOKICK", "NOKICK" },
37 { "ACCOUNT_FLAG_COLLECTOR", "COLLECTOR" },
38 { "ACCOUNT_FLAG_TRIAL", "TRIAL" },
39 { "ACCOUNT_FLAG_CANCELLED", "CANCELLED" },
40 { "ACCOUNT_FLAG_IGR", "IGR" },
41 { "ACCOUNT_FLAG_WHOLESALER", "WHOLESALER" },
42 { "ACCOUNT_FLAG_PRIVILEGED", "PRIVILEGED" },
43 { "ACCOUNT_FLAG_EU_FORBID_ELV", "EU_FORBID_ELV" },
44 { "ACCOUNT_FLAG_EU_FORBID_BILLING", "EU_FORBID_BILLING" },
45 { "ACCOUNT_FLAG_RESTRICTED", "RESTRICTED" },
46 { "ACCOUNT_FLAG_REFERRAL", "REFERRAL" },
47 { "ACCOUNT_FLAG_BLIZZARD", "BLIZZARD" },
48 { "ACCOUNT_FLAG_RECURRING_BILLING", "RECURRING_BILLING" },
49 { "ACCOUNT_FLAG_NOELECTUP", "NOELECTUP" },
50 { "ACCOUNT_FLAG_KR_CERTIFICATE", "KR_CERTIFICATE" },
51 { "ACCOUNT_FLAG_EXPANSION_COLLECTOR", "EXPANSION_COLLECTOR" },
52 { "ACCOUNT_FLAG_DISABLE_VOICE", "DISABLE_VOICE" },
53 { "ACCOUNT_FLAG_DISABLE_VOICE_SPEAK", "DISABLE_VOICE_SPEAK" },
54 { "ACCOUNT_FLAG_REFERRAL_RESURRECT", "REFERRAL_RESURRECT" },
55 { "ACCOUNT_FLAG_EU_FORBID_CC", "EU_FORBID_CC" },
56 { "ACCOUNT_FLAG_OPENBETA_DELL", "OPENBETA_DELL" },
57 { "ACCOUNT_FLAG_PROPASS", "PROPASS" },
58 { "ACCOUNT_FLAG_PROPASS_LOCK", "PROPASS_LOCK" },
59 { "ACCOUNT_FLAG_PENDING_UPGRADE", "PENDING_UPGRADE" },
60 { "ACCOUNT_FLAG_RETAIL_FROM_TRIAL", "RETAIL_FROM_TRIAL" },
61 { "ACCOUNT_FLAG_EXPANSION2_COLLECTOR", "EXPANSION2_COLLECTOR" },
62 { "ACCOUNT_FLAG_OVERMIND_LINKED", "OVERMIND_LINKED" },
63 { "ACCOUNT_FLAG_DEMOS", "DEMOS" },
64 { "ACCOUNT_FLAG_DEATH_KNIGHT_OK", "DEATH_KNIGHT_OK" },
65 { "ACCOUNT_FLAG_S2_REQUIRE_IGR", "S2_REQUIRE_IGR" },
66 { "ACCOUNT_FLAG_S2_TRIAL", "S2_TRIAL" }
67};

Referenced by account_commandscript::ChangeAccountFlag(), account_commandscript::HandleAccountFlagListCommand(), misc_commandscript::HandlePInfoCommand(), and account_commandscript::ParseAccountFlagBit().

◆ localeNames