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')
actionsTextList = ruleViolationWindow:getChildById('actionList')
g_keyboard.bindKeyDown('Ctrl+Y', show)
g_keyboard.bindKeyDown('Ctrl+Y', function() show() end)
if g_game.isOnline() then
loadReasons()
@ -63,6 +63,7 @@ end
function loadReasons()
reasonsTextList:destroyChildren()
actionsTextList:destroyChildren()
local actions = g_game.getGMActions()
for reason, actionFlags in pairs(actions) do
@ -100,7 +101,7 @@ function onSelectReason(reasonLabel, focused)
if reasonLabel.actionFlags and focused then
actionsTextList:destroyChildren()
for actionBaseFlag = 0, #rvactions do
actionFlagString = rvactions[actionBaseFlag]
local actionFlagString = rvactions[actionBaseFlag]
if bit32.band(reasonLabel.actionFlags, math.pow(2, actionBaseFlag)) > 0 then
local label = g_ui.createWidget('RVListLabel', actionsTextList)
label:setText(actionFlagString)
@ -111,9 +112,21 @@ function onSelectReason(reasonLabel, focused)
end
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 reason = reasonsTextList:getFocusedChild().reasonId
local action = actionsTextList:getFocusedChild().actionId
local reason = reasonLabel.reasonId
local action = actionLabel.actionId
local comment = ruleViolationWindow:getChildById('commentText'):getText()
local statement = ruleViolationWindow:getChildById('statementText'):getText()
local statementId = 0 -- TODO: message unique id ?

View File

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

View File

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

View File

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