* fixed teleport bug, now the server is correctly notified that we reached the destination. ok, we are still floating in the air, but this is fine since there is no gravity yet.

* fixed Player & Unit _type mask setting
* added exception handler for loading ADT files, just to be on the safe side if anything is going wrong there
This commit is contained in:
false_genesis 2008-02-22 23:01:56 +00:00
parent 95fce570dd
commit a9893d2957
6 changed files with 52 additions and 21 deletions

View File

@ -351,7 +351,7 @@ DefReturnResult DefScriptPackage::func_bitxor(CmdSet& Set)
DefReturnResult DefScriptPackage::func_addevent(CmdSet& Set)
{
GetEventMgr()->Add(Set.arg[0],Set.defaultarg,(clock_t)toNumber(Set.arg[1]),Set.myname.c_str());
GetEventMgr()->Add(Set.arg[0],Set.defaultarg,(clock_t)toNumber(Set.arg[1]),Set.myname.c_str(),isTrue(Set.arg[2]));
return true;
}

View File

@ -326,7 +326,7 @@ DefReturnResult DefScriptPackage::SCtarget(CmdSet& Set)
}
Object *obj = ws->objmgr.GetObj(guid);
if(obj && obj->IsUnit() || obj->IsCorpse()) // only units and corpses are targetable
if(obj && (obj->IsUnit() || obj->IsCorpse())) // only units and corpses are targetable
{
ws->SendSetSelection(guid); // will also set the target for myCharacter
return toString(guid);

View File

@ -11,7 +11,7 @@
Player::Player() : Unit()
{
_type = TYPE_PLAYER;
_type |= TYPE_PLAYER;
_typeid = TYPEID_PLAYER;
_valuescount = PLAYER_END;
}

View File

@ -3,7 +3,7 @@
Unit::Unit() : WorldObject()
{
_type = TYPE_UNIT;
_type |= TYPE_UNIT;
_typeid = TYPEID_UNIT;
_valuescount = UNIT_END;
}

View File

@ -854,10 +854,10 @@ void WorldSession::_HandleTelePortAckOpcode(WorldPacket& recvPacket)
logdetail("Got teleported, data: x: %f, y: %f, z: %f, o: %f, guid: "I64FMT, x, y, z, o, guid);
// TODO: put this into a capsule class later, that autodetects movement flags etc.
WorldPacket response;
response.SetOpcode(MSG_MOVE_FALL_LAND);
response << uint32(0) << (uint32)getMSTime(); // no flags; time correct?
response << x << y << z << o << uint32(0);
WorldPacket response(MSG_MOVE_FALL_LAND,4+1+4+4+4+4+4+4);
response << uint32(0) << (uint8)0; // no flags; unk
response <<(uint32)getMSTime(); // time correct?
response << x << y << z << o << uint32(100); // simulate 100 msec fall time
SendWorldPacket(response);
_world->UpdatePos(x,y);
@ -891,6 +891,28 @@ void WorldSession::_HandleNewWorldOpcode(WorldPacket& recvPacket)
recvPacket >> mapid >> x >> y >> z >> o;
if(GetMyChar())
GetMyChar()->ClearSpells(); // will be resent by server
// when getting teleported, the client sends CMSG_CANCEL_TRADE 2 times.. dont ask me why.
WorldPacket wp(CMSG_CANCEL_TRADE,8);
SendWorldPacket(wp);
SendWorldPacket(wp);
wp.SetOpcode(MSG_MOVE_WORLDPORT_ACK);
SendWorldPacket(wp);
wp.SetOpcode(CMSG_SET_ACTIVE_MOVER);
wp << GetGuid();
SendWorldPacket(wp);
// TODO: put this into a capsule class later, that autodetects movement flags etc.
WorldPacket response(MSG_MOVE_FALL_LAND,4+1+4+4+4+4+4+4);
response << uint32(0) << (uint8)0; // no flags; unk
response <<(uint32)getMSTime(); // time correct?
response << x << y << z << o << uint32(100); // simulate 100 msec fall time
SendWorldPacket(response);
// TODO: clear action buttons
// clear world data and load required maps

View File

@ -15,6 +15,8 @@ inline void flipcc(uint8 *fcc)
}
bool ADTFile::Load(std::string fn)
{
try
{
uint32 fs = GetFileSize(fn.c_str());
if(!fs)
@ -31,6 +33,13 @@ bool ADTFile::Load(std::string fn)
buf.rpos(0);
return LoadMem(buf);
}
catch (...)
{
printf("ADTFile::Load() Exception\n");
return false;
}
}
bool ADTFile::LoadMem(ByteBuffer& buf)
{