From dae6804e2784788c6a6913cb1a2bf8dabf8bad05 Mon Sep 17 00:00:00 2001 From: leelf00 Date: Wed, 7 Aug 2024 23:24:55 +0800 Subject: [PATCH 1/3] Add SQL --- sql/updates/world/2024_08_XX_XX_world.sql | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 sql/updates/world/2024_08_XX_XX_world.sql diff --git a/sql/updates/world/2024_08_XX_XX_world.sql b/sql/updates/world/2024_08_XX_XX_world.sql new file mode 100644 index 00000000..956d5244 --- /dev/null +++ b/sql/updates/world/2024_08_XX_XX_world.sql @@ -0,0 +1,24 @@ +-- +DROP TABLE IF EXISTS `creature_template_model`; +CREATE TABLE `creature_template_model`( + `CreatureID` int(10) unsigned NOT NULL, + `Idx` int(10) unsigned NOT NULL DEFAULT '0', + `CreatureDisplayID` int(10) unsigned NOT NULL, + `DisplayScale` float NOT NULL DEFAULT '1', + `Probability` float NOT NULL DEFAULT '0', + `VerifiedBuild` int NOT NULL DEFAULT 0, + PRIMARY KEY (`CreatureID`,`CreatureDisplayID`) +) ENGINE=InnoDB CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +INSERT IGNORE INTO `creature_template_model` (`CreatureID`,`Idx`,`CreatureDisplayID`,`DisplayScale`,`Probability`,`VerifiedBuild`) SELECT `entry`,0,`modelid1`,`scale`,1,`VerifiedBuild` FROM `creature_template` WHERE `modelid1`!=0; +INSERT IGNORE INTO `creature_template_model` (`CreatureID`,`Idx`,`CreatureDisplayID`,`DisplayScale`,`Probability`,`VerifiedBuild`) SELECT `entry`,1,`modelid2`,`scale`,1,`VerifiedBuild` FROM `creature_template` WHERE `modelid2`!=0; +INSERT IGNORE INTO `creature_template_model` (`CreatureID`,`Idx`,`CreatureDisplayID`,`DisplayScale`,`Probability`,`VerifiedBuild`) SELECT `entry`,2,`modelid3`,`scale`,1,`VerifiedBuild` FROM `creature_template` WHERE `modelid3`!=0; +INSERT IGNORE INTO `creature_template_model` (`CreatureID`,`Idx`,`CreatureDisplayID`,`DisplayScale`,`Probability`,`VerifiedBuild`) SELECT `entry`,3,`modelid4`,`scale`,1,`VerifiedBuild` FROM `creature_template` WHERE `modelid4`!=0; + +UPDATE `creature_template` SET `scale`=1; + +ALTER TABLE `creature_template` + DROP `modelid1`, + DROP `modelid2`, + DROP `modelid3`, + DROP `modelid4`; \ No newline at end of file From 1130285f0a4ab42a35dda0b6dffbe080f0fc5eb3 Mon Sep 17 00:00:00 2001 From: lee Date: Sun, 11 Aug 2024 21:45:42 +0800 Subject: [PATCH 2/3] Split models to creature_template_model --- .../Database/Implementation/WorldDatabase.cpp | 2 +- .../game/AI/SmartScripts/SmartScript.cpp | 10 +- src/server/game/BattlePet/BattlePet.cpp | 4 +- src/server/game/BattlePet/BattlePetMgr.cpp | 6 +- src/server/game/DataStores/DBCStores.h | 2 +- src/server/game/DataStores/DBCStructure.h | 4 +- src/server/game/DataStores/DBCfmt.h | 6 +- .../game/Entities/Creature/Creature.cpp | 124 ++++-- src/server/game/Entities/Creature/Creature.h | 11 +- .../game/Entities/Creature/CreatureData.h | 38 +- src/server/game/Entities/Pet/Pet.cpp | 4 +- src/server/game/Entities/Pet/Pet.h | 2 +- src/server/game/Entities/Unit/Unit.cpp | 17 +- src/server/game/Entities/Unit/Unit.h | 14 +- src/server/game/Globals/ObjectMgr.cpp | 391 +++++++++--------- src/server/game/Globals/ObjectMgr.h | 10 +- src/server/game/Handlers/NPCHandler.cpp | 13 +- src/server/game/Handlers/QueryHandler.cpp | 23 +- .../game/Spells/Auras/SpellAuraEffects.cpp | 25 +- src/server/scripts/Commands/cs_npc.cpp | 2 +- src/server/scripts/Commands/cs_reload.cpp | 80 +--- .../MagistersTerrace/boss_vexallus.cpp | 4 +- .../ScarletEnclave/chapter1.cpp | 6 +- .../ScarletHalls/scarlet_halls.cpp | 4 +- .../HourofTwilight/hour_of_twilight.cpp | 4 +- .../AzjolNerub/Ahnkahet/boss_amanitar.cpp | 2 +- .../Ahnkahet/boss_prince_taldaram.cpp | 4 +- .../boss_anubarak_trial.cpp | 8 +- .../boss_northrend_beasts.cpp | 4 +- .../trial_of_the_crusader.cpp | 6 +- .../HallsOfReflection/halls_of_reflection.cpp | 4 +- .../Northrend/Nexus/Nexus/boss_anomalus.cpp | 4 +- .../Ulduar/Ulduar/boss_flame_leviathan.cpp | 4 +- .../Northrend/Ulduar/Ulduar/boss_freya.cpp | 6 +- .../Northrend/Ulduar/Ulduar/boss_hodir.cpp | 12 +- .../Northrend/Ulduar/Ulduar/boss_mimiron.cpp | 4 +- .../Ulduar/Ulduar/boss_razorscale.cpp | 6 +- .../Northrend/Ulduar/Ulduar/boss_thorim.cpp | 8 +- .../Ulduar/Ulduar/ulduar_scripts.cpp | 4 +- .../Pandaria/HeartOfFear/boss_garalon.cpp | 4 +- .../Pandaria/MogushanVault/boss_feng.cpp | 4 +- .../battle_on_the_high_seas.cpp | 6 +- .../Scenarios/BrewingStorm/brewing_storm.cpp | 4 +- .../IsleOfThunder/isle_of_thunder.cpp | 4 +- .../IsleOfThunder/thunder_king_citadel.cpp | 6 +- .../instance_secrets_of_ragefire.cpp | 2 +- .../SecretsOfRagefire/secrets_of_ragefire.cpp | 6 +- .../UngaIngoo/instance_unga_ingoo.cpp | 4 +- .../Scenarios/UngaIngoo/unga_ingoo.cpp | 2 +- .../boss_fallen_protectors.cpp | 4 +- .../SiegeOfOrgrimmar/boss_galakras.cpp | 2 +- .../SiegeOfOrgrimmar/boss_iron_juggernaut.cpp | 10 +- .../SiegeOfOrgrimmar/boss_norushen.cpp | 4 +- .../boss_paragons_of_the_klaxxi.cpp | 3 +- .../SiegeOfOrgrimmar/boss_sha_of_pride.cpp | 4 +- .../boss_siegecrafter_blackfuse.cpp | 8 +- .../boss_spoils_of_pandaria.cpp | 6 +- .../boss_thok_the_bloodthirsty.cpp | 4 +- .../instance_siege_of_orgrimmar.cpp | 8 +- .../SiegeOfOrgrimmar/siege_of_orgrimmar.cpp | 2 +- .../boss_council_of_elders.cpp | 4 +- .../ThroneOfThunder/boss_dark_animus.cpp | 6 +- .../ThroneOfThunder/boss_horridon.cpp | 4 +- .../ThroneOfThunder/boss_iron_qon.cpp | 4 +- .../Pandaria/ThroneOfThunder/boss_jikun.cpp | 4 +- .../Pandaria/ThroneOfThunder/boss_jinrokh.cpp | 6 +- .../Pandaria/ThroneOfThunder/boss_megaera.cpp | 4 +- .../Pandaria/ThroneOfThunder/boss_tortos.cpp | 2 +- .../ThroneOfThunder/boss_twin_consorts.cpp | 6 +- .../instance_throne_of_thunder.cpp | 8 +- .../scripts/Pandaria/zone_the_jade_forest.cpp | 2 +- src/server/scripts/Spells/spell_generic.cpp | 5 +- src/server/scripts/Spells/spell_item.cpp | 4 +- src/server/scripts/World/npcs_special.cpp | 4 +- 74 files changed, 524 insertions(+), 518 deletions(-) diff --git a/src/server/database/Database/Implementation/WorldDatabase.cpp b/src/server/database/Database/Implementation/WorldDatabase.cpp index 873c6f74..5579a24d 100644 --- a/src/server/database/Database/Implementation/WorldDatabase.cpp +++ b/src/server/database/Database/Implementation/WorldDatabase.cpp @@ -78,7 +78,7 @@ void WorldDatabaseConnection::DoPrepareStatements() PrepareStatement(WORLD_SEL_WAYPOINT_SCRIPT_ID_BY_GUID, "SELECT id FROM waypoint_scripts WHERE guid = ?", CONNECTION_SYNCH); PrepareStatement(WORLD_DEL_CREATURE, "DELETE FROM creature WHERE guid = ?", CONNECTION_ASYNC); PrepareStatement(WORLD_SEL_COMMANDS, "SELECT name, security, help FROM command", CONNECTION_SYNCH); - PrepareStatement(WORLD_SEL_CREATURE_TEMPLATE, "SELECT difficulty_entry_1, difficulty_entry_2, difficulty_entry_3, difficulty_entry_4, difficulty_entry_5, KillCredit1, KillCredit2, modelid1, modelid2, modelid3, modelid4, name, subname, IconName, gossip_menu_id, minlevel, maxlevel, exp, exp_unk, faction, npcflag, npcflag2, speed_walk, speed_run, scale, `rank`, mindmg, maxdmg, dmgschool, attackpower, dmg_multiplier, BaseAttackTime, RangeAttackTime, unit_class, unit_flags, unit_flags2, dynamicflags, family, trainer_type, trainer_class, trainer_race, minrangedmg, maxrangedmg, rangedattackpower, type, type_flags, type_flags2, lootid, pickpocketloot, skinloot, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, spell1, spell2, spell3, spell4, spell5, spell6, spell7, spell8, PetSpellDataId, VehicleId, mingold, maxgold, AIName, MovementType, HoverHeight, Health_mod, Mana_mod, Mana_mod_extra, Armor_mod, RacialLeader, questItem1, questItem2, questItem3, questItem4, questItem5, questItem6, movementId, RegenHealth, mechanic_immune_mask, flags_extra, ScriptName FROM creature_template WHERE entry = ?", CONNECTION_SYNCH); + PrepareStatement(WORLD_SEL_CREATURE_TEMPLATE, "SELECT difficulty_entry_1, difficulty_entry_2, difficulty_entry_3, difficulty_entry_4, difficulty_entry_5, KillCredit1, KillCredit2, name, subname, IconName, gossip_menu_id, minlevel, maxlevel, exp, exp_unk, faction, npcflag, npcflag2, speed_walk, speed_run, scale, `rank`, mindmg, maxdmg, dmgschool, attackpower, dmg_multiplier, BaseAttackTime, RangeAttackTime, unit_class, unit_flags, unit_flags2, dynamicflags, family, trainer_type, trainer_class, trainer_race, minrangedmg, maxrangedmg, rangedattackpower, type, type_flags, type_flags2, lootid, pickpocketloot, skinloot, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, spell1, spell2, spell3, spell4, spell5, spell6, spell7, spell8, PetSpellDataId, VehicleId, mingold, maxgold, AIName, MovementType, HoverHeight, Health_mod, Mana_mod, Mana_mod_extra, Armor_mod, RacialLeader, questItem1, questItem2, questItem3, questItem4, questItem5, questItem6, movementId, RegenHealth, mechanic_immune_mask, flags_extra, ScriptName FROM creature_template WHERE entry = ?", CONNECTION_SYNCH); PrepareStatement(WORLD_SEL_WAYPOINT_SCRIPT_BY_ID, "SELECT guid, delay, command, datalong, datalong2, dataint, x, y, z, o FROM waypoint_scripts WHERE id = ?", CONNECTION_SYNCH); PrepareStatement(WORLD_SEL_ITEM_TEMPLATE_BY_NAME, "SELECT entry FROM item_template WHERE name = ?", CONNECTION_SYNCH); PrepareStatement(WORLD_SEL_CREATURE_BY_ID, "SELECT guid FROM creature WHERE id = ?", CONNECTION_SYNCH); diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index d3bf2b88..0f96c228 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -275,10 +275,10 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u { if (CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(e.action.morphOrMount.creature)) { - uint32 displayId = ObjectMgr::ChooseDisplayId(ci); - (*itr)->ToCreature()->SetDisplayId(displayId); + CreatureModel const* model = ObjectMgr::ChooseDisplayId(ci); + (*itr)->ToCreature()->SetDisplayId(model->CreatureDisplayID, model->DisplayScale); TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_MORPH_TO_ENTRY_OR_MODEL: Creature entry %u, GuidLow %u set displayid to %u", - (*itr)->GetEntry(), (*itr)->GetGUID().GetCounter(), displayId); + (*itr)->GetEntry(), (*itr)->GetGUID().GetCounter(), model->CreatureDisplayID); } } //if no param1, then use value from param2 (modelId) @@ -1036,7 +1036,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (e.action.morphOrMount.creature > 0) { if (CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(e.action.morphOrMount.creature)) - (*itr)->ToUnit()->Mount(ObjectMgr::ChooseDisplayId(cInfo)); + (*itr)->ToUnit()->Mount(ObjectMgr::ChooseDisplayId(cInfo)->CreatureDisplayID); } else (*itr)->ToUnit()->Mount(e.action.morphOrMount.model); diff --git a/src/server/game/BattlePet/BattlePet.cpp b/src/server/game/BattlePet/BattlePet.cpp index 858ae029..8cc78cc0 100644 --- a/src/server/game/BattlePet/BattlePet.cpp +++ b/src/server/game/BattlePet/BattlePet.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -33,7 +33,7 @@ void BattlePet::Initialise(bool newBattlePet) { // existence is checked before this, no problem should arise m_npc = sBattlePetSpeciesStore.LookupEntry(m_species)->NpcId; - m_displayId = sObjectMgr->GetCreatureTemplate(m_npc)->Modelid1; + m_displayId = sObjectMgr->GetCreatureTemplate(m_npc)->GetModelByIdx(0)->CreatureDisplayID; // setup initial battle pet states InitialiseStates(newBattlePet); diff --git a/src/server/game/BattlePet/BattlePetMgr.cpp b/src/server/game/BattlePet/BattlePetMgr.cpp index cbaefb05..e0916622 100644 --- a/src/server/game/BattlePet/BattlePetMgr.cpp +++ b/src/server/game/BattlePet/BattlePetMgr.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -642,7 +642,7 @@ void BattlePetMgr::SendBattlePetJournal() journalData << uint16(battlePet->GetFlags()); journalData << uint32(creatureTemplate->Entry); - journalData << uint32(creatureTemplate->Modelid1); + journalData << uint32(creatureTemplate->GetModelByIdx(0)->CreatureDisplayID); journalData << uint32(battlePet->GetSpeed()); journalData.WriteString(battlePet->GetNickname()); journalData.WriteByteSeq(petEntry[6]); @@ -792,7 +792,7 @@ void BattlePetMgr::SendBattlePetUpdate(BattlePet* battlePet, bool notification) data << uint16(battlePet->GetFlags()); data.WriteByteSeq(petEntry[5]); - data << uint32(creatureTemplate->Modelid1); + data << uint32(creatureTemplate->GetModelByIdx(0)->CreatureDisplayID); data << uint16(battlePet->GetLevel()); m_owner->GetSession()->SendPacket(&data); diff --git a/src/server/game/DataStores/DBCStores.h b/src/server/game/DataStores/DBCStores.h index 52d81a1a..72f3f4bd 100644 --- a/src/server/game/DataStores/DBCStores.h +++ b/src/server/game/DataStores/DBCStores.h @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/src/server/game/DataStores/DBCStructure.h b/src/server/game/DataStores/DBCStructure.h index 9a6c5a04..4fa42dcb 100644 --- a/src/server/game/DataStores/DBCStructure.h +++ b/src/server/game/DataStores/DBCStructure.h @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -892,7 +892,7 @@ struct CreatureModelDataEntry { uint32 Id; uint32 Flags; - DbcStr ModelPath; + char* ModelName; // 2 //uint32 Unk1; float ModelScale; // Used in calculation of unit collision data //int32 Unk2 diff --git a/src/server/game/DataStores/DBCfmt.h b/src/server/game/DataStores/DBCfmt.h index 202cbd9c..d0b6e7da 100644 --- a/src/server/game/DataStores/DBCfmt.h +++ b/src/server/game/DataStores/DBCfmt.h @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -18,7 +18,7 @@ #ifndef TRINITY_DBCSFRM_H #define TRINITY_DBCSFRM_H -// x - skip, X - skip, s - char*, f - float, i - uint32, b - uint8, d - index (not included) +// x - skip, X - skip, s - char*, S - char*, f - float, i - uint32, b - uint8, d - index (not included) // n - index (included), l - bool, p - field present in sql dbc, a - field absent in sql dbc char const Achievementfmt[] = "niiisxiixixxiii"; @@ -45,7 +45,7 @@ char const ChrClassesXPowerTypesfmt[] = "nii"; char const CinematicCameraEntryfmt[] = "nSiffff"; char const CinematicSequencesEntryfmt[] = "nxiiiiiiii"; char const CreatureDisplayInfofmt[] = "nixifxxxxxxxxxxxxxxx"; -char const CreatureModelDatafmt[] = "nisxfxxxxxxxxxxffxxxxxxxxxxxxxxxxx"; +char const CreatureModelDatafmt[] = "niSxfxxxxxxxxxxffxxxxxxxxxxxxxxxxx"; char const CreatureFamilyfmt[] = "nfifiiiiixsx"; char const CreatureImmunitiesfmt[] = "niiiiiiiiiiiiiiiiiiiiiiiiiiiii"; char const CreatureSpellDatafmt[] = "niiiixxxx"; diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 5ae89d50..f29ec41d 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -113,26 +113,67 @@ VendorItem const* VendorItemData::FindItemCostPair(uint32 item_id, uint32 extend return NULL; } -uint32 CreatureTemplate::GetRandomValidModelId() const +CreatureModel const CreatureModel::DefaultInvisibleModel(11686, 1.0f, 1.0f); +CreatureModel const CreatureModel::DefaultVisibleModel(17519, 1.0f, 1.0f); + +CreatureModel const* CreatureTemplate::GetModelByIdx(uint32 idx) const +{ + return idx < Models.size() ? &Models[idx] : nullptr; +} + +CreatureModel const* CreatureTemplate::GetRandomValidModel() const +{ + if (!Models.size()) + return nullptr; + + // If only one element, ignore the Probability (even if 0) + if (Models.size() == 1) + return &Models[0]; + + auto selectedItr = Trinity::Containers::SelectRandomWeightedContainerElement(Models, [](CreatureModel const& model) + { + return model.Probability; + }); + + return &(*selectedItr); +} + +CreatureModel const* CreatureTemplate::GetFirstValidModel() const { - uint8 c = 0; - uint32 modelIDs[4]; + for (CreatureModel const& model : Models) + if (model.CreatureDisplayID) + return &model; + + return nullptr; +} - if (Modelid1) modelIDs[c++] = Modelid1; - if (Modelid2) modelIDs[c++] = Modelid2; - if (Modelid3) modelIDs[c++] = Modelid3; - if (Modelid4) modelIDs[c++] = Modelid4; +CreatureModel const* CreatureTemplate::GetModelWithDisplayId(uint32 displayId) const +{ + for (CreatureModel const& model : Models) + if (displayId == model.CreatureDisplayID) + return &model; - return ((c>0) ? modelIDs[urand(0, c-1)] : 0); + return nullptr; } -uint32 CreatureTemplate::GetFirstValidModelId() const +CreatureModel const* CreatureTemplate::GetFirstInvisibleModel() const { - if (Modelid1) return Modelid1; - if (Modelid2) return Modelid2; - if (Modelid3) return Modelid3; - if (Modelid4) return Modelid4; - return 0; + for (CreatureModel const& model : Models) + if (CreatureModelInfo const* modelInfo = sObjectMgr->GetCreatureModelInfo(model.CreatureDisplayID)) + if (modelInfo && modelInfo->is_trigger) + return &model; + + return &CreatureModel::DefaultInvisibleModel; +} + +CreatureModel const* CreatureTemplate::GetFirstVisibleModel() const +{ + for (CreatureModel const& model : Models) + if (CreatureModelInfo const* modelInfo = sObjectMgr->GetCreatureModelInfo(model.CreatureDisplayID)) + if (modelInfo && !modelInfo->is_trigger) + return &model; + + return &CreatureModel::DefaultVisibleModel; } bool AssistDelayEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) @@ -340,22 +381,22 @@ bool Creature::InitEntry(uint32 entry, uint32 /*team*/, const CreatureData* data SetClass(uint8(cinfo->unit_class)); // Cancel load if no model defined - if (!(cinfo->GetFirstValidModelId())) + if (!(cinfo->GetFirstValidModel())) { TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has no model defined in table `creature_template`, can't load. ", entry); return false; } - uint32 displayID = ObjectMgr::ChooseDisplayId(GetCreatureTemplate(), data); - CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelRandomGender(&displayID); + CreatureModel model = *ObjectMgr::ChooseDisplayId(cinfo, data); + CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelRandomGender(&model, cinfo); if (!minfo) // Cancel load if no model defined { TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has no model defined in table `creature_template`, can't load. ", entry); return false; } - SetDisplayId(displayID); - SetNativeDisplayId(displayID); + SetDisplayId(model.CreatureDisplayID, true); + SetNativeDisplayId(model.CreatureDisplayID); SetGender(minfo->gender); // Load creature equipment @@ -804,6 +845,13 @@ bool Creature::Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry, return false; } + { + // area/zone id is needed immediately for ZoneScript::GetCreatureEntry hook before it is known which creature template to load (no model/scale available yet) + PositionFullTerrainStatus data; + GetMap()->GetFullTerrainStatusForPosition(GetPhaseMask(), GetPositionX(), GetPositionY(), GetPositionZ(), data, MAP_ALL_LIQUIDS, DEFAULT_COLLISION_HEIGHT); + ProcessPositionDataChanged(data); + } + if (!CreateFromProto(guidlow, Entry, vehId, team, data)) return false; @@ -840,14 +888,8 @@ bool Creature::Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry, Relocate(x, y, z, ang); } - uint32 displayID = GetNativeDisplayId(); - CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelRandomGender(&displayID); - if (minfo && !IsTotem()) // Cancel load if no model defined or if totem - { - SetDisplayId(displayID); - SetNativeDisplayId(displayID); - SetGender(minfo->gender); - } + //! Need to be called after LoadCreaturesAddon - MOVEMENTFLAG_HOVER is set there + m_positionZ += GetHoverOffset(); LastUsedScriptID = GetScriptId(); @@ -1042,9 +1084,9 @@ void Creature::SaveToDB(uint32 mapid, uint16 spawnMask, uint32 phaseMask) CreatureTemplate const* cinfo = GetCreatureTemplate(); if (cinfo) { - if (displayId == cinfo->Modelid1 || displayId == cinfo->Modelid2 || - displayId == cinfo->Modelid3 || displayId == cinfo->Modelid4) - displayId = 0; + for (CreatureModel model : cinfo->Models) + if (displayId && displayId == model.CreatureDisplayID) + displayId = 0; if (npcflag == cinfo->npcflag) npcflag = 0; @@ -1719,14 +1761,10 @@ void Creature::Respawn(bool force) setDeathState(JUST_RESPAWNED); - uint32 displayID = GetNativeDisplayId(); - CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelRandomGender(&displayID); - if (minfo) // Cancel load if no model defined - { - SetDisplayId(displayID); - SetNativeDisplayId(displayID); - SetGender(minfo->gender); - } + + CreatureModel display(GetNativeDisplayId(), 0, 1.0f); + if (sObjectMgr->GetCreatureModelRandomGender(&display, GetCreatureTemplate())) + SetDisplayId(display.CreatureDisplayID, true); sBattlePetSpawnMgr->OnRespawn(this); @@ -2869,9 +2907,9 @@ void Creature::SetObjectScale(float scale) } } -void Creature::SetDisplayId(uint32 modelId) +void Creature::SetDisplayId(uint32 modelId, float displayScale /*= 1.f*/) { - Unit::SetDisplayId(modelId); + Unit::SetDisplayId(modelId, displayScale); if (CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelInfo(modelId)) { @@ -2880,6 +2918,12 @@ void Creature::SetDisplayId(uint32 modelId) } } +void Creature::SetDisplayFromModel(uint32 modelIdx) +{ + if (CreatureModel const* model = GetCreatureTemplate()->GetModelByIdx(modelIdx)) + SetDisplayId(model->CreatureDisplayID); +} + void Creature::SetTarget(ObjectGuid guid) { if (!_focusSpell) diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index 3a714002..78d436c6 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -105,13 +105,7 @@ struct CreatureData uint32 gameEventId = 0; }; -struct CreatureModelInfo -{ - float bounding_radius; - float combat_reach; - uint8 gender; - uint32 modelid_other_gender; -}; + // Benchmarked: Faster than std::map (insert/find) typedef std::unordered_map CreatureModelContainer; @@ -260,7 +254,8 @@ class TC_GAME_API Creature : public Unit, public GridObject, public Ma void RemoveFromWorld() override; void SetObjectScale(float scale) override; - void SetDisplayId(uint32 modelId) override; + void SetDisplayId(uint32 displayId, float displayScale = 1.f) override; + void SetDisplayFromModel(uint32 modelIdx); void DisappearAndDie(); diff --git a/src/server/game/Entities/Creature/CreatureData.h b/src/server/game/Entities/Creature/CreatureData.h index 0699c9cf..2eca9040 100644 --- a/src/server/game/Entities/Creature/CreatureData.h +++ b/src/server/game/Entities/Creature/CreatureData.h @@ -132,16 +132,29 @@ static uint32 const MAX_CREATURE_MODELS = 4; static uint32 const MAX_CREATURE_QUEST_ITEMS = 6; static uint32 const MAX_CREATURE_SPELLS = 8; +struct CreatureModel +{ + static CreatureModel const DefaultInvisibleModel; + static CreatureModel const DefaultVisibleModel; + + CreatureModel() : + CreatureDisplayID(0), DisplayScale(0.0f), Probability(0.0f) { } + + CreatureModel(uint32 creatureDisplayID, float displayScale, float probability) : + CreatureDisplayID(creatureDisplayID), DisplayScale(displayScale), Probability(probability) { } + + uint32 CreatureDisplayID; + float DisplayScale; + float Probability; +}; + // from `creature_template` table struct TC_GAME_API CreatureTemplate { uint32 Entry; uint32 DifficultyEntry[MAX_TEMPLATE_DIFFICULTY - 1]; uint32 KillCredit[MAX_KILL_CREDIT]; - uint32 Modelid1; - uint32 Modelid2; - uint32 Modelid3; - uint32 Modelid4; + std::vector Models; std::string Name; std::string FemaleName; std::string SubName; @@ -205,8 +218,12 @@ struct TC_GAME_API CreatureTemplate uint32 MechanicImmuneMask; uint32 flags_extra; uint32 ScriptID; - uint32 GetRandomValidModelId() const; - uint32 GetFirstValidModelId() const; + CreatureModel const* GetModelByIdx(uint32 idx) const; + CreatureModel const* GetRandomValidModel() const; + CreatureModel const* GetFirstValidModel() const; + CreatureModel const* GetModelWithDisplayId(uint32 displayId) const; + CreatureModel const* GetFirstInvisibleModel() const; + CreatureModel const* GetFirstVisibleModel() const; // helpers SkillType GetRequiredLootSkill() const @@ -284,6 +301,15 @@ struct CreatureLocale std::vector Title; }; +struct CreatureModelInfo +{ + float bounding_radius; + float combat_reach; + uint8 gender; + uint32 modelid_other_gender; + bool is_trigger; +}; + #pragma pack(pop) // `creature_addon` table diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp index 7cbe032d..3dcd1cff 100644 --- a/src/server/game/Entities/Pet/Pet.cpp +++ b/src/server/game/Entities/Pet/Pet.cpp @@ -1763,9 +1763,9 @@ Player* Pet::GetOwner() const return Minion::GetOwner()->ToPlayer(); } -void Pet::SetDisplayId(uint32 modelId) +void Pet::SetDisplayId(uint32 modelId, float displayScale /*= 1.f*/) { - Guardian::SetDisplayId(modelId); + Guardian::SetDisplayId(modelId, displayScale); if (!isControlled()) return; diff --git a/src/server/game/Entities/Pet/Pet.h b/src/server/game/Entities/Pet/Pet.h index 3dbc4c68..a7e55d63 100644 --- a/src/server/game/Entities/Pet/Pet.h +++ b/src/server/game/Entities/Pet/Pet.h @@ -46,7 +46,7 @@ class TC_GAME_API Pet : public Guardian void AddToWorld() override; void RemoveFromWorld() override; - void SetDisplayId(uint32 modelId) override; + void SetDisplayId(uint32 modelId, float displayScale = 1.f) override; PetType getPetType() const { return m_petType; } void setPetType(PetType type) { m_petType = type; } diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 9c6ecf0e..1ef0cea8 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -14995,9 +14995,10 @@ void Unit::SetAnimTier(AnimTier tier) SetByteValue(UNIT_FIELD_ANIM_TIER, UNIT_BYTES_1_OFFSET_ANIM_TIER, static_cast(tier)); } -void Unit::SetDisplayId(uint32 modelId) +void Unit::SetDisplayId(uint32 modelId, float displayScale /*= 1.f*/) { SetUInt32Value(UNIT_FIELD_DISPLAY_ID, modelId); + //SetFloatValue(UNIT_FIELD_DISPLAY_SCALE, displayScale); } void Unit::RestoreDisplayId() @@ -19672,19 +19673,7 @@ void Unit::BuildValuesUpdate(uint8 updateType, ByteBuffer* data, Player* target) if (cinfo->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER) { if (target->IsGameMaster()) - { - if (cinfo->Modelid1) - displayId = cinfo->Modelid1; // Modelid1 is a visible model for gms - else - displayId = 17519; // world visible trigger's model - } - else - { - if (cinfo->Modelid2) - displayId = cinfo->Modelid2; // Modelid2 is an invisible model for players - else - displayId = 11686; // world invisible trigger's model - } + displayId = cinfo->GetFirstVisibleModel()->CreatureDisplayID; } } diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 4b887c3e..98c029f8 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -2240,16 +2240,12 @@ class TC_GAME_API Unit : public WorldObject { return GetUInt32Value(UNIT_FIELD_DISPLAY_ID); } - virtual void SetDisplayId(uint32 modelId); - uint32 GetNativeDisplayId() const - { - return GetUInt32Value(UNIT_FIELD_NATIVE_DISPLAY_ID); - } + virtual void SetDisplayId(uint32 modelId, float displayScale = 1.f); + uint32 GetNativeDisplayId() const { return GetUInt32Value(UNIT_FIELD_NATIVE_DISPLAY_ID); } + float GetNativeDisplayScale() const { return 1.0f /**GetFloatValue(UNIT_FIELD_NATIVE_X_DISPLAY_SCALE)**/; } void RestoreDisplayId(); - void SetNativeDisplayId(uint32 modelId) - { - SetUInt32Value(UNIT_FIELD_NATIVE_DISPLAY_ID, modelId); - } + void SetNativeDisplayId(uint32 displayId, float displayScale = 1.f) { SetUInt32Value(UNIT_FIELD_NATIVE_DISPLAY_ID, displayId); /**SetFloatValue(UNIT_FIELD_NATIVE_X_DISPLAY_SCALE, displayScale);**/ } + void setTransForm(uint32 spellid) { m_transform = spellid; diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 7aea5874..d171559e 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -422,23 +422,23 @@ void ObjectMgr::LoadCreatureTemplates() { uint32 oldMSTime = getMSTime(); - // 0 1 2 3 4 5 6 7 8 9 10 - QueryResult result = WorldDatabase.Query("SELECT entry, difficulty_entry_1, difficulty_entry_2, difficulty_entry_3, difficulty_entry_4, difficulty_entry_5, KillCredit1, KillCredit2, modelid1, modelid2, modelid3, " - // 11 12 13 14 15 16 17 18 19 20 21 22 23 24 - "modelid4, name, femaleName, subname, IconName, gossip_menu_id, minlevel, maxlevel, exp, exp_unk, faction, npcflag, npcflag2, speed_walk, " - // 25 26 27 28 29 30 31 32 33 34 35 36 37 + // 0 1 2 3 4 5 6 7 + QueryResult result = WorldDatabase.Query("SELECT entry, difficulty_entry_1, difficulty_entry_2, difficulty_entry_3, difficulty_entry_4, difficulty_entry_5, KillCredit1, KillCredit2, " + // 8 9 10 11 12 13 14 15 16 17 18 19 20 + "name, femaleName, subname, IconName, gossip_menu_id, minlevel, maxlevel, exp, exp_unk, faction, npcflag, npcflag2, speed_walk, " + // 21 22 23 24 25 26 27 28 29 30 31 32 33 "speed_run, scale, `rank`, mindmg, maxdmg, dmgschool, attackpower, dmg_multiplier, BaseAttackTime, RangeAttackTime, unit_class, unit_flags, unit_flags2, " - // 38 39 40 41 42 43 44 45 46 + // 34 35 36 37 38 39 40 41 42 "dynamicflags, family, trainer_type, trainer_class, trainer_race, minrangedmg, maxrangedmg, rangedattackpower, type, " - // 47 48 49 50 51 52 53 54 55 56 57 + // 43 44 45 46 47 48 49 50 51 52 53 "type_flags, type_flags2, lootid, pickpocketloot, skinloot, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, " - // 58 59 60 61 62 63 64 65 66 67 68 69 70 71 + // 54 55 56 57 58 59 60 61 62 63 64 65 66 67 "spell1, spell2, spell3, spell4, spell5, spell6, spell7, spell8, PetSpellDataId, VehicleId, mingold, maxgold, AIName, MovementType, " - // 72 73 74 75 76 77 78 + // 68 69 70 71 72 73 74 "ctm.Ground, ctm.Swim, ctm.Flight, ctm.Rooted, ctm.Chase, ctm.Random, ctm.InteractionPauseTimer," - // 80 81 82 83 84 85 86 87 88 89 90 + // 75 76 77 78 79 80 81 82 83 84 85 "HoverHeight, Health_mod, Mana_mod, Mana_mod_extra, Armor_mod, RacialLeader, questItem1, questItem2, questItem3, questItem4, questItem5, " - // 91 92 93 94 95 96 97 98 + // 86 87 88 89 90 91 92 93 " questItem6, movementId, RegenHealth, VignetteID, TrackingQuestID, mechanic_immune_mask, flags_extra, ScriptName " "FROM creature_template ct LEFT JOIN creature_template_movement ctm ON ct.entry = ctm.CreatureId;"); @@ -449,13 +449,26 @@ void ObjectMgr::LoadCreatureTemplates() } _creatureTemplateStore.rehash(result->GetRowCount()); - uint32 count = 0; do { Field* fields = result->Fetch(); + LoadCreatureTemplate(fields); + } + while (result->NextRow()); - uint32 entry = fields[0].GetUInt32(); + // We load the creature models after loading but before checking + LoadCreatureTemplateModels(); + // Checking needs to be done after loading because of the difficulty self referencing + for (CreatureTemplateContainer::const_iterator itr = _creatureTemplateStore.begin(); itr != _creatureTemplateStore.end(); ++itr) + CheckCreatureTemplate(&itr->second); + + TC_LOG_INFO("server.loading", ">> Loaded %u creature definitions in %u ms", uint32(_creatureTemplateStore.size()), GetMSTimeDiffToNow(oldMSTime)); +} + +void ObjectMgr::LoadCreatureTemplate(Field* fields) +{ + uint32 entry = fields[0].GetUInt32(); CreatureTemplate& creatureTemplate = _creatureTemplateStore[entry]; @@ -467,111 +480,150 @@ void ObjectMgr::LoadCreatureTemplates() for (uint8 i = 0; i < MAX_KILL_CREDIT; ++i) creatureTemplate.KillCredit[i] = fields[6 + i].GetUInt32(); - creatureTemplate.Modelid1 = fields[8].GetUInt32(); - creatureTemplate.Modelid2 = fields[9].GetUInt32(); - creatureTemplate.Modelid3 = fields[10].GetUInt32(); - creatureTemplate.Modelid4 = fields[11].GetUInt32(); - creatureTemplate.Name = fields[12].GetString(); - creatureTemplate.FemaleName = fields[13].GetString(); - creatureTemplate.SubName = fields[14].GetString(); - creatureTemplate.IconName = fields[15].GetString(); - creatureTemplate.GossipMenuId = fields[16].GetUInt32(); - creatureTemplate.minlevel = fields[17].GetInt16(); - creatureTemplate.maxlevel = fields[18].GetInt16(); - creatureTemplate.expansion = uint32(fields[19].GetInt16()); - creatureTemplate.expansionUnknown = uint32(fields[20].GetUInt16()); - creatureTemplate.faction = uint32(fields[21].GetUInt16()); - creatureTemplate.npcflag = fields[22].GetUInt32(); - creatureTemplate.npcflag2 = fields[23].GetUInt32(); - creatureTemplate.speed_walk = fields[24].GetFloat(); - creatureTemplate.speed_run = fields[25].GetFloat(); - creatureTemplate.scale = fields[26].GetFloat(); - creatureTemplate.rank = uint32(fields[27].GetUInt8()); - creatureTemplate.mindmg = fields[28].GetFloat(); - creatureTemplate.maxdmg = fields[39].GetFloat(); - creatureTemplate.dmgschool = uint32(fields[30].GetInt8()); - creatureTemplate.attackpower = fields[31].GetUInt32(); - creatureTemplate.dmg_multiplier = fields[32].GetFloat(); - creatureTemplate.BaseAttackTime = fields[33].GetUInt32(); - creatureTemplate.RangeAttackTime = fields[34].GetUInt32(); - creatureTemplate.unit_class = uint32(fields[35].GetUInt8()); - creatureTemplate.unit_flags = fields[36].GetUInt32(); - creatureTemplate.unit_flags2 = fields[37].GetUInt32(); - creatureTemplate.dynamicflags = fields[38].GetUInt32(); - creatureTemplate.family = uint32(fields[39].GetUInt8()); - creatureTemplate.trainer_type = uint32(fields[40].GetUInt8()); - creatureTemplate.trainer_class = uint32(fields[41].GetUInt8()); - creatureTemplate.trainer_race = uint32(fields[42].GetUInt8()); - creatureTemplate.minrangedmg = fields[43].GetFloat(); - creatureTemplate.maxrangedmg = fields[44].GetFloat(); - creatureTemplate.rangedattackpower = uint32(fields[45].GetUInt16()); - creatureTemplate.type = uint32(fields[46].GetUInt8()); - creatureTemplate.type_flags = fields[47].GetUInt32(); - creatureTemplate.type_flags2 = fields[48].GetUInt32(); - creatureTemplate.lootid = fields[49].GetUInt32(); - creatureTemplate.pickpocketLootId = fields[50].GetUInt32(); - creatureTemplate.SkinLootId = fields[51].GetUInt32(); + creatureTemplate.Name = fields[8].GetString(); + creatureTemplate.FemaleName = fields[9].GetString(); + creatureTemplate.SubName = fields[10].GetString(); + creatureTemplate.IconName = fields[11].GetString(); + creatureTemplate.GossipMenuId = fields[12].GetUInt32(); + creatureTemplate.minlevel = fields[13].GetInt16(); + creatureTemplate.maxlevel = fields[14].GetInt16(); + creatureTemplate.expansion = uint32(fields[15].GetInt16()); + creatureTemplate.expansionUnknown = uint32(fields[16].GetUInt16()); + creatureTemplate.faction = uint32(fields[17].GetUInt16()); + creatureTemplate.npcflag = fields[18].GetUInt32(); + creatureTemplate.npcflag2 = fields[19].GetUInt32(); + creatureTemplate.speed_walk = fields[20].GetFloat(); + creatureTemplate.speed_run = fields[21].GetFloat(); + creatureTemplate.scale = fields[22].GetFloat(); + creatureTemplate.rank = uint32(fields[23].GetUInt8()); + creatureTemplate.mindmg = fields[24].GetFloat(); + creatureTemplate.maxdmg = fields[25].GetFloat(); + creatureTemplate.dmgschool = uint32(fields[26].GetInt8()); + creatureTemplate.attackpower = fields[27].GetUInt32(); + creatureTemplate.dmg_multiplier = fields[28].GetFloat(); + creatureTemplate.BaseAttackTime = fields[29].GetUInt32(); + creatureTemplate.RangeAttackTime = fields[30].GetUInt32(); + creatureTemplate.unit_class = uint32(fields[31].GetUInt8()); + creatureTemplate.unit_flags = fields[32].GetUInt32(); + creatureTemplate.unit_flags2 = fields[33].GetUInt32(); + creatureTemplate.dynamicflags = fields[34].GetUInt32(); + creatureTemplate.family = uint32(fields[35].GetUInt8()); + creatureTemplate.trainer_type = uint32(fields[36].GetUInt8()); + creatureTemplate.trainer_class = uint32(fields[37].GetUInt8()); + creatureTemplate.trainer_race = uint32(fields[38].GetUInt8()); + creatureTemplate.minrangedmg = fields[39].GetFloat(); + creatureTemplate.maxrangedmg = fields[40].GetFloat(); + creatureTemplate.rangedattackpower = uint32(fields[41].GetUInt16()); + creatureTemplate.type = uint32(fields[42].GetUInt8()); + creatureTemplate.type_flags = fields[43].GetUInt32(); + creatureTemplate.type_flags2 = fields[44].GetUInt32(); + creatureTemplate.lootid = fields[45].GetUInt32(); + creatureTemplate.pickpocketLootId = fields[46].GetUInt32(); + creatureTemplate.SkinLootId = fields[47].GetUInt32(); for (uint8 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i) - creatureTemplate.resistance[i] = fields[52 + i - 1].GetInt16(); + creatureTemplate.resistance[i] = fields[48 + i - 1].GetInt16(); for (uint8 i = 0; i < CREATURE_MAX_SPELLS; ++i) - creatureTemplate.spells[i] = fields[58 + i].GetUInt32(); - - creatureTemplate.PetSpellDataId = fields[66].GetUInt32(); - creatureTemplate.VehicleId = fields[67].GetUInt32(); - creatureTemplate.mingold = fields[68].GetUInt32(); - creatureTemplate.maxgold = fields[69].GetUInt32(); - creatureTemplate.AIName = fields[70].GetString(); - creatureTemplate.MovementType = uint32(fields[71].GetUInt8()); + creatureTemplate.spells[i] = fields[54 + i].GetUInt32(); + + creatureTemplate.PetSpellDataId = fields[62].GetUInt32(); + creatureTemplate.VehicleId = fields[63].GetUInt32(); + creatureTemplate.mingold = fields[64].GetUInt32(); + creatureTemplate.maxgold = fields[65].GetUInt32(); + creatureTemplate.AIName = fields[66].GetString(); + creatureTemplate.MovementType = uint32(fields[67].GetUInt8()); + if (!fields[68].IsNull()) + creatureTemplate.Movement.Ground = static_cast(fields[68].GetUInt8()); + + if (!fields[69].IsNull()) + creatureTemplate.Movement.Swim = fields[69].GetBool(); + + if (!fields[70].IsNull()) + creatureTemplate.Movement.Flight = static_cast(fields[70].GetUInt8()); + + if (!fields[71].IsNull()) + creatureTemplate.Movement.Rooted = fields[71].GetBool(); + if (!fields[72].IsNull()) - creatureTemplate.Movement.Ground = static_cast(fields[72].GetUInt8()); + creatureTemplate.Movement.Chase = static_cast(fields[72].GetUInt8()); if (!fields[73].IsNull()) - creatureTemplate.Movement.Swim = fields[73].GetBool(); + creatureTemplate.Movement.Random = static_cast(fields[73].GetUInt8()); if (!fields[74].IsNull()) - creatureTemplate.Movement.Flight = static_cast(fields[74].GetUInt8()); + creatureTemplate.Movement.InteractionPauseTimer = fields[74].GetUInt32(); - if (!fields[75].IsNull()) - creatureTemplate.Movement.Rooted = fields[75].GetBool(); + creatureTemplate.HoverHeight = fields[75].GetFloat(); + creatureTemplate.ModHealth = fields[76].GetFloat(); + creatureTemplate.ModMana = fields[77].GetFloat(); + creatureTemplate.ModManaExtra = fields[78].GetFloat(); + creatureTemplate.ModArmor = fields[79].GetFloat(); + creatureTemplate.RacialLeader = fields[80].GetBool(); - if (!fields[76].IsNull()) - creatureTemplate.Movement.Chase = static_cast(fields[76].GetUInt8()); + for (uint8 i = 0; i < MAX_CREATURE_QUEST_ITEMS; ++i) + creatureTemplate.questItems[i] = fields[81 + i].GetUInt32(); - if (!fields[77].IsNull()) - creatureTemplate.Movement.Random = static_cast(fields[77].GetUInt8()); + creatureTemplate.movementId = fields[87].GetUInt32(); + creatureTemplate.RegenHealth = fields[88].GetBool(); + creatureTemplate.VignetteID = fields[89].GetUInt32(); + creatureTemplate.TrackingQuestID = fields[90].GetUInt32(); + creatureTemplate.MechanicImmuneMask = fields[91].GetUInt32(); + creatureTemplate.flags_extra = fields[92].GetUInt32(); + creatureTemplate.ScriptID = GetScriptId(fields[93].GetString()); +} - if (!fields[78].IsNull()) - creatureTemplate.Movement.InteractionPauseTimer = fields[78].GetUInt32(); +void ObjectMgr::LoadCreatureTemplateModels() +{ + uint32 oldMSTime = getMSTime(); - creatureTemplate.HoverHeight = fields[79].GetFloat(); - creatureTemplate.ModHealth = fields[80].GetFloat(); - creatureTemplate.ModMana = fields[81].GetFloat(); - creatureTemplate.ModManaExtra = fields[82].GetFloat(); - creatureTemplate.ModArmor = fields[83].GetFloat(); - creatureTemplate.RacialLeader = fields[84].GetBool(); + // 0 1 2 3 + QueryResult result = WorldDatabase.Query("SELECT CreatureID, CreatureDisplayID, DisplayScale, Probability FROM creature_template_model ORDER BY Idx ASC"); - for (uint8 i = 0; i < MAX_CREATURE_QUEST_ITEMS; ++i) - creatureTemplate.questItems[i] = fields[85 + i].GetUInt32(); + if (!result) + { + TC_LOG_INFO("server.loading", ">> Loaded 0 creature template model definitions. DB table `creature_template_model` is empty."); + return; + } - creatureTemplate.movementId = fields[91].GetUInt32(); - creatureTemplate.RegenHealth = fields[92].GetBool(); - creatureTemplate.VignetteID = fields[93].GetUInt32(); - creatureTemplate.TrackingQuestID = fields[94].GetUInt32(); - creatureTemplate.MechanicImmuneMask = fields[95].GetUInt32(); - creatureTemplate.flags_extra = fields[96].GetUInt32(); - creatureTemplate.ScriptID = GetScriptId(fields[97].GetString()); + uint32 count = 0; + do + { + Field* fields = result->Fetch(); + + uint32 creatureId = fields[0].GetUInt32(); + uint32 creatureDisplayId = fields[1].GetUInt32(); + float displayScale = fields[2].GetFloat(); + float probability = fields[3].GetFloat(); + + CreatureTemplate const* cInfo = GetCreatureTemplate(creatureId); + if (!cInfo) + { + TC_LOG_ERROR("sql.sql", "Creature template (Entry: %u) does not exist but has a record in `creature_template_model`", creatureId); + continue; + } + + CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(creatureDisplayId); + if (!displayEntry) + { + TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) lists non-existing CreatureDisplayID id (%u), this can crash the client.", creatureId, creatureDisplayId); + continue; + } + + CreatureModelInfo const* modelInfo = GetCreatureModelInfo(creatureDisplayId); + if (!modelInfo) + TC_LOG_ERROR("sql.sql", "No model data exist for `CreatureDisplayID` = %u listed by creature (Entry: %u).", creatureDisplayId, creatureId); + + if (displayScale <= 0.0f) + displayScale = 1.0f; + + const_cast(cInfo)->Models.emplace_back(creatureDisplayId, displayScale, probability); ++count; } while (result->NextRow()); - // Checking needs to be done after loading because of the difficulty self referencing - for (CreatureTemplateContainer::const_iterator itr = _creatureTemplateStore.begin(); itr != _creatureTemplateStore.end(); ++itr) - CheckCreatureTemplate(&itr->second); - - TC_LOG_INFO("server.loading", ">> Loaded %u creature definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u creature template models in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } static bool CheckCreatureAddonSpell(uint32 entry, SpellInfo const* spellInfo) @@ -905,76 +957,6 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) if (!factionTemplate) TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has non-existing faction template (%u).", cInfo->Entry, cInfo->faction); - // used later for scale - CreatureDisplayInfoEntry const* displayScaleEntry = NULL; - - if (cInfo->Modelid1) - { - CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->Modelid1); - if (!displayEntry) - { - TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) lists non-existing Modelid1 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid1); - const_cast(cInfo)->Modelid1 = 0; - } - else if (!displayScaleEntry) - displayScaleEntry = displayEntry; - - CreatureModelInfo const* modelInfo = GetCreatureModelInfo(cInfo->Modelid1); - if (!modelInfo) - TC_LOG_ERROR("sql.sql", "No model data exist for `Modelid1` = %u listed by creature (Entry: %u).", cInfo->Modelid1, cInfo->Entry); - } - - if (cInfo->Modelid2) - { - CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->Modelid2); - if (!displayEntry) - { - TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) lists non-existing Modelid2 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid2); - const_cast(cInfo)->Modelid2 = 0; - } - else if (!displayScaleEntry) - displayScaleEntry = displayEntry; - - CreatureModelInfo const* modelInfo = GetCreatureModelInfo(cInfo->Modelid2); - if (!modelInfo) - TC_LOG_ERROR("sql.sql", "No model data exist for `Modelid2` = %u listed by creature (Entry: %u).", cInfo->Modelid2, cInfo->Entry); - } - - if (cInfo->Modelid3) - { - CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->Modelid3); - if (!displayEntry) - { - TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) lists non-existing Modelid3 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid3); - const_cast(cInfo)->Modelid3 = 0; - } - else if (!displayScaleEntry) - displayScaleEntry = displayEntry; - - CreatureModelInfo const* modelInfo = GetCreatureModelInfo(cInfo->Modelid3); - if (!modelInfo) - TC_LOG_ERROR("sql.sql", "No model data exist for `Modelid3` = %u listed by creature (Entry: %u).", cInfo->Modelid3, cInfo->Entry); - } - - if (cInfo->Modelid4) - { - CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->Modelid4); - if (!displayEntry) - { - TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) lists non-existing Modelid4 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid4); - const_cast(cInfo)->Modelid4 = 0; - } - else if (!displayScaleEntry) - displayScaleEntry = displayEntry; - - CreatureModelInfo const* modelInfo = GetCreatureModelInfo(cInfo->Modelid4); - if (!modelInfo) - TC_LOG_ERROR("sql.sql", "No model data exist for `Modelid4` = %u listed by creature (Entry: %u).", cInfo->Modelid4, cInfo->Entry); - } - - if (!displayScaleEntry) - TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) does not have any existing display id in Modelid1/Modelid2/Modelid3/Modelid4.", cInfo->Entry); - for (int k = 0; k < MAX_KILL_CREDIT; ++k) { if (cInfo->KillCredit[k]) @@ -987,6 +969,11 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) } } + if (!cInfo->Models.size()) + TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) does not have any existing display id in creature_template_model.", cInfo->Entry); + else if (std::accumulate(cInfo->Models.begin(), cInfo->Models.end(), 0.0f, [](float sum, CreatureModel const& model) { return sum + model.Probability; }) <= 0.0f) + TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has zero total chance for all models in creature_template_model.", cInfo->Entry); + if (!cInfo->unit_class || ((1 << (cInfo->unit_class - 1)) & CLASSMASK_ALL_CREATURES) == 0) { TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has invalid unit_class (%u) in creature_template. Set to 1 (UNIT_CLASS_WARRIOR).", cInfo->Entry, cInfo->unit_class); @@ -1073,15 +1060,6 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) const_cast(cInfo)->MovementType = IDLE_MOTION_TYPE; } - /// if not set custom creature scale then load scale from CreatureDisplayInfo.dbc - if (cInfo->scale <= 0.0f) - { - if (displayScaleEntry) - const_cast(cInfo)->scale = displayScaleEntry->CreatureModelScale; - else - const_cast(cInfo)->scale = 1.0f; - } - if (cInfo->expansion > MAX_CREATURE_BASE_HP) { TC_LOG_ERROR("sql.sql", "Table `creature_template` lists creature (Entry: %u) with `exp` %u. Ignored and set to 0.", cInfo->Entry, cInfo->expansion); @@ -1526,7 +1504,7 @@ void ObjectMgr::LoadCreatureMovementOverrides() TC_LOG_INFO("server.loading", ">> Loaded " SZFMTD " movement overrides in %u ms", _creatureMovementOverrides.size(), GetMSTimeDiffToNow(oldMSTime)); } -CreatureModelInfo const* ObjectMgr::GetCreatureModelInfo(uint32 modelId) +CreatureModelInfo const* ObjectMgr::GetCreatureModelInfo(uint32 modelId) const { CreatureModelContainer::const_iterator itr = _creatureModelStore.find(modelId); if (itr != _creatureModelStore.end()) @@ -1535,13 +1513,19 @@ CreatureModelInfo const* ObjectMgr::GetCreatureModelInfo(uint32 modelId) return nullptr; } -uint32 ObjectMgr::ChooseDisplayId(CreatureTemplate const* cinfo, CreatureData const* data /*= NULL*/) +CreatureModel const* ObjectMgr::ChooseDisplayId(CreatureTemplate const* cinfo, CreatureData const* data /*= nullptr*/) { // Load creature model (display id) if (data && data->displayid) - return data->displayid; + if (CreatureModel const* model = cinfo->GetModelWithDisplayId(data->displayid)) + return model; - return cinfo->GetRandomValidModelId(); + if (!(cinfo->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER)) + if (CreatureModel const* model = cinfo->GetRandomValidModel()) + return model; + + // Triggers by default receive the invisible model + return cinfo->GetFirstInvisibleModel(); } void ObjectMgr::ChooseCreatureFlags(const CreatureTemplate* cinfo, uint32& npcflag, uint32& unit_flags, uint32& dynamicflags, const CreatureData* data /*= NULL*/) @@ -1563,22 +1547,31 @@ void ObjectMgr::ChooseCreatureFlags(const CreatureTemplate* cinfo, uint32& npcfl } } -CreatureModelInfo const* ObjectMgr::GetCreatureModelRandomGender(uint32* displayID) +CreatureModelInfo const* ObjectMgr::GetCreatureModelRandomGender(CreatureModel* model, CreatureTemplate const* creatureTemplate) const { - CreatureModelInfo const* modelInfo = GetCreatureModelInfo(*displayID); + CreatureModelInfo const* modelInfo = GetCreatureModelInfo(model->CreatureDisplayID); if (!modelInfo) - return NULL; + return nullptr; // If a model for another gender exists, 50% chance to use it if (modelInfo->modelid_other_gender != 0 && urand(0, 1) == 0) { CreatureModelInfo const* minfo_tmp = GetCreatureModelInfo(modelInfo->modelid_other_gender); if (!minfo_tmp) - TC_LOG_ERROR("sql.sql", "Model (Entry: %u) has modelid_other_gender %u not found in table `creature_model_info`. ", *displayID, modelInfo->modelid_other_gender); + TC_LOG_ERROR("sql.sql", "Model (Entry: %u) has modelid_other_gender %u not found in table `creature_model_info`. ", model->CreatureDisplayID, modelInfo->modelid_other_gender); else { - // Model ID changed - *displayID = modelInfo->modelid_other_gender; + // DisplayID changed + model->CreatureDisplayID = modelInfo->modelid_other_gender; + if (creatureTemplate) + { + auto itr = std::find_if(creatureTemplate->Models.begin(), creatureTemplate->Models.end(), [&](CreatureModel const& templateModel) + { + return templateModel.CreatureDisplayID == modelInfo->modelid_other_gender; + }); + if (itr != creatureTemplate->Models.end()) + *model = *itr; + } return minfo_tmp; } } @@ -1606,6 +1599,12 @@ void ObjectMgr::LoadCreatureModelInfo() Field* fields = result->Fetch(); uint32 modelId = fields[0].GetUInt32(); + CreatureDisplayInfoEntry const* creatureDisplay = sCreatureDisplayInfoStore.LookupEntry(modelId); + if (!creatureDisplay) + { + TC_LOG_ERROR("sql.sql", "Table `creature_model_info` has model for nonexistent display id (%u).", modelId); + continue; + } CreatureModelInfo& modelInfo = _creatureModelStore[modelId]; @@ -1613,6 +1612,7 @@ void ObjectMgr::LoadCreatureModelInfo() modelInfo.combat_reach = fields[2].GetFloat(); modelInfo.gender = fields[3].GetUInt8(); modelInfo.modelid_other_gender = fields[4].GetUInt32(); + modelInfo.is_trigger = false; // Checks @@ -1631,6 +1631,9 @@ void ObjectMgr::LoadCreatureModelInfo() modelInfo.modelid_other_gender = 0; } + if (CreatureModelDataEntry const* modelData = sCreatureModelDataStore.LookupEntry(creatureDisplay->ModelID)) + modelInfo.is_trigger = strstr(modelData->ModelName, "INVISIBLESTALKER"); + if (modelInfo.combat_reach < 0.1f) modelInfo.combat_reach = DEFAULT_PLAYER_COMBAT_REACH; @@ -6284,7 +6287,8 @@ void ObjectMgr::GetTaxiPath(uint32 source, uint32 destination, uint32 &path, uin uint32 ObjectMgr::GetTaxiMountDisplayId(uint32 id, uint32 team, bool allowed_alt_team /* = false */) { - uint32 mount_id = 0; + CreatureModel mountModel; + CreatureTemplate const* mount_info = nullptr; // select mount creature id TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(id); @@ -6307,19 +6311,20 @@ uint32 ObjectMgr::GetTaxiMountDisplayId(uint32 id, uint32 team, bool allowed_alt CreatureTemplate const* mount_info = GetCreatureTemplate(mount_entry); if (mount_info) { - mount_id = mount_info->GetRandomValidModelId(); - if (!mount_id) + CreatureModel const* model = mount_info->GetRandomValidModel(); + if (!model) { TC_LOG_ERROR("sql.sql", "No displayid found for the taxi mount with the entry %u! Can't load it!", mount_entry); return 0; } + mountModel = *model; } } // minfo is not actually used but the mount_id was updated - GetCreatureModelRandomGender(&mount_id); + GetCreatureModelRandomGender(&mountModel, mount_info); - return mount_id; + return mountModel.CreatureDisplayID; } Quest const* ObjectMgr::GetQuestTemplate(uint32 quest_id) const @@ -10344,13 +10349,13 @@ GameObjectTemplateAddon const* ObjectMgr::GetGameObjectTemplateAddon(uint32 entr return nullptr; } -CreatureTemplate const* ObjectMgr::GetCreatureTemplate(uint32 entry) +CreatureTemplate const* ObjectMgr::GetCreatureTemplate(uint32 entry) const { CreatureTemplateContainer::const_iterator itr = _creatureTemplateStore.find(entry); if (itr != _creatureTemplateStore.end()) return &(itr->second); - return NULL; + return nullptr; } AreaTriggerTemplate const* ObjectMgr::GetAreaTriggerTemplate(uint32 entry) const diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index d7733742..c41ac893 100644 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -1053,11 +1053,11 @@ class ObjectMgr void LoadGameObjectTemplateAddons(); void AddGameobjectInfo(GameObjectTemplate* goinfo); - CreatureTemplate const* GetCreatureTemplate(uint32 entry); + CreatureTemplate const* GetCreatureTemplate(uint32 entry) const; CreatureTemplateContainer const* GetCreatureTemplates() const { return &_creatureTemplateStore; } - CreatureModelInfo const* GetCreatureModelInfo(uint32 modelId); - CreatureModelInfo const* GetCreatureModelRandomGender(uint32* displayID); - static uint32 ChooseDisplayId(CreatureTemplate const* cinfo, CreatureData const* data = NULL); + CreatureModelInfo const* GetCreatureModelInfo(uint32 modelId) const; + CreatureModelInfo const* GetCreatureModelRandomGender(CreatureModel* model, CreatureTemplate const* creatureTemplate) const; + static CreatureModel const* ChooseDisplayId(CreatureTemplate const* cinfo, CreatureData const* data = nullptr); static void ChooseCreatureFlags(CreatureTemplate const* cinfo, uint32& npcflag, uint32& unit_flags, uint32& dynamicflags, CreatureData const* data = NULL); EquipmentInfo const* GetEquipmentInfo(uint32 entry, int8& id); CreatureAddon const* GetCreatureAddon(uint32 lowguid); @@ -1245,6 +1245,8 @@ class ObjectMgr void LoadCreatureTemplates(); void LoadCreatureTemplateAddons(); void LoadCreatureSparringTemplate(); + void LoadCreatureTemplate(Field* fields); + void LoadCreatureTemplateModels(); void LoadCreatureDifficultyModifiers(); void CheckCreatureTemplate(CreatureTemplate const* cInfo); void CheckCreatureMovement(char const* table, uint64 id, CreatureMovementData& creatureMovement); diff --git a/src/server/game/Handlers/NPCHandler.cpp b/src/server/game/Handlers/NPCHandler.cpp index 0c33a50b..e5447389 100644 --- a/src/server/game/Handlers/NPCHandler.cpp +++ b/src/server/game/Handlers/NPCHandler.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -738,8 +738,17 @@ void WorldSession::SendPetList(ObjectGuid guid, uint8 first, uint8 last) uint8 petStableState = itr.first <= PET_SLOT_ACTIVE_LAST ? 1 : 2; uint32 modelId = 0; + if (CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(petData.Entry)) - modelId = cInfo->Modelid1 ? cInfo->Modelid1 : cInfo->Modelid2; + { + if (CreatureModel const* model1 = cInfo->GetModelByIdx(0)) + modelId = model1->CreatureDisplayID; + else + { + CreatureModel const* model2 = cInfo->GetModelByIdx(1); + modelId = model2->CreatureDisplayID; + } + } buff << uint32(petData.Entry); buff << uint32(_player->GetLevel()); // All pets have equal level diff --git a/src/server/game/Handlers/QueryHandler.cpp b/src/server/game/Handlers/QueryHandler.cpp index 51560b95..50ce6587 100644 --- a/src/server/game/Handlers/QueryHandler.cpp +++ b/src/server/game/Handlers/QueryHandler.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -337,8 +337,15 @@ void WorldSession::HandleCreatureQueryOpcode(WorldPacket& recvData) data.FlushBits(); data << uint32(creatureInfo->KillCredit[0]); // New in 3.1, kill credit - data << uint32(creatureInfo->Modelid4); // Modelid4 - data << uint32(creatureInfo->Modelid2); // Modelid2 + + if (CreatureModel const* model = creatureInfo->GetModelByIdx(3)) + data << uint32(model->CreatureDisplayID); // Modelid4 + else + data << uint32(0); + if (CreatureModel const* model = creatureInfo->GetModelByIdx(1)) + data << uint32(model->CreatureDisplayID); // Modelid2 + else + data << uint32(0); data << uint32(creatureInfo->expansion); // Expansion Required data << uint32(creatureInfo->type); // CreatureType.dbc data << float(creatureInfo->ModHealth); // Hp modifier @@ -351,8 +358,14 @@ void WorldSession::HandleCreatureQueryOpcode(WorldPacket& recvData) if (Title != "") data << Title; // Subname - data << uint32(creatureInfo->Modelid1); // Modelid1 - data << uint32(creatureInfo->Modelid3); // Modelid3 + if (CreatureModel const* model = creatureInfo->GetModelByIdx(0)) + data << uint32(model->CreatureDisplayID); // Modelid1 + else + data << uint32(0); + if (CreatureModel const* model = creatureInfo->GetModelByIdx(2)) + data << uint32(model->CreatureDisplayID); // Modelid3 + else + data << uint32(0); if (creatureInfo->IconName != "") data << creatureInfo->IconName; // "Directions" for guard, string for Icons 2.3.0 diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index ba0ca82a..1e68b5ab 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -2287,8 +2287,9 @@ void AuraEffect::HandleAuraTransform(AuraApplication const* aurApp, uint8 mode, { uint32 modelId = 0; - if (uint32 modelid = ci->GetRandomValidModelId()) - modelId = modelid; // Will use the default model here + // choose a model, based on trigger flag + if (uint32 modelid = ObjectMgr::ChooseDisplayId(ci)->CreatureDisplayID) + modelId = modelid; // Polymorph (sheep) if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_MAGE && GetSpellInfo()->SpellIconID == 82 && GetSpellInfo()->SpellVisual[0] == 12978) @@ -2344,10 +2345,10 @@ void AuraEffect::HandleAuraTransform(AuraApplication const* aurApp, uint8 mode, uint32 cr_id = target->GetAuraEffectsByType(SPELL_AURA_MOUNTED).front()->GetMiscValue(); if (CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(cr_id)) { - uint32 displayID = ObjectMgr::ChooseDisplayId(ci); - sObjectMgr->GetCreatureModelRandomGender(&displayID); + CreatureModel model = *ObjectMgr::ChooseDisplayId(ci); + sObjectMgr->GetCreatureModelRandomGender(&model, ci); - target->SetMountDisplayId(displayID); + target->SetMountDisplayId(model.CreatureDisplayID); } } } @@ -2842,11 +2843,12 @@ void AuraEffect::HandleAuraMounted(AuraApplication const* aurApp, uint8 mode, bo if (CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creatureEntry)) { - displayId = GetMiscValueB() == 2 ? creatureInfo->Modelid2 : creatureInfo->Modelid1; - sObjectMgr->GetCreatureModelRandomGender(&displayId); - vehicleId = creatureInfo->VehicleId; + CreatureModel model = *ObjectMgr::ChooseDisplayId(creatureInfo); + sObjectMgr->GetCreatureModelRandomGender(&model, creatureInfo); + displayId = model.CreatureDisplayID; + //some spell has one aura of mount and one of vehicle for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i) if (GetSpellInfo()->Effects[i].Effect == SPELL_EFFECT_SUMMON @@ -5388,10 +5390,9 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool if (CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creatureEntry)) { - uint32 displayID = ObjectMgr::ChooseDisplayId(creatureInfo); - sObjectMgr->GetCreatureModelRandomGender(&displayID); - - target->SetUInt32Value(UNIT_FIELD_MOUNT_DISPLAY_ID, displayID); + CreatureModel model = *ObjectMgr::ChooseDisplayId(creatureInfo); + sObjectMgr->GetCreatureModelRandomGender(&model, creatureInfo); + target->SetUInt32Value(UNIT_FIELD_MOUNT_DISPLAY_ID, model.CreatureDisplayID); } } break; diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index 4875964d..5ef90c35 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -261,7 +261,7 @@ class npc_commandscript : public CommandScript data.curhealth = 0; data.curmana = 0; data.currentwaypoint = 0; - data.displayid = cinfo->GetFirstValidModelId(); + //data.displayid = cinfo->GetFirstValidModelId(); Not sure need this line here data.dynamicflags = 0; data.equipmentId = 0; data.mapId = trans->GetGOInfo()->moTransport.mapID; diff --git a/src/server/scripts/Commands/cs_reload.cpp b/src/server/scripts/Commands/cs_reload.cpp index 04828968..616ace1d 100644 --- a/src/server/scripts/Commands/cs_reload.cpp +++ b/src/server/scripts/Commands/cs_reload.cpp @@ -476,85 +476,7 @@ class reload_commandscript : public CommandScript TC_LOG_INFO("misc", "Reloading creature template entry %u", entry); Field* fields = result->Fetch(); - - for (uint8 i = 0; i < MAX_TEMPLATE_DIFFICULTY - 1; ++i) - cInfo->DifficultyEntry[i] = fields[0 + i].GetUInt32(); - - for (uint8 i = 0; i < MAX_KILL_CREDIT; ++i) - cInfo->KillCredit[i] = fields[5 + i].GetUInt32(); - - cInfo->Modelid1 = fields[7].GetUInt32(); - cInfo->Modelid2 = fields[8].GetUInt32(); - cInfo->Modelid3 = fields[9].GetUInt32(); - cInfo->Modelid4 = fields[10].GetUInt32(); - cInfo->Name = fields[11].GetString(); - cInfo->SubName = fields[12].GetString(); - cInfo->IconName = fields[13].GetString(); - cInfo->GossipMenuId = fields[14].GetUInt32(); - cInfo->minlevel = fields[15].GetUInt8(); - cInfo->maxlevel = fields[16].GetUInt8(); - cInfo->expansion = fields[17].GetUInt16(); - cInfo->expansionUnknown = fields[18].GetUInt16(); - cInfo->faction = fields[19].GetUInt16(); - cInfo->npcflag = fields[20].GetUInt32(); - cInfo->npcflag2 = fields[21].GetUInt32(); - cInfo->speed_walk = fields[22].GetFloat(); - cInfo->speed_run = fields[23].GetFloat(); - cInfo->scale = fields[24].GetFloat(); - cInfo->rank = fields[25].GetUInt8(); - cInfo->mindmg = fields[26].GetFloat(); - cInfo->maxdmg = fields[27].GetFloat(); - cInfo->dmgschool = fields[28].GetUInt8(); - cInfo->attackpower = fields[29].GetUInt32(); - cInfo->dmg_multiplier = fields[30].GetFloat(); - cInfo->BaseAttackTime = fields[31].GetUInt32(); - cInfo->RangeAttackTime = fields[32].GetUInt32(); - cInfo->unit_class = fields[33].GetUInt8(); - cInfo->unit_flags = fields[34].GetUInt32(); - cInfo->unit_flags2 = fields[35].GetUInt32(); - cInfo->dynamicflags = fields[36].GetUInt32(); - cInfo->family = fields[37].GetUInt8(); - cInfo->trainer_type = fields[38].GetUInt8(); - cInfo->trainer_class = fields[39].GetUInt8(); - cInfo->trainer_race = fields[40].GetUInt8(); - cInfo->minrangedmg = fields[41].GetFloat(); - cInfo->maxrangedmg = fields[42].GetFloat(); - cInfo->rangedattackpower = fields[43].GetUInt16(); - cInfo->type = fields[44].GetUInt8(); - cInfo->type_flags = fields[45].GetUInt32(); - cInfo->type_flags2 = fields[46].GetUInt32(); - cInfo->lootid = fields[47].GetUInt32(); - cInfo->pickpocketLootId = fields[48].GetUInt32(); - cInfo->SkinLootId = fields[49].GetUInt32(); - - for (uint8 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i) - cInfo->resistance[i] = fields[50 + i -1].GetUInt16(); - - for (uint8 i = 0; i < CREATURE_MAX_SPELLS; ++i) - cInfo->spells[i] = fields[56 + i].GetUInt32(); - - cInfo->PetSpellDataId = fields[64].GetUInt32(); - cInfo->VehicleId = fields[65].GetUInt32(); - cInfo->mingold = fields[66].GetUInt32(); - cInfo->maxgold = fields[67].GetUInt32(); - cInfo->AIName = fields[68].GetString(); - cInfo->MovementType = fields[69].GetUInt8(); - cInfo->HoverHeight = fields[70].GetFloat(); - cInfo->ModHealth = fields[71].GetFloat(); - cInfo->ModMana = fields[72].GetFloat(); - cInfo->ModManaExtra = fields[73].GetFloat(); - cInfo->ModArmor = fields[74].GetFloat(); - cInfo->RacialLeader = fields[75].GetBool(); - - for (uint8 i = 0; i < MAX_CREATURE_QUEST_ITEMS; ++i) - cInfo->questItems[i] = fields[76 + i].GetUInt32(); - - cInfo->movementId = fields[82].GetUInt32(); - cInfo->RegenHealth = fields[83].GetBool(); - cInfo->MechanicImmuneMask = fields[84].GetUInt32(); - cInfo->flags_extra = fields[85].GetUInt32(); - cInfo->ScriptID = sObjectMgr->GetScriptId(fields[86].GetCString()); - + sObjectMgr->LoadCreatureTemplate(fields); sObjectMgr->CheckCreatureTemplate(cInfo); } diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp index 562b3da4..5add509c 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -218,7 +218,7 @@ class npc_pure_energy : public CreatureScript { npc_pure_energyAI(Creature* creature) : ScriptedAI(creature) { - me->SetDisplayId(me->GetCreatureTemplate()->Modelid2); + me->SetDisplayFromModel(1); } void Reset() override { } diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp index 6365282c..c695395a 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -357,7 +357,7 @@ struct npc_eye_of_acherus : public ScriptedAI { npc_eye_of_acherus(Creature* creature) : ScriptedAI(creature) { - creature->SetDisplayId(creature->GetCreatureTemplate()->Modelid1); + me->SetDisplayFromModel(0); creature->SetReactState(REACT_PASSIVE); } @@ -1080,7 +1080,7 @@ class npc_scarlet_miner_cart : public CreatureScript npc_scarlet_miner_cartAI(Creature* creature) : PassiveAI(creature), _minerGUID(), _playerGUID() { me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); - me->SetDisplayId(me->GetCreatureTemplate()->Modelid1); // Modelid2 is a horse. + me->SetDisplayFromModel(0); } void JustSummoned(Creature* summon) override diff --git a/src/server/scripts/EasternKingdoms/ScarletHalls/scarlet_halls.cpp b/src/server/scripts/EasternKingdoms/ScarletHalls/scarlet_halls.cpp index eb15de57..868a31eb 100644 --- a/src/server/scripts/EasternKingdoms/ScarletHalls/scarlet_halls.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletHalls/scarlet_halls.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -432,7 +432,7 @@ class npc_commander_lindon : public CreatureScript void JustSummoned(Creature* summon) override { - summon->SetDisplayId(summon->GetCreatureTemplate()->Modelid1); + summon->SetDisplayFromModel(0); } void UpdateAI(uint32 diff) override diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/HourofTwilight/hour_of_twilight.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/HourofTwilight/hour_of_twilight.cpp index c3cbf2cb..0c7e7801 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/HourofTwilight/hour_of_twilight.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/HourofTwilight/hour_of_twilight.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -1952,7 +1952,7 @@ class npc_ice_wall_exit_stalker : public CreatureScript void Reset() override { - me->SetDisplayId(me->GetCreatureTemplate()->Modelid2); + me->SetDisplayFromModel(1); me->SetReactState(REACT_PASSIVE); } diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp index ff46b684..1cfa9b8f 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp @@ -197,7 +197,7 @@ class npc_amanitar_mushrooms : public CreatureScript 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) diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp index 9a1b0299..3b699e1d 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -387,7 +387,7 @@ class npc_taldaram_flamesphere : public CreatureScript { me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetFlying(true); - me->SetDisplayId(me->GetCreatureTemplate()->Modelid1); + me->SetDisplayFromModel(0); me->SetFaction(16); me->SetObjectScale(1.0f); DoCast(me, SPELL_FLAME_SPHERE_VISUAL); diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp index b68cbef3..6897b7e0 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -251,11 +251,11 @@ 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->CombatStart(target); - summoned->SetDisplayId(summoned->GetCreatureTemplate()->Modelid1); + summoned->SetDisplayFromModel(0); Talk(EMOTE_SPIKE, target); break; default: @@ -601,7 +601,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); } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp index fd240dc0..5f073996 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -478,7 +478,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 diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp index 3844b9e5..f50f6353 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -244,7 +244,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); } if (_instance) _instance->SetBossState(BOSS_LICH_KING, IN_PROGRESS); @@ -447,7 +447,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); diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp index 7bf8620f..2113c822 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -1966,7 +1966,7 @@ struct npc_queldelar_weapon : public customCreatureAI isIntro = true; - me->SetDisplayId(me->GetCreatureTemplate()->Modelid2); + me->SetDisplayFromModel(1); Talk(SAY_QUELDELAR_INTRO); z = me->GetPositionZ(); me->OverrideInhabitType(INHABIT_AIR); diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp index e2fe29f9..5a6d8814 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -212,7 +212,7 @@ class npc_chaotic_rift : public CreatureScript { uiChaoticEnergyBurstTimer = 1000; uiSummonCrazedManaWraithTimer = 5000; - me->SetDisplayId(me->GetCreatureTemplate()->Modelid2); + me->SetDisplayFromModel(1); DoCast(me, SPELL_ARCANEFORM, false); } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp index 211f0d39..e8b24738 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -823,7 +823,7 @@ class boss_flame_leviathan_seat : public CreatureScript { ASSERT(vehicle); me->SetReactState(REACT_PASSIVE); - me->SetDisplayId(me->GetCreatureTemplate()->Modelid2); + me->SetDisplayFromModel(1); instance = creature->GetInstanceScript(); } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp index 255c0629..8aaf811b 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp @@ -1739,7 +1739,7 @@ class npc_sun_beam : public CreatureScript { me->SetReactState(REACT_PASSIVE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - me->SetDisplayId(me->GetCreatureTemplate()->Modelid2); + me->SetDisplayFromModel(1); me->DespawnOrUnsummon(12*IN_MILLISECONDS); DoCast(me, SPELL_FREYA_UNSTABLE_ENERGY_VISUAL, true); // visual } @@ -1879,7 +1879,7 @@ class npc_nature_bomb : public CreatureScript _bombTimer = urand(8*IN_MILLISECONDS, 10*IN_MILLISECONDS); DoCast(SPELL_OBJECT_BOMB); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetDisplayId(me->GetCreatureTemplate()->Modelid2); + me->SetDisplayFromModel(1); SetCombatMovement(false); } @@ -1926,7 +1926,7 @@ class npc_unstable_sun_beam : public CreatureScript _despawnTimer = urand(7000, 12000); DoCast(me, SPELL_PHOTOSYNTHESIS); DoCast(me, SPELL_UNSTABLE_SUN_BEAM); - me->SetDisplayId(me->GetCreatureTemplate()->Modelid2); + me->SetDisplayFromModel(1); SetCombatMovement(false); } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp index 90984dcf..c4174fef 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -539,7 +539,7 @@ class npc_flash_freeze : public CreatureScript npc_flash_freezeAI(Creature* creature) : ScriptedAI(creature), instance(me->GetInstanceScript()) { me->SetReactState(REACT_PASSIVE); - me->SetDisplayId(me->GetCreatureTemplate()->Modelid2); + me->SetDisplayFromModel(1); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED | UNIT_FLAG_PACIFIED); SetCombatMovement(false); targetGUID = ObjectGuid::Empty; @@ -599,7 +599,7 @@ class npc_ice_block : public CreatureScript npc_ice_blockAI(Creature* creature) : ScriptedAI(creature), instance(me->GetInstanceScript()) { me->SetReactState(REACT_PASSIVE); - me->SetDisplayId(me->GetCreatureTemplate()->Modelid2); + me->SetDisplayFromModel(1); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED | UNIT_FLAG_PACIFIED); SetCombatMovement(false); targetGUID = ObjectGuid::Empty; @@ -683,7 +683,7 @@ class npc_icicle : public CreatureScript { npc_icicleAI(Creature* creature) : ScriptedAI(creature) { - 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->SetReactState(REACT_PASSIVE); SetCombatMovement(false); @@ -733,7 +733,7 @@ class npc_snowpacked_icicle : public CreatureScript { npc_snowpacked_icicleAI(Creature* creature) : ScriptedAI(creature) { - 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->SetReactState(REACT_PASSIVE); SetCombatMovement(false); @@ -1068,7 +1068,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 diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp index d041a6b0..c2915912 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp @@ -1614,7 +1614,7 @@ class boss_vx_001 : public CreatureScript if (Creature* pTemp = me->SummonCreature(NPC_MIMIRON_FOCUS, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10*IN_MILLISECONDS)) { pTemp->SetReactState(REACT_PASSIVE); - pTemp->SetDisplayId(pTemp->GetCreatureTemplate()->Modelid2); + pTemp->SetDisplayFromModel(1); pTemp->GetMotionMaster()->MoveIdle(); pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); pTemp->CombatStop(); @@ -1630,7 +1630,7 @@ class boss_vx_001 : public CreatureScript if (Creature* pTemp = me->SummonCreature(NPC_MIMIRON_FOCUS, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10*IN_MILLISECONDS)) { pTemp->SetReactState(REACT_PASSIVE); - pTemp->SetDisplayId(pTemp->GetCreatureTemplate()->Modelid2); + pTemp->SetDisplayFromModel(1); pTemp->GetMotionMaster()->MoveIdle(); pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); pTemp->CombatStop(); diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp index b5a0f55a..b2710d29 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -212,7 +212,7 @@ class boss_razorscale_controller : public CreatureScript { boss_razorscale_controllerAI(Creature* creature) : BossAI(creature, DATA_RAZORSCALE_CONTROL) { - me->SetDisplayId(me->GetCreatureTemplate()->Modelid2); + me->SetDisplayFromModel(1); me->SetFlying(true); } @@ -952,7 +952,7 @@ class npc_devouring_flame : public CreatureScript npc_devouring_flameAI(Creature* creature) : ScriptedAI(creature) { me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_PACIFIED); - me->SetDisplayId(me->GetCreatureTemplate()->Modelid2); + me->SetDisplayFromModel(1); me->SetReactState(REACT_PASSIVE); SetCombatMovement(false); } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp index facaf59d..486eba19 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -308,7 +308,7 @@ class npc_thorim_controller : public CreatureScript me->SetReactState(REACT_PASSIVE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NON_ATTACKABLE); _gotActivated = false; - me->SetDisplayId(me->GetCreatureTemplate()->Modelid2); + me->SetDisplayFromModel(1); } void Reset() override @@ -599,7 +599,7 @@ class boss_thorim : public CreatureScript for (uint8 n = 0; n < 7; n++) if (Creature* thunderOrb = me->SummonCreature(NPC_THUNDER_ORB, PosOrbs[n], TEMPSUMMON_CORPSE_DESPAWN)) { - thunderOrb->SetDisplayId(thunderOrb->GetCreatureTemplate()->Modelid2); + thunderOrb->SetDisplayFromModel(1); thunderOrb->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } @@ -1576,7 +1576,7 @@ class npc_runic_smash : public CreatureScript npc_runic_smashAI(Creature* creature) : ScriptedAI(creature) { me->SetReactState(REACT_PASSIVE); - me->SetDisplayId(me->GetCreatureTemplate()->Modelid2); + me->SetDisplayFromModel(1); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); SetCombatMovement(false); } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar_scripts.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar_scripts.cpp index 8fa1f39e..c6d2e500 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar_scripts.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar_scripts.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -60,7 +60,7 @@ class npc_ironwork_cannon : public CreatureScript { npc_ironwork_cannonAI(Creature* creature) : ScriptedAI(creature) { - me->SetDisplayId(me->GetCreatureTemplate()->Modelid2); + me->SetDisplayFromModel(1); me->SetPowerType(POWER_ENERGY); me->SetMaxPower(POWER_ENERGY, 100); me->SetPower(POWER_ENERGY, 100); diff --git a/src/server/scripts/Pandaria/HeartOfFear/boss_garalon.cpp b/src/server/scripts/Pandaria/HeartOfFear/boss_garalon.cpp index 7b209776..57b92598 100644 --- a/src/server/scripts/Pandaria/HeartOfFear/boss_garalon.cpp +++ b/src/server/scripts/Pandaria/HeartOfFear/boss_garalon.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -563,7 +563,7 @@ class npc_garalon_leg : public CreatureScript void Reset() override { me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NOT_SELECTABLE); - me->SetDisplayId(me->GetCreatureTemplate()->Modelid4); + me->SetDisplayFromModel(3); } void DamageTaken(Unit* attacker, uint32& damage) override diff --git a/src/server/scripts/Pandaria/MogushanVault/boss_feng.cpp b/src/server/scripts/Pandaria/MogushanVault/boss_feng.cpp index 64a0d3e0..1bcc3f2d 100644 --- a/src/server/scripts/Pandaria/MogushanVault/boss_feng.cpp +++ b/src/server/scripts/Pandaria/MogushanVault/boss_feng.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -1110,7 +1110,7 @@ class npc_wild_spark : public CreatureScript void InitializeAI() override { instance = me->GetInstanceScript(); - me->SetDisplayId(me->GetCreatureTemplate()->Modelid1); + me->SetDisplayFromModel(0); Reset(); } diff --git a/src/server/scripts/Pandaria/Scenarios/BattleOnTheHighSeas/battle_on_the_high_seas.cpp b/src/server/scripts/Pandaria/Scenarios/BattleOnTheHighSeas/battle_on_the_high_seas.cpp index 11ea01ce..ab5c9b59 100644 --- a/src/server/scripts/Pandaria/Scenarios/BattleOnTheHighSeas/battle_on_the_high_seas.cpp +++ b/src/server/scripts/Pandaria/Scenarios/BattleOnTheHighSeas/battle_on_the_high_seas.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -948,7 +948,7 @@ struct npc_high_seas_explosive_barrel_trigger : public ScriptedAI void Reset() override { - me->SetDisplayId(me->GetCreatureTemplate()->Modelid2); + me->SetDisplayFromModel(1); } void UpdateAI(uint32 /*diff*/) override { } @@ -1127,7 +1127,7 @@ struct npc_high_seas_net_climber : public ScriptedAI void Reset() override { - me->SetDisplayId(me->GetCreatureTemplate()->Modelid2); + me->SetDisplayFromModel(1); scheduler .Schedule(Milliseconds(1000), [this](TaskContext context) diff --git a/src/server/scripts/Pandaria/Scenarios/BrewingStorm/brewing_storm.cpp b/src/server/scripts/Pandaria/Scenarios/BrewingStorm/brewing_storm.cpp index 81e69669..7394d618 100644 --- a/src/server/scripts/Pandaria/Scenarios/BrewingStorm/brewing_storm.cpp +++ b/src/server/scripts/Pandaria/Scenarios/BrewingStorm/brewing_storm.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -588,7 +588,7 @@ struct npc_viletongue_stalker : public ScriptedAI void Reset() override { - me->SetDisplayId(me->GetCreatureTemplate()->Modelid2); + me->SetDisplayFromModel(1); } void DoAction(int32 actionId) override diff --git a/src/server/scripts/Pandaria/Scenarios/IsleOfThunder/isle_of_thunder.cpp b/src/server/scripts/Pandaria/Scenarios/IsleOfThunder/isle_of_thunder.cpp index 727f90c0..72f51e6f 100644 --- a/src/server/scripts/Pandaria/Scenarios/IsleOfThunder/isle_of_thunder.cpp +++ b/src/server/scripts/Pandaria/Scenarios/IsleOfThunder/isle_of_thunder.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -3886,7 +3886,7 @@ struct npc_huseng_gatekeeper : public customCreatureAI void JustSummoned(Creature* summon) override { - summon->SetDisplayId(summon->GetCreatureTemplate()->Modelid2); + summon->SetDisplayFromModel(1); summons.Summon(summon); diff --git a/src/server/scripts/Pandaria/Scenarios/IsleOfThunder/thunder_king_citadel.cpp b/src/server/scripts/Pandaria/Scenarios/IsleOfThunder/thunder_king_citadel.cpp index 0b3f55b5..1d124a44 100644 --- a/src/server/scripts/Pandaria/Scenarios/IsleOfThunder/thunder_king_citadel.cpp +++ b/src/server/scripts/Pandaria/Scenarios/IsleOfThunder/thunder_king_citadel.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -172,7 +172,7 @@ struct npc_thunder_king_treasure_stasis_rune : public ScriptedAI void InitializeAI() override { - me->SetDisplayId(me->GetCreatureTemplate()->Modelid1); + me->SetDisplayFromModel(0); hasTriggered = false; @@ -212,7 +212,7 @@ struct npc_thunder_king_treasure_speed_rune : public ScriptedAI void InitializeAI() override { - me->SetDisplayId(me->GetCreatureTemplate()->Modelid1); + me->SetDisplayFromModel(0); scheduler .Schedule(Seconds(1), [this](TaskContext context) diff --git a/src/server/scripts/Pandaria/Scenarios/SecretsOfRagefire/instance_secrets_of_ragefire.cpp b/src/server/scripts/Pandaria/Scenarios/SecretsOfRagefire/instance_secrets_of_ragefire.cpp index 1ed85c80..c22a5fbd 100644 --- a/src/server/scripts/Pandaria/Scenarios/SecretsOfRagefire/instance_secrets_of_ragefire.cpp +++ b/src/server/scripts/Pandaria/Scenarios/SecretsOfRagefire/instance_secrets_of_ragefire.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/src/server/scripts/Pandaria/Scenarios/SecretsOfRagefire/secrets_of_ragefire.cpp b/src/server/scripts/Pandaria/Scenarios/SecretsOfRagefire/secrets_of_ragefire.cpp index 7562383f..b025e27d 100644 --- a/src/server/scripts/Pandaria/Scenarios/SecretsOfRagefire/secrets_of_ragefire.cpp +++ b/src/server/scripts/Pandaria/Scenarios/SecretsOfRagefire/secrets_of_ragefire.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -1046,7 +1046,7 @@ struct npc_ragefire_investigated_item : public ScriptedAI void Reset() override { - me->SetDisplayId(me->GetCreatureTemplate()->Modelid2); + me->SetDisplayFromModel(1); if (me->GetEntry() == NPC_PANDARIA_ARTIFACTS) me->SetObjectScale(2.0f); @@ -1474,7 +1474,7 @@ struct npc_ragefire_shattered_earth : public ScriptedAI void Reset() override { - me->SetDisplayId(me->GetCreatureTemplate()->Modelid2); + me->SetDisplayFromModel(1); DoCast(me, SPELL_SHATTERED_EARTH); } diff --git a/src/server/scripts/Pandaria/Scenarios/UngaIngoo/instance_unga_ingoo.cpp b/src/server/scripts/Pandaria/Scenarios/UngaIngoo/instance_unga_ingoo.cpp index 980c6ef7..ef3a96f4 100644 --- a/src/server/scripts/Pandaria/Scenarios/UngaIngoo/instance_unga_ingoo.cpp +++ b/src/server/scripts/Pandaria/Scenarios/UngaIngoo/instance_unga_ingoo.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -133,7 +133,7 @@ class instance_unga_ingoo : public InstanceMapScript case NPC_BUNNY_ZTO_2: case NPC_BUNNY_ZTO: case NPC_HOZEN_SWING: - creature->SetDisplayId(creature->GetCreatureTemplate()->Modelid2); + creature->SetDisplayFromModel(1); break; case NPC_OOKIE: case NPC_CHIHOZEN_BINONO: diff --git a/src/server/scripts/Pandaria/Scenarios/UngaIngoo/unga_ingoo.cpp b/src/server/scripts/Pandaria/Scenarios/UngaIngoo/unga_ingoo.cpp index 8e16d16c..993b1d72 100644 --- a/src/server/scripts/Pandaria/Scenarios/UngaIngoo/unga_ingoo.cpp +++ b/src/server/scripts/Pandaria/Scenarios/UngaIngoo/unga_ingoo.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/src/server/scripts/Pandaria/SiegeOfOrgrimmar/boss_fallen_protectors.cpp b/src/server/scripts/Pandaria/SiegeOfOrgrimmar/boss_fallen_protectors.cpp index 5ae788b2..4ac62901 100644 --- a/src/server/scripts/Pandaria/SiegeOfOrgrimmar/boss_fallen_protectors.cpp +++ b/src/server/scripts/Pandaria/SiegeOfOrgrimmar/boss_fallen_protectors.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -2083,7 +2083,7 @@ struct npc_golden_lotus_trigger : public ScriptedAI void Reset() override { - me->SetDisplayId(me->GetCreatureTemplate()->Modelid2); + me->SetDisplayFromModel(1); scheduler .Schedule(Milliseconds(2500), [this](TaskContext context) diff --git a/src/server/scripts/Pandaria/SiegeOfOrgrimmar/boss_galakras.cpp b/src/server/scripts/Pandaria/SiegeOfOrgrimmar/boss_galakras.cpp index 2bccc692..342a203c 100644 --- a/src/server/scripts/Pandaria/SiegeOfOrgrimmar/boss_galakras.cpp +++ b/src/server/scripts/Pandaria/SiegeOfOrgrimmar/boss_galakras.cpp @@ -1716,7 +1716,7 @@ struct npc_galakras_dragonmaw_war_banner : public ScriptedAI void Reset() override { me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true); - me->SetDisplayId(me->GetCreatureTemplate()->Modelid1); + me->SetDisplayFromModel(0); DoCast(me, SPELL_WAR_BANNER_AT); } void EnterEvadeMode() override { } diff --git a/src/server/scripts/Pandaria/SiegeOfOrgrimmar/boss_iron_juggernaut.cpp b/src/server/scripts/Pandaria/SiegeOfOrgrimmar/boss_iron_juggernaut.cpp index 81650380..1ba6b50b 100644 --- a/src/server/scripts/Pandaria/SiegeOfOrgrimmar/boss_iron_juggernaut.cpp +++ b/src/server/scripts/Pandaria/SiegeOfOrgrimmar/boss_iron_juggernaut.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -592,7 +592,7 @@ struct npc_juggernaut_crawler_mine_clicker : public ScriptedAI if (Creature* juggernaut = ObjectAccessor::GetCreature(*me, me->GetInstanceScript() ? me->GetInstanceScript()->GetGuidData(DATA_IRON_JUGGERNAUT) : ObjectGuid::Empty)) juggernaut->AI()->JustSummoned(me); - me->SetDisplayId(me->GetCreatureTemplate()->Modelid1); + me->SetDisplayFromModel(0); } void UpdateAI(uint32 /*diff*/) override { } @@ -619,7 +619,7 @@ struct npc_borer_drill : public ScriptedAI void Reset() override { - me->SetDisplayId(me->GetCreatureTemplate()->Modelid1); + me->SetDisplayFromModel(0); DoCast(me, SPELL_BORER_DRILL_MAIN_AT, true); scheduler @@ -664,7 +664,7 @@ struct npc_juggernaut_explosive_tar : public ScriptedAI void Reset() override { - me->SetDisplayId(me->GetCreatureTemplate()->Modelid1); + me->SetDisplayFromModel(0); DoCast(me, SPELL_EXPLOSIVE_TAR_AT, true); DoCast(me, SPELL_EXPLOSIVE_TAR_VISUAL, true); hasDestroyed = false; @@ -694,7 +694,7 @@ struct npc_juggernaut_cutter_laser : public ScriptedAI void IsSummonedBy(Unit* summoner) override { - me->SetDisplayId(me->GetCreatureTemplate()->Modelid1); + me->SetDisplayFromModel(0); if (Creature* juggernaut = ObjectAccessor::GetCreature(*me, me->GetInstanceScript() ? me->GetInstanceScript()->GetGuidData(DATA_IRON_JUGGERNAUT) : ObjectGuid::Empty)) juggernaut->AI()->JustSummoned(me); diff --git a/src/server/scripts/Pandaria/SiegeOfOrgrimmar/boss_norushen.cpp b/src/server/scripts/Pandaria/SiegeOfOrgrimmar/boss_norushen.cpp index 4f8f77f5..898efa89 100644 --- a/src/server/scripts/Pandaria/SiegeOfOrgrimmar/boss_norushen.cpp +++ b/src/server/scripts/Pandaria/SiegeOfOrgrimmar/boss_norushen.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -1491,7 +1491,7 @@ struct npc_blind_hatred : public ScriptedAI void Reset() override { - me->SetDisplayId(me->GetCreatureTemplate()->Modelid1); + me->SetDisplayFromModel(0); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); me->SetReactState(REACT_PASSIVE); DoCast(me, SPELL_BLIND_HATRED_NPC_VIS, true); diff --git a/src/server/scripts/Pandaria/SiegeOfOrgrimmar/boss_paragons_of_the_klaxxi.cpp b/src/server/scripts/Pandaria/SiegeOfOrgrimmar/boss_paragons_of_the_klaxxi.cpp index 01b65b5b..e84dd82e 100644 --- a/src/server/scripts/Pandaria/SiegeOfOrgrimmar/boss_paragons_of_the_klaxxi.cpp +++ b/src/server/scripts/Pandaria/SiegeOfOrgrimmar/boss_paragons_of_the_klaxxi.cpp @@ -4694,7 +4694,8 @@ class spell_paragons_award : public AuraScript target->SetTitle(title); if (auto creat = sObjectMgr->GetCreatureTemplate(GetSpellInfo()->Effects[EFFECT_0].MiscValue)) - target->SetDisplayId(creat->Modelid1); + target->SetDisplayId(creat->GetModelByIdx(0)->CreatureDisplayID); + } void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) diff --git a/src/server/scripts/Pandaria/SiegeOfOrgrimmar/boss_sha_of_pride.cpp b/src/server/scripts/Pandaria/SiegeOfOrgrimmar/boss_sha_of_pride.cpp index 57f7322e..b1593eb1 100644 --- a/src/server/scripts/Pandaria/SiegeOfOrgrimmar/boss_sha_of_pride.cpp +++ b/src/server/scripts/Pandaria/SiegeOfOrgrimmar/boss_sha_of_pride.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -975,7 +975,7 @@ struct npc_rift_of_corruption : public ScriptedAI void Reset() override { - me->SetDisplayId(me->GetCreatureTemplate()->Modelid1); + me->SetDisplayFromModel(0); DoCast(me, SPELL_RIFT_OF_CORRUPTION_VIS); DoCast(me, SPELL_BOLT_OF_CORRUPTION_DUMMY); DoCast(me, SPELL_RIFT_OF_CORRUPTION_AT); diff --git a/src/server/scripts/Pandaria/SiegeOfOrgrimmar/boss_siegecrafter_blackfuse.cpp b/src/server/scripts/Pandaria/SiegeOfOrgrimmar/boss_siegecrafter_blackfuse.cpp index 804aa817..708447ce 100644 --- a/src/server/scripts/Pandaria/SiegeOfOrgrimmar/boss_siegecrafter_blackfuse.cpp +++ b/src/server/scripts/Pandaria/SiegeOfOrgrimmar/boss_siegecrafter_blackfuse.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -1631,7 +1631,7 @@ struct npc_soo_activated_weapons_type : public ScriptedAI //me->SetName(normalInfo->Name); if (normalInfo) - me->SetDisplayId(normalInfo->Modelid1); + me->SetDisplayId(normalInfo->GetModelByIdx(0)->CreatureDisplayID); me->AddAura(SPELL_OVERCHARGED_WEAPON_VISUAL, me); // not need announe it in DBM uint32 maxHealthByDefault = me->GetMaxHealth(); @@ -2182,7 +2182,7 @@ struct npc_siegecrafter_shockwave_missle_trigger : public ScriptedAI void Reset() override { - me->SetDisplayId(me->GetEntry() == NPC_LASER_ARRAY_TARGET_VEHICLE ? me->GetCreatureTemplate()->Modelid2 : me->GetCreatureTemplate()->Modelid1); + me->SetDisplayFromModel(me->GetEntry() == NPC_LASER_ARRAY_TARGET_VEHICLE ? 1 : 0); } }; @@ -2956,7 +2956,7 @@ class spell_siegecrafter_overcharge_weapon : public SpellScript //target->SetName(normalInfo->Name); if (normalInfo) - target->SetDisplayId(normalInfo->Modelid1); + target->SetDisplayId(normalInfo->GetModelByIdx(0)->CreatureDisplayID); } // Speical Announce about overcharged weapon diff --git a/src/server/scripts/Pandaria/SiegeOfOrgrimmar/boss_spoils_of_pandaria.cpp b/src/server/scripts/Pandaria/SiegeOfOrgrimmar/boss_spoils_of_pandaria.cpp index 2c1baf35..0d419b50 100644 --- a/src/server/scripts/Pandaria/SiegeOfOrgrimmar/boss_spoils_of_pandaria.cpp +++ b/src/server/scripts/Pandaria/SiegeOfOrgrimmar/boss_spoils_of_pandaria.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -1755,7 +1755,7 @@ struct npc_spoils_lift_hook : public ScriptedAI void Reset() override { - me->SetDisplayId(me->GetCreatureTemplate()->Modelid2); + me->SetDisplayFromModel(1); me->SetFlag(UNIT_FIELD_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); hasPassenger = false; clickerGUID = ObjectGuid::Empty; @@ -2248,7 +2248,7 @@ struct npc_spoils_pandarens_gift : public ScriptedAI void IsSummonedBy(Unit* summoner) override { if (summoner->ToCreature()) - me->SetDisplayId(summoner->ToCreature()->GetCreatureTemplate()->Modelid1); // for visible, no data in sniffs more than it (should`ve a green weapon under circle like me remember) + me->SetDisplayId(summoner->ToCreature()->GetCreatureTemplate()->GetModelByIdx(0)->CreatureDisplayID); // for visible, no data in sniffs more than it (should`ve a green weapon under circle like me remember) summonerEntry = summoner->GetEntry(); diff --git a/src/server/scripts/Pandaria/SiegeOfOrgrimmar/boss_thok_the_bloodthirsty.cpp b/src/server/scripts/Pandaria/SiegeOfOrgrimmar/boss_thok_the_bloodthirsty.cpp index a4954a56..f23accba 100644 --- a/src/server/scripts/Pandaria/SiegeOfOrgrimmar/boss_thok_the_bloodthirsty.cpp +++ b/src/server/scripts/Pandaria/SiegeOfOrgrimmar/boss_thok_the_bloodthirsty.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -1131,7 +1131,7 @@ struct npc_thok_ice_tomb : public ScriptedAI if (Creature* thok = ObjectAccessor::GetCreature(*me, me->GetInstanceScript() ? me->GetInstanceScript()->GetGuidData(DATA_THOK_THE_BLOODTHIRSTY) : ObjectGuid::Empty)) thok->AI()->JustSummoned(me); - me->SetDisplayId(me->GetCreatureTemplate()->Modelid2); + me->SetDisplayFromModel(1); ownerGUID = summoner->GetGUID(); summoner->CastSpell(summoner, SPELL_SUMMON_ICE_TOMB_STUN, true); diff --git a/src/server/scripts/Pandaria/SiegeOfOrgrimmar/instance_siege_of_orgrimmar.cpp b/src/server/scripts/Pandaria/SiegeOfOrgrimmar/instance_siege_of_orgrimmar.cpp index 891ca8ca..19c8f1d2 100644 --- a/src/server/scripts/Pandaria/SiegeOfOrgrimmar/instance_siege_of_orgrimmar.cpp +++ b/src/server/scripts/Pandaria/SiegeOfOrgrimmar/instance_siege_of_orgrimmar.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -705,7 +705,7 @@ class instance_siege_of_orgrimmar : public InstanceMapScript zealGUID = creature->GetGUID(); break; case NPC_PORTAL_TO_ORGRIMMAR: - creature->SetDisplayId(creature->GetCreatureTemplate()->Modelid3); + creature->SetDisplayFromModel(2); break; case NPC_LORTHEMAR_THERON: lorthemarGUID = creature->GetGUID(); @@ -804,7 +804,7 @@ class instance_siege_of_orgrimmar : public InstanceMapScript norushenRoomGUID = creature->GetGUID(); break; case NPC_BLOOD_POOL: - creature->SetDisplayId(creature->GetCreatureTemplate()->Modelid1); + creature->SetDisplayFromModel(0); break; case NPC_EMBODIED_ANGUISH: anguishGUID = creature->GetGUID(); @@ -843,7 +843,7 @@ class instance_siege_of_orgrimmar : public InstanceMapScript miasmaGUID = creature->GetGUID(); break; case NPC_SLG_GENERIC_MOP: - creature->SetDisplayId(creature->GetCreatureTemplate()->Modelid2); + creature->SetDisplayFromModel(1); break; case NPC_AKOLIK: akolikGUID = creature->GetGUID(); diff --git a/src/server/scripts/Pandaria/SiegeOfOrgrimmar/siege_of_orgrimmar.cpp b/src/server/scripts/Pandaria/SiegeOfOrgrimmar/siege_of_orgrimmar.cpp index 75fa2625..fb5e7d10 100644 --- a/src/server/scripts/Pandaria/SiegeOfOrgrimmar/siege_of_orgrimmar.cpp +++ b/src/server/scripts/Pandaria/SiegeOfOrgrimmar/siege_of_orgrimmar.cpp @@ -4798,7 +4798,7 @@ struct npc_siege_of_orgrimmar_sha_cloud : public ScriptedAI void Reset() override { me->SetFlag(UNIT_FIELD_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); - me->SetDisplayId(me->GetCreatureTemplate()->Modelid2); + me->SetDisplayFromModel(1); } void OnSpellClick(Unit* clicker, bool& /*result*/) override diff --git a/src/server/scripts/Pandaria/ThroneOfThunder/boss_council_of_elders.cpp b/src/server/scripts/Pandaria/ThroneOfThunder/boss_council_of_elders.cpp index 93ed079d..d498ddf9 100644 --- a/src/server/scripts/Pandaria/ThroneOfThunder/boss_council_of_elders.cpp +++ b/src/server/scripts/Pandaria/ThroneOfThunder/boss_council_of_elders.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -1631,7 +1631,7 @@ struct npc_council_reckless_charge : public ScriptedAI void IsSummonedBy(Unit* summoner) override { - me->SetDisplayId(me->GetCreatureTemplate()->Modelid2); + me->SetDisplayFromModel(1); if (Creature* kazrajin = ObjectAccessor::GetCreature(*me, me->GetInstanceScript() ? me->GetInstanceScript()->GetGuidData(NPC_COUNCIL_KAZRAJIN) : ObjectGuid::Empty)) { diff --git a/src/server/scripts/Pandaria/ThroneOfThunder/boss_dark_animus.cpp b/src/server/scripts/Pandaria/ThroneOfThunder/boss_dark_animus.cpp index 7c8c2b5c..d21eb613 100644 --- a/src/server/scripts/Pandaria/ThroneOfThunder/boss_dark_animus.cpp +++ b/src/server/scripts/Pandaria/ThroneOfThunder/boss_dark_animus.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -391,7 +391,7 @@ class npc_anima_orb : public CreatureScript void InitializeAI() override { me->setActive(true); - me->SetDisplayId(me->GetCreatureTemplate()->Modelid2); + me->SetDisplayFromModel(1); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); me->SetFlag(UNIT_FIELD_FLAGS2, UNIT_FLAG2_DISABLE_TURN); me->SetReactState(REACT_PASSIVE); @@ -412,7 +412,7 @@ class npc_anima_orb : public CreatureScript if (instance && instance->GetBossState(DATA_DARK_ANIMUS) == DONE) return; - me->SetDisplayId(me->GetCreatureTemplate()->Modelid2); + me->SetDisplayFromModel(1); DoCast(me, SPELL_ANIMA_ORB_VISUAL, true); me->SetFaction(14); me->SetMaxHealth(1); diff --git a/src/server/scripts/Pandaria/ThroneOfThunder/boss_horridon.cpp b/src/server/scripts/Pandaria/ThroneOfThunder/boss_horridon.cpp index 26e6c62f..e399f1f6 100644 --- a/src/server/scripts/Pandaria/ThroneOfThunder/boss_horridon.cpp +++ b/src/server/scripts/Pandaria/ThroneOfThunder/boss_horridon.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -1752,7 +1752,7 @@ struct npc_living_poison : public ScriptedAI void IsSummonedBy(Unit* summoner) override { - me->SetDisplayId(me->GetCreatureTemplate()->Modelid2); + me->SetDisplayFromModel(1); me->SetReactState(REACT_PASSIVE); me->AddAura(SPELL_LIVING_POISON_PERIODIC, me); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED); diff --git a/src/server/scripts/Pandaria/ThroneOfThunder/boss_iron_qon.cpp b/src/server/scripts/Pandaria/ThroneOfThunder/boss_iron_qon.cpp index ddcd11ad..06342bcb 100644 --- a/src/server/scripts/Pandaria/ThroneOfThunder/boss_iron_qon.cpp +++ b/src/server/scripts/Pandaria/ThroneOfThunder/boss_iron_qon.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -1267,7 +1267,7 @@ struct npc_rushing_wind : public ScriptedAI void IsSummonedBy(Unit* summoner) override { instance = me->GetInstanceScript(); - me->SetDisplayId(me->GetCreatureTemplate()->Modelid1); + me->SetDisplayFromModel(0); if (Creature* ironQon = ObjectAccessor::GetCreature(*me, instance ? instance->GetGuidData(DATA_IRON_QON) : ObjectGuid::Empty)) { diff --git a/src/server/scripts/Pandaria/ThroneOfThunder/boss_jikun.cpp b/src/server/scripts/Pandaria/ThroneOfThunder/boss_jikun.cpp index bf61dfd4..0175254a 100644 --- a/src/server/scripts/Pandaria/ThroneOfThunder/boss_jikun.cpp +++ b/src/server/scripts/Pandaria/ThroneOfThunder/boss_jikun.cpp @@ -845,7 +845,7 @@ struct npc_fall_catcher_jikun : public ScriptedAI void IsSummonedBy(Unit* summoner) override { - me->SetDisplayId(me->GetCreatureTemplate()->Modelid2); + me->SetDisplayFromModel(1); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); summonerGUID = summoner->GetGUID(); x = 0.0f; y = 0.0f; @@ -891,7 +891,7 @@ struct npc_jikun_feed : public ScriptedAI void IsSummonedBy(Unit* summoner) override { slimedGUIDs.clear(); - me->SetDisplayId(me->GetCreatureTemplate()->Modelid2); + me->SetDisplayFromModel(1); if (Creature* jiKun = ObjectAccessor::GetCreature(*me, me->GetInstanceScript() ? me->GetInstanceScript()->GetGuidData(DATA_JI_KUN) : ObjectGuid::Empty)) jiKun->AI()->JustSummoned(me); diff --git a/src/server/scripts/Pandaria/ThroneOfThunder/boss_jinrokh.cpp b/src/server/scripts/Pandaria/ThroneOfThunder/boss_jinrokh.cpp index 1ac5e5f5..4121587e 100644 --- a/src/server/scripts/Pandaria/ThroneOfThunder/boss_jinrokh.cpp +++ b/src/server/scripts/Pandaria/ThroneOfThunder/boss_jinrokh.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -615,7 +615,7 @@ struct npc_lightning_fissure : public ScriptedAI void IsSummonedBy(Unit* summoner) override { instance = me->GetInstanceScript(); - me->SetDisplayId(me->GetCreatureTemplate()->Modelid2); + me->SetDisplayFromModel(1); DoCast(me, SPELL_LIGHTNING_FISSURE_VISUAL, true); scheduler @@ -1387,7 +1387,7 @@ class npc_lightning_storm_bunny : public CreatureScript void IsSummonedBy(Unit* summoner) override { - me->SetDisplayId(me->GetCreatureTemplate()->Modelid2); + me->SetDisplayFromModel(1); DoCast(me, SPELL_LIGHTNING_STRIKE_VISUAL, true); nonCombatEvents.ScheduleEvent(EVENT_LAUNCH, 4 * IN_MILLISECONDS); } diff --git a/src/server/scripts/Pandaria/ThroneOfThunder/boss_megaera.cpp b/src/server/scripts/Pandaria/ThroneOfThunder/boss_megaera.cpp index adc56f11..3e2bcc18 100644 --- a/src/server/scripts/Pandaria/ThroneOfThunder/boss_megaera.cpp +++ b/src/server/scripts/Pandaria/ThroneOfThunder/boss_megaera.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -250,7 +250,7 @@ class boss_megaera : public CreatureScript boss_megaeraAI(Creature* creature) : BossAI(creature, DATA_MEGAERA) { me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetDisplayId(me->GetCreatureTemplate()->Modelid2); + me->SetDisplayFromModel(1); // delay for init me->m_Events.Schedule(1500, [this]() diff --git a/src/server/scripts/Pandaria/ThroneOfThunder/boss_tortos.cpp b/src/server/scripts/Pandaria/ThroneOfThunder/boss_tortos.cpp index 6657febc..93a67095 100644 --- a/src/server/scripts/Pandaria/ThroneOfThunder/boss_tortos.cpp +++ b/src/server/scripts/Pandaria/ThroneOfThunder/boss_tortos.cpp @@ -635,7 +635,7 @@ class npc_rockfall_tortos : public CreatureScript void IsSummonedBy(Unit* /*summoner*/) override { Reset(); - me->SetDisplayId(me->GetCreatureTemplate()->Modelid1); + me->SetDisplayFromModel(0); DoCast(me, SPELL_ROCKFALL, true); me->DespawnOrUnsummon(10000); } diff --git a/src/server/scripts/Pandaria/ThroneOfThunder/boss_twin_consorts.cpp b/src/server/scripts/Pandaria/ThroneOfThunder/boss_twin_consorts.cpp index f0351745..fcc11f06 100644 --- a/src/server/scripts/Pandaria/ThroneOfThunder/boss_twin_consorts.cpp +++ b/src/server/scripts/Pandaria/ThroneOfThunder/boss_twin_consorts.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -1350,7 +1350,7 @@ struct npc_celestial_star : public ScriptedAI isNext = 1; } - me->SetDisplayId(me->GetCreatureTemplate()->Modelid2); + me->SetDisplayFromModel(1); DoCast(me, SPELL_STAR_STATE_INACTIVE, true); DoCast(me, invStarSequenceType.find(sequenceValue - 1)->second[0], true); } @@ -1449,7 +1449,7 @@ struct npc_crashing_star : public ScriptedAI void Reset() override { - me->SetDisplayId(me->GetCreatureTemplate()->Modelid2); + me->SetDisplayFromModel(1); DoCast(me, SPELL_STAR_STATE_INACTIVE, true); } diff --git a/src/server/scripts/Pandaria/ThroneOfThunder/instance_throne_of_thunder.cpp b/src/server/scripts/Pandaria/ThroneOfThunder/instance_throne_of_thunder.cpp index d14a05e4..07223ba0 100644 --- a/src/server/scripts/Pandaria/ThroneOfThunder/instance_throne_of_thunder.cpp +++ b/src/server/scripts/Pandaria/ThroneOfThunder/instance_throne_of_thunder.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -487,14 +487,14 @@ class instance_throne_of_thunder : public InstanceMapScript overchargeConduitGUID = creature->GetGUID(); break; case NPC_EXIT_CHAMBER: - creature->SetDisplayId(creature->GetCreatureTemplate()->Modelid2); + creature->SetDisplayFromModel(1); chamberExitGUID = creature->GetGUID(); if (GetData(DATA_JI_KUN_EVENT)) creature->CastSpell(creature, SPELL_EXIT_CHAMBER_AT, true); break; case NPC_SLG_GENERIC_MOP: - creature->SetDisplayId(creature->GetCreatureTemplate()->Modelid2); + creature->SetDisplayFromModel(1); if (creature->GetPositionZ() < -194.0f) megaeraAnnouncerGUID = creature->GetGUID(); @@ -516,7 +516,7 @@ class instance_throne_of_thunder : public InstanceMapScript case NPC_SPLASH_GRATE: case NPC_GARAJAL_THRASH_SOUL: case NPC_INVIS_STALKER_UNK: - creature->SetDisplayId(creature->GetCreatureTemplate()->Modelid2); + creature->SetDisplayFromModel(1); break; case NPC_FADED_IMAGE_OF_CHI_JI: fadedChijiGUID = creature->GetGUID(); diff --git a/src/server/scripts/Pandaria/zone_the_jade_forest.cpp b/src/server/scripts/Pandaria/zone_the_jade_forest.cpp index 3d75c31c..72fef8fe 100644 --- a/src/server/scripts/Pandaria/zone_the_jade_forest.cpp +++ b/src/server/scripts/Pandaria/zone_the_jade_forest.cpp @@ -353,7 +353,7 @@ class npc_kraxik_tornado : public CreatureScript void Reset() override { - me->SetDisplayId(me->GetCreatureTemplate()->Modelid1); + me->SetDisplayFromModel(0); me->SetReactState(REACT_PASSIVE); me->CastSpell(me, SPELL_TORNADO_DMG); diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index a9d42a9a..32d1822b 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -4337,7 +4337,10 @@ class spell_gen_flesh_to_stone : public AuraScript { if (Unit* owner = GetUnitOwner()) if (CreatureTemplate const* creatureTemplate = sObjectMgr->GetCreatureTemplate(aurEff->GetMiscValue())) - owner->SetDisplayId(creatureTemplate->Modelid2); + { + CreatureModel const* model2 = creatureTemplate->GetModelByIdx(1); + owner->SetDisplayId(model2->CreatureDisplayID); + } } void HandleRemoveEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index 6bdd7f37..71e87729 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -3378,7 +3378,7 @@ class spell_item_potion_of_illusion : public SpellScript if (!model) return true; - if (strstr(model->ModelPath[LOCALE_enUS], "INVISIBLESTALKER")) + if (strstr(model->ModelName, "INVISIBLESTALKER")) return true; return false; diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index 9ab2626f..96bde648 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -3288,7 +3288,7 @@ struct npc_pandaren_firework_launcher : public ScriptedAI void Reset() override { - me->SetDisplayId(me->GetCreatureTemplate()->Modelid2); + me->SetDisplayFromModel(1); scheduler .Schedule(Milliseconds(500), [this](TaskContext context) From 607b1abce17d81dfe9f143034af65f61c6ac5ef3 Mon Sep 17 00:00:00 2001 From: lee Date: Sun, 11 Aug 2024 22:18:58 +0800 Subject: [PATCH 3/3] Rename SQL --- .../world/{2024_08_XX_XX_world.sql => 2024_08_11_00_world.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sql/updates/world/{2024_08_XX_XX_world.sql => 2024_08_11_00_world.sql} (100%) diff --git a/sql/updates/world/2024_08_XX_XX_world.sql b/sql/updates/world/2024_08_11_00_world.sql similarity index 100% rename from sql/updates/world/2024_08_XX_XX_world.sql rename to sql/updates/world/2024_08_11_00_world.sql