mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-09 22:20:24 +00:00
[Quest API] Adds new methods to NPCs and Corpses (#1510)
- Add $npc->HasItem(item_id) to Perl. - Add $npc->CountItem(item_id) to Perl. - Add $npc->GetItemIDBySlot(loot_slot) to Perl. - Add $npc->GetFirstSlotByItemID(item_id) to Perl. - Add $corpse->HasItem(item_id) to Perl. - Add $corpse->CountItem(item_id) to Perl. - Add $corpse->GetItemIDBySlot(loot_slot) to Perl. - Add $corpse->GetFirstSlotByItemID(item_id) to Perl. - Add npc:HasItem(item_id) to Lua. - Add npc:CountItem(item_id) to Lua. - Add npc:GetItemIDBySlot(loot_slot) to Lua. - Add npc:GetFirstSlotByItemID(item_id) to Lua. - Add corpse:HasItem(item_id) to Lua. - Add corpse:CountItem(item_id) to Lua. - Add corpse:GetItemIDBySlot(loot_slot) to Lua. - Add corpse:GetFirstSlotByItemID(item_id) to Lua. These methods will allow server operators to view the loot a current has in a slot, the first slot found by item ID, count the item by ID, and see if the NPC has the item. With that functionality you could build a custom loot system and modify loot more dynamically.
This commit is contained in:
+29
-1
@@ -582,6 +582,30 @@ void Lua_NPC::ClearLastName()
|
||||
self->ClearLastName();
|
||||
}
|
||||
|
||||
bool Lua_NPC::HasItem(uint32 item_id)
|
||||
{
|
||||
Lua_Safe_Call_Bool();
|
||||
return self->HasItem(item_id);
|
||||
}
|
||||
|
||||
uint16 Lua_NPC::CountItem(uint32 item_id)
|
||||
{
|
||||
Lua_Safe_Call_Int();
|
||||
return self->CountItem(item_id);
|
||||
}
|
||||
|
||||
uint32 Lua_NPC::GetItemIDBySlot(uint16 loot_slot)
|
||||
{
|
||||
Lua_Safe_Call_Int();
|
||||
return self->GetItemIDBySlot(loot_slot);
|
||||
}
|
||||
|
||||
uint16 Lua_NPC::GetFirstSlotByItemID(uint32 item_id)
|
||||
{
|
||||
Lua_Safe_Call_Int();
|
||||
return self->GetFirstSlotByItemID(item_id);
|
||||
}
|
||||
|
||||
luabind::scope lua_register_npc() {
|
||||
return luabind::class_<Lua_NPC, Lua_Mob>("NPC")
|
||||
.def(luabind::constructor<>())
|
||||
@@ -698,7 +722,11 @@ luabind::scope lua_register_npc() {
|
||||
.def("ScaleNPC", (void(Lua_NPC::*)(uint8))&Lua_NPC::ScaleNPC)
|
||||
.def("IsRaidTarget", (bool(Lua_NPC::*)(void))&Lua_NPC::IsRaidTarget)
|
||||
.def("ChangeLastName", (void(Lua_NPC::*)(const char*))&Lua_NPC::ChangeLastName)
|
||||
.def("ClearLastName", (void(Lua_NPC::*)(void))&Lua_NPC::ClearLastName);
|
||||
.def("ClearLastName", (void(Lua_NPC::*)(void))&Lua_NPC::ClearLastName)
|
||||
.def("HasItem", (bool(Lua_NPC::*)(uint32))&Lua_NPC::HasItem)
|
||||
.def("CountItem", (uint16(Lua_NPC::*)(uint32))&Lua_NPC::CountItem)
|
||||
.def("GetItemIDBySlot", (uint32(Lua_NPC::*)(uint16))&Lua_NPC::GetItemIDBySlot)
|
||||
.def("GetFirstSlotByItemID", (uint16(Lua_NPC::*)(uint32))&Lua_NPC::GetFirstSlotByItemID);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user