Merge commit 'origin/master' into 320

This commit is contained in:
tomrus88 2009-07-08 22:08:09 +04:00
commit 87930a6d07
35 changed files with 719 additions and 467 deletions

View file

@ -6645,18 +6645,24 @@ bool isValidString(std::wstring wstr, uint32 strictMask, bool numericOrSpace, bo
return false;
}
bool ObjectMgr::IsValidName( const std::string& name, bool create )
uint8 ObjectMgr::CheckPlayerName( const std::string& name, bool create )
{
std::wstring wname;
if(!Utf8toWStr(name,wname))
return false;
return CHAR_NAME_INVALID_CHARACTER;
if(wname.size() < 1 || wname.size() > MAX_PLAYER_NAME)
return false;
if(wname.size() > MAX_PLAYER_NAME)
return CHAR_NAME_TOO_LONG;
uint32 minName = sWorld.getConfig(CONFIG_MIN_PLAYER_NAME);
if(wname.size() < minName)
return CHAR_NAME_TOO_SHORT;
uint32 strictMask = sWorld.getConfig(CONFIG_STRICT_PLAYER_NAMES);
return isValidString(wname,strictMask,false,create);
if(!isValidString(wname,strictMask,false,create))
return CHAR_NAME_MIXED_LANGUAGES;
return CHAR_NAME_SUCCESS;
}
bool ObjectMgr::IsValidCharterName( const std::string& name )
@ -6665,7 +6671,11 @@ bool ObjectMgr::IsValidCharterName( const std::string& name )
if(!Utf8toWStr(name,wname))
return false;
if(wname.size() < 1)
if(wname.size() > MAX_CHARTER_NAME)
return false;
uint32 minName = sWorld.getConfig(CONFIG_MIN_CHARTER_NAME);
if(wname.size() < minName)
return false;
uint32 strictMask = sWorld.getConfig(CONFIG_STRICT_CHARTER_NAMES);
@ -6673,18 +6683,24 @@ bool ObjectMgr::IsValidCharterName( const std::string& name )
return isValidString(wname,strictMask,true);
}
bool ObjectMgr::IsValidPetName( const std::string& name )
PetNameInvalidReason ObjectMgr::CheckPetName( const std::string& name )
{
std::wstring wname;
if(!Utf8toWStr(name,wname))
return false;
return PET_NAME_INVALID;
if(wname.size() < 1)
return false;
if(wname.size() > MAX_PET_NAME)
return PET_NAME_TOO_LONG;
uint32 minName = sWorld.getConfig(CONFIG_MIN_PET_NAME);
if(wname.size() < minName)
return PET_NAME_TOO_SHORT;
uint32 strictMask = sWorld.getConfig(CONFIG_STRICT_PET_NAMES);
if(!isValidString(wname,strictMask,false))
return PET_NAME_MIXED_LANGUAGES;
return isValidString(wname,strictMask,false);
return PET_NAME_SUCCESS;
}
int ObjectMgr::GetIndexForLocale( LocaleConstant loc )