]> jfr.im git - irc/gameservirc.git/blame - gameserv/player.h
Fixed the Player class so that the data is all private and encapsulated. Updated...
[irc/gameservirc.git] / gameserv / player.h
CommitLineData
85ce9d3e 1#ifndef PLAYER_H
2#define PLAYER_H
3
5c449fde 4#include <string>
26b17386 5
5c449fde 6using namespace std;
85ce9d3e 7
c8ada07e 8typedef struct monster_ Monster;
9d057db5 9
85ce9d3e 10class aClient; // forward declaration
37ed80a9 11
26b17386 12class item; // forward declaration
13class weapon; // forward declaration
14class armor; // forward declaration
15class potion; // forward declaration
37ed80a9 16class pouch; // forward declaration
85ce9d3e 17
18class Player {
19public:
fbb87959 20 Player();
21 Player(char *);
22 Player(string);
23 ~Player();
24 void setData(Player *);
25
26 void reset();
27
28 long int getFlags() { return flags; }; // Returns the Client's current flags
29 // Functions also return the flags after modifying them
30 long int setFlags(long int); // Sets the clients flags to a new value
31 long int addFlag(long int); // Adds a flag to the client's flags
32 long int remFlag(long int); // Removes a flag from the client's current flags
33
34
35 item *getWeapon() { return w; };
36 item *getArmor() { return a; };
37
38 void setWeapon (item &); // Set a player's weapon to some item
39 void setArmor (item &); // Set a player's weapon to some item
40
41 void clearWeapon () { w = NULL; }; // Remove a weapon
42 void clearArmor () { a = NULL; };
43
44 void setName (string &); // Set the player's name
45 void setName (const char *); // Set the player's name
46 void setLevel(int ); // Set the player's level
47 void setExp(long int); // Set the player's experience
48 void setGold(long int); // Set the player's gold
49 void setBank(long int); // Set the player's bank balance
50 void setHP(int); // Set the player's hit points (health)
51 void setMaxHP(int); // Set the player's maximum hit points
52 void setStrength(int); // Set the player's raw strength
53 void setDefense(int); // Set the player's raw defense
54 void setForestFights(int); // Set the player's forest fight limit
55 void setPlayerFights(int); // Set the player's player vs. player fight limit
56 void setPassword(const char *p); // Set the player's password
57
58 void setClient(aClient *); // Set the pointer back to this player's IRC Client
59 void setMonster(Monster); // Set the pointer to the monster this player is fighting
60 void setMyMaster(Monster *); // Set the pointer to the master this player is fighting
61 void setBattle(aClient *); // Set the pointer to the player this person is fighting
62
63 void addLevel(int); // Add to the player's level
64 void addExp(int); // Add to the player's experience
65 void addGold(int); // Add to the player's gold
66 void addBank(int); // Add to the player's bank account
67 void addHP(int); // Add to the player's hit points
68 void addMaxHP(int); // Add to the player's maximum hit points
69 void addStrength(int); // Add to the player's strength
70 void addDefense(int); // Add to the player's defense
71 void addForestFights(int); // Add to the player's forest fights
72 void addPlayerFights(int); // Add to the player's player vs. player fights
73
74 void subtractLevel(int); // Subtract from a player's level
75 void subtractExp(long int); // Subtract from a player's experience
76 void subtractGold(long int); // Subtract from a player's gold
77 void subtractBank(long int); // Subtract from a player's bank account
78 void subtractHP(int); // Subtract from a player's hit points
79 void subtractMaxHP(int); // Subtract from a player's maximum hit points
80 void subtractStrength(int); // Subtract from a player's strength
81 void subtractDefense(int); // Subtract from a player's defense
82 void subtractForestFights(int); // Subtract from a player's forest fights
83 void subtractPlayerFights(int); // Subtract from a player's player vs. player fights
84 pouch *inventory; // This contains everything you're holding
85
86 string getName() { return name; };
87 int getLevel() { return level; };
88 long int getExp() { return exp; };
89 long int getGold() { return gold; };
90 long int getBank() { return bank; };
91 int getHP() { return hp; };
92 int getMaxHP() { return maxhp; };
93 int getStrength() { return strength; };
94 int getDefense() { return defense; };
95 int getForestFights() { return forest_fights; };
96 int getPlayerFights() { return player_fights; };
97 string getPassword() { return password; };
98
99 aClient *getClient() { return client; };
100 Monster *getMonster() { return fight; };
101 Monster *getMaster() { return master; };
102 aClient *getBattle() { return battle; };
103
104 void delMaster(); // Delete the monster stored in *master
105 void delMonster(); // Delete the monster stored in *fight
106 void delBattle(); // Clear the pointer to the player this person is fighting
107 void healall () { setHP(getMaxHP()); }; // Completely heal this person's hp
108
109 long int lastcommand; // timestamp for the last command typed
110 long int lastlogin; // timestamp for the last login
111
112
1af35752 113private:
fbb87959 114 string name; // Player's Name
115 int level; // Player's level (1-12)
116 long int exp; // Player's experience
117 long int gold; // Gold on hand
118 long int bank; // Gold in the bank
119 int hp; // Current Hit Points (health)
120 int maxhp; // Maximum Hit Points
121 int strength; // Player's Strength
122 int defense; // Player's defensive strength
123 int forest_fights; // Amount of forest fights left today
124 int player_fights; // Amount of player<->player fights for today
125 string password; // Player's encrypted password
126
127 aClient *client; // Pointer to the aClient this player is from
128 Monster *fight; // Pointer to the monster the player is currently fighting
129 Monster *master; // Pointer to the master the player is currently fighting
130 aClient *battle; // Pointer to the player this player is currently fighting
131
132 long int flags; // Player's current flags
133 item *w; // Player's weapon
134 item *a; // Player's armor
85ce9d3e 135};
136
137struct monster_ {
fbb87959 138 monster_();
139 monster_(monster_ *);
140 monster_(monster_ &);
141 ~monster_();
142 string name; // The monster's name
143 string weapon; // A name for their weapon. Doesn't have to be in weapons[]
144 int strength; // Their strength
145 int gold; // The gold you get when you kill them
146 int exp; // The experience you get when you kill them
147 int hp; // Their remaining hitpoints
148 int maxhp; // Their max hitpoints
149 int defense; // Only used seldomly
150 string death; // What is said when they die
85ce9d3e 151};
152
153#endif