Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config files restructure #20

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
build/
enet/build/
venv/
env/

# feature server
feature_server/logs/
feature_server/data/
feature_server/config.txt
feature_server/maps/*.txtc
# config/userdata
configs/maps/*.txtc
configs/logs/
configs/data/

# py2exe
py2exe/dist/
Expand Down
10 changes: 2 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,7 @@ python:
- 2.7

install:
- pip install cython
- pip install twisted
- pip install jinja2
- pip install pillow
- pip install pygeoip
- pip install pycrypto
- pip install pyasn1
- pip install -r requirements.txt

script:
- sh build.sh
- sh build.sh
134 changes: 74 additions & 60 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,60 +1,74 @@
![PySnip](http://i.imgur.com/QFgqcRM.png)

[![Build Status](https://travis-ci.org/NateShoffner/PySnip.svg?branch=master)](https://travis-ci.org/NateShoffner/PySnip)

PySnip is an robust, open-source and cross-platform server implementation for [Ace of Spades](http://buildandshoot.com). It is fully customizable with extensions and scripts.

### Features ###

* Many administrator features
* A lot of epic commands
* A remote console (using SSH)
* Map rotation
* Map metadata (name, version, author, and map configuration)
* Map extensions (water damage, etc.)
* A map generator
* An IRC client for managing your server
* A JSON query webserver
* A status server with map overview
* Server/map scripts
* Airstrikes
* Melee attacks with the pickaxe
* New gamemodes (deathmatch / runningman)
* Rollback feature (rolling back to the original map)
* Spectator mode
* Dirt grenades
* Platforms with buttons
* Ban subscribe service
* A ton of other features

### Installing ###
#### For windows ####
Go to [releases](https://github.com/NateShoffner/PySnip/releases) and download desired version.

#### For linux ####
Grab it from repo.
```bash
git clone https://github.com/NateShoffner/PySnip
cd PySnip
```
Create virtualenv
```bash
virtualenv -p python2 venv
source ./venv/bin/activate
```
Install dependencies
```bash
pip install cython twisted jinja2 pillow pygeoip pycrypto pyasn1
```
Compile
```bash
./build.sh
```
Run
```bash
./run_server.sh
```

### Support ###

Feel free to post a question on the [forums](http://buildandshoot.com/viewforum.php?f=19) if you need any help or hop onto [IRC](http://webchat.quakenet.org/?channels=%23buildandshoot) to to chat.
![PySnip](http://i.imgur.com/QFgqcRM.png)

[![Build Status](https://travis-ci.org/NateShoffner/PySnip.svg?branch=master)](https://travis-ci.org/NateShoffner/PySnip)

PySnip is an robust, open-source and cross-platform server implementation for [Ace of Spades](http://buildandshoot.com). It is fully customizable with extensions and scripts.

### Features ###

* Many administrator features
* A lot of epic commands
* A remote console (using SSH)
* Map rotation
* Map metadata (name, version, author, and map configuration)
* Map extensions (water damage, etc.)
* A map generator
* An IRC client for managing your server
* A JSON query webserver
* A status server with map overview
* Server/map scripts
* Airstrikes
* Melee attacks with the pickaxe
* New gamemodes (deathmatch / runningman)
* Rollback feature (rolling back to the original map)
* Spectator mode
* Dirt grenades
* Platforms with buttons
* Ban subscribe service
* A ton of other features

### Installing ###
#### For windows ####
Go to [releases](https://github.com/NateShoffner/PySnip/releases) and download desired version.

#### For linux ####
Grab it from repo.
```bash
git clone https://github.com/NateShoffner/PySnip
cd PySnip
```
Create virtualenv
```bash
virtualenv -p python2 venv
source ./venv/bin/activate
```
Install dependencies
```bash
pip install cython twisted jinja2 pillow pygeoip pycrypto pyasn1
```
Compile
```bash
./build.sh
```
Run
```bash
./run_server.sh
```

### FAQs

#### GeoLiteCity.dat error

If you get the error: `('from' command disabled - missing data/GeoLiteCity.dat)` in the server log, you will need to
download a `GeoLiteCity.dat` file into the data directory in your config directory.

A script is included to automate this - run the following:

```
cd ~/.pysnip/
/path/to/pysnip/feature_server/update_geoip.py
```

### Support ###

Feel free to post a question on the [forums](http://buildandshoot.com/viewforum.php?f=19) if you need any help or hop onto [IRC](http://webchat.quakenet.org/?channels=%23buildandshoot) to chat.
25 changes: 25 additions & 0 deletions configs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Config directory

Structure as follows:

```
.
├── config.json # default config file if no file specified
├── config.json.default # backup config file (same as config.json as supplied)
├── logs # logs directory
│   └── log.txt # default server logfile
├── maps # maps in .txt generate script form or .vxl data
│   ├── classicgen.txt # includes a couple of simple maps - add any maps you want to use here
│   └── ...
└── scripts # contains all scripts and extensions - load by adding name to script list in config
├── __init__.py # don't delete this - needed so python can import scripts for this directory
├── afk.py # huge number of scripts included - see each file for more information, instructions, and attributions
├── aimblock.py # place any other scripts you want to use in this directory
├── aimbot2.py
├── airstrike.py
├── antijerk.py
├── arena.py
├── autohelp.py
└── ...
```

146 changes: 146 additions & 0 deletions configs/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
{
"name" : "PySnip server",
"motd" : [
"Welcome to %(server_name)s",
"Map: %(map_name)s by %(map_author)s",
"Game mode: %(game_mode)s",
"Server powered by PySnip and BuildAndShoot.com"
],
"help" : [
"Server name: %(server_name)s",
"Map: %(map_name)s by %(map_author)s",
"Game mode: %(game_mode)s",
"/STREAK Shows how many kills in a row you got without dying",
"/INTEL Tells you who's got the enemy intel",
"/VOTEKICK Start a vote to temporarily ban a disruptive player",
"/TIME Remaining time until forced map reset"
],
"tips" : [
"You are playing %(game_mode)s on %(server_name)s",
"Type /help for info & commands"
],
"tip_frequency" : 5,
"rules" : [
"Cheating isn't welcome. Griefing is frowned upon. Have fun!"
],
"master" : false,
"max_players" : 32,
"max_connections_per_ip" : 3,
"port" : 32887,
"network_interface" : "",

"game_mode" : "ctf",
"cap_limit" : 10,
"default_time_limit" : 120,
"advance_on_win" : true,
"maps" : ["classicgen", "random"],
"random_rotation" : false,

"respawn_time" : 16,
"respawn_waves" : true,
"friendly_fire" : "on_grief",
"grief_friendly_fire_time" : 5,
"spade_teamkills_on_grief" : false,
"balanced_teams" : 2,
"teamswitch_interval" : 0,

"speedhack_detect" : false,
"votekick_percentage" : 35,
"votekick_ban_duration" : 30,
"votekick_public_votes" : true,
"votemap_public_votes" : true,
"votemap_extension_time" : 15,
"votemap_player_driven" : false,
"votemap_autoschedule" : false,
"votemap_time" : 120,
"votemap_percentage" : 80,

"melee_damage" : 80,
"fall_damage" : true,
"user_blocks_only" : false,
"set_god_build" : false,
"server_prefix" : "",
"time_announcements" : [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 30, 60, 120, 180,
240, 300, 600, 900, 1200, 1800, 2400, 3000],
"login_retries" : 3,
"default_ban_duration" : 1440,

"logfile" : "./logs/log.txt",
"rotate_daily" : true,
"debug_log" : false,
"profile" : false,

"team1" : {
"name" : "Blue",
"color" : [0, 0, 255]
},
"team2" : {
"name" : "Green",
"color" : [0, 255, 0]
},
"passwords" : {
"admin" : ["adminpass1", "adminpass2", "adminpass3"],
"moderator" : ["modpass"],
"guard" : ["guardpass"],
"trusted" : ["trustedpass"]
},
"rights" : {
"moderator" : ["advance", "cancel", "dban", "fog", "from", "goto", "hackinfo", "hban", "invisible", "ip", "kick", "kickafk", "kill", "map", "master", "move", "mute", "resetgame", "switch", "teleport", "teleport_other", "tpsilent", "togglebuild", "togglekill", "togglevotekick", "trust", "undoban", "unmute", "unstick", "where", "whowas"],
"guard" : ["cancel", "fog", "from", "goto", "hackinfo", "hban", "ip", "kick", "kickafk", "kill", "move", "mute", "switch", "teleport", "teleport_other", "togglebuild", "togglekill", "togglevotekick", "trust", "unmute", "unstick", "where", "whowas"]
},
"ssh" : {
"enabled" : false,
"port" : 32887,
"users" : {
"user" : "ssh_pass_change_this"
}
},
"status_server" : {
"enabled" : true,
"port" : 32886,
"logging" : true
},
"ban_publish" : {
"enabled" : false,
"port" : 32885
},
"ban_subscribe" : {
"enabled" : true,
"urls" : [
["http://www.blacklist.spadille.net/subscribe.json", []]
]
},
"irc" : {
"enabled" : false,
"nickname" : "PySnip",
"username" : "PySnip",
"realname" : "PySnip",
"server" : "irc.quakenet.org",
"port" : 6667,
"channel" : "#MyServerChannel",
"password" : "",
"commandprefix" : "!",
"chatprefix" : "."
},
"scripts" : [
"rollback",
"protect",
"map_extensions",
"disco",
"votekick",
"trusted",
"ratio",
"passreload",
"blockinfo",
"bugfix",
"fbpatch",
"afk"
],

"squad_respawn_time" : 32,
"squad_size" : 4,
"auto_squad" : false,
"load_saved_map" : false,
"rollback_on_game_end" : false,
"afk_time_limit" : 30
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion contrib/scripts/README.txt

This file was deleted.

10 changes: 10 additions & 0 deletions feature_server/cfg.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

# to have global configuration variables
# similar to http://effbot.org/pyfaq/how-do-i-share-global-variables-across-modules.htm

import os

config = {}
config_dir = os.path.join(os.path.expanduser("~"), ".pysnip")
config_file = 'config.json'

5 changes: 4 additions & 1 deletion feature_server/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with pyspades. If not, see <http://www.gnu.org/licenses/>.

import os
import math
from random import choice
from pyspades.constants import *
Expand All @@ -24,6 +25,8 @@

from map import check_rotation

import cfg

class InvalidPlayer(Exception):
pass

Expand Down Expand Up @@ -932,7 +935,7 @@ def add(func, name = None):
# optional commands
try:
import pygeoip
database = pygeoip.GeoIP('./data/GeoLiteCity.dat')
database = pygeoip.GeoIP(os.path.join(cfg.config_dir, 'data/GeoLiteCity.dat'))

@name('from')
def where_from(connection, value = None):
Expand Down
Empty file removed feature_server/data/dummy
Empty file.
Loading