feat(editor): preset selection auto-fills sensible AzerothCore faction

When a user picks a creature preset, faction stays 0 (server treats this
as 'use template') unless the user already typed a value. Now defaults
based on the preset category:
  Critter        -> 250 (critter, indifferent to all)
  hostile preset -> 14  (monster, hostile to all)
  friendly preset -> 35  (friendly to all)
Means picking 'Wolf' from the preset list immediately produces a hostile
NPC that actually attacks players in-game without further configuration.
This commit is contained in:
Kelsi 2026-05-06 04:48:30 -07:00
parent 70366dc5f6
commit 00717543a8

View file

@ -1853,6 +1853,13 @@ void EditorUI::renderNpcPanel(EditorApp& app) {
tmpl.minDamage = 3 + p.defaultLevel * 2;
tmpl.maxDamage = 5 + p.defaultLevel * 3;
tmpl.armor = p.defaultLevel * 10;
// Sensible AzerothCore FactionTemplate default — only set
// if the user hasn't already typed in a custom value.
if (tmpl.faction == 0) {
if (p.category == CreatureCategory::Critter) tmpl.faction = 250;
else if (p.defaultHostile) tmpl.faction = 14; // Monster
else tmpl.faction = 35; // Friendly
}
}
if (ImGui::IsItemHovered())
ImGui::SetTooltip("%s", p.modelPath.c_str());