User Tag List

Results 1 to 3 of 3

Thread: ammo slot

  1. #1
    Lurking Member
    Join Date
    Sep 2016
    Posts
    3
    XP
    37
    Level
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    ammo slot

    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 by vvm; 09-09-2016 at 06:27 PM.
    Achievements:
    Level I Member

  2. #2
    Moderator / Eluna Dev <span style='color: #FF0000'><span class='glow_8B0000'>Rochet2</span></span>'s Avatar
    Join Date
    Apr 2013
    Location
    Finland
    Posts
    1,860
    XP
    13,531
    Level
    35
    Thanks
    95
    Thanked 592 Times in 419 Posts
    If you take a look at Spell::TakeAmmo you can see this:
    https://github.com/TrinityCore/Trini...pp#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 by Rochet2; 09-09-2016 at 10:05 PM.
    Awards:
    Support LOL Scripter Facepalm! Raffle Winner
    rochet2.github.io - Home of great codes

  3. #3
    Original Poster
    Lurking Member
    Join Date
    Sep 2016
    Posts
    3
    XP
    37
    Level
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •