[7297] Fixed profession spells sorting in trainer spell list at client.
[getmangos.git] / src / game / CalendarHandler.cpp
blob9d1171687b62edc837d265fc281d8642110b0abf
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"
27 void WorldSession::HandleCalendarGetCalendar(WorldPacket &recv_data)
29 sLog.outDebug("WORLD: CMSG_CALENDAR_GET_CALENDAR");
30 recv_data.hexlike();
32 time_t cur_time = time(NULL);
34 WorldPacket data(SMSG_CALENDAR_SEND_CALENDAR,4+4*0+4+4*0+4+4);
36 // TODO: calendar invite event output
37 data << (uint32) 0; //invite node count
38 // TODO: calendar event output
39 data << (uint32) 0; //event count
41 data << (uint32) 0; //wtf??
42 data << (uint32) secsToTimeBitFields(cur_time); // current time
44 uint32 counter = 0;
45 size_t p_counter = data.wpos();
46 data << uint32(counter); // instance save count
48 for(int i = 0; i < TOTAL_DIFFICULTIES; ++i)
50 for (Player::BoundInstancesMap::iterator itr = _player->m_boundInstances[i].begin(); itr != _player->m_boundInstances[i].end(); ++itr)
52 if(itr->second.perm)
54 InstanceSave *save = itr->second.save;
55 data << uint32(save->GetMapId());
56 data << uint32(save->GetDifficulty());
57 data << uint32(save->GetResetTime() - cur_time);
58 data << uint64(save->GetInstanceId()); // instance save id as unique instance copy id
59 ++counter;
63 data.put<uint32>(p_counter,counter);
65 data << (uint32) 1135753200; //wtf?? (28.12.2005 12:00)
66 data << (uint32) 0; // unk counter 4
67 data << (uint32) 0; // unk counter 5
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);