diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bindings/scripts/scripts/zone/ulduar/ulduar/boss_flame_leviathan.cpp | 2 | ||||
-rw-r--r-- | src/game/CharacterHandler.cpp | 4 | ||||
-rw-r--r-- | src/game/Creature.cpp | 55 | ||||
-rw-r--r-- | src/game/Creature.h | 6 | ||||
-rw-r--r-- | src/game/CreatureEventAI.cpp | 5 | ||||
-rw-r--r-- | src/game/GameEventMgr.cpp | 1 | ||||
-rw-r--r-- | src/game/Object.cpp | 8 | ||||
-rw-r--r-- | src/game/ObjectMgr.cpp | 176 | ||||
-rw-r--r-- | src/game/ObjectMgr.h | 2 | ||||
-rw-r--r-- | src/game/Player.cpp | 8 | ||||
-rw-r--r-- | src/game/QueryHandler.cpp | 8 | ||||
-rw-r--r-- | src/game/TaxiHandler.cpp | 20 | ||||
-rw-r--r-- | src/game/Totem.cpp | 24 | ||||
-rw-r--r-- | src/game/WorldSession.h | 2 |
14 files changed, 195 insertions, 126 deletions
diff --git a/src/bindings/scripts/scripts/zone/ulduar/ulduar/boss_flame_leviathan.cpp b/src/bindings/scripts/scripts/zone/ulduar/ulduar/boss_flame_leviathan.cpp index b4b4ce68297..c1798cf8893 100644 --- a/src/bindings/scripts/scripts/zone/ulduar/ulduar/boss_flame_leviathan.cpp +++ b/src/bindings/scripts/scripts/zone/ulduar/ulduar/boss_flame_leviathan.cpp @@ -65,7 +65,7 @@ struct TRINITY_DLL_DECL boss_flame_leviathan_seatAI : public ScriptedAI void Reset() { if(const CreatureInfo *cInfo = me->GetCreatureInfo()) - me->SetDisplayId(cInfo->DisplayID_H2); // A for gm, H1 invisible + me->SetDisplayId(cInfo->DisplayID_H[1]); // A for gm, H1 invisible } void UpdateAI(const uint32 diff) diff --git a/src/game/CharacterHandler.cpp b/src/game/CharacterHandler.cpp index 7e4b047b095..84b830651e7 100644 --- a/src/game/CharacterHandler.cpp +++ b/src/game/CharacterHandler.cpp @@ -770,7 +770,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder) { sLog.outDebug( "WORLD: Restart character %u taxi flight", pCurrChar->GetGUIDLow() ); - uint32 MountId = objmgr.GetTaxiMount(sourceNode, pCurrChar->GetTeam(),true); + uint32 mountDisplayId = objmgr.GetTaxiMountDisplayId(sourceNode, pCurrChar->GetTeam(),true); uint32 path = pCurrChar->m_taxi.GetCurrentTaxiPath(); // search appropriate start path node @@ -812,7 +812,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder) } } - SendDoFlight( MountId, path, startNode ); + SendDoFlight( mountDisplayId, path, startNode ); } // Load pet if any (if player not alive and in taxi flight or another then pet will remember as temporary unsummoned) diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 24fd970bddf..1fbea2da325 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -92,20 +92,20 @@ uint32 CreatureInfo::GetRandomValidModelId() const uint32 c = 0; uint32 modelIDs[4]; - if (DisplayID_A) modelIDs[c++] = DisplayID_A; - if (DisplayID_A2) modelIDs[c++] = DisplayID_A2; - if (DisplayID_H) modelIDs[c++] = DisplayID_H; - if (DisplayID_H2) modelIDs[c++] = DisplayID_H2; + if (DisplayID_A[0]) modelIDs[c++] = DisplayID_A[0]; + if (DisplayID_A[1]) modelIDs[c++] = DisplayID_A[1]; + if (DisplayID_H[0]) modelIDs[c++] = DisplayID_H[0]; + if (DisplayID_H[1]) modelIDs[c++] = DisplayID_H[1]; return ((c>0) ? modelIDs[urand(0,c-1)] : 0); } uint32 CreatureInfo::GetFirstValidModelId() const { - if(DisplayID_A) return DisplayID_A; - if(DisplayID_A2) return DisplayID_A2; - if(DisplayID_H) return DisplayID_H; - if(DisplayID_H2) return DisplayID_H2; + if(DisplayID_A[0]) return DisplayID_A[0]; + if(DisplayID_A[1]) return DisplayID_A[1]; + if(DisplayID_H[0]) return DisplayID_H[0]; + if(DisplayID_H[1]) return DisplayID_H[1]; return 0; } @@ -291,15 +291,15 @@ bool Creature::InitEntry(uint32 Entry, uint32 team, const CreatureData *data ) return false; } - uint32 display_id = objmgr.ChooseDisplayId(team, GetCreatureInfo(), data); + uint32 display_id = objmgr.ChooseDisplayId(0, GetCreatureInfo(), data); CreatureModelInfo const *minfo = objmgr.GetCreatureModelRandomGender(display_id); - if (!minfo) + if (!minfo) // Cancel load if no model defined { - sLog.outErrorDb("Creature (Entry: %u) has model %u not found in table `creature_model_info`, can't load. ", Entry, display_id); + sLog.outErrorDb("Creature (Entry: %u) has no model defined in table `creature_template`, can't load. ",Entry); return false; } - else - display_id = minfo->modelid; // it can be different (for another gender) + + display_id = minfo->modelid; // it can be different (for another gender) SetDisplayId(display_id); SetNativeDisplayId(display_id); @@ -1270,10 +1270,33 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) // check if it's a custom model and if not, use 0 for displayId CreatureInfo const *cinfo = GetCreatureInfo(); - if(cinfo) + if (cinfo) { - if(displayId == cinfo->DisplayID_A || displayId == cinfo->DisplayID_A2 || - displayId == cinfo->DisplayID_H || displayId == cinfo->DisplayID_H2) displayId = 0; + if (displayId != cinfo->DisplayID_A[0] && displayId != cinfo->DisplayID_A[1] && + displayId != cinfo->DisplayID_H[0] && displayId != cinfo->DisplayID_H[1]) + { + if (cinfo->DisplayID_A[0]) + if (CreatureModelInfo const *minfo = objmgr.GetCreatureModelInfo(cinfo->DisplayID_A[0])) + if(displayId == minfo->modelid_other_gender) + displayId = 0; + + if (displayId && cinfo->DisplayID_A[1]) + if (CreatureModelInfo const *minfo = objmgr.GetCreatureModelInfo(cinfo->DisplayID_A[1])) + if(displayId == minfo->modelid_other_gender) + displayId = 0; + + if (displayId && cinfo->DisplayID_H[0]) + if (CreatureModelInfo const *minfo = objmgr.GetCreatureModelInfo(cinfo->DisplayID_H[0])) + if(displayId == minfo->modelid_other_gender) + displayId = 0; + + if (displayId && cinfo->DisplayID_H[1]) + if (CreatureModelInfo const *minfo = objmgr.GetCreatureModelInfo(cinfo->DisplayID_H[1])) + if(displayId == minfo->modelid_other_gender) + displayId = 0; + } + else + displayId = 0; } // data->guid = guid don't must be update at save diff --git a/src/game/Creature.h b/src/game/Creature.h index 954259d8846..b44b5b68ef5 100644 --- a/src/game/Creature.h +++ b/src/game/Creature.h @@ -179,10 +179,8 @@ struct CreatureInfo uint32 HeroicEntry; uint32 unk1; uint32 unk2; - uint32 DisplayID_A; - uint32 DisplayID_A2; - uint32 DisplayID_H; - uint32 DisplayID_H2; + uint32 DisplayID_A[2]; + uint32 DisplayID_H[2]; char* Name; char* SubName; char* IconName; diff --git a/src/game/CreatureEventAI.cpp b/src/game/CreatureEventAI.cpp index 0e1c6c02319..000d59fac28 100644 --- a/src/game/CreatureEventAI.cpp +++ b/src/game/CreatureEventAI.cpp @@ -385,9 +385,8 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 { if (CreatureInfo const* ci = GetCreatureTemplateStore(action.morph.creatureId)) { - //use default display - if (ci->DisplayID_A) - m_creature->SetDisplayId(ci->DisplayID_A); + uint32 display_id = objmgr.ChooseDisplayId(0,ci); + m_creature->SetDisplayId(display_id); } } //if no param1, then use value from param2 (modelId) diff --git a/src/game/GameEventMgr.cpp b/src/game/GameEventMgr.cpp index 0d70a4f5cde..b96fab9ab8b 100644 --- a/src/game/GameEventMgr.cpp +++ b/src/game/GameEventMgr.cpp @@ -1408,6 +1408,7 @@ void GameEventMgr::ChangeEquipOrModel(int16 event_id, bool activate) CreatureModelInfo const *minfo = objmgr.GetCreatureModelRandomGender(display_id); if (minfo) display_id = minfo->modelid; + if (data2->equipmentId == 0) itr->second.equipement_id_prev = cinfo->equipmentId; else if (data2->equipmentId != -1) diff --git a/src/game/Object.cpp b/src/game/Object.cpp index 132729aea40..b2ad38ceb47 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -540,15 +540,15 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask { if(target->isGameMaster()) { - if(cinfo->DisplayID_A) - *data << cinfo->DisplayID_A; + if(cinfo->DisplayID_A[0]) + *data << cinfo->DisplayID_A[0]; else *data << 17519; // world invisible trigger's model } else { - if(cinfo->DisplayID_A2) - *data << cinfo->DisplayID_A2; + if(cinfo->DisplayID_A[1]) + *data << cinfo->DisplayID_A[1]; else *data << 11686; // world invisible trigger's model } diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 4fb36b7ea7a..20ace65d79b 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -615,52 +615,75 @@ void ObjectMgr::LoadCreatureTemplates() sLog.outErrorDb("Creature (Entry: %u) has non-existing faction_H template (%u)", cInfo->Entry, cInfo->faction_H); // used later for scale - CreatureDisplayInfoEntry const* displayEntryA = cInfo->DisplayID_A ? sCreatureDisplayInfoStore.LookupEntry(cInfo->DisplayID_A) : NULL; - if (cInfo->DisplayID_A && !displayEntryA) - sLog.outErrorDb("Creature (Entry: %u) has non-existing DisplayID_A id (%u), can crash client", cInfo->Entry, cInfo->DisplayID_A); - - if (cInfo->DisplayID_A2) + CreatureDisplayInfoEntry const* displayScaleEntry = NULL; + + if (cInfo->DisplayID_A[0]) { - CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->DisplayID_A2); - if (!displayEntry) + CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->DisplayID_A[0]); + if(!displayEntry) { - sLog.outErrorDb("Creature (Entry: %u) has non-existing DisplayID_A2 id (%u), can crash client", cInfo->Entry, cInfo->DisplayID_A2); - const_cast<CreatureInfo*>(cInfo)->DisplayID_A2 = 0; + sLog.outErrorDb("Creature (Entry: %u) has non-existing DisplayID_A id (%u), can crash client", cInfo->Entry, cInfo->DisplayID_A[0]); + const_cast<CreatureInfo*>(cInfo)->DisplayID_A[0] = 0; } - } + else if(!displayScaleEntry) + displayScaleEntry = displayEntry; - // used later for scale - CreatureDisplayInfoEntry const* displayEntryH = cInfo->DisplayID_H ? sCreatureDisplayInfoStore.LookupEntry(cInfo->DisplayID_H) : NULL; - if (cInfo->DisplayID_H && !displayEntryH) - sLog.outErrorDb("Creature (Entry: %u) has non-existing DisplayID_H id (%u), can crash client", cInfo->Entry, cInfo->DisplayID_H); + CreatureModelInfo const* minfo = sCreatureModelStorage.LookupEntry<CreatureModelInfo>(cInfo->DisplayID_A[0]); + if (!minfo) + sLog.outErrorDb("Creature (Entry: %u) not has model data for DisplayID_A (%u)", cInfo->Entry, cInfo->DisplayID_A[0]); + } - if (cInfo->DisplayID_H2) + if (cInfo->DisplayID_A[1]) { - CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->DisplayID_H2); - if (!displayEntry) + CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->DisplayID_A[1]); + if(!displayEntry) { - sLog.outErrorDb("Creature (Entry: %u) has non-existing DisplayID_H2 id (%u), can crash client", cInfo->Entry, cInfo->DisplayID_H2); - const_cast<CreatureInfo*>(cInfo)->DisplayID_H2 = 0; + sLog.outErrorDb("Creature (Entry: %u) has non-existing DisplayID_A2 id (%u), can crash client", cInfo->Entry, cInfo->DisplayID_A[1]); + const_cast<CreatureInfo*>(cInfo)->DisplayID_A[1] = 0; } - } + else if(!displayScaleEntry) + displayScaleEntry = displayEntry; - if (!displayEntryA && !displayEntryH) - sLog.outErrorDb("Creature (Entry: %u) has non-existing both DisplayID_A and DisplayID_H", cInfo->Entry); + CreatureModelInfo const* minfo = sCreatureModelStorage.LookupEntry<CreatureModelInfo>(cInfo->DisplayID_A[1]); + if (!minfo) + sLog.outErrorDb("Creature (Entry: %u) not has model data for DisplayID_A2 (%u)", cInfo->Entry, cInfo->DisplayID_A[1]); + } - if (cInfo->DisplayID_A) + if (cInfo->DisplayID_H[0]) { - CreatureModelInfo const* minfo = sCreatureModelStorage.LookupEntry<CreatureModelInfo>(cInfo->DisplayID_A); + CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->DisplayID_H[0]); + if(!displayEntry) + { + sLog.outErrorDb("Creature (Entry: %u) has non-existing DisplayID_H id (%u), can crash client", cInfo->Entry, cInfo->DisplayID_H[0]); + const_cast<CreatureInfo*>(cInfo)->DisplayID_H[0] = 0; + } + else if(!displayScaleEntry) + displayScaleEntry = displayEntry; + + CreatureModelInfo const* minfo = sCreatureModelStorage.LookupEntry<CreatureModelInfo>(cInfo->DisplayID_H[0]); if (!minfo) - sLog.outErrorDb("Creature (Entry: %u) has non-existing modelId_A (%u)", cInfo->Entry, cInfo->DisplayID_A); + sLog.outErrorDb("Creature (Entry: %u) not has model data for DisplayID_H (%u)", cInfo->Entry, cInfo->DisplayID_H[0]); } - if (cInfo->DisplayID_H) + if (cInfo->DisplayID_H[1]) { - CreatureModelInfo const* minfo = sCreatureModelStorage.LookupEntry<CreatureModelInfo>(cInfo->DisplayID_H); + CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->DisplayID_H[1]); + if(!displayEntry) + { + sLog.outErrorDb("Creature (Entry: %u) has non-existing DisplayID_H2 id (%u), can crash client", cInfo->Entry, cInfo->DisplayID_H[1]); + const_cast<CreatureInfo*>(cInfo)->DisplayID_H[1] = 0; + } + else if(!displayScaleEntry) + displayScaleEntry = displayEntry; + + CreatureModelInfo const* minfo = sCreatureModelStorage.LookupEntry<CreatureModelInfo>(cInfo->DisplayID_H[1]); if (!minfo) - sLog.outErrorDb("Creature (Entry: %u) has non-existing modelId_H (%u)", cInfo->Entry, cInfo->DisplayID_H); + sLog.outErrorDb("Creature (Entry: %u) not has model data for DisplayID_H2 (%u)", cInfo->Entry, cInfo->DisplayID_H[1]); } + if (!displayScaleEntry) + sLog.outErrorDb("Creature (Entry: %u) not has any existed display id in DisplayID_A/DisplayID_A2/DisplayID_H/DisplayID_H2", cInfo->Entry); + if (cInfo->unit_class && ((1 << (cInfo->unit_class-1)) & CLASSMASK_ALL_CREATURES) == 0) sLog.outErrorDb("Creature (Entry: %u) has invalid unit_class(%u) for creature_template", cInfo->Entry, cInfo->unit_class); @@ -732,9 +755,10 @@ void ObjectMgr::LoadCreatureTemplates() /// if not set custom creature scale then load scale from CreatureDisplayInfo.dbc if(cInfo->scale <= 0.0f) { - uint32 modelid = cInfo->GetFirstValidModelId(); - CreatureDisplayInfoEntry const* ScaleEntry = sCreatureDisplayInfoStore.LookupEntry(modelid); - const_cast<CreatureInfo*>(cInfo)->scale = ScaleEntry ? ScaleEntry->scale : 1.0f; + if(displayScaleEntry) + const_cast<CreatureInfo*>(cInfo)->scale = displayScaleEntry->scale; + else + const_cast<CreatureInfo*>(cInfo)->scale = 1.0f; } } } @@ -931,17 +955,39 @@ CreatureModelInfo const* ObjectMgr::GetCreatureModelInfo(uint32 modelid) return sCreatureModelStorage.LookupEntry<CreatureModelInfo>(modelid); } -uint32 ObjectMgr::ChooseDisplayId(uint32 team, const CreatureInfo *cinfo, const CreatureData *data) +uint32 ObjectMgr::ChooseDisplayId(uint32 team, const CreatureInfo *cinfo, const CreatureData *data /*= NULL*/) { // Load creature model (display id) - uint32 display_id = 0; + if (data && data->displayid) + return data->displayid; + + if(!team) + return cinfo->GetRandomValidModelId(); - if (!data || data->displayid == 0) // use defaults from the template + // use defaults from the template + uint32 display_id; + + // DisplayID_A is used if no team is given + if (team == HORDE) { - display_id = cinfo->GetRandomValidModelId(); + if(cinfo->DisplayID_H[0]) + display_id = cinfo->DisplayID_H[1] ? cinfo->DisplayID_H[urand(0,1)] : cinfo->DisplayID_H[0]; + else + display_id = cinfo->DisplayID_H[1]; + + if(!display_id) + display_id = cinfo->DisplayID_A[0] ? cinfo->DisplayID_A[0] : cinfo->DisplayID_A[1]; + } + else if(team == ALLIANCE) + { + if(cinfo->DisplayID_A[0]) + display_id = cinfo->DisplayID_A[1] ? cinfo->DisplayID_A[urand(0,1)] : cinfo->DisplayID_A[0]; + else + display_id = cinfo->DisplayID_A[1]; + + if(!display_id) + display_id = cinfo->DisplayID_H[0] ? cinfo->DisplayID_H[0] : cinfo->DisplayID_H[1]; } - else - display_id = data->displayid; // overwritten from creature data return display_id; } @@ -972,6 +1018,29 @@ void ObjectMgr::LoadCreatureModelInfo() { sCreatureModelStorage.Load(); + // post processing + for(uint32 i = 1; i < sCreatureModelStorage.MaxEntry; ++i) + { + CreatureModelInfo const *minfo = sCreatureModelStorage.LookupEntry<CreatureModelInfo>(i); + if (!minfo) + continue; + + if (!sCreatureDisplayInfoStore.LookupEntry(minfo->modelid)) + sLog.outErrorDb("Table `creature_model_info` has model for not existed display id (%u).", minfo->modelid); + + if (minfo->gender > GENDER_NONE) + { + sLog.outErrorDb("Table `creature_model_info` has wrong gender (%u) for display id (%u).", uint32(minfo->gender), minfo->modelid); + const_cast<CreatureModelInfo*>(minfo)->gender = GENDER_MALE; + } + + if (minfo->modelid_other_gender && !sCreatureDisplayInfoStore.LookupEntry(minfo->modelid_other_gender)) + { + sLog.outErrorDb("Table `creature_model_info` has not existed alt.gender model (%u) for existed display id (%u).", minfo->modelid_other_gender, minfo->modelid); + const_cast<CreatureModelInfo*>(minfo)->modelid_other_gender = 0; + } + } + sLog.outString( ">> Loaded %u creature model based info", sCreatureModelStorage.RecordCount ); sLog.outString(); @@ -5103,11 +5172,11 @@ void ObjectMgr::GetTaxiPath( uint32 source, uint32 destination, uint32 &path, ui path = dest_i->second.ID; } -uint16 ObjectMgr::GetTaxiMount( uint32 id, uint32 team, bool allowed_alt_team /* = false */) +uint32 ObjectMgr::GetTaxiMountDisplayId( uint32 id, uint32 team, bool allowed_alt_team /* = false */) { uint16 mount_entry = 0; - uint16 mount_id = 0; + // select mount creature id TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(id); if(node) { @@ -5116,34 +5185,27 @@ uint16 ObjectMgr::GetTaxiMount( uint32 id, uint32 team, bool allowed_alt_team /* mount_entry = node->MountCreatureID[1]; if(!mount_entry && allowed_alt_team) mount_entry = node->MountCreatureID[0]; - - CreatureInfo const *ci = GetCreatureTemplate(mount_entry); - if(ci) - mount_id = ci->DisplayID_A; } - if (team == HORDE) + else if (team == HORDE) { mount_entry = node->MountCreatureID[0]; if(!mount_entry && allowed_alt_team) mount_entry = node->MountCreatureID[1]; - - CreatureInfo const *ci = GetCreatureTemplate(mount_entry); - if(ci) - mount_id = ci->DisplayID_H; } } - CreatureModelInfo const *minfo = GetCreatureModelInfo(mount_id); - if(!minfo) - { - sLog.outErrorDb("Taxi mount (Entry: %u) for taxi node (Id: %u) for team %u has model %u not found in table `creature_model_info`, can't load. ", - mount_entry,id,team,mount_id); + CreatureInfo const *mount_info = GetCreatureTemplate(mount_entry); + if (!mount_info) + return 0; - return false; - } - if(minfo->modelid_other_gender!=0) - mount_id = urand(0,1) ? mount_id : minfo->modelid_other_gender; + uint16 mount_id = objmgr.ChooseDisplayId(team,mount_info); + if (!mount_id) + return 0; + + CreatureModelInfo const *minfo = objmgr.GetCreatureModelRandomGender(mount_id); + if (minfo) + mount_id = minfo->modelid; return mount_id; } diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h index 0f31b90015c..a508c573ef6 100644 --- a/src/game/ObjectMgr.h +++ b/src/game/ObjectMgr.h @@ -433,7 +433,7 @@ class ObjectMgr uint32 GetNearestTaxiNode( float x, float y, float z, uint32 mapid, uint32 team ); void GetTaxiPath( uint32 source, uint32 destination, uint32 &path, uint32 &cost); - uint16 GetTaxiMount( uint32 id, uint32 team, bool allowed_alt_team = false); + uint32 GetTaxiMountDisplayId( uint32 id, uint32 team, bool allowed_alt_team = false); void GetTaxiPathNodes( uint32 path, Path &pathnodes, std::vector<uint32>& mapIds ); void GetTransportPathNodes( uint32 path, TransportPath &pathnodes ); diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 68545b6a379..19e5c7e02d2 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -230,7 +230,7 @@ bool PlayerTaxi::LoadTaxiDestinationsFromString( const std::string& values, uint } // can't load taxi path without mount set (quest taxi path?) - if(!objmgr.GetTaxiMount(GetTaxiSource(),team,true)) + if(!objmgr.GetTaxiMountDisplayId(GetTaxiSource(),team,true)) return false; return true; @@ -17473,10 +17473,10 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc } // get mount model (in case non taximaster (npc==NULL) allow more wide lookup) - uint16 mount_id = objmgr.GetTaxiMount(sourcenode, GetTeam(), npc == NULL); + uint32 mount_display_id = objmgr.GetTaxiMountDisplayId(sourcenode, GetTeam(), npc == NULL); // in spell case allow 0 model - if (mount_id == 0 && spellid == 0 || sourcepath == 0) + if (mount_display_id == 0 && spellid == 0 || sourcepath == 0) { WorldPacket data(SMSG_ACTIVATETAXIREPLY, 4); data << uint32(ERR_TAXIUNSPECIFIEDSERVERERROR); @@ -17513,7 +17513,7 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc sLog.outDebug("WORLD: Sent SMSG_ACTIVATETAXIREPLY"); - GetSession()->SendDoFlight(mount_id, sourcepath); + GetSession()->SendDoFlight(mount_display_id, sourcepath); return true; } diff --git a/src/game/QueryHandler.cpp b/src/game/QueryHandler.cpp index 1ed9fd77db3..e07941d57ca 100644 --- a/src/game/QueryHandler.cpp +++ b/src/game/QueryHandler.cpp @@ -189,10 +189,10 @@ void WorldSession::HandleCreatureQueryOpcode( WorldPacket & recv_data ) data << uint32(ci->rank); // Creature Rank (elite, boss, etc) data << uint32(ci->unk1); // new in 3.1, creature entry? data << uint32(ci->unk2); // new in 3.1, creature entry? - data << (uint32)ci->DisplayID_A; // DisplayID_A - data << (uint32)ci->DisplayID_A2; // DisplayID_A2 - data << (uint32)ci->DisplayID_H; // DisplayID_H - data << (uint32)ci->DisplayID_H2; // DisplayID_H2 + data << uint32(ci->DisplayID_A[0]); // modelid_male1 + data << uint32(ci->DisplayID_H[0]); // modelid_female1 ? + data << uint32(ci->DisplayID_A[1]); // modelid_male2 ? + data << uint32(ci->DisplayID_H[1]); // modelid_femmale2 ? data << float(ci->unk16); // unk data << float(ci->unk17); // unk data << uint8(ci->RacialLeader); diff --git a/src/game/TaxiHandler.cpp b/src/game/TaxiHandler.cpp index 7d90bbd26ce..0928b8ba96a 100644 --- a/src/game/TaxiHandler.cpp +++ b/src/game/TaxiHandler.cpp @@ -119,17 +119,18 @@ void WorldSession::SendTaxiMenu( Creature* unit ) sLog.outDebug( "WORLD: Sent SMSG_SHOWTAXINODES" ); } -void WorldSession::SendDoFlight( uint16 MountId, uint32 path, uint32 pathNode ) +void WorldSession::SendDoFlight( uint32 mountDisplayId, uint32 path, uint32 pathNode ) { // remove fake death - if(GetPlayer()->hasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); while(GetPlayer()->GetMotionMaster()->GetCurrentMovementGeneratorType()==FLIGHT_MOTION_TYPE) GetPlayer()->GetMotionMaster()->MovementExpired(false); - if (MountId) - GetPlayer()->Mount( MountId ); + if (mountDisplayId) + GetPlayer()->Mount( mountDisplayId ); + GetPlayer()->GetMotionMaster()->MoveTaxiFlight(path,pathNode); } @@ -243,16 +244,15 @@ void WorldSession::HandleMoveSplineDoneOpcode(WorldPacket& /*recv_data*/) sLog.outDebug( "WORLD: Taxi has to go from %u to %u", sourcenode, destinationnode ); - uint16 MountId = objmgr.GetTaxiMount(sourcenode, GetPlayer()->GetTeam()); + uint32 mountDisplayId = objmgr.GetTaxiMountDisplayId(sourcenode, GetPlayer()->GetTeam()); uint32 path, cost; objmgr.GetTaxiPath( sourcenode, destinationnode, path, cost); - if(path && MountId) - { - SendDoFlight( MountId, path, 1 ); // skip start fly node - return; - } + if(path && mountDisplayId) + SendDoFlight( mountDisplayId, path, 1 ); // skip start fly node + else + GetPlayer()->m_taxi.ClearTaxiDestinations(); // clear problematic path and next } GetPlayer()->m_taxi.ClearTaxiDestinations(); // not destinations, clear source node diff --git a/src/game/Totem.cpp b/src/game/Totem.cpp index 98701b7f6b5..67fa0281d91 100644 --- a/src/game/Totem.cpp +++ b/src/game/Totem.cpp @@ -59,25 +59,11 @@ void Totem::InitStats(uint32 duration) CreatureInfo const *cinfo = GetCreatureInfo(); if (m_owner->GetTypeId()==TYPEID_PLAYER && cinfo) { - uint32 modelid = 0; - if(((Player*)m_owner)->GetTeam() == HORDE) - { - if(cinfo->DisplayID_H) - modelid = cinfo->DisplayID_H; - else if(cinfo->DisplayID_H2) - modelid = cinfo->DisplayID_H2; - } - else - { - if(cinfo->DisplayID_A) - modelid = cinfo->DisplayID_A; - else if(cinfo->DisplayID_A2) - modelid = cinfo->DisplayID_A2; - } - if (modelid) - SetDisplayId(modelid); - else - sLog.outErrorDb("Totem::Summon: Missing modelid information for entry %u, team %u, totem will use default values.",GetEntry(),((Player*)m_owner)->GetTeam()); + uint32 display_id = objmgr.ChooseDisplayId(((Player*)m_owner)->GetTeam(),cinfo); + CreatureModelInfo const *minfo = objmgr.GetCreatureModelRandomGender(display_id); + if (minfo) + display_id = minfo->modelid; + SetDisplayId(display_id); } // Get spell casted by totem diff --git a/src/game/WorldSession.h b/src/game/WorldSession.h index 5671ebecfd4..bd3f9595fb3 100644 --- a/src/game/WorldSession.h +++ b/src/game/WorldSession.h @@ -229,7 +229,7 @@ class TRINITY_DLL_SPEC WorldSession //Taxi void SendTaxiStatus( uint64 guid ); void SendTaxiMenu( Creature* unit ); - void SendDoFlight( uint16 MountId, uint32 path, uint32 pathNode = 0 ); + void SendDoFlight( uint32 mountDisplayId, uint32 path, uint32 pathNode = 0 ); bool SendLearnNewTaxiNode( Creature* unit ); // Guild/Arena Team |