diff --git a/modules/client_entergame/characterlist.lua b/modules/client_entergame/characterlist.lua index 586f254f..df51596f 100644 --- a/modules/client_entergame/characterlist.lua +++ b/modules/client_entergame/characterlist.lua @@ -111,7 +111,8 @@ end function onGameConnectionError(message, code) CharacterList.destroyLoadBox() - errorBox = displayErrorBox(tr("Connection Error"), message) + local text = tr('Your connection has been lost. (err: %d)', code) + errorBox = displayErrorBox(tr("Connection Error"), text) errorBox.onOk = function() errorBox = nil CharacterList.showAgain() diff --git a/modules/gamelib/protocollogin.lua b/modules/gamelib/protocollogin.lua index 065c6a15..61f2be78 100644 --- a/modules/gamelib/protocollogin.lua +++ b/modules/gamelib/protocollogin.lua @@ -10,7 +10,7 @@ LoginServerExtendedCharacterList = 101 function ProtocolLogin:login(host, port, accountName, accountPassword) if string.len(host) == 0 or port == nil or port == 0 then - signalcall(self.onError, self, tr("You must enter a valid server address and port.")) + signalcall(self.onLoginError, self, tr("You must enter a valid server address and port.")) return end @@ -96,7 +96,7 @@ function ProtocolLogin:onRecv(msg) elseif opcode == LoginServerMotd then self:parseMotd(msg) elseif opcode == LoginServerUpdateNeeded then - signalcall(self.onError, self, tr("Client needs update.")) + signalcall(self.onLoginError, self, tr("Client needs update.")) elseif opcode == LoginServerCharacterList then self:parseCharacterList(msg) elseif opcode == LoginServerExtendedCharacterList then @@ -113,7 +113,7 @@ end function ProtocolLogin:parseError(msg) local errorMessage = msg:getString() - signalcall(self.onError, self, errorMessage) + signalcall(self.onLoginError, self, errorMessage) end function ProtocolLogin:parseMotd(msg) @@ -153,3 +153,8 @@ end function ProtocolLogin:parseOpcode(opcode, msg) signalcall(self.onOpcode, self, opcode, msg) end + +function ProtocolLogin:onError(msg, code) + local text = tr('Your connection has been lost. (err: %d)', code) + signalcall(self.onLoginError, self, opcode, text) +end \ No newline at end of file diff --git a/src/client/protocolgameparse.cpp b/src/client/protocolgameparse.cpp index 4b0a4716..b6950cdd 100644 --- a/src/client/protocolgameparse.cpp +++ b/src/client/protocolgameparse.cpp @@ -763,8 +763,10 @@ void ProtocolGame::parseMagicEffect(const InputMessagePtr& msg) else effectId = msg->getU8(); - if(!g_things.isValidDatId(effectId, ThingCategoryEffect)) - g_logger.traceError("invalid effect id"); + if(!g_things.isValidDatId(effectId, ThingCategoryEffect)) { + g_logger.traceError(stdext::format("invalid effect id %d", effectId)); + return; + } EffectPtr effect = EffectPtr(new Effect()); effect->setId(effectId); @@ -789,8 +791,10 @@ void ProtocolGame::parseDistanceMissile(const InputMessagePtr& msg) Position toPos = getPosition(msg); int shotId = msg->getU8(); - if(!g_things.isValidDatId(shotId, ThingCategoryMissile)) - g_logger.traceError("invalid effect id"); + if(!g_things.isValidDatId(shotId, ThingCategoryMissile)) { + g_logger.traceError(stdext::format("invalid missile id %d", shotId)); + return; + } MissilePtr missile = MissilePtr(new Missile()); missile->setId(shotId); @@ -1648,8 +1652,10 @@ Outfit ProtocolGame::getOutfit(const InputMessagePtr& msg) int feet = msg->getU8(); int addons = msg->getU8(); - if(!g_things.isValidDatId(lookType, ThingCategoryCreature)) + if(!g_things.isValidDatId(lookType, ThingCategoryCreature)) { + g_logger.traceError(stdext::format("invalid outfit looktype %d", lookType)); lookType = 0; + } outfit.setId(lookType); outfit.setHead(head); @@ -1665,8 +1671,10 @@ Outfit ProtocolGame::getOutfit(const InputMessagePtr& msg) outfit.setAuxId(13); // invisible effect id } else { - if(!g_things.isValidDatId(lookTypeEx, ThingCategoryItem)) + if(!g_things.isValidDatId(lookTypeEx, ThingCategoryItem)) { + g_logger.traceError(stdext::format("invalid outfit looktypeex %d", lookTypeEx)); lookTypeEx = 0; + } outfit.setCategory(ThingCategoryItem); outfit.setAuxId(lookTypeEx); }