summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-05-12 08:11:35 -0600
committerJared Adams <jaxad0127@gmail.com>2009-05-12 08:12:31 -0600
commit657afb7b642d5b02289c6bb5bc883c2987cdf5d1 (patch)
tree26816e7e3f3acfd521844be85423a8b18d2443c5 /src/net
parentb4d5e2a9c92fe5b0f53c3d08b87c324960c3215c (diff)
downloadmana-657afb7b642d5b02289c6bb5bc883c2987cdf5d1.tar.gz
mana-657afb7b642d5b02289c6bb5bc883c2987cdf5d1.tar.bz2
mana-657afb7b642d5b02289c6bb5bc883c2987cdf5d1.tar.xz
mana-657afb7b642d5b02289c6bb5bc883c2987cdf5d1.zip
Remove methods from LocalPlayer that just call Net
And make a few others like that, and remove them too.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/ea/inventoryhandler.cpp4
-rw-r--r--src/net/ea/playerhandler.cpp2
-rw-r--r--src/net/ea/skillhandler.cpp4
-rw-r--r--src/net/ea/tradehandler.cpp12
-rw-r--r--src/net/tmwserv/inventoryhandler.cpp3
-rw-r--r--src/net/tmwserv/playerhandler.cpp3
-rw-r--r--src/net/tmwserv/tradehandler.cpp2
7 files changed, 24 insertions, 6 deletions
diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp
index 1c48aa6c..30c583b8 100644
--- a/src/net/ea/inventoryhandler.cpp
+++ b/src/net/ea/inventoryhandler.cpp
@@ -27,6 +27,7 @@
#include "net/messageout.h"
#include "configuration.h"
+#include "equipment.h"
#include "inventory.h"
#include "item.h"
#include "itemshortcut.h"
@@ -318,6 +319,9 @@ void InventoryHandler::unequipItem(const Item *item)
MessageOut outMsg(CMSG_PLAYER_UNEQUIP);
outMsg.writeInt16(item->getInvIndex() + INVENTORY_OFFSET);
+
+ // Tidy equipment directly to avoid weapon still shown bug, for instance
+ player_node->mEquipment->removeEquipment(item->getInvIndex());
}
void InventoryHandler::useItem(const Item *item)
diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp
index 3f8fbc09..29f0bac4 100644
--- a/src/net/ea/playerhandler.cpp
+++ b/src/net/ea/playerhandler.cpp
@@ -75,7 +75,7 @@ namespace {
{
void action(const gcn::ActionEvent &event)
{
- player_node->revive();
+ Net::getPlayerHandler()->respawn();
deathNotice = NULL;
buyDialog->setVisible(false);
sellDialog->setVisible(false);
diff --git a/src/net/ea/skillhandler.cpp b/src/net/ea/skillhandler.cpp
index 0239a2c8..69b0fd65 100644
--- a/src/net/ea/skillhandler.cpp
+++ b/src/net/ea/skillhandler.cpp
@@ -26,6 +26,7 @@
#include "net/messagein.h"
#include "net/messageout.h"
+#include "localplayer.h"
#include "log.h"
#include "gui/skill.h"
@@ -216,6 +217,9 @@ void SkillHandler::handleMessage(MessageIn &msg)
void SkillHandler::up(int skillId)
{
+ if (player_node->mSkillPoint <= 0)
+ return;
+
MessageOut outMsg(CMSG_SKILL_LEVELUP_REQUEST);
outMsg.writeInt16(skillId);
}
diff --git a/src/net/ea/tradehandler.cpp b/src/net/ea/tradehandler.cpp
index ee8e6733..74722332 100644
--- a/src/net/ea/tradehandler.cpp
+++ b/src/net/ea/tradehandler.cpp
@@ -23,6 +23,7 @@
#include "net/ea/protocol.h"
+#include "net/inventoryhandler.h"
#include "net/messagein.h"
#include "net/messageout.h"
@@ -48,7 +49,7 @@ namespace {
{
void action(const gcn::ActionEvent &event)
{
- player_node->tradeReply(event.getId() == "yes");
+ Net::getTradeHandler()->respond(event.getId() == "yes");
}
} listener;
}
@@ -91,7 +92,7 @@ void TradeHandler::handleMessage(MessageIn &msg)
{
if (!player_node->tradeRequestOk())
{
- player_node->tradeReply(false);
+ Net::getTradeHandler()->respond(false);
break;
}
@@ -104,7 +105,7 @@ void TradeHandler::handleMessage(MessageIn &msg)
}
else
{
- player_node->tradeReply(false);
+ Net::getTradeHandler()->respond(false);
break;
}
break;
@@ -183,7 +184,7 @@ void TradeHandler::handleMessage(MessageIn &msg)
// Successfully added item
if (item->isEquipment() && item->isEquipped())
{
- player_node->unequipItem(item);
+ Net::getInventoryHandler()->unequipItem(item);
}
tradeWindow->addItem(item->getId(), true, quantity,
item->isEquipment());
@@ -236,6 +237,9 @@ void TradeHandler::request(Being *being)
void TradeHandler::respond(bool accept)
{
+ if (!accept)
+ player_node->setTrading(false);
+
MessageOut outMsg(CMSG_TRADE_RESPONSE);
outMsg.writeInt8(accept ? 3 : 4);
}
diff --git a/src/net/tmwserv/inventoryhandler.cpp b/src/net/tmwserv/inventoryhandler.cpp
index d78c8318..8110fdd2 100644
--- a/src/net/tmwserv/inventoryhandler.cpp
+++ b/src/net/tmwserv/inventoryhandler.cpp
@@ -100,6 +100,9 @@ void InventoryHandler::unequipItem(const Item *item)
MessageOut msg(PGMSG_UNEQUIP);
msg.writeInt8(item->getInvIndex());
Net::GameServer::connection->send(msg);
+
+ // Tidy equipment directly to avoid weapon still shown bug, for instance
+ player_node->mEquipment->setEquipment(item->getInvIndex(), 0);
}
void InventoryHandler::useItem(const Item *item)
diff --git a/src/net/tmwserv/playerhandler.cpp b/src/net/tmwserv/playerhandler.cpp
index c7769ede..b697e8a8 100644
--- a/src/net/tmwserv/playerhandler.cpp
+++ b/src/net/tmwserv/playerhandler.cpp
@@ -29,6 +29,7 @@
#include "net/messagein.h"
#include "net/messageout.h"
+#include "net/net.h"
#include "effectmanager.h"
#include "engine.h"
@@ -81,7 +82,7 @@ namespace {
{
void action(const gcn::ActionEvent &event)
{
- player_node->revive();
+ Net::getPlayerHandler()->respawn();
deathNotice = NULL;
buyDialog->setVisible(false);
sellDialog->setVisible(false);
diff --git a/src/net/tmwserv/tradehandler.cpp b/src/net/tmwserv/tradehandler.cpp
index 4c462a3f..74789a34 100644
--- a/src/net/tmwserv/tradehandler.cpp
+++ b/src/net/tmwserv/tradehandler.cpp
@@ -167,6 +167,8 @@ void TradeHandler::request(Being *being)
void TradeHandler::respond(bool accept)
{
// TODO
+ if (!accept)
+ player_node->setTrading(false);
}
void TradeHandler::addItem(Item *item, int amount)