mirror of
https://github.com/azerothcore/mod-ale
synced 2025-11-29 15:38:17 +08:00
Add methods item:SetRandomProperties and item:SetRandomSuffix (#274)
This commit is contained in:
@@ -927,6 +927,8 @@ ElunaRegister<Item> ItemMethods[] =
|
||||
{ "SetOwner", &LuaItem::SetOwner },
|
||||
{ "SetBinding", &LuaItem::SetBinding },
|
||||
{ "SetCount", &LuaItem::SetCount },
|
||||
{ "SetRandomProperty", &LuaItem::SetRandomProperty },
|
||||
{ "SetRandomSuffix", &LuaItem::SetRandomSuffix },
|
||||
|
||||
// Boolean
|
||||
{ "IsSoulBound", &LuaItem::IsSoulBound },
|
||||
|
||||
@@ -683,6 +683,32 @@ namespace LuaItem
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the random properties for the [Item] from a given random property ID.
|
||||
*
|
||||
* @param uint32 randomPropId : The ID of the random property to be applied.
|
||||
*/
|
||||
int SetRandomProperty(lua_State* L, Item* item)
|
||||
{
|
||||
uint32 randomPropId = Eluna::CHECKVAL<uint32>(L, 2);
|
||||
item->SetItemRandomProperties(randomPropId);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the random suffix for the [Item] from a given random suffix ID.
|
||||
*
|
||||
* @param uint32 randomSuffixId : The ID of the random suffix to be applied.
|
||||
*/
|
||||
int SetRandomSuffix(lua_State* L, Item* item)
|
||||
{
|
||||
uint32 randomPropId = Eluna::CHECKVAL<uint32>(L, 2);
|
||||
item->SetItemRandomProperties(-randomPropId);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* OTHER */
|
||||
/**
|
||||
* Removes an enchant from the [Item] by the specified slot
|
||||
|
||||
Reference in New Issue
Block a user