Protocol 8.40-.42 fixes, closes #272

This commit is contained in:
Sam 2013-12-04 16:01:51 +01:00
parent b9b9a32b83
commit 99500c9c91
4 changed files with 23 additions and 11 deletions

View File

@ -43,7 +43,7 @@ function init()
reasonsTextList = ruleViolationWindow:getChildById('reasonList') reasonsTextList = ruleViolationWindow:getChildById('reasonList')
actionsTextList = ruleViolationWindow:getChildById('actionList') actionsTextList = ruleViolationWindow:getChildById('actionList')
g_keyboard.bindKeyDown('Ctrl+Y', show) g_keyboard.bindKeyDown('Ctrl+Y', function() show() end)
if g_game.isOnline() then if g_game.isOnline() then
loadReasons() loadReasons()
@ -63,6 +63,7 @@ end
function loadReasons() function loadReasons()
reasonsTextList:destroyChildren() reasonsTextList:destroyChildren()
actionsTextList:destroyChildren()
local actions = g_game.getGMActions() local actions = g_game.getGMActions()
for reason, actionFlags in pairs(actions) do for reason, actionFlags in pairs(actions) do
@ -100,7 +101,7 @@ function onSelectReason(reasonLabel, focused)
if reasonLabel.actionFlags and focused then if reasonLabel.actionFlags and focused then
actionsTextList:destroyChildren() actionsTextList:destroyChildren()
for actionBaseFlag = 0, #rvactions do for actionBaseFlag = 0, #rvactions do
actionFlagString = rvactions[actionBaseFlag] local actionFlagString = rvactions[actionBaseFlag]
if bit32.band(reasonLabel.actionFlags, math.pow(2, actionBaseFlag)) > 0 then if bit32.band(reasonLabel.actionFlags, math.pow(2, actionBaseFlag)) > 0 then
local label = g_ui.createWidget('RVListLabel', actionsTextList) local label = g_ui.createWidget('RVListLabel', actionsTextList)
label:setText(actionFlagString) label:setText(actionFlagString)
@ -111,9 +112,21 @@ function onSelectReason(reasonLabel, focused)
end end
function report() function report()
local reasonLabel = reasonsTextList:getFocusedChild()
if not reasonLabel then
displayErrorBox(tr("Error"), tr("You must select a reason."))
return
end
local actionLabel = actionsTextList:getFocusedChild()
if not actionLabel then
displayErrorBox(tr("Error"), tr("You must select an action."))
return
end
local target = ruleViolationWindow:getChildById('nameText'):getText() local target = ruleViolationWindow:getChildById('nameText'):getText()
local reason = reasonsTextList:getFocusedChild().reasonId local reason = reasonLabel.reasonId
local action = actionsTextList:getFocusedChild().actionId local action = actionLabel.actionId
local comment = ruleViolationWindow:getChildById('commentText'):getText() local comment = ruleViolationWindow:getChildById('commentText'):getText()
local statement = ruleViolationWindow:getChildById('statementText'):getText() local statement = ruleViolationWindow:getChildById('statementText'):getText()
local statementId = 0 -- TODO: message unique id ? local statementId = 0 -- TODO: message unique id ?

View File

@ -1468,16 +1468,13 @@ void Game::setProtocolVersion(int version)
enableFeature(Otc::GameProtocolChecksum); enableFeature(Otc::GameProtocolChecksum);
enableFeature(Otc::GameChallengeOnLogin); enableFeature(Otc::GameChallengeOnLogin);
enableFeature(Otc::GameAccountNames); enableFeature(Otc::GameAccountNames);
enableFeature(Otc::GameDoubleFreeCapacity);
} }
if(version >= 780 && version <= 854) { // 780 might not be accurate if(version >= 780 && version <= 854) { // 780 might not be accurate
enableFeature(Otc::GameChargeableItems); enableFeature(Otc::GameChargeableItems);
} }
if(version >= 850) {
enableFeature(Otc::GameDoubleFreeCapacity);
}
if(version >= 854) { if(version >= 854) {
enableFeature(Otc::GameCreatureEmblems); enableFeature(Otc::GameCreatureEmblems);
} }

View File

@ -57,7 +57,7 @@ void buildMessageModesMap(int version) {
messageModesMap[Otc::MessageFailure] = 20; messageModesMap[Otc::MessageFailure] = 20;
messageModesMap[Otc::MessageBlue] = 21; messageModesMap[Otc::MessageBlue] = 21;
messageModesMap[Otc::MessageRed] = 22; messageModesMap[Otc::MessageRed] = 22;
} else if(version >= 850) { } else if(version >= 840) {
messageModesMap[Otc::MessageNone] = 0; messageModesMap[Otc::MessageNone] = 0;
messageModesMap[Otc::MessageSay] = 1; messageModesMap[Otc::MessageSay] = 1;
messageModesMap[Otc::MessageWhisper] = 2; messageModesMap[Otc::MessageWhisper] = 2;

View File

@ -407,7 +407,9 @@ void ProtocolGame::parseGMActions(const InputMessagePtr& msg)
int numViolationReasons; int numViolationReasons;
if(g_game.getProtocolVersion() >= 850) if(g_game.getProtocolVersion() >= 840)
numViolationReasons = 23;
else if(g_game.getProtocolVersion() >= 850)
numViolationReasons = 20; numViolationReasons = 20;
else else
numViolationReasons = 32; numViolationReasons = 32;
@ -557,7 +559,7 @@ void ProtocolGame::parseTileAddThing(const InputMessagePtr& msg)
Position pos = getPosition(msg); Position pos = getPosition(msg);
int stackPos = -1; int stackPos = -1;
if(g_game.getProtocolVersion() >= 850) if(g_game.getProtocolVersion() >= 841)
stackPos = msg->getU8(); stackPos = msg->getU8();
ThingPtr thing = getThing(msg); ThingPtr thing = getThing(msg);