aboutsummaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorKudlaty <none@none>2009-09-21 07:52:16 +0200
committerKudlaty <none@none>2009-09-21 07:52:16 +0200
commitb4cd005f036316ebf828b301970b5795110d78af (patch)
tree67a67fa337389ea8afef7cfbf011034dbfa70cb1 /src/game
parent45e2f9c002f58e7dc01207ab88f6ffa052860611 (diff)
Reapply patch about changing modelid_a/h(2) values to modelid1..4, display ids are no longer incorrectly chosen based on player faction.
--HG-- branch : trunk
Diffstat (limited to 'src/game')
-rw-r--r--src/game/Creature.cpp42
-rw-r--r--src/game/Creature.h6
-rw-r--r--src/game/Object.cpp8
-rw-r--r--src/game/ObjectMgr.cpp121
-rw-r--r--src/game/QueryHandler.cpp8
5 files changed, 70 insertions, 115 deletions
diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp
index 3812ce7865a..9a8eae73cfb 100644
--- a/src/game/Creature.cpp
+++ b/src/game/Creature.cpp
@@ -93,20 +93,20 @@ uint32 CreatureInfo::GetRandomValidModelId() const
uint32 c = 0;
uint32 modelIDs[4];
- 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];
+ if (Modelid1) modelIDs[c++] = Modelid1;
+ if (Modelid2) modelIDs[c++] = Modelid2;
+ if (Modelid3) modelIDs[c++] = Modelid3;
+ if (Modelid4) modelIDs[c++] = Modelid4;
return ((c>0) ? modelIDs[urand(0,c-1)] : 0);
}
uint32 CreatureInfo::GetFirstValidModelId() const
{
- 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];
+ if(Modelid1) return Modelid1;
+ if(Modelid2) return Modelid2;
+ if(Modelid3) return Modelid3;
+ if(Modelid4) return Modelid4;
return 0;
}
@@ -1295,30 +1295,8 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
CreatureInfo const *cinfo = GetCreatureInfo();
if (cinfo)
{
- 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
+ if (displayId == cinfo->Modelid1 || displayId == cinfo->Modelid2 ||
+ displayId == cinfo->Modelid3 || displayId == cinfo->Modelid4)
displayId = 0;
}
diff --git a/src/game/Creature.h b/src/game/Creature.h
index d7c09c35548..8f123dad406 100644
--- a/src/game/Creature.h
+++ b/src/game/Creature.h
@@ -169,8 +169,10 @@ struct CreatureInfo
uint32 Entry;
uint32 HeroicEntry;
uint32 KillCredit[MAX_KILL_CREDIT];
- uint32 DisplayID_A[2];
- uint32 DisplayID_H[2];
+ uint32 Modelid1;
+ uint32 Modelid2;
+ uint32 Modelid3;
+ uint32 Modelid4;
char* Name;
char* SubName;
char* IconName;
diff --git a/src/game/Object.cpp b/src/game/Object.cpp
index b2e3486a210..c13a41d9d8c 100644
--- a/src/game/Object.cpp
+++ b/src/game/Object.cpp
@@ -578,15 +578,15 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask
{
if(target->isGameMaster())
{
- if(cinfo->DisplayID_A[0])
- *data << cinfo->DisplayID_A[0];
+ if(cinfo->Modelid1)
+ *data << cinfo->Modelid1;
else
*data << 17519; // world invisible trigger's model
}
else
{
- if(cinfo->DisplayID_A[1])
- *data << cinfo->DisplayID_A[1];
+ if(cinfo->Modelid3)
+ *data << cinfo->Modelid3;
else
*data << 11686; // world invisible trigger's model
}
diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp
index d2011bd7e4e..73a85e55a41 100644
--- a/src/game/ObjectMgr.cpp
+++ b/src/game/ObjectMgr.cpp
@@ -670,72 +670,72 @@ void ObjectMgr::LoadCreatureTemplates()
// used later for scale
CreatureDisplayInfoEntry const* displayScaleEntry = NULL;
- if (cInfo->DisplayID_A[0])
+ if (cInfo->Modelid1)
{
- CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->DisplayID_A[0]);
+ CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->Modelid1);
if(!displayEntry)
{
- 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;
+ sLog.outErrorDb("Creature (Entry: %u) has non-existing Modelid1 id (%u), can crash client", cInfo->Entry, cInfo->Modelid1);
+ const_cast<CreatureInfo*>(cInfo)->Modelid1 = 0;
}
else if(!displayScaleEntry)
displayScaleEntry = displayEntry;
- CreatureModelInfo const* minfo = sCreatureModelStorage.LookupEntry<CreatureModelInfo>(cInfo->DisplayID_A[0]);
+ CreatureModelInfo const* minfo = sCreatureModelStorage.LookupEntry<CreatureModelInfo>(cInfo->Modelid1);
if (!minfo)
- sLog.outErrorDb("Creature (Entry: %u) not has model data for DisplayID_A (%u)", cInfo->Entry, cInfo->DisplayID_A[0]);
+ sLog.outErrorDb("Creature (Entry: %u) not has model data for Modelid1 (%u)", cInfo->Entry, cInfo->Modelid1);
}
- if (cInfo->DisplayID_A[1])
+ if (cInfo->Modelid2)
{
- CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->DisplayID_A[1]);
+ CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->Modelid2);
if(!displayEntry)
{
- 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;
+ sLog.outErrorDb("Creature (Entry: %u) has non-existing Modelid2 id (%u), can crash client", cInfo->Entry, cInfo->Modelid2);
+ const_cast<CreatureInfo*>(cInfo)->Modelid2 = 0;
}
else if(!displayScaleEntry)
displayScaleEntry = displayEntry;
- CreatureModelInfo const* minfo = sCreatureModelStorage.LookupEntry<CreatureModelInfo>(cInfo->DisplayID_A[1]);
+ CreatureModelInfo const* minfo = sCreatureModelStorage.LookupEntry<CreatureModelInfo>(cInfo->Modelid2);
if (!minfo)
- sLog.outErrorDb("Creature (Entry: %u) not has model data for DisplayID_A2 (%u)", cInfo->Entry, cInfo->DisplayID_A[1]);
+ sLog.outErrorDb("Creature (Entry: %u) not has model data for Modelid2 (%u)", cInfo->Entry, cInfo->Modelid2);
}
- if (cInfo->DisplayID_H[0])
+ if (cInfo->Modelid3)
{
- CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->DisplayID_H[0]);
+ CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->Modelid3);
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;
+ sLog.outErrorDb("Creature (Entry: %u) has non-existing Modelid3 id (%u), can crash client", cInfo->Entry, cInfo->Modelid3);
+ const_cast<CreatureInfo*>(cInfo)->Modelid3 = 0;
}
else if(!displayScaleEntry)
displayScaleEntry = displayEntry;
- CreatureModelInfo const* minfo = sCreatureModelStorage.LookupEntry<CreatureModelInfo>(cInfo->DisplayID_H[0]);
+ CreatureModelInfo const* minfo = sCreatureModelStorage.LookupEntry<CreatureModelInfo>(cInfo->Modelid3);
if (!minfo)
- sLog.outErrorDb("Creature (Entry: %u) not has model data for DisplayID_H (%u)", cInfo->Entry, cInfo->DisplayID_H[0]);
+ sLog.outErrorDb("Creature (Entry: %u) not has model data for Modelid3 (%u)", cInfo->Entry, cInfo->Modelid3);
}
- if (cInfo->DisplayID_H[1])
+ if (cInfo->Modelid4)
{
- CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->DisplayID_H[1]);
+ CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->Modelid4);
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;
+ sLog.outErrorDb("Creature (Entry: %u) has non-existing Modelid4 id (%u), can crash client", cInfo->Entry, cInfo->Modelid4);
+ const_cast<CreatureInfo*>(cInfo)->Modelid4 = 0;
}
else if(!displayScaleEntry)
displayScaleEntry = displayEntry;
- CreatureModelInfo const* minfo = sCreatureModelStorage.LookupEntry<CreatureModelInfo>(cInfo->DisplayID_H[1]);
+ CreatureModelInfo const* minfo = sCreatureModelStorage.LookupEntry<CreatureModelInfo>(cInfo->Modelid4);
if (!minfo)
- sLog.outErrorDb("Creature (Entry: %u) not has model data for DisplayID_H2 (%u)", cInfo->Entry, cInfo->DisplayID_H[1]);
+ sLog.outErrorDb("Creature (Entry: %u) not has model data for Modelid4 (%u)", cInfo->Entry, cInfo->Modelid4);
}
if (!displayScaleEntry)
- sLog.outErrorDb("Creature (Entry: %u) not has any existed display id in DisplayID_A/DisplayID_A2/DisplayID_H/DisplayID_H2", cInfo->Entry);
+ sLog.outErrorDb("Creature (Entry: %u) not has any existed display id in Modelid1/Modelid2/Modelid3/Modelid4", cInfo->Entry);
for(int k = 0; k < MAX_KILL_CREDIT; ++k)
{
@@ -1023,10 +1023,16 @@ CreatureModelInfo const* ObjectMgr::GetCreatureModelInfo(uint32 modelid)
uint32 ObjectMgr::ChooseDisplayId(uint32 team, const CreatureInfo *cinfo, const CreatureData *data /*= NULL*/)
{
// Load creature model (display id)
- if (data && data->displayid)
+ uint32 display_id = 0;
+
+ if (!data || data->displayid == 0)
+ {
+ display_id = cinfo->GetRandomValidModelId();
+ }
+ else
return data->displayid;
- if(!team)
+ /*if(!team)
{
switch(cinfo->Entry)
{
@@ -1034,40 +1040,15 @@ uint32 ObjectMgr::ChooseDisplayId(uint32 team, const CreatureInfo *cinfo, const
case 33114: // Flame Leviathan Seat (model 24914 chair)
case 33167: // Salvaged Demolisher Mechanic Seat
case 33189: // Liquid Pryite
- return cinfo->DisplayID_A[0];
+ return cinfo->Modelid1;
case 33218: // Pyrite Safety Container
- return cinfo->DisplayID_A[1];
+ return cinfo->Modelid2;
case 33143: // Overload Control Device
- return cinfo->DisplayID_H[0];
+ return cinfo->Modelid3;
default:
return cinfo->GetRandomValidModelId();
}
- }
-
- // use defaults from the template
- uint32 display_id;
-
- // DisplayID_A is used if no team is given
- if (team == HORDE)
- {
- 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];
- }
+ }*/
return display_id;
}
@@ -5291,35 +5272,29 @@ void ObjectMgr::GetTaxiPath( uint32 source, uint32 destination, uint32 &path, ui
uint32 ObjectMgr::GetTaxiMountDisplayId( uint32 id, uint32 team, bool allowed_alt_team /* = false */)
{
- uint16 mount_entry = 0;
+ uint32 mount_entry = 0;
+ uint32 mount_id = 0;
// select mount creature id
TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(id);
if(node)
{
if (team == ALLIANCE)
- {
mount_entry = node->MountCreatureID[1];
- if(!mount_entry && allowed_alt_team)
- mount_entry = node->MountCreatureID[0];
- }
- else if (team == HORDE)
- {
+ else
mount_entry = node->MountCreatureID[0];
- if(!mount_entry && allowed_alt_team)
- mount_entry = node->MountCreatureID[1];
+ CreatureInfo const *mount_info = GetCreatureTemplate(mount_entry);
+ if (mount_info)
+ {
+ if (! (mount_id = mount_info->GetRandomValidModelId()))
+ {
+ sLog.outErrorDb("No displayid found for the taxi mount with the entry %u! Can't load it!", mount_entry);
+ return false;
+ }
}
}
- CreatureInfo const *mount_info = GetCreatureTemplate(mount_entry);
- if (!mount_info)
- return 0;
-
- 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;
diff --git a/src/game/QueryHandler.cpp b/src/game/QueryHandler.cpp
index 860427e787e..ebd5e773c12 100644
--- a/src/game/QueryHandler.cpp
+++ b/src/game/QueryHandler.cpp
@@ -190,10 +190,10 @@ void WorldSession::HandleCreatureQueryOpcode( WorldPacket & recv_data )
data << uint32(ci->rank); // Creature Rank (elite, boss, etc)
data << uint32(ci->KillCredit[0]); // new in 3.1, kill credit
data << uint32(ci->KillCredit[1]); // new in 3.1, kill credit
- 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 << uint32(ci->Modelid1); // Modelid1
+ data << uint32(ci->Modelid2); // Modelid2
+ data << uint32(ci->Modelid3); // Modelid3
+ data << uint32(ci->Modelid4); // Modelid4
data << float(ci->unk16); // unk
data << float(ci->unk17); // unk
data << uint8(ci->RacialLeader);