* Update structure for SMSG_ADDON_INFO and add some sort of basic handling for incorrect addon CRCs (anti-cheating).
* Fix CRLF in MovementHandler.cpp. * Move some handlers/senders to correct place. --HG-- branch : trunk
This commit is contained in:
@@ -773,6 +773,23 @@ void WorldSession::HandleResurrectResponseOpcode(WorldPacket & recv_data)
|
|||||||
GetPlayer()->ResurectUsingRequestData();
|
GetPlayer()->ResurectUsingRequestData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WorldSession::SendAreaTriggerMessage(const char* Text, ...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
char szStr [1024];
|
||||||
|
szStr[0] = '\0';
|
||||||
|
|
||||||
|
va_start(ap, Text);
|
||||||
|
vsnprintf( szStr, 1024, Text, ap );
|
||||||
|
va_end(ap);
|
||||||
|
|
||||||
|
uint32 length = strlen(szStr)+1;
|
||||||
|
WorldPacket data(SMSG_AREA_TRIGGER_MESSAGE, 4+length);
|
||||||
|
data << length;
|
||||||
|
data << szStr;
|
||||||
|
SendPacket(&data);
|
||||||
|
}
|
||||||
|
|
||||||
void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data)
|
void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data)
|
||||||
{
|
{
|
||||||
sLog.outDebug("WORLD: Received CMSG_AREATRIGGER");
|
sLog.outDebug("WORLD: Received CMSG_AREATRIGGER");
|
||||||
@@ -1628,3 +1645,10 @@ void WorldSession::HandleWorldStateUITimerUpdate(WorldPacket& recv_data)
|
|||||||
data << uint32(time(NULL));
|
data << uint32(time(NULL));
|
||||||
SendPacket(&data);
|
SendPacket(&data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WorldSession::SendSetPhaseShift(uint32 PhaseShift)
|
||||||
|
{
|
||||||
|
WorldPacket data(SMSG_SET_PHASE_SHIFT, 4);
|
||||||
|
data << uint32(PhaseShift);
|
||||||
|
SendPacket(&data);
|
||||||
|
}
|
||||||
|
|||||||
@@ -608,17 +608,49 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket &recv_data)
|
|||||||
int8 seatId;
|
int8 seatId;
|
||||||
recv_data >> seatId;
|
recv_data >> seatId;
|
||||||
|
|
||||||
if(!accessory)
|
if(!accessory)
|
||||||
GetPlayer()->ChangeSeat(-1, seatId > 0); // prev/next
|
GetPlayer()->ChangeSeat(-1, seatId > 0); // prev/next
|
||||||
else if(Unit *vehUnit = ObjectAccessor::GetUnit(*GetPlayer(), accessory))
|
else if(Unit *vehUnit = ObjectAccessor::GetUnit(*GetPlayer(), accessory))
|
||||||
if(Vehicle *vehicle = vehUnit->GetVehicleKit())
|
if(Vehicle *vehicle = vehUnit->GetVehicleKit())
|
||||||
if(vehicle->HasEmptySeat(seatId))
|
if(vehicle->HasEmptySeat(seatId))
|
||||||
GetPlayer()->EnterVehicle(vehicle, seatId);
|
GetPlayer()->EnterVehicle(vehicle, seatId);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WorldSession::HandleEnterPlayerVehicle(WorldPacket &data)
|
||||||
|
{
|
||||||
|
// Read guid
|
||||||
|
uint64 guid;
|
||||||
|
data >> guid;
|
||||||
|
|
||||||
|
if(Player* pl=ObjectAccessor::FindPlayer(guid))
|
||||||
|
{
|
||||||
|
if (!pl->GetVehicleKit())
|
||||||
|
return;
|
||||||
|
if (!pl->IsInRaidWith(_player))
|
||||||
|
return;
|
||||||
|
if(!pl->IsWithinDistInMap(_player,INTERACTION_DISTANCE))
|
||||||
|
return;
|
||||||
|
_player->EnterVehicle(pl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void WorldSession::HandleEjectPasenger(WorldPacket &data)
|
||||||
|
{
|
||||||
|
if(data.GetOpcode()==CMSG_EJECT_PASSENGER)
|
||||||
|
{
|
||||||
|
if(Vehicle* Vv= _player->GetVehicleKit())
|
||||||
|
{
|
||||||
|
uint64 guid;
|
||||||
|
data >> guid;
|
||||||
|
if(Player* Pl=ObjectAccessor::FindPlayer(guid))
|
||||||
|
Pl->ExitVehicle();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void WorldSession::HandleRequestVehicleExit(WorldPacket &recv_data)
|
void WorldSession::HandleRequestVehicleExit(WorldPacket &recv_data)
|
||||||
{
|
{
|
||||||
sLog.outDebug("WORLD: Recvd CMSG_REQUEST_VEHICLE_EXIT");
|
sLog.outDebug("WORLD: Recvd CMSG_REQUEST_VEHICLE_EXIT");
|
||||||
|
|||||||
@@ -8941,11 +8941,11 @@ void ObjectMgr::LoadCreatureClassLevelStats()
|
|||||||
stats.BaseMana = fields[5].GetUInt32();
|
stats.BaseMana = fields[5].GetUInt32();
|
||||||
stats.BaseArmor = fields[6].GetUInt32();
|
stats.BaseArmor = fields[6].GetUInt32();
|
||||||
|
|
||||||
if (stats.Level > MAX_LEVEL)
|
if (stats.Level > STRONG_MAX_LEVEL)
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Creature base stats for class %u has invalid level %u (max is %u) - set to %u",
|
sLog.outErrorDb("Creature base stats for class %u has invalid level %u (max is %u) - set to %u",
|
||||||
stats.Class, stats.Level, MAX_LEVEL, DEFAULT_MAX_LEVEL);
|
stats.Class, stats.Level, STRONG_MAX_LEVEL, STRONG_MAX_LEVEL);
|
||||||
stats.Level = DEFAULT_MAX_LEVEL;
|
stats.Level = STRONG_MAX_LEVEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!stats.Class || ((1 << (stats.Class - 1)) & CLASSMASK_ALL_CREATURES) == 0)
|
if (!stats.Class || ((1 << (stats.Class - 1)) & CLASSMASK_ALL_CREATURES) == 0)
|
||||||
|
|||||||
+21
-74
@@ -472,25 +472,6 @@ void WorldSession::KickPlayer()
|
|||||||
m_Socket->CloseSocket ();
|
m_Socket->CloseSocket ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Cancel channeling handler
|
|
||||||
|
|
||||||
void WorldSession::SendAreaTriggerMessage(const char* Text, ...)
|
|
||||||
{
|
|
||||||
va_list ap;
|
|
||||||
char szStr [1024];
|
|
||||||
szStr[0] = '\0';
|
|
||||||
|
|
||||||
va_start(ap, Text);
|
|
||||||
vsnprintf( szStr, 1024, Text, ap );
|
|
||||||
va_end(ap);
|
|
||||||
|
|
||||||
uint32 length = strlen(szStr)+1;
|
|
||||||
WorldPacket data(SMSG_AREA_TRIGGER_MESSAGE, 4+length);
|
|
||||||
data << length;
|
|
||||||
data << szStr;
|
|
||||||
SendPacket(&data);
|
|
||||||
}
|
|
||||||
|
|
||||||
void WorldSession::SendNotification(const char *format,...)
|
void WorldSession::SendNotification(const char *format,...)
|
||||||
{
|
{
|
||||||
if(format)
|
if(format)
|
||||||
@@ -526,13 +507,6 @@ void WorldSession::SendNotification(int32 string_id,...)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::SendSetPhaseShift(uint32 PhaseShift)
|
|
||||||
{
|
|
||||||
WorldPacket data(SMSG_SET_PHASE_SHIFT, 4);
|
|
||||||
data << uint32(PhaseShift);
|
|
||||||
SendPacket(&data);
|
|
||||||
}
|
|
||||||
|
|
||||||
const char * WorldSession::GetTrinityString( int32 entry ) const
|
const char * WorldSession::GetTrinityString( int32 entry ) const
|
||||||
{
|
{
|
||||||
return objmgr.GetTrinityString(entry,GetSessionDbLocaleIndex());
|
return objmgr.GetTrinityString(entry,GetSessionDbLocaleIndex());
|
||||||
@@ -860,11 +834,13 @@ void WorldSession::ReadAddonsInfo(WorldPacket &data)
|
|||||||
|
|
||||||
sLog.outDebug("ADDON: Name: %s, Enabled: 0x%x, CRC: 0x%x, Unknown2: 0x%x", addonName.c_str(), enabled, crc, unk1);
|
sLog.outDebug("ADDON: Name: %s, Enabled: 0x%x, CRC: 0x%x, Unknown2: 0x%x", addonName.c_str(), enabled, crc, unk1);
|
||||||
|
|
||||||
m_addonsList.push_back(AddonInfo(addonName, enabled, crc));
|
// TODO: Find out when to not use CRC/pubkey, and other possible states.
|
||||||
|
m_addonsList.push_back(AddonInfo(addonName, enabled, crc, 2, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 unk2;
|
uint32 currentTime;
|
||||||
addonInfo >> unk2;
|
addonInfo >> currentTime;
|
||||||
|
sLog.outDebug("ADDON: CurrentTime: %u", currentTime);
|
||||||
|
|
||||||
if(addonInfo.rpos() != addonInfo.size())
|
if(addonInfo.rpos() != addonInfo.size())
|
||||||
sLog.outDebug("packet under read!");
|
sLog.outDebug("packet under read!");
|
||||||
@@ -875,7 +851,7 @@ void WorldSession::ReadAddonsInfo(WorldPacket &data)
|
|||||||
|
|
||||||
void WorldSession::SendAddonsInfo()
|
void WorldSession::SendAddonsInfo()
|
||||||
{
|
{
|
||||||
unsigned char tdata[256] =
|
unsigned char addonPublicKey[256] =
|
||||||
{
|
{
|
||||||
0xC3, 0x5B, 0x50, 0x84, 0xB9, 0x3E, 0x32, 0x42, 0x8C, 0xD0, 0xC7, 0x48, 0xFA, 0x0E, 0x5D, 0x54,
|
0xC3, 0x5B, 0x50, 0x84, 0xB9, 0x3E, 0x32, 0x42, 0x8C, 0xD0, 0xC7, 0x48, 0xFA, 0x0E, 0x5D, 0x54,
|
||||||
0x5A, 0xA3, 0x0E, 0x14, 0xBA, 0x9E, 0x0D, 0xB9, 0x5D, 0x8B, 0xEE, 0xB6, 0x84, 0x93, 0x45, 0x75,
|
0x5A, 0xA3, 0x0E, 0x14, 0xBA, 0x9E, 0x0D, 0xB9, 0x5D, 0x8B, 0xEE, 0xB6, 0x84, 0x93, 0x45, 0x75,
|
||||||
@@ -899,26 +875,30 @@ void WorldSession::SendAddonsInfo()
|
|||||||
|
|
||||||
for (AddonsList::iterator itr = m_addonsList.begin(); itr != m_addonsList.end(); ++itr)
|
for (AddonsList::iterator itr = m_addonsList.begin(); itr != m_addonsList.end(); ++itr)
|
||||||
{
|
{
|
||||||
uint8 state = 2; // 2 is sent here
|
data << uint8(itr->State);
|
||||||
data << uint8(state);
|
|
||||||
|
|
||||||
uint8 unk1 = 1; // 1 is sent here
|
uint8 crcpub = itr->UsePublicKeyOrCRC;
|
||||||
data << uint8(unk1);
|
data << uint8(crcpub);
|
||||||
if (unk1)
|
if (crcpub)
|
||||||
{
|
{
|
||||||
uint8 unk2 = (itr->CRC != 0x4c1c776d); // If addon is Standard addon CRC
|
uint8 usepk = (itr->CRC != STANDARD_ADDON_CRC); // If addon is Standard addon CRC
|
||||||
data << uint8(unk2);
|
data << uint8(usepk);
|
||||||
if (unk2) // if CRC is wrong, add public key (client need it)
|
if (usepk) // if CRC is wrong, add public key (client need it)
|
||||||
data.append(tdata, sizeof(tdata));
|
{
|
||||||
|
sLog.outError("ADDON: CRC (0x%x) for addon %s is wrong (does not match expected %x), sending pubkey",
|
||||||
|
itr->Name, itr->CRC, STANDARD_ADDON_CRC);
|
||||||
|
|
||||||
data << uint32(0);
|
data.append(addonPublicKey, sizeof(addonPublicKey));
|
||||||
|
}
|
||||||
|
|
||||||
|
data << uint32(/*itr->CRC*/ 0); // TODO: Find out the meaning of this.
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8 unk3 = 0; // 0 is sent here
|
uint8 unk3 = 0; // 0 is sent here
|
||||||
data << uint8(unk3);
|
data << uint8(unk3);
|
||||||
if (unk3)
|
if (unk3)
|
||||||
{
|
{
|
||||||
// String, 256 (null terminated?)
|
// String, length 256 (null terminated)
|
||||||
data << uint8(0);
|
data << uint8(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -938,39 +918,6 @@ void WorldSession::SendAddonsInfo()
|
|||||||
SendPacket(&data);
|
SendPacket(&data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WorldSession::HandleEnterPlayerVehicle(WorldPacket &data)
|
|
||||||
{
|
|
||||||
// Read guid
|
|
||||||
uint64 guid;
|
|
||||||
data >> guid;
|
|
||||||
|
|
||||||
if(Player* pl=ObjectAccessor::FindPlayer(guid))
|
|
||||||
{
|
|
||||||
if (!pl->GetVehicleKit())
|
|
||||||
return;
|
|
||||||
if (!pl->IsInRaidWith(_player))
|
|
||||||
return;
|
|
||||||
if(!pl->IsWithinDistInMap(_player,INTERACTION_DISTANCE))
|
|
||||||
return;
|
|
||||||
_player->EnterVehicle(pl);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void WorldSession::HandleEjectPasenger(WorldPacket &data)
|
|
||||||
{
|
|
||||||
if(data.GetOpcode()==CMSG_EJECT_PASSENGER)
|
|
||||||
{
|
|
||||||
if(Vehicle* Vv= _player->GetVehicleKit())
|
|
||||||
{
|
|
||||||
uint64 guid;
|
|
||||||
data >> guid;
|
|
||||||
if(Player* Pl=ObjectAccessor::FindPlayer(guid))
|
|
||||||
Pl->ExitVehicle();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void WorldSession::SetPlayer( Player *plr )
|
void WorldSession::SetPlayer( Player *plr )
|
||||||
{
|
{
|
||||||
_player = plr;
|
_player = plr;
|
||||||
|
|||||||
@@ -73,20 +73,26 @@ struct AccountData
|
|||||||
|
|
||||||
struct AddonInfo
|
struct AddonInfo
|
||||||
{
|
{
|
||||||
AddonInfo(const std::string& name, uint8 enabled, uint32 crc)
|
AddonInfo(const std::string& name, uint8 enabled, uint32 crc, uint8 state, bool crcOrPubKey)
|
||||||
{
|
{
|
||||||
Name = name;
|
Name = name;
|
||||||
Enabled = enabled;
|
Enabled = enabled;
|
||||||
CRC = crc;
|
CRC = crc;
|
||||||
|
State = state;
|
||||||
|
UsePublicKeyOrCRC = crcOrPubKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Name;
|
std::string Name;
|
||||||
uint8 Enabled;
|
uint8 Enabled;
|
||||||
uint32 CRC;
|
uint32 CRC;
|
||||||
|
uint8 State;
|
||||||
|
bool UsePublicKeyOrCRC;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::list<AddonInfo> AddonsList;
|
typedef std::list<AddonInfo> AddonsList;
|
||||||
|
|
||||||
|
#define STANDARD_ADDON_CRC 0x4c1c776d
|
||||||
|
|
||||||
enum PartyOperation
|
enum PartyOperation
|
||||||
{
|
{
|
||||||
PARTY_OP_INVITE = 0,
|
PARTY_OP_INVITE = 0,
|
||||||
|
|||||||
Reference in New Issue
Block a user