From dba03d69f6fac5310f2fa3690750c7fd07ce1653 Mon Sep 17 00:00:00 2001 From: Eduardo Bart Date: Wed, 11 Jan 2012 10:48:34 -0200 Subject: [PATCH] fix protocol 860 death, fix progress bar --- modules/core_widgets/uiprogressbar.lua | 7 +++++-- src/otclient/core/game.cpp | 1 + src/otclient/net/protocolgameparse.cpp | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/core_widgets/uiprogressbar.lua b/modules/core_widgets/uiprogressbar.lua index ff2ad0ba..404f50e3 100644 --- a/modules/core_widgets/uiprogressbar.lua +++ b/modules/core_widgets/uiprogressbar.lua @@ -4,13 +4,16 @@ function UIProgressBar.create() local progressbar = UIProgressBar.internalCreate() progressbar:setFocusable(false) progressbar:setPhantom(true) - progressbar.percent = 100 + progressbar.percent = 0 + progressbar:setBackgroundSize({width = 1, height = 1}) return progressbar end function UIProgressBar:setPercent(percent) self:setBackgroundHeight(self:getHeight()) - self:setBackgroundWidth((percent * self:getWidth())/100) + local width = (percent * self:getWidth())/100 + if width == 0 then width = 1 end + self:setBackgroundWidth(width) self.percent = percent end diff --git a/src/otclient/core/game.cpp b/src/otclient/core/game.cpp index 8c3e1777..3c750c91 100644 --- a/src/otclient/core/game.cpp +++ b/src/otclient/core/game.cpp @@ -66,6 +66,7 @@ void Game::processLoginError(const std::string& error) void Game::processConnectionError(const boost::system::error_code& error) { // connection errors only have meaning if we still have a protocol + dump << "disconnected: connection error = " << error.message(); if(m_protocolGame) { if(error != asio::error::eof) g_lua.callGlobalField("Game", "onConnectionError", error.message()); diff --git a/src/otclient/net/protocolgameparse.cpp b/src/otclient/net/protocolgameparse.cpp index 7e8b2607..893fc1d6 100644 --- a/src/otclient/net/protocolgameparse.cpp +++ b/src/otclient/net/protocolgameparse.cpp @@ -307,7 +307,9 @@ void ProtocolGame::parsePing(InputMessage&) void ProtocolGame::parseDeath(InputMessage& msg) { +#if PROTOCOL==862 msg.getU8(); // 100 is a fair death. < 100 is a unfair death. +#endif g_game.processDeath(); }