mirror of
https://github.com/mangosfour/server.git
synced 2025-12-26 16:37:06 +00:00
Second set of Moves and Year update
This commit is contained in:
parent
9d20fe2b32
commit
12257a5bc2
493 changed files with 491 additions and 491 deletions
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
730
src/game/Object/Calendar.cpp
Normal file
730
src/game/Object/Calendar.cpp
Normal file
|
|
@ -0,0 +1,730 @@
|
|||
/*
|
||||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* World of Warcraft, and all World of Warcraft or Warcraft art, images,
|
||||
* and lore are copyrighted by Blizzard Entertainment, Inc.
|
||||
*/
|
||||
|
||||
#include "Calendar.h"
|
||||
#include "Guild.h"
|
||||
#include "Mail.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "ProgressBar.h"
|
||||
|
||||
INSTANTIATE_SINGLETON_1(CalendarMgr);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// CalendarEvent Class to store single event informations
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CalendarEvent::~CalendarEvent()
|
||||
{
|
||||
RemoveAllInvite();
|
||||
}
|
||||
|
||||
// Add an invite to internal invite map return true if success
|
||||
bool CalendarEvent::AddInvite(CalendarInvite* invite)
|
||||
{
|
||||
if (!invite)
|
||||
return false;
|
||||
|
||||
return m_Invitee.insert(CalendarInviteMap::value_type(invite->InviteId, invite)).second;
|
||||
}
|
||||
|
||||
CalendarInvite* CalendarEvent::GetInviteById(uint64 inviteId)
|
||||
{
|
||||
CalendarInviteMap::iterator itr = m_Invitee.find(inviteId);
|
||||
if (itr != m_Invitee.end())
|
||||
return itr->second;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CalendarInvite* CalendarEvent::GetInviteByGuid(ObjectGuid const& guid)
|
||||
{
|
||||
CalendarInviteMap::const_iterator inviteItr = m_Invitee.begin();
|
||||
while (inviteItr != m_Invitee.end())
|
||||
{
|
||||
if (inviteItr->second->InviteeGuid == guid)
|
||||
return inviteItr->second;
|
||||
++inviteItr;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// remove invite by its iterator
|
||||
void CalendarEvent::RemoveInviteByItr(CalendarInviteMap::iterator inviteItr)
|
||||
{
|
||||
MANGOS_ASSERT(inviteItr != m_Invitee.end()); // iterator must be valid
|
||||
|
||||
if (!IsGuildEvent())
|
||||
sCalendarMgr.SendCalendarEventInviteRemoveAlert(sObjectMgr.GetPlayer(inviteItr->second->InviteeGuid), this, CALENDAR_STATUS_REMOVED);
|
||||
|
||||
sCalendarMgr.SendCalendarEventInviteRemove(inviteItr->second, Flags);
|
||||
|
||||
CharacterDatabase.PExecute("DELETE FROM calendar_invites WHERE inviteId=" UI64FMTD, inviteItr->second->InviteId);
|
||||
|
||||
delete inviteItr->second;
|
||||
m_Invitee.erase(inviteItr);
|
||||
}
|
||||
|
||||
// remove invite by ObjectGuid of the player (may not be found so nothing removed)
|
||||
void CalendarEvent::RemoveInviteByGuid(ObjectGuid const& playerGuid)
|
||||
{
|
||||
CalendarInviteMap::iterator itr = m_Invitee.begin();
|
||||
while (itr != m_Invitee.end())
|
||||
{
|
||||
if (itr->second->InviteeGuid == playerGuid)
|
||||
RemoveInviteByItr(itr++);
|
||||
else
|
||||
++itr;
|
||||
}
|
||||
}
|
||||
|
||||
// remove invite by invite ID (some check done before and if requirement not complete
|
||||
// operation is aborted and raison is sent to client
|
||||
bool CalendarEvent::RemoveInviteById(uint64 inviteId, Player* remover)
|
||||
{
|
||||
CalendarInviteMap::iterator inviteItr = m_Invitee.find(inviteId);
|
||||
if (inviteItr == m_Invitee.end())
|
||||
{
|
||||
// invite not found
|
||||
sCalendarMgr.SendCalendarCommandResult(remover, CALENDAR_ERROR_NO_INVITE);
|
||||
return false;
|
||||
}
|
||||
|
||||
// assign a pointer to CalendarInvite class to make read more easy
|
||||
CalendarInvite* invite = inviteItr->second;
|
||||
|
||||
if (invite->InviteeGuid != remover->GetObjectGuid())
|
||||
{
|
||||
// check if remover is an invitee
|
||||
CalendarInvite* removerInvite = GetInviteByGuid(remover->GetObjectGuid());
|
||||
if (removerInvite == NULL)
|
||||
{
|
||||
// remover is not invitee cheat???
|
||||
sCalendarMgr.SendCalendarCommandResult(remover, CALENDAR_ERROR_NOT_INVITED);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (removerInvite->Rank != CALENDAR_RANK_MODERATOR && removerInvite->Rank != CALENDAR_RANK_OWNER)
|
||||
{
|
||||
// remover have not enough right to remove invite
|
||||
sCalendarMgr.SendCalendarCommandResult(remover, CALENDAR_ERROR_PERMISSIONS);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (CreatorGuid == invite->InviteeGuid)
|
||||
{
|
||||
sCalendarMgr.SendCalendarCommandResult(remover, CALENDAR_ERROR_DELETE_CREATOR_FAILED);
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO: Send mail to invitee if needed
|
||||
|
||||
RemoveInviteByItr(inviteItr);
|
||||
return true;
|
||||
}
|
||||
|
||||
// remove all invite without sending ingame mail
|
||||
void CalendarEvent::RemoveAllInvite()
|
||||
{
|
||||
CalendarInviteMap::iterator itr = m_Invitee.begin();
|
||||
while (itr != m_Invitee.end())
|
||||
RemoveInviteByItr(itr++);
|
||||
}
|
||||
|
||||
// remove all invite sending ingame mail
|
||||
void CalendarEvent::RemoveAllInvite(ObjectGuid const& removerGuid)
|
||||
{
|
||||
// build mail title
|
||||
std::ostringstream title;
|
||||
title << removerGuid << ':' << Title;
|
||||
|
||||
// build mail body
|
||||
std::ostringstream body;
|
||||
body << secsToTimeBitFields(time(NULL));
|
||||
|
||||
// creating mail draft
|
||||
MailDraft draft(title.str(), body.str());
|
||||
|
||||
CalendarInviteMap::iterator itr = m_Invitee.begin();
|
||||
while (itr != m_Invitee.end())
|
||||
{
|
||||
if (removerGuid != itr->second->InviteeGuid)
|
||||
draft.SendMailTo(MailReceiver(itr->second->InviteeGuid), this, MAIL_CHECK_MASK_COPIED);
|
||||
RemoveInviteByItr(itr++);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// CalendarInvite Classes store single invite information
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CalendarInvite::CalendarInvite(CalendarEvent* event, uint64 inviteId, ObjectGuid senderGuid, ObjectGuid inviteeGuid, time_t statusTime, CalendarInviteStatus status, CalendarModerationRank rank, std::string text) :
|
||||
m_calendarEvent(event), InviteId(inviteId), SenderGuid(senderGuid), InviteeGuid(inviteeGuid), LastUpdateTime(statusTime), Status(status), Rank(rank), Text(text)
|
||||
{
|
||||
// only for pre invite case
|
||||
if (!event)
|
||||
InviteId = 0;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// CalendarMgr Classes handle all events and invites.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// fill all player events in provided CalendarEventsList
|
||||
void CalendarMgr::GetPlayerEventsList(ObjectGuid const& guid, CalendarEventsList& calEventList)
|
||||
{
|
||||
uint32 guildId = 0;
|
||||
Player* player = sObjectMgr.GetPlayer(guid);
|
||||
if (player)
|
||||
guildId = player->GetGuildId();
|
||||
else
|
||||
guildId = Player::GetGuildIdFromDB(guid);
|
||||
|
||||
for (CalendarEventStore::iterator itr = m_EventStore.begin(); itr != m_EventStore.end(); ++itr)
|
||||
{
|
||||
CalendarEvent* event = &itr->second;
|
||||
|
||||
// add own event and same guild event or announcement
|
||||
if ((event->CreatorGuid == guid) || ((event->IsGuildAnnouncement() || event->IsGuildEvent()) && event->GuildId == guildId))
|
||||
{
|
||||
calEventList.push_back(event);
|
||||
continue;
|
||||
}
|
||||
|
||||
// add all event where player is invited
|
||||
if (event->GetInviteByGuid(guid))
|
||||
calEventList.push_back(event);
|
||||
}
|
||||
}
|
||||
|
||||
// fill all player invites in provided CalendarInvitesList
|
||||
void CalendarMgr::GetPlayerInvitesList(ObjectGuid const& guid, CalendarInvitesList& calInvList)
|
||||
{
|
||||
for (CalendarEventStore::iterator itr = m_EventStore.begin(); itr != m_EventStore.end(); ++itr)
|
||||
{
|
||||
CalendarEvent* event = &itr->second;
|
||||
|
||||
if (event->IsGuildAnnouncement())
|
||||
continue;
|
||||
|
||||
CalendarInviteMap const* cInvMap = event->GetInviteMap();
|
||||
CalendarInviteMap::const_iterator ci_itr = cInvMap->begin();
|
||||
while (ci_itr != cInvMap->end())
|
||||
{
|
||||
if (ci_itr->second->InviteeGuid == guid)
|
||||
{
|
||||
calInvList.push_back(ci_itr->second);
|
||||
break;
|
||||
}
|
||||
++ci_itr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add single event to main events store
|
||||
// some check done before so it may fail and raison is sent to client
|
||||
// return value is the CalendarEvent pointer on success
|
||||
CalendarEvent* CalendarMgr::AddEvent(ObjectGuid const& guid, std::string title, std::string description, uint32 type, uint32 repeatable,
|
||||
uint32 maxInvites, int32 dungeonId, time_t eventTime, time_t unkTime, uint32 flags)
|
||||
{
|
||||
Player* player = sObjectMgr.GetPlayer(guid);
|
||||
if (!player)
|
||||
return NULL;
|
||||
|
||||
if (title.empty())
|
||||
{
|
||||
SendCalendarCommandResult(player, CALENDAR_ERROR_NEEDS_TITLE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (eventTime < time(NULL))
|
||||
{
|
||||
SendCalendarCommandResult(player, CALENDAR_ERROR_INVALID_DATE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
uint32 guildId = 0;
|
||||
|
||||
if ((flags & CALENDAR_FLAG_GUILD_EVENT) || (flags & CALENDAR_FLAG_GUILD_ANNOUNCEMENT))
|
||||
{
|
||||
guildId = player->GetGuildId();
|
||||
if (!guildId)
|
||||
{
|
||||
SendCalendarCommandResult(player, CALENDAR_ERROR_GUILD_PLAYER_NOT_IN_GUILD);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!CanAddGuildEvent(guildId))
|
||||
{
|
||||
SendCalendarCommandResult(player, CALENDAR_ERROR_GUILD_EVENTS_EXCEEDED);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!CanAddEvent(guid))
|
||||
{
|
||||
SendCalendarCommandResult(player, CALENDAR_ERROR_EVENTS_EXCEEDED);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
uint64 nId = GetNewEventId();
|
||||
|
||||
DEBUG_FILTER_LOG(LOG_FILTER_CALENDAR, "CalendarMgr::AddEvent> ID("UI64FMTD"), '%s', Desc > '%s', type=%u, repeat=%u, maxInvites=%u, dungeonId=%d, flags=%u",
|
||||
nId, title.c_str(), description.c_str(), type, repeatable, maxInvites, dungeonId, flags);
|
||||
|
||||
CalendarEvent& newEvent = m_EventStore[nId];
|
||||
|
||||
newEvent.EventId = nId;
|
||||
newEvent.CreatorGuid = guid;
|
||||
newEvent.Title = title;
|
||||
newEvent.Description = description;
|
||||
newEvent.Type = (CalendarEventType) type;
|
||||
newEvent.Repeatable = (CalendarRepeatType) repeatable;
|
||||
newEvent.DungeonId = dungeonId;
|
||||
newEvent.EventTime = eventTime;
|
||||
newEvent.Flags = flags;
|
||||
newEvent.GuildId = guildId;
|
||||
|
||||
CharacterDatabase.escape_string(title);
|
||||
CharacterDatabase.escape_string(description);
|
||||
CharacterDatabase.PExecute("INSERT INTO calendar_events VALUES ("UI64FMTD", %u, %u, %u, %u, %d, %u, '%s', '%s')",
|
||||
nId,
|
||||
guid.GetCounter(),
|
||||
guildId,
|
||||
type,
|
||||
flags,
|
||||
dungeonId,
|
||||
uint32(eventTime),
|
||||
title.c_str(),
|
||||
description.c_str());
|
||||
return &newEvent;
|
||||
}
|
||||
|
||||
// remove event by its id
|
||||
// some check done before so it may fail and raison is sent to client
|
||||
void CalendarMgr::RemoveEvent(uint64 eventId, Player* remover)
|
||||
{
|
||||
CalendarEventStore::iterator citr = m_EventStore.find(eventId);
|
||||
if (citr == m_EventStore.end())
|
||||
{
|
||||
SendCalendarCommandResult(remover, CALENDAR_ERROR_EVENT_INVALID);
|
||||
return;
|
||||
}
|
||||
|
||||
if (remover->GetObjectGuid() != citr->second.CreatorGuid)
|
||||
{
|
||||
// only creator can remove his event
|
||||
SendCalendarCommandResult(remover, CALENDAR_ERROR_PERMISSIONS);
|
||||
return;
|
||||
}
|
||||
|
||||
SendCalendarEventRemovedAlert(&citr->second);
|
||||
|
||||
CharacterDatabase.PExecute("DELETE FROM calendar_events WHERE eventId=" UI64FMTD, eventId);
|
||||
|
||||
// explicitly remove all invite and send mail to all invitee
|
||||
citr->second.RemoveAllInvite(remover->GetObjectGuid());
|
||||
m_EventStore.erase(citr);
|
||||
}
|
||||
|
||||
// Add invit to an event and inform client
|
||||
// some check done before so it may fail and raison is sent to client
|
||||
// return value is the CalendarInvite pointer on success
|
||||
CalendarInvite* CalendarMgr::AddInvite(CalendarEvent* event, ObjectGuid const& senderGuid, ObjectGuid const& inviteeGuid, CalendarInviteStatus status, CalendarModerationRank rank, std::string text, time_t statusTime)
|
||||
{
|
||||
Player* sender = sObjectMgr.GetPlayer(senderGuid);
|
||||
if (!event || !sender)
|
||||
return NULL;
|
||||
|
||||
std::string name;
|
||||
sObjectMgr.GetPlayerNameByGUID(inviteeGuid, name);
|
||||
|
||||
// check if invitee is not already invited
|
||||
if (event->GetInviteByGuid(inviteeGuid))
|
||||
{
|
||||
SendCalendarCommandResult(sender, CALENDAR_ERROR_ALREADY_INVITED_TO_EVENT_S, name.c_str());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// check if player can still have new invite (except for event creator)
|
||||
if (!event->IsGuildAnnouncement() && event->CreatorGuid != inviteeGuid)
|
||||
{
|
||||
if (!CanAddInviteTo(inviteeGuid))
|
||||
{
|
||||
SendCalendarCommandResult(sender, CALENDAR_ERROR_OTHER_INVITES_EXCEEDED_S, name.c_str());
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
CalendarInvite* invite = new CalendarInvite(event, GetNewInviteId(), senderGuid, inviteeGuid, statusTime, status, rank, text);
|
||||
|
||||
if (!event->IsGuildAnnouncement())
|
||||
SendCalendarEventInvite(invite);
|
||||
|
||||
if (!event->IsGuildEvent() || invite->InviteeGuid == event->CreatorGuid)
|
||||
SendCalendarEventInviteAlert(invite);
|
||||
|
||||
if (event->IsGuildAnnouncement())
|
||||
{
|
||||
// no need to realy add invite for announcements
|
||||
delete invite;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DEBUG_FILTER_LOG(LOG_FILTER_CALENDAR, "Add Invite> eventId["UI64FMTD"], senderGuid[%s], inviteGuid[%s], Status[%u], rank[%u], text[%s], time[%u]",
|
||||
event->EventId, senderGuid.GetString().c_str(), inviteeGuid.GetString().c_str(), uint32(status), uint32(rank), text.c_str(), uint32(statusTime));
|
||||
|
||||
if (!event->AddInvite(invite))
|
||||
{
|
||||
sLog.outError("CalendarEvent::AddInvite > Fail adding invite!");
|
||||
delete invite;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CharacterDatabase.PExecute("INSERT INTO calendar_invites VALUES ("UI64FMTD", "UI64FMTD", %u, %u, %u, %u, %u)",
|
||||
invite->InviteId,
|
||||
event->EventId,
|
||||
inviteeGuid.GetCounter(),
|
||||
senderGuid.GetCounter(),
|
||||
uint32(status),
|
||||
uint32(statusTime),
|
||||
uint32(rank));
|
||||
|
||||
return invite;
|
||||
}
|
||||
|
||||
// remove invit from an event and inform client
|
||||
// some check done before so it may fail and raison is sent to client
|
||||
// require valid eventId/inviteId and correct right for the remover.
|
||||
bool CalendarMgr::RemoveInvite(uint64 eventId, uint64 inviteId, ObjectGuid const& removerGuid)
|
||||
{
|
||||
Player* remover = sObjectMgr.GetPlayer(removerGuid);
|
||||
CalendarEventStore::iterator citr = m_EventStore.find(eventId);
|
||||
if (citr == m_EventStore.end())
|
||||
{
|
||||
SendCalendarCommandResult(remover, CALENDAR_ERROR_EVENT_INVALID);
|
||||
return false;
|
||||
}
|
||||
|
||||
CalendarEvent& event = citr->second;
|
||||
|
||||
return event.RemoveInviteById(inviteId, remover);
|
||||
}
|
||||
|
||||
// return how many events still require some pending action
|
||||
uint32 CalendarMgr::GetPlayerNumPending(ObjectGuid const& guid)
|
||||
{
|
||||
CalendarInvitesList inviteList;
|
||||
GetPlayerInvitesList(guid, inviteList);
|
||||
|
||||
uint32 pendingNum = 0;
|
||||
time_t currTime = time(NULL);
|
||||
for (CalendarInvitesList::const_iterator itr = inviteList.begin(); itr != inviteList.end(); ++itr)
|
||||
{
|
||||
if (CalendarEvent const* event = (*itr)->GetCalendarEvent())
|
||||
{
|
||||
// pass all passed events
|
||||
if (event->EventTime < currTime)
|
||||
continue;
|
||||
|
||||
// pass all locked events
|
||||
if (event->Flags & CALENDAR_FLAG_INVITES_LOCKED)
|
||||
continue;
|
||||
}
|
||||
|
||||
// add only invite that require some action
|
||||
if ((*itr)->Status == CALENDAR_STATUS_INVITED || (*itr)->Status == CALENDAR_STATUS_TENTATIVE || (*itr)->Status == CALENDAR_STATUS_NOT_SIGNED_UP)
|
||||
++pendingNum;
|
||||
}
|
||||
|
||||
return pendingNum;
|
||||
}
|
||||
|
||||
// copy event to another date (all invitee is copied too but their status are reseted)
|
||||
void CalendarMgr::CopyEvent(uint64 eventId, time_t newTime, ObjectGuid const& guid)
|
||||
{
|
||||
Player* player = sObjectMgr.GetPlayer(guid);
|
||||
CalendarEvent* event = GetEventById(eventId);
|
||||
if (!event)
|
||||
{
|
||||
SendCalendarCommandResult(player, CALENDAR_ERROR_EVENT_INVALID);
|
||||
return;
|
||||
}
|
||||
|
||||
CalendarEvent* newEvent = AddEvent(guid, event->Title, event->Description, event->Type, event->Repeatable,
|
||||
CALENDAR_MAX_INVITES, event->DungeonId, newTime, event->UnknownTime, event->Flags);
|
||||
|
||||
if (!newEvent)
|
||||
return;
|
||||
|
||||
if (newEvent->IsGuildAnnouncement())
|
||||
AddInvite(newEvent, guid, guid, CALENDAR_STATUS_CONFIRMED, CALENDAR_RANK_OWNER, "", time(NULL));
|
||||
else
|
||||
{
|
||||
// copy all invitees, set new owner as the one who make the copy, set invitees status to invited
|
||||
CalendarInviteMap const* cInvMap = event->GetInviteMap();
|
||||
CalendarInviteMap::const_iterator ci_itr = cInvMap->begin();
|
||||
|
||||
while (ci_itr != cInvMap->end())
|
||||
{
|
||||
if (ci_itr->second->InviteeGuid == guid)
|
||||
{
|
||||
AddInvite(newEvent, guid, ci_itr->second->InviteeGuid, CALENDAR_STATUS_CONFIRMED, CALENDAR_RANK_OWNER, "", time(NULL));
|
||||
}
|
||||
else
|
||||
{
|
||||
CalendarModerationRank rank = CALENDAR_RANK_PLAYER;
|
||||
// copy moderator rank
|
||||
if (ci_itr->second->Rank == CALENDAR_RANK_MODERATOR)
|
||||
rank = CALENDAR_RANK_MODERATOR;
|
||||
|
||||
AddInvite(newEvent, guid, ci_itr->second->InviteeGuid, CALENDAR_STATUS_INVITED, rank, "", time(NULL));
|
||||
}
|
||||
++ci_itr;
|
||||
}
|
||||
}
|
||||
|
||||
SendCalendarEvent(player, newEvent, CALENDAR_SENDTYPE_COPY);
|
||||
}
|
||||
|
||||
// remove all events and invite of player
|
||||
// used when player is deleted
|
||||
void CalendarMgr::RemovePlayerCalendar(ObjectGuid const& playerGuid)
|
||||
{
|
||||
CalendarEventStore::iterator itr = m_EventStore.begin();
|
||||
|
||||
while (itr != m_EventStore.end())
|
||||
{
|
||||
if (itr->second.CreatorGuid == playerGuid)
|
||||
{
|
||||
// all invite will be automaticaly deleted
|
||||
m_EventStore.erase(itr++);
|
||||
// itr already incremented so go recheck event owner
|
||||
continue;
|
||||
}
|
||||
// event not owned by playerGuid but an invite can still be found
|
||||
CalendarEvent* event = &itr->second;
|
||||
event->RemoveInviteByGuid(playerGuid);
|
||||
++itr;
|
||||
}
|
||||
}
|
||||
|
||||
// remove all events and invite of player related to a specific guild
|
||||
// used when player quit a guild
|
||||
void CalendarMgr::RemoveGuildCalendar(ObjectGuid const& playerGuid, uint32 GuildId)
|
||||
{
|
||||
CalendarEventStore::iterator itr = m_EventStore.begin();
|
||||
|
||||
while (itr != m_EventStore.end())
|
||||
{
|
||||
CalendarEvent* event = &itr->second;
|
||||
if (event->CreatorGuid == playerGuid && (event->IsGuildEvent() || event->IsGuildAnnouncement()))
|
||||
{
|
||||
// all invite will be automaticaly deleted
|
||||
m_EventStore.erase(itr++);
|
||||
// itr already incremented so go recheck event owner
|
||||
continue;
|
||||
}
|
||||
|
||||
// event not owned by playerGuid but an guild invite can still be found
|
||||
if (event->GuildId != GuildId || !(event->IsGuildEvent() || event->IsGuildAnnouncement()))
|
||||
{
|
||||
++itr;
|
||||
continue;
|
||||
}
|
||||
|
||||
event->RemoveInviteByGuid(playerGuid);
|
||||
++itr;
|
||||
}
|
||||
}
|
||||
|
||||
// load all events and their related invites from invite
|
||||
void CalendarMgr::LoadCalendarsFromDB()
|
||||
{
|
||||
// in case of reload (not yet implemented)
|
||||
m_MaxInviteId = 0;
|
||||
m_MaxEventId = 0;
|
||||
m_EventStore.clear();
|
||||
|
||||
sLog.outString("Loading Calendar Events...");
|
||||
|
||||
// 0 1 2 3 4 5 6 7 8
|
||||
QueryResult* eventsQuery = CharacterDatabase.Query("SELECT eventId, creatorGuid, guildId, type, flags, dungeonId, eventTime, title, description FROM calendar_events ORDER BY eventId");
|
||||
if (!eventsQuery)
|
||||
{
|
||||
BarGoLink bar(1);
|
||||
bar.step();
|
||||
sLog.outString();
|
||||
sLog.outString(">> calendar_events table is empty!");
|
||||
}
|
||||
else
|
||||
{
|
||||
BarGoLink bar(eventsQuery->GetRowCount());
|
||||
do
|
||||
{
|
||||
Field* field = eventsQuery->Fetch();
|
||||
bar.step();
|
||||
|
||||
uint64 eventId = field[0].GetUInt64();
|
||||
|
||||
CalendarEvent& newEvent = m_EventStore[eventId];
|
||||
|
||||
newEvent.EventId = eventId;
|
||||
newEvent.CreatorGuid = ObjectGuid(HIGHGUID_PLAYER, field[1].GetUInt32());
|
||||
newEvent.GuildId = field[2].GetUInt32();
|
||||
newEvent.Type = CalendarEventType(field[3].GetUInt8());
|
||||
newEvent.Flags = field[4].GetUInt32();
|
||||
newEvent.DungeonId = field[5].GetInt32();
|
||||
newEvent.EventTime = time_t(field[6].GetUInt32());
|
||||
newEvent.Title = field[7].GetCppString();
|
||||
newEvent.Description = field[8].GetCppString();
|
||||
|
||||
m_MaxEventId = std::max(eventId, m_MaxEventId);
|
||||
}
|
||||
while (eventsQuery->NextRow());
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString(">> Loaded %u events!", uint32(eventsQuery->GetRowCount()));
|
||||
delete eventsQuery;
|
||||
}
|
||||
|
||||
sLog.outString("Loading Calendar invites...");
|
||||
// 0 1 2 3 4 5 6
|
||||
QueryResult* invitesQuery = CharacterDatabase.Query("SELECT inviteId, eventId, inviteeGuid, senderGuid, status, lastUpdateTime, rank FROM calendar_invites ORDER BY inviteId");
|
||||
if (!invitesQuery)
|
||||
{
|
||||
BarGoLink bar(1);
|
||||
bar.step();
|
||||
sLog.outString();
|
||||
|
||||
if (m_MaxEventId) // An Event was loaded before
|
||||
{
|
||||
// delete all events (no event exist without at least one invite)
|
||||
m_EventStore.clear();
|
||||
m_MaxEventId = 0;
|
||||
CharacterDatabase.DirectExecute("TRUNCATE TABLE calendar_events");
|
||||
sLog.outString(">> calendar_invites table is empty, cleared calendar_events table!");
|
||||
}
|
||||
else
|
||||
sLog.outString(">> calendar_invite table is empty!");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_MaxEventId)
|
||||
{
|
||||
uint64 totalInvites = 0;
|
||||
uint32 deletedInvites = 0;
|
||||
BarGoLink bar(invitesQuery->GetRowCount());
|
||||
do
|
||||
{
|
||||
Field* field = invitesQuery->Fetch();
|
||||
|
||||
uint64 inviteId = field[0].GetUInt64();
|
||||
uint64 eventId = field[1].GetUInt64();
|
||||
ObjectGuid inviteeGuid = ObjectGuid(HIGHGUID_PLAYER, field[2].GetUInt32());
|
||||
ObjectGuid senderGuid = ObjectGuid(HIGHGUID_PLAYER, field[3].GetUInt32());
|
||||
CalendarInviteStatus status = CalendarInviteStatus(field[4].GetUInt8());
|
||||
time_t lastUpdateTime = time_t(field[5].GetUInt32());
|
||||
CalendarModerationRank rank = CalendarModerationRank(field[6].GetUInt8());
|
||||
|
||||
CalendarEvent* event = GetEventById(eventId);
|
||||
if (!event)
|
||||
{
|
||||
// delete invite
|
||||
CharacterDatabase.PExecute("DELETE FROM calendar_invites WHERE inviteId =" UI64FMTD, field[0].GetUInt64());
|
||||
++deletedInvites;
|
||||
continue;
|
||||
}
|
||||
|
||||
CalendarInvite* invite = new CalendarInvite(event, inviteId, senderGuid, inviteeGuid, lastUpdateTime, status, rank, "");
|
||||
event->AddInvite(invite);
|
||||
++totalInvites;
|
||||
m_MaxInviteId = std::max(inviteId, m_MaxInviteId);
|
||||
}
|
||||
while (invitesQuery->NextRow());
|
||||
sLog.outString();
|
||||
sLog.outString(">> Loaded "UI64FMTD" invites! %s", totalInvites, (deletedInvites != 0) ? "(deleted some invites without corresponding event!)" : "");
|
||||
}
|
||||
else
|
||||
{
|
||||
// delete all invites (no invites exist without events)
|
||||
CharacterDatabase.DirectExecute("TRUNCATE TABLE calendar_invites");
|
||||
sLog.outString(">> calendar_invites table is cleared! (invites without events found)");
|
||||
}
|
||||
delete invitesQuery;
|
||||
}
|
||||
sLog.outString();
|
||||
}
|
||||
|
||||
// check if player have not reached event limit
|
||||
bool CalendarMgr::CanAddEvent(ObjectGuid const& guid)
|
||||
{
|
||||
uint32 totalEvents = 0;
|
||||
// count all event created by guid
|
||||
for (CalendarEventStore::iterator itr = m_EventStore.begin(); itr != m_EventStore.end(); ++itr)
|
||||
if ((itr->second.CreatorGuid == guid) && (++totalEvents >= CALENDAR_MAX_EVENTS))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
// check if guild have not reached event limit
|
||||
bool CalendarMgr::CanAddGuildEvent(uint32 guildId)
|
||||
{
|
||||
if (!guildId)
|
||||
return false;
|
||||
|
||||
uint32 totalEvents = 0;
|
||||
// count all guild events in a guild
|
||||
for (CalendarEventStore::iterator itr = m_EventStore.begin(); itr != m_EventStore.end(); ++itr)
|
||||
if ((itr->second.GuildId == guildId) && (++totalEvents >= CALENDAR_MAX_GUILD_EVENTS))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
// check if an invitee have not reached invite limit
|
||||
bool CalendarMgr::CanAddInviteTo(ObjectGuid const& guid)
|
||||
{
|
||||
uint32 totalInvites = 0;
|
||||
|
||||
for (CalendarEventStore::iterator itr = m_EventStore.begin(); itr != m_EventStore.end(); ++itr)
|
||||
{
|
||||
CalendarEvent* event = &itr->second;
|
||||
|
||||
if (event->IsGuildAnnouncement())
|
||||
continue;
|
||||
|
||||
CalendarInviteMap const* cInvMap = event->GetInviteMap();
|
||||
CalendarInviteMap::const_iterator ci_itr = cInvMap->begin();
|
||||
while (ci_itr != cInvMap->end())
|
||||
{
|
||||
if ((ci_itr->second->InviteeGuid == guid) && (++totalInvites >= CALENDAR_MAX_INVITES))
|
||||
return false;
|
||||
++ci_itr;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
289
src/game/Object/Calendar.h
Normal file
289
src/game/Object/Calendar.h
Normal file
|
|
@ -0,0 +1,289 @@
|
|||
/*
|
||||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* World of Warcraft, and all World of Warcraft or Warcraft art, images,
|
||||
* and lore are copyrighted by Blizzard Entertainment, Inc.
|
||||
*/
|
||||
|
||||
#ifndef MANGOS_CALENDAR_H
|
||||
#define MANGOS_CALENDAR_H
|
||||
|
||||
#include "Policies/Singleton.h"
|
||||
#include "Common.h"
|
||||
#include "ObjectGuid.h"
|
||||
#include "SharedDefines.h"
|
||||
|
||||
enum CalendarEventType
|
||||
{
|
||||
CALENDAR_TYPE_RAID = 0,
|
||||
CALENDAR_TYPE_DUNGEON = 1,
|
||||
CALENDAR_TYPE_PVP = 2,
|
||||
CALENDAR_TYPE_MEETING = 3,
|
||||
CALENDAR_TYPE_OTHER = 4,
|
||||
CALENDAR_TYPE_HEROIC = 5
|
||||
};
|
||||
|
||||
enum CalendarInviteStatus
|
||||
{
|
||||
CALENDAR_STATUS_INVITED = 0,
|
||||
CALENDAR_STATUS_ACCEPTED = 1,
|
||||
CALENDAR_STATUS_DECLINED = 2,
|
||||
CALENDAR_STATUS_CONFIRMED = 3,
|
||||
CALENDAR_STATUS_OUT = 4,
|
||||
CALENDAR_STATUS_STANDBY = 5,
|
||||
CALENDAR_STATUS_SIGNED_UP = 6,
|
||||
CALENDAR_STATUS_NOT_SIGNED_UP = 7,
|
||||
CALENDAR_STATUS_TENTATIVE = 8,
|
||||
CALENDAR_STATUS_REMOVED = 9 // correct name?
|
||||
};
|
||||
|
||||
// commented flag never showed in sniff but handled by client
|
||||
enum CalendarFlags
|
||||
{
|
||||
CALENDAR_FLAG_ALL_ALLOWED = 0x001,
|
||||
//CALENDAR_FLAG_SYSTEM = 0x004,
|
||||
//CALENDAR_FLAG_HOLLIDAY = 0x008,
|
||||
CALENDAR_FLAG_INVITES_LOCKED = 0x010,
|
||||
CALENDAR_FLAG_GUILD_ANNOUNCEMENT = 0x040,
|
||||
//CALENDAR_FLAG_RAID_LOCKOUT = 0x080,
|
||||
//CALENDAR_FLAG_UNK_PLAYER = 0x102,
|
||||
//CALENDAR_FLAG_RAID_RESET = 0x200,
|
||||
CALENDAR_FLAG_GUILD_EVENT = 0x400
|
||||
};
|
||||
|
||||
enum CalendarRepeatType
|
||||
{
|
||||
CALENDAR_REPEAT_NEVER = 0,
|
||||
CALENDAR_REPEAT_WEEKLY = 1,
|
||||
CALENDAR_REPEAT_BIWEEKLY = 2,
|
||||
CALENDAR_REPEAT_MONTHLY = 3
|
||||
};
|
||||
|
||||
enum CalendarSendEventType
|
||||
{
|
||||
CALENDAR_SENDTYPE_GET = 0,
|
||||
CALENDAR_SENDTYPE_ADD = 1,
|
||||
CALENDAR_SENDTYPE_COPY = 2
|
||||
};
|
||||
|
||||
enum CalendarModerationRank
|
||||
{
|
||||
CALENDAR_RANK_PLAYER = 0,
|
||||
CALENDAR_RANK_MODERATOR = 1,
|
||||
CALENDAR_RANK_OWNER = 2
|
||||
};
|
||||
|
||||
enum CalendarError
|
||||
{
|
||||
CALENDAR_OK = 0,
|
||||
CALENDAR_ERROR_GUILD_EVENTS_EXCEEDED = 1,
|
||||
CALENDAR_ERROR_EVENTS_EXCEEDED = 2,
|
||||
CALENDAR_ERROR_SELF_INVITES_EXCEEDED = 3,
|
||||
CALENDAR_ERROR_OTHER_INVITES_EXCEEDED_S = 4,
|
||||
CALENDAR_ERROR_PERMISSIONS = 5,
|
||||
CALENDAR_ERROR_EVENT_INVALID = 6,
|
||||
CALENDAR_ERROR_NOT_INVITED = 7,
|
||||
CALENDAR_ERROR_INTERNAL = 8,
|
||||
CALENDAR_ERROR_GUILD_PLAYER_NOT_IN_GUILD = 9,
|
||||
CALENDAR_ERROR_ALREADY_INVITED_TO_EVENT_S = 10,
|
||||
CALENDAR_ERROR_PLAYER_NOT_FOUND = 11,
|
||||
CALENDAR_ERROR_NOT_ALLIED = 12,
|
||||
CALENDAR_ERROR_IGNORING_YOU_S = 13,
|
||||
CALENDAR_ERROR_INVITES_EXCEEDED = 14,
|
||||
CALENDAR_ERROR_INVALID_DATE = 16,
|
||||
CALENDAR_ERROR_INVALID_TIME = 17,
|
||||
|
||||
CALENDAR_ERROR_NEEDS_TITLE = 19,
|
||||
CALENDAR_ERROR_EVENT_PASSED = 20,
|
||||
CALENDAR_ERROR_EVENT_LOCKED = 21,
|
||||
CALENDAR_ERROR_DELETE_CREATOR_FAILED = 22,
|
||||
CALENDAR_ERROR_SYSTEM_DISABLED = 24,
|
||||
CALENDAR_ERROR_RESTRICTED_ACCOUNT = 25,
|
||||
CALENDAR_ERROR_ARENA_EVENTS_EXCEEDED = 26,
|
||||
CALENDAR_ERROR_RESTRICTED_LEVEL = 27,
|
||||
CALENDAR_ERROR_USER_SQUELCHED = 28,
|
||||
CALENDAR_ERROR_NO_INVITE = 29,
|
||||
|
||||
CALENDAR_ERROR_EVENT_WRONG_SERVER = 36,
|
||||
CALENDAR_ERROR_INVITE_WRONG_SERVER = 37,
|
||||
CALENDAR_ERROR_NO_GUILD_INVITES = 38,
|
||||
CALENDAR_ERROR_INVALID_SIGNUP = 39,
|
||||
CALENDAR_ERROR_NO_MODERATOR = 40
|
||||
};
|
||||
|
||||
#define CALENDAR_MAX_EVENTS 30
|
||||
#define CALENDAR_MAX_GUILD_EVENTS 100
|
||||
#define CALENDAR_MAX_INVITES 100
|
||||
|
||||
// forward declaration
|
||||
class CalendarEvent;
|
||||
class CalendarInvite;
|
||||
class CalendarMgr;
|
||||
class Player;
|
||||
class DungeonPersistentState;
|
||||
class WorldPacket;
|
||||
|
||||
typedef std::map<uint64, CalendarInvite*> CalendarInviteMap;
|
||||
typedef std::list<CalendarInvite*> CalendarInvitesList;
|
||||
typedef std::list<CalendarEvent*> CalendarEventsList;
|
||||
|
||||
// CalendarEvent class used to store one event
|
||||
class CalendarEvent
|
||||
{
|
||||
public:
|
||||
CalendarEvent(uint64 eventId, uint64 creatorGUID, uint32 guildId, CalendarEventType type, int32 dungeonId,
|
||||
time_t eventTime, uint32 flags, time_t unknownTime, std::string title, std::string description) :
|
||||
EventId(eventId), CreatorGuid(creatorGUID), GuildId(guildId), Type(type), DungeonId(dungeonId),
|
||||
EventTime(eventTime), Flags(flags), UnknownTime(unknownTime), Title(title),
|
||||
Description(description) { }
|
||||
|
||||
CalendarEvent() : EventId(0), CreatorGuid(uint64(0)), GuildId(0), Type(CALENDAR_TYPE_OTHER), DungeonId(-1), EventTime(0),
|
||||
Flags(0), UnknownTime(0) { }
|
||||
|
||||
~CalendarEvent();
|
||||
|
||||
// helper to test event flag
|
||||
bool IsGuildEvent() const { return Flags & CALENDAR_FLAG_GUILD_EVENT; }
|
||||
bool IsGuildAnnouncement() const { return Flags & CALENDAR_FLAG_GUILD_ANNOUNCEMENT; }
|
||||
|
||||
bool AddInvite(CalendarInvite* invite);
|
||||
|
||||
CalendarInviteMap const* GetInviteMap() const { return &m_Invitee; }
|
||||
|
||||
CalendarInvite* GetInviteById(uint64 inviteId);
|
||||
CalendarInvite* GetInviteByGuid(ObjectGuid const& guid);
|
||||
|
||||
bool RemoveInviteById(uint64 inviteId, Player* remover);
|
||||
void RemoveInviteByGuid(ObjectGuid const& playerGuid);
|
||||
void RemoveAllInvite(ObjectGuid const& remover);
|
||||
|
||||
uint64 EventId; // unique ID for that event
|
||||
ObjectGuid CreatorGuid; // ObjectGuid of the event creator
|
||||
uint32 GuildId; // guild Id set only if its an guild event or guild announce
|
||||
CalendarEventType Type; // event type (look CalendarEventType enum)
|
||||
CalendarRepeatType Repeatable; // not actualy used, maybe no need to store it because it seem not handled by client
|
||||
int32 DungeonId; // required for dungeon event type
|
||||
time_t EventTime; // event date
|
||||
uint32 Flags; // (look at CalendarFlags enum)
|
||||
time_t UnknownTime; // maybe related to timezone
|
||||
std::string Title; // title of the event
|
||||
std::string Description; // description of the event
|
||||
|
||||
private:
|
||||
void RemoveInviteByItr(CalendarInviteMap::iterator inviteItr);
|
||||
void RemoveAllInvite();
|
||||
|
||||
CalendarInviteMap m_Invitee;
|
||||
};
|
||||
|
||||
// CalendarInvite class store single invite information
|
||||
class CalendarInvite
|
||||
{
|
||||
public:
|
||||
|
||||
CalendarInvite() : m_calendarEvent(NULL), InviteId(0), LastUpdateTime(time(NULL)), Status(CALENDAR_STATUS_INVITED), Rank(CALENDAR_RANK_PLAYER) {}
|
||||
|
||||
CalendarInvite(CalendarEvent* event, uint64 inviteId, ObjectGuid senderGuid, ObjectGuid inviteeGuid, time_t statusTime,
|
||||
CalendarInviteStatus status, CalendarModerationRank rank, std::string text);
|
||||
|
||||
~CalendarInvite() {}
|
||||
|
||||
CalendarEvent const* GetCalendarEvent() const { return m_calendarEvent; }
|
||||
|
||||
uint64 InviteId; // unique ID
|
||||
ObjectGuid InviteeGuid; // invitee ObjectGuid
|
||||
ObjectGuid SenderGuid; // the invite sender (can be equal to InviteeGuid)
|
||||
time_t LastUpdateTime; // last time updated
|
||||
CalendarInviteStatus Status; // status of this invite (look CalendarInviteStatus enum)
|
||||
CalendarModerationRank Rank; // rank of the invitee (look CalendarModerationRank enum)
|
||||
std::string Text; // seem not implemented in client
|
||||
|
||||
private:
|
||||
CalendarEvent* m_calendarEvent; // link to the parent events
|
||||
};
|
||||
|
||||
// storage for all events
|
||||
typedef std::map<uint64, CalendarEvent> CalendarEventStore;
|
||||
|
||||
// CalendarMgr class is the main class to handle events and their invites
|
||||
class CalendarMgr
|
||||
{
|
||||
public:
|
||||
CalendarMgr() : m_MaxEventId(0), m_MaxInviteId(0) {};
|
||||
~CalendarMgr() {};
|
||||
|
||||
void GetPlayerEventsList(ObjectGuid const& guid, CalendarEventsList& calEventList);
|
||||
void GetPlayerInvitesList(ObjectGuid const& guid, CalendarInvitesList& calInvList);
|
||||
|
||||
CalendarEvent* AddEvent(ObjectGuid const& guid, std::string title, std::string description, uint32 type, uint32 repeatable, uint32 maxInvites,
|
||||
int32 dungeonId, time_t eventTime, time_t unkTime, uint32 flags);
|
||||
|
||||
CalendarInvite* AddInvite(CalendarEvent* event, ObjectGuid const& senderGuid, ObjectGuid const& inviteeGuid, CalendarInviteStatus status, CalendarModerationRank rank, std::string text, time_t statusTime);
|
||||
|
||||
void RemoveEvent(uint64 eventId, Player* remover);
|
||||
bool RemoveInvite(uint64 eventId, uint64 inviteId, ObjectGuid const& removerGuid);
|
||||
void RemovePlayerCalendar(ObjectGuid const& playerGuid);
|
||||
void RemoveGuildCalendar(ObjectGuid const& playerGuid, uint32 GuildId);
|
||||
|
||||
void CopyEvent(uint64 eventId, time_t newTime, ObjectGuid const& guid);
|
||||
uint32 GetPlayerNumPending(ObjectGuid const& guid);
|
||||
|
||||
CalendarEvent* GetEventById(uint64 eventId)
|
||||
{
|
||||
CalendarEventStore::iterator itr = m_EventStore.find(eventId);
|
||||
return (itr != m_EventStore.end()) ? &itr->second : NULL;
|
||||
}
|
||||
|
||||
// sql related
|
||||
void LoadCalendarsFromDB();
|
||||
|
||||
// send data to client function
|
||||
void SendCalendarEventInvite(CalendarInvite const* invite);
|
||||
void SendCalendarEventInviteAlert(CalendarInvite const* invite);
|
||||
void SendCalendarCommandResult(Player* player, CalendarError err, char const* param = NULL);
|
||||
void SendCalendarEventRemovedAlert(CalendarEvent const* event);
|
||||
void SendCalendarEvent(Player* player, CalendarEvent const* event, uint32 sendType);
|
||||
void SendCalendarEventInviteRemoveAlert(Player* player, CalendarEvent const* event, CalendarInviteStatus status);
|
||||
void SendCalendarEventInviteRemove(CalendarInvite const* invite, uint32 flags);
|
||||
void SendCalendarEventStatus(CalendarInvite const* invite);
|
||||
void SendCalendarClearPendingAction(Player* player);
|
||||
void SendCalendarEventModeratorStatusAlert(CalendarInvite const* invite);
|
||||
void SendCalendarEventUpdateAlert(CalendarEvent const* event, time_t oldEventTime);
|
||||
void SendCalendarRaidLockoutRemove(Player* player, DungeonPersistentState const* save);
|
||||
void SendCalendarRaidLockoutAdd(Player* player, DungeonPersistentState const* save);
|
||||
|
||||
void SendPacketToAllEventRelatives(WorldPacket packet, CalendarEvent const* event);
|
||||
|
||||
private:
|
||||
uint64 GetNewEventId() { return ++m_MaxEventId; }
|
||||
uint64 GetNewInviteId() { return ++m_MaxInviteId; }
|
||||
|
||||
bool CanAddInviteTo(ObjectGuid const& guid); // check if player can recieve a new invite
|
||||
bool CanAddGuildEvent(uint32 guildId); // check if guild not reached the event number limit
|
||||
bool CanAddEvent(ObjectGuid const& guid); // check if player not reached the event number limit
|
||||
|
||||
CalendarEventStore m_EventStore; // main events storage
|
||||
uint64 m_MaxEventId; // current max event ID
|
||||
uint64 m_MaxInviteId; // current max invite ID
|
||||
};
|
||||
|
||||
#define sCalendarMgr MaNGOS::Singleton<CalendarMgr>::Instance()
|
||||
|
||||
#endif
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu>
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
582
src/game/Object/Vehicle.cpp
Normal file
582
src/game/Object/Vehicle.cpp
Normal file
|
|
@ -0,0 +1,582 @@
|
|||
/*
|
||||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* World of Warcraft, and all World of Warcraft or Warcraft art, images,
|
||||
* and lore are copyrighted by Blizzard Entertainment, Inc.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @addtogroup TransportSystem
|
||||
* @{
|
||||
*
|
||||
* @file Vehicle.cpp
|
||||
* This file contains the code needed for CMaNGOS to support vehicles
|
||||
* Currently implemented
|
||||
* - Board to board a passenger onto a vehicle (includes checks)
|
||||
* - Unboard to unboard a passenger from the vehicle
|
||||
* - SwitchSeat to switch to another seat of the same vehicle
|
||||
* - CanBoard to check if a passenger can board a vehicle
|
||||
* - Internal helper to set the controlling and spells for a vehicle's seat
|
||||
* - Internal helper to control the available seats of a vehicle
|
||||
*/
|
||||
|
||||
#include "Vehicle.h"
|
||||
#include "Common.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "ObjectGuid.h"
|
||||
#include "Log.h"
|
||||
#include "Unit.h"
|
||||
#include "Creature.h"
|
||||
#include "CreatureAI.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "SQLStorages.h"
|
||||
#include "Util.h"
|
||||
#include "movement/MoveSplineInit.h"
|
||||
#include "movement/MoveSpline.h"
|
||||
#include "MapManager.h"
|
||||
#include "TemporarySummon.h"
|
||||
|
||||
void ObjectMgr::LoadVehicleAccessory()
|
||||
{
|
||||
sVehicleAccessoryStorage.Load();
|
||||
|
||||
sLog.outString(">> Loaded %u vehicle accessories", sVehicleAccessoryStorage.GetRecordCount());
|
||||
sLog.outString();
|
||||
|
||||
// Check content
|
||||
for (SQLMultiStorage::SQLSIterator<VehicleAccessory> itr = sVehicleAccessoryStorage.getDataBegin<VehicleAccessory>(); itr < sVehicleAccessoryStorage.getDataEnd<VehicleAccessory>(); ++itr)
|
||||
{
|
||||
if (!sCreatureStorage.LookupEntry<CreatureInfo>(itr->vehicleEntry))
|
||||
{
|
||||
sLog.outErrorDb("Table `vehicle_accessory` has entry (vehicle entry: %u, seat %u, passenger %u) where vehicle_entry is invalid, skip vehicle.", itr->vehicleEntry, itr->seatId, itr->passengerEntry);
|
||||
sVehicleAccessoryStorage.EraseEntry(itr->vehicleEntry);
|
||||
continue;
|
||||
}
|
||||
if (!sCreatureStorage.LookupEntry<CreatureInfo>(itr->passengerEntry))
|
||||
{
|
||||
sLog.outErrorDb("Table `vehicle_accessory` has entry (vehicle entry: %u, seat %u, passenger %u) where accessory_entry is invalid, skip vehicle.", itr->vehicleEntry, itr->seatId, itr->passengerEntry);
|
||||
sVehicleAccessoryStorage.EraseEntry(itr->vehicleEntry);
|
||||
continue;
|
||||
}
|
||||
if (itr->seatId >= MAX_VEHICLE_SEAT)
|
||||
{
|
||||
sLog.outErrorDb("Table `vehicle_accessory` has entry (vehicle entry: %u, seat %u, passenger %u) where seat is invalid (must be between 0 and %u), skip vehicle.", itr->vehicleEntry, itr->seatId, itr->passengerEntry, MAX_VEHICLE_SEAT - 1);
|
||||
sVehicleAccessoryStorage.EraseEntry(itr->vehicleEntry);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Constructor of VehicleInfo
|
||||
*
|
||||
* @param owner MUST be provided owner of the vehicle (type Unit)
|
||||
* @param vehicleEntry MUST be provided dbc-entry of the vehicle
|
||||
* @param overwriteNpcEntry Use to overwrite the GetEntry() result for selecting associated passengers
|
||||
*
|
||||
* This function will initialise the VehicleInfo of the vehicle owner
|
||||
* Also the seat-map is created here
|
||||
*/
|
||||
VehicleInfo::VehicleInfo(Unit* owner, VehicleEntry const* vehicleEntry, uint32 overwriteNpcEntry) : TransportBase(owner),
|
||||
m_vehicleEntry(vehicleEntry),
|
||||
m_creatureSeats(0),
|
||||
m_playerSeats(0),
|
||||
m_overwriteNpcEntry(overwriteNpcEntry),
|
||||
m_isInitialized(false)
|
||||
{
|
||||
MANGOS_ASSERT(vehicleEntry);
|
||||
|
||||
// Initial fill of available seats for the vehicle
|
||||
for (uint8 i = 0; i < MAX_VEHICLE_SEAT; ++i)
|
||||
{
|
||||
if (uint32 seatId = vehicleEntry->m_seatID[i])
|
||||
{
|
||||
if (VehicleSeatEntry const* seatEntry = sVehicleSeatStore.LookupEntry(seatId))
|
||||
{
|
||||
m_vehicleSeats.insert(VehicleSeatMap::value_type(i, seatEntry));
|
||||
|
||||
if (IsUsableSeatForCreature(seatEntry->m_flags))
|
||||
m_creatureSeats |= 1 << i;
|
||||
|
||||
if (IsUsableSeatForPlayer(seatEntry->m_flags))
|
||||
m_playerSeats |= 1 << i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VehicleInfo::~VehicleInfo()
|
||||
{
|
||||
((Unit*)m_owner)->RemoveSpellsCausingAura(SPELL_AURA_CONTROL_VEHICLE);
|
||||
|
||||
RemoveAccessoriesFromMap(); // Remove accessories (for example required with player vehicles)
|
||||
}
|
||||
|
||||
void VehicleInfo::Initialize()
|
||||
{
|
||||
if (!m_overwriteNpcEntry)
|
||||
m_overwriteNpcEntry = m_owner->GetEntry();
|
||||
|
||||
// Loading passengers (rough version only!)
|
||||
SQLMultiStorage::SQLMSIteratorBounds<VehicleAccessory> bounds = sVehicleAccessoryStorage.getBounds<VehicleAccessory>(m_overwriteNpcEntry);
|
||||
for (SQLMultiStorage::SQLMultiSIterator<VehicleAccessory> itr = bounds.first; itr != bounds.second; ++itr)
|
||||
{
|
||||
if (Creature* summoned = m_owner->SummonCreature(itr->passengerEntry, m_owner->GetPositionX(), m_owner->GetPositionY(), m_owner->GetPositionZ(), 2 * m_owner->GetOrientation(), TEMPSUMMON_DEAD_DESPAWN, 0))
|
||||
{
|
||||
DEBUG_LOG("VehicleInfo(of %s)::Initialize: Load vehicle accessory %s onto seat %u", m_owner->GetGuidStr().c_str(), summoned->GetGuidStr().c_str(), itr->seatId);
|
||||
m_accessoryGuids.insert(summoned->GetObjectGuid());
|
||||
int32 basepoint0 = itr->seatId + 1;
|
||||
summoned->CastCustomSpell((Unit*)m_owner, SPELL_RIDE_VEHICLE_HARDCODED, &basepoint0, NULL, NULL, true);
|
||||
}
|
||||
}
|
||||
m_isInitialized = true;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function will board a passenger onto a vehicle
|
||||
*
|
||||
* @param passenger MUST be provided. This Unit will be boarded onto the vehicles (if it checks out)
|
||||
* @param seat Seat to which the passenger will be boarded (if can, elsewise an alternative will be selected if possible)
|
||||
*/
|
||||
void VehicleInfo::Board(Unit* passenger, uint8 seat)
|
||||
{
|
||||
MANGOS_ASSERT(passenger);
|
||||
|
||||
DEBUG_LOG("VehicleInfo(of %s)::Board: Try to board passenger %s to seat %u", m_owner->GetGuidStr().c_str(), passenger->GetGuidStr().c_str(), seat);
|
||||
|
||||
// This check is also called in Spell::CheckCast()
|
||||
if (!CanBoard(passenger))
|
||||
return;
|
||||
|
||||
// Use the planned seat only if the seat is valid, possible to choose and empty
|
||||
if (!IsSeatAvailableFor(passenger, seat))
|
||||
if (!GetUsableSeatFor(passenger, seat))
|
||||
return;
|
||||
|
||||
VehicleSeatEntry const* seatEntry = GetSeatEntry(seat);
|
||||
MANGOS_ASSERT(seatEntry);
|
||||
|
||||
// ToDo: Unboard passenger from a MOTransport when they are properly implemented
|
||||
/*if (TransportInfo* transportInfo = passenger->GetTransportInfo())
|
||||
{
|
||||
WorldObject* transporter = transportInfo->GetTransport();
|
||||
|
||||
// Must be a MO transporter
|
||||
MANGOS_ASSERT(transporter->GetObjectGuid().IsMOTransport());
|
||||
|
||||
((Transport*)transporter)->UnBoardPassenger(passenger);
|
||||
}*/
|
||||
|
||||
DEBUG_LOG("VehicleInfo::Board: Board passenger: %s to seat %u", passenger->GetGuidStr().c_str(), seat);
|
||||
|
||||
// Calculate passengers local position
|
||||
float lx, ly, lz, lo;
|
||||
CalculateBoardingPositionOf(passenger->GetPositionX(), passenger->GetPositionY(), passenger->GetPositionZ(), passenger->GetOrientation(), lx, ly, lz, lo);
|
||||
|
||||
BoardPassenger(passenger, lx, ly, lz, lo, seat); // Use TransportBase to store the passenger
|
||||
|
||||
// Set data for createobject packets
|
||||
passenger->m_movementInfo.SetTransportData(m_owner->GetObjectGuid(), lx, ly, lz, lo, 0, seat);
|
||||
|
||||
if (passenger->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
Player* pPlayer = (Player*)passenger;
|
||||
pPlayer->RemovePet(PET_SAVE_AS_CURRENT);
|
||||
|
||||
WorldPacket data(SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA);
|
||||
pPlayer->GetSession()->SendPacket(&data);
|
||||
|
||||
// SMSG_BREAK_TARGET (?)
|
||||
}
|
||||
|
||||
if (!passenger->IsRooted())
|
||||
passenger->SetRoot(true);
|
||||
|
||||
Movement::MoveSplineInit init(*passenger);
|
||||
init.MoveTo(0.0f, 0.0f, 0.0f); // ToDo: Set correct local coords
|
||||
init.SetFacing(0.0f); // local orientation ? ToDo: Set proper orientation!
|
||||
init.SetBoardVehicle();
|
||||
init.Launch();
|
||||
|
||||
// Apply passenger modifications
|
||||
ApplySeatMods(passenger, seatEntry->m_flags);
|
||||
}
|
||||
|
||||
/*
|
||||
* This function will switch the seat of a passenger on the same vehicle
|
||||
*
|
||||
* @param passenger MUST be provided. This Unit will change its seat on the vehicle
|
||||
* @param seat Seat to which the passenger will be switched
|
||||
*/
|
||||
void VehicleInfo::SwitchSeat(Unit* passenger, uint8 seat)
|
||||
{
|
||||
MANGOS_ASSERT(passenger);
|
||||
|
||||
DEBUG_LOG("VehicleInfo::SwitchSeat: passenger: %s try to switch to seat %u", passenger->GetGuidStr().c_str(), seat);
|
||||
|
||||
// Switching seats is not possible
|
||||
if (m_vehicleEntry->m_flags & VEHICLE_FLAG_DISABLE_SWITCH)
|
||||
return;
|
||||
|
||||
PassengerMap::const_iterator itr = m_passengers.find(passenger);
|
||||
MANGOS_ASSERT(itr != m_passengers.end());
|
||||
|
||||
// We are already boarded to this seat
|
||||
if (itr->second->GetTransportSeat() == seat)
|
||||
return;
|
||||
|
||||
// Check if it's a valid seat
|
||||
if (!IsSeatAvailableFor(passenger, seat))
|
||||
return;
|
||||
|
||||
VehicleSeatEntry const* seatEntry = GetSeatEntry(itr->second->GetTransportSeat());
|
||||
MANGOS_ASSERT(seatEntry);
|
||||
|
||||
// Switching seats is only allowed if this flag is set
|
||||
if (~seatEntry->m_flags & SEAT_FLAG_CAN_SWITCH)
|
||||
return;
|
||||
|
||||
// Remove passenger modifications of the old seat
|
||||
RemoveSeatMods(passenger, seatEntry->m_flags);
|
||||
|
||||
// Set to new seat
|
||||
itr->second->SetTransportSeat(seat);
|
||||
|
||||
Movement::MoveSplineInit init(*passenger);
|
||||
init.MoveTo(0.0f, 0.0f, 0.0f); // ToDo: Set correct local coords
|
||||
//if (oldorientation != neworientation) (?)
|
||||
//init.SetFacing(0.0f); // local orientation ? ToDo: Set proper orientation!
|
||||
// It seems that Seat switching is sent without SplineFlag BoardVehicle
|
||||
init.Launch();
|
||||
|
||||
// Get seatEntry of new seat
|
||||
seatEntry = GetSeatEntry(seat);
|
||||
MANGOS_ASSERT(seatEntry);
|
||||
|
||||
// Apply passenger modifications of the new seat
|
||||
ApplySeatMods(passenger, seatEntry->m_flags);
|
||||
}
|
||||
|
||||
/*
|
||||
* This function will Unboard a passenger
|
||||
*
|
||||
* @param passenger MUST be provided. This Unit will be unboarded from the vehicle
|
||||
* @param changeVehicle If set, the passenger is expected to be directly boarded to another vehicle,
|
||||
* and hence he will not be unboarded but only removed from this vehicle.
|
||||
*/
|
||||
void VehicleInfo::UnBoard(Unit* passenger, bool changeVehicle)
|
||||
{
|
||||
MANGOS_ASSERT(passenger);
|
||||
|
||||
DEBUG_LOG("VehicleInfo::Unboard: passenger: %s", passenger->GetGuidStr().c_str());
|
||||
|
||||
PassengerMap::const_iterator itr = m_passengers.find(passenger);
|
||||
MANGOS_ASSERT(itr != m_passengers.end());
|
||||
|
||||
VehicleSeatEntry const* seatEntry = GetSeatEntry(itr->second->GetTransportSeat());
|
||||
MANGOS_ASSERT(seatEntry);
|
||||
|
||||
UnBoardPassenger(passenger); // Use TransportBase to remove the passenger from storage list
|
||||
|
||||
if (!changeVehicle) // Send expected unboarding packages
|
||||
{
|
||||
// Update movementInfo
|
||||
passenger->m_movementInfo.ClearTransportData();
|
||||
|
||||
if (passenger->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
Player* pPlayer = (Player*)passenger;
|
||||
pPlayer->ResummonPetTemporaryUnSummonedIfAny();
|
||||
|
||||
// SMSG_PET_DISMISS_SOUND (?)
|
||||
}
|
||||
|
||||
if (passenger->IsRooted())
|
||||
passenger->SetRoot(false);
|
||||
|
||||
Movement::MoveSplineInit init(*passenger);
|
||||
// ToDo: Set proper unboard coordinates
|
||||
init.MoveTo(m_owner->GetPositionX(), m_owner->GetPositionY(), m_owner->GetPositionZ());
|
||||
init.SetExitVehicle();
|
||||
init.Launch();
|
||||
|
||||
// Despawn if passenger was accessory
|
||||
if (passenger->GetTypeId() == TYPEID_UNIT && m_accessoryGuids.find(passenger->GetObjectGuid()) != m_accessoryGuids.end())
|
||||
{
|
||||
Creature* cPassenger = static_cast<Creature*>(passenger);
|
||||
// TODO Same TODO as in VehicleInfo::RemoveAccessoriesFromMap
|
||||
cPassenger->ForcedDespawn(5000);
|
||||
m_accessoryGuids.erase(passenger->GetObjectGuid());
|
||||
}
|
||||
}
|
||||
|
||||
// Remove passenger modifications
|
||||
RemoveSeatMods(passenger, seatEntry->m_flags);
|
||||
|
||||
// Some creature vehicles get despawned after passenger unboarding
|
||||
if (m_owner->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
// TODO: Guesswork, but seems to be fairly near correct
|
||||
// Only if the passenger was on control seat? Also depending on some flags
|
||||
if ((seatEntry->m_flags & SEAT_FLAG_CAN_CONTROL) &&
|
||||
!(m_vehicleEntry->m_flags & (VEHICLE_FLAG_UNK4 | VEHICLE_FLAG_UNK20)))
|
||||
{
|
||||
if (((Creature*)m_owner)->IsTemporarySummon())
|
||||
((Creature*)m_owner)->ForcedDespawn(1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This function will check if a passenger can be boarded
|
||||
*
|
||||
* @param passenger Unit that attempts to board onto a vehicle
|
||||
*/
|
||||
bool VehicleInfo::CanBoard(Unit* passenger) const
|
||||
{
|
||||
if (!passenger)
|
||||
return false;
|
||||
|
||||
// Passenger is this vehicle
|
||||
if (passenger == m_owner)
|
||||
return false;
|
||||
|
||||
// Passenger is already on this vehicle (in this case switching seats is required)
|
||||
if (passenger->IsBoarded() && passenger->GetTransportInfo()->GetTransport() == m_owner)
|
||||
return false;
|
||||
|
||||
// Prevent circular boarding: passenger (could only be vehicle) must not have m_owner on board
|
||||
if (passenger->IsVehicle() && passenger->GetVehicleInfo()->HasOnBoard(m_owner))
|
||||
return false;
|
||||
|
||||
// Check if we have at least one empty seat
|
||||
if (!GetEmptySeats())
|
||||
return false;
|
||||
|
||||
// Passenger is already boarded
|
||||
if (m_passengers.find(passenger) != m_passengers.end())
|
||||
return false;
|
||||
|
||||
// Check for empty player seats
|
||||
if (passenger->GetTypeId() == TYPEID_PLAYER)
|
||||
return GetEmptySeatsMask() & m_playerSeats;
|
||||
|
||||
// Check for empty creature seats
|
||||
return GetEmptySeatsMask() & m_creatureSeats;
|
||||
}
|
||||
|
||||
Unit* VehicleInfo::GetPassenger(uint8 seat) const
|
||||
{
|
||||
for (PassengerMap::const_iterator itr = m_passengers.begin(); itr != m_passengers.end(); ++itr)
|
||||
if (itr->second->GetTransportSeat() == seat)
|
||||
return (Unit*)itr->first;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Helper function to undo the turning of the vehicle to calculate a relative position of the passenger when boarding
|
||||
void VehicleInfo::CalculateBoardingPositionOf(float gx, float gy, float gz, float go, float& lx, float& ly, float& lz, float& lo) const
|
||||
{
|
||||
NormalizeRotatedPosition(gx - m_owner->GetPositionX(), gy - m_owner->GetPositionY(), lx, ly);
|
||||
|
||||
lz = gz - m_owner->GetPositionZ();
|
||||
lo = NormalizeOrientation(go - m_owner->GetOrientation());
|
||||
}
|
||||
|
||||
void VehicleInfo::RemoveAccessoriesFromMap()
|
||||
{
|
||||
// Remove all accessories
|
||||
for (GuidSet::const_iterator itr = m_accessoryGuids.begin(); itr != m_accessoryGuids.end(); ++itr)
|
||||
{
|
||||
if (Creature* pAccessory = m_owner->GetMap()->GetCreature(*itr))
|
||||
{
|
||||
// TODO - unclear how long to despawn, also maybe some flag etc depending
|
||||
pAccessory->ForcedDespawn(5000);
|
||||
}
|
||||
}
|
||||
m_accessoryGuids.clear();
|
||||
m_isInitialized = false;
|
||||
}
|
||||
|
||||
/* ************************************************************************************************
|
||||
* Helper function for seat control
|
||||
* ***********************************************************************************************/
|
||||
|
||||
/// Get the Vehicle SeatEntry of a seat by position
|
||||
VehicleSeatEntry const* VehicleInfo::GetSeatEntry(uint8 seat) const
|
||||
{
|
||||
VehicleSeatMap::const_iterator itr = m_vehicleSeats.find(seat);
|
||||
return itr != m_vehicleSeats.end() ? itr->second : NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function will get a usable seat for a passenger
|
||||
*
|
||||
* @param passenger MUST be provided. Unit for which to try to get a free seat
|
||||
* @param seat will contain an available seat if returned true
|
||||
* @return return TRUE if and only if an available seat was found. In this case @seat will contain the id
|
||||
*/
|
||||
bool VehicleInfo::GetUsableSeatFor(Unit* passenger, uint8& seat) const
|
||||
{
|
||||
MANGOS_ASSERT(passenger);
|
||||
|
||||
uint8 possibleSeats = (passenger->GetTypeId() == TYPEID_PLAYER) ? (GetEmptySeatsMask() & m_playerSeats) : (GetEmptySeatsMask() & m_creatureSeats);
|
||||
|
||||
// No usable seats available
|
||||
if (!possibleSeats)
|
||||
return false;
|
||||
|
||||
// Start with 0
|
||||
seat = 0;
|
||||
|
||||
for (uint8 i = 1; seat < MAX_VEHICLE_SEAT; i <<= 1, ++seat)
|
||||
if (possibleSeats & i)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Returns if a @passenger could board onto @seat - @passenger MUST be provided
|
||||
bool VehicleInfo::IsSeatAvailableFor(Unit* passenger, uint8 seat) const
|
||||
{
|
||||
MANGOS_ASSERT(passenger);
|
||||
|
||||
return seat < MAX_VEHICLE_SEAT &&
|
||||
(GetEmptySeatsMask() & (passenger->GetTypeId() == TYPEID_PLAYER ? m_playerSeats : m_creatureSeats) & (1 << seat));
|
||||
}
|
||||
|
||||
/// Wrapper to collect all taken seats
|
||||
uint8 VehicleInfo::GetTakenSeatsMask() const
|
||||
{
|
||||
uint8 takenSeatsMask = 0;
|
||||
|
||||
for (PassengerMap::const_iterator itr = m_passengers.begin(); itr != m_passengers.end(); ++itr)
|
||||
takenSeatsMask |= 1 << itr->second->GetTransportSeat();
|
||||
|
||||
return takenSeatsMask;
|
||||
}
|
||||
|
||||
bool VehicleInfo:: IsUsableSeatForPlayer(uint32 seatFlags) const
|
||||
{
|
||||
return seatFlags & SEAT_FLAG_USABLE;
|
||||
}
|
||||
|
||||
/// Add control and such modifiers to a passenger if required
|
||||
void VehicleInfo::ApplySeatMods(Unit* passenger, uint32 seatFlags)
|
||||
{
|
||||
Unit* pVehicle = (Unit*)m_owner; // Vehicles are alawys Unit
|
||||
|
||||
if (passenger->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
Player* pPlayer = (Player*)passenger;
|
||||
|
||||
if (seatFlags & SEAT_FLAG_CAN_CONTROL)
|
||||
{
|
||||
pPlayer->GetCamera().SetView(pVehicle);
|
||||
|
||||
pPlayer->SetCharm(pVehicle);
|
||||
pVehicle->SetCharmerGuid(pPlayer->GetObjectGuid());
|
||||
|
||||
pVehicle->addUnitState(UNIT_STAT_CONTROLLED);
|
||||
pVehicle->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
|
||||
|
||||
pPlayer->SetClientControl(pVehicle, 1);
|
||||
pPlayer->SetMover(pVehicle);
|
||||
|
||||
// Unconfirmed - default speed handling
|
||||
if (pVehicle->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
if (!pPlayer->IsWalking() && pVehicle->IsWalking())
|
||||
{
|
||||
((Creature*)pVehicle)->SetWalk(false, true);
|
||||
}
|
||||
else if (pPlayer->IsWalking() && !pVehicle->IsWalking())
|
||||
{
|
||||
((Creature*)pVehicle)->SetWalk(true, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (seatFlags & (SEAT_FLAG_USABLE | SEAT_FLAG_CAN_CAST))
|
||||
{
|
||||
CharmInfo* charmInfo = pVehicle->InitCharmInfo(pVehicle);
|
||||
charmInfo->InitVehicleCreateSpells();
|
||||
|
||||
pPlayer->PossessSpellInitialize();
|
||||
}
|
||||
}
|
||||
else if (passenger->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
if (seatFlags & SEAT_FLAG_CAN_CONTROL)
|
||||
{
|
||||
passenger->SetCharm(pVehicle);
|
||||
pVehicle->SetCharmerGuid(passenger->GetObjectGuid());
|
||||
}
|
||||
|
||||
((Creature*)passenger)->AI()->SetCombatMovement(false);
|
||||
// Not entirely sure how this must be handled in relation to CONTROL
|
||||
// But in any way this at least would require some changes in the movement system most likely
|
||||
passenger->GetMotionMaster()->Clear(false, true);
|
||||
passenger->GetMotionMaster()->MoveIdle();
|
||||
}
|
||||
}
|
||||
|
||||
/// Remove control and such modifiers to a passenger if they were added
|
||||
void VehicleInfo::RemoveSeatMods(Unit* passenger, uint32 seatFlags)
|
||||
{
|
||||
Unit* pVehicle = (Unit*)m_owner;
|
||||
|
||||
if (passenger->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
Player* pPlayer = (Player*)passenger;
|
||||
|
||||
if (seatFlags & SEAT_FLAG_CAN_CONTROL)
|
||||
{
|
||||
pPlayer->SetCharm(NULL);
|
||||
pVehicle->SetCharmerGuid(ObjectGuid());
|
||||
|
||||
pPlayer->SetClientControl(pVehicle, 0);
|
||||
pPlayer->SetMover(NULL);
|
||||
|
||||
pVehicle->clearUnitState(UNIT_STAT_CONTROLLED);
|
||||
pVehicle->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
|
||||
|
||||
// must be called after movement control unapplying
|
||||
pPlayer->GetCamera().ResetView();
|
||||
}
|
||||
|
||||
if (seatFlags & (SEAT_FLAG_USABLE | SEAT_FLAG_CAN_CAST))
|
||||
pPlayer->RemovePetActionBar();
|
||||
}
|
||||
else if (passenger->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
if (seatFlags & SEAT_FLAG_CAN_CONTROL)
|
||||
{
|
||||
passenger->SetCharm(NULL);
|
||||
pVehicle->SetCharmerGuid(ObjectGuid());
|
||||
}
|
||||
// Reinitialize movement
|
||||
((Creature*)passenger)->AI()->SetCombatMovement(true, true);
|
||||
if (!passenger->getVictim())
|
||||
passenger->GetMotionMaster()->Initialize();
|
||||
}
|
||||
}
|
||||
|
||||
/*! @} */
|
||||
119
src/game/Object/Vehicle.h
Normal file
119
src/game/Object/Vehicle.h
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
/*
|
||||
* MaNGOS is a full featured server for World of Warcraft, supporting
|
||||
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
|
||||
*
|
||||
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* World of Warcraft, and all World of Warcraft or Warcraft art, images,
|
||||
* and lore are copyrighted by Blizzard Entertainment, Inc.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @addtogroup TransportSystem to provide abstract support for transported entities
|
||||
* The Transport System in MaNGOS consists of these files:
|
||||
* - TransportSystem.h to provide the basic classes TransportBase and TransportInfo
|
||||
* - TransportSystem.cpp which implements these classes
|
||||
* - Vehicle.h as a vehicle is a transporter it will inherit itr transporter-information from TransportBase
|
||||
* - Transports.h to implement the MOTransporter (subclas of gameobject) - Remains TODO
|
||||
* as well of
|
||||
* - impacts to various files
|
||||
*
|
||||
* @{
|
||||
*
|
||||
* @file Vehicle.h
|
||||
* This file contains the headers for the functionality required by Vehicles
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MANGOSSERVER_VEHICLE_H
|
||||
#define MANGOSSERVER_VEHICLE_H
|
||||
|
||||
#include "Common.h"
|
||||
#include "TransportSystem.h"
|
||||
|
||||
class Unit;
|
||||
|
||||
struct VehicleEntry;
|
||||
struct VehicleSeatEntry;
|
||||
|
||||
struct VehicleAccessory
|
||||
{
|
||||
uint32 vehicleEntry;
|
||||
uint32 seatId;
|
||||
uint32 passengerEntry;
|
||||
};
|
||||
|
||||
typedef std::map<uint8 /*seatPosition*/, VehicleSeatEntry const*> VehicleSeatMap;
|
||||
|
||||
/*
|
||||
* A class to provide support for each vehicle. This includes
|
||||
* - Boarding and unboarding of passengers, including support to switch vehicles
|
||||
* - Basic checks if a passenger can board
|
||||
*/
|
||||
class VehicleInfo : public TransportBase
|
||||
{
|
||||
public:
|
||||
explicit VehicleInfo(Unit* owner, VehicleEntry const* vehicleEntry, uint32 overwriteNpcEntry);
|
||||
void Initialize(); ///< Initializes the accessories
|
||||
bool IsInitialized() const { return m_isInitialized; }
|
||||
|
||||
~VehicleInfo();
|
||||
|
||||
VehicleEntry const* GetVehicleEntry() const { return m_vehicleEntry; }
|
||||
|
||||
void Board(Unit* passenger, uint8 seat); // Board a passenger to a vehicle
|
||||
void SwitchSeat(Unit* passenger, uint8 seat); // Used to switch seats of a passenger
|
||||
void UnBoard(Unit* passenger, bool changeVehicle); // Used to Unboard a passenger from a vehicle
|
||||
|
||||
bool CanBoard(Unit* passenger) const; // Used to check if a Unit can board a vehicle
|
||||
Unit* GetPassenger(uint8 seat) const;
|
||||
|
||||
void RemoveAccessoriesFromMap(); ///< Unsummones accessory in case of far-teleport or death
|
||||
|
||||
private:
|
||||
// Internal use to calculate the boarding position
|
||||
void CalculateBoardingPositionOf(float gx, float gy, float gz, float go, float& lx, float& ly, float& lz, float& lo) const;
|
||||
|
||||
// Seat information
|
||||
VehicleSeatEntry const* GetSeatEntry(uint8 seat) const;
|
||||
bool GetUsableSeatFor(Unit* passenger, uint8& seat) const;
|
||||
bool IsSeatAvailableFor(Unit* passenger, uint8 seat) const;
|
||||
|
||||
uint8 GetTakenSeatsMask() const;
|
||||
uint8 GetEmptySeatsMask() const { return ~GetTakenSeatsMask(); }
|
||||
uint8 GetEmptySeats() const { return m_vehicleSeats.size() - m_passengers.size(); }
|
||||
|
||||
bool IsUsableSeatForPlayer(uint32 seatFlags) const;
|
||||
bool IsUsableSeatForCreature(uint32 seatFlags) const { return true; } // special flag?, !IsUsableSeatForPlayer(seatFlags)?
|
||||
|
||||
// Apply/ Remove Controlling of the vehicle
|
||||
void ApplySeatMods(Unit* passenger, uint32 seatFlags);
|
||||
void RemoveSeatMods(Unit* passenger, uint32 seatFlags);
|
||||
|
||||
VehicleEntry const* m_vehicleEntry;
|
||||
VehicleSeatMap m_vehicleSeats; ///< Stores the available seats of the vehicle (filled in constructor)
|
||||
uint8 m_creatureSeats; ///< Mask that stores which seats are avaiable for creatures
|
||||
uint8 m_playerSeats; ///< Mask that stores which seats are avaiable for players
|
||||
|
||||
uint32 m_overwriteNpcEntry; // Internal use to store the entry with which the vehicle-accessories are fetched
|
||||
bool m_isInitialized; // Internal use to store if the accessory is initialized
|
||||
GuidSet m_accessoryGuids; ///< Stores the summoned accessories of this vehicle
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/*! @} */
|
||||
Loading…
Add table
Add a link
Reference in a new issue