summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2006-12-11 15:47:35 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2006-12-11 15:47:35 +0000
commit8da32105732949b4b0273c718d118bcfae70a1c9 (patch)
tree0a354974d48268cfaafcdb1e06b498fa26a59c1e /src/net
parentf9ce4e302cb3ed203d89a7a18e10b7ad4f11519c (diff)
downloadmana-client-8da32105732949b4b0273c718d118bcfae70a1c9.tar.gz
mana-client-8da32105732949b4b0273c718d118bcfae70a1c9.tar.bz2
mana-client-8da32105732949b4b0273c718d118bcfae70a1c9.tar.xz
mana-client-8da32105732949b4b0273c718d118bcfae70a1c9.zip
Merged 0.0 changes from revision 2825 to 2898 to trunk.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/beinghandler.cpp83
-rw-r--r--src/net/inventoryhandler.cpp2
-rw-r--r--src/net/npchandler.cpp10
-rw-r--r--src/net/playerhandler.cpp18
-rw-r--r--src/net/skillhandler.cpp4
5 files changed, 62 insertions, 55 deletions
diff --git a/src/net/beinghandler.cpp b/src/net/beinghandler.cpp
index 2d68dd28..6d8ff6c6 100644
--- a/src/net/beinghandler.cpp
+++ b/src/net/beinghandler.cpp
@@ -66,6 +66,7 @@ void BeingHandler::handleMessage(MessageIn &msg)
/*
Uint32 id;
Uint16 job, speed;
+ Uint16 headBottom, headTop, headMid;
Sint16 param1;
Sint8 type;
Being *srcBeing, *dstBeing;
@@ -124,7 +125,8 @@ void BeingHandler::handleMessage(MessageIn &msg)
dstBeing->mJob = job;
dstBeing->setHairStyle(msg.readShort());
dstBeing->setWeapon(msg.readShort());
- dstBeing->setVisibleEquipment(3, msg.readShort()); // head bottom
+ dstBeing->setVisibleEquipment(
+ Being::BOTTOMCLOTHES_SPRITE, msg.readShort());
if (msg.getId() == SMSG_BEING_MOVE)
{
@@ -132,8 +134,9 @@ void BeingHandler::handleMessage(MessageIn &msg)
}
msg.readShort(); // shield
- dstBeing->setVisibleEquipment(4, msg.readShort()); // head top
- dstBeing->setVisibleEquipment(5, msg.readShort()); // head mid
+ dstBeing->setVisibleEquipment(Being::HAIT_SPRITE, msg.readShort());
+ dstBeing->setVisibleEquipment(
+ Being::TOPCLOTHES_SPRITE, msg.readShort());
dstBeing->setHairColor(msg.readShort());
msg.readShort(); // unknown
msg.readShort(); // head dir
@@ -156,7 +159,9 @@ void BeingHandler::handleMessage(MessageIn &msg)
}
else
{
- //msg.readCoordinates(dstBeing->mX, dstBeing->mY, dstBeing->mDirection);
+ //Uint8 dir;
+ //msg->readCoordinates(dstBeing->mX, dstBeing->mY, dir);
+ //dstBeing->setDirection(dir);
}
msg.readByte(); // unknown
@@ -173,19 +178,7 @@ void BeingHandler::handleMessage(MessageIn &msg)
if (msg.readByte() == 1)
{
- // Death
- switch (dstBeing->getType())
- {
- case Being::MONSTER:
- dstBeing->setAction(Being::MONSTER_DEAD);
- dstBeing->mFrame = 0;
- dstBeing->mWalkTime = tick_time;
- break;
-
- default:
- dstBeing->setAction(Being::DEAD);
- break;
- }
+ dstBeing->setAction(Being::DEAD);
}
else
{
@@ -219,15 +212,7 @@ void BeingHandler::handleMessage(MessageIn &msg)
if (srcBeing != NULL &&
srcBeing != player_node)
{
- // buggy
- if (srcBeing->getType() == Being::MONSTER)
- {
- srcBeing->setAction(Being::MONSTER_ATTACK);
- }
- else
- {
- srcBeing->setAction(Being::ATTACK);
- }
+ srcBeing->setAction(Being::ATTACK);
srcBeing->mFrame = 0;
srcBeing->mWalkTime = tick_time;
}
@@ -275,27 +260,35 @@ void BeingHandler::handleMessage(MessageIn &msg)
}
int type = msg.readByte();
+ int id = msg.readByte();
switch (type) {
case 1:
- dstBeing->setHairStyle(msg.readByte());
+ dstBeing->setHairStyle(id);
break;
case 2:
- dstBeing->setWeapon(msg.readByte());
+ dstBeing->setWeapon(id);
+ break;
+ case 3: // Change lower headgear for eAthena, pants for us
+ dstBeing->setVisibleEquipment(
+ Being::BOTTOMCLOTHES_SPRITE,
+ id);
+ break;
+ case 4: // Change upper headgear for eAthena, hat for us
+ dstBeing->setVisibleEquipment(
+ Being::HAT_SPRITE,
+ id);
break;
- case 3:
- case 4:
- case 5:
- // Equip/unequip head 3. Bottom 4. Top 5. Middle
- dstBeing->setVisibleEquipment(type, msg.readByte());
- // First 3 slots of mVisibleEquipments are reserved for
- // later use, probably accessories.
+ case 5: // Change middle headgear for eathena, armor for us
+ dstBeing->setVisibleEquipment(
+ Being::TOPCLOTHES_SPRITE,
+ id);
break;
case 6:
- dstBeing->setHairColor(msg.readByte());
+ dstBeing->setHairColor(id);
break;
default:
- printf("c3: %i\n", msg.readByte()); // unsupported
+ logger->log("c3: %i\n", id); // unsupported
break;
}
}
@@ -331,15 +324,15 @@ void BeingHandler::handleMessage(MessageIn &msg)
dstBeing->setHairStyle(msg.readShort());
dstBeing->setWeaponById(msg.readShort()); // item id 1
msg.readShort(); // item id 2
- dstBeing->setVisibleEquipment(3, msg.readShort()); // head bottom
+ headBottom = msg.readShort();
if (msg.getId() == SMSG_PLAYER_MOVE)
{
msg.readLong(); // server tick
}
- dstBeing->setVisibleEquipment(4, msg.readShort()); // head top
- dstBeing->setVisibleEquipment(5, msg.readShort()); // head mid
+ headTop = msg.readShort();
+ headMid = msg.readShort();
dstBeing->setHairColor(msg.readShort());
msg.readShort(); // unknown
msg.readShort(); // head dir
@@ -348,6 +341,10 @@ void BeingHandler::handleMessage(MessageIn &msg)
msg.readShort(); // manner
msg.readByte(); // karma
dstBeing->setSex(1 - msg.readByte()); // sex
+ dstBeing->setVisibleEquipment(
+ Being::BOTTOMCLOTHES_SPRITE, headBottom);
+ dstBeing->setVisibleEquipment(Being::HAT_SPRITE, headTop);
+ dstBeing->setVisibleEquipment(Being::TOPCLOTHES_SPRITE, headMid);
if (msg.getId() == SMSG_PLAYER_MOVE)
{
@@ -359,7 +356,9 @@ void BeingHandler::handleMessage(MessageIn &msg)
}
else
{
- //msg.readCoordinates(dstBeing->mX, dstBeing->mY, dstBeing->mDirection);
+ //Uint8 dir;
+ //msg->readCoordinates(dstBeing->mX, dstBeing->mY, dir);
+ //dstBeing->setDirection(dir);
}
msg.readByte(); // unknown
@@ -386,7 +385,7 @@ void BeingHandler::handleMessage(MessageIn &msg)
case 0x0119:
// Change in players look
- printf("0x0119 %li %i %i %x %i\n", msg.readLong(),
+ logger->log("0x0119 %li %i %i %x %i\n", msg.readLong(),
msg.readShort(), msg.readShort(), msg.readShort(),
msg.readByte());
break;
diff --git a/src/net/inventoryhandler.cpp b/src/net/inventoryhandler.cpp
index 3f7e8709..f003d77a 100644
--- a/src/net/inventoryhandler.cpp
+++ b/src/net/inventoryhandler.cpp
@@ -92,7 +92,7 @@ void InventoryHandler::handleMessage(MessageIn &msg)
if (msg.readByte()> 0) {
chatWindow->chatLog("Unable to pick up item", BY_SERVER);
} else {
- const ItemInfo &itemInfo = itemDb->getItemInfo(itemId);
+ const ItemInfo &itemInfo = ItemDB::get(itemId);
chatWindow->chatLog("You picked up a " +
itemInfo.getName(), BY_SERVER);
player_node->addInvItem(index, itemId, amount, equipType != 0);
diff --git a/src/net/npchandler.cpp b/src/net/npchandler.cpp
index 9c89e71f..02204a84 100644
--- a/src/net/npchandler.cpp
+++ b/src/net/npchandler.cpp
@@ -49,20 +49,22 @@ NPCHandler::NPCHandler()
void NPCHandler::handleMessage(MessageIn &msg)
{
+ int id;
+
switch (msg.getId())
{
case SMSG_NPC_CHOICE:
msg.readShort(); // length
- current_npc = dynamic_cast<NPC*>(
- beingManager->findBeing(msg.readLong()));
+ id = msg.readLong();
+ current_npc = dynamic_cast<NPC*>(beingManager->findBeing(id));
npcListDialog->parseItems(msg.readString(msg.getLength() - 8));
npcListDialog->setVisible(true);
break;
case SMSG_NPC_MESSAGE:
msg.readShort(); // length
- current_npc = dynamic_cast<NPC*>(
- beingManager->findBeing(msg.readLong()));
+ id = msg.readLong();
+ current_npc = dynamic_cast<NPC*>(beingManager->findBeing(id));
npcTextDialog->addText(msg.readString(msg.getLength() - 8));
npcListDialog->setVisible(false);
npcTextDialog->setVisible(true);
diff --git a/src/net/playerhandler.cpp b/src/net/playerhandler.cpp
index 6eb80d59..37291c0a 100644
--- a/src/net/playerhandler.cpp
+++ b/src/net/playerhandler.cpp
@@ -46,7 +46,8 @@ OkDialog *deathNotice = NULL;
namespace {
struct WeightListener : public gcn::ActionListener
{
- void action(const std::string &eventId, gcn::Widget *widget) {
+ void action(const std::string &eventId, gcn::Widget *widget)
+ {
weightNotice = NULL;
}
} weightListener;
@@ -57,8 +58,10 @@ namespace {
*/
// TODO Move somewhere else
namespace {
- struct DeathListener : public gcn::ActionListener {
- void action(const std::string &eventId, gcn::Widget *widget) {
+ struct DeathListener : public gcn::ActionListener
+ {
+ void action(const std::string &eventId, gcn::Widget *widget)
+ {
player_node->revive();
deathNotice = NULL;
}
@@ -114,10 +117,11 @@ void PlayerHandler::handleMessage(MessageIn &msg)
player_node->mMaxWeight / 2)
{
weightNotice = new OkDialog("Message",
- "You are carrying more then half your "
- "weight. You are unable to regain "
- "health.");
- weightNotice->addActionListener(&weightListener);
+ "You are carrying more then half "
+ "your weight. You are unable to "
+ "regain health.");
+ weightNotice->addActionListener(
+ &weightListener);
}
player_node->mTotalWeight = value;
break;
diff --git a/src/net/skillhandler.cpp b/src/net/skillhandler.cpp
index d9bea775..17dea606 100644
--- a/src/net/skillhandler.cpp
+++ b/src/net/skillhandler.cpp
@@ -26,6 +26,8 @@
#include "messagein.h"
#include "protocol.h"
+#include "../log.h"
+
#include "../gui/chat.h"
#include "../gui/skill.h"
@@ -85,7 +87,7 @@ void SkillHandler::handleMessage(MessageIn &msg)
if (action.success != SKILL_FAILED &&
action.bskill == BSKILL_EMOTE)
{
- printf("Action: %d/%d", action.bskill, action.success);
+ logger->log("Action: %d/%d", action.bskill, action.success);
}
chatWindow->chatLog(action);
break;