当前位置: 首页>>代码示例>>C++>>正文


C++ CalendarEvent::GetInviteMap方法代码示例

本文整理汇总了C++中CalendarEvent::GetInviteMap方法的典型用法代码示例。如果您正苦于以下问题:C++ CalendarEvent::GetInviteMap方法的具体用法?C++ CalendarEvent::GetInviteMap怎么用?C++ CalendarEvent::GetInviteMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CalendarEvent的用法示例。


在下文中一共展示了CalendarEvent::GetInviteMap方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CopyEvent

// 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())
        {
            const CalendarInvite* invite = ci_itr->second;
            if (invite->InviteeGuid == guid)
            {
                AddInvite(newEvent, guid, invite->InviteeGuid, CALENDAR_STATUS_CONFIRMED, CALENDAR_RANK_OWNER, "", time(NULL));
            }
            else
            {
                CalendarModerationRank rank = CALENDAR_RANK_PLAYER;
                // copy moderator rank
                if (invite->Rank == CALENDAR_RANK_MODERATOR)
                    rank = CALENDAR_RANK_MODERATOR;

                AddInvite(newEvent, guid, invite->InviteeGuid, CALENDAR_STATUS_INVITED, rank, "", time(NULL));
            }
            ++ci_itr;
        }
    }

    SendCalendarEvent(player, newEvent, CALENDAR_SENDTYPE_COPY);
}
开发者ID:Arrait,项目名称:mangos-wotlk,代码行数:47,代码来源:Calendar.cpp

示例2: GetPlayerInvitesList

// 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;
        }
    }
}
开发者ID:OrAlien,项目名称:server,代码行数:23,代码来源:Calendar.cpp

示例3: CanAddInviteTo

// 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;
}
开发者ID:OrAlien,项目名称:server,代码行数:24,代码来源:Calendar.cpp


注:本文中的CalendarEvent::GetInviteMap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。