summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorPhilipp Sehmisch <crush@themanaworld.org>2009-08-16 18:25:55 +0200
committerPhilipp Sehmisch <crush@themanaworld.org>2009-08-16 18:25:55 +0200
commit4263962e947b4914de8d1750f21cc7cc82567b4d (patch)
tree32340098913c302fdb33f88ffea65fb36920db75 /src/net
parentdd0844b6ac01293e7afd0dd85e695b8d77b8e4be (diff)
parent7e2673a3b9460fdcd646e23c3bd9039de854565f (diff)
downloadmana-4263962e947b4914de8d1750f21cc7cc82567b4d.tar.gz
mana-4263962e947b4914de8d1750f21cc7cc82567b4d.tar.bz2
mana-4263962e947b4914de8d1750f21cc7cc82567b4d.tar.xz
mana-4263962e947b4914de8d1750f21cc7cc82567b4d.zip
More merges and conflict resolves
Diffstat (limited to 'src/net')
-rw-r--r--src/net/ea/beinghandler.cpp90
-rw-r--r--src/net/ea/charserverhandler.cpp25
-rw-r--r--src/net/ea/partyhandler.cpp2
-rw-r--r--src/net/logindata.h2
-rw-r--r--src/net/tmwserv/beinghandler.cpp11
-rw-r--r--src/net/tmwserv/charserverhandler.cpp4
-rw-r--r--src/net/tmwserv/chathandler.cpp2
-rw-r--r--src/net/tmwserv/generalhandler.cpp6
-rw-r--r--src/net/tmwserv/generalhandler.h1
-rw-r--r--src/net/tmwserv/specialhandler.cpp5
-rw-r--r--src/net/tmwserv/specialhandler.h5
11 files changed, 91 insertions, 62 deletions
diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp
index 1d780a60..29c10900 100644
--- a/src/net/ea/beinghandler.cpp
+++ b/src/net/ea/beinghandler.cpp
@@ -37,6 +37,8 @@
#include "gui/partywindow.h"
+#include "resources/colordb.h"
+
#include <iostream>
namespace EAthena {
@@ -98,7 +100,7 @@ Being *createBeing(int id, short job)
void BeingHandler::handleMessage(MessageIn &msg)
{
int id;
- short job, speed;
+ short job, speed, gender;
Uint16 headTop, headMid, headBottom;
Uint16 shoes, gloves;
Uint16 weapon, shield;
@@ -109,6 +111,7 @@ void BeingHandler::handleMessage(MessageIn &msg)
int type;
Uint16 status;
Being *srcBeing, *dstBeing;
+ Player *player;
int hairStyle, hairColor, flag;
switch (msg.getId())
@@ -137,6 +140,8 @@ void BeingHandler::handleMessage(MessageIn &msg)
dstBeing = createBeing(id, job);
}
+ player = dynamic_cast<Player*>(dstBeing);
+
// Fix monster jobs
if (dstBeing->getType() == Being::MONSTER)
{
@@ -158,7 +163,7 @@ void BeingHandler::handleMessage(MessageIn &msg)
dstBeing->setWalkSpeed(speed);
dstBeing->mJob = job;
hairStyle = msg.readInt16();
- dstBeing->setSprite(Being::WEAPON_SPRITE, msg.readInt16());
+ weapon = msg.readInt16();
headBottom = msg.readInt16();
if (msg.getId() == SMSG_BEING_MOVE)
@@ -166,7 +171,7 @@ void BeingHandler::handleMessage(MessageIn &msg)
msg.readInt32(); // server tick
}
- dstBeing->setSprite(Being::SHIELD_SPRITE, msg.readInt16());
+ shield = msg.readInt16();
headTop = msg.readInt16();
headMid = msg.readInt16();
hairColor = msg.readInt16();
@@ -178,16 +183,22 @@ void BeingHandler::handleMessage(MessageIn &msg)
msg.readInt16(); // manner
dstBeing->setStatusEffectBlock(32, msg.readInt16()); // opt3
msg.readInt8(); // karma
- dstBeing->setGender(
- (msg.readInt8() == 0) ? GENDER_FEMALE : GENDER_MALE);
+ gender = msg.readInt8();
- // Set these after the gender, as the sprites may be gender-specific
- dstBeing->setSprite(Being::BOTTOMCLOTHES_SPRITE, headBottom);
- dstBeing->setSprite(Being::TOPCLOTHES_SPRITE, headMid);
- dstBeing->setSprite(Being::HAT_SPRITE, headTop);
- dstBeing->setSprite(Being::SHOE_SPRITE, shoes);
- dstBeing->setSprite(Being::GLOVES_SPRITE, gloves);
- dstBeing->setHairStyle(hairStyle, hairColor);
+ if (player)
+ {
+ player->setGender((gender == 0)
+ ? GENDER_FEMALE : GENDER_MALE);
+ // Set these after the gender, as the sprites may be gender-specific
+ player->setSprite(Player::HAIR_SPRITE, hairStyle * -1, ColorDB::get(hairColor));
+ player->setSprite(Player::BOTTOMCLOTHES_SPRITE, headBottom);
+ player->setSprite(Player::TOPCLOTHES_SPRITE, headMid);
+ player->setSprite(Player::HAT_SPRITE, headTop);
+ player->setSprite(Player::SHOE_SPRITE, shoes);
+ player->setSprite(Player::GLOVES_SPRITE, gloves);
+ player->setSprite(Player::WEAPON_SPRITE, weapon);
+ player->setSprite(Player::SHIELD_SPRITE, shield);
+ }
if (msg.getId() == SMSG_BEING_MOVE)
{
@@ -371,6 +382,8 @@ void BeingHandler::handleMessage(MessageIn &msg)
break;
}
+ player = dynamic_cast<Player*>(dstBeing);
+
int type = msg.readInt8();
int id = 0;
int id2 = 0;
@@ -384,41 +397,41 @@ void BeingHandler::handleMessage(MessageIn &msg)
switch (type) {
case 1: // eAthena LOOK_HAIR
- dstBeing->setHairStyle(id, -1);
+ player->setSpriteID(Player::HAIR_SPRITE, id *-1);
break;
case 2: // Weapon ID in id, Shield ID in id2
- dstBeing->setSprite(Being::WEAPON_SPRITE, id);
- dstBeing->setSprite(Being::SHIELD_SPRITE, id2);
+ player->setSprite(Player::WEAPON_SPRITE, id);
+ player->setSprite(Player::SHIELD_SPRITE, id2);
break;
case 3: // Change lower headgear for eAthena, pants for us
- dstBeing->setSprite(Being::BOTTOMCLOTHES_SPRITE, id);
+ player->setSprite(Player::BOTTOMCLOTHES_SPRITE, id);
break;
case 4: // Change upper headgear for eAthena, hat for us
- dstBeing->setSprite(Being::HAT_SPRITE, id);
+ player->setSprite(Player::HAT_SPRITE, id);
break;
case 5: // Change middle headgear for eathena, armor for us
- dstBeing->setSprite(Being::TOPCLOTHES_SPRITE, id);
+ player->setSprite(Player::TOPCLOTHES_SPRITE, id);
break;
case 6: // eAthena LOOK_HAIR_COLOR
- dstBeing->setHairStyle(-1, id);
+ player->setSpriteColor(Player::HAIR_SPRITE, ColorDB::get(id));
break;
case 8: // eAthena LOOK_SHIELD
- dstBeing->setSprite(Being::SHIELD_SPRITE, id);
+ player->setSprite(Player::SHIELD_SPRITE, id);
break;
case 9: // eAthena LOOK_SHOES
- dstBeing->setSprite(Being::SHOE_SPRITE, id);
+ player->setSprite(Player::SHOE_SPRITE, id);
break;
case 10: // LOOK_GLOVES
- dstBeing->setSprite(Being::GLOVES_SPRITE, id);
+ player->setSprite(Player::GLOVES_SPRITE, id);
break;
case 11: // LOOK_CAPE
- dstBeing->setSprite(Being::CAPE_SPRITE, id);
+ player->setSprite(Player::CAPE_SPRITE, id);
break;
case 12:
- dstBeing->setSprite(Being::MISC1_SPRITE, id);
+ player->setSprite(Player::MISC1_SPRITE, id);
break;
case 13:
- dstBeing->setSprite(Being::MISC2_SPRITE, id);
+ player->setSprite(Player::MISC2_SPRITE, id);
break;
default:
logger->log("SMSG_BEING_CHANGE_LOOKS: unsupported type: "
@@ -466,15 +479,16 @@ void BeingHandler::handleMessage(MessageIn &msg)
dstBeing = createBeing(id, job);
}
+ player = dynamic_cast<Player*>(dstBeing);
+
{
PartyMember *member = partyWindow->findMember(id);
if (member && member->online)
{
- dynamic_cast<Player*>(dstBeing)->setInParty(true);
+ player->setInParty(true);
}
}
-
dstBeing->setWalkSpeed(speed);
dstBeing->mJob = job;
hairStyle = msg.readInt16();
@@ -497,19 +511,19 @@ void BeingHandler::handleMessage(MessageIn &msg)
msg.readInt16(); // manner
dstBeing->setStatusEffectBlock(32, msg.readInt16()); // opt3
msg.readInt8(); // karma
- dstBeing->setGender(
- (msg.readInt8() == 0) ? GENDER_FEMALE : GENDER_MALE);
+ player->setGender((msg.readInt8() == 0)
+ ? GENDER_FEMALE : GENDER_MALE);
// Set these after the gender, as the sprites may be gender-specific
- dstBeing->setSprite(Being::WEAPON_SPRITE, weapon);
- dstBeing->setSprite(Being::SHIELD_SPRITE, shield);
- dstBeing->setSprite(Being::BOTTOMCLOTHES_SPRITE, headBottom);
- dstBeing->setSprite(Being::TOPCLOTHES_SPRITE, headMid);
- dstBeing->setSprite(Being::HAT_SPRITE, headTop);
- //dstBeing->setSprite(Being::CAPE_SPRITE, cape);
- //dstBeing->setSprite(Being::MISC1_SPRITE, misc1);
- //dstBeing->setSprite(Being::MISC2_SPRITE, misc2);
- dstBeing->setHairStyle(hairStyle, hairColor);
+ player->setSprite(Player::WEAPON_SPRITE, weapon);
+ player->setSprite(Player::SHIELD_SPRITE, shield);
+ player->setSprite(Player::BOTTOMCLOTHES_SPRITE, headBottom);
+ player->setSprite(Player::TOPCLOTHES_SPRITE, headMid);
+ player->setSprite(Player::HAT_SPRITE, headTop);
+ //player->setSprite(Player::CAPE_SPRITE, cape);
+ //player->setSprite(Player::MISC1_SPRITE, misc1);
+ //player->setSprite(Player::MISC2_SPRITE, misc2);
+ player->setSprite(Player::HAIR_SPRITE, hairStyle * -1, ColorDB::get(hairColor));
if (msg.getId() == SMSG_PLAYER_MOVE)
{
diff --git a/src/net/ea/charserverhandler.cpp b/src/net/ea/charserverhandler.cpp
index 6fae1864..47d454a8 100644
--- a/src/net/ea/charserverhandler.cpp
+++ b/src/net/ea/charserverhandler.cpp
@@ -35,6 +35,8 @@
#include "gui/charcreatedialog.h"
#include "gui/okdialog.h"
+#include "resources/colordb.h"
+
#include "utils/gettext.h"
#include "utils/stringutils.h"
@@ -176,10 +178,10 @@ LocalPlayer *CharServerHandler::readPlayerData(MessageIn &msg, int &slot)
int temp = msg.readInt32();
tempPlayer->setAttributeBase(JOB, temp);
tempPlayer->setAttributeEffective(JOB, temp);
- tempPlayer->setSprite(Being::SHOE_SPRITE, msg.readInt16());
- tempPlayer->setSprite(Being::GLOVES_SPRITE, msg.readInt16());
- tempPlayer->setSprite(Being::CAPE_SPRITE, msg.readInt16());
- tempPlayer->setSprite(Being::MISC1_SPRITE, msg.readInt16());
+ tempPlayer->setSprite(Player::SHOE_SPRITE, msg.readInt16());
+ tempPlayer->setSprite(Player::GLOVES_SPRITE, msg.readInt16());
+ tempPlayer->setSprite(Player::CAPE_SPRITE, msg.readInt16());
+ tempPlayer->setSprite(Player::MISC1_SPRITE, msg.readInt16());
msg.readInt32(); // option
msg.readInt32(); // karma
msg.readInt32(); // manner
@@ -192,16 +194,15 @@ LocalPlayer *CharServerHandler::readPlayerData(MessageIn &msg, int &slot)
msg.readInt16(); // class
int hairStyle = msg.readInt16();
Uint16 weapon = msg.readInt16();
- tempPlayer->setSprite(Being::WEAPON_SPRITE, weapon);
+ tempPlayer->setSprite(Player::WEAPON_SPRITE, weapon);
tempPlayer->setLevel(msg.readInt16());
msg.readInt16(); // skill point
- tempPlayer->setSprite(Being::BOTTOMCLOTHES_SPRITE, msg.readInt16()); // head bottom
- tempPlayer->setSprite(Being::SHIELD_SPRITE, msg.readInt16());
- tempPlayer->setSprite(Being::HAT_SPRITE, msg.readInt16()); // head option top
- tempPlayer->setSprite(Being::TOPCLOTHES_SPRITE, msg.readInt16()); // head option mid
- int hairColor = msg.readInt16();
- tempPlayer->setHairStyle(hairStyle, hairColor);
- tempPlayer->setSprite(Being::MISC2_SPRITE, msg.readInt16());
+ tempPlayer->setSprite(Player::BOTTOMCLOTHES_SPRITE, msg.readInt16()); // head bottom
+ tempPlayer->setSprite(Player::SHIELD_SPRITE, msg.readInt16());
+ tempPlayer->setSprite(Player::HAT_SPRITE, msg.readInt16()); // head option top
+ tempPlayer->setSprite(Player::TOPCLOTHES_SPRITE, msg.readInt16()); // head option mid
+ tempPlayer->setSprite(Player::HAIR_SPRITE, hairStyle * -1, ColorDB::get(msg.readInt16()));
+ tempPlayer->setSprite(Player::MISC2_SPRITE, msg.readInt16());
tempPlayer->setName(msg.readString(24));
for (int i = 0; i < 6; i++) {
tempPlayer->setAttributeBase(i + STR, msg.readInt8());
diff --git a/src/net/ea/partyhandler.cpp b/src/net/ea/partyhandler.cpp
index a4a84b07..f514c3b6 100644
--- a/src/net/ea/partyhandler.cpp
+++ b/src/net/ea/partyhandler.cpp
@@ -139,7 +139,6 @@ void PartyHandler::handleMessage(MessageIn &msg)
break;
}
std::string nick;
- int gender = 0;
std::string partyName = "";
if (being->getType() != Being::PLAYER)
{
@@ -148,7 +147,6 @@ void PartyHandler::handleMessage(MessageIn &msg)
else
{
nick = being->getName();
- gender = being->getGender();
partyName = msg.readString(24);
}
partyWindow->showPartyInvite(nick, partyName);
diff --git a/src/net/logindata.h b/src/net/logindata.h
index 4cf989cb..db7aafff 100644
--- a/src/net/logindata.h
+++ b/src/net/logindata.h
@@ -24,7 +24,7 @@
#include <string>
-#include "being.h"
+#include "player.h"
struct LoginData
{
diff --git a/src/net/tmwserv/beinghandler.cpp b/src/net/tmwserv/beinghandler.cpp
index acd6b62c..d5092782 100644
--- a/src/net/tmwserv/beinghandler.cpp
+++ b/src/net/tmwserv/beinghandler.cpp
@@ -37,6 +37,8 @@
#include "gui/okdialog.h"
+#include "resources/colordb.h"
+
#include "utils/gettext.h"
#include "net/tmwserv/gameserver/player.h"
@@ -95,8 +97,8 @@ static void handleLooks(Player *being, MessageIn &msg)
// Order of sent slots. Has to be in sync with the server code.
static int const nb_slots = 4;
static int const slots[nb_slots] =
- { Being::WEAPON_SPRITE, Being::HAT_SPRITE, Being::TOPCLOTHES_SPRITE,
- Being::BOTTOMCLOTHES_SPRITE };
+ { Player::WEAPON_SPRITE, Player::HAT_SPRITE, Player::TOPCLOTHES_SPRITE,
+ Player::BOTTOMCLOTHES_SPRITE };
int mask = msg.readInt8();
@@ -144,7 +146,7 @@ void BeingHandler::handleBeingEnterMessage(MessageIn &msg)
}
Player *p = static_cast< Player * >(being);
int hs = msg.readInt8(), hc = msg.readInt8();
- p->setHairStyle(hs, hc);
+ p->setSprite(Player::HAIR_SPRITE, hs * -1, ColorDB::get(hc));
p->setGender(msg.readInt8() == GENDER_MALE ?
GENDER_MALE : GENDER_FEMALE);
handleLooks(p, msg);
@@ -304,8 +306,7 @@ void BeingHandler::handleBeingLooksChangeMessage(MessageIn &msg)
{
int style = msg.readInt16();
int color = msg.readInt16();
- player->setHairStyle(style, color);
- player->setGender((Gender)msg.readInt16());
+ player->setSprite(Player::HAIR_SPRITE, style * -1, ColorDB::get(color));
}
}
diff --git a/src/net/tmwserv/charserverhandler.cpp b/src/net/tmwserv/charserverhandler.cpp
index 0146babb..93181a93 100644
--- a/src/net/tmwserv/charserverhandler.cpp
+++ b/src/net/tmwserv/charserverhandler.cpp
@@ -38,6 +38,8 @@
#include "gui/charcreatedialog.h"
#include "gui/okdialog.h"
+#include "resources/colordb.h"
+
#include "utils/gettext.h"
extern Net::Connection *gameServerConnection;
@@ -229,7 +231,7 @@ LocalPlayer* CharServerHandler::readPlayerData(MessageIn &msg, int &slot)
tempPlayer->setName(msg.readString());
tempPlayer->setGender(msg.readInt8() == GENDER_MALE ? GENDER_MALE : GENDER_FEMALE);
int hs = msg.readInt8(), hc = msg.readInt8();
- tempPlayer->setHairStyle(hs, hc);
+ tempPlayer->setSprite(Player::HAIR_SPRITE, hs * -1, ColorDB::get(hc));
tempPlayer->setLevel(msg.readInt16());
tempPlayer->setCharacterPoints(msg.readInt16());
tempPlayer->setCorrectionPoints(msg.readInt16());
diff --git a/src/net/tmwserv/chathandler.cpp b/src/net/tmwserv/chathandler.cpp
index ad3ae49b..c95f6ac5 100644
--- a/src/net/tmwserv/chathandler.cpp
+++ b/src/net/tmwserv/chathandler.cpp
@@ -298,7 +298,7 @@ void ChatHandler::handleChannelEvent(MessageIn &msg)
std::string user1 = line.substr(0, first);
std::string user2 = line.substr(first+1, line.length());
channel->getTab()->chatLog(strprintf(_("%s has kicked %s."),
- user1, user2), BY_CHANNEL);
+ user1.c_str(), user2.c_str()), BY_CHANNEL);
} break;
default:
diff --git a/src/net/tmwserv/generalhandler.cpp b/src/net/tmwserv/generalhandler.cpp
index d643586b..011433fe 100644
--- a/src/net/tmwserv/generalhandler.cpp
+++ b/src/net/tmwserv/generalhandler.cpp
@@ -22,6 +22,7 @@
#include "gui/inventorywindow.h"
#include "gui/partywindow.h"
#include "gui/skilldialog.h"
+#include "gui/specialswindow.h"
#include "gui/statuswindow.h"
#include "net/tmwserv/generalhandler.h"
@@ -43,6 +44,7 @@
#include "net/tmwserv/npchandler.h"
#include "net/tmwserv/partyhandler.h"
#include "net/tmwserv/playerhandler.h"
+#include "net/tmwserv/specialhandler.h"
#include "net/tmwserv/tradehandler.h"
#include "utils/gettext.h"
@@ -72,7 +74,8 @@ GeneralHandler::GeneralHandler():
mNpcHandler(new NpcHandler),
mPartyHandler(new PartyHandler),
mPlayerHandler(new PlayerHandler),
- mTradeHandler(new TradeHandler)
+ mTradeHandler(new TradeHandler),
+ mSpecialHandler(new SpecialHandler)
{
accountServerConnection = Net::getConnection();
gameServerConnection = Net::getConnection();
@@ -149,6 +152,7 @@ void GeneralHandler::guiWindowsLoaded()
inventoryWindow->setSplitAllowed(true);
partyWindow->clearPartyName();
skillDialog->loadSkills("tmw-skills.xml");
+ specialsWindow->loadSpecials("specials.xml");
player_node->setExpNeeded(100);
diff --git a/src/net/tmwserv/generalhandler.h b/src/net/tmwserv/generalhandler.h
index 08e18850..40166ca0 100644
--- a/src/net/tmwserv/generalhandler.h
+++ b/src/net/tmwserv/generalhandler.h
@@ -63,6 +63,7 @@ class GeneralHandler : public Net::GeneralHandler
MessageHandlerPtr mPartyHandler;
MessageHandlerPtr mPlayerHandler;
MessageHandlerPtr mTradeHandler;
+ MessageHandlerPtr mSpecialHandler;
};
} // namespace TmwServ
diff --git a/src/net/tmwserv/specialhandler.cpp b/src/net/tmwserv/specialhandler.cpp
index f259e77a..2e4ff1bb 100644
--- a/src/net/tmwserv/specialhandler.cpp
+++ b/src/net/tmwserv/specialhandler.cpp
@@ -37,6 +37,11 @@ SpecialHandler::SpecialHandler()
specialHandler = this;
}
+void SpecialHandler::handleMessage(MessageIn &msg)
+{
+ // TODO
+}
+
void SpecialHandler::use(int id)
{
MessageOut msg(PGMSG_USE_SPECIAL);
diff --git a/src/net/tmwserv/specialhandler.h b/src/net/tmwserv/specialhandler.h
index c7ebd6a2..b8f0ce90 100644
--- a/src/net/tmwserv/specialhandler.h
+++ b/src/net/tmwserv/specialhandler.h
@@ -22,15 +22,18 @@
#ifndef NET_TMWSERV_SKILLHANDLER_H
#define NET_TMWSERV_SKILLHANDLER_H
+#include "net/messagehandler.h"
#include "net/specialhandler.h"
namespace TmwServ {
-class SpecialHandler : public Net::SpecialHandler
+class SpecialHandler : public MessageHandler, public Net::SpecialHandler
{
public:
SpecialHandler();
+ void handleMessage(MessageIn &msg);
+
void use(int id);
void use(int id, int level, int beingId);