Giter Site home page Giter Site logo

th3-z / kf2-magicked-admin Goto Github PK

View Code? Open in Web Editor NEW
31.0 8.0 7.0 1.9 MB

:spider: Mutator-free management, statistics, and in-game bot for ranked Killing Floor 2 servers

Home Page: https://kf2-ma.th3-z.xyz

License: MIT License

Python 98.53% Makefile 0.75% Dockerfile 0.21% Shell 0.21% Lua 0.30%
bot killingfloor2 chatbot statistics player-stats kf2 player-commands

kf2-magicked-admin's Introduction

+       _/      _/        _/_/_/                          
+    _/_/_/_/  _/_/_/          _/              _/_/_/_/   
+     _/      _/    _/    _/_/    _/_/_/_/_/      _/      
+    _/      _/    _/        _/                _/         
+     _/_/  _/    _/  _/_/_/                _/_/_/_/      

kf2-magicked-admin's People

Contributors

d1ceward avatar shompi avatar skylord123 avatar stephen720 avatar th3-z avatar williambrown42 avatar yakonche avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kf2-magicked-admin's Issues

!sid

display player steam ids

Perk thresholds

Get player level from info page when it is enabled. option to boot perks below a certain level.

Documentation

The code is horribly under documented. All functions and classes need detailed comments.

Broken when running mutators.

https://github.com/th3-z/kf-magicked-admin/blob/57d0b39c32b13513bf5f28ab4f52695141d8cb0a/magicked_admin/server/managers/server_mapper.py#L48
https://github.com/th3-z/kf-magicked-admin/blob/57d0b39c32b13513bf5f28ab4f52695141d8cb0a/magicked_admin/server/managers/server_mapper.py#L49

Throws a ValueError: not enough to unpack (expected 2, got 1)

Changed the index from 7 to 8 on line 48 and from 8 to 9 on line 49 and it appears to be working. Looks like the mutator line being empty doesn't show up in the array throwing off the index when it is there.

No controll over Debug-Level when running from source

Hello!

I got a little problem when running the Bot under linux. This is really not that important but I wanted to just report this. Maybe there is already a way. If so please just let me know.

The problem I'm having is, that I have no control over the logging level when running the program directly on a linux client. It's always in DEBUG mode and outputs all Information. I know i could just change the main.py and be done with it but I guess there has to be a way to pass an argument at the start or add an config file.

If i have the time I'll try to add an argument to the config and change main.py so you can control the debug level with the config file. Maybe this will do the job.

Thanks for the help!

Greeter command

A greeter command with the joining player's total logins, time, and rank by dosh. An internal command !p_join {name} is already sent to chatbot on player join, it just needs a handler.

time command

command that displays the user's time logged in, session count, and rank by time spent.

Web-admin Unavailable During Map Changes

Web-admin becomes unavailable to connect to when a new map is loaded, causing Magicked to lose connection to THAT server. Any other active servers in your config will stay connected until they also load a new map.

Greeter doesnt work on first player

There is no in-game chat with only 1 player present, so the greeting goes unnoticed. This could be delayed until another player joins or until the game starts.

Recursive use of cursors

database.save_players() Line 122, called by server.write_all_players(), motd_updater.run()
Two players quit between updating motd and writing players messages. Crashed thread.

!ticket

Allow players to leave a message e.g. !ticket kf-manor is broken

Magicked Ignoring Chat

While having for instance "!start_tc 1 say test" active, Magicked refuses to listen to 90% of messages.
Encountered using self.time_interval of 2

Player rank up triggers

Easiest way to implement this is probably retrieving the top 100 or so dosh/kill scores on initialisation and comparing them to the online player's scores. Only respond to milestones such as: 100,50,25,15,10,5,4,3,2,1.

!restart and !load_map change gamemode to survival

The Commands !restart and !load_map are not respecting the current game mode and always start the map on a survival game.

This is because the game mode is hard-coded within the payload of the function change_map in class server

Dependencies missing in list.

It looks like colorama and termcolor aren't part of the standard library, ran into troubles building until installing those two.

Username collisions

Should be using steam ID as primary key to avoid collisions. Can be read from the players page.

Threads printing concurrently

In certain cases multiple threads are trying to print at the same time, e.g. chat logger and server_mapper death message.

[Linux] Programm not terminating when run in terminal

Hello There!

First of all thank you guys for this awesome bot! I really like it and once you set it up it works like a charm.

But i have one Problem... I can't quit the program.
I'm running it within a Screen Session on my Debian-vServer.
When I terminate the program by pressing Crtl+C

Here is a copy of the terminal-output.

kf2server@vServer:~/magicked_admin$ python3 main.py
INFO: Database for server_one initialised
INFO: Connecting to: 127.0.0.1:22123 (server_one)
INFO: Mapper for server_one initialised
INFO: Server server_one initialised
INFO: Executing script: server_one.init
                start_wc 1 say Hello! I'm ChatBot and here to help you. Type !help so get started :)
                start_tc 180 say Hi! Want to know how you are doing? Typ !me or !help in the chat :)
INFO: Bot on server server_one initialised
INFO: Initialisation complete

ChatBot@server_one: Wave command started.
ChatBot@server_one: Timed command started.
DEBUG: No players
DEBUG: No players
DEBUG: No players
_N0x@server_one: !me
INFO: Writing players
ChatBot@server_one: Stats for _N0x:
Sessions:                       0
Play time:              00:00:00
Deaths:                 0
Kills:                          0
Dosh earned:            0
Dosh spent:             0
Health lost:            0
Dosh this game: 0
Kills this wave:                0
Dosh this wave: 0
_N0x@server_one: !help
ChatBot@server_one: Player commands:
 !me, !dosh, !kills, !server_dosh, !server_kills, !top_dosh, !top_kills, !stats, !info
DEBUG: No players
_N0x@server_one: !info
DEBUG: No players
ChatBot@server_one: I'm a bot for ranked Killing Floor 2 servers. Visit:
github.com/th3-z/kf-magicked-admin/
for information, source code, and credits.
DEBUG: No players
^C
INFO: Terminating...
INFO: Writing players

I took a look at the Python skripts and the last thing that is outputting "INFO: Writing players" is
the method write_all_players in server/server.py

def write_all_players(self, final=False):
   print("INFO: Writing players")
   for player in self.players:
       self.database.save_player(player, final)

because saving player stats works while the program is running i suspect that the error lies within the "final" part in the method save_player in the file database/database.py

        if final:
            now = datetime.datetime.now()
            elapsed_time = now - player.session_start
            seconds = elapsed_time.total_seconds()
            new_time = player.total_time + seconds

            self.cur.execute("UPDATE players SET time_online = ? WHERE username = ?",
                             (new_time, player.username))

But i could not find any thing wrong here. (Still learning pyhton...)

Please let me know if you need any other information!

Thank you

Tim

EDIT:
Just to make sure here are the permissions for the files. It should be no problem to write data to the .sqlite file.

kf2server@vServer:~/magicked_admin$ ls -lsh
insgesamt 92K
4,0K drwxr-xr-x 4 kf2server kf2server 4,0K Apr 10 12:05 chatbot
4,0K drwxr-xr-x 2 kf2server kf2server 4,0K Apr 10 12:03 config
4,0K drwxr-xr-x 3 kf2server kf2server 4,0K Apr 11 11:37 database
 32K -rw-r--r-- 1 kf2server kf2server  32K Apr 10 12:03 icon.ico
4,0K -rw-r--r-- 1 kf2server kf2server  205 Apr 10 12:40 magicked_admin.conf
4,0K -rw-r--r-- 1 kf2server kf2server 2,1K Apr 10 12:46 main.py
4,0K drwxr-xr-x 5 kf2server kf2server 4,0K Apr 10 12:04 server
 20K -rw-r--r-- 1 kf2server kf2server  20K Apr 11 09:26 server_one_db.sqlite
4,0K -rw-r--r-- 1 kf2server kf2server  170 Apr 10 13:32 server_one.init
4,0K -rw-r--r-- 1 kf2server kf2server  224 Apr 10 12:41 server_one.motd
4,0K -rw-r--r-- 1 kf2server kf2server  999 Apr 10 12:03 setup.py
4,0K drwxr-xr-x 3 kf2server kf2server 4,0K Apr 10 12:05 utils

Multi-admin related errors

When multi-admin is disabled the program will print errors, keeping running, but be completely non-functional.
Solution, check state of multi-admin from the login page and respond accordingly.

datatype error in info page

Exception in thread Thread-2:
Traceback (most recent call last):
File "C:\Users\Stephen\AppData\Local\Programs\Python\Python36-32\lib\threading.py", line 916, in _bootstrap_inner
self.run()
File "C:\Users\Stephen\Desktop\kf-magicked-admin\magicked_admin\server\managers\server_mapper.py", line 83, in run
int(new_health), int(new_kills), int(new_dosh), int(new_ping)
ValueError: invalid literal for int() with base 10: 'No'

Lobby players considered dead.

Players that join mid-game and click receive a death.
One solution is to only allow players to die after killing ZEDs, but ZED kill persist when rejoining.

MOTD type option

%SRC in the motd is replaced by top kills. This should be configurable to show time or dosh too. Configuration option would work okay.

Unicode support

Players with pure Unicode names (e.g. Chinese players) of the same length will collide because the characters are replaced with ?s.

Wave number for start_trc

Optional wave number argument for start_trc to run commands when the trader opens on a specific wave.

E.g. !start_trc 2 say wave two trader is open

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.