AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
ObjectMgr.cpp File Reference
#include "ObjectMgr.h"
#include "AchievementMgr.h"
#include "ArenaTeamMgr.h"
#include "CharacterCache.h"
#include "Chat.h"
#include "Common.h"
#include "Config.h"
#include "Containers.h"
#include "CreatureAIFactory.h"
#include "DBCStructure.h"
#include "DatabaseEnv.h"
#include "DisableMgr.h"
#include "GameEventMgr.h"
#include "GameObjectAIFactory.h"
#include "GameTime.h"
#include "GossipDef.h"
#include "GroupMgr.h"
#include "GuildMgr.h"
#include "LFGMgr.h"
#include "Log.h"
#include "MapMgr.h"
#include "Pet.h"
#include "PoolMgr.h"
#include "ReputationMgr.h"
#include "ScriptMgr.h"
#include "Spell.h"
#include "SpellMgr.h"
#include "SpellScript.h"
#include "SpellScriptLoader.h"
#include "StringConvert.h"
#include "Tokenize.h"
#include "Transport.h"
#include "Unit.h"
#include "Util.h"
#include "Vehicle.h"
#include "World.h"
#include <boost/algorithm/string.hpp>
#include <numeric>
#include "ItemEnchantmentMgr.h"

Go to the source code of this file.

Enumerations

enum  LanguageType {
  LT_BASIC_LATIN = 0x0000 ,
  LT_EXTENDEN_LATIN = 0x0001 ,
  LT_CYRILLIC = 0x0002 ,
  LT_EAST_ASIA = 0x0004 ,
  LT_ANY = 0xFFFF
}
 

Functions

std::string GetScriptsTableNameByType (ScriptsType type)
 
ScriptMapMapGetScriptsMapByType (ScriptsType type)
 
std::string GetScriptCommandName (ScriptCommands command)
 
bool normalizePlayerName (std::string &name)
 
LanguageDesc const * GetLanguageDescByID (uint32 lang)
 
void CheckGOLockId (GameObjectTemplate const *goInfo, uint32 dataN, uint32 N)
 
void CheckGOLinkedTrapId (GameObjectTemplate const *goInfo, uint32 dataN, uint32 N)
 
void CheckGOSpellId (GameObjectTemplate const *goInfo, uint32 dataN, uint32 N)
 
void CheckAndFixGOChairHeightId (GameObjectTemplate const *goInfo, uint32 const &dataN, uint32 N)
 
void CheckGONoDamageImmuneId (GameObjectTemplate *goTemplate, uint32 dataN, uint32 N)
 
void CheckGOConsumable (GameObjectTemplate const *goInfo, uint32 dataN, uint32 N)
 
static LanguageType GetRealmLanguageType (bool create)
 
bool isValidString (std::wstring wstr, uint32 strictMask, bool numericOrSpace, bool create=false)
 
SkillRangeType GetSkillRangeType (SkillRaceClassInfoEntry const *rcEntry)
 

Variables

ScriptMapMap sSpellScripts
 
ScriptMapMap sEventScripts
 
ScriptMapMap sWaypointScripts
 
LanguageDesc lang_description [LANGUAGES_COUNT]
 

Enumeration Type Documentation

◆ LanguageType

Enumerator
LT_BASIC_LATIN 
LT_EXTENDEN_LATIN 
LT_CYRILLIC 
LT_EAST_ASIA 
LT_ANY 
8360{
8361 LT_BASIC_LATIN = 0x0000,
8362 LT_EXTENDEN_LATIN = 0x0001,
8363 LT_CYRILLIC = 0x0002,
8364 LT_EAST_ASIA = 0x0004,
8365 LT_ANY = 0xFFFF
8366};
@ LT_ANY
Definition: ObjectMgr.cpp:8365
@ LT_EXTENDEN_LATIN
Definition: ObjectMgr.cpp:8362
@ LT_EAST_ASIA
Definition: ObjectMgr.cpp:8364
@ LT_BASIC_LATIN
Definition: ObjectMgr.cpp:8361
@ LT_CYRILLIC
Definition: ObjectMgr.cpp:8363

Function Documentation

◆ CheckAndFixGOChairHeightId()

void CheckAndFixGOChairHeightId ( GameObjectTemplate const *  goInfo,
uint32 const &  dataN,
uint32  N 
)
inline
7133{
7135 return;
7136
7137 LOG_ERROR("sql.sql", "Gameobject (Entry: {} GoType: {}) have data{}={} but correct chair height in range 0..{}.",
7138 goInfo->entry, goInfo->type, N, dataN, UNIT_STAND_STATE_SIT_HIGH_CHAIR - UNIT_STAND_STATE_SIT_LOW_CHAIR);
7139
7140 // prevent client and server unexpected work
7141 const_cast<uint32&>(dataN) = 0;
7142}
#define LOG_ERROR(filterType__,...)
Definition: Log.h:157
std::uint32_t uint32
Definition: Define.h:107
@ UNIT_STAND_STATE_SIT_HIGH_CHAIR
Definition: UnitDefines.h:38
@ UNIT_STAND_STATE_SIT_LOW_CHAIR
Definition: UnitDefines.h:36

References GameObjectTemplate::entry, LOG_ERROR, GameObjectTemplate::type, UNIT_STAND_STATE_SIT_HIGH_CHAIR, and UNIT_STAND_STATE_SIT_LOW_CHAIR.

Referenced by ObjectMgr::LoadGameObjectTemplate().

◆ CheckGOConsumable()

void CheckGOConsumable ( GameObjectTemplate const *  goInfo,
uint32  dataN,
uint32  N 
)
inline
7154{
7155 // 0/1 correct values
7156 if (dataN <= 1)
7157 return;
7158
7159 LOG_ERROR("sql.sql", "Gameobject (Entry: {} GoType: {}) have data{}={} but expected boolean (0/1) consumable field value.",
7160 goInfo->entry, goInfo->type, N, dataN);
7161}

References GameObjectTemplate::entry, LOG_ERROR, and GameObjectTemplate::type.

Referenced by ObjectMgr::LoadGameObjectTemplate().

◆ CheckGOLinkedTrapId()

void CheckGOLinkedTrapId ( GameObjectTemplate const *  goInfo,
uint32  dataN,
uint32  N 
)
inline
7114{
7115 if (GameObjectTemplate const* trapInfo = sObjectMgr->GetGameObjectTemplate(dataN))
7116 {
7117 if (trapInfo->type != GAMEOBJECT_TYPE_TRAP)
7118 LOG_ERROR("sql.sql", "Gameobject (Entry: {} GoType: {}) have data{}={} but GO (Entry {}) have not GAMEOBJECT_TYPE_TRAP ({}) type.",
7119 goInfo->entry, goInfo->type, N, dataN, dataN, GAMEOBJECT_TYPE_TRAP);
7120 }
7121}
@ GAMEOBJECT_TYPE_TRAP
Definition: SharedDefines.h:1566
#define sObjectMgr
Definition: ObjectMgr.h:1635
Definition: GameObjectData.h:31

References GameObjectTemplate::entry, GAMEOBJECT_TYPE_TRAP, LOG_ERROR, sObjectMgr, and GameObjectTemplate::type.

Referenced by ObjectMgr::LoadGameObjectTemplate().

◆ CheckGOLockId()

void CheckGOLockId ( GameObjectTemplate const *  goInfo,
uint32  dataN,
uint32  N 
)
inline
7105{
7106 if (sLockStore.LookupEntry(dataN))
7107 return;
7108
7109 LOG_ERROR("sql.sql", "Gameobject (Entry: {} GoType: {}) have data{}={} but lock (Id: {}) not found.",
7110 goInfo->entry, goInfo->type, N, goInfo->door.lockId, goInfo->door.lockId);
7111}
DBCStorage< LockEntry > sLockStore(LockEntryfmt)

References GameObjectTemplate::door, GameObjectTemplate::entry, GameObjectTemplate::lockId, LOG_ERROR, sLockStore, and GameObjectTemplate::type.

Referenced by ObjectMgr::LoadGameObjectTemplate().

◆ CheckGONoDamageImmuneId()

void CheckGONoDamageImmuneId ( GameObjectTemplate goTemplate,
uint32  dataN,
uint32  N 
)
inline
7145{
7146 // 0/1 correct values
7147 if (dataN <= 1)
7148 return;
7149
7150 LOG_ERROR("sql.sql", "Gameobject (Entry: {} GoType: {}) have data{}={} but expected boolean (0/1) noDamageImmune field value.", goTemplate->entry, goTemplate->type, N, dataN);
7151}
uint32 type
Definition: GameObjectData.h:33
uint32 entry
Definition: GameObjectData.h:32

References GameObjectTemplate::entry, LOG_ERROR, and GameObjectTemplate::type.

Referenced by ObjectMgr::LoadGameObjectTemplate().

◆ CheckGOSpellId()

void CheckGOSpellId ( GameObjectTemplate const *  goInfo,
uint32  dataN,
uint32  N 
)
inline
7124{
7125 if (sSpellMgr->GetSpellInfo(dataN))
7126 return;
7127
7128 LOG_ERROR("sql.sql", "Gameobject (Entry: {} GoType: {}) have data{}={} but Spell (Entry {}) not exist.",
7129 goInfo->entry, goInfo->type, N, dataN, dataN);
7130}
#define sSpellMgr
Definition: SpellMgr.h:825

References GameObjectTemplate::entry, LOG_ERROR, sSpellMgr, and GameObjectTemplate::type.

Referenced by ObjectMgr::LoadGameObjectTemplate().

◆ GetLanguageDescByID()

LanguageDesc const * GetLanguageDescByID ( uint32  lang)
254{
255 for (uint8 i = 0; i < LANGUAGES_COUNT; ++i)
256 {
257 if (uint32(lang_description[i].lang_id) == lang)
258 return &lang_description[i];
259 }
260
261 return nullptr;
262}
std::uint8_t uint8
Definition: Define.h:109
#define LANGUAGES_COUNT
Definition: SharedDefines.h:756
LanguageDesc lang_description[LANGUAGES_COUNT]
Definition: ObjectMgr.cpp:230

References lang_description, and LANGUAGES_COUNT.

Referenced by WorldSession::HandleMessagechatOpcode(), ObjectMgr::LoadBroadcastTexts(), and CreatureTextMgr::LoadCreatureTexts().

◆ GetRealmLanguageType()

static LanguageType GetRealmLanguageType ( bool  create)
static
8369{
8370 switch (sWorld->getIntConfig(CONFIG_REALM_ZONE))
8371 {
8372 case REALM_ZONE_UNKNOWN: // any language
8376 return LT_ANY;
8377 case REALM_ZONE_UNITED_STATES: // extended-Latin
8378 case REALM_ZONE_OCEANIC:
8380 case REALM_ZONE_ENGLISH:
8381 case REALM_ZONE_GERMAN:
8382 case REALM_ZONE_FRENCH:
8383 case REALM_ZONE_SPANISH:
8384 return LT_EXTENDEN_LATIN;
8385 case REALM_ZONE_KOREA: // East-Asian
8386 case REALM_ZONE_TAIWAN:
8387 case REALM_ZONE_CHINA:
8388 return LT_EAST_ASIA;
8389 case REALM_ZONE_RUSSIAN: // Cyrillic
8390 return LT_CYRILLIC;
8391 default:
8392 return create ? LT_BASIC_LATIN : LT_ANY; // basic-Latin at create, any at login
8393 }
8394}
@ CONFIG_REALM_ZONE
Definition: IWorld.h:219
#define sWorld
Definition: World.h:443
@ REALM_ZONE_TEST_SERVER
Definition: World.h:117
@ REALM_ZONE_LATIN_AMERICA
Definition: World.h:95
@ REALM_ZONE_SPANISH
Definition: World.h:102
@ REALM_ZONE_OCEANIC
Definition: World.h:94
@ REALM_ZONE_KOREA
Definition: World.h:97
@ REALM_ZONE_UNKNOWN
Definition: World.h:91
@ REALM_ZONE_UNITED_STATES
Definition: World.h:93
@ REALM_ZONE_ENGLISH
Definition: World.h:99
@ REALM_ZONE_FRENCH
Definition: World.h:101
@ REALM_ZONE_QA_SERVER
Definition: World.h:119
@ REALM_ZONE_CHINA
Definition: World.h:107
@ REALM_ZONE_RUSSIAN
Definition: World.h:103
@ REALM_ZONE_DEVELOPMENT
Definition: World.h:92
@ REALM_ZONE_TAIWAN
Definition: World.h:105
@ REALM_ZONE_GERMAN
Definition: World.h:100

References CONFIG_REALM_ZONE, LT_ANY, LT_BASIC_LATIN, LT_CYRILLIC, LT_EAST_ASIA, LT_EXTENDEN_LATIN, REALM_ZONE_CHINA, REALM_ZONE_DEVELOPMENT, REALM_ZONE_ENGLISH, REALM_ZONE_FRENCH, REALM_ZONE_GERMAN, REALM_ZONE_KOREA, REALM_ZONE_LATIN_AMERICA, REALM_ZONE_OCEANIC, REALM_ZONE_QA_SERVER, REALM_ZONE_RUSSIAN, REALM_ZONE_SPANISH, REALM_ZONE_TAIWAN, REALM_ZONE_TEST_SERVER, REALM_ZONE_UNITED_STATES, REALM_ZONE_UNKNOWN, and sWorld.

Referenced by isValidString().

◆ GetScriptCommandName()

std::string GetScriptCommandName ( ScriptCommands  command)
104{
105 std::string res = "";
106 switch (command)
107 {
109 res = "SCRIPT_COMMAND_TALK";
110 break;
112 res = "SCRIPT_COMMAND_EMOTE";
113 break;
115 res = "SCRIPT_COMMAND_FIELD_SET";
116 break;
118 res = "SCRIPT_COMMAND_MOVE_TO";
119 break;
121 res = "SCRIPT_COMMAND_FLAG_SET";
122 break;
124 res = "SCRIPT_COMMAND_FLAG_REMOVE";
125 break;
127 res = "SCRIPT_COMMAND_TELEPORT_TO";
128 break;
130 res = "SCRIPT_COMMAND_QUEST_EXPLORED";
131 break;
133 res = "SCRIPT_COMMAND_KILL_CREDIT";
134 break;
136 res = "SCRIPT_COMMAND_RESPAWN_GAMEOBJECT";
137 break;
139 res = "SCRIPT_COMMAND_TEMP_SUMMON_CREATURE";
140 break;
142 res = "SCRIPT_COMMAND_OPEN_DOOR";
143 break;
145 res = "SCRIPT_COMMAND_CLOSE_DOOR";
146 break;
148 res = "SCRIPT_COMMAND_ACTIVATE_OBJECT";
149 break;
151 res = "SCRIPT_COMMAND_REMOVE_AURA";
152 break;
154 res = "SCRIPT_COMMAND_CAST_SPELL";
155 break;
157 res = "SCRIPT_COMMAND_PLAY_SOUND";
158 break;
160 res = "SCRIPT_COMMAND_CREATE_ITEM";
161 break;
163 res = "SCRIPT_COMMAND_DESPAWN_SELF";
164 break;
166 res = "SCRIPT_COMMAND_LOAD_PATH";
167 break;
169 res = "SCRIPT_COMMAND_CALLSCRIPT_TO_UNIT";
170 break;
172 res = "SCRIPT_COMMAND_KILL";
173 break;
174 // AzerothCore only
176 res = "SCRIPT_COMMAND_ORIENTATION";
177 break;
179 res = "SCRIPT_COMMAND_EQUIP";
180 break;
182 res = "SCRIPT_COMMAND_MODEL";
183 break;
185 res = "SCRIPT_COMMAND_CLOSE_GOSSIP";
186 break;
188 res = "SCRIPT_COMMAND_PLAYMOVIE";
189 break;
190 default:
191 {
192 char sz[32];
193 snprintf(sz, sizeof(sz), "Unknown command: %d", command);
194 res = sz;
195 break;
196 }
197 }
198 return res;
199}
@ SCRIPT_COMMAND_EMOTE
Definition: ObjectMgr.h:93
@ SCRIPT_COMMAND_CREATE_ITEM
Definition: ObjectMgr.h:109
@ SCRIPT_COMMAND_DESPAWN_SELF
Definition: ObjectMgr.h:110
@ SCRIPT_COMMAND_CLOSE_DOOR
Definition: ObjectMgr.h:104
@ SCRIPT_COMMAND_CAST_SPELL
Definition: ObjectMgr.h:107
@ SCRIPT_COMMAND_RESPAWN_GAMEOBJECT
Definition: ObjectMgr.h:101
@ SCRIPT_COMMAND_QUEST_EXPLORED
Definition: ObjectMgr.h:99
@ SCRIPT_COMMAND_ACTIVATE_OBJECT
Definition: ObjectMgr.h:105
@ SCRIPT_COMMAND_TALK
Definition: ObjectMgr.h:92
@ SCRIPT_COMMAND_OPEN_DOOR
Definition: ObjectMgr.h:103
@ SCRIPT_COMMAND_EQUIP
Definition: ObjectMgr.h:118
@ SCRIPT_COMMAND_FIELD_SET
Definition: ObjectMgr.h:94
@ SCRIPT_COMMAND_PLAYMOVIE
Definition: ObjectMgr.h:121
@ SCRIPT_COMMAND_CALLSCRIPT_TO_UNIT
Definition: ObjectMgr.h:113
@ SCRIPT_COMMAND_TELEPORT_TO
Definition: ObjectMgr.h:98
@ SCRIPT_COMMAND_MOVE_TO
Definition: ObjectMgr.h:95
@ SCRIPT_COMMAND_FLAG_SET
Definition: ObjectMgr.h:96
@ SCRIPT_COMMAND_TEMP_SUMMON_CREATURE
Definition: ObjectMgr.h:102
@ SCRIPT_COMMAND_KILL_CREDIT
Definition: ObjectMgr.h:100
@ SCRIPT_COMMAND_KILL
Definition: ObjectMgr.h:114
@ SCRIPT_COMMAND_LOAD_PATH
Definition: ObjectMgr.h:112
@ SCRIPT_COMMAND_ORIENTATION
Definition: ObjectMgr.h:117
@ SCRIPT_COMMAND_PLAY_SOUND
Definition: ObjectMgr.h:108
@ SCRIPT_COMMAND_MODEL
Definition: ObjectMgr.h:119
@ SCRIPT_COMMAND_CLOSE_GOSSIP
Definition: ObjectMgr.h:120
@ SCRIPT_COMMAND_REMOVE_AURA
Definition: ObjectMgr.h:106
@ SCRIPT_COMMAND_FLAG_REMOVE
Definition: ObjectMgr.h:97

References SCRIPT_COMMAND_ACTIVATE_OBJECT, SCRIPT_COMMAND_CALLSCRIPT_TO_UNIT, SCRIPT_COMMAND_CAST_SPELL, SCRIPT_COMMAND_CLOSE_DOOR, SCRIPT_COMMAND_CLOSE_GOSSIP, SCRIPT_COMMAND_CREATE_ITEM, SCRIPT_COMMAND_DESPAWN_SELF, SCRIPT_COMMAND_EMOTE, SCRIPT_COMMAND_EQUIP, SCRIPT_COMMAND_FIELD_SET, SCRIPT_COMMAND_FLAG_REMOVE, SCRIPT_COMMAND_FLAG_SET, SCRIPT_COMMAND_KILL, SCRIPT_COMMAND_KILL_CREDIT, SCRIPT_COMMAND_LOAD_PATH, SCRIPT_COMMAND_MODEL, SCRIPT_COMMAND_MOVE_TO, SCRIPT_COMMAND_OPEN_DOOR, SCRIPT_COMMAND_ORIENTATION, SCRIPT_COMMAND_PLAY_SOUND, SCRIPT_COMMAND_PLAYMOVIE, SCRIPT_COMMAND_QUEST_EXPLORED, SCRIPT_COMMAND_REMOVE_AURA, SCRIPT_COMMAND_RESPAWN_GAMEOBJECT, SCRIPT_COMMAND_TALK, SCRIPT_COMMAND_TELEPORT_TO, and SCRIPT_COMMAND_TEMP_SUMMON_CREATURE.

Referenced by ScriptInfo::GetDebugInfo(), and ObjectMgr::LoadScripts().

◆ GetScriptsMapByType()

ScriptMapMap * GetScriptsMapByType ( ScriptsType  type)
84{
85 ScriptMapMap* res = nullptr;
86 switch (type)
87 {
88 case SCRIPTS_SPELL:
89 res = &sSpellScripts;
90 break;
91 case SCRIPTS_EVENT:
92 res = &sEventScripts;
93 break;
95 res = &sWaypointScripts;
96 break;
97 default:
98 break;
99 }
100 return res;
101}
std::map< uint32, ScriptMap > ScriptMapMap
Definition: ObjectMgr.h:386
@ SCRIPTS_WAYPOINT
Definition: ObjectMgr.h:150
@ SCRIPTS_EVENT
Definition: ObjectMgr.h:149
@ SCRIPTS_SPELL
Definition: ObjectMgr.h:148
ScriptMapMap sSpellScripts
Definition: ObjectMgr.cpp:59
ScriptMapMap sEventScripts
Definition: ObjectMgr.cpp:60
ScriptMapMap sWaypointScripts
Definition: ObjectMgr.cpp:61

References SCRIPTS_EVENT, SCRIPTS_SPELL, SCRIPTS_WAYPOINT, sEventScripts, sSpellScripts, and sWaypointScripts.

Referenced by ObjectMgr::LoadScripts(), and Map::ScriptsProcess().

◆ GetScriptsTableNameByType()

std::string GetScriptsTableNameByType ( ScriptsType  type)
64{
65 std::string res = "";
66 switch (type)
67 {
68 case SCRIPTS_SPELL:
69 res = "spell_scripts";
70 break;
71 case SCRIPTS_EVENT:
72 res = "event_scripts";
73 break;
75 res = "waypoint_scripts";
76 break;
77 default:
78 break;
79 }
80 return res;
81}

References SCRIPTS_EVENT, SCRIPTS_SPELL, and SCRIPTS_WAYPOINT.

Referenced by ScriptInfo::GetDebugInfo(), and ObjectMgr::LoadScripts().

◆ GetSkillRangeType()

SkillRangeType GetSkillRangeType ( SkillRaceClassInfoEntry const *  rcEntry)
8864{
8865 SkillLineEntry const* skill = sSkillLineStore.LookupEntry(rcEntry->SkillID);
8866 if (!skill)
8867 {
8868 return SKILL_RANGE_NONE;
8869 }
8870
8871 if (sSkillTiersStore.LookupEntry(rcEntry->SkillTierID))
8872 {
8873 return SKILL_RANGE_RANK;
8874 }
8875
8876 if (rcEntry->SkillID == SKILL_RUNEFORGING)
8877 {
8878 return SKILL_RANGE_MONO;
8879 }
8880
8881 switch (skill->categoryId)
8882 {
8884 return SKILL_RANGE_MONO;
8886 return SKILL_RANGE_LANGUAGE;
8887 }
8888
8889 return SKILL_RANGE_LEVEL;
8890}
@ SKILL_CATEGORY_ARMOR
Definition: SharedDefines.h:3075
@ SKILL_CATEGORY_LANGUAGES
Definition: SharedDefines.h:3077
@ SKILL_RUNEFORGING
Definition: SharedDefines.h:3004
@ SKILL_RANGE_MONO
Definition: ObjectMgr.h:676
@ SKILL_RANGE_NONE
Definition: ObjectMgr.h:678
@ SKILL_RANGE_LANGUAGE
Definition: ObjectMgr.h:674
@ SKILL_RANGE_RANK
Definition: ObjectMgr.h:677
@ SKILL_RANGE_LEVEL
Definition: ObjectMgr.h:675
DBCStorage< SkillTiersEntry > sSkillTiersStore(SkillTiersfmt)
DBCStorage< SkillLineEntry > sSkillLineStore(SkillLinefmt)
Definition: DBCStructure.h:1582
int32 categoryId
Definition: DBCStructure.h:1584

References SkillLineEntry::categoryId, SKILL_CATEGORY_ARMOR, SKILL_CATEGORY_LANGUAGES, SKILL_RANGE_LANGUAGE, SKILL_RANGE_LEVEL, SKILL_RANGE_MONO, SKILL_RANGE_NONE, SKILL_RANGE_RANK, SKILL_RUNEFORGING, SkillRaceClassInfoEntry::SkillID, SkillRaceClassInfoEntry::SkillTierID, sSkillLineStore, and sSkillTiersStore.

Referenced by Player::_LoadSkills(), Player::LearnDefaultSkill(), and Player::UpdateSkillsForLevel().

◆ isValidString()

bool isValidString ( std::wstring  wstr,
uint32  strictMask,
bool  numericOrSpace,
bool  create = false 
)
8397{
8398 if (strictMask == 0) // any language, ignore realm
8399 {
8400 if (isExtendedLatinString(wstr, numericOrSpace))
8401 return true;
8402 if (isCyrillicString(wstr, numericOrSpace))
8403 return true;
8404 if (isEastAsianString(wstr, numericOrSpace))
8405 return true;
8406 return false;
8407 }
8408
8409 if (strictMask & 0x2) // realm zone specific
8410 {
8412 if (lt & LT_EXTENDEN_LATIN)
8413 if (isExtendedLatinString(wstr, numericOrSpace))
8414 return true;
8415 if (lt & LT_CYRILLIC)
8416 if (isCyrillicString(wstr, numericOrSpace))
8417 return true;
8418 if (lt & LT_EAST_ASIA)
8419 if (isEastAsianString(wstr, numericOrSpace))
8420 return true;
8421 }
8422
8423 if (strictMask & 0x1) // basic Latin
8424 {
8425 if (isBasicLatinString(wstr, numericOrSpace))
8426 return true;
8427 }
8428
8429 return false;
8430}
bool isCyrillicString(std::wstring_view wstr, bool numericOrSpace)
Definition: Util.h:255
bool isBasicLatinString(std::wstring_view wstr, bool numericOrSpace)
Definition: Util.h:235
bool isEastAsianString(std::wstring_view wstr, bool numericOrSpace)
Definition: Util.h:265
bool isExtendedLatinString(std::wstring_view wstr, bool numericOrSpace)
Definition: Util.h:245
static LanguageType GetRealmLanguageType(bool create)
Definition: ObjectMgr.cpp:8368
LanguageType
Definition: ObjectMgr.cpp:8360

References GetRealmLanguageType(), isBasicLatinString(), isCyrillicString(), isEastAsianString(), isExtendedLatinString(), LT_CYRILLIC, LT_EAST_ASIA, and LT_EXTENDEN_LATIN.

Referenced by ObjectMgr::CheckPetName(), ObjectMgr::CheckPlayerName(), ObjectMgr::IsValidChannelName(), and ObjectMgr::IsValidCharterName().

◆ normalizePlayerName()

bool normalizePlayerName ( std::string &  name)
209{
210 if (name.empty())
211 return false;
212
213 if (name.find(" ") != std::string::npos)
214 return false;
215
216 std::wstring tmp;
217 if (!Utf8toWStr(name, tmp))
218 return false;
219
220 wstrToLower(tmp);
221 if (!tmp.empty())
222 tmp[0] = wcharToUpper(tmp[0]);
223
224 if (!WStrToUtf8(tmp, name))
225 return false;
226
227 return true;
228}
wchar_t wcharToUpper(wchar_t wchar)
Definition: Util.h:278
bool Utf8toWStr(char const *utf8str, std::size_t csize, wchar_t *wstr, std::size_t &wsize)
Definition: Util.cpp:281
bool WStrToUtf8(wchar_t const *wstr, std::size_t size, std::string &utf8str)
Definition: Util.cpp:333
void wstrToLower(std::wstring &str)
Definition: Util.cpp:382

References Utf8toWStr(), wcharToUpper(), wstrToLower(), and WStrToUtf8().

Referenced by ChatHandler::extractLowGuidFromLink(), ChatHandler::extractPlayerNameFromLink(), PlayerNameMapHolder::Find(), character_commandscript::GetDeletedCharacterInfoList(), ChatHandler::GetPlayerGroupAndGUIDByName(), WorldSession::HandleAddFriendOpcode(), WorldSession::HandleAddIgnoreOpcode(), WorldSession::HandleArenaTeamInviteOpcode(), WorldSession::HandleArenaTeamLeaderOpcode(), WorldSession::HandleArenaTeamRemoveOpcode(), ban_commandscript::HandleBanCharacterCommand(), ban_commandscript::HandleBanHelper(), WorldSession::HandleChannelBan(), WorldSession::HandleChannelInvite(), WorldSession::HandleChannelKick(), WorldSession::HandleChannelModerator(), WorldSession::HandleChannelMute(), WorldSession::HandleChannelSetOwner(), WorldSession::HandleChannelUnban(), WorldSession::HandleChannelUnmoderator(), WorldSession::HandleChannelUnmute(), character_commandscript::HandleCharacterRenameCommand(), WorldSession::HandleCharCreateOpcode(), WorldSession::HandleCharCustomizeCallback(), WorldSession::HandleCharFactionOrRaceChangeCallback(), WorldSession::HandleCharRenameOpcode(), deserter_commandscript::HandleDeserterAdd(), ticket_commandscript::HandleGMTicketAssignToCommand(), ticket_commandscript::HandleGMTicketGetByNameCommand(), WorldSession::HandleGroupInviteOpcode(), WorldSession::HandleGroupSwapSubGroupOpcode(), WorldSession::HandleGroupUninviteOpcode(), WorldSession::HandleGuildDemoteOpcode(), WorldSession::HandleGuildInviteOpcode(), WorldSession::HandleGuildLeaderOpcode(), WorldSession::HandleGuildPromoteOpcode(), WorldSession::HandleGuildRemoveOpcode(), WorldSession::HandleGuildSetOfficerNoteOpcode(), WorldSession::HandleGuildSetPublicNoteOpcode(), WorldSession::HandleMessagechatOpcode(), WorldSession::HandleSendMail(), WorldSession::HandleSetPlayerDeclinedNames(), ban_commandscript::HandleUnBanCharacterCommand(), ban_commandscript::HandleUnBanHelper(), message_commandscript::HandleWhispersCommand(), WorldSession::HandleWhoisOpcode(), PlayerDumpReader::LoadDump(), Acore::ChatCommands::PlayerIdentifier::TryConsume(), and character_commandscript::ValidatePDumpTarget().

Variable Documentation

◆ lang_description

LanguageDesc lang_description[LANGUAGES_COUNT]
Initial value:
=
{
{ LANG_ADDON, 0, 0 },
{ LANG_UNIVERSAL, 0, 0 },
{ LANG_ZOMBIE, 0, 0 },
}
@ LANG_TITAN
Definition: SharedDefines.h:742
@ LANG_GNOMISH_BINARY
Definition: SharedDefines.h:751
@ LANG_UNIVERSAL
Definition: SharedDefines.h:735
@ LANG_GNOMISH
Definition: SharedDefines.h:746
@ LANG_GOBLIN_BINARY
Definition: SharedDefines.h:752
@ LANG_DEMONIC
Definition: SharedDefines.h:741
@ LANG_DRAENEI
Definition: SharedDefines.h:749
@ LANG_THALASSIAN
Definition: SharedDefines.h:743
@ LANG_DRACONIC
Definition: SharedDefines.h:744
@ LANG_TROLL
Definition: SharedDefines.h:747
@ LANG_TAURAHE
Definition: SharedDefines.h:738
@ LANG_KALIMAG
Definition: SharedDefines.h:745
@ LANG_ZOMBIE
Definition: SharedDefines.h:750
@ LANG_ADDON
Definition: SharedDefines.h:753
@ LANG_DWARVISH
Definition: SharedDefines.h:739
@ LANG_GUTTERSPEAK
Definition: SharedDefines.h:748
@ LANG_COMMON
Definition: SharedDefines.h:740
@ LANG_ORCISH
Definition: SharedDefines.h:736
@ LANG_DARNASSIAN
Definition: SharedDefines.h:737
@ SKILL_LANG_GNOMISH
Definition: SharedDefines.h:2952
@ SKILL_LANG_COMMON
Definition: SharedDefines.h:2882
@ SKILL_LANG_DRAENEI
Definition: SharedDefines.h:2988
@ SKILL_LANG_ORCISH
Definition: SharedDefines.h:2884
@ SKILL_LANG_TROLL
Definition: SharedDefines.h:2953
@ SKILL_LANG_GUTTERSPEAK
Definition: SharedDefines.h:2980
@ SKILL_LANG_OLD_TONGUE
Definition: SharedDefines.h:2899
@ SKILL_LANG_TAURAHE
Definition: SharedDefines.h:2887
@ SKILL_LANG_TITAN
Definition: SharedDefines.h:2898
@ SKILL_LANG_DARNASSIAN
Definition: SharedDefines.h:2886
@ SKILL_LANG_DEMON_TONGUE
Definition: SharedDefines.h:2897
@ SKILL_LANG_DWARVEN
Definition: SharedDefines.h:2885
@ SKILL_LANG_THALASSIAN
Definition: SharedDefines.h:2895
@ SKILL_LANG_DRACONIC
Definition: SharedDefines.h:2896

Referenced by GetLanguageDescByID(), and learn_commandscript::HandleLearnAllLangCommand().

◆ sEventScripts

◆ sSpellScripts

◆ sWaypointScripts