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