[7870] Implement creature ranged ammo show at ranged weapon use.

* Use BDC data (creature weapon not alwas listed in item_template)
This commit is contained in:
VladimirMangos 2009-05-22 06:06:20 +04:00
parent b708cc87a3
commit 3b11d833c8
5 changed files with 39 additions and 6 deletions

View file

@ -3048,7 +3048,40 @@ void Spell::WriteAmmoToPacket( WorldPacket * data )
}
}
}
// TODO: implement selection ammo data based at ranged weapon stored in equipmodel/equipinfo/equipslot fields
else
{
for (uint8 i = 0; i < 3; ++i)
{
if(uint32 item_id = m_caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + i))
{
if(ItemEntry const * itemEntry = sItemStore.LookupEntry(item_id))
{
if(itemEntry->Class==ITEM_CLASS_WEAPON)
{
switch(itemEntry->SubClass)
{
case ITEM_SUBCLASS_WEAPON_THROWN:
ammoDisplayID = itemEntry->DisplayId;
ammoInventoryType = itemEntry->InventoryType;
break;
case ITEM_SUBCLASS_WEAPON_BOW:
case ITEM_SUBCLASS_WEAPON_CROSSBOW:
ammoDisplayID = 5996; // is this need fixing?
ammoInventoryType = INVTYPE_AMMO;
break;
case ITEM_SUBCLASS_WEAPON_GUN:
ammoDisplayID = 5998; // is this need fixing?
ammoInventoryType = INVTYPE_AMMO;
break;
}
if(ammoDisplayID)
break;
}
}
}
}
}
*data << uint32(ammoDisplayID);
*data << uint32(ammoInventoryType);