Skip to content

Commit cfb5d77

Browse files
committed
Port RandomSuffix and RandomProperty item methods
azerothcore/mod-ale@2deb507
1 parent 277dece commit cfb5d77

File tree

4 files changed

+35
-3
lines changed

4 files changed

+35
-3
lines changed

methods/CMangos/ItemMethods.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -975,7 +975,9 @@ namespace LuaItem
975975
{ "SaveToDB", &LuaItem::SaveToDB },
976976

977977
// Not implemented methods
978-
{ "IsRefundExpired", METHOD_REG_NONE } // not implemented
978+
{ "IsRefundExpired", METHOD_REG_NONE }, // not implemented
979+
{ "SetRandomProperty", METHOD_REG_NONE }, // not implemented
980+
{ "SetRandomSuffix", METHOD_REG_NONE } // not implemented
979981
};
980982
};
981983
#endif

methods/Mangos/ItemMethods.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,9 @@ namespace LuaItem
873873
{ "GetSpeed", METHOD_REG_NONE }, // not implemented
874874
{ "GetArmor", METHOD_REG_NONE }, // not implemented
875875
{ "GetMaxDurability", METHOD_REG_NONE }, // not implemented
876-
{ "GetDurability", METHOD_REG_NONE } // not implemented
876+
{ "GetDurability", METHOD_REG_NONE }, // not implemented
877+
{ "SetRandomProperty", METHOD_REG_NONE }, // not implemented
878+
{ "SetRandomSuffix", METHOD_REG_NONE } // not implemented
877879
};
878880
};
879881
#endif

methods/TrinityCore/ItemMethods.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,30 @@ namespace LuaItem
828828
return 1;
829829
}
830830

831+
/**
832+
* Sets the random properties for the [Item] from a given random property ID.
833+
*
834+
* @param uint32 randomPropId : The ID of the random property to be applied.
835+
*/
836+
int SetRandomProperty(Eluna* E, Item* item)
837+
{
838+
uint32 randomPropId = E->CHECKVAL<uint32>(2);
839+
item->SetItemRandomProperties(randomPropId);
840+
return 0;
841+
}
842+
843+
/**
844+
* Sets the random suffix for the [Item] from a given random suffix ID.
845+
*
846+
* @param uint32 randomSuffixId : The ID of the random suffix to be applied.
847+
*/
848+
int SetRandomSuffix(Eluna* E, Item* item)
849+
{
850+
uint32 randomPropId = E->CHECKVAL<uint32>(2);
851+
item->SetItemRandomProperties(-randomPropId);
852+
return 0;
853+
}
854+
831855
/* OTHER */
832856
/**
833857
* Removes an enchant from the [Item] by the specified slot
@@ -916,6 +940,8 @@ namespace LuaItem
916940
{ "SetOwner", &LuaItem::SetOwner },
917941
{ "SetBinding", &LuaItem::SetBinding },
918942
{ "SetCount", &LuaItem::SetCount },
943+
{ "SetRandomProperty", &LuaItem::SetRandomProperty },
944+
{ "SetRandomSuffix", &LuaItem::SetRandomSuffix },
919945

920946
// Boolean
921947
{ "IsSoulBound", &LuaItem::IsSoulBound },

methods/VMangos/ItemMethods.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,9 @@ namespace LuaItem
825825
{ "IsCurrencyToken", METHOD_REG_NONE }, // not implemented
826826
{ "IsBoundAccountWide", METHOD_REG_NONE }, // not implemented
827827
{ "IsWeaponVellum", METHOD_REG_NONE }, // not implemented
828-
{ "IsArmorVellum", METHOD_REG_NONE } // not implemented
828+
{ "IsArmorVellum", METHOD_REG_NONE }, // not implemented
829+
{ "SetRandomProperty", METHOD_REG_NONE }, // not implemented
830+
{ "SetRandomSuffix", METHOD_REG_NONE } // not implemented
829831
};
830832
};
831833
#endif

0 commit comments

Comments
 (0)