mirror of
https://github.com/azerothcore/mod-ale
synced 2025-11-29 15:38:17 +08:00
feat(LuaEngine/ItemTemplateMethods): add GetIcon method (#241)
Co-authored-by: 55Honey <71938210+55Honey@users.noreply.github.com>
This commit is contained in:
@@ -966,6 +966,7 @@ ElunaRegister<ItemTemplate> ItemTemplateMethods[] =
|
||||
{ "GetAllowableRace", &LuaItemTemplate::GetAllowableRace },
|
||||
{ "GetItemLevel", &LuaItemTemplate::GetItemLevel },
|
||||
{ "GetRequiredLevel", &LuaItemTemplate::GetRequiredLevel },
|
||||
{ "GetIcon", &LuaItemTemplate::GetIcon },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user