| 1 |
Public Class clsTask |
| 2 |
Inherits clsItem |
| 3 |
|
| 4 |
Friend arlCommands As New StringArrayList |
| 5 |
Private bRepeatable As Boolean |
| 6 |
Friend Property ContinueToExecuteLowerPriority As Boolean ' Multiple Matching |
| 7 |
Friend arlRestrictions As New RestrictionArrayList |
| 8 |
Friend arlActions As New ActionArrayList |
| 9 |
Private sTriedAgainMessage As String |
| 10 |
Private sDescription As String |
| 11 |
Public Enum BeforeAfterEnum |
| 12 |
Before |
| 13 |
After |
| 14 |
End Enum |
| 15 |
Public eDisplayCompletion As BeforeAfterEnum = BeforeAfterEnum.After |
| 16 |
Public Enum TaskTypeEnum |
| 17 |
General |
| 18 |
Specific |
| 19 |
System |
| 20 |
End Enum |
| 21 |
Public TaskType As TaskTypeEnum |
| 22 |
Private iPriority As Integer |
| 23 |
Private iAutoFillPriority As Integer |
| 24 |
Private oFailOverride As Description |
| 25 |
Public LowPriority As Boolean |
| 26 |
Public Scored As Boolean |
| 27 |
Public ReplaceDuplicateKey As Boolean |
| 28 |
Public PreventOverriding As Boolean |
| 29 |
Public bSystemTask As Boolean |
| 30 |
|
| 31 |
Private _RegExs As List(Of System.Text.RegularExpressions.Regex)() |
| 32 |
Public ReadOnly Property RegExs As List(Of System.Text.RegularExpressions.Regex)() |
| 33 |
Get |
| 34 |
If _RegExs Is Nothing Then |
| 35 |
ReDim _RegExs(arlCommands.Count - 1) |
| 36 |
'For Each sCommand As String In arlCommands |
| 37 |
For iCom As Integer = 0 To arlCommands.Count - 1 |
| 38 |
Dim sCommand As String = arlCommands(iCom) |
| 39 |
_RegExs(iCom) = New List(Of System.Text.RegularExpressions.Regex) |
| 40 |
For Each regex As System.Text.RegularExpressions.Regex In UserSession.GetRegularExpression(sCommand, "", False) |
| 41 |
_RegExs(iCom).Add(regex) |
| 42 |
Next |
| 43 |
Next |
| 44 |
End If |
| 45 |
|
| 46 |
Return _RegExs |
| 47 |
End Get |
| 48 |
End Property |
| 49 |
|
| 50 |
' Want |
| 51 |
' Specific Text + Parent Text, specific actions, parent actions - Before* (text+actions) |
| 52 |
' Specific Text, specific actions, parent actions - Before (actions) |
| 53 |
|
| 54 |
' Specific Text + Parent Text, specific actions - Before (text) |
| 55 |
' Specific Text, specific actions - Override* |
| 56 |
' Parent Text + Specific Text, specific actions - After (text) |
| 57 |
|
| 58 |
' Specific Text, parent actions, specific actions - After (actions) |
| 59 |
' Parent Text + Specific Text, parent actions, specific actions - After (text+actions) |
| 60 |
|
| 61 |
|
| 62 |
' Old |
| 63 |
' Parent with text, Specific with text, Execute parent action => Specific text, specific actions, parent actions |
| 64 |
' Parent with text, Specific without text, Execute parent action => Parent text, specific actions, parent actions |
| 65 |
' Parent with text, Specific with text, No parent action => Specific text, specific actions |
| 66 |
' Parent with text, Specific without text, No parent action => Parent text, specific actions |
| 67 |
|
| 68 |
Public Enum SpecificOverrideTypeEnum |
| 69 |
BeforeTextAndActions |
| 70 |
BeforeActionsOnly |
| 71 |
BeforeTextOnly |
| 72 |
Override |
| 73 |
AfterTextOnly |
| 74 |
AfterActionsOnly |
| 75 |
AfterTextAndActions |
| 76 |
End Enum |
| 77 |
Public SpecificOverrideType As SpecificOverrideTypeEnum = SpecificOverrideTypeEnum.Override |
| 78 |
|
| 79 |
Private bRunImmediately As Boolean = False |
| 80 |
Public Property RunImmediately() As Boolean |
| 81 |
Get |
| 82 |
Return TaskType = TaskTypeEnum.System AndAlso bRunImmediately |
| 83 |
End Get |
| 84 |
Set(ByVal value As Boolean) |
| 85 |
bRunImmediately = value |
| 86 |
End Set |
| 87 |
End Property |
| 88 |
|
| 89 |
Public Property LocationTrigger As String = "" |
| 90 |
Public Property Completed() As Boolean |
| 91 |
|
| 92 |
Friend Class Specific |
| 93 |
Public Type As ReferencesType |
| 94 |
Public Multiple As Boolean |
| 95 |
Public Keys As New StringArrayList |
| 96 |
|
| 97 |
Public Function List() As String |
| 98 |
|
| 99 |
Dim sList As String = "" |
| 100 |
|
| 101 |
If Not Keys Is Nothing AndAlso Keys.Count > 0 Then |
| 102 |
For i As Integer = 0 To Keys.Count - 1 |
| 103 |
Select Case Type |
| 104 |
Case ReferencesType.Direction |
| 105 |
If Keys(i) <> "" Then sList &= DirectionName(CType([Enum].Parse(GetType(DirectionsEnum), Keys(i)), DirectionsEnum)) |
| 106 |
Case Else |
| 107 |
sList &= Adventure.GetNameFromKey(Keys(i), False, False) |
| 108 |
End Select |
| 109 |
If i + 2 < Keys.Count Then sList &= ", " |
| 110 |
If i + 2 = Keys.Count Then sList &= " and " |
| 111 |
Next |
| 112 |
End If |
| 113 |
|
| 114 |
Return sList |
| 115 |
|
| 116 |
End Function |
| 117 |
|
| 118 |
Public Function Clone() As Specific |
| 119 |
Dim spec As New Specific |
| 120 |
|
| 121 |
spec.Type = Type |
| 122 |
spec.Multiple = Multiple |
| 123 |
spec.Keys = Keys.Clone |
| 124 |
|
| 125 |
Return spec |
| 126 |
End Function |
| 127 |
|
| 128 |
End Class |
| 129 |
Friend Specifics() As Specific |
| 130 |
Public GeneralKey As String |
| 131 |
|
| 132 |
Public Property Description() As String |
| 133 |
Get |
| 134 |
If sDescription <> "" Then |
| 135 |
Return sDescription |
| 136 |
ElseIf arlCommands.Count > 0 Then |
| 137 |
Return arlCommands(0) |
| 138 |
Else |
| 139 |
Return Key |
| 140 |
End If |
| 141 |
End Get |
| 142 |
Set(ByVal Value As String) |
| 143 |
sDescription = Value |
| 144 |
End Set |
| 145 |
End Property |
| 146 |
|
| 147 |
|
| 148 |
Dim iHasReferences As Integer = -1 |
| 149 |
Public ReadOnly Property HasReferences() As Boolean |
| 150 |
Get |
| 151 |
If iHasReferences > -1 Then Return CBool(IIf(iHasReferences = 0, False, True)) |
| 152 |
For Each sRef As String In ReferenceNames() |
| 153 |
For Each sCommand As String In Me.arlCommands |
| 154 |
If sCommand.Contains(sRef) Then |
| 155 |
iHasReferences = 1 |
| 156 |
Return True |
| 157 |
End If |
| 158 |
Next |
| 159 |
Next |
| 160 |
iHasReferences = 0 |
| 161 |
Return False |
| 162 |
End Get |
| 163 |
End Property |
| 164 |
|
| 165 |
Friend ReadOnly Property MakeNice() As String |
| 166 |
Get |
| 167 |
' Makes things like "[get/take] {the} %object% {from {the/a {green}} box}" into "get the %object% from the box" |
| 168 |
|
| 169 |
Dim iLevel As Integer = 0 |
| 170 |
Dim bIgnore() As Boolean |
| 171 |
Dim sText As String = Me.TaskCommand(Me) ' Me.arlCommands(0) |
| 172 |
|
| 173 |
ReDim bIgnore(0) |
| 174 |
bIgnore(0) = False |
| 175 |
MakeNice = Nothing |
| 176 |
|
| 177 |
For i As Integer = 0 To sText.Length - 1 |
| 178 |
Select Case sText.Substring(i, 1) |
| 179 |
Case "[", "{" |
| 180 |
iLevel += 1 |
| 181 |
ReDim Preserve bIgnore(iLevel) |
| 182 |
bIgnore(iLevel) = bIgnore(iLevel - 1) |
| 183 |
Case "]", "}" |
| 184 |
iLevel -= 1 |
| 185 |
Case "/" |
| 186 |
bIgnore(iLevel) = True |
| 187 |
Case Else |
| 188 |
If Not bIgnore(iLevel) Then MakeNice &= sText.Substring(i, 1) |
| 189 |
End Select |
| 190 |
Next |
| 191 |
|
| 192 |
MakeNice = MakeNice.Replace(" * ", " ").Replace("* ", " ").Replace(" *", " ") |
| 193 |
|
| 194 |
End Get |
| 195 |
End Property |
| 196 |
|
| 197 |
Friend Function RefsInCommand(ByVal sCommand As String) As StringArrayList |
| 198 |
|
| 199 |
Dim arlRefs As New StringArrayList |
| 200 |
|
| 201 |
For Each sSection As String In sCommand.Split("%"c) |
| 202 |
For Each sRef As String In ReferenceNames() |
| 203 |
If "%" & sSection & "%" = sRef Then |
| 204 |
arlRefs.Add(sRef) |
| 205 |
Exit For |
| 206 |
End If |
| 207 |
Next |
| 208 |
Next |
| 209 |
|
| 210 |
Return arlRefs |
| 211 |
|
| 212 |
End Function |
| 213 |
|
| 214 |
Friend ReadOnly Property References() As StringArrayList |
| 215 |
Get |
| 216 |
Return RefsInCommand(TaskCommand(Me, False)) |
| 217 |
End Get |
| 218 |
End Property |
| 219 |
|
| 220 |
Public Function TaskCommand(ByVal task As clsTask, Optional ByVal bReplaceSpecifics As Boolean = True, Optional ByVal iMatchedTask As Integer = -1) As String |
| 221 |
|
| 222 |
Dim sTaskCommand As String = "" |
| 223 |
Dim iMatchedTaskCommand As Integer = 0 |
| 224 |
If iMatchedTask = -1 Then iMatchedTaskCommand = UserSession.iMatchedTaskCommand |
| 225 |
|
| 226 |
Select Case task.TaskType |
| 227 |
Case TaskTypeEnum.General |
| 228 |
Dim iRefsCount As Integer = 0 |
| 229 |
If task.arlCommands.Count = 0 Then |
| 230 |
ErrMsg("Error, general task """ & sDescription & """ has no commands!") |
| 231 |
Return "" |
| 232 |
End If |
| 233 |
If task.arlCommands.Count > iMatchedTaskCommand Then |
| 234 |
sTaskCommand = task.arlCommands(iMatchedTaskCommand) |
| 235 |
Else |
| 236 |
sTaskCommand = task.arlCommands(0) |
| 237 |
End If |
| 238 |
If RefsInCommand(sTaskCommand).Count > iRefsCount Then ' Need to make sure we're checking against the command we matched on |
| 239 |
iRefsCount = RefsInCommand(sTaskCommand).Count |
| 240 |
End If |
| 241 |
' Some v4 games may not have same no. of refs on each line, so if any other lines have more, use that instead |
| 242 |
For Each sCommand As String In task.arlCommands |
| 243 |
If RefsInCommand(sCommand).Count > iRefsCount Then |
| 244 |
iRefsCount = RefsInCommand(sCommand).Count |
| 245 |
sTaskCommand = sCommand |
| 246 |
End If |
| 247 |
Next |
| 248 |
|
| 249 |
Case TaskTypeEnum.Specific |
| 250 |
sTaskCommand = TaskCommand(Adventure.htblTasks(task.GeneralKey), bReplaceSpecifics) |
| 251 |
If bReplaceSpecifics Then |
| 252 |
' Replace any Specifics from this key |
| 253 |
For iSpec As Integer = 0 To Specifics.Length - 1 |
| 254 |
If Specifics(iSpec).Keys.Count = 0 OrElse (Specifics(iSpec).Keys.Count = 1 AndAlso Specifics(iSpec).Keys(0) = "") Then |
| 255 |
' Allow, as it's passing thru the parent as a reference |
| 256 |
Else |
| 257 |
' Replace the parent task %object% with our specific key |
| 258 |
sTaskCommand = sTaskCommand.Replace(Me.References(iSpec), Specifics(iSpec).List) |
| 259 |
End If |
| 260 |
Next |
| 261 |
End If |
| 262 |
Case TaskTypeEnum.System |
| 263 |
sTaskCommand = "" |
| 264 |
End Select |
| 265 |
|
| 266 |
Return sTaskCommand |
| 267 |
|
| 268 |
End Function |
| 269 |
|
| 270 |
Friend Property CompletionMessage() As Description |
| 271 |
|
| 272 |
Friend Property FailOverride() As Description |
| 273 |
Get |
| 274 |
Return oFailOverride |
| 275 |
End Get |
| 276 |
Set(ByVal value As Description) |
| 277 |
oFailOverride = value |
| 278 |
End Set |
| 279 |
End Property |
| 280 |
|
| 281 |
Public Property Priority() As Integer |
| 282 |
Get |
| 283 |
Return iPriority |
| 284 |
End Get |
| 285 |
Set(ByVal Value As Integer) |
| 286 |
iPriority = Value |
| 287 |
' TODO - rejig all the other priorities to insert this one |
| 288 |
End Set |
| 289 |
End Property |
| 290 |
|
| 291 |
Public Property AutoFillPriority() As Integer |
| 292 |
Get |
| 293 |
Return iAutoFillPriority |
| 294 |
End Get |
| 295 |
Set(ByVal value As Integer) |
| 296 |
iAutoFillPriority = value |
| 297 |
End Set |
| 298 |
End Property |
| 299 |
|
| 300 |
Public Property TriedAgainMessage() As String |
| 301 |
Get |
| 302 |
Return sTriedAgainMessage |
| 303 |
End Get |
| 304 |
Set(ByVal Value As String) |
| 305 |
sTriedAgainMessage = Value |
| 306 |
End Set |
| 307 |
End Property |
| 308 |
|
| 309 |
Public Property Repeatable() As Boolean |
| 310 |
Get |
| 311 |
Return bRepeatable |
| 312 |
End Get |
| 313 |
Set(ByVal Value As Boolean) |
| 314 |
bRepeatable = Value |
| 315 |
End Set |
| 316 |
End Property |
| 317 |
|
| 318 |
Public Property AggregateOutput As Boolean = True |
| 319 |
|
| 320 |
Public Sub New() |
| 321 |
CompletionMessage = New Description |
| 322 |
oFailOverride = New Description |
| 323 |
|
| 324 |
ContinueToExecuteLowerPriority = False |
| 325 |
Me.iAutoFillPriority = 10 |
| 326 |
End Sub |
| 327 |
|
| 328 |
Private Class TaskPrioritySortComparer |
| 329 |
Implements System.Collections.Generic.IComparer(Of String) |
| 330 |
|
| 331 |
Public Function Compare(x As String, y As String) As Integer Implements System.Collections.Generic.IComparer(Of String).Compare |
| 332 |
Return Adventure.htblTasks(x).Priority.CompareTo(Adventure.htblTasks(y).Priority) |
| 333 |
End Function |
| 334 |
End Class |
| 335 |
|
| 336 |
Friend ReadOnly Property Children(Optional ByVal bIncludeCompleted As Boolean = False) As StringArrayList |
| 337 |
Get |
| 338 |
Dim sal As New StringArrayList |
| 339 |
|
| 340 |
For Each tas As clsTask In Adventure.Tasks(clsAdventure.TasksListEnum.SpecificTasks).Values |
| 341 |
If tas.GeneralKey = Me.Key AndAlso (bIncludeCompleted OrElse Not tas.Completed OrElse tas.Repeatable) Then sal.Add(tas.Key) |
| 342 |
Next |
| 343 |
sal.Sort(New TaskPrioritySortComparer) |
| 344 |
|
| 345 |
Return sal |
| 346 |
End Get |
| 347 |
End Property |
| 348 |
|
| 349 |
Public ReadOnly Property Parent() As String |
| 350 |
Get |
| 351 |
Return Me.GeneralKey |
| 352 |
End Get |
| 353 |
End Property |
| 354 |
|
| 355 |
Public Function IsCompleteable() As Boolean |
| 356 |
Return UserSession.PassRestrictions(Me.arlRestrictions, True, Me) |
| 357 |
Return True ' Hmmm... |
| 358 |
End Function |
| 359 |
|
| 360 |
Friend NewReferences() As clsNewReference |
| 361 |
Friend NewReferencesWorking() As clsNewReference |
| 362 |
|
| 363 |
Friend Function CopyNewRefs(ByVal OriginalRefs() As clsNewReference) As clsNewReference() |
| 364 |
|
| 365 |
If OriginalRefs Is Nothing Then Return Nothing |
| 366 |
|
| 367 |
Dim NewRefCopy(OriginalRefs.Length - 1) As clsNewReference |
| 368 |
|
| 369 |
For iRef As Integer = 0 To OriginalRefs.Length - 1 |
| 370 |
If OriginalRefs(iRef) IsNot Nothing Then |
| 371 |
Dim nr As New clsNewReference(OriginalRefs(iRef).ReferenceType) |
| 372 |
For iItem As Integer = 0 To OriginalRefs(iRef).Items.Count - 1 |
| 373 |
Dim itm As New clsSingleItem |
| 374 |
itm.MatchingPossibilities = OriginalRefs(iRef).Items(iItem).MatchingPossibilities.Clone |
| 375 |
itm.bExplicitlyMentioned = OriginalRefs(iRef).Items(iItem).bExplicitlyMentioned |
| 376 |
itm.sCommandReference = OriginalRefs(iRef).Items(iItem).sCommandReference |
| 377 |
nr.Items.Add(itm) |
| 378 |
Next |
| 379 |
nr.Index = OriginalRefs(iRef).Index |
| 380 |
nr.ReferenceMatch = OriginalRefs(iRef).ReferenceMatch |
| 381 |
NewRefCopy(iRef) = nr |
| 382 |
End If |
| 383 |
Next |
| 384 |
Return NewRefCopy |
| 385 |
End Function |
| 386 |
|
| 387 |
Public Function HasObjectExistRestriction() As Boolean |
| 388 |
Static bChecked As Boolean = False |
| 389 |
Static bResult As Boolean = False |
| 390 |
|
| 391 |
If Not bChecked Then |
| 392 |
For Each rest As clsRestriction In Me.arlRestrictions |
| 393 |
If rest.eType = clsRestriction.RestrictionTypeEnum.Object AndAlso rest.eObject = clsRestriction.ObjectEnum.Exist Then |
| 394 |
bResult = True |
| 395 |
Exit For |
| 396 |
End If |
| 397 |
Next |
| 398 |
bChecked = True |
| 399 |
Return bResult |
| 400 |
Else |
| 401 |
Return bResult |
| 402 |
End If |
| 403 |
End Function |
| 404 |
|
| 405 |
Public Function HasCharacterExistRestriction() As Boolean |
| 406 |
Static bChecked As Boolean = False |
| 407 |
Static bResult As Boolean = False |
| 408 |
|
| 409 |
If Not bChecked Then |
| 410 |
For Each rest As clsRestriction In Me.arlRestrictions |
| 411 |
If rest.eType = clsRestriction.RestrictionTypeEnum.Character AndAlso rest.eCharacter = clsRestriction.CharacterEnum.Exist Then |
| 412 |
bResult = True |
| 413 |
Exit For |
| 414 |
End If |
| 415 |
Next |
| 416 |
bChecked = True |
| 417 |
Return bResult |
| 418 |
Else |
| 419 |
Return bResult |
| 420 |
End If |
| 421 |
End Function |
| 422 |
|
| 423 |
Public Function HasLocationExistRestriction() As Boolean |
| 424 |
Static bChecked As Boolean = False |
| 425 |
Static bResult As Boolean = False |
| 426 |
|
| 427 |
If Not bChecked Then |
| 428 |
For Each rest As clsRestriction In Me.arlRestrictions |
| 429 |
If rest.eType = clsRestriction.RestrictionTypeEnum.Location AndAlso rest.eLocation = clsRestriction.LocationEnum.Exist Then |
| 430 |
bResult = True |
| 431 |
Exit For |
| 432 |
End If |
| 433 |
Next |
| 434 |
bChecked = True |
| 435 |
Return bResult |
| 436 |
Else |
| 437 |
Return bResult |
| 438 |
End If |
| 439 |
End Function |
| 440 |
|
| 441 |
Public Overrides ReadOnly Property Clone() As clsItem |
| 442 |
Get |
| 443 |
Dim tas As clsTask = CType(Me.MemberwiseClone, clsTask) |
| 444 |
tas.arlCommands = tas.arlCommands.Clone |
| 445 |
tas.arlRestrictions = tas.arlRestrictions.Copy |
| 446 |
tas.arlActions = tas.arlActions.Copy |
| 447 |
If Specifics IsNot Nothing Then |
| 448 |
ReDim tas.Specifics(Specifics.Length - 1) |
| 449 |
For i As Integer = 0 To tas.Specifics.Length - 1 |
| 450 |
tas.Specifics(i) = Specifics(i).Clone |
| 451 |
Next |
| 452 |
End If |
| 453 |
Return tas |
| 454 |
End Get |
| 455 |
End Property |
| 456 |
|
| 457 |
Public Overrides ReadOnly Property CommonName() As String |
| 458 |
Get |
| 459 |
Return Description |
| 460 |
End Get |
| 461 |
End Property |
| 462 |
|
| 463 |
Friend Overrides ReadOnly Property AllDescriptions() As System.Collections.Generic.List(Of SharedModule.Description) |
| 464 |
Get |
| 465 |
Dim all As New Generic.List(Of Description) |
| 466 |
For Each r As clsRestriction In Me.arlRestrictions |
| 467 |
all.Add(r.oMessage) |
| 468 |
Next |
| 469 |
all.Add(Me.CompletionMessage) |
| 470 |
all.Add(Me.FailOverride) |
| 471 |
Return all |
| 472 |
End Get |
| 473 |
End Property |
| 474 |
|
| 475 |
Friend Overrides Function FindStringLocal(sSearchString As String, Optional sReplace As String = Nothing, Optional bFindAll As Boolean = True, Optional ByRef iReplacements As Integer = 0) As Object |
| 476 |
Dim iCount As Integer = iReplacements |
| 477 |
iReplacements += MyBase.FindStringInStringProperty(Me.sDescription, sSearchString, sReplace, bFindAll) |
| 478 |
Return iReplacements - iCount |
| 479 |
End Function |
| 480 |
|
| 481 |
Public Overrides Function ReferencesKey(ByVal sKey As String) As Integer |
| 482 |
Dim iCount As Integer = 0 |
| 483 |
iCount += arlRestrictions.ReferencesKey(sKey) |
| 484 |
iCount += arlActions.ReferencesKey(sKey) |
| 485 |
For Each d As Description In AllDescriptions |
| 486 |
iCount += d.ReferencesKey(sKey) |
| 487 |
Next |
| 488 |
If GeneralKey = sKey Then iCount += 1 |
| 489 |
Return iCount |
| 490 |
|
| 491 |
End Function |
| 492 |
|
| 493 |
Public Overrides Function DeleteKey(ByVal sKey As String) As Boolean |
| 494 |
If Not arlRestrictions.DeleteKey(sKey) Then Return False |
| 495 |
If Not arlActions.DeleteKey(sKey) Then Return False |
| 496 |
For Each d As Description In AllDescriptions |
| 497 |
If Not d.DeleteKey(sKey) Then Return False |
| 498 |
Next |
| 499 |
If GeneralKey = sKey Then GeneralKey = "" |
| 500 |
Return True |
| 501 |
End Function |
| 502 |
|
| 503 |
End Class |
| 504 |
|
| 505 |
|
| 506 |
Public Class clsRestriction |
| 507 |
Public Enum RestrictionTypeEnum |
| 508 |
Location |
| 509 |
[Object] |
| 510 |
Task |
| 511 |
Character |
| 512 |
Variable |
| 513 |
[Property] |
| 514 |
Direction |
| 515 |
Expression |
| 516 |
Item |
| 517 |
End Enum |
| 518 |
Friend eType As RestrictionTypeEnum |
| 519 |
|
| 520 |
Public Enum MustEnum |
| 521 |
Must |
| 522 |
MustNot |
| 523 |
End Enum |
| 524 |
Public eMust As MustEnum |
| 525 |
|
| 526 |
Public sKey1, sKey2 As String |
| 527 |
|
| 528 |
Friend oMessage As Description |
| 529 |
|
| 530 |
Public Enum LocationEnum |
| 531 |
HaveBeenSeenByCharacter |
| 532 |
BeInGroup |
| 533 |
HaveProperty |
| 534 |
BeLocation |
| 535 |
Exist |
| 536 |
End Enum |
| 537 |
Public eLocation As LocationEnum |
| 538 |
|
| 539 |
Public Enum ObjectEnum |
| 540 |
BeAtLocation |
| 541 |
BeHeldByCharacter |
| 542 |
BeWornByCharacter |
| 543 |
BeVisibleToCharacter |
| 544 |
BeInsideObject |
| 545 |
BeOnObject |
| 546 |
BeInState |
| 547 |
BeInGroup |
| 548 |
HaveBeenSeenByCharacter |
| 549 |
BePartOfObject |
| 550 |
BePartOfCharacter |
| 551 |
Exist |
| 552 |
HaveProperty |
| 553 |
BeExactText |
| 554 |
BeHidden |
| 555 |
BeObject |
| 556 |
End Enum |
| 557 |
Public eObject As ObjectEnum |
| 558 |
|
| 559 |
Public Enum TaskEnum |
| 560 |
Complete |
| 561 |
End Enum |
| 562 |
Public eTask As TaskEnum |
| 563 |
|
| 564 |
Public Enum CharacterEnum |
| 565 |
BeAlone |
| 566 |
BeAloneWith |
| 567 |
BeAtLocation |
| 568 |
BeCharacter |
| 569 |
BeHoldingObject |
| 570 |
BeInConversationWith |
| 571 |
BeInPosition |
| 572 |
BeInSameLocationAsCharacter |
| 573 |
BeInSameLocationAsObject |
| 574 |
BeInsideObject |
| 575 |
BeLyingOnObject |
| 576 |
BeInGroup |
| 577 |
BeOfGender |
| 578 |
BeOnObject |
| 579 |
BeOnCharacter |
| 580 |
BeStandingOnObject |
| 581 |
BeSittingOnObject |
| 582 |
BeWearingObject |
| 583 |
BeWithinLocationGroup |
| 584 |
Exist |
| 585 |
HaveProperty |
| 586 |
HaveRouteInDirection |
| 587 |
HaveSeenLocation |
| 588 |
HaveSeenObject |
| 589 |
HaveSeenCharacter |
| 590 |
BeVisibleToCharacter |
| 591 |
End Enum |
| 592 |
Public eCharacter As CharacterEnum |
| 593 |
|
| 594 |
' Can only be things common to all items |
| 595 |
Public Enum ItemEnum |
| 596 |
BeAtLocation |
| 597 |
BeCharacter |
| 598 |
BeInSameLocationAsCharacter |
| 599 |
BeInSameLocationAsObject |
| 600 |
BeInsideObject |
| 601 |
BeLocation |
| 602 |
BeInGroup |
| 603 |
BeObject |
| 604 |
BeOnCharacter |
| 605 |
BeOnObject |
| 606 |
BeType |
| 607 |
Exist |
| 608 |
HaveProperty |
| 609 |
End Enum |
| 610 |
Public eItem As ItemEnum |
| 611 |
|
| 612 |
Public Enum VariableEnum |
| 613 |
LessThan |
| 614 |
LessThanOrEqualTo |
| 615 |
EqualTo |
| 616 |
GreaterThanOrEqualTo |
| 617 |
GreaterThan |
| 618 |
Contain |
| 619 |
End Enum |
| 620 |
Public eVariable As VariableEnum |
| 621 |
|
| 622 |
Public Overrides Function ToString() As String |
| 623 |
Return Summary |
| 624 |
End Function |
| 625 |
|
| 626 |
Public IntValue As Integer |
| 627 |
Public StringValue As String |
| 628 |
|
| 629 |
|
| 630 |
Public Function ReferencesKey(ByVal sKey As String) As Boolean |
| 631 |
Return sKey1 = sKey OrElse sKey2 = sKey |
| 632 |
End Function |
| 633 |
|
| 634 |
|
| 635 |
Public ReadOnly Property Summary() As String |
| 636 |
Get |
| 637 |
Dim sSummary As String = "Undefined Restriction" |
| 638 |
|
| 639 |
Try |
| 640 |
If sKey1 IsNot Nothing OrElse eType = RestrictionTypeEnum.Expression Then |
| 641 |
Select Case eType |
| 642 |
Case RestrictionTypeEnum.Location |
| 643 |
sSummary = Adventure.GetNameFromKey(sKey1, , , True) |
| 644 |
Select Case eMust |
| 645 |
Case MustEnum.Must |
| 646 |
sSummary &= " must " |
| 647 |
Case MustEnum.MustNot |
| 648 |
sSummary &= " must not " |
| 649 |
End Select |
| 650 |
Select Case eLocation |
| 651 |
Case LocationEnum.HaveBeenSeenByCharacter |
| 652 |
sSummary &= "have been seen by " & Adventure.GetNameFromKey(sKey2) |
| 653 |
Case LocationEnum.BeInGroup |
| 654 |
sSummary &= "be in " & Adventure.GetNameFromKey(sKey2) |
| 655 |
Case LocationEnum.HaveProperty |
| 656 |
sSummary &= "have " & Adventure.GetNameFromKey(sKey2) |
| 657 |
Case LocationEnum.BeLocation |
| 658 |
sSummary &= "be location " & Adventure.GetNameFromKey(sKey2) |
| 659 |
Case LocationEnum.Exist |
| 660 |
sSummary &= "exist" |
| 661 |
End Select |
| 662 |
|
| 663 |
Case RestrictionTypeEnum.Object |
| 664 |
sSummary = Adventure.GetNameFromKey(sKey1, , , True) |
| 665 |
Select Case eMust |
| 666 |
Case MustEnum.Must |
| 667 |
sSummary &= " must " |
| 668 |
Case MustEnum.MustNot |
| 669 |
sSummary &= " must not " |
| 670 |
End Select |
| 671 |
Select Case eObject |
| 672 |
Case ObjectEnum.BeAtLocation |
| 673 |
sSummary &= "be at " & Adventure.GetNameFromKey(sKey2) |
| 674 |
sSummary = sSummary.Replace("at " & HIDDEN, HIDDEN) |
| 675 |
Case ObjectEnum.BeHeldByCharacter |
| 676 |
sSummary &= "be held by " & Adventure.GetNameFromKey(sKey2) |
| 677 |
Case ObjectEnum.BeHidden |
| 678 |
sSummary &= "be hidden" |
| 679 |
Case ObjectEnum.BeInGroup |
| 680 |
sSummary &= "be in object " & Adventure.GetNameFromKey(sKey2) |
| 681 |
Case ObjectEnum.BeInsideObject |
| 682 |
sSummary &= ("be inside " & Adventure.GetNameFromKey(sKey2)) |
| 683 |
Case ObjectEnum.BeInState |
| 684 |
sSummary &= "be in state '" & sKey2 & "'" |
| 685 |
Case ObjectEnum.BeOnObject |
| 686 |
sSummary &= ("be on " & Adventure.GetNameFromKey(sKey2)) |
| 687 |
Case ObjectEnum.BePartOfCharacter |
| 688 |
sSummary &= "be part of " & Adventure.GetNameFromKey(sKey2) |
| 689 |
Case ObjectEnum.BePartOfObject |
| 690 |
sSummary &= ("be part of " & Adventure.GetNameFromKey(sKey2)) |
| 691 |
Case ObjectEnum.HaveBeenSeenByCharacter |
| 692 |
sSummary &= "have been seen by " & Adventure.GetNameFromKey(sKey2) |
| 693 |
Case ObjectEnum.BeVisibleToCharacter |
| 694 |
sSummary &= "be visible to " & Adventure.GetNameFromKey(sKey2) |
| 695 |
Case ObjectEnum.BeWornByCharacter |
| 696 |
sSummary &= "be worn by " & Adventure.GetNameFromKey(sKey2) |
| 697 |
Case ObjectEnum.Exist |
| 698 |
sSummary &= "exist" |
| 699 |
Case ObjectEnum.HaveProperty |
| 700 |
sSummary &= "have " & Adventure.GetNameFromKey(sKey2) |
| 701 |
Case ObjectEnum.BeExactText |
| 702 |
sSummary &= "be exact text '" & sKey2 & "'" |
| 703 |
Case ObjectEnum.BeObject |
| 704 |
sSummary &= "be " & Adventure.GetNameFromKey(sKey2) |
| 705 |
End Select |
| 706 |
|
| 707 |
Case RestrictionTypeEnum.Task |
| 708 |
sSummary = Adventure.GetNameFromKey(sKey1, , , True) |
| 709 |
Select Case eMust |
| 710 |
Case MustEnum.Must |
| 711 |
sSummary &= " must be complete" |
| 712 |
Case MustEnum.MustNot |
| 713 |
sSummary &= " must not be complete" |
| 714 |
End Select |
| 715 |
|
| 716 |
Case RestrictionTypeEnum.Character |
| 717 |
sSummary = Adventure.GetNameFromKey(sKey1, , , True) |
| 718 |
Select Case eMust |
| 719 |
Case MustEnum.Must |
| 720 |
sSummary &= " must " |
| 721 |
Case MustEnum.MustNot |
| 722 |
sSummary &= " must not " |
| 723 |
End Select |
| 724 |
Select Case eCharacter |
| 725 |
Case CharacterEnum.BeAlone |
| 726 |
sSummary &= "be alone" |
| 727 |
Case CharacterEnum.BeAloneWith |
| 728 |
sSummary &= "be alone with " & Adventure.GetNameFromKey(sKey2) |
| 729 |
Case CharacterEnum.BeAtLocation |
| 730 |
sSummary &= "be at " & Adventure.GetNameFromKey(sKey2) |
| 731 |
Case CharacterEnum.BeCharacter |
| 732 |
sSummary &= "be " & Adventure.GetNameFromKey(sKey2) |
| 733 |
Case CharacterEnum.BeInConversationWith |
| 734 |
sSummary &= "be in conversation with " & Adventure.GetNameFromKey(sKey2) |
| 735 |
Case CharacterEnum.Exist |
| 736 |
sSummary &= "exist" |
| 737 |
Case CharacterEnum.HaveRouteInDirection |
| 738 |
sSummary &= "have a route available " |
| 739 |
If sKey2 = ANYDIRECTION Then |
| 740 |
sSummary &= "in any direction" |
| 741 |
ElseIf sKey2.StartsWith("ReferencedDirection") Then |
| 742 |
sSummary &= "to the " & sKey2.Replace("ReferencedDirection", "Referenced Direction") |
| 743 |
Else |
| 744 |
Select Case EnumParseDirections(sKey2) |
| 745 |
Case DirectionsEnum.North, DirectionsEnum.NorthEast, DirectionsEnum.East, DirectionsEnum.SouthEast, DirectionsEnum.South, DirectionsEnum.SouthWest, DirectionsEnum.West, DirectionsEnum.NorthWest |
| 746 |
sSummary &= "to the " & DirectionName(EnumParseDirections(sKey2)) |
| 747 |
Case DirectionsEnum.Up, DirectionsEnum.Down, DirectionsEnum.In, DirectionsEnum.Out |
| 748 |
sSummary &= DirectionName(EnumParseDirections(sKey2)) |
| 749 |
End Select |
| 750 |
|
| 751 |
End If |
| 752 |
Case CharacterEnum.HaveProperty |
| 753 |
sSummary &= "have " & Adventure.GetNameFromKey(sKey2) |
| 754 |
Case CharacterEnum.HaveSeenCharacter |
| 755 |
sSummary &= "have seen " & Adventure.GetNameFromKey(sKey2) |
| 756 |
Case CharacterEnum.HaveSeenLocation |
| 757 |
sSummary &= "have seen " & Adventure.GetNameFromKey(sKey2) |
| 758 |
Case CharacterEnum.HaveSeenObject |
| 759 |
sSummary &= "have seen " & Adventure.GetNameFromKey(sKey2) |
| 760 |
Case CharacterEnum.BeHoldingObject |
| 761 |
sSummary &= "be holding " & Adventure.GetNameFromKey(sKey2) |
| 762 |
Case CharacterEnum.BeInSameLocationAsCharacter |
| 763 |
sSummary &= "be in the same location as " & Adventure.GetNameFromKey(sKey2) |
| 764 |
Case CharacterEnum.BeInSameLocationAsObject |
| 765 |
If sKey2.StartsWith("ReferencedObject") OrElse Adventure.GetTypeFromKeyNice(sKey2) = "Object" Then |
| 766 |
sSummary &= "be in the same location as " & Adventure.GetNameFromKey(sKey2) |
| 767 |
Else |
| 768 |
sSummary &= "be in the same location as any object in " & Adventure.GetNameFromKey(sKey2) |
| 769 |
End If |
| 770 |
Case CharacterEnum.BeLyingOnObject |
| 771 |
sSummary &= "be lying on " & Adventure.GetNameFromKey(sKey2) |
| 772 |
Case CharacterEnum.BeInGroup |
| 773 |
sSummary &= "be a member of " & Adventure.GetNameFromKey(sKey2) |
| 774 |
Case CharacterEnum.BeOfGender |
| 775 |
sSummary &= "be of gender " & sKey2 |
| 776 |
Case CharacterEnum.BeSittingOnObject |
| 777 |
sSummary &= "be sitting on " & Adventure.GetNameFromKey(sKey2) |
| 778 |
Case CharacterEnum.BeStandingOnObject |
| 779 |
sSummary &= "be standing on " & Adventure.GetNameFromKey(sKey2) |
| 780 |
Case CharacterEnum.BeWearingObject |
| 781 |
sSummary &= "be wearing " & Adventure.GetNameFromKey(sKey2) |
| 782 |
Case CharacterEnum.BeWithinLocationGroup |
| 783 |
sSummary &= "be at a location within " & Adventure.GetNameFromKey(sKey2) |
| 784 |
Case CharacterEnum.BeInPosition |
| 785 |
sSummary &= "be in position " & sKey2 |
| 786 |
Case CharacterEnum.BeInsideObject |
| 787 |
sSummary &= "be inside " & Adventure.GetNameFromKey(sKey2) |
| 788 |
Case CharacterEnum.BeOnObject |
| 789 |
sSummary &= "be on " & Adventure.GetNameFromKey(sKey2) |
| 790 |
Case CharacterEnum.BeOnCharacter |
| 791 |
sSummary &= "be on " & Adventure.GetNameFromKey(sKey2) |
| 792 |
Case CharacterEnum.BeVisibleToCharacter |
| 793 |
sSummary &= "be visible to " & Adventure.GetNameFromKey(sKey2) |
| 794 |
End Select |
| 795 |
|
| 796 |
Case RestrictionTypeEnum.Item |
| 797 |
sSummary = Adventure.GetNameFromKey(sKey1, , , True) |
| 798 |
Select Case eMust |
| 799 |
Case MustEnum.Must |
| 800 |
sSummary &= " must " |
| 801 |
Case MustEnum.MustNot |
| 802 |
sSummary &= " must not " |
| 803 |
End Select |
| 804 |
Select Case eItem |
| 805 |
Case ItemEnum.BeAtLocation |
| 806 |
sSummary &= "be at " & Adventure.GetNameFromKey(sKey2) |
| 807 |
Case ItemEnum.BeCharacter |
| 808 |
sSummary &= "be " & Adventure.GetNameFromKey(sKey2) |
| 809 |
Case ItemEnum.BeInGroup |
| 810 |
sSummary &= "be a member of " & Adventure.GetNameFromKey(sKey2) |
| 811 |
Case ItemEnum.BeInSameLocationAsCharacter |
| 812 |
sSummary &= "be in the same loc as " & Adventure.GetNameFromKey(sKey2) |
| 813 |
Case ItemEnum.BeInSameLocationAsObject |
| 814 |
sSummary &= "be in the same loc as " & Adventure.GetNameFromKey(sKey2) |
| 815 |
Case ItemEnum.BeInsideObject |
| 816 |
sSummary &= "be inside " & Adventure.GetNameFromKey(sKey2) |
| 817 |
Case ItemEnum.BeLocation |
| 818 |
sSummary &= "be " & Adventure.GetNameFromKey(sKey2) |
| 819 |
Case ItemEnum.BeObject |
| 820 |
sSummary &= "be " & Adventure.GetNameFromKey(sKey2) |
| 821 |
Case ItemEnum.BeOnCharacter |
| 822 |
sSummary &= "be on " & Adventure.GetNameFromKey(sKey2) |
| 823 |
Case ItemEnum.BeOnObject |
| 824 |
sSummary &= "be on " & Adventure.GetNameFromKey(sKey2) |
| 825 |
Case ItemEnum.BeType |
| 826 |
sSummary &= "be item type " & sKey2 |
| 827 |
Case ItemEnum.Exist |
| 828 |
sSummary &= "exist" |
| 829 |
Case ItemEnum.HaveProperty |
| 830 |
sSummary &= "have " & Adventure.GetNameFromKey(sKey2) |
| 831 |
End Select |
| 832 |
|
| 833 |
Case RestrictionTypeEnum.Variable |
| 834 |
Dim eVarType As clsVariable.VariableTypeEnum |
| 835 |
|
| 836 |
If sKey1.StartsWith("ReferencedNumber") Then |
| 837 |
sSummary = Adventure.GetNameFromKey(sKey1) & " " |
| 838 |
eVarType = clsVariable.VariableTypeEnum.Numeric |
| 839 |
ElseIf sKey1.StartsWith("ReferencedText") Then |
| 840 |
sSummary = Adventure.GetNameFromKey(sKey1) & " " |
| 841 |
eVarType = clsVariable.VariableTypeEnum.Text |
| 842 |
Else |
| 843 |
If sKey1.StartsWith("Parameter-") Then |
| 844 |
sSummary = "Parameter '" & Adventure.GetNameFromKey(sKey1) & "' " |
| 845 |
Else |
| 846 |
Dim var As clsVariable = Adventure.htblVariables(sKey1) |
| 847 |
eVarType = var.Type |
| 848 |
sSummary = "Variable '" & var.Name |
| 849 |
If sKey2 <> "" Then |
| 850 |
If Adventure.htblVariables.ContainsKey(sKey2) Then |
| 851 |
sSummary &= "[%" & Adventure.htblVariables(sKey2).Name & "%]" |
| 852 |
Else |
| 853 |
sSummary &= "[" & sKey2 & "]" |
| 854 |
End If |
| 855 |
End If |
| 856 |
sSummary &= "' " |
| 857 |
End If |
| 858 |
End If |
| 859 |
|
| 860 |
Select Case eMust |
| 861 |
Case MustEnum.Must |
| 862 |
sSummary &= "must " |
| 863 |
Case MustEnum.MustNot |
| 864 |
sSummary &= "must not " |
| 865 |
End Select |
| 866 |
|
| 867 |
If eVarType = clsVariable.VariableTypeEnum.Numeric Then |
| 868 |
sSummary &= "be " |
| 869 |
|
| 870 |
Select Case eVariable |
| 871 |
Case VariableEnum.EqualTo |
| 872 |
sSummary &= "equal to " |
| 873 |
Case VariableEnum.GreaterThan |
| 874 |
sSummary &= "greater than " |
| 875 |
Case VariableEnum.GreaterThanOrEqualTo |
| 876 |
sSummary &= "greater than or equal to " |
| 877 |
Case VariableEnum.LessThan |
| 878 |
sSummary &= "less than " |
| 879 |
Case VariableEnum.LessThanOrEqualTo |
| 880 |
sSummary &= "less than or equal to " |
| 881 |
End Select |
| 882 |
Else |
| 883 |
Select Case eVariable |
| 884 |
Case VariableEnum.EqualTo |
| 885 |
sSummary &= "be equal to " |
| 886 |
Case VariableEnum.Contain |
| 887 |
sSummary &= "contain " |
| 888 |
End Select |
| 889 |
End If |
| 890 |
|
| 891 |
|
| 892 |
If IntValue = Integer.MinValue Then |
| 893 |
sSummary &= Adventure.GetNameFromKey(StringValue) |
| 894 |
Else |
| 895 |
If eVarType = clsVariable.VariableTypeEnum.Numeric Then |
| 896 |
If StringValue <> "" AndAlso StringValue <> IntValue.ToString Then |
| 897 |
sSummary &= StringValue ' Must be an expression resulting in an integer |
| 898 |
Else |
| 899 |
sSummary &= IntValue |
| 900 |
End If |
| 901 |
Else |
| 902 |
sSummary &= "'" & StringValue & "'" |
| 903 |
End If |
| 904 |
End If |
| 905 |
|
| 906 |
Case RestrictionTypeEnum.Property |
| 907 |
Dim p As clsProperty = Nothing |
| 908 |
If Adventure.htblAllProperties.TryGetValue(sKey1, p) Then |
| 909 |
sSummary = Adventure.GetNameFromKey(sKey1, , , True) & " for " & Adventure.GetNameFromKey(sKey2) |
| 910 |
Select Case eMust |
| 911 |
Case MustEnum.Must |
| 912 |
sSummary &= " must be " |
| 913 |
Case MustEnum.MustNot |
| 914 |
sSummary &= " must not be " |
| 915 |
End Select |
| 916 |
Select Case p.Type |
| 917 |
Case clsProperty.PropertyTypeEnum.CharacterKey, clsProperty.PropertyTypeEnum.LocationGroupKey, clsProperty.PropertyTypeEnum.LocationKey, clsProperty.PropertyTypeEnum.ObjectKey |
| 918 |
sSummary &= "'" & Adventure.GetNameFromKey(StringValue) & "'" |
| 919 |
Case clsProperty.PropertyTypeEnum.SelectionOnly |
| 920 |
Case clsProperty.PropertyTypeEnum.Integer, clsProperty.PropertyTypeEnum.ValueList |
| 921 |
Select Case CType(IntValue, VariableEnum) |
| 922 |
Case VariableEnum.LessThan |
| 923 |
sSummary &= "< " |
| 924 |
Case VariableEnum.LessThanOrEqualTo |
| 925 |
sSummary &= "<= " |
| 926 |
Case VariableEnum.EqualTo |
| 927 |
sSummary &= "= " |
| 928 |
Case VariableEnum.GreaterThanOrEqualTo |
| 929 |
sSummary &= ">= " |
| 930 |
Case VariableEnum.GreaterThan |
| 931 |
sSummary &= "> " |
| 932 |
End Select |
| 933 |
|
| 934 |
Dim bSetVar As Boolean = False |
| 935 |
If p.Type = clsProperty.PropertyTypeEnum.ValueList AndAlso IsNumeric(StringValue) Then |
| 936 |
For Each sValue As String In p.ValueList.Keys |
| 937 |
If p.ValueList(sValue) = SafeInt(StringValue) Then |
| 938 |
sSummary &= "'" & sValue & "'" |
| 939 |
bSetVar = True |
| 940 |
Exit For |
| 941 |
End If |
| 942 |
Next |
| 943 |
End If |
| 944 |
If Not bSetVar Then sSummary &= "'" & StringValue & "'" |
| 945 |
Case clsProperty.PropertyTypeEnum.StateList, clsProperty.PropertyTypeEnum.Text |
| 946 |
sSummary &= "'" & StringValue & "'" |
| 947 |
End Select |
| 948 |
End If |
| 949 |
|
| 950 |
Case RestrictionTypeEnum.Direction |
| 951 |
sSummary = "Referenced Direction " |
| 952 |
Select Case eMust |
| 953 |
Case MustEnum.Must |
| 954 |
sSummary &= "must be " |
| 955 |
Case MustEnum.MustNot |
| 956 |
sSummary &= "must not be " |
| 957 |
End Select |
| 958 |
sSummary &= DirectionName(EnumParseDirections(sKey1)) |
| 959 |
|
| 960 |
Case RestrictionTypeEnum.Expression |
| 961 |
sSummary = StringValue |
| 962 |
|
| 963 |
End Select |
| 964 |
End If |
| 965 |
|
| 966 |
Catch |
| 967 |
ErrMsg("Error producing restriction summary") |
| 968 |
End Try |
| 969 |
|
| 970 |
Return sSummary |
| 971 |
End Get |
| 972 |
End Property |
| 973 |
|
| 974 |
|
| 975 |
Public Function Copy() As clsRestriction |
| 976 |
Dim rest As New clsRestriction |
| 977 |
|
| 978 |
rest.eCharacter = Me.eCharacter |
| 979 |
rest.eType = Me.eType |
| 980 |
rest.eLocation = Me.eLocation |
| 981 |
rest.eMust = Me.eMust |
| 982 |
rest.eObject = Me.eObject |
| 983 |
rest.eTask = Me.eTask |
| 984 |
rest.eVariable = Me.eVariable |
| 985 |
rest.eItem = Me.eItem |
| 986 |
rest.sKey1 = Me.sKey1 |
| 987 |
rest.sKey2 = Me.sKey2 |
| 988 |
rest.IntValue = Me.IntValue |
| 989 |
rest.StringValue = Me.StringValue |
| 990 |
rest.oMessage = Me.oMessage.Copy |
| 991 |
|
| 992 |
Return rest |
| 993 |
End Function |
| 994 |
|
| 995 |
Public Sub New() |
| 996 |
oMessage = New Description |
| 997 |
End Sub |
| 998 |
|
| 999 |
End Class |
| 1000 |
|
| 1001 |
|
| 1002 |
|
| 1003 |
Public Class clsAction |
| 1004 |
|
| 1005 |
Public Enum ItemEnum |
| 1006 |
' Objects |
| 1007 |
MoveObject |
| 1008 |
AddObjectToGroup |
| 1009 |
RemoveObjectFromGroup |
| 1010 |
|
| 1011 |
' Characters |
| 1012 |
MoveCharacter |
| 1013 |
AddCharacterToGroup |
| 1014 |
RemoveCharacterFromGroup |
| 1015 |
|
| 1016 |
' Variables |
| 1017 |
SetVariable |
| 1018 |
IncreaseVariable |
| 1019 |
DecreaseVariable |
| 1020 |
|
| 1021 |
SetProperties |
| 1022 |
SetTasks |
| 1023 |
EndGame |
| 1024 |
Conversation |
| 1025 |
|
| 1026 |
' Locations |
| 1027 |
AddLocationToGroup |
| 1028 |
RemoveLocationFromGroup |
| 1029 |
|
| 1030 |
Time |
| 1031 |
End Enum |
| 1032 |
Public eItem As ItemEnum |
| 1033 |
|
| 1034 |
Public sKey1, sKey2 As String |
| 1035 |
Public sPropertyValue As String |
| 1036 |
|
| 1037 |
Public Enum MoveObjectWhatEnum |
| 1038 |
[Object] |
| 1039 |
EverythingHeldBy |
| 1040 |
EverythingWornBy |
| 1041 |
EverythingInside |
| 1042 |
EverythingOn |
| 1043 |
EverythingWithProperty |
| 1044 |
EverythingInGroup |
| 1045 |
EverythingAtLocation |
| 1046 |
End Enum |
| 1047 |
Public eMoveObjectWhat As MoveObjectWhatEnum |
| 1048 |
|
| 1049 |
Public Enum MoveObjectToEnum |
| 1050 |
' Static or Dynamic Moves |
| 1051 |
ToLocation |
| 1052 |
ToSameLocationAs ' Object or Character |
| 1053 |
ToLocationGroup ' If static, moves to all locations. If dynamic, moves to random location |
| 1054 |
' |
| 1055 |
' Dynamic Moves |
| 1056 |
' |
| 1057 |
InsideObject |
| 1058 |
OntoObject |
| 1059 |
ToCarriedBy |
| 1060 |
ToWornBy |
| 1061 |
' |
| 1062 |
' Static Moves |
| 1063 |
ToPartOfCharacter |
| 1064 |
ToPartOfObject |
| 1065 |
' |
| 1066 |
' To/From Group |
| 1067 |
ToGroup |
| 1068 |
FromGroup |
| 1069 |
End Enum |
| 1070 |
Public eMoveObjectTo As MoveObjectToEnum |
| 1071 |
|
| 1072 |
Public Enum MoveCharacterWhoEnum |
| 1073 |
Character |
| 1074 |
EveryoneInside |
| 1075 |
EveryoneOn |
| 1076 |
EveryoneWithProperty |
| 1077 |
EveryoneInGroup |
| 1078 |
EveryoneAtLocation |
| 1079 |
End Enum |
| 1080 |
Public eMoveCharacterWho As MoveCharacterWhoEnum |
| 1081 |
|
| 1082 |
Public Enum MoveCharacterToEnum |
| 1083 |
InDirection |
| 1084 |
ToLocation |
| 1085 |
ToLocationGroup |
| 1086 |
ToSameLocationAs ' Object or Character |
| 1087 |
ToStandingOn |
| 1088 |
ToSittingOn |
| 1089 |
ToLyingOn |
| 1090 |
ToSwitchWith |
| 1091 |
InsideObject |
| 1092 |
OntoCharacter |
| 1093 |
ToParentLocation |
| 1094 |
ToGroup |
| 1095 |
FromGroup |
| 1096 |
End Enum |
| 1097 |
Public eMoveCharacterTo As MoveCharacterToEnum |
| 1098 |
|
| 1099 |
Public Enum MoveLocationWhatEnum |
| 1100 |
Location |
| 1101 |
LocationOf |
| 1102 |
EverywhereInGroup |
| 1103 |
EverywhereWithProperty |
| 1104 |
End Enum |
| 1105 |
Public eMoveLocationWhat As MoveLocationWhatEnum |
| 1106 |
|
| 1107 |
Public Enum MoveLocationToEnum |
| 1108 |
' To/From Group |
| 1109 |
ToGroup |
| 1110 |
FromGroup |
| 1111 |
End Enum |
| 1112 |
Public eMoveLocationTo As MoveLocationToEnum |
| 1113 |
|
| 1114 |
Public Enum ObjectStatusEnum |
| 1115 |
DunnoYet |
| 1116 |
End Enum |
| 1117 |
Public eObjectStatus As ObjectStatusEnum |
| 1118 |
|
| 1119 |
Public Enum VariablesEnum |
| 1120 |
Assignment |
| 1121 |
[Loop] |
| 1122 |
End Enum |
| 1123 |
Public eVariables As VariablesEnum |
| 1124 |
|
| 1125 |
Public Enum SetTasksEnum |
| 1126 |
Execute |
| 1127 |
Unset |
| 1128 |
End Enum |
| 1129 |
Public eSetTasks As SetTasksEnum |
| 1130 |
|
| 1131 |
Public Enum EndGameEnum |
| 1132 |
Win |
| 1133 |
Lose |
| 1134 |
Neutral |
| 1135 |
Running |
| 1136 |
End Enum |
| 1137 |
Public eEndgame As EndGameEnum |
| 1138 |
|
| 1139 |
<Flags> _ |
| 1140 |
Friend Enum ConversationEnum |
| 1141 |
Greet = 1 |
| 1142 |
Ask = 2 |
| 1143 |
Tell = 4 |
| 1144 |
Command = 8 |
| 1145 |
Farewell = 16 |
| 1146 |
EnterConversation = 32 |
| 1147 |
LeaveConversation = 64 |
| 1148 |
End Enum |
| 1149 |
Friend eConversation As ConversationEnum |
| 1150 |
|
| 1151 |
Public IntValue As Integer |
| 1152 |
Public StringValue As String |
| 1153 |
|
| 1154 |
Public Function Copy() As clsAction |
| 1155 |
|
| 1156 |
Dim act As New clsAction |
| 1157 |
|
| 1158 |
act.eendgame = Me.eendgame |
| 1159 |
act.eItem = Me.eItem |
| 1160 |
act.eMoveObjectWhat = Me.eMoveObjectWhat |
| 1161 |
act.eMoveObjectTo = Me.eMoveObjectTo |
| 1162 |
act.eMoveCharacterWho = Me.eMoveCharacterWho |
| 1163 |
act.eMoveCharacterTo = Me.eMoveCharacterTo |
| 1164 |
act.eMoveLocationWhat = Me.eMoveLocationWhat |
| 1165 |
act.eMoveLocationTo = Me.eMoveLocationTo |
| 1166 |
act.sPropertyValue = Me.sPropertyValue |
| 1167 |
act.eObjectStatus = Me.eObjectStatus |
| 1168 |
act.eSetTasks = Me.eSetTasks |
| 1169 |
act.eVariables = Me.eVariables |
| 1170 |
act.eConversation = Me.eConversation |
| 1171 |
act.IntValue = Me.IntValue |
| 1172 |
act.sKey1 = Me.sKey1 |
| 1173 |
act.sKey2 = Me.sKey2 |
| 1174 |
act.StringValue = Me.StringValue |
| 1175 |
|
| 1176 |
Return act |
| 1177 |
|
| 1178 |
End Function |
| 1179 |
|
| 1180 |
Public Overrides Function ToString() As String |
| 1181 |
Return Summary |
| 1182 |
End Function |
| 1183 |
|
| 1184 |
Public Function ReferencesKey(ByVal sKey As String) As Boolean |
| 1185 |
Return sKey1 = sKey OrElse sKey2 = sKey |
| 1186 |
End Function |
| 1187 |
|
| 1188 |
Public ReadOnly Property Summary() As String |
| 1189 |
Get |
| 1190 |
Dim sSummary As String = "Undefined Action" |
| 1191 |
|
| 1192 |
Try |
| 1193 |
Select Case eItem |
| 1194 |
Case ItemEnum.MoveObject, ItemEnum.AddObjectToGroup, ItemEnum.RemoveObjectFromGroup |
| 1195 |
|
| 1196 |
Select Case eItem |
| 1197 |
Case ItemEnum.MoveObject |
| 1198 |
sSummary = "Move " |
| 1199 |
Case ItemEnum.AddObjectToGroup |
| 1200 |
sSummary = "Add " |
| 1201 |
Case ItemEnum.RemoveObjectFromGroup |
| 1202 |
sSummary = "Remove " |
| 1203 |
Case Else |
| 1204 |
ErrMsg("eItem not specified") |
| 1205 |
End Select |
| 1206 |
|
| 1207 |
Dim bDynamic As Boolean = True |
| 1208 |
Select Case eMoveObjectWhat |
| 1209 |
Case MoveObjectWhatEnum.Object |
| 1210 |
If Not sKey1.StartsWith("ReferencedObject") Then bDynamic = Not Adventure.htblObjects(sKey1).IsStatic |
| 1211 |
|
| 1212 |
Case MoveObjectWhatEnum.EverythingHeldBy |
| 1213 |
sSummary &= "everything held by " |
| 1214 |
|
| 1215 |
Case MoveObjectWhatEnum.EverythingAtLocation |
| 1216 |
sSummary &= "everything at " |
| 1217 |
|
| 1218 |
Case MoveObjectWhatEnum.EverythingInGroup |
| 1219 |
sSummary &= "everything in " |
| 1220 |
|
| 1221 |
Case MoveObjectWhatEnum.EverythingInside |
| 1222 |
sSummary &= "everything inside " |
| 1223 |
|
| 1224 |
Case MoveObjectWhatEnum.EverythingOn |
| 1225 |
sSummary &= "everything on " |
| 1226 |
|
| 1227 |
Case MoveObjectWhatEnum.EverythingWithProperty |
| 1228 |
sSummary &= "everything with " & Adventure.GetNameFromKey(sKey1) |
| 1229 |
If sPropertyValue <> "" Then |
| 1230 |
Dim prop As clsProperty = Adventure.htblObjectProperties(sKey1) |
| 1231 |
If prop IsNot Nothing Then |
| 1232 |
sSummary &= " where value is " |
| 1233 |
Select Case prop.Type |
| 1234 |
Case clsProperty.PropertyTypeEnum.CharacterKey, clsProperty.PropertyTypeEnum.LocationGroupKey, clsProperty.PropertyTypeEnum.LocationKey, clsProperty.PropertyTypeEnum.ObjectKey |
| 1235 |
sSummary &= Adventure.GetNameFromKey(sPropertyValue) |
| 1236 |
Case clsProperty.PropertyTypeEnum.Integer, clsProperty.PropertyTypeEnum.StateList, clsProperty.PropertyTypeEnum.Text |
| 1237 |
sSummary &= "'" & sPropertyValue & "'" |
| 1238 |
Case clsProperty.PropertyTypeEnum.SelectionOnly |
| 1239 |
' N/A |
| 1240 |
End Select |
| 1241 |
End If |
| 1242 |
End If |
| 1243 |
|
| 1244 |
Case MoveObjectWhatEnum.EverythingWornBy |
| 1245 |
sSummary &= "everything worn by " |
| 1246 |
|
| 1247 |
Case Else |
| 1248 |
ErrMsg("eMoveObjectWhat not specified") |
| 1249 |
End Select |
| 1250 |
If eMoveObjectWhat <> MoveObjectWhatEnum.EverythingWithProperty Then sSummary &= Adventure.GetNameFromKey(sKey1) |
| 1251 |
|
| 1252 |
Select Case eMoveObjectTo |
| 1253 |
Case MoveObjectToEnum.InsideObject |
| 1254 |
sSummary &= " inside " & Adventure.GetNameFromKey(sKey2) |
| 1255 |
Case MoveObjectToEnum.OntoObject |
| 1256 |
sSummary &= " onto " & Adventure.GetNameFromKey(sKey2) |
| 1257 |
Case MoveObjectToEnum.ToCarriedBy |
| 1258 |
sSummary &= " to held by " & Adventure.GetNameFromKey(sKey2) |
| 1259 |
Case MoveObjectToEnum.ToLocation |
| 1260 |
If sKey2 = "Hidden" Then |
| 1261 |
sSummary &= " to Hidden" |
| 1262 |
Else |
| 1263 |
sSummary &= " to " & Adventure.GetNameFromKey(sKey2) |
| 1264 |
End If |
| 1265 |
Case MoveObjectToEnum.ToLocationGroup |
| 1266 |
If bDynamic Then |
| 1267 |
sSummary &= " to somewhere in location " & Adventure.GetNameFromKey(sKey2) |
| 1268 |
Else |
| 1269 |
sSummary &= " to everywhere in location " & Adventure.GetNameFromKey(sKey2) |
| 1270 |
End If |
| 1271 |
Case MoveObjectToEnum.ToPartOfCharacter |
| 1272 |
sSummary &= " to part of " & Adventure.GetNameFromKey(sKey2) |
| 1273 |
Case MoveObjectToEnum.ToPartOfObject |
| 1274 |
sSummary &= " to part of " & Adventure.GetNameFromKey(sKey2) |
| 1275 |
Case MoveObjectToEnum.ToSameLocationAs |
| 1276 |
sSummary &= " to same location as " & Adventure.GetNameFromKey(sKey2) |
| 1277 |
Case MoveObjectToEnum.ToWornBy |
| 1278 |
sSummary &= " to worn by " & Adventure.GetNameFromKey(sKey2) |
| 1279 |
Case MoveObjectToEnum.ToGroup |
| 1280 |
sSummary &= " to " & Adventure.GetNameFromKey(sKey2) |
| 1281 |
Case MoveObjectToEnum.FromGroup |
| 1282 |
sSummary &= " from " & Adventure.GetNameFromKey(sKey2) |
| 1283 |
End Select |
| 1284 |
|
| 1285 |
Case ItemEnum.MoveCharacter, ItemEnum.AddCharacterToGroup, ItemEnum.RemoveCharacterFromGroup |
| 1286 |
|
| 1287 |
Select Case eItem |
| 1288 |
Case ItemEnum.MoveCharacter |
| 1289 |
sSummary = "Move " |
| 1290 |
Case ItemEnum.AddCharacterToGroup |
| 1291 |
sSummary = "Add " |
| 1292 |
Case ItemEnum.RemoveCharacterFromGroup |
| 1293 |
sSummary = "Remove " |
| 1294 |
Case Else |
| 1295 |
ErrMsg("eItem not specified") |
| 1296 |
End Select |
| 1297 |
|
| 1298 |
Select Case eMoveCharacterWho |
| 1299 |
Case MoveCharacterWhoEnum.Character |
| 1300 |
' |
| 1301 |
Case MoveCharacterWhoEnum.EveryoneAtLocation |
| 1302 |
sSummary &= "everyone at " |
| 1303 |
Case MoveCharacterWhoEnum.EveryoneInGroup |
| 1304 |
sSummary &= "everyone in " |
| 1305 |
Case MoveCharacterWhoEnum.EveryoneInside |
| 1306 |
sSummary &= "everyone inside " |
| 1307 |
Case MoveCharacterWhoEnum.EveryoneOn |
| 1308 |
sSummary &= "everyone on " |
| 1309 |
Case MoveCharacterWhoEnum.EveryoneWithProperty |
| 1310 |
sSummary &= "everyone with " & Adventure.GetNameFromKey(sKey1) |
| 1311 |
If sPropertyValue <> "" Then |
| 1312 |
Dim prop As clsProperty = Adventure.htblCharacterProperties(sKey1) |
| 1313 |
If prop IsNot Nothing Then |
| 1314 |
sSummary &= " where value is " |
| 1315 |
Select Case prop.Type |
| 1316 |
Case clsProperty.PropertyTypeEnum.CharacterKey, clsProperty.PropertyTypeEnum.LocationGroupKey, clsProperty.PropertyTypeEnum.LocationKey, clsProperty.PropertyTypeEnum.ObjectKey |
| 1317 |
sSummary &= Adventure.GetNameFromKey(sPropertyValue) |
| 1318 |
Case clsProperty.PropertyTypeEnum.Integer, clsProperty.PropertyTypeEnum.StateList, clsProperty.PropertyTypeEnum.Text |
| 1319 |
sSummary &= "'" & sPropertyValue & "'" |
| 1320 |
Case clsProperty.PropertyTypeEnum.SelectionOnly |
| 1321 |
' N/A |
| 1322 |
End Select |
| 1323 |
End If |
| 1324 |
End If |
| 1325 |
Case Else |
| 1326 |
ErrMsg("eMoveCharacterWho not specified") |
| 1327 |
End Select |
| 1328 |
If eMoveCharacterWho <> MoveCharacterWhoEnum.EveryoneWithProperty Then sSummary &= Adventure.GetNameFromKey(sKey1) |
| 1329 |
|
| 1330 |
Select Case eMoveCharacterTo |
| 1331 |
Case MoveCharacterToEnum.InDirection |
| 1332 |
sSummary &= " in direction" |
| 1333 |
If sKey2.StartsWith("ReferencedDirection") Then |
| 1334 |
sSummary &= sKey2.Replace("ReferencedDirection", " Referenced Direction ") |
| 1335 |
Else |
| 1336 |
sSummary &= " " & DirectionName(EnumParseDirections(sKey2)) |
| 1337 |
End If |
| 1338 |
Case MoveCharacterToEnum.ToLocation |
| 1339 |
sSummary &= " to " & Adventure.GetNameFromKey(sKey2) |
| 1340 |
Case MoveCharacterToEnum.ToLocationGroup |
| 1341 |
sSummary &= " to " & Adventure.GetNameFromKey(sKey2) |
| 1342 |
Case MoveCharacterToEnum.ToSameLocationAs |
| 1343 |
sSummary &= " to same location as " & Adventure.GetNameFromKey(sKey2) |
| 1344 |
Case MoveCharacterToEnum.ToStandingOn |
| 1345 |
sSummary &= " to standing on " & Adventure.GetNameFromKey(sKey2) |
| 1346 |
Case MoveCharacterToEnum.ToSittingOn |
| 1347 |
sSummary &= " to sitting on " & Adventure.GetNameFromKey(sKey2) |
| 1348 |
Case MoveCharacterToEnum.ToSwitchWith |
| 1349 |
sSummary &= " to switch places with " & Adventure.GetNameFromKey(sKey2) |
| 1350 |
Case MoveCharacterToEnum.ToLyingOn |
| 1351 |
sSummary &= " to lying on " & Adventure.GetNameFromKey(sKey2) |
| 1352 |
Case MoveCharacterToEnum.InsideObject |
| 1353 |
sSummary &= " inside " & Adventure.GetNameFromKey(sKey2) |
| 1354 |
Case MoveCharacterToEnum.OntoCharacter |
| 1355 |
sSummary &= " onto " & Adventure.GetNameFromKey(sKey2) |
| 1356 |
Case MoveCharacterToEnum.ToParentLocation |
| 1357 |
sSummary &= " to parent location" |
| 1358 |
Case MoveCharacterToEnum.ToGroup |
| 1359 |
sSummary &= " to " & Adventure.GetNameFromKey(sKey2) |
| 1360 |
Case MoveCharacterToEnum.FromGroup |
| 1361 |
sSummary &= " from " & Adventure.GetNameFromKey(sKey2) |
| 1362 |
End Select |
| 1363 |
|
| 1364 |
Case ItemEnum.AddLocationToGroup, ItemEnum.RemoveLocationFromGroup |
| 1365 |
|
| 1366 |
Select Case eItem |
| 1367 |
Case ItemEnum.AddLocationToGroup |
| 1368 |
sSummary = "Add " |
| 1369 |
Case ItemEnum.RemoveLocationFromGroup |
| 1370 |
sSummary = "Remove " |
| 1371 |
Case Else |
| 1372 |
ErrMsg("eItem not specified") |
| 1373 |
End Select |
| 1374 |
|
| 1375 |
Select Case eMoveLocationWhat |
| 1376 |
Case MoveLocationWhatEnum.Location |
| 1377 |
' |
| 1378 |
Case MoveLocationWhatEnum.LocationOf |
| 1379 |
sSummary &= "location of " |
| 1380 |
Case MoveLocationWhatEnum.EverywhereInGroup |
| 1381 |
sSummary &= "everywhere in " |
| 1382 |
Case MoveLocationWhatEnum.EverywhereWithProperty |
| 1383 |
sSummary &= "everywhere with " & Adventure.GetNameFromKey(sKey1) |
| 1384 |
If sPropertyValue <> "" Then |
| 1385 |
Dim prop As clsProperty = Adventure.htblLocationProperties(sKey1) |
| 1386 |
If prop IsNot Nothing Then |
| 1387 |
sSummary &= " where value is " |
| 1388 |
Select Case prop.Type |
| 1389 |
Case clsProperty.PropertyTypeEnum.CharacterKey, clsProperty.PropertyTypeEnum.LocationGroupKey, clsProperty.PropertyTypeEnum.LocationKey, clsProperty.PropertyTypeEnum.ObjectKey |
| 1390 |
sSummary &= Adventure.GetNameFromKey(sPropertyValue) |
| 1391 |
Case clsProperty.PropertyTypeEnum.Integer, clsProperty.PropertyTypeEnum.StateList, clsProperty.PropertyTypeEnum.Text |
| 1392 |
sSummary &= "'" & sPropertyValue & "'" |
| 1393 |
Case clsProperty.PropertyTypeEnum.SelectionOnly |
| 1394 |
' N/A |
| 1395 |
End Select |
| 1396 |
End If |
| 1397 |
End If |
| 1398 |
Case Else |
| 1399 |
ErrMsg("eMoveLocationWhat not specified") |
| 1400 |
End Select |
| 1401 |
If eMoveLocationWhat <> MoveLocationWhatEnum.EverywhereWithProperty Then sSummary &= Adventure.GetNameFromKey(sKey1) |
| 1402 |
|
| 1403 |
Select Case eMoveLocationTo |
| 1404 |
Case MoveLocationToEnum.ToGroup |
| 1405 |
sSummary &= " to " & Adventure.GetNameFromKey(sKey2) |
| 1406 |
Case MoveLocationToEnum.FromGroup |
| 1407 |
sSummary &= " from " & Adventure.GetNameFromKey(sKey2) |
| 1408 |
End Select |
| 1409 |
|
| 1410 |
Case ItemEnum.SetProperties |
| 1411 |
Dim p As clsProperty = Nothing |
| 1412 |
If Adventure.htblAllProperties.TryGetValue(sKey2, p) Then |
| 1413 |
sSummary = "Set property '" & p.Description & "' of " & Adventure.GetNameFromKey(sKey1) & " to " |
| 1414 |
Dim bSetVar As Boolean = False |
| 1415 |
If sPropertyValue.Length > 2 AndAlso sPropertyValue.StartsWith("%") AndAlso sPropertyValue.EndsWith("%") Then 'AndAlso Adventure.htblVariables.ContainsKey(value.Substring(1, value.Length - 2)) Then |
| 1416 |
For Each v As clsVariable In Adventure.htblVariables.Values |
| 1417 |
If sPropertyValue = "%" & v.Name & "%" Then |
| 1418 |
sSummary &= Adventure.GetNameFromKey(v.Key) |
| 1419 |
bSetVar = True |
| 1420 |
Exit For |
| 1421 |
End If |
| 1422 |
Next |
| 1423 |
End If |
| 1424 |
If Not bSetVar AndAlso p.Type = clsProperty.PropertyTypeEnum.ValueList AndAlso IsNumeric(sPropertyValue) Then |
| 1425 |
For Each sValue As String In p.ValueList.Keys |
| 1426 |
If p.ValueList(sValue) = SafeInt(sPropertyValue) Then |
| 1427 |
sSummary &= "'" & sValue & "'" |
| 1428 |
bSetVar = True |
| 1429 |
Exit For |
| 1430 |
End If |
| 1431 |
Next |
| 1432 |
End If |
| 1433 |
If Not bSetVar AndAlso sPropertyValue.StartsWith("Referenced") Then |
| 1434 |
sSummary &= Adventure.GetNameFromKey(sPropertyValue) |
| 1435 |
bSetVar = True |
| 1436 |
End If |
| 1437 |
If Not bSetVar Then sSummary &= "'" & sPropertyValue & "'" |
| 1438 |
End If |
| 1439 |
|
| 1440 |
Case ItemEnum.SetVariable, ItemEnum.IncreaseVariable, ItemEnum.DecreaseVariable |
| 1441 |
Dim var As clsVariable = Adventure.htblVariables(sKey1) |
| 1442 |
Select Case Me.eVariables |
| 1443 |
Case VariablesEnum.Assignment |
| 1444 |
Select Case eItem |
| 1445 |
Case ItemEnum.SetVariable |
| 1446 |
sSummary = "Set" |
| 1447 |
Case ItemEnum.IncreaseVariable |
| 1448 |
sSummary = "Increase" |
| 1449 |
Case ItemEnum.DecreaseVariable |
| 1450 |
sSummary = "Decrease" |
| 1451 |
End Select |
| 1452 |
sSummary &= " variable " & var.Name |
| 1453 |
If Adventure.htblVariables(sKey1).Length > 1 Then |
| 1454 |
If IsNumeric(sKey2) Then |
| 1455 |
sSummary &= "[" & sKey2 & "]" |
| 1456 |
ElseIf sKey2.StartsWith("ReferencedNumber") Then |
| 1457 |
sSummary &= Adventure.GetNameFromKey(sKey2, False) 'We already get brackets in the ref name, so don't double them up |
| 1458 |
Else |
| 1459 |
sSummary &= "[%" & Adventure.htblVariables(sKey2).Name & "%]" |
| 1460 |
End If |
| 1461 |
End If |
| 1462 |
Select Case eItem |
| 1463 |
Case ItemEnum.SetVariable |
| 1464 |
sSummary &= " to " |
| 1465 |
Case ItemEnum.IncreaseVariable, ItemEnum.DecreaseVariable |
| 1466 |
sSummary &= " by " |
| 1467 |
End Select |
| 1468 |
If var.Type = clsVariable.VariableTypeEnum.Numeric Then |
| 1469 |
sSummary &= "'" & StringValue & "'" |
| 1470 |
Else |
| 1471 |
sSummary &= "'" & StringValue & "'" ' already has quotes around it - oh really, not if it's an expression |
| 1472 |
End If |
| 1473 |
Case VariablesEnum.Loop |
| 1474 |
sSummary = "FOR %Loop% = " & IntValue & " TO " & CInt(Val(sKey2)) & " : SET " & var.Name & "[%Loop%] = " & StringValue & " : NEXT %Loop%" |
| 1475 |
End Select |
| 1476 |
|
| 1477 |
Case ItemEnum.SetTasks |
| 1478 |
If sPropertyValue <> "" Then |
| 1479 |
sSummary = "FOR %Loop% = " & IntValue & " TO " & CInt(sPropertyValue) & " : " |
| 1480 |
Else |
| 1481 |
sSummary = "" |
| 1482 |
End If |
| 1483 |
Select Case Me.eSetTasks |
| 1484 |
Case SetTasksEnum.Execute |
| 1485 |
sSummary &= "Execute " & Adventure.GetNameFromKey(sKey1) |
| 1486 |
If StringValue <> "" Then sSummary &= " (" & StringValue.Replace("|", ", ") & ")" |
| 1487 |
Case SetTasksEnum.Unset |
| 1488 |
sSummary &= "Unset " & Adventure.GetNameFromKey(sKey1) |
| 1489 |
End Select |
| 1490 |
If sPropertyValue <> "" Then |
| 1491 |
sSummary &= " : NEXT %Loop%" |
| 1492 |
End If |
| 1493 |
Case ItemEnum.Time |
| 1494 |
sSummary = "Skip " & StringValue & " turns" |
| 1495 |
|
| 1496 |
Case ItemEnum.EndGame |
| 1497 |
Select Case Me.eEndgame |
| 1498 |
Case EndGameEnum.Win |
| 1499 |
sSummary = "End game in Victory" |
| 1500 |
Case EndGameEnum.Lose |
| 1501 |
sSummary = "End game in Defeat" |
| 1502 |
Case EndGameEnum.Neutral |
| 1503 |
sSummary = "End game" |
| 1504 |
End Select |
| 1505 |
|
| 1506 |
Case ItemEnum.Conversation |
| 1507 |
Select Case Me.eConversation |
| 1508 |
Case ConversationEnum.Greet |
| 1509 |
sSummary = "Greet " & Adventure.GetNameFromKey(sKey1) & IIf(StringValue <> "", " with '" & StringValue & "'", "").ToString |
| 1510 |
Case ConversationEnum.Ask |
| 1511 |
sSummary = "Ask " & Adventure.GetNameFromKey(sKey1) & " about '" & StringValue & "'" |
| 1512 |
Case ConversationEnum.Tell |
| 1513 |
sSummary = "Tell " & Adventure.GetNameFromKey(sKey1) & " about '" & StringValue & "'" |
| 1514 |
Case ConversationEnum.Command |
| 1515 |
sSummary = "Say '" & StringValue & "' to " & Adventure.GetNameFromKey(sKey1) |
| 1516 |
Case ConversationEnum.EnterConversation |
| 1517 |
sSummary = "Enter conversation with " & Adventure.GetNameFromKey(sKey1) |
| 1518 |
Case ConversationEnum.LeaveConversation |
| 1519 |
sSummary = "Leave conversation with " & Adventure.GetNameFromKey(sKey1) |
| 1520 |
End Select |
| 1521 |
End Select |
| 1522 |
Catch |
| 1523 |
sSummary = "Bad Action Definition" |
| 1524 |
End Try |
| 1525 |
Return sSummary |
| 1526 |
End Get |
| 1527 |
End Property |
| 1528 |
|
| 1529 |
End Class |