EQEMU Quest API: Difference between revisions

From EQArchives
Jump to navigationJump to search
 
(25 intermediate revisions by the same user not shown)
Line 1: Line 1:
This will document the Quest API for Perl since that is what is used on EQ Archives.
This will document the Quest API for Perl since that is what is used on EQ Archives. Also see the official [https://docs.eqemu.io/quest-api/introduction/ EQEMU Quest API] docs and [http://spire.akkadius.com/quest-api-explorer?lang=perl&constant=Mob Spire Quest API Explorer] for latest definitions and Quest examples.
== Perl Consts ==


=== Mob ===
The EQEMU Quest API is largely event-based.  Variables in the Perl API are available either as Perl Consts that are available for all events, or as variables that are exported specifically for a given event.


==== $faction ====
== Events ==
Provides the faction level the player has with the NPC's primary faction. This will be an integer between 1 (Ally) and 9 (Scowls). See https://docs.eqemu.io/server/factions/faction-values/
Quest Event subroutines are defined in the EQEMU Server source code at [https://github.com/EQEmu/Server/blob/7873ad37710cfe65f75f63c92cb226787df23b70/zone/embparser.cpp#L59 https://github.com/EQEmu/Server/blob/7873ad37710cfe65f75f63c92cb226787df23b70/zone/embparser.cpp#L59]
TODO
{| class="wikitable"
! Event Name !! Trigger !! Notes
|-
| [[QuestAPI:Perl:EVENT_AGGRO|EVENT_AGGRO]] || ||
|-
| [[QuestAPI:Perl:EVENT_AGGRO_SAY|EVENT_AGGRO_SAY]] || ||
|-
| [[QuestAPI:Perl:EVENT_ITEM|EVENT_ITEM]] || When an item or money is turned into the mob. || This is actually aliased to EVENT_TRADE, and is exclusive to the Perl API (Lua uses EVENT_TRADE).
|-
| [[QuestAPI:Perl:EVENT_AGGRO|EVENT_AGGRO]]
|}


==== $class ====
== Perl Consts ==
The player's class (i.e. Rogue, Cleric, etc.).
The following variables are exported and are always available for use in NPC scripts.
=== Mob ===
{| class="wikitable"
! Constant !! Description
|-
| $bot_id ||
|-
|$bot_owner_char_id ||
|-
| $class || The player's class '''Name''' (i.e. Rogue, Cleric, etc.). See also https://docs.eqemu.io/server/player/class-list/
|-
| $faction ||Provides the faction level the player has with the NPC's primary faction.  This will be an integer between 1 (Ally) and 9 (Scowls).  See also https://docs.eqemu.io/server/factions/faction-values/
|-
| $h ||Current heading of mob (i.e. the direction they are facing out of 360 degrees).
|-
| $hpratio ||
|-
| $mlevel || Mob's (NPC) level
|-
| $mname || Mob's (NPC) name
|-
| $mobid || NPC ID - should line up with the ID in the npc_types table.  See also https://docs.eqemu.io/schema/npcs/npc_types/
|-
| $name || the player's first name
|-
| $race ||The player's race (i.e. Human, Erudite, etc.).
|-
| $status || -2 = Banned, -1 = Suspended, 0 = Normal players, and > 1 are privileged users (Guides, GM); see https://docs.eqemu.io/server/player/status-levels/
|-
| $targetid ||
|-
| $targetname ||
|-
| $ulevel || player (user) level
|-
| $uguild_id || player (user) unique guild identifier in the database (an integer)
|-
| $uguildrank || 0 = Member, 1 = Officer, 2 = Leader; see https://docs.eqemu.io/server/player/guild-ranks/
|-
| $userid || player's unique identifier in the database (an integer)
|-
| $x || Current x coordinates of mob.
|-
| $y ||Current y coordinates of mob.
|-
| $z ||Current z coordinates of mob.
|-
|}


==== $race ====
=== Zone ===
The player's race (i.e. Human, Erudite, etc.).
{| class="wikitable"
! Constant !! Description
|-
|$instanceid ||
|-
|$instanceversion ||
|-
|$zonehour ||
|-
|$zoneid ||
|-
|$zoneln ||
|-
|$zonemin ||
|-
|$zonesn ||
|-
|$zonetime ||
|-
|$zoneweather ||
|-
|}


==== $x ====
== Source Code ==
Current x coordinates of mob.
The best source of truth for quest api is in the EQEMU source code. The relevant files are as follows:
 
* Any source file that starts with '''perl_''' at https://github.com/EQEmu/Server/tree/master/zone
==== $y ====
* https://github.com/EQEmu/Server/blob/7873ad37710cfe65f75f63c92cb226787df23b70/zone/embparser.h
Current y coordinates of mob.
* https://github.com/EQEmu/Server/blob/7873ad37710cfe65f75f63c92cb226787df23b70/zone/embparser.cpp
 
* https://github.com/EQEmu/Server/blob/7873ad37710cfe65f75f63c92cb226787df23b70/zone/embparser_api.cpp
==== $z ====
* https://github.com/EQEmu/Server/blob/7873ad37710cfe65f75f63c92cb226787df23b70/zone/embperl.h
Current z coordinates of mob.
* https://github.com/EQEmu/Server/blob/7873ad37710cfe65f75f63c92cb226787df23b70/zone/embperl.cpp
 
==== $h ====
Current heading of mob (i.e. the direction they are facing out of 360 degrees).
 
<pre>
$bot_id
$bot_owner_char_id
$class
$faction
$h
$hpratio
$mlevel
$mname
$mobid
$name
$race
$status
$targetid
$targetname
$uguild_id
$uguildrank
$ulevel
$userid
$x
$y
$z
</pre>
 
=== Zone ===
<pre>
$instanceid
$instanceversion
$zonehour
$zoneid
$zoneln
$zonemin
$zonesn
$zonetime
$zoneweather
</pre>

Latest revision as of 03:53, 2 July 2023

This will document the Quest API for Perl since that is what is used on EQ Archives. Also see the official EQEMU Quest API docs and Spire Quest API Explorer for latest definitions and Quest examples.

The EQEMU Quest API is largely event-based. Variables in the Perl API are available either as Perl Consts that are available for all events, or as variables that are exported specifically for a given event.

Events

Quest Event subroutines are defined in the EQEMU Server source code at https://github.com/EQEmu/Server/blob/7873ad37710cfe65f75f63c92cb226787df23b70/zone/embparser.cpp#L59

TODO
Event Name Trigger Notes
EVENT_AGGRO
EVENT_AGGRO_SAY
EVENT_ITEM When an item or money is turned into the mob. This is actually aliased to EVENT_TRADE, and is exclusive to the Perl API (Lua uses EVENT_TRADE).
EVENT_AGGRO

Perl Consts

The following variables are exported and are always available for use in NPC scripts.

Mob

Constant Description
$bot_id
$bot_owner_char_id
$class The player's class Name (i.e. Rogue, Cleric, etc.). See also https://docs.eqemu.io/server/player/class-list/
$faction Provides the faction level the player has with the NPC's primary faction. This will be an integer between 1 (Ally) and 9 (Scowls). See also https://docs.eqemu.io/server/factions/faction-values/
$h Current heading of mob (i.e. the direction they are facing out of 360 degrees).
$hpratio
$mlevel Mob's (NPC) level
$mname Mob's (NPC) name
$mobid NPC ID - should line up with the ID in the npc_types table. See also https://docs.eqemu.io/schema/npcs/npc_types/
$name the player's first name
$race The player's race (i.e. Human, Erudite, etc.).
$status -2 = Banned, -1 = Suspended, 0 = Normal players, and > 1 are privileged users (Guides, GM); see https://docs.eqemu.io/server/player/status-levels/
$targetid
$targetname
$ulevel player (user) level
$uguild_id player (user) unique guild identifier in the database (an integer)
$uguildrank 0 = Member, 1 = Officer, 2 = Leader; see https://docs.eqemu.io/server/player/guild-ranks/
$userid player's unique identifier in the database (an integer)
$x Current x coordinates of mob.
$y Current y coordinates of mob.
$z Current z coordinates of mob.

Zone

Constant Description
$instanceid
$instanceversion
$zonehour
$zoneid
$zoneln
$zonemin
$zonesn
$zonetime
$zoneweather

Source Code

The best source of truth for quest api is in the EQEMU source code. The relevant files are as follows: