MCPcopy Create free account
hub / github.com/diasurgical/DevilutionX / IsUniqueMonsterItemValid

Function IsUniqueMonsterItemValid

Source/items/validation.cpp:78–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76}
77
78bool IsUniqueMonsterItemValid(uint16_t iCreateInfo, uint32_t dwBuff)
79{
80 const uint8_t level = iCreateInfo & CF_LEVEL;
81 const bool isHellfireItem = (dwBuff & CF_HELLFIRE) != 0;
82
83 // Check all unique monster levels to see if they match the item level
84 for (int i = 0; UniqueMonstersData[i].mName != nullptr; i++) {
85 const auto &uniqueMonsterData = UniqueMonstersData[i];
86 const auto &uniqueMonsterLevel = static_cast<uint8_t>(MonstersData[uniqueMonsterData.mtype].level);
87
88 if (IsAnyOf(uniqueMonsterData.mtype, MT_DEFILER, MT_NAKRUL, MT_HORKDMN)) {
89 // These monsters don't use their mlvl for item generation
90 continue;
91 }
92
93 if (level == uniqueMonsterLevel) {
94 // If the ilvl matches the mlvl, we confirm the item is legitimate
95 return true;
96 }
97 }
98
99 return false;
100}
101
102bool IsDungeonItemValid(uint16_t iCreateInfo, uint32_t dwBuff)
103{

Callers 3

IsPItemValidFunction · 0.85
UnPackNetItemFunction · 0.85
IsItemValidFunction · 0.85

Calls 1

IsAnyOfFunction · 0.85

Tested by

no test coverage detected