[7186] Implement instance reset time show in calender.
[getmangos.git] / src / game / CalendarHandler.cpp
blob225e598e6e10e9e3b305862a1b396b01352ae6b6
1 /*
2 * Copyright (C) 2005-2009 MaNGOS <http://www.mangosproject.org/>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #include "Common.h"
20 #include "Log.h"
21 #include "Player.h"
22 #include "WorldPacket.h"
23 #include "WorldSession.h"
24 #include "Opcodes.h"
25 #include "InstanceSaveMgr.h"
29 void WorldSession::HandleCalendarGetCalendar(WorldPacket &recv_data)
31 sLog.outDebug("WORLD: CMSG_CALENDAR_GET_CALENDAR");
32 recv_data.hexlike();
34 time_t cur_time = time(NULL);
36 WorldPacket data(SMSG_CALENDAR_SEND_CALENDAR,4+4*0+4+4*0+4+4);
38 // TODO: calendar invite event output
39 data << (uint32) 0; //invite node count
40 // TODO: calendar event output
41 data << (uint32) 0; //event count
43 data << (uint32) 0; //wtf??
44 data << (uint32) secsToTimeBitFields(cur_time); // current time
46 uint32 counter = 0;
47 size_t p_counter = data.wpos();
48 data << uint32(counter); // instance save count
50 for(int i = 0; i < TOTAL_DIFFICULTIES; ++i)
52 for (Player::BoundInstancesMap::iterator itr = _player->m_boundInstances[i].begin(); itr != _player->m_boundInstances[i].end(); ++itr)
54 if(itr->second.perm)
56 InstanceSave *save = itr->second.save;
57 data << uint32(save->GetMapId());
58 data << uint32(save->GetDifficulty());
59 data << uint32(save->GetResetTime() - cur_time);
60 data << uint64(save->GetInstanceId()); // instance save id as unique instance copy id
61 ++counter;
65 data.put<uint32>(p_counter,counter);
67 data << (uint32) 1135753200; //wtf?? (28.12.2005 12:00)
68 sLog.outDebug("Sending calendar");
69 //data.hexlike();
70 SendPacket(&data);
73 void WorldSession::HandleCalendarGetEvent(WorldPacket &recv_data)
75 sLog.outDebug("WORLD: CMSG_CALENDAR_GET_EVENT");
76 recv_data.hexlike();
79 void WorldSession::HandleCalendarGuildFilter(WorldPacket &recv_data)
81 sLog.outDebug("WORLD: CMSG_CALENDAR_GUILD_FILTER");
82 recv_data.hexlike();
85 void WorldSession::HandleCalendarArenaTeam(WorldPacket &recv_data)
87 sLog.outDebug("WORLD: CMSG_CALENDAR_ARENA_TEAM");
88 recv_data.hexlike();
91 void WorldSession::HandleCalendarAddEvent(WorldPacket &recv_data)
93 sLog.outDebug("WORLD: CMSG_CALENDAR_ADD_EVENT");
94 recv_data.hexlike();
97 void WorldSession::HandleCalendarUpdateEvent(WorldPacket &recv_data)
99 sLog.outDebug("WORLD: CMSG_CALENDAR_UPDATE_EVENT");
100 recv_data.hexlike();
103 void WorldSession::HandleCalendarRemoveEvent(WorldPacket &recv_data)
105 sLog.outDebug("WORLD: CMSG_CALENDAR_REMOVE_EVENT");
106 recv_data.hexlike();
109 void WorldSession::HandleCalendarCopyEvent(WorldPacket &recv_data)
111 sLog.outDebug("WORLD: CMSG_CALENDAR_COPY_EVENT");
112 recv_data.hexlike();
115 void WorldSession::HandleCalendarEventInvite(WorldPacket &recv_data)
117 sLog.outDebug("WORLD: CMSG_CALENDAR_EVENT_INVITE");
118 recv_data.hexlike();
121 void WorldSession::HandleCalendarEventRsvp(WorldPacket &recv_data)
123 sLog.outDebug("WORLD: CMSG_CALENDAR_EVENT_RSVP");
124 recv_data.hexlike();
127 void WorldSession::HandleCalendarEventRemoveInvite(WorldPacket &recv_data)
129 sLog.outDebug("WORLD: CMSG_CALENDAR_EVENT_REMOVE_INVITE");
130 recv_data.hexlike();
133 void WorldSession::HandleCalendarEventStatus(WorldPacket &recv_data)
135 sLog.outDebug("WORLD: CMSG_CALENDAR_EVENT_STATUS");
136 recv_data.hexlike();
139 void WorldSession::HandleCalendarEventModeratorStatus(WorldPacket &recv_data)
141 sLog.outDebug("WORLD: CMSG_CALENDAR_EVENT_MODERATOR_STATUS");
142 recv_data.hexlike();
145 void WorldSession::HandleCalendarComplain(WorldPacket &recv_data)
147 sLog.outDebug("WORLD: CMSG_CALENDAR_COMPLAIN");
148 recv_data.hexlike();
151 void WorldSession::HandleCalendarGetNumPending(WorldPacket &recv_data)
153 sLog.outDebug("WORLD: CMSG_CALENDAR_GET_NUM_PENDING");
154 recv_data.hexlike();
156 WorldPacket data(SMSG_CALENDAR_SEND_NUM_PENDING, 4);
157 data << uint32(0); // 0 - no pending invites, 1 - some pending invites
158 SendPacket(&data);