Correct and add documentation

This commit is contained in:
Rochet2
2014-08-12 20:43:42 +03:00
parent 9e49400768
commit 247e07fce4
6 changed files with 166 additions and 105 deletions

View File

@@ -10,7 +10,7 @@
namespace LuaGameObject
{
/**
* Returns 'true' if the &GameObject has the specified quest
* Returns 'true' if the &GameObject can give the specified &Quest
*
* @param uint32 questId : quest entry Id to check
* @return bool hasQuest
@@ -52,7 +52,7 @@ namespace LuaGameObject
/**
* Returns 'true' if the &GameObject is active
*
* @return bool isActiveObject
* @return bool isActive
*/
int IsActive(lua_State* L, GameObject* go)
{
@@ -67,7 +67,7 @@ namespace LuaGameObject
}*/
/**
* Returns display Id of the &GameObject
* Returns display ID of the &GameObject
*
* @return uint32 displayId
*/
@@ -193,7 +193,7 @@ namespace LuaGameObject
/**
* Removes &GameObject from the world
*
* @param bool deleteFromDB : if true, it will delete the go from the database
* @param bool deleteFromDB : if true, it will delete the &GameObject from the database
*/
int RemoveFromWorld(lua_State* L, GameObject* go)
{
@@ -205,12 +205,12 @@ namespace LuaGameObject
}
/**
* Registers a event to the &GameObject
* Registers a timed event to the &GameObject
*
* @param function function : function to register the event with
* @param function function : function to trigger when the time has passed
* @param uint32 delay : set time in milliseconds for the event to trigger
* @param uint32 repeats : how many times for the event to repeat, 0 is infinite
* @return int32 functionReference
* @return int32 eventId : unique ID for the timed event used to cancel it
*/
int RegisterEvent(lua_State* L, GameObject* go)
{
@@ -227,7 +227,7 @@ namespace LuaGameObject
}
/**
* Removes event from a &GameObject by the specified event Id
* Removes the timed event from a &GameObject by the specified event ID
*
* @param int32 eventId : event Id to remove
*/
@@ -239,7 +239,7 @@ namespace LuaGameObject
}
/**
* Removes all events from a &GameObject
* Removes all timed events from a &GameObject
*
*/
int RemoveEvents(lua_State* /*L*/, GameObject* go)
@@ -249,9 +249,9 @@ namespace LuaGameObject
}
/**
* Changes the state of a &GameObject to a door or button
* Changes uses a door or a button type &GameObject
*
* @param uint32 delay : cooldown time to restore the go
* @param uint32 delay : cooldown time in seconds to restore the &GameObject back to normal
*/
int UseDoorOrButton(lua_State* L, GameObject* go)
{
@@ -264,7 +264,7 @@ namespace LuaGameObject
/**
* Despawns a &GameObject
*
* @param uint32 delay : time of despawn
* @param uint32 delay : time in seconds to despawn
*/
int Despawn(lua_State* L, GameObject* go)
{
@@ -280,7 +280,7 @@ namespace LuaGameObject
/**
* Respawns a &GameObject
*
* @param uint32 delay : time of respawn
* @param uint32 delay : time of respawn in seconds
*/
int Respawn(lua_State* L, GameObject* go)
{

View File

@@ -133,7 +133,7 @@ namespace LuaMap
}
/**
* Returns the instance id of the &Map
* Returns the instance ID of the &Map
*
* @return uint32 instanceId
*/
@@ -156,7 +156,7 @@ namespace LuaMap
}
/**
* Returns the id of the &Map
* Returns the ID of the &Map
*
* @return uint32 mapId
*/
@@ -167,7 +167,7 @@ namespace LuaMap
}
/**
* Returns the area id of the &Map at the specified X, Y and Z coordinates
* Returns the area ID of the &Map at the specified X, Y and Z coordinates
*
* @param float x
* @param float y
@@ -188,6 +188,11 @@ namespace LuaMap
return 1;
}
/**
* Returns a &WorldObject by it's guid from the map if it is spawned
*
* @param uint64 guid
*/
int GetWorldObject(lua_State* L, Map* map)
{
uint64 guid = Eluna::CHECKVAL<uint64>(L, 2);

View File

@@ -82,7 +82,7 @@ namespace LuaQuest
}
/**
* Returns entry id of the &Quest.
* Returns entry ID of the &Quest.
*
* @return uint32 entryId
*/
@@ -115,7 +115,7 @@ namespace LuaQuest
}
/**
* Returns the next &Quest entry id.
* Returns the next &Quest entry ID.
*
* @return int32 entryId
*/

View File

@@ -138,7 +138,7 @@ namespace LuaSpell
}
/**
* Sets the &Spell to automatically repeat:
* Sets the &Spell to automatically repeat.
*
* @param bool repeat : set variable to 'true' for spell to automatically repeat
*/

View File

@@ -45,7 +45,7 @@ namespace LuaWorldObject
#endif
/**
* Returns the current instance id of the &WorldObject
* Returns the current instance ID of the &WorldObject
*
* @return uint32 instanceId
*/
@@ -56,7 +56,7 @@ namespace LuaWorldObject
}
/**
* Returns the current area id of the &WorldObject
* Returns the current area ID of the &WorldObject
*
* @return uint32 areaId
*/
@@ -67,7 +67,7 @@ namespace LuaWorldObject
}
/**
* Returns the current zone id of the &WorldObject
* Returns the current zone ID of the &WorldObject
*
* @return uint32 zoneId
*/
@@ -78,7 +78,7 @@ namespace LuaWorldObject
}
/**
* Returns the current map id of the &WorldObject
* Returns the current map ID of the &WorldObject
*
* @return uint32 mapId
*/
@@ -124,7 +124,7 @@ namespace LuaWorldObject
/**
* Returns the current orientation of the &WorldObject
*
* @return float orientation
* @return float orientation / facing
*/
int GetO(lua_State* L, WorldObject* obj)
{
@@ -133,7 +133,7 @@ namespace LuaWorldObject
}
/**
* Returns the coordinates and orientation / facing of the &WorldObject
* Returns the coordinates and orientation of the &WorldObject
*
* @return float x : x coordinate of the &WorldObject
* @return float y : y coordinate of the &WorldObject
@@ -152,7 +152,7 @@ namespace LuaWorldObject
/**
* Returns the nearest &Player object in sight of the &WorldObject or within the given range
*
* @param float range = 533.33333 : optionally set range
* @param float range = 533.33333 : optionally set range. Default range is grid size
*
* @return &Player nearestPlayer
*/
@@ -175,12 +175,12 @@ namespace LuaWorldObject
}
/**
* Returns the nearest &GameObject object in sight of the &WorldObject or within the given range and/or with a specific entry id
* Returns the nearest &GameObject object in sight of the &WorldObject or within the given range and/or with a specific entry ID
*
* @param float range = 533.33333 : optionally set range
* @param uint32 entryId = 0 : optionally set entry id of game object to find
* @param float range = 533.33333 : optionally set range. Default range is grid size
* @param uint32 entryId = 0 : optionally set entry ID of game object to find
*
* @return &GameObject nearesGameObject
* @return &GameObject nearestGameObject
*/
int GetNearestGameObject(lua_State* L, WorldObject* obj)
{
@@ -202,12 +202,12 @@ namespace LuaWorldObject
}
/**
* Returns the nearest &Creature object in sight of the &WorldObject or within the given range and/or with a specific entry id
* Returns the nearest &Creature object in sight of the &WorldObject or within the given range and/or with a specific entry ID
*
* @param float range = 533.33333 : optionally set range
* @param uint32 entryId = 0 : optionally set entry id of creature to find
* @param float range = 533.33333 : optionally set range. Default range is grid size
* @param uint32 entryId = 0 : optionally set entry ID of creature to find
*
* @return &Creature nearesCreature
* @return &Creature nearestCreature
*/
int GetNearestCreature(lua_State* L, WorldObject* obj)
{
@@ -229,11 +229,11 @@ namespace LuaWorldObject
}
/**
* Returns a table of @Player objects in sight of the &WorldObject or within the given range
* Returns a table of &Player objects in sight of the &WorldObject or within the given range
*
* @param float range = 533.33333 : optionally set range
* @param float range = 533.33333 : optionally set range. Default range is grid size
*
* @return table playersInRange
* @return table playersInRange : table of &Players
*/
int GetPlayersInRange(lua_State* L, WorldObject* obj)
{
@@ -265,12 +265,12 @@ namespace LuaWorldObject
}
/**
* Returns a table of @Creature objects in sight of the &WorldObject or within the given range and/or with a specific entry id
* Returns a table of &Creature objects in sight of the &WorldObject or within the given range and/or with a specific entry ID
*
* @param float range = 533.33333 : optionally set range
* @param uint32 entryId = 0 : optionally set entry id of creatures to find
* @param float range = 533.33333 : optionally set range. Default range is grid size
* @param uint32 entryId = 0 : optionally set entry ID of creatures to find
*
* @return table creaturesInRange
* @return table creaturesInRange : table of &Creatures
*/
int GetCreaturesInRange(lua_State* L, WorldObject* obj)
{
@@ -303,12 +303,12 @@ namespace LuaWorldObject
}
/**
* Returns a table of @GameObject objects in sight of the &WorldObject or within the given range and/or with a specific entry id
* Returns a table of &GameObject objects in sight of the &WorldObject or within the given range and/or with a specific entry ID
*
* @param float range = 533.33333 : optionally set range
* @param uint32 entryId = 0 : optionally set entry id of game objects to find
* @param float range = 533.33333 : optionally set range. Default range is grid size
* @param uint32 entryId = 0 : optionally set entry ID of game objects to find
*
* @return table gameObjectsInRange
* @return table gameObjectsInRange : table of &GameObjects
*/
int GetGameObjectsInRange(lua_State* L, WorldObject* obj)
{
@@ -340,19 +340,28 @@ namespace LuaWorldObject
return 1;
}
/**
* Returns nearest &WorldObject in sight of the &WorldObject.
* The distance, type, entry and hostility requirements the &WorldObject must match can be passed.
*
* @param float range = 533.33333 : optionally set range. Default range is grid size
* @param &TypeMask type = 0 : the &TypeMask that the &WorldObject must be. This can contain multiple types. 0 will be ingored
* @param uint32 entry = 0 : the entry of the &WorldObject, 0 will be ingored
* @param uint32 hostile = 0 : specifies whether the &WorldObject needs to be 1 hostile, 2 friendly or 0 either
*
* @return &WorldObject worldObject
*/
int GetNearObject(lua_State* L, WorldObject* obj)
{
bool nearest = Eluna::CHECKVAL<bool>(L, 2, true);
float range = Eluna::CHECKVAL<float>(L, 3, SIZE_OF_GRIDS);
uint16 type = Eluna::CHECKVAL<uint16>(L, 4, 0); // TypeMask
uint32 entry = Eluna::CHECKVAL<uint32>(L, 5, 0);
uint32 hostile = Eluna::CHECKVAL<uint32>(L, 6, 0); // 0 none, 1 hostile, 2 friendly
float range = Eluna::CHECKVAL<float>(L, 2, SIZE_OF_GRIDS);
uint16 type = Eluna::CHECKVAL<uint16>(L, 3, 0); // TypeMask
uint32 entry = Eluna::CHECKVAL<uint32>(L, 4, 0);
uint32 hostile = Eluna::CHECKVAL<uint32>(L, 5, 0); // 0 none, 1 hostile, 2 friendly
float x, y, z;
obj->GetPosition(x, y, z);
ElunaUtil::WorldObjectInRangeCheck checker(nearest, obj, range, type, entry, hostile);
if (nearest)
{
ElunaUtil::WorldObjectInRangeCheck checker(true, obj, range, type, entry, hostile);
WorldObject* target = NULL;
#ifndef TRINITY
MaNGOS::WorldObjectLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(target, checker);
@@ -365,8 +374,29 @@ namespace LuaWorldObject
Eluna::Push(L, target);
return 1;
}
else
/**
* Returns a table of &WorldObjects in sight of the &WorldObject.
* The distance, type, entry and hostility requirements the &WorldObject must match can be passed.
*
* @param float range = 533.33333 : optionally set range. Default range is grid size
* @param &TypeMask type = 0 : the &TypeMask that the &WorldObject must be. This can contain multiple types. 0 will be ingored
* @param uint32 entry = 0 : the entry of the &WorldObject, 0 will be ingored
* @param uint32 hostile = 0 : specifies whether the &WorldObject needs to be 1 hostile, 2 friendly or 0 either
*
* @return table worldObjectList : table of &WorldObjects
*/
int GetNearObjects(lua_State* L, WorldObject* obj)
{
float range = Eluna::CHECKVAL<float>(L, 2, SIZE_OF_GRIDS);
uint16 type = Eluna::CHECKVAL<uint16>(L, 3, 0); // TypeMask
uint32 entry = Eluna::CHECKVAL<uint32>(L, 4, 0);
uint32 hostile = Eluna::CHECKVAL<uint32>(L, 5, 0); // 0 none, 1 hostile, 2 friendly
float x, y, z;
obj->GetPosition(x, y, z);
ElunaUtil::WorldObjectInRangeCheck checker(false, obj, range, type, entry, hostile);
std::list<WorldObject*> list;
#ifndef TRINITY
MaNGOS::WorldObjectListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(list, checker);
@@ -391,15 +421,12 @@ namespace LuaWorldObject
return 1;
}
return 1;
}
/**
* Returns a &WorldObject based on its guid
* Returns a &WorldObject based on it's guid if it is spawned
*
* @param uint64 guid
*
* @return &WorldObject nearestPlayer
* @return &WorldObject worldObject
*/
int GetWorldObject(lua_State* L, WorldObject* obj)
{
@@ -434,7 +461,7 @@ namespace LuaWorldObject
}
/**
* Get the distance from this &WorldObject to another &WorldObject, or from this &WorldObject to a point.
* Returns the distance from this &WorldObject to another &WorldObject, or from this &WorldObject to a point.
*
* @proto dist = (obj)
* @proto dist = (x, y, z)
@@ -461,6 +488,18 @@ namespace LuaWorldObject
return 1;
}
/**
* Returns a point relative to the &WorldObject.
* With distance set to 1 and angle set to 0, this will return a point 1 yard in front of the &WorldObject
*
* @param &WorldObject object
* @param float distance : specifies the distance of the point from the &WorldObject in yards
* @param float angle : specifies the angle of the point relative to the orientation / facing of the &WorldObject in radians
*
* @return float x
* @return float y
* @return float z
*/
int GetRelativePoint(lua_State* L, WorldObject* obj)
{
float dist = Eluna::CHECKVAL<float>(L, 2);
@@ -475,6 +514,19 @@ namespace LuaWorldObject
return 3;
}
/**
* Returns the angle between this &WorldObject and another &WorldObject or a point.
* The angle is the angle between two points and orientation will be ignored.
*
* @proto dist = (obj)
* @proto dist = (x, y)
*
* @param &WorldObject object
* @param float x
* @param float y
*
* @return float angle : angle in radians in range 0..2*pi
*/
int GetAngle(lua_State* L, WorldObject* obj)
{
WorldObject* target = Eluna::CHECKOBJ<WorldObject>(L, 2, false);
@@ -490,7 +542,11 @@ namespace LuaWorldObject
return 1;
}
/* OTHER */
/**
* Sends a &WorldPacket to &Players in sight of the &WorldObject.
*
* @param &WorldPacket packet
*/
int SendPacket(lua_State* L, WorldObject* obj)
{
WorldPacket* data = Eluna::CHECKOBJ<WorldPacket>(L, 2);
@@ -499,9 +555,9 @@ namespace LuaWorldObject
}
/**
* Summons a game object at specified location.
* Spawns a &GameObject at specified location.
*
* @param uint32 entry : game object entry
* @param uint32 entry : &GameObject entry ID
* @param float x
* @param float y
* @param float z
@@ -528,14 +584,14 @@ namespace LuaWorldObject
/**
* Spawns the creature at specified location.
*
* @param uint32 entry : creature entry
* @param uint32 entry : &Creature's entry ID
* @param float x
* @param float y
* @param float z
* @param float o
* @param TempSummonType spawnType : defines how and when the creature despawns
* @param uint32 despawnTimer : despawn time in seconds
* @return &Creature
* @return &Creature spawnedCreature
*/
int SpawnCreature(lua_State* L, WorldObject* obj)
{

View File

@@ -46,7 +46,7 @@ namespace LuaPacket
}
/**
* Reads an int8 value of the &WorldPacket specified.
* Reads and returns an int8 value from the &WorldPacket.
*
* @return int8 value
*/
@@ -59,7 +59,7 @@ namespace LuaPacket
}
/**
* Reads a uint8 value of the &WorldPacket specified.
* Reads and returns a uint8 value from the &WorldPacket.
*
* @return uint8 value
*/
@@ -72,7 +72,7 @@ namespace LuaPacket
}
/**
* Reads an int16 value of the &WorldPacket specified.
* Reads and returns an int16 value from the &WorldPacket.
*
* @return int16 value
*/
@@ -85,7 +85,7 @@ namespace LuaPacket
}
/**
* Reads a uint16 value of the &WorldPacket specified.
* Reads and returns a uint16 value from the &WorldPacket.
*
* @return uint16 value
*/
@@ -98,7 +98,7 @@ namespace LuaPacket
}
/**
* Reads an int32 value of the &WorldPacket specified.
* Reads and returns an int32 value from the &WorldPacket.
*
* @return int32 value
*/
@@ -111,7 +111,7 @@ namespace LuaPacket
}
/**
* Reads a uint32 value of the &WorldPacket specified.
* Reads and returns a uint32 value from the &WorldPacket.
*
* @return uint32 value
*/
@@ -124,7 +124,7 @@ namespace LuaPacket
}
/**
* Reads a float value of the &WorldPacket specified.
* Reads and returns a float value from the &WorldPacket.
*
* @return float value
*/
@@ -137,7 +137,7 @@ namespace LuaPacket
}
/**
* Reads a double value of the &WorldPacket specified.
* Reads and returns a double value from the &WorldPacket.
*
* @return double value
*/
@@ -150,7 +150,7 @@ namespace LuaPacket
}
/**
* Reads a uint64 value of the &WorldPacket specified.
* Reads and returns a uint64 value from the &WorldPacket.
*
* @return uint64 value : value returned as string
*/
@@ -163,7 +163,7 @@ namespace LuaPacket
}
/**
* Reads a string value of the &WorldPacket specified.
* Reads and returns a string value from the &WorldPacket.
*
* @return string value
*/