summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
Diffstat (limited to 'src/net')
-rw-r--r--src/net/tmwa/beinghandler.cpp21
-rw-r--r--src/net/tmwa/charserverhandler.cpp2
-rw-r--r--src/net/tmwa/inventoryhandler.cpp32
-rw-r--r--src/net/tmwa/loginhandler.cpp26
4 files changed, 57 insertions, 24 deletions
diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp
index 9c5c45185..0548a2715 100644
--- a/src/net/tmwa/beinghandler.cpp
+++ b/src/net/tmwa/beinghandler.cpp
@@ -631,7 +631,10 @@ void BeingHandler::handleMessage(Net::MessageIn &msg)
else
{ // SMSG_BEING_CHANGE_LOOKS2
id = msg.readInt16();
- id2 = msg.readInt16();
+ if (type == 2 || serverVersion > 0)
+ id2 = msg.readInt16();
+ else
+ id2 = 1;
color = "";
}
@@ -907,10 +910,18 @@ void BeingHandler::handleMessage(Net::MessageIn &msg)
if (!config.getBoolValue("hideShield"))
dstBeing->setSprite(SPRITE_SHIELD, shield);
//dstBeing->setSprite(SPRITE_SHOE, shoes);
- logger->log("bmt: %d, %d, %d", colors[0], colors[2], colors[1]);
- dstBeing->setSprite(SPRITE_BOTTOMCLOTHES, headBottom, "", colors[0]);
- dstBeing->setSprite(SPRITE_TOPCLOTHES, headMid, "", colors[2]);
- dstBeing->setSprite(SPRITE_HAT, headTop, "", colors[1]);
+ if (serverVersion > 0)
+ {
+ dstBeing->setSprite(SPRITE_BOTTOMCLOTHES, headBottom, "", colors[0]);
+ dstBeing->setSprite(SPRITE_TOPCLOTHES, headMid, "", colors[2]);
+ dstBeing->setSprite(SPRITE_HAT, headTop, "", colors[1]);
+ }
+ else
+ {
+ dstBeing->setSprite(SPRITE_BOTTOMCLOTHES, headBottom);
+ dstBeing->setSprite(SPRITE_TOPCLOTHES, headMid);
+ dstBeing->setSprite(SPRITE_HAT, headTop);
+ }
//dstBeing->setSprite(SPRITE_GLOVES, gloves);
//dstBeing->setSprite(SPRITE_CAPE, cape);
//dstBeing->setSprite(SPRITE_MISC1, misc1);
diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp
index a1b7c83b8..35cca6f07 100644
--- a/src/net/tmwa/charserverhandler.cpp
+++ b/src/net/tmwa/charserverhandler.cpp
@@ -83,7 +83,7 @@ void CharServerHandler::handleMessage(Net::MessageIn &msg)
int slots = msg.readInt16();
if (slots > 0 && slots < 30)
loginData.characterSlots = slots;
- bool version = msg.readInt8() == 1;
+ bool version = msg.readInt8() == 1 && serverVersion > 0;
msg.skip(17); // Unused
delete_all(mCharacters);
diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp
index fc32c3ec3..7113cddb3 100644
--- a/src/net/tmwa/inventoryhandler.cpp
+++ b/src/net/tmwa/inventoryhandler.cpp
@@ -209,6 +209,9 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
cards[0], cards[1], cards[2], cards[3]);
}
+ if (serverVersion < 1 && identified > 1)
+ identified = 1;
+
if (msg.getId() == SMSG_PLAYER_INVENTORY)
{
// Trick because arrows are not considered equipment
@@ -255,6 +258,9 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
refine);
}
+ if (serverVersion < 1 && identified > 1)
+ identified = 1;
+
mInventoryItems.push_back(InventoryItem(index, itemId, amount,
refine, identified, false));
}
@@ -299,6 +305,9 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
if (item && item->getId() == itemId)
amount += inventory->getItem(index)->getQuantity();
+ if (serverVersion < 1 && identified > 1)
+ identified = 1;
+
inventory->setItem(index, itemId, amount, refine,
identified, equipType != 0);
}
@@ -410,6 +419,9 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
{
if (mStorage)
{
+ if (serverVersion < 1 && identified > 1)
+ identified = 1;
+
mStorage->setItem(index, itemId, amount, refine,
identified, false);
}
@@ -458,29 +470,31 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
{
index = msg.readInt16() - INVENTORY_OFFSET;
itemId = msg.readInt16();
- if (itemId == 1172)
- logger->log("step1");
int itemType = msg.readInt8(); // type
identified = msg.readInt8(); // identify flag
+
msg.readInt16(); // equip type
equipType = msg.readInt16();
msg.readInt8(); // attribute
refine = msg.readInt8();
msg.skip(8); // card
- if (itemId == 1172)
- logger->log("step2");
- if (inventory)
- inventory->setItem(index, itemId, 1, refine, identified, true);
-
- if (equipType)
- mEquips.setEquipment(getSlot(equipType), index);
if (debugInventory)
{
logger->log("Index: %d, ID: %d, Type: %d, Identified: %d",
index, itemId, itemType, identified);
}
+
+ if (serverVersion < 1 && identified > 1)
+ identified = 1;
+
+ if (inventory)
+ inventory->setItem(index, itemId, 1, refine, identified, true);
+
+ if (equipType)
+ mEquips.setEquipment(getSlot(equipType), index);
+
}
break;
diff --git a/src/net/tmwa/loginhandler.cpp b/src/net/tmwa/loginhandler.cpp
index a1b3c0f95..810d97056 100644
--- a/src/net/tmwa/loginhandler.cpp
+++ b/src/net/tmwa/loginhandler.cpp
@@ -198,15 +198,23 @@ void LoginHandler::handleMessage(Net::MessageIn &msg)
{
// TODO: verify these!
- msg.readInt8(); // -1
- msg.readInt8(); // T
- msg.readInt8(); // M
- msg.readInt8(); // W
-
- unsigned int options = msg.readInt32();
-
- mRegistrationEnabled = options;
-// mRegistrationEnabled = (options & 1);
+ char b1 = msg.readInt8(); // -1
+ char b2 = msg.readInt8(); // T
+ char b3 = msg.readInt8(); // M
+ char b4 = msg.readInt8(); // W
+ if (b1 == -1 && b2 == 'E' && b3 == 'V' && b4 == 'L')
+ {
+ unsigned int options = msg.readInt8();
+ mRegistrationEnabled = options;
+ msg.skip(2);
+ serverVersion = msg.readInt8();
+ }
+ else
+ {
+ unsigned int options = msg.readInt32();
+ mRegistrationEnabled = options;
+ serverVersion = 0;
+ }
// Leave this last
mVersionResponse = true;