add getammo function

This commit is contained in:
avitasia
2026-02-07 09:02:55 -08:00
parent 9a340d6357
commit 453e656e3e
7 changed files with 4589 additions and 4489 deletions
+30
View File
@@ -16,6 +16,7 @@ For installation, configuration, and general usage information, see the main [RE
- [GetEquippedItem](#getequippeditemunittoken-slot)
- [GetBagItems](#getbagitemsbagindex)
- [GetBagItem](#getbagitembagindex-slot)
- [GetAmmo](#getammo)
- [GetSpellRec](#getspellrecspellid-copy)
- [GetSpellRecField](#getspellrecfieldspellid-fieldname-copy)
- [GetSpellModifiers](#getspellmodifiersspellid-modifiertype)
@@ -433,6 +434,35 @@ if bankItem then
end
```
#### GetAmmo()
Returns the player's currently equipped ammo item ID and the total quantity remaining across all bags.
**Parameters:**
- None
**Returns:**
- If no ammo is equipped: returns `nil`
- Otherwise returns two values:
- 1st param (number): The ammo item ID
- 2nd param (number): Total ammo count across backpack and bags 1-4
**Examples:**
```lua
-- Check current ammo
local ammoId, count = GetAmmo()
if ammoId then
print("Ammo ID: " .. ammoId .. " Count: " .. count)
else
print("No ammo equipped")
end
-- Low ammo warning
local ammoId, count = GetAmmo()
if ammoId and count < 200 then
print("Low ammo! Only " .. count .. " remaining")
end
```
#### GetSpellRec(spellId, [copy])
Returns a Lua table reference containing all fields for the spell's `SpellRec` record (including localized `name` and `rank`). Returns nil if the spell cannot be found.