713 | | CreatureModelInfo const* minfo = sCreatureModelStorage.LookupEntry<CreatureModelInfo>(cInfo->DisplayID_A); |
714 | | if (!minfo) |
715 | | sLog.outErrorDb("Creature (Entry: %u) has non-existing modelId_A (%u)", cInfo->Entry, cInfo->DisplayID_A); |
716 | | minfo = sCreatureModelStorage.LookupEntry<CreatureModelInfo>(cInfo->DisplayID_H); |
717 | | if (!minfo) |
718 | | sLog.outErrorDb("Creature (Entry: %u) has non-existing modelId_H (%u)", cInfo->Entry, cInfo->DisplayID_H); |
| 713 | // check model ids, supplying and sending non-existent ids to the client might crash them |
| 714 | if(!sCreatureModelStorage.LookupEntry<CreatureModelInfo>(cInfo->Modelid1)) |
| 715 | { |
| 716 | sLog.outErrorDb("Creature (Entry: %u) has non-existing modelId_A (%u), setting it to 0", cInfo->Entry, cInfo->Modelid1); |
| 717 | const_cast<CreatureInfo*>(cInfo)->Modelid1 = 0; |
| 718 | } |
| 719 | if(!sCreatureModelStorage.LookupEntry<CreatureModelInfo>(cInfo->Modelid2)) |
| 720 | { |
| 721 | sLog.outErrorDb("Creature (Entry: %u) has non-existing modelId_A2 (%u), setting it to 0", cInfo->Entry, cInfo->Modelid2); |
| 722 | const_cast<CreatureInfo*>(cInfo)->Modelid2 = 0; |
| 723 | } |
| 724 | if(!sCreatureModelStorage.LookupEntry<CreatureModelInfo>(cInfo->Modelid3)) |
| 725 | { |
| 726 | sLog.outErrorDb("Creature (Entry: %u) has non-existing modelId_H (%u), setting it to 0", cInfo->Entry, cInfo->Modelid3); |
| 727 | const_cast<CreatureInfo*>(cInfo)->Modelid3 = 0; |
| 728 | } |
| 729 | if(!sCreatureModelStorage.LookupEntry<CreatureModelInfo>(cInfo->Modelid4)) |
| 730 | { |
| 731 | sLog.outErrorDb("Creature (Entry: %u) has non-existing modelId_H2 (%u), setting it to 0", cInfo->Entry, cInfo->Modelid4); |
| 732 | const_cast<CreatureInfo*>(cInfo)->Modelid4 = 0; |
| 733 | } |
907 | | uint32 display_id; |
908 | | if (!data || data->displayid == 0) // use defaults from the template |
909 | | { |
910 | | // DisplayID_A is used if no team is given |
911 | | if (team == HORDE) |
912 | | display_id = (cinfo->DisplayID_H2 != 0 && urand(0,1) == 0) ? cinfo->DisplayID_H2 : cinfo->DisplayID_H; |
913 | | else |
914 | | display_id = (cinfo->DisplayID_A2 != 0 && urand(0,1) == 0) ? cinfo->DisplayID_A2 : cinfo->DisplayID_A; |
915 | | } |
916 | | else // overriden in creature data |
917 | | display_id = data->displayid; |
| 923 | uint32 display_id = 0; |
| 924 | |
| 925 | if (!data || data->displayid == 0) // use defaults from the template |
| 926 | { |
| 927 | display_id = cinfo->GetRandomValidModelId(); |
| 928 | } else display_id = data->displayid; // overwritten from creature data |
4606 | | if(node) |
4607 | | { |
4608 | | if (team == ALLIANCE) |
4609 | | { |
4610 | | mount_entry = node->alliance_mount_type; |
4611 | | CreatureInfo const *ci = GetCreatureTemplate(mount_entry); |
4612 | | if(ci) |
4613 | | mount_id = ci->DisplayID_A; |
4614 | | } |
4615 | | if (team == HORDE) |
4616 | | { |
4617 | | mount_entry = node->horde_mount_type; |
4618 | | CreatureInfo const *ci = GetCreatureTemplate(mount_entry); |
4619 | | if(ci) |
4620 | | mount_id = ci->DisplayID_H; |
| 4617 | if (node) |
| 4618 | { |
| 4619 | if (team == ALLIANCE) mount_entry = node->alliance_mount_type; |
| 4620 | else mount_entry = node->horde_mount_type; |
| 4621 | |
| 4622 | CreatureInfo const *cinfo = GetCreatureTemplate(mount_entry); |
| 4623 | if (cinfo) |
| 4624 | { |
| 4625 | if(! (mount_id = cinfo->GetRandomValidModelId())) |
| 4626 | { |
| 4627 | sLog.outErrorDb("No displayid found for the taxi mount with the entry %u! Can't load it!", mount_entry); |
| 4628 | return false; |
| 4629 | } |