* added some error handling

* chat msg formatting updates
* misc stuff
This commit is contained in:
False.Genesis 2007-02-14 16:01:32 +00:00
parent f4148cefc1
commit 2d90dc3cfe
10 changed files with 88 additions and 9 deletions

View File

@ -27,6 +27,7 @@ showopcodes=3
// Hide opcodes which is coming very frequently? // Hide opcodes which is coming very frequently?
// Has only an effect if you have showopcodes > 0
// 1 - yes // 1 - yes
// 0 - No // 0 - No
hidefreqopcodes=1 hidefreqopcodes=1
@ -74,7 +75,10 @@ enablecli=1
// like "Hi" and "What do you think of x" etc. // like "Hi" and "What do you think of x" etc.
enablechatai=1 enablechatai=1
// show ping responses & ping time // show ping responses
notifyping=1 notifyping=1
// shows the opcodes pseuwow sends to the server
showmyopcodes=0

View File

@ -196,7 +196,15 @@ void PseuInstance::Update()
} }
if(_wsession && _wsession->IsValid()) if(_wsession && _wsession->IsValid())
{ {
_wsession->Update(); // update the worldSESSION, which will update the worldsocket itself try
{
_wsession->Update(); // update the worldSESSION, which will update the worldsocket itself
}
catch (...)
{
logerror("Unhandled exception in WorldSession::Update()");
}
} }
if(_wsession && _wsession->DeleteMe()) if(_wsession && _wsession->DeleteMe())
{ {

View File

@ -409,9 +409,6 @@ public:
private: private:
uint8 _slot; uint8 _slot;
// Bag *_bag; // not yet implemented // Bag *_bag; // not yet implemented
// ItemProto *_proto; // not yet implemented.
// is it good to use a proto here?
}; };

View File

@ -25,6 +25,7 @@ void Object::_InitValues()
void Object::_Create( uint64 guid ) void Object::_Create( uint64 guid )
{ {
//ASSERT(_valuescount > 0);
if(!_uint32values) if(!_uint32values)
_InitValues(); _InitValues();
@ -48,6 +49,20 @@ void WorldObject::SetPosition(float x, float y, float z, float o, uint16 _map)
_o = o; _o = o;
_m = _map; _m = _map;
} }
/*
void WorldObject::_Create( uint64 guid, uint32 mapid, float x, float y, float z, float ang, uint32 entry )
{
Object::_Create(guid);
SetUInt32Value( OBJECT_FIELD_ENTRY,entry);
_m = mapid;
_x = x;
_y = y;
_z = z;
_o = ang;
}
*/
void WorldSession::_HandleDestroyObjectOpcode(WorldPacket& recvPacket) void WorldSession::_HandleDestroyObjectOpcode(WorldPacket& recvPacket)
{ {

View File

@ -34,6 +34,7 @@ enum TYPEID
class Object class Object
{ {
public: public:
Object();
virtual ~Object(); virtual ~Object();
inline const uint64 GetGUID() const { return GetUInt64Value(0); } inline const uint64 GetGUID() const { return GetUInt64Value(0); }
inline const uint32 GetGUIDLow() const { return GetUInt32Value(0); } inline const uint32 GetGUIDLow() const { return GetUInt32Value(0); }
@ -71,7 +72,6 @@ public:
} }
protected: protected:
Object();
void _Create(uint64 guid); void _Create(uint64 guid);
void _InitValues(void); void _InitValues(void);

View File

@ -0,0 +1,9 @@
#include "common.h"
#include "Unit.h"
Unit::Unit() : WorldObject()
{
_type = TYPE_UNIT;
_typeid = TYPEID_UNIT;
}

15
src/Client/World/Unit.h Normal file
View File

@ -0,0 +1,15 @@
#ifndef _UNIT_H
#define _UNIT_H
#include "Object.h"
class Unit : public WorldObject
{
public:
Unit();
private:
};
#endif

View File

@ -118,6 +118,9 @@ void WorldSession::_HandleUpdateObjectOpcode(WorldPacket& recvPacket)
uint8 objtypeid, flags; uint8 objtypeid, flags;
recvPacket >> objtypeid >> flags; recvPacket >> objtypeid >> flags;
logdebug("Create Object type %u with guid "I64FMT,objtypeid,uguid); logdebug("Create Object type %u with guid "I64FMT,objtypeid,uguid);
//Object *obj = new Object;
//obj->_Create(uguid);
//objmgr.Add((Object*)obj);
this->_MovementUpdate(objtypeid, uguid, recvPacket); // i think thats the wrong place for this [FG] this->_MovementUpdate(objtypeid, uguid, recvPacket); // i think thats the wrong place for this [FG]
// Double checked - seems right - if i really am wrong, please correct [Mini] // Double checked - seems right - if i really am wrong, please correct [Mini]

View File

@ -107,7 +107,16 @@ void WorldSession::Update(void)
{ {
if (table[i].opcode == packet->GetOpcode()) if (table[i].opcode == packet->GetOpcode())
{ {
(this->*table[i].handler)(*packet); try
{
(this->*table[i].handler)(*packet);
}
catch (...)
{
logerror("Exception while handling opcode %u!",packet->GetOpcode());
logerror("Data: pktsize=%u, handler=0x%X queuesize=%u",packet->size(),table[i].handler,pktQueue.size());
}
known=true; known=true;
break; break;
} }
@ -129,6 +138,7 @@ void WorldSession::Update(void)
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;
known=false;
} }
_DoTimedActions(); _DoTimedActions();
@ -422,11 +432,23 @@ void WorldSession::_HandleMessageChatOpcode(WorldPacket& recvPacket)
} }
else if (type==CHAT_MSG_CHANNEL ) else if (type==CHAT_MSG_CHANNEL )
{ {
logcustom(0,WHITE,"CHANNEL [%s]: %s [%s]: %s",channel.c_str(),plrname.c_str(),LookupName(lang,langNames),msg.c_str()); logcustom(0,WHITE,"CHANNEL: [%s]: %s [%s]: %s",channel.c_str(),plrname.c_str(),LookupName(lang,langNames),msg.c_str());
}
else if (type==CHAT_MSG_SAY )
{
logcustom(0,WHITE,"CHAT: %s [%s]: %s",plrname.c_str(),LookupName(lang,langNames),msg.c_str());
}
else if (type==CHAT_MSG_YELL )
{
logcustom(0,WHITE,"CHAT: %s yells [%s]: %s ",plrname.c_str(),LookupName(lang,langNames),msg.c_str());
}
else if (type==CHAT_MSG_WHISPER_INFORM )
{
logcustom(0,WHITE,"TO %s [%s]: %s",plrname.c_str(),LookupName(lang,langNames),msg.c_str());
} }
else else
{ {
logcustom(0,WHITE,"CHAT: %s [%s]: %s",plrname.c_str(),LookupName(lang,langNames),msg.c_str()); logcustom(0,WHITE,"UNK CHAT TYPE (%u): %s [%s]: %s",type,plrname.c_str(),LookupName(lang,langNames),msg.c_str());
} }
if(target_guid!=_myGUID && msg.length()>1 && msg.at(0)=='-' && GetInstance()->GetConf()->allowgamecmd) if(target_guid!=_myGUID && msg.length()>1 && msg.at(0)=='-' && GetInstance()->GetConf()->allowgamecmd)

View File

@ -308,6 +308,12 @@
<File <File
RelativePath=".\Client\World\SharedDefines.h"> RelativePath=".\Client\World\SharedDefines.h">
</File> </File>
<File
RelativePath=".\Client\World\Unit.cpp">
</File>
<File
RelativePath=".\Client\World\Unit.h">
</File>
<File <File
RelativePath=".\Client\World\UpdateData.cpp"> RelativePath=".\Client\World\UpdateData.cpp">
</File> </File>