Merge pull request #11976 from Ascathor/master
Core/Misc: New ability to log account IP access history
This commit is contained in:
commit
84e6af26e6
23 files changed
+618
-52
No files matched your search
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "ScriptLoader.h"
|
||||
#include "World.h"
|
||||
|
||||
//examples
|
||||
void AddSC_example_creature();
|
||||
@@ -41,7 +42,7 @@ void AddSC_item_spell_scripts();
|
||||
void AddSC_example_spell_scripts();
|
||||
void AddSC_holiday_spell_scripts();
|
||||
|
||||
void AddSC_SmartSCripts();
|
||||
void AddSC_SmartScripts();
|
||||
|
||||
//Commands
|
||||
void AddSC_account_commandscript();
|
||||
@@ -97,6 +98,7 @@ void AddSC_npc_innkeeper();
|
||||
void AddSC_npcs_special();
|
||||
void AddSC_npc_taxi();
|
||||
void AddSC_achievement_scripts();
|
||||
void AddSC_action_ip_logger();
|
||||
|
||||
//eastern kingdoms
|
||||
void AddSC_alterac_valley(); //Alterac Valley
|
||||
@@ -695,6 +697,7 @@ void AddSC_outdoorpvp_zm();
|
||||
|
||||
// player
|
||||
void AddSC_chat_log();
|
||||
void AddSC_action_ip_logger();
|
||||
|
||||
#endif
|
||||
|
||||
@@ -702,7 +705,7 @@ void AddScripts()
|
||||
{
|
||||
AddExampleScripts();
|
||||
AddSpellScripts();
|
||||
AddSC_SmartSCripts();
|
||||
AddSC_SmartScripts();
|
||||
AddCommandScripts();
|
||||
#ifdef SCRIPTS
|
||||
AddWorldScripts();
|
||||
@@ -803,7 +806,10 @@ void AddWorldScripts()
|
||||
AddSC_npcs_special();
|
||||
AddSC_npc_taxi();
|
||||
AddSC_achievement_scripts();
|
||||
AddSC_chat_log();
|
||||
AddSC_chat_log(); // location: scripts\World\chat_log.cpp
|
||||
// To avoid duplicate code, we check once /*ONLY*/ if logging is permitted or not.
|
||||
if (sWorld->getBoolConfig(CONFIG_IP_BASED_ACTION_LOGGING))
|
||||
AddSC_action_ip_logger(); // location: scripts\World\action_ip_logger.cpp
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -224,6 +224,7 @@ void ScriptMgr::Unload()
|
||||
SCR_CLEAR(TransportScript);
|
||||
SCR_CLEAR(AchievementCriteriaScript);
|
||||
SCR_CLEAR(PlayerScript);
|
||||
SCR_CLEAR(AccountScript);
|
||||
SCR_CLEAR(GuildScript);
|
||||
SCR_CLEAR(GroupScript);
|
||||
SCR_CLEAR(UnitScript);
|
||||
@@ -1257,9 +1258,14 @@ void ScriptMgr::OnPlayerCreate(Player* player)
|
||||
FOREACH_SCRIPT(PlayerScript)->OnCreate(player);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnPlayerDelete(uint64 guid)
|
||||
void ScriptMgr::OnPlayerDelete(uint64 guid, uint32 accountId)
|
||||
{
|
||||
FOREACH_SCRIPT(PlayerScript)->OnDelete(guid);
|
||||
FOREACH_SCRIPT(PlayerScript)->OnDelete(guid, accountId);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnPlayerFailedDelete(uint64 guid, uint32 accountId)
|
||||
{
|
||||
FOREACH_SCRIPT(PlayerScript)->OnFailedDelete(guid, accountId);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnPlayerSave(Player* player)
|
||||
@@ -1277,6 +1283,37 @@ void ScriptMgr::OnPlayerUpdateZone(Player* player, uint32 newZone, uint32 newAre
|
||||
FOREACH_SCRIPT(PlayerScript)->OnUpdateZone(player, newZone, newArea);
|
||||
}
|
||||
|
||||
// Account
|
||||
void ScriptMgr::OnAccountLogin(uint32 accountId)
|
||||
{
|
||||
FOREACH_SCRIPT(AccountScript)->OnAccountLogin(accountId);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnFailedAccountLogin(uint32 accountId)
|
||||
{
|
||||
FOREACH_SCRIPT(AccountScript)->OnFailedAccountLogin(accountId);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnEmailChange(uint32 accountId)
|
||||
{
|
||||
FOREACH_SCRIPT(AccountScript)->OnEmailChange(accountId);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnFailedEmailChange(uint32 accountId)
|
||||
{
|
||||
FOREACH_SCRIPT(AccountScript)->OnFailedEmailChange(accountId);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnPasswordChange(uint32 accountId)
|
||||
{
|
||||
FOREACH_SCRIPT(AccountScript)->OnPasswordChange(accountId);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnFailedPasswordChange(uint32 accountId)
|
||||
{
|
||||
FOREACH_SCRIPT(AccountScript)->OnFailedPasswordChange(accountId);
|
||||
}
|
||||
|
||||
// Guild
|
||||
void ScriptMgr::OnGuildAddMember(Guild* guild, Player* player, uint8& plRank)
|
||||
{
|
||||
@@ -1539,6 +1576,12 @@ PlayerScript::PlayerScript(const char* name)
|
||||
ScriptRegistry<PlayerScript>::AddScript(this);
|
||||
}
|
||||
|
||||
AccountScript::AccountScript(const char* name)
|
||||
: ScriptObject(name)
|
||||
{
|
||||
ScriptRegistry<AccountScript>::AddScript(this);
|
||||
}
|
||||
|
||||
GuildScript::GuildScript(const char* name)
|
||||
: ScriptObject(name)
|
||||
{
|
||||
@@ -1581,6 +1624,7 @@ template class ScriptRegistry<PlayerScript>;
|
||||
template class ScriptRegistry<GuildScript>;
|
||||
template class ScriptRegistry<GroupScript>;
|
||||
template class ScriptRegistry<UnitScript>;
|
||||
template class ScriptRegistry<AccountScript>;
|
||||
|
||||
// Undefine utility macros.
|
||||
#undef GET_SCRIPT_RET
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "World.h"
|
||||
#include "Weather.h"
|
||||
|
||||
class AccountMgr;
|
||||
class AuctionHouseObject;
|
||||
class AuraScript;
|
||||
class Battleground;
|
||||
@@ -753,7 +754,10 @@ class PlayerScript : public UnitScript
|
||||
virtual void OnCreate(Player* /*player*/) { }
|
||||
|
||||
// Called when a player is deleted.
|
||||
virtual void OnDelete(uint64 /*guid*/) { }
|
||||
virtual void OnDelete(uint64 /*guid*/, uint32 /*accountId*/) { }
|
||||
|
||||
// Called when a player delete failed
|
||||
virtual void OnFailedDelete(uint64 /*guid*/, uint32 /*accountId*/) { }
|
||||
|
||||
// Called when a player is about to be saved.
|
||||
virtual void OnSave(Player* /*player*/) { }
|
||||
@@ -768,6 +772,33 @@ class PlayerScript : public UnitScript
|
||||
virtual void OnMapChanged(Player* /*player*/) { }
|
||||
};
|
||||
|
||||
class AccountScript : public ScriptObject
|
||||
{
|
||||
protected:
|
||||
|
||||
AccountScript(const char* name);
|
||||
|
||||
public:
|
||||
|
||||
// Called when an account logged in succesfully
|
||||
virtual void OnAccountLogin(uint32 accountId) {}
|
||||
|
||||
// Called when an account login failed
|
||||
virtual void OnFailedAccountLogin(uint32 accountId) {}
|
||||
|
||||
// Called when Email is successfully changed for Account
|
||||
virtual void OnEmailChange(uint32 accountId) {}
|
||||
|
||||
// Called when Email failed to change for Account
|
||||
virtual void OnFailedEmailChange(uint32 accountId) {}
|
||||
|
||||
// Called when Password is successfully changed for Account
|
||||
virtual void OnPasswordChange(uint32 accountId) {}
|
||||
|
||||
// Called when Password failed to change for Account
|
||||
virtual void OnFailedPasswordChange(uint32 accountId) {}
|
||||
};
|
||||
|
||||
class GuildScript : public ScriptObject
|
||||
{
|
||||
protected:
|
||||
@@ -1037,11 +1068,21 @@ class ScriptMgr
|
||||
void OnPlayerLogin(Player* player, bool firstLogin);
|
||||
void OnPlayerLogout(Player* player);
|
||||
void OnPlayerCreate(Player* player);
|
||||
void OnPlayerDelete(uint64 guid);
|
||||
void OnPlayerDelete(uint64 guid, uint32 accountId);
|
||||
void OnPlayerFailedDelete(uint64 guid, uint32 accountId);
|
||||
void OnPlayerSave(Player* player);
|
||||
void OnPlayerBindToInstance(Player* player, Difficulty difficulty, uint32 mapid, bool permanent);
|
||||
void OnPlayerUpdateZone(Player* player, uint32 newZone, uint32 newArea);
|
||||
|
||||
public: /* AccountScript */
|
||||
|
||||
void OnAccountLogin(uint32 accountId);
|
||||
void OnFailedAccountLogin(uint32 accountId);
|
||||
void OnEmailChange(uint32 accountId);
|
||||
void OnFailedEmailChange(uint32 accountId);
|
||||
void OnPasswordChange(uint32 accountId);
|
||||
void OnFailedPasswordChange(uint32 accountId);
|
||||
|
||||
public: /* GuildScript */
|
||||
|
||||
void OnGuildAddMember(Guild* guild, Player* player, uint8& plRank);
|
||||
|
||||
Reference in new issue
Block a user