Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Core/Instances: Fix some Instance Lock chat messages
Always send a Welcome type Instance Lock chat message when entering an instance instead of changing type based on remaining time.
Fix scheduled warning message to always send "Your instance lock for ... will expire in 0 minutes." even if there are hours left, issue added in 4193806 , closes #11519 .
Update warning messages based on remaining time so that the most meaning is always used (6 hours left, 59 minutes left, etc).
  • Loading branch information
jackpoz committed Jul 8, 2015
1 parent 23e4472 commit fae8269
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
10 changes: 6 additions & 4 deletions src/server/game/Entities/Player/Player.cpp
Expand Up @@ -22621,15 +22621,17 @@ void Player::SendTransferAborted(uint32 mapid, TransferAbortReason reason, uint8
GetSession()->SendPacket(&data);
}

void Player::SendInstanceResetWarning(uint32 mapid, Difficulty difficulty, uint32 time)
void Player::SendInstanceResetWarning(uint32 mapid, Difficulty difficulty, uint32 time, bool welcome)
{
// type of warning, based on the time remaining until reset
uint32 type;
if (time > 3600)
if (welcome)
type = RAID_INSTANCE_WELCOME;
else if (time > 900 && time <= 3600)
else if (time > 21600)
type = RAID_INSTANCE_WELCOME;
else if (time > 3600)
type = RAID_INSTANCE_WARNING_HOURS;
else if (time > 300 && time <= 900)
else if (time > 300)
type = RAID_INSTANCE_WARNING_MIN;
else
type = RAID_INSTANCE_WARNING_MIN_SOON;
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Entities/Player/Player.h
Expand Up @@ -1129,7 +1129,7 @@ class Player : public Unit, public GridObject<Player>
void SendInitialPacketsAfterAddToMap();
void SendSupercededSpell(uint32 oldSpell, uint32 newSpell);
void SendTransferAborted(uint32 mapid, TransferAbortReason reason, uint8 arg = 0);
void SendInstanceResetWarning(uint32 mapid, Difficulty difficulty, uint32 time);
void SendInstanceResetWarning(uint32 mapid, Difficulty difficulty, uint32 time, bool welcome);

bool CanInteractWithQuestGiver(Object* questGiver);
Creature* GetNPCIfCanInteractWith(ObjectGuid guid, uint32 npcflagmask);
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Handlers/MovementHandler.cpp
Expand Up @@ -163,7 +163,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
if (time_t timeReset = sInstanceSaveMgr->GetResetTimeFor(mEntry->MapID, diff))
{
uint32 timeleft = uint32(timeReset - time(NULL));
GetPlayer()->SendInstanceResetWarning(mEntry->MapID, diff, timeleft);
GetPlayer()->SendInstanceResetWarning(mEntry->MapID, diff, timeleft, true);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/server/game/Instances/InstanceSaveMgr.cpp
Expand Up @@ -646,10 +646,10 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, b

if (warn)
{
if (now <= resetTime)
if (now >= resetTime)
timeLeft = 0;
else
timeLeft = uint32(now - resetTime);
timeLeft = uint32(resetTime - now);

((InstanceMap*)map2)->SendResetWarnings(timeLeft);
}
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Maps/Map.cpp
Expand Up @@ -3171,7 +3171,7 @@ void InstanceMap::UnloadAll()
void InstanceMap::SendResetWarnings(uint32 timeLeft) const
{
for (MapRefManager::const_iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr)
itr->GetSource()->SendInstanceResetWarning(GetId(), itr->GetSource()->GetDifficulty(IsRaid()), timeLeft);
itr->GetSource()->SendInstanceResetWarning(GetId(), itr->GetSource()->GetDifficulty(IsRaid()), timeLeft, false);
}

void InstanceMap::SetResetSchedule(bool on)
Expand Down

0 comments on commit fae8269

Please sign in to comment.