feat(LuaEngine/ItemTemplateMethods): add GetIcon method (#241)

Co-authored-by: 55Honey <71938210+55Honey@users.noreply.github.com>
This commit is contained in:
iThorgrim
2025-02-05 14:30:20 +01:00
committed by GitHub
parent 4ffa5f3900
commit 364c03e5cf
2 changed files with 17 additions and 0 deletions

View File

@@ -966,6 +966,7 @@ ElunaRegister<ItemTemplate> ItemTemplateMethods[] =
{ "GetAllowableRace", &LuaItemTemplate::GetAllowableRace },
{ "GetItemLevel", &LuaItemTemplate::GetItemLevel },
{ "GetRequiredLevel", &LuaItemTemplate::GetRequiredLevel },
{ "GetIcon", &LuaItemTemplate::GetIcon },
{ NULL, NULL }
};

View File

@@ -196,6 +196,22 @@ namespace LuaItemTemplate
Eluna::Push(L, itemTemplate->RequiredLevel);
return 1;
}
/**
* Returns the icon is used by this [ItemTemplate].
*
* @return string itemIcon
*/
int GetIcon(lua_State* L, ItemTemplate* itemTemplate)
{
uint32 display_id = itemTemplate->DisplayInfoID;
ItemDisplayInfoEntry const* displayInfo = sItemDisplayInfoStore.LookupEntry(display_id);
const char* icon = displayInfo->inventoryIcon;
Eluna::Push(L, icon);
return 1;
}
}
#endif