DB/Creatures: Port master model system

Fixes incorrect displayid for creatures, due to probability
This commit is contained in:
funjoker committed 2023-09-15 23:52:51 +02:00
1 parent eb5cbdf948
commit df32b341a5
43 files changed
+65170 -262

No files matched your search

+1 -2
View File
@@ -995,8 +995,7 @@ public:
return false;
}
creature->SetDisplayId(displayId);
creature->SetNativeDisplayId(displayId);
creature->SetDisplayId(displayId, true);
creature->SaveToDB();
@@ -208,7 +208,7 @@ struct npc_romogg_chains_of_woe : public NullCreatureAI
void IsSummonedBy(Unit* /*summoner*/) override
{
me->SetDisplayId(me->GetCreatureTemplate()->Modelid2);
me->SetDisplayFromModel(1);
DoCastSelf(SPELL_CHAINS_OF_WOE_TELEPORT);
DoCastSelf(SPELL_CHAINS_OF_WOE_CHANNELED);
}
@@ -315,7 +315,7 @@ struct boss_magmaw : public BossAI
{
case NPC_PILLAR_OF_FLAME:
summon->CastSpell(summon, SPELL_PILLAR_OF_FLAME_DUMMY);
summon->SetDisplayId(summon->GetCreatureTemplate()->Modelid1);
summon->SetDisplayFromModel(0);
summon->DespawnOrUnsummon(7s);
Talk(SAY_ANNOUNCE_LAVA_PARASITES);
summons.Summon(summon);
@@ -533,7 +533,7 @@ private:
if (pincer1)
{
pincer1->EnterVehicle(me, SEAT_MAGMAWS_PINCER_1);
pincer1->SetDisplayId(pincer1->GetCreatureTemplate()->Modelid3);
pincer1->SetDisplayFromModel(2);
_bodyPartGUIDs[BODY_PART_PINCER_1] = pincer1->GetGUID();
}
@@ -541,7 +541,7 @@ private:
if (pincer2)
{
pincer2->EnterVehicle(me, SEAT_MAGMAWS_PINCER_2);
pincer2->SetDisplayId(pincer2->GetCreatureTemplate()->Modelid3);
pincer2->SetDisplayFromModel(2);
_bodyPartGUIDs[BODY_PART_PINCER_2] = pincer2->GetGUID();
}
@@ -198,7 +198,7 @@ class npc_pure_energy : public CreatureScript
{
npc_pure_energyAI(Creature* creature) : ScriptedAI(creature)
{
me->SetDisplayId(me->GetCreatureTemplate()->Modelid2);
me->SetDisplayFromModel(1);
}
void JustDied(Unit* killer) override
@@ -382,7 +382,7 @@ struct npc_eye_of_acherus : public ScriptedAI
{
npc_eye_of_acherus(Creature* creature) : ScriptedAI(creature)
{
creature->SetDisplayId(creature->GetCreatureTemplate()->Modelid1);
creature->SetDisplayFromModel(0);
creature->SetReactState(REACT_PASSIVE);
}
@@ -157,7 +157,7 @@ public:
switch (creature->GetEntry())
{
case NPC_FORSAKEN_BLIGHTSPREADER:
creature->SetDisplayId(creature->GetCreatureTemplate()->Modelid1);
creature->SetDisplayFromModel(0);
break;
case NPC_HIGH_WARLORD_CROMUSH:
if (creature->ToTempSummon())
@@ -402,7 +402,7 @@ public:
void Initialize()
{
me->SetDisplayId(me->GetCreatureTemplate()->Modelid2);
me->SetDisplayFromModel(1);
me->SetReactState(REACT_PASSIVE);
DoCast(me, SPELL_DARKFIEND_SKIN, true);
@@ -740,7 +740,7 @@ struct npc_brazie_fertilitize_o_tron_2000 : public ScriptedAI
void IsSummonedBy(Unit* summoner) override
{
me->SetDisplayId(me->GetCreatureTemplate()->Modelid2);
me->SetDisplayFromModel(1);
if (Creature* vehicle = summoner->GetVehicleCreatureBase())
if (vehicle->IsAIEnabled())
@@ -828,7 +828,7 @@ struct npc_brazie_spot : public ScriptedAI
me->SetFullHealth();
me->UpdateEntry(NPC_EMPTY_SPOT);
_currentEntry = NPC_EMPTY_SPOT;
me->SetDisplayId(me->GetCreatureTemplate()->Modelid1);
me->SetDisplayFromModel(0);
me->AttackStop();
me->SetFacingTo(me->GetHomePosition().GetOrientation());
_events.Reset();
@@ -840,7 +840,7 @@ struct npc_brazie_spot : public ScriptedAI
me->m_SightDistance = 150.0f;
me->m_CombatDistance = 150.0f;
me->SetDisplayId(me->GetCreatureTemplate()->Modelid1);
me->SetDisplayFromModel(0);
if (Creature* vehicle = summoner->GetVehicleCreatureBase())
if (vehicle->IsAIEnabled())
@@ -899,7 +899,7 @@ struct npc_brazie_spot : public ScriptedAI
}
if (spell->Id != SPELL_PLAGUE_GAS)
me->SetDisplayId(me->GetCreatureTemplate()->Modelid2);
me->SetDisplayFromModel(1);
}
void UpdateAI(uint32 diff) override
@@ -969,7 +969,7 @@ struct npc_brazie_zombie : public ScriptedAI
DoCastSelf(SPELL_ZOMBIE_GROWL);
else if (me->GetEntry() == NPC_GHOUL)
{
me->SetDisplayId(me->GetCreatureTemplate()->Modelid4);
me->SetDisplayFromModel(3);
DoCastSelf(SPELL_GHOUL_GROWL, true);
DoCastSelf(SPELL_BUCKET_HEAD, true);
}
@@ -1125,15 +1125,15 @@ struct npc_brazie_vehicle_notifier : public ScriptedAI
{
case NPC_SOLAR_POWER:
case NPC_FREEZYA_SEEDS:
me->SetDisplayId(me->GetCreatureTemplate()->Modelid2);
me->SetDisplayFromModel(1);
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
break;
case NPC_PLACE_IT_HERE:
me->Relocate(EmptySpotPositions[0]);
me->SetDisplayId(me->GetCreatureTemplate()->Modelid2);
me->SetDisplayFromModel(1);
break;
default:
me->SetDisplayId(me->GetCreatureTemplate()->Modelid1);
me->SetDisplayFromModel(0);
break;
}
@@ -324,7 +324,6 @@ public:
{
_events.Reset();
_events.ScheduleEvent(EVENT_DETERMINE_EVENT, Seconds(2));
me->SetDisplayId(me->GetCreatureTemplate()->GetRandomValidModelId());
}
void UpdateAI(uint32 diff) override
@@ -346,7 +346,7 @@ class npc_shard_of_torment : public CreatureScript
me->SetReactState(REACT_PASSIVE);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_REMOVE_CLIENT_CONTROL | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE);
me->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_DISABLE_TURN);
me->SetDisplayId(me->GetCreatureTemplate()->Modelid2);
me->SetDisplayFromModel(1);
_instance = creature->GetInstanceScript();
}
@@ -225,7 +225,7 @@ struct boss_lord_rhyolith : public BossAI
{
if (Creature* foot = DoSummon(entry, me->GetPosition(), 0, TEMPSUMMON_MANUAL_DESPAWN))
{
foot->SetDisplayId(foot->GetCreatureTemplate()->Modelid2);
foot->SetDisplayFromModel(1);
foot->CastSpell(me, SPELL_RIDE_VEHICLE, CastSpellExtraArgs().AddSpellBP0(seatId));
foot->CastSpell(foot, SPELL_START_FIGHT);
foot->CastSpell(foot, SPELL_FOOT_DAMAGE_TRACKER);
@@ -323,7 +323,7 @@ struct boss_lord_rhyolith : public BossAI
break;
case NPC_VOLCANO:
summon->CastSpell(nullptr, SPELL_VOLCANO_BASE);
summon->SetDisplayId(summon->GetCreatureTemplate()->Modelid2);
summon->SetDisplayFromModel(1);
summons.Summon(summon);
break;
case NPC_PILLAR:
@@ -906,7 +906,7 @@ struct npc_rhyolith_volcano : public NullCreatureAI
case ACTION_ACTIVATE_VOLCANO:
me->UpdateEntry(NPC_VOLCANO_HEATED, nullptr, false);
if (CreatureTemplate const* transformTemplate = sObjectMgr->GetCreatureTemplate(NPC_VOLCANO_HEATED))
me->SetDisplayId(transformTemplate->Modelid2);
me->SetDisplayFromModel(1);
_events.ScheduleEvent(EVENT_ERUPTION, 5s);
break;
case ACTION_SCHEDULE_MAGMA_FLOW:
@@ -921,7 +921,7 @@ struct npc_rhyolith_volcano : public NullCreatureAI
me->UpdateEntry(NPC_VOLCANO_CRATER, nullptr, false);
if (CreatureTemplate const* transformTemplate = sObjectMgr->GetCreatureTemplate(NPC_VOLCANO_CRATER))
me->SetDisplayId(transformTemplate->Modelid2);
me->SetDisplayFromModel(1);
break;
default:
break;
@@ -701,7 +701,7 @@ struct npc_hoo_whirling_winds : public ScriptedAI
void InitializeAI() override
{
me->SetReactState(REACT_AGGRESSIVE);
me->SetDisplayId(me->GetCreatureTemplate()->Modelid1);
me->SetDisplayFromModel(0);
}
void AttackStart(Unit* who) override
@@ -256,7 +256,7 @@ struct npc_husam_tolvir_land_mine : public NullCreatureAI
{
npc_husam_tolvir_land_mine(Creature* creature) : NullCreatureAI(creature)
{
me->SetDisplayId(me->GetCreatureTemplate()->Modelid2);
me->SetDisplayFromModel(1);
}
void JustAppeared() override
@@ -194,7 +194,7 @@ struct boss_siamat : public BossAI
break;
case NPC_CLOUD_BURST:
summons.Summon(summon);
summon->SetDisplayId(summon->GetCreatureTemplate()->Modelid2);
summon->SetDisplayFromModel(1);
break;
case NPC_MINION_OF_SIAMAT_STORM:
summons.Summon(summon);
@@ -129,7 +129,7 @@ class instance_vortex_pinnacle : public InstanceMapScript
switch (creature->GetEntry())
{
case NPC_HOWLING_GALE:
creature->SetDisplayId(creature->GetCreatureTemplate()->Modelid2);
creature->SetDisplayFromModel(1);
break;
case NPC_AIR_CURRENT:
_airCurrentGUIDs.push_back(creature->GetGUID());
@@ -163,7 +163,7 @@ class instance_vortex_pinnacle : public InstanceMapScript
}
break;
case NPC_GOLDEN_ORB:
creature->SetDisplayId(creature->GetCreatureTemplate()->Modelid2);
creature->SetDisplayFromModel(1);
break;
default:
break;
@@ -250,7 +250,7 @@ public:
void Reset() override
{
_events.Reset();
me->SetDisplayId(me->GetCreatureTemplate()->Modelid2);
me->SetDisplayFromModel(1);
}
void JustEngagedWith(Unit* /*who*/) override
@@ -566,7 +566,7 @@ private:
if (Creature* warden = DoSummon(NPC_GROVE_WARDEN, GroveWardenSummonPositions[spawnIndex], 20000))
{
warden->DespawnOrUnsummon(3min);
warden->SetDisplayId(warden->GetCreatureTemplate()->Modelid1);
warden->SetDisplayFromModel(0);
Position waypointPos = GroveWardenWaypointPosition1;
Position homePos = me->GetHomePosition();
if (me->GetExactDist2d(GroveWardenWaypointPosition1) < me->GetExactDist2d(GroveWardenWaypointPosition2))
@@ -177,7 +177,7 @@ public:
events.Reset();
events.ScheduleEvent(EVENT_AURA, 1 * IN_MILLISECONDS);
me->SetDisplayId(me->GetCreatureTemplate()->Modelid2);
me->SetDisplayFromModel(1);
DoCast(SPELL_PUTRID_MUSHROOM);
if (me->GetEntry() == NPC_POISONOUS_MUSHROOM)
@@ -254,10 +254,10 @@ class boss_anubarak_trial : public CreatureScript
_burrowGUID.push_back(summoned->GetGUID());
summoned->SetReactState(REACT_PASSIVE);
summoned->CastSpell(summoned, SPELL_CHURNING_GROUND, false);
summoned->SetDisplayId(summoned->GetCreatureTemplate()->Modelid2);
summoned->SetDisplayFromModel(1);
break;
case NPC_SPIKE:
summoned->SetDisplayId(summoned->GetCreatureTemplate()->Modelid1);
summoned->SetDisplayFromModel(0);
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true))
{
summoned->EngageWithTarget(target);
@@ -621,7 +621,7 @@ class npc_frost_sphere : public CreatureScript
{
me->SetReactState(REACT_PASSIVE);
DoCast(SPELL_FROST_SPHERE);
me->SetDisplayId(me->GetCreatureTemplate()->Modelid2);
me->SetDisplayFromModel(1);
me->GetMotionMaster()->MoveRandom(20.0f);
}
@@ -489,7 +489,7 @@ class npc_firebomb : public CreatureScript
DoCast(me, SPELL_FIRE_BOMB_DOT, true);
SetCombatMovement(false);
me->SetReactState(REACT_PASSIVE);
me->SetDisplayId(me->GetCreatureTemplate()->Modelid2);
me->SetDisplayFromModel(1);
}
void UpdateAI(uint32 /*diff*/) override
@@ -314,7 +314,7 @@ class boss_lich_king_toc : public CreatureScript
if (Creature* summoned = me->SummonCreature(NPC_TRIGGER, ToCCommonLoc[2].GetPositionX(), ToCCommonLoc[2].GetPositionY(), ToCCommonLoc[2].GetPositionZ(), 5, TEMPSUMMON_TIMED_DESPAWN, 1*MINUTE*IN_MILLISECONDS))
{
summoned->CastSpell(summoned, 51807, false);
summoned->SetDisplayId(summoned->GetCreatureTemplate()->Modelid2);
summoned->SetDisplayFromModel(1);
}
_instance->SetBossState(BOSS_LICH_KING, IN_PROGRESS);
@@ -510,7 +510,7 @@ class npc_fizzlebang_toc : public CreatureScript
{
_triggerGUID = pTrigger->GetGUID();
pTrigger->SetObjectScale(2.0f);
pTrigger->SetDisplayId(pTrigger->ToCreature()->GetCreatureTemplate()->Modelid1);
pTrigger->ToCreature()->SetDisplayFromModel(0);
pTrigger->CastSpell(pTrigger, SPELL_WILFRED_PORTAL, false);
}
_instance->SetData(TYPE_EVENT, 1132);
@@ -2585,7 +2585,7 @@ class npc_quel_delar_sword : public CreatureScript
npc_quel_delar_swordAI(Creature* creature) : ScriptedAI(creature)
{
_instance = me->GetInstanceScript();
me->SetDisplayId(me->GetCreatureTemplate()->Modelid2);
me->SetDisplayFromModel(1);
_intro = true;
}
@@ -270,7 +270,7 @@ class npc_pit_of_saron_icicle : public CreatureScript
{
npc_pit_of_saron_icicleAI(Creature* creature) : PassiveAI(creature)
{
me->SetDisplayId(me->GetCreatureTemplate()->Modelid1);
me->SetDisplayFromModel(0);
}
void IsSummonedBy(Unit* summoner) override
@@ -223,7 +223,7 @@ class npc_chaotic_rift : public CreatureScript
void Reset() override
{
Initialize();
me->SetDisplayId(me->GetCreatureTemplate()->Modelid2);
me->SetDisplayFromModel(1);
DoCast(me, SPELL_ARCANEFORM, false);
}
@@ -614,7 +614,7 @@ class boss_flame_leviathan_seat : public CreatureScript
boss_flame_leviathan_seatAI(Creature* creature) : ScriptedAI(creature)
{
me->SetReactState(REACT_PASSIVE);
me->SetDisplayId(me->GetCreatureTemplate()->Modelid2);
me->SetDisplayFromModel(1);
instance = creature->GetInstanceScript();
}
@@ -186,7 +186,7 @@ class npc_flash_freeze : public CreatureScript
{
Initialize();
instance = me->GetInstanceScript();
me->SetDisplayId(me->GetCreatureTemplate()->Modelid2);
me->SetDisplayFromModel(1);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED | UNIT_FLAG_PACIFIED);
me->SetControlled(true, UNIT_STATE_ROOT);
}
@@ -262,7 +262,7 @@ class npc_ice_block : public CreatureScript
npc_ice_blockAI(Creature* creature) : ScriptedAI(creature)
{
instance = me->GetInstanceScript();
me->SetDisplayId(me->GetCreatureTemplate()->Modelid2);
me->SetDisplayFromModel(1);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED | UNIT_FLAG_PACIFIED);
me->SetControlled(true, UNIT_STATE_ROOT);
}
@@ -554,7 +554,7 @@ class npc_icicle : public CreatureScript
npc_icicleAI(Creature* creature) : ScriptedAI(creature)
{
Initialize();
me->SetDisplayId(me->GetCreatureTemplate()->Modelid1);
me->SetDisplayFromModel(0);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_PACIFIED | UNIT_FLAG_NOT_SELECTABLE);
me->SetControlled(true, UNIT_STATE_ROOT);
me->SetReactState(REACT_PASSIVE);
@@ -609,7 +609,7 @@ class npc_snowpacked_icicle : public CreatureScript
npc_snowpacked_icicleAI(Creature* creature) : ScriptedAI(creature)
{
Initialize();
me->SetDisplayId(me->GetCreatureTemplate()->Modelid2);
me->SetDisplayFromModel(1);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_PACIFIED);
me->SetControlled(true, UNIT_STATE_ROOT);
me->SetReactState(REACT_PASSIVE);
@@ -951,7 +951,7 @@ class npc_toasty_fire : public CreatureScript
{
npc_toasty_fireAI(Creature* creature) : ScriptedAI(creature)
{
me->SetDisplayId(me->GetCreatureTemplate()->Modelid2);
me->SetDisplayFromModel(1);
}
void Reset() override
@@ -197,7 +197,7 @@ class boss_razorscale_controller : public CreatureScript
boss_razorscale_controllerAI(Creature* creature) : ScriptedAI(creature), summons(me)
{
instance = creature->GetInstanceScript();
me->SetDisplayId(me->GetCreatureTemplate()->Modelid2);
me->SetDisplayFromModel(1);
}
InstanceScript* instance;
+1 -1
View File
@@ -309,7 +309,7 @@ struct npc_pet_dk_rune_weapon : public AggressorAI
if (!summoner)
return;
me->SetDisplayId(me->GetCreatureTemplate()->Modelid2);
me->SetDisplayFromModel(1);
for (uint32 spellId : { SPELL_COPY_WEAPON_1, SPELL_COPY_WEAPON_2 })
DoCast(summoner, spellId, true);
+2 -2
View File
@@ -2894,8 +2894,8 @@ public:
init.SetFacing(o);
who->GetMotionMaster()->LaunchMoveSpline(std::move(init), EVENT_VEHICLE_BOARD, MOTION_SLOT_CONTROLLED);
who->m_Events.AddEvent(new CastFoodSpell(who, _chairSpells.at(who->GetEntry())), who->m_Events.CalculateTime(1000));
if (who->GetTypeId() == TYPEID_UNIT)
who->SetDisplayId(who->ToCreature()->GetCreatureTemplate()->Modelid1);
if (Creature* creature = who->ToCreature())
creature->SetDisplayFromModel(0);
}
};