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