aboutsummaryrefslogtreecommitdiff
path: root/src/game/Spell.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-05-22 16:38:55 -0500
committermegamage <none@none>2009-05-22 16:38:55 -0500
commitc31fc2780bfef4349d239f6f19d0904b24a347ee (patch)
tree1e4460ef273fd77c1f1b0119a73008997ad3dd71 /src/game/Spell.cpp
parentceaf8c13bbf9dbe407d48bc489c0fc02e7e6aef4 (diff)
[7870] Implement creature ranged ammo show at ranged weapon use. Author: VladimirMangos
* Use BDC data (creature weapon not alwas listed in item_template) --HG-- branch : trunk
Diffstat (limited to 'src/game/Spell.cpp')
-rw-r--r--src/game/Spell.cpp35
1 files changed, 34 insertions, 1 deletions
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index b394206af4f..1236129e155 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -3241,7 +3241,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);