#include <lamoule.h>

Public Member Functions | |
| Lamoule (BotKernel *) | |
| Constructor. | |
| vector< string > | getTopShot () |
| Get the lamoule's topshot. | |
| void | setTopShot (string, string, string) |
| Set the lamoule's topshot. | |
| void | addPlayer (string, unsigned int) |
| Add a player in the ladder. | |
| char | increaseScore (string, int, unsigned int, bool) |
| Increase score for a player. | |
| vector< TiXmlElement * > | sort (sort_criterion, int) |
| Sort elements to get stats. | |
| vector< string > | get5first (sort_criterion, int) |
| Get 5 first. | |
| vector< string > | getInfosPlayer (string, int) |
| Get informations about a player. | |
| bool | deletePlayer (string) |
| Remove a player from the ladder. | |
| void | purifyFile (int) |
| Purify File. | |
| bool | setNextScore (int) |
| Set next score. | |
| int | generateScore () |
| generate score | |
Private Member Functions | |
| void | initFile () |
| Initialize the XML file. | |
Private Attributes | |
| TiXmlDocument * | doc |
| Represent the xml document. | |
| TiXmlNode * | root |
| Represent documents's root. | |
| unsigned int | nextScore |
| Stores the next score. | |
| int | MAX_SCORE |
| Maximul score. | |
| int | FIRST_FLOOR |
| First floor. | |
| int | SECOND_FLOOR |
| Second floor. | |
Manage lamoule's ladder. Score are stored in an XML file
Definition at line 57 of file lamoule.h.
| Lamoule::Lamoule | ( | BotKernel * | b | ) |
Constructor.
Constructor
Definition at line 34 of file lamoule.cpp.
References Plugin::addRequirement(), Plugin::author, Plugin::bindFunction(), Plugin::description, doc, FIRST_FLOOR, BotKernel::getDatasDir(), IN_COMMAND_HANDLER, IN_LOOP, initFile(), MAX_SCORE, Plugin::name, nextScore, root, SECOND_FLOOR, and Plugin::version.
| void Lamoule::addPlayer | ( | string | nick, | |
| unsigned int | initialScore | |||
| ) |
Add a player in the ladder.
Add a player in the ladder
| nick | Nick to add | |
| initialScore | Initial player's score |
Definition at line 125 of file lamoule.cpp.
References doc, Tools::intToStr(), and root.
Referenced by increaseScore().
| bool Lamoule::deletePlayer | ( | string | nick | ) |
Remove a player from the ladder.
Delete a player from the ladder
| nick | Nick to delete |
Definition at line 330 of file lamoule.cpp.
References doc, root, and Tools::to_lower().
Referenced by deleteplayer().
| int Lamoule::generateScore | ( | ) |
generate score
Generate a random score. If "nextscore" is set, then it's returned
Definition at line 143 of file lamoule.cpp.
References FIRST_FLOOR, MAX_SCORE, nextScore, Tools::random(), and SECOND_FLOOR.
Referenced by lamoule().
| vector< string > Lamoule::get5first | ( | sort_criterion | criterion, | |
| int | min_attempts | |||
| ) |
Get 5 first.
Get top 5 depending on score or average
| criterion | Sort criterion | |
| min_attempts | Minimal attempts number to appear in ladder |
Definition at line 262 of file lamoule.cpp.
References Tools::doubleToStr(), Tools::intToStr(), sort(), and Tools::strToDouble().
Referenced by top5(), and toptotal().
| vector< string > Lamoule::getInfosPlayer | ( | string | nick, | |
| int | min_attempts | |||
| ) |
Get informations about a player.
Get informations about a player
| nick | Player's nick | |
| min_attempts | Minimal attempts number to have a rank |
Definition at line 292 of file lamoule.cpp.
References AVERAGE, Tools::doubleToStr(), Tools::intToStr(), root, sort(), Tools::strToDouble(), and Tools::to_lower().
Referenced by player().
| vector< string > Lamoule::getTopShot | ( | ) |
Get the lamoule's topshot.
Get the lamoule's topshot
Definition at line 89 of file lamoule.cpp.
References doc.
Referenced by increaseScore(), and topshot().
| char Lamoule::increaseScore | ( | string | nick, | |
| int | score, | |||
| unsigned int | diffAttempts, | |||
| bool | checkTop | |||
| ) |
Increase score for a player.
Increase score for a player
| nick | Player's nick | |
| score | Player's score | |
| diffAttempts | Time between two attempts | |
| checkTop | Tell if topshot must be checked |
Definition at line 172 of file lamoule.cpp.
References addPlayer(), doc, getTopShot(), Tools::intToStr(), root, setTopShot(), Tools::strToDouble(), Tools::strToInt(), and Tools::to_lower().
Referenced by increase(), and lamoule().
| void Lamoule::initFile | ( | ) | [private] |
Initialize the XML file.
Initilaize the XML file by creating root and first childs
Definition at line 68 of file lamoule.cpp.
Referenced by Lamoule().
| void Lamoule::purifyFile | ( | int | reset_time | ) |
Purify File.
Purify the XML file by deleting player who didn't play since a while
| reset_time | Time (in seconds) after witch one a player is deleted |
Definition at line 346 of file lamoule.cpp.
References doc, root, and Tools::strToInt().
Referenced by purifyFile().
| bool Lamoule::setNextScore | ( | int | score | ) |
Set next score.
Set next score
| score | Next score |
Definition at line 362 of file lamoule.cpp.
References MAX_SCORE, and nextScore.
Referenced by nextscore().
| void Lamoule::setTopShot | ( | string | nick, | |
| string | score, | |||
| string | date | |||
| ) |
Set the lamoule's topshot.
Set the lamoule's topshot
| nick | Topshoter's nick | |
| score | Topshot's score | |
| date | Topshot's date |
Definition at line 108 of file lamoule.cpp.
References doc.
Referenced by increaseScore().
| vector< TiXmlElement * > Lamoule::sort | ( | sort_criterion | criterion, | |
| int | min_attempts | |||
| ) |
Sort elements to get stats.
Sort a vector elements depending on scores or average
| criterion | Sort criterion | |
| min_attempts | Minimum attempts to be sorted |
Definition at line 213 of file lamoule.cpp.
References AVERAGE, root, Tools::strToDouble(), Tools::strToInt(), and TOTAL.
Referenced by get5first(), and getInfosPlayer().
TiXmlDocument* Lamoule::doc [private] |
Represent the xml document.
Definition at line 61 of file lamoule.h.
Referenced by addPlayer(), deletePlayer(), getTopShot(), increaseScore(), initFile(), Lamoule(), purifyFile(), and setTopShot().
int Lamoule::FIRST_FLOOR [private] |
int Lamoule::MAX_SCORE [private] |
Maximul score.
Definition at line 69 of file lamoule.h.
Referenced by generateScore(), Lamoule(), and setNextScore().
unsigned int Lamoule::nextScore [private] |
Stores the next score.
Definition at line 67 of file lamoule.h.
Referenced by generateScore(), Lamoule(), and setNextScore().
TiXmlNode* Lamoule::root [private] |
Represent documents's root.
Definition at line 63 of file lamoule.h.
Referenced by addPlayer(), deletePlayer(), getInfosPlayer(), increaseScore(), initFile(), Lamoule(), purifyFile(), and sort().
int Lamoule::SECOND_FLOOR [private] |
Second floor.
Definition at line 73 of file lamoule.h.
Referenced by generateScore(), and Lamoule().
1.5.8