PageRenderTime 50ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/src/game/CalendarHandler.cpp

https://gitlab.com/Kanedias/MangosDeprecated
C++ | 256 lines | 127 code | 39 blank | 90 comment | 4 complexity | c4b9379cba472a2e9dfbafc967c63821 MD5 | raw file
  1. /*
  2. * Copyright (C) 2005-2010 MaNGOS <http://www.mangosproject.org/>
  3. *
  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.
  8. *
  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.
  13. *
  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
  17. */
  18. #include "Common.h"
  19. #include "Log.h"
  20. #include "Player.h"
  21. #include "WorldPacket.h"
  22. #include "WorldSession.h"
  23. #include "Opcodes.h"
  24. #include "InstanceSaveMgr.h"
  25. void WorldSession::HandleCalendarGetCalendar(WorldPacket &/*recv_data*/)
  26. {
  27. DEBUG_LOG("WORLD: CMSG_CALENDAR_GET_CALENDAR"); // empty
  28. time_t cur_time = time(NULL);
  29. WorldPacket data(SMSG_CALENDAR_SEND_CALENDAR,4+4*0+4+4*0+4+4);
  30. // TODO: calendar invite event output
  31. data << (uint32) 0; //invite node count
  32. // TODO: calendar event output
  33. data << (uint32) 0; //event count
  34. data << (uint32) 0; //wtf??
  35. data << (uint32) secsToTimeBitFields(cur_time); // current time
  36. uint32 counter = 0;
  37. size_t p_counter = data.wpos();
  38. data << uint32(counter); // instance save count
  39. for(int i = 0; i < MAX_DIFFICULTY; ++i)
  40. {
  41. for (Player::BoundInstancesMap::const_iterator itr = _player->m_boundInstances[i].begin(); itr != _player->m_boundInstances[i].end(); ++itr)
  42. {
  43. if(itr->second.perm)
  44. {
  45. InstanceSave *save = itr->second.save;
  46. data << uint32(save->GetMapId());
  47. data << uint32(save->GetDifficulty());
  48. data << uint32(save->GetResetTime() - cur_time);
  49. data << uint64(save->GetInstanceId()); // instance save id as unique instance copy id
  50. ++counter;
  51. }
  52. }
  53. }
  54. data.put<uint32>(p_counter,counter);
  55. data << (uint32) 1135753200; //wtf?? (28.12.2005 12:00)
  56. data << (uint32) 0; // unk counter 4
  57. data << (uint32) 0; // unk counter 5
  58. //DEBUG_LOG("Sending calendar");
  59. //data.hexlike();
  60. SendPacket(&data);
  61. }
  62. void WorldSession::HandleCalendarGetEvent(WorldPacket &recv_data)
  63. {
  64. DEBUG_LOG("WORLD: CMSG_CALENDAR_GET_EVENT");
  65. recv_data.hexlike();
  66. recv_data.read_skip<uint64>(); // unk
  67. }
  68. void WorldSession::HandleCalendarGuildFilter(WorldPacket &recv_data)
  69. {
  70. DEBUG_LOG("WORLD: CMSG_CALENDAR_GUILD_FILTER");
  71. recv_data.hexlike();
  72. recv_data.read_skip<uint32>(); // unk1
  73. recv_data.read_skip<uint32>(); // unk2
  74. recv_data.read_skip<uint32>(); // unk3
  75. }
  76. void WorldSession::HandleCalendarArenaTeam(WorldPacket &recv_data)
  77. {
  78. DEBUG_LOG("WORLD: CMSG_CALENDAR_ARENA_TEAM");
  79. recv_data.hexlike();
  80. recv_data.read_skip<uint32>(); // unk
  81. }
  82. void WorldSession::HandleCalendarAddEvent(WorldPacket &recv_data)
  83. {
  84. DEBUG_LOG("WORLD: CMSG_CALENDAR_ADD_EVENT");
  85. recv_data.hexlike();
  86. recv_data.rpos(recv_data.wpos()); // set to end to avoid warnings spam
  87. //std::string unk1, unk2;
  88. //recv_data >> (std::string)unk1;
  89. //recv_data >> (std::string)unk2;
  90. //uint8 unk3, unk4;
  91. //uint32 unk5, unk6, unk7, unk8, unk9, count = 0;
  92. //recv_data >> (uint8)unk3;
  93. //recv_data >> (uint8)unk4;
  94. //recv_data >> (uint32)unk5;
  95. //recv_data >> (uint32)unk6;
  96. //recv_data >> (uint32)unk7;
  97. //recv_data >> (uint32)unk8;
  98. //recv_data >> (uint32)unk9;
  99. //if (!((unk9 >> 6) & 1))
  100. //{
  101. // recv_data >> (uint32)count;
  102. // if (count)
  103. // {
  104. // uint8 unk12,unk13;
  105. // uint64 guid;
  106. // for (int i=0;i<count;i++)
  107. // {
  108. // recv_data.readPackGUID(guid);
  109. // recv_data >> (uint8)unk12;
  110. // recv_data >> (uint8)unk13;
  111. // }
  112. // }
  113. //}
  114. }
  115. void WorldSession::HandleCalendarUpdateEvent(WorldPacket &recv_data)
  116. {
  117. DEBUG_LOG("WORLD: CMSG_CALENDAR_UPDATE_EVENT");
  118. recv_data.hexlike();
  119. recv_data.rpos(recv_data.wpos()); // set to end to avoid warnings spam
  120. //recv_data >> uint64
  121. //recv_data >> uint64
  122. //recv_data >> std::string
  123. //recv_data >> std::string
  124. //recv_data >> uint8
  125. //recv_data >> uint8
  126. //recv_data >> uint32
  127. //recv_data >> uint32
  128. //recv_data >> uint32
  129. //recv_data >> uint32
  130. //recv_data >> uint32
  131. }
  132. void WorldSession::HandleCalendarRemoveEvent(WorldPacket &recv_data)
  133. {
  134. DEBUG_LOG("WORLD: CMSG_CALENDAR_REMOVE_EVENT");
  135. recv_data.hexlike();
  136. recv_data.rpos(recv_data.wpos()); // set to end to avoid warnings spam
  137. //recv_data >> uint64
  138. //recv_data >> uint64
  139. //recv_data >> uint32
  140. }
  141. void WorldSession::HandleCalendarCopyEvent(WorldPacket &recv_data)
  142. {
  143. DEBUG_LOG("WORLD: CMSG_CALENDAR_COPY_EVENT");
  144. recv_data.hexlike();
  145. recv_data.rpos(recv_data.wpos()); // set to end to avoid warnings spam
  146. //recv_data >> uint64
  147. //recv_data >> uint64
  148. //recv_data >> uint32
  149. }
  150. void WorldSession::HandleCalendarEventInvite(WorldPacket &recv_data)
  151. {
  152. DEBUG_LOG("WORLD: CMSG_CALENDAR_EVENT_INVITE");
  153. recv_data.hexlike();
  154. recv_data.rpos(recv_data.wpos()); // set to end to avoid warnings spam
  155. //recv_data >> uint64
  156. //recv_data >> uint64
  157. //recv_data >> std::string
  158. //recv_data >> uint8
  159. //recv_data >> uint8
  160. }
  161. void WorldSession::HandleCalendarEventRsvp(WorldPacket &recv_data)
  162. {
  163. DEBUG_LOG("WORLD: CMSG_CALENDAR_EVENT_RSVP");
  164. recv_data.hexlike();
  165. recv_data.rpos(recv_data.wpos()); // set to end to avoid warnings spam
  166. //recv_data >> uint64
  167. //recv_data >> uint64
  168. //recv_data >> uint32
  169. }
  170. void WorldSession::HandleCalendarEventRemoveInvite(WorldPacket &recv_data)
  171. {
  172. DEBUG_LOG("WORLD: CMSG_CALENDAR_EVENT_REMOVE_INVITE");
  173. recv_data.hexlike();
  174. recv_data.rpos(recv_data.wpos()); // set to end to avoid warnings spam
  175. //recv_data.readPackGUID(guid)
  176. //recv_data >> uint64
  177. //recv_data >> uint64
  178. //recv_data >> uint64
  179. }
  180. void WorldSession::HandleCalendarEventStatus(WorldPacket &recv_data)
  181. {
  182. DEBUG_LOG("WORLD: CMSG_CALENDAR_EVENT_STATUS");
  183. recv_data.hexlike();
  184. recv_data.rpos(recv_data.wpos()); // set to end to avoid warnings spam
  185. //recv_data.readPackGUID(guid)
  186. //recv_data >> uint64
  187. //recv_data >> uint64
  188. //recv_data >> uint64
  189. //recv_data >> uint32
  190. }
  191. void WorldSession::HandleCalendarEventModeratorStatus(WorldPacket &recv_data)
  192. {
  193. DEBUG_LOG("WORLD: CMSG_CALENDAR_EVENT_MODERATOR_STATUS");
  194. recv_data.hexlike();
  195. recv_data.rpos(recv_data.wpos()); // set to end to avoid warnings spam
  196. //recv_data.readPackGUID(guid)
  197. //recv_data >> uint64
  198. //recv_data >> uint64
  199. //recv_data >> uint64
  200. //recv_data >> uint32
  201. }
  202. void WorldSession::HandleCalendarComplain(WorldPacket &recv_data)
  203. {
  204. DEBUG_LOG("WORLD: CMSG_CALENDAR_COMPLAIN");
  205. recv_data.hexlike();
  206. recv_data.rpos(recv_data.wpos()); // set to end to avoid warnings spam
  207. //recv_data >> uint64
  208. //recv_data >> uint64
  209. //recv_data >> uint64
  210. }
  211. void WorldSession::HandleCalendarGetNumPending(WorldPacket & /*recv_data*/)
  212. {
  213. DEBUG_LOG("WORLD: CMSG_CALENDAR_GET_NUM_PENDING"); // empty
  214. WorldPacket data(SMSG_CALENDAR_SEND_NUM_PENDING, 4);
  215. data << uint32(0); // 0 - no pending invites, 1 - some pending invites
  216. SendPacket(&data);
  217. }