World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
Файл UIShops.cpp

См. исходные тексты.

Определения типов

using EngineIoc = Engine_::IocContainer
 

Функции

void ShopDialogMain (GUIWindow dialogwin)
 
void ShopDialogDisplayEquip (GUIWindow dialogwin, BuildingType building=BuildingType_WeaponShop)
 
void ShopDialogSellEquip (GUIWindow dialogwin, BuildingType building)
 
void ShopDialogIdentify (GUIWindow dialogwin, BuildingType building)
 
void ShopDialogRepair (GUIWindow dialogwin, BuildingType building)
 
void ShopDialogLearn (GUIWindow dialogwin)
 
void WeaponShopWares (GUIWindow dialogwin, bool special)
 
void WeaponShopDialog ()
 
void ArmorShopWares (GUIWindow dialogwin, bool special)
 
void ArmorShopDialog ()
 
void AlchemyMagicShopWares (GUIWindow dialogwin, BuildingType building, bool special)
 
void AlchemistDialog ()
 
void MagicShopDialog ()
 
void UIShop_Buy_Identify_Repair ()
 
void ShowPopupShopItem ()
 
void sub_4B1523_showSpellbookInfo (int spellItemId)
 
void GetHouseGoodbyeSpeech ()
 
void sub_4B1447_party_fine (int shopId, int stealingResult, int fineToAdd)
 

Переменные

Imageshop_ui_background = nullptr
 
std::array< Image *, 12 > shop_ui_items_in_store
 

Типы

◆ EngineIoc

См. определение в файле UIShops.cpp строка 31

Функции

◆ ShopDialogMain()

void ShopDialogMain ( GUIWindow  dialogwin)

См. определение в файле UIShops.cpp строка 37

37  {
39  pShopOptions[0] = localization->GetString(134); // standard
40  pShopOptions[1] = localization->GetString(152); // special
41  pShopOptions[2] = localization->GetString(159); // display
42  pShopOptions[3] = localization->GetString(160); // learn
43 
44  int all_text_height = 0;
45  for (int i = 0; i < 4; ++i)
46  all_text_height += pFontArrus->CalcTextHeight(
47  pShopOptions[i], dialogwin.uFrameWidth, 0);
48 
49  int textspacings = (174 - all_text_height) / 4;
50  int textoffset = 138 - (textspacings / 2);
51 
52  int pNumString = 0;
53  GUIButton *pButton;
54  int pColorText;
55 
57  i < pDialogueWindow->pNumPresenceButton +
59  ++i) {
60  pButton = pDialogueWindow->GetControl(i);
61  pButton->uY = textspacings + textoffset;
62  pButton->uHeight = pFontArrus->CalcTextHeight(
63  pShopOptions[pNumString], dialogwin.uFrameWidth, 0);
64  textoffset = pButton->uY +
66  dialogwin.uFrameWidth, 0) -
67  1;
68  pButton->uW = textoffset + 6;
69 
70  pColorText = Color16(0xE1u, 0xCDu, 0x23u);
72  pColorText = Color16(0xFFu, 0xFFu, 0xFFu);
73 
74  dialogwin.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText,
75  pShopOptions[pNumString], 3);
76  ++pNumString;
77  }
78  }
79 }

Перекрестные ссылки GUIFont::CalcTextHeight(), Color16(), GUIWindow::DrawTitleText(), GUIWindow::GetControl(), Localization::GetString(), HouseUI_CheckIfPlayerCanInteract(), localization, GUIWindow::pCurrentPosActiveItem, pDialogueWindow, pFontArrus, pShopOptions, GUIWindow::pStartingPosActiveItem, GUIWindow::uFrameWidth, GUIButton::uHeight, GUIButton::uW и GUIButton::uY.

Используется в AlchemistDialog(), ArmorShopDialog(), MagicShopDialog() и WeaponShopDialog().

+ Граф вызовов:
+ Граф вызова функции:

◆ ShopDialogDisplayEquip()

void ShopDialogDisplayEquip ( GUIWindow  dialogwin,
BuildingType  building = BuildingType_WeaponShop 
)

См. определение в файле UIShops.cpp строка 81

82  {
83  draw_leather();
85 
86  pShopOptions[0] = localization->GetString(200); // sell
87  pShopOptions[1] = localization->GetString(113); // identify
88  pShopOptions[2] = localization->GetString(179); // repair - not for alchemy
89 
90  int options;
91  if (building == BuildingType_AlchemistShop) {
92  options = 2;
93  } else {
94  options = 3;
95  }
96 
97  int all_text_height = 0;
98  for (int i = 0; i < options; ++i)
99  all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i],
100  dialogwin.uFrameWidth, 0);
101 
102  int textspacings = (174 - all_text_height) / options;
103  int textoffset = 138 - (textspacings / 2);
104 
105  int pNumString = 0;
106  GUIButton *pButton;
107  int pColorText;
108 
110  i < pDialogueWindow->pNumPresenceButton +
112  ++i) {
113  pButton = pDialogueWindow->GetControl(i);
114  pButton->uY = textspacings + textoffset;
115  pButton->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString],
116  dialogwin.uFrameWidth, 0);
117  textoffset = pButton->uY +
119  dialogwin.uFrameWidth, 0) -
120  1;
121  pButton->uW = textoffset + 6;
122 
123  pColorText = Color16(0xE1u, 0xCDu, 0x23u);
125  pColorText = Color16(0xFFu, 0xFFu, 0xFFu);
126  dialogwin.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText,
127  pShopOptions[pNumString], 3);
128  ++pNumString;
129  }
130 }

Перекрестные ссылки BuildingType_AlchemistShop, GUIFont::CalcTextHeight(), CharacterUI_InventoryTab_Draw(), Color16(), draw_leather(), GUIWindow::DrawTitleText(), GUIWindow::GetControl(), Localization::GetString(), localization, GUIWindow::pCurrentPosActiveItem, pDialogueWindow, pFontArrus, pPlayers, pShopOptions, GUIWindow::pStartingPosActiveItem, uActiveCharacter, GUIWindow::uFrameWidth, GUIButton::uHeight, GUIButton::uW и GUIButton::uY.

Используется в AlchemistDialog(), ArmorShopDialog(), MagicShopDialog() и WeaponShopDialog().

+ Граф вызовов:
+ Граф вызова функции:

◆ ShopDialogSellEquip()

void ShopDialogSellEquip ( GUIWindow  dialogwin,
BuildingType  building 
)

См. определение в файле UIShops.cpp строка 132

132  {
133  draw_leather();
135 
138 
139  Point pt = dialogwin.mouse->GetCursorPos();
140 
141  int invindex = ((pt.x - 14) / 32) + 14 * ((pt.y - 17) / 32);
142  if (pt.x <= 13 || pt.x >= 462)
143  return;
144 
145  int pItemID = pPlayers[uActiveCharacter]->GetItemListAtInventoryIndex(invindex);
146  if (pItemID) {
147  ItemGen *item =
148  &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1];
149  int phrases_id =
150  pPlayers[uActiveCharacter]->SelectPhrasesTransaction(
151  item, building, (int)window_SpeakInHouse->ptr_1C, 3);
152  auto str = BuildDialogueString(
153  pMerchantsSellPhrases[phrases_id], uActiveCharacter - 1, item,
154  (char *)window_SpeakInHouse->ptr_1C, 3);
155  dialogwin.DrawTitleText(pFontArrus, 0,
156  (174 - pFontArrus->CalcTextHeight(
157  str, dialogwin.uFrameWidth, 0)) /
158  2 +
159  138,
160  Color16(0xFFu, 0xFFu, 0xFFu), str, 3);
161  }
162  }
163 }

Перекрестные ссылки BuildDialogueString(), GUIFont::CalcTextHeight(), CharacterUI_InventoryTab_Draw(), Color16(), draw_leather(), GUIWindow::DrawTitleText(), GameUI_StatusBar_DrawImmediate(), Mouse::GetCursorPos(), Localization::GetString(), HouseUI_CheckIfPlayerCanInteract(), localization, GUIWindow::mouse, pFontArrus, pMerchantsSellPhrases, pPlayers, GUIWindow::ptr_1C, uActiveCharacter, GUIWindow::uFrameWidth, window_SpeakInHouse, Point::x и Point::y.

Используется в AlchemistDialog(), ArmorShopDialog(), MagicShopDialog() и WeaponShopDialog().

+ Граф вызовов:
+ Граф вызова функции:

◆ ShopDialogIdentify()

void ShopDialogIdentify ( GUIWindow  dialogwin,
BuildingType  building 
)

См. определение в файле UIShops.cpp строка 165

165  {
166  draw_leather();
168 
171 
173 
174  int invindex = ((pt.x - 14) >> 5) + 14 * ((pt.y - 17) >> 5);
175  if (pt.x <= 13 || pt.x >= 462) return;
176 
177  int pItemID = pPlayers[uActiveCharacter]->GetItemListAtInventoryIndex(invindex);
178 
179  if (pItemID) {
180  ItemGen *item = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1];
181 
182  String str;
183  if (!item->IsIdentified()) {
184  int phrases_id = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(
185  item, building, (int)window_SpeakInHouse->ptr_1C, 4);
186  str = BuildDialogueString(
188  item, (char *)window_SpeakInHouse->ptr_1C, 4);
189  } else {
190  str = BuildDialogueString("%24", uActiveCharacter - 1, item,
191  (char *)window_SpeakInHouse->ptr_1C, 4);
192  }
193 
194  dialogwin.DrawTitleText(pFontArrus, 0,
195  (174 - pFontArrus->CalcTextHeight(str, dialogwin.uFrameWidth, 0)) / 2 + 138,
196  Color16(0xFFu, 0xFFu, 0xFFu), str, 3);
197  }
198  }
199 }

Перекрестные ссылки BuildDialogueString(), GUIFont::CalcTextHeight(), CharacterUI_InventoryTab_Draw(), Color16(), draw_leather(), GUIWindow::DrawTitleText(), GameUI_StatusBar_DrawImmediate(), Mouse::GetCursorPos(), Localization::GetString(), HouseUI_CheckIfPlayerCanInteract(), ItemGen::IsIdentified(), localization, pFontArrus, pMerchantsIdentifyPhrases, pPlayers, GUIWindow::ptr_1C, Engine_::IocContainer::ResolveMouse(), uActiveCharacter, GUIWindow::uFrameWidth, window_SpeakInHouse, Point::x и Point::y.

Используется в AlchemistDialog(), ArmorShopDialog(), MagicShopDialog() и WeaponShopDialog().

+ Граф вызовов:
+ Граф вызова функции:

◆ ShopDialogRepair()

void ShopDialogRepair ( GUIWindow  dialogwin,
BuildingType  building 
)

См. определение в файле UIShops.cpp строка 201

201  {
202  draw_leather();
204 
207 
208  Point pt = dialogwin.mouse->GetCursorPos();
209 
210  int invindex = ((pt.x - 14) >> 5) + 14 * ((pt.y - 17) >> 5);
211  if (pt.x <= 13 || pt.x >= 462)
212  return;
213 
214  int pItemID = pPlayers[uActiveCharacter]->GetItemListAtInventoryIndex(invindex);
215  if (pItemID == 0)
216  return;
217 
218  if ((pPlayers[uActiveCharacter]->pOwnItems[pItemID - 1].uAttributes &
219  ITEM_BROKEN)) {
220  ItemGen *item = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1];
221  int phrases_id = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(
222  item, building, (int)window_SpeakInHouse->ptr_1C, 5);
224  pMerchantsRepairPhrases[phrases_id], uActiveCharacter - 1, item,
225  (char *)window_SpeakInHouse->ptr_1C, 5);
226  dialogwin.DrawTitleText(pFontArrus, 0,
227  (174 - pFontArrus->CalcTextHeight(str, dialogwin.uFrameWidth, 0)) / 2 + 138,
228  Color16(0xFFu, 0xFFu, 0xFFu), str, 3);
229  }
230  }
231 }

Перекрестные ссылки BuildDialogueString(), GUIFont::CalcTextHeight(), CharacterUI_InventoryTab_Draw(), Color16(), draw_leather(), GUIWindow::DrawTitleText(), GameUI_StatusBar_DrawImmediate(), Mouse::GetCursorPos(), Localization::GetString(), HouseUI_CheckIfPlayerCanInteract(), ITEM_BROKEN, localization, GUIWindow::mouse, pFontArrus, pMerchantsRepairPhrases, pPlayers, GUIWindow::ptr_1C, uActiveCharacter, GUIWindow::uFrameWidth, window_SpeakInHouse, Point::x и Point::y.

Используется в ArmorShopDialog(), MagicShopDialog() и WeaponShopDialog().

+ Граф вызовов:
+ Граф вызова функции:

◆ ShopDialogLearn()

void ShopDialogLearn ( GUIWindow  dialogwin)

См. определение в файле UIShops.cpp строка 233

233  {
235  uint item_num = 0;
236  int all_text_height = 0;
237 
238  int baseprice = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1] .flt_24 * 500.0);
239  int pPrice = baseprice * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
240  if (pPrice < baseprice / 3)
241  pPrice = baseprice / 3;
242 
244  i < pDialogueWindow->pNumPresenceButton +
246  ++i) {
248  [pPlayers[uActiveCharacter]->classType]
249  [pDialogueWindow->GetControl(i)->msg_param - 36] &&
250  !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36]) {
251  all_text_height += pFontArrus->CalcTextHeight(
254  dialogwin.uFrameWidth, 0);
255  item_num++;
256  }
257  }
258 
259  if (item_num) {
260  auto str = localization->FormatString(
261  401, pPrice); // Skill price: %lu / Стоимость навыка: %lu
262  dialogwin.DrawTitleText(pFontArrus, 0, 0x92u, 0, str, 3);
263 
264  int textspacings = (149 - all_text_height) / item_num;
265  if (textspacings > 32)
266  textspacings = 32;
267 
268  int textoffset = 162 - textspacings / 2;
269 
270  GUIButton *pButton;
271  int pColorText;
272 
274  i < pDialogueWindow->pNumPresenceButton +
276  ++i) {
277  pButton = pDialogueWindow->GetControl(i);
278 
280  [pPlayers[uActiveCharacter]->classType]
281  [pButton->msg_param - 36] ||
283  ->pActiveSkills[pButton->msg_param - 36]) {
284  pButton->uW = 0;
285  pButton->uHeight = 0;
286  pButton->uY = 0;
287  } else {
288  pButton->uY = textspacings + textoffset;
289  pButton->uHeight = pFontArrus->CalcTextHeight(
290  localization->GetSkillName(pButton->msg_param - 36),
291  dialogwin.uFrameWidth, 0);
292  textoffset =
293  pButton->uY +
295  localization->GetSkillName(pButton->msg_param - 36),
296  dialogwin.uFrameWidth, 0) -
297  1;
298  pButton->uW = textoffset + 6;
299  pColorText = Color16(0xE1u, 0xCDu, 0x23u);
301  pColorText = Color16(0xFFu, 0xFFu, 0xFFu);
302  dialogwin.DrawTitleText(
303  pFontArrus, 0, pButton->uY, pColorText,
304  localization->GetSkillName(pButton->msg_param - 36), 3);
305  }
306  }
307  return;
308  }
309 
310  // seek knowledge elsewhere
311  auto str =
313  544, pPlayers[uActiveCharacter]->pName,
315  pPlayers[uActiveCharacter]->classType)) +
316  "\n \n" +
317  localization->GetString(528); //Больше ничего не могу предложить.
318  dialogwin.DrawTitleText(pFontArrus, 0,
319  (174 - pFontArrus->CalcTextHeight(
320  str, dialogwin.uFrameWidth, 0, 0)) /
321  2 +
322  138,
323  Color16(0xE1u, 0xCDu, 0x23u), str, 3);
324  }
325 }

Перекрестные ссылки byte_4ED970_skill_learn_ability_by_class_table, GUIFont::CalcTextHeight(), Color16(), GUIWindow::DrawTitleText(), _2devent::flt_24, Localization::FormatString(), Localization::GetClassName(), GUIWindow::GetControl(), Localization::GetSkillName(), Localization::GetString(), HouseUI_CheckIfPlayerCanInteract(), localization, GUIButton::msg_param, p2DEvents, GUIWindow::pCurrentPosActiveItem, pDialogueWindow, pFontArrus, pPlayers, GUIWindow::pStartingPosActiveItem, GUIWindow::ptr_1C, uActiveCharacter, GUIWindow::uFrameWidth, GUIButton::uHeight, GUIButton::uW, GUIButton::uY и window_SpeakInHouse.

Используется в AlchemistDialog(), ArmorShopDialog(), MagicShopDialog() и WeaponShopDialog().

+ Граф вызовов:
+ Граф вызова функции:

◆ WeaponShopWares()

void WeaponShopWares ( GUIWindow  dialogwin,
bool  special 
)

См. определение в файле UIShops.cpp строка 327

327  {
328  render->DrawTextureAlphaNew(8 / 640.0f, 8 / 480.0f, shop_ui_background);
329  int item_X = 0;
330 
331  for (uint i = 0; i < 6; ++i) {
332  if ((special == 0 &&
333  pParty
334  ->StandartItemsInShops[(unsigned int)
336  .uItemID) ||
337  (special == 1 &&
338  pParty
339  ->SpecialItemsInShops[(unsigned int)
341  .uItemID)) {
342  render->DrawTextureAlphaNew(
343  ((60 -
344  ((signed int)shop_ui_items_in_store[i]->GetWidth() / 2)) +
345  item_X) /
346  640.0f,
347  (weapons_Ypos[i] + 30) / 480.0f, shop_ui_items_in_store[i]);
348  }
349 
350  item_X += 70;
351  }
352 
354  uint item_num = 0;
355  for (uint i = 0; i < 6; ++i) {
356  if ((special == 0 &&
357  pParty
358  ->StandartItemsInShops[(unsigned int)
360  .uItemID) ||
361  (special == 1 &&
362  pParty
363  ->SpecialItemsInShops[(unsigned int)
365  .uItemID)) {
366  ++item_num;
367  }
368  }
369 
370  if (OS_IfCtrlPressed() && pPlayers[uActiveCharacter]->CanSteal())
372  localization->GetString(185),
373  0); // Steal item / Украсть предмет
374  else
376  localization->GetString(195),
377  0); // Buy item / Выберите предмет для покупки
378 
379  if (item_num) { // this shoudl go into func??
381  ItemGen *item;
382 
383  int testx = (pt.x - 30) / 70;
384  if (testx >= 0 && testx < 6) { // testx limits check
385  if (special == 0) {
386  item = &pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][testx];
387  } else {
388  item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][testx];
389  }
390 
391  if (item->uItemID) { // item picking
392  int testpos =
393  ((60 - ((signed int)shop_ui_items_in_store[testx]
394  ->GetWidth() /
395  2)) +
396  testx * 70);
397 
398  if (pt.x >= testpos &&
399  pt.x < (testpos + (signed int)shop_ui_items_in_store[testx]->GetWidth())) {
400  if (pt.y >= weapons_Ypos[testx] + 30 &&
401  pt.y < (weapons_Ypos[testx] + 30 + shop_ui_items_in_store[testx]->GetHeight())) {
402  String str;
403  if (!OS_IfCtrlPressed() ||
404  !pPlayers[uActiveCharacter]->CanSteal()) {
405  str = BuildDialogueString(
406  pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(
408  (int)window_SpeakInHouse->ptr_1C, 2)],
409  uActiveCharacter - 1, item,
410  (char *)window_SpeakInHouse->ptr_1C, 2);
411  } else {
412  str = BuildDialogueString(
413  localization->GetString(181),
414  uActiveCharacter - 1, item,
415  (char *)window_SpeakInHouse->ptr_1C, 2);
416  }
417  dialogwin.DrawTitleText(
418  pFontArrus, 0,
419  (174 - pFontArrus->CalcTextHeight(
420  str, dialogwin.uFrameWidth, 0)) /
421  2 +
422  138,
423  Color16(0xFFu, 0xFFu, 0xFFu), str, 3);
424  }
425  }
426  }
427  }
428  } else { // shop empty
431  [(unsigned int)window_SpeakInHouse->ptr_1C] -
432  pParty->GetPlayingTime()); //Приходите через 7 дней
433  }
434  }
435 }

Перекрестные ссылки BuildDialogueString(), BuildingType_WeaponShop, GUIFont::CalcTextHeight(), Color16(), GUIWindow::DrawShops_next_generation_time_string(), GUIWindow::DrawTitleText(), GameUI_StatusBar_DrawImmediate(), Mouse::GetCursorPos(), Party::GetPlayingTime(), Localization::GetString(), HouseUI_CheckIfPlayerCanInteract(), localization, OS_IfCtrlPressed(), Party::PartyTimes, pFontArrus, pMerchantsBuyPhrases, pParty, pPlayers, GUIWindow::ptr_1C, render, Engine_::IocContainer::ResolveMouse(), shop_ui_background, shop_ui_items_in_store, PartyTimeStruct::Shops_next_generation_time, Party::SpecialItemsInShops, Party::StandartItemsInShops, uActiveCharacter, GUIWindow::uFrameWidth, ItemGen::uItemID, weapons_Ypos, window_SpeakInHouse, Point::x и Point::y.

Используется в WeaponShopDialog().

+ Граф вызовов:
+ Граф вызова функции:

◆ WeaponShopDialog()

void WeaponShopDialog ( )

См. определение в файле UIShops.cpp строка 437

437  {
438  GUIWindow dialog_window = *window_SpeakInHouse;
439  dialog_window.uFrameX = 483;
440  dialog_window.uFrameWidth = 143;
441  dialog_window.uFrameZ = 334;
442 
443  switch (dialog_menu_id) {
444  case HOUSE_DIALOGUE_MAIN: {
445  ShopDialogMain(dialog_window);
446  break;
447  }
449  WeaponShopWares(dialog_window);
450  break;
451  }
453  WeaponShopWares(dialog_window, 1);
454  break;
455  }
458  break;
459  }
462  break;
463  }
466  break;
467  }
469  ShopDialogDisplayEquip(dialog_window);
470  break;
471  }
473  ShopDialogLearn(dialog_window);
474  break;
475  }
476  default: {
477  __debugbreak();
478  break;
479  }
480  }
481 }

Перекрестные ссылки __debugbreak(), BuildingType_WeaponShop, dialog_menu_id, HOUSE_DIALOGUE_LEARN_SKILLS, HOUSE_DIALOGUE_MAIN, HOUSE_DIALOGUE_SHOP_BUY_SPECIAL, HOUSE_DIALOGUE_SHOP_BUY_STANDARD, HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT, HOUSE_DIALOGUE_SHOP_IDENTIFY, HOUSE_DIALOGUE_SHOP_REPAIR, HOUSE_DIALOGUE_SHOP_SELL, ShopDialogDisplayEquip(), ShopDialogIdentify(), ShopDialogLearn(), ShopDialogMain(), ShopDialogRepair(), ShopDialogSellEquip(), GUIWindow::uFrameWidth, GUIWindow::uFrameX, GUIWindow::uFrameZ, WeaponShopWares() и window_SpeakInHouse.

Используется в GUIWindow::HouseDialogManager().

+ Граф вызовов:
+ Граф вызова функции:

◆ ArmorShopWares()

void ArmorShopWares ( GUIWindow  dialogwin,
bool  special 
)

См. определение в файле UIShops.cpp строка 483

483  {
484  render->DrawTextureAlphaNew(8 / 640.0f, 8 / 480.0f, shop_ui_background);
485  int item_x = 0;
486 
487  for (int i = 0; i < 8; ++i) {
488  if ((special == 0 &&
490  .uItemID) ||
491  (special == 1 &&
493  .uItemID)) {
494  if (i >= 4) { // low row
495  render->DrawTextureAlphaNew(
496  ((90 - (shop_ui_items_in_store[i]->GetWidth() / 2)) +
497  item_x - 420) /
498  640.0f,
499  126 / 480.0f, shop_ui_items_in_store[i]);
500  } else {
501  render->DrawTextureAlphaNew(
502  ((86 - (shop_ui_items_in_store[i]->GetWidth() / 2)) +
503  item_x) /
504  640.0f,
505  (98 - shop_ui_items_in_store[i]->GetHeight()) / 480.0f,
507  }
508  }
509  item_x += 105;
510  }
511 
513  int pItemCount = 0;
514  for (int i = 0; i < 8; ++i) {
515  if ((special == 0 &&
517  .uItemID) ||
518  (special == 1 &&
520  .uItemID))
521  ++pItemCount;
522  }
523 
524  if (OS_IfCtrlPressed() == 0 ||
525  pPlayers[uActiveCharacter]->CanSteal() == 0)
527  0); // Select the Item to Buy
528  else
530  0); // Steal item
531 
532  if (pItemCount) { // this should go into func??
534 
535  int testx = (pt.x - 40) / 105;
536  // testx limits check
537  if (testx >= 0 && testx < 4) {
538  if (pt.y >= 126) {
539  testx += 4;
540  }
541 
542  ItemGen *item;
543  if (special == 0) {
544  item = &pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][testx];
545  } else {
546  item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][testx];
547  }
548 
549  if (item->uItemID) {
550  int testpos;
551  if (testx >= 4) {
552  testpos =
553  ((90 - (shop_ui_items_in_store[testx]->GetWidth() / 2)) +
554  (testx * 105) - 420); // low row
555  } else {
556  testpos =
557  ((86 - (shop_ui_items_in_store[testx]->GetWidth() / 2)) +
558  testx * 105);
559  }
560 
561  if (pt.x >= testpos &&
562  pt.x <= testpos + shop_ui_items_in_store[testx]->GetWidth()) {
563  if ((pt.y >= 126 &&
564  pt.y < (126 + shop_ui_items_in_store[testx]->GetHeight())) ||
565  (pt.y <= 98 &&
566  pt.y >= (98 - shop_ui_items_in_store[testx]->GetHeight()))) {
567  // y is 126 to 126 + height low or 98-height to 98
568 
569  String str;
570  if (!OS_IfCtrlPressed() ||
571  !pPlayers[uActiveCharacter]->CanSteal()) {
572  str = BuildDialogueString(
574  [pPlayers[uActiveCharacter]->SelectPhrasesTransaction(
576  uActiveCharacter - 1, item,
577  (char *)window_SpeakInHouse->ptr_1C, 2);
578  } else {
579  str = BuildDialogueString(
580  localization->GetString(181),
581  uActiveCharacter - 1, item,
582  (char *)window_SpeakInHouse->ptr_1C,
583  2); // "Steal %24"
584  }
585  dialogwin.DrawTitleText(
586  pFontArrus, 0,
587  (174 - pFontArrus->CalcTextHeight(str, dialogwin.uFrameWidth, 0)) / 2 + 138,
588  Color16(0xFFu, 0xFFu, 0xFFu), str, 3);
589  }
590  }
591  }
592  }
593  } else {
594  // empty shop
598  }
599  }
600 }

Перекрестные ссылки BuildDialogueString(), BuildingType_ArmorShop, GUIFont::CalcTextHeight(), Color16(), GUIWindow::DrawShops_next_generation_time_string(), GUIWindow::DrawTitleText(), GameUI_StatusBar_DrawImmediate(), Mouse::GetCursorPos(), Party::GetPlayingTime(), Localization::GetString(), HouseUI_CheckIfPlayerCanInteract(), localization, OS_IfCtrlPressed(), GUIWindow::par1C, Party::PartyTimes, pFontArrus, pMerchantsBuyPhrases, pParty, pPlayers, GUIWindow::ptr_1C, render, Engine_::IocContainer::ResolveMouse(), shop_ui_background, shop_ui_items_in_store, PartyTimeStruct::Shops_next_generation_time, Party::SpecialItemsInShops, Party::StandartItemsInShops, uActiveCharacter, GUIWindow::uFrameWidth, ItemGen::uItemID, window_SpeakInHouse, Point::x и Point::y.

Используется в ArmorShopDialog().

+ Граф вызовов:
+ Граф вызова функции:

◆ ArmorShopDialog()

void ArmorShopDialog ( )

См. определение в файле UIShops.cpp строка 602

602  {
603  GUIWindow dialog_window = *window_SpeakInHouse;
604  dialog_window.uFrameX = 483;
605  dialog_window.uFrameWidth = 143;
606  dialog_window.uFrameZ = 334;
607 
608  switch (dialog_menu_id) {
609  case HOUSE_DIALOGUE_MAIN: {
610  ShopDialogMain(dialog_window);
611  break;
612  }
614  ArmorShopWares(dialog_window);
615  break;
616  }
618  ArmorShopWares(dialog_window, 1);
619  break;
620  }
622  ShopDialogDisplayEquip(dialog_window);
623  break;
624  }
627  break;
628  }
631  break;
632  }
635  break;
636  }
638  ShopDialogLearn(dialog_window);
639  break;
640  }
641  default: {
642  __debugbreak();
643  break;
644  }
645  }
646 }

Перекрестные ссылки __debugbreak(), ArmorShopWares(), BuildingType_ArmorShop, dialog_menu_id, HOUSE_DIALOGUE_LEARN_SKILLS, HOUSE_DIALOGUE_MAIN, HOUSE_DIALOGUE_SHOP_BUY_SPECIAL, HOUSE_DIALOGUE_SHOP_BUY_STANDARD, HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT, HOUSE_DIALOGUE_SHOP_IDENTIFY, HOUSE_DIALOGUE_SHOP_REPAIR, HOUSE_DIALOGUE_SHOP_SELL, ShopDialogDisplayEquip(), ShopDialogIdentify(), ShopDialogLearn(), ShopDialogMain(), ShopDialogRepair(), ShopDialogSellEquip(), GUIWindow::uFrameWidth, GUIWindow::uFrameX, GUIWindow::uFrameZ и window_SpeakInHouse.

Используется в GUIWindow::HouseDialogManager().

+ Граф вызовов:
+ Граф вызова функции:

◆ AlchemyMagicShopWares()

void AlchemyMagicShopWares ( GUIWindow  dialogwin,
BuildingType  building,
bool  special 
)

См. определение в файле UIShops.cpp строка 648

649  {
650  render->DrawTextureAlphaNew(8 / 640.0f, 8 / 480.0f, shop_ui_background);
651 
652  int itemx;
653  int itemy;
654 
655  for (uint i = 0; i < 12; ++i) {
656  if ((special == 0 &&
658  .uItemID) ||
659  (special == 1 &&
661  .uItemID)) {
662  if (i >= 6) { // low row
663  itemy = 308 - shop_ui_items_in_store[i]->GetHeight();
664  if (itemy < 0) itemy = 0;
665 
666  itemx = 75 * i - shop_ui_items_in_store[i]->GetWidth() / 2 +
667  40 - 450;
668 
669  } else {
670  itemy = 152 - shop_ui_items_in_store[i]->GetHeight();
671  if (itemy < 0) itemy = 0;
672 
673  itemx = 75 * i - shop_ui_items_in_store[i]->GetWidth() / 2 + 40;
674  }
675 
676  if (i == 0 || i == 6) {
677  if (itemx < 18) itemx = 18;
678  }
679 
680  if (i == 5 || i == 11) {
681  if (itemx > 457 - shop_ui_items_in_store[i]->GetWidth())
682  itemx = 457 - shop_ui_items_in_store[i]->GetWidth();
683  }
684 
685  render->DrawTextureAlphaNew(itemx / 640.0f, itemy / 480.0f,
687  }
688  }
689 
691  int item_num = 0;
692 
693  for (uint i = 0; i < 12; ++i) {
694  if (special == 0 &&
695  pParty
696  ->StandartItemsInShops[(unsigned int)window_SpeakInHouse
697  ->ptr_1C][i]
698  .uItemID ||
699  special == 1 &&
700  pParty
701  ->SpecialItemsInShops[(unsigned int)window_SpeakInHouse
702  ->ptr_1C][i]
703  .uItemID)
704  ++item_num;
705  }
706 
707  if (OS_IfCtrlPressed() && pPlayers[uActiveCharacter]->CanSteal())
709  else
711 
712  if (item_num) {
714 
715  int testx = (pt.x) / 75;
716  // testx limits check
717  if (testx >= 0 && testx < 6) {
718  if (pt.y > 152) {
719  testx += 6;
720  }
721 
722  ItemGen *item;
723  if (special == 0) {
724  item = &pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][testx];
725  } else {
726  item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][testx];
727  }
728 
729  if (item->uItemID) { // item picking
730  int testpos;
731  if (pt.y > 152) {
732  testpos = 75 * testx - shop_ui_items_in_store[testx]->GetWidth() / 2 + 40 - 450;
733  } else {
734  testpos = 75 * testx - shop_ui_items_in_store[testx]->GetWidth() / 2 + 40;
735  }
736 
737  if (pt.x >= testpos &&
738  pt.x <= testpos + shop_ui_items_in_store[testx]->GetWidth()) {
739  if ((pt.y <= 308 &&
740  pt.y >= (308 - shop_ui_items_in_store[testx]->GetHeight())) ||
741  (pt.y <= 152 &&
742  pt.y >= (152 - shop_ui_items_in_store[testx]->GetHeight()))) {
743  // y is 152-h to 152 or 308-height to 308
744 
745  String str;
746  if (!OS_IfCtrlPressed() ||
747  !pPlayers[uActiveCharacter]->CanSteal()) {
748  str = BuildDialogueString(
751  ->SelectPhrasesTransaction(
752  item, building,
754  2)],
755  uActiveCharacter - 1, item,
756  (char *)window_SpeakInHouse->ptr_1C, 2);
757  } else {
758  str = BuildDialogueString(
759  localization->GetString(181),
760  uActiveCharacter - 1, item,
761  (char *)window_SpeakInHouse->ptr_1C,
762  2); // "Steal %24"
763  }
764  dialogwin.DrawTitleText(
765  pFontArrus, 0,
766  (174 - pFontArrus->CalcTextHeight(
767  str, dialogwin.uFrameWidth, 0)) /
768  2 +
769  138,
770  Color16(0xFFu, 0xFFu, 0xFFu), str, 3);
771  }
772  }
773  }
774  }
775  } else {
776  // shop empty
779  [(unsigned int)window_SpeakInHouse->ptr_1C] -
781  }
782  }
783 }

Перекрестные ссылки BuildDialogueString(), GUIFont::CalcTextHeight(), Color16(), GUIWindow::DrawShops_next_generation_time_string(), GUIWindow::DrawTitleText(), GameUI_StatusBar_DrawImmediate(), Mouse::GetCursorPos(), Party::GetPlayingTime(), Localization::GetString(), HouseUI_CheckIfPlayerCanInteract(), localization, OS_IfCtrlPressed(), GUIWindow::par1C, Party::PartyTimes, pFontArrus, pMerchantsBuyPhrases, pParty, pPlayers, GUIWindow::ptr_1C, render, Engine_::IocContainer::ResolveMouse(), shop_ui_background, shop_ui_items_in_store, PartyTimeStruct::Shops_next_generation_time, Party::SpecialItemsInShops, Party::StandartItemsInShops, uActiveCharacter, GUIWindow::uFrameWidth, ItemGen::uItemID, window_SpeakInHouse, Point::x и Point::y.

Используется в AlchemistDialog() и MagicShopDialog().

+ Граф вызовов:
+ Граф вызова функции:

◆ AlchemistDialog()

void AlchemistDialog ( )

См. определение в файле UIShops.cpp строка 785

785  {
786  GUIWindow dialog_window = *window_SpeakInHouse;
787  dialog_window.uFrameX = 483;
788  dialog_window.uFrameWidth = 143;
789  dialog_window.uFrameZ = 334;
790 
791  switch (dialog_menu_id) {
792  case HOUSE_DIALOGUE_MAIN: {
793  ShopDialogMain(dialog_window);
794  break;
795  }
798  break;
799  }
802  break;
803  }
806  break;
807  }
810  break;
811  }
814  break;
815  }
817  ShopDialogLearn(dialog_window);
818  break;
819  }
820  default: {
821  __debugbreak();
822  break;
823  }
824  }
825 }

Перекрестные ссылки __debugbreak(), AlchemyMagicShopWares(), BuildingType_AlchemistShop, dialog_menu_id, HOUSE_DIALOGUE_LEARN_SKILLS, HOUSE_DIALOGUE_MAIN, HOUSE_DIALOGUE_SHOP_BUY_SPECIAL, HOUSE_DIALOGUE_SHOP_BUY_STANDARD, HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT, HOUSE_DIALOGUE_SHOP_IDENTIFY, HOUSE_DIALOGUE_SHOP_SELL, ShopDialogDisplayEquip(), ShopDialogIdentify(), ShopDialogLearn(), ShopDialogMain(), ShopDialogSellEquip(), GUIWindow::uFrameWidth, GUIWindow::uFrameX, GUIWindow::uFrameZ и window_SpeakInHouse.

Используется в GUIWindow::HouseDialogManager().

+ Граф вызовов:
+ Граф вызова функции:

◆ MagicShopDialog()

void MagicShopDialog ( )

См. определение в файле UIShops.cpp строка 827

827  {
828  GUIWindow dialog_window = *window_SpeakInHouse;
829  dialog_window.uFrameX = 483;
830  dialog_window.uFrameWidth = 143;
831  dialog_window.uFrameZ = 334;
832 
833  switch (dialog_menu_id) {
834  case HOUSE_DIALOGUE_MAIN: {
835  ShopDialogMain(dialog_window);
836  break;
837  }
840  break;
841  }
844  break;
845  }
847  ShopDialogDisplayEquip(dialog_window);
848  break;
849  }
852  break;
853  }
856  break;
857  }
860  break;
861  }
863  ShopDialogLearn(dialog_window);
864  break;
865  }
866  default: {
867  __debugbreak();
868  break;
869  }
870  }
871 }

Перекрестные ссылки __debugbreak(), AlchemyMagicShopWares(), BuildingType_MagicShop, dialog_menu_id, HOUSE_DIALOGUE_LEARN_SKILLS, HOUSE_DIALOGUE_MAIN, HOUSE_DIALOGUE_SHOP_BUY_SPECIAL, HOUSE_DIALOGUE_SHOP_BUY_STANDARD, HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT, HOUSE_DIALOGUE_SHOP_IDENTIFY, HOUSE_DIALOGUE_SHOP_REPAIR, HOUSE_DIALOGUE_SHOP_SELL, ShopDialogDisplayEquip(), ShopDialogIdentify(), ShopDialogLearn(), ShopDialogMain(), ShopDialogRepair(), ShopDialogSellEquip(), GUIWindow::uFrameWidth, GUIWindow::uFrameX, GUIWindow::uFrameZ и window_SpeakInHouse.

Используется в GUIWindow::HouseDialogManager().

+ Граф вызовов:
+ Граф вызова функции:

◆ UIShop_Buy_Identify_Repair()

void UIShop_Buy_Identify_Repair ( )

См. определение в файле UIShops.cpp строка 874

874  {
875  unsigned int pItemID; // esi@20
876  ItemGen *item; // esi@21
877 
878  // int v18; // ecx@37
879  float pPriceMultiplier; // ST1C_4@38
880  int taken_item; // eax@40
881  ItemGen *bought_item; // esi@51
882  int party_reputation; // eax@55
883  int v39; // eax@63
884  int v42; // esi@74
885  signed int v43; // ebx@74
886  unsigned __int16 *pSkill; // esi@77
887  int v55; // [sp+0h] [bp-B4h]@26
888  int a6; // [sp+98h] [bp-1Ch]@57
889  int a3; // [sp+9Ch] [bp-18h]@53
890  unsigned int uNumSeconds; // [sp+A4h] [bp-10h]@53
891  unsigned int invindex; // [sp+A8h] [bp-Ch]@9
892  int uPriceItemService; // [sp+ACh] [bp-8h]@12
893 
895  pPlayers[uActiveCharacter]->OnInventoryLeftClick();
896  return;
897  }
898 
900  pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0);
901  return;
902  }
903 
905 
906  switch (dialog_menu_id) {
909  pPlayers[uActiveCharacter]->OnInventoryLeftClick();
910  break;
911  }
912 
914  int testx = (pt.x - 32) / 70;
915  if (testx >= 0 && testx < 6) {
916  if (pt.y >= 250) {
917  testx += 6;
918  }
919 
920  bought_item = &pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C - 139][testx];
921  if (bought_item->uItemID) {
922  int testpos;
923  if (pt.y >= 250) {
924  testpos = 32 + 70 * testx - 420;
925  } else {
926  testpos = 32 + 70 * testx;
927  }
928 
929  if (pt.x >= testpos &&
930  pt.x <= testpos + shop_ui_items_in_store[testx]->GetWidth()) {
931  if ((pt.y >= 90 &&
932  pt.y <= (90 + shop_ui_items_in_store[testx]->GetHeight())) ||
933  (pt.y >= 250 &&
934  pt.y <= (250 + shop_ui_items_in_store[testx]->GetHeight()))) {
935  pPriceMultiplier =
937  uPriceItemService = pPlayers[uActiveCharacter]->GetBuyingPrice(
938  bought_item->GetValue(), pPriceMultiplier);
939 
940  if (pParty->GetGold() < uPriceItemService) {
942  (unsigned int)window_SpeakInHouse->ptr_1C,
943  (HouseSoundID)2);
944  GameUI_StatusBar_OnEvent(localization->GetString(LSTR_NOT_ENOUGH_GOLD));
945  return;
946  }
947 
948  taken_item = pPlayers[uActiveCharacter]->AddItem(
949  -1, bought_item->uItemID);
950  if (taken_item) {
951  bought_item->SetIdentified();
952  memcpy(
953  &pPlayers[uActiveCharacter]->pInventoryItemList[taken_item - 1],
954  bought_item, 0x24u);
955  dword_F8B1E4 = 1;
956  Party::TakeGold(uPriceItemService);
958  bought_item->Reset();
959  render->ClearZBuffer(0, 479);
960  pPlayers[uActiveCharacter]->PlaySound(
961  (PlayerSpeech)SPEECH_75, 0);
962  return;
963  }
964 
965  pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0);
966  GameUI_StatusBar_OnEvent(localization->GetString(563)); // "Pack is Full!"
967  break;
968  }
969  }
970  }
971  }
972 
973  return; // no item
974  break;
975  }
976 
978  invindex = ((pt.x - 14) >> 5) + 14 * ((pt.y - 17) >> 5);
979  if (pt.x <= 13 || pt.x >= 462 ||
980  (pItemID = pPlayers[uActiveCharacter]->GetItemListAtInventoryIndex(invindex),
981  !pItemID))
982  return;
983 
985  ->pInventoryItemList[pItemID - 1]
986  .MerchandiseTest((int)window_SpeakInHouse->ptr_1C)) {
987  dword_F8B1E4 = 1;
988  pPlayers[uActiveCharacter]->SalesProcess(
989  invindex, pItemID - 1, (int)window_SpeakInHouse->ptr_1C);
991  render->ClearZBuffer(0, 479);
992  pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)77, 0);
993  return;
994  }
995 
996  pPlayers[uActiveCharacter]->PlaySound(SPEECH_79, 0);
997  pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0);
998  break;
999  }
1000 
1002  invindex = ((pt.x - 14) >> 5) + 14 * ((pt.y - 17) >> 5);
1003  if (pt.x <= 13 || pt.x >= 462 ||
1004  (pItemID = pPlayers[uActiveCharacter]->GetItemListAtInventoryIndex(invindex),
1005  !pItemID))
1006  return;
1007 
1008  uPriceItemService =
1009  pPlayers[uActiveCharacter]->GetPriceIdentification(
1011  item = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1];
1012 
1013  if (!(item->uAttributes & ITEM_IDENTIFIED)) {
1014  if (item->MerchandiseTest((int)window_SpeakInHouse->ptr_1C)) {
1015  if (pParty->GetGold() >= uPriceItemService) {
1016  dword_F8B1E4 = 1;
1017  Party::TakeGold(uPriceItemService);
1018  item->uAttributes |= ITEM_IDENTIFIED;
1019  pPlayers[uActiveCharacter]->PlaySound(SPEECH_73, 0);
1021  return;
1022  }
1023 
1024  PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C,
1025  (HouseSoundID)2);
1026  return;
1027  }
1028 
1029  pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0);
1030  pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)79, 0);
1031  return;
1032  }
1033 
1034  pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)76, 0);
1035  break;
1036  }
1037 
1039  invindex = ((pt.x - 14) >> 5) + 14 * ((pt.y - 17) >> 5);
1040  if (pt.x <= 13 || pt.x >= 462 ||
1041  (pItemID = pPlayers[uActiveCharacter]->GetItemListAtInventoryIndex(
1042  invindex),
1043  !pItemID))
1044  return;
1045 
1046  item = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1];
1047  pPriceMultiplier =
1048  p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1]
1050  uPriceItemService = pPlayers[uActiveCharacter]->GetPriceRepair(
1051  item->GetValue(), pPriceMultiplier);
1052 
1053  if (item->uAttributes & ITEM_BROKEN) {
1054  if (item->MerchandiseTest((int)window_SpeakInHouse->ptr_1C)) {
1055  if (pParty->GetGold() >= uPriceItemService) {
1056  dword_F8B1E4 = 1;
1057  Party::TakeGold(uPriceItemService);
1058  item->uAttributes =
1059  (item->uAttributes & 0xFFFFFFFD) | 1;
1060  pPlayers[uActiveCharacter]->PlaySound(SPEECH_74, 0);
1062  return;
1063  }
1064 
1065  PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C,
1066  (HouseSoundID)2);
1067  return;
1068  }
1069 
1070  pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0);
1071  pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)79, 0);
1072  return;
1073  }
1074 
1075  pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)76, 0);
1076  break;
1077  }
1078 
1081  int testx;
1082  int testpos;
1083 
1084  switch (in_current_building_type) {
1086 
1087  testx = (pt.x - 30) / 70;
1088  if (testx >= 0 && testx < 6) {
1090  bought_item =
1092  [(int)window_SpeakInHouse->ptr_1C][testx];
1093  else
1094  bought_item =
1096  [(int)window_SpeakInHouse->ptr_1C][testx];
1097 
1098  if (bought_item->uItemID) {
1099  testpos =
1100  ((60 -
1101  ((signed int)shop_ui_items_in_store[testx]
1102  ->GetWidth() /
1103  2)) +
1104  testx * 70);
1105  if (pt.x >= testpos &&
1106  pt.x <
1107  (testpos +
1108  (signed int)shop_ui_items_in_store[testx]
1109  ->GetWidth())) {
1110  if (pt.y >= weapons_Ypos[testx] + 30 &&
1111  pt.y < (weapons_Ypos[testx] + 30 +
1112  shop_ui_items_in_store[testx]
1113  ->GetHeight())) {
1114  break; // good
1115  }
1116  } else {
1117  bought_item = nullptr;
1118  return;
1119  }
1120  } else {
1121  return;
1122  }
1123  }
1124  break;
1125 
1127 
1128  testx = (pt.x - 40) / 105;
1129  if (testx >= 0 && testx < 4) {
1130  if (pt.y >= 126) {
1131  testx += 4;
1132  }
1133 
1135  bought_item =
1137  [(int)window_SpeakInHouse->ptr_1C][testx];
1138  else
1139  bought_item =
1141  [(int)window_SpeakInHouse->ptr_1C][testx];
1142 
1143  if (bought_item->uItemID) {
1144  if (testx >= 4) {
1145  testpos = ((90 - (shop_ui_items_in_store[testx]
1146  ->GetWidth() /
1147  2)) +
1148  (testx * 105) - 420); // low row
1149  } else {
1150  testpos = ((86 - (shop_ui_items_in_store[testx]
1151  ->GetWidth() /
1152  2)) +
1153  testx * 105);
1154  }
1155 
1156  if (pt.x >= testpos &&
1157  pt.x <=
1158  testpos + shop_ui_items_in_store[testx]
1159  ->GetWidth()) {
1160  if ((pt.y >= 126 &&
1161  pt.y <
1162  (126 + shop_ui_items_in_store[testx]
1163  ->GetHeight())) ||
1164  (pt.y <= 98 &&
1165  pt.y >=
1166  (98 - shop_ui_items_in_store[testx]
1167  ->GetHeight()))) {
1168  break; // good
1169  }
1170  } else {
1171  bought_item = nullptr;
1172  return;
1173  }
1174  } else {
1175  return;
1176  }
1177  }
1178  break;
1179 
1182 
1183  testx = (pt.x) / 75;
1184  if (testx >= 0 && testx < 6) {
1185  if (pt.y > 152) {
1186  testx += 6;
1187  }
1188 
1190  bought_item =
1192  [(int)window_SpeakInHouse->ptr_1C][testx];
1193  else
1194  bought_item =
1196  [(int)window_SpeakInHouse->ptr_1C][testx];
1197 
1198  if (bought_item->uItemID) {
1199  if (pt.y > 152) {
1200  testpos =
1201  75 * testx -
1202  shop_ui_items_in_store[testx]->GetWidth() /
1203  2 +
1204  40 - 450;
1205  } else {
1206  testpos =
1207  75 * testx -
1208  shop_ui_items_in_store[testx]->GetWidth() /
1209  2 +
1210  40;
1211  }
1212 
1213  if (pt.x >= testpos &&
1214  pt.x <=
1215  testpos + shop_ui_items_in_store[testx]
1216  ->GetWidth()) {
1217  if ((pt.y <= 308 &&
1218  pt.y >=
1219  (308 - shop_ui_items_in_store[testx]
1220  ->GetHeight())) ||
1221  (pt.y <= 152 &&
1222  pt.y >=
1223  (152 - shop_ui_items_in_store[testx]
1224  ->GetHeight()))) {
1225  // y is 152-h to 152 or 308-height to 308
1226  break; // good
1227  }
1228  } else {
1229  bought_item = nullptr;
1230  return;
1231  }
1232  } else {
1233  return;
1234  }
1235  }
1236  break;
1237 
1238  default:
1239  return;
1240  }
1241 
1242  uPriceItemService = pPlayers[uActiveCharacter]->GetBuyingPrice(
1243  bought_item->GetValue(),
1244  p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1]
1245  .fPriceMultiplier);
1246  uNumSeconds = 0;
1247  a3 = 0;
1250  ._steal_perm;
1251  party_reputation = pParty->GetPartyReputation();
1252  if (pPlayers[uActiveCharacter]->CanSteal() && OS_IfCtrlPressed()) {
1253  uNumSeconds = pPlayers[uActiveCharacter]->StealFromShop(
1254  bought_item, a3, party_reputation, 0, &a6);
1255  if (!uNumSeconds) {
1256  // caught stealing no item
1258  return;
1259  }
1260  } else if (pParty->GetGold() < uPriceItemService) {
1262  GameUI_StatusBar_OnEvent(localization->GetString(LSTR_NOT_ENOUGH_GOLD));
1263  return;
1264  }
1265 
1266  v39 = pPlayers[uActiveCharacter]->AddItem(-1, bought_item->uItemID);
1267  if (v39) {
1268  bought_item->SetIdentified();
1269  memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v39 - 1],
1270  bought_item, sizeof(ItemGen));
1271  if (uNumSeconds != 0) { // stolen
1273  ->pInventoryItemList[v39 - 1]
1274  .SetStolen();
1276  uNumSeconds, a6);
1277  } else {
1278  dword_F8B1E4 = 1;
1279  Party::TakeGold(uPriceItemService);
1280  }
1282  bought_item->Reset();
1283  render->ClearZBuffer(0, 479);
1285  0);
1286  return;
1287  } else {
1288  pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0);
1290  localization->GetString(563)); // "Pack is Full!"
1291  return;
1292  }
1293  break;
1294  }
1295  default: // if click video screen in shop
1296  {
1297  if (dialog_menu_id >= 36 && dialog_menu_id <= 72) {
1298  __debugbreak(); // please do record these dialogue ids to the
1299  // HOUSE_DIALOGUE_MENU enum
1300 
1301  v42 = dialog_menu_id - 36;
1302  // v43 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 *
1303  // (unsigned int)ptr_507BC0->ptr_1C] * 500.0);
1304  v43 =
1305  (signed __int64)(p2DEvents[(unsigned int)
1307  1]
1308  .flt_24 *
1309  500.0);
1310  uPriceItemService =
1311  v43 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) /
1312  100;
1313  if (uPriceItemService < v43 / 3) uPriceItemService = v43 / 3;
1315  [pPlayers[uActiveCharacter]->classType][v42]) {
1316  pSkill = &pPlayers[uActiveCharacter]->pActiveSkills[v42];
1317  if (!*pSkill) {
1318  if (pParty->GetGold() < uPriceItemService) {
1319  GameUI_StatusBar_OnEvent(localization->GetString(LSTR_NOT_ENOUGH_GOLD));
1322  v55 = 4;
1323  else
1324  v55 = 2;
1326  (unsigned int)window_SpeakInHouse->ptr_1C,
1327  (HouseSoundID)v55);
1328  return;
1329  }
1330  Party::TakeGold(uPriceItemService);
1331  dword_F8B1E4 = 1;
1332  *pSkill = 1;
1333  pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)78, 0);
1334  return;
1335  }
1336  }
1337  }
1338  break;
1339  }
1340  }
1341 }

Перекрестные ссылки __debugbreak(), MapInfo::_steal_perm, ViewingParams::bRedrawGameUI, BuildingType_AlchemistShop, BuildingType_ArmorShop, BuildingType_MagicShop, BuildingType_Training, BuildingType_WeaponShop, byte_4ED970_skill_learn_ability_by_class_table, current_character_screen_window, current_screen_type, dialog_menu_id, dword_F8B1E4, _2devent::flt_24, _2devent::fPriceMultiplier, GameUI_StatusBar_OnEvent(), Mouse::GetCursorPos(), Party::GetGold(), MapStats::GetMapInfo(), Party::GetPartyReputation(), Localization::GetString(), ItemGen::GetValue(), HOUSE_DIALOGUE_GUILD_BUY_BOOKS, HOUSE_DIALOGUE_SHOP_BUY_SPECIAL, HOUSE_DIALOGUE_SHOP_BUY_STANDARD, HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT, HOUSE_DIALOGUE_SHOP_IDENTIFY, HOUSE_DIALOGUE_SHOP_REPAIR, HOUSE_DIALOGUE_SHOP_SELL, HouseUI_CheckIfPlayerCanInteract(), in_current_building_type, ITEM_BROKEN, ITEM_IDENTIFIED, localization, ItemGen::MerchandiseTest(), OS_IfCtrlPressed(), p2DEvents, GUIWindow::par1C, pAudioPlayer, pCurrentMapName, MapStats::pInfos, PlayHouseSound(), AudioPlayer::PlaySound(), pMapStats, pParty, pPlayers, GUIWindow::ptr_1C, render, ItemGen::Reset(), Engine_::IocContainer::ResolveMouse(), SCREEN_E, ItemGen::SetIdentified(), shop_ui_items_in_store, SOUND_error, Party::SpecialItemsInShops, SPEECH_73, SPEECH_74, SPEECH_75, SPEECH_79, SPEECH_NoRoom, Party::SpellBooksInGuilds, Party::StandartItemsInShops, sub_4B1447_party_fine(), Party::TakeGold(), uActiveCharacter, ItemGen::uAttributes, ItemGen::uItemID, viewparams, weapons_Ypos, WINDOW_CharacterWindow_Inventory, window_SpeakInHouse, Point::x и Point::y.

Используется в Application::Game::EventLoop().

+ Граф вызовов:
+ Граф вызова функции:

◆ ShowPopupShopItem()

void ShowPopupShopItem ( )

См. определение в файле UIShops.cpp строка 1344

1344  {
1345  ItemGen *item; // ecx@13
1346  int invindex;
1347  int testpos;
1348 
1349  if (in_current_building_type <= 0) return;
1351 
1353  int testx;
1354 
1358  switch (in_current_building_type) {
1359  case BuildingType_WeaponShop: {
1360  testx = (pt.x - 30) / 70;
1361  if (testx >= 0 && testx < 6) {
1363  item =
1365  [(int)window_SpeakInHouse->ptr_1C][testx];
1366  else
1367  item =
1369  [(int)window_SpeakInHouse->ptr_1C][testx];
1370 
1371  if (item->uItemID) {
1372  testpos =
1373  ((60 -
1374  (shop_ui_items_in_store[testx]->GetWidth() /
1375  2)) +
1376  testx * 70);
1377  if (pt.x >= testpos &&
1378  pt.x <
1379  (testpos + shop_ui_items_in_store[testx]
1380  ->GetWidth())) {
1381  if (pt.y >= weapons_Ypos[testx] + 30 &&
1382  pt.y < (weapons_Ypos[testx] + 30 +
1383  shop_ui_items_in_store[testx]
1384  ->GetHeight())) {
1385  GameUI_DrawItemInfo(item);
1386  }
1387  } else {
1388  return;
1389  }
1390  }
1391  } else {
1392  return;
1393  }
1394 
1395  break;
1396  }
1397 
1399  testx = (pt.x - 40) / 105;
1400  if (testx >= 0 && testx < 4) {
1401  if (pt.y >= 126) {
1402  testx += 4;
1403  }
1404 
1406  item =
1408  [(int)window_SpeakInHouse->ptr_1C][testx];
1409  else
1410  item =
1412  [(int)window_SpeakInHouse->ptr_1C][testx];
1413 
1414  if (item->uItemID) {
1415  if (testx >= 4) {
1416  testpos = ((90 - (shop_ui_items_in_store[testx]
1417  ->GetWidth() /
1418  2)) +
1419  (testx * 105) - 420); // low row
1420  } else {
1421  testpos = ((86 - (shop_ui_items_in_store[testx]
1422  ->GetWidth() /
1423  2)) +
1424  testx * 105);
1425  }
1426 
1427  if (pt.x >= testpos &&
1428  pt.x <=
1429  testpos + shop_ui_items_in_store[testx]
1430  ->GetWidth()) {
1431  if ((pt.y >= 126 &&
1432  pt.y <
1433  (126 + shop_ui_items_in_store[testx]
1434  ->GetHeight())) ||
1435  (pt.y <= 98 &&
1436  pt.y >=
1437  (98 - shop_ui_items_in_store[testx]
1438  ->GetHeight()))) {
1439  GameUI_DrawItemInfo(item);
1440  } else {
1441  return;
1442  }
1443  }
1444  } else {
1445  return;
1446  }
1447  }
1448  break;
1449 
1452  testx = (pt.x) / 75;
1453  // testx limits check
1454  if (testx >= 0 && testx < 6) {
1455  if (pt.y >= 152) {
1456  testx += 6;
1457  }
1458 
1460  item =
1462  [(int)window_SpeakInHouse->ptr_1C][testx];
1463  else
1464  item =
1466  [(int)window_SpeakInHouse->ptr_1C][testx];
1467 
1468  if (item->uItemID) {
1469  if (pt.y > 152) {
1470  testpos =
1471  75 * testx -
1472  shop_ui_items_in_store[testx]->GetWidth() /
1473  2 +
1474  40 - 450;
1475  } else {
1476  testpos =
1477  75 * testx -
1478  shop_ui_items_in_store[testx]->GetWidth() /
1479  2 +
1480  40;
1481  }
1482 
1483  if (pt.x >= testpos &&
1484  pt.x <=
1485  testpos + shop_ui_items_in_store[testx]
1486  ->GetWidth()) {
1487  if ((pt.y <= 308 &&
1488  pt.y >=
1489  (308 - shop_ui_items_in_store[testx]
1490  ->GetHeight())) ||
1491  (pt.y <= 152 &&
1492  pt.y >=
1493  (152 - shop_ui_items_in_store[testx]
1494  ->GetHeight()))) {
1495  GameUI_DrawItemInfo(item);
1496  } else {
1497  return;
1498  }
1499  }
1500  } else {
1501  return;
1502  }
1503  }
1504  break;
1505 
1506  default:
1507  // v3 = render->pActiveZBuffer[mouse.x +
1508  // pSRZBufferLineOffsets[mouse.y]] & 0xFFFF; if (!v3)
1509  // return;
1510  // v7 = &pParty->StandartItemsInShops[(unsigned
1511  // int)window_SpeakInHouse->ptr_1C][v3 - 1]; if
1512  // (dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL) v7 =
1513  // &pParty->SpecialItemsInShops[(unsigned
1514  // int)window_SpeakInHouse->ptr_1C][v3 - 1];
1515  // GameUI_DrawItemInfo(v7);
1516  return;
1517  break;
1518  }
1519  }
1520 
1524  invindex = ((pt.x - 14) >> 5) + 14 * ((pt.y - 17) >> 5);
1525  if (pt.x <= 13 || pt.x >= 462 ||
1526  !pPlayers[uActiveCharacter]->GetItemListAtInventoryIndex(
1527  invindex))
1528  return;
1529 
1531  pPlayers[uActiveCharacter]->GetItemAtInventoryIndex(invindex));
1532  return;
1533  }
1534  }
1535 
1538  int testx = (pt.x - 32) / 70;
1539  if (testx >= 0 && testx < 6) {
1540  if (pt.y >= 250) {
1541  testx += 6;
1542  }
1543 
1545  [testx];
1546 
1547  if (item->uItemID) {
1548  int testpos;
1549  if (pt.y >= 250) {
1550  testpos = 32 + 70 * testx - 420;
1551  } else {
1552  testpos = 32 + 70 * testx;
1553  }
1554 
1555  if (pt.x >= testpos &&
1556  pt.x <=
1557  testpos + shop_ui_items_in_store[testx]->GetWidth()) {
1558  if ((pt.y >= 90 &&
1559  pt.y <=
1560  (90 +
1561  shop_ui_items_in_store[testx]->GetHeight())) ||
1562  (pt.y >= 250 &&
1563  pt.y <=
1564  (250 +
1565  shop_ui_items_in_store[testx]->GetHeight()))) {
1566  unsigned int guildId =
1567  (unsigned int)window_SpeakInHouse->ptr_1C - 139;
1569  pParty->SpellBooksInGuilds[guildId][testx].uItemID);
1570  }
1571  }
1572  }
1573  }
1574  }
1575 }

Перекрестные ссылки BuildingType_16, BuildingType_AlchemistShop, BuildingType_ArmorShop, BuildingType_MagicShop, BuildingType_WeaponShop, dialog_menu_id, GameUI_DrawItemInfo(), Mouse::GetCursorPos(), HOUSE_DIALOGUE_GUILD_BUY_BOOKS, HOUSE_DIALOGUE_SHOP_BUY_SPECIAL, HOUSE_DIALOGUE_SHOP_BUY_STANDARD, HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT, HOUSE_DIALOGUE_SHOP_REPAIR, HOUSE_DIALOGUE_SHOP_SELL, in_current_building_type, GUIWindow::par1C, pParty, pPlayers, GUIWindow::ptr_1C, Engine_::IocContainer::ResolveMouse(), shop_ui_items_in_store, Party::SpecialItemsInShops, Party::SpellBooksInGuilds, Party::StandartItemsInShops, sub_4B1523_showSpellbookInfo(), uActiveCharacter, ItemGen::uItemID, weapons_Ypos, window_SpeakInHouse, Point::x и Point::y.

Используется в UI_OnMouseRightClick().

+ Граф вызовов:
+ Граф вызова функции:

◆ sub_4B1523_showSpellbookInfo()

void sub_4B1523_showSpellbookInfo ( int  spellItemId)

См. определение в файле UIShops.cpp строка 1577

1577  {
1578  int v4; // eax@4
1579  long v5; // ecx@4
1580  int v6; // eax@10
1581  char *v7; // ST44_4@12
1582  unsigned __int16 v8; // ax@12
1583  int v13; // [sp+6Ch] [bp-8h]@4
1584  int v14; // [sp+70h] [bp-4h]@4
1585 
1586  int spellId = spellItemId - 399;
1587  int spellLevel = (spellItemId - 400) % 11 + 1;
1588  unsigned int spellSchool = 4 * (spellItemId - 400) / 11;
1589 
1590  // sprintf(tmp_str.data(), "%s%03d", spellbook_texture_filename_suffices[v11
1591  // / 4], v2); not used
1592 
1594  unsigned int v3 = 30;
1595  if (a2.y <= 320) {
1596  v3 = a2.y + 30;
1597  }
1598 
1599  GUIWindow a1;
1600  a1.uFrameY = v3;
1601  a1.uFrameWidth = 328;
1602  a1.uFrameHeight = 68;
1603  a1.uFrameX = 90;
1604  a1.uFrameZ = 417;
1605  a1.uFrameW = v3 + 67;
1610  v5 = a2.y;
1611  if (v14 > a2.y) v5 = v14;
1612  if (v13 > v5) v5 = v13;
1613  if (v4 > v5) v5 = v4;
1614 
1615  auto str = StringPrintf(
1616  "%s\n\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%"
1617  "s\t000\n%s\t%03d:\t%03d%s",
1618  pSpellStats->pInfos[spellId].pDescription,
1619  localization->GetString(431), // "Normal"
1620  v5 + 3, v5 + 10, pSpellStats->pInfos[spellId].pBasicSkillDesc,
1621  localization->GetString(433), // "Expert"
1622  v5 + 3, v5 + 10, pSpellStats->pInfos[spellId].pExpertSkillDesc,
1623  localization->GetString(432), // "Master"
1624  v5 + 3, v5 + 10, pSpellStats->pInfos[spellId].pMasterSkillDesc,
1625  localization->GetString(96), // "Grand"
1626  v5 + 3, v5 + 10, pSpellStats->pInfos[spellId].pGrandmasterSkillDesc);
1627  v6 = pFontSmallnum->CalcTextHeight(str, a1.uFrameWidth, 0);
1628  a1.uFrameHeight += v6;
1629  if (a1.uFrameHeight < 150) {
1630  a1.uFrameHeight = 150;
1631  }
1633  a1.DrawMessageBox(0);
1634  a1.uFrameWidth -= 12;
1635  a1.uFrameHeight -= 12;
1636  v7 = pSpellStats->pInfos[spellId].pName;
1637  a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1;
1638  a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1;
1639  v8 = Color16(0xFFu, 0xFFu, 0x9Bu);
1640  a1.DrawTitleText(pFontArrus, 0x78u, 0xCu, v8, v7, 3u);
1641  a1.DrawText(pFontSmallnum, 120, 44, 0, str, 0, 0, 0);
1642  a1.uFrameZ = a1.uFrameX + 107;
1643  a1.uFrameWidth = 108;
1644  a1.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0,
1645  localization->GetSkillName(spellSchool / 4 + 12), 3u);
1646 
1647  str = StringPrintf("%s\n%d", localization->GetString(522),
1648  *(&pSpellDatas[0].uNormalLevelMana + 10 * spellId));
1649  a1.DrawTitleText(pFontComic, 0xCu,
1650  a1.uFrameHeight - pFontComic->GetHeight() - 16, 0, str, 3);
1651 }

Перекрестные ссылки GUIFont::CalcTextHeight(), Color16(), GUIWindow::DrawMessageBox(), GUIWindow::DrawText(), GUIWindow::DrawTitleText(), game_viewport_width, Mouse::GetCursorPos(), GUIFont::GetHeight(), GUIFont::GetLineWidth(), Localization::GetSkillName(), Localization::GetString(), localization, SpellInfo::pBasicSkillDesc, SpellInfo::pDescription, SpellInfo::pExpertSkillDesc, pFontArrus, pFontComic, pFontSmallnum, SpellInfo::pGrandmasterSkillDesc, SpellStats::pInfos, SpellInfo::pMasterSkillDesc, SpellInfo::pName, pSpellDatas, pSpellStats, Engine_::IocContainer::ResolveMouse(), StringPrintf(), GUIWindow::uFrameHeight, GUIWindow::uFrameW, GUIWindow::uFrameWidth, GUIWindow::uFrameX, GUIWindow::uFrameY, GUIWindow::uFrameZ и Point::y.

Используется в ShowPopupShopItem().

+ Граф вызовов:
+ Граф вызова функции:

◆ GetHouseGoodbyeSpeech()

void GetHouseGoodbyeSpeech ( )

См. определение в файле UIShops.cpp строка 1654

1654  {
1655  signed int v2; // edi@10
1656  signed int v5; // edi@20
1657  int v7[4]; // [sp+Ch] [bp-10h]@12
1658 
1659  if (in_current_building_type > 0) {
1662  if (!dword_F8B1E4) return;
1663  } else {
1665  }
1667  return;
1668  }
1669  if ((signed __int64)pParty->PartyTimes
1670  ._shop_ban_times[(unsigned int)window_SpeakInHouse->ptr_1C] <=
1671  pParty->GetPlayingTime()) {
1672  if (pParty->GetGold() <= 10000) {
1673  if (!dword_F8B1E4) return;
1675  return;
1676  }
1677  PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C,
1678  (HouseSoundID)(dword_F8B1E4 + 3));
1680  v5 = 0;
1681  for (uint i = 1; i <= 4; ++i) {
1682  if (pPlayers[i]->CanAct()) v7[v5++] = i;
1683  }
1684  if (v5) {
1687  uSpeakingCharacter = v7[rand() % v5];
1688  return;
1689  }
1690  }
1691  } else { // caught stealing
1693  v2 = 0;
1694  for (uint i = 1; i <= 4; ++i) {
1695  if (pPlayers[i]->CanAct()) v7[v2++] = i;
1696  }
1697  if (v2) {
1700  uSpeakingCharacter = v7[rand() % v2];
1701  return;
1702  }
1703  }
1704  }
1705  }
1706 }

Перекрестные ссылки _A750D8_player_speech_timer, PartyTimeStruct::_shop_ban_times, BuildingType_Bank, BuildingType_MagicShop, BuildingType_Temple, dword_F8B1E4, Party::GetGold(), Party::GetPlayingTime(), HouseSound_Goodbye, HouseSound_Greeting_2, in_current_building_type, Party::PartyTimes, PlayerSpeechID, PlayHouseSound(), pParty, pPlayers, GUIWindow::ptr_1C, SPEECH_80, uSpeakingCharacter и window_SpeakInHouse.

Используется в Application::Game::EventLoop() и TavernDialog().

+ Граф вызовов:
+ Граф вызова функции:

◆ sub_4B1447_party_fine()

void sub_4B1447_party_fine ( int  shopId,
int  stealingResult,
int  fineToAdd 
)

См. определение в файле UIShops.cpp строка 1709

1710  { // not working properly??
1711  int v3; // esi@1
1712  DDM_DLV_Header *v7; // eax@14
1713 
1714  if (stealingResult == 0 || stealingResult == 1) { // got caught
1715  if (pParty->uFine < 4000000) {
1716  if (fineToAdd + pParty->uFine < 0)
1717  pParty->uFine = 0;
1718  else if (fineToAdd + pParty->uFine > 4000000)
1719  pParty->uFine = 4000000;
1720  else
1721  pParty->uFine += fineToAdd;
1722  }
1723  if (pParty->uFine) {
1724  for (uint i = 1; i <= 4; ++i) {
1725  if (!_449B57_test_bit(pPlayers[i]->_achieved_awards_bits, PLAYER_GUILD_BITS__FINED))
1726  _449B7E_toggle_bit(pPlayers[i]->_achieved_awards_bits, PLAYER_GUILD_BITS__FINED, 1);
1727  }
1728  }
1729  if (stealingResult == 1)
1730  v3 = 2;
1731  else
1732  v3 = 1;
1733 
1734  pParty->PartyTimes._shop_ban_times[shopId] =
1736  GameTime::FromDays(1)); // only ban when caught
1737  } else {
1738  v3 = 2;
1739  }
1740 
1741  pParty->InTheShopFlags[shopId] = 1;
1742  v7 = &pOutdoor->ddm;
1744  v7->uReputation += v3;
1745  if (v7->uReputation > 10000) v7->uReputation = 10000;
1746 }

Перекрестные ссылки _449B57_test_bit(), _449B7E_toggle_bit(), PartyTimeStruct::_shop_ban_times, OutdoorLocation::ddm, IndoorLocation::dlv, GameTime::FromDays(), Party::GetPlayingTime(), Party::InTheShopFlags, LEVEL_Outdoor, Party::PartyTimes, pIndoor, pOutdoor, pParty, pPlayers, uCurrentlyLoadedLevelType, Party::uFine и DDM_DLV_Header::uReputation.

Используется в UIShop_Buy_Identify_Repair().

+ Граф вызовов:
+ Граф вызова функции:

Переменные

◆ shop_ui_background

Image* shop_ui_background = nullptr

См. определение в файле UIShops.cpp строка 33

Используется в AlchemyMagicShopWares(), ArmorShopWares(), GuildDialog(), HouseDialogPressCloseBtn() и WeaponShopWares().

◆ shop_ui_items_in_store

std::array<Image *, 12> shop_ui_items_in_store

См. определение в файле UIShops.cpp строка 35

Используется в AlchemyMagicShopWares(), ArmorShopWares(), GuildDialog(), ShowPopupShopItem(), SpellBookGenerator(), UIShop_Buy_Identify_Repair() и WeaponShopWares().

pMerchantsIdentifyPhrases
std::array< const char *, 7 > pMerchantsIdentifyPhrases
Definition: mm7_data.cpp:751
GUIWindow::DrawText
void DrawText(GUIFont *font, int x, int y, unsigned short uFontColor, const char *str, bool present_time_transparency=false, int max_text_height=0, int uFontShadowColor=0)
Definition: GUIWindow.cpp:694
ShopDialogIdentify
void ShopDialogIdentify(GUIWindow dialogwin, BuildingType building)
Definition: UIShops.cpp:165
GUIWindow::uFrameW
unsigned int uFrameW
Definition: GUIWindow.h:473
Localization::GetString
const char * GetString(unsigned int index) const
Definition: Localization.cpp:13
uSpeakingCharacter
int uSpeakingCharacter
Definition: mm7_data.cpp:764
MapStats::pInfos
MapInfo pInfos[77]
Definition: MapInfo.h:79
Party::GetPlayingTime
GameTime & GetPlayingTime()
Definition: Party.h:230
HOUSE_DIALOGUE_SHOP_BUY_SPECIAL
@ HOUSE_DIALOGUE_SHOP_BUY_SPECIAL
Definition: UIHouses.h:32
BuildingType_Training
@ BuildingType_Training
Definition: Events2D.h:34
Mouse::GetCursorPos
Point GetCursorPos()
Definition: Mouse.cpp:108
GUIWindow
Definition: GUIWindow.h:433
AlchemyMagicShopWares
void AlchemyMagicShopWares(GUIWindow dialogwin, BuildingType building, bool special)
Definition: UIShops.cpp:648
BuildingType_16
@ BuildingType_16
Definition: Events2D.h:20
Party::uFine
int uFine
Definition: Party.h:324
ItemGen::SetIdentified
void SetIdentified()
Definition: Items.h:307
shop_ui_background
Image * shop_ui_background
Definition: UIShops.cpp:33
_449B57_test_bit
bool _449B57_test_bit(unsigned __int8 *a1, __int16 a2)
Definition: Party.cpp:1185
SpellStats::pInfos
SpellInfo pInfos[100]
Definition: Spells.h:192
PartyTimeStruct::Shops_next_generation_time
std::array< GameTime, 85 > Shops_next_generation_time
Definition: Party.h:143
dialog_menu_id
HOUSE_DIALOGUE_MENU dialog_menu_id
Definition: UIHouses.cpp:50
PlayerSpeechID
enum PlayerSpeech PlayerSpeechID
Definition: Player.cpp:48
SPEECH_80
@ SPEECH_80
Definition: Player.h:126
BuildingType_ArmorShop
@ BuildingType_ArmorShop
Definition: Events2D.h:6
MapStats::GetMapInfo
MAP_TYPE GetMapInfo(const String &Str2)
Definition: MapInfo.cpp:225
AudioPlayer::PlaySound
void PlaySound(SoundID eSoundID, int pid, unsigned int uNumRepeats, int x, int y, int a7)
Definition: AudioPlayer.cpp:195
Party::InTheShopFlags
std::array< int, 53 > InTheShopFlags
Definition: Party.h:323
game_viewport_width
unsigned int game_viewport_width
Definition: mm7_data.cpp:194
SpellInfo::pName
char * pName
Definition: Spells.h:176
weapons_Ypos
std::array< int16_t, 6 > weapons_Ypos
Definition: mm7_data.cpp:769
SOUND_error
@ SOUND_error
Definition: AudioPlayer.h:19
HOUSE_DIALOGUE_LEARN_SKILLS
@ HOUSE_DIALOGUE_LEARN_SKILLS
Definition: UIHouses.h:33
localization
Localization * localization
Definition: Localization.cpp:11
Point::x
unsigned int x
Definition: Point.h:7
GameUI_StatusBar_DrawImmediate
void GameUI_StatusBar_DrawImmediate(const String &str, int color)
Definition: UIStatusBar.cpp:88
GUIWindow::DrawTitleText
void DrawTitleText(GUIFont *font, int horizontal_margin, int vertical_margin, unsigned __int16 uDefaultColor, const char *pInString, int line_spacing)
Definition: GUIWindow.cpp:665
GUIFont::GetLineWidth
unsigned int GetLineWidth(const String &str)
Definition: GUIFont.cpp:278
HouseSound_Greeting_2
@ HouseSound_Greeting_2
Definition: UIHouses.h:115
GUIFont::GetHeight
unsigned int GetHeight() const
Definition: GUIFont.cpp:84
BuildingType_Bank
@ BuildingType_Bank
Definition: Events2D.h:26
ItemGen::Reset
void Reset()
Definition: Items.cpp:133
pPlayers
NZIArray< struct Player *, 5 > pPlayers
Definition: Player.cpp:46
GUIWindow::uFrameWidth
unsigned int uFrameWidth
Definition: GUIWindow.h:470
Localization::GetSkillName
const char * GetSkillName(unsigned int index) const
Definition: Localization.h:51
GUIButton
Definition: GUIButton.h:11
pIndoor
IndoorLocation * pIndoor
Definition: Indoor.cpp:49
GUIWindow::uFrameZ
unsigned int uFrameZ
Definition: GUIWindow.h:472
_2devent::flt_24
float flt_24
Definition: Events2D.h:54
current_screen_type
enum CURRENT_SCREEN current_screen_type
Definition: GUIWindow.cpp:83
Party::PartyTimes
PartyTimeStruct PartyTimes
Definition: Party.h:249
p2DEvents
_2devent p2DEvents[525]
Definition: Events.cpp:57
pMapStats
struct MapStats * pMapStats
Definition: mm7_data.cpp:20
GUIWindow::pStartingPosActiveItem
int pStartingPosActiveItem
Definition: GUIWindow.h:485
CharacterUI_InventoryTab_Draw
void CharacterUI_InventoryTab_Draw(Player *player, bool a2)
Definition: UICharacter.cpp:1829
pShopOptions
std::array< const char *, 4 > pShopOptions
Definition: mm7_data.cpp:776
CURRENT_SCREEN::SCREEN_E
@ SCREEN_E
current_character_screen_window
enum WindowType current_character_screen_window
Definition: GUIWindow.cpp:78
in_current_building_type
BuildingType in_current_building_type
Definition: UIHouses.cpp:49
BuildingType_WeaponShop
@ BuildingType_WeaponShop
Definition: Events2D.h:5
ItemGen::uAttributes
unsigned int uAttributes
Definition: Items.h:349
ShopDialogSellEquip
void ShopDialogSellEquip(GUIWindow dialogwin, BuildingType building)
Definition: UIShops.cpp:132
window_SpeakInHouse
GUIWindow * window_SpeakInHouse
Definition: GUIWindow.cpp:51
pParty
Party * pParty
Definition: Party.cpp:30
HOUSE_DIALOGUE_MAIN
@ HOUSE_DIALOGUE_MAIN
Definition: UIHouses.h:8
pFontArrus
GUIFont * pFontArrus
Definition: GUIFont.cpp:18
GUIWindow::pCurrentPosActiveItem
int pCurrentPosActiveItem
Definition: GUIWindow.h:482
HOUSE_DIALOGUE_GUILD_BUY_BOOKS
@ HOUSE_DIALOGUE_GUILD_BUY_BOOKS
Definition: UIHouses.h:25
HouseSoundID
HouseSoundID
Definition: UIHouses.h:112
WINDOW_CharacterWindow_Inventory
@ WINDOW_CharacterWindow_Inventory
Definition: GUIWindow.h:330
ShopDialogLearn
void ShopDialogLearn(GUIWindow dialogwin)
Definition: UIShops.cpp:233
viewparams
struct ViewingParams * viewparams
Definition: mm7_data.cpp:22
GUIWindow::DrawMessageBox
void DrawMessageBox(bool inside_game_viewport)
Definition: GUIWindow.cpp:319
ItemGen::uItemID
int uItemID
Definition: Items.h:326
pSpellDatas
std::array< SpellData, 100 > pSpellDatas
Definition: Spells.cpp:170
GUIWindow::uFrameHeight
unsigned int uFrameHeight
Definition: GUIWindow.h:471
BuildingType_Temple
@ BuildingType_Temple
Definition: Events2D.h:27
ShopDialogMain
void ShopDialogMain(GUIWindow dialogwin)
Definition: UIShops.cpp:37
Engine_::IocContainer::ResolveMouse
static Mouse * ResolveMouse()
Definition: IocContainer.cpp:88
IndoorLocation::dlv
struct DDM_DLV_Header dlv
Definition: Indoor.h:648
Party::TakeGold
static void TakeGold(int amount)
Definition: Party.cpp:292
GUIFont::CalcTextHeight
unsigned int CalcTextHeight(const String &str, unsigned int width, int x_offset, bool return_on_carriage=false)
Definition: GUIFont.cpp:246
BuildingType_MagicShop
@ BuildingType_MagicShop
Definition: Events2D.h:7
f
GLfloat f
Definition: SDL_opengl_glext.h:1873
DDM_DLV_Header::uReputation
int uReputation
Definition: Indoor.h:96
pMerchantsSellPhrases
std::array< const char *, 7 > pMerchantsSellPhrases
Definition: mm7_data.cpp:749
shop_ui_items_in_store
std::array< Image *, 12 > shop_ui_items_in_store
Definition: UIShops.cpp:35
sub_4B1523_showSpellbookInfo
void sub_4B1523_showSpellbookInfo(int spellItemId)
Definition: UIShops.cpp:1577
LEVEL_Outdoor
@ LEVEL_Outdoor
Definition: Indoor.h:287
DDM_DLV_Header
Definition: Indoor.h:82
SpellInfo::pExpertSkillDesc
char * pExpertSkillDesc
Definition: Spells.h:180
PlayHouseSound
void PlayHouseSound(unsigned int uHouseID, HouseSoundID sound)
Definition: UIHouses.cpp:1036
pCurrentMapName
String pCurrentMapName
Definition: mm7_data.cpp:712
Party::StandartItemsInShops
std::array< std::array< ItemGen, 12 >, 53 > StandartItemsInShops
Definition: Party.h:314
ItemGen::IsIdentified
bool IsIdentified()
Definition: Items.h:306
GUIWindow::uFrameY
unsigned int uFrameY
Definition: GUIWindow.h:469
pSpellStats
struct SpellStats * pSpellStats
Definition: Spells.cpp:32
pFontComic
GUIFont * pFontComic
Definition: GUIFont.cpp:24
Party::GetPartyReputation
int GetPartyReputation()
Definition: Party.cpp:922
OutdoorLocation::ddm
struct DDM_DLV_Header ddm
Definition: Outdoor.h:131
HouseUI_CheckIfPlayerCanInteract
bool HouseUI_CheckIfPlayerCanInteract()
Definition: UIHouses.cpp:797
GUIButton::uW
unsigned int uW
Definition: GUIButton.h:26
BuildDialogueString
String BuildDialogueString(const char *lpsz, unsigned __int8 uPlayerID, ItemGen *a3, char *a4, int a5, GameTime *a6)
Definition: GUIWindow.cpp:2189
HOUSE_DIALOGUE_SHOP_SELL
@ HOUSE_DIALOGUE_SHOP_SELL
Definition: UIHouses.h:10
OS_IfCtrlPressed
bool OS_IfCtrlPressed()
Definition: Lin.cpp:23
SPEECH_75
@ SPEECH_75
Definition: Player.h:121
Point::y
unsigned int y
Definition: Point.h:8
draw_leather
void draw_leather()
Definition: UICharacter.cpp:925
dword_F8B1E4
int dword_F8B1E4
Definition: mm7_data.cpp:779
GUIButton::msg_param
unsigned int msg_param
Definition: GUIButton.h:30
ArmorShopWares
void ArmorShopWares(GUIWindow dialogwin, bool special)
Definition: UIShops.cpp:483
GameUI_DrawItemInfo
void GameUI_DrawItemInfo(struct ItemGen *inspect_item)
Definition: UIPopup.cpp:168
BuildingType_AlchemistShop
@ BuildingType_AlchemistShop
Definition: Events2D.h:8
v2
GLfloat GLfloat GLfloat v2
Definition: SDL_opengl_glext.h:695
GUIWindow::mouse
Mouse * mouse
Definition: GUIWindow.h:491
ITEM_IDENTIFIED
@ ITEM_IDENTIFIED
Definition: Items.h:26
uint
unsigned int uint
Definition: MM7.h:4
ITEM_BROKEN
@ ITEM_BROKEN
Definition: Items.h:27
uActiveCharacter
unsigned int uActiveCharacter
Definition: mm7_data.cpp:555
v3
GLfloat GLfloat GLfloat GLfloat v3
Definition: SDL_opengl_glext.h:696
Localization::FormatString
String FormatString(unsigned int index,...) const
Definition: Localization.cpp:17
GUIButton::uY
unsigned int uY
Definition: GUIButton.h:22
_449B7E_toggle_bit
void _449B7E_toggle_bit(unsigned char *pArray, __int16 a2, unsigned __int16 bToggle)
Definition: Party.cpp:1190
__debugbreak
void __cdecl __debugbreak(void)
GUIButton::uHeight
unsigned int uHeight
Definition: GUIButton.h:24
MapInfo::_steal_perm
int _steal_perm
Definition: MapInfo.h:47
_2devent::fPriceMultiplier
float fPriceMultiplier
Definition: Events2D.h:53
GUIWindow::par1C
unsigned int par1C
Definition: GUIWindow.h:477
GameUI_StatusBar_OnEvent
void GameUI_StatusBar_OnEvent(const String &str, unsigned int num_seconds)
Definition: UIStatusBar.cpp:33
SPEECH_79
@ SPEECH_79
Definition: Player.h:125
GUIWindow::ptr_1C
void * ptr_1C
Definition: GUIWindow.h:476
ViewingParams::bRedrawGameUI
int bRedrawGameUI
Definition: Viewport.h:74
PartyTimeStruct::_shop_ban_times
std::array< GameTime, 53 > _shop_ban_times
Definition: Party.h:144
SPEECH_74
@ SPEECH_74
Definition: Player.h:120
GameTime::FromDays
static GameTime FromDays(int days)
Definition: Time.h:92
GUIWindow::DrawShops_next_generation_time_string
void DrawShops_next_generation_time_string(GameTime time)
Definition: GUIWindow.cpp:648
uCurrentlyLoadedLevelType
LEVEL_TYPE uCurrentlyLoadedLevelType
Definition: Indoor.cpp:52
pMerchantsBuyPhrases
std::array< const char *, 7 > pMerchantsBuyPhrases
Definition: mm7_data.cpp:748
HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT
@ HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT
Definition: UIHouses.h:31
GUIWindow::GetControl
GUIButton * GetControl(unsigned int uID)
Definition: GUIWindow.cpp:311
pMerchantsRepairPhrases
std::array< const char *, 7 > pMerchantsRepairPhrases
Definition: mm7_data.cpp:750
GUIWindow::uFrameX
unsigned int uFrameX
Definition: GUIWindow.h:468
HOUSE_DIALOGUE_SHOP_BUY_STANDARD
@ HOUSE_DIALOGUE_SHOP_BUY_STANDARD
Definition: UIHouses.h:9
pAudioPlayer
AudioPlayer * pAudioPlayer
Definition: AudioPlayer.cpp:20
Localization::GetClassName
const char * GetClassName(unsigned int index) const
Definition: Localization.h:35
SpellInfo::pDescription
char * pDescription
Definition: Spells.h:178
Point
Definition: Point.h:3
ItemGen
Definition: Items.h:263
ItemGen::GetValue
unsigned int GetValue()
Definition: Items.cpp:588
sub_4B1447_party_fine
void sub_4B1447_party_fine(int shopId, int stealingResult, int fineToAdd)
Definition: UIShops.cpp:1709
PlayerSpeech
PlayerSpeech
Definition: Player.h:46
HOUSE_DIALOGUE_SHOP_REPAIR
@ HOUSE_DIALOGUE_SHOP_REPAIR
Definition: UIHouses.h:12
pDialogueWindow
GUIWindow * pDialogueWindow
Definition: GUIWindow.cpp:50
Color16
uint16_t Color16(uint32_t r, uint32_t g, uint32_t b)
Definition: Engine.cpp:148
pOutdoor
OutdoorLocation * pOutdoor
Definition: Outdoor.cpp:48
ShopDialogDisplayEquip
void ShopDialogDisplayEquip(GUIWindow dialogwin, BuildingType building=BuildingType_WeaponShop)
Definition: UIShops.cpp:81
WeaponShopWares
void WeaponShopWares(GUIWindow dialogwin, bool special)
Definition: UIShops.cpp:327
ShopDialogRepair
void ShopDialogRepair(GUIWindow dialogwin, BuildingType building)
Definition: UIShops.cpp:201
SPEECH_73
@ SPEECH_73
Definition: Player.h:119
_A750D8_player_speech_timer
int64_t _A750D8_player_speech_timer
Definition: mm7_data.cpp:763
SpellInfo::pBasicSkillDesc
char * pBasicSkillDesc
Definition: Spells.h:179
Party::SpellBooksInGuilds
std::array< std::array< ItemGen, 12 >, 32 > SpellBooksInGuilds
Definition: Party.h:316
StringPrintf
String StringPrintf(const char *fmt,...)
Definition: Strings.cpp:9
Party::SpecialItemsInShops
std::array< std::array< ItemGen, 12 >, 53 > SpecialItemsInShops
Definition: Party.h:315
HOUSE_DIALOGUE_SHOP_IDENTIFY
@ HOUSE_DIALOGUE_SHOP_IDENTIFY
Definition: UIHouses.h:11
String
std::string String
Definition: Strings.h:10
HouseSound_Goodbye
@ HouseSound_Goodbye
Definition: UIHouses.h:116
byte_4ED970_skill_learn_ability_by_class_table
std::array< std::array< char, 37 >, 36 > byte_4ED970_skill_learn_ability_by_class_table
Definition: mm7_data.cpp:425
GameTime
Definition: Time.h:14
Party::GetGold
int GetGold() const
Definition: Party.cpp:264
pFontSmallnum
GUIFont * pFontSmallnum
Definition: GUIFont.cpp:25
SpellInfo::pGrandmasterSkillDesc
char * pGrandmasterSkillDesc
Definition: Spells.h:182
SPEECH_NoRoom
@ SPEECH_NoRoom
Definition: Player.h:61
SpellInfo::pMasterSkillDesc
char * pMasterSkillDesc
Definition: Spells.h:181
ItemGen::MerchandiseTest
bool MerchandiseTest(int _2da_idx)
Definition: Items.cpp:1626
render
std::shared_ptr< IRender > render
Definition: RenderOpenGL.cpp:52