• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

[SOLVED] ammo slot

Status
Not open for further replies.

vvm

New member
I'm working on a script to keep track of ammo for hunters on my TrinityCore server. I've tried a few different techniques that seem to work okay, but what I am really looking for is a way to identify which type of ammo is currently equipped and being used in combat, taking into account the fact that a hunter could conceivably have any number of different types of ammo in their bags at any given time. I saw that the Player:EquipItem and Player:GetItemByPos has some details regarding inventory and equipment slots; however, I noticed that the ammo slot is not mentioned. Is this not enumerated at all? Is there any way to detect which ammo is in the ammo slot? Or are there any suggestions on how to identify the type of ammo in use? Any feedback would be appreciated.
 
Last edited:

Rochet2

Moderator / Eluna Dev
If you take a look at Spell::TakeAmmo you can see this:
https://github.com/TrinityCore/TrinityCore/blob/3.3.5/src/server/game/Spells/Spell.cpp#L4427-L4454

More specificly this, which seems to get the item ID used as ammo: uint32 ammo = m_caster->ToPlayer()->GetUInt32Value(PLAYER_AMMO_ID)

Eluna has the same function: http://eluna.emudevs.com/Object/GetUInt32Value.html
And on 3.3.5 PLAYER_AMMO_ID is 1198

The reason ammo is not in equipped slots is probably that it is just used from the bags. I don think it is actually "equipped" in the same sense as other items.
 
Last edited:

vvm

New member
Thank you so much! That is exactly what I needed. My script is working perfectly now. I will be able to keep track of the number of shots fired with ranged weapons, as well as define options for unlimited ammo. Thank you again.
 
Status
Not open for further replies.
Top