Core/Player: Fix old issue with creating a character if using declined names. Thx to someone, whose name was lost on old forums
This commit is contained in:
@@ -8003,8 +8003,15 @@ void ObjectMgr::LoadFishingBaseSkillLevel()
|
|||||||
sLog->outString();
|
sLog->outString();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ObjectMgr::CheckDeclinedNames(std::wstring mainpart, DeclinedName const& names)
|
bool ObjectMgr::CheckDeclinedNames(std::wstring w_ownname, DeclinedName const& names)
|
||||||
{
|
{
|
||||||
|
// get main part of the name
|
||||||
|
std::wstring mainpart = GetMainPartOfName(w_ownname, 0);
|
||||||
|
// prepare flags
|
||||||
|
bool x = true;
|
||||||
|
bool y = true;
|
||||||
|
|
||||||
|
// check declined names
|
||||||
for (uint8 i =0; i < MAX_DECLINED_NAME_CASES; ++i)
|
for (uint8 i =0; i < MAX_DECLINED_NAME_CASES; ++i)
|
||||||
{
|
{
|
||||||
std::wstring wname;
|
std::wstring wname;
|
||||||
@@ -8012,9 +8019,12 @@ bool ObjectMgr::CheckDeclinedNames(std::wstring mainpart, DeclinedName const& na
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (mainpart != GetMainPartOfName(wname, i+1))
|
if (mainpart != GetMainPartOfName(wname, i+1))
|
||||||
return false;
|
x = false;
|
||||||
|
|
||||||
|
if (w_ownname != wname)
|
||||||
|
y = false;
|
||||||
}
|
}
|
||||||
return true;
|
return (x || y);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 ObjectMgr::GetAreaTriggerScriptId(uint32 trigger_id)
|
uint32 ObjectMgr::GetAreaTriggerScriptId(uint32 trigger_id)
|
||||||
|
|||||||
@@ -1135,7 +1135,7 @@ class ObjectMgr
|
|||||||
static PetNameInvalidReason CheckPetName(const std::string& name);
|
static PetNameInvalidReason CheckPetName(const std::string& name);
|
||||||
static bool IsValidCharterName(const std::string& name);
|
static bool IsValidCharterName(const std::string& name);
|
||||||
|
|
||||||
static bool CheckDeclinedNames(std::wstring mainpart, DeclinedName const& names);
|
static bool CheckDeclinedNames(std::wstring w_ownname, DeclinedName const& names);
|
||||||
|
|
||||||
GameTele const* GetGameTele(uint32 id) const
|
GameTele const* GetGameTele(uint32 id) const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1150,7 +1150,7 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recv_data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ObjectMgr::CheckDeclinedNames(GetMainPartOfName(wname, 0), declinedname))
|
if (!ObjectMgr::CheckDeclinedNames(wname, declinedname))
|
||||||
{
|
{
|
||||||
WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4+8);
|
WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4+8);
|
||||||
data << uint32(1);
|
data << uint32(1);
|
||||||
|
|||||||
@@ -628,7 +628,7 @@ void WorldSession::HandlePetRename(WorldPacket & recv_data)
|
|||||||
|
|
||||||
std::wstring wname;
|
std::wstring wname;
|
||||||
Utf8toWStr(name, wname);
|
Utf8toWStr(name, wname);
|
||||||
if (!ObjectMgr::CheckDeclinedNames(GetMainPartOfName(wname, 0), declinedname))
|
if (!ObjectMgr::CheckDeclinedNames(wname, declinedname))
|
||||||
{
|
{
|
||||||
SendPetNameInvalid(PET_NAME_DECLENSION_DOESNT_MATCH_BASE_NAME, name, &declinedname);
|
SendPetNameInvalid(PET_NAME_DECLENSION_DOESNT_MATCH_BASE_NAME, name, &declinedname);
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user