Core/Calendar

* Added sending SMSG_CALENDAR_RAID_LOCKOUT_REMOVED when instance save is removed
* Refactored sending SMSG_CALENDAR_RAID_LOCKOUT_ADDED/REMOVED into separate method
This commit is contained in:
Shauren
2012-02-24 19:31:40 +01:00
parent a09310244f
commit a934abbbb7
4 changed files with 25 additions and 16 deletions
+4 -8
View File
@@ -18117,6 +18117,9 @@ void Player::UnbindInstance(BoundInstancesMap::iterator &itr, Difficulty difficu
}
itr->second.save->RemovePlayer(this); // save can become invalid
if (itr->second.perm)
GetSession()->SendCalendarRaidLockout(itr->second.save, false);
m_boundInstances[difficulty].erase(itr++);
}
}
@@ -18186,14 +18189,7 @@ void Player::BindToInstance()
GetSession()->SendPacket(&data);
BindToInstance(mapSave, true);
time_t currTime = time(NULL);
data.Initialize(SMSG_CALENDAR_RAID_LOCKOUT_ADDED, 4 + 4 + 4 + 4 + 8);
data << uint32(secsToTimeBitFields(currTime));
data << uint32(mapSave->GetMapId());
data << uint32(mapSave->GetDifficulty());
data << uint32(mapSave->GetResetTime() - currTime);
data << uint64(mapSave->GetInstanceId());
GetSession()->SendPacket(&data);
GetSession()->SendCalendarRaidLockout(mapSave, true);
}
void Player::SendRaidInfo()
@@ -414,3 +414,22 @@ void WorldSession::SendCalendarEventRemovedAlert(uint64 eventId)
data << uint32(0); // invite time
SendPacket(&data);
}
void WorldSession::SendCalendarRaidLockout(InstanceSave* save, bool add)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "%s", add ? "SMSG_CALENDAR_RAID_LOCKOUT_ADDED" : "SMSG_CALENDAR_RAID_LOCKOUT_REMOVED");
time_t currTime = time(NULL);
WorldPacket data(SMSG_CALENDAR_RAID_LOCKOUT_REMOVED, (add ? 4 : 0) + 4 + 4 + 4 + 8);
if (add)
{
data.SetOpcode(SMSG_CALENDAR_RAID_LOCKOUT_ADDED);
data << uint32(secsToTimeBitFields(currTime));
}
data << uint32(save->GetMapId());
data << uint32(save->GetDifficulty());
data << uint32(save->GetResetTime() - currTime);
data << uint64(save->GetInstanceId());
SendPacket(&data);
}
+1 -8
View File
@@ -2519,14 +2519,7 @@ void InstanceMap::PermBindAllPlayers(Player* source)
data << uint32(0);
player->GetSession()->SendPacket(&data);
time_t currTime = time(NULL);
data.Initialize(SMSG_CALENDAR_RAID_LOCKOUT_ADDED, 4 + 4 + 4 + 4 + 8);
data << uint32(secsToTimeBitFields(currTime));
data << uint32(save->GetMapId());
data << uint32(save->GetDifficulty());
data << uint32(save->GetResetTime() - currTime);
data << uint64(save->GetInstanceId());
player->GetSession()->SendPacket(&data);
player->GetSession()->SendCalendarRaidLockout(save, true);
}
// if the leader is not in the instance the group will not get a perm bind
+1
View File
@@ -881,6 +881,7 @@ class WorldSession
void SendCalendarEvent(uint64 eventId, bool added = false);
void SendCalendarEventInviteAlert(uint64 eventId, uint64 inviteId);
void SendCalendarEventRemovedAlert(uint64 eventId);
void SendCalendarRaidLockout(InstanceSave* save, bool add);
void HandleSpellClick(WorldPacket& recv_data);
void HandleMirrorImageDataRequest(WorldPacket& recv_data);