* added: auto-query player name on UPDATETYPE_CREATE_OBJECT
* added Object::_name to store object names faster & easier accessable. only players & items are added yet. * added a small check for headers < 4 bytes (this can MAYBE fix some problems/errors with crypt)
This commit is contained in:
parent
0d5e55fc67
commit
bc74818daa
@ -96,10 +96,13 @@ public:
|
||||
inline float GetY(void) { return _y; }
|
||||
inline float GetZ(void) { return _z; }
|
||||
inline float GetO(void) { return _o; }
|
||||
inline void SetName(std::string name) { _name = name; }
|
||||
inline std::string GetName(void) { return _name; }
|
||||
protected:
|
||||
WorldObject();
|
||||
float _x,_y,_z,_o; // coords, orientation
|
||||
uint16 _m; // map
|
||||
std::string _name;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -134,7 +134,7 @@ void WorldSession::_HandleUpdateObjectOpcode(WorldPacket& recvPacket)
|
||||
this->_MovementUpdate(objtypeid, uguid, recvPacket);
|
||||
this->_ValuesUpdate(uguid, recvPacket);
|
||||
|
||||
_QueryObjectProto(uguid);
|
||||
_QueryObjectInfo(uguid);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -282,7 +282,7 @@ void WorldSession::_ValuesUpdate(uint64 uguid, WorldPacket& recvPacket)
|
||||
|
||||
}
|
||||
|
||||
void WorldSession::_QueryObjectProto(uint64 guid)
|
||||
void WorldSession::_QueryObjectInfo(uint64 guid)
|
||||
{
|
||||
Object *obj = objmgr.GetObj(guid);
|
||||
if(obj)
|
||||
@ -299,6 +299,18 @@ void WorldSession::_QueryObjectProto(uint64 guid)
|
||||
SendQueryItem(obj->GetEntry(),obj->GetGUID()); // not sure if sending GUID is correct
|
||||
}
|
||||
}
|
||||
case TYPEID_PLAYER:
|
||||
{
|
||||
std::string name = plrNameCache.GetName(guid);
|
||||
if(name.empty())
|
||||
{
|
||||
SendQueryPlayerName(guid);
|
||||
}
|
||||
else
|
||||
{
|
||||
((WorldObject*)obj)->SetName(name);
|
||||
}
|
||||
}
|
||||
//case...
|
||||
}
|
||||
}
|
||||
|
||||
@ -546,6 +546,9 @@ void WorldSession::_HandleNameQueryResponseOpcode(WorldPacket& recvPacket)
|
||||
if(GetInstance()->GetConf()->debug > 1)
|
||||
SendChatMessage(CHAT_MSG_SAY,0,"Player "+pname+" added to cache.","");
|
||||
}
|
||||
WorldObject *wo = (WorldObject*)objmgr.GetObj(pguid);
|
||||
if(wo)
|
||||
wo->SetName(pname);
|
||||
}
|
||||
|
||||
void WorldSession::_HandlePongOpcode(WorldPacket& recvPacket)
|
||||
|
||||
@ -95,7 +95,7 @@ private:
|
||||
|
||||
void _MovementUpdate(uint8 objtypeid, uint64 guid, WorldPacket& recvPacket); // Helper for _HandleUpdateObjectOpcode
|
||||
void _ValuesUpdate(uint64 uguid, WorldPacket& recvPacket); // ...
|
||||
void _QueryObjectProto(uint64 guid);
|
||||
void _QueryObjectInfo(uint64 guid);
|
||||
|
||||
PseuInstance *_instance;
|
||||
WorldSocket *_socket;
|
||||
|
||||
@ -42,6 +42,12 @@ void WorldSocket::OnRead()
|
||||
this->CloseAndDelete();
|
||||
return;
|
||||
}
|
||||
// a valid header needs to have at least 4 bytes
|
||||
if(len < 4 && (!_gothdr))
|
||||
{
|
||||
logerror("WorldSocket::OnRead(): Got %u bytes (header too small) - waiting for more data",len);
|
||||
return;
|
||||
}
|
||||
|
||||
uint8 *buf=new uint8[len];
|
||||
ibuf.Read((char*)buf,len);
|
||||
@ -76,7 +82,7 @@ void WorldSocket::OnRead()
|
||||
// if the crypt gets messy its hardly possible to recover it, especially if we dont know
|
||||
// the lentgh of the following data part
|
||||
// TODO: invent some way how to recover the crypt (reconnect?)
|
||||
delete [] buf; // drop the current queue content
|
||||
delete buf; // drop the current queue content
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user