]>
Commit | Line | Data |
---|---|---|
1 | #ifndef PLAYER_H | |
2 | #define PLAYER_H | |
3 | ||
4 | #include <string> | |
5 | ||
6 | using namespace std; | |
7 | ||
8 | class aClient; // forward declaration | |
9 | class Monster; // forward declaration | |
10 | ||
11 | class item; // forward declaration | |
12 | class weapon; // forward declaration | |
13 | class armor; // forward declaration | |
14 | class potion; // forward declaration | |
15 | class pouch; // forward declaration | |
16 | ||
17 | class Player { | |
18 | public: | |
19 | Player(); | |
20 | Player(char *); | |
21 | Player(string); | |
22 | ~Player(); | |
23 | void setData(Player *); | |
24 | ||
25 | void reset(); | |
26 | ||
27 | long int getFlags() { return flags; }; // Returns the Client's current flags | |
28 | // Functions also return the flags after modifying them | |
29 | long int setFlags(long int); // Sets the clients flags to a new value | |
30 | long int addFlag(long int); // Adds a flag to the client's flags | |
31 | long int remFlag(long int); // Removes a flag from the client's current flags | |
32 | ||
33 | ||
34 | item *getWeapon() { return w; }; | |
35 | item *getArmor() { return a; }; | |
36 | ||
37 | void setWeapon (item &); // Set a player's weapon to some item | |
38 | void setArmor (item &); // Set a player's weapon to some item | |
39 | ||
40 | void clearWeapon () { w = NULL; }; // Remove a weapon | |
41 | void clearArmor () { a = NULL; }; | |
42 | ||
43 | void setName (string &); // Set the player's name | |
44 | void setName (const char *); // Set the player's name | |
45 | void setLevel(int ); // Set the player's level | |
46 | void setExp(long int); // Set the player's experience | |
47 | void setGold(long int); // Set the player's gold | |
48 | void setBank(long int); // Set the player's bank balance | |
49 | void setHP(int); // Set the player's hit points (health) | |
50 | void setMaxHP(int); // Set the player's maximum hit points | |
51 | void setStrength(int); // Set the player's raw strength | |
52 | void setDefense(int); // Set the player's raw defense | |
53 | void setForestFights(int); // Set the player's forest fight limit | |
54 | void setPlayerFights(int); // Set the player's player vs. player fight limit | |
55 | void setPassword(const char *p); // Set the player's password while encrypting it | |
56 | void setRawPassword(const char *p); //Set the player's password without encrypting it | |
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 | ||
113 | private: | |
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 | |
135 | }; | |
136 | ||
137 | class Monster { | |
138 | public: | |
139 | Monster(); | |
140 | Monster(Monster *); | |
141 | Monster(Monster &); | |
142 | ~Monster(); | |
143 | string name; // The monster's name | |
144 | string weapon; // A name for their weapon. Doesn't have to be in weapons[] | |
145 | int strength; // Their strength | |
146 | int gold; // The gold you get when you kill them | |
147 | int exp; // The experience you get when you kill them | |
148 | int hp; // Their remaining hitpoints | |
149 | int maxhp; // Their max hitpoints | |
150 | int defense; // Only used seldomly | |
151 | string death; // What is said when they die | |
152 | }; | |
153 | ||
154 | #endif |