summaryrefslogtreecommitdiffstats
path: root/sigencore/Player.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sigencore/Player.cpp')
-rw-r--r--sigencore/Player.cpp75
1 files changed, 39 insertions, 36 deletions
diff --git a/sigencore/Player.cpp b/sigencore/Player.cpp
index 2b72657f..85787936 100644
--- a/sigencore/Player.cpp
+++ b/sigencore/Player.cpp
@@ -27,7 +27,10 @@
#include <sigscript/ItemTypeWrapper.h>
#include <sigscript/RulesWrapper.h>
-Sigencore::Player::Player(Sigscript::GameWrapper* game, Sigscript::Config* parent) :
+using namespace Sigscript;
+using namespace Sigencore;
+
+Player::Player(GameWrapper* game, Config* parent) :
Client(game, parent),
m_world(NULL),
m_arena(NULL),
@@ -36,31 +39,31 @@ Sigencore::Player::Player(Sigscript::GameWrapper* game, Sigscript::Config* paren
{
}
-Sigencore::Player::~Player()
+Player::~Player()
{
}
-Sigencore::Overworld* Sigencore::Player::world() const
+Overworld* Player::world() const
{
return m_world;
}
-bool Sigencore::Player::enterWorld(Overworld* world)
+bool Player::enterWorld(Overworld* world)
{
// TODO
}
-void Sigencore::Player::exitWorld()
+void Player::exitWorld()
{
// TODO
}
-Sigencore::Arena* Sigencore::Player::arena() const
+Arena* Player::arena() const
{
return m_arena;
}
-bool Sigencore::Player::enterArena(Arena* arena)
+bool Player::enterArena(Arena* arena)
{
m_active.clear();
for (int i = 0; (m_active.size() < m_game->rules()->maxFight()) && (i < m_team->numMembers()); ++i)
@@ -75,7 +78,7 @@ bool Sigencore::Player::enterArena(Arena* arena)
return (m_active.size() && Client::enterArena(arena));
}
-void Sigencore::Player::exitArena()
+void Player::exitArena()
{
foreach (TeamMember* teamMember, m_active)
teamMember->exitArena();
@@ -83,22 +86,22 @@ void Sigencore::Player::exitArena()
Client::exitArena();
}
-int Sigencore::Player::itemWeightTotal(const bool distinct) const
+int Player::itemWeightTotal(const bool distinct) const
{
- QList<Sigscript::ItemWrapper*> items = m_items.keys();
+ QList<ItemWrapper*> items = m_items.keys();
int weight = 0;
- foreach (Sigscript::ItemWrapper* item, items)
+ foreach (ItemWrapper* item, items)
weight += item->weight() * (distinct ? m_items[item] : 1);
return weight;
}
-int Sigencore::Player::itemWeightType(const int type, const bool distinct) const
+int Player::itemWeightType(const int type, const bool distinct) const
{
if (type < 0)
return itemWeightTotal(distinct);
- QList<Sigscript::ItemWrapper*> items = m_items.keys();
+ QList<ItemWrapper*> items = m_items.keys();
int weight = 0;
- foreach (Sigscript::ItemWrapper* item, items)
+ foreach (ItemWrapper* item, items)
{
if (item->type()->id() == type)
weight += item->weight() * (distinct ? m_items[item] : 1);
@@ -106,33 +109,33 @@ int Sigencore::Player::itemWeightType(const int type, const bool distinct) const
return weight;
}
-int Sigencore::Player::itemWeight(const int item, const bool distinct) const
+int Player::itemWeight(const int item, const bool distinct) const
{
if (item < 0)
return itemWeightTotal(distinct);
- Sigscript::ItemWrapper* itemd = m_game->item(item);
+ ItemWrapper* itemd = m_game->item(item);
int weight = 0;
if (itemd && m_items.contains(itemd))
weight += itemd->weight() * (distinct ? m_items[itemd] : 1);
return weight;
}
-int Sigencore::Player::itemCountTotal(const bool distinct) const
+int Player::itemCountTotal(const bool distinct) const
{
- QList<Sigscript::ItemWrapper*> items = m_items.keys();
+ QList<ItemWrapper*> items = m_items.keys();
int count = 0;
- foreach (Sigscript::ItemWrapper* item, items)
+ foreach (ItemWrapper* item, items)
count += (distinct ? m_items[item] : 1);
return count;
}
-int Sigencore::Player::itemCountType(const int type, const bool distinct) const
+int Player::itemCountType(const int type, const bool distinct) const
{
if (type < 0)
return itemCountTotal(distinct);
- QList<Sigscript::ItemWrapper*> items = m_items.keys();
+ QList<ItemWrapper*> items = m_items.keys();
int count = 0;
- foreach (Sigscript::ItemWrapper* item, items)
+ foreach (ItemWrapper* item, items)
{
if (item->type()->id() == type)
count += (distinct ? m_items[item] : 1);
@@ -140,24 +143,24 @@ int Sigencore::Player::itemCountType(const int type, const bool distinct) const
return count;
}
-int Sigencore::Player::itemCount(const int item, const bool distinct) const
+int Player::itemCount(const int item, const bool distinct) const
{
if (item < 0)
return itemCountTotal(distinct);
- Sigscript::ItemWrapper* itemd = m_game->item(item);
+ ItemWrapper* itemd = m_game->item(item);
int count = 0;
if (itemd && m_items.contains(itemd))
count += (distinct ? m_items[itemd] : 1);
return count;
}
-QMap<Sigscript::ItemWrapper*, int> Sigencore::Player::items(const int type) const
+QMap<ItemWrapper*, int> Player::items(const int type) const
{
if (type < 0)
return m_items;
- QMap<Sigscript::ItemWrapper*, int> itemMap = m_items;
- QList<Sigscript::ItemWrapper*> items = itemMap.keys();
- foreach (Sigscript::ItemWrapper* item, items)
+ QMap<ItemWrapper*, int> itemMap = m_items;
+ QList<ItemWrapper*> items = itemMap.keys();
+ foreach (ItemWrapper* item, items)
{
if (item->id() != type)
itemMap.remove(item);
@@ -165,7 +168,7 @@ QMap<Sigscript::ItemWrapper*, int> Sigencore::Player::items(const int type) cons
return itemMap;
}
-int Sigencore::Player::giveItems(Sigscript::ItemWrapper* item, const int count, const bool allOrNothing)
+int Player::giveItems(ItemWrapper* item, const int count, const bool allOrNothing)
{
const int id = item->id();
const QString name = item->name();
@@ -243,7 +246,7 @@ int Sigencore::Player::giveItems(Sigscript::ItemWrapper* item, const int count,
return count - end;
}
-bool Sigencore::Player::giveMoney(const int amount, const bool allOrNothing)
+bool Player::giveMoney(const int amount, const bool allOrNothing)
{
int playerMin = 0;
int playerMax = m_game->rules()->maxMoney();
@@ -259,22 +262,22 @@ bool Sigencore::Player::giveMoney(const int amount, const bool allOrNothing)
return qAbs(newUnbounded - newAmount);
}
-Sigencore::Team* Sigencore::Player::team() const
+Team* Player::team() const
{
return m_team;
}
-Sigencore::TeamMember* Sigencore::Player::findMember(const QUuid& id) const
+TeamMember* Player::findMember(const QUuid& id) const
{
return m_team->findTeamMember(id);
}
-QList<Sigencore::TeamMember*> Sigencore::Player::active() const
+QList<TeamMember*> Player::active() const
{
return m_active;
}
-void Sigencore::Player::switchOut(TeamMember* oldActive, TeamMember* newActive)
+void Player::switchOut(TeamMember* oldActive, TeamMember* newActive)
{
oldActive->exitArena();
newActive->makeActive(m_arena);
@@ -282,12 +285,12 @@ void Sigencore::Player::switchOut(TeamMember* oldActive, TeamMember* newActive)
m_active.append(newActive);
}
-bool Sigencore::Player::isKnockedOut() const
+bool Player::isKnockedOut() const
{
return m_team->isKnockedOut();
}
-int Sigencore::Player::money() const
+int Player::money() const
{
return m_money;
}