node-lou
This node library provides methods to connect and retrieve information from the Lord of Ultima game API.
Installation
This package can be installed via the node npm package manager.
npm install node-lou
Usage
Since the release of v0.2, the node-lou library now permits multiple accounts to be used. This allows the library to send multiple requests in parallel to LoU decreasing the time it takes to complete certain requests and avoiding the LoU bot detection.
You must first connect to LoU using the createClient() method. Once the connection is made you can then request info from LoU easily.
var lou =lou
API
lou.createClient
Used to provide configuration data, authenticate with LoU, and connect to the world. Returns null if successful or an error as the first argument in the callback function
lou
lou.get
The get namespace contains methods for retrieving info from LoU. Some of these methods require several calls to the LoU API. These particular methods will take advantage of multiple LoU accounts to speed up the request.
// Get the current server timestamp and step used for time calculationslouget// Retrieve an authenticated account. If no email is provided will grab the next available account.var acct = louget// Retrieve alliance info by idlouget// Retrieve alliance info by namelouget// Retrieve the alliance info of a player by their idlouget// Retrieve the members of an alliance by idlouget// Get a player's public info by idlouget// Retrieve public city information by give city idlouget// The next three methods retrieve complete listings of information// in the world and can take several seconds to complete. They// utilize multiple accounts to speed up this process.lougetlougetlouget
lou.get.my
This namespace contains methods for gathering information specific to a configured account. Must supply the email address of the desired account. Since these are specific to an account, they return private information.
lougetmylougetmylougetmylougetmy
lou.send
The send namespace contains methods for LoU commands that trigger an action. These methods can be considered against the LoU Gameplay rules and may result in a ban of the offending account. I am not responsible for the use of the below methods.
lousend
lou.raw
This method exposes the communication to LoU for sending raw requests. The first argument must contain two elements, an endpoint string and a data object. The data object is what is sent to the LoU server while the endpoint specifies it's destination. The example provided is the raw request for retrieving an alliance by id.
louget
Examples
A simple example of retrieving a player's city with only his name and the city name. Check the examples directory for more examples.
var playerName = 'PastorBones' cityName = 'Jericho' // First, create our client and get a connectionlou
Contributing
Fork the node-lou repository on GitHub and send a Pull Request.
Notes
- Requires the 'htmlparser' and 'async' node modules.
- Early in it's development, the API may change in future releases
TODO
- Add the rest of the API functions
- Instill better error checking throughout library on supplied attributes
- Develope a node compatible javascript library for decrypting world data (base91)
- High-level functions
- city layout generation
- time calculations for resources and travel distances
- boss and dungeon calculations for amount of troops to send
License
Copyright (c) 2012 Roger Mayfield (pastor_bones@yahoo.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.