1. Initium Module¶
Initium.py is essentially the core framework for the Howl project. This file contains all the methods included in the framework, however, modules are encouraged to contain their own functions in addition to the core framework functions found here.
-
class
initium.
initium
[source]¶ Bases:
object
This is the core Howl framework object.
All bot modules should inerhit from this class by using:
>>> class Bot(initium.webdriver, initium.initium): # Class definition line for Bot implementing Howl framework
-
get_chat_messages
(chat_tab='Private')[source]¶ This function opens the specified chat tab and collects all messages and authors in the chat.
- Args:
- chat_tab (string) – Global, Location, Party, Group, or Private. Default is “Private”
- Returns:
- messages (array) – An array of dictionaries containing keys ‘time’, ‘author’, ‘text’, ‘channel’.
One way to use this function is:
messages = Bot.update_messages(“Global”)
-
get_gold
()[source]¶ This function returns the current gold in the bot’s inventory in the Initium game.
- Args:
- None: This function takes no arguments
- Returns:
- Gold (string) – Either actual gold or “-1” if gold could quantitiy not be found.
One way to use this function is:
>>> print("Gold: " + Bot.get_gold()) Gold: 9,873
-
get_item_stats
(element=None)[source]¶ This function parses the popup HTML for relevant item stats. Optionally receives an argument element to click before loading stats, otherwise assumes an item popup is opened.
- Args:
- element (selenium.WebElement) – Optionally click this element to load its item stats
- Returns:
- stats (dictionary) – A mapping of string keys to their respective stats. Empty if no popup is open
One way to use this function is:
>>> item_stats = Bot.get_item_stats(item_web_element) # Fills the dictionary with all relevant stats
-
get_location
()[source]¶ This function returns the current location of the bot in the Initium world.
- Args:
- None: This function takes no arguments
- Returns:
- Location (string) – Either actual location or “Unknown Location” if location could not be found.
One way to use this function is:
>>> print("Location: " + Bot.get_location()) Location: Aera
-
is_chat_tab_loaded
(chat_tab='Location')[source]¶ Checks for existance of messages in the given chat tab.
- Args:
- chat_tab (strng) – The chat tab to select. Default is ‘Location’
- Returns:
- result (boolean) – True if an item popup is loaded
-
is_item_popup_open
()[source]¶ Checks for existance of an item popup with stats visible.
- Args:
- None - This function receives no arguments
- Returns:
- result (boolean) – True if an item popup is loaded
-
login
(email, pw)[source]¶ This function logs the player in to the Initium world.
- Args:
- email (string) – Username to log in with pw (string) – Password to log in with
- Returns:
- None: This function return is void
-
reply
(text, player=None, delay=True)[source]¶ This replies to a player with a certain message in the Private chat tab. Multiple messages can be said by separating them with newline characters.
Do be wary of multiple messages at once tho, as too many sent too quickly can result in a temporary chat ban in-game.
Assumes player name already selected if player is not given.
- Args:
text (string) – Actual message to be said to player.
player (string) – Target player’s name.
delay (boolean) – Delay between sending messages or not. Default is True
- Returns:
- Nothing is returned by this function.
Examples of this function in use:
>>> Bot.reply("Using Howl is easy!", "[Dev] Rade") # "Using Howl is easy!" whispered to whichever player's name is in PlayerNameElement >>> Bot.reply("This Message splits \n Into two chat messages.", "Bella") # "This message splits ", " Into two chat messages." both said to the given player >>> Bot.reply("Something here.") # "Something here" said in private chat, assuming player name was already selected for private chat.
-
say
(text, chat_tab='Location', delay=True)[source]¶ This function says a message in the specified chat tab. Multiple messages can be said by separating them with newline characters.
Do be wary of multiple messages at once tho, as too many sent too quickly can result in a temporary chat ban in-game.
- Args:
text (string) – Actual message to be said in chat.
chat_tab (string) – Global, Location, Party, Group, or Private (Note, Initium.reply should be used for private). Default is “Location”
delay (boolean) – Delay between sending messages or not. Default is True
- Returns:
- Nothing is returned by this function.
Examples of this function in use:
>>> Bot.say("Using Howl is easy!", "Global") # "Using Howl is easy!" in Global tab >>> Bot.say("This Message splits \n Into two chat messages.", "Location") # "This message splits ", " Into two chat messages." both in Location tab
-