mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-08 15:58:04 +00:00
fix(Core): CanAccountCreateCharacter hook parameters (#13060)
This commit is contained in:
@@ -432,7 +432,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData)
|
|||||||
|
|
||||||
std::function<void(PreparedQueryResult)> finalizeCharacterCreation = [this, createInfo](PreparedQueryResult result)
|
std::function<void(PreparedQueryResult)> finalizeCharacterCreation = [this, createInfo](PreparedQueryResult result)
|
||||||
{
|
{
|
||||||
if (!sScriptMgr->CanAccountCreateCharacter(createInfo, GetAccountId()))
|
if (!sScriptMgr->CanAccountCreateCharacter(GetAccountId(), createInfo->Race, createInfo->Class))
|
||||||
{
|
{
|
||||||
SendCharCreate(CHAR_CREATE_DISABLED);
|
SendCharCreate(CHAR_CREATE_DISABLED);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -82,11 +82,11 @@ void ScriptMgr::OnFailedPasswordChange(uint32 accountId)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ScriptMgr::CanAccountCreateCharacter(std::shared_ptr<CharacterCreateInfo> createInfo, uint32 accountId)
|
bool ScriptMgr::CanAccountCreateCharacter(uint32 accountId, uint8 charRace, uint8 charClass)
|
||||||
{
|
{
|
||||||
auto ret = IsValidBoolScript<AccountScript>([&](AccountScript* script)
|
auto ret = IsValidBoolScript<AccountScript>([&](AccountScript* script)
|
||||||
{
|
{
|
||||||
return !script->CanAccountCreateCharacter(createInfo, accountId);
|
return !script->CanAccountCreateCharacter(accountId, charRace, charClass);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (ret && *ret)
|
if (ret && *ret)
|
||||||
|
|||||||
@@ -1461,7 +1461,7 @@ public:
|
|||||||
virtual void OnFailedPasswordChange(uint32 /*accountId*/) { }
|
virtual void OnFailedPasswordChange(uint32 /*accountId*/) { }
|
||||||
|
|
||||||
// Called when creating a character on the Account
|
// Called when creating a character on the Account
|
||||||
[[nodiscard]] virtual bool CanAccountCreateCharacter(std::shared_ptr<CharacterCreateInfo> /*createInfo*/, uint32 /*accountId*/) { return true;}
|
[[nodiscard]] virtual bool CanAccountCreateCharacter(uint32 /*accountId*/, uint8 /*charRace*/, uint8 /*charClass*/) { return true;}
|
||||||
};
|
};
|
||||||
|
|
||||||
class GuildScript : public ScriptObject
|
class GuildScript : public ScriptObject
|
||||||
@@ -2360,7 +2360,7 @@ public: /* AccountScript */
|
|||||||
void OnFailedEmailChange(uint32 accountId);
|
void OnFailedEmailChange(uint32 accountId);
|
||||||
void OnPasswordChange(uint32 accountId);
|
void OnPasswordChange(uint32 accountId);
|
||||||
void OnFailedPasswordChange(uint32 accountId);
|
void OnFailedPasswordChange(uint32 accountId);
|
||||||
bool CanAccountCreateCharacter(std::shared_ptr<CharacterCreateInfo> createInfo, uint32 accountId);
|
bool CanAccountCreateCharacter(uint32 accountId, uint8 charRace, uint8 charClass);
|
||||||
|
|
||||||
public: /* GuildScript */
|
public: /* GuildScript */
|
||||||
void OnGuildAddMember(Guild* guild, Player* player, uint8& plRank);
|
void OnGuildAddMember(Guild* guild, Player* player, uint8& plRank);
|
||||||
|
|||||||
Reference in New Issue
Block a user