@@ -609,6 +609,104 @@ namespace LuaItem
609609 return 1 ;
610610 }
611611
612+ /* *
613+ * Returns the stat info of the specified stat slot of this [Item]
614+ *
615+ * @param uint8 statSlot : the stat slot specified
616+ * @return int32 statValue
617+ * @return int32 statType
618+ */
619+ int GetStatInfo (Eluna* E, Item* item)
620+ {
621+ uint8 statSlot = E->CHECKVAL <uint8>(2 );
622+ int32 statValue = 0 ;
623+ int32 statType = 0 ;
624+
625+ if (statSlot > 0 && statSlot <= item->GetTemplate ()->StatsCount )
626+ {
627+ auto & statEntry = item->GetTemplate ()->ItemStat [statSlot - 1 ];
628+ statValue = statEntry.ItemStatValue ;
629+ statType = statEntry.ItemStatType ;
630+ }
631+
632+ E->Push (statValue);
633+ E->Push (statType);
634+ return 2 ;
635+ }
636+
637+ /* *
638+ * Returns the damage info of the specified damage slot of this [Item]
639+ *
640+ * @param uint8 damageSlot : the damage slot specified (1 or 2)
641+ * @return uint32 damageType
642+ * @return float minDamage
643+ * @return float maxDamage
644+ */
645+ int GetDamageInfo (Eluna* E, Item* item)
646+ {
647+ uint8 damageSlot = E->CHECKVAL <uint8>(2 );
648+ uint32 damageType = 0 ;
649+ float damageMin = 0 ;
650+ float damageMax = 0 ;
651+
652+ if (damageSlot > 0 && damageSlot <= MAX_ITEM_PROTO_DAMAGES)
653+ {
654+ auto & damageEntry = item->GetTemplate ()->Damage [damageSlot - 1 ];
655+ damageType = damageEntry.DamageType ;
656+ damageMin = damageEntry.DamageMin ;
657+ damageMax = damageEntry.DamageMax ;
658+ }
659+
660+ E->Push (damageType);
661+ E->Push (damageMin);
662+ E->Push (damageMax);
663+ return 3 ;
664+ }
665+
666+ /* *
667+ * Returns the base attack speed of this [Item]
668+ *
669+ * @return uint32 speed
670+ */
671+ int GetSpeed (Eluna* E, Item* item)
672+ {
673+ E->Push (item->GetTemplate ()->Delay );
674+ return 1 ;
675+ }
676+
677+ /* *
678+ * Returns the base armor of this [Item]
679+ *
680+ * @return uint32 armor
681+ */
682+ int GetArmor (Eluna* E, Item* item)
683+ {
684+ E->Push (item->GetTemplate ()->Armor );
685+ return 1 ;
686+ }
687+
688+ /* *
689+ * Returns the max durability of this [Item]
690+ *
691+ * @return uint32 maxDurability
692+ */
693+ int GetMaxDurability (Eluna* E, Item* item)
694+ {
695+ E->Push (item->GetUInt32Value (ITEM_FIELD_MAXDURABILITY));
696+ return 1 ;
697+ }
698+
699+ /* *
700+ * Returns the current durability of this [Item]
701+ *
702+ * @return uint32 durabiliy
703+ */
704+ int GetDurability (Eluna* E, Item* item)
705+ {
706+ E->Push (item->GetUInt32Value (ITEM_FIELD_DURABILITY));
707+ return 1 ;
708+ }
709+
612710 /* *
613711 * Returns the random property ID of this [Item]
614712 *
@@ -807,6 +905,12 @@ namespace LuaItem
807905 { " GetRandomSuffix" , &LuaItem::GetRandomSuffix },
808906 { " GetItemSet" , &LuaItem::GetItemSet },
809907 { " GetBagSize" , &LuaItem::GetBagSize },
908+ { " GetStatInfo" , &LuaItem::GetStatInfo },
909+ { " GetDamageInfo" , &LuaItem::GetDamageInfo },
910+ { " GetSpeed" , &LuaItem::GetSpeed },
911+ { " GetArmor" , &LuaItem::GetArmor },
912+ { " GetMaxDurability" , &LuaItem::GetMaxDurability },
913+ { " GetDurability" , &LuaItem::GetDurability },
810914
811915 // Setters
812916 { " SetOwner" , &LuaItem::SetOwner },
0 commit comments