#include "player.h"
+#include "pouch.h"
+#include "extern.h"
+#include "flags.h"
#include <stdlib.h>
#include <stdio.h>
memset(name, 0, 255);
memset(password, 0, 255);
- cout << "Got Here" << endl;
-
exp = 1;
gold = 0;
bank = 500;
armor = 1;
weapon = 1;
level = 1;
- alive = 1;
- started = 1; // Possibly deprecated
- forest_fights = 100;
+ forest_fights = forestfights;
player_fights = 3;
fight = NULL;
master = NULL;
battle = NULL;
+ flags = 0;
+ setAlive(this);
+ inventory.reset();
}
Player::Player(aClient *user)
password = new char[256];
if (user)
+ {
setData(user->stats);
+ strcpy(name, user->getNick());
+ }
else
setData(NULL);
armor = right->armor;
weapon = right->weapon;
level = right->level;
- alive = right->alive;
- started = right->started; // Possibly obsoleted
forest_fights = right->forest_fights;
player_fights = right->player_fights;
+ flags = right->flags;
+ inventory.setInventory(&right->inventory);
}
else
{
reset();
int num = rand() % 32767;
- sprintf(name, "Player%d\0", num);
+ sprintf(name, "Player%d", num);
}
cout << "Setting Player data for " << name << endl;
strength = m->strength;
maxhp = m->maxhp;
+ hp = m->hp;
gold = m->gold;
exp = m->exp;
}
+
+long int Player::setFlags(long int newflags)
+{
+ flags = newflags;
+ return getFlags();
+}
+
+long int Player::addFlag(long int flag)
+{
+ flags |= flag;
+ return getFlags();
+}
+
+long int Player::remFlag(long int flag)
+{
+ flags &= ~flag;
+ return getFlags();
+}
+
+Pouch::Pouch(int h, int s, int d)
+{
+ setHealing(h);
+ setStrength(s);
+ setDefense(d);
+}