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)
96{
97 std::string::size_type n = 0;
98 while ((n = str.find('\\')) != str.npos) { str.erase(n, 1); }
99 while ((n = str.find('"')) != str.npos) { str.erase(n, 1); }
100 while ((n = str.find('\'')) != str.npos) { str.erase(n, 1); }
101}

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

◆ GetLocaleByName()

LocaleConstant GetLocaleByName ( std::string const &  name)
79{
80 for (uint32 i = 0; i < TOTAL_LOCALES; ++i)
81 if (IsLocaleRegistered(LocaleConstant(i)) && name == localeNames[i])
82 return LocaleConstant(i);
83
84 return LOCALE_enUS; // including enGB case
85}
char const * localeNames[TOTAL_LOCALES]
Definition Common.cpp:20
LocaleConstant
Definition Common.h:125
@ TOTAL_LOCALES
Definition Common.h:137
@ LOCALE_enUS
Definition Common.h:126
bool IsLocaleRegistered(LocaleConstant locale)
Definition Common.h:147
std::uint32_t uint32
Definition Define.h:107

References IsLocaleRegistered(), LOCALE_enUS, localeNames, and TOTAL_LOCALES.

Referenced by AccountInfo::AccountInfo(), server_commandscript::HandleServerSetMotdCommand(), ObjectMgr::LoadAcoreStrings(), AutobroadcastMgr::LoadAutobroadcastsLocalized(), ObjectMgr::LoadBroadcastTextLocales(), ObjectMgr::LoadCreatureLocales(), CreatureTextMgr::LoadCreatureTextLocales(), ObjectMgr::LoadGameObjectLocales(), ObjectMgr::LoadGossipMenuItemsLocales(), ObjectMgr::LoadItemLocales(), ObjectMgr::LoadItemSetNameLocales(), ObjectMgr::LoadModuleStringsLocale(), MotdMgr::LoadMotdLocale(), ObjectMgr::LoadNpcTextLocales(), ObjectMgr::LoadPageTextLocales(), ObjectMgr::LoadPetNamesLocales(), ObjectMgr::LoadPointOfInterestLocales(), ObjectMgr::LoadQuestGreetingsLocales(), ObjectMgr::LoadQuestLocales(), ObjectMgr::LoadQuestOfferRewardLocale(), ObjectMgr::LoadQuestRequestItemsLocale(), AchievementGlobalMgr::LoadRewardLocales(), ObjectMgr::LoadTrainers(), TEST(), TEST(), TEST(), and TEST_F().

◆ GetNameByLocaleConstant()

const std::string GetNameByLocaleConstant ( LocaleConstant  localeConstant)
88{
89 if (IsLocaleRegistered(localeConstant))
90 return localeNames[localeConstant];
91
93}
#define DEFAULT_LOCALE
Definition Common.h:140

References DEFAULT_LOCALE, IsLocaleRegistered(), and localeNames.

Referenced by WardenWin::HandleData(), server_commandscript::HandleServerMotdCommand(), TEST(), TEST(), and TEST_F().

◆ IsLocaleValid()

bool IsLocaleValid ( std::string const &  locale)

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(), account_commandscript::HandleAccountInfoCommand(), misc_commandscript::HandlePInfoCommand(), and account_commandscript::ParseAccountFlagBit().

◆ localeNames