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
This commit is contained in:
Kudlaty
2009-09-21 07:52:16 +02:00
parent 45e2f9c002
commit b4cd005f03
8 changed files with 82 additions and 121 deletions
+6
View File
@@ -0,0 +1,6 @@
ALTER TABLE `item_template` MODIFY `stackable` int;
ALTER TABLE `creature_template` CHANGE COLUMN `modelid_A` `modelid1` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT 0;
ALTER TABLE `creature_template` CHANGE COLUMN `modelid_A2` `modelid2` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT 0;
ALTER TABLE `creature_template` CHANGE COLUMN `modelid_H` `modelid3` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT 0;
ALTER TABLE `creature_template` CHANGE COLUMN `modelid_H2` `modelid4` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT 0;
+5 -5
View File
@@ -494,10 +494,10 @@ CREATE TABLE `creature_template` (
`heroic_entry` mediumint(8) unsigned NOT NULL default '0',
`unk1` int(11) unsigned NOT NULL default '0',
`unk2` int(11) unsigned NOT NULL default '0',
`modelid_A` mediumint(8) unsigned NOT NULL default '0',
`modelid_A2` mediumint(8) unsigned NOT NULL default '0',
`modelid_H` mediumint(8) unsigned NOT NULL default '0',
`modelid_H2` mediumint(8) unsigned NOT NULL default '0',
`modelid1` mediumint(8) unsigned NOT NULL default '0',
`modelid2` mediumint(8) unsigned NOT NULL default '0',
`modelid3` mediumint(8) unsigned NOT NULL default '0',
`modelid4` mediumint(8) unsigned NOT NULL default '0',
`name` char(100) NOT NULL default '0',
`subname` char(100) default NULL,
`IconName` char(100) default NULL,
@@ -1270,7 +1270,7 @@ CREATE TABLE `item_template` (
`RequiredReputationFaction` smallint(5) unsigned NOT NULL default '0',
`RequiredReputationRank` smallint(5) unsigned NOT NULL default '0',
`maxcount` smallint(5) NOT NULL default '-1',
`stackable` smallint(5) NOT NULL default '1',
`stackable` int NOT NULL default '1',
`ContainerSlots` tinyint(3) unsigned NOT NULL default '0',
`StatsCount` tinyint(3) unsigned NOT NULL default '0',
`stat_type1` tinyint(3) unsigned NOT NULL default '0',
@@ -748,7 +748,7 @@ struct TRINITY_DLL_DECL npc_scarlet_miner_cartAI : public PassiveAI
npc_scarlet_miner_cartAI(Creature *c) : PassiveAI(c), minerGUID(0)
{
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE);
me->SetDisplayId(me->GetCreatureInfo()->DisplayID_A[0]); // H0 is horse
me->SetDisplayId(me->GetCreatureInfo()->Modelid1); // H0 is horse
}
uint64 minerGUID;
+10 -32
View File
@@ -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;
}
+4 -2
View File
@@ -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;
+4 -4
View File
@@ -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
}
+48 -73
View File
@@ -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;
+4 -4
View File
@@ -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);