summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
Diffstat (limited to 'src/net')
-rw-r--r--src/net/beinghandler.cpp11
-rw-r--r--src/net/equipmenthandler.cpp7
-rw-r--r--src/net/loginhandler.cpp2
-rw-r--r--src/net/playerhandler.cpp60
4 files changed, 67 insertions, 13 deletions
diff --git a/src/net/beinghandler.cpp b/src/net/beinghandler.cpp
index fbef02bd..7c9b8afd 100644
--- a/src/net/beinghandler.cpp
+++ b/src/net/beinghandler.cpp
@@ -23,6 +23,7 @@
#include "beinghandler.h"
+#include <iostream>
#include <SDL_types.h>
#include "messagein.h"
@@ -37,6 +38,7 @@
#include "../particle.h"
#include "../sound.h"
#include "../player_relations.h"
+#include "../npc.h"
const int EMOTION_TIME = 150; /**< Duration of emotion icon */
@@ -203,8 +205,13 @@ void BeingHandler::handleMessage(MessageIn *msg)
break;
// If this is player's current target, clear it.
- if (player_node->getTarget() == dstBeing)
+ if (dstBeing == player_node->getTarget())
+ {
player_node->stopAttack();
+ }
+
+ if (dstBeing == current_npc)
+ current_npc = NULL;
if (msg->readInt8() == 1)
{
@@ -464,7 +471,7 @@ void BeingHandler::handleMessage(MessageIn *msg)
msg->readInt8(); // unknown
dstBeing->mWalkTime = tick_time;
- dstBeing->mFrame = 0;
+ //dstBeing->mFrame = 0;
break;
case SMSG_PLAYER_STOP:
diff --git a/src/net/equipmenthandler.cpp b/src/net/equipmenthandler.cpp
index cc5d016c..0fc98175 100644
--- a/src/net/equipmenthandler.cpp
+++ b/src/net/equipmenthandler.cpp
@@ -156,6 +156,12 @@ void EquipmentHandler::handleMessage(MessageIn *msg)
mask <<= 1;
position++;
}
+
+ item = inventory->getItem(index);
+ if (!item)
+ break;
+
+ item->setEquipped(false);
player_node->mEquipment->removeEquipment(position);
}
logger->log("Unequipping: %i %i(%i) %i",
@@ -174,6 +180,7 @@ void EquipmentHandler::handleMessage(MessageIn *msg)
item = inventory->getItem(index);
if (item) {
+ item->setEquipped(true);
player_node->mEquipment->setArrows(item);
logger->log("Arrows equipped: %i", index);
}
diff --git a/src/net/loginhandler.cpp b/src/net/loginhandler.cpp
index 6505e39f..737d1762 100644
--- a/src/net/loginhandler.cpp
+++ b/src/net/loginhandler.cpp
@@ -113,7 +113,7 @@ void LoginHandler::handleMessage(MessageIn *msg)
errorMessage = "You have been blocked by the GM Team";
break;
case 6:
- errorMessage = "You have been banned for 5 minutes";
+ errorMessage = "You have been temporarily banned from the game. Please contact the GM team";
break;
case 9:
errorMessage = "This user name is already taken";
diff --git a/src/net/playerhandler.cpp b/src/net/playerhandler.cpp
index e871b670..61e68295 100644
--- a/src/net/playerhandler.cpp
+++ b/src/net/playerhandler.cpp
@@ -52,6 +52,9 @@ extern BuyDialog *buyDialog;
extern SellDialog *sellDialog;
extern Window *buySellDialog;
+static const int MAP_TELEPORT_SCROLL_DISTANCE = 8; /* Max. distance we are willing to scroll after a teleport;
+ * everything beyond will reset the port hard. */
+
/**
* Listener used for handling the overweigth message.
*/
@@ -113,17 +116,13 @@ void PlayerHandler::handleMessage(MessageIn *msg)
* This client assumes that all walk messages succeed,
* and that the server will send a correction notice
* otherwise.
- *
- * Note that this packet is also used by eAthena to notify
- * the client of a server-generated auto-move. A patch has
- * been submitted to Mantis to eliminate these auto moves,
- * since they're inconsistent with the client design.
*/
break;
case SMSG_PLAYER_WARP:
{
std::string mapPath = msg->readString(16);
+ bool nearby;
Uint16 x = msg->readInt16();
Uint16 y = msg->readInt16();
@@ -135,13 +134,23 @@ void PlayerHandler::handleMessage(MessageIn *msg)
*/
player_node->stopAttack();
+ nearby = (engine->getCurrentMapName() == mapPath);
// Switch the actual map, deleting the previous one
engine->changeMap(mapPath);
current_npc = 0;
- float scrollOffsetX = (x - player_node->mX) * 32;
- float scrollOffsetY = (y - player_node->mY) * 32;
+ float scrollOffsetX = 0.0f;
+ float scrollOffsetY = 0.0f;
+
+ /* Scroll if neccessary */
+ if (!nearby
+ || (abs(x - player_node->mX) > MAP_TELEPORT_SCROLL_DISTANCE)
+ || (abs(y - player_node->mY) > MAP_TELEPORT_SCROLL_DISTANCE))
+ {
+ scrollOffsetX = (x - player_node->mX) * 32;
+ scrollOffsetY = (y - player_node->mY) * 32;
+ }
player_node->setAction(Being::STAND);
player_node->mFrame = 0;
@@ -204,8 +213,39 @@ void PlayerHandler::handleMessage(MessageIn *msg)
if (player_node->mHp == 0 && deathNotice == NULL)
{
- deathNotice = new OkDialog("Message",
- "You're now dead, press ok to restart");
+ static char const *const deadMsg[] =
+ {
+ "You are dead.",
+ "We regret to inform you that your character was killed in battle.",
+ "You are not that alive anymore.",
+ "The cold hands of the grim reaper are grabbing for your soul.",
+ "Game Over!",
+ "Insert coin to continue",
+ "No, kids. Your character did not really die. It... err... went to a better place.",
+ "Your plan of breaking your enemies weapon by bashing it with your throat failed.",
+ "I guess this did not run too well.",
+ "Do you want your possessions identified?", // Nethack reference
+ "Sadly, no trace of you was ever found...", // Secret of Mana reference
+ "Annihilated.", // Final Fantasy VI reference
+ "Looks like you got your head handed to you.", //Earthbound reference
+ "You screwed up again, dump your body down the tubes and get you another one.", // Leisure Suit Larry 1 Reference
+ "You're not dead yet. You're just resting.", // Monty Python reference from a couple of skits
+ "You are no more.", // Monty Python reference from the dead parrot sketch starting now
+ "You have ceased to be.",
+ "You've expired and gone to meet your maker.",
+ "You're a stiff.",
+ "Bereft of life, you rest in peace.",
+ "If you weren't so animated, you'd be pushing up the daisies.",
+ "Your metabolic processes are now history.",
+ "You're off the twig.",
+ "You've kicked the bucket.",
+ "You've shuffled off your mortal coil, run down the curtain and joined the bleedin' choir invisibile.",
+ "You are an ex-player.",
+ "You're pining for the fjords." // Monty Python reference from the dead parrot sketch
+ };
+ std::string message(deadMsg[rand()%27]);
+
+ deathNotice = new OkDialog("Message", message);
deathNotice->addActionListener(&deathListener);
player_node->setAction(Being::DEAD);
}
@@ -288,7 +328,7 @@ void PlayerHandler::handleMessage(MessageIn *msg)
}
break;
- // Updates stats and status points
+ // Updates stats and status points
case SMSG_PLAYER_STAT_UPDATE_5:
player_node->mStatsPointsToAttribute = msg->readInt16();
player_node->mAttr[LocalPlayer::STR] = msg->readInt8();