-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPawnList.cs
883 lines (806 loc) · 33.5 KB
/
PawnList.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using LavishVMAPI;
namespace Vanguard.ISXVG
{
/// <summary>
/// This exception is only thrown if there is an error in syntax during a PawnList search.
/// </summary>
[Serializable]
public class PawnListSyntaxException : Exception
{
/// <summary>
/// Initializes a new instance of the <see cref="PawnListSyntaxException"/> class.
/// </summary>
internal PawnListSyntaxException() {}
/// <summary>
/// Initializes a new instance of the <see cref="PawnListSyntaxException"/> class.
/// </summary>
/// <param name="message">The message.</param>
internal PawnListSyntaxException(string message) : base(message) {}
/// <summary>
/// Initializes a new instance of the <see cref="PawnListSyntaxException"/> class.
/// </summary>
/// <param name="message">The message.</param>
/// <param name="argument">The argument.</param>
internal PawnListSyntaxException(string message, string argument)
: base(message)
{
Argument = argument;
}
/// <summary>
/// Initializes a new instance of the <see cref="PawnListSyntaxException"/> class.
/// </summary>
/// <param name="message">The message.</param>
/// <param name="inner">The inner.</param>
internal PawnListSyntaxException(string message, Exception inner) : base(message, inner) {}
protected PawnListSyntaxException(
SerializationInfo info,
StreamingContext context) : base(info, context) {}
/// <summary>
/// The argument that caused the syntax exception.
/// </summary>
/// <value>The argument.</value>
public string Argument { get; private set; }
}
/// <summary>
/// An enumerable list of Pawns. This is created to give you the ability to create a collection of Pawns, from
/// a set of search strings. See the remarks for valid search strings.
/// </summary>
public sealed class PawnList : IEnumerable<Pawn>
{
private readonly List<Pawn> _lst;
/// <summary>
/// Initializes a new instance of the <see cref="PawnList"/> class.
/// </summary>
/// <param name="search">The search params.</param>
public PawnList(params string[] search) : this(false, search) {}
/// <summary>
/// Initializes a new instance of the <see cref="PawnList"/> class.
/// </summary>
/// <param name="throwSyntaxErrors">if set to <c>true</c> [throw syntax errors].</param>
/// <param name="search">The search.</param>
public PawnList(bool throwSyntaxErrors, params string[] search)
{
// We want it all done in a single frame. This may hurt FPS.
// Make sure the user is aware!
using (new FrameLock(true))
{
// Set our search args. And parse everything.
SearchArguments = new PawnSearchArgs(throwSyntaxErrors, search);
_lst = new List<Pawn>();
// This is our main 'search' function.
RefreshList();
}
}
/// <summary>
/// Gets the search arguments of this <see cref="PawnList"/>.
/// </summary>
/// <value>The search arguments.</value>
public PawnSearchArgs SearchArguments { get; private set; }
/// <summary>
/// Gets the count of this <see cref="PawnList"/>.
/// </summary>
/// <value>The count.</value>
public int Count { get { return _lst.Count; } }
/// <summary>
/// Gets the <see cref="Vanguard.ISXVG.Pawn"/> at the specified index.
/// </summary>
/// <value></value>
public Pawn this[int index] { get { return _lst[index]; } }
#region IEnumerable<Pawn> Members
/// <summary>
/// Returns an enumerator that iterates through the collection.
/// </summary>
/// <returns>
/// A <see cref="T:System.Collections.Generic.IEnumerator`1" /> that can be used to iterate through the collection.
/// </returns>
/// <filterpriority>1</filterpriority>
public IEnumerator<Pawn> GetEnumerator()
{
return _lst.GetEnumerator();
}
/// <summary>
/// Returns an enumerator that iterates through a collection.
/// </summary>
/// <returns>
/// An <see cref="T:System.Collections.IEnumerator" /> object that can be used to iterate through the collection.
/// </returns>
/// <filterpriority>2</filterpriority>
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
#endregion
/// <summary>
/// Creates a new PawnList based on the search parameters.
/// </summary>
/// <param name="search">The search params.</param>
/// <returns></returns>
public static PawnList Search(params string[] search)
{
return Search(false, search);
}
/// <summary>
/// Creates a new PawnList based on the search parameters.
/// </summary>
/// <param name="throwSyntaxExceptions">if set to <c>true</c> [throw syntax exceptions].</param>
/// <param name="search">The search.</param>
/// <returns></returns>
public static PawnList Search(bool throwSyntaxExceptions, params string[] search)
{
return new PawnList(throwSyntaxExceptions, search);
}
/// <summary>
/// Refreshes this <see cref="PawnList"/> based on the <see cref="SearchArguments"/> provided when creating this class.
/// </summary>
public void RefreshList()
{
// Make sure we run _RefreshList in a framelock. I prefer to split it here, since it makes my life a bit easier
// in case I want to add more functionality.
using (new FrameLock(true))
{
_RefreshList();
}
}
/// <summary>
/// Refreshes this <see cref="PawnList"/> based on the <see cref="SearchArguments"/> provided when creating this class.
/// </summary>
private void _RefreshList()
{
_lst.Clear();
// Really sad that we need to do this... but oh well...
int pawnCount = new VG().PawnCount;
int limit = int.MaxValue; // Laziness.
// Just to shorten stuff a bit.
PawnSearchArgs a = SearchArguments;
// Set our limit ONCE. If limit has no value, it defaults to int.MaxValue.
// Which pretty much removes the limit :P
if (a.Limit.HasValue)
{
limit = a.Limit.Value;
}
float meZ = new Character().Z;
for (int i = 0; i < pawnCount; i++)
{
// We hit the 'limit'. So just stop even going through stuff!
if (_lst.Count >= limit)
{
break;
}
// Store our pawn so we don't need to get a new one 50-60 times per iteration.
Pawn p = new Pawn(i);
PawnType ptype = p.PawnType;
// And now...... the long.... long... search method. Oh boy!
if (a.AggroNpc.HasValue)
{
// If we only wnat NPCs that are aggroed, and the current is not. Skip it.
if (a.AggroNpc.Value && !p.IsAggro)
{
continue;
}
// Opposite of the above.
if (!a.AggroNpc.Value && p.IsAggro)
{
continue;
}
}
if (a.Attackable.HasValue)
{
if (a.Attackable.Value && !p.IsAttackable)
{
continue;
}
if (!a.Attackable.Value && p.IsAttackable)
{
continue;
}
}
if (a.Clickable.HasValue)
{
if (a.Clickable.Value && !p.IsClickable)
{
continue;
}
if (!a.Clickable.Value && p.IsClickable)
{
continue;
}
}
if (a.Corpse.HasValue)
{
if (a.Corpse.Value && ptype != PawnType.Corpse)
{
continue;
}
if (!a.Corpse.Value && ptype == PawnType.Corpse)
{
continue;
}
}
if (a.CraftingStation.HasValue)
{
if (a.CraftingStation.Value && ptype != PawnType.CraftingStation)
{
continue;
}
if (!a.CraftingStation.Value && ptype == PawnType.CraftingStation)
{
continue;
}
}
if (a.Distance.HasValue)
{
if (a.Distance.Value > p.Distance)
{
continue;
}
}
if (!string.IsNullOrEmpty(a.Name))
{
// If the Name property is set, a simple contains should suffice.
// Also, if the Name and ExactName are BOTH set. If this fails,
// the exact name check would fail also. So just do the check now.
// Note: We're doing this via .ToLower() strings. It's just a contains, so casing should have no input on the matter.
if (!p.Name.ToLower().Contains(a.Name.ToLower()))
{
continue;
}
}
if (!string.IsNullOrEmpty(a.ExactName))
{
// Literal match.
if (a.ExactName != p.Name)
{
continue;
}
}
if (a.GroupMember.HasValue)
{
if (a.GroupMember.Value && ptype != PawnType.GroupMember)
{
continue;
}
if (!a.GroupMember.Value && ptype == PawnType.GroupMember)
{
continue;
}
}
// NotID takes precedence over ID.
if (a.NotID.HasValue)
{
if (a.NotID.Value == p.ID)
{
continue;
}
}
if (a.ID.HasValue)
{
if (a.ID.Value != p.ID)
{
continue;
}
}
// If OuterRadius has a value. InnerRadius will have one too.
// But since only InnerRadius differing from OutRadius changes
// the search, we'll use that within the a.OuterRadius.HasValue check.
if (a.OuterRadius.HasValue)
{
float distance = p.Distance;
if (a.InnerRadius.Value != a.OuterRadius.Value)
{
// Means we need to check for a distance 'within'.
if (a.InnerRadius.Value <= distance || a.OuterRadius.Value >= distance)
{
continue;
}
}
else
{
if (a.OuterRadius.Value > distance)
{
continue;
}
}
}
// Do both checks.
if (a.MaxLevel.HasValue || a.MinLevel.HasValue)
{
int lvl = p.Level;
if (a.MaxLevel.HasValue)
{
if (a.MaxLevel <= lvl)
{
continue;
}
}
if (a.MinLevel.HasValue)
{
if (a.MinLevel >= lvl)
{
continue;
}
}
}
if (a.Merchant.HasValue)
{
if (a.Merchant.Value && ptype != PawnType.Merchant)
{
continue;
}
if (!a.Merchant.Value && ptype == PawnType.Merchant)
{
continue;
}
}
if (a.MyPet.HasValue)
{
if (a.MyPet.Value && ptype != PawnType.MyPet)
{
continue;
}
if (!a.MyPet.Value && ptype == PawnType.MyPet)
{
continue;
}
}
if (a.NoOwner.HasValue)
{
if (a.NoOwner.HasValue && p.Owner.IsValid)
{
continue;
}
}
if (a.Npc.HasValue)
{
if (a.Npc.Value && ptype != PawnType.NPC)
{
continue;
}
if (!a.Npc.Value && ptype == PawnType.NPC)
{
continue;
}
}
if (a.Pc.HasValue)
{
if (a.Pc.Value && ptype != PawnType.PC)
{
continue;
}
if (!a.Pc.Value && ptype == PawnType.PC)
{
continue;
}
}
if (a.Pet.HasValue)
{
if (a.Pet.Value && ptype != PawnType.Pet)
{
continue;
}
if (!a.Pet.Value && ptype == PawnType.Pet)
{
continue;
}
}
if (a.QuestNpc.HasValue)
{
if (a.QuestNpc.Value && !p.HasQuestFlag)
{
continue;
}
if (!a.QuestNpc.Value && p.HasQuestFlag)
{
continue;
}
}
if (!string.IsNullOrEmpty(a.Race))
{
if (p.Race.ToLower() != a.Race.ToLower())
{
continue;
}
}
if (a.Resource.HasValue)
{
if (a.Resource.Value && ptype != PawnType.Resource)
{
continue;
}
if (!a.Resource.Value && ptype == PawnType.Resource)
{
continue;
}
}
if (a.Trainer.HasValue)
{
if (a.Trainer.Value && ptype != PawnType.Trainer)
{
continue;
}
if (!a.Trainer.Value && ptype == PawnType.Trainer)
{
continue;
}
}
if (!string.IsNullOrEmpty(a.Type))
{
if (a.Type.ToLower() != p.Type.ToLower())
{
continue;
}
}
if (a.ZRange.HasValue)
{
// Should be right.... right?
float zdist = Math.Abs(meZ - p.Z);
if (zdist >= a.ZRange.Value)
{
continue;
}
}
// FINALLY! THE END! All our checks passed. So we can FINALLY add the pawn to the list.
// Holy christ that took forever!
_lst.Add(p);
}
}
#region Nested type: PawnSearchArgs
/// <summary>
/// <para>A (small.. kinda) struct to hold information about the passed search arguments.
/// All of the types in this struct are nullable for a reason. (Things can get screwy if you define
/// bools that shouldn't be defined.)</para>
///
/// <para>Use #field#.HasValue and #field#.Value to get values for things (not valid for strings. Just use them normally).
/// You shouldn't need to read from this struct. It is mainly used internally, however,
/// I have left it public (with readonly fields) in case you want to add some sort of functionality.</para>
/// </summary>
public struct PawnSearchArgs
{
// So... do YOU know about nullable types? :)
public readonly bool? AggroNpc;
public readonly bool? Attackable;
public readonly bool? Clickable;
public readonly bool? Corpse;
public readonly bool? CraftingStation;
public readonly float? Distance;
public readonly string ExactName;
public readonly bool? GroupMember;
public readonly int? ID;
public readonly float? InnerRadius;
public readonly int? Limit;
public readonly int? MaxLevel;
public readonly bool? Merchant;
public readonly int? MinLevel;
public readonly bool? MyPet;
public readonly string Name;
public readonly bool? NoOwner;
public readonly int? NotID;
public readonly bool? Npc;
public readonly float? OuterRadius;
public readonly bool? Pc;
public readonly bool? Pet;
public readonly bool? QuestNpc;
public readonly string Race;
public readonly bool? Resource;
public readonly bool? Trainer;
public readonly string Type;
public readonly float? ZRange;
/// <summary>
/// Initializes a new instance of the <see cref="PawnSearchArgs"/> struct.
/// </summary>
/// <param name="throwSyntaxErrors">if set to <c>true</c> syntax exceptions will be thrown.</param>
/// <param name="args">The args.</param>
/// <exception cref="PawnListSyntaxException">
/// Thrown when syntax is wrong.
/// Sytnax expectation, and use are returned, as well as the invalid argument.
/// </exception>
// I forget if using the structs default ctor will set all the fields to null, or their normal default (0, false, etc)
// I don't have time to test it at the moment. But if needed, the fields may need to be set to null manually.
public PawnSearchArgs(bool throwSyntaxErrors, params string[] args) : this()
{
#region Prelim splitting in case people use ',' to split args
List<string> realArgs = new List<string>();
foreach (string s in args)
{
// Just split by , Since some args require spaces!
string[] insert = s.Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries);
foreach (string ins in insert)
{
// Trim any extra whitespace
realArgs.Add(ins.Trim());
}
}
#endregion
foreach (string arg in realArgs)
{
// This isn't incredibly glamorous. But oh well. Eventually I'll write a (very) long regex
// to handle this much quicker. Until then, this will have to do.
bool not = arg.StartsWith("not");
// We're only checking the 'actual' argument. This shouldn't include the 'not' delimiter.
string toCheck = not
? arg.Substring(3)
: arg;
string[] spaceSplit = toCheck.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries);
#region 'level' switch
if (toCheck.StartsWith("level"))
{
if (spaceSplit.Length == 2)
{
// We should be 2 items in the main array. (level #, or level #-# still comes out to 2 items when split by ' ')
string[] levels = spaceSplit[1].Split(new[] {'-'}, StringSplitOptions.RemoveEmptyEntries);
MinLevel = levels.Length == 2
? Convert.ToInt32(levels[0])
: Convert.ToInt32(spaceSplit[1]);
MaxLevel = levels.Length == 2
? Convert.ToInt32(levels[1])
: Convert.ToInt32(spaceSplit[1]);
}
else if (throwSyntaxErrors)
{
throw new PawnListSyntaxException(
"Invalid level syntax. Supported forms are: level #, or level #-#.", arg);
}
}
#endregion
#region 'distance' switch
else if (toCheck.StartsWith("distance"))
{
if (spaceSplit.Length == 2)
{
Distance = Convert.ToSingle(spaceSplit[1]);
}
else if (throwSyntaxErrors)
{
throw new PawnListSyntaxException(
"Invalid distance syntax. Supported form is: distance #. # may be of type float.", arg);
}
}
#endregion
#region 'clickable'
else if (toCheck.StartsWith("clickable"))
{
// Simplicity!
Clickable = !not;
}
#endregion
#region 'aggronpc'
else if (toCheck.StartsWith("aggronpc"))
{
AggroNpc = !not;
}
#endregion
#region 'attackable'
else if (toCheck.StartsWith("attackable"))
{
Attackable = !not;
}
#endregion
#region 'corpse'
else if (toCheck.StartsWith("corpse"))
{
Corpse = !not;
}
#endregion
#region 'craftingstation'
else if (toCheck.StartsWith("craftingstation"))
{
CraftingStation = !not;
}
#endregion
#region 'groupmember'
else if (toCheck.StartsWith("groupmember"))
{
GroupMember = !not;
}
#endregion
#region 'npc'
else if (toCheck.StartsWith("npc"))
{
Npc = !not;
}
#endregion
#region 'pc'
else if (toCheck.StartsWith("pc"))
{
Pc = !not;
}
#endregion
#region 'pet'
else if (toCheck.StartsWith("pet"))
{
Pet = !not;
}
#endregion
#region 'questnpc'
else if (toCheck.StartsWith("questnpc"))
{
QuestNpc = !not;
}
#endregion
#region 'resource'
else if (toCheck.StartsWith("resource"))
{
Resource = !not;
}
#endregion
#region 'trainer'
else if (toCheck.StartsWith("trainer"))
{
Trainer = !not;
}
#endregion
#region 'mypet'
else if (toCheck.StartsWith("mypet"))
{
Trainer = !not;
}
#endregion
#region 'noowner'
// No 'not' clause for this.
else if (toCheck.StartsWith("noowner"))
{
if (!not)
{
NoOwner = true;
}
else if (throwSyntaxErrors)
{
throw new PawnListSyntaxException("There is no 'not' clause for the noowner switch.", arg);
}
}
#endregion
#region 'merchant'
else if (toCheck.StartsWith("merchant"))
{
Merchant = !not;
}
#endregion
#region Radius checks
else if (toCheck.StartsWith("radius"))
{
if (spaceSplit.Length == 2)
{
string[] radii = spaceSplit[1].Split(new[] {'-'}, StringSplitOptions.RemoveEmptyEntries);
InnerRadius = radii.Length == 2
? Convert.ToSingle(radii[0])
: Convert.ToSingle(spaceSplit[1]);
OuterRadius = radii.Length == 2
? Convert.ToSingle(radii[1])
: Convert.ToSingle(spaceSplit[1]);
}
else if (throwSyntaxErrors)
{
throw new PawnListSyntaxException(
"Invalid radius syntax. Possible values are: radius #, or radius #-#.", arg);
}
}
#endregion
#region 'zrange'
else if (toCheck.StartsWith("zrange"))
{
if (spaceSplit.Length == 2)
{
ZRange = Convert.ToSingle(spaceSplit[1]);
}
else if (throwSyntaxErrors)
{
throw new PawnListSyntaxException(
"Invalid zrange syntax. Valid syntax is: zrange #. # may be a float.");
}
}
#endregion
#region 'id' and 'notid'
else if (toCheck.StartsWith("id"))
{
if (not)
{
if (spaceSplit.Length == 2)
{
NotID = Convert.ToInt32(spaceSplit[1]);
}
else if (throwSyntaxErrors)
{
throw new PawnListSyntaxException("Invalid syntax for notid. Valid syntax is: notid #",
arg);
}
}
else
{
if (spaceSplit.Length == 2)
{
ID = Convert.ToInt32(spaceSplit[1]);
}
else if (throwSyntaxErrors)
{
throw new PawnListSyntaxException("Invalid syntax for id. Valid syntax is: id #", arg);
}
}
}
#endregion
#region 'race'
else if (toCheck.StartsWith("race"))
{
if (spaceSplit.Length == 2)
{
Race = spaceSplit[1];
}
else if (throwSyntaxErrors)
{
throw new PawnListSyntaxException("Invalid syntax for race. Valid syntax is: race Dwarf",
arg);
}
}
#endregion
#region 'type'
else if (toCheck.StartsWith("type"))
{
if (spaceSplit.Length == 2)
{
Type = spaceSplit[1];
}
else if (throwSyntaxErrors)
{
throw new PawnListSyntaxException(
"Invalid syntax for type. Valid syntax is: type typeString", arg);
}
}
#endregion
#region 'name'
else if (toCheck.StartsWith("name"))
{
if (spaceSplit.Length == 2)
{
Name = spaceSplit[1];
}
else if (throwSyntaxErrors)
{
throw new PawnListSyntaxException(
"Invalid syntax for name. Valid syntax is: name nameToCheck", arg);
}
}
#endregion
#region 'exactname'
else if (toCheck.StartsWith("exactname"))
{
if (spaceSplit.Length == 2)
{
ExactName = spaceSplit[1];
}
else if (throwSyntaxErrors)
{
throw new PawnListSyntaxException(
"Invalid syntax for exactname. Valid syntax is: exactname NameToCheck", arg);
}
}
#endregion
#region 'limit'
else if (toCheck.StartsWith("limit"))
{
if (spaceSplit.Length == 2)
{
Limit = Convert.ToInt32(spaceSplit[1]);
}
else if (throwSyntaxErrors)
{
throw new PawnListSyntaxException("Invalid limit syntax. Valid syntax is: limit #");
}
}
#endregion
#region Catch all
else
{
if (throwSyntaxErrors)
{
throw new PawnListSyntaxException("Invalid switch parameter provided.", arg);
}
}
#endregion
}
}
}
#endregion
}
}