MARS Client Scripting Library - MarsUnit

From Multiverse

Jump to: navigation, search

MarsUnit is a module in the Mars Client Scripting API used for determining information about units in the world.

Contents

Methods

UnitAffectingCombat

affectingCombat = UnitAffectingCombat(unit)

Indicates whether the specified unit is affecting combat. Currently, this simply checks the combatstate property of the object.

Returns

True if the object has a combatstate property that is set to True or None if the object does not.

Parameters

Parameter Datatype Default Value Description
unit string None The unit specifier (e.g. "player", "target" or "mouseover")

UnitExists

unitExists = UnitExists(unit)

Indicates whether the specified unit exists in the world.

Returns

True if there is an object matching the unit specifier in the world or False if there is no such object.

Parameters

Parameter Datatype Default Value Description
unit string None The unit specifier (e.g. "player", "target" or "mouseover")

UnitHealth

health =  UnitHealth(unit)

Indicates the health of the specified unit.

Returns

An integer representing the current health of the specified unit, or a default of 0 if the object lacks the health property, or does not exist.

Parameters

Parameter Datatype Default Value Description
unit string None The unit specifier (e.g. "player", "target" or "mouseover")

UnitHealthMax

healthMax =  UnitHealthMax(unit)

Indicates the maximum health of the specified unit.

Returns

An integer representing the maximum health of the specified unit, or a default of 0 if the object lacks the health-max property, or does not exist.

Parameters

Parameter Datatype Default Value Description
unit string None The unit specifier (e.g. "player", "target" or "mouseover")

UnitInParty

isPartyMember =  UnitInParty(unit)

Indicates whether the specified unit is a member of a party.

Returns

Currently, since we do not maintain groups on the client, this is only a stub and will always return False.

Parameters

Parameter Datatype Default Value Description
unit string None The unit specifier (e.g. "player", "target" or "mouseover")

UnitIsPartyLeader

isPartyLeader = UnitIsPartyLeader(unit)

Indicates whether the specified unit is the leader of their party.

Returns

Currently, since we do not maintain groups on the client, this is only a stub and will always return False.

Parameters

Parameter Datatype Default Value Description
unit string None The unit specifier (e.g. "player", "target" or "mouseover")

UnitIsPVP

pvpEnabled =  UnitIsPVP(unit)

Indicates whether the specified unit has pvp enabled.

Returns

True if the object has a property named pvpstate and that property is set to True. If the object does not have the pvpstate property, or that property is not set to True this method will return None.

Parameters

Parameter Datatype Default Value Description
unit string None The unit specifier (e.g. "player", "target" or "mouseover")

UnitIsDead

isDead =  UnitIsDead(unit)

Indicates whether the specified unit is dead.

Returns

True if the object has a property named deadstate and that property is set to True. If the object does not have the deadstate property, or that property is not set to True this method will return None.

Parameters

Parameter Datatype Default Value Description
unit string None The unit specifier (e.g. "player", "target" or "mouseover")

UnitLevel

level =  UnitLevel(unit)

Indicates the level of the specified unit.

Returns

An integer representing the level of the specified unit, or a default of 0 if the object lacks the level property, or does not exist.

Parameters

Parameter Datatype Default Value Description
unit string None The unit specifier (e.g. "player", "target" or "mouseover")

UnitMana

mana =  UnitMana(unit)

Indicates the mana of the specified unit.

Returns

An integer representing the current mana (or power) of the specified unit, or a default of 0 if the object lacks the mana property, or does not exist.

Parameters

Parameter Datatype Default Value Description
unit string None The unit specifier (e.g. "player", "target" or "mouseover")

UnitManaMax

manaMax =  UnitManaMax(unit)

Indicates the maximum mana (or power) of the specified unit.

Returns

An integer representing the maximum mana (or power) of the specified unit, or a default of 0 if the object lacks the mana-max property, or does not exist.

Parameters

Parameter Datatype Default Value Description
unit string None The unit specifier (e.g. "player", "target" or "mouseover")

UnitName

objName =  UnitName(unit)

Indicates the name of the specified unit.

Returns

A string with the current name of the specified unit, or a default of "" if the object does not exist.

Parameters

Parameter Datatype Default Value Description
unit string None The unit specifier (e.g. "player", "target" or "mouseover")

UnitPlayerControlled

playerControlled =  UnitPlayerControlled(unit)

Indicates whether the specified unit is a player.

Returns

Currently, the client does not keep track of the difference between mobs and players, so this method only returns True if the selected unit is the player.

Parameters

Parameter Datatype Default Value Description
unit string None The unit specifier (e.g. "player", "target" or "mouseover")

Events

The MarsUnit module does not generates any UI events.

Messages

The MarsUnit module does not register for any message types

Personal tools