Mercurial > repos > IBDev-IBBoard.WarFoundry.API
comparison api/Exporters/WarFoundryHtmlExporter.cs @ 208:e8e9026dd4ea
Fixes #216: Export unit abilities in to HTML
* Add export of ability names in HTML
* Restructure the equipment export code so that there is some degree of differentiation between equipments and abilities
Re #213: Add abilities to units
* Add initial stub "Abilities" property to unit that returns required abilities
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Mon, 09 Nov 2009 16:49:27 +0000 |
parents | 91f7b8da0b53 |
children | 1b718b67f7f6 |
comparison
equal
deleted
inserted
replaced
207:897c53d5a8aa | 208:e8e9026dd4ea |
---|---|
141 statCell.InnerText = stat.SlotValueString; | 141 statCell.InnerText = stat.SlotValueString; |
142 row.AppendChild(statCell); | 142 row.AppendChild(statCell); |
143 } | 143 } |
144 | 144 |
145 StringBuilder sb = new StringBuilder(); | 145 StringBuilder sb = new StringBuilder(); |
146 bool addSeparator = false; | 146 UnitEquipmentItem[] unitEquipment = unit.GetEquipment (); |
147 | 147 |
148 foreach (UnitEquipmentItem equip in unit.GetEquipment()) | 148 if (unitEquipment.Length > 0) |
149 { | 149 { |
150 if (!addSeparator) | 150 bool addSeparator = false; |
151 | |
152 foreach (UnitEquipmentItem equip in unitEquipment) | |
151 { | 153 { |
152 addSeparator = true; | 154 if (!addSeparator) |
155 { | |
156 addSeparator = true; | |
157 } | |
158 else | |
159 { | |
160 sb.Append(", "); | |
161 } | |
162 | |
163 sb.Append(Translation.GetTranslation("armyHtmlExportEquipAmountRatio", "{0} for {1}", equip.Name, unit.GetEquipmentAmountString(equip))); | |
153 } | 164 } |
154 else | 165 |
166 sb.Append(". "); | |
167 } | |
168 | |
169 ICollection<Ability> abilities = unit.Abilities; | |
170 | |
171 if (abilities.Count > 0) | |
172 { | |
173 bool addSeparator = false; | |
174 | |
175 foreach (Ability ability in abilities) | |
155 { | 176 { |
156 sb.Append(", "); | 177 if (!addSeparator) |
178 { | |
179 addSeparator = true; | |
180 } | |
181 else | |
182 { | |
183 sb.Append(", "); | |
184 } | |
185 | |
186 sb.Append(ability.Name); | |
157 } | 187 } |
158 | 188 |
159 sb.Append(Translation.GetTranslation("armyHtmlExportEquipAmountRatio", "{0} for {1}", equip.Name, unit.GetEquipmentAmountString(equip))); | 189 sb.Append(". "); |
160 } | 190 } |
161 | 191 |
162 XmlElement notes = doc.CreateElement("td"); | 192 XmlElement notes = doc.CreateElement("td"); |
163 notes.InnerText = sb.ToString(); | 193 notes.InnerText = sb.ToString(); |
164 row.AppendChild(notes); | 194 row.AppendChild(notes); |