Mercurial > repos > IBDev-IBBoard.WarFoundry.API
comparison api/Objects/Stats.cs @ 181:8c6f55d289b0
Fixes #200: Stats names should be case-insensitive
* ToLower() all stat names/IDs so that they are case-insensitive
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 24 Oct 2009 15:18:00 +0000 |
parents | 5145b7c61ae0 |
children | ece26f6a62f3 |
comparison
equal
deleted
inserted
replaced
180:55dc7c97fcfe | 181:8c6f55d289b0 |
---|---|
33 get { return stats.ToArray(); } | 33 get { return stats.ToArray(); } |
34 } | 34 } |
35 | 35 |
36 public void SetStatValue(string statName, string statValue) | 36 public void SetStatValue(string statName, string statValue) |
37 { | 37 { |
38 StatSlot slot = sysStats[statName]; | 38 StatSlot slot = sysStats[statName.ToLower()]; |
39 | 39 |
40 if (slot!=null) | 40 if (slot!=null) |
41 { | 41 { |
42 int pos = sysStats.GetStatSlotPosition(slot); | 42 int pos = sysStats.GetStatSlotPosition(slot); |
43 | 43 |
50 | 50 |
51 public Stat this[string id] | 51 public Stat this[string id] |
52 { | 52 { |
53 get | 53 get |
54 { | 54 { |
55 StatSlot slot = sysStats[id]; | 55 StatSlot slot = sysStats[id.ToLower()]; |
56 int pos = sysStats.GetStatSlotPosition(slot); | 56 int pos = sysStats.GetStatSlotPosition(slot); |
57 Stat stat = null; | 57 Stat stat = null; |
58 | 58 |
59 try | 59 try |
60 { | 60 { |
84 } | 84 } |
85 } | 85 } |
86 | 86 |
87 public string GetStatValue(string id) | 87 public string GetStatValue(string id) |
88 { | 88 { |
89 return this[id].SlotValueString; | 89 return this[id.ToLower()].SlotValueString; |
90 } | 90 } |
91 | 91 |
92 public int StatCount | 92 public int StatCount |
93 { | 93 { |
94 get { return stats.Count; } | 94 get { return stats.Count; } |