Lua functions

HasItem

Registered in this checkout as EQ2Emu_lua_HasItem; implementation found at WorldServer/Lua/LuaFunctions.cpp:1865.

Historical signature: HasItem(Player, ItemID, IncludeBank)

Parameter and behavior details in the historical explanation are under review against the current implementation.

Function: HasItem(Player, ItemID, IncludeBank)

Description: Determines whether a given player possesses an item with the specified Item ID.

Parameters:

  • Player: Spawn – The player or NPC to check for the item. (Typically a Player.)
  • ItemID: Int32 – The unique ID of the item to check for.
  • IncudeBank: Boolean – If we should check the bank also

Returns: Boolean – true (1) if the spawn’s inventory contains at least one of the specified item; false (0) if the item is not present.

Checked example

Active call in a local runtime Lua script. Argument count matches current fixed C++ readers. This is a contextual call pattern, not a tested standalone script.

if HasItem(Spawn, 15337, 1) then

Evidence: server/SpawnScripts/Castleview/VindainGreenfaith.lua:257; binding EQ2Emu_lua_HasItem.

Current registration: WorldServer/Lua/LuaInterface.cpp. Historical explanation: EQ2Emu Lua documentation.