summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2010-07-17 23:10:05 -0600
committerJared Adams <jaxad0127@gmail.com>2010-07-18 11:45:33 -0600
commit81d8168bb5796ccb1704bcce9f5327c35e55d281 (patch)
tree3e7e111eb956757f49579bb4366c24c94712387d /src/net
parent2ae96bdc5517b2147662f19ff6d700657c0d0d42 (diff)
downloadmana-client-81d8168bb5796ccb1704bcce9f5327c35e55d281.tar.gz
mana-client-81d8168bb5796ccb1704bcce9f5327c35e55d281.tar.bz2
mana-client-81d8168bb5796ccb1704bcce9f5327c35e55d281.tar.xz
mana-client-81d8168bb5796ccb1704bcce9f5327c35e55d281.zip
Move more from LocalPlayer to PlayerInfo
Also cleanup PlayerInfo a bit. Reviewed-by: Chuck Miller
Diffstat (limited to 'src/net')
-rw-r--r--src/net/manaserv/inventoryhandler.cpp10
-rw-r--r--src/net/manaserv/playerhandler.cpp2
-rw-r--r--src/net/manaserv/tradehandler.cpp9
-rw-r--r--src/net/tmwa/buysellhandler.cpp2
-rw-r--r--src/net/tmwa/inventoryhandler.cpp4
-rw-r--r--src/net/tmwa/inventoryhandler.h10
-rw-r--r--src/net/tmwa/tradehandler.cpp15
7 files changed, 27 insertions, 25 deletions
diff --git a/src/net/manaserv/inventoryhandler.cpp b/src/net/manaserv/inventoryhandler.cpp
index bf5682c7..3f8aa8b5 100644
--- a/src/net/manaserv/inventoryhandler.cpp
+++ b/src/net/manaserv/inventoryhandler.cpp
@@ -61,8 +61,8 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
switch (msg.getId())
{
case GPMSG_INVENTORY_FULL:
- player_node->clearInventory();
- player_node->mEquipment->setBackend(&mEquips);
+ PlayerInfo::clearInventory();
+ PlayerInfo::getEquipment()->setBackend(&mEquips);
// no break!
case GPMSG_INVENTORY:
@@ -83,7 +83,7 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
else if (slot >= 32 && slot < 32 + getSize(Inventory::INVENTORY))
{
int amount = id ? msg.readInt8() : 0;
- player_node->setInvItem(slot - 32, id, amount);
+ PlayerInfo::setInventoryItem(slot - 32, id, amount);
}
};
break;
@@ -131,7 +131,7 @@ bool InventoryHandler::canSplit(const Item *item)
void InventoryHandler::splitItem(const Item *item, int amount)
{
- int newIndex = player_node->getInventory()->getFreeSlot();
+ int newIndex = PlayerInfo::getInventory()->getFreeSlot();
if (newIndex > Inventory::NO_SLOT_INDEX)
{
MessageOut msg(PGMSG_MOVE_ITEM);
@@ -150,7 +150,7 @@ void InventoryHandler::moveItem(int oldIndex, int newIndex)
MessageOut msg(PGMSG_MOVE_ITEM);
msg.writeInt8(oldIndex);
msg.writeInt8(newIndex);
- msg.writeInt8(player_node->getInventory()->getItem(oldIndex)
+ msg.writeInt8(PlayerInfo::getInventory()->getItem(oldIndex)
->getQuantity());
gameServerConnection->send(msg);
}
diff --git a/src/net/manaserv/playerhandler.cpp b/src/net/manaserv/playerhandler.cpp
index cef75472..bc03cc25 100644
--- a/src/net/manaserv/playerhandler.cpp
+++ b/src/net/manaserv/playerhandler.cpp
@@ -241,7 +241,7 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg)
int current = msg.readInt32();
int max = msg.readInt32();
int recharge = msg.readInt32();
- player_node->setSpecialStatus(id, current, max, recharge);
+ PlayerInfo::setSpecialStatus(id, current, max, recharge);
}
} break;
/*
diff --git a/src/net/manaserv/tradehandler.cpp b/src/net/manaserv/tradehandler.cpp
index b6169ac9..d5505075 100644
--- a/src/net/manaserv/tradehandler.cpp
+++ b/src/net/manaserv/tradehandler.cpp
@@ -24,6 +24,7 @@
#include "actorspritemanager.h"
#include "item.h"
#include "localplayer.h"
+#include "playerinfo.h"
#include "gui/confirmdialog.h"
#include "gui/trade.h"
@@ -110,7 +111,7 @@ void TradeHandler::handleMessage(Net::MessageIn &msg)
respond(false);
break;
}
- player_node->setTrading(true);
+ PlayerInfo::setTrading(true);
tradePartnerName = being->getName();
tradePartnerID = being->getId();
ConfirmDialog *dlg = new ConfirmDialog(_("Request for Trade"),
@@ -149,14 +150,14 @@ void TradeHandler::handleMessage(Net::MessageIn &msg)
localChatTab->chatLog(_("Trade canceled."), BY_SERVER);
tradeWindow->setVisible(false);
tradeWindow->reset();
- player_node->setTrading(false);
+ PlayerInfo::setTrading(false);
break;
case GPMSG_TRADE_COMPLETE:
localChatTab->chatLog(_("Trade completed."), BY_SERVER);
tradeWindow->setVisible(false);
tradeWindow->reset();
- player_node->setTrading(false);
+ PlayerInfo::setTrading(false);
break;
}
}
@@ -177,7 +178,7 @@ void TradeHandler::respond(bool accept)
gameServerConnection->send(msg);
if (!accept)
- player_node->setTrading(false);
+ PlayerInfo::setTrading(false);
}
void TradeHandler::addItem(Item *item, int amount)
diff --git a/src/net/tmwa/buysellhandler.cpp b/src/net/tmwa/buysellhandler.cpp
index cd12939b..d0c8fd40 100644
--- a/src/net/tmwa/buysellhandler.cpp
+++ b/src/net/tmwa/buysellhandler.cpp
@@ -99,7 +99,7 @@ void BuySellHandler::handleMessage(Net::MessageIn &msg)
int value = msg.readInt32();
msg.readInt32(); // OCvalue
- Item *item = player_node->getInventory()->getItem(index);
+ Item *item = PlayerInfo::getInventory()->getItem(index);
if (item && !(item->isEquipped()))
dialog->addItem(item, value);
diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp
index fd979dc6..41049c3d 100644
--- a/src/net/tmwa/inventoryhandler.cpp
+++ b/src/net/tmwa/inventoryhandler.cpp
@@ -126,7 +126,7 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
int number, flag;
int index, amount, itemId, equipType, arrow;
int identified, cards[4], itemType;
- Inventory *inventory = player_node->getInventory();
+ Inventory *inventory = PlayerInfo::getInventory();
switch (msg.getId())
{
@@ -136,7 +136,7 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
{
// Clear inventory - this will be a complete refresh
mEquips.clear();
- player_node->mEquipment->setBackend(&mEquips);
+ PlayerInfo::getEquipment()->setBackend(&mEquips);
inventory->clear();
}
diff --git a/src/net/tmwa/inventoryhandler.h b/src/net/tmwa/inventoryhandler.h
index 82738afe..8e6e12ca 100644
--- a/src/net/tmwa/inventoryhandler.h
+++ b/src/net/tmwa/inventoryhandler.h
@@ -24,7 +24,7 @@
#include "equipment.h"
#include "inventory.h"
-#include "localplayer.h"
+#include "playerinfo.h"
#include "gui/inventorywindow.h"
@@ -51,7 +51,7 @@ class EquipBackend : public Equipment::Backend {
{
return NULL;
}
- return player_node->getInventory()->getItem(invyIndex);
+ return PlayerInfo::getInventory()->getItem(invyIndex);
}
void clear()
@@ -60,7 +60,7 @@ class EquipBackend : public Equipment::Backend {
{
if (mEquipment[i] != -1)
{
- Item* item = player_node->getInventory()->getItem(i);
+ Item* item = PlayerInfo::getInventory()->getItem(i);
if (item)
{
item->setEquipped(false);
@@ -74,7 +74,7 @@ class EquipBackend : public Equipment::Backend {
void setEquipment(int index, int inventoryIndex)
{
// Unequip existing item
- Item* item = player_node->getInventory()->getItem(mEquipment[index]);
+ Item* item = PlayerInfo::getInventory()->getItem(mEquipment[index]);
if (item)
{
item->setEquipped(false);
@@ -82,7 +82,7 @@ class EquipBackend : public Equipment::Backend {
mEquipment[index] = inventoryIndex;
- item = player_node->getInventory()->getItem(inventoryIndex);
+ item = PlayerInfo::getInventory()->getItem(inventoryIndex);
if (item)
{
item->setEquipped(true);
diff --git a/src/net/tmwa/tradehandler.cpp b/src/net/tmwa/tradehandler.cpp
index 9089f8e6..2c82f1e2 100644
--- a/src/net/tmwa/tradehandler.cpp
+++ b/src/net/tmwa/tradehandler.cpp
@@ -24,6 +24,7 @@
#include "inventory.h"
#include "item.h"
#include "localplayer.h"
+#include "playerinfo.h"
#include "playerrelations.h"
#include "gui/confirmdialog.h"
@@ -96,14 +97,14 @@ void TradeHandler::handleMessage(Net::MessageIn &msg)
if (player_relations.hasPermission(tradePartnerName,
PlayerRelation::TRADE))
{
- if (!player_node->tradeRequestOk() || confirmDlg)
+ if (PlayerInfo::isTrading() || confirmDlg)
{
Net::getTradeHandler()->respond(false);
break;
}
tradePartnerName = tradePartnerNameTemp;
- player_node->setTrading(true);
+ PlayerInfo::setTrading(true);
confirmDlg = new ConfirmDialog(_("Request for Trade"),
strprintf(_("%s wants to trade with you, do you "
"accept?"), tradePartnerName.c_str()));
@@ -147,7 +148,7 @@ void TradeHandler::handleMessage(Net::MessageIn &msg)
// otherwise ignore silently
tradeWindow->setVisible(false);
- player_node->setTrading(false);
+ PlayerInfo::setTrading(false);
break;
default: // Shouldn't happen as well, but to be sure
localChatTab->chatLog(_("Unhandled trade cancel packet."),
@@ -177,7 +178,7 @@ void TradeHandler::handleMessage(Net::MessageIn &msg)
// Trade: New Item add response (was 0x00ea, now 01b1)
{
const int index = msg.readInt16() - INVENTORY_OFFSET;
- Item *item = player_node->getInventory()->getItem(index);
+ Item *item = PlayerInfo::getInventory()->getItem(index);
if (!item)
{
tradeWindow->receivedOk(true);
@@ -224,14 +225,14 @@ void TradeHandler::handleMessage(Net::MessageIn &msg)
localChatTab->chatLog(_("Trade canceled."), BY_SERVER);
tradeWindow->setVisible(false);
tradeWindow->reset();
- player_node->setTrading(false);
+ PlayerInfo::setTrading(false);
break;
case SMSG_TRADE_COMPLETE:
localChatTab->chatLog(_("Trade completed."), BY_SERVER);
tradeWindow->setVisible(false);
tradeWindow->reset();
- player_node->setTrading(false);
+ PlayerInfo::setTrading(false);
break;
}
}
@@ -245,7 +246,7 @@ void TradeHandler::request(Being *being)
void TradeHandler::respond(bool accept)
{
if (!accept)
- player_node->setTrading(false);
+ PlayerInfo::setTrading(false);
MessageOut outMsg(CMSG_TRADE_RESPONSE);
outMsg.writeInt8(accept ? 3 : 4);