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:
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"
PROTOCOL_STRINGS={SET_PROTOCOL:"\e98\e",VERSION_CLIENT:"\eV2\e",VERSION_CLIENT_END:"\eV3\e"}When(/^I send the protocol command "([^"]*)"$/)do|command|resp=telnet_command(@connection,PROTOCOL_STRINGS[command.to_sym],/.../)endThen(/^I receive a CLIENT_VERSION of "([^"]*)"$/)do|version|expectation=PROTOCOL_STRINGS[:VERSION_CLIENT]+version+PROTOCOL_STRINGS[:VERSION_CLIENT_END]expect(@last_resp).toinclude(expectation)end
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).toinclude(expectation)end