Skip to content
This repository has been archived by the owner on Jul 11, 2018. It is now read-only.

Commit

Permalink
2.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
alejandroliu committed Dec 5, 2016
1 parent cd90ca5 commit a3d6e36
Show file tree
Hide file tree
Showing 21 changed files with 711 additions and 282 deletions.
65 changes: 53 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<img src="https://raw.githubusercontent.com/alejandroliu/pocketmine-plugins/master/Media/killrate.png" style="width:64px;height:64px" width="64" height="64"/>

<!-- meta:Categories = Informational -->
<!-- meta:PluginAccess = Commands, Databases, Entities -->
<!-- meta:PluginAccess = Commands, Databases, Entities, Tiles -->
<!-- template: gd2/header.md -->

# KillRate

- Summary: Keep track of the number of kills
- PocketMine-MP version: 1.5 (API:1.12.0)
- DependencyPlugins:
- OptionalPlugins: PocketMoney, MassiveEconomy, EconomyAPI, GoldStd
- OptionalPlugins: PocketMoney, MassiveEconomy, EconomyAPI, GoldStd, RankUp
- Categories: Informational
- Plugin Access: Commands, Databases, Entities
- Plugin Access: Commands, Databases, Entities, Tiles
- WebSite: https://github.com/alejandroliu/pocketmine-plugins/tree/master/KillRate

<!-- end-include -->
Expand All @@ -30,13 +30,13 @@ that. You are more likely to get a response and help that way.

_NOTE:_

This documentation was last updated for version **2.0.1**.
This documentation was last updated for version **2.1.1**.

Please go to
[github](https://github.com/alejandroliu/pocketmine-plugins/tree/master/KillRate)
for the most up-to-date documentation.

You can also download this plugin from this [page](https://github.com/alejandroliu/pocketmine-plugins/releases/tag/KillRate-2.0.1).
You can also download this plugin from this [page](https://github.com/alejandroliu/pocketmine-plugins/releases/tag/KillRate-2.1.1).

<!-- end-include -->

Expand Down Expand Up @@ -99,6 +99,30 @@ substitutions:
* {count} - score
* {sname} - only the first 8 characters of the player's name

### RankUp Support

To enable the **ranks** feature, the
[RankUp](http://forums.pocketmine.net/plugins/rankup.830/)
plugin is required. This provides a leveling up functionality. The following
settings are recommended to be configured in RankUp's **config.yml.**

* preferred-economy: null
- This disables the economy support. **KillRate** will be ranking up, so
you don't need to buy ranks.
* ranks: Define your ranks as needed. Also the price for each rank are
interpreted by **KillRate** as the amount of points needed to rank up.

Also, you should remove the permission **rankup.rankup**. This is used for
the command to buy ranks. This is not needed as ranks are awarded by
**KillRate** automatically.

### kill-streak

The kill streak feature is used to track kill-streaks. If you enable you
also need to define the **min-kills** in **settings**. If a player reaches
this many victories in a row without dying he will be in a kill-streak and
an additional bonus money gets awarded.

<!-- php:$h=3; -->
<!-- template: gd2/permissions.md -->

Expand All @@ -108,6 +132,7 @@ substitutions:
* killrate.cmd.stats: Access to stats command
* killrate.cmd.stats.other (op): View other's stats
* killrate.cmd.rank: View top players
* killrate.cmd.give (op): Give points to players
* killrate.signs.place (op): Allow to place KillRate signs
* killrate.signs.use: Allow to use KillRate signs

Expand All @@ -125,19 +150,26 @@ are defined.
* backend: Use SQLiteMgr or MySqlMgr
* MySql: MySQL settings. Only used if backend is MySqlMgr to configure MySql settings

#### features

* signs: enable/disable signs
* ranks: Enable support for RankUp plugin
* achievements: Enable PocketMine achievements
* kill-streak: Enable kill-streak tracking. tracks the number of kills without dying
* rewards: award money. if true, money is awarded. Requires an economy plugin

#### formats

Sign formats used to show sign data.

#### settings

* points: award points. if true points are awarded and tracked.
* rewards: award money. if true, money is awarded. Requires an economy plugin
* min-kills: Minimum number of kills before declaring a kill-streak
* reset-on-death: Reset counters on death. Set to false to disable, otherwise the number of deaths till reset. When the player dies X number of times, scores will reset. (GAME OVER MAN!)
* creative: track creative kills. if true, kills done by players in creative are scored
* dynamic-updates: Update signs. Set to 0 or false to disable, otherwise sign update frequence in ticks
* reset-on-death: Reset counters on death. set to **false** or to a number. When the player dies that number of times, scores will reset. (GAME OVER MAN!)
* kill-streak: Enable kill-streak tracking. "set to **false** or to a number. Will show the kill streak of a player once the number of kills before dying reaches number
* achievements: Enable PocketMine achievements
* default-rank: Default rank (when resetting ranks) set to **false** to disable this feature

#### signs

Expand All @@ -151,7 +183,7 @@ created

Configure awards for the different type of kills. Format:

"entity" => [ money, points ],
"entity": [ money, points ]

The entity ( * ) is the default.

Expand Down Expand Up @@ -225,11 +257,11 @@ shown earlier.
In order to use the script extension you need to do the following:

1. Download the script plugin:
[KillRateEx.php](https://github.com/alejandroliu/pocketmine-plugins/tree/master/KillRate/examples)
[KillRateEx.php](https://github.com/alejandroliu/pocketmine-plugins/tree/master/KillRate/example)
2. Copy the script plugin to your plugin folder.
3. Install [PurePerms](http://forums.pocketmine.net/plugins/pureperms.862/)
4. Read KillRateEx.php on how to configure PurePerms or alternatively download
and use the example [PurePerms-groups.yml](https://github.com/alejandroliu/pocketmine-plugins/tree/master/KillRate/examples)
and use the example [PurePerms-groups.yml](https://github.com/alejandroliu/pocketmine-plugins/tree/master/KillRate/example)
and place it in the PurePerms folder as "groups.yml".
5. Read and modify KillRateEx.php according to taste. The script has plenty
of comments on how things work.
Expand All @@ -251,6 +283,15 @@ In order to use the script extension you need to do the following:

# Changes

* 2.1.1: Bug fixes
* Fixed bug reported by @PolarKing
* 2.1.0: Ranks
* Config file layout changed
* Added more achievements
* Added more events
* Added support for RankUp (Suggested by @rock2rap)
* Code clean-ups
* Thanks to @rock2rap for helping test it
* 2.0.1: Bug fixes
* Removed KillRateEx inclusion
* dump messages.ini if no language defined.
Expand Down
9 changes: 6 additions & 3 deletions plugin.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: KillRate
version: 2.0.1
version: 2.1.1
main: aliuly\killrate\Main
api: 1.12.0
load: POSTWORLD
# You have to have at least one of these...
softdepend: [PocketMoney,MassiveEconomy,EconomyAPI,GoldStd]
softdepend: [PocketMoney,MassiveEconomy,EconomyAPI,GoldStd,RankUp]

description: Keep track of the number of kills
author: aliuly
Expand All @@ -13,7 +13,7 @@ website: https://github.com/alejandroliu/pocketmine-plugins/tree/master/KillRate
commands:
killrate:
description: Show kill rate stats
usage: "/killrate [stats|top]"
usage: "/killrate [stats|top|give]"
aliases: [kr]
permission: killrate.cmd

Expand All @@ -30,6 +30,9 @@ permissions:
killrate.cmd.rank:
default: true
description: "View top players"
killrate.cmd.give:
default: op
description: "Give points to players"
killrate.signs.place:
default: op
description: "Allow to place KillRate signs"
Expand Down
16 changes: 14 additions & 2 deletions resources/messages/messages.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
"! MISSING MONEY API PLUGIN"=""
"%1%-mode"=""
"%1% beat previous streak record of %2% at %3% kills"=""
"%1% ended his kill-streak at %2% kills"=""
"%1% has a %2% kill streak"=""
"%1% died %2% times. RIP!"=""
"%1% died. RIP!"=""
"%1% ended his first kill-streak at %2% kills"=""
"%1% has a %2%-kill streak"=""
"%1% is now %2%!"=""
"%1% not found"=""
"%1% points awarded!"=""
"%1% points deducted!"=""
"* EconomyAPI or"=""
Expand All @@ -14,8 +18,11 @@
". Please install one of the following:"=""
"<nagme>"=""
"Adventure"=""
"Awarding %1% %2% to %3%"=""
"Configuration has been changed"=""
"Creative"=""
"Default rank %1% not found"=""
"GAME OVER!!!"=""
"It is recommended to delete old config.yml"=""
"KillRate sub-commands"=""
"Kills: "=""
Expand All @@ -27,6 +34,7 @@
"On-line Scores"=""
"Placed [KillRate] sign"=""
"Points: "=""
"RankUp plugin not found"=""
"Show player scores"=""
"Show top players"=""
"Spectator"=""
Expand All @@ -36,6 +44,8 @@
"Top Online"=""
"Top Players"=""
"Top Scores"=""
"Unable to award level %1%"=""
"Unable to reset rank for %1%"=""
"Unknown command %1%"=""
"Unknown command. Try /killrate help"=""
"Usage: /killrate %1% %2%"=""
Expand All @@ -48,9 +58,11 @@
"You earn $%1%"=""
"You earn $1"=""
"You earn an additional $%1% for being in kill-streak!"=""
"You have been awarded %1% %2% by %3%"=""
"You were killed by %1%!"=""
"kdratio: "=""
"one point awarded!"=""
"one point deducted!"=""
"ranks feature disabled"=""
"mc.lang"="C"
"mc.version"="2.0.0"
16 changes: 14 additions & 2 deletions resources/messages/spa.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
"! MISSING MONEY API PLUGIN"="! FALTA PLUGIN DE ECONOMIA"
"%1%-mode"="modo-%1%"
"%1% beat previous streak record of %2% at %3% kills"="%1% rompió su record de rachas anterior de %2% con %3% victorias."
"%1% ended his kill-streak at %2% kills"="%1% terminó su racha de victorias con %2%"
"%1% has a %2% kill streak"="%1% tiene una racha de %2% victorias"
"%1% died %2% times. RIP!"="%1% murio %2% veces. Q.E.P.D!!!"
"%1% died. RIP!"="%1% murio. Q.E.P.D!!!"
"%1% ended his first kill-streak at %2% kills"="%1% acabo su racha con %2% victorias"
"%1% has a %2%-kill streak"="%1% tiene una racha de %2% victorias"
"%1% is now %2%!"="%1% es ahora un %2%"
"%1% not found"="%1% no se encuentra"
"%1% points awarded!"="%1% puntos ganados!"
"%1% points deducted!"="%1% puntos perdidos!"
"* EconomyAPI or"="* EconomyAPI ó"
Expand All @@ -14,8 +18,11 @@
". Please install one of the following:"=". Por favor instale uno de estos:"
"<nagme>"="no"
"Adventure"="Aventura"
"Awarding %1% %2% to %3%"="Otorgando %1% %2% a %3%"
"Configuration has been changed"="Configuración ha cambiado"
"Creative"="Creativo"
"Default rank %1% not found"="Nivel basico %1% no se puede encontrar"
"GAME OVER!!!"="JUEGO TERMINADO!!!"
"It is recommended to delete old config.yml"="Se recomienda borrar su config.yml anterior"
"KillRate sub-commands"="Sub-comandos de KillRate"
"Kills: "="Muertos: "
Expand All @@ -27,6 +34,7 @@
"On-line Scores"="Puntajes en-línea"
"Placed [KillRate] sign"="Construyo un cartel de [KillRate]"
"Points: "="Puntos: "
"RankUp plugin not found"="No se encontro plugin RankUp"
"Show player scores"="Mostrar puntajes de jugador"
"Show top players"="Mostrar los mejores jugadores"
"Spectator"="Espectador"
Expand All @@ -36,6 +44,8 @@
"Top Online"="Mejores en-línea"
"Top Players"="Mejores"
"Top Scores"="Mejores Puntajes"
"Unable to award level %1%"="No se puede otorgar nivel %1%"
"Unable to reset rank for %1%"="No se puede re-iniciar el rango de %1%"
"Unknown command %1%"="Comando %1% no es reconozido"
"Unknown command. Try /killrate help"="Comando desconocido, use /killrate help"
"Usage: /killrate %1% %2%"="Uso: /killrate %1% %2%"
Expand All @@ -48,9 +58,11 @@
"You earn $%1%"="Haz ganado %1% EUR"
"You earn $1"="Haz ganado Un EUR"
"You earn an additional $%1% for being in kill-streak!"="Ganaste unos %1%EUR addicionales por tener un racha!"
"You have been awarded %1% %2% by %3%"="Ha sido entregado %1% %2% por %3%"
"You were killed by %1%!"="Fue eliminado por %1%!"
"kdratio: "="efectividad: "
"one point awarded!"="Un punto ganado!"
"one point deducted!"="Un punto perdido!"
"ranks feature disabled"="Modulo de rangos deshabilitado"
"mc.lang"="spa"
"mc.version"="2.0.0"
46 changes: 46 additions & 0 deletions src/aliuly/killrate/AchievementsGiver.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php
namespace aliuly\killrate;

use aliuly\killrate\Main as KillRatePlugin;

use pocketmine\Achievement;
use pocketmine\Player;

class AchievementsGiver {
protected $owner;
protected $enabled;
public function __construct(KillRatePlugin $owner,$mode) {
$this->owner = $owner;
$this->enabled = $mode;
if ($this->enabled) {
Achievement::add("killer","First Blood!",[]);
Achievement::add("serialKiller","Killer Streak!",["killer"]);
Achievement::add("ranked1","Ranked #1!",["killer"]);
Achievement::add("kill10","Achieved 10 Kills!",["killer"]);
Achievement::add("kill100","Achieved 100 Kills!",["kill10"]);
Achievement::add("kill1000","Achieved 1,000 Kills!",["kill100"]);
}
}
public function awardSerialKiller(Player $player) {
if (!$this->enabled) return;
$player->awardAchievement("serialKiller");
}

public function awardKills(Player $player, $vic, $kills) {
if (!$this->enabled || !$kills) return;

$player->awardAchievement("killer");
if ($vic == "Player") {
if ($kills >= 10) $player->awardAchievement("kill10");
if ($kills >= 100) $player->awardAchievement("kill100");
if ($kills >= 1000) $player->awardAchievement("kill1000");
}

$res = $this->owner->getRankings(1);
if ($res !== null && $res[0]["player"] == strtolower($player->getName())) {
// Achieved #1 ranking!
$player->awardAchievement("ranked1");
}
}

}
2 changes: 1 addition & 1 deletion src/aliuly/killrate/DatabaseManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use pocketmine\plugin\PluginBase;

interface DatabaseManager {
public function __construct(PluginBase $owner);
public function __construct(PluginBase $owner,$cfg);
public function getTops($limit,$players,$scores);
public function getScores($player);
public function getScore($player,$type);
Expand Down
Loading

0 comments on commit a3d6e36

Please sign in to comment.