From 53bbde0b488d0f44e7fc224410455344fffd86ac Mon Sep 17 00:00:00 2001 From: Eduardo Bart Date: Sat, 28 Apr 2012 12:12:02 -0300 Subject: [PATCH] add missing protocol 8.6 optbyte --- src/otclient/core/item.cpp | 2 +- src/otclient/luafunctions.cpp | 1 + src/otclient/net/protocolgame.h | 1 + src/otclient/net/protocolgameparse.cpp | 19 ++++++++++++++----- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/otclient/core/item.cpp b/src/otclient/core/item.cpp index 9b290583..7f939e4d 100644 --- a/src/otclient/core/item.cpp +++ b/src/otclient/core/item.cpp @@ -85,7 +85,7 @@ void Item::draw(const Point& dest, float scaleFactor, bool animate) } else if(m_countOrSubType < 50) { xPattern = 2; yPattern = 1; - } else if(m_countOrSubType <= 100) { + } else { xPattern = 3; yPattern = 1; } diff --git a/src/otclient/luafunctions.cpp b/src/otclient/luafunctions.cpp index 98c060e1..8bc4fcb4 100644 --- a/src/otclient/luafunctions.cpp +++ b/src/otclient/luafunctions.cpp @@ -244,6 +244,7 @@ void OTClient::registerLuaFunctions() g_lua.registerClass(); g_lua.bindClassStaticFunction("create", &Item::create); + g_lua.bindClassMemberFunction("setCount", &Item::setCount); g_lua.bindClassMemberFunction("getCount", &Item::getCount); g_lua.bindClassMemberFunction("getId", &Item::getId); g_lua.bindClassMemberFunction("isStackable", &Item::isStackable); diff --git a/src/otclient/net/protocolgame.h b/src/otclient/net/protocolgame.h index 4d7c067a..86b9c6fd 100644 --- a/src/otclient/net/protocolgame.h +++ b/src/otclient/net/protocolgame.h @@ -145,6 +145,7 @@ private: void parseCreatureSpeed(InputMessage& msg); void parseCreatureSkulls(InputMessage& msg); void parseCreatureShields(InputMessage& msg); + void parseCreatureUnpass(InputMessage& msg); void parseCreatureTurn(InputMessage& msg); void parseEditText(InputMessage& msg); void parseEditList(InputMessage& msg); diff --git a/src/otclient/net/protocolgameparse.cpp b/src/otclient/net/protocolgameparse.cpp index d819dd9d..8072e05d 100644 --- a/src/otclient/net/protocolgameparse.cpp +++ b/src/otclient/net/protocolgameparse.cpp @@ -165,12 +165,9 @@ void ProtocolGame::parseMessage(InputMessage& msg) case Proto::GameServerCreatureParty: parseCreatureShields(msg); break; -#if PROTOCOL>=870 case Proto::GameServerCreatureUnpass: - msg.getU32(); // creature id - msg.getU8(); // unpassable boolean + parseCreatureUnpass(msg); break; -#endif case Proto::GameServerEditText: parseEditText(msg); break; @@ -510,7 +507,7 @@ void ProtocolGame::parseOpenNpcTrade(InputMessage& msg) int listCount = msg.getU8(); for(int i = 0; i < listCount; ++i) { ItemPtr item = Item::create(msg.getU16()); - item->setSubType(msg.getU8()); + item->setCountOrSubType(msg.getU8()); std::string name = msg.getString(); int weight = msg.getU32(); @@ -690,6 +687,18 @@ void ProtocolGame::parseCreatureShields(InputMessage& msg) logTraceError("could not get greature"); } +void ProtocolGame::parseCreatureUnpass(InputMessage& msg) +{ + uint id = msg.getU32(); + bool unpass = msg.getU8(); + + CreaturePtr creature = g_map.getCreatureById(id); + if(creature) + creature->setPassable(!unpass); + else + logTraceError("could not get greature"); +} + void ProtocolGame::parseCreatureTurn(InputMessage& msg) { uint id = msg.getU32();