]> jfr.im git - irc/gameservirc.git/blobdiff - gameserv/player.h
implemented equipping weapons and armor and saving what is equipped
[irc/gameservirc.git] / gameserv / player.h
index e3cf445691b2a4a7f4afc1611014983b78cc767d..5a8d58678e3229e7af1d0f84a2be99f73619e262 100644 (file)
@@ -1,21 +1,28 @@
 #ifndef PLAYER_H
 #define PLAYER_H
 
-#include "aClient.h"
-#include "pouch.h"
-#include "myString.h"
+#include <string>
+
+using namespace std;
 
 typedef struct monster_ Monster;
 
 class aClient; // forward declaration
 
+class item;    // forward declaration
+class weapon;  // forward declaration
+class armor;   // forward declaration
+class potion;  // forward declaration
+class pouch;   // forward declaration
+
 class Player {
 public:
     Player();
-    Player(aClient *);
     Player(char *);
+    Player(string);
     ~Player();
     void setData(Player *);
+    void setPassword(const char *p);
     void reset();
 
     long int getFlags() { return flags; };          // Returns the Client's current flags
@@ -25,7 +32,13 @@ public:
     long int remFlag(long int);     // Removes a flag from the client's current flags
 
 
-    myString name;             // Player's Name
+    item *getWeapon() { return w; };
+    item *getArmor() { return a; };
+
+    void setWeapon (item &);  // Set a player's weapon to some item
+    void setArmor (item &);   // Set a player's weapon to some item
+
+    string name;               // Player's Name
     int level;                 // Player's level (1-12)
     long int exp;               // Player's experience
     long int gold;              // Gold on hand
@@ -34,12 +47,10 @@ public:
     int maxhp;                  // Maximum Hit Points
     int strength;               // Player's Strength
     int defense;                // Player's defensive strength
-    int armor;                  // Number for the player's armor
-    int weapon;                 // Number for the player's weapon
     int forest_fights;          // Amount of forest fights left today
     int player_fights;          // Amount of player<->player fights for today
-    myString password;         // Player's encrypted password
-    Pouch inventory;           // This contains their potions, etc.
+    string password;           // Player's encrypted password
+    pouch *inventory;          // This contains everything you're holding
     long int lastcommand;      // timestamp for the last command typed
     long int lastlogin;                // timestamp for the last login
 
@@ -50,6 +61,8 @@ public:
 
 private:
     long int flags;            // Player's current flags
+    item *w;                    // Player's weapon
+    item *a;                    // Player's armor
 };
 
 struct monster_ {
@@ -57,14 +70,15 @@ struct monster_ {
     monster_(monster_ *);
     monster_(monster_ &);
     ~monster_();
-    myString name;     // The monster's name
-    myString weapon;   // A name for their weapon
-    int strength;  // Their strength
-    int gold;      // The gold you get when you kill them
-    int exp;       // The experience you get when you kill them
-    int hp;        // Their remaining hitpoints
-    int maxhp;     // Their max hitpoints
-    myString death;    // What is said when they are killed
+    string name;       // The monster's name
+    string weapon;     // A name for their weapon. Doesn't have to be in weapons[]
+    int strength;      // Their strength
+    int gold;          // The gold you get when you kill them
+    int exp;           // The experience you get when you kill them
+    int hp;            // Their remaining hitpoints
+    int maxhp;         // Their max hitpoints
+    int defense;       // Only used seldomly
+    string death;      // What is said when they die
 };
 
 #endif