Fix protocol error #362

TODO:
Handle the helpers in LUA, it could be added into Battle Window i think,
if someone know where should this be comment here !
This commit is contained in:
Joao Pasqualini Costa 2013-10-20 18:31:20 -02:00
parent 8230bf2af4
commit 971d90a596
5 changed files with 26 additions and 0 deletions

View File

@ -171,6 +171,7 @@ void Game::processEnterGame()
g_lua.callGlobalField("g_game", "onEnterGame"); g_lua.callGlobalField("g_game", "onEnterGame");
} }
void Game::processGameStart() void Game::processGameStart()
{ {
m_online = true; m_online = true;
@ -234,6 +235,11 @@ void Game::processGMActions(const std::vector<uint8>& actions)
g_lua.callGlobalField("g_game", "onGMActions", actions); g_lua.callGlobalField("g_game", "onGMActions", actions);
} }
void Game::processPlayerHelpers(int helpers)
{
g_lua.callGlobalField("g_game", "onPlayerHelpersUpdate", helpers);
}
void Game::processPing() void Game::processPing()
{ {
g_lua.callGlobalField("g_game", "onPing"); g_lua.callGlobalField("g_game", "onPing");

View File

@ -73,6 +73,8 @@ protected:
void processAttackCancel(uint seq); void processAttackCancel(uint seq);
void processWalkCancel(Otc::Direction direction); void processWalkCancel(Otc::Direction direction);
void processPlayerHelpers(int helpers);
// message related // message related
void processTextMessage(Otc::MessageMode mode, const std::string& text); void processTextMessage(Otc::MessageMode mode, const std::string& text);
void processTalk(const std::string& name, int level, Otc::MessageMode mode, const std::string& text, int channelId, const Position& pos); void processTalk(const std::string& name, int level, Otc::MessageMode mode, const std::string& text, int channelId, const Position& pos);

View File

@ -102,6 +102,7 @@ namespace Proto {
GameServerCreatureSkull = 144, GameServerCreatureSkull = 144,
GameServerCreatureParty = 145, GameServerCreatureParty = 145,
GameServerCreatureUnpass = 146, GameServerCreatureUnpass = 146,
GameServerPlayerHelpers = 148,
GameServerEditText = 150, GameServerEditText = 150,
GameServerEditList = 151, GameServerEditList = 151,
GameServerPlayerDataBasic = 159, // 950 GameServerPlayerDataBasic = 159, // 950

View File

@ -125,6 +125,7 @@ public:
void addPosition(const OutputMessagePtr& msg, const Position& position); void addPosition(const OutputMessagePtr& msg, const Position& position);
private: private:
void parsePlayerHelpers(const InputMessagePtr& msg);
void parseMessage(const InputMessagePtr& msg); void parseMessage(const InputMessagePtr& msg);
void parsePendingGame(const InputMessagePtr& msg); void parsePendingGame(const InputMessagePtr& msg);
void parseEnterGame(const InputMessagePtr& msg); void parseEnterGame(const InputMessagePtr& msg);

View File

@ -323,6 +323,10 @@ void ProtocolGame::parseMessage(const InputMessagePtr& msg)
case Proto::GameServerEnterGame: case Proto::GameServerEnterGame:
parseEnterGame(msg); parseEnterGame(msg);
break; break;
// PROTOCOL>=1010
case Proto::GameServerPlayerHelpers:
parsePlayerHelpers(msg);
break;
// otclient ONLY // otclient ONLY
case Proto::GameServerExtendedOpcode: case Proto::GameServerExtendedOpcode:
parseExtendedOpcode(msg); parseExtendedOpcode(msg);
@ -379,6 +383,18 @@ void ProtocolGame::parseEnterGame(const InputMessagePtr& msg)
} }
} }
void ProtocolGame::parsePlayerHelpers(const InputMessagePtr& msg)
{
uint id = msg->getU32();
int helpers = msg->getU16();
CreaturePtr creature = g_map.getCreatureById(id);
if(creature)
g_game.processPlayerHelpers(helpers);
else
g_logger.traceError("could not get creature");
}
void ProtocolGame::parseGMActions(const InputMessagePtr& msg) void ProtocolGame::parseGMActions(const InputMessagePtr& msg)
{ {
std::vector<uint8> actions; std::vector<uint8> actions;