aboutsummaryrefslogtreecommitdiff
path: root/src/game/MiscHandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/MiscHandler.cpp')
-rw-r--r--src/game/MiscHandler.cpp106
1 files changed, 86 insertions, 20 deletions
diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp
index c51ca063e48..c843bd27fe0 100644
--- a/src/game/MiscHandler.cpp
+++ b/src/game/MiscHandler.cpp
@@ -47,6 +47,7 @@
#include "AccountMgr.h"
#include "Vehicle.h"
#include "CreatureAI.h"
+#include "DBCEnums.h"
void WorldSession::HandleRepopRequestOpcode( WorldPacket & recv_data )
{
@@ -468,7 +469,7 @@ void WorldSession::HandleSetTargetOpcode( WorldPacket & recv_data )
uint64 guid ;
recv_data >> guid;
- _player->SetUInt32Value(UNIT_FIELD_TARGET,guid);
+ _player->SetUInt32Value(UNIT_FIELD_TARGET, guid);
// update reputation list if need
Unit* unit = ObjectAccessor::GetUnit(*_player, guid );
@@ -692,10 +693,8 @@ void WorldSession::HandleSetContactNotesOpcode( WorldPacket & recv_data )
void WorldSession::HandleBugOpcode( WorldPacket & recv_data )
{
- uint32 suggestion, contentlen;
- std::string content;
- uint32 typelen;
- std::string type;
+ uint32 suggestion, contentlen, typelen;
+ std::string content, type;
recv_data >> suggestion >> contentlen >> content;
@@ -988,8 +987,8 @@ void WorldSession::HandleRequestAccountData(WorldPacket& recv_data)
dest.resize(destSize);
- WorldPacket data (SMSG_UPDATE_ACCOUNT_DATA, 8+4+4+4+destSize);
- data << uint64(_player->GetGUID()); // player guid
+ WorldPacket data(SMSG_UPDATE_ACCOUNT_DATA, 8+4+4+4+destSize);
+ data << uint64(_player ? _player->GetGUID() : 0); // player guid
data << uint32(type); // type (0-7)
data << uint32(adata->Time); // unix time
data << uint32(size); // decompressed length
@@ -1053,7 +1052,12 @@ void WorldSession::HandleMoveTimeSkippedOpcode( WorldPacket & recv_data )
/* WorldSession::Update( getMSTime() );*/
DEBUG_LOG( "WORLD: Time Lag/Synchronization Resent/Update" );
- recv_data.read_skip<uint64>();
+ uint64 guid;
+ if(!recv_data.readPackGUID(guid))
+ {
+ recv_data.rpos(recv_data.wpos());
+ return;
+ }
recv_data.read_skip<uint32>();
/*
uint64 guid;
@@ -1441,10 +1445,16 @@ void WorldSession::HandleResetInstancesOpcode( WorldPacket & /*recv_data*/ )
if(pGroup)
{
if(pGroup->IsLeader(_player->GetGUID()))
- pGroup->ResetInstances(INSTANCE_RESET_ALL, _player);
+ {
+ pGroup->ResetInstances(INSTANCE_RESET_ALL, false, _player);
+ pGroup->ResetInstances(INSTANCE_RESET_ALL, true,_player);
+ }
}
else
- _player->ResetInstances(INSTANCE_RESET_ALL);
+ {
+ _player->ResetInstances(INSTANCE_RESET_ALL, false);
+ _player->ResetInstances(INSTANCE_RESET_ALL, true);
+ }
}
void WorldSession::HandleSetDungeonDifficultyOpcode( WorldPacket & recv_data )
@@ -1454,15 +1464,15 @@ void WorldSession::HandleSetDungeonDifficultyOpcode( WorldPacket & recv_data )
uint32 mode;
recv_data >> mode;
- if(mode == _player->GetDifficulty())
- return;
-
- if(mode > DIFFICULTY_HEROIC)
+ if(mode >= MAX_DUNGEON_DIFFICULTY)
{
sLog.outError("WorldSession::HandleSetDungeonDifficultyOpcode: player %d sent an invalid instance mode %d!", _player->GetGUIDLow(), mode);
return;
}
+ if(Difficulty(mode) == _player->GetDungeonDifficulty())
+ return;
+
// cannot reset while in an instance
Map *map = _player->GetMap();
if(map && map->IsDungeon())
@@ -1480,21 +1490,64 @@ void WorldSession::HandleSetDungeonDifficultyOpcode( WorldPacket & recv_data )
{
// the difficulty is set even if the instances can't be reset
//_player->SendDungeonDifficulty(true);
- pGroup->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, _player);
- pGroup->SetDifficulty(mode);
+ pGroup->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, false, _player);
+ pGroup->SetDungeonDifficulty(Difficulty(mode));
}
}
else
{
- _player->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY);
- _player->SetDifficulty(mode);
+ _player->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, false);
+ _player->SetDungeonDifficulty(Difficulty(mode));
+ }
+}
+
+void WorldSession::HandleSetRaidDifficultyOpcode( WorldPacket & recv_data )
+{
+ sLog.outDebug("MSG_SET_RAID_DIFFICULTY");
+
+ uint32 mode;
+ recv_data >> mode;
+
+ if(mode >= MAX_RAID_DIFFICULTY)
+ {
+ sLog.outError("WorldSession::HandleSetRaidDifficultyOpcode: player %d sent an invalid instance mode %d!", _player->GetGUIDLow(), mode);
+ return;
+ }
+
+ // cannot reset while in an instance
+ Map *map = _player->GetMap();
+ if(map && map->IsDungeon())
+ {
+ sLog.outError("WorldSession::HandleSetRaidDifficultyOpcode: player %d tried to reset the instance while inside!", _player->GetGUIDLow());
+ return;
}
+
+ if(Difficulty(mode) == _player->GetRaidDifficulty())
+ return;
+
+ if(_player->getLevel() < LEVELREQUIREMENT_HEROIC)
+ return;
+
+ if(Group *pGroup = _player->GetGroup())
+ {
+ if(pGroup->IsLeader(_player->GetGUID()))
+ {
+ // the difficulty is set even if the instances can't be reset
+ //_player->SendDungeonDifficulty(true);
+ pGroup->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, true, _player);
+ pGroup->SetRaidDifficulty(Difficulty(mode));
+ }
+ }
+ else
+ {
+ _player->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, true);
+ _player->SetRaidDifficulty(Difficulty(mode));
+ }
}
void WorldSession::HandleCancelMountAuraOpcode( WorldPacket & /*recv_data*/ )
{
sLog.outDebug("WORLD: CMSG_CANCEL_MOUNT_AURA");
- //recv_data.hexlike();
//If player is not mounted, so go out :)
if (!_player->IsMounted()) // not blizz like; no any messages on blizz
@@ -1519,7 +1572,10 @@ void WorldSession::HandleMoveSetCanFlyAckOpcode( WorldPacket & recv_data )
sLog.outDebug("WORLD: CMSG_MOVE_SET_CAN_FLY_ACK");
//recv_data.hexlike();
- recv_data.read_skip<uint64>(); // guid
+ uint64 guid; // guid - unused
+ if(!recv_data.readPackGUID(guid))
+ return;
+
recv_data.read_skip<uint32>(); // unk
MovementInfo movementInfo;
@@ -1558,3 +1614,13 @@ void WorldSession::HandleQueryInspectAchievements( WorldPacket & recv_data )
player->GetAchievementMgr().SendRespondInspectAchievements(_player);
}
+
+void WorldSession::HandleWorldStateUITimerUpdate(WorldPacket& recv_data)
+{
+ // empty opcode
+ sLog.outDebug("WORLD: CMSG_WORLD_STATE_UI_TIMER_UPDATE");
+
+ WorldPacket data(SMSG_WORLD_STATE_UI_TIMER_UPDATE, 4);
+ data << uint32(time(NULL));
+ SendPacket(&data);
+}