Skip to main content
  1. Posts/

Day 65 - A couple of easy wins

OldDays seitan-spin drag-spin-exp cucumber

Advice.
Advice.

In which we write two trivial tests, fix a trivial bug, and call it a day.

DisplayCombatDamage
#

Ah, the modern desire for numbers popping up when we strike an enemy. Traditionally, IoK gave only adjectives: light, moderate, heavy, severe, and fatal.

On a per-player basis, combat damage display is controlled via a conference command, and you get a warning if it’s disabled via the config file. Easy enough to test:

features/config_file.feature
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
Scenario: DisplayCombatDamage True, I can enable combat damage display
  Given I use the "minimal" database
  And I set "DisplayCombatDamage" in the config file to "True"
  And the server is started
  When I log on using a standard account
  And I enter the chat
  And I issue the display combat damage command
  And I did not see a message telling me combat damage display was disabled

Scenario: DisplayCombatDamage False, I cannot enable combat damage display
  Given I use the "minimal" database
  And I set "DisplayCombatDamage" in the config file to "False"
  And the server is started
  When I log on using a standard account
  And I enter the chat
  And I issue the display combat damage command
  And I saw a message telling me combat damage display was disabled
31 scenarios (31 passed)
227 steps (227 passed)
5m44.004s

Next step: test it in-game.

Time to fix: “server code not set up to handle the type of ImpLevel”
#

The day number is a multiple of five, so let’s try to fix one of the little server bugs we’ve run across.

features/config_file.feature
62
63
64
65
66
67
68
69
70
71
72
73
# bug: server code not set up to handle the type of ImpLevel.
@bug
Scenario: APP_NAME used when trying to ignore a staff member
  Given I use the "minimal" database
  And I set "APP_NAME" in the config file to "Test Ignore Staff"
  And I ensure a developer account exists
  And the server executable is started
  And I allow time for the server to complete startup
  When I log on using a standard account
  And I enter the chat
  And I try to ignore the developer account
  Then I saw an ignore rejection with application name "Test Ignore Staff"

fails on trying to ignore the developer account:

And I try to ignore the developer account                                # features/steps/conference_steps.rb:2
  Sending /ignore dev01_name and waiting for /./...
  timed out while waiting for more data (Net::ReadTimeout)

and over in the server log we find: {SystemFailure} DBPlayer.getPlayerField(2, ImpLevel, DragonsSpine.Globals+eImpLevel) Unable to find DragonsSpine.Globals+eImpLevel in switch. which points us to

DragonsSpine/DAL/DBPlayer.cs
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
foreach (DataRow dr in dtPlayer.Rows)
{
  switch (objectType.ToString())
  {
    case "System.Int16":
      return Convert.ToInt16(dr[field]);
    case "System.Int32":
      return Convert.ToInt32(dr[field]);
    case "System.Int64":
      return Convert.ToInt64(dr[field]);
    case "System.String":
      return dr[field].ToString();
    case "System.Boolean":
      return Convert.ToBoolean(dr[field]);
    case "System.Char":
      return Convert.ToChar(dr[field]);
    case "System.DateTime":
      return Convert.ToDateTime(dr[field]);
    case "System.Double":
      return Convert.ToDouble(dr[field]);
    case "Character.SkillType":
      return dr[field].ToString();
    default:
      Utils.Log("DBPlayer.getPlayerField(" + playerID + ", " + field + ", " + objectType.ToString() + ") Unable to find " + objectType.ToString() + " in switch.", Utils.LogType.SystemFailure);
      break;

So can I just add “DragonsSpine.Globals+eImpLevel” and treat it as a 32-bit int?

DragonsSpine/DAL/DBPlayer.cs
72
73
74
75
76
77
78
    case "System.Int16":
      return Convert.ToInt16(dr[field]);
    case "DragonsSpine.Globals+eImpLevel":
    case "System.Int32":
      return Convert.ToInt32(dr[field]);
    case "System.Int64":
      return Convert.ToInt64(dr[field]);
And I try to ignore the developer account                                # features/steps/conference_steps.rb:2
  Sending /ignore dev01_name and waiting for /./...
  You are in Conference Room A.
  You are the only player present.
  Type /help for a list of commands.
  You cannot ignore a Test Ignore Staff staff member.

Apparently I can.

One bug down, many to go. Back to the testing. Tomorrow.


Useful Stuff
#


More to come
More to come

Day 65 code - tests

Day 65 code - server