• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

[SOLVED] Disable trinket proc in arenas

Status
Not open for further replies.

Intouch

Respected Member
Hello ^^

I was trying to disable items for arenas and I disable one part of that via DB adding flag for item, and they are disabled (part of that)
Problem is trinkets which proc, like Deathbringer's Will trinket..... etc etc

How can I disable that proc too ?
Is possible to add check when player try to join arena with items +277 level and he get error message for example: "You can't join arena with +277 level items) ?
 

Tommy

Founder
Hello ^^

I was trying to disable items for arenas and I disable one part of that via DB adding flag for item, and they are disabled (part of that)
Problem is trinkets which proc, like Deathbringer's Will trinket..... etc etc

How can I disable that proc too ?
Is possible to add check when player try to join arena with items +277 level and he get error message for example: "You can't join arena with +277 level items) ?

You can check item levels up items and stop PvE players from joining, yes. Procs are spells if you didn't know, so, you could disable those specific spells in arenas. OR, if you can, lock the said items so players cannot use them. You could also have an aura check to see if they have the certain proc spell auras on them and remove it.
 

Intouch

Respected Member
Aham, well is possible to add some check inside some Arena C++ file ?
(Example: if player have item lvl +277 then don't allow player to join arena .... and send him error message on top of the screen)
 

Tommy

Founder
In BattleGroundHandler.cpp in "HandleBattlemasterJoinArena" function you can do that. You should at least look through the source and try it out yourself. I feel like I always help you, but you don't learn. >.>

I'm going to edit the entire function and make it work with what you're wanting. In LIME is my changes and how I would go upon doing this.

Code:
void WorldSession::HandleBattlemasterJoinArena(WorldPacket& recvData)
{
    TC_LOG_DEBUG("network", "WORLD: CMSG_BATTLEMASTER_JOIN_ARENA");

    uint64 guid;                                            // arena Battlemaster guid
    uint8 arenaslot;                                        // 2v2, 3v3 or 5v5
    uint8 asGroup;                                          // asGroup
    uint8 isRated;                                          // isRated
    Group* grp = NULL;

    recvData >> guid >> arenaslot >> asGroup >> isRated;

    // ignore if we already in BG or BG queue
    if (_player->InBattleground())
        return;

    Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
    if (!unit)
        return;

    if (!unit->IsBattleMaster())                             // it's not battle master
        return;

    uint8 arenatype = 0;
    uint32 arenaRating = 0;
    uint32 matchmakerRating = 0;

    switch (arenaslot)
    {
        case 0:
            arenatype = ARENA_TYPE_2v2;
            break;
        case 1:
            arenatype = ARENA_TYPE_3v3;
            break;
        case 2:
            arenatype = ARENA_TYPE_5v5;
            break;
        default:
            TC_LOG_ERROR("network", "Unknown arena slot %u at HandleBattlemasterJoinArena()", arenaslot);
            return;
    }

    //check existance
    Battleground* bg = sBattlegroundMgr->GetBattlegroundTemplate(BATTLEGROUND_AA);
    if (!bg)
    {
        TC_LOG_ERROR("network", "Battleground: template bg (all arenas) not found");
        return;
    }

    if (DisableMgr::IsDisabledFor(DISABLE_TYPE_BATTLEGROUND, BATTLEGROUND_AA, NULL))
    {
        ChatHandler(this).PSendSysMessage(LANG_ARENA_DISABLED);
        return;
    }

    BattlegroundTypeId bgTypeId = bg->GetTypeID();
    BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(bgTypeId, arenatype);
    PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bg->GetMapId(), _player->getLevel());
    if (!bracketEntry)
        return;

    GroupJoinBattlegroundResult err = ERR_GROUP_JOIN_BATTLEGROUND_FAIL;

    if (!asGroup)
    {
        // check if already in queue
        if (_player->GetBattlegroundQueueIndex(bgQueueTypeId) < PLAYER_MAX_BATTLEGROUND_QUEUES)
            //player is already in this queue
            return;
        // check if has free queue slots
        if (!_player->HasFreeBattlegroundQueueId())
            return;
    }
    else
    {
        grp = _player->GetGroup();
        // no group found, error
        if (!grp)
            return;
        if (grp->GetLeaderGUID() != _player->GetGUID())
            return;
        err = grp->CanJoinBattlegroundQueue(bg, bgQueueTypeId, arenatype, arenatype, isRated != 0, arenaslot);
    }

    uint32 ateamId = 0;

    if (isRated)
    {
        ateamId = _player->GetArenaTeamId(arenaslot);
        // check real arenateam existence only here (if it was moved to group->CanJoin .. () then we would ahve to get it twice)
        ArenaTeam* at = sArenaTeamMgr->GetArenaTeamById(ateamId);
        if (!at)
        {
            _player->GetSession()->SendNotInArenaTeamPacket(arenatype);
            return;
        }
        // get the team rating for queueing
        arenaRating = at->GetRating();
        matchmakerRating = at->GetAverageMMR(grp);
        // the arenateam id must match for everyone in the group

        if (arenaRating <= 0)
            arenaRating = 1;
    }

    BattlegroundQueue &bgQueue = sBattlegroundMgr->GetBattlegroundQueue(bgQueueTypeId);
    if (asGroup)
    {
        uint32 avgTime = 0;

        if (err > 0)
        {
            TC_LOG_DEBUG("bg.battleground", "Battleground: arena join as group start");
            if (isRated)
            {
                TC_LOG_DEBUG("bg.battleground", "Battleground: arena team id %u, leader %s queued with matchmaker rating %u for type %u", _player->GetArenaTeamId(arenaslot), _player->GetName().c_str(), matchmakerRating, arenatype);
                bg->SetRated(true);
            }
            else
                bg->SetRated(false);

            GroupQueueInfo* ginfo = bgQueue.AddGroup(_player, grp, bgTypeId, bracketEntry, arenatype, isRated != 0, false, arenaRating, matchmakerRating, ateamId);
            avgTime = bgQueue.GetAverageQueueWaitTime(ginfo, bracketEntry->GetBracketId());
        }

[COLOR="#00FF00"]
        uint8 slots[] = { SLOT_CHEST, SLOT_HANDS, SLOT_HEAD, SLOT_BACK, SLOT_FEET, SLOT_SHOULDERS, SLOT_MAIN_HAND, SLOT_OFF_HAND, SLOT_TRINKET1, SLOT_TRINKET2, SLOT_FINGER1, SLOT_FINGER2,
        SLOT_WAIST, SLOT_WRISTS, SLOT_LEGS, SLOT_RANGED };[/COLOR]
        for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
        {
            Player* member = itr->GetSource();
            if (!member)
                continue;

[COLOR="#00FF00"]            for (int i = 0; i < sizeof(uint8) / sizeof(slots); ++i)
            {
                Item* item = member->GetItemByPos(INVENTORY_SLOT_BAG_0, slots[i]);
                if (item)
                {
                    if (item->GetTemplate()->ItemLevel >= 277)
                    {
                        _player->GetSession()->SendNotification("%s cannot join the queue because they have an item with an item level >= 277", member->GetName().c_str());
                        member->GetSession()->SendNotification("You cannot join the queue because you have an item with an item level >= 277.");
			return;
                    }
                }
            }[/COLOR]

            WorldPacket data;

            if (err <= 0)
            {
                sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, err);
                member->GetSession()->SendPacket(&data);
                continue;
            }

            // add to queue
            uint32 queueSlot = member->AddBattlegroundQueueId(bgQueueTypeId);

            // send status packet (in queue)
            sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, arenatype, 0);
            member->GetSession()->SendPacket(&data);
            sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, err);
            member->GetSession()->SendPacket(&data);
            TC_LOG_DEBUG("bg.battleground", "Battleground: player joined queue for arena as group bg queue type %u bg type %u: GUID %u, NAME %s", bgQueueTypeId, bgTypeId, member->GetGUIDLow(), member->GetName().c_str());
        }
    }
    else
    {
        GroupQueueInfo* ginfo = bgQueue.AddGroup(_player, NULL, bgTypeId, bracketEntry, arenatype, isRated != 0, false, arenaRating, matchmakerRating, ateamId);
        uint32 avgTime = bgQueue.GetAverageQueueWaitTime(ginfo, bracketEntry->GetBracketId());
        uint32 queueSlot = _player->AddBattlegroundQueueId(bgQueueTypeId);

        WorldPacket data;
        // send status packet (in queue)
        sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, arenatype, 0);
        SendPacket(&data);
        TC_LOG_DEBUG("bg.battleground", "Battleground: player joined queue for arena, skirmish, bg queue type %u bg type %u: GUID %u, NAME %s", bgQueueTypeId, bgTypeId, _player->GetGUIDLow(), _player->GetName().c_str());
    }
    sBattlegroundMgr->ScheduleQueueUpdate(matchmakerRating, arenatype, bgQueueTypeId, bgTypeId, bracketEntry->GetBracketId());
}
 

Intouch

Respected Member
Yea I know that am annoying with this... But only problem is because I can't find function for "item level" ... I was trying to find but can't... I learn to find place where to put code just idk some functions like that....
 

Intouch

Respected Member
Aham, well is possible to add some check inside some Arena C++ file ?
(Example: if player have item lvl +277 then don't allow player to join arena .... and send him error message on top of the screen)

Like I said in this message... I can but sometimes ppl will forget to remove items and they will have "unuseful items". So that is why I want that check for items!
 

Intouch

Respected Member
Yeahh, so I was trying to find place and function and maybe is ArenaTeam.cpp file good location for code just idk function "check" for item lvl.
 
Status
Not open for further replies.
Top