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:
tobmaps
2011-05-10 18:52:28 +07:00
parent f3a12453a0
commit bd6750b4d0
4 changed files with 16 additions and 6 deletions
+13 -3
View File
@@ -8003,8 +8003,15 @@ void ObjectMgr::LoadFishingBaseSkillLevel()
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)
{
std::wstring wname;
@@ -8012,9 +8019,12 @@ bool ObjectMgr::CheckDeclinedNames(std::wstring mainpart, DeclinedName const& na
return false;
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)
+1 -1
View File
@@ -1135,7 +1135,7 @@ class ObjectMgr
static PetNameInvalidReason CheckPetName(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
{
@@ -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);
data << uint32(1);
@@ -628,7 +628,7 @@ void WorldSession::HandlePetRename(WorldPacket & recv_data)
std::wstring 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);
return;