- Added new config option: hidefreqopcodes which hides annoying opcodes which gets sent all the time

- Additionaly i added some more stuff for handling the update packet
This commit is contained in:
Mini 2007-02-07 21:03:49 +00:00
parent 3d461e5981
commit 4aa6911563
6 changed files with 157 additions and 72 deletions

View File

@ -26,6 +26,12 @@ reconnect=0
showopcodes=3
// Hide opcodes which is coming very frequently?
// 1 - yes
// 0 - No
hidefreqopcodes=1
// the IP or hostname the wow server is running on
realmlist=localhost

View File

@ -248,6 +248,7 @@ void PseuInstanceConf::ApplyFromVarSet(VarSet &v)
charname=v.Get("CHARNAME");
networksleeptime=atoi(v.Get("NETWORKSLEEPTIME").c_str());
showopcodes=atoi(v.Get("SHOWOPCODES").c_str());
hidefreqopcodes=(bool)atoi(v.Get("HIDEFREQOPCODES").c_str());
enablecli=(bool)atoi(v.Get("ENABLECLI").c_str());
allowgamecmd=(bool)atoi(v.Get("ALLOWGAMECMD").c_str());
enablechatai=(bool)atoi(v.Get("ENABLECHATAI").c_str());

View File

@ -40,6 +40,7 @@ class PseuInstanceConf
std::string worldhost;
uint16 networksleeptime;
uint8 showopcodes;
bool hidefreqopcodes;
bool allowgamecmd;
bool enablecli;
bool enablechatai;

View File

@ -32,32 +32,22 @@ void WorldSession::_HandleCompressedUpdateObjectOpcode(WorldPacket& recvPacket)
void WorldSession::_HandleUpdateObjectOpcode(WorldPacket& recvPacket)
{
//recvPacket.hexlike();
uint8 utype;
uint8 unk8;
uint32 usize, ublocks;
uint64 uguid;
recvPacket >> ublocks >> unk8;
logdebug("UpdateObject: ublocks=%u unk=%u",ublocks,unk8);
//while(true) // need to read full packet as soon as the structure is 100% known & implemented
// for now reading first object is enough
{
recvPacket >> utype;
logdebug("UpdateObject: utype=%u",utype);
switch(utype)
{
case UPDATETYPE_OUT_OF_RANGE_OBJECTS:
recvPacket >> usize;
for(uint16 i=0;i<usize;i++)
{
uguid = recvPacket.GetPackedGuid(); // not 100% sure if this is correct
logdebug("GUID "I64FMT" out of range",uguid);
// TODO: delete object from known objects list
}
break;
case UPDATETYPE_VALUES:
{
//recvPacket.hexlike();
uint8 utype;
uint8 unk8;
uint32 usize, ublocks;
uint64 uguid;
recvPacket >> ublocks >> unk8;
logdebug("UpdateObject: ublocks=%u unk=%u",ublocks,unk8);
//while(true) // need to read full packet as soon as the structure is 100% known & implemented
// for now reading first object is enough
{
recvPacket >> utype;
logdebug("UpdateObject: utype=%u",utype);
switch(utype)
{
case UPDATETYPE_VALUES:
{
uint8 blockcount, masksize, valuesCount = 1500;
uint32 value;
uguid = recvPacket.GetPackedGuid();
@ -76,40 +66,115 @@ void WorldSession::_HandleUpdateObjectOpcode(WorldPacket& recvPacket)
if (umask.GetBit(i))
{
recvPacket >> value;
logdebug("Value (%d): %d", i, value);
//logdebug("Value (%d): %d", i, value);
}
}
}
break;
}
break;
case UPDATETYPE_CREATE_OBJECT:
case UPDATETYPE_CREATE_OBJECT2:
{
uguid = recvPacket.GetPackedGuid();
uint8 objtypeid;
recvPacket >> objtypeid;
logdebug("Create Object type %u with guid "I64FMT,objtypeid,uguid);
if(objtypeid==TYPEID_PLAYER)
{
case UPDATETYPE_MOVEMENT:
{
//this->_MovementUpdate(objtypeid, recvPacket);
// TODO: Get objtypeid from objmgr
}
break;
}
if(objtypeid==TYPEID_UNIT)
{
case UPDATETYPE_CREATE_OBJECT:
case UPDATETYPE_CREATE_OBJECT2:
{
uguid = recvPacket.GetPackedGuid();
uint8 objtypeid, flags;
recvPacket >> objtypeid >> flags;
logdebug("Create Object type %u with guid "I64FMT,objtypeid,uguid);
}
if( (objtypeid==TYPEID_CORPSE) || (objtypeid==TYPEID_GAMEOBJECT) || (objtypeid==TYPEID_DYNAMICOBJECT))
{
this->_MovementUpdate(objtypeid, recvPacket);
}
// (TODO) and then: Add object to objmgr
}
break;
// (TODO) and then: Add object to objmgr
}
break;
case UPDATETYPE_OUT_OF_RANGE_OBJECTS:
recvPacket >> usize;
for(uint16 i=0;i<usize;i++)
{
uguid = recvPacket.GetPackedGuid(); // not 100% sure if this is correct
logdebug("GUID "I64FMT" out of range",uguid);
// TODO: delete object from known objects list
}
break;
default:
break;
}
}
default:
break;
}
}
}
void WorldSession::_MovementUpdate(uint8 objtypeid, WorldPacket& recvPacket)
{
if(objtypeid==TYPEID_PLAYER)
{
uint32 flags2, time;
uint64 tguid;
float nul;
float x, y, z, o;
float tx, ty, tz, to;
float speedWalk, speedRun, speedSwimBack, speedSwim, speedWalkBack, speedTurn;
recvPacket >> flags2 >> time;
if (flags2 & 0x02000000) // On a transport
{
recvPacket >> x >> y >> z >> o >> tguid >> tx >> ty >> tz >> to;
}
else
{
recvPacket >> x >> y >> z >> o;
}
recvPacket >> nul;
if(flags2 & 0x2000) // Self update
{
// What is this data used for?
recvPacket << nul;
recvPacket << nul;
recvPacket << nul;
recvPacket << nul;
}
recvPacket >> speedWalk >> speedRun >> speedSwimBack >> speedSwim >> speedWalkBack >> speedTurn;
logdebug("TYPEID_PLAYER: OnTransport=%s x=%d y=%d z=%d o=%d", flags2 & 0x02000000 ? "true" : "false", x, y, z, o);
}
if(objtypeid==TYPEID_UNIT)
{
uint32 flags2, unk, posCount;
float nul, unkf;
float x, y, z, o;
float speedWalk, speedRun, speedSwimBack, speedSwim, speedWalkBack, speedTurn;
recvPacket >> flags2 >> unk >> x >> y >> z >> o >> nul;
recvPacket >> speedWalk >> speedRun >> speedSwimBack >> speedSwim >> speedWalkBack >> speedTurn;
if (flags2 & 0x400000)
{
recvPacket >> unk >> unk >> unk >> unk >> posCount;
for (uint8 i = 0; i < posCount + 1; i++)
{
recvPacket >> unkf >> unkf >> unkf; // Some x, y, z value
}
}
logdebug("TYPEID_UNIT: 0x400000 flag=%s x=%d y=%d z=%d o=%d", flags2 & 0x400000 ? "true" : "false", x, y, z, o);
}
if( (objtypeid==TYPEID_CORPSE) || (objtypeid==TYPEID_GAMEOBJECT) || (objtypeid==TYPEID_DYNAMICOBJECT))
{
float x, y, z, o;
recvPacket >> x >> y >> z >> o;
// TODO: Check for transport and corpse extra data
}
}

View File

@ -99,27 +99,37 @@ void WorldSession::Update(void)
OpcodeHandler *table = _GetOpcodeHandlerTable();
bool known=false;
while(pktQueue.size())
{
WorldPacket *packet = pktQueue.next();
while(pktQueue.size())
{
WorldPacket *packet = pktQueue.next();
for (uint16 i = 0; table[i].handler != NULL; i++)
{
if (table[i].opcode == packet->GetOpcode())
{
(this->*table[i].handler)(*packet);
known=true;
break;
}
}
if( (known && GetInstance()->GetConf()->showopcodes==1)
|| ((!known) && GetInstance()->GetConf()->showopcodes==2)
|| (GetInstance()->GetConf()->showopcodes==3) )
{
for (uint16 i = 0; table[i].handler != NULL; i++)
{
if (table[i].opcode == packet->GetOpcode())
{
(this->*table[i].handler)(*packet);
known=true;
break;
}
}
bool hideOpcode = false;
// TODO: Maybe make table or something with all the frequently opcodes
if (packet->GetOpcode() == SMSG_MONSTER_MOVE)
{
hideOpcode = true;
}
if( ( (known && GetInstance()->GetConf()->showopcodes==1)
|| ((!known) && GetInstance()->GetConf()->showopcodes==2)
|| (GetInstance()->GetConf()->showopcodes==3) )
&& (!GetInstance()->GetConf()->hidefreqopcodes || GetInstance()->GetConf()->hidefreqopcodes && !hideOpcode))
{
logcustom(1,YELLOW,">> Opcode %u [%s] (%s)", packet->GetOpcode(), LookupName(packet->GetOpcode(),g_worldOpcodeNames), known ? "Known" : "UNKNOWN");
}
delete packet;
}
}
delete packet;
}
_DoTimedActions();

View File

@ -91,6 +91,8 @@ private:
void _HandleItemQuerySingleResponseOpcode(WorldPacket& recvPacket);
void _HandleDestroyObjectOpcode(WorldPacket& recvPacket);
void _MovementUpdate(uint8 objtypeid, WorldPacket& recvPacket); // Helper for _HandleUpdateObjectOpcode
PseuInstance *_instance;
WorldSocket *_socket;
ZThread::LockedQueue<WorldPacket*,ZThread::FastMutex> pktQueue;