Giter Club home page Giter Club logo

q2_server_query's Introduction

Q2ServerQuery

Maintainability Dependency Status

I got tired of finding workarounds to query Q2 Servers by using JS libraries or other language implementations, so I created this simple gem.

NOTE: This works ONLY with Quake 2 servers, it's not adapted for other protocols, but it might work with game servers that use the same protocol

Installation

Add this line to your application's Gemfile:

gem 'q2_server_query'

And then execute:

$ bundle

Or install it yourself as:

$ gem install q2_server_query

Usage

client = Q2ServerQuery::Client.new("your.serverhostname.com (or IP)", server_port)
client.status

# Using AQ2 Server as example.
=> {
 "*Q2Admin"=>"2.0~fa34812",
 "_admin"=>"some_admin_name",
 "actionversion"=>"TNG 2.81 2017-08-25 07abb71",
 "allitem"=>"0",
 "allweapon"=>"0",
 "capturelimit"=>"0",
 "cheats"=>"0",
 "ctf"=>"0",
 "deathmatch"=>"1",
 "dmflags"=>"768",
 "fraglimit"=>"0",
 "game"=>"action",
 "gamedate"=>"Feb 21 2018",
 "gamedir"=>"action",
 "gamename"=>"action",
 "hostname"=>"AQ2 Server",
 "items"=>"1",
 "mapname"=>"teamjungle",
 "maptime"=>"0:00",
 "matchmode"=>"0",
 "maxclients"=>"16",
 "needpass"=>"0",
 "port"=>"27910",
 "protocol"=>"34",
 "q2a_mvd"=>"1.6hau",
 "roundlimit"=>"10",
 "roundtimelimit"=>"2",
 "t1"=>"0",
 "t2"=>"0",
 "t3"=>"0",
 "teamplay"=>"1",
 "tgren"=>"1",
 "timelimit"=>"20",
 "use_3teams"=>"0",
 "use_tourney"=>"0",
 "uptime"=>"1+2:24.11",
 "players"=>[
    {"frags"=>"99", "ping"=>"99", "name"=>"some_player"},
    {"frags"=>"99", "ping"=>"99", "name"=>"another_player"}
 ]
}

Development

  1. Fork it.
  2. Do your thang.
  3. Push a PR.
  4. Ping me.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/elfenars/q2_server_query.

License

The gem is available as open source under the terms of the MIT License.

q2_server_query's People

Contributors

rojosinalma avatar

Stargazers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.