In which we learn the binary language of moisture vaporators.
Note: Due to
a bit of a situation at work, I’m suddenly very
busy again. Rather than lose what little momentum exists, I’ll be doing shorter posts.
Test Every Day
CLIENT_VERSION
Let’s keep striking away at that config file. One we skipped earlier is the CLIENT_VERSION. It
appears to be used in only one place, where it is simply communicated to the client along with the
APP_VERSION:
As might be clear, this is using a custom protocol rather than simple ANSI. So we’ll need to figure
out how to connect using this protocol (you can see why I initially skipped this part).
sendWorldVersion is called by PrintMainMenu if the character’s protocol is equal to
APP_PROTOCOL (also from the config file, and defaulted to “Kesmai” in the original code repo).
So how is the character’s protocol determined? It defaults to “normal” and can be swapped between
“normal” and “old-kesmai” at the menu, that’s easy enough to find. But the only place I see it
being set to anything else is in Protocol.CheckMenuCommand:
#region Set Protocol
if (command == SET_PROTOCOL)
{
ch.protocol = DragonsSpineMain.APP_PROTOCOL;
Menu.PrintMainMenu(ch);
returntrue;
}
#endregion
Earlier on, we see SET_PROTOCOL = (char)27 + "98" + (char)27, so it seems that this particular
escape sequence being sent at any menu will do the trick. I’ll assume that a custom client
application just knows to do this itself.
Scenario: CLIENT_VERSION sent at main menu
Given I use the "minimal" database as-is
And I set "CLIENT_VERSION" in the config file to "25.6.2.4"
And the server is started
When I log on using a standard account
And I send the protocol command "SET_PROTOCOL"
Then I receive a CLIENT_VERSION of "25.6.2.4"
Scenario: NEWS included in WorldInformation
Given I use the "minimal" database as-is
And I set "NEWS" in the config file to "This is a test, do not be alarmed."
And the server is started
When I log on using a standard account
And I send the protocol command "SET_PROTOCOL"
Then I receive a NEWS of "This is a test, do not be alarmed."
Then(/^I receive a NEWS of "([^"]*)"$/) do|news|
expectation =PROTOCOL_STRINGS[:NEWS]+
news +PROTOCOL_STRINGS[:NEWS_END]
expect(@last_resp).to include(expectation)
end