Change network errors message

This commit is contained in:
Eduardo Bart 2013-02-21 17:31:47 -03:00
parent 90d2032e9e
commit 5b573afdfc
3 changed files with 24 additions and 10 deletions

View File

@ -111,7 +111,8 @@ end
function onGameConnectionError(message, code) function onGameConnectionError(message, code)
CharacterList.destroyLoadBox() 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.onOk = function()
errorBox = nil errorBox = nil
CharacterList.showAgain() CharacterList.showAgain()

View File

@ -10,7 +10,7 @@ LoginServerExtendedCharacterList = 101
function ProtocolLogin:login(host, port, accountName, accountPassword) function ProtocolLogin:login(host, port, accountName, accountPassword)
if string.len(host) == 0 or port == nil or port == 0 then 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 return
end end
@ -96,7 +96,7 @@ function ProtocolLogin:onRecv(msg)
elseif opcode == LoginServerMotd then elseif opcode == LoginServerMotd then
self:parseMotd(msg) self:parseMotd(msg)
elseif opcode == LoginServerUpdateNeeded then elseif opcode == LoginServerUpdateNeeded then
signalcall(self.onError, self, tr("Client needs update.")) signalcall(self.onLoginError, self, tr("Client needs update."))
elseif opcode == LoginServerCharacterList then elseif opcode == LoginServerCharacterList then
self:parseCharacterList(msg) self:parseCharacterList(msg)
elseif opcode == LoginServerExtendedCharacterList then elseif opcode == LoginServerExtendedCharacterList then
@ -113,7 +113,7 @@ end
function ProtocolLogin:parseError(msg) function ProtocolLogin:parseError(msg)
local errorMessage = msg:getString() local errorMessage = msg:getString()
signalcall(self.onError, self, errorMessage) signalcall(self.onLoginError, self, errorMessage)
end end
function ProtocolLogin:parseMotd(msg) function ProtocolLogin:parseMotd(msg)
@ -153,3 +153,8 @@ end
function ProtocolLogin:parseOpcode(opcode, msg) function ProtocolLogin:parseOpcode(opcode, msg)
signalcall(self.onOpcode, self, opcode, msg) signalcall(self.onOpcode, self, opcode, msg)
end end
function ProtocolLogin:onError(msg, code)
local text = tr('Your connection has been lost. (err: %d)', code)
signalcall(self.onLoginError, self, opcode, text)
end

View File

@ -763,8 +763,10 @@ void ProtocolGame::parseMagicEffect(const InputMessagePtr& msg)
else else
effectId = msg->getU8(); effectId = msg->getU8();
if(!g_things.isValidDatId(effectId, ThingCategoryEffect)) if(!g_things.isValidDatId(effectId, ThingCategoryEffect)) {
g_logger.traceError("invalid effect id"); g_logger.traceError(stdext::format("invalid effect id %d", effectId));
return;
}
EffectPtr effect = EffectPtr(new Effect()); EffectPtr effect = EffectPtr(new Effect());
effect->setId(effectId); effect->setId(effectId);
@ -789,8 +791,10 @@ void ProtocolGame::parseDistanceMissile(const InputMessagePtr& msg)
Position toPos = getPosition(msg); Position toPos = getPosition(msg);
int shotId = msg->getU8(); int shotId = msg->getU8();
if(!g_things.isValidDatId(shotId, ThingCategoryMissile)) if(!g_things.isValidDatId(shotId, ThingCategoryMissile)) {
g_logger.traceError("invalid effect id"); g_logger.traceError(stdext::format("invalid missile id %d", shotId));
return;
}
MissilePtr missile = MissilePtr(new Missile()); MissilePtr missile = MissilePtr(new Missile());
missile->setId(shotId); missile->setId(shotId);
@ -1648,8 +1652,10 @@ Outfit ProtocolGame::getOutfit(const InputMessagePtr& msg)
int feet = msg->getU8(); int feet = msg->getU8();
int addons = 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; lookType = 0;
}
outfit.setId(lookType); outfit.setId(lookType);
outfit.setHead(head); outfit.setHead(head);
@ -1665,8 +1671,10 @@ Outfit ProtocolGame::getOutfit(const InputMessagePtr& msg)
outfit.setAuxId(13); // invisible effect id outfit.setAuxId(13); // invisible effect id
} }
else { 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; lookTypeEx = 0;
}
outfit.setCategory(ThingCategoryItem); outfit.setCategory(ThingCategoryItem);
outfit.setAuxId(lookTypeEx); outfit.setAuxId(lookTypeEx);
} }