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", BUTTON_SKIN, this)),
104  // TRANSLATORS: char create dialog button
105  mRotateButton(new Button(this, _(">"), "rotate", BUTTON_SKIN, 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", BUTTON_SKIN, this)),
114  // TRANSLATORS: char create dialog button
115  mCancelButton(new Button(this, _("Cancel"), "cancel", BUTTON_SKIN, 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  mNextHairColorButton = new Button(this,
195  // TRANSLATORS: This is a narrow symbol used to denote 'next'.
196  // You may change this symbol if your language uses another.
197  // TRANSLATORS: char create dialog button
198  _(">"),
199  "nextcolor",
200  BUTTON_SKIN,
201  this);
202  mPrevHairColorButton = new Button(this,
203  // TRANSLATORS: This is a narrow symbol used to denote 'previous'.
204  // You may change this symbol if your language uses another.
205  // TRANSLATORS: char create dialog button
206  _("<"),
207  "prevcolor",
208  BUTTON_SKIN,
209  this);
210  // TRANSLATORS: char create dialog label
211  mHairColorLabel = new Label(this, _("Hair color:"));
212  mHairColorNameLabel = new Label(this, "");
213  }
214 
216  {
217  mNextHairStyleButton = new Button(this,
218  // TRANSLATORS: char create dialog button
219  _(">"),
220  "nextstyle",
221  BUTTON_SKIN,
222  this);
223  mPrevHairStyleButton = new Button(this,
224  // TRANSLATORS: char create dialog button
225  _("<"),
226  "prevstyle",
227  BUTTON_SKIN,
228  this);
229  // TRANSLATORS: char create dialog label
230  mHairStyleLabel = new Label(this, _("Hair style:"));
231  mHairStyleNameLabel = new Label(this, "");
232  }
233 
235  {
236  mNextRaceButton = new Button(this,
237  // TRANSLATORS: char create dialog button
238  _(">"),
239  "nextrace",
240  BUTTON_SKIN,
241  this);
242  mPrevRaceButton = new Button(this,
243  // TRANSLATORS: char create dialog button
244  _("<"),
245  "prevrace",
246  BUTTON_SKIN,
247  this);
248  // TRANSLATORS: char create dialog label
249  mRaceLabel = new Label(this, _("Race:"));
250  mRaceNameLabel = new Label(this, "");
251  }
253  {
254  mNextLookButton = new Button(this,
255  // TRANSLATORS: char create dialog button
256  _(">"),
257  "nextlook",
258  BUTTON_SKIN,
259  this);
260  mPrevLookButton = new Button(this,
261  // TRANSLATORS: char create dialog button
262  _("<"),
263  "prevlook",
264  BUTTON_SKIN,
265  this);
266  // TRANSLATORS: char create dialog label
267  mLookLabel = new Label(this, _("Look:"));
268  mLookNameLabel = new Label(this, "");
269  }
270 
272  {
273  const int forceGender = features.getIntValue("forceCharGender");
274  if (forceGender == -1)
275  {
276  const int size = config.getIntValue("fontSize");
277  mGenderStrip = new TabStrip(this,
278  "gender_" + getWindowName(),
279  size + 16,
280  0);
281  mGenderStrip->setPressFirst(false);
283  mGenderStrip->setActionEventId("gender_");
284  // TRANSLATORS: one char size female character gender
285  mGenderStrip->addButton(_("F"), "f", false);
286  if (features.getIntValue("forceAccountGender") == -1)
287  {
289  {
290  // TRANSLATORS: one char size male character gender
291  mGenderStrip->addButton(_("M"), "m", true);
292  // TRANSLATORS: one char size hidden character gender
293  mGenderStrip->addButton(_("H"), "h", false);
294  }
295  else
296  {
297  // TRANSLATORS: one char size male character gender
298  mGenderStrip->addButton(_("M"), "m", false);
299  // TRANSLATORS: one char size unknown character gender
300  mGenderStrip->addButton(_("U"), "u", true);
301  }
302  }
303  else
304  {
305  // TRANSLATORS: one char size male character gender
306  mGenderStrip->addButton(_("M"), "m", true);
308  {
309  // TRANSLATORS: one char size hidden character gender
310  mGenderStrip->addButton(_("H"), "h", false);
311  }
312  }
313 
315  add(mGenderStrip);
316 
317  mGenderStrip->setPosition(385, 130);
318  mGenderStrip->setWidth(500);
319  mGenderStrip->setHeight(50);
320  }
321  else
322  {
323  mGender = Being::intToGender(CAST_U8(forceGender));
325  }
326  }
327 
328  mPlayerBox->setWidth(74);
329 
330  mNameField->setActionEventId("create");
332 
333  mPlayerBox->setDimension(Rect(360, 0, 110, 90));
334  mActionButton->setPosition(385, 100);
335  mRotateButton->setPosition(415, 100);
336 
339  300, mNameField->getHeight()));
340 
341  const uint32_t labelPadding = getOption("labelPadding", 2);
342  const uint32_t leftX = 120 + mPadding;
343  const uint32_t rightX = 300 + mPadding;
344  const uint32_t labelX = mPadding;
345  uint32_t nameX = leftX + labelPadding;
346  uint32_t y = 30;
347  if (mPrevHairColorButton != nullptr)
348  nameX += mPrevHairColorButton->getWidth();
349  else if (mPrevHairStyleButton != nullptr)
350  nameX += mPrevHairStyleButton->getWidth();
351  else if (mPrevLookButton != nullptr)
352  nameX += mPrevLookButton->getWidth();
353  else if (mPrevRaceButton != nullptr)
354  nameX += mPrevRaceButton->getWidth();
355 
357  {
359  mNextHairColorButton->setPosition(rightX, y);
360  y += 5;
361  mHairColorLabel->setPosition(labelX, y);
362  mHairColorNameLabel->setPosition(nameX, y);
363  y += 24;
364  }
366  {
368  mNextHairStyleButton->setPosition(rightX, y);
369  y += 5;
370  mHairStyleLabel->setPosition(labelX, y);
371  mHairStyleNameLabel->setPosition(nameX, y);
372  y += 24;
373  }
374 
376  {
377  if (mPrevLookButton != nullptr)
378  mPrevLookButton->setPosition(leftX, y);
379  if (mNextLookButton != nullptr)
380  mNextLookButton->setPosition(rightX, y);
381  y += 5;
382  if (mLookLabel != nullptr)
383  mLookLabel->setPosition(labelX, y);
384  if (mLookNameLabel != nullptr)
385  mLookNameLabel->setPosition(nameX, y); // 93
386  y += 24;
387  }
389  {
390  if (mPrevRaceButton != nullptr)
391  mPrevRaceButton->setPosition(leftX, y);
392  if (mNextRaceButton != nullptr)
393  mNextRaceButton->setPosition(rightX, y);
394  y += 5;
395  if (mRaceLabel != nullptr)
396  mRaceLabel->setPosition(labelX, y);
397  if (mRaceNameLabel != nullptr)
398  mRaceNameLabel->setPosition(nameX, y);
399  }
400  mMaxY = y + 29 + getTitlePadding();
401 
402  updateSliders();
403  setButtonsPosition(w, h);
404 
405  add(mPlayerBox);
406  add(mNameField);
407  add(mNameLabel);
408 
410  {
415  }
416 
418  {
423  }
426 
428  {
431  add(mLookLabel);
433  }
434 
436  {
439  add(mRaceLabel);
441  }
442 
446 
447  center();
450 
451  updateHair();
453  updateRace();
455  updateLook();
456  updatePlayer();
457 
458  addKeyListener(this);
459 }
460 
462 {
464 
465  if (charServerHandler != nullptr)
467 }
468 
470 {
471  const std::string &id = event.getId();
472  if (id == "create")
473  {
474  if (getName().length() >= 4)
475  {
476  // Attempt to create the character
477  mCreateButton->setEnabled(false);
478 
479  STD_VECTOR<int> atts;
480  const size_t sz = mAttributeSlider.size();
481  for (size_t i = 0; i < sz; i++)
482  {
483  atts.push_back(CAST_S32(
484  mAttributeSlider[i]->getValue()));
485  }
486  for (size_t i = sz; i < 6; i ++)
487  atts.push_back(1);
488 
489  const int characterSlot = mSlot;
490 
492  characterSlot,
493  mGender,
494  mHairStyle,
495  mHairColor,
496  CAST_U8(mRace),
497  CAST_U8(mLook),
498  atts);
499  }
500  else
501  {
503  // TRANSLATORS: char creation error
504  _("Error"),
505  // TRANSLATORS: char creation error
506  _("Your name needs to be at least 4 characters."),
507  // TRANSLATORS: ok dialog button
508  _("OK"),
510  Modal_true,
512  nullptr,
513  260);
514  }
515  }
516  else if (id == "cancel")
517  {
518  scheduleDelete();
519  }
520  else if (id == "nextcolor")
521  {
522  mHairColor ++;
523  updateHair();
524  }
525  else if (id == "prevcolor")
526  {
527  mHairColor --;
528  updateHair();
529  }
530  else if (id == "nextstyle")
531  {
532  mHairStyle ++;
533  updateHair();
534  }
535  else if (id == "prevstyle")
536  {
537  mHairStyle --;
538  updateHair();
539  }
540  else if (id == "nextrace")
541  {
542  mRace ++;
543  updateRace();
544  }
545  else if (id == "prevrace")
546  {
547  mRace --;
548  updateRace();
549  }
550  else if (id == "nextlook")
551  {
552  mLook ++;
553  updateLook();
554  }
555  else if (id == "prevlook")
556  {
557  mLook --;
558  updateLook();
559  }
560  else if (id == "statslider")
561  {
562  updateSliders();
563  }
564  else if (id == "action")
565  {
566  mAction ++;
567  if (mAction >= 5)
568  mAction = 0;
569  updatePlayer();
570  }
571  else if (id == "rotate")
572  {
573  mDirection ++;
574  if (mDirection >= 4)
575  mDirection = 0;
576  updatePlayer();
577  }
578  else if (id == "gender_m")
579  {
582  }
583  else if (id == "gender_f")
584  {
587  }
588  else if (id == "gender_u")
589  {
592  }
593  else if (id == "gender_h")
594  {
597  }
598 }
599 
600 std::string CharCreateDialog::getName() const
601 {
602  std::string name = mNameField->getText();
603  trim(name);
604  return name;
605 }
606 
608 {
609  for (size_t i = 0, sz = mAttributeSlider.size(); i < sz; i++)
610  {
611  // Update captions
612  mAttributeValue[i]->setCaption(
613  toString(CAST_S32(mAttributeSlider[i]->getValue())));
614  mAttributeValue[i]->adjustSize();
615  }
616 
617  // Update distributed points
618  const int pointsLeft = mMaxPoints - getDistributedPoints();
619  if (pointsLeft == 0)
620  {
621  // TRANSLATORS: char create dialog label
622  mAttributesLeft->setCaption(_("Character stats OK"));
623  mCreateButton->setEnabled(true);
624  }
625  else
626  {
627  mCreateButton->setEnabled(false);
628  if (pointsLeft > 0)
629  {
631  // TRANSLATORS: char create dialog label
632  strprintf(_("Please distribute %d points"), pointsLeft));
633  }
634  else
635  {
637  // TRANSLATORS: char create dialog label
638  strprintf(_("Please remove %d points"), -pointsLeft));
639  }
640  }
641 
643 }
644 
646 {
647  mCreateButton->setEnabled(true);
648 }
649 
651 {
652  unsigned int points = 0;
653 
654  for (size_t i = 0, sz = mAttributeSlider.size(); i < sz; i++)
655  points += CAST_U32(mAttributeSlider[i]->getValue());
656  return CAST_S32(points);
657 }
658 
660  int available,
661  const int min, const int max)
662 {
663  size_t sz;
664 
665  if (min == max || available == 0)
666  {
667  sz = 0U;
668  available = 0;
669  }
670  else
671  {
672  sz = labels.size();
673  }
674 
675  mMaxPoints = available;
676 
677  for (size_t i = 0; i < mAttributeLabel.size(); i++)
678  {
679  remove(mAttributeLabel[i]);
681  remove(mAttributeSlider[i]);
683  remove(mAttributeValue[i]);
685  }
686 
687  mAttributeLabel.resize(sz);
688  mAttributeSlider.resize(sz);
689  mAttributeValue.resize(sz);
690 
691  const uint32_t w = 480;
692  uint32_t h = 350;
693  uint32_t y = 89;
695  y += 29;
697  y += 29;
698 
699  for (size_t i = 0; i < sz; i++)
700  {
701  mAttributeLabel[i] = new Label(this, labels[i]);
702  mAttributeLabel[i]->setWidth(70);
703  mAttributeLabel[i]->setPosition(mPadding,
704  y + CAST_S32(i * 24));
705  mAttributeLabel[i]->adjustSize();
706  add(mAttributeLabel[i]);
707 
708  mAttributeSlider[i] = new Slider(this, min, max, 1.0);
709  mAttributeSlider[i]->setDimension(Rect(140 + mPadding,
710  y + CAST_S32(i * 24),
711  150,
712  12));
713  mAttributeSlider[i]->setActionEventId("statslider");
714  mAttributeSlider[i]->addActionListener(this);
715  add(mAttributeSlider[i]);
716 
717  mAttributeValue[i] = new Label(this, toString(min));
718  mAttributeValue[i]->setPosition(295 + mPadding,
719  y + CAST_S32(i * 24));
720  add(mAttributeValue[i]);
721  }
722 
723  updateSliders();
724  if (available == 0)
725  {
727  h = y;
728  }
729  else
730  {
731  h = y +
732  CAST_S32(sz) * 24 +
734  getPadding();
735  }
737  features.getIntValue("forceCharGender") == -1 &&
738  y < 160)
739  {
740  if (h < 160)
741  h = 160;
742  }
743  if (h < mMaxY)
744  h = mMaxY;
746  {
747  const int forceGender = features.getIntValue("forceCharGender");
748  if (forceGender == -1 && h < 180)
749  h = 180;
750  else if (h < 120)
751  h = 120;
752  }
753  h += mCreateButton->getHeight();
754 
755  setContentSize(w, h);
756  setButtonsPosition(w, h);
757 }
758 
760 {
761  if (features.getIntValue("forceCharGender") != -1)
762  return;
763 
764  mDefaultGender = gender;
765  mPlayer->setGender(gender);
766 }
767 
769 {
770  if (mHairStyle <= 0)
772  else
776  {
778  }
779  const ItemInfo &item = ItemDB::get(-mHairStyle);
780  if (mHairStyleNameLabel != nullptr)
781  {
783  mHairStyleNameLabel->resizeTo(150, 150);
784  }
785 
786  if (ColorDB::getHairSize() != 0)
788  else
789  mHairColor = 0;
790  if (mHairColor < 0)
794  {
796  }
797  if (mHairColorNameLabel != nullptr)
798  {
801  mHairColorNameLabel->resizeTo(150, 150);
802  }
803 
805  mHairStyle * -1,
807  updatePlayer();
808 }
809 
811 {
812  if (mRace < mMinRace)
813  mRace = mMaxRace;
814  else if (mRace > mMaxRace)
815  mRace = mMinRace;
816 
817  updateLook();
818 }
819 
821 {
822  const ItemInfo &item = ItemDB::get(-100 - mRace);
823  const int sz = item.getColorsSize();
824  if (sz > 0 && serverFeatures->haveLookSelection())
825  {
826  if (mLook < 0)
827  mLook = sz - 1;
828  if (mLook > mMaxLook)
829  mLook = mMinLook;
830  if (mLook >= sz)
831  mLook = mMinLook;
832  }
833  else
834  {
835  mLook = 0;
836  }
838  CAST_U8(mLook));
839  if (mRaceNameLabel != nullptr)
840  {
842  mRaceNameLabel->resizeTo(150, 150);
843  }
844  if (mLookNameLabel != nullptr)
845  {
847  fromInt(mLook, ItemColor)));
848  mLookNameLabel->resizeTo(150, 150);
849  }
850 }
851 
853 {
854  BLOCK_START("CharCreateDialog::logic")
855  if (mPlayer != nullptr)
856  mPlayer->logic();
857  BLOCK_END("CharCreateDialog::logic")
858 }
859 
861 {
862  if (mPlayer != nullptr)
863  {
866  }
867 }
868 
870 {
871  const InputActionT actionId = event.getActionId();
872  PRAGMA45(GCC diagnostic push)
873  PRAGMA45(GCC diagnostic ignored "-Wswitch-enum")
874  switch (actionId)
875  {
877  event.consume();
880  break;
881 
882  default:
883  break;
884  }
885  PRAGMA45(GCC diagnostic pop)
886 }
887 
888 void CharCreateDialog::setButtonsPosition(const int w, const int h)
889 {
890  const int h2 = h - 5 - mCancelButton->getHeight();
891  if (mainGraphics->getHeight() < 480)
892  {
893  if (mMaxPoints != 0)
894  {
895  mCreateButton->setPosition(337, 160);
897  }
898  else
899  {
901  w / 2,
902  160);
905  160);
906  }
907  }
908  else
909  {
911  w / 2,
912  h2);
915  h2);
916  }
918 }
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:792
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:507
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)
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:96
Configuration config
virtual void setGender(const GenderT gender)
Definition: being.cpp:3581
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:1453
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
virtual bool haveCharHiddenGender() const =0
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:942
virtual bool haveRaceSelection() const =0
void setSpriteColor(const unsigned int slot, const int id, const std::string &color)
Definition: being.cpp:2890
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:1689
#define new
Definition: debug_new.h:147
void setContentSize(int width, int height)
Definition: window.cpp:491
Net::ServerFeatures * serverFeatures
Definition: net.cpp:98
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
const std::string BUTTON_SKIN
Definition: button.h:88
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:765
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:715
#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:1553
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:830
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:777
void center()
Definition: window.cpp:1416
void setDefaultGender(const GenderT gender)
void setSubtype(const BeingTypeId subtype, const uint16_t look)
Definition: being.cpp:370
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:1833
Configuration features
static const uint8_t directions[]
int getNumOfHairstyles()
Definition: itemdb.cpp:1196
int getHeight() const
Definition: widget.h:239
Button * mPrevHairColorButton
void setStickyButtonLock(const bool sticky)
Definition: window.cpp:771
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:82
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:3048
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