mirror of
https://github.com/azerothcore/mod-ale
synced 2025-11-29 15:38:17 +08:00
Updated method documentation and cleaned up
Method documentation should be completed. Only thing left now is polishing up (fixing typos, update wording, add enumerator data to method documentation that doesn't have it, etc).. Cleaned whitespaces Corrected/Fixed up some comments Removed all known documented method comments in LuaFunctions.cpp. Commented out methods are now marked as undocumented until they are uncommented & documented in their respective header files. Removed 'Getter, Setter, Boolean, Other' comments in method files Documented VehicleMethods, the rest of PlayerMethods, UnitMethods, CreatureMethods and GuildMethods. Refer to #101 for more information
This commit is contained in:
@@ -67,8 +67,7 @@ public:
|
|||||||
BindingMap(lua_State* L) :
|
BindingMap(lua_State* L) :
|
||||||
L(L),
|
L(L),
|
||||||
maxBindingID(0)
|
maxBindingID(0)
|
||||||
{
|
{ }
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Insert a new binding from `key` to `ref`, which lasts for `shots`-many pushes.
|
* Insert a new binding from `key` to `ref`, which lasts for `shots`-many pushes.
|
||||||
@@ -224,7 +223,7 @@ struct EventKey
|
|||||||
|
|
||||||
EventKey(T event_id) :
|
EventKey(T event_id) :
|
||||||
event_id(event_id)
|
event_id(event_id)
|
||||||
{}
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -240,7 +239,7 @@ struct EntryKey
|
|||||||
EntryKey(T event_id, uint32 entry) :
|
EntryKey(T event_id, uint32 entry) :
|
||||||
event_id(event_id),
|
event_id(event_id),
|
||||||
entry(entry)
|
entry(entry)
|
||||||
{}
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -258,7 +257,7 @@ struct UniqueObjectKey
|
|||||||
event_id(event_id),
|
event_id(event_id),
|
||||||
guid(guid),
|
guid(guid),
|
||||||
instance_id(instance_id)
|
instance_id(instance_id)
|
||||||
{}
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,8 +14,6 @@
|
|||||||
*/
|
*/
|
||||||
namespace LuaCreature
|
namespace LuaCreature
|
||||||
{
|
{
|
||||||
/* BOOLEAN */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns `true` if the [Creature] is set to not give reputation when killed,
|
* Returns `true` if the [Creature] is set to not give reputation when killed,
|
||||||
* and returns `false` otherwise.
|
* and returns `false` otherwise.
|
||||||
@@ -368,12 +366,25 @@ namespace LuaCreature
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the [Creature] is damaged enough for looting
|
||||||
|
*
|
||||||
|
* @return bool isDamagedEnough
|
||||||
|
*/
|
||||||
int IsDamageEnoughForLootingAndReward(Eluna* /*E*/, lua_State* L, Creature* creature)
|
int IsDamageEnoughForLootingAndReward(Eluna* /*E*/, lua_State* L, Creature* creature)
|
||||||
{
|
{
|
||||||
Eluna::Push(L, creature->IsDamageEnoughForLootingAndReward());
|
Eluna::Push(L, creature->IsDamageEnoughForLootingAndReward());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the [Creature] can start attacking specified target
|
||||||
|
*
|
||||||
|
* Does not work on most targets
|
||||||
|
*
|
||||||
|
* @param [Unit] target
|
||||||
|
* @param bool force = true : force [Creature] to attack
|
||||||
|
*/
|
||||||
int CanStartAttack(Eluna* /*E*/, lua_State* L, Creature* creature) // TODO: Implement core side
|
int CanStartAttack(Eluna* /*E*/, lua_State* L, Creature* creature) // TODO: Implement core side
|
||||||
{
|
{
|
||||||
Unit* target = Eluna::CHECKOBJ<Unit>(L, 2);
|
Unit* target = Eluna::CHECKOBJ<Unit>(L, 2);
|
||||||
@@ -383,6 +394,12 @@ namespace LuaCreature
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if [Creature] has the specified loot mode
|
||||||
|
*
|
||||||
|
* @param uint16 lootMode
|
||||||
|
* @return bool hasLootMode
|
||||||
|
*/
|
||||||
int HasLootMode(Eluna* /*E*/, lua_State* L, Creature* creature) // TODO: Implement LootMode features
|
int HasLootMode(Eluna* /*E*/, lua_State* L, Creature* creature) // TODO: Implement LootMode features
|
||||||
{
|
{
|
||||||
uint16 lootMode = Eluna::CHECKVAL<uint16>(L, 2);
|
uint16 lootMode = Eluna::CHECKVAL<uint16>(L, 2);
|
||||||
@@ -392,8 +409,6 @@ namespace LuaCreature
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* GETTERS */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the time it takes for this [Creature] to respawn once killed.
|
* Returns the time it takes for this [Creature] to respawn once killed.
|
||||||
*
|
*
|
||||||
@@ -853,8 +868,6 @@ namespace LuaCreature
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* SETTERS */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the [Creature]'s NPC flags to `flags`.
|
* Sets the [Creature]'s NPC flags to `flags`.
|
||||||
*
|
*
|
||||||
@@ -1091,8 +1104,6 @@ namespace LuaCreature
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* OTHER */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Despawn this [Creature].
|
* Despawn this [Creature].
|
||||||
*
|
*
|
||||||
@@ -1129,7 +1140,7 @@ namespace LuaCreature
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make the [Creature] start following it's waypoint path.
|
* Make the [Creature] start following its waypoint path.
|
||||||
*/
|
*/
|
||||||
int MoveWaypoint(Eluna* /*E*/, lua_State* /*L*/, Creature* creature)
|
int MoveWaypoint(Eluna* /*E*/, lua_State* /*L*/, Creature* creature)
|
||||||
{
|
{
|
||||||
@@ -1229,12 +1240,20 @@ namespace LuaCreature
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TRINITY
|
#ifdef TRINITY
|
||||||
|
/**
|
||||||
|
* Resets [Creature]'s loot mode to default
|
||||||
|
*/
|
||||||
int ResetLootMode(Eluna* /*E*/, lua_State* /*L*/, Creature* creature) // TODO: Implement LootMode features
|
int ResetLootMode(Eluna* /*E*/, lua_State* /*L*/, Creature* creature) // TODO: Implement LootMode features
|
||||||
{
|
{
|
||||||
creature->ResetLootMode();
|
creature->ResetLootMode();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes specified loot mode from [Creature]
|
||||||
|
*
|
||||||
|
* @param uint16 lootMode
|
||||||
|
*/
|
||||||
int RemoveLootMode(Eluna* /*E*/, lua_State* L, Creature* creature) // TODO: Implement LootMode features
|
int RemoveLootMode(Eluna* /*E*/, lua_State* L, Creature* creature) // TODO: Implement LootMode features
|
||||||
{
|
{
|
||||||
uint16 lootMode = Eluna::CHECKVAL<uint16>(L, 2);
|
uint16 lootMode = Eluna::CHECKVAL<uint16>(L, 2);
|
||||||
@@ -1243,6 +1262,11 @@ namespace LuaCreature
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a loot mode to the [Creature]
|
||||||
|
*
|
||||||
|
* @param uint16 lootMode
|
||||||
|
*/
|
||||||
int AddLootMode(Eluna* /*E*/, lua_State* L, Creature* creature) // TODO: Implement LootMode features
|
int AddLootMode(Eluna* /*E*/, lua_State* L, Creature* creature) // TODO: Implement LootMode features
|
||||||
{
|
{
|
||||||
uint16 lootMode = Eluna::CHECKVAL<uint16>(L, 2);
|
uint16 lootMode = Eluna::CHECKVAL<uint16>(L, 2);
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ namespace LuaQuery
|
|||||||
luaL_argerror(L, 2, "invalid field index");
|
luaL_argerror(L, 2, "invalid field index");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* BOOLEAN */
|
|
||||||
/**
|
/**
|
||||||
* Returns `true` if the specified column of the current row is `NULL`, otherwise `false`.
|
* Returns `true` if the specified column of the current row is `NULL`, otherwise `false`.
|
||||||
*
|
*
|
||||||
@@ -48,7 +47,6 @@ namespace LuaQuery
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* GETTERS */
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of columns in the result set.
|
* Returns the number of columns in the result set.
|
||||||
*
|
*
|
||||||
@@ -247,8 +245,6 @@ namespace LuaQuery
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* OTHER */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Advances the [ElunaQuery] to the next row in the result set.
|
* Advances the [ElunaQuery] to the next row in the result set.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -65,8 +65,8 @@ namespace LuaGameObject
|
|||||||
|
|
||||||
/*int IsDestructible(Eluna* E, lua_State* L, GameObject* go) // TODO: Implementation core side
|
/*int IsDestructible(Eluna* E, lua_State* L, GameObject* go) // TODO: Implementation core side
|
||||||
{
|
{
|
||||||
Eluna::Push(L, go->IsDestructibleBuilding());
|
Eluna::Push(L, go->IsDestructibleBuilding());
|
||||||
return 1;
|
return 1;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -152,14 +152,14 @@ namespace LuaGroup
|
|||||||
|
|
||||||
/*int IsLFGGroup(Eluna* E, lua_State* L, Group* group) // TODO: Implementation
|
/*int IsLFGGroup(Eluna* E, lua_State* L, Group* group) // TODO: Implementation
|
||||||
{
|
{
|
||||||
Eluna::Push(L, group->isLFGGroup());
|
Eluna::Push(L, group->isLFGGroup());
|
||||||
return 1;
|
return 1;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
/*int IsBFGroup(Eluna* E, lua_State* L, Group* group) // TODO: Implementation
|
/*int IsBFGroup(Eluna* E, lua_State* L, Group* group) // TODO: Implementation
|
||||||
{
|
{
|
||||||
Eluna::Push(L, group->isBFGroup());
|
Eluna::Push(L, group->isBFGroup());
|
||||||
return 1;
|
return 1;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -395,8 +395,8 @@ namespace LuaGroup
|
|||||||
|
|
||||||
/*int ConvertToLFG(Eluna* E, lua_State* L, Group* group) // TODO: Implementation
|
/*int ConvertToLFG(Eluna* E, lua_State* L, Group* group) // TODO: Implementation
|
||||||
{
|
{
|
||||||
group->ConvertToLFG();
|
group->ConvertToLFG();
|
||||||
return 0;
|
return 0;
|
||||||
}*/
|
}*/
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ void Eluna::OnDisband(Guild* guild)
|
|||||||
CallAllFunctions(GuildEventBindings, key);
|
CallAllFunctions(GuildEventBindings, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Eluna::OnMemberWitdrawMoney(Guild* guild, Player* player, uint32& amount, bool isRepair) // isRepair not a part of Mangos, implement?
|
void Eluna::OnMemberWitdrawMoney(Guild* guild, Player* player, uint32& amount, bool isRepair)
|
||||||
{
|
{
|
||||||
START_HOOK(GUILD_EVENT_ON_MONEY_WITHDRAW);
|
START_HOOK(GUILD_EVENT_ON_MONEY_WITHDRAW);
|
||||||
Push(guild);
|
Push(guild);
|
||||||
|
|||||||
@@ -12,7 +12,6 @@
|
|||||||
*/
|
*/
|
||||||
namespace LuaGuild
|
namespace LuaGuild
|
||||||
{
|
{
|
||||||
/* GETTERS */
|
|
||||||
/**
|
/**
|
||||||
* Returns a table with the [Player]s in this [Guild]
|
* Returns a table with the [Player]s in this [Guild]
|
||||||
*
|
*
|
||||||
@@ -139,7 +138,6 @@ namespace LuaGuild
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* SETTERS */
|
|
||||||
#ifndef CATA
|
#ifndef CATA
|
||||||
/**
|
/**
|
||||||
* Sets the leader of this [Guild]
|
* Sets the leader of this [Guild]
|
||||||
@@ -179,7 +177,6 @@ namespace LuaGuild
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* OTHER */
|
|
||||||
// SendPacketToGuild(packet)
|
// SendPacketToGuild(packet)
|
||||||
/**
|
/**
|
||||||
* Sends a [WorldPacket] to all the [Player]s in the [Guild]
|
* Sends a [WorldPacket] to all the [Player]s in the [Guild]
|
||||||
@@ -272,6 +269,12 @@ namespace LuaGuild
|
|||||||
|
|
||||||
#ifndef CLASSIC
|
#ifndef CLASSIC
|
||||||
// Move to Player methods
|
// Move to Player methods
|
||||||
|
/**
|
||||||
|
* Windraws money from the [Guild] bank
|
||||||
|
*
|
||||||
|
* @param [Player] player
|
||||||
|
* @param uint32 money
|
||||||
|
*/
|
||||||
int WithdrawBankMoney(Eluna* /*E*/, lua_State* L, Guild* guild)
|
int WithdrawBankMoney(Eluna* /*E*/, lua_State* L, Guild* guild)
|
||||||
{
|
{
|
||||||
Player* player = Eluna::CHECKOBJ<Player>(L, 2);
|
Player* player = Eluna::CHECKOBJ<Player>(L, 2);
|
||||||
@@ -287,6 +290,12 @@ namespace LuaGuild
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Move to Player methods
|
// Move to Player methods
|
||||||
|
/**
|
||||||
|
* Deposits money to the [Guild] bank
|
||||||
|
*
|
||||||
|
* @param [Player] player
|
||||||
|
* @param uint32 money
|
||||||
|
*/
|
||||||
int DepositBankMoney(Eluna* /*E*/, lua_State* L, Guild* guild)
|
int DepositBankMoney(Eluna* /*E*/, lua_State* L, Guild* guild)
|
||||||
{
|
{
|
||||||
Player* player = Eluna::CHECKOBJ<Player>(L, 2);
|
Player* player = Eluna::CHECKOBJ<Player>(L, 2);
|
||||||
|
|||||||
2
Hooks.h
2
Hooks.h
@@ -143,7 +143,7 @@ namespace Hooks
|
|||||||
AUCTION_EVENT_ON_SUCCESSFUL = 28, // (event, auctionId, owner, item, expireTime, buyout, startBid, currentBid, bidderGUIDLow)
|
AUCTION_EVENT_ON_SUCCESSFUL = 28, // (event, auctionId, owner, item, expireTime, buyout, startBid, currentBid, bidderGUIDLow)
|
||||||
AUCTION_EVENT_ON_EXPIRE = 29, // (event, auctionId, owner, item, expireTime, buyout, startBid, currentBid, bidderGUIDLow)
|
AUCTION_EVENT_ON_EXPIRE = 29, // (event, auctionId, owner, item, expireTime, buyout, startBid, currentBid, bidderGUIDLow)
|
||||||
|
|
||||||
// AddOns
|
// AddOns
|
||||||
ADDON_EVENT_ON_MESSAGE = 30, // (event, sender, type, prefix, msg, target) - target can be nil/whisper_target/guild/group/channel. Can return false
|
ADDON_EVENT_ON_MESSAGE = 30, // (event, sender, type, prefix, msg, target) - target can be nil/whisper_target/guild/group/channel. Can return false
|
||||||
|
|
||||||
WORLD_EVENT_ON_DELETE_CREATURE = 31, // (event, creature)
|
WORLD_EVENT_ON_DELETE_CREATURE = 31, // (event, creature)
|
||||||
|
|||||||
@@ -12,7 +12,6 @@
|
|||||||
*/
|
*/
|
||||||
namespace LuaItem
|
namespace LuaItem
|
||||||
{
|
{
|
||||||
/* BOOLEAN */
|
|
||||||
/**
|
/**
|
||||||
* Returns 'true' if the [Item] is soulbound, 'false' otherwise
|
* Returns 'true' if the [Item] is soulbound, 'false' otherwise
|
||||||
*
|
*
|
||||||
@@ -231,15 +230,11 @@ namespace LuaItem
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*int IsRefundExpired(Eluna* E, lua_State* L, Item* item)// TODO: Implement core support
|
||||||
* int IsRefundExpired(Eluna* E, lua_State* L, Item* item)// TODO: Implement core support
|
{
|
||||||
* {
|
Eluna::Push(L, item->IsRefundExpired());
|
||||||
* Eluna::Push(L, item->IsRefundExpired());
|
return 1;
|
||||||
* return 1;
|
}*/
|
||||||
* }
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* GETTERS */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the chat link of the [Item]
|
* Returns the chat link of the [Item]
|
||||||
@@ -295,12 +290,8 @@ namespace LuaItem
|
|||||||
}
|
}
|
||||||
if (suffix)
|
if (suffix)
|
||||||
{
|
{
|
||||||
//std::string test(suffix[(name != temp->Name1) ? loc_idx : DEFAULT_LOCALE]);
|
|
||||||
//if (!test.empty())
|
|
||||||
//{
|
|
||||||
name += ' ';
|
name += ' ';
|
||||||
name += suffix[(name != temp->Name1) ? locale : uint8(DEFAULT_LOCALE)];
|
name += suffix[(name != temp->Name1) ? locale : uint8(DEFAULT_LOCALE)];
|
||||||
/*}*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -631,7 +622,6 @@ namespace LuaItem
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* SETTERS */
|
|
||||||
/**
|
/**
|
||||||
* Sets the [Player] specified as the owner of the [Item]
|
* Sets the [Player] specified as the owner of the [Item]
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -169,7 +169,6 @@ CreatureUniqueBindings(NULL)
|
|||||||
OpenLua();
|
OpenLua();
|
||||||
|
|
||||||
// Replace this with map insert if making multithread version
|
// Replace this with map insert if making multithread version
|
||||||
//
|
|
||||||
|
|
||||||
// Set event manager. Must be after setting sEluna
|
// Set event manager. Must be after setting sEluna
|
||||||
// on multithread have a map of state pointers and here insert this pointer to the map and then save a pointer of that pointer to the EventMgr
|
// on multithread have a map of state pointers and here insert this pointer to the map and then save a pointer of that pointer to the EventMgr
|
||||||
|
|||||||
@@ -139,8 +139,8 @@ private:
|
|||||||
static std::string lua_requirepath;
|
static std::string lua_requirepath;
|
||||||
|
|
||||||
uint32 event_level;
|
uint32 event_level;
|
||||||
// When a hook pushes arguments to be passed to event handlers
|
// When a hook pushes arguments to be passed to event handlers,
|
||||||
// this is used to keep track of how many arguments were pushed.
|
// this is used to keep track of how many arguments were pushed.
|
||||||
uint8 push_counter;
|
uint8 push_counter;
|
||||||
bool enabled;
|
bool enabled;
|
||||||
|
|
||||||
@@ -160,8 +160,8 @@ private:
|
|||||||
void CloseLua();
|
void CloseLua();
|
||||||
void DestroyBindStores();
|
void DestroyBindStores();
|
||||||
void CreateBindStores();
|
void CreateBindStores();
|
||||||
bool ExecuteCall(int params, int res);
|
|
||||||
void InvalidateObjects();
|
void InvalidateObjects();
|
||||||
|
bool ExecuteCall(int params, int res);
|
||||||
|
|
||||||
// Use ReloadEluna() to make eluna reload
|
// Use ReloadEluna() to make eluna reload
|
||||||
// This is called on world update to reload eluna
|
// This is called on world update to reload eluna
|
||||||
|
|||||||
1237
LuaFunctions.cpp
1237
LuaFunctions.cpp
File diff suppressed because it is too large
Load Diff
@@ -24,7 +24,6 @@
|
|||||||
*/
|
*/
|
||||||
namespace LuaObject
|
namespace LuaObject
|
||||||
{
|
{
|
||||||
/* BOOLEAN */
|
|
||||||
/**
|
/**
|
||||||
* Returns `true` if the specified flag is set, otherwise `false`.
|
* Returns `true` if the specified flag is set, otherwise `false`.
|
||||||
*
|
*
|
||||||
@@ -52,7 +51,6 @@ namespace LuaObject
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* GETTERS */
|
|
||||||
/**
|
/**
|
||||||
* Returns the data at the specified index, casted to a signed 32-bit integer.
|
* Returns the data at the specified index, casted to a signed 32-bit integer.
|
||||||
*
|
*
|
||||||
@@ -224,7 +222,6 @@ namespace LuaObject
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* SETTERS */
|
|
||||||
/**
|
/**
|
||||||
* Sets the specified flag in the data value at the specified index.
|
* Sets the specified flag in the data value at the specified index.
|
||||||
*
|
*
|
||||||
@@ -376,7 +373,6 @@ namespace LuaObject
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* OTHER */
|
|
||||||
/**
|
/**
|
||||||
* Removes a flag from the value at the specified index.
|
* Removes a flag from the value at the specified index.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ void Eluna::OnLearnTalents(Player* pPlayer, uint32 talentId, uint32 talentRank,
|
|||||||
CallAllFunctions(PlayerEventBindings, key);
|
CallAllFunctions(PlayerEventBindings, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Player
|
|
||||||
bool Eluna::OnCommand(Player* player, const char* text)
|
bool Eluna::OnCommand(Player* player, const char* text)
|
||||||
{
|
{
|
||||||
// If from console, player is NULL
|
// If from console, player is NULL
|
||||||
|
|||||||
405
PlayerMethods.h
405
PlayerMethods.h
@@ -12,7 +12,6 @@
|
|||||||
*/
|
*/
|
||||||
namespace LuaPlayer
|
namespace LuaPlayer
|
||||||
{
|
{
|
||||||
/* BOOLEAN */
|
|
||||||
#if (!defined(TBC) && !defined(CLASSIC))
|
#if (!defined(TBC) && !defined(CLASSIC))
|
||||||
/**
|
/**
|
||||||
* Returns 'true' if the [Player] can Titan Grip, 'false' otherwise.
|
* Returns 'true' if the [Player] can Titan Grip, 'false' otherwise.
|
||||||
@@ -102,6 +101,12 @@ namespace LuaPlayer
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if [Player] has specified login flag
|
||||||
|
*
|
||||||
|
* @param uint32 flag
|
||||||
|
* @return bool hasLoginFlag
|
||||||
|
*/
|
||||||
int HasAtLoginFlag(Eluna* /*E*/, lua_State* L, Player* player)
|
int HasAtLoginFlag(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
uint32 flag = Eluna::CHECKVAL<uint32>(L, 2);
|
uint32 flag = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
@@ -110,6 +115,12 @@ namespace LuaPlayer
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if [Player] has [Quest] for [GameObject]
|
||||||
|
*
|
||||||
|
* @param int32 entry : entry of a [GameObject]
|
||||||
|
* @return bool hasQuest
|
||||||
|
*/
|
||||||
int HasQuestForGO(Eluna* /*E*/, lua_State* L, Player* player)
|
int HasQuestForGO(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
int32 entry = Eluna::CHECKVAL<int32>(L, 2);
|
int32 entry = Eluna::CHECKVAL<int32>(L, 2);
|
||||||
@@ -260,6 +271,12 @@ namespace LuaPlayer
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CLASSIC
|
#ifdef CLASSIC
|
||||||
|
/**
|
||||||
|
* Returns [Player] kills
|
||||||
|
*
|
||||||
|
* @param bool honorable = true : if victims are honorable
|
||||||
|
* @return uint32 kills
|
||||||
|
*/
|
||||||
int GetHonorStoredKills(Eluna* /*E*/, lua_State* L, Player* player)
|
int GetHonorStoredKills(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
bool honorable = Eluna::CHECKVAL<bool>(L, 2, true);
|
bool honorable = Eluna::CHECKVAL<bool>(L, 2, true);
|
||||||
@@ -268,12 +285,22 @@ namespace LuaPlayer
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns rank points
|
||||||
|
*
|
||||||
|
* @return float rankPoints
|
||||||
|
*/
|
||||||
int GetRankPoints(Eluna* /*E*/, lua_State* L, Player* player)
|
int GetRankPoints(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
Eluna::Push(L, player->GetRankPoints());
|
Eluna::Push(L, player->GetRankPoints());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns last week's standing position
|
||||||
|
*
|
||||||
|
* @return int32 standingPos
|
||||||
|
*/
|
||||||
int GetHonorLastWeekStandingPos(Eluna* /*E*/, lua_State* L, Player* player)
|
int GetHonorLastWeekStandingPos(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
Eluna::Push(L, player->GetHonorLastWeekStandingPos());
|
Eluna::Push(L, player->GetHonorLastWeekStandingPos());
|
||||||
@@ -648,64 +675,63 @@ namespace LuaPlayer
|
|||||||
|
|
||||||
/*int HasReceivedQuestReward(Eluna* E, lua_State* L, Player* player)
|
/*int HasReceivedQuestReward(Eluna* E, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
uint32 entry = Eluna::CHECKVAL<uint32>(L, 2);
|
uint32 entry = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
|
|
||||||
Eluna::Push(L, player->IsQuestRewarded(entry));
|
Eluna::Push(L, player->IsQuestRewarded(entry));
|
||||||
return 1;
|
return 1;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
/*int IsOutdoorPvPActive(Eluna* E, lua_State* L, Player* player)
|
/*int IsOutdoorPvPActive(Eluna* E, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
Eluna::Push(L, player->IsOutdoorPvPActive());
|
Eluna::Push(L, player->IsOutdoorPvPActive());
|
||||||
return 1;
|
return 1;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
/*int IsImmuneToEnvironmentalDamage(Eluna* E, lua_State* L, Player* player)
|
/*int IsImmuneToEnvironmentalDamage(Eluna* E, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
Eluna::Push(L, player->IsImmuneToEnvironmentalDamage());
|
Eluna::Push(L, player->IsImmuneToEnvironmentalDamage());
|
||||||
return 1;
|
return 1;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
/*int InRandomLfgDungeon(Eluna* E, lua_State* L, Player* player)
|
/*int InRandomLfgDungeon(Eluna* E, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
Eluna::Push(L, player->inRandomLfgDungeon());
|
Eluna::Push(L, player->inRandomLfgDungeon());
|
||||||
return 1;
|
return 1;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
/*int IsUsingLfg(Eluna* E, lua_State* L, Player* player)
|
/*int IsUsingLfg(Eluna* E, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
Eluna::Push(L, player->isUsingLfg());
|
Eluna::Push(L, player->isUsingLfg());
|
||||||
return 1;
|
return 1;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
/*int IsNeverVisible(Eluna* E, lua_State* L, Player* player)
|
/*int IsNeverVisible(Eluna* E, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
Eluna::Push(L, player->IsNeverVisible());
|
Eluna::Push(L, player->IsNeverVisible());
|
||||||
return 1;
|
return 1;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
/*int CanFlyInZone(Eluna* E, lua_State* L, Player* player)
|
/*int CanFlyInZone(Eluna* E, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
uint32 mapid = Eluna::CHECKVAL<uint32>(L, 2);
|
uint32 mapid = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
uint32 zone = Eluna::CHECKVAL<uint32>(L, 2);
|
uint32 zone = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
|
|
||||||
Eluna::Push(L, player->IsKnowHowFlyIn(mapid, zone));
|
Eluna::Push(L, player->IsKnowHowFlyIn(mapid, zone));
|
||||||
return 1;
|
return 1;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
/*int HasPendingBind(Eluna* E, lua_State* L, Player* player)
|
/*int HasPendingBind(Eluna* E, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
Eluna::Push(L, player->PendingHasPendingBind());
|
Eluna::Push(L, player->PendingHasPendingBind());
|
||||||
return 1;
|
return 1;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
/*int IsARecruiter(Eluna* E, lua_State* L, Player* player)
|
/*int IsARecruiter(Eluna* E, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
Eluna::Push(L, player->GetSession()->IsARecruiter() || (player->GetSession()->GetRecruiterId() != 0));
|
Eluna::Push(L, player->GetSession()->IsARecruiter() || (player->GetSession()->GetRecruiterId() != 0));
|
||||||
return 1;
|
return 1;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
/* GETTERS */
|
|
||||||
#if (!defined(TBC) && !defined(CLASSIC))
|
#if (!defined(TBC) && !defined(CLASSIC))
|
||||||
/**
|
/**
|
||||||
* Returns the amount of available specs the [Player] currently has
|
* Returns the amount of available specs the [Player] currently has
|
||||||
@@ -869,12 +895,23 @@ namespace LuaPlayer
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns [Group] invitation
|
||||||
|
*
|
||||||
|
* @return [Group] group
|
||||||
|
*/
|
||||||
int GetGroupInvite(Eluna* /*E*/, lua_State* L, Player* player)
|
int GetGroupInvite(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
Eluna::Push(L, player->GetGroupInvite());
|
Eluna::Push(L, player->GetGroupInvite());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns rested experience bonus
|
||||||
|
*
|
||||||
|
* @param uint32 xp
|
||||||
|
* @return uint32 xpBonus
|
||||||
|
*/
|
||||||
int GetXPRestBonus(Eluna* /*E*/, lua_State* L, Player* player)
|
int GetXPRestBonus(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
uint32 xp = Eluna::CHECKVAL<uint32>(L, 2);
|
uint32 xp = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
@@ -938,6 +975,12 @@ namespace LuaPlayer
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns skill temporary bonus value
|
||||||
|
*
|
||||||
|
* @param uint32 skill
|
||||||
|
* @param int16 bonusVal
|
||||||
|
*/
|
||||||
int GetSkillTempBonusValue(Eluna* /*E*/, lua_State* L, Player* player)
|
int GetSkillTempBonusValue(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
uint32 skill = Eluna::CHECKVAL<uint32>(L, 2);
|
uint32 skill = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
@@ -946,6 +989,12 @@ namespace LuaPlayer
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns skill permanent bonus value
|
||||||
|
*
|
||||||
|
* @param uint32 skill
|
||||||
|
* @param int16 bonusVal
|
||||||
|
*/
|
||||||
int GetSkillPermBonusValue(Eluna* /*E*/, lua_State* L, Player* player)
|
int GetSkillPermBonusValue(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
uint32 skill = Eluna::CHECKVAL<uint32>(L, 2);
|
uint32 skill = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
@@ -954,6 +1003,12 @@ namespace LuaPlayer
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns skill value without bonus'
|
||||||
|
*
|
||||||
|
* @param uint32 skill
|
||||||
|
* @return uint16 pureVal
|
||||||
|
*/
|
||||||
int GetPureSkillValue(Eluna* /*E*/, lua_State* L, Player* player)
|
int GetPureSkillValue(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
uint32 skill = Eluna::CHECKVAL<uint32>(L, 2);
|
uint32 skill = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
@@ -962,6 +1017,12 @@ namespace LuaPlayer
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns base skill value
|
||||||
|
*
|
||||||
|
* @param uint32 skill
|
||||||
|
* @return uint16 baseVal
|
||||||
|
*/
|
||||||
int GetBaseSkillValue(Eluna* /*E*/, lua_State* L, Player* player)
|
int GetBaseSkillValue(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
uint32 skill = Eluna::CHECKVAL<uint32>(L, 2);
|
uint32 skill = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
@@ -970,6 +1031,12 @@ namespace LuaPlayer
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns skill value
|
||||||
|
*
|
||||||
|
* @param uint32 skill
|
||||||
|
* @return uint16 val
|
||||||
|
*/
|
||||||
int GetSkillValue(Eluna* /*E*/, lua_State* L, Player* player)
|
int GetSkillValue(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
uint32 skill = Eluna::CHECKVAL<uint32>(L, 2);
|
uint32 skill = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
@@ -978,6 +1045,12 @@ namespace LuaPlayer
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns max value of specified skill without bonus'
|
||||||
|
*
|
||||||
|
* @param uint32 skill
|
||||||
|
* @return uint16 pureVal
|
||||||
|
*/
|
||||||
int GetPureMaxSkillValue(Eluna* /*E*/, lua_State* L, Player* player)
|
int GetPureMaxSkillValue(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
uint32 skill = Eluna::CHECKVAL<uint32>(L, 2);
|
uint32 skill = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
@@ -986,6 +1059,12 @@ namespace LuaPlayer
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns max value of specified skill
|
||||||
|
*
|
||||||
|
* @param uint32 skill
|
||||||
|
* @return uint16 val
|
||||||
|
*/
|
||||||
int GetMaxSkillValue(Eluna* /*E*/, lua_State* L, Player* player)
|
int GetMaxSkillValue(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
uint32 skill = Eluna::CHECKVAL<uint32>(L, 2);
|
uint32 skill = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
@@ -994,18 +1073,34 @@ namespace LuaPlayer
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns mana bonus from amount of intellect
|
||||||
|
*
|
||||||
|
* @return float bonus
|
||||||
|
*/
|
||||||
int GetManaBonusFromIntellect(Eluna* /*E*/, lua_State* L, Player* player)
|
int GetManaBonusFromIntellect(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
Eluna::Push(L, player->GetManaBonusFromIntellect());
|
Eluna::Push(L, player->GetManaBonusFromIntellect());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns health bonus from amount of stamina
|
||||||
|
*
|
||||||
|
* @return float bonus
|
||||||
|
*/
|
||||||
int GetHealthBonusFromStamina(Eluna* /*E*/, lua_State* L, Player* player)
|
int GetHealthBonusFromStamina(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
Eluna::Push(L, player->GetHealthBonusFromStamina());
|
Eluna::Push(L, player->GetHealthBonusFromStamina());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns raid or dungeon difficulty
|
||||||
|
*
|
||||||
|
* @param bool isRaid = true : argument is TrinityCore only
|
||||||
|
* @return int32 difficulty
|
||||||
|
*/
|
||||||
int GetDifficulty(Eluna* /*E*/, lua_State* L, Player* player)
|
int GetDifficulty(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
#ifdef TBC
|
#ifdef TBC
|
||||||
@@ -1068,6 +1163,11 @@ namespace LuaPlayer
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns [Unit] target combo points are on
|
||||||
|
*
|
||||||
|
* @return [Unit] target
|
||||||
|
*/
|
||||||
int GetComboTarget(Eluna* /*E*/, lua_State* L, Player* player)
|
int GetComboTarget(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#ifndef TRINITY
|
||||||
@@ -1078,6 +1178,11 @@ namespace LuaPlayer
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns [Player]'s combo points
|
||||||
|
*
|
||||||
|
* @return uint8 comboPoints
|
||||||
|
*/
|
||||||
int GetComboPoints(Eluna* /*E*/, lua_State* L, Player* player)
|
int GetComboPoints(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
Eluna::Push(L, player->GetComboPoints());
|
Eluna::Push(L, player->GetComboPoints());
|
||||||
@@ -1123,6 +1228,13 @@ namespace LuaPlayer
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns [Quest] required [Creature] or [GameObject] count
|
||||||
|
*
|
||||||
|
* @param uint32 quest : entry of a quest
|
||||||
|
* @param int32 entry : entry of required [Creature]
|
||||||
|
* @return uint16 count
|
||||||
|
*/
|
||||||
int GetReqKillOrCastCurrentCount(Eluna* /*E*/, lua_State* L, Player* player)
|
int GetReqKillOrCastCurrentCount(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
uint32 questId = Eluna::CHECKVAL<uint32>(L, 2);
|
uint32 questId = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
@@ -1178,6 +1290,11 @@ namespace LuaPlayer
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns active GM chat tag
|
||||||
|
*
|
||||||
|
* @return uint8 tag
|
||||||
|
*/
|
||||||
int GetChatTag(Eluna* /*E*/, lua_State* L, Player* player)
|
int GetChatTag(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
Eluna::Push(L, player->GetChatTag());
|
Eluna::Push(L, player->GetChatTag());
|
||||||
@@ -1461,30 +1578,28 @@ namespace LuaPlayer
|
|||||||
|
|
||||||
/*int GetRecruiterId(Eluna* E, lua_State* L, Player* player)
|
/*int GetRecruiterId(Eluna* E, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
Eluna::Push(L, player->GetSession()->GetRecruiterId());
|
Eluna::Push(L, player->GetSession()->GetRecruiterId());
|
||||||
return 1;
|
return 1;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
/*int GetSelectedPlayer(Eluna* E, lua_State* L, Player* player)
|
/*int GetSelectedPlayer(Eluna* E, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
Eluna::Push(L, player->GetSelectedPlayer());
|
Eluna::Push(L, player->GetSelectedPlayer());
|
||||||
return 1;
|
return 1;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
/*int GetSelectedUnit(Eluna* E, lua_State* L, Player* player)
|
/*int GetSelectedUnit(Eluna* E, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
Eluna::Push(L, player->GetSelectedUnit());
|
Eluna::Push(L, player->GetSelectedUnit());
|
||||||
return 1;
|
return 1;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
/*int GetNearbyGameObject(Eluna* E, lua_State* L, Player* player)
|
/*int GetNearbyGameObject(Eluna* E, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
Eluna::Push(L, ChatHandler(player->GetSession()).GetNearbyGameObject());
|
Eluna::Push(L, ChatHandler(player->GetSession()).GetNearbyGameObject());
|
||||||
return 1;
|
return 1;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
/* SETTERS */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Locks the player controls and disallows all movement and casting.
|
* Locks the player controls and disallows all movement and casting.
|
||||||
*
|
*
|
||||||
@@ -1561,6 +1676,14 @@ namespace LuaPlayer
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets (increases) skill of the [Player]
|
||||||
|
*
|
||||||
|
* @param uint16 id
|
||||||
|
* @param uint16 step
|
||||||
|
* @param uint16 currVal
|
||||||
|
* @param uint16 maxVal
|
||||||
|
*/
|
||||||
int SetSkill(Eluna* /*E*/, lua_State* L, Player* player)
|
int SetSkill(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
uint16 id = Eluna::CHECKVAL<uint16>(L, 2);
|
uint16 id = Eluna::CHECKVAL<uint16>(L, 2);
|
||||||
@@ -1620,6 +1743,12 @@ namespace LuaPlayer
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets [Quest] state
|
||||||
|
*
|
||||||
|
* @param uint32 entry : entry of a quest
|
||||||
|
* @param uint32 status
|
||||||
|
*/
|
||||||
int SetQuestStatus(Eluna* /*E*/, lua_State* L, Player* player)
|
int SetQuestStatus(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
uint32 entry = Eluna::CHECKVAL<uint32>(L, 2);
|
uint32 entry = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
@@ -1657,6 +1786,11 @@ namespace LuaPlayer
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggles PvP Death
|
||||||
|
*
|
||||||
|
* @param bool on = true
|
||||||
|
*/
|
||||||
int SetPvPDeath(Eluna* /*E*/, lua_State* L, Player* player)
|
int SetPvPDeath(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
bool on = Eluna::CHECKVAL<bool>(L, 2, true);
|
bool on = Eluna::CHECKVAL<bool>(L, 2, true);
|
||||||
@@ -1691,6 +1825,11 @@ namespace LuaPlayer
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggle Blizz (GM) tag
|
||||||
|
*
|
||||||
|
* @param bool on = true
|
||||||
|
*/
|
||||||
int SetGMChat(Eluna* /*E*/, lua_State* L, Player* player)
|
int SetGMChat(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
bool on = Eluna::CHECKVAL<bool>(L, 2, true);
|
bool on = Eluna::CHECKVAL<bool>(L, 2, true);
|
||||||
@@ -1772,6 +1911,12 @@ namespace LuaPlayer
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CLASSIC
|
#ifdef CLASSIC
|
||||||
|
/**
|
||||||
|
* Sets kills
|
||||||
|
*
|
||||||
|
* @param uint32 kills
|
||||||
|
* @param bool honorable = true : if victims were honorable
|
||||||
|
*/
|
||||||
int SetHonorStoredKills(Eluna* /*E*/, lua_State* L, Player* player)
|
int SetHonorStoredKills(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
uint32 kills = Eluna::CHECKVAL<uint32>(L, 2);
|
uint32 kills = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
@@ -1781,6 +1926,11 @@ namespace LuaPlayer
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets rank points
|
||||||
|
*
|
||||||
|
* @param float rankPoints
|
||||||
|
*/
|
||||||
int SetRankPoints(Eluna* /*E*/, lua_State* L, Player* player)
|
int SetRankPoints(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
float rankPoints = Eluna::CHECKVAL<float>(L, 2);
|
float rankPoints = Eluna::CHECKVAL<float>(L, 2);
|
||||||
@@ -1789,6 +1939,11 @@ namespace LuaPlayer
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets last week's honor standing position
|
||||||
|
*
|
||||||
|
* @param int32 standingPos
|
||||||
|
*/
|
||||||
int SetHonorLastWeekStandingPos(Eluna* /*E*/, lua_State* L, Player* player)
|
int SetHonorLastWeekStandingPos(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
int32 standingPos = Eluna::CHECKVAL<int32>(L, 2);
|
int32 standingPos = Eluna::CHECKVAL<int32>(L, 2);
|
||||||
@@ -1881,13 +2036,12 @@ namespace LuaPlayer
|
|||||||
|
|
||||||
/*int SetMovement(Eluna* E, lua_State* L, Player* player)
|
/*int SetMovement(Eluna* E, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
int32 pType = Eluna::CHECKVAL<int32>(L, 2);
|
int32 pType = Eluna::CHECKVAL<int32>(L, 2);
|
||||||
|
|
||||||
player->SetMovement((PlayerMovementType)pType);
|
player->SetMovement((PlayerMovementType)pType);
|
||||||
return 0;
|
return 0;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
/* OTHER */
|
|
||||||
#if (!defined(TBC) && !defined(CLASSIC))
|
#if (!defined(TBC) && !defined(CLASSIC))
|
||||||
/**
|
/**
|
||||||
* Resets the [Player]s pets talent points
|
* Resets the [Player]s pets talent points
|
||||||
@@ -2028,6 +2182,9 @@ namespace LuaPlayer
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the [Player]'s corpse
|
||||||
|
*/
|
||||||
int CreateCorpse(Eluna* /*E*/, lua_State* /*L*/, Player* player)
|
int CreateCorpse(Eluna* /*E*/, lua_State* /*L*/, Player* player)
|
||||||
{
|
{
|
||||||
player->CreateCorpse();
|
player->CreateCorpse();
|
||||||
@@ -2261,6 +2418,15 @@ namespace LuaPlayer
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Repairs [Item] at specified position. Returns total repair cost
|
||||||
|
*
|
||||||
|
* @param uint16 position
|
||||||
|
* @param bool cost = true
|
||||||
|
* @param float discountMod
|
||||||
|
* @param bool guildBank = false
|
||||||
|
* @return uint32 totalCost
|
||||||
|
*/
|
||||||
int DurabilityRepair(Eluna* /*E*/, lua_State* L, Player* player)
|
int DurabilityRepair(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
uint16 position = Eluna::CHECKVAL<uint16>(L, 2);
|
uint16 position = Eluna::CHECKVAL<uint16>(L, 2);
|
||||||
@@ -2276,6 +2442,14 @@ namespace LuaPlayer
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Repairs all [Item]s. Returns total repair cost
|
||||||
|
*
|
||||||
|
* @param bool cost = true
|
||||||
|
* @param float discountMod = 1
|
||||||
|
* @param bool guidBank = false
|
||||||
|
* @return uint32 totalCost
|
||||||
|
*/
|
||||||
int DurabilityRepairAll(Eluna* /*E*/, lua_State* L, Player* player)
|
int DurabilityRepairAll(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
bool cost = Eluna::CHECKVAL<bool>(L, 2, true);
|
bool cost = Eluna::CHECKVAL<bool>(L, 2, true);
|
||||||
@@ -2290,6 +2464,11 @@ namespace LuaPlayer
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets durability loss for an [Item] in the specified slot
|
||||||
|
*
|
||||||
|
* @param int32 slot
|
||||||
|
*/
|
||||||
int DurabilityPointLossForEquipSlot(Eluna* /*E*/, lua_State* L, Player* player)
|
int DurabilityPointLossForEquipSlot(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
int32 slot = Eluna::CHECKVAL<int32>(L, 2);
|
int32 slot = Eluna::CHECKVAL<int32>(L, 2);
|
||||||
@@ -2299,6 +2478,14 @@ namespace LuaPlayer
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets durability loss on all [Item]s equipped
|
||||||
|
*
|
||||||
|
* If inventory is true, sets durability loss for [Item]s in bags
|
||||||
|
*
|
||||||
|
* @param int32 points
|
||||||
|
* @param bool inventory = true
|
||||||
|
*/
|
||||||
int DurabilityPointsLossAll(Eluna* /*E*/, lua_State* L, Player* player)
|
int DurabilityPointsLossAll(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
int32 points = Eluna::CHECKVAL<int32>(L, 2);
|
int32 points = Eluna::CHECKVAL<int32>(L, 2);
|
||||||
@@ -2308,6 +2495,12 @@ namespace LuaPlayer
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets durability loss for the specified [Item]
|
||||||
|
*
|
||||||
|
* @param [Item] item
|
||||||
|
* @param int32 points
|
||||||
|
*/
|
||||||
int DurabilityPointsLoss(Eluna* /*E*/, lua_State* L, Player* player)
|
int DurabilityPointsLoss(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
Item* item = Eluna::CHECKOBJ<Item>(L, 2);
|
Item* item = Eluna::CHECKOBJ<Item>(L, 2);
|
||||||
@@ -2317,6 +2510,12 @@ namespace LuaPlayer
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Damages specified [Item]
|
||||||
|
*
|
||||||
|
* @param [Item] item
|
||||||
|
* @param double percent
|
||||||
|
*/
|
||||||
int DurabilityLoss(Eluna* /*E*/, lua_State* L, Player* player)
|
int DurabilityLoss(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
Item* item = Eluna::CHECKOBJ<Item>(L, 2);
|
Item* item = Eluna::CHECKOBJ<Item>(L, 2);
|
||||||
@@ -2326,6 +2525,12 @@ namespace LuaPlayer
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Damages all [Item]s equipped. If inventory is true, damages [Item]s in bags
|
||||||
|
*
|
||||||
|
* @param double percent
|
||||||
|
* @param bool inventory = true
|
||||||
|
*/
|
||||||
int DurabilityLossAll(Eluna* /*E*/, lua_State* L, Player* player)
|
int DurabilityLossAll(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
double percent = Eluna::CHECKVAL<double>(L, 2);
|
double percent = Eluna::CHECKVAL<double>(L, 2);
|
||||||
@@ -2399,6 +2604,13 @@ namespace LuaPlayer
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the [Spell] from the [Player]
|
||||||
|
*
|
||||||
|
* @param uint32 entry : entry of a [Spell]
|
||||||
|
* @param bool disabled = false
|
||||||
|
* @param bool learnLowRank = true
|
||||||
|
*/
|
||||||
int RemoveSpell(Eluna* /*E*/, lua_State* L, Player* player)
|
int RemoveSpell(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
uint32 entry = Eluna::CHECKVAL<uint32>(L, 2);
|
uint32 entry = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
@@ -2422,6 +2634,12 @@ namespace LuaPlayer
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds combo points to the [Player]
|
||||||
|
*
|
||||||
|
* @param [Unit] target
|
||||||
|
* @param int8 count
|
||||||
|
*/
|
||||||
int AddComboPoints(Eluna* /*E*/, lua_State* L, Player* player)
|
int AddComboPoints(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
Unit* target = Eluna::CHECKOBJ<Unit>(L, 2);
|
Unit* target = Eluna::CHECKOBJ<Unit>(L, 2);
|
||||||
@@ -2431,6 +2649,12 @@ namespace LuaPlayer
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gives [Quest] monster talked to credit
|
||||||
|
*
|
||||||
|
* @param uint32 entry : entry of a [Creature]
|
||||||
|
* @param [Creature] creature
|
||||||
|
*/
|
||||||
int TalkedToCreature(Eluna* /*E*/, lua_State* L, Player* player)
|
int TalkedToCreature(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
uint32 entry = Eluna::CHECKVAL<uint32>(L, 2);
|
uint32 entry = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
@@ -2440,6 +2664,11 @@ namespace LuaPlayer
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gives [Quest] monster killed credit
|
||||||
|
*
|
||||||
|
* @param uint32 entry : entry of a [Creature]
|
||||||
|
*/
|
||||||
int KilledMonsterCredit(Eluna* /*E*/, lua_State* L, Player* player)
|
int KilledMonsterCredit(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
uint32 entry = Eluna::CHECKVAL<uint32>(L, 2);
|
uint32 entry = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
@@ -2448,6 +2677,12 @@ namespace LuaPlayer
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Completes a [Quest] if in a [Group]
|
||||||
|
*
|
||||||
|
* @param uint32 quest : entry of a quest
|
||||||
|
* @param [WorldObject] obj
|
||||||
|
*/
|
||||||
int GroupEventHappens(Eluna* /*E*/, lua_State* L, Player* player)
|
int GroupEventHappens(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
uint32 questId = Eluna::CHECKVAL<uint32>(L, 2);
|
uint32 questId = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
@@ -2457,6 +2692,11 @@ namespace LuaPlayer
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Completes the [Quest] if a [Quest] area is explored, or completes the [Quest]
|
||||||
|
*
|
||||||
|
* @param uint32 quest : entry of a [Quest]
|
||||||
|
*/
|
||||||
int AreaExploredOrEventHappens(Eluna* /*E*/, lua_State* L, Player* player)
|
int AreaExploredOrEventHappens(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
uint32 questId = Eluna::CHECKVAL<uint32>(L, 2);
|
uint32 questId = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
@@ -2466,9 +2706,9 @@ namespace LuaPlayer
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the given quest entry failed for the [Player].
|
* Sets the given [Quest] entry failed for the [Player].
|
||||||
*
|
*
|
||||||
* @param uint32 entry : quest entry
|
* @param uint32 entry : entry of a [Quest]
|
||||||
*/
|
*/
|
||||||
int FailQuest(Eluna* /*E*/, lua_State* L, Player* player)
|
int FailQuest(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
@@ -2715,6 +2955,14 @@ namespace LuaPlayer
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends whisper text from the [Player]
|
||||||
|
*
|
||||||
|
* @param string text
|
||||||
|
* @param uint32 lang : language the [Player] will speak
|
||||||
|
* @param [Player] receiver : is the [Player] that will receive the whisper, if TrinityCore
|
||||||
|
* @param uint64 guid : is the GUID of a [Player] that will receive the whisper, not TrinityCore
|
||||||
|
*/
|
||||||
int Whisper(Eluna* /*E*/, lua_State* L, Player* player)
|
int Whisper(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
std::string text = Eluna::CHECKVAL<std::string>(L, 2);
|
std::string text = Eluna::CHECKVAL<std::string>(L, 2);
|
||||||
@@ -2745,6 +2993,12 @@ namespace LuaPlayer
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends yell text from the [Player]
|
||||||
|
*
|
||||||
|
* @param string text : text for the [Player] to yells
|
||||||
|
* @param uint32 lang : language the [Player] will speak
|
||||||
|
*/
|
||||||
int Yell(Eluna* /*E*/, lua_State* L, Player* player)
|
int Yell(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
std::string text = Eluna::CHECKVAL<std::string>(L, 2);
|
std::string text = Eluna::CHECKVAL<std::string>(L, 2);
|
||||||
@@ -2757,6 +3011,12 @@ namespace LuaPlayer
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends say text from the [Player]
|
||||||
|
*
|
||||||
|
* @param string text : text for the [Player] to say
|
||||||
|
* @param uint32 lang : language the [Player] will speak
|
||||||
|
*/
|
||||||
int Say(Eluna* /*E*/, lua_State* L, Player* player)
|
int Say(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
std::string text = Eluna::CHECKVAL<std::string>(L, 2);
|
std::string text = Eluna::CHECKVAL<std::string>(L, 2);
|
||||||
@@ -2769,6 +3029,12 @@ namespace LuaPlayer
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gives the [Player] experience
|
||||||
|
*
|
||||||
|
* @param uint32 xp : experience to give
|
||||||
|
* @param [Unit] victim = nil
|
||||||
|
*/
|
||||||
int GiveXP(Eluna* /*E*/, lua_State* L, Player* player)
|
int GiveXP(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
uint32 xp = Eluna::CHECKVAL<uint32>(L, 2);
|
uint32 xp = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
@@ -3063,6 +3329,11 @@ namespace LuaPlayer
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes specified amount of lifetime kills
|
||||||
|
*
|
||||||
|
* @param uint32 val : kills to remove
|
||||||
|
*/
|
||||||
int RemoveLifetimeKills(Eluna* /*E*/, lua_State* L, Player* player)
|
int RemoveLifetimeKills(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
uint32 val = Eluna::CHECKVAL<uint32>(L, 2);
|
uint32 val = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
@@ -3073,6 +3344,12 @@ namespace LuaPlayer
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resets cooldown of the specified spell
|
||||||
|
*
|
||||||
|
* @param uint32 spellId
|
||||||
|
* @param bool update = true
|
||||||
|
*/
|
||||||
int ResetSpellCooldown(Eluna* /*E*/, lua_State* L, Player* player)
|
int ResetSpellCooldown(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
uint32 spellId = Eluna::CHECKVAL<uint32>(L, 2);
|
uint32 spellId = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
@@ -3085,6 +3362,12 @@ namespace LuaPlayer
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resets cooldown of the specified category
|
||||||
|
*
|
||||||
|
* @param uint32 category
|
||||||
|
* @param bool update = true
|
||||||
|
*/
|
||||||
int ResetTypeCooldowns(Eluna* /*E*/, lua_State* L, Player* player)
|
int ResetTypeCooldowns(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
uint32 category = Eluna::CHECKVAL<uint32>(L, 2);
|
uint32 category = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
@@ -3103,7 +3386,7 @@ namespace LuaPlayer
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resets all of the [Player]s cooldowns
|
* Resets all of the [Player]'s cooldowns
|
||||||
*/
|
*/
|
||||||
int ResetAllCooldowns(Eluna* /*E*/, lua_State* /*L*/, Player* player)
|
int ResetAllCooldowns(Eluna* /*E*/, lua_State* /*L*/, Player* player)
|
||||||
{
|
{
|
||||||
@@ -3115,6 +3398,12 @@ namespace LuaPlayer
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears a cooldown of the specified spell
|
||||||
|
*
|
||||||
|
* @param uint32 spellId : entry of a spell
|
||||||
|
* @param [Unit] target
|
||||||
|
*/
|
||||||
int SendClearCooldowns(Eluna* /*E*/, lua_State* L, Player* player)
|
int SendClearCooldowns(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
uint32 spellId = Eluna::CHECKVAL<uint32>(L, 2);
|
uint32 spellId = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
@@ -3127,6 +3416,7 @@ namespace LuaPlayer
|
|||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends a Broadcast Message to the [Player]
|
* Sends a Broadcast Message to the [Player]
|
||||||
*
|
*
|
||||||
@@ -3183,6 +3473,16 @@ namespace LuaPlayer
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends addon message to the [Player] receiver
|
||||||
|
*
|
||||||
|
* @param string prefix
|
||||||
|
* @param string message
|
||||||
|
* @param uint8 channel
|
||||||
|
* @param [Player] receiver
|
||||||
|
* @param string fullMsg
|
||||||
|
*
|
||||||
|
*/
|
||||||
int SendAddonMessage(Eluna* /*E*/, lua_State* L, Player* player)
|
int SendAddonMessage(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
std::string prefix = Eluna::CHECKVAL<std::string>(L, 2);
|
std::string prefix = Eluna::CHECKVAL<std::string>(L, 2);
|
||||||
@@ -3371,6 +3671,13 @@ namespace LuaPlayer
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plays sound to [Player]
|
||||||
|
*
|
||||||
|
* See [Unit]:PlayDirectSound
|
||||||
|
*
|
||||||
|
* @param uint32 sound : entry of a sound
|
||||||
|
*/
|
||||||
int PlaySoundToPlayer(Eluna* /*E*/, lua_State* L, Player* player)
|
int PlaySoundToPlayer(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
uint32 soundId = Eluna::CHECKVAL<uint32>(L, 2);
|
uint32 soundId = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
@@ -3395,6 +3702,16 @@ namespace LuaPlayer
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends POI to the location on your map
|
||||||
|
*
|
||||||
|
* @param float x
|
||||||
|
* @param float y
|
||||||
|
* @param uint32 icon : map icon to show
|
||||||
|
* @param uint32 flags
|
||||||
|
* @param uint32 data
|
||||||
|
* @param string iconText
|
||||||
|
*/
|
||||||
int GossipSendPOI(Eluna* /*E*/, lua_State* L, Player* player)
|
int GossipSendPOI(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
float x = Eluna::CHECKVAL<float>(L, 2);
|
float x = Eluna::CHECKVAL<float>(L, 2);
|
||||||
@@ -3456,12 +3773,20 @@ namespace LuaPlayer
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts [Player]'s corpse to bones
|
||||||
|
*/
|
||||||
int SpawnBones(Eluna* /*E*/, lua_State* /*L*/, Player* player)
|
int SpawnBones(Eluna* /*E*/, lua_State* /*L*/, Player* player)
|
||||||
{
|
{
|
||||||
player->SpawnCorpseBones();
|
player->SpawnCorpseBones();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loots [Player]'s bones for insignia
|
||||||
|
*
|
||||||
|
* @param [Player] looter
|
||||||
|
*/
|
||||||
int RemovedInsignia(Eluna* /*E*/, lua_State* L, Player* player)
|
int RemovedInsignia(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
Player* looter = Eluna::CHECKOBJ<Player>(L, 2);
|
Player* looter = Eluna::CHECKOBJ<Player>(L, 2);
|
||||||
|
|||||||
@@ -180,8 +180,8 @@ namespace LuaQuest
|
|||||||
|
|
||||||
/*int GetMaxLevel(Eluna* E, lua_State* L, Quest* quest)
|
/*int GetMaxLevel(Eluna* E, lua_State* L, Quest* quest)
|
||||||
{
|
{
|
||||||
Eluna::Push(L, quest->GetMaxLevel());
|
Eluna::Push(L, quest->GetMaxLevel());
|
||||||
return 1;
|
return 1;
|
||||||
}*/
|
}*/
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ void Eluna::OnLuaStateOpen()
|
|||||||
CallAllFunctions(ServerEventBindings, key);
|
CallAllFunctions(ServerEventBindings, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
// areatrigger
|
// AreaTrigger
|
||||||
bool Eluna::OnAreaTrigger(Player* pPlayer, AreaTriggerEntry const* pTrigger)
|
bool Eluna::OnAreaTrigger(Player* pPlayer, AreaTriggerEntry const* pTrigger)
|
||||||
{
|
{
|
||||||
START_HOOK_WITH_RETVAL(TRIGGER_EVENT_ON_TRIGGER, false);
|
START_HOOK_WITH_RETVAL(TRIGGER_EVENT_ON_TRIGGER, false);
|
||||||
@@ -94,7 +94,7 @@ bool Eluna::OnAreaTrigger(Player* pPlayer, AreaTriggerEntry const* pTrigger)
|
|||||||
return CallAllFunctionsBool(ServerEventBindings, key);
|
return CallAllFunctionsBool(ServerEventBindings, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
// weather
|
// Weather
|
||||||
void Eluna::OnChange(Weather* weather, uint32 zone, WeatherState state, float grade)
|
void Eluna::OnChange(Weather* weather, uint32 zone, WeatherState state, float grade)
|
||||||
{
|
{
|
||||||
START_HOOK(WEATHER_EVENT_ON_CHANGE);
|
START_HOOK(WEATHER_EVENT_ON_CHANGE);
|
||||||
|
|||||||
265
UnitMethods.h
265
UnitMethods.h
@@ -12,7 +12,13 @@
|
|||||||
*/
|
*/
|
||||||
namespace LuaUnit
|
namespace LuaUnit
|
||||||
{
|
{
|
||||||
/* BOOLEAN */
|
/**
|
||||||
|
* The [Unit] tries to attack a given target
|
||||||
|
*
|
||||||
|
* @param [Unit] who : [Unit] to attack
|
||||||
|
* @param bool meleeAttack = false: attack with melee or not
|
||||||
|
* @return didAttack : if the [Unit] did not attack
|
||||||
|
*/
|
||||||
int Attack(Eluna* /*E*/, lua_State* L, Unit* unit)
|
int Attack(Eluna* /*E*/, lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
Unit* who = Eluna::CHECKOBJ<Unit>(L, 2);
|
Unit* who = Eluna::CHECKOBJ<Unit>(L, 2);
|
||||||
@@ -22,6 +28,11 @@ namespace LuaUnit
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The [Unit] stops attacking its target
|
||||||
|
*
|
||||||
|
* @return bool isAttacking : if the [Unit] wasn't attacking already
|
||||||
|
*/
|
||||||
int AttackStop(Eluna* /*E*/, lua_State* L, Unit* unit)
|
int AttackStop(Eluna* /*E*/, lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
Eluna::Push(L, unit->AttackStop());
|
Eluna::Push(L, unit->AttackStop());
|
||||||
@@ -574,24 +585,22 @@ namespace LuaUnit
|
|||||||
|
|
||||||
/*int IsVisible(Eluna* E, lua_State* L, Unit* unit)
|
/*int IsVisible(Eluna* E, lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
Eluna::Push(L, unit->IsVisible());
|
Eluna::Push(L, unit->IsVisible());
|
||||||
return 1;
|
return 1;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
/*int IsMoving(Eluna* E, lua_State* L, Unit* unit)
|
/*int IsMoving(Eluna* E, lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
Eluna::Push(L, unit->isMoving());
|
Eluna::Push(L, unit->isMoving());
|
||||||
return 1;
|
return 1;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
/*int IsFlying(Eluna* E, lua_State* L, Unit* unit)
|
/*int IsFlying(Eluna* E, lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
Eluna::Push(L, unit->IsFlying());
|
Eluna::Push(L, unit->IsFlying());
|
||||||
return 1;
|
return 1;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
/* GETTERS */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the [Unit]'s owner.
|
* Returns the [Unit]'s owner.
|
||||||
*
|
*
|
||||||
@@ -719,6 +728,12 @@ namespace LuaUnit
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns [Unit]'s specified stat
|
||||||
|
*
|
||||||
|
* @param uint32 statType
|
||||||
|
* @return float stat
|
||||||
|
*/
|
||||||
int GetStat(Eluna* /*E*/, lua_State* L, Unit* unit)
|
int GetStat(Eluna* /*E*/, lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
uint32 stat = Eluna::CHECKVAL<uint32>(L, 2);
|
uint32 stat = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
@@ -730,6 +745,12 @@ namespace LuaUnit
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the [Unit]'s base spell power
|
||||||
|
*
|
||||||
|
* @param uint32 spellSchool
|
||||||
|
* @return uint32 spellPower
|
||||||
|
*/
|
||||||
int GetBaseSpellPower(Eluna* /*E*/, lua_State* L, Unit* unit)
|
int GetBaseSpellPower(Eluna* /*E*/, lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
uint32 spellschool = Eluna::CHECKVAL<uint32>(L, 2);
|
uint32 spellschool = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
@@ -1142,6 +1163,11 @@ namespace LuaUnit
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the [Unit]'s combat timer
|
||||||
|
*
|
||||||
|
* @return uint32 combatTimer
|
||||||
|
*/
|
||||||
int GetCombatTime(Eluna* /*E*/, lua_State* L, Unit* unit)
|
int GetCombatTime(Eluna* /*E*/, lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
Eluna::Push(L, unit->GetCombatTimer());
|
Eluna::Push(L, unit->GetCombatTimer());
|
||||||
@@ -1225,6 +1251,11 @@ namespace LuaUnit
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if (!defined(TBC) && !defined(CLASSIC))
|
#if (!defined(TBC) && !defined(CLASSIC))
|
||||||
|
/**
|
||||||
|
* Returns [Unit]'s [Vehicle] methods
|
||||||
|
*
|
||||||
|
* @return [Vehicle] vehicle
|
||||||
|
*/
|
||||||
int GetVehicleKit(Eluna* /*E*/, lua_State* L, Unit* unit)
|
int GetVehicleKit(Eluna* /*E*/, lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#ifndef TRINITY
|
||||||
@@ -1243,6 +1274,11 @@ namespace LuaUnit
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Critter Guid
|
||||||
|
*
|
||||||
|
* @return uint64 critterGuid
|
||||||
|
*/
|
||||||
int GetCritterGUID(Eluna* /*E*/, lua_State* L, Unit* unit)
|
int GetCritterGUID(Eluna* /*E*/, lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#ifndef TRINITY
|
||||||
@@ -1327,8 +1363,6 @@ namespace LuaUnit
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* SETTERS */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the [Unit]'s owner GUID to given GUID.
|
* Sets the [Unit]'s owner GUID to given GUID.
|
||||||
*
|
*
|
||||||
@@ -1636,6 +1670,11 @@ namespace LuaUnit
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets creator GUID
|
||||||
|
*
|
||||||
|
* @param uint64 guid
|
||||||
|
*/
|
||||||
int SetCreatorGUID(Eluna* /*E*/, lua_State* L, Unit* unit)
|
int SetCreatorGUID(Eluna* /*E*/, lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
uint64 guid = Eluna::CHECKVAL<uint64>(L, 2);
|
uint64 guid = Eluna::CHECKVAL<uint64>(L, 2);
|
||||||
@@ -1647,6 +1686,11 @@ namespace LuaUnit
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets charmer GUID
|
||||||
|
*
|
||||||
|
* @param uint64 guid
|
||||||
|
*/
|
||||||
int SetCharmerGUID(Eluna* /*E*/, lua_State* L, Unit* unit)
|
int SetCharmerGUID(Eluna* /*E*/, lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
uint64 guid = Eluna::CHECKVAL<uint64>(L, 2);
|
uint64 guid = Eluna::CHECKVAL<uint64>(L, 2);
|
||||||
@@ -1658,6 +1702,11 @@ namespace LuaUnit
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets pet GUID
|
||||||
|
*
|
||||||
|
* @param uint64 guid
|
||||||
|
*/
|
||||||
int SetPetGUID(Eluna* /*E*/, lua_State* L, Unit* unit)
|
int SetPetGUID(Eluna* /*E*/, lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
uint64 guid = Eluna::CHECKVAL<uint64>(L, 2);
|
uint64 guid = Eluna::CHECKVAL<uint64>(L, 2);
|
||||||
@@ -1669,6 +1718,11 @@ namespace LuaUnit
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggles (Sets) [Unit]'s water walking
|
||||||
|
*
|
||||||
|
* @param bool enable = true
|
||||||
|
*/
|
||||||
int SetWaterWalk(Eluna* /*E*/, lua_State* L, Unit* unit)
|
int SetWaterWalk(Eluna* /*E*/, lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
bool enable = Eluna::CHECKVAL<bool>(L, 2, true);
|
bool enable = Eluna::CHECKVAL<bool>(L, 2, true);
|
||||||
@@ -1680,6 +1734,11 @@ namespace LuaUnit
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the [Unit]'s stand state
|
||||||
|
*
|
||||||
|
* @param uint8 state : stand state
|
||||||
|
*/
|
||||||
int SetStandState(Eluna* /*E*/, lua_State* L, Unit* unit)
|
int SetStandState(Eluna* /*E*/, lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
uint8 state = Eluna::CHECKVAL<uint8>(L, 2);
|
uint8 state = Eluna::CHECKVAL<uint8>(L, 2);
|
||||||
@@ -1820,20 +1879,18 @@ namespace LuaUnit
|
|||||||
|
|
||||||
/*int SetCanFly(Eluna* E, lua_State* L, Unit* unit)
|
/*int SetCanFly(Eluna* E, lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
bool apply = Eluna::CHECKVAL<bool>(L, 2, true);
|
bool apply = Eluna::CHECKVAL<bool>(L, 2, true);
|
||||||
unit->SetCanFly(apply);
|
unit->SetCanFly(apply);
|
||||||
return 0;
|
return 0;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
/*int SetVisible(Eluna* E, lua_State* L, Unit* unit)
|
/*int SetVisible(Eluna* E, lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
bool x = Eluna::CHECKVAL<bool>(L, 2, true);
|
bool x = Eluna::CHECKVAL<bool>(L, 2, true);
|
||||||
unit->SetVisible(x);
|
unit->SetVisible(x);
|
||||||
return 0;
|
return 0;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
/* OTHER */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears the [Unit]'s threat list.
|
* Clears the [Unit]'s threat list.
|
||||||
*/
|
*/
|
||||||
@@ -1890,18 +1947,36 @@ namespace LuaUnit
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns calculated percentage from Health
|
||||||
|
*
|
||||||
|
* @return int32 percentage
|
||||||
|
*/
|
||||||
int CountPctFromCurHealth(Eluna* /*E*/, lua_State* L, Unit* unit)
|
int CountPctFromCurHealth(Eluna* /*E*/, lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
Eluna::Push(L, unit->CountPctFromCurHealth(Eluna::CHECKVAL<int32>(L, 2)));
|
Eluna::Push(L, unit->CountPctFromCurHealth(Eluna::CHECKVAL<int32>(L, 2)));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns calculated percentage from Max Health
|
||||||
|
*
|
||||||
|
* @return int32 percentage
|
||||||
|
*/
|
||||||
int CountPctFromMaxHealth(Eluna* /*E*/, lua_State* L, Unit* unit)
|
int CountPctFromMaxHealth(Eluna* /*E*/, lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
Eluna::Push(L, unit->CountPctFromMaxHealth(Eluna::CHECKVAL<int32>(L, 2)));
|
Eluna::Push(L, unit->CountPctFromMaxHealth(Eluna::CHECKVAL<int32>(L, 2)));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends chat message to [Player]
|
||||||
|
*
|
||||||
|
* @param uint8 type : chat, whisper, etc
|
||||||
|
* @param uint32 lang : language to speak
|
||||||
|
* @param string msg
|
||||||
|
* @param [Player] target
|
||||||
|
*/
|
||||||
int SendChatMessageToPlayer(Eluna* /*E*/, lua_State* L, Unit* unit)
|
int SendChatMessageToPlayer(Eluna* /*E*/, lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
uint8 type = Eluna::CHECKVAL<uint8>(L, 2);
|
uint8 type = Eluna::CHECKVAL<uint8>(L, 2);
|
||||||
@@ -1924,19 +1999,27 @@ namespace LuaUnit
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// static void PrepareMove(Unit* unit)
|
/*static void PrepareMove(Unit* unit)
|
||||||
// {
|
{
|
||||||
// unit->GetMotionMaster()->MovementExpired(); // Chase
|
unit->GetMotionMaster()->MovementExpired(); // Chase
|
||||||
// unit->StopMoving(); // Some
|
unit->StopMoving(); // Some
|
||||||
// unit->GetMotionMaster()->Clear(); // all
|
unit->GetMotionMaster()->Clear(); // all
|
||||||
// }
|
}*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stops the [Unit]'s movement
|
||||||
|
*/
|
||||||
int MoveStop(Eluna* /*E*/, lua_State* /*L*/, Unit* unit)
|
int MoveStop(Eluna* /*E*/, lua_State* /*L*/, Unit* unit)
|
||||||
{
|
{
|
||||||
unit->StopMoving();
|
unit->StopMoving();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The [Unit]'s movement expires and clears movement
|
||||||
|
*
|
||||||
|
* @param bool reset = true : cleans movement
|
||||||
|
*/
|
||||||
int MoveExpire(Eluna* /*E*/, lua_State* L, Unit* unit)
|
int MoveExpire(Eluna* /*E*/, lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
bool reset = Eluna::CHECKVAL<bool>(L, 2, true);
|
bool reset = Eluna::CHECKVAL<bool>(L, 2, true);
|
||||||
@@ -1944,6 +2027,11 @@ namespace LuaUnit
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears the [Unit]'s movement
|
||||||
|
*
|
||||||
|
* @param bool reset = true : clean movement
|
||||||
|
*/
|
||||||
int MoveClear(Eluna* /*E*/, lua_State* L, Unit* unit)
|
int MoveClear(Eluna* /*E*/, lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
bool reset = Eluna::CHECKVAL<bool>(L, 2, true);
|
bool reset = Eluna::CHECKVAL<bool>(L, 2, true);
|
||||||
@@ -1951,12 +2039,20 @@ namespace LuaUnit
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The [Unit] will be idle
|
||||||
|
*/
|
||||||
int MoveIdle(Eluna* /*E*/, lua_State* /*L*/, Unit* unit)
|
int MoveIdle(Eluna* /*E*/, lua_State* /*L*/, Unit* unit)
|
||||||
{
|
{
|
||||||
unit->GetMotionMaster()->MoveIdle();
|
unit->GetMotionMaster()->MoveIdle();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The [Unit] will move at random
|
||||||
|
*
|
||||||
|
* @param float radius : limit on how far the [Unit] will move at random
|
||||||
|
*/
|
||||||
int MoveRandom(Eluna* /*E*/, lua_State* L, Unit* unit)
|
int MoveRandom(Eluna* /*E*/, lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
float radius = Eluna::CHECKVAL<float>(L, 2);
|
float radius = Eluna::CHECKVAL<float>(L, 2);
|
||||||
@@ -1970,12 +2066,22 @@ namespace LuaUnit
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The [Unit] will move to its set home location
|
||||||
|
*/
|
||||||
int MoveHome(Eluna* /*E*/, lua_State* /*L*/, Unit* unit)
|
int MoveHome(Eluna* /*E*/, lua_State* /*L*/, Unit* unit)
|
||||||
{
|
{
|
||||||
unit->GetMotionMaster()->MoveTargetedHome();
|
unit->GetMotionMaster()->MoveTargetedHome();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The [Unit] will follow the target
|
||||||
|
*
|
||||||
|
* @param [Unit] target : target to follow
|
||||||
|
* @param float dist = 0 : distance to start following
|
||||||
|
* @param float angle = 0
|
||||||
|
*/
|
||||||
int MoveFollow(Eluna* /*E*/, lua_State* L, Unit* unit)
|
int MoveFollow(Eluna* /*E*/, lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
Unit* target = Eluna::CHECKOBJ<Unit>(L, 2);
|
Unit* target = Eluna::CHECKOBJ<Unit>(L, 2);
|
||||||
@@ -1985,6 +2091,13 @@ namespace LuaUnit
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The [Unit] will chase the target
|
||||||
|
*
|
||||||
|
* @param [Unit] target : target to chase
|
||||||
|
* @param float dist = 0 : distance start chasing
|
||||||
|
* @param float angle = 0
|
||||||
|
*/
|
||||||
int MoveChase(Eluna* /*E*/, lua_State* L, Unit* unit)
|
int MoveChase(Eluna* /*E*/, lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
Unit* target = Eluna::CHECKOBJ<Unit>(L, 2);
|
Unit* target = Eluna::CHECKOBJ<Unit>(L, 2);
|
||||||
@@ -1994,12 +2107,21 @@ namespace LuaUnit
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The [Unit] will move confused
|
||||||
|
*/
|
||||||
int MoveConfused(Eluna* /*E*/, lua_State* /*L*/, Unit* unit)
|
int MoveConfused(Eluna* /*E*/, lua_State* /*L*/, Unit* unit)
|
||||||
{
|
{
|
||||||
unit->GetMotionMaster()->MoveConfused();
|
unit->GetMotionMaster()->MoveConfused();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The [Unit] will flee
|
||||||
|
*
|
||||||
|
* @param [Unit] target
|
||||||
|
* @param uint32 time = 0 : flee delay
|
||||||
|
*/
|
||||||
int MoveFleeing(Eluna* /*E*/, lua_State* L, Unit* unit)
|
int MoveFleeing(Eluna* /*E*/, lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
Unit* target = Eluna::CHECKOBJ<Unit>(L, 2);
|
Unit* target = Eluna::CHECKOBJ<Unit>(L, 2);
|
||||||
@@ -2008,6 +2130,15 @@ namespace LuaUnit
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The [Unit] will move to the coordinates
|
||||||
|
*
|
||||||
|
* @param uint32 id : unique waypoint Id
|
||||||
|
* @param float x
|
||||||
|
* @param float y
|
||||||
|
* @param float z
|
||||||
|
* @param bool genPath = true : if true, generates path
|
||||||
|
*/
|
||||||
int MoveTo(Eluna* /*E*/, lua_State* L, Unit* unit)
|
int MoveTo(Eluna* /*E*/, lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
uint32 id = Eluna::CHECKVAL<uint32>(L, 2);
|
uint32 id = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
@@ -2020,6 +2151,16 @@ namespace LuaUnit
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if (!defined(TBC) && !defined(CLASSIC))
|
#if (!defined(TBC) && !defined(CLASSIC))
|
||||||
|
/**
|
||||||
|
* Makes the [Unit] jump to the coordinates
|
||||||
|
*
|
||||||
|
* @param float x
|
||||||
|
* @param float y
|
||||||
|
* @param float z
|
||||||
|
* @param float zSpeed : start velocity
|
||||||
|
* @param float maxHeight : maximum height
|
||||||
|
* @param uint32 id = 0 : unique movement Id
|
||||||
|
*/
|
||||||
int MoveJump(Eluna* /*E*/, lua_State* L, Unit* unit)
|
int MoveJump(Eluna* /*E*/, lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
float x = Eluna::CHECKVAL<float>(L, 2);
|
float x = Eluna::CHECKVAL<float>(L, 2);
|
||||||
@@ -2033,6 +2174,14 @@ namespace LuaUnit
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The [Unit] will whisper the message to a [Player]
|
||||||
|
*
|
||||||
|
* @param string msg : message for the [Unit] to emote
|
||||||
|
* @param lang : language for the [Unit] to speak
|
||||||
|
* @param [Player] receiver : specific [Unit] to receive the message
|
||||||
|
* @param bool bossWhisper = false : is a boss whisper
|
||||||
|
*/
|
||||||
int SendUnitWhisper(Eluna* /*E*/, lua_State* L, Unit* unit)
|
int SendUnitWhisper(Eluna* /*E*/, lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
const char* msg = Eluna::CHECKVAL<const char*>(L, 2);
|
const char* msg = Eluna::CHECKVAL<const char*>(L, 2);
|
||||||
@@ -2048,6 +2197,13 @@ namespace LuaUnit
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The [Unit] will emote the message
|
||||||
|
*
|
||||||
|
* @param string msg : message for the [Unit] to emote
|
||||||
|
* @param [Unit] receiver = nil : specific [Unit] to receive the message
|
||||||
|
* @param bool bossEmote = false : is a boss emote
|
||||||
|
*/
|
||||||
int SendUnitEmote(Eluna* /*E*/, lua_State* L, Unit* unit)
|
int SendUnitEmote(Eluna* /*E*/, lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
const char* msg = Eluna::CHECKVAL<const char*>(L, 2);
|
const char* msg = Eluna::CHECKVAL<const char*>(L, 2);
|
||||||
@@ -2062,6 +2218,12 @@ namespace LuaUnit
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The [Unit] will say the message
|
||||||
|
*
|
||||||
|
* @param string msg : message for the [Unit] to say
|
||||||
|
* @param uint32 language : language for the [Unit] to speak
|
||||||
|
*/
|
||||||
int SendUnitSay(Eluna* /*E*/, lua_State* L, Unit* unit)
|
int SendUnitSay(Eluna* /*E*/, lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
const char* msg = Eluna::CHECKVAL<const char*>(L, 2);
|
const char* msg = Eluna::CHECKVAL<const char*>(L, 2);
|
||||||
@@ -2075,6 +2237,12 @@ namespace LuaUnit
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The [Unit] will yell the message
|
||||||
|
*
|
||||||
|
* @param string msg : message for the [Unit] to yell
|
||||||
|
* @param uint32 language : language for the [Unit] to speak
|
||||||
|
*/
|
||||||
int SendUnitYell(Eluna* /*E*/, lua_State* L, Unit* unit)
|
int SendUnitYell(Eluna* /*E*/, lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
const char* msg = Eluna::CHECKVAL<const char*>(L, 2);
|
const char* msg = Eluna::CHECKVAL<const char*>(L, 2);
|
||||||
@@ -2168,12 +2336,20 @@ namespace LuaUnit
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears the [Unit]'s combat
|
||||||
|
*/
|
||||||
int ClearInCombat(Eluna* /*E*/, lua_State* /*L*/, Unit* unit)
|
int ClearInCombat(Eluna* /*E*/, lua_State* /*L*/, Unit* unit)
|
||||||
{
|
{
|
||||||
unit->ClearInCombat();
|
unit->ClearInCombat();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stops the [Unit]'s current spell cast
|
||||||
|
*
|
||||||
|
* @param uint32 spell = 0 : entry of a spell
|
||||||
|
*/
|
||||||
int StopSpellCast(Eluna* /*E*/, lua_State* L, Unit* unit)
|
int StopSpellCast(Eluna* /*E*/, lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
uint32 spellId = Eluna::CHECKVAL<uint32>(L, 2, 0);
|
uint32 spellId = Eluna::CHECKVAL<uint32>(L, 2, 0);
|
||||||
@@ -2181,6 +2357,14 @@ namespace LuaUnit
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interrupts [Unit]'s spell state, casting, etc.
|
||||||
|
*
|
||||||
|
* if spell is not interruptible, it will return
|
||||||
|
*
|
||||||
|
* @param int32 spellType : type of spell to interrupt
|
||||||
|
* @param bool delayed = true : skips if the spell is delayed
|
||||||
|
*/
|
||||||
int InterruptSpell(Eluna* /*E*/, lua_State* L, Unit* unit)
|
int InterruptSpell(Eluna* /*E*/, lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
int spellType = Eluna::CHECKVAL<int>(L, 2);
|
int spellType = Eluna::CHECKVAL<int>(L, 2);
|
||||||
@@ -2271,6 +2455,12 @@ namespace LuaUnit
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The [Unit] plays a sound to a [Player], if no [Player] it will play the sound to everyone near
|
||||||
|
*
|
||||||
|
* @param uint32 sound : entry of a sound
|
||||||
|
* @param [Player] player : [Player] to play the sound to
|
||||||
|
*/
|
||||||
int PlayDirectSound(Eluna* /*E*/, lua_State* L, Unit* unit)
|
int PlayDirectSound(Eluna* /*E*/, lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
uint32 soundId = Eluna::CHECKVAL<uint32>(L, 2);
|
uint32 soundId = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
@@ -2285,6 +2475,15 @@ namespace LuaUnit
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The [Unit] plays a sound to a [Player]
|
||||||
|
*
|
||||||
|
* If no [Player] it will play the sound to everyone near
|
||||||
|
* Sound will fade the further you are
|
||||||
|
*
|
||||||
|
* @param uint32 sound : entry of a sound
|
||||||
|
* @param [Player] player : [Player] to play the sound to
|
||||||
|
*/
|
||||||
int PlayDistanceSound(Eluna* /*E*/, lua_State* L, Unit* unit)
|
int PlayDistanceSound(Eluna* /*E*/, lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
uint32 soundId = Eluna::CHECKVAL<uint32>(L, 2);
|
uint32 soundId = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
@@ -2526,26 +2725,26 @@ namespace LuaUnit
|
|||||||
|
|
||||||
/*int RestoreDisplayId(Eluna* E, lua_State* L, Unit* unit)
|
/*int RestoreDisplayId(Eluna* E, lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
unit->RestoreDisplayId();
|
unit->RestoreDisplayId();
|
||||||
return 0;
|
return 0;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
/*int RestoreFaction(Eluna* E, lua_State* L, Unit* unit)
|
/*int RestoreFaction(Eluna* E, lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
unit->RestoreFaction();
|
unit->RestoreFaction();
|
||||||
return 0;
|
return 0;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
/*int RemoveBindSightAuras(Eluna* E, lua_State* L, Unit* unit)
|
/*int RemoveBindSightAuras(Eluna* E, lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
unit->RemoveBindSightAuras();
|
unit->RemoveBindSightAuras();
|
||||||
return 0;
|
return 0;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
/*int RemoveCharmAuras(Eluna* E, lua_State* L, Unit* unit)
|
/*int RemoveCharmAuras(Eluna* E, lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
unit->RemoveCharmAuras();
|
unit->RemoveCharmAuras();
|
||||||
return 0;
|
return 0;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
/*int DisableMelee(Eluna* E, lua_State* L, Unit* unit)
|
/*int DisableMelee(Eluna* E, lua_State* L, Unit* unit)
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ using namespace Hooks;
|
|||||||
return;\
|
return;\
|
||||||
LOCK_ELUNA
|
LOCK_ELUNA
|
||||||
|
|
||||||
// Vehicle
|
|
||||||
void Eluna::OnInstall(Vehicle* vehicle)
|
void Eluna::OnInstall(Vehicle* vehicle)
|
||||||
{
|
{
|
||||||
START_HOOK(VEHICLE_EVENT_ON_INSTALL);
|
START_HOOK(VEHICLE_EVENT_ON_INSTALL);
|
||||||
|
|||||||
@@ -14,7 +14,12 @@
|
|||||||
*/
|
*/
|
||||||
namespace LuaVehicle
|
namespace LuaVehicle
|
||||||
{
|
{
|
||||||
/* BOOLEAN */
|
/**
|
||||||
|
* Returns true if the [Unit] passenger is on board
|
||||||
|
*
|
||||||
|
* @param [Unit] passenger
|
||||||
|
* @return bool isOnBoard
|
||||||
|
*/
|
||||||
int IsOnBoard(Eluna* /*E*/, lua_State* L, Vehicle* vehicle)
|
int IsOnBoard(Eluna* /*E*/, lua_State* L, Vehicle* vehicle)
|
||||||
{
|
{
|
||||||
Unit* passenger = Eluna::CHECKOBJ<Unit>(L, 2);
|
Unit* passenger = Eluna::CHECKOBJ<Unit>(L, 2);
|
||||||
@@ -26,7 +31,11 @@ namespace LuaVehicle
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* GETTERS */
|
/**
|
||||||
|
* Returns the [Vehicle]'s owner
|
||||||
|
*
|
||||||
|
* @return [Unit] owner
|
||||||
|
*/
|
||||||
int GetOwner(Eluna* /*E*/, lua_State* L, Vehicle* vehicle)
|
int GetOwner(Eluna* /*E*/, lua_State* L, Vehicle* vehicle)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#ifndef TRINITY
|
||||||
@@ -37,6 +46,11 @@ namespace LuaVehicle
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the [Vehicle]'s entry
|
||||||
|
*
|
||||||
|
* @return uint32 entry
|
||||||
|
*/
|
||||||
int GetEntry(Eluna* /*E*/, lua_State* L, Vehicle* vehicle)
|
int GetEntry(Eluna* /*E*/, lua_State* L, Vehicle* vehicle)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#ifndef TRINITY
|
||||||
@@ -47,6 +61,12 @@ namespace LuaVehicle
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the [Vehicle]'s passenger in the specified seat
|
||||||
|
*
|
||||||
|
* @param int8 seat
|
||||||
|
* @return [Unit] passenger
|
||||||
|
*/
|
||||||
int GetPassenger(Eluna* /*E*/, lua_State* L, Vehicle* vehicle)
|
int GetPassenger(Eluna* /*E*/, lua_State* L, Vehicle* vehicle)
|
||||||
{
|
{
|
||||||
int8 seatId = Eluna::CHECKVAL<int8>(L, 2);
|
int8 seatId = Eluna::CHECKVAL<int8>(L, 2);
|
||||||
@@ -54,7 +74,12 @@ namespace LuaVehicle
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* OTHER */
|
/**
|
||||||
|
* Adds [Unit] passenger to a specified seat in the [Vehicle]
|
||||||
|
*
|
||||||
|
* @param [Unit] passenger
|
||||||
|
* @param int8 seat
|
||||||
|
*/
|
||||||
int AddPassenger(Eluna* /*E*/, lua_State* L, Vehicle* vehicle)
|
int AddPassenger(Eluna* /*E*/, lua_State* L, Vehicle* vehicle)
|
||||||
{
|
{
|
||||||
Unit* passenger = Eluna::CHECKOBJ<Unit>(L, 2);
|
Unit* passenger = Eluna::CHECKOBJ<Unit>(L, 2);
|
||||||
@@ -68,6 +93,11 @@ namespace LuaVehicle
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes [Unit] passenger from the [Vehicle]
|
||||||
|
*
|
||||||
|
* @param [Unit] passenger
|
||||||
|
*/
|
||||||
int RemovePassenger(Eluna* /*E*/, lua_State* L, Vehicle* vehicle)
|
int RemovePassenger(Eluna* /*E*/, lua_State* L, Vehicle* vehicle)
|
||||||
{
|
{
|
||||||
Unit* passenger = Eluna::CHECKOBJ<Unit>(L, 2);
|
Unit* passenger = Eluna::CHECKOBJ<Unit>(L, 2);
|
||||||
@@ -80,6 +110,6 @@ namespace LuaVehicle
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif // CLASSIC
|
||||||
#endif
|
#endif // TBC
|
||||||
#endif
|
#endif // VEHICLEMETHODS_H
|
||||||
Reference in New Issue
Block a user