feat(core): account delete hook (#18605)

Add account delete hook
This commit is contained in:
silviu20092
2024-03-27 01:57:42 +02:00
committed by GitHub
parent 16f220253a
commit 5b8bc792b8
4 changed files with 14 additions and 0 deletions

View File

@@ -68,6 +68,8 @@ namespace AccountMgr
if (!result)
return AOR_NAME_NOT_EXIST;
sScriptMgr->OnBeforeAccountDelete(accountId);
// Obtain accounts characters
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARS_BY_ACCOUNT_ID);
stmt->SetData(0, accountId);

View File

@@ -27,6 +27,14 @@ void ScriptMgr::OnAccountLogin(uint32 accountId)
});
}
void ScriptMgr::OnBeforeAccountDelete(uint32 accountId)
{
ExecuteScript<AccountScript>([&](AccountScript* script)
{
script->OnBeforeAccountDelete(accountId);
});
}
//void ScriptMgr::OnAccountLogout(uint32 accountId)
//{
// ExecuteScript<AccountScript>([&](AccountScript* script)

View File

@@ -29,6 +29,9 @@ public:
// Called when an account logged in successfully
virtual void OnAccountLogin(uint32 /*accountId*/) { }
// Called when an account is about to be deleted
virtual void OnBeforeAccountDelete(uint32 /*accountId*/) { }
// Called when an ip logged in successfully
virtual void OnLastIpUpdate(uint32 /*accountId*/, std::string /*ip*/) { }

View File

@@ -469,6 +469,7 @@ public: /* PlayerScript */
public: /* AccountScript */
void OnAccountLogin(uint32 accountId);
void OnBeforeAccountDelete(uint32 accountId);
void OnLastIpUpdate(uint32 accountId, std::string ip);
void OnFailedAccountLogin(uint32 accountId);
void OnEmailChange(uint32 accountId);