diff --git a/src/Client/DefScript/DefScriptFunctions.cpp b/src/Client/DefScript/DefScriptFunctions.cpp index 0b0efc7..9776022 100644 --- a/src/Client/DefScript/DefScriptFunctions.cpp +++ b/src/Client/DefScript/DefScriptFunctions.cpp @@ -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; } diff --git a/src/Client/DefScriptInterface.cpp b/src/Client/DefScriptInterface.cpp index 30e6b5b..d6f6091 100644 --- a/src/Client/DefScriptInterface.cpp +++ b/src/Client/DefScriptInterface.cpp @@ -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); diff --git a/src/Client/World/Player.cpp b/src/Client/World/Player.cpp index 7047cda..c67674d 100644 --- a/src/Client/World/Player.cpp +++ b/src/Client/World/Player.cpp @@ -11,7 +11,7 @@ Player::Player() : Unit() { - _type = TYPE_PLAYER; + _type |= TYPE_PLAYER; _typeid = TYPEID_PLAYER; _valuescount = PLAYER_END; } diff --git a/src/Client/World/Unit.cpp b/src/Client/World/Unit.cpp index 34eec85..d306429 100644 --- a/src/Client/World/Unit.cpp +++ b/src/Client/World/Unit.cpp @@ -3,7 +3,7 @@ Unit::Unit() : WorldObject() { - _type = TYPE_UNIT; + _type |= TYPE_UNIT; _typeid = TYPEID_UNIT; _valuescount = UNIT_END; } diff --git a/src/Client/World/WorldSession.cpp b/src/Client/World/WorldSession.cpp index 728c39c..ef983b6 100644 --- a/src/Client/World/WorldSession.cpp +++ b/src/Client/World/WorldSession.cpp @@ -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 diff --git a/src/shared/ADTFile.cpp b/src/shared/ADTFile.cpp index 8cb6e54..2950bcd 100644 --- a/src/shared/ADTFile.cpp +++ b/src/shared/ADTFile.cpp @@ -16,20 +16,29 @@ inline void flipcc(uint8 *fcc) bool ADTFile::Load(std::string fn) { - uint32 fs = GetFileSize(fn.c_str()); - if(!fs) - return false; - std::fstream fh; - fh.open(fn.c_str(), std::ios_base::in | std::ios_base::binary); - if(!fh.is_open()) - return false; + try + { + uint32 fs = GetFileSize(fn.c_str()); + if(!fs) + return false; + std::fstream fh; + fh.open(fn.c_str(), std::ios_base::in | std::ios_base::binary); + if(!fh.is_open()) + return false; - ByteBuffer buf(fs); - buf.resize(fs); - fh.read((char*)buf.contents(),fs); - fh.close(); - buf.rpos(0); - return LoadMem(buf); + ByteBuffer buf(fs); + buf.resize(fs); + fh.read((char*)buf.contents(),fs); + fh.close(); + buf.rpos(0); + return LoadMem(buf); + } + catch (...) + { + printf("ADTFile::Load() Exception\n"); + return false; + } + } bool ADTFile::LoadMem(ByteBuffer& buf)