aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/World
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/scripts/World')
-rw-r--r--src/server/scripts/World/action_ip_logger.cpp46
1 files changed, 28 insertions, 18 deletions
diff --git a/src/server/scripts/World/action_ip_logger.cpp b/src/server/scripts/World/action_ip_logger.cpp
index 85c404e873d..f8b45b51b73 100644
--- a/src/server/scripts/World/action_ip_logger.cpp
+++ b/src/server/scripts/World/action_ip_logger.cpp
@@ -18,6 +18,8 @@
#include "ScriptMgr.h"
#include "DatabaseEnv.h"
#include "Player.h"
+#include "Realm.h"
+#include "World.h"
#include "WorldSession.h"
enum IPLoggingTypes
@@ -95,6 +97,7 @@ class AccountActionIpLogger : public AccountScript
// We declare all the required variables
uint32 playerGuid = accountId;
+ uint32 realmId = realm.Id.Realm;
std::string systemNote = "ERROR"; // "ERROR" is a placeholder here. We change it later.
// With this switch, we change systemNote so that we have a more accurate phrasing of what type it is.
@@ -139,10 +142,11 @@ class AccountActionIpLogger : public AccountScript
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_ALDL_IP_LOGGING);
stmt->setUInt32(0, playerGuid);
- stmt->setUInt32(1, 0);
- stmt->setUInt8(2, aType);
- stmt->setUInt32(3, playerGuid);
- stmt->setString(4, systemNote);
+ stmt->setUInt64(1, 0);
+ stmt->setUInt32(2, realmId);
+ stmt->setUInt8(3, aType);
+ stmt->setUInt32(4, playerGuid);
+ stmt->setString(5, systemNote);
LoginDatabase.Execute(stmt);
}
else // ... but for failed login, we query last_attempt_ip from account table. Which we do with an unique query
@@ -150,10 +154,11 @@ class AccountActionIpLogger : public AccountScript
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_FACL_IP_LOGGING);
stmt->setUInt32(0, playerGuid);
- stmt->setUInt32(1, 0);
- stmt->setUInt8(2, aType);
- stmt->setUInt32(3, playerGuid);
- stmt->setString(4, systemNote);
+ stmt->setUInt64(1, 0);
+ stmt->setUInt32(2, realmId);
+ stmt->setUInt8(3, aType);
+ stmt->setUInt32(4, playerGuid);
+ stmt->setString(5, systemNote);
LoginDatabase.Execute(stmt);
}
return;
@@ -199,6 +204,7 @@ class CharacterActionIpLogger : public PlayerScript
// We declare all the required variables
uint32 playerGuid = player->GetSession()->GetAccountId();
+ uint32 realmId = realm.Id.Realm;
const std::string currentIp = player->GetSession()->GetRemoteAddress();
std::string systemNote = "ERROR"; // "ERROR" is a placeholder here. We change it...
@@ -232,9 +238,10 @@ class CharacterActionIpLogger : public PlayerScript
stmt->setUInt32(0, playerGuid);
stmt->setUInt64(1, player->GetGUID().GetCounter());
- stmt->setUInt8(2, aType);
- stmt->setString(3, currentIp); // We query the ip here.
- stmt->setString(4, systemNote);
+ stmt->setUInt32(2, realmId);
+ stmt->setUInt8(3, aType);
+ stmt->setString(4, currentIp); // We query the ip here.
+ stmt->setString(5, systemNote);
// Seeing as the time differences should be minimal, we do not get unixtime and the timestamp right now;
// Rather, we let it be added with the SQL query.
@@ -265,6 +272,7 @@ public:
// Action IP Logger is only intialized if config is set up
// Else, this script isn't loaded in the first place: We require no config check.
+ uint32 realmId = realm.Id.Realm;
// Query playerGuid/accountId, as we only have characterGuid
std::string systemNote = "ERROR"; // "ERROR" is a placeholder here. We change it later.
@@ -286,17 +294,19 @@ public:
}
// Once we have done everything, we can insert the new log.
- LoginDatabasePreparedStatement* stmt2 = LoginDatabase.GetPreparedStatement(LOGIN_INS_ALDL_IP_LOGGING);
+ LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_ALDL_IP_LOGGING);
+
+ stmt->setUInt32(0, playerGuid);
+ stmt->setUInt64(1, guid.GetCounter());
+ stmt->setUInt32(2, realmId);
+ stmt->setUInt8(3, aType);
+ stmt->setUInt32(4, playerGuid);
+ stmt->setString(5, systemNote);
- stmt2->setUInt32(0, playerGuid);
- stmt2->setUInt64(1, guid.GetCounter());
- stmt2->setUInt8(2, aType);
- stmt2->setUInt32(3, playerGuid);
- stmt2->setString(4, systemNote);
// Seeing as the time differences should be minimal, we do not get unixtime and the timestamp right now;
// Rather, we let it be added with the SQL query.
- LoginDatabase.Execute(stmt2);
+ LoginDatabase.Execute(stmt);
return;
}
};