88 for (
uint32 lvl = 0; lvl < 10; ++lvl) {
152 for (std::vector<Spell>::iterator sp =
_availSpells[spellLevel].begin(); sp !=
_availSpells[spellLevel].end(); ++sp) {
160 for (std::vector<Spell>::iterator sp =
_knownSpells[spellLevel].begin(); sp !=
_knownSpells[spellLevel].end(); ++sp) {
176 std::vector<Spell> *fromSpellList;
177 std::vector<Spell> *toSpellList;
198 fromListBox->
remove(spellItem);
205 toListBox->
add(spellItem,
true);
209 for (std::vector<Spell>::iterator it = fromSpellList->begin(); it != fromSpellList->end(); ++it) {
211 toSpellList->push_back(*it);
212 fromSpellList->erase(it);
221 if (widget.
getTag() ==
"OkButton") {
222 for (
size_t lvl = 0; lvl <
_knownSpells.size(); ++lvl) {
231 if (widget.
getTag() ==
"CancelButton") {
236 if (widget.
getTag() ==
"RecommendButton") {
243 if (widget.
getTag() ==
"ResetButton") {
252 if (widget.
getTag() ==
"SpellLevel" + Common::composeString<uint32>(lvl)) {
267 for (
size_t lvl = 2; lvl < twodaSpellGain.
getColumnCount(); ++lvl) {
268 if (spellLevelRow.
empty(lvl)) {
285 if (gainTable ==
"CLS_SPGN_BARD") {
287 }
else if (gainTable ==
"CLS_SPGN_CLER") {
288 casterName =
"Cleric";
289 }
else if (gainTable ==
"CLS_SPGN_DRUI") {
290 casterName =
"Druid";
291 }
else if (gainTable ==
"CLS_SPGN_PAL") {
292 casterName =
"Paladin";
293 }
else if (gainTable ==
"CLS_SPGN_RANG") {
294 casterName =
"Ranger";
295 }
else if (gainTable ==
"CLS_SPGN_WIZ" || gainTable ==
"CLS_SPGN_SORC") {
296 casterName =
"Wiz_Sorc";
298 error(
"Unknown caster name when building spells list: %s", gainTable.
c_str());
306 oppositeSchool = rowOppSchool.
getString(
"Letter");
311 for (
size_t sp = 0; sp < twodaSpells.
getRowCount(); ++sp) {
315 if (spellRow.
empty(
"Name"))
318 if (spellRow.
empty(casterName))
327 if (spellRow.
getString(
"School") == oppositeSchool)
331 if (gainTable ==
"CLS_SPGN_WIZ" && spellLevel == 0) {
356 iconName =
"ir_cantrips";
357 }
else if (lvl > 0 && lvl < 7) {
358 iconName =
"ir_level" + lvlStr;
360 iconName =
"ir_level789";
363 const std::vector<Common::UString> texture(1, iconName);
370 for (
size_t ab = 0; ab < twodaAbilities.
getRowCount(); ++ab) {
379 size_t lvlToShow = 0;
380 for (
size_t lvl =
_maxLevel; lvl == 0UL; --lvl)
392 if (classRow.
empty(
"SpellKnownTable") && classLevel == 0) {
403 if (knownRow.
empty(c))
416 std::vector<std::vector<uint16> > prefSpells;
420 bool allSpellsMoved =
false;
422 allSpellsMoved =
true;
427 if ((*s).spellID != prefSpells[lvl].front())
430 allSpellsMoved =
false;
434 prefSpells[lvl].erase(prefSpells[lvl].begin());
440 if (allSpellsMoved && prefSpells[lvl].size() > 0) {
441 prefSpells[lvl].erase(prefSpells[lvl].begin());
442 allSpellsMoved =
false;
446 if (prefSpells[lvl].size() == 0)
Class to hold the two-dimensional array of a 2DA file.
uint8 getHitDice() const
Returns the number of hit dice, which is effectively the total number of levels.
Common::ScopedPtr< CharHelp > _spellHelp
The global graphics manager.
#define TalkMan
Shortcut for accessing the talk manager.
const Common::UString & getString(size_t column) const
Return the contents of a cell as a string.
uint32 _returnCode
The GUI's return code.
A class holding an UTF-8 string.
WidgetListBox * _availListBox
WidgetListBox * getListBox(const Common::UString &tag, bool vital=false)
std::vector< std::vector< Spell > > _availSpells
CharSpells(CharGenChoices &choices, Engines::Console *console)
bool beginsWith(const UString &with) const
const Creature & getCharacter()
bool endsWith(const UString &with) const
void moveSpell(WidgetListItemSpell *spellItem)
size_t getRowCount() const
Return the number of rows in the array.
void showSpellHelp(Spell &spell)
uint8 getTotalAbility(Ability ability) const
Utility templates and functions for working with strings and streams.
void callbackActive(Widget &widget)
Callback that's triggered when a widget was activated.
std::vector< std::vector< Spell > > _knownSpells
WidgetButton * getButton(const Common::UString &tag, bool vital=false)
const char * c_str() const
Return the (utf8 encoded) string data.
size_t getColumnCount() const
Return the number of columns in the array.
WidgetListBox * _knownListBox
WidgetLabel * getLabel(const Common::UString &tag, bool vital=false)
Utility templates and functions.
CharGenChoices * _choices
Handling BioWare's 2DAs (two-dimensional array).
int8 getAbilityModifier(Ability ability)
A node within a 3D model.
void computeRemainingSpells(const Aurora::TwoDARow &classRow)
uint16 getClassLevel(uint32 classID) const
Get the creature's level for this class.
void load(const Common::UString &resref)
#define TwoDAReg
Shortcut for accessing the 2da registry.
int32 getInt(size_t column) const
Return the contents of a cell as an int.
void setSpell(size_t spellLevel, uint16 spell)
void getPrefSpells(std::vector< std::vector< uint16 > > &spells)
bool empty(size_t column) const
Check if the cell is empty.
UString toLower() const
Return a lowercased copy of the string.
const TwoDARow & getRow(size_t row) const
Get a row.
void setRecommendedSpells()
The spells selection GUI in CharGen.
The global talk manager for Aurora strings.
A creature in a Neverwinter Nights area.
std::vector< uint8 > _remainingSpells
uint8 getSpellSchool() const
void fixWidgetType(const Common::UString &tag, NWN::GUI::WidgetType &type)
void showSpellLevel(size_t spellLevel, bool forceUpdate=false)
size_t _currentSpellLevel
void NORETURN_PRE error(const char *s,...)
bool empty()
Check if the gui is currently empty.
#define GfxMan
Shortcut for accessing the graphics manager.
void setTextures(const std::vector< Common::UString > &textures)
Set textures to the node.