ManaPlus
charcreatedialog.cpp
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2004-2009 The Mana World Development Team
4  * Copyright (C) 2009-2010 The Mana Developers
5  * Copyright (C) 2011-2018 The ManaPlus Developers
6  *
7  * This file is part of The ManaPlus Client.
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <http://www.gnu.org/licenses/>.
21  */
22 
24 
25 #include "configuration.h"
26 
28 
29 #include "being/being.h"
30 
31 #include "gui/windows/okdialog.h"
32 
33 #include "gui/widgets/button.h"
36 #include "gui/widgets/label.h"
37 #include "gui/widgets/playerbox.h"
38 #include "gui/widgets/slider.h"
39 #include "gui/widgets/tabstrip.h"
40 #include "gui/widgets/textfield.h"
41 
42 #include "net/charserverhandler.h"
43 #include "net/serverfeatures.h"
44 
45 #include "resources/iteminfo.h"
46 
47 #include "resources/db/chardb.h"
48 #include "resources/db/colordb.h"
49 #include "resources/db/itemdb.h"
50 
51 #include "utils/delete2.h"
52 #include "utils/gettext.h"
53 
54 #include "debug.h"
55 
56 #undef ERROR
57 
58 static const BeingActionT actions[] =
59 {
65 };
66 
67 static const uint8_t directions[] =
68 {
73 };
74 
76  const int slot) :
77  // TRANSLATORS: char create dialog name
78  Window(_("New Character"), Modal_true, parent, "charcreate.xml"),
80  KeyListener(),
81  mCharSelectDialog(parent),
82  mNameField(new TextField(this, std::string(),
83  LoseFocusOnTab_true, nullptr, std::string(), false)),
84  // TRANSLATORS: char create dialog label
85  mNameLabel(new Label(this, _("Name:"))),
86  mNextHairColorButton(nullptr),
87  mPrevHairColorButton(nullptr),
88  mHairColorLabel(nullptr),
89  mHairColorNameLabel(nullptr),
90  mNextHairStyleButton(nullptr),
91  mPrevHairStyleButton(nullptr),
92  mHairStyleLabel(nullptr),
93  mHairStyleNameLabel(nullptr),
94  mNextRaceButton(nullptr),
95  mPrevRaceButton(nullptr),
96  mRaceLabel(nullptr),
97  mRaceNameLabel(nullptr),
98  mNextLookButton(nullptr),
99  mPrevLookButton(nullptr),
100  mLookLabel(nullptr),
101  mLookNameLabel(nullptr),
102  // TRANSLATORS: char create dialog button
103  mActionButton(new Button(this, _("^"), "action", this)),
104  // TRANSLATORS: char create dialog button
105  mRotateButton(new Button(this, _(">"), "rotate", this)),
106  mAttributeSlider(),
107  mAttributeLabel(),
108  mAttributeValue(),
109  mAttributesLeft(new Label(this,
110  // TRANSLATORS: char create dialog label
111  strprintf(_("Please distribute %d points"), 99))),
112  // TRANSLATORS: char create dialog button
113  mCreateButton(new Button(this, _("Create"), "create", this)),
114  // TRANSLATORS: char create dialog button
115  mCancelButton(new Button(this, _("Cancel"), "cancel", this)),
116  mPlayer(Being::createBeing(BeingId_zero,
117  ActorType::Player,
119  nullptr)),
120  mPlayerBox(new PlayerBox(this, mPlayer, "charcreate_playerbox.xml",
121  "charcreate_selectedplayerbox.xml")),
122  mGenderStrip(nullptr),
123  mMaxPoints(0),
124  mUsedPoints(0),
125  mRace(CharDB::getMinRace()),
126  mLook(0),
131  mHairStyle(0),
132  mHairColor(0),
133  mMaxY(0U),
134  mSlot(slot),
135  mDefaultGender(Gender::FEMALE),
136  mGender(Gender::UNSPECIFIED),
137  maxHairColor(CharDB::getMaxHairColor()),
138  minHairColor(CharDB::getMinHairColor()),
139  maxHairStyle(CharDB::getMaxHairStyle()),
140  minHairStyle(CharDB::getMinHairStyle()),
141  mAction(0),
142  mDirection(0)
143 {
144  setStickyButtonLock(true);
145  setSticky(true);
146  setWindowName("NewCharacter");
147 
148  const int w = 480;
149  const int h = 350;
150  setContentSize(w, h);
151 
153  const STD_VECTOR<BeingSlot> &items = CharDB::getDefaultItems();
154  int i = 1;
155  for (STD_VECTOR<BeingSlot>::const_iterator it = items.begin(),
156  it_fend = items.end();
157  it != it_fend;
158  ++ it, i ++)
159  {
160  const BeingSlot &beingSlot = *it;
162  beingSlot.spriteId,
163  beingSlot.cardsId);
164  }
165 
166  if (maxHairColor == 0u)
168  if (maxHairStyle == 0u)
170 
171  if (maxHairStyle != 0u)
172  {
173  mHairStyle = (CAST_U32(rand())
175  }
176  else
177  {
178  mHairStyle = 0;
179  }
180  if (maxHairColor != 0u)
181  {
182  mHairColor = (CAST_U32(rand())
184  }
185  else
186  {
187  mHairColor = 0;
188  }
189 
190  mNameField->setMaximum(24);
191 
193  {
194  // TRANSLATORS: This is a narrow symbol used to denote 'next'.
195  // You may change this symbol if your language uses another.
196  // TRANSLATORS: char create dialog button
197  mNextHairColorButton = new Button(this, _(">"), "nextcolor", this);
198  // TRANSLATORS: This is a narrow symbol used to denote 'previous'.
199  // You may change this symbol if your language uses another.
200  // TRANSLATORS: char create dialog button
201  mPrevHairColorButton = new Button(this, _("<"), "prevcolor", this);
202  // TRANSLATORS: char create dialog label
203  mHairColorLabel = new Label(this, _("Hair color:"));
204  mHairColorNameLabel = new Label(this, "");
205  }
206 
208  {
209  // TRANSLATORS: char create dialog button
210  mNextHairStyleButton = new Button(this, _(">"), "nextstyle", this);
211  // TRANSLATORS: char create dialog button
212  mPrevHairStyleButton = new Button(this, _("<"), "prevstyle", this);
213  // TRANSLATORS: char create dialog label
214  mHairStyleLabel = new Label(this, _("Hair style:"));
215  mHairStyleNameLabel = new Label(this, "");
216  }
217 
219  {
220  // TRANSLATORS: char create dialog button
221  mNextRaceButton = new Button(this, _(">"), "nextrace", this);
222  // TRANSLATORS: char create dialog button
223  mPrevRaceButton = new Button(this, _("<"), "prevrace", this);
224  // TRANSLATORS: char create dialog label
225  mRaceLabel = new Label(this, _("Race:"));
226  mRaceNameLabel = new Label(this, "");
227  }
229  {
230  // TRANSLATORS: char create dialog button
231  mNextLookButton = new Button(this, _(">"), "nextlook", this);
232  // TRANSLATORS: char create dialog button
233  mPrevLookButton = new Button(this, _("<"), "prevlook", this);
234  // TRANSLATORS: char create dialog label
235  mLookLabel = new Label(this, _("Look:"));
236  mLookNameLabel = new Label(this, "");
237  }
238 
240  {
241  const int forceGender = features.getIntValue("forceCharGender");
242  if (forceGender == -1)
243  {
244  const int size = config.getIntValue("fontSize");
245  mGenderStrip = new TabStrip(this,
246  "gender_" + getWindowName(),
247  size + 16,
248  0);
249  mGenderStrip->setPressFirst(false);
251  mGenderStrip->setActionEventId("gender_");
252  // TRANSLATORS: one char size female character gender
253  mGenderStrip->addButton(_("F"), "f", false);
254  if (features.getIntValue("forceAccountGender") == -1)
255  {
257  {
258  // TRANSLATORS: one char size male character gender
259  mGenderStrip->addButton(_("M"), "m", true);
260  // TRANSLATORS: one char size other character gender
261  mGenderStrip->addButton(_("O"), "o", false);
262  }
263  else
264  {
265  // TRANSLATORS: one char size male character gender
266  mGenderStrip->addButton(_("M"), "m", false);
267  // TRANSLATORS: one char size unknown character gender
268  mGenderStrip->addButton(_("U"), "u", true);
269  }
270  }
271  else
272  {
273  // TRANSLATORS: one char size male character gender
274  mGenderStrip->addButton(_("M"), "m", true);
276  {
277  // TRANSLATORS: one char size other character gender
278  mGenderStrip->addButton(_("O"), "o", false);
279  }
280  }
281 
282 
284  add(mGenderStrip);
285 
286  mGenderStrip->setPosition(385, 130);
287  mGenderStrip->setWidth(500);
288  mGenderStrip->setHeight(50);
289  }
290  else
291  {
292  mGender = Being::intToGender(CAST_U8(forceGender));
294  }
295  }
296 
297  mPlayerBox->setWidth(74);
298 
299  mNameField->setActionEventId("create");
301 
302  mPlayerBox->setDimension(Rect(360, 0, 110, 90));
303  mActionButton->setPosition(385, 100);
304  mRotateButton->setPosition(415, 100);
305 
308  300, mNameField->getHeight()));
309 
310  const uint32_t labelPadding = getOption("labelPadding", 2);
311  const uint32_t leftX = 120 + mPadding;
312  const uint32_t rightX = 300 + mPadding;
313  const uint32_t labelX = mPadding;
314  uint32_t nameX = leftX + labelPadding;
315  uint32_t y = 30;
316  if (mPrevHairColorButton != nullptr)
317  nameX += mPrevHairColorButton->getWidth();
318  else if (mPrevHairStyleButton != nullptr)
319  nameX += mPrevHairStyleButton->getWidth();
320  else if (mPrevLookButton != nullptr)
321  nameX += mPrevLookButton->getWidth();
322  else if (mPrevRaceButton != nullptr)
323  nameX += mPrevRaceButton->getWidth();
324 
326  {
328  mNextHairColorButton->setPosition(rightX, y);
329  y += 5;
330  mHairColorLabel->setPosition(labelX, y);
331  mHairColorNameLabel->setPosition(nameX, y);
332  y += 24;
333  }
335  {
337  mNextHairStyleButton->setPosition(rightX, y);
338  y += 5;
339  mHairStyleLabel->setPosition(labelX, y);
340  mHairStyleNameLabel->setPosition(nameX, y);
341  y += 24;
342  }
343 
345  {
346  if (mPrevLookButton != nullptr)
347  mPrevLookButton->setPosition(leftX, y);
348  if (mNextLookButton != nullptr)
349  mNextLookButton->setPosition(rightX, y);
350  y += 5;
351  if (mLookLabel != nullptr)
352  mLookLabel->setPosition(labelX, y);
353  if (mLookNameLabel != nullptr)
354  mLookNameLabel->setPosition(nameX, y); // 93
355  y += 24;
356  }
358  {
359  if (mPrevRaceButton != nullptr)
360  mPrevRaceButton->setPosition(leftX, y);
361  if (mNextRaceButton != nullptr)
362  mNextRaceButton->setPosition(rightX, y);
363  y += 5;
364  if (mRaceLabel != nullptr)
365  mRaceLabel->setPosition(labelX, y);
366  if (mRaceNameLabel != nullptr)
367  mRaceNameLabel->setPosition(nameX, y);
368  }
369  mMaxY = y + 29 + getTitlePadding();
370 
371  updateSliders();
372  setButtonsPosition(w, h);
373 
374  add(mPlayerBox);
375  add(mNameField);
376  add(mNameLabel);
377 
379  {
384  }
385 
387  {
392  }
395 
397  {
400  add(mLookLabel);
402  }
403 
405  {
408  add(mRaceLabel);
410  }
411 
415 
416  center();
419 
420  updateHair();
422  updateRace();
424  updateLook();
425  updatePlayer();
426 
427  addKeyListener(this);
428 }
429 
431 {
432  delete2(mPlayer);
433 
434  if (charServerHandler != nullptr)
436 }
437 
439 {
440  const std::string &id = event.getId();
441  if (id == "create")
442  {
443  if (getName().length() >= 4)
444  {
445  // Attempt to create the character
446  mCreateButton->setEnabled(false);
447 
448  STD_VECTOR<int> atts;
449  const size_t sz = mAttributeSlider.size();
450  for (size_t i = 0; i < sz; i++)
451  {
452  atts.push_back(CAST_S32(
453  mAttributeSlider[i]->getValue()));
454  }
455  for (size_t i = sz; i < 6; i ++)
456  atts.push_back(1);
457 
458  const int characterSlot = mSlot;
459 
461  characterSlot,
462  mGender,
463  mHairStyle,
464  mHairColor,
465  CAST_U8(mRace),
466  CAST_U8(mLook),
467  atts);
468  }
469  else
470  {
472  // TRANSLATORS: char creation error
473  _("Error"),
474  // TRANSLATORS: char creation error
475  _("Your name needs to be at least 4 characters."),
476  // TRANSLATORS: ok dialog button
477  _("OK"),
479  Modal_true,
481  nullptr,
482  260);
483  }
484  }
485  else if (id == "cancel")
486  {
487  scheduleDelete();
488  }
489  else if (id == "nextcolor")
490  {
491  mHairColor ++;
492  updateHair();
493  }
494  else if (id == "prevcolor")
495  {
496  mHairColor --;
497  updateHair();
498  }
499  else if (id == "nextstyle")
500  {
501  mHairStyle ++;
502  updateHair();
503  }
504  else if (id == "prevstyle")
505  {
506  mHairStyle --;
507  updateHair();
508  }
509  else if (id == "nextrace")
510  {
511  mRace ++;
512  updateRace();
513  }
514  else if (id == "prevrace")
515  {
516  mRace --;
517  updateRace();
518  }
519  else if (id == "nextlook")
520  {
521  mLook ++;
522  updateLook();
523  }
524  else if (id == "prevlook")
525  {
526  mLook --;
527  updateLook();
528  }
529  else if (id == "statslider")
530  {
531  updateSliders();
532  }
533  else if (id == "action")
534  {
535  mAction ++;
536  if (mAction >= 5)
537  mAction = 0;
538  updatePlayer();
539  }
540  else if (id == "rotate")
541  {
542  mDirection ++;
543  if (mDirection >= 4)
544  mDirection = 0;
545  updatePlayer();
546  }
547  else if (id == "gender_m")
548  {
551  }
552  else if (id == "gender_f")
553  {
556  }
557  else if (id == "gender_u")
558  {
561  }
562  else if (id == "gender_o")
563  {
566  }
567 }
568 
569 std::string CharCreateDialog::getName() const
570 {
571  std::string name = mNameField->getText();
572  trim(name);
573  return name;
574 }
575 
577 {
578  for (size_t i = 0, sz = mAttributeSlider.size(); i < sz; i++)
579  {
580  // Update captions
581  mAttributeValue[i]->setCaption(
582  toString(CAST_S32(mAttributeSlider[i]->getValue())));
583  mAttributeValue[i]->adjustSize();
584  }
585 
586  // Update distributed points
587  const int pointsLeft = mMaxPoints - getDistributedPoints();
588  if (pointsLeft == 0)
589  {
590  // TRANSLATORS: char create dialog label
591  mAttributesLeft->setCaption(_("Character stats OK"));
592  mCreateButton->setEnabled(true);
593  }
594  else
595  {
596  mCreateButton->setEnabled(false);
597  if (pointsLeft > 0)
598  {
600  // TRANSLATORS: char create dialog label
601  strprintf(_("Please distribute %d points"), pointsLeft));
602  }
603  else
604  {
606  // TRANSLATORS: char create dialog label
607  strprintf(_("Please remove %d points"), -pointsLeft));
608  }
609  }
610 
612 }
613 
615 {
616  mCreateButton->setEnabled(true);
617 }
618 
620 {
621  int points = 0;
622 
623  for (size_t i = 0, sz = mAttributeSlider.size(); i < sz; i++)
624  points += CAST_S32(mAttributeSlider[i]->getValue());
625  return points;
626 }
627 
629  int available,
630  const int min, const int max)
631 {
632  size_t sz;
633 
634  if (min == max || available == 0)
635  {
636  sz = 0U;
637  available = 0;
638  }
639  else
640  {
641  sz = labels.size();
642  }
643 
644  mMaxPoints = available;
645 
646  for (size_t i = 0; i < mAttributeLabel.size(); i++)
647  {
648  remove(mAttributeLabel[i]);
650  remove(mAttributeSlider[i]);
652  remove(mAttributeValue[i]);
654  }
655 
656  mAttributeLabel.resize(sz);
657  mAttributeSlider.resize(sz);
658  mAttributeValue.resize(sz);
659 
660  const uint32_t w = 480;
661  uint32_t h = 350;
662  uint32_t y = 89;
664  y += 29;
666  y += 29;
667 
668  for (size_t i = 0; i < sz; i++)
669  {
670  mAttributeLabel[i] = new Label(this, labels[i]);
671  mAttributeLabel[i]->setWidth(70);
672  mAttributeLabel[i]->setPosition(mPadding,
673  y + CAST_S32(i * 24));
674  mAttributeLabel[i]->adjustSize();
675  add(mAttributeLabel[i]);
676 
677  mAttributeSlider[i] = new Slider(this, min, max, 1.0);
678  mAttributeSlider[i]->setDimension(Rect(140 + mPadding,
679  y + CAST_S32(i * 24),
680  150,
681  12));
682  mAttributeSlider[i]->setActionEventId("statslider");
683  mAttributeSlider[i]->addActionListener(this);
684  add(mAttributeSlider[i]);
685 
686  mAttributeValue[i] = new Label(this, toString(min));
687  mAttributeValue[i]->setPosition(295 + mPadding,
688  y + CAST_S32(i * 24));
689  add(mAttributeValue[i]);
690  }
691 
692  updateSliders();
693  if (available == 0)
694  {
696  h = y;
697  }
698  else
699  {
700  h = y +
701  CAST_S32(sz) * 24 +
703  getPadding();
704  }
706  features.getIntValue("forceCharGender") == -1 &&
707  y < 160)
708  {
709  if (h < 160)
710  h = 160;
711  }
712  if (h < mMaxY)
713  h = mMaxY;
715  {
716  const int forceGender = features.getIntValue("forceCharGender");
717  if (forceGender == -1 && h < 180)
718  h = 180;
719  else if (h < 120)
720  h = 120;
721  }
722  h += mCreateButton->getHeight();
723 
724  setContentSize(w, h);
725  setButtonsPosition(w, h);
726 }
727 
729 {
730  if (features.getIntValue("forceCharGender") != -1)
731  return;
732 
733  mDefaultGender = gender;
734  mPlayer->setGender(gender);
735 }
736 
738 {
739  if (mHairStyle <= 0)
741  else
745  {
747  }
748  const ItemInfo &item = ItemDB::get(-mHairStyle);
749  if (mHairStyleNameLabel != nullptr)
750  {
752  mHairStyleNameLabel->resizeTo(150, 150);
753  }
754 
755  if (ColorDB::getHairSize() != 0)
757  else
758  mHairColor = 0;
759  if (mHairColor < 0)
763  {
765  }
766  if (mHairColorNameLabel != nullptr)
767  {
770  mHairColorNameLabel->resizeTo(150, 150);
771  }
772 
774  mHairStyle * -1,
776  updatePlayer();
777 }
778 
780 {
781  if (mRace < mMinRace)
782  mRace = mMaxRace;
783  else if (mRace > mMaxRace)
784  mRace = mMinRace;
785 
786  updateLook();
787 }
788 
790 {
791  const ItemInfo &item = ItemDB::get(-100 - mRace);
792  const int sz = item.getColorsSize();
793  if (sz > 0 && serverFeatures->haveLookSelection())
794  {
795  if (mLook < 0)
796  mLook = sz - 1;
797  if (mLook > mMaxLook)
798  mLook = mMinLook;
799  if (mLook >= sz)
800  mLook = mMinLook;
801  }
802  else
803  {
804  mLook = 0;
805  }
807  CAST_U8(mLook));
808  if (mRaceNameLabel != nullptr)
809  {
811  mRaceNameLabel->resizeTo(150, 150);
812  }
813  if (mLookNameLabel != nullptr)
814  {
816  fromInt(mLook, ItemColor)));
817  mLookNameLabel->resizeTo(150, 150);
818  }
819 }
820 
822 {
823  BLOCK_START("CharCreateDialog::logic")
824  if (mPlayer != nullptr)
825  mPlayer->logic();
826  BLOCK_END("CharCreateDialog::logic")
827 }
828 
830 {
831  if (mPlayer != nullptr)
832  {
835  }
836 }
837 
839 {
840  const InputActionT actionId = event.getActionId();
841  PRAGMA45(GCC diagnostic push)
842  PRAGMA45(GCC diagnostic ignored "-Wswitch-enum")
843  switch (actionId)
844  {
846  event.consume();
849  break;
850 
851  default:
852  break;
853  }
854  PRAGMA45(GCC diagnostic pop)
855 }
856 
857 void CharCreateDialog::setButtonsPosition(const int w, const int h)
858 {
859  const int h2 = h - 5 - mCancelButton->getHeight();
860  if (mainGraphics->getHeight() < 480)
861  {
862  if (mMaxPoints != 0)
863  {
864  mCreateButton->setPosition(337, 160);
866  }
867  else
868  {
870  w / 2,
871  160);
874  160);
875  }
876  }
877  else
878  {
880  w / 2,
881  h2);
884  h2);
885  }
887 }
const std::vector< BeingSlot > & getDefaultItems()
Definition: chardb.cpp:186
#define CAST_U32
Definition: cast.h:30
#define _(s)
Definition: gettext.h:34
const ItemInfo & get(const int id)
Definition: itemdb.cpp:814
Definition: gender.h:28
int getWidth() const
Definition: widget.h:220
const bool LoseFocusOnTab_true
BeingAction ::T BeingActionT
Definition: beingaction.h:40
#define CAST_U8
Definition: cast.h:26
CardsList cardsId
Definition: beingslot.h:45
void setWidth(const int width)
Definition: widget.cpp:132
Being * createBeing(const BeingId id, const int job)
Definition: beingrecv.cpp:500
Button * mPrevHairStyleButton
int mPadding
Definition: window.h:617
std::vector< Label * > mAttributeLabel
const bool Visible_true
Definition: visible.h:29
void action(const ActionEvent &event)
virtual bool haveCharOtherGender() const =0
PRAGMA45(GCC diagnostic push) PRAGMA45(GCC diagnostic ignored "-Wunused-result") int TestLauncher
CharCreateDialog(CharSelectDialog *const parent, const int slot)
virtual void addButton(const std::string &text, const std::string &tag, const bool pressed)
Definition: widgetgroup.cpp:41
unsigned getMinHairColor()
Definition: chardb.cpp:131
#define fromInt(val, name)
Definition: intdefines.h:45
void addActionListener(ActionListener *const actionListener)
Definition: widget.cpp:251
void setVisible(Visible visible)
Definition: widget.cpp:224
Definition: rect.h:72
Definition: window.h:98
unsigned getMaxLook()
Definition: chardb.cpp:171
#define BLOCK_START(name)
Definition: perfomance.h:78
Definition: button.h:94
Configuration config
virtual void setGender(const GenderT gender)
Definition: being.cpp:3555
const BeingTypeId BeingTypeId_zero
Definition: beingtypeid.h:29
void setDimension(const Rect &dimension)
Definition: widget.cpp:168
virtual void setCharCreateDialog(CharCreateDialog *const window) const =0
int getOption(const std::string &name, const int def) const
Definition: window.cpp:1449
void keyPressed(KeyEvent &event)
#define BLOCK_END(name)
Definition: perfomance.h:79
void setMaximum(const int max)
Definition: textfield.h:157
void setAttributes(const StringVect &labels, int available, const int min, const int max)
unsigned int minHairStyle
uint16_t ItemColor
Definition: itemcolor.h:29
int getIntValue(const std::string &key) const
const std::string & getActionEventId() const
Definition: widget.h:604
void setActionEventId(const std::string &actionEventId)
Definition: widget.h:595
std::vector< std::string > StringVect
Definition: stringvector.h:28
const std::string & getName() const
Definition: iteminfo.h:73
#define delete2(var)
Definition: delete2.h:24
void setButtonsPosition(const int w, const int h)
unsigned getMaxHairColor()
Definition: chardb.cpp:136
static GenderT intToGender(const uint8_t sex) A_CONST
Definition: being.h:936
virtual bool haveRaceSelection() const =0
void setSpriteColor(const unsigned int slot, const int id, const std::string &color)
Definition: being.cpp:2863
unsigned getMinLook()
Definition: chardb.cpp:166
std::string & getHairColorName(const ItemColor id)
Definition: colordb.cpp:189
int getDistributedPoints() const
virtual void setDirection(const uint8_t direction)
Definition: being.cpp:1661
#define new
Definition: debug_new.h:147
void setContentSize(int width, int height)
Definition: window.cpp:491
Net::ServerFeatures * serverFeatures
Definition: net.cpp:94
int getTitlePadding() const
Definition: window.h:601
int getColorsSize() const
Definition: iteminfo.h:303
static const BeingActionT actions[]
#define CAST_S32
Definition: cast.h:29
virtual void requestFocus()
Definition: widget.cpp:203
std::string strprintf(const char *const format,...)
Definition: stringutils.cpp:99
void setCaption(const std::string &caption)
Definition: label.cpp:261
unsigned int mAction
void setSticky(const bool sticky)
Definition: window.cpp:761
const bool Visible_false
Definition: visible.h:29
Definition: label.h:87
TabStrip * mGenderStrip
unsigned int maxHairColor
int getHeight() const
Definition: graphics.cpp:647
virtual void add(Widget *const widget)
Definition: chardb.h:34
std::string trim(std::string const &str)
std::vector< Slider * > mAttributeSlider
InputAction ::T InputActionT
Definition: inputaction.h:714
#define nullptr
Definition: localconsts.h:44
Graphics * mainGraphics
Definition: graphics.cpp:108
unsigned getMaxHairStyle()
Definition: chardb.cpp:146
const bool ShowCenter_true
Definition: showcenter.h:29
std::string getColorName(const ItemColor idx) const
Definition: iteminfo.cpp:412
void setPosition(const int x, const int y)
Definition: widget.cpp:160
void addKeyListener(KeyListener *const keyListener)
Definition: widget.cpp:271
virtual void setAction(const BeingActionT &action, const int attackId)
Definition: being.cpp:1525
virtual void newCharacter(const std::string &name, const int slot, const GenderT gender, const int hairstyle, const int hairColor, const unsigned char race, const uint16_t look, const std::vector< int > &stats) const =0
unsigned getMaxRace()
Definition: chardb.cpp:181
const std::string & getWindowName() const
Definition: window.h:360
void setEnabled(const bool enabled)
Definition: widget.h:351
virtual unsigned int hairSprite() const =0
Button * mNextHairColorButton
Gender ::T GenderT
Definition: gender.h:35
virtual void scheduleDelete()
Definition: window.cpp:826
void setHeight(const int height)
Definition: widget.cpp:139
int spriteId
Definition: beingslot.h:44
int getX() const
Definition: widget.h:268
std::string toString(T const &value)
converts any type to a string
Definition: catch.hpp:1774
virtual void setVisible(Visible visible)
Definition: window.cpp:773
void center()
Definition: window.cpp:1412
void setDefaultGender(const GenderT gender)
void setSubtype(const BeingTypeId subtype, const uint16_t look)
Definition: being.cpp:369
unsigned getMinRace()
Definition: chardb.cpp:176
#define CREATEWIDGET(type,...)
Definition: createwidget.h:28
void setPressFirst(const bool press)
Definition: tabstrip.h:50
virtual bool haveLookSelection() const =0
void logic()
Definition: being.cpp:1805
Configuration features
static const uint8_t directions[]
int getNumOfHairstyles()
Definition: itemdb.cpp:1217
int getHeight() const
Definition: widget.h:239
Button * mPrevHairColorButton
void setStickyButtonLock(const bool sticky)
Definition: window.cpp:767
TextField * mNameField
const BeingId BeingId_zero
Definition: beingid.h:29
std::string getDyeColorsString(const ItemColor color) const
Definition: iteminfo.cpp:226
virtual bool haveCreateCharGender() const =0
Definition: slider.h:85
std::vector< Label * > mAttributeValue
void resizeTo(const int maxSize, const int minSize)
Definition: label.cpp:224
unsigned int minHairColor
unsigned int maxHairStyle
int BeingTypeId
Definition: beingtypeid.h:29
Definition: being.h:93
Net::CharServerHandler * charServerHandler
Definition: net.cpp:79
void adjustSize()
Definition: label.cpp:197
unsigned int mDirection
const std::string & getText() const
Definition: textfield.h:223
void setSpriteCards(const unsigned int slot, const int id, const CardsList &cards)
Definition: being.cpp:3021
int getPadding() const
Definition: window.h:503
std::string getName() const
int getHairSize()
Definition: colordb.cpp:212
Button * mNextHairStyleButton
PlayerBox * mPlayerBox
void setWindowName(const std::string &name)
Definition: window.h:354
unsigned getMinHairStyle()
Definition: chardb.cpp:141