Esempio n. 1
0
// Add group or player into queue. If player has group and he's a leader then whole party will be added to queue.
void LFGQueue::AddToQueue(Player* leader, uint32 queAreaID)
{
    if(!leader)
        return;

    if (AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(queAreaID))
    {
        if (DisableMgr::IsDisabledFor(DISABLE_TYPE_MAP, areaEntry->mapid))
        {
            ChatHandler(leader->GetSession()).SendSysMessage(LANG_MAP_IS_DISABLED);
            return;
        }
    }

    Group* grp = leader->GetGroup();

    //add players from group to queue list & group to group list
    // Calculate what roles group need and add it to the GroupQueueList, (DONT'ADD PLAYERS!)
    if (grp && grp->IsLeader(leader->GetObjectGuid()))
    {
        // Add group to queued groups list
        LFGGroupQueueInfo& i_Group = m_QueuedGroups[grp->GetId()];

        grp->CalculateLFGRoles(i_Group);
       i_Group.team = leader->GetTeam();
        i_Group.areaId = queAreaID;
        i_Group.groupTimer = 5 * MINUTE * IN_MILLISECONDS; // Minute timer for SMSG_MEETINGSTONE_IN_PROGRESS

        grp->SetLFGAreaId(queAreaID);

        WorldPacket data;
        BuildSetQueuePacket(data, queAreaID, MEETINGSTONE_STATUS_JOINED_QUEUE);

        grp->BroadcastPacket(&data, true);
    }
    else if(!grp)
    {
        // Add player to queued players list
        LFGPlayerQueueInfo& i_Player = m_QueuedPlayers[leader->GetObjectGuid()];

        i_Player.roleMask = CalculateRoles((Classes)leader->getClass());
       i_Player.team = leader->GetTeam();
        i_Player.areaId = queAreaID;
        i_Player.hasQueuePriority = false;

        leader->GetSession()->SendMeetingstoneSetqueue(queAreaID, MEETINGSTONE_STATUS_JOINED_QUEUE);
    }
    else                                                    // Player is in group, but it's not leader
        MANGOS_ASSERT(false && "LFGQueue::AddToQueue called while player is not leader and in group.");
}
Esempio n. 2
0
void LFGQueue::UpdateGroup(uint32 groupId)
{
    QueuedGroupsMap::iterator qGroup = m_QueuedGroups.find(groupId);

    if(qGroup != m_QueuedGroups.end())
    {
        Group* grp = sObjectMgr.GetGroupById(qGroup->first);

        if(grp)
        {
            grp->CalculateLFGRoles(qGroup->second);
        }

    }
}