mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-22 21:26:23 +00:00
feat(Core/Disables): Implement DISABLE_TYPE_LOOT (#15136)
This commit is contained in:
@@ -44,7 +44,7 @@ namespace DisableMgr
|
||||
|
||||
DisableMap m_DisableMap;
|
||||
|
||||
uint8 MAX_DISABLE_TYPES = 10;
|
||||
uint8 MAX_DISABLE_TYPES = 11;
|
||||
}
|
||||
|
||||
void LoadDisables()
|
||||
@@ -258,6 +258,8 @@ namespace DisableMgr
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DISABLE_TYPE_LOOT:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -303,7 +305,12 @@ namespace DisableMgr
|
||||
|
||||
bool IsDisabledFor(DisableType type, uint32 entry, Unit const* unit, uint8 flags)
|
||||
{
|
||||
ASSERT(type < MAX_DISABLE_TYPES);
|
||||
if (type > MAX_DISABLE_TYPES)
|
||||
{
|
||||
LOG_ERROR("server", "Disables::IsDisabledFor() called with unknown disable type {}! (entry {}, flags {}).", type, entry, flags);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_DisableMap[type].empty())
|
||||
return false;
|
||||
|
||||
@@ -389,6 +396,8 @@ namespace DisableMgr
|
||||
return true;
|
||||
case DISABLE_TYPE_GAME_EVENT:
|
||||
return true;
|
||||
case DISABLE_TYPE_LOOT:
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -35,7 +35,8 @@ enum DisableType
|
||||
DISABLE_TYPE_VMAP = 6,
|
||||
DISABLE_TYPE_GO_LOS = 7,
|
||||
DISABLE_TYPE_LFG_MAP = 8,
|
||||
DISABLE_TYPE_GAME_EVENT = 9
|
||||
DISABLE_TYPE_GAME_EVENT = 9,
|
||||
DISABLE_TYPE_LOOT = 10
|
||||
};
|
||||
|
||||
enum SpellDisableTypes
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#include "LootMgr.h"
|
||||
#include "Containers.h"
|
||||
#include "DisableMgr.h"
|
||||
#include "Group.h"
|
||||
#include "Log.h"
|
||||
#include "ObjectMgr.h"
|
||||
@@ -413,6 +414,11 @@ bool LootItem::AllowedForPlayer(Player const* player, ObjectGuid source) const
|
||||
return false;
|
||||
}
|
||||
|
||||
if (DisableMgr::IsDisabledFor(DISABLE_TYPE_LOOT, itemid, nullptr))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isMasterLooter = player->GetGroup() && player->GetGroup()->GetMasterLooterGuid() == player->GetGUID();
|
||||
bool itemVisibleForMasterLooter = !needs_quest && (!follow_loot_rules || !is_underthreshold);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user