Ejemplo n.º 1
0
inline void ChatLog::_AppendGroupMembers(Group* group, std::ostringstream& ss)
{
    if (!group)
        ss << " {unknown group}:";
    else
    {
        char sz[32];
        sprintf(sz, UI64FMTD, group->GetGUID());
        ss << " {" << sz << "} [";
        const uint64& leaderGuid = group->GetLeaderGUID();
        if (Player* leader = ObjectAccessor::FindPlayer(leaderGuid))
            ss << leader->GetName();

        Group::MemberSlotList members = group->GetMemberSlots();
        for (Group::member_citerator itr = members.begin(); itr != members.end(); ++itr)
        {
            if (itr->guid == leaderGuid)
                continue;

            if (Player* member = ObjectAccessor::FindPlayer(itr->guid))
                ss << "," << member->GetName();
        }
        ss << "]:";
    }
}
Ejemplo n.º 2
0
inline void ChatLog::_AppendGroupMembers(Group* group, std::string& s)
{
    if (!group)
        s.append(" {unknown group}:");
    else
    {
        char sz[32];
        sprintf(sz, UI64FMTD, group->GetGUID());
        s.append(" {").append(sz).append("} [");
        const uint64& leaderGuid = group->GetLeaderGUID();
        if (Player* leader = sObjectMgr->GetPlayerByLowGUID(leaderGuid))
            s.append(leader->GetName());

        Group::MemberSlotList members = group->GetMemberSlots();
        for (Group::member_citerator itr = members.begin(); itr != members.end(); ++itr)
        {
            if (itr->guid == leaderGuid)
                continue;

            if (Player* member = sObjectMgr->GetPlayerByLowGUID(itr->guid))
                s.append(",").append(member->GetName());
        }
        s.append("]:");
    }
}
Ejemplo n.º 3
0
GroupQueueInfo* ChallengeMgr::CreateGroupQueueInfo(Group *group, BattlegroundTypeId bgTypeId, uint8 arenatype)
{
    Player *leader = ObjectAccessor::FindPlayer(group->GetLeaderGUID());
    if (!leader)
        return NULL;

    GroupQueueInfo* ginfo            = new GroupQueueInfo;
    ginfo->BgTypeId                  = bgTypeId;
    ginfo->ArenaType                 = arenatype;
    ginfo->ArenaTeamId               = 0;
    ginfo->IsRated                   = 0;
    ginfo->IsInvitedToBGInstanceGUID = 0;
    ginfo->JoinTime                  = getMSTime();
    ginfo->RemoveInviteTime          = 0;
    ginfo->Team                      = leader->GetTeam();
    ginfo->ArenaTeamRating           = 0;
    ginfo->ArenaMatchmakerRating     = 0;
    ginfo->OpponentsTeamRating       = 0;
    ginfo->OpponentsMatchmakerRating = 0;
    ginfo->Players.clear();

    PlayerQueueInfo* info = new PlayerQueueInfo;
    info->GroupInfo = ginfo;
    info->LastOnlineTime = getMSTime();

    Group::MemberSlotList hList = group->GetMemberSlots();
    for (Group::MemberSlotList::iterator itr = hList.begin(); itr != hList.end(); ++itr)
        ginfo->Players[(*itr).guid]  = info;

    return ginfo;
}
    static bool HandlePvpfinderJoinCommand(ChatHandler* handler, const char* args)
    {

        handler->PSendSysMessage("%s%s|r", "|cff00ff00", "PvPFinder in Developement");

        if (!handler->GetSession())
            return false;

        Player* player = handler->GetSession()->GetPlayer();

        Group* group = player->GetGroup();

        if (!group)
        {
            handler->PSendSysMessage("%s%s|r", "|cff0000ff", "Non sei in un gruppo!");
            return false;
        }
        
        if (group->GetLeaderGUID() != player->GetGUID())
        {
            handler->PSendSysMessage("%s%s|r", "|cff0000ff", "Solo il leader del gruppo può joinare il PvPFinder!");
            return false;
        }

        uint32 members = group->GetMembersCount();
        if (members != 5 && members != 10 && members != 25 && members != 40)
        {
            handler->PSendSysMessage("%s%s|r", "|cff0000ff", "Dovete formare un gruppo da 5, 10, 25 o 40 persone per poter joinare il PvPFinder!");
            return false;
        }

        const Group::MemberSlotList members_list = group->GetMemberSlots();
        for (Group::member_citerator itr = members_list.begin(); itr!= members_list.end(); ++itr)
        {
            Player* member = (Unit::GetPlayer(*player, itr->guid));
            if (!member)
                continue;
           
            if (member->InBattleground() || member->InBattlegroundQueue() || member->InArena())
            {
                handler->PSendSysMessage("%s%s|r", "|cff0000ff", "Un membro del gruppo ha coda per BG/Arena!");
                return false;
            }
        }


        return true;
    }                                                           // HandleWpAddCommand
Ejemplo n.º 5
0
    void CheckEventFail()
    {
        Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID);

        if (!pPlayer)
            return;

        if (Group *EventGroup = pPlayer->GetGroup())
        {
            Player* GroupMember;

            uint8 GroupMemberCount = 0;
            uint8 DeadMemberCount = 0;
            uint8 FailedMemberCount = 0;

            const Group::MemberSlotList members = EventGroup->GetMemberSlots();

            for (Group::member_citerator itr = members.begin(); itr!= members.end(); ++itr)
            {
                GroupMember = (Unit::GetPlayer(*me, itr->guid));

                if (!GroupMember)
                    continue;

                if (!GroupMember->IsWithinDistInMap(me, EVENT_AREA_RADIUS) && GroupMember->GetQuestStatus(QUEST_A_PAWN_ON_THE_ETERNAL_BOARD) == QUEST_STATUS_INCOMPLETE)
                {
                     GroupMember->FailQuest(QUEST_A_PAWN_ON_THE_ETERNAL_BOARD);
                     GroupMember->SetQuestStatus(QUEST_A_PAWN_ON_THE_ETERNAL_BOARD, QUEST_STATUS_NONE);
                     ++FailedMemberCount;
                }
                ++GroupMemberCount;

                if (GroupMember->isDead())
                    ++DeadMemberCount;
            }

            if (GroupMemberCount == FailedMemberCount || !pPlayer->IsWithinDistInMap(me, EVENT_AREA_RADIUS))
                Failed = true; //only so event can restart
        }
    }
Ejemplo n.º 6
0
        void SendMessageToGroup(Player* player, char *message)
        {
            if (!player)
                return;

            Group* group = player->GetGroup();

            if (!group)
                return;

            const Group::MemberSlotList members = group->GetMemberSlots();
            for (Group::member_citerator citr = members.begin(); citr != members.end(); ++citr)
            {
                Player* player = ObjectAccessor::FindPlayer(citr->guid);
                if (player && player->IsInWorld())
                {
                        std::string str = "|cFFFFFC00" + std::string(message); // make message yellow
                        WorldPacket data(SMSG_NOTIFICATION, (str.size()+1));
                        data << str;
                        player->GetSession()->SendPacket(&data);
                }
            }
        }