Skip to content

Commit 3420935

Browse files
committed
CMaNGOS: Add SetRandom Item methods
1 parent 70ee72e commit 3420935

File tree

1 file changed

+27
-3
lines changed

1 file changed

+27
-3
lines changed

methods/CMangos/ItemMethods.h

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -837,6 +837,30 @@ namespace LuaItem
837837
return 1;
838838
}
839839

840+
/**
841+
* Sets the random properties for the [Item] from a given random property ID.
842+
*
843+
* @param uint32 randomPropId : The ID of the random property to be applied.
844+
*/
845+
int SetRandomProperty(Eluna* E, Item* item)
846+
{
847+
uint32 randomPropId = E->CHECKVAL<uint32>(2);
848+
item->SetItemRandomProperties(randomPropId);
849+
return 0;
850+
}
851+
852+
/**
853+
* Sets the random suffix for the [Item] from a given random suffix ID.
854+
*
855+
* @param uint32 randomSuffixId : The ID of the random suffix to be applied.
856+
*/
857+
int SetRandomSuffix(Eluna* E, Item* item)
858+
{
859+
uint32 randomPropId = E->CHECKVAL<uint32>(2);
860+
item->SetItemRandomProperties(-(int32)randomPropId);
861+
return 0;
862+
}
863+
840864
/* OTHER */
841865
/**
842866
* Removes an enchant from the [Item] by the specified slot
@@ -936,6 +960,8 @@ namespace LuaItem
936960
{ "SetOwner", &LuaItem::SetOwner },
937961
{ "SetBinding", &LuaItem::SetBinding },
938962
{ "SetCount", &LuaItem::SetCount },
963+
{"SetRandomProperty", &LuaItem::SetRandomProperty },
964+
{"SetRandomSuffix", &LuaItem::SetRandomSuffix },
939965

940966
// Boolean
941967
{ "IsSoulBound", &LuaItem::IsSoulBound },
@@ -975,9 +1001,7 @@ namespace LuaItem
9751001
{ "SaveToDB", &LuaItem::SaveToDB },
9761002

9771003
// Not implemented methods
978-
{ "IsRefundExpired", METHOD_REG_NONE }, // not implemented
979-
{ "SetRandomProperty", METHOD_REG_NONE }, // not implemented
980-
{ "SetRandomSuffix", METHOD_REG_NONE } // not implemented
1004+
{ "IsRefundExpired", METHOD_REG_NONE } // not implemented
9811005
};
9821006
};
9831007
#endif

0 commit comments

Comments
 (0)