Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions sql/migrations/20250418172108_world.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
DROP PROCEDURE IF EXISTS add_migration;
DELIMITER ??
CREATE PROCEDURE `add_migration`()
BEGIN
DECLARE v INT DEFAULT 1;
SET v = (SELECT COUNT(*) FROM `migrations` WHERE `id`='20250418172108');
IF v = 0 THEN
INSERT INTO `migrations` VALUES ('20250418172108');
-- Add your query below.

-- Correct levelrange for Morbent Fel Pre 1.6

UPDATE `creature_template` SET `level_max`=35 WHERE `entry`=1200 AND `patch`=0;

-- End of migration.
END IF;
END??
DELIMITER ;
CALL add_migration();
DROP PROCEDURE IF EXISTS add_migration;
8 changes: 8 additions & 0 deletions src/game/ObjectMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1620,6 +1620,14 @@ void ObjectMgr::CheckCreatureTemplate(CreatureInfo* cInfo)
sLog.Out(LOG_DBERROR, LOG_LVL_MINIMAL, "Creature (Entry: %u) with despawn instantly flag has skinning loot assigned. It will never be lootable.", cInfo->entry);
}

if (cInfo->level_min > cInfo->level_max)
{
uint32 tmp = cInfo->level_min;
cInfo->level_min = cInfo->level_max;
cInfo->level_max = tmp;
sLog.Out(LOG_DBERROR, LOG_LVL_MINIMAL, "Creature (Entry: %u) has level_min (%u) greater than level_max (%u), values have been swapped.", cInfo->entry, cInfo->level_max, cInfo->level_min);
}

ConvertCreatureAurasField<CreatureInfo>(cInfo, "creature_template", "Entry", cInfo->entry);
}

Expand Down
4 changes: 2 additions & 2 deletions src/game/Objects/Creature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1703,8 +1703,8 @@ void Creature::SelectLevel(float percentHealth, float percentMana)
CreatureInfo const* cinfo = GetCreatureInfo();

// level
uint32 const minLevel = std::min(cinfo->level_max, cinfo->level_min);
uint32 const maxLevel = std::max(cinfo->level_max, cinfo->level_min);
uint32 const minLevel = cinfo->level_min;
uint32 const maxLevel = cinfo->level_max;
uint32 const level = minLevel == maxLevel ? minLevel : urand(minLevel, maxLevel);

SetLevel(level);
Expand Down