summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-08-16 18:35:06 +0300
committerAndrei Karas <akaras@inbox.ru>2015-08-16 19:43:03 +0300
commit3242aa80fbee19eb421ace68d1c3c69e4fc777e6 (patch)
tree50cc1b2e47953c20059183889e667f673ba7e4c2
parentd207e52ab770681f8bd584c06dd9aa03096b71f5 (diff)
downloadmanaverse-3242aa80fbee19eb421ace68d1c3c69e4fc777e6.tar.gz
manaverse-3242aa80fbee19eb421ace68d1c3c69e4fc777e6.tar.bz2
manaverse-3242aa80fbee19eb421ace68d1c3c69e4fc777e6.tar.xz
manaverse-3242aa80fbee19eb421ace68d1c3c69e4fc777e6.zip
Add packet SMSG_ITEM_VISIBLE2 0x0b18.
Change net version to 10.
-rw-r--r--src/actormanager.cpp8
-rw-r--r--src/actormanager.h4
-rw-r--r--src/flooritem.cpp20
-rw-r--r--src/flooritem.h9
-rw-r--r--src/net/eathena/itemhandler.cpp46
-rw-r--r--src/net/eathena/itemhandler.h2
-rw-r--r--src/net/eathena/network.h2
-rw-r--r--src/net/eathena/packets.h2
-rw-r--r--src/net/eathena/protocol.h1
-rw-r--r--src/net/tmwa/itemhandler.cpp8
10 files changed, 91 insertions, 11 deletions
diff --git a/src/actormanager.cpp b/src/actormanager.cpp
index ec0e0ed1b..b83a08a0d 100644
--- a/src/actormanager.cpp
+++ b/src/actormanager.cpp
@@ -301,17 +301,21 @@ FloorItem *ActorManager::createItem(const BeingId id,
const int x, const int y,
const int itemType,
const int amount,
+ const int refine,
const ItemColor color,
const Identified identified,
- const int subX, const int subY)
+ const int subX, const int subY,
+ const int *const cards)
{
FloorItem *const floorItem = new FloorItem(id,
itemId,
x, y,
itemType,
amount,
+ refine,
color,
- identified);
+ identified,
+ cards);
floorItem->postInit(mMap, subX, subY);
if (!checkForPickup(floorItem))
diff --git a/src/actormanager.h b/src/actormanager.h
index 609ecd22a..e4689bbf2 100644
--- a/src/actormanager.h
+++ b/src/actormanager.h
@@ -85,9 +85,11 @@ class ActorManager final: public ConfigListener
const int x, const int y,
const int itemType,
const int amount,
+ const int refine,
const ItemColor color,
const Identified identified,
- const int subX, const int subY);
+ const int subX, const int subY,
+ const int *const cards);
/**
* Destroys the given ActorSprite at the end of
diff --git a/src/flooritem.cpp b/src/flooritem.cpp
index 8cb59bd9d..b9d2f3cf3 100644
--- a/src/flooritem.cpp
+++ b/src/flooritem.cpp
@@ -23,6 +23,7 @@
#include "flooritem.h"
#include "configuration.h"
+#include "item.h"
#include "render/graphics.h"
@@ -48,14 +49,18 @@ FloorItem::FloorItem(const BeingId id,
const int x, const int y,
const int itemType,
const int amount,
+ const int refine,
const ItemColor color,
- const Identified identified) :
+ const Identified identified,
+ const int *const cards) :
ActorSprite(id),
+ mCards(),
mItemId(itemId),
mX(x),
mY(y),
mDropTime(cur_time),
mAmount(amount),
+ mRefine(refine),
mHeightPosDiff(0),
mItemType(itemType),
mPickupCount(0),
@@ -65,6 +70,7 @@ FloorItem::FloorItem(const BeingId id,
mShowMsg(true),
mHighlight(config.getBoolValue("floorItemsHighlight"))
{
+ setCards(cards, maxCards);
}
void FloorItem::postInit(Map *const map, int subX, int subY)
@@ -103,6 +109,18 @@ void FloorItem::postInit(Map *const map, int subX, int subY)
info.getDyeColorsString(mColor));
}
+void FloorItem::setCards(const int *const cards,
+ const int size)
+{
+ if (size < 0 || !cards)
+ return;
+ int sz = size;
+ if (sz > maxCards)
+ sz = maxCards;
+ for (int f = 0; f < sz; f ++)
+ mCards[f] = cards[f];
+}
+
const ItemInfo &FloorItem::getInfo() const
{
return ItemDB::get(mItemId);
diff --git a/src/flooritem.h b/src/flooritem.h
index b6310e419..ca4a5022e 100644
--- a/src/flooritem.h
+++ b/src/flooritem.h
@@ -53,8 +53,10 @@ class FloorItem final : public ActorSprite
const int x, const int y,
const int itemType,
const int amount,
+ const int refine,
const ItemColor color,
- const Identified identified);
+ const Identified identified,
+ const int *const cards);
A_DELETE_COPY(FloorItem)
@@ -108,11 +110,16 @@ class FloorItem final : public ActorSprite
Cursor::Cursor getHoverCursor() const A_WARN_UNUSED
{ return mCursor; }
+ void setCards(const int *const cards,
+ const int size);
+
private:
+ int mCards[4];
int mItemId;
int mX, mY;
int mDropTime;
int mAmount;
+ int mRefine;
int mHeightPosDiff;
int mItemType;
unsigned int mPickupCount;
diff --git a/src/net/eathena/itemhandler.cpp b/src/net/eathena/itemhandler.cpp
index 98ab79f78..004b97104 100644
--- a/src/net/eathena/itemhandler.cpp
+++ b/src/net/eathena/itemhandler.cpp
@@ -39,6 +39,7 @@ ItemHandler::ItemHandler() :
static const uint16_t _messages[] =
{
SMSG_ITEM_VISIBLE,
+ SMSG_ITEM_VISIBLE2,
SMSG_ITEM_DROPPED,
SMSG_ITEM_REMOVE,
SMSG_GRAFFITI_VISIBLE,
@@ -72,6 +73,10 @@ void ItemHandler::handleMessage(Net::MessageIn &msg)
processItemMvpDropped(msg);
break;
+ case SMSG_ITEM_VISIBLE2:
+ processItemVisible2(msg);
+ break;
+
default:
break;
}
@@ -97,9 +102,11 @@ void ItemHandler::processItemDropped(Net::MessageIn &msg)
x, y,
itemType,
amount,
+ 0,
ItemColor_one,
identified,
- subX, subY);
+ subX, subY,
+ nullptr);
}
}
@@ -147,9 +154,44 @@ void ItemHandler::processItemVisible(Net::MessageIn &msg)
x, y,
0,
amount,
+ 0,
+ ItemColor_one,
+ identified,
+ subX, subY,
+ nullptr);
+ }
+}
+
+void ItemHandler::processItemVisible2(Net::MessageIn &msg)
+{
+ const BeingId id = msg.readBeingId("item object id");
+ const int itemId = msg.readInt16("item id");
+ const int itemType = msg.readUInt8("type");
+ const Identified identified = fromInt(
+ msg.readUInt8("identify"), Identified);
+ msg.readUInt8("attribute");
+ const uint8_t refine = msg.readUInt8("refine");
+ int cards[4];
+ for (int f = 0; f < 4; f++)
+ cards[f] = msg.readInt16("card");
+ const int x = msg.readInt16("x");
+ const int y = msg.readInt16("y");
+ const int amount = msg.readInt16("amount");
+ const int subX = static_cast<int>(msg.readInt8("sub x"));
+ const int subY = static_cast<int>(msg.readInt8("sub y"));
+
+ if (actorManager)
+ {
+ actorManager->createItem(id,
+ itemId,
+ x, y,
+ itemType,
+ amount,
+ refine,
ItemColor_one,
identified,
- subX, subY);
+ subX, subY,
+ &cards[0]);
}
}
diff --git a/src/net/eathena/itemhandler.h b/src/net/eathena/itemhandler.h
index 5e8753126..f7029e1d0 100644
--- a/src/net/eathena/itemhandler.h
+++ b/src/net/eathena/itemhandler.h
@@ -47,6 +47,8 @@ class ItemHandler final : public MessageHandler, public Ea::ItemHandler
static void processItemMvpDropped(Net::MessageIn &msg);
static void processItemVisible(Net::MessageIn &msg);
+
+ static void processItemVisible2(Net::MessageIn &msg);
};
} // namespace EAthena
diff --git a/src/net/eathena/network.h b/src/net/eathena/network.h
index 0d25bbf38..12f83c87d 100644
--- a/src/net/eathena/network.h
+++ b/src/net/eathena/network.h
@@ -29,7 +29,7 @@
* Protocol version, reported to the eAthena char and mapserver who can adjust
* the protocol accordingly.
*/
-#define CLIENT_PROTOCOL_VERSION 9
+#define CLIENT_PROTOCOL_VERSION 10
namespace EAthena
{
diff --git a/src/net/eathena/packets.h b/src/net/eathena/packets.h
index f88571130..722feca7d 100644
--- a/src/net/eathena/packets.h
+++ b/src/net/eathena/packets.h
@@ -282,7 +282,7 @@ int16_t packet_lengths[] =
//0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
// #0x0B00
16, -1, 10, -1, -1, -1, -1, 0, 27, 0, -1, -1, 0, 0, 0, 0,
- -1, 0, 0, 0, 0, 0, -1, 19, 0, 0, 0, 0, 0, 0, 0, 0,
+ -1, 0, 0, 0, 0, 0, -1, 19, 28, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
// #0x0B40
diff --git a/src/net/eathena/protocol.h b/src/net/eathena/protocol.h
index d3f0b3cb2..562ae4d06 100644
--- a/src/net/eathena/protocol.h
+++ b/src/net/eathena/protocol.h
@@ -140,6 +140,7 @@ packet(SMSG_SKILL_ARROW_CREATE_LIST, 0x01ad);
packet(SMSG_SKILL_DEVOTION_EFFECT, 0x01cf);
packet(SMSG_ITEM_USE_RESPONSE, 0x00a8);
packet(SMSG_ITEM_VISIBLE, 0x009d); /**< An item is on the floor */
+packet(SMSG_ITEM_VISIBLE2, 0x0b18);
packet(SMSG_GRAFFITI_VISIBLE, 0x01c9);
packet(SMSG_ITEM_DROPPED, 0x084b); /**< An item is dropped */
packet(SMSG_ITEM_MVP_DROPPED, 0x07fd);
diff --git a/src/net/tmwa/itemhandler.cpp b/src/net/tmwa/itemhandler.cpp
index 336fb619c..b99ca12dc 100644
--- a/src/net/tmwa/itemhandler.cpp
+++ b/src/net/tmwa/itemhandler.cpp
@@ -86,9 +86,11 @@ void ItemHandler::processItemDropped(Net::MessageIn &msg)
x, y,
0,
amount,
+ 0,
identify,
Identified_false,
- subX, subY);
+ subX, subY,
+ nullptr);
}
}
@@ -111,9 +113,11 @@ void ItemHandler::processItemVisible(Net::MessageIn &msg)
x, y,
0,
amount,
+ 0,
ItemColor_one,
identified,
- subX, subY);
+ subX, subY,
+ nullptr);
}
}