Skip to content

Commit

Permalink
Merge 561404c into bc1189c
Browse files Browse the repository at this point in the history
  • Loading branch information
th3-z committed Oct 13, 2019
2 parents bc1189c + 561404c commit 814356c
Show file tree
Hide file tree
Showing 29 changed files with 1,119 additions and 932 deletions.
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. Windows]
- OS: [e.g. Windows 10]
- KF2-MA version: [e.g. 0.1.3]

**Server (please complete the following information):**
- Mods: [e.g. ControlledDifficulty]
- Web admin resource modifications: [e.g. Perk levels on info page]
- Applied web-admin patches: [e.g. Yes]

**Log**
```
Expand Down
3 changes: 1 addition & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@ Please delete options that are not relevant.

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update

# Checklist:

- [ ] Follows the style guidelines of this project
- [ ] Corresponding changes to the documentation and help texts
- [ ] Generates no new warnings
- [ ] Updated relevant locale files `make i18n-init`
- [ ] Added tests
- [ ] Pytests and linter passes
- [ ] Added relevant labels to the pull request
Expand Down
30 changes: 15 additions & 15 deletions README.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ the `!op` command.
* `!start_jc <command>` - Start a command that runs every time a player joins
- Example: `!start_jc say Welcome %PLR` - Greets a player on join
- Available tokens: `%PLR` - username, `%KLL` - total kills, `%DSH` -
total dosh
total dosh; `%PLR` - username, `%BCK` - "back" if sessions > 1, `%DRK` -
dosh rank, `%KRK` - kill rank, `%TME` - play time, `%TRK` - play time
rank, `%SES` - sessions
* `!stop_jc` - Stops all join commands
* `!start_wc [-w <wave>] <command>` - Start a command that runs on wave `<wave>`
- `-w` Wave to run the command on, can be omitted to have the command
Expand Down Expand Up @@ -169,26 +171,28 @@ the `!op` command.
* `!marquee <marquee_name>` - Runs a marquee in the chat from the
`conf/marquee` folder, _experimental_
- Example: `!marquee example`
* `!enforce_dosh` - Kicks all players that have more dosh than the
`dosh_threshold` configuration option
- Example: `!start_tc 600 enforce_dosh`
* `!update_motd <type>` - Refreshes the welcome screen leaderboard, type is
one of: kills, dosh, or time
- Example: `!start_tc 300 update_motd kills`
* `!reload_motd` - Reloads the server's `*.motd` file from `conf`
* `!enforce_dosh <amount>` - Kicks all players that have more dosh than the specified `amount`
- Example: `!start_tc 600 enforce_dosh 60000`
</details>

### MOTD leaderboard

Writing a `conf/server_name.motd` file containing pairs of `%PLR` and `%SCR`
and enabling the `motd_scoreboard` option will put a live leaderboard in the
motd and update it every 5 minutes.
Create a `conf/server_name.motd` file containing pairs of `%PLR` and `%SCR`.
`%PLR` will be replaced with player names and `%SCR` will be replaced with
their current score. You can now use `!update_motd <type>` to draw the
leaderboard into your welcome screen, `<type>` should be kills, dosh, or time
depending on the desired score metric.

`%SRV_D` and `%SRV_K` will be replaced by the total dosh and kills on the
server respectively.

The `scoreboard_type` configuration option allows you to change the score
metric on the leaderboard. The options for this are: `dosh` or `kills`.

### Scripts

Writing a `server_name.init` in the `conf` folder with a series of commands
Writing a `server_name.init` in the `conf/scripts` folder with a series of commands
will run the commands in sequence when the bot starts on `server_name`.

Additional scripts can be written in the `conf/scripts` folder and ran with the
Expand Down Expand Up @@ -243,10 +247,6 @@ Options can be configured in the config file `conf/magicked_admin.conf`.
* `scoreboard_type`
- Possible values: `kills`, or `dosh`. Change the type of scores that are
displayed in the MOTD scoreboard.
* `dosh_threshold`
- Integer value, configures the `!enforce_dosh` command. The dosh threshold
is the amount of dosh a player can carry before they are kicked by the next
call to `!enforce_dosh`.

Running with Docker
---------------------------
Expand Down
7 changes: 4 additions & 3 deletions admin_patches/admin_patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def run(target=None):
server_path = ask_dir()

if not server_path:
die(_("User cancelled installation"))
die(_("User cancelled installation"), pause=True)
if not test_dir(server_path):
die(_("Killing Floor 2 server not found in path:\n\t{}")
.format(server_path), pause=True)
Expand All @@ -60,17 +60,18 @@ def run(target=None):
die(_("Server file validation failed, possible reasons:"
"\n\t - Game update"
"\n\t - User mods"
"\n\t - Patches already applied"))
"\n\t - Patches already applied"), pause=True)

info(_("Patching files..."))
patches_path = find_data_file(PATCHES_PATH)

if not patch_files(target_path, patches_path):
die(_("Patching failed"))
die(_("Patching failed"), pause=True)
else:
print() # \n
info(_("Patches installed successfully!\n"))


if __name__ == "__main__":
run()
die(pause=True)
53 changes: 22 additions & 31 deletions docs/steam_guide.txt
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ Commands that can be ran by server administrators, and users authorized with the

[*] '[b]!start_jc <command>[/b]' - Start a command that runs every time a player joins
- Example: '[b]!start_jc say Welcome %PLR[/b]' - Greets a player on join
- Available tokens: '[b]%PLR[/b]' - username, '[b]%KLL[/b]' - total kills, '[b]%DSH[/b]' - total dosh
- Available tokens: '[b]%PLR[/b]' - username, '[b]%KLL[/b]' - total kills, '[b]%DSH[/b]' - total dosh, '[b]%BCK[/b]' - "back" if sessions > 1, '[b]%DRK[/b]' - dosh rank, '[b]%KRK[/b]' - kill rank, '[b]%TME[/b]' - play time, '[b]%TRK[/b]' - play time rank, '[b]%SES[/b]' - sessions

[*] '[b]!stop_jc[/b]' - Stops all join commands

Expand Down Expand Up @@ -204,12 +204,17 @@ Commands that can be ran by server administrators, and users authorized with the
[*] '[b]!marquee <marquee_name>[/b]' - Runs a marquee in the chat from the '[b]conf/marquee[/b]' folder, [i]experimental[/i]
- Example: '[b]!marquee example[/b]'

[*] '[b]!enforce_dosh[/b]' - Kicks all players that have more dosh than the 'dosh_threshold' configuration option
- Example: '[b]!start_tc 600 enforce_dosh[/b]'
[*] '[b]!enforce_dosh <amount>[/b]' - Kicks all players that have more dosh than the specified amount.
- Example: '[b]!start_tc 600 enforce_dosh 60000[/b]'

[*] '[b]!update_motd <type>[/b]' - Refreshes the welcome screen leaderboard, type is one of: kills, dosh, or time
- Example: '[b]!start_tc 300 update_motd kills[/b]'

[*] '[b]!reload_motd[/b]' - Reloads the server's '[b]*.motd[/b]' file from '[b]conf[/b]'
[/list]

## Welcome screen leaderboards
Writing a '[b]conf/server_name.motd[/b]' file containing pairs of '[b]%PLR[/b]' and '[b]%SCR[/b]', and enabling the '[b]motd_scoreboard[/b]' option in the config file ('[b]conf/magicked_admin.conf[/b]') will allow you to render live leaderboard on the welcome screen.
Writing a '[b]conf/server_name.motd[/b]' file containing pairs of '[b]%PLR[/b]' and '[b]%SCR[/b]' will allow you to render live leaderboard on the welcome screen.

A simple example could be as follows.
[code]Welcome to our server.
Expand All @@ -224,9 +229,12 @@ Top Players (total kills):
Have fun and good luck!
[/code]

KF2 Magicked Admin will replace '[b]%PLR[/b]' with the player's username, '[b]%SCR[/b]' with the player's total kills or total dosh, '[b]%SRV_K[/b]' with the global server kills, and '[b]%SRV_D[/b]' with the global server dosh.
KF2 Magicked Admin will replace '[b]%PLR[/b]' with the player's username, '[b]%SCR[/b]' with the player's total kills or total dosh, '[b]%SRV_K[/b]' with the global server kills, and '[b]%SRV_D[/b]' with the global server dosh.

Once the file is written, use the '[b]!update_motd <type>[/b]' command to refresh the leaderboard. This should be used in combination with '[b]!start_tc <refresh_interval>[/b]' so that it is refreshed automatically.
- Example: '[b]!start_tc 300 update_motd dosh[/b]'

The metric for '[b]%SCR[/b]' can be either 'kills', or 'dosh'. This is configured with the '[b]scoreboard_type[/b]' option in '[b]conf/magicked_admin.conf[/b]'.
The metric for '[b]%SCR[/b]' can be either 'kills', 'time', or 'dosh'. This is can be set by changing the '[b]<type>[/b]' parameter when using '[b]!update_motd <type>[/b]'

Here is my survival suicidal welcome screen as an example of what can be achieved.

Expand All @@ -235,8 +243,8 @@ Here is my survival suicidal welcome screen as an example of what can be achieve

[h1]Notes[/h1]
[list]
[*] The leaderboard updates every 5 minutes.
[*] This will overwrite your existing motd.
[*] '[b]!reload_motd[/b]' Can be used to reload the template file while KF2 Magicked Admin is still running.
[/list]

## Scripts
Expand All @@ -250,7 +258,7 @@ There are two categories of scripts, they differ in when and how they are execut

[h1]Init scripts[/h1]

Writing a '[b]server_name.init[/b]' in the '[b]conf[/b]' folder with a series of commands will run the commands in sequence when the bot starts on '[b]server_name[/b]'. The server names are defined in '[b]conf/magicked_admin.conf[/b]', if you haven't changed the name it will default to '[b]server_one[/b]'.
Writing a '[b]server_name.init[/b]' in the '[b]conf/scripts[/b]' folder with a series of commands will run the commands in sequence when the bot starts on '[b]server_name[/b]'. The server names are defined in '[b]conf/magicked_admin.conf[/b]', if you haven't changed the name it will default to '[b]server_one[/b]'.

An example init file will have been generated on first launch, this can be used as a template for writing your own init scripts.

Expand All @@ -264,13 +272,14 @@ These scripts are formatted much the same as the init script, the commands will

Some commands are particularly useful when used in scripts, these are: '[b]!start_tc[/b]', '[b]!start_trc[/b]', '[b]!start_wc[/b]', '[b]!start_jc[/b]', '[b]!top_wave_kills[/b]', '[b]!top_wave_dosh[/b]', '[b]!enforce_dosh[/b]', '[b]!say[/b]'.

'[b]conf/server_one.init[/b]' - [i]Show who earned the most dosh each wave when the trader opens[/i]
[code] start_trc top_wave_dosh[/code]
'[b]conf/scripts/server_one.init[/b]' - [i]Show who earned the most dosh each wave when the trader opens, and update the welcome screen leaderboard every 5 minutes[/i]
[code] start_trc top_wave_dosh
start_tc 300 update_motd dosh[/code]

'[b]conf/server_one.init[/b]' - [i]Advertise your Steam group when the boss wave is reached[/i]
'[b]conf/scripts/server_one.init[/b]' - [i]Advertise your Steam group when the boss wave is reached[/i]
[code] start_wc -w -1 say Join our steam group: http://our.steam/group[/code]

'[b]conf/server_one.init[/b]' - [i]Provide basic bot usage guidance to players[/i]
'[b]conf/scripts/server_one.init[/b]' - [i]Provide basic bot usage guidance to players[/i]
[code] start_tc -rt 800 say I'm a bot, type !commands to see available commands[/code]

'[b]conf/scripts/priv_game[/b]' - [i]Setup a private lobby with a single command[/i]
Expand Down Expand Up @@ -302,14 +311,6 @@ The following options can be configured in the config file '[b]conf/magicked_adm
[*] '[b]game_password[/b]' - Default game password to set when the password is toggled using '[b]!password <on|off>[/b]'.
- Example: '[b]game_password=Hunter69[/b]'

[*] '[b]motd_scoreboard[/b]' - Boolean value, enable or disable the motd leaderboard feature. Defaults to disabled.
- Example: '[b]motd_scoreboard=True[/b]'

[*] '[b]scoreboard_type[/b]' - Possible values: '[b]kills[/b]', or '[b]dosh[/b]'. Change the type of scores that are displayed in the motd leaderboard.
- Example: '[b]scoreboard_type=dosh[/b]'

[*] '[b]dosh_threshold[/b]' - Integer value, configures the '[b]!enforce_dosh[/b]' command. The dosh threshold is the amount of dosh a player can carry before they are kicked by the next call to '[b]!enforce_dosh[/b]'. This can be useful on endless servers where it is possible to crash the server by dropping a huge amount of dosh.
- Example: '[b]dosh_threshold=40000[/b]'
[/list]

## Renaming the chatbot (multi-admin)
Expand Down Expand Up @@ -373,22 +374,12 @@ Below is an example.
[code]
[server_one]
game_password = 123
motd_scoreboard = False
scoreboard_type = Kills
max_players = 6
enable_greeter = True
dosh_threshold = 40000
address = http://127.0.0.1:8080
username = Admin
password = root

[server_two]
game_password = Hunter69
motd_scoreboard = True
scoreboard_type = Dosh
max_players = 6
enable_greeter = True
dosh_threshold = 40000
address = http://127.0.0.1:8081
username = Admin
password = 123
Expand All @@ -404,7 +395,7 @@ You first need to open '[b]conf/magicked_admin.conf[/b]' and here you can change
You then need to go back and change '[b]server_one.motd[/b]' and '[b]server_one.init[/b]' to the name you just set it to in '[b]conf/magicked_admin.conf[/b]'.

## Resetting stats
To [b]reset[/b] the scoreboard all you have to do is [b]delete[/b] the '[b]conf/*.sqlite[/b]' file associated with the server name, a new one will be created the next time you start KF2 Magicked Admin.
To reset the scoreboard all you have to do is delete the '[b]conf/*.sqlite[/b]' file associated with the server name, a new one will be created the next time you start KF2 Magicked Admin.

If I wanted to reset the stats on '[b]server_four[/b]', I would delete the '[b]conf/server_four.sqlite[/b]' file and restart KF2 Magicked Admin.

Expand Down
2 changes: 1 addition & 1 deletion locale/admin_patches.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2019-10-07 14:28+0100\n"
"POT-Creation-Date: 2019-10-13 22:59+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down
4 changes: 2 additions & 2 deletions locale/en_GB/admin_patches.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2019-10-07 14:28+0100\n"
"PO-Revision-Date: 2019-10-07 14:28+0100\n"
"POT-Creation-Date: 2019-10-13 22:59+0100\n"
"PO-Revision-Date: 2019-10-13 22:59+0100\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: en_GB\n"
"Language-Team: en_GB <LL@li.org>\n"
Expand Down
Loading

0 comments on commit 814356c

Please sign in to comment.