AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
WorldSessionFilter Class Reference

#include "WorldSession.h"

Inheritance diagram for WorldSessionFilter:
PacketFilter

Public Member Functions

 WorldSessionFilter (WorldSession *pSession)
 
 ~WorldSessionFilter () override=default
 
bool Process (WorldPacket *packet) override
 
- Public Member Functions inherited from PacketFilter
 PacketFilter (WorldSession *pSession)
 
virtual ~PacketFilter ()=default
 
virtual bool Process (WorldPacket *)
 
virtual bool ProcessUnsafe () const
 

Additional Inherited Members

- Protected Attributes inherited from PacketFilter
WorldSession *const m_pSession
 

Detailed Description

Constructor & Destructor Documentation

◆ WorldSessionFilter()

WorldSessionFilter::WorldSessionFilter ( WorldSession pSession)
inlineexplicit
259: PacketFilter(pSession) {}
Definition: WorldSession.h:231

◆ ~WorldSessionFilter()

WorldSessionFilter::~WorldSessionFilter ( )
overridedefault

Member Function Documentation

◆ Process()

bool WorldSessionFilter::Process ( WorldPacket packet)
overridevirtual

Reimplemented from PacketFilter.

85{
86 ClientOpcodeHandler const* opHandle = opcodeTable[static_cast<OpcodeClient>(packet->GetOpcode())];
87
88 //check if packet handler is supposed to be safe
89 if (opHandle->ProcessingPlace == PROCESS_INPLACE)
90 return true;
91
92 //thread-unsafe packets should be processed in World::UpdateSessions()
94 return true;
95
96 //no player attached? -> our client! ^^
97 Player* player = m_pSession->GetPlayer();
98 if (!player)
99 return true;
100
101 //lets process all packets for non-in-the-world player
102 return !player->IsInWorld();
103}
Opcodes
List of Opcodes.
Definition: Opcodes.h:30
OpcodeTable opcodeTable
Definition: Opcodes.cpp:51
PacketProcessing ProcessingPlace
Definition: Opcodes.h:1392
@ PROCESS_INPLACE
Definition: Opcodes.h:1366
@ PROCESS_THREADUNSAFE
Definition: Opcodes.h:1367
bool IsInWorld() const
Definition: Object.h:104
Definition: Player.h:1064
Definition: Opcodes.h:1385
uint16 GetOpcode() const
Definition: WorldPacket.h:76
WorldSession *const m_pSession
Definition: WorldSession.h:240
Player * GetPlayer() const
Definition: WorldSession.h:362

References WorldPacket::GetOpcode(), WorldSession::GetPlayer(), Object::IsInWorld(), PacketFilter::m_pSession, opcodeTable, PROCESS_INPLACE, PROCESS_THREADUNSAFE, and ClientOpcodeHandler::ProcessingPlace.