aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Handlers
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2015-01-10 01:35:47 +0100
committerShauren <shauren.trinity@gmail.com>2015-01-10 01:35:47 +0100
commitfaa583c7843af37d757bd46ca0bd226175dabc38 (patch)
tree5af657d84903b337bdb22c341bb01f4e6aab1392 /src/server/game/Handlers
parentf6b30fdf616bd289dd668f98a0aed8dbfb14eba8 (diff)
Core/Maps: Updated map difficulties
Diffstat (limited to 'src/server/game/Handlers')
-rw-r--r--src/server/game/Handlers/CalendarHandler.cpp8
-rw-r--r--src/server/game/Handlers/CharacterHandler.cpp5
-rw-r--r--src/server/game/Handlers/GroupHandler.cpp2
-rw-r--r--src/server/game/Handlers/MiscHandler.cpp99
-rw-r--r--src/server/game/Handlers/MovementHandler.cpp2
5 files changed, 79 insertions, 37 deletions
diff --git a/src/server/game/Handlers/CalendarHandler.cpp b/src/server/game/Handlers/CalendarHandler.cpp
index 457f2ae2faf..f2410f2ffd9 100644
--- a/src/server/game/Handlers/CalendarHandler.cpp
+++ b/src/server/game/Handlers/CalendarHandler.cpp
@@ -111,7 +111,7 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/)
{
InstanceSave const* save = itr->second.save;
dataBuffer << uint32(save->GetMapId());
- dataBuffer << uint32(save->GetDifficulty());
+ dataBuffer << uint32(save->GetDifficultyID());
dataBuffer << uint32(save->GetResetTime() - currTime);
dataBuffer << uint64(save->GetInstanceId()); // instance save id as unique instance copy id
++boundCounter;
@@ -726,7 +726,7 @@ void WorldSession::SendCalendarRaidLockout(InstanceSave const* save, bool add)
}
data << uint32(save->GetMapId());
- data << uint32(save->GetDifficulty());
+ data << uint32(save->GetDifficultyID());
data << uint32(save->GetResetTime() - currTime);
data << uint64(save->GetInstanceId());
SendPacket(&data);
@@ -739,14 +739,14 @@ void WorldSession::SendCalendarRaidLockoutUpdated(InstanceSave const* save)
ObjectGuid guid = _player->GetGUID();
TC_LOG_DEBUG("network", "SMSG_CALENDAR_RAID_LOCKOUT_UPDATED [%s] Map: %u, Difficulty %u",
- guid.ToString().c_str(), save->GetMapId(), save->GetDifficulty());
+ guid.ToString().c_str(), save->GetMapId(), save->GetDifficultyID());
time_t currTime = time(NULL);
WorldPacket data(SMSG_CALENDAR_RAID_LOCKOUT_UPDATED, 4 + 4 + 4 + 4 + 8);
data.AppendPackedTime(currTime);
data << uint32(save->GetMapId());
- data << uint32(save->GetDifficulty());
+ data << uint32(save->GetDifficultyID());
data << uint32(0); // Amount of seconds that has changed to the reset time
data << uint32(save->GetResetTime() - currTime);
SendPacket(&data);
diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp
index de074443a39..84e6ed34bb8 100644
--- a/src/server/game/Handlers/CharacterHandler.cpp
+++ b/src/server/game/Handlers/CharacterHandler.cpp
@@ -845,7 +845,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
SendTutorialsData();
pCurrChar->GetMotionMaster()->Initialize();
- pCurrChar->SendDungeonDifficulty(false);
+ pCurrChar->SendDungeonDifficulty();
WorldPackets::Character::LoginVerifyWorld loginVerifyWorld;
loginVerifyWorld.MapID = pCurrChar->GetMapId();
@@ -873,7 +873,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
features.ScrollOfResurrectionMaxRequestsPerDay = 1;
features.CfgRealmID = 2;
features.CfgRealmRecID = 0;
- features.VoiceEnabled = true;
+ features.VoiceEnabled = false;
/// END OF DUMMY VALUES
features.CharUndeleteEnabled = sWorld->getBoolConfig(CONFIG_FEATURE_SYSTEM_CHARACTER_UNDELETE_ENABLED);
@@ -2489,6 +2489,7 @@ void WorldSession::SendCharRename(ResponseCodes result, WorldPackets::Character:
void WorldSession::SendCharCustomize(ResponseCodes result, WorldPackets::Character::CharCustomizeInfo const* customizeInfo)
{
/// @todo: fix 6.x implementation
+ (void)result;
(void)customizeInfo;
/*
WorldPacket data(SMSG_CHAR_CUSTOMIZE, 1 + 8 + customizeInfo.NewName.size() + 1 + 6);
diff --git a/src/server/game/Handlers/GroupHandler.cpp b/src/server/game/Handlers/GroupHandler.cpp
index 97b25d5fc1b..9f42c4591ea 100644
--- a/src/server/game/Handlers/GroupHandler.cpp
+++ b/src/server/game/Handlers/GroupHandler.cpp
@@ -134,7 +134,7 @@ void WorldSession::HandleGroupInviteOpcode(WorldPacket& recvData)
return;
}
// just ignore us
- if (player->GetInstanceId() != 0 && player->GetDungeonDifficulty() != GetPlayer()->GetDungeonDifficulty())
+ if (player->GetInstanceId() != 0 && player->GetDungeonDifficultyID() != GetPlayer()->GetDungeonDifficultyID())
{
SendPartyResult(PARTY_OP_INVITE, memberName, ERR_IGNORING_YOU_S);
return;
diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp
index 1bdb0fd703e..569bcf73ffa 100644
--- a/src/server/game/Handlers/MiscHandler.cpp
+++ b/src/server/game/Handlers/MiscHandler.cpp
@@ -1540,26 +1540,38 @@ void WorldSession::HandleResetInstancesOpcode(WorldPacket& /*recvData*/)
if (Group* group = _player->GetGroup())
{
if (group->IsLeader(_player->GetGUID()))
- group->ResetInstances(INSTANCE_RESET_ALL, false, _player);
+ group->ResetInstances(INSTANCE_RESET_ALL, false, false, _player);
}
else
- _player->ResetInstances(INSTANCE_RESET_ALL, false);
+ _player->ResetInstances(INSTANCE_RESET_ALL, false, false);
}
-void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket& recvData)
+void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPackets::Misc::SetDungeonDifficulty& setDungeonDifficulty)
{
- TC_LOG_DEBUG("network", "MSG_SET_DUNGEON_DIFFICULTY");
+ DifficultyEntry const* difficultyEntry = sDifficultyStore.LookupEntry(setDungeonDifficulty.DifficultyID);
+ if (!difficultyEntry)
+ {
+ TC_LOG_DEBUG("network", "WorldSession::HandleSetDungeonDifficultyOpcode: %s sent an invalid instance mode %d!",
+ _player->GetGUID().ToString().c_str(), setDungeonDifficulty.DifficultyID);
+ return;
+ }
- uint32 mode;
- recvData >> mode;
+ if (difficultyEntry->InstanceType != MAP_INSTANCE)
+ {
+ TC_LOG_DEBUG("network", "WorldSession::HandleSetDungeonDifficultyOpcode: %s sent an non-dungeon instance mode %d!",
+ _player->GetGUID().ToString().c_str(), difficultyEntry->ID);
+ return;
+ }
- if (mode >= MAX_DUNGEON_DIFFICULTY)
+ if (!(difficultyEntry->Flags & DIFFICULTY_FLAG_CAN_SELECT))
{
- TC_LOG_DEBUG("network", "WorldSession::HandleSetDungeonDifficultyOpcode: %s sent an invalid instance mode %d!", _player->GetGUID().ToString().c_str(), mode);
+ TC_LOG_DEBUG("network", "WorldSession::HandleSetDungeonDifficultyOpcode: %s sent unselectable instance mode %d!",
+ _player->GetGUID().ToString().c_str(), difficultyEntry->ID);
return;
}
- if (Difficulty(mode) == _player->GetDungeonDifficulty())
+ Difficulty difficultyID = Difficulty(difficultyEntry->ID);
+ if (difficultyID == _player->GetDungeonDifficultyID())
return;
// cannot reset while in an instance
@@ -1594,41 +1606,62 @@ void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket& recvData)
}
// the difficulty is set even if the instances can't be reset
//_player->SendDungeonDifficulty(true);
- group->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, false, _player);
- group->SetDungeonDifficulty(Difficulty(mode));
+ group->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, false, false, _player);
+ group->SetDungeonDifficultyID(difficultyID);
}
}
else
{
- _player->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, false);
- _player->SetDungeonDifficulty(Difficulty(mode));
+ _player->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, false, false);
+ _player->SetDungeonDifficultyID(difficultyID);
+ _player->SendDungeonDifficulty();
}
}
-void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket& recvData)
+void WorldSession::HandleSetRaidDifficultyOpcode(WorldPackets::Misc::SetRaidDifficulty& setRaidDifficulty)
{
- TC_LOG_DEBUG("network", "MSG_SET_RAID_DIFFICULTY");
+ DifficultyEntry const* difficultyEntry = sDifficultyStore.LookupEntry(setRaidDifficulty.DifficultyID);
+ if (!difficultyEntry)
+ {
+ TC_LOG_DEBUG("network", "WorldSession::HandleSetDungeonDifficultyOpcode: %s sent an invalid instance mode %u!",
+ _player->GetGUID().ToString().c_str(), setRaidDifficulty.DifficultyID);
+ return;
+ }
- uint32 mode;
- recvData >> mode;
+ if (difficultyEntry->InstanceType != MAP_RAID)
+ {
+ TC_LOG_DEBUG("network", "WorldSession::HandleSetDungeonDifficultyOpcode: %s sent an non-dungeon instance mode %u!",
+ _player->GetGUID().ToString().c_str(), difficultyEntry->ID);
+ return;
+ }
- if (mode >= MAX_RAID_DIFFICULTY)
+ if (!(difficultyEntry->Flags & DIFFICULTY_FLAG_CAN_SELECT))
{
- TC_LOG_ERROR("network", "WorldSession::HandleSetRaidDifficultyOpcode: %s sent an invalid instance mode %d!", _player->GetGUID().ToString().c_str(), mode);
+ TC_LOG_DEBUG("network", "WorldSession::HandleSetDungeonDifficultyOpcode: %s sent unselectable instance mode %u!",
+ _player->GetGUID().ToString().c_str(), difficultyEntry->ID);
return;
}
+ if (((difficultyEntry->Flags & DIFFICULTY_FLAG_LEGACY) >> 5) != setRaidDifficulty.Legacy)
+ {
+ TC_LOG_DEBUG("network", "WorldSession::HandleSetDungeonDifficultyOpcode: %s sent not matching legacy difficulty %u!",
+ _player->GetGUID().ToString().c_str(), difficultyEntry->ID);
+ return;
+ }
+
+ Difficulty difficultyID = Difficulty(difficultyEntry->ID);
+ if (difficultyID == (setRaidDifficulty.Legacy ? _player->GetLegacyRaidDifficultyID() : _player->GetRaidDifficultyID()))
+ return;
+
// cannot reset while in an instance
Map* map = _player->FindMap();
if (map && map->IsDungeon())
{
- TC_LOG_DEBUG("network", "WorldSession::HandleSetRaidDifficultyOpcode: %s tried to reset the instance while inside!", _player->GetGUID().ToString().c_str());
+ TC_LOG_DEBUG("network", "WorldSession::HandleSetRaidDifficultyOpcode: player (Name: %s, %s) tried to reset the instance while player is inside!",
+ _player->GetName().c_str(), _player->GetGUID().ToString().c_str());
return;
}
- if (Difficulty(mode) == _player->GetRaidDifficulty())
- return;
-
Group* group = _player->GetGroup();
if (group)
{
@@ -1645,20 +1678,28 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket& recvData)
if (groupGuy->GetMap()->IsRaid())
{
- TC_LOG_DEBUG("network", "WorldSession::HandleSetRaidDifficultyOpcode: %s tried to reset the instance while inside!", _player->GetGUID().ToString().c_str());
+ TC_LOG_DEBUG("network", "WorldSession::HandleSetRaidDifficultyOpcode: %s tried to reset the instance while group member (Name: %s, %s) is inside!",
+ _player->GetGUID().ToString().c_str(), groupGuy->GetName().c_str(), groupGuy->GetGUID().ToString().c_str());
return;
}
}
// the difficulty is set even if the instances can't be reset
- //_player->SendDungeonDifficulty(true);
- group->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, true, _player);
- group->SetRaidDifficulty(Difficulty(mode));
+ group->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, true, setRaidDifficulty.Legacy != 0, _player);
+ if (setRaidDifficulty.Legacy)
+ group->SetLegacyRaidDifficultyID(difficultyID);
+ else
+ group->SetRaidDifficultyID(difficultyID);
}
}
else
{
- _player->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, true);
- _player->SetRaidDifficulty(Difficulty(mode));
+ _player->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, true, setRaidDifficulty.Legacy != 0);
+ if (setRaidDifficulty.Legacy)
+ _player->SetLegacyRaidDifficultyID(difficultyID);
+ else
+ _player->SetRaidDifficultyID(difficultyID);
+
+ _player->SendRaidDifficulty(setRaidDifficulty.Legacy != 0);
}
}
diff --git a/src/server/game/Handlers/MovementHandler.cpp b/src/server/game/Handlers/MovementHandler.cpp
index f4d9c7d10ca..e1e5ae49778 100644
--- a/src/server/game/Handlers/MovementHandler.cpp
+++ b/src/server/game/Handlers/MovementHandler.cpp
@@ -158,7 +158,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
bool allowMount = !mEntry->IsDungeon() || mEntry->IsBattlegroundOrArena();
if (mInstance)
{
- Difficulty diff = GetPlayer()->GetDifficulty(mEntry->IsRaid());
+ Difficulty diff = GetPlayer()->GetDifficultyID(mEntry);
if (MapDifficulty const* mapDiff = GetMapDifficultyData(mEntry->ID, diff))
{
if (mapDiff->resetTime)