Core/Globals: validate creature_template mingold and maxgold fields

This commit is contained in:
ariel-
2017-12-19 19:59:36 -03:00
parent 9199e8f106
commit 5798fda0a0
2 changed files with 8 additions and 1 deletions

View File

@@ -1720,7 +1720,7 @@ void GameEventMgr::SetHolidayEventTime(GameEventData& event)
if (!event.holidayStage) // Ignore holiday
return;
const HolidaysEntry* holiday = sHolidaysStore.LookupEntry(event.holiday_id);
HolidaysEntry const* holiday = sHolidaysStore.LookupEntry(event.holiday_id);
if (!holiday->Date[0] || !holiday->Duration[0]) // Invalid definitions
{

View File

@@ -809,6 +809,13 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
ok = true;
}
if (cInfo->mingold > cInfo->maxgold)
{
TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has `mingold` %u which is greater than `maxgold` %u, setting `maxgold` to %u.",
cInfo->Entry, cInfo->mingold, cInfo->maxgold, cInfo->mingold);
const_cast<CreatureTemplate*>(cInfo)->maxgold = cInfo->mingold;
}
if (cInfo->AIName == "TotemAI")
{
TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has not-allowed `AIName` '%s' set, removing", cInfo->Entry, cInfo->AIName.c_str());