Merge branch 'master' into dev

This commit is contained in:
Salja
2014-12-21 07:00:03 +01:00
4 changed files with 370 additions and 0 deletions

View File

@@ -10,6 +10,11 @@
namespace LuaItem
{
/* BOOLEAN */
/**
* Returns 'true' if the [Item] is soulbound, 'false' otherwise
*
* @return bool isSoulBound
*/
int IsSoulBound(Eluna* /*E*/, lua_State* L, Item* item)
{
Eluna::Push(L, item->IsSoulBound());
@@ -17,6 +22,11 @@ namespace LuaItem
}
#if (!defined(TBC) && !defined(CLASSIC))
/**
* Returns 'true' if the [Item] is account bound, 'false' otherwise
*
* @return bool isAccountBound
*/
int IsBoundAccountWide(Eluna* /*E*/, lua_State* L, Item* item)
{
Eluna::Push(L, item->IsBoundAccountWide());
@@ -24,12 +34,23 @@ namespace LuaItem
}
#endif
/**
* Returns 'true' if the [Item] is bound to a [Player] by an enchant, 'false' otehrwise
*
* @return bool isBoundByEnchant
*/
int IsBoundByEnchant(Eluna* /*E*/, lua_State* L, Item* item)
{
Eluna::Push(L, item->IsBoundByEnchant());
return 1;
}
/**
* Returns 'true' if the [Item] is not bound to the [Player] specified, 'false' otherwise
*
* @param [Player] player : the [Player] object to check the item against
* @return bool isNotBound
*/
int IsNotBoundToPlayer(Eluna* /*E*/, lua_State* L, Item* item)
{
Player* player = Eluna::CHECKOBJ<Player>(L, 2);
@@ -38,12 +59,22 @@ namespace LuaItem
return 1;
}
/**
* Returns 'true' if the [Item] is locked, 'false' otherwise
*
* @return bool isLocked
*/
int IsLocked(Eluna* /*E*/, lua_State* L, Item* item)
{
Eluna::Push(L, item->IsLocked());
return 1;
}
/**
* Returns 'true' if the [Item] is a bag, 'false' otherwise
*
* @return bool isBag
*/
int IsBag(Eluna* /*E*/, lua_State* L, Item* item)
{
Eluna::Push(L, item->IsBag());
@@ -51,6 +82,11 @@ namespace LuaItem
}
#ifndef CLASSIC
/**
* Returns 'true' if the [Item] is a currency token, 'false' otherwise
*
* @return bool isCurrencyToken
*/
int IsCurrencyToken(Eluna* /*E*/, lua_State* L, Item* item)
{
Eluna::Push(L, item->IsCurrencyToken());
@@ -58,18 +94,33 @@ namespace LuaItem
}
#endif
/**
* Returns 'true' if the [Item] is a not an empty bag, 'false' otherwise
*
* @return bool isNotEmptyBag
*/
int IsNotEmptyBag(Eluna* /*E*/, lua_State* L, Item* item)
{
Eluna::Push(L, item->IsNotEmptyBag());
return 1;
}
/**
* Returns 'true' if the [Item] is broken, 'false' otherwise
*
* @return bool isBroken
*/
int IsBroken(Eluna* /*E*/, lua_State* L, Item* item)
{
Eluna::Push(L, item->IsBroken());
return 1;
}
/**
* Returns 'true' if the [Item] can be traded, 'false' otherwise
*
* @return bool isTradeable
*/
int CanBeTraded(Eluna* /*E*/, lua_State* L, Item* item)
{
#if (defined(TBC) || defined(CLASSIC))
@@ -81,24 +132,45 @@ namespace LuaItem
return 1;
}
/**
* Returns 'true' if the [Item] is currently in a trade window, 'false' otherwise
*
* @return bool isInTrade
*/
int IsInTrade(Eluna* /*E*/, lua_State* L, Item* item)
{
Eluna::Push(L, item->IsInTrade());
return 1;
}
/**
* Returns 'true' if the [Item] is currently in a bag, 'false' otherwise
*
* @return bool isInBag
*/
int IsInBag(Eluna* /*E*/, lua_State* L, Item* item)
{
Eluna::Push(L, item->IsInBag());
return 1;
}
/**
* Returns 'true' if the [Item] is currently equipped, 'false' otherwise
*
* @return bool isEquipped
*/
int IsEquipped(Eluna* /*E*/, lua_State* L, Item* item)
{
Eluna::Push(L, item->IsEquipped());
return 1;
}
/**
* Returns 'true' if the [Item] has the [Quest] specified tied to it, 'false' otherwise
*
* @param uint32 questId : the [Quest] id to be checked
* @return bool hasQuest
*/
int HasQuest(Eluna* /*E*/, lua_State* L, Item* item)
{
uint32 quest = Eluna::CHECKVAL<uint32>(L, 2);
@@ -110,6 +182,11 @@ namespace LuaItem
return 1;
}
/**
* Returns 'true' if the [Item] is a potion, 'false' otherwise
*
* @return bool isPotion
*/
int IsPotion(Eluna* /*E*/, lua_State* L, Item* item)
{
Eluna::Push(L, item->IsPotion());
@@ -117,12 +194,22 @@ namespace LuaItem
}
#ifndef CATA
/**
* Returns 'true' if the [Item] is a weapon vellum, 'false' otherwise
*
* @return bool isWeaponVellum
*/
int IsWeaponVellum(Eluna* /*E*/, lua_State* L, Item* item)
{
Eluna::Push(L, item->IsWeaponVellum());
return 1;
}
/**
* Returns 'true' if the [Item] is an armor vellum, 'false' otherwise
*
* @return bool isArmorVellum
*/
int IsArmorVellum(Eluna* /*E*/, lua_State* L, Item* item)
{
Eluna::Push(L, item->IsArmorVellum());
@@ -130,6 +217,11 @@ namespace LuaItem
}
#endif
/**
* Returns 'true' if the [Item] is a conjured consumable, 'false' otherwise
*
* @return bool isConjuredConsumable
*/
int IsConjuredConsumable(Eluna* /*E*/, lua_State* L, Item* item)
{
Eluna::Push(L, item->IsConjuredConsumable());
@@ -237,36 +329,67 @@ namespace LuaItem
return 1;
}
/**
* Returns the [Player] who currently owns the [Item]
*
* @return [Player] player : the [Player] who owns the [Item]
*/
int GetOwner(Eluna* /*E*/, lua_State* L, Item* item)
{
Eluna::Push(L, item->GetOwner());
return 1;
}
/**
* Returns the [Item]s stack count
*
* @return uint32 count
*/
int GetCount(Eluna* /*E*/, lua_State* L, Item* item)
{
Eluna::Push(L, item->GetCount());
return 1;
}
/**
* Returns the [Item]s max stack count
*
* @return uint32 maxCount
*/
int GetMaxStackCount(Eluna* /*E*/, lua_State* L, Item* item)
{
Eluna::Push(L, item->GetMaxStackCount());
return 1;
}
/**
* Returns the [Item]s current slot
*
* @return uint8 slot
*/
int GetSlot(Eluna* /*E*/, lua_State* L, Item* item)
{
Eluna::Push(L, item->GetSlot());
return 1;
}
/**
* Returns the [Item]s current bag slot
*
* @return uint8 bagSlot
*/
int GetBagSlot(Eluna* /*E*/, lua_State* L, Item* item)
{
Eluna::Push(L, item->GetBagSlot());
return 1;
}
/**
* Returns the [Item]s enchantment ID by enchant slot specified
*
* @param uint32 enchantSlot : the enchant slot specified
* @return uint32 enchantId : the id of the enchant slot specified
*/
int GetEnchantmentId(Eluna* /*E*/, lua_State* L, Item* item)
{
uint32 enchant_slot = Eluna::CHECKVAL<uint32>(L, 2);
@@ -278,6 +401,12 @@ namespace LuaItem
return 1;
}
/**
* Returns the spell ID tied to the [Item] by spell index
*
* @param uint32 spellIndex : the spell index specified
* @return uint32 spellId : the id of the spell
*/
int GetSpellId(Eluna* /*E*/, lua_State* L, Item* item)
{
uint32 index = Eluna::CHECKVAL<uint32>(L, 2);
@@ -288,6 +417,12 @@ namespace LuaItem
return 1;
}
/**
* Returns the spell trigger tied to the [Item] by spell index
*
* @param uint32 spellIndex : the spell index specified
* @return uint32 spellTrigger : the spell trigger of the specified index
*/
int GetSpellTrigger(Eluna* /*E*/, lua_State* L, Item* item)
{
uint32 index = Eluna::CHECKVAL<uint32>(L, 2);
@@ -298,78 +433,143 @@ namespace LuaItem
return 1;
}
/**
* Returns class of the [Item]
*
* @return uint32 class
*/
int GetClass(Eluna* /*E*/, lua_State* L, Item* item)
{
Eluna::Push(L, item->GetTemplate()->Class);
return 1;
}
/**
* Returns subclass of the [Item]
*
* @return uint32 subClass
*/
int GetSubClass(Eluna* /*E*/, lua_State* L, Item* item)
{
Eluna::Push(L, item->GetTemplate()->SubClass);
return 1;
}
/**
* Returns the name of the [Item]
*
* @return string name
*/
int GetName(Eluna* /*E*/, lua_State* L, Item* item)
{
Eluna::Push(L, item->GetTemplate()->Name1);
return 1;
}
/**
* Returns the display ID of the [Item]
*
* @return uint32 displayId
*/
int GetDisplayId(Eluna* /*E*/, lua_State* L, Item* item)
{
Eluna::Push(L, item->GetTemplate()->DisplayInfoID);
return 1;
}
/**
* Returns the quality of the [Item]
*
* @return uint32 quality
*/
int GetQuality(Eluna* /*E*/, lua_State* L, Item* item)
{
Eluna::Push(L, item->GetTemplate()->Quality);
return 1;
}
/**
* Returns the default purchase count of the [Item]
*
* @return uint32 count
*/
int GetBuyCount(Eluna* /*E*/, lua_State* L, Item* item)
{
Eluna::Push(L, item->GetTemplate()->BuyCount);
return 1;
}
/**
* Returns the purchase price of the [Item]
*
* @return uint32 price
*/
int GetBuyPrice(Eluna* /*E*/, lua_State* L, Item* item)
{
Eluna::Push(L, item->GetTemplate()->BuyPrice);
return 1;
}
/**
* Returns the sell price of the [Item]
*
* @return uint32 price
*/
int GetSellPrice(Eluna* /*E*/, lua_State* L, Item* item)
{
Eluna::Push(L, item->GetTemplate()->SellPrice);
return 1;
}
/**
* Returns the inventory type of the [Item]
*
* @return uint32 inventoryType
*/
int GetInventoryType(Eluna* /*E*/, lua_State* L, Item* item)
{
Eluna::Push(L, item->GetTemplate()->InventoryType);
return 1;
}
/**
* Returns the [Player] classes allowed to use this [Item]
*
* @return uint32 allowableClass
*/
int GetAllowableClass(Eluna* /*E*/, lua_State* L, Item* item)
{
Eluna::Push(L, item->GetTemplate()->AllowableClass);
return 1;
}
/**
* Returns the [Player] races allowed to use this [Item]
*
* @return uint32 allowableRace
*/
int GetAllowableRace(Eluna* /*E*/, lua_State* L, Item* item)
{
Eluna::Push(L, item->GetTemplate()->AllowableRace);
return 1;
}
/**
* Returns the [Item]s level
*
* @return uint32 itemLevel
*/
int GetItemLevel(Eluna* /*E*/, lua_State* L, Item* item)
{
Eluna::Push(L, item->GetTemplate()->ItemLevel);
return 1;
}
/**
* Returns the minimum level required to use this [Item]
*
* @return uint32 requiredLevel
*/
int GetRequiredLevel(Eluna* /*E*/, lua_State* L, Item* item)
{
Eluna::Push(L, item->GetTemplate()->RequiredLevel);
@@ -384,6 +584,11 @@ namespace LuaItem
}
#endif
/**
* Returns the random property ID of this [Item]
*
* @return uint32 randomPropertyId
*/
int GetRandomProperty(Eluna* /*E*/, lua_State* L, Item* item)
{
Eluna::Push(L, item->GetTemplate()->RandomProperty);
@@ -398,12 +603,22 @@ namespace LuaItem
}
#endif
/**
* Returns the item set ID of this [Item]
*
* @return uint32 itemSetId
*/
int GetItemSet(Eluna* /*E*/, lua_State* L, Item* item)
{
Eluna::Push(L, item->GetTemplate()->ItemSet);
return 1;
}
/**
* Returns the bag size of this [Item], 0 if [Item] is not a bag
*
* @return uint32 bagSize
*/
int GetBagSize(Eluna* /*E*/, lua_State* L, Item* item)
{
if (Bag* bag = item->ToBag())
@@ -414,6 +629,11 @@ namespace LuaItem
}
/* SETTERS */
/**
* Sets the [Player] specified as the owner of the [Item]
*
* @param [Player] player : the [Player] specified
*/
int SetOwner(Eluna* /*E*/, lua_State* L, Item* item)
{
Player* player = Eluna::CHECKOBJ<Player>(L, 2);
@@ -425,6 +645,11 @@ namespace LuaItem
return 0;
}
/**
* Sets the binding of the [Item] to 'true' or 'false'
*
* @param bool setBinding
*/
int SetBinding(Eluna* /*E*/, lua_State* L, Item* item)
{
bool soulbound = Eluna::CHECKVAL<bool>(L, 2);
@@ -433,6 +658,11 @@ namespace LuaItem
return 0;
}
/**
* Sets the stack count of the [Item]
*
* @param uint32 count
*/
int SetCount(Eluna* /*E*/, lua_State* L, Item* item)
{
uint32 count = Eluna::CHECKVAL<uint32>(L, 2);
@@ -440,6 +670,13 @@ namespace LuaItem
return 0;
}
/**
* Sets the specified enchantment of the [Item] to the specified slot
*
* @param uint32 enchantId : the ID of the enchant to be applied
* @param uint32 enchantSlot : the slot for the enchant to be applied to
* @return bool enchantmentSuccess : if enchantment is successfully set to specified slot, returns 'true', otherwise 'false'
*/
int SetEnchantment(Eluna* /*E*/, lua_State* L, Item* item)
{
Player* owner = item->GetOwner();
@@ -468,6 +705,12 @@ namespace LuaItem
}
/* OTHER */
/**
* Removes an enchant from the [Item] by the specified slot
*
* @param uint32 enchantSlot : the slot for the enchant to be removed from
* @return bool enchantmentRemoved : if enchantment is successfully removed from specified slot, returns 'true', otherwise 'false'
*/
int ClearEnchantment(Eluna* /*E*/, lua_State* L, Item* item)
{
Player* owner = item->GetOwner();
@@ -493,6 +736,9 @@ namespace LuaItem
return 1;
}
/**
* Saves the [Item] to the database
*/
int SaveToDB(Eluna* /*E*/, lua_State* /*L*/, Item* item)
{
#ifndef TRINITY