Levak / warfacebot

WarfaceBot, a headless XMPP client for Warface (FPS game)
GNU Affero General Public License v3.0
92 stars 73 forks source link
warface

WarfaceBot Build Status Coverity

... a headless XMPP client for Warface (FPS game).

Why

After my analysis of Warface in-game protocol, I've decided to write an headless client that will perform various statistical tasks. While developing it, I've found it could be used for other means, such as create solo games, which could be the opportunity for legit players to face new difficulties as the official game doesn't have support for single player.

License

It is mandatory to understand the concept of licensing and free software that yields in the GNU world. Indeed, this program is distributed under the terms of AGPLv3. Please take the time to read and understand the file LICENSE shipped within this repository.

About this program

This is a XMPP client for Warface only, as the latter uses a special overlay protocol to hide the fact that it's using XMPP. It's a headless client because it performs lobby actions without the need of launching a resource-needing game and can be ran on a dedicated server.

This program is shipped fully functionnal but is intended to be customized (such as adding support to Cleverbot, adding stats, or custom commands).

It also features a little console that lets you enter owner-only commands. It can also be used to send XMPP queries (at your own risks !).

How does it work?

This program acts like a normal game client. It's basically a dummy implementation of both Warface overlay protocol, XMPP, and the custom queries used by Warface. XMPP is a standard presence protocol. All the lobby and shop actions are made using custom XMPP queries.

It is composed of two parts, similary to the game:

Important notices

This program lacks of several features that would make it totally undetectable. Here is the TODO list:

How to use

Preparing the accounts

If you wish to use your bots for helping you starting solo games, you need to train them before using this program as they wont be able to join Skilled, Hardcore or survival rooms. Else, skip this section.

Skilled and Hardcore rooms can be unlocked starting from level 4. Thus, you'll need to complete the class tutorials, the initiation and regular maps, and some other PvP games to access this level. It represents 30 minutes of game per account.

Survival rooms are available starting from level 10 (ColdPeak is unlocked at level 25). You'll need to either spend some time in PvP - Storm. This represents 2 days of game per account.

To link your main account with your bot:

  1. Create a bot account
  2. Launch your bot account with warfacebot
  3. Launch your main account with the official game
  4. Send a friend request to your bot account from your main account
  5. The bot should automatically accept the friend invitation request

Optional (for Skilled/Hardcore and Survival):

  1. Launch the bot account with the official game
  2. Complete the tutorials and reach level 4.

Step by step

  1. Clone this repository (if you didn't download it already) :

    $ git clone https://github.com/Levak/warfacebot.git

    Note: For Windows users, you can also download it from binary releases.

  2. Compile the application :

    $ cd warfacebot
    $ make

    Required dependencies (cygwin packages) :

    • Devel/make
    • Devel/gcc-core
    • Net/curl
    • Libs/zlib-devel
    • Net/libssl-devel
    • Libs/libreadline-devel
  3. Run the application by using the provided launcher wb.sh:

    $ ./wb.sh eu
    Email: mybot@trashmail.com
    Password: 
    ...
  4. Repeat the step 3. for every bot you wish to boot up in another terminal.

  5. The bot replies to any follow requests sent from the game to that account. Just ask him to join your room like you would do with any other player.

Whisper commands

You can whisper commands to the bot such as:

Owner-only commands

Additionally, you can enter owner-only commands directly in the terminal, such as:

Console variables

In order to dynamically affect the behavior of the bot without the need of recompiling it (either to configure it while running or on launch), couple CVars have been added.

Config files are single-token-separated files. The token is either a space, an equal sign, or both. Extra tokens after the cvar name are ignored. Below is an example of a valid config file (assuming cvar_name is a valid cvar):

   cvar_name 1
   cvar_name=1
   cvar_name   1
   cvar_name = 1

Note: When using wb.sh <server> to launch warfacebot, the config file ./cfg/server/<server>.cfg is used in order to determine the game version and the server host. If the game version changed, you need to update this file accordingly.

How to use CVars

CVars can be defined in 4 different ways:

Game-related variables

CryOnline-related variables

DBus-related variables

Query-related variables

Warfacebot-related variables