LuaBridge:Methods

From ArcEmu-Wiki
Revision as of 18:55, 2 June 2011 by 71.252.225.135 (Talk)
Jump to: navigation, search

Contents


These are the Methods in LuaBridge.

Some method links have not be documented since the method name and parameters is self documenting enough.



Class Hierarchy

Gossip Menu

GossipMenu : constructor( GUID creature_guid, uint32 text_id, uint32 language )
void : AddItem( uint8 icon, string itemname, uint32 itemid, bool codebox )
void : AddMenuItem( uint8 icon, string itemname, uint32 itemid, uint32 boxmoney, string boxmsg, bool codebox )
void : Send( Player player )
uint32 : GetTextID()
void : SetTextID( uint32 newtextid )
static void : Complete( Player player )
static void : SendSimpleMenu( GUID creature_guid, uint32 text_id, Player player )

Object

The object class is the highest base class(actually eventableobject is the highest but it's not accessible in Lua since it's purely for utility rather than a standalone class) in Arcemu.

All other classes such as Item, Unit, GameObject, derive from Object. All objects in the Lua environment can access their methods without explicit casting since it's the most basic class.

Methods


GUID methods


GUID : GetGUID()
uint32 : GetHighGUID()
uint32 : GetLowGUID()
WoWGUID : GetNewGUID()
uint32 : GetEntryFromGUID()

Class identification methods


uint32 : GetEntry()
uint32 : GetTypeID()
bool : IsUnit()
bool : IsGameObject()
bool : IsPlayer()
bool : IsItem()
bool : IsCreature()
bool : IsPet()

Position methods


float : GetPositionX()
float : GetPositionY()
float : GetPositionZ()
float : GetOrientation()
void : SetPosition( float newX, float newY, float newZ, float newO )
float : GetSpawnX()
float : GetSpawnY()
float : GetSpawnZ()
float : GetSpawnO()
bool : IsInFront( Object target )
bool : IsBehind( Object target)
bool : IsInArc( Object target, float degrees )
float : CalcAngle( float x1, float y1, float x2, float y2 )
float : CalcRadAngle( float x1, float y1, float x2, float y2 )
uint32 : GetMapID()
uint32 : GetZoneID()
uint32 : SetMapID( uint32 newmapid )
uint32 : SetZoneID( uint32 newzoneid )

Object Model Manipulation


float : GetScale()
void : SetScale( float newscale )

Distance Manipulation Methods


float : CalcDistanceToObject( Object )
float : CalcDistanceToLocation( float x, float y, float z )

Phasing Methods


void : Phase ( uint32 command, uint32 newphase )
uint32 : GetPhase()
LCF void : PhaseAdd( uint32 phasetoadd )
LCF void : PhaseSet( uint32 phasetoset )
LCF void : PhaseDelete( uint32 phasetodelete )

InRange Objects Methods


table<Object> : GetInRangeOpposingFactions()
table<Object> : GetInRangeSameFactions()
table<Object> : GetInRangeObjects()
LCF table<Player> : GetInRangePlayers()
LCF table<Unit> : GetInRangeAllies()
LCF table<Unit> : GetInRangeEnemies()
LCF table<Unit> : GetRandomAlly()
LCF table<Unit> : GetRandomEnemy()
LCF table<Unit> : GetClosestAlly()
LCF table<Unit> : GetClosestEnemy()
LCF table<Player> : GetClosestPlayer()
LCF table<Player> : GetRandomPlayer( uint32 type )
LCF table<Creature> : GetInRangeCreatures()
LCF table<Unit> : GetInRangeUnits()
LCF table<Creature> : GetFriendlyCreatures()
LCF table<Creature> : GetHostileCreatures()
LCF table<GameObject> : GetInRangeGameObjects()

Object Flag Methods


uint32 : GetUInt32Value( uint32 field_index)
GUID : GetUInt64Value( uint32 field_index)
void : SetUInt32Value ( uint32 field_index, uint32 newvalue )
void : SetUInt64Value ( uint32 field_index, GUID newguid)
float : GetFloatValue ( uint32 field_index )
void : SetFloatValue ( uint32 field_index, float newvalue )
void : ModFloatValue ( uint32 field_index, float modvalue )
void : ModFloatValueByPCT ( uint32 field_index, int32 percentage )
void : ModUnsigned32Value ( uint32 field_index, int32 modvalue)
void : ModSigned32Value ( uint32 field_index, int32 modvalue)
uint8 : GetByte( uint32 field_index, uint32 byte_index )
void : SetByte( uint32 field_index, uint32 byte_index, uint8 byte_value)
void : SetFlag ( uint32 field_index, uint32 flag_to_append )
void : RemoveFlag ( uint32 field_index, uint32 flag_to_remove)

Misc Methods


void : PlaySoundToSet( uint32 sound_id )
bool : IsInBg()
bool : IsInWorld()
Spell : GetCurrentSpell()
void : SendPacket( WorldPacket packet )
void : DealDamage( Unit target, uint32 damage, uint32 targetEvent, uint32 spellid, bool no_remove_auras )

Unit

The Unit class is used to describe players and creatures.

It's effectively an abstract class since you can't instantiate a Unit.

It either has to be a player instantiation or a creature.

Unit derives from Object so it contains all its methods meaning you can call Object methods from a Unit userdata.

Methods

AIInterface : GetAIInterface()

PvP Methods


bool : IsPVPFlagged()
void : SetPVPFlag()
void : RemovePVPFlag()
bool : IsFFAPVPFlagged()
void : SetFFAPVPFlag()
void : RemoveFFAPVPFlag()
bool : IsSanctuaryFlagged()
void : SetSanctuaryFlag()
void : RemoveSanctuaryFlag()

Stat Methods


uint32 : GetLevel()
void : SetLevel( uint32 newlevel )
void : ModLevel( int32 modlevel )
uint32 : GetAP()
uint32 : GetRAP()
int32 : GetStealthLevel()
int32 : GetStealthDetectBonus()
void : SetMinDamage( float mindamage )
float : GetMinDamage()
void : SetMaxDamage( float maxdamage )
float : GetMaxDamage()
void : SetMinOffhandDamage( float minoffhanddamage )
float : GetMinOffhandDamage()
void : SetMaxOffhandDamage( float maxoffhanddamage )
float : GetMaxOffhandDamage()
void : SetStat( uint32 stat_index, uint32 amount )
uint32 : GetStat( uint32 stat_index )
void : SetResistance( uint32 res_index, uint32 amount )
uint32 : GetResistance( uint32 res_index )
void : SetBaseHealth( uint32 basehealth )
void : SetBaseMana( uint32 basemana )
uint32 : GetHealth()
void : SetHealth( uint32 newhealth)
uint32 : GetHealthPct()
void : SetHealthPct( uint32 percent )
uint32 : GetMaxHealth()
void : SetMaxHealth( uint32 newmaxhealth)
void : ModHealth( int32 modamount)
void : ModMaxHealth( int32 modamount)
uint32 : GetPower( uint32 power_type )
void : SetPower( uint32 power_type, uint32 amount )
uint32 : GetMaxPower( uint32 power_type )
void : SetMaxPower( uint32 power_type, uint32 amount )
void : SetManaPct( uint32 percent )

State Methods


bool : IsCasting()
bool : IsDazed()
bool : IsStealthed()
void  : RemoveStealth()
bool : IsInvisible()
void : SetInvisibility( uint32 id )
void : RemoveInvisibility()
bool : IsAlive()
bool : IsDead()
bool : IsPacified()
bool : IsFeared()
bool : IsStunned()
void : AddStateFlag( uint32 flag )
bool : HasStateFlag( uint32 flag )
void : ClearStateFlag( uint32 flag )
void : EnableAI()
void : DisableAI()
void : SetEmoteState( uint8 emote )
uint32 : GetOldEmote()

Attributes


uint32 : GetClassMask()
uint32 : GetRaceMask()
uint32 : GetFaction()
void : SetFaction( uint32 faction )
bool : IsSpiritHealer()
uint32 : GetClass()
void : SetClass( uint32 class)
uint32 : GetRace()
void : SetRace( uint32 race)
uint32 : GetPowerType()
void : SetPowerType( uint32 power_type )
uint32 : GetDisplayID()
void : SetDisplayID( uint32 newdisplay )
uint32 : GetDisplayID()
void : SetNativeDisplayID( uint32 newdisplay )

Combat Methods


return type methods
bool IsAttackReady( bool offhand )
void SetAttackTimer( uint32 time, bool offhand )
CombatStatus CombatStatus
void Heal( Unit target, uint32 spellid, uint32 amount )
void Energize( Unit target, uint32 spellid, uint32 amount, uint32 power_type)
uint32 GetThreatModifyer()
void ModThreatModifyer( int32 mod )

Messaging Methods

return type method
void SendChatMessage( uint32 chat_type, uint32 language_type, string message, uint32 delay)
void SendChatMessageToPlayer( uint32 chat_type, uint32 language_type, string message, Player plr)
void SendChatMessageAlternateEntry( uint32 creature_entry, uint32 chat_type, uint32 language_type, string message)

Movement


return type method
float runspeed
float walkspeed
float flyspeed

Spell/Aura


void : Demorph()
void : CastSpell( Unit target, uint32 spellid, bool triggered)
void : CastSpellAoF( float x, float y, float z, SpellEntry spell, bool triggered)
bool : HasAura( uint32 spellid )
uint32 : GetAuraStackCount( uint32 spellid)
bool : HasAurasWithMechanic( uint32 mechanic)
bool : RemoveAura( uint32 spellid, GUID guid)
bool : RemoveAllAuras( uint32 spellid, GUID guid)
void : RemoveNegativeAuras()
void : RemoveAllNonPersistentAuras()

CombatStatus

bool : IsInCombat()

Creature

The Creature class is what all in-game npcs are. It derives from Unit, so it contains all of Units methods.

Methods

Attributes


bool : IsVehicle()
bool : IsVendor()
bool : IsTrainer()
bool : IsClassTrainer()
bool : IsProfTrainer()
bool : IsQuestGiver()
bool : IsFlightMaster()
bool : IsCharterGiver()
bool : IsGuildBanker()
bool : IsBattleMaster()
bool : IsBanker()
bool : IsInnKeeper()
bool : IsTabardDesigner()
bool : IsAuctioneer()
bool : IsStableMaster()
bool : IsArmorer()
bool : IsTotem()
bool : IsExotic()
bool : IsCritter()
bool : IsTrainingDummy()
uint32 : GetSQLID()

Item


bool : HasItems()
uint32 : GetItemIdBySlot( uint32 slot )
uint32 : GetItemAmountBySlot( uint32 slot )
int32 : GetSlotByItemId( uint32 itemid)
uint32 : GetItemAmountByItemId( uint32 itemid)

Quests


bool : HasQuests()
bool : HasQuest( uint32 questid, uint32 type)
void : AddQuest( QuestRelation quest )
void : DeleteQuest( QuestRelation quest )
Quest : FindQuest( uint32 quest_id, uint8 relation)
uint32 : GetQuestRelation( uint32 quest_id)
uint32 : NumOfQuests()

Misc


void : RemoveFromWorld( bool free_guid)
CreatureProto : GetProto()
bool : CanSee( Unit target )
uint32 : GetTotemSlot()
Group : GetGroup()
CreatureInfo : GetCreatureInfo()
bool : isSkinned
bool : IsPickPocketed()
bool : Despawn( uint32 delay, uint32 respawndelay )
bool : m_noRespawn
Player : m_escorter
void : SaveToDB()
bool : canregeneratehp
void : RegisterEvent( lua_function function, uint32 delay, uint32 repeats, ... )
void : RemoveEvents()
CreatureAIScript : GetScript()

CreatureProto

A structure that holds useful information describing a creature. Every unique creature id has a copy of this structure.

property type property name
uint32 Id
uint32 MinLevel
uint32 MaxLevel
uint32 Faction
uint32 MinHealth
uint32 MaxHealth
uint32 Mana
uint32 NPCFlags
uint32 MinDamage
uint32 MaxDamage
uint32 boss
float walk_speed
float run_speed
float fly_speed
uint32 guardtype
uint32 summonguard

CreatureInfo

Another structure that holds useful information for a creature.

property type property name
uint32 Id
string Name
string SubName
uint32 Type
uint32 Family
uint32 Rank

CreatureAIScript

This class is what is responsible for calling the method AIUpdate() for creatures.

void : RegisterAIUpdateEvent( uint32 period )
void : ModifyAIUpdateEvent( uint32 newperiod)
void : RemoveAIUpdateEvent()

AIInterface

This class is what defines AI behavior for creatures.

return type method name
void SetUnitToFollow( Unit newtarget )
Unit GetUnitToFollow()
void SetFollowDistance( float newdistance )
void SetFollowAngle( float newangle )
Unit GetUnitToFear()
void SetUnitToFear( Unit newtarget )
Unit GetSoullinkedWith()
bool IsSoullinked()
void SetSoulLinkedWith( Unit newtarget )
uint8 GetAIState()
void SetAIState( uint32 newstate )
void MoveTo( float x,float y,float z, float o)
void StopMovement( uint32 stoptime )
bool hasWaypoints()
Unit GetNextTarget()
void SetNextTarget( Unit newtarget )
void AttackReaction( Unit target, uint32 threat, uint32 spellid )
void HealReaction( Unit healer, Unit victim, SpellEntry spell, uint32 amount )
void WipeHateList()
void RemoveThreatByPtr( Unit hated )
bool modThreatByPtr( Unit hated, int32 mod )
uint32 getThreatByPtr( Unit hated )
Unit GetMostHated()
Unit GetSecondHated()
bool taunt( Unit target, bool apply )
Unit GetTauntedBy()
bool IsTaunted()
uint32 GetCurrentWaypoint()
void ChangeWaypointID( uint32 oldid, uint32 newid )
Waypoint GetWaypoint( uint32 wpid )
void DeleteWayPoint( uint32 wpid )
void DeleteWayPoints()
void SetWaypointToMove( uint32 wpid )
void SetMoveType( uint32 movementtype)
uint32 GetMoveType()
bool IsFlying()
void AddWayPoint( Waypoint wptoadd )
uint32 GetAITargetsCount()
properties
property type property name
bool canmove
bool moveRun
bool moveFly
bool disable_combat
bool disable_melee
bool disable_spell
bool disable_targeting

Waypoint

This class defines a structure that provides location vector coordinates and other information creatures use for waypoints.

properties
property type property name
uint32 id
float x
float y
float z
float o
uint32 waittime
uint32 flags
uint32 backwardskinid
uint32 forwardskinid

GameObject

This class object defines things like doors/chests/traps/transports, etc. GameObjects are very passive objects since they mostly require input from a unit to function.

return type method name
bool HasQuests()
uint32 NumOfQuests()
void Despawn( uint32 delay, uint32 respawndelay )
bool IsQuestGiver()
void RemoveFromWorld( bool free_guid )
GameObjectAIScript GetScript()
GameObjectInfo GetInfo()
void SaveToDB()
void RegisterEvent( lua_function function, uint32 delay, uint32 repeats, ... )
void RemoveEvents()

GameObjectAIScript

This class is what is responsible for calling the method AIUpdate() for gameobjects.

return type method name
void RegisterAIUpdateEvent( uint32 period )
void ModifyAIUpdateEvent( uint32 newperiod)
void RemoveAIUpdateEvent()

GameObjectInfo

property type property name
uint32 ID
uint32 Type
uint32 DisplayID
string Name
uint32 SpellFocus

Player

This class is what defines the player. It derives from Unit so it has all of its methods.

Skill Manipulation

return type method proto
void AdvanceSkillLine( uint32 skilline, uint32 amount )
void AddSkillLine( uint32 skilline, uint32 current, uint32 max )
uint32 GetSkillLineMax( uint32 skilline )
uint32 GetSkillLineCurrent( uint32 skilline )
uint32 RemoveSkillLine( uint32 skilline )
void ModifySkillBonus( uint32 skilline, int32 mod )
void ModifySkillBonusByType( uint32 skilltype, int32 mod )
bool HasSkillLine( uint32 skilline )
void removeSkillSpells( uint32 skilline )
void RemoveAllSkills()
void advanceSkills( uint32 amount )
void modifyMaxSkill( uint32 skilline, uint32 newmax )
void learnSkillSpells( uint32 skilline, uint32 skillcurrent )

Languages

return type method proto
void RemoveLanguages()
void AddLanguages( bool all )

Taxi

return type method proto
TaxiPath GetTaxiPath()
bool GetTaxiState()
void TaxiStart( TaxiPath path, uint32 modelid, uint32 starting_node )
void SetTaxiPath( TaxiPath path)
void SetTaxiState( bool state )

Quest

return type method proto
bool HasQuests()
int32 GetOpenQuestSlot()
QuestLogEntry GetQuestLogForEntry( uint32 entry )
QuestLogEntry GetQuestLogInSlot( int32 slot )
uint32 GetQuestSharer()
void SetQuestSharer( uint32 guid )
void SetQuestLogSlot( QuestLogEntry qlog, uint32 slot )
void HasFinishedDaily( uint32 questid )
void AddToFinishedQuests( uint32 questid )
bool HasFinishedQuest( uint32 questid )
bool GetQuestRewardStatus( uint32 questid )
bool HasQuestForItem( uint32 itemid )
bool HasQuestSpell ( uint32 spellid )
void RemoveQuestSpell( uint32 spellid )
bool HasQuest( uint32 questid )
void RemoveQuestMob( uint32 id )

Player Team

return type method proto
uint32 GetTeam()
uint32 getInitialTeam()
void SetTeam( uint32 team )
void ResetTeam()
bool isHordeTeam()
bool isAllianceTeam()

Spells/Talents

return type method proto
bool HasSpell( uint32 spellid )
void AddSpell( uint32 spellid )
void AddShapeShiftSpell( uint32 spellid )
void RemoveShapeShiftSpell( uint32 spellid )
uint8 GetShapeShift()
void SetShapeShift( uint8 newss )
void ResetAllCooldowns()
void ClearCooldownForSpell( uint32 spellid )
uint32 GetTalentPoints()
void ModTalentPoints( int32 mod )
void SetTalentPoints( uint32 talentpoints )
void ResetSpells()
void ResetTalents()

Reputation

return type method proto
int32 GetStanding( uint32 faction )
void ModStanding( uint32 faction, int32 mod )
int32 GetBaseStanding( uint32 faction )
void SetStanding( uint32 faction, int32 value )
Standing GetStandingRank( uint32 faction )
uint32 GetExaltedCount()
uint8 GetPVPRank()
void SetPVPRank( int32 newrank )
uint32 GetMaxPersonalRating()
uint32 HasTitle( RankTitles title )
void SetKnownTitle( RankTitles title, bool set )

Group/Guild

return type method name
bool IsInGroup()
bool IsGroupLeader()
bool IsGroupMember( Player player )
bool IsInGuild()
uint32 GetGuildID()
void SetGuildID( uint32 id )
uint32 GetGuildRank()
void SetGuildRank( uint32 rank )

Dueling

return type method proto
void RequestDuel( Player target )
void EndDuel( uint8 winreason )
void DuelCountDown()
void SetDuelStatus( uint8 status )
uint8 GetDuelStatus()
void SetDuelState( uint8 state )
uint8 GetDuelState()
uint32 GetDuelTeam()
void SetDuelTeam( uint32 team )

Ban/Kick

return type method proto
bool IsBanned()
void SetBanned()
void SetBannedWithReason( string reason )
void clearBan()
string GetBanReason()
void Kick( uint32 delay )
void SoftDisconnect()

Misc

return type method proto
bool CanSee( Object target )
bool IsVisible( GUID target )
bool IsMounted()
void Dismount()
void SafeTeleport( uint32 mapid, uint32 instanceid, float x, float y, float z, float o)
void Teleport( uint32 mapid, float x, float y, float z )
uint32 GetDungeonDifficulty()
uint32 GetRaidDifficulty()
void Possess( Unit target )
void Unpossess()
string GetName()
WorldSession GetSession()
void KillPlayer()
void ResurrectPlayer()
void SetBindPoint( float x, float y, float z, uint32 mapid, uint32 zoneid )

Targetting

return type method proto
GUID GetFarsightTarget()
void SetFarsightTarget( GUID newtarget )
GUID GetTarget()
void SetTarget( GUID newtarget )
GUID GetSelection()
void SetSelection( GUID newtarget )
GameObject GetSelectedGO()

Global Methods

LuaPacket(opcode, size)
- Creates a LuaPacket object so that you can use Packet Methods
on it.
CreateLuaEvent()
ModifyLuaEventInterval()
ModifyLuaEventTimer()
DestroyLuaEvent()
getregistry()
TO_PLAYER()
TO_CREATURE()
TO_ITEM()
TO_UNIT()
TO_GAMEOBJECT()
GetGameTime()
GetPlayer()
GetEngineName()
GetEngineVersion()
logcolor()
WorldDBQuery()
CharDBQuery()
SendWorldMessage()
ReloadTable()
ReloadLuaEngine()
GetPlayersInWorld()
Rehash()
GetArcemuRevision()
GetPlayersInMap()
GetPlayersInZone()
bit_and()
bit_or()
bit_xor()
bit_not()
bit_shiftleft()
bit_shiftright()
GetPlatform()
SendPacketToZone()
SendPacketToInstance()
SendPacketToWorld()
SendPacketToChannel()
GetInstanceCreature()
GetInstancePlayerCount()
GetPlayersInInstance()

DBC Spell

This is executed on dbcSpell. This is a global variable.
:LookupEntry()
:GetNumRows()
:LookupEntryForced()

SQL Query

These are executed on WorldDB or CharacterDB. Both of these are global variables.
:Query()
:Execute()

Map Methods

:GetMapID()
:GetObject()
:CreateGameObject()
:CreateAndSpawnGameObject()
:GetGameObject()
:GetCreature()
:GetMapInfo()
:CreateCreature()
:CreateDynamicObject()
:GetDynamicObject()
:GetPlayer()
:GetInstanceID()
:GetInterface()
:HasPlayers()
:GetPlayerCount()
:GetSqlIdCreature()
:GetSqlIdGameObject()

Map Script Interface

:GetGameObjectNearestCoords(GetGameObjectNearestCoords)
:GetCreatureNearestCoords(GetCreatureNearestCoords)
:GetPlayerNearestCoords(GetPlayerNearestCoords)
:SpawnCreature(uint32,float,float,float,float,bool,bool,uint32,uint32,uint32)
:SpawnGameObject(uint32,float,float,float,float,bool,uint32,uint32,uint32)

Taxi Methods

:GetTaxiNode(GetTaxiNode)
:GetTaxiPath(uint32)
:GetTaxiPathFT(uint32,uint32)
:GetNearestTaxiNode(GetNearestTaxiNode)
:GetID(GetID)
:AddPathNode(AddPathNode)
:GetNodeCount(GetNodeCount)
:GetPrice(GetPrice)

Packet Methods

These are invoked on LuaPacket objects. :opcode()
:clear()
:WriteInt8()
:WriteUInt8()
:WriteInt16()
:WriteUInt16()
:WriteInt32()
:WriteUInt32()
:WriteWoWGuid()
:size()

Spell Methods

:gettype()
:getstate()
:cancel()
:cast()
:finish()
:getproto()
:isaspect()
:isseal()
:createprotooverride()
:getduration()
:getradius()
:isstealthspell()
:isinvisibilityspell()

Personal tools