mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
Allow ObjectMgr::ChooseDisplayId return another team display id if none own team.
Also for support same for mounts switch to use ChooseDisplayId in ObjectMgr::GetTaxiMount Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
parent
2377917176
commit
a1b941b059
1 changed files with 30 additions and 13 deletions
|
|
@ -871,7 +871,7 @@ CreatureModelInfo const* ObjectMgr::GetCreatureModelInfo(uint32 modelid)
|
||||||
return sCreatureModelStorage.LookupEntry<CreatureModelInfo>(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)
|
// Load creature model (display id)
|
||||||
uint32 display_id;
|
uint32 display_id;
|
||||||
|
|
@ -879,9 +879,25 @@ uint32 ObjectMgr::ChooseDisplayId(uint32 team, const CreatureInfo *cinfo, const
|
||||||
{
|
{
|
||||||
// DisplayID_A is used if no team is given
|
// DisplayID_A is used if no team is given
|
||||||
if (team == HORDE)
|
if (team == HORDE)
|
||||||
|
{
|
||||||
display_id = (cinfo->DisplayID_H2 != 0 && urand(0,1) == 0) ? cinfo->DisplayID_H2 : cinfo->DisplayID_H;
|
display_id = (cinfo->DisplayID_H2 != 0 && urand(0,1) == 0) ? cinfo->DisplayID_H2 : cinfo->DisplayID_H;
|
||||||
|
if(!display_id)
|
||||||
|
{
|
||||||
|
display_id = cinfo->DisplayID_A;
|
||||||
|
if(!display_id)
|
||||||
|
display_id = cinfo->DisplayID_A2;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
display_id = (cinfo->DisplayID_A2 != 0 && urand(0,1) == 0) ? cinfo->DisplayID_A2 : cinfo->DisplayID_A;
|
display_id = (cinfo->DisplayID_A2 != 0 && urand(0,1) == 0) ? cinfo->DisplayID_A2 : cinfo->DisplayID_A;
|
||||||
|
if(!display_id)
|
||||||
|
{
|
||||||
|
display_id = cinfo->DisplayID_H;
|
||||||
|
if(!display_id)
|
||||||
|
display_id = cinfo->DisplayID_H2;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else // overridden in creature data
|
else // overridden in creature data
|
||||||
display_id = data->displayid;
|
display_id = data->displayid;
|
||||||
|
|
@ -4796,8 +4812,8 @@ void ObjectMgr::GetTaxiPath( uint32 source, uint32 destination, uint32 &path, ui
|
||||||
uint16 ObjectMgr::GetTaxiMount( uint32 id, uint32 team, bool allowed_alt_team /* = false */)
|
uint16 ObjectMgr::GetTaxiMount( uint32 id, uint32 team, bool allowed_alt_team /* = false */)
|
||||||
{
|
{
|
||||||
uint16 mount_entry = 0;
|
uint16 mount_entry = 0;
|
||||||
uint16 mount_id = 0;
|
|
||||||
|
|
||||||
|
// select mount creature id
|
||||||
TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(id);
|
TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(id);
|
||||||
if(node)
|
if(node)
|
||||||
{
|
{
|
||||||
|
|
@ -4806,23 +4822,23 @@ uint16 ObjectMgr::GetTaxiMount( uint32 id, uint32 team, bool allowed_alt_team /*
|
||||||
mount_entry = node->MountCreatureID[1];
|
mount_entry = node->MountCreatureID[1];
|
||||||
if(!mount_entry && allowed_alt_team)
|
if(!mount_entry && allowed_alt_team)
|
||||||
mount_entry = node->MountCreatureID[0];
|
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];
|
mount_entry = node->MountCreatureID[0];
|
||||||
|
|
||||||
if(!mount_entry && allowed_alt_team)
|
if(!mount_entry && allowed_alt_team)
|
||||||
mount_entry = node->MountCreatureID[1];
|
mount_entry = node->MountCreatureID[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CreatureInfo const *ci = GetCreatureTemplate(mount_entry);
|
CreatureInfo const *mount_info = GetCreatureTemplate(mount_entry);
|
||||||
if(ci)
|
if (!mount_info)
|
||||||
mount_id = ci->DisplayID_H;
|
return 0;
|
||||||
}
|
|
||||||
}
|
uint16 mount_id = objmgr.ChooseDisplayId(team,mount_info);
|
||||||
|
if (!mount_id)
|
||||||
|
return 0;
|
||||||
|
|
||||||
CreatureModelInfo const *minfo = GetCreatureModelInfo(mount_id);
|
CreatureModelInfo const *minfo = GetCreatureModelInfo(mount_id);
|
||||||
if (!minfo)
|
if (!minfo)
|
||||||
|
|
@ -4832,6 +4848,7 @@ uint16 ObjectMgr::GetTaxiMount( uint32 id, uint32 team, bool allowed_alt_team /*
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (minfo->modelid_other_gender != 0)
|
if (minfo->modelid_other_gender != 0)
|
||||||
mount_id = urand(0,1) ? mount_id : minfo->modelid_other_gender;
|
mount_id = urand(0,1) ? mount_id : minfo->modelid_other_gender;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue