- 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 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 // the IP or hostname the wow server is running on
realmlist=localhost realmlist=localhost

View File

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

View File

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

View File

@ -32,32 +32,22 @@ void WorldSession::_HandleCompressedUpdateObjectOpcode(WorldPacket& recvPacket)
void WorldSession::_HandleUpdateObjectOpcode(WorldPacket& recvPacket) void WorldSession::_HandleUpdateObjectOpcode(WorldPacket& recvPacket)
{ {
//recvPacket.hexlike(); //recvPacket.hexlike();
uint8 utype; uint8 utype;
uint8 unk8; uint8 unk8;
uint32 usize, ublocks; uint32 usize, ublocks;
uint64 uguid; uint64 uguid;
recvPacket >> ublocks >> unk8; recvPacket >> ublocks >> unk8;
logdebug("UpdateObject: ublocks=%u unk=%u",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 //while(true) // need to read full packet as soon as the structure is 100% known & implemented
// for now reading first object is enough // for now reading first object is enough
{ {
recvPacket >> utype; recvPacket >> utype;
logdebug("UpdateObject: utype=%u",utype); logdebug("UpdateObject: utype=%u",utype);
switch(utype) switch(utype)
{ {
case UPDATETYPE_OUT_OF_RANGE_OBJECTS: case UPDATETYPE_VALUES:
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:
{
uint8 blockcount, masksize, valuesCount = 1500; uint8 blockcount, masksize, valuesCount = 1500;
uint32 value; uint32 value;
uguid = recvPacket.GetPackedGuid(); uguid = recvPacket.GetPackedGuid();
@ -76,40 +66,115 @@ void WorldSession::_HandleUpdateObjectOpcode(WorldPacket& recvPacket)
if (umask.GetBit(i)) if (umask.GetBit(i))
{ {
recvPacket >> value; recvPacket >> value;
logdebug("Value (%d): %d", i, value); //logdebug("Value (%d): %d", i, value);
} }
} }
} }
break; break;
case UPDATETYPE_CREATE_OBJECT: case UPDATETYPE_MOVEMENT:
case UPDATETYPE_CREATE_OBJECT2: {
{ //this->_MovementUpdate(objtypeid, recvPacket);
uguid = recvPacket.GetPackedGuid(); // TODO: Get objtypeid from objmgr
uint8 objtypeid; }
recvPacket >> objtypeid; break;
logdebug("Create Object type %u with guid "I64FMT,objtypeid,uguid);
if(objtypeid==TYPEID_PLAYER)
{
} case UPDATETYPE_CREATE_OBJECT:
if(objtypeid==TYPEID_UNIT) case UPDATETYPE_CREATE_OBJECT2:
{ {
uguid = recvPacket.GetPackedGuid();
uint8 objtypeid, flags;
recvPacket >> objtypeid >> flags;
logdebug("Create Object type %u with guid "I64FMT,objtypeid,uguid);
} this->_MovementUpdate(objtypeid, recvPacket);
if( (objtypeid==TYPEID_CORPSE) || (objtypeid==TYPEID_GAMEOBJECT) || (objtypeid==TYPEID_DYNAMICOBJECT))
{
} // (TODO) and then: Add object to objmgr
}
break;
// (TODO) and then: Add object to objmgr case UPDATETYPE_OUT_OF_RANGE_OBJECTS:
} recvPacket >> usize;
break; 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: void WorldSession::_MovementUpdate(uint8 objtypeid, WorldPacket& recvPacket)
break; {
} 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(); OpcodeHandler *table = _GetOpcodeHandlerTable();
bool known=false; bool known=false;
while(pktQueue.size()) while(pktQueue.size())
{ {
WorldPacket *packet = pktQueue.next(); WorldPacket *packet = pktQueue.next();
for (uint16 i = 0; table[i].handler != NULL; i++) for (uint16 i = 0; table[i].handler != NULL; i++)
{ {
if (table[i].opcode == packet->GetOpcode()) if (table[i].opcode == packet->GetOpcode())
{ {
(this->*table[i].handler)(*packet); (this->*table[i].handler)(*packet);
known=true; known=true;
break; break;
} }
} }
if( (known && GetInstance()->GetConf()->showopcodes==1)
|| ((!known) && GetInstance()->GetConf()->showopcodes==2) bool hideOpcode = false;
|| (GetInstance()->GetConf()->showopcodes==3) )
{ // 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"); logcustom(1,YELLOW,">> Opcode %u [%s] (%s)", packet->GetOpcode(), LookupName(packet->GetOpcode(),g_worldOpcodeNames), known ? "Known" : "UNKNOWN");
} }
delete packet; delete packet;
} }
_DoTimedActions(); _DoTimedActions();

View File

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