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
22 #include "WorldPacket.h"
23 #include "WorldSession.h"
25 #include "InstanceSaveMgr.h"
27 void WorldSession::HandleCalendarGetCalendar(WorldPacket
&recv_data
)
29 sLog
.outDebug("WORLD: CMSG_CALENDAR_GET_CALENDAR"); // empty
31 time_t cur_time
= time(NULL
);
33 WorldPacket
data(SMSG_CALENDAR_SEND_CALENDAR
,4+4*0+4+4*0+4+4);
35 // TODO: calendar invite event output
36 data
<< (uint32
) 0; //invite node count
37 // TODO: calendar event output
38 data
<< (uint32
) 0; //event count
40 data
<< (uint32
) 0; //wtf??
41 data
<< (uint32
) secsToTimeBitFields(cur_time
); // current time
44 size_t p_counter
= data
.wpos();
45 data
<< uint32(counter
); // instance save count
47 for(int i
= 0; i
< TOTAL_DIFFICULTIES
; ++i
)
49 for (Player::BoundInstancesMap::const_iterator itr
= _player
->m_boundInstances
[i
].begin(); itr
!= _player
->m_boundInstances
[i
].end(); ++itr
)
53 InstanceSave
*save
= itr
->second
.save
;
54 data
<< uint32(save
->GetMapId());
55 data
<< uint32(save
->GetDifficulty());
56 data
<< uint32(save
->GetResetTime() - cur_time
);
57 data
<< uint64(save
->GetInstanceId()); // instance save id as unique instance copy id
62 data
.put
<uint32
>(p_counter
,counter
);
64 data
<< (uint32
) 1135753200; //wtf?? (28.12.2005 12:00)
65 data
<< (uint32
) 0; // unk counter 4
66 data
<< (uint32
) 0; // unk counter 5
67 //sLog.outDebug("Sending calendar");
72 void WorldSession::HandleCalendarGetEvent(WorldPacket
&recv_data
)
74 sLog
.outDebug("WORLD: CMSG_CALENDAR_GET_EVENT");
76 recv_data
.read_skip
<uint64
>(); // unk
79 void WorldSession::HandleCalendarGuildFilter(WorldPacket
&recv_data
)
81 sLog
.outDebug("WORLD: CMSG_CALENDAR_GUILD_FILTER");
83 recv_data
.read_skip
<uint32
>(); // unk1
84 recv_data
.read_skip
<uint32
>(); // unk2
85 recv_data
.read_skip
<uint32
>(); // unk3
88 void WorldSession::HandleCalendarArenaTeam(WorldPacket
&recv_data
)
90 sLog
.outDebug("WORLD: CMSG_CALENDAR_ARENA_TEAM");
92 recv_data
.read_skip
<uint32
>(); // unk
95 void WorldSession::HandleCalendarAddEvent(WorldPacket
&recv_data
)
97 sLog
.outDebug("WORLD: CMSG_CALENDAR_ADD_EVENT");
99 recv_data
.rpos(recv_data
.wpos()); // set to end to avoid warnings spam
101 //std::string unk1, unk2;
102 //recv_data >> (std::string)unk1;
103 //recv_data >> (std::string)unk2;
106 //uint32 unk5, unk6, unk7, unk8, unk9, count = 0;
107 //recv_data >> (uint8)unk3;
108 //recv_data >> (uint8)unk4;
109 //recv_data >> (uint32)unk5;
110 //recv_data >> (uint32)unk6;
111 //recv_data >> (uint32)unk7;
112 //recv_data >> (uint32)unk8;
113 //recv_data >> (uint32)unk9;
114 //if (!((unk9 >> 6) & 1))
116 // recv_data >> (uint32)count;
119 // uint8 unk12,unk13;
121 // for (int i=0;i<count;i++)
123 // recv_data.readPackGUID(guid);
124 // recv_data >> (uint8)unk12;
125 // recv_data >> (uint8)unk13;
131 void WorldSession::HandleCalendarUpdateEvent(WorldPacket
&recv_data
)
133 sLog
.outDebug("WORLD: CMSG_CALENDAR_UPDATE_EVENT");
135 recv_data
.rpos(recv_data
.wpos()); // set to end to avoid warnings spam
137 //recv_data >> uint64
138 //recv_data >> uint64
139 //recv_data >> std::string
140 //recv_data >> std::string
143 //recv_data >> uint32
144 //recv_data >> uint32
145 //recv_data >> uint32
146 //recv_data >> uint32
147 //recv_data >> uint32
150 void WorldSession::HandleCalendarRemoveEvent(WorldPacket
&recv_data
)
152 sLog
.outDebug("WORLD: CMSG_CALENDAR_REMOVE_EVENT");
154 recv_data
.rpos(recv_data
.wpos()); // set to end to avoid warnings spam
156 //recv_data >> uint64
157 //recv_data >> uint64
158 //recv_data >> uint32
162 void WorldSession::HandleCalendarCopyEvent(WorldPacket
&recv_data
)
164 sLog
.outDebug("WORLD: CMSG_CALENDAR_COPY_EVENT");
166 recv_data
.rpos(recv_data
.wpos()); // set to end to avoid warnings spam
168 //recv_data >> uint64
169 //recv_data >> uint64
170 //recv_data >> uint32
174 void WorldSession::HandleCalendarEventInvite(WorldPacket
&recv_data
)
176 sLog
.outDebug("WORLD: CMSG_CALENDAR_EVENT_INVITE");
178 recv_data
.rpos(recv_data
.wpos()); // set to end to avoid warnings spam
180 //recv_data >> uint64
181 //recv_data >> uint64
182 //recv_data >> std::string
188 void WorldSession::HandleCalendarEventRsvp(WorldPacket
&recv_data
)
190 sLog
.outDebug("WORLD: CMSG_CALENDAR_EVENT_RSVP");
192 recv_data
.rpos(recv_data
.wpos()); // set to end to avoid warnings spam
194 //recv_data >> uint64
195 //recv_data >> uint64
196 //recv_data >> uint32
200 void WorldSession::HandleCalendarEventRemoveInvite(WorldPacket
&recv_data
)
202 sLog
.outDebug("WORLD: CMSG_CALENDAR_EVENT_REMOVE_INVITE");
204 recv_data
.rpos(recv_data
.wpos()); // set to end to avoid warnings spam
206 //recv_data.readPackGUID(guid)
207 //recv_data >> uint64
208 //recv_data >> uint64
209 //recv_data >> uint64
212 void WorldSession::HandleCalendarEventStatus(WorldPacket
&recv_data
)
214 sLog
.outDebug("WORLD: CMSG_CALENDAR_EVENT_STATUS");
216 recv_data
.rpos(recv_data
.wpos()); // set to end to avoid warnings spam
218 //recv_data.readPackGUID(guid)
219 //recv_data >> uint64
220 //recv_data >> uint64
221 //recv_data >> uint64
222 //recv_data >> uint32
225 void WorldSession::HandleCalendarEventModeratorStatus(WorldPacket
&recv_data
)
227 sLog
.outDebug("WORLD: CMSG_CALENDAR_EVENT_MODERATOR_STATUS");
229 recv_data
.rpos(recv_data
.wpos()); // set to end to avoid warnings spam
231 //recv_data.readPackGUID(guid)
232 //recv_data >> uint64
233 //recv_data >> uint64
234 //recv_data >> uint64
235 //recv_data >> uint32
238 void WorldSession::HandleCalendarComplain(WorldPacket
&recv_data
)
240 sLog
.outDebug("WORLD: CMSG_CALENDAR_COMPLAIN");
242 recv_data
.rpos(recv_data
.wpos()); // set to end to avoid warnings spam
244 //recv_data >> uint64
245 //recv_data >> uint64
246 //recv_data >> uint64
249 void WorldSession::HandleCalendarGetNumPending(WorldPacket
& /*recv_data*/)
251 sLog
.outDebug("WORLD: CMSG_CALENDAR_GET_NUM_PENDING"); // empty
253 WorldPacket
data(SMSG_CALENDAR_SEND_NUM_PENDING
, 4);
254 data
<< uint32(0); // 0 - no pending invites, 1 - some pending invites