* 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:
parent
95fce570dd
commit
a9893d2957
@ -351,7 +351,7 @@ DefReturnResult DefScriptPackage::func_bitxor(CmdSet& Set)
|
|||||||
|
|
||||||
DefReturnResult DefScriptPackage::func_addevent(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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -326,7 +326,7 @@ DefReturnResult DefScriptPackage::SCtarget(CmdSet& Set)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Object *obj = ws->objmgr.GetObj(guid);
|
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
|
ws->SendSetSelection(guid); // will also set the target for myCharacter
|
||||||
return toString(guid);
|
return toString(guid);
|
||||||
|
|||||||
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
Player::Player() : Unit()
|
Player::Player() : Unit()
|
||||||
{
|
{
|
||||||
_type = TYPE_PLAYER;
|
_type |= TYPE_PLAYER;
|
||||||
_typeid = TYPEID_PLAYER;
|
_typeid = TYPEID_PLAYER;
|
||||||
_valuescount = PLAYER_END;
|
_valuescount = PLAYER_END;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
Unit::Unit() : WorldObject()
|
Unit::Unit() : WorldObject()
|
||||||
{
|
{
|
||||||
_type = TYPE_UNIT;
|
_type |= TYPE_UNIT;
|
||||||
_typeid = TYPEID_UNIT;
|
_typeid = TYPEID_UNIT;
|
||||||
_valuescount = UNIT_END;
|
_valuescount = UNIT_END;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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);
|
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.
|
// TODO: put this into a capsule class later, that autodetects movement flags etc.
|
||||||
WorldPacket response;
|
WorldPacket response(MSG_MOVE_FALL_LAND,4+1+4+4+4+4+4+4);
|
||||||
response.SetOpcode(MSG_MOVE_FALL_LAND);
|
response << uint32(0) << (uint8)0; // no flags; unk
|
||||||
response << uint32(0) << (uint32)getMSTime(); // no flags; time correct?
|
response <<(uint32)getMSTime(); // time correct?
|
||||||
response << x << y << z << o << uint32(0);
|
response << x << y << z << o << uint32(100); // simulate 100 msec fall time
|
||||||
SendWorldPacket(response);
|
SendWorldPacket(response);
|
||||||
|
|
||||||
_world->UpdatePos(x,y);
|
_world->UpdatePos(x,y);
|
||||||
@ -891,6 +891,28 @@ void WorldSession::_HandleNewWorldOpcode(WorldPacket& recvPacket)
|
|||||||
recvPacket >> mapid >> x >> y >> z >> o;
|
recvPacket >> mapid >> x >> y >> z >> o;
|
||||||
if(GetMyChar())
|
if(GetMyChar())
|
||||||
GetMyChar()->ClearSpells(); // will be resent by server
|
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
|
// TODO: clear action buttons
|
||||||
|
|
||||||
// clear world data and load required maps
|
// clear world data and load required maps
|
||||||
|
|||||||
@ -16,20 +16,29 @@ inline void flipcc(uint8 *fcc)
|
|||||||
|
|
||||||
bool ADTFile::Load(std::string fn)
|
bool ADTFile::Load(std::string fn)
|
||||||
{
|
{
|
||||||
uint32 fs = GetFileSize(fn.c_str());
|
try
|
||||||
if(!fs)
|
{
|
||||||
return false;
|
uint32 fs = GetFileSize(fn.c_str());
|
||||||
std::fstream fh;
|
if(!fs)
|
||||||
fh.open(fn.c_str(), std::ios_base::in | std::ios_base::binary);
|
return false;
|
||||||
if(!fh.is_open())
|
std::fstream fh;
|
||||||
return false;
|
fh.open(fn.c_str(), std::ios_base::in | std::ios_base::binary);
|
||||||
|
if(!fh.is_open())
|
||||||
|
return false;
|
||||||
|
|
||||||
ByteBuffer buf(fs);
|
ByteBuffer buf(fs);
|
||||||
buf.resize(fs);
|
buf.resize(fs);
|
||||||
fh.read((char*)buf.contents(),fs);
|
fh.read((char*)buf.contents(),fs);
|
||||||
fh.close();
|
fh.close();
|
||||||
buf.rpos(0);
|
buf.rpos(0);
|
||||||
return LoadMem(buf);
|
return LoadMem(buf);
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
printf("ADTFile::Load() Exception\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ADTFile::LoadMem(ByteBuffer& buf)
|
bool ADTFile::LoadMem(ByteBuffer& buf)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user