summaryrefslogtreecommitdiff
path: root/src/net/ea
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/ea')
-rw-r--r--src/net/ea/charserverhandler.cpp15
-rw-r--r--src/net/ea/generalhandler.cpp6
-rw-r--r--src/net/ea/maphandler.cpp7
-rw-r--r--src/net/ea/playerhandler.cpp43
-rw-r--r--src/net/ea/protocol.h9
5 files changed, 42 insertions, 38 deletions
diff --git a/src/net/ea/charserverhandler.cpp b/src/net/ea/charserverhandler.cpp
index a09f11f9..d8429d5e 100644
--- a/src/net/ea/charserverhandler.cpp
+++ b/src/net/ea/charserverhandler.cpp
@@ -169,14 +169,13 @@ void CharServerHandler::handleMessage(MessageIn &msg)
LocalPlayer *CharServerHandler::readPlayerData(MessageIn &msg, int &slot)
{
- LocalPlayer *tempPlayer = new LocalPlayer(mLoginData->account_ID, 0, NULL);
+ LocalPlayer *tempPlayer = new LocalPlayer(msg.readInt32(), 0, NULL);
tempPlayer->setGender(mLoginData->sex);
- tempPlayer->mCharId = msg.readInt32();
- tempPlayer->setLevelProgress(msg.readInt32());
+ tempPlayer->setExp(msg.readInt32());
tempPlayer->setMoney(msg.readInt32());
- tempPlayer->mJobXp = msg.readInt32();
- tempPlayer->mJobLevel = msg.readInt32();
+ tempPlayer->setExperience(JOB, msg.readInt32(), 1);
+ tempPlayer->setAttributeBase(JOB, msg.readInt32());
tempPlayer->setSprite(Being::SHOE_SPRITE, msg.readInt16());
tempPlayer->setSprite(Being::GLOVES_SPRITE, msg.readInt16());
tempPlayer->setSprite(Being::CAPE_SPRITE, msg.readInt16());
@@ -187,8 +186,8 @@ LocalPlayer *CharServerHandler::readPlayerData(MessageIn &msg, int &slot)
msg.skip(2); // unknown
tempPlayer->setHp(msg.readInt16());
tempPlayer->setMaxHp(msg.readInt16());
- tempPlayer->mMp = msg.readInt16();
- tempPlayer->mMaxMp = msg.readInt16();
+ tempPlayer->setMP(msg.readInt16());
+ tempPlayer->setMaxMP(msg.readInt16());
msg.readInt16(); // speed
msg.readInt16(); // class
int hairStyle = msg.readInt16();
@@ -272,7 +271,7 @@ void CharServerHandler::newCharacter(const std::string &name, int slot,
void CharServerHandler::deleteCharacter(int slot, LocalPlayer* character)
{
MessageOut outMsg(CMSG_CHAR_DELETE);
- outMsg.writeInt32(character->mCharId);
+ outMsg.writeInt32(character->getId());
outMsg.writeString("a@a.com", 40);
}
diff --git a/src/net/ea/generalhandler.cpp b/src/net/ea/generalhandler.cpp
index bbadd44f..06481824 100644
--- a/src/net/ea/generalhandler.cpp
+++ b/src/net/ea/generalhandler.cpp
@@ -23,7 +23,7 @@
#include "gui/inventorywindow.h"
#include "gui/skilldialog.h"
-#include "gui/status.h"
+#include "gui/statuswindow.h"
#include "net/ea/network.h"
#include "net/ea/protocol.h"
@@ -205,7 +205,7 @@ void GeneralHandler::guiWindowsLoaded()
inventoryWindow->setSplitAllowed(false);
skillDialog->loadSkills("ea-skills.xml");
- /*statusWindow->addAttribute(STR, _("Strength"), true);
+ statusWindow->addAttribute(STR, _("Strength"), true);
statusWindow->addAttribute(AGI, _("Agility"), true);
statusWindow->addAttribute(VIT, _("Vitality"), true);
statusWindow->addAttribute(INT, _("Intelligence"), true);
@@ -217,7 +217,7 @@ void GeneralHandler::guiWindowsLoaded()
statusWindow->addAttribute(MATK, _("M.Attack"), false);
statusWindow->addAttribute(MDEF, _("M.Defense"), false);
statusWindow->addAttribute(HIT, _("% Accuracy"), false);
- statusWindow->addAttribute(FLEE, _("% Evade"), false);*/
+ statusWindow->addAttribute(FLEE, _("% Evade"), false);
}
void GeneralHandler::guiWindowsUnloaded()
diff --git a/src/net/ea/maphandler.cpp b/src/net/ea/maphandler.cpp
index 6f8a9827..a466e022 100644
--- a/src/net/ea/maphandler.cpp
+++ b/src/net/ea/maphandler.cpp
@@ -82,16 +82,21 @@ void MapHandler::handleMessage(MessageIn &msg)
}
}
+#include <fstream>
+
void MapHandler::connect(LoginData *loginData)
{
// Send login infos
MessageOut outMsg(CMSG_MAP_SERVER_CONNECT);
outMsg.writeInt32(loginData->account_ID);
- outMsg.writeInt32(player_node->mCharId);
+ outMsg.writeInt32(player_node->getId());
outMsg.writeInt32(loginData->session_ID1);
outMsg.writeInt32(loginData->session_ID2);
outMsg.writeInt8((loginData->sex == GENDER_MALE) ? 1 : 0);
+ // Change the player's ID to the account ID to match what eAthena uses
+ player_node->setId(loginData->account_ID);
+
// We get 4 useless bytes before the real answer comes in (what are these?)
mNetwork->skip(4);
}
diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp
index c2a1ecf1..60c7e2c1 100644
--- a/src/net/ea/playerhandler.cpp
+++ b/src/net/ea/playerhandler.cpp
@@ -37,6 +37,7 @@
#include "gui/gui.h"
#include "gui/okdialog.h"
#include "gui/sell.h"
+#include "gui/statuswindow.h"
#include "gui/storagewindow.h"
#include "gui/viewport.h"
@@ -229,8 +230,8 @@ void PlayerHandler::handleMessage(MessageIn &msg)
case 0x0004: break; // manner
case 0x0005: player_node->setHp(value); break;
case 0x0006: player_node->setMaxHp(value); break;
- case 0x0007: player_node->mMp = value; break;
- case 0x0008: player_node->mMaxMp = value; break;
+ case 0x0007: player_node->setMP(value); break;
+ case 0x0008: player_node->setMaxMP(value); break;
case 0x0009: player_node->setCharacterPoints(value); break;
case 0x000b: player_node->setLevel(value); break;
case 0x000c: player_node->setSkillPoints(value); break;
@@ -288,7 +289,8 @@ void PlayerHandler::handleMessage(MessageIn &msg)
player_node->setAttributeEffective(CRIT, value); break;
case 0x0035: player_node->mAttackSpeed = value; break;
- case 0x0037: player_node->mJobLevel = value; break;
+ case 0x0037:
+ player_node->setAttributeBase(JOB, value); break;
case 500: player_node->setGMLevel(value); break;
}
@@ -305,10 +307,11 @@ void PlayerHandler::handleMessage(MessageIn &msg)
case SMSG_PLAYER_STAT_UPDATE_2:
switch (msg.readInt16()) {
case 0x0001:
- player_node->setLevelProgress(msg.readInt32());
+ player_node->setExp(msg.readInt32());
break;
case 0x0002:
- player_node->mJobXp = msg.readInt32();
+ player_node->setExperience(JOB, msg.readInt32(),
+ player_node->getExperience(JOB).second);
break;
case 0x0014: {
int curGp = player_node->getMoney();
@@ -320,10 +323,12 @@ void PlayerHandler::handleMessage(MessageIn &msg)
}
break;
case 0x0016:
- player_node->mXpForNextLevel = msg.readInt32();
+ player_node->setExpNeeded(msg.readInt32());
break;
case 0x0017:
- player_node->mJobXpForNextLevel = msg.readInt32();
+ player_node->setExperience(JOB,
+ player_node->getExperience(JOB).first,
+ msg.readInt32());
break;
}
break;
@@ -363,32 +368,32 @@ void PlayerHandler::handleMessage(MessageIn &msg)
int val = msg.readInt8();
player_node->setAttributeEffective(STR, val + ATTR_BONUS(STR));
player_node->setAttributeBase(STR, val);
- player_node->setAttributeBase(STR, msg.readInt8());
+ statusWindow->setPointsNeeded(STR, msg.readInt8());
val = msg.readInt8();
player_node->setAttributeEffective(AGI, val + ATTR_BONUS(AGI));
player_node->setAttributeBase(AGI, val);
- player_node->setAttributeBase(AGI_U, msg.readInt8());
+ statusWindow->setPointsNeeded(AGI, msg.readInt8());
val = msg.readInt8();
player_node->setAttributeEffective(VIT, val + ATTR_BONUS(VIT));
player_node->setAttributeBase(VIT, val);
- player_node->setAttributeBase(VIT_U, msg.readInt8());
+ statusWindow->setPointsNeeded(VIT, msg.readInt8());
val = msg.readInt8();
player_node->setAttributeEffective(INT, val + ATTR_BONUS(INT));
player_node->setAttributeBase(INT, val);
- player_node->setAttributeBase(INT_U, msg.readInt8());
+ statusWindow->setPointsNeeded(INT, msg.readInt8());
val = msg.readInt8();
player_node->setAttributeEffective(DEX, val + ATTR_BONUS(DEX));
player_node->setAttributeBase(DEX, val);
- player_node->setAttributeBase(DEX_U, msg.readInt8());
+ statusWindow->setPointsNeeded(DEX, msg.readInt8());
val = msg.readInt8();
player_node->setAttributeEffective(LUK, val + ATTR_BONUS(LUK));
player_node->setAttributeBase(LUK, val);
- player_node->setAttributeBase(LUK_U, msg.readInt8());
+ statusWindow->setPointsNeeded(LUK, msg.readInt8());
val = msg.readInt16(); // ATK
player_node->setAttributeBase(ATK, val);
@@ -430,22 +435,22 @@ void PlayerHandler::handleMessage(MessageIn &msg)
case SMSG_PLAYER_STAT_UPDATE_6:
switch (msg.readInt16()) {
case 0x0020:
- player_node->setAttributeBase(STR_U, msg.readInt8());
+ statusWindow->setPointsNeeded(STR, msg.readInt8());
break;
case 0x0021:
- player_node->setAttributeBase(AGI_U, msg.readInt8());
+ statusWindow->setPointsNeeded(AGI, msg.readInt8());
break;
case 0x0022:
- player_node->setAttributeBase(VIT_U, msg.readInt8());
+ statusWindow->setPointsNeeded(VIT, msg.readInt8());
break;
case 0x0023:
- player_node->setAttributeBase(INT_U, msg.readInt8());
+ statusWindow->setPointsNeeded(INT, msg.readInt8());
break;
case 0x0024:
- player_node->setAttributeBase(DEX_U, msg.readInt8());
+ statusWindow->setPointsNeeded(DEX, msg.readInt8());
break;
case 0x0025:
- player_node->setAttributeBase(LUK_U, msg.readInt8());
+ statusWindow->setPointsNeeded(LUK, msg.readInt8());
break;
}
break;
diff --git a/src/net/ea/protocol.h b/src/net/ea/protocol.h
index 268c8c67..279e4c2f 100644
--- a/src/net/ea/protocol.h
+++ b/src/net/ea/protocol.h
@@ -23,6 +23,8 @@
#define EA_PROTOCOL_H
enum {
+ JOB = 0xa,
+
STR = 0xd,
AGI,
VIT,
@@ -30,13 +32,6 @@ enum {
DEX,
LUK,
- STR_U,
- AGI_U,
- VIT_U,
- INT_U,
- DEX_U,
- LUK_U,
-
ATK,
DEF,
MATK,