TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
CharacterActionIpLogger Class Reference

Public Member Functions

 CharacterActionIpLogger ()
 
void OnCreate (Player *player) override
 
void OnLogin (Player *player, bool) override
 
void OnLogout (Player *player) override
 
void CharacterIPLogAction (Player *player, IPLoggingTypes aType)
 Logs a number of actions done by players with an IP. More...
 
- Public Member Functions inherited from PlayerScript
virtual void OnPVPKill (Player *, Player *)
 
virtual void OnCreatureKill (Player *, Creature *)
 
virtual void OnPlayerKilledByCreature (Creature *, Player *)
 
virtual void OnLevelChanged (Player *, uint8)
 
virtual void OnFreeTalentPointsChanged (Player *, uint32)
 
virtual void OnTalentsReset (Player *, bool)
 
virtual void OnMoneyChanged (Player *, int64 &)
 
virtual void OnMoneyLimit (Player *, int64)
 
virtual void OnGiveXP (Player *, uint32 &, Unit *)
 
virtual void OnReputationChange (Player *, uint32, int32 &, bool)
 
virtual void OnDuelRequest (Player *, Player *)
 
virtual void OnDuelStart (Player *, Player *)
 
virtual void OnDuelEnd (Player *, Player *, DuelCompleteType)
 
virtual void OnChat (Player *, uint32, uint32, std::string &)
 
virtual void OnChat (Player *, uint32, uint32, std::string &, Player *)
 
virtual void OnChat (Player *, uint32, uint32, std::string &, Group *)
 
virtual void OnChat (Player *, uint32, uint32, std::string &, Guild *)
 
virtual void OnChat (Player *, uint32, uint32, std::string &, Channel *)
 
virtual void OnClearEmote (Player *)
 
virtual void OnTextEmote (Player *, uint32, uint32, ObjectGuid)
 
virtual void OnSpellCast (Player *, Spell *, bool)
 
virtual void OnDelete (ObjectGuid, uint32)
 
virtual void OnFailedDelete (ObjectGuid, uint32)
 
virtual void OnSave (Player *)
 
virtual void OnBindToInstance (Player *, Difficulty, uint32, bool, uint8)
 
virtual void OnUpdateZone (Player *, uint32, uint32)
 
virtual void OnMapChanged (Player *)
 
virtual void OnQuestStatusChange (Player *, uint32, QuestStatus)
 
- Public Member Functions inherited from UnitScript
virtual void OnHeal (Unit *, Unit *, uint32 &)
 
virtual void OnDamage (Unit *, Unit *, uint32 &)
 
virtual void ModifyPeriodicDamageAurasTick (Unit *, Unit *, uint32 &)
 
virtual void ModifyMeleeDamage (Unit *, Unit *, uint32 &)
 
virtual void ModifySpellDamageTaken (Unit *, Unit *, int32 &)
 
- Public Member Functions inherited from ScriptObject
const std::string & GetName () const
 

Additional Inherited Members

- Protected Member Functions inherited from PlayerScript
 PlayerScript (const char *name)
 
- Protected Member Functions inherited from UnitScript
 UnitScript (const char *name, bool addToScripts=true)
 
- Protected Member Functions inherited from ScriptObject
 ScriptObject (const char *name)
 
virtual ~ScriptObject ()
 

Constructor & Destructor Documentation

CharacterActionIpLogger::CharacterActionIpLogger ( )
inline
164 : PlayerScript("CharacterActionIpLogger") { }
PlayerScript(const char *name)
Definition: ScriptMgr.cpp:1664

Member Function Documentation

void CharacterActionIpLogger::CharacterIPLogAction ( Player player,
IPLoggingTypes  aType 
)
inline

Logs a number of actions done by players with an IP.

194  {
195  // Action IP Logger is only intialized if config is set up
196  // Else, this script isn't loaded in the first place: We require no config check.
197 
198  // We declare all the required variables
199  uint32 playerGuid = player->GetSession()->GetAccountId();
200  const std::string currentIp = player->GetSession()->GetRemoteAddress();
201  std::string systemNote = "ERROR"; // "ERROR" is a placeholder here. We change it...
202 
203  // ... with this switch, so that we have a more accurate phrasing of what type it is
204  switch (aType)
205  {
206  case CHARACTER_CREATE:
207  systemNote = "Logged on CharacterCreate";
208  break;
209  case CHARACTER_LOGIN:
210  systemNote = "Logged on CharacterLogin";
211  break;
212  case CHARACTER_LOGOUT:
213  systemNote = "Logged on CharacterLogout";
214  break;
215  case CHARACTER_DELETE:
216  systemNote = "Logged on CharacterDelete";
217  break;
219  systemNote = "Logged on Failed CharacterDelete";
220  break;
221  // Neither should happen. Ever. Period. If it does, call Mythbusters.
222  case UNKNOWN_ACTION:
223  default:
224  systemNote = "ERROR! Unknown action!";
225  break;
226  }
227 
228  // Once we have done everything, we can insert the new log.
230 
231  stmt->setUInt32(0, playerGuid);
232  stmt->setUInt64(1, player->GetGUID().GetCounter());
233  stmt->setUInt8(2, aType);
234  stmt->setString(3, currentIp.c_str()); // We query the ip here.
235  stmt->setString(4, systemNote.c_str());
236  // Seeing as the time differences should be minimal, we do not get unixtime and the timestamp right now;
237  // Rather, we let it be added with the SQL query.
238 
239  LoginDatabase.Execute(stmt);
240  return;
241  }
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
void setUInt8(const uint8 index, const uint8 value)
Definition: PreparedStatement.cpp:97
void setString(const uint8 index, const std::string &value)
Definition: PreparedStatement.cpp:187
Definition: action_ip_logger.cpp:32
Definition: PreparedStatement.h:74
LoginDatabaseWorkerPool LoginDatabase
Accessor to the realm/login database.
Definition: DatabaseEnv.cpp:22
Definition: action_ip_logger.cpp:39
Definition: action_ip_logger.cpp:37
uint32_t uint32
Definition: Define.h:150
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
Definition: action_ip_logger.cpp:36
Definition: LoginDatabase.h:102
Definition: action_ip_logger.cpp:33
Definition: action_ip_logger.cpp:34

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void CharacterActionIpLogger::OnCreate ( Player player)
inlineoverridevirtual

Reimplemented from PlayerScript.

168  {
170  }
Definition: action_ip_logger.cpp:32
void CharacterIPLogAction(Player *player, IPLoggingTypes aType)
Logs a number of actions done by players with an IP.
Definition: action_ip_logger.cpp:193

+ Here is the call graph for this function:

void CharacterActionIpLogger::OnLogin ( Player player,
bool   
)
inlineoverridevirtual

Reimplemented from PlayerScript.

174  {
176  }
void CharacterIPLogAction(Player *player, IPLoggingTypes aType)
Logs a number of actions done by players with an IP.
Definition: action_ip_logger.cpp:193
Definition: action_ip_logger.cpp:33

+ Here is the call graph for this function:

void CharacterActionIpLogger::OnLogout ( Player player)
inlineoverridevirtual

Reimplemented from PlayerScript.

180  {
182  }
void CharacterIPLogAction(Player *player, IPLoggingTypes aType)
Logs a number of actions done by players with an IP.
Definition: action_ip_logger.cpp:193
Definition: action_ip_logger.cpp:34

+ Here is the call graph for this function:


The documentation for this class was generated from the following file: