ManaPlus
npcdialog.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-2017 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 
23 #include "gui/windows/npcdialog.h"
24 
25 #include "actormanager.h"
26 #include "configuration.h"
27 #include "settings.h"
28 #include "soundmanager.h"
29 
30 #include "const/sound.h"
31 
32 #include "being/being.h"
33 #include "being/playerinfo.h"
34 
35 #include "enums/gui/layouttype.h"
36 
37 #include "gui/gui.h"
38 #include "gui/viewport.h"
39 
40 #include "gui/fonts/font.h"
41 
42 #include "gui/popups/popupmenu.h"
43 
46 
47 #include "gui/widgets/browserbox.h"
48 #include "gui/widgets/button.h"
50 #include "gui/widgets/icon.h"
54 #include "gui/widgets/layout.h"
56 #include "gui/widgets/playerbox.h"
57 #include "gui/widgets/scrollarea.h"
58 
60 
61 #include "resources/db/avatardb.h"
62 #include "resources/db/npcdb.h"
64 
66 
68 
70 
71 #include "net/npchandler.h"
72 #include "net/packetlimiter.h"
73 
74 #include "utils/copynpaste.h"
75 #include "utils/delete2.h"
76 #include "utils/foreach.h"
77 #include "utils/gettext.h"
78 
79 #include <sstream>
80 
81 #include "debug.h"
82 
83 // TRANSLATORS: npc dialog button
84 #define CAPTION_WAITING _("Stop waiting")
85 // TRANSLATORS: npc dialog button
86 #define CAPTION_NEXT _("Next")
87 // TRANSLATORS: npc dialog button
88 #define CAPTION_CLOSE _("Close")
89 // TRANSLATORS: npc dialog button
90 #define CAPTION_SUBMIT _("Submit")
91 
94 
95 typedef STD_VECTOR<Image *>::iterator ImageVectorIter;
96 
98  // TRANSLATORS: npc dialog name
99  Window(_("NPC"), Modal_false, nullptr, "npc.xml"),
100  ActionListener(),
101  mNpcId(npcId),
102  mDefaultInt(0),
103  mDefaultString(),
104  mTextBox(new BrowserBox(this, Opaque_true,
105  "browserbox.xml")),
106  mScrollArea(new ScrollArea(this, mTextBox,
107  fromBool(getOptionBool("showtextbackground"), Opaque),
108  "npc_textbackground.xml")),
109  mText(),
110  mNewText(),
111  mItems(),
112  mImages(),
113  mItemList(CREATEWIDGETR(ExtendedListBox,
114  this, this, "extendedlistbox.xml")),
115  mListScrollArea(new ScrollArea(this, mItemList,
116  fromBool(getOptionBool("showlistbackground"), Opaque),
117  "npc_listbackground.xml")),
118  mSkinContainer(new Container(this)),
119  mSkinScrollArea(new ScrollArea(this, mSkinContainer,
120  fromBool(getOptionBool("showlistbackground"), Opaque),
121  "npc_listbackground.xml")),
122  mItemLinkHandler(new ItemLinkHandler),
123  mTextField(new TextField(this, "")),
124  mIntField(new IntTextField(this)),
125  // TRANSLATORS: npc dialog button
126  mPlusButton(new Button(this, _("+"), "inc", this)),
127  // TRANSLATORS: npc dialog button
128  mMinusButton(new Button(this, _("-"), "dec", this)),
129  // TRANSLATORS: npc dialog button
130  mClearButton(new Button(this, _("Clear"), "clear", this)),
131  mButton(new Button(this, "", "ok", this)),
132  // TRANSLATORS: npc dialog button
133  mButton2(new Button(this, _("Close"), "close", this)),
134  // TRANSLATORS: npc dialog button
135  mButton3(new Button(this, _("Add"), "add", this)),
136  // TRANSLATORS: npc dialog button
137  mResetButton(new Button(this, _("Reset"), "reset", this)),
139  mComplexInventory(new ComplexInventory(InventoryType::Craft, 1)),
140  mItemContainer(new ItemContainer(this, mInventory,
141  10000, ShowEmptyRows_true)),
142  mItemScrollArea(new ScrollArea(this, mItemContainer,
143  fromBool(getOptionBool("showitemsbackground"), Opaque),
144  "npc_listbackground.xml")),
145  mInputState(NpcInputState::NONE),
146  mActionState(NpcActionState::WAIT),
147  mSkinControls(),
148  mSkinName(),
149  mPlayerBox(new PlayerBox(nullptr)),
150  mAvatarBeing(nullptr),
151  mDialogInfo(nullptr),
152  mLastNextTime(0),
153  mCameraMode(-1),
154  mCameraX(0),
155  mCameraY(0),
156  mShowAvatar(false),
157  mLogInteraction(config.getBoolValue("logNpcInGui"))
158 {
159  // Basic Window Setup
160  setWindowName("NpcText");
161  setResizable(true);
162  setFocusable(true);
163  setStickyButtonLock(true);
164 
165  setMinWidth(200);
166  setMinHeight(150);
167 
169 
170  mPlayerBox->setWidth(70);
171  mPlayerBox->setHeight(100);
172 
173  // Setup output text box
175  mTextBox->setMaxRow(config.getIntValue("ChatLogLength"));
177  mTextBox->setProcessVars(true);
179  mTextBox->setEnableKeys(true);
180  mTextBox->setEnableTabs(true);
181  mTextBox->setEnableImages(true);
182 
185 
186  // Setup listbox
192  if (gui->getNpcFont()->getHeight() < 20)
193  mItemList->setRowHeight(20);
194  else
196 
197  setContentSize(260, 175);
205 
206  const Font *const fnt = mButton->getFont();
207  int width = std::max(fnt->getWidth(CAPTION_WAITING),
208  fnt->getWidth(CAPTION_NEXT));
209  width = std::max(width, fnt->getWidth(CAPTION_CLOSE));
210  width = std::max(width, fnt->getWidth(CAPTION_SUBMIT));
211  mButton->setWidth(8 + width);
212 
213  // Place widgets
214  buildLayout();
215 
216  center();
217  loadWindowState();
218 
219  instances.push_back(this);
220 }
221 
223 {
226  requestFocus();
227  enableVisibleSound(true);
229 
230  if (actorManager != nullptr)
231  {
232  const Being *const being = actorManager->findBeing(mNpcId);
233  if (being != nullptr)
234  {
236  being->getSubType(), BeingTypeId)));
237  setCaption(being->getName());
238  }
239  }
240 
241  config.addListener("logNpcInGui", this);
242 }
243 
245 {
246  config.removeListeners(this);
248  clearLayout();
249 
250  if (mPlayerBox != nullptr)
251  {
252  delete mPlayerBox->getBeing();
253  delete mPlayerBox;
254  }
255 
257 
258  delete2(mTextBox);
260  delete2(mButton);
261  delete2(mButton2);
262  delete2(mButton3);
277 
279  {
280  if (*it != nullptr)
281  (*it)->decRef();
282  }
283 
284  mImages.clear();
285 
286  instances.remove(this);
287 }
288 
289 void NpcDialog::addText(const std::string &text, const bool save)
290 {
291  if (save || mLogInteraction)
292  {
293  if (mText.size() > 5000)
294  mText.clear();
295 
296  mNewText.append(text);
297  mTextBox->addRow(text);
298  }
301  buildLayout();
302 }
303 
305 {
307  buildLayout();
308 }
309 
311 {
313  buildLayout();
314 }
315 
316 void NpcDialog::action(const ActionEvent &event)
317 {
318  const std::string &eventId = event.getId();
319  if (eventId == "ok")
320  {
322  {
324  return;
325 
326  nextDialog();
327  addText(std::string(), false);
328  }
331  {
332  if (cutInWindow != nullptr)
333  cutInWindow->hide();
334  closeDialog();
335  }
337  {
338  std::string printText; // Text that will get printed
339  // in the textbox
340  switch (mInputState)
341  {
342  case NpcInputState::LIST:
343  {
344  if (mDialogInfo != nullptr)
345  return;
346  if (gui != nullptr)
347  gui->resetClickCount();
348  const int selectedIndex = mItemList->getSelected();
349 
350  if (selectedIndex >= CAST_S32(mItems.size())
351  || selectedIndex < 0
354  {
355  return;
356  }
357  unsigned char choice = CAST_U8(
358  selectedIndex + 1);
359  printText = mItems[selectedIndex];
360 
361  npcHandler->listInput(mNpcId, choice);
362  break;
363  }
365  {
368  {
369  return;
370  }
371  printText = mTextField->getText();
372  npcHandler->stringInput(mNpcId, printText);
373  break;
374  }
376  {
379  {
380  return;
381  }
382  printText = strprintf("%d", mIntField->getValue());
385  break;
386  }
387  case NpcInputState::ITEM:
388  {
389  restoreVirtuals();
392  {
393  return;
394  }
395 
396  std::string str;
397  const int sz = mInventory->getSize();
398  if (sz == 0)
399  {
400  str = "0,0";
401  }
402  else
403  {
404  const Item *item = mInventory->getItem(0);
405  if (item != nullptr)
406  {
407  str = strprintf("%d,%d", item->getId(),
408  toInt(item->getColor(), int));
409  }
410  else
411  {
412  str = "0,0";
413  }
414  for (int f = 1; f < sz; f ++)
415  {
416  str.append(";");
417  item = mInventory->getItem(f);
418  if (item != nullptr)
419  {
420  str.append(strprintf("%d,%d", item->getId(),
421  toInt(item->getColor(), int)));
422  }
423  else
424  {
425  str.append("0,0");
426  }
427  }
428  }
429 
430  // need send selected item
432  mInventory->clear();
433  break;
434  }
436  {
437  restoreVirtuals();
440  {
441  return;
442  }
443 
444  std::string str;
445  const int sz = mInventory->getSize();
446  if (sz == 0)
447  {
448  str = "-1";
449  }
450  else
451  {
452  const Item *item = mInventory->getItem(0);
453  if (item != nullptr)
454  {
455  str = strprintf("%d", item->getTag());
456  }
457  else
458  {
459  str = "-1";
460  }
461  for (int f = 1; f < sz; f ++)
462  {
463  str.append(";");
464  item = mInventory->getItem(f);
465  if (item != nullptr)
466  str.append(strprintf("%d", item->getTag()));
467  else
468  str.append("-1");
469  }
470  }
471 
472  // need send selected item
474  mInventory->clear();
475  break;
476  }
478  {
479  restoreVirtuals();
482  {
483  return;
484  }
485 
486  std::string str;
487  const int sz = mComplexInventory->getSize();
488  if (sz == 0)
489  {
490  str.clear();
491  }
492  else
493  {
494  const ComplexItem *item = dynamic_cast<ComplexItem*>(
496  str = complexItemToStr(item);
497  for (int f = 1; f < sz; f ++)
498  {
499  str.append("|");
500  item = dynamic_cast<ComplexItem*>(
502  str.append(complexItemToStr(item));
503  }
504  }
505 
506  // need send selected item
508  mInventory->clear();
509  break;
510  }
511 
512  case NpcInputState::NONE:
513  default:
514  break;
515  }
519  {
520  // addText will auto remove the input layout
521  addText(strprintf("> \"%s\"", printText.c_str()), false);
522  }
523  mNewText.clear();
524  }
525 
526  if (!mLogInteraction)
527  mTextBox->clearRows();
528  }
529  else if (eventId == "reset")
530  {
531  switch (mInputState)
532  {
535  break;
538  break;
539  case NpcInputState::ITEM:
541  mInventory->clear();
542  break;
545  break;
546  case NpcInputState::NONE:
547  case NpcInputState::LIST:
548  default:
549  break;
550  }
551  }
552  else if (eventId == "inc")
553  {
555  }
556  else if (eventId == "dec")
557  {
559  }
560  else if (eventId == "clear")
561  {
562  switch (mInputState)
563  {
564  case NpcInputState::ITEM:
566  mInventory->clear();
567  break;
570  break;
573  case NpcInputState::LIST:
574  case NpcInputState::NONE:
575  default:
576  clearRows();
577  break;
578  }
579  }
580  else if (eventId == "close")
581  {
582  restoreVirtuals();
584  {
585  switch (mInputState)
586  {
587  case NpcInputState::ITEM:
588  npcHandler->stringInput(mNpcId, "0,0");
589  break;
591  npcHandler->stringInput(mNpcId, "-1");
592  break;
595  break;
598  case NpcInputState::NONE:
599  case NpcInputState::LIST:
600  default:
601  npcHandler->listInput(mNpcId, 255);
602  break;
603  }
604  if (cutInWindow != nullptr)
605  cutInWindow->hide();
606  closeDialog();
607  }
608  }
609  else if (eventId == "add")
610  {
611  if (inventoryWindow != nullptr)
612  {
614  Inventory *const inventory = PlayerInfo::getInventory();
615  if (inventory != nullptr)
616  {
618  {
619  if (mComplexInventory->addVirtualItem(item, -1, 1))
620  inventory->virtualRemove(item, 1);
621  }
622  else
623  {
624  if (mInventory->addVirtualItem(item, -1, 1))
625  inventory->virtualRemove(item, 1);
626  }
627  }
628  }
629  }
630  else if (eventId.find("skin_") == 0)
631  {
632  const std::string cmd = eventId.substr(5);
633  std::string printText;
634  int cnt = 0;
636  {
637  if (cmd == *it)
638  {
639  npcHandler->listInput(mNpcId, CAST_U8(cnt + 1));
640  printText = mItems[cnt];
641 
645  {
646  // addText will auto remove the input layout
647  addText(strprintf("> \"%s\"", printText.c_str()), false);
648  }
649  mNewText.clear();
650  break;
651  }
652  cnt ++;
653  }
654  }
655 }
656 
658 {
660 }
661 
663 {
664  restoreCamera();
666 }
667 
669 {
670  return CAST_S32(mItems.size());
671 }
672 
673 std::string NpcDialog::getElementAt(int i)
674 {
675  return mItems[i];
676 }
677 
679 {
680  return mImages[i];
681 }
682 
684 {
685  mItems.clear();
687  {
688  if (*it != nullptr)
689  (*it)->decRef();
690  }
691  mImages.clear();
694  buildLayout();
695 }
696 
697 void NpcDialog::addChoice(const std::string &choice)
698 {
699  mItems.push_back(choice);
700  mImages.push_back(nullptr);
701 }
702 
703 void NpcDialog::parseListItems(const std::string &itemString)
704 {
705  std::istringstream iss(itemString);
706  std::string tmp;
707  const std::string path = paths.getStringValue("guiIcons");
708  while (getline(iss, tmp, ':'))
709  {
710  if (tmp.empty())
711  continue;
712  const size_t pos = tmp.find('|');
713  if (pos == std::string::npos)
714  {
715  mItems.push_back(tmp);
716  mImages.push_back(nullptr);
717  }
718  else
719  {
720  mItems.push_back(tmp.substr(pos + 1));
721  Image *const img = Loader::getImage(pathJoin(path,
722  std::string(tmp.substr(0, pos)).append(".png")));
723  mImages.push_back(img);
724  }
725  }
726 
727  if (!mItems.empty())
728  {
731  }
732  else
733  {
734  mItemList->setSelected(-1);
735  }
736 }
737 
739 {
740  if (!mItems.empty())
741  mItemList->refocus();
742 }
743 
744 void NpcDialog::textRequest(const std::string &defaultText)
745 {
748  mDefaultString = defaultText;
749  mTextField->setText(defaultText);
750 
751  buildLayout();
752 }
753 
755 {
756  return mTextField->isFocused();
757 }
758 
760 {
761  return mTextField->isFocused() || mIntField->isFocused()
762  || mItemList->isFocused();
763 }
764 
766 {
767  FOR_EACH (DialogList::const_iterator, it, instances)
768  {
769  if (((*it) != nullptr) && (*it)->isInputFocused())
770  return true;
771  }
772 
773  return false;
774 }
775 
776 void NpcDialog::integerRequest(const int defaultValue, const int min,
777  const int max)
778 {
781  mDefaultInt = defaultValue;
782  mIntField->setRange(min, max);
783  mIntField->setValue(defaultValue);
784  buildLayout();
785 }
786 
788 {
791  mInventory->resize(size);
792  buildLayout();
793 }
794 
796 {
799  mInventory->resize(size);
800  buildLayout();
801 }
802 
804 {
807  mComplexInventory->resize(size);
808  buildLayout();
809 }
810 
811 void NpcDialog::move(const int amount)
812 {
814  return;
815 
816  switch (mInputState)
817  {
819  mIntField->setValue(mIntField->getValue() + amount);
820  break;
821  case NpcInputState::LIST:
823  break;
824  case NpcInputState::NONE:
826  case NpcInputState::ITEM:
829  default:
830  break;
831  }
832 }
833 
835 {
836  Window::setVisible(visible);
837 
838  if (visible == Visible_false)
839  scheduleDelete();
840 }
841 
842 void NpcDialog::optionChanged(const std::string &name)
843 {
844  if (name == "logNpcInGui")
845  mLogInteraction = config.getBoolValue("logNpcInGui");
846 }
847 
849 {
850  if (instances.size() == 1)
851  return instances.front();
852 
853  FOR_EACH (DialogList::const_iterator, it, instances)
854  {
855  if (((*it) != nullptr) && (*it)->isFocused())
856  return (*it);
857  }
858 
859  return nullptr;
860 }
861 
863 {
864  FOR_EACH (DialogList::const_iterator, it, instances)
865  {
866  if (*it != nullptr)
867  (*it)->close();
868  }
869 }
870 
872 {
873  if (mShowAvatar)
874  {
875  place(0, 0, mPlayerBox);
876  place(1, 0, mScrollArea, 5, 3);
877  place(4, 3, mClearButton);
878  place(5, 3, mButton);
879  }
880  else
881  {
882  place(0, 0, mScrollArea, 5, 3);
883  place(3, 3, mClearButton);
884  place(4, 3, mButton);
885  }
886 }
887 
889 {
890  if (mShowAvatar)
891  {
892  place(0, 0, mPlayerBox);
893  place(1, 0, mScrollArea, 6, 3);
894  place(0, 3, mListScrollArea, 7, 3);
895  place(1, 6, mButton2, 2);
896  place(3, 6, mClearButton, 2);
897  place(5, 6, mButton, 2);
898  }
899  else
900  {
901  place(0, 0, mScrollArea, 6, 3);
902  place(0, 3, mListScrollArea, 6, 3);
903  place(0, 6, mButton2, 2);
904  place(2, 6, mClearButton, 2);
905  place(4, 6, mButton, 2);
906  }
907 }
908 
910 {
912  if ((mDialogInfo != nullptr) && mDialogInfo->hideText)
913  {
914  if (mShowAvatar)
915  {
916  place(0, 0, mPlayerBox);
917  place(1, 0, mSkinScrollArea, 7, 3);
918  place(1, 3, mButton2, 2);
919  }
920  else
921  {
922  place(0, 0, mSkinScrollArea, 6, 3);
923  place(0, 3, mButton2, 2);
924  }
925  }
926  else
927  {
928  if (mShowAvatar)
929  {
930  place(0, 0, mPlayerBox);
931  place(1, 0, mScrollArea, 6, 3);
932  place(0, 3, mSkinScrollArea, 7, 3);
933  place(1, 6, mButton2, 2);
934  }
935  else
936  {
937  place(0, 0, mScrollArea, 6, 3);
938  place(0, 3, mSkinScrollArea, 6, 3);
939  place(0, 6, mButton2, 2);
940  }
941  }
942 }
943 
945 {
946  if (mShowAvatar)
947  {
948  place(0, 0, mPlayerBox);
949  place(1, 0, mScrollArea, 6, 3);
950  place(1, 3, mTextField, 6);
951  place(1, 4, mResetButton, 2);
952  place(3, 4, mClearButton, 2);
953  place(5, 4, mButton, 2);
954  }
955  else
956  {
957  place(0, 0, mScrollArea, 6, 3);
958  place(0, 3, mTextField, 6);
959  place(0, 4, mResetButton, 2);
960  place(2, 4, mClearButton, 2);
961  place(4, 4, mButton, 2);
962  }
963 }
964 
966 {
967  if (mShowAvatar)
968  {
969  place(0, 0, mPlayerBox);
970  place(1, 0, mScrollArea, 6, 3);
971  place(1, 3, mMinusButton, 1);
972  place(2, 3, mIntField, 4);
973  place(6, 3, mPlusButton, 1);
974  place(1, 4, mResetButton, 2);
975  place(3, 4, mClearButton, 2);
976  place(5, 4, mButton, 2);
977  }
978  else
979  {
980  place(0, 0, mScrollArea, 6, 3);
981  place(0, 3, mMinusButton, 1);
982  place(1, 3, mIntField, 4);
983  place(5, 3, mPlusButton, 1);
984  place(0, 4, mResetButton, 2);
985  place(2, 4, mClearButton, 2);
986  place(4, 4, mButton, 2);
987  }
988 }
989 
991 {
992  if (mDialogInfo != nullptr)
993  {
996  }
997  else
998  {
999  mItemContainer->setCellBackgroundImage("inventory_cell.xml");
1000  mItemContainer->setMaxColumns(10000);
1001  }
1002 
1005  else
1007 
1008  if ((mDialogInfo != nullptr) && mDialogInfo->hideText)
1009  {
1010  if (mShowAvatar)
1011  {
1012  place(0, 0, mPlayerBox);
1013  place(1, 0, mItemScrollArea, 7, 3);
1014  place(1, 3, mButton3, 2);
1015  place(3, 3, mClearButton, 2);
1016  place(5, 3, mButton, 2);
1017  }
1018  else
1019  {
1020  place(0, 0, mItemScrollArea, 6, 3);
1021  place(0, 3, mButton3, 2);
1022  place(2, 3, mClearButton, 2);
1023  place(4, 3, mButton, 2);
1024  }
1025  }
1026  else
1027  {
1028  if (mShowAvatar)
1029  {
1030  place(0, 0, mPlayerBox);
1031  place(1, 0, mScrollArea, 6, 3);
1032  place(0, 3, mItemScrollArea, 7, 3);
1033  place(1, 6, mButton3, 2);
1034  place(3, 6, mClearButton, 2);
1035  place(5, 6, mButton, 2);
1036  }
1037  else
1038  {
1039  place(0, 0, mScrollArea, 6, 3);
1040  place(0, 3, mItemScrollArea, 6, 3);
1041  place(0, 6, mButton3, 2);
1042  place(2, 6, mClearButton, 2);
1043  place(4, 6, mButton, 2);
1044  }
1045  }
1046 }
1047 
1049 {
1050  clearLayout();
1051 
1053  {
1056  else if (mActionState == NpcActionState::NEXT)
1058  else if (mActionState == NpcActionState::CLOSE)
1061  }
1062  else if (mInputState != NpcInputState::NONE)
1063  {
1065  switch (mInputState)
1066  {
1067  case NpcInputState::LIST:
1068  if (mDialogInfo == nullptr)
1070  else
1072  mItemList->setSelected(-1);
1073  break;
1074 
1075  case NpcInputState::STRING:
1077  break;
1078 
1081  break;
1082 
1083  case NpcInputState::ITEM:
1087  break;
1088 
1089  case NpcInputState::NONE:
1090  default:
1091  break;
1092  }
1093  }
1094 
1095  Layout &layout = getLayout();
1096  layout.setRowHeight(1, LayoutType::SET);
1097  redraw();
1099 }
1100 
1102 {
1103  if ((viewport == nullptr) || mCameraMode >= 0)
1104  return;
1105 
1109 }
1110 
1112 {
1113  if ((viewport == nullptr) || mCameraMode == -1)
1114  return;
1115 
1118  if (mCameraMode != 0)
1119  {
1122  }
1123  mCameraMode = -1;
1124 }
1125 
1127 {
1128  const bool needShow = (avatarId != BeingTypeId_zero);
1129  if (needShow)
1130  {
1131  delete mAvatarBeing;
1134  avatarId,
1135  nullptr);
1137  if (!mAvatarBeing->mSprites.empty())
1138  {
1139  mAvatarBeing->logic();
1140  const BeingInfo *const info = AvatarDB::get(avatarId);
1141  const int pad2 = 2 * mPadding;
1142  int width = 0;
1143  if (info != nullptr)
1144  {
1145  width = info->getWidth();
1146  mPlayerBox->setWidth(width + pad2);
1147  mPlayerBox->setHeight(info->getHeight() + pad2);
1148  }
1149  const Sprite *const sprite = mAvatarBeing->mSprites[0];
1150  if ((sprite != nullptr) && (width == 0))
1151  {
1152  mPlayerBox->setWidth(sprite->getWidth() + pad2);
1153  mPlayerBox->setHeight(sprite->getHeight() + pad2);
1154  }
1155  }
1156  }
1157  else
1158  {
1160  mPlayerBox->setPlayer(nullptr);
1161  }
1162  if (needShow != mShowAvatar)
1163  {
1164  mShowAvatar = needShow;
1165  buildLayout();
1166  }
1167  else
1168  {
1169  mShowAvatar = needShow;
1170  }
1171 }
1172 
1173 void NpcDialog::setAvatarDirection(const uint8_t direction)
1174 {
1175  Being *const being = mPlayerBox->getBeing();
1176  if (being != nullptr)
1177  being->setDirection(direction);
1178 }
1179 
1180 void NpcDialog::setAvatarAction(const int actionId)
1181 {
1182  Being *const being = mPlayerBox->getBeing();
1183  if (being != nullptr)
1184  being->setAction(static_cast<BeingActionT>(actionId), 0);
1185 }
1186 
1188 {
1189  BLOCK_START("NpcDialog::logic")
1190  Window::logic();
1191  if (mShowAvatar && (mAvatarBeing != nullptr))
1192  {
1193  mAvatarBeing->logic();
1194  if (mPlayerBox->getWidth() < CAST_S32(3 * getPadding()))
1195  {
1196  const Sprite *const sprite = mAvatarBeing->mSprites[0];
1197  if (sprite != nullptr)
1198  {
1199  mPlayerBox->setWidth(sprite->getWidth() + 2 * getPadding());
1200  mPlayerBox->setHeight(sprite->getHeight() + 2 * getPadding());
1201  buildLayout();
1202  }
1203  }
1204  }
1205  BLOCK_END("NpcDialog::logic")
1206 }
1207 
1209 {
1210  mTextBox->clearRows();
1211 }
1212 
1214 {
1215  NpcDialogs::iterator it = mNpcDialogs.begin();
1216  const NpcDialogs::iterator it_end = mNpcDialogs.end();
1217  while (it != it_end)
1218  {
1219  delete (*it).second;
1220  ++ it;
1221  }
1222  mNpcDialogs.clear();
1223 }
1224 
1226 {
1227  Window::mousePressed(event);
1228  if (event.getButton() == MouseButton::RIGHT
1229  && event.getSource() == mTextBox)
1230  {
1231  event.consume();
1232  if (popupMenu != nullptr)
1233  {
1235  viewport->mMouseX,
1236  viewport->mMouseY);
1237  }
1238  }
1239 }
1240 
1241 void NpcDialog::copyToClipboard(const int x, const int y) const
1242 {
1243  std::string str = mTextBox->getTextAtPos(x, y);
1244  sendBuffer(str);
1245 }
1246 
1247 void NpcDialog::setSkin(const std::string &skin)
1248 {
1249  if (skin.empty())
1250  {
1251  mSkinName = skin;
1252  mDialogInfo = nullptr;
1253  return;
1254  }
1255  const NpcDialogInfo *const dialog = NpcDialogDB::getDialog(skin);
1256  if (dialog == nullptr)
1257  {
1258  logger->log("Error: creating controls for not existing npc dialog %s",
1259  skin.c_str());
1260  return;
1261  }
1262  mSkinName = skin;
1263  mDialogInfo = dialog;
1264 }
1265 
1267 {
1269 }
1270 
1272 {
1274 
1275  if (mDialogInfo == nullptr)
1276  return;
1277 
1278  FOR_EACH (STD_VECTOR<NpcImageInfo*>::const_iterator,
1279  it,
1281  {
1282  const NpcImageInfo *const info = *it;
1283  Image *const image = Theme::getImageFromTheme(info->name);
1284  if (image != nullptr)
1285  {
1286  Icon *const icon = new Icon(this, image, AutoRelease_true);
1287  icon->setPosition(info->x, info->y);
1288  mSkinContainer->add(icon);
1289  }
1290  }
1291  FOR_EACH (STD_VECTOR<NpcTextInfo*>::const_iterator,
1292  it,
1294  {
1295  const NpcTextInfo *const info = *it;
1296  BrowserBox *box = new BrowserBox(this,
1297  Opaque_true,
1298  "browserbox.xml");
1299  box->setOpaque(Opaque_false);
1300  box->setMaxRow(config.getIntValue("ChatLogLength"));
1302  box->setProcessVars(true);
1303  box->setFont(gui->getNpcFont());
1304  box->setEnableKeys(true);
1305  box->setEnableTabs(true);
1306  box->setPosition(info->x, info->y);
1307  mSkinContainer->add(box);
1308  box->setWidth(info->width);
1309  box->setHeight(info->height);
1310  StringVect parts;
1311  splitToStringVector(parts, info->text, '\n');
1312  FOR_EACH (StringVectCIter, it2, parts)
1313  {
1314  box->addRow(*it2);
1315  }
1316  }
1317  FOR_EACH (STD_VECTOR<NpcButtonInfo*>::const_iterator,
1318  it,
1320  {
1321  const NpcButtonInfo *const info = *it;
1322  Button *const button = new Button(this);
1323  button->setCaption(info->name);
1324  button->setActionEventId("skin_" + info->value);
1325  button->addActionListener(this);
1326  button->setPosition(info->x, info->y);
1327  if (!info->image.empty())
1328  {
1329  button->setImageWidth(info->imageWidth);
1330  button->setImageHeight(info->imageHeight);
1331  button->loadImageSet(info->image);
1332  }
1333  mSkinContainer->add(button);
1334  button->adjustSize();
1335  }
1336 }
1337 
1339 {
1340  Inventory *const inventory = PlayerInfo::getInventory();
1341  if (inventory != nullptr)
1342  inventory->restoreVirtuals();
1343 }
1344 
1346 {
1347  std::string str;
1348  if (item != nullptr)
1349  {
1350  const STD_VECTOR<Item*> &items = item->getChilds();
1351  const size_t sz = items.size();
1352  if (sz == 0u)
1353  return str;
1354 
1355  const Item *item2 = items[0];
1356 
1357  str = strprintf("%d,%d",
1358  item2->getInvIndex(),
1359  item2->getQuantity());
1360  for (size_t f = 1; f < sz; f ++)
1361  {
1362  str.append(";");
1363  item2 = items[f];
1364  str.append(strprintf("%d,%d",
1365  item2->getInvIndex(),
1366  item2->getQuantity()));
1367  }
1368  }
1369  else
1370  {
1371  str.clear();
1372  }
1373  return str;
1374 }
1375 
1377  const int amount,
1378  const int slot)
1379 {
1381  return;
1382 
1383  Inventory *const inventory = PlayerInfo::getInventory();
1384 
1385  if (inventory == nullptr)
1386  return;
1387 
1389  item,
1390  slot,
1391  amount))
1392  {
1393  inventory->virtualRemove(item, amount);
1394  }
1395 }
void resize(const unsigned int newSize)
Definition: inventory.cpp:396
int getInvIndex() const
Definition: item.h:164
Font * getFont() const
Definition: widget.cpp:330
void setPlayer(Being *being)
Definition: playerbox.h:73
bool sendBuffer(const std::string &text)
Definition: copynpaste.cpp:517
#define FOR_EACH(type, iter, array)
Definition: foreach.h:24
void optionChanged(const std::string &name)
Definition: npcdialog.cpp:842
int getWidth() const
Definition: beinginfo.h:203
void setDefaultSize()
Definition: window.cpp:1186
std::string getStringValue(const std::string &key) const
#define _(s)
Definition: gettext.h:34
void showNpcDialogPopup(const BeingId npcId, const int x, const int y)
Definition: popupmenu.cpp:2226
void addChoice(const std::string &)
Definition: npcdialog.cpp:697
const bool ShowEmptyRows_true
Definition: showemptyrows.h:29
void redraw()
Definition: window.cpp:1394
void setSelected(const int selected)
Definition: listbox.cpp:392
void deleteSkinControls()
Definition: npcdialog.cpp:1266
void setValue(const int value)
void setCameraRelativeY(const int n)
Definition: viewport.h:148
int getWidth() const
Definition: widget.h:220
void placeNormalControls()
Definition: npcdialog.cpp:871
void restoreVirtuals()
Definition: inventory.cpp:499
int getTag() const
Definition: item.h:230
std::string value
Definition: npcbuttoninfo.h:44
void loadImageSet(const std::string &imageName)
Definition: button.cpp:417
void setEnableKeys(const bool n)
Definition: browserbox.h:137
#define CAST_U8
Definition: cast.h:26
void setWidth(const int width)
Definition: widget.cpp:132
StringVect::const_iterator StringVectCIter
Definition: stringvector.h:30
Button * mButton2
Definition: npcdialog.h:298
NpcActionStateT mActionState
Definition: npcdialog.h:310
int mPadding
Definition: window.h:610
void splitToStringVector(StringVect &tokens, const std::string &text, const char separator)
bool addVirtualItem(const Item *const item, int index, const int amount)
Gui * gui
Definition: gui.cpp:110
void showNextButton()
Definition: npcdialog.cpp:304
std::string name
Definition: npcbuttoninfo.h:43
Definition: font.h:88
virtual void integerInput(const BeingId npcId, const int value) const =0
#define CAPTION_CLOSE
Definition: npcdialog.cpp:88
const bool Visible_true
Definition: visible.h:29
void move(const int amount)
Definition: npcdialog.cpp:811
void loadWindowState()
Definition: window.cpp:1075
#define fromInt(val, name)
Definition: intdefines.h:45
std::vector< NpcButtonInfo * > buttons
void addActionListener(ActionListener *const actionListener)
Definition: widget.cpp:251
void setImageHeight(const int height)
Definition: button.h:261
void setVisible(Visible visible)
Definition: widget.cpp:224
virtual void stringInput(const BeingId npcId, const std::string &value) const =0
std::string complexItemToStr(const ComplexItem *const item)
Definition: npcdialog.cpp:1345
BeingId mNpcId
Definition: npcdialog.h:269
MouseButtonT getButton() const
Definition: mouseevent.h:113
void setScrollPolicy(const ScrollPolicy hPolicy, const ScrollPolicy vPolicy)
std::string pathJoin(std::string str1, const std::string &str2)
void removeControls()
Definition: container.cpp:42
Definition: sprite.h:32
static NpcDialog * getActive()
Definition: npcdialog.cpp:848
ComplexInventory * mComplexInventory
Definition: npcdialog.h:305
Inventory * getInventory()
Definition: playerinfo.cpp:207
void restoreVirtuals()
Definition: npcdialog.cpp:1338
void setMinWidth(const int width)
Definition: window.cpp:579
std::string mDefaultString
Definition: npcdialog.h:272
Definition: window.h:98
StringVect mItems
Definition: npcdialog.h:281
ItemContainer * mItemContainer
Definition: npcdialog.h:306
#define BLOCK_START(name)
Definition: perfomance.h:78
Definition: button.h:94
SoundManager soundManager
Configuration config
const BeingTypeId BeingTypeId_zero
Definition: beingtypeid.h:29
int BeingId
Definition: beingid.h:29
void choiceRequest()
Definition: npcdialog.cpp:683
int getCameraRelativeY() const
Definition: viewport.h:142
void addText(const std::string &string, const bool save=true)
Definition: npcdialog.cpp:289
void setVisible(Visible visible)
Definition: npcdialog.cpp:834
void refocus()
Definition: listbox.cpp:358
bool limitPackets(const PacketTypeT type)
ScrollArea * mScrollArea
Definition: npcdialog.h:276
#define BLOCK_END(name)
Definition: perfomance.h:79
void virtualRemove(Item *const item, const int amount)
Definition: inventory.cpp:484
Button * mButton3
Definition: npcdialog.h:299
void setDistributeMousePressed(const bool b)
Definition: listbox.h:140
std::vector< NpcTextInfo * > texts
int getIntValue(const std::string &key) const
const Image * getImageAt(int i)
Definition: npcdialog.cpp:678
void toggleCameraMode()
Definition: viewport.cpp:254
void setActionEventId(const std::string &actionEventId)
Definition: widget.h:595
void setVerticalScrollAmount(const int vScroll)
void placeTextInputControls()
Definition: npcdialog.cpp:944
void postInit()
Definition: npcdialog.cpp:222
int mMouseX
Definition: viewport.h:153
int getHeight() const
Definition: beinginfo.h:206
std::vector< std::string > StringVect
Definition: stringvector.h:28
void setAvatarDirection(const uint8_t direction)
Definition: npcdialog.cpp:1173
void copyToClipboard(const int x, const int y) const
Definition: npcdialog.cpp:1241
#define delete2(var)
Definition: delete2.h:24
void setSkin(const std::string &skin)
Definition: npcdialog.cpp:1247
InventoryWindow * inventoryWindow
Button * mResetButton
Definition: npcdialog.h:302
int getNumberOfElements()
Definition: npcdialog.cpp:668
std::string getTextAtPos(const int x, const int y) const
Definition: browserbox.cpp:863
void setVerticalScrollPolicy(const ScrollPolicy vPolicy)
std::list< NpcDialog * > DialogList
Definition: npcdialog.h:244
void addListener(const std::string &key, ConfigListener *const listener)
static Being * createBeing(const BeingId id, const ActorTypeT type, const BeingTypeId subtype, Map *const map)
Definition: being.cpp:5493
virtual bool isFocused() const
Definition: widget.cpp:183
void setText(const std::string &text)
Definition: textfield.cpp:799
void restoreCamera()
Definition: npcdialog.cpp:1111
void clear()
Definition: inventory.cpp:237
void adjustSize()
Definition: button.cpp:821
IntTextField * mIntField
Definition: npcdialog.h:291
int getVerticalMaxScroll()
Logger * logger
Definition: logger.cpp:95
virtual bool addVirtualItem(const Item *const item, int index, const int amount)
Definition: inventory.cpp:438
void itemCraftRequest(const int size)
Definition: npcdialog.cpp:803
BeingTypeId getAvatarFor(const BeingTypeId id)
Definition: npcdb.cpp:200
std::map< BeingId, NpcDialog * > NpcDialogs
Definition: npcdialog.h:55
virtual void setDirection(const uint8_t direction)
Definition: being.cpp:1649
#define new
Definition: debug_new.h:147
#define toInt(val, name)
Definition: intdefines.h:46
void buildLayout()
Definition: npcdialog.cpp:1048
void setContentSize(int width, int height)
Definition: window.cpp:484
Settings settings
Definition: settings.cpp:31
void placeMenuControls()
Definition: npcdialog.cpp:888
std::string image
Definition: npcbuttoninfo.h:45
void setCellBackgroundImage(const std::string &xmlName)
void nextDialog()
Definition: npcdialog.cpp:657
bool getBoolValue(const std::string &key) const
void clearRows()
Definition: npcdialog.cpp:1208
void setCaption(const std::string &caption)
Definition: button.h:214
Definition: icon.h:39
NpcDialogInfo * getDialog(const std::string &name)
void placeSkinControls()
Definition: npcdialog.cpp:909
void setWrappingEnabled(const bool wrappingEnabled)
Definition: listbox.h:222
std::string text
Definition: npctextinfo.h:41
#define CAST_S32
Definition: cast.h:29
virtual void requestFocus()
Definition: widget.cpp:203
virtual void nextDialog(const BeingId npcId) const =0
int mCameraX
Definition: npcdialog.h:318
std::string strprintf(const char *const format,...)
Definition: stringutils.cpp:99
#define CAPTION_WAITING
Definition: npcdialog.cpp:84
void logic()
Definition: npcdialog.cpp:1187
virtual int getHeight() const =0
static NpcDialogs mNpcDialogs
Definition: npcdialog.h:239
const bool Visible_false
Definition: visible.h:29
std::string getElementAt(int i)
Definition: npcdialog.cpp:673
Image * getImage(const std::string &idPath)
Definition: imageloader.cpp:85
int getQuantity() const
Definition: item.h:104
#define fromBool(val, name)
Definition: booldefines.h:48
#define CAPTION_NEXT
Definition: npcdialog.cpp:86
NpcInventoryInfo inventory
Definition: npcdialoginfo.h:42
BrowserBox * mTextBox
Definition: npcdialog.h:275
bool info(InputEvent &event)
Definition: commands.cpp:56
const NpcDialogInfo * mDialogInfo
Definition: npcdialog.h:315
LayoutCell & place(const int x, const int y, Widget *const wg, const int w=1, const int h=1)
Definition: window.cpp:1372
void closeDialog()
Definition: npcdialog.cpp:662
PopupMenu * popupMenu
Definition: popupmenu.cpp:102
static Image * getImageFromTheme(const std::string &path)
Definition: theme.cpp:654
virtual void add(Widget *const widget)
std::vector< Sprite * > mSprites
ItemColor getColor() const
Definition: item.h:180
void resetClickCount()
Definition: gui.cpp:968
void setProcessVars(const bool n)
Definition: browserbox.h:131
void setRange(const int minimum, const int maximum)
Being * findBeing(const BeingId id) const
void createSkinControls()
Definition: npcdialog.cpp:1271
void setEnableTabs(const bool n)
Definition: browserbox.h:140
int getSelected() const
Definition: listbox.h:167
Definition: item.h:48
#define nullptr
Definition: localconsts.h:44
void setMaxColumns(const int maxColumns)
std::vector< Image * > mImages
Definition: npcdialog.h:282
const bool Opaque_false
Definition: opaque.h:29
static void closeAll()
Definition: npcdialog.cpp:862
void setImageWidth(const int width)
Definition: button.h:258
void setPosition(const int x, const int y)
Definition: widget.cpp:160
int getValue() const
void refocus()
Definition: npcdialog.cpp:738
virtual void setAction(const BeingActionT &action, const int attackId)
Definition: being.cpp:1513
void setInventory(Inventory *const inventory)
Being * mAvatarBeing
Definition: npcdialog.h:314
void parseListItems(const std::string &itemString)
Definition: npcdialog.cpp:703
bool isTextInputFocused() const
Definition: npcdialog.cpp:754
std::string mSkinName
Definition: npcdialog.h:312
static bool isAnyInputFocused()
Definition: npcdialog.cpp:765
std::string mText
Definition: npcdialog.h:277
void showAvatar(const BeingTypeId avatarId)
Definition: npcdialog.cpp:1126
int mCameraY
Definition: npcdialog.h:319
const std::string & getName() const
Definition: being.h:233
void enableVisibleSound(bool b)
Definition: window.h:473
void setMinHeight(const int height)
Definition: window.cpp:592
virtual void listInput(const BeingId npcId, const unsigned char value) const =0
Button * mClearButton
Definition: npcdialog.h:294
Inventory * mInventory
Definition: npcdialog.h:304
ScrollArea * mSkinScrollArea
Definition: npcdialog.h:286
Inventory * mInventory
Definition: playerinfo.cpp:57
virtual void scheduleDelete()
Definition: window.cpp:819
virtual int getWidth() const =0
Layout & getLayout()
Definition: window.cpp:1353
unsigned int cameraMode
Definition: settings.h:142
int mMouseY
Definition: viewport.h:154
void saveCamera()
Definition: npcdialog.cpp:1101
int mDefaultInt
Definition: npcdialog.h:271
NpcInputStateT mInputState
Definition: npcdialog.h:309
static DialogList instances
Definition: npcdialog.h:245
void setHeight(const int height)
Definition: widget.cpp:139
ExtendedListBox * mItemList
Definition: npcdialog.h:283
Configuration paths
static void clearDialogs()
Definition: npcdialog.cpp:1213
bool mShowAvatar
Definition: npcdialog.h:320
Container * mSkinContainer
Definition: npcdialog.h:285
void showCloseButton()
Definition: npcdialog.cpp:310
void setMaxRow(unsigned max)
Definition: browserbox.h:80
int getId() const
Definition: item.h:80
void setFocusable(const bool focusable)
Definition: widget.cpp:191
virtual void setVisible(Visible visible)
Definition: window.cpp:766
void center()
Definition: window.cpp:1405
static const std::string SOUND_SHOW_WINDOW
Definition: sound.h:34
Item * getSelectedItem() const
NpcDialog(const BeingId npcId)
Definition: npcdialog.cpp:97
BeingInfo * get(const BeingTypeId id)
Definition: avatardb.cpp:140
std::string mNewText
Definition: npcdialog.h:278
void setLinkHandler(LinkHandler *linkHandler)
Definition: browserbox.cpp:160
void setFont(Font *const font)
Definition: widget.cpp:348
void setEnableImages(const bool n)
Definition: browserbox.h:134
void removeListeners(ConfigListener *const listener)
int mCameraMode
Definition: npcdialog.h:317
const bool Opaque_true
Definition: opaque.h:29
const std::vector< Item * > & getChilds() const
Definition: complexitem.h:58
ItemLinkHandler * mItemLinkHandler
Definition: npcdialog.h:287
int getWidth(const std::string &text) const
Definition: font.cpp:333
ScrollArea * mItemScrollArea
Definition: npcdialog.h:307
void logic()
Definition: being.cpp:1793
void placeIntInputControls()
Definition: npcdialog.cpp:965
void integerRequest(const int defaultValue=0, const int min=0, const int max=2147483647)
Definition: npcdialog.cpp:776
int getCameraRelativeX() const
Definition: viewport.h:139
void mousePressed(MouseEvent &event)
Definition: window.cpp:824
Definition: image.h:61
void action(const ActionEvent &event)
Definition: npcdialog.cpp:316
void mousePressed(MouseEvent &event)
Definition: npcdialog.cpp:1225
Font * getNpcFont() const
Definition: gui.h:177
const bool AutoRelease_true
Definition: autorelease.h:29
void setOpaque(Opaque opaque)
Definition: browserbox.h:74
void setResizable(const bool resize)
Definition: window.cpp:615
std::vector< NpcImageInfo * > images
void setCameraRelativeX(const int n)
Definition: viewport.h:145
void setStickyButtonLock(const bool sticky)
Definition: window.cpp:760
Net::NpcHandler * npcHandler
Definition: net.cpp:86
#define CHECKLISTENERS
Definition: localconsts.h:305
NpcDialogMenuInfo menu
Definition: npcdialoginfo.h:41
const BeingId BeingId_zero
Definition: beingid.h:29
void setAvatarAction(const int actionId)
Definition: npcdialog.cpp:1180
#define CREATEWIDGETR(type,...)
Definition: createwidget.h:35
void log(const char *const log_text,...)
Definition: logger.cpp:243
void placeItemInputControls()
Definition: npcdialog.cpp:990
int getHeight() const
Definition: font.cpp:360
Item * getItem(const int index) const
Definition: inventory.cpp:82
Definition: layout.h:43
void itemIndexRequest(const int size)
Definition: npcdialog.cpp:795
Button * mMinusButton
Definition: npcdialog.h:293
Button * mButton
Definition: npcdialog.h:297
void addCraftItem(Item *const item, const int amount, const int slot)
Definition: npcdialog.cpp:1376
#define CAPTION_SUBMIT
Definition: npcdialog.cpp:90
void clearLayout()
Definition: window.cpp:1360
void setCaption(const std::string &caption)
Definition: window.h:523
int BeingTypeId
Definition: beingtypeid.h:29
Definition: being.h:93
void addRow(const std::string &row, const bool atTop=false)
Definition: browserbox.cpp:165
void setRowHeight(const int n, const int h)
Definition: layoutcell.cpp:127
void itemRequest(const int size)
Definition: npcdialog.cpp:787
void textRequest(const std::string &defaultText="")
Definition: npcdialog.cpp:744
BeingTypeId getSubType() const
Definition: being.h:395
void clearRows()
Definition: browserbox.cpp:352
ScrollArea * mListScrollArea
Definition: npcdialog.h:284
const std::string & getText() const
Definition: textfield.h:225
PlayerBox * mPlayerBox
Definition: npcdialog.h:313
virtual void closeDialog(const BeingId npcId)=0
int getPadding() const
Definition: window.h:496
bool isInputFocused() const
Definition: npcdialog.cpp:759
TextField * mTextField
Definition: npcdialog.h:290
std::vector< Image * >::iterator ImageVectorIter
Definition: npcdialog.cpp:95
void setRowHeight(unsigned int n)
Definition: listbox.h:158
bool mLogInteraction
Definition: npcdialog.h:321
void postInit()
Definition: window.cpp:241
ActorManager * actorManager
Viewport * viewport
Definition: viewport.cpp:35
void playGuiSound(const std::string &name)
std::string name
Definition: npcimageinfo.h:39
Button * mPlusButton
Definition: npcdialog.h:292
CutInWindow * cutInWindow
Definition: cutinwindow.cpp:36
void setWindowName(const std::string &name)
Definition: window.h:353
Being * getBeing()
Definition: playerbox.h:91
unsigned getSize() const
Definition: inventory.h:75
void setHorizontalScrollPolicy(const ScrollPolicy hPolicy)