summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gui/status.cpp12
-rw-r--r--src/localplayer.cpp30
-rw-r--r--src/localplayer.h5
-rw-r--r--src/net/ea/playerhandler.cpp4
-rw-r--r--src/net/ea/playerhandler.h4
-rw-r--r--src/net/playerhandler.h4
-rw-r--r--src/net/tmwserv/gameserver/player.cpp14
-rw-r--r--src/net/tmwserv/gameserver/player.h2
-rw-r--r--src/net/tmwserv/playerhandler.cpp12
-rw-r--r--src/net/tmwserv/playerhandler.h4
10 files changed, 34 insertions, 57 deletions
diff --git a/src/gui/status.cpp b/src/gui/status.cpp
index ea5f63d0..497eef79 100644
--- a/src/gui/status.cpp
+++ b/src/gui/status.cpp
@@ -269,17 +269,17 @@ void StatusWindow::action(const gcn::ActionEvent &event)
if (event.getId().length() == 3)
{
if (event.getId() == "STR")
- Net::getPlayerHandler()->increaseStat(LocalPlayer::STR);
+ Net::getPlayerHandler()->increaseAttribute(LocalPlayer::STR);
if (event.getId() == "AGI")
- Net::getPlayerHandler()->increaseStat(LocalPlayer::AGI);
+ Net::getPlayerHandler()->increaseAttribute(LocalPlayer::AGI);
if (event.getId() == "VIT")
- Net::getPlayerHandler()->increaseStat(LocalPlayer::VIT);
+ Net::getPlayerHandler()->increaseAttribute(LocalPlayer::VIT);
if (event.getId() == "INT")
- Net::getPlayerHandler()->increaseStat(LocalPlayer::INT);
+ Net::getPlayerHandler()->increaseAttribute(LocalPlayer::INT);
if (event.getId() == "DEX")
- Net::getPlayerHandler()->increaseStat(LocalPlayer::DEX);
+ Net::getPlayerHandler()->increaseAttribute(LocalPlayer::DEX);
if (event.getId() == "LUK")
- Net::getPlayerHandler()->increaseStat(LocalPlayer::LUK);
+ Net::getPlayerHandler()->increaseAttribute(LocalPlayer::LUK);
}
}
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 3f1a3904..84fcbe3c 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -55,10 +55,8 @@
#include "effectmanager.h"
#include "guild.h"
-#include "net/tmwserv/gameserver/player.h"
+//#include "net/tmwserv/gameserver/player.h"
#include "net/tmwserv/chatserver/guild.h"
-#else
-#include "net/ea/partyhandler.h"
#endif
#include "resources/animation.h"
@@ -83,7 +81,6 @@ LocalPlayer *player_node = NULL;
#ifdef TMWSERV_SUPPORT
LocalPlayer::LocalPlayer():
Player(65535, 0, NULL),
- mEquipment(new Equipment),
#else
LocalPlayer::LocalPlayer(int id, int job, Map *map):
Player(id, job, map),
@@ -92,26 +89,24 @@ LocalPlayer::LocalPlayer(int id, int job, Map *map):
mJobLevel(0),
mXpForNextLevel(0), mJobXpForNextLevel(0),
mMp(0), mMaxMp(0),
- mSkillPoints(0),
mAttackRange(0),
ATK(0), MATK(0), DEF(0), MDEF(0), HIT(0), FLEE(0),
ATK_BONUS(0), MATK_BONUS(0), DEF_BONUS(0), MDEF_BONUS(0), FLEE_BONUS(0),
- mEquipment(new Equipment),
#endif
+ mEquipment(new Equipment),
mInStorage(false),
#ifdef EATHENA_SUPPORT
mTargetTime(-1),
#endif
mLastTarget(-1),
-#ifdef TMWSERV_SUPPORT
mCharacterPoints(-1),
mCorrectionPoints(-1),
mLevelProgress(0),
-#endif
mLevel(1),
mMoney(0),
mTotalWeight(1), mMaxWeight(1),
mHp(1), mMaxHp(1),
+ mSkillPoints(0),
mTarget(NULL), mPickUpTarget(NULL),
mTrading(false), mGoingToTarget(false), mKeepAttacking(false),
mLastAction(-1),
@@ -566,21 +561,22 @@ void LocalPlayer::setWalkingDir(int dir)
}
}
-#ifdef TMWSERV_SUPPORT
void LocalPlayer::stopWalking(bool sendToServer)
{
if (mAction == WALK && mWalkingDir) {
mWalkingDir = 0;
+#ifdef TMWSERV_SUPPORT
mLocalWalkTime = 0;
+#endif
Being::setDestination(getPosition().x,getPosition().y);
if (sendToServer)
- Net::GameServer::Player::walk(getPosition().x, getPosition().y);
+ Net::getPlayerHandler()->setDestination(getPosition().x,
+ getPosition().y);
setAction(STAND);
}
clearPath();
}
-#endif
void LocalPlayer::toggleSit()
{
@@ -660,13 +656,13 @@ void LocalPlayer::attack()
Net::GameServer::Player::attack(getSpriteDirection());
}
*/
+#endif
+
void LocalPlayer::useSpecial(int special)
{
Net::getSpecialHandler()->use(special);
}
-#endif
-
void LocalPlayer::attack(Being *target, bool keep)
{
#ifdef TMWSERV_SUPPORT
@@ -772,14 +768,12 @@ void LocalPlayer::stopAttack()
mLastTarget = -1;
}
-#ifdef TMWSERV_SUPPORT
-
void LocalPlayer::raiseAttribute(size_t attr)
{
// we assume that the server allows the change. When not we will undo it later.
mCharacterPoints--;
mAttributeBase.at(attr)++;
- Net::GameServer::Player::raiseAttribute(attr + CHAR_ATTR_BEGIN);
+ Net::getPlayerHandler()->increaseAttribute(attr);
}
void LocalPlayer::lowerAttribute(size_t attr)
@@ -788,11 +782,9 @@ void LocalPlayer::lowerAttribute(size_t attr)
mCorrectionPoints--;
mCharacterPoints++;
mAttributeBase.at(attr)--;
- Net::GameServer::Player::lowerAttribute(attr + CHAR_ATTR_BEGIN);
+ Net::getPlayerHandler()->decreaseAttribute(attr);
}
-#endif
-
void LocalPlayer::setAttributeBase(int num, int value)
{
int old = mAttributeBase[num];
diff --git a/src/localplayer.h b/src/localplayer.h
index 7fb43d3a..ea6d76d5 100644
--- a/src/localplayer.h
+++ b/src/localplayer.h
@@ -182,9 +182,8 @@ class LocalPlayer : public Player
*/
void setTrading(bool trading) { mTrading = trading; }
-#ifdef TMWSERV_SUPPORT
void useSpecial(int id);
-#endif
+
void attack(Being *target = NULL, bool keep = false);
/**
@@ -249,7 +248,6 @@ class LocalPlayer : public Player
*/
bool withinAttackRange(Being *target);
-#ifdef TMWSERV_SUPPORT
/**
* Stops the player dead in his tracks
*/
@@ -264,7 +262,6 @@ class LocalPlayer : public Player
* Uses a correction point to lower an attribute
*/
void lowerAttribute(size_t attr);
-#endif
void toggleSit();
void emote(Uint8 emotion);
diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp
index 9eecc445..9b4c56e2 100644
--- a/src/net/ea/playerhandler.cpp
+++ b/src/net/ea/playerhandler.cpp
@@ -431,7 +431,7 @@ void PlayerHandler::emote(int emoteId)
outMsg.writeInt8(emoteId);
}
-void PlayerHandler::increaseStat(LocalPlayer::Attribute attr)
+void PlayerHandler::increaseAttribute(size_t attr)
{
MessageOut outMsg(CMSG_STAT_UPDATE_REQUEST);
@@ -464,7 +464,7 @@ void PlayerHandler::increaseStat(LocalPlayer::Attribute attr)
outMsg.writeInt8(1);
}
-void PlayerHandler::decreaseStat(LocalPlayer::Attribute attr)
+void PlayerHandler::decreaseAttribute(size_t attr)
{
// Supported by eA?
}
diff --git a/src/net/ea/playerhandler.h b/src/net/ea/playerhandler.h
index dcf53f6f..7312dacf 100644
--- a/src/net/ea/playerhandler.h
+++ b/src/net/ea/playerhandler.h
@@ -39,9 +39,9 @@ class PlayerHandler : public MessageHandler, public Net::PlayerHandler
void emote(int emoteId);
- void increaseStat(LocalPlayer::Attribute attr);
+ void increaseAttribute(size_t attr);
- void decreaseStat(LocalPlayer::Attribute attr);
+ void decreaseAttribute(size_t attr);
void increaseSkill(int skillId);
diff --git a/src/net/playerhandler.h b/src/net/playerhandler.h
index 9a185d9c..910424b3 100644
--- a/src/net/playerhandler.h
+++ b/src/net/playerhandler.h
@@ -35,9 +35,9 @@ class PlayerHandler
virtual void emote(int emoteId) = 0;
- virtual void increaseStat(LocalPlayer::Attribute attr) = 0;
+ virtual void increaseAttribute(size_t attr) = 0;
- virtual void decreaseStat(LocalPlayer::Attribute attr) = 0;
+ virtual void decreaseAttribute(size_t attr) = 0;
virtual void increaseSkill(int skillId) = 0;
diff --git a/src/net/tmwserv/gameserver/player.cpp b/src/net/tmwserv/gameserver/player.cpp
index 7935b06d..4e63930b 100644
--- a/src/net/tmwserv/gameserver/player.cpp
+++ b/src/net/tmwserv/gameserver/player.cpp
@@ -50,20 +50,6 @@ void Net::GameServer::Player::moveItem(int oldSlot, int newSlot, int amount)
Net::GameServer::connection->send(msg);
}
-void Net::GameServer::Player::raiseAttribute(int attribute)
-{
- MessageOut msg(PGMSG_RAISE_ATTRIBUTE);
- msg.writeInt8(attribute);
- Net::GameServer::connection->send(msg);
-}
-
-void Net::GameServer::Player::lowerAttribute(int attribute)
-{
- MessageOut msg(PGMSG_LOWER_ATTRIBUTE);
- msg.writeInt8(attribute);
- Net::GameServer::connection->send(msg);
-}
-
void Net::GameServer::Player::respawn()
{
MessageOut msg(PGMSG_RESPAWN);
diff --git a/src/net/tmwserv/gameserver/player.h b/src/net/tmwserv/gameserver/player.h
index 823dcb11..9a202c6e 100644
--- a/src/net/tmwserv/gameserver/player.h
+++ b/src/net/tmwserv/gameserver/player.h
@@ -42,8 +42,6 @@ namespace Net
{
void walk(int x, int y);
void moveItem(int oldSlot, int newSlot, int amount);
- void raiseAttribute(int attribute);
- void lowerAttribute(int attribute);
void respawn();
static RespawnRequestListener respawnListener;
}
diff --git a/src/net/tmwserv/playerhandler.cpp b/src/net/tmwserv/playerhandler.cpp
index fe1b821c..413fbeaf 100644
--- a/src/net/tmwserv/playerhandler.cpp
+++ b/src/net/tmwserv/playerhandler.cpp
@@ -322,14 +322,18 @@ void PlayerHandler::emote(int emoteId)
// TODO
}
-void PlayerHandler::increaseStat(LocalPlayer::Attribute attr)
+void PlayerHandler::increaseAttribute(size_t attr)
{
- // TODO
+ MessageOut msg(PGMSG_RAISE_ATTRIBUTE);
+ msg.writeInt8(attr);
+ Net::GameServer::connection->send(msg);
}
-void PlayerHandler::decreaseStat(LocalPlayer::Attribute attr)
+void PlayerHandler::decreaseAttribute(size_t attr)
{
- // TODO
+ MessageOut msg(PGMSG_LOWER_ATTRIBUTE);
+ msg.writeInt8(attr);
+ Net::GameServer::connection->send(msg);
}
void PlayerHandler::increaseSkill(int skillId)
diff --git a/src/net/tmwserv/playerhandler.h b/src/net/tmwserv/playerhandler.h
index 88844a55..1c94b4e4 100644
--- a/src/net/tmwserv/playerhandler.h
+++ b/src/net/tmwserv/playerhandler.h
@@ -38,9 +38,9 @@ class PlayerHandler : public MessageHandler, public Net::PlayerHandler
void emote(int emoteId);
- void increaseStat(LocalPlayer::Attribute attr);
+ void increaseAttribute(size_t attr);
- void decreaseStat(LocalPlayer::Attribute attr);
+ void decreaseAttribute(size_t attr);
void increaseSkill(int skillId);