CuAPI

From Camelot Unchained Wiki
Jump to: navigation, search


cuAPI is the interface between a user interface widget and the client. The interface is divided into various sections, most of which are only included if a corresponding flag is included in the widget's .ui file.

General[edit | edit source]

This section covers all the standard cuAPI methods and properties that are included regardless of any "handles...." flags in the .ui file.

Events[edit | edit source]

Events allow inter-UI communication. An event fired in one UI can be listened for and received in another UI. It follows the pub/sub pattern though with a slightly quirky [due to technical limitations] interface. For an example of a more traditional pub/sub interface wrapper to these events see here.

cuAPI.listen(topic) 
Tells the client to send events for the specified topic. Topic should match the name of an event fired by this or other UIs.
cuAPI.OnEvent(handler) 
Callback from the client when a previously listened for topic is seen. The handler receives the topic and an object with the payload (arguments) of the event.
cuAPI.Ignore(topic) 
Stop listening for events for topic.
cuAPI.Fire(topic, args) 
Fire an event with a payload / arguments.

Abilities[edit | edit source]

"handlesAbilities": true

Methods for handling abilities.

Announcements[edit | edit source]

"handlesAnnouncements": true

Methods for handling announcements.

BeginChat[edit | edit source]

"handlesBeginChat": true

This UI handles the cuAPI.OnBeginChat() callback. Only one UI can handle begin chat at a time, as it links the pressing ENTER in the client to the UI that will handle the chat.

Building[edit | edit source]

"handlesBuilding": true

Methods for handling building.

Character[edit | edit source]

"handlesCharacter": true

Methods for handling character (player).

Chat[edit | edit source]

"handlesChat": true

Methods for handling chat.

Config[edit | edit source]

"handlesConfig": true

Methods for handling config.

Console[edit | edit source]

"handlesConsole": true

Methods for handling console commands.

EnemyTarget[edit | edit source]

"handlesEnemyTarget": true

Methods for handling the enemy target.

EquippedGear[edit | edit source]

"handlesEquippedGear": true

Methods for handling equipped gear.

FriendlyTarget[edit | edit source]

"handlesFriendlyTarget": true

Methods for handling the friendly target.

Input[edit | edit source]

"handlesInput": true

This flag tells the client that input events (keyboard and mouse) should be sent to this UI. If a UI does not need to handle input, it should not set this flag in order to maximize performance.

Inventory[edit | edit source]

"handlesInventory": true

Methods for handling the inventory.

Login[edit | edit source]

"handlesInventory": true

Methods for handling the login process.