]> jfr.im git - irc/gameservirc.git/blame - gameserv/toplist.h
Added code for the start of the DataLayer format as well as a basic FilePlayerDAO...
[irc/gameservirc.git] / gameserv / toplist.h
CommitLineData
e248e6be 1#ifndef TOPLIST_H
2#define TOPLIST_H
3
71a1182a 4#include <list>\r
5#include <string>\r
6#include "player.h"
e248e6be 7
8using namespace std;
9
10// Forward declaration
71a1182a 11class Player;\r
12class aClient;\r
13class Monster;\r
14class item;\r
e248e6be 15
71a1182a 16class PlayerWrapper\r
17{\r
18 public:\r
19 PlayerWrapper();\r
20 PlayerWrapper(Player *pl);\r
21 ~PlayerWrapper();\r
22 \r
23 void setPlayer(Player *pl);\r
24 \r
25 string getName() { return p->getName(); };\r
26 int getLevel() { return p->getLevel(); };\r
27 long int getExp() { return p->getExp(); };\r
28 long int getGold() { return p->getGold(); };\r
29 long int getBank() { return p->getBank(); };\r
30 int getHP() { return p->getHP(); };\r
31 int getMaxHP() { return p->getMaxHP(); };\r
32 int getStrength() { return p->getStrength(); };\r
33 int getDefense() { return p->getDefense(); };\r
34 int getForestFights() { return p->getForestFights(); };\r
35 int getPlayerFights() { return p->getPlayerFights(); };\r
36 string getPassword() { return p->getPassword(); };\r
37\r
38 aClient *getClient() { return p->getClient(); };\r
39 Monster *getMonster() { return p->getMonster(); };\r
40 Monster *getMaster() { return p->getMaster(); };\r
41 aClient *getBattle() { return p->getBattle(); };\r
42\r
43 bool operator < (PlayerWrapper &right);\r
44 \r
45 private:\r
46 Player *p;\r
47};\r
48
49class toplist \r
50{
e248e6be 51public:
52 // Default Constructor
53 toplist();
54
55 // Constructor with a parameter for the count
56 toplist(int);
57
58 // Destructor
59 ~toplist();
60
61 // Insert the player into the top list if they make it
62 void insertPlayer(Player *);
63
64 // Set how many players should be in the toplist
65 void setCount(int);
66 int getCount() { return count; };
67
68 // Sort the list
69 void sort();
70
71 // Prune the list so it's not larger than the count
71a1182a 72 void prune();\r
73 \r
74 void reverse();
e248e6be 75
71a1182a 76 list<PlayerWrapper>::iterator begin();\r
77 list<PlayerWrapper>::iterator end();\r
78 bool empty();
e248e6be 79
80private:
81
82 // The actual list of players
71a1182a 83 list<PlayerWrapper> myList;
e248e6be 84
85 // The number of players to keep in the list
86 int count;
71a1182a 87};\r
88\r
89\r
90
e248e6be 91#endif