• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ CalendarEventType函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中CalendarEventType函数的典型用法代码示例。如果您正苦于以下问题:C++ CalendarEventType函数的具体用法?C++ CalendarEventType怎么用?C++ CalendarEventType使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: time_t

void WorldSession::HandleCalendarUpdateEvent(WorldPackets::Calendar::CalendarUpdateEvent& calendarUpdateEvent)
{
    ObjectGuid guid = _player->GetGUID();
    time_t oldEventTime = time_t(0);

    // prevent events in the past
    // To Do: properly handle timezones and remove the "- time_t(86400L)" hack
    if (calendarUpdateEvent.EventInfo.Time < (time(NULL) - time_t(86400L)))
        return;

    if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(calendarUpdateEvent.EventInfo.EventID))
    {
        oldEventTime = calendarEvent->GetDate();

        calendarEvent->SetType(CalendarEventType(calendarUpdateEvent.EventInfo.EventType));
        calendarEvent->SetFlags(calendarUpdateEvent.EventInfo.Flags);
        calendarEvent->SetDate(calendarUpdateEvent.EventInfo.Time);
        calendarEvent->SetTextureId(calendarUpdateEvent.EventInfo.TextureID);
        calendarEvent->SetTitle(calendarUpdateEvent.EventInfo.Title);
        calendarEvent->SetDescription(calendarUpdateEvent.EventInfo.Description);

        sCalendarMgr->UpdateEvent(calendarEvent);
        sCalendarMgr->SendCalendarEventUpdateAlert(*calendarEvent, oldEventTime);
    }
    else
        sCalendarMgr->SendCalendarCommandResult(guid, CALENDAR_ERROR_EVENT_INVALID);
}
开发者ID:beyourself,项目名称:DeathCore_6.x,代码行数:27,代码来源:CalendarHandler.cpp


示例2: TC_LOG_DEBUG

void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recvData)
{
    ObjectGuid guid = _player->GetGUID();
    time_t oldEventTime;

    uint64 eventId;
    uint64 inviteId;
    std::string title;
    std::string description;
    uint8 type;
    uint8 repetitionType;
    uint32 maxInvites;
    int32 dungeonId;
    uint32 eventPackedTime;
    uint32 timeZoneTime;
    uint32 flags;

    recvData >> eventId >> inviteId >> title >> description >> type >> repetitionType >> maxInvites >> dungeonId;
    recvData.ReadPackedTime(eventPackedTime);
    recvData.ReadPackedTime(timeZoneTime);
    recvData >> flags;

    // prevent events in the past
    // To Do: properly handle timezones and remove the "- time_t(86400L)" hack
    if (time_t(eventPackedTime) < (time(NULL) - time_t(86400L)))
    {
        recvData.rfinish();
        return;
    }

    TC_LOG_DEBUG("network", "CMSG_CALENDAR_UPDATE_EVENT [%s] EventId [" UI64FMTD
        "], InviteId [" UI64FMTD "] Title %s, Description %s, type %u "
        "Repeatable %u, MaxInvites %u, Dungeon ID %d, Time %u "
        "Time2 %u, Flags %u", guid.ToString().c_str(), eventId, inviteId, title.c_str(),
        description.c_str(), type, repetitionType, maxInvites, dungeonId,
        eventPackedTime, timeZoneTime, flags);

    if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId))
    {
        oldEventTime = calendarEvent->GetEventTime();

        calendarEvent->SetType(CalendarEventType(type));
        calendarEvent->SetFlags(flags);
        calendarEvent->SetEventTime(time_t(eventPackedTime));
        calendarEvent->SetTimeZoneTime(time_t(timeZoneTime)); // Not sure, seems constant from the little sniffs we have
        calendarEvent->SetDungeonId(dungeonId);
        calendarEvent->SetTitle(title);
        calendarEvent->SetDescription(description);

        sCalendarMgr->UpdateEvent(calendarEvent);
        sCalendarMgr->SendCalendarEventUpdateAlert(*calendarEvent, oldEventTime);
    }
    else
        sCalendarMgr->SendCalendarCommandResult(guid, CALENDAR_ERROR_EVENT_INVALID);
}
开发者ID:mysql1,项目名称:TournamentCore,代码行数:55,代码来源:CalendarHandler.cpp


示例3: calendarEvent

void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData)
{
    uint64 guid = _player->GetGUID();

    std::string title;
    std::string description;
    uint8 type;
    uint8 repeatable;
    uint32 maxInvites;
    int32 dungeonId;
    uint32 eventPackedTime;
    uint32 unkPackedTime;
    uint32 flags;

    recvData >> title >> description >> type >> repeatable >> maxInvites >> dungeonId;
    recvData.ReadPackedTime(eventPackedTime);
    recvData.ReadPackedTime(unkPackedTime);
    recvData >> flags;

    CalendarEvent calendarEvent(sCalendarMgr->GetFreeEventId(), guid, 0, CalendarEventType(type), dungeonId,
        time_t(eventPackedTime), flags, time_t(unkPackedTime), title, description);

    if (calendarEvent.IsGuildEvent() || calendarEvent.IsGuildAnnouncement())
        if (Player* creator = ObjectAccessor::FindPlayer(guid))
            calendarEvent.SetGuildId(creator->GetGuildId());

    if (calendarEvent.IsGuildAnnouncement())
    {
        // 946684800 is 01/01/2000 00:00:00 - default response time
        CalendarInvite invite(0, calendarEvent.GetEventId(), 0, guid, 946684800, CALENDAR_STATUS_NOT_SIGNED_UP, CALENDAR_RANK_PLAYER, "");
        // WARNING: By passing pointer to a local variable, the underlying method(s) must NOT perform any kind
        // of storage of the pointer as it will lead to memory corruption
        sCalendarMgr->AddInvite(&calendarEvent, &invite);
    }
    else
    {
        uint32 inviteCount;
        recvData >> inviteCount;

        for (uint32 i = 0; i < inviteCount; ++i)
        {
            uint64 invitee = 0;
            uint8 status = 0;
            uint8 rank = 0;
            recvData.readPackGUID(invitee);
            recvData >> status >> rank;

            // 946684800 is 01/01/2000 00:00:00 - default response time
            CalendarInvite* invite = new CalendarInvite(sCalendarMgr->GetFreeInviteId(), calendarEvent.GetEventId(), invitee, guid, 946684800, CalendarInviteStatus(status), CalendarModerationRank(rank), "");
            sCalendarMgr->AddInvite(&calendarEvent, invite);
        }
    }

    sCalendarMgr->AddEvent(new CalendarEvent(calendarEvent, calendarEvent.GetEventId()), CALENDAR_SENDTYPE_ADD);
}
开发者ID:BravadoToDeath,项目名称:ArkCORE-NG,代码行数:55,代码来源:CalendarHandler.cpp


示例4: HandleCalendarUpdateEvent

void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recvData)
{
    uint64 guid = _player->GetGUID();
    time_t oldEventTime;

    uint64 eventId;
    uint64 inviteId;
    std::string title;
    std::string description;
    uint8 type;
    uint8 repetitionType;
    uint32 maxInvites;
    int32 dungeonId;
    uint32 eventPackedTime;
    uint32 timeZoneTime;
    uint32 flags;

    recvData >> eventId >> inviteId >> title >> description >> type >> repetitionType >> maxInvites >> dungeonId;
    recvData.ReadPackedTime(eventPackedTime);
    recvData.ReadPackedTime(timeZoneTime);
    recvData >> flags;

    sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_UPDATE_EVENT [" UI64FMTD "] EventId [" UI64FMTD
        "], InviteId [" UI64FMTD "] Title %s, Description %s, type %u "
        "Repeatable %u, MaxInvites %u, Dungeon ID %d, Time %u "
        "Time2 %u, Flags %u", guid, eventId, inviteId, title.c_str(),
        description.c_str(), type, repetitionType, maxInvites, dungeonId,
        eventPackedTime, timeZoneTime, flags);

    if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId))
    {
        oldEventTime = calendarEvent->GetEventTime();

        calendarEvent->SetType(CalendarEventType(type));
        calendarEvent->SetFlags(flags);
        calendarEvent->SetEventTime(time_t(eventPackedTime));
        calendarEvent->SetTimeZoneTime(time_t(timeZoneTime)); // Not sure, seems constant from the little sniffs we have
        calendarEvent->SetDungeonId(dungeonId);
        calendarEvent->SetTitle(title);
        calendarEvent->SetDescription(description);

        sCalendarMgr->UpdateEvent(calendarEvent);
        sCalendarMgr->SendCalendarEventUpdateAlert(*calendarEvent, oldEventTime);
    }
    else
        sCalendarMgr->SendCalendarCommandResult(guid, CALENDAR_ERROR_EVENT_INVALID);
}
开发者ID:Caydan,项目名称:DeathCore,代码行数:47,代码来源:CalendarHandler.cpp


示例5: HandleCalendarUpdateEvent

void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recvData)
{
    uint64 guid = _player->GetGUID();
    time_t oldEventTime;

    uint64 eventId;
    uint64 inviteId;
    std::string title;
    std::string description;
    uint8 type;
    uint8 repetitionType;
    uint32 maxInvites;
    int32 dungeonId;
    uint32 eventPackedTime;
    uint32 timeZoneTime;
    uint32 flags;

    recvData >> eventId >> inviteId >> title >> description >> type >> repetitionType >> maxInvites >> dungeonId;
    recvData.ReadPackedTime(eventPackedTime);
    recvData.ReadPackedTime(timeZoneTime);
    recvData >> flags;

    if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId))
    {
        oldEventTime = calendarEvent->GetEventTime();

        calendarEvent->SetType(CalendarEventType(type));
        calendarEvent->SetFlags(flags);
        calendarEvent->SetEventTime(time_t(eventPackedTime));
        calendarEvent->SetTimeZoneTime(time_t(timeZoneTime)); // Not sure, seems constant from the little sniffs we have
        calendarEvent->SetDungeonId(dungeonId);
        calendarEvent->SetTitle(title);
        calendarEvent->SetDescription(description);

        sCalendarMgr->UpdateEvent(calendarEvent);
        sCalendarMgr->SendCalendarEventUpdateAlert(*calendarEvent, oldEventTime);
    }
    else
        sCalendarMgr->SendCalendarCommandResult(guid, CALENDAR_ERROR_EVENT_INVALID);
}
开发者ID:Lbniese,项目名称:WoWCircle434,代码行数:40,代码来源:CalendarHandler.cpp


示例6: DEBUG_LOG

void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recv_data)
{
    ObjectGuid guid = _player->GetObjectGuid();
    DEBUG_LOG("WORLD: CMSG_CALENDAR_UPDATE_EVENT [%u]", guid.GetCounter());

    time_t oldEventTime;
    ObjectGuid eventId;
    ObjectGuid inviteId;
    std::string title;
    std::string description;
    uint8 type;
    uint8 repetitionType;
    uint32 maxInvites;
    int32 dungeonId;
    uint32 eventPackedTime;
    uint32 UnknownPackedTime;
    uint32 flags;

    recv_data >> eventId >> inviteId >> title >> description >> type >> repetitionType >> maxInvites >> dungeonId;
    eventPackedTime   = recv_data.ReadPackedTime();
    UnknownPackedTime = recv_data.ReadPackedTime();
    recv_data >> flags;

    DEBUG_FILTER_LOG(LOG_FILTER_CALENDAR, "WorldSession::HandleCalendarUpdateEvent [%u] EventId [%u], InviteId [%u] Title %s, Description %s, type %u "
        "Repeatable %u, MaxInvites %u, Dungeon ID %d, Flags %u", guid.GetCounter(), uint32(eventId), uint32(inviteId), title.c_str(),
        description.c_str(), uint32(type), uint32(repetitionType), maxInvites, dungeonId, flags);

    if (CalendarEvent* calendarEvent = sCalendarMgr.GetEventById(eventId))
    {
        if (guid != calendarEvent->CreatorGuid)
        {
            CalendarInvite* updaterInvite = calendarEvent->GetInviteByGuid(guid);
            if (updaterInvite == NULL)
            {
                sCalendarMgr.SendCalendarCommandResult(guid, CALENDAR_ERROR_NOT_INVITED);
                return ;
            }

            if (updaterInvite->Rank != CALENDAR_RANK_MODERATOR)
            {
                // remover have not enough right to change invite status
                sCalendarMgr.SendCalendarCommandResult(guid, CALENDAR_ERROR_PERMISSIONS);
                return;
            }
        }

        oldEventTime = calendarEvent->EventTime;

        calendarEvent->Type = CalendarEventType(type);
        calendarEvent->Flags = flags;
        calendarEvent->EventTime = eventPackedTime;
        calendarEvent->UnknownTime = UnknownPackedTime;
        calendarEvent->DungeonId = dungeonId;
        calendarEvent->Title = title;
        calendarEvent->Description = description;

        calendarEvent->RemoveFlag(CALENDAR_STATE_FLAG_SAVED);
        calendarEvent->AddFlag(CALENDAR_STATE_FLAG_UPDATED);

        sCalendarMgr.SendCalendarEventUpdateAlert(calendarEvent, oldEventTime);

    }
    else
        sCalendarMgr.SendCalendarCommandResult(guid, CALENDAR_ERROR_EVENT_INVALID);
}
开发者ID:xarly,项目名称:mangos,代码行数:65,代码来源:CalendarHandler.cpp


示例7: CalendarEvent

void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData)
{
    ObjectGuid guid = _player->GetGUID();

    std::string title;
    std::string description;
    uint8 type;
    uint8 repeatable;
    uint32 maxInvites;
    int32 dungeonId;
    uint32 eventPackedTime;
    uint32 unkPackedTime;
    uint32 flags;

    recvData >> title >> description >> type >> repeatable >> maxInvites >> dungeonId;
    recvData.ReadPackedTime(eventPackedTime);
    recvData.ReadPackedTime(unkPackedTime);
    recvData >> flags;

    // prevent events in the past
    // To Do: properly handle timezones and remove the "- time_t(86400L)" hack
    if (time_t(eventPackedTime) < (time(NULL) - time_t(86400L)))
    {
        recvData.rfinish();
        return;
    }

    CalendarEvent* calendarEvent = new CalendarEvent(sCalendarMgr->GetFreeEventId(), guid, 0, CalendarEventType(type), dungeonId,
        time_t(eventPackedTime), flags, time_t(unkPackedTime), title, description);

    if (calendarEvent->IsGuildEvent() || calendarEvent->IsGuildAnnouncement())
        if (Player* creator = ObjectAccessor::FindPlayer(guid))
            calendarEvent->SetGuildId(creator->GetGuildId());

    if (calendarEvent->IsGuildAnnouncement())
    {
        // 946684800 is 01/01/2000 00:00:00 - default response time
        CalendarInvite invite(0, calendarEvent->GetEventId(), ObjectGuid::Empty, guid, 946684800, CALENDAR_STATUS_NOT_SIGNED_UP, CALENDAR_RANK_PLAYER, "");
        // WARNING: By passing pointer to a local variable, the underlying method(s) must NOT perform any kind
        // of storage of the pointer as it will lead to memory corruption
        sCalendarMgr->AddInvite(calendarEvent, &invite);
    }
    else
    {
        // client limits the amount of players to be invited to 100
        const uint32 MaxPlayerInvites = 100;

        uint32 inviteCount;
        ObjectGuid invitee[MaxPlayerInvites];
        uint8 status[MaxPlayerInvites];
        uint8 rank[MaxPlayerInvites];

        memset(status, 0, sizeof(status));
        memset(rank, 0, sizeof(rank));

        try
        {
            recvData >> inviteCount;

            for (uint32 i = 0; i < inviteCount && i < MaxPlayerInvites; ++i)
            {
                recvData >> invitee[i].ReadAsPacked();
                recvData >> status[i] >> rank[i];
            }
        }
        catch (ByteBufferException const&)
        {
            delete calendarEvent;
            calendarEvent = NULL;
            throw;
        }

        SQLTransaction trans;
        if (inviteCount > 1)
            trans = CharacterDatabase.BeginTransaction();

        for (uint32 i = 0; i < inviteCount && i < MaxPlayerInvites; ++i)
        {
            // 946684800 is 01/01/2000 00:00:00 - default response time
            CalendarInvite* invite = new CalendarInvite(sCalendarMgr->GetFreeInviteId(), calendarEvent->GetEventId(), invitee[i], guid, 946684800, CalendarInviteStatus(status[i]), CalendarModerationRank(rank[i]), "");
            sCalendarMgr->AddInvite(calendarEvent, invite, trans);
        }

        if (inviteCount > 1)
            CharacterDatabase.CommitTransaction(trans);
    }

    sCalendarMgr->AddEvent(calendarEvent, CALENDAR_SENDTYPE_ADD);
}
开发者ID:mysql1,项目名称:TournamentCore,代码行数:89,代码来源:CalendarHandler.cpp


示例8: MAKE_NEW_GUID

void CalendarMgr::LoadFromDB()
{
    uint32 count = 0;
    _maxEventId = 0;
    _maxInviteId = 0;

    //                                                       0   1        2      3            4     5        6          7      8
    if (QueryResult result = CharacterDatabase.Query("SELECT id, creator, title, description, type, dungeon, eventtime, flags, time2 FROM calendar_events"))
        do
        {
            Field* fields = result->Fetch();

            uint64 eventId          = fields[0].GetUInt64();
            uint64 creatorGUID      = MAKE_NEW_GUID(fields[1].GetUInt32(), 0, HIGHGUID_PLAYER);
            std::string title       = fields[2].GetString();
            std::string description = fields[3].GetString();
            CalendarEventType type  = CalendarEventType(fields[4].GetUInt8());
            int32 dungeonId         = fields[5].GetInt32();
            uint32 eventTime        = fields[6].GetUInt32();
            uint32 flags            = fields[7].GetUInt32();
            uint32 timezoneTime     = fields[8].GetUInt32();
            uint32 guildId = 0;

            if (flags & CALENDAR_FLAG_GUILD_EVENT || flags & CALENDAR_FLAG_WITHOUT_INVITES)
                guildId = Player::GetGuildIdFromDB(creatorGUID);

            CalendarEvent* calendarEvent = new CalendarEvent(eventId, creatorGUID, guildId, type, dungeonId, time_t(eventTime), flags, time_t(timezoneTime), title, description);
            _events.insert(calendarEvent);

            _maxEventId = std::max(_maxEventId, eventId);

            ++count;
        }
        while (result->NextRow());

    sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u calendar events", count);
    count = 0;

    //                                                       0   1      2        3       4       5           6     7
    if (QueryResult result = CharacterDatabase.Query("SELECT id, event, invitee, sender, status, statustime, rank, text FROM calendar_invites"))
        do
        {
            Field* fields = result->Fetch();

            uint64 inviteId             = fields[0].GetUInt64();
            uint64 eventId              = fields[1].GetUInt64();
            uint64 invitee              = MAKE_NEW_GUID(fields[2].GetUInt32(), 0, HIGHGUID_PLAYER);
            uint64 senderGUID           = MAKE_NEW_GUID(fields[3].GetUInt32(), 0, HIGHGUID_PLAYER);
            CalendarInviteStatus status = CalendarInviteStatus(fields[4].GetUInt8());
            uint32 statusTime           = fields[5].GetUInt32();
            CalendarModerationRank rank = CalendarModerationRank(fields[6].GetUInt8());
            std::string text            = fields[7].GetString();

            CalendarInvite* invite = new CalendarInvite(inviteId, eventId, invitee, senderGUID, time_t(statusTime), status, rank, text);
            _invites[eventId].push_back(invite);

            _maxInviteId = std::max(_maxInviteId, inviteId);

            ++count;
        }
        while (result->NextRow());

    sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u calendar invites", count);

    for (uint64 i = 1; i < _maxEventId; ++i)
        if (!GetEvent(i))
            _freeEventIds.push_back(i);

    for (uint64 i = 1; i < _maxInviteId; ++i)
        if (!GetInvite(i))
            _freeInviteIds.push_back(i);
}
开发者ID:ter884,项目名称:TER-Server,代码行数:72,代码来源:CalendarMgr.cpp


示例9: CalendarEventType

void CalendarMgr::LoadFromDB()
{
    // Loading calendar_events
    {
        QueryResult* result = CharacterDatabase.Query("SELECT entry, creator, title, description, type, dungeon, date, flags FROM calendar_events");
        if (!result)
        {
            Log.Debug("CalendarMgr", "Table calendar_events is empty.");
            return;
        }
        if (result == 0)
            return;

        uint32 count = 0;

        do
        {
            Field* fields = result->Fetch();

            uint64 entry = fields[0].GetUInt32();
            uint32 creator = fields[1].GetUInt32();
            std::string title = fields[2].GetString();
            std::string description = fields[3].GetString();
            CalendarEventType type = CalendarEventType(fields[4].GetUInt32());
            uint32 dungeon = fields[5].GetUInt32();
            time_t date = fields[6].GetUInt32();
            uint32 flags = fields[7].GetUInt32();

            CalendarEvent* calendarEvent = new CalendarEvent(entry, creator, title, description, type, dungeon, time_t(date), flags);
            _events.insert(calendarEvent);

            Log.Debug("CalendarMgr", "Title %s loaded", calendarEvent->title.c_str()); // remove me ;-)

            ++count;
        } while (result->NextRow());

    }
    Log.Success("CalendarMgr", "%u entries loaded from table calendar_events", _events.size());
    {
        QueryResult* result = CharacterDatabase.Query("SELECT invite_id, event, invitee, sender, status, statustime, rank, text FROM calendar_invites");
        if (!result)
        {
            Log.Debug("CalendarMgr", "Table calendar_invites is empty.");
            return;
        }
        if (result == 0)
            return;

        uint32 count = 0;
        do
        {
            Field* fields = result->Fetch();

            uint32 invite_id = fields[0].GetUInt32();               // entry of the calendar event (unique)
            uint32 event = fields[1].GetUInt32();             // id of the character
            uint32 invitee = fields[2].GetUInt32();
            uint32 sender = fields[3].GetUInt32();
            CalendarInviteStatus status = CalendarInviteStatus(fields[4].GetUInt32());
            time_t statustime = fields[5].GetUInt32();
            uint32 rank = fields[6].GetUInt32();
            std::string text = fields[7].GetString();

            CalendarInvite* invite = new CalendarInvite(invite_id, event, invitee, sender, status, time_t(statustime), rank, text);
            _invites[event].push_back(invite);

            ++count;
        } while (result->NextRow());
    }
    Log.Success("CalendarMgr", "Loaded %u calendar invites", _invites.size());
}
开发者ID:Declipe,项目名称:AscEmu,代码行数:70,代码来源:CalendarMgr.cpp


示例10: CalendarEvent

void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData)
{
    uint64 guid = _player->GetGUID();

    std::string title;
    std::string description;
    uint8 type;
    int32 dungeonId;
    uint32 eventPackedTime;
    uint32 maxInvites;  // always 100, necesary? Not find the way how to change it
    uint32 flags;
    uint32 inviteeCount;
    uint16 descriptionLength, titleLength;

    recvData >> maxInvites >> flags >> dungeonId;
    recvData.ReadPackedTime(eventPackedTime);
    recvData >> type;
    inviteeCount = recvData.ReadBits(22);
    descriptionLength = recvData.ReadBits(11);

    std::list<CalendarInvitePacketInfo> calendarInviteList;
    for (uint32 i = 0; i < inviteeCount; i++)
    {
        CalendarInvitePacketInfo info;
        info.Guid[7] = recvData.ReadBit();
        info.Guid[2] = recvData.ReadBit();
        info.Guid[6] = recvData.ReadBit();
        info.Guid[3] = recvData.ReadBit();
        info.Guid[5] = recvData.ReadBit();
        info.Guid[1] = recvData.ReadBit();
        info.Guid[0] = recvData.ReadBit();
        info.Guid[4] = recvData.ReadBit();
        calendarInviteList.push_back(info);
    }

    titleLength = recvData.ReadBits(8);

    for (std::list<CalendarInvitePacketInfo>::iterator iter = calendarInviteList.begin(); iter != calendarInviteList.end(); ++iter)
    {
        recvData.ReadByteSeq(iter->Guid[4]);
        recvData.ReadByteSeq(iter->Guid[2]);
        recvData.ReadByteSeq(iter->Guid[3]);
        recvData.ReadByteSeq(iter->Guid[1]);
        recvData.ReadByteSeq(iter->Guid[0]);
        recvData.ReadByteSeq(iter->Guid[6]);
        recvData.ReadByteSeq(iter->Guid[7]);
        recvData >> iter->Status;
        recvData.ReadByteSeq(iter->Guid[5]);
        recvData >> iter->ModerationRank;
    }

    title = recvData.ReadString(titleLength);
    description = recvData.ReadString(descriptionLength);

    CalendarEvent* calendarEvent = new CalendarEvent(sCalendarMgr->GetFreeEventId(), guid, 0, CalendarEventType(type), dungeonId,
        time_t(eventPackedTime), flags, title, description);

    if (calendarEvent->IsGuildEvent() || calendarEvent->IsGuildAnnouncement())
        if (Player* creator = ObjectAccessor::FindPlayer(guid))
            calendarEvent->SetGuildId(creator->GetGuildId());

    if (calendarEvent->IsGuildAnnouncement())
    {
        // DEFAULT_STATUS_TIME is 01/01/2000 00:00:00 - default response time
        CalendarInvite* invite = new CalendarInvite(0, calendarEvent->GetEventId(), 0, guid, DEFAULT_STATUS_TIME, CALENDAR_STATUS_NOT_SIGNED_UP, CALENDAR_RANK_PLAYER, "");
        sCalendarMgr->AddInvite(calendarEvent, invite);
    }
    else
    {
        for (std::list<CalendarInvitePacketInfo>::const_iterator iter = calendarInviteList.begin(); iter != calendarInviteList.end(); ++iter)
        {
            // DEFAULT_STATUS_TIME is 01/01/2000 00:00:00 - default response time
            CalendarInvite* invite = new CalendarInvite(sCalendarMgr->GetFreeInviteId(), calendarEvent->GetEventId(), (uint64)iter->Guid, guid, DEFAULT_STATUS_TIME, CalendarInviteStatus(iter->Status), CalendarModerationRank(iter->ModerationRank), "");
            sCalendarMgr->AddInvite(calendarEvent, invite);
        }
    }

    sCalendarMgr->AddEvent(calendarEvent, CALENDAR_SENDTYPE_ADD);
}
开发者ID:JunkyBulgaria,项目名称:SkyFire.548,代码行数:79,代码来源:CalendarHandler.cpp


示例11: CalendarEvent

void WorldSession::HandleCalendarAddEvent(WorldPackets::Calendar::CalendarAddEvent& calendarAddEvent)
{
    ObjectGuid guid = _player->GetGUID();

    // prevent events in the past
    // To Do: properly handle timezones and remove the "- time_t(86400L)" hack
    if (calendarAddEvent.EventInfo.Time < (time(NULL) - time_t(86400L)))
        return;

    CalendarEvent* calendarEvent = new CalendarEvent(sCalendarMgr->GetFreeEventId(), guid, UI64LIT(0), CalendarEventType(calendarAddEvent.EventInfo.EventType), calendarAddEvent.EventInfo.TextureID,
        calendarAddEvent.EventInfo.Time, calendarAddEvent.EventInfo.Flags, calendarAddEvent.EventInfo.Title, calendarAddEvent.EventInfo.Description, time_t(0));

    if (calendarEvent->IsGuildEvent() || calendarEvent->IsGuildAnnouncement())
        if (Player* creator = ObjectAccessor::FindPlayer(guid))
            calendarEvent->SetGuildId(creator->GetGuildId());

    if (calendarEvent->IsGuildAnnouncement())
    {
        CalendarInvite invite(0, calendarEvent->GetEventId(), ObjectGuid::Empty, guid, CALENDAR_DEFAULT_RESPONSE_TIME, CALENDAR_STATUS_NOT_SIGNED_UP, CALENDAR_RANK_PLAYER, "");
        // WARNING: By passing pointer to a local variable, the underlying method(s) must NOT perform any kind
        // of storage of the pointer as it will lead to memory corruption
        sCalendarMgr->AddInvite(calendarEvent, &invite);
    }
    else
    {
        SQLTransaction trans;
        if (calendarAddEvent.EventInfo.Invites.size() > 1)
            trans = CharacterDatabase.BeginTransaction();

        for (uint32 i = 0; i < calendarAddEvent.EventInfo.Invites.size(); ++i)
        {
            CalendarInvite* invite = new CalendarInvite(sCalendarMgr->GetFreeInviteId(), calendarEvent->GetEventId(), calendarAddEvent.EventInfo.Invites[i].Guid,
                guid, CALENDAR_DEFAULT_RESPONSE_TIME, CalendarInviteStatus(calendarAddEvent.EventInfo.Invites[i].Status),
                CalendarModerationRank(calendarAddEvent.EventInfo.Invites[i].Moderator), "");
            sCalendarMgr->AddInvite(calendarEvent, invite, trans);
        }

        if (calendarAddEvent.EventInfo.Invites.size() > 1)
            CharacterDatabase.CommitTransaction(trans);
    }

    sCalendarMgr->AddEvent(calendarEvent, CALENDAR_SENDTYPE_ADD);
}
开发者ID:beyourself,项目名称:DeathCore_6.x,代码行数:43,代码来源:CalendarHandler.cpp


示例12: bar

// 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);
//.........这里部分代码省略.........
开发者ID:OrAlien,项目名称:server,代码行数:101,代码来源:Calendar.cpp


示例13: CalendarEvent

void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData)
{
    uint64 guid = _player->GetGUID();

    std::string title;
    std::string description;
    uint8 type;
    uint8 repeatable;
    uint32 maxInvites;
    int32 dungeonId;
    uint32 eventPackedTime;
    uint32 unkPackedTime;
    uint32 flags;

    recvData >> title >> description >> type >> repeatable >> maxInvites >> dungeonId;
    recvData.ReadPackedTime(eventPackedTime);
    recvData.ReadPackedTime(unkPackedTime);
    recvData >> flags;

    CalendarEvent* calendarEvent = new CalendarEvent(sCalendarMgr->GetFreeEventId(), guid, 0, CalendarEventType(type), dungeonId,
        time_t(eventPackedTime), flags, time_t(unkPackedTime), title, description);

    if (calendarEvent->IsGuildEvent() || calendarEvent->IsGuildAnnouncement())
        if (Player* creator = ObjectAccessor::FindPlayer(guid))
            calendarEvent->SetGuildId(creator->GetGuildId());

    if (calendarEvent->IsGuildAnnouncement())
    {
        // 946684800 is 01/01/2000 00:00:00 - default response time
        CalendarInvite* invite = new CalendarInvite(sCalendarMgr->GetFreeInviteId(), calendarEvent->GetEventId(), 0, guid, 946684800, CALENDAR_STATUS_NOT_SIGNED_UP, CALENDAR_RANK_PLAYER, "");
        sCalendarMgr->AddInvite(calendarEvent, invite);
    }
    else
    {
        uint32 inviteCount;
        recvData >> inviteCount;

        for (uint32 i = 0; i < inviteCount; ++i)
        {
            uint64 invitee = 0;
            uint8 status = 0;
            uint8 rank = 0;
            recvData.readPackGUID(invitee);
            recvData >> status >> rank;

            // 946684800 is 01/01/2000 00:00:00 - default response time
            CalendarInvite* invite = new CalendarInvite(sCalendarMgr->GetFreeInviteId(), calendarEvent->GetEventId(), invitee, guid, 946684800, CalendarInviteStatus(status), CalendarModerationRank(rank), "");
            sCalendarMgr->AddInvite(calendarEvent, invite);
        }
    }

    sCalendarMgr->AddEvent(calendarEvent, CALENDAR_SENDTYPE_ADD);
}
开发者ID:cristal,项目名称:TeraCore,代码行数:53,代码来源:CalendarHandler.cpp


示例14: DEBUG_LOG

void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recv_data)
{
    ObjectGuid guid = _player->GetObjectGuid();
    DEBUG_LOG("WORLD: Received opcode CMSG_CALENDAR_UPDATE_EVENT [%s]", guid.GetString().c_str());

    time_t oldEventTime;
    uint64 eventId;
    uint64 inviteId;
    std::string title;
    std::string description;
    uint8 type;
    uint8 repetitionType;
    uint32 maxInvites;
    int32 dungeonId;
    uint32 eventPackedTime;
    uint32 UnknownPackedTime;
    uint32 flags;

    recv_data >> eventId >> inviteId >> title >> description >> type >> repetitionType >> maxInvites >> dungeonId;
    recv_data >> eventPackedTime;
    recv_data >> UnknownPackedTime;
    recv_data >> flags;

    DEBUG_FILTER_LOG(LOG_FILTER_CALENDAR, "EventId [" UI64FMTD "], InviteId [" UI64FMTD "] Title %s, Description %s, type %u "
                     "Repeatable %u, MaxInvites %u, Dungeon ID %d, Flags %u", eventId, inviteId, title.c_str(),
                     description.c_str(), uint32(type), uint32(repetitionType), maxInvites, dungeonId, flags);

    if (CalendarEvent* event = sCalendarMgr.GetEventById(eventId))
    {
        if (guid != event->CreatorGuid)
        {
            CalendarInvite* updaterInvite = event->GetInviteByGuid(guid);
            if (updaterInvite == nullptr)
            {
                sCalendarMgr.SendCalendarCommandResult(_player, CALENDAR_ERROR_NOT_INVITED);
                return ;
            }

            if (updaterInvite->Rank != CALENDAR_RANK_MODERATOR)
            {
                // remover have not enough right to change invite status
                sCalendarMgr.SendCalendarCommandResult(_player, CALENDAR_ERROR_PERMISSIONS);
                return;
            }
        }

        oldEventTime = event->EventTime;

        event->Type = CalendarEventType(type);
        event->Flags = flags;
        event->EventTime = timeBitFieldsToSecs(eventPackedTime);
        event->UnknownTime = timeBitFieldsToSecs(UnknownPackedTime);
        event->DungeonId = dungeonId;
        event->Title = title;
        event->Description = description;

        sCalendarMgr.SendCalendarEventUpdateAlert(event, oldEventTime);

        // query construction
        CharacterDatabase.escape_string(title);
        CharacterDatabase.escape_string(description);
        CharacterDatabase.PExecute("UPDATE calendar_events SET "
                                   "type=%u, flags=%u, dungeonId=%d, eventTime=%u, title='%s', description='%s'"
                                   "WHERE eventid=" UI64FMTD,
                                   uint32(type), flags, dungeonId, uint32(event->EventTime), title.c_str(), description.c_str(), eventId);
    }
    else
        sCalendarMgr.SendCalendarCommandResult(_player, CALENDAR_ERROR_EVENT_INVALID);
}
开发者ID:HerrTrigger,项目名称:mangos-wotlk,代码行数:69,代码来源:CalendarHandler.cpp


示例15: TC_LOG_DEBUG

void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recvData)
{
    uint64 guid = _player->GetGUID();
    time_t oldEventTime;

    ObjectGuid eventId;
    ObjectGuid inviteId;
    std::string title;
    std::string description;
    uint8 type;
    uint32 maxInvites;
    int32 dungeonId;
    uint32 eventPackedTime;
    uint32 flags;
    uint16 descriptionLength;
    uint16 titleLength;

    recvData >> maxInvites >> dungeonId;
    recvData.ReadPackedTime(eventPackedTime);
    recvData >> flags >> type;
    eventId[4] = recvData.ReadBit();
    eventId[5] = recvData.ReadBit();
    eventId[2] = recvData.ReadBit();
    inviteId[4] = recvData.ReadBit();
    eventId[7] = recvData.ReadBit();
    eventId[0] = recvData.ReadBit();
    inviteId[5] = recvData.ReadBit();
    inviteId[3] = recvData.ReadBit();
    eventId[6] = recvData.ReadBit();
    eventId[1] = recvData.ReadBit();
    inviteId[6] = recvData.ReadBit();
    inviteId[2] = recvData.ReadBit();
    inviteId[7] = recvData.ReadBit();
    inviteId[1] = recvData.ReadBit();
    inviteId[0] = recvData.ReadBit();
    descriptionLength = recvData.ReadBits(11);
    titleLength = recvData.ReadBits(8);
    eventId[3] = recvData.ReadBit();

    recvData.ReadByteSeq(inviteId[6]);
    recvData.ReadByteSeq(eventId[0]);
    recvData.ReadByteSeq(inviteId[7]);
    recvData.ReadByteSeq(inviteId[3]);
    recvData.ReadByteSeq(eventId[6]);
    recvData.ReadByteSeq(inviteId[1]);
    recvData.ReadByteSeq(eventId[2]);
    title = recvData.ReadString(titleLength);
    recvData.ReadByteSeq(inviteId[5]);
    recvData.ReadByteSeq(inviteId[4]);
    recvData.ReadByteSeq(eventId[5]);
    recvData.ReadByteSeq(eventId[3]);
    recvData.ReadByteSeq(inviteId[0]);
    recvData.ReadByteSeq(eventId[4]);
    description = recvData.ReadString(descriptionLength);
    recvData.ReadByteSeq(eventId[1]);
    recvData.ReadByteSeq(inviteId[2]);
    recvData.ReadByteSeq(eventId[7]);

    TC_LOG_DEBUG("network", "CMSG_CALENDAR_UPDATE_EVENT [" UI64FMTD "] EventId [" UI64FMTD
        "], InviteId [" UI64FMTD "] Title %s, Description %s, type %u "
        "MaxInvites %u, Dungeon ID %d, Time %u, Flags %u",
        guid, (uint64)eventId, (uint64)inviteId, title.c_str(),
        description.c_str(), type, maxInvites, dungeonId,
        eventPackedTime, flags);

    if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId))
    {
        oldEventTime = calendarEvent->GetEventTime();

        calendarEvent->SetType(CalendarEventType(type));
        calendarEvent->SetFlags(flags);
        calendarEvent->SetEventTime(time_t(eventPackedTime));
        calendarEvent->SetDungeonId(dungeonId);
        calendarEvent->SetTitle(title);
        calendarEvent->SetDescription(description);

        sCalendarMgr->UpdateEvent(calendarEvent);
        sCalendarMgr->SendCalendarEventUpdateAlert(*calendarEvent, oldEventTime);
    }
    else
        sCalendarMgr->SendCalendarCommandResult(guid, CALENDAR_ERROR_EVENT_INVALID);
}
开发者ID:JunkyBulgaria,项目名称:SkyFire.548,代码行数:82,代码来源:CalendarHandler.cpp


示例16: getMSTime

void CalendarMgr::LoadFromDB()
{
    uint32 oldMSTime = getMSTime();

    uint32 count = 0;
    _maxEventId = 0;
    _maxInviteId = 0;

    //                                                       0   1        2      3            4     5        6          7      8
    if (QueryResult result = CharacterDatabase.Query("SELECT id, creator, title, description, type, dungeon, eventtime, flags, time2 FROM calendar_events"))
        do
        {
            Field* fields = result->Fetch();

            uint64 eventId          = fields[0].GetUInt64();
            ObjectGuid creatorGUID  = ObjectGuid(HighGuid::Player, fields[1].GetUInt32());
            std::string title       = fields[2].GetString();
            std::string description = fields[3].GetString();
            CalendarEventType type  = CalendarEventType(fields[4].GetUInt8());
            int32 dungeonId         = fields[5].GetInt32();
            uint32 eventTime        = fields[6].GetUInt32();
            uint32 flags            = fields[7].GetUInt32();
            uint32 timezoneTime     = fields[8].GetUInt32();
            ObjectGuid::LowType guildId = 0;

            if (flags & CALENDAR_FLAG_GUILD_EVENT || flags & CALENDAR_FLAG_WITHOUT_INVITES)
                guildId = sCharacterCache->GetCharacterGuildIdByGuid(creatorGUID);

            CalendarEvent* calendarEvent = new CalendarEvent(eventId, creatorGUID, guildId, type, dungeonId, time_t(eventTime), flags, time_t(timezoneTime), title, description);
            _events.insert(calendarEvent);

            _maxEventId = std::max(_maxEventId, eventId);

            ++count;
        }
        while (result->NextRow());

    TC_LOG_INFO("server.loading", ">> Loaded %u calendar events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
    count = 0;
    oldMSTime = getMSTime();

    //                                                       0   1      

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ CalendarInviteStatus函数代码示例发布时间:2022-05-30
下一篇:
C++ CalculateRanks函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap