Custom ingame UI library for TERA.
index.js
const UI = require('ui'),
Command = require('command')
module.exports = function TestUI(dispatch) {
const ui = UI(dispatch),
command = Command(dispatch)
ui.use(UI.static(__dirname + '/ui'))
command.add('testui', () => { ui.open() })
}
ui/index.html
<html>
<head>
<script>
window.addEventListener('error', function(e) {
_tera_client_proxy_.alert('Error: ' + e.message)
})
window.onload = function() {
_tera_client_proxy_.resize_to(200, 200)
_tera_client_proxy_.set_title('Test UI')
}
</script>
</head>
<body>
Hello ponies!
</body>
</html>
The API is identical to Express, with a few notable differences:
- The constructor
UI(dispatch[, options])
returns an instance ofUI.Router
. UI.Router
has a new function calledopen([path])
which opens an ingame window pointing to the specified route.
The ingame Awesomium browser has a property of window
called __tera_client_proxy__
that allows scripts to interact with the client. It has the following functions:
Returns the player's gender name (localized).
Returns the player's race name (localized).
Returns the player's class name (localized).
Returns the player's name.
Returns the player's level.
Returns the player's continent ID.
Returns the arbiter server ID.
Returns the client's language code (ex. 'USA'
).
Returns the client's locale (ex. 'en'
).
Returns the browser window size.
Closes the browser window.
Prints a system alert message to the ingame chat box.
Sends C_QUERY_COIN
.
Reloads the page.
Resizes the browser window.
Sets the window title.