World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
Items.cpp
См. документацию.
1 #include "Engine/Objects/Items.h"
2 
3 #include <map>
4 #include <string>
5 #include <vector>
6 
7 #include "Engine/Engine.h"
8 #include "Engine/Localization.h"
9 #include "Engine/LOD.h"
10 #include "Engine/MapInfo.h"
11 #include "Engine/OurMath.h"
12 #include "Engine/Party.h"
13 
14 #include "GUI/GUIButton.h"
15 #include "GUI/GUIWindow.h"
16 
17 #include "GUI/UI/UIHouses.h"
18 
21 
22 #include "Engine/Objects/Chest.h"
24 
25 std::array<std::array<char, 14>, 7> byte_4E8168 = {{ // byte_4E8178 -treasure levles
26  {{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}},
27  {{1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}},
28  {{1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3}},
29  {{2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4}},
30  {{2, 2, 2, 2, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5}},
31  {{2, 2, 2, 2, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6}},
32  {{2, 2, 2, 2, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}}
33 }};
34 
36 
37 struct ItemsTable* pItemsTable; // 005D29E0
38 
39 extern std::vector<char*> Tokenize(char* input, const char separator);
40 
41 //----- (00439DF3) --------------------------------------------------------
43  bool* draintargetHP) {
44  *draintargetHP = false;
45  *damage_type = DMGT_FIRE;
46  if (uItemID == ITEM_NULL) return 0;
47 
50  *damage_type = DMGT_ELECTR;
51  return rand() % 10 + 6;
52  }
54  *damage_type = DMGT_FIRE;
55  return rand() % 16 + 3;
56  }
58  *damage_type = DMGT_COLD;
59  return rand() % 4 + 9;
60  }
62  *damage_type = DMGT_BODY;
63  return 8;
64  }
65 
66  switch (special_enchantment) {
68  *damage_type = DMGT_COLD;
69  return rand() % 2 + 3;
70  break;
72  *damage_type = DMGT_COLD;
73  return rand() % 3 + 6;
74  break;
76  *damage_type = DMGT_COLD;
77  return rand() % 4 + 9;
78  break;
80  *damage_type = DMGT_ELECTR;
81  return rand() % 4 + 2;
82  break;
84  *damage_type = DMGT_ELECTR;
85  return rand() % 7 + 4;
86  break;
88  *damage_type = DMGT_ELECTR;
89  return rand() % 10 + 6;
90  break;
92  *damage_type = DMGT_FIRE;
93  return GetDiceResult(1, 6);
94  break;
96  *damage_type = DMGT_FIRE;
97  return GetDiceResult(2, 6);
98  break;
100  *damage_type = DMGT_FIRE;
101  return GetDiceResult(3, 6);
102  break;
104  *damage_type = DMGT_BODY;
105  return 5;
106  break;
108  *damage_type = DMGT_BODY;
109  return 8;
110  break;
112  *damage_type = DMGT_BODY;
113  return 12;
114  break;
117  *damage_type = DMGT_DARK;
118  *draintargetHP = true;
119  return 0;
120  break;
121 
123  *damage_type = DMGT_FIRE;
124  return rand() % 11 + 10;
125  break;
126  default:
127  *damage_type = DMGT_FIRE;
128  return 0;
129  }
130 }
131 
132 //----- (00402F07) --------------------------------------------------------
134  this->uHolderPlayer = 0;
135  this->uAttributes = 0;
136  this->uNumCharges = 0;
138  this->m_enchantmentStrength = 0;
139  this->uEnchantmentType = 0;
140  this->uItemID = ITEM_NULL;
141  this->uBodyAnchor = 0;
142  this->expirte_time.Reset();
143 }
144 
145 //----- (00458260) --------------------------------------------------------
147  if (this->uAttributes & ITEM_TEMP_BONUS) {
148  if (time > this->expirte_time) {
149  this->uEnchantmentType = 0;
151  this->uAttributes &= ~ITEM_TEMP_BONUS;
152  }
153  }
154 }
155 
156 //----- (0045814E) --------------------------------------------------------
158  free(pMonstersTXT_Raw);
160  free(pSpcItemsTXT_Raw);
161  free(pStdItemsTXT_Raw);
162  free(pRndItemsTXT_Raw);
163  free(pItemsTXT_Raw);
164  free(pHostileTXT_Raw);
165  free(pHistoryTXT_Raw);
166  free(pPotionsTXT_Raw);
167  free(pPotionNotesTXT_Raw);
168  pMonstersTXT_Raw = nullptr;
169  pMonsterPlacementTXT_Raw = nullptr;
170  pSpcItemsTXT_Raw = nullptr;
171  pStdItemsTXT_Raw = nullptr;
172  pRndItemsTXT_Raw = nullptr;
173  pItemsTXT_Raw = nullptr;
174  pHostileTXT_Raw = nullptr;
175  pHistoryTXT_Raw = nullptr;
176  pPotionsTXT_Raw = nullptr;
177  pPotionNotesTXT_Raw = nullptr;
178 }
179 
180 //----- (00456D84) --------------------------------------------------------
182  std::map<std::string, ITEM_EQUIP_TYPE, ci_less> equipStatMap;
183  equipStatMap["weapon"] = EQUIP_SINGLE_HANDED;
184  equipStatMap["weapon2"] = EQUIP_TWO_HANDED;
185  equipStatMap["weapon1or2"] = EQUIP_SINGLE_HANDED;
186  equipStatMap["missile"] = EQUIP_BOW;
187  equipStatMap["bow"] = EQUIP_BOW;
188  equipStatMap["armor"] = EQUIP_ARMOUR;
189  equipStatMap["shield"] = EQUIP_SHIELD;
190  equipStatMap["helm"] = EQUIP_HELMET;
191  equipStatMap["belt"] = EQUIP_BELT;
192  equipStatMap["cloak"] = EQUIP_CLOAK;
193  equipStatMap["gauntlets"] = EQUIP_GAUNTLETS;
194  equipStatMap["boots"] = EQUIP_BOOTS;
195  equipStatMap["ring"] = EQUIP_RING;
196  equipStatMap["amulet"] = EQUIP_AMULET;
197  equipStatMap["weaponw"] = EQUIP_WAND;
198  equipStatMap["herb"] = EQUIP_REAGENT;
199  equipStatMap["reagent"] = EQUIP_REAGENT;
200  equipStatMap["bottle"] = EQUIP_POTION;
201  equipStatMap["sscroll"] = EQUIP_SPELL_SCROLL;
202  equipStatMap["book"] = EQUIP_BOOK;
203  equipStatMap["mscroll"] = EQUIP_MESSAGE_SCROLL;
204  equipStatMap["gold"] = EQUIP_GOLD;
205  equipStatMap["gem"] = EQUIP_GEM;
206 
207  std::map<std::string, PLAYER_SKILL_TYPE, ci_less> equipSkillMap;
208  equipSkillMap["staff"] = PLAYER_SKILL_STAFF;
209  equipSkillMap["sword"] = PLAYER_SKILL_SWORD;
210  equipSkillMap["dagger"] = PLAYER_SKILL_DAGGER;
211  equipSkillMap["axe"] = PLAYER_SKILL_AXE;
212  equipSkillMap["spear"] = PLAYER_SKILL_SPEAR;
213  equipSkillMap["bow"] = PLAYER_SKILL_BOW;
214  equipSkillMap["mace"] = PLAYER_SKILL_MACE;
215  equipSkillMap["blaster"] = PLAYER_SKILL_BLASTER;
216  equipSkillMap["shield"] = PLAYER_SKILL_SHIELD;
217  equipSkillMap["leather"] = PLAYER_SKILL_LEATHER;
218  equipSkillMap["chain"] = PLAYER_SKILL_CHAIN;
219  equipSkillMap["plate"] = PLAYER_SKILL_PLATE;
220  equipSkillMap["club"] = PLAYER_SKILL_CLUB;
221 
222  std::map<std::string, ITEM_MATERIAL, ci_less> materialMap;
223  materialMap["artifact"] = MATERIAL_ARTEFACT;
224  materialMap["relic"] = MATERIAL_RELIC;
225  materialMap["special"] = MATERIAL_SPECIAL;
226 
227  char* test_string;
228  int item_counter;
229 
230  pMapStats = new MapStats;
232 
236 
237  pSpellStats = new SpellStats;
239 
240  LoadPotions();
241  LoadPotionNotes();
242 
245 
248 
249  pStdItemsTXT_Raw = (char*)pEvents_LOD->LoadCompressedTexture("stditems.txt");
250  strtok(pStdItemsTXT_Raw, "\r");
251  strtok(NULL, "\r");
252  strtok(NULL, "\r");
253  strtok(NULL, "\r");
254  // Standard Bonuses by Group
255  for (int i = 0; i < 24; ++i) {
256  test_string = strtok(NULL, "\r") + 1;
257  auto tokens = Tokenize(test_string, '\t');
258  pEnchantments[i].pBonusStat = RemoveQuotes(tokens[0]);
259  pEnchantments[i].pOfName = RemoveQuotes(tokens[1]);
260  for (int j = 0; j < 9; j++) {
261  pEnchantments[i].to_item[j] = atoi(tokens[j + 2]);
262  }
263  }
264 
265  memset(&pEnchantmentsSumm, 0, 36);
266  for (int i = 0; i < 9; ++i) {
267  for (int j = 0; j < 24; ++j)
268  pEnchantmentsSumm[i] += pEnchantments[j].to_item[i];
269  }
270 
271  // Bonus range for Standard by Level
272  strtok(NULL, "\r");
273  strtok(NULL, "\r");
274  strtok(NULL, "\r");
275  strtok(NULL, "\r");
276  strtok(NULL, "\r");
277  for (int i = 0; i < 6; ++i) { // counted from 1
278  test_string = strtok(NULL, "\r") + 1;
279  auto tokens = Tokenize(test_string, '\t');
280  Assert(tokens.size() == 4, "Invalid number of tokens");
281  bonus_ranges[i].minR = atoi(tokens[2]);
282  bonus_ranges[i].maxR = atoi(tokens[3]);
283  }
284 
285  pSpcItemsTXT_Raw = (char*)pEvents_LOD->LoadCompressedTexture("spcitems.txt");
286  strtok(pSpcItemsTXT_Raw, "\r");
287  strtok(NULL, "\r");
288  strtok(NULL, "\r");
289  strtok(NULL, "\r");
290  for (int i = 0; i < 72; ++i) {
291  test_string = strtok(NULL, "\r") + 1;
292  auto tokens = Tokenize(test_string, '\t');
293  Assert(tokens.size() >= 17, "Invalid number of tokens");
296  for (int j = 0; j < 12; j++) {
297  pSpecialEnchantments[i].to_item_apply[j] = atoi(tokens[j + 2]);
298  }
299  int res;
300  res = atoi(tokens[14]);
301  int mask = 0;
302  if (!res) {
303  ++tokens[14];
304  while (*tokens[14] == ' ') // fix X 2 case
305  ++tokens[14];
306  res = atoi(tokens[14]);
307  mask = 4; // bit encode for when we need to multuply value
308  }
310  pSpecialEnchantments[i].iTreasureLevel = (tolower(tokens[15][0]) - 97) | mask;
311  }
312 
314  memset(&pSpecialEnchantmentsSumm, 0, 96);
315  for (int i = 0; i < 12; ++i) {
316  for (unsigned int j = 0; j <= pSpecialEnchantments_count; ++j)
318  pSpecialEnchantments[j].to_item_apply[i];
319  }
320 
322 
323  pItemsTXT_Raw = (char*)pEvents_LOD->LoadCompressedTexture("items.txt");
324  strtok(pItemsTXT_Raw, "\r");
325  strtok(NULL, "\r");
326  uAllItemsCount = 0;
327  item_counter = 0;
328  while (item_counter < 800) {
329  test_string = strtok(NULL, "\r") + 1;
330 
331  extern std::vector<char*> Tokenize(char* input, const char separator);
332  auto tokens = Tokenize(test_string, '\t');
333 
334  item_counter = atoi(tokens[0]);
335  uAllItemsCount = item_counter;
336  pItems[item_counter].pIconName = RemoveQuotes(tokens[1]);
337  pItems[item_counter].pName = RemoveQuotes(tokens[2]);
338  pItems[item_counter].uValue = atoi(tokens[3]);
339  auto findResult = equipStatMap.find(tokens[4]);
340  pItems[item_counter].uEquipType =
341  findResult == equipStatMap.end() ? EQUIP_NONE : findResult->second;
342  auto findResult2 = equipSkillMap.find(tokens[5]);
343  pItems[item_counter].uSkillType = findResult2 == equipSkillMap.end()
345  : findResult2->second;
346  auto tokens2 = Tokenize(tokens[6], 'd');
347  if (tokens2.size() == 2) {
348  pItems[item_counter].uDamageDice = atoi(tokens2[0]);
349  pItems[item_counter].uDamageRoll = atoi(tokens2[1]);
350  } else if (tolower(tokens2[0][0]) != 's') {
351  pItems[item_counter].uDamageDice = atoi(tokens2[0]);
352  pItems[item_counter].uDamageRoll = 1;
353  } else {
354  pItems[item_counter].uDamageDice = 0;
355  pItems[item_counter].uDamageRoll = 0;
356  }
357  pItems[item_counter].uDamageMod = atoi(tokens[7]);
358  auto findResult3 = materialMap.find(tokens[8]);
359  pItems[item_counter].uMaterial = findResult3 == materialMap.end()
361  : findResult3->second;
362  pItems[item_counter].uItemID_Rep_St = atoi(tokens[9]);
363  pItems[item_counter].pUnidentifiedName = RemoveQuotes(tokens[10]);
364  pItems[item_counter].uSpriteID = atoi(tokens[11]);
365 
366  pItems[item_counter]._additional_value = 0;
367  pItems[item_counter]._bonus_type = 0;
368  if (pItems[item_counter].uMaterial == MATERIAL_SPECIAL) {
369  for (int ii = 0; ii < 24; ++ii) {
370  if (!_stricmp(tokens[12], pEnchantments[ii].pOfName)) {
371  pItems[item_counter]._bonus_type = ii + 1;
372  break;
373  }
374  }
375  if (!pItems[item_counter]._bonus_type) {
376  for (int ii = 0; ii < 72; ++ii) {
377  if (!_stricmp(tokens[12],
378  pSpecialEnchantments[ii].pNameAdd)) {
379  pItems[item_counter]._additional_value = ii + 1;
380  }
381  }
382  }
383  }
384 
385  if ((pItems[item_counter].uMaterial == MATERIAL_SPECIAL) &&
386  (pItems[item_counter]._bonus_type)) {
387  char b_s = atoi(tokens[13]);
388  if (b_s)
389  pItems[item_counter]._bonus_strength = b_s;
390  else
391  pItems[item_counter]._bonus_strength = 1;
392  } else {
393  pItems[item_counter]._bonus_strength = 0;
394  }
395  pItems[item_counter].uEquipX = atoi(tokens[14]);
396  pItems[item_counter].uEquipY = atoi(tokens[15]);
397  pItems[item_counter].pDescription = RemoveQuotes(tokens[16]);
398  item_counter++;
399  }
400 
401  uAllItemsCount = item_counter;
402  pRndItemsTXT_Raw = (char*)pEvents_LOD->LoadCompressedTexture("rnditems.txt");
403  strtok(pRndItemsTXT_Raw, "\r");
404  strtok(NULL, "\r");
405  strtok(NULL, "\r");
406  strtok(NULL, "\r");
407  for (item_counter = 0; item_counter < 619; item_counter++) {
408  test_string = strtok(NULL, "\r") + 1;
409  auto tokens = Tokenize(test_string, '\t');
410  Assert(tokens.size() > 7, "Invalid number of tokens");
411  item_counter = atoi(tokens[0]);
412  pItems[item_counter].uChanceByTreasureLvl1 = atoi(tokens[2]);
413  pItems[item_counter].uChanceByTreasureLvl2 = atoi(tokens[3]);
414  pItems[item_counter].uChanceByTreasureLvl3 = atoi(tokens[4]);
415  pItems[item_counter].uChanceByTreasureLvl4 = atoi(tokens[5]);
416  pItems[item_counter].uChanceByTreasureLvl5 = atoi(tokens[6]);
417  pItems[item_counter].uChanceByTreasureLvl6 = atoi(tokens[7]);
418  }
419 
420  // ChanceByTreasureLvl Summ - to calculate chance
421  memset(&uChanceByTreasureLvlSumm, 0, 24);
422  for (int i = 0; i < 6; ++i) {
423  for (int j = 1; j < item_counter; ++j)
424  uChanceByTreasureLvlSumm[i] += pItems[j].uChanceByTreasureLvl[i];
425  }
426 
427  strtok(NULL, "\r");
428  strtok(NULL, "\r");
429  strtok(NULL, "\r");
430  strtok(NULL, "\r");
431  strtok(NULL, "\r");
432  for (int i = 0; i < 3; ++i) {
433  test_string = strtok(NULL, "\r") + 1;
434  auto tokens = Tokenize(test_string, '\t');
435  Assert(tokens.size() > 7, "Invalid number of tokens");
436  switch (i) {
437  case 0:
438  uBonusChanceStandart[0] = atoi(tokens[2]);
439  uBonusChanceStandart[1] = atoi(tokens[3]);
440  uBonusChanceStandart[2] = atoi(tokens[4]);
441  uBonusChanceStandart[3] = atoi(tokens[5]);
442  uBonusChanceStandart[4] = atoi(tokens[6]);
443  uBonusChanceStandart[5] = atoi(tokens[7]);
444  break;
445  case 1:
446  uBonusChanceSpecial[0] = atoi(tokens[2]);
447  uBonusChanceSpecial[1] = atoi(tokens[3]);
448  uBonusChanceSpecial[2] = atoi(tokens[4]);
449  uBonusChanceSpecial[3] = atoi(tokens[5]);
450  uBonusChanceSpecial[4] = atoi(tokens[6]);
451  uBonusChanceSpecial[5] = atoi(tokens[7]);
452  break;
453  case 2:
454  uBonusChanceWpSpecial[0] = atoi(tokens[2]);
455  uBonusChanceWpSpecial[1] = atoi(tokens[3]);
456  uBonusChanceWpSpecial[2] = atoi(tokens[4]);
457  uBonusChanceWpSpecial[3] = atoi(tokens[5]);
458  uBonusChanceWpSpecial[4] = atoi(tokens[6]);
459  uBonusChanceWpSpecial[5] = atoi(tokens[7]);
460  break;
461  }
462  }
463  free(pRndItemsTXT_Raw);
464  pRndItemsTXT_Raw = nullptr;
465 
469 }
470 
471 //----- (00456D17) --------------------------------------------------------
473  if (pItems[pItem->uItemID].uMaterial == MATERIAL_SPECIAL) {
474  pItem->uEnchantmentType = pItems[pItem->uItemID]._bonus_type;
475  pItem->special_enchantment =
476  (ITEM_ENCHANTMENT)pItems[pItem->uItemID]._additional_value;
477  pItem->m_enchantmentStrength = pItems[pItem->uItemID]._bonus_strength;
478  }
479 }
480 
481 //----- (00456D43) --------------------------------------------------------
483  return this->pItems[pItem->uItemID].uMaterial == MATERIAL_SPECIAL;
484 }
485 
486 //----- (00456D5E) --------------------------------------------------------
488  return pItems[pItem->uItemID].uMaterial == MATERIAL_SPECIAL ||
489  pItems[pItem->uItemID].uMaterial == MATERIAL_RELIC ||
490  pItems[pItem->uItemID].uMaterial == MATERIAL_ARTEFACT;
491 }
492 
493 //----- (00453B3C) --------------------------------------------------------
495  // char Text[90];
496  char* test_string;
497  unsigned int uRow;
498  unsigned int uColumn;
499  unsigned __int8 potion_value;
500 
501  free(pPotionNotesTXT_Raw);
502  auto tokens = Tokenize("", '\t');
503  char* pPotionsTXT_Raw = (char*)pEvents_LOD->LoadCompressedTexture("potion.txt");
504  test_string = strtok(pPotionsTXT_Raw, "\r") + 1;
505  while (test_string) {
506  tokens = Tokenize(test_string, '\t');
507  if (!strcmp(tokens[0], "222")) break;
508  test_string = strtok(NULL, "\r") + 1;
509  }
510  if (!test_string) {
511  logger->Warning(L"Error Pre-Parsing Potion Table");
512  return;
513  }
514 
515  for (uRow = 0; uRow < 50; ++uRow) {
516  if (tokens.size() < 50) {
517  logger->Warning(L"Error Parsing Potion Table at Row: %d Column: %d",
518  uRow, tokens.size());
519  return;
520  }
521  for (uColumn = 0; uColumn < 50; ++uColumn) {
522  char* currValue = tokens[uColumn + 7];
523  potion_value = atoi(currValue);
524  if (!potion_value && tolower(currValue[0]) == 'e') {
525  potion_value = atoi(currValue + 1);
526  }
527  this->potion_data[uRow][uColumn] = potion_value;
528  }
529 
530  test_string = strtok(NULL, "\r") + 1;
531  if (!test_string) {
532  logger->Warning(L"Error Parsing Potion Table at Row: %d Column: %d",
533  uRow, 0);
534  return;
535  }
536  tokens = Tokenize(test_string, '\t');
537  }
538 }
539 
540 //----- (00453CE5) --------------------------------------------------------
542  // char Text[90];
543  char* test_string;
544  unsigned int uRow;
545  unsigned int uColumn;
546  unsigned __int8 potion_note;
547 
548  free(pPotionNotesTXT_Raw);
549  auto tokens = Tokenize("", '\t');
550  char* pPotionNotesTXT_Raw = (char*)pEvents_LOD->LoadCompressedTexture("potnotes.txt");
551  test_string = strtok(pPotionNotesTXT_Raw, "\r") + 1;
552  while (test_string) {
553  tokens = Tokenize(test_string, '\t');
554  if (!strcmp(tokens[0], "222")) break;
555  test_string = strtok(NULL, "\r") + 1;
556  }
557  if (!test_string) {
558  logger->Warning(L"Error Pre-Parsing Potion Table");
559  return;
560  }
561 
562  for (uRow = 0; uRow < 50; ++uRow) {
563  if (tokens.size() < 50) {
564  logger->Warning(L"Error Parsing Potion Table at Row: %d Column: %d",
565  uRow, tokens.size());
566  return;
567  }
568  for (uColumn = 0; uColumn < 50; ++uColumn) {
569  char* currValue = tokens[uColumn + 7];
570  potion_note = atoi(currValue);
571  if (!potion_note && tolower(currValue[0]) == 'e') {
572  potion_note = atoi(currValue + 1);
573  }
574  this->potion_note[uRow][uColumn] = potion_note;
575  }
576 
577  test_string = strtok(NULL, "\r") + 1;
578  if (!test_string) {
579  logger->Warning(L"Error Parsing Potion Table at Row: %d Column: %d",
580  uRow, 0);
581  return;
582  }
583  tokens = Tokenize(test_string, '\t');
584  }
585 }
586 
587 //----- (00456442) --------------------------------------------------------
588 unsigned int ItemGen::GetValue() {
589  unsigned int uBaseValue; // edi@1
590  unsigned int mod, bonus;
591 
592  uBaseValue = pItemsTable->pItems[this->uItemID].uValue;
593  if (this->uAttributes & ITEM_TEMP_BONUS ||
594  pItemsTable->IsMaterialNonCommon(this))
595  return uBaseValue;
596  if (uEnchantmentType) return uBaseValue + 100 * m_enchantmentStrength;
597 
598  if (special_enchantment) {
601  if (!mod)
602  return uBaseValue + bonus;
603  else
604  return uBaseValue * bonus;
605  }
606  return uBaseValue;
607 }
608 
609 //----- (00456499) --------------------------------------------------------
611  if (IsIdentified()) {
612  return GetIdentifiedName();
613  } else {
614  return String(pItemsTable->pItems[uItemID].pUnidentifiedName);
615  }
616 }
617 
618 //----- (004564B3) --------------------------------------------------------
620  unsigned __int8 equip_type;
621 
622  equip_type = GetItemEquipType();
623  if ((equip_type == EQUIP_REAGENT) || (equip_type == EQUIP_POTION) ||
624  (equip_type == EQUIP_GOLD)) {
625  return String(pItemsTable->pItems[uItemID].pName);
626  }
627 
628  if (uItemID == ITEM_LICH_JAR_FULL) { // Lich Jar
629  if ((uHolderPlayer > 0) && (uHolderPlayer <= 4)) {
630  auto player_name = pPlayers[uHolderPlayer]->pName;
631  if (player_name[strlen(player_name) - 1] == 's')
632  return localization->FormatString(
633  655, pPlayers[uHolderPlayer]->pName); // "%s' Jar"
634  else
635  return localization->FormatString(
636  654, pPlayers[uHolderPlayer]->pName); // "%s's Jar"
637  }
638  }
639 
640  if (!pItemsTable->IsMaterialNonCommon(this)) {
641  if (uEnchantmentType) {
642  return String(pItemsTable->pItems[uItemID].pName) + " " +
644  } else if (!special_enchantment) {
645  return String(pItemsTable->pItems[uItemID].pName);
646  } else {
647  if (special_enchantment == 16 // Drain Hit Points from target.
648  || special_enchantment == 39 // Double damage vs Demons.
649  || special_enchantment == 40 // Double damage vs Dragons
650  || special_enchantment == 45 // +5 Speed and Accuracy
651  || special_enchantment == 56 // +5 Might and Endurance.
652  || special_enchantment == 57 // +5 Intellect and Personality.
653  || special_enchantment == 58 // Increased Value.
654  || special_enchantment == 60 // +3 Unarmed and Dodging skills
655  || special_enchantment == 61 // +3 Stealing and Disarm skills.
656  || special_enchantment == 59 // Increased Weapon speed.
657  || special_enchantment == 63 // Double Damage vs. Elves.
658  || special_enchantment == 64 // Double Damage vs. Undead.
659  || special_enchantment == 67 // Adds 5 points of Body damage and +2 Disarm skill.
660  || special_enchantment == 68 // Adds 6-8 points of Cold damage and +5 Armor Class.
661  ) { // enchantment and name positions inverted!
662  return StringPrintf(
663  "%s %s",
665  .pNameAdd,
666  pItemsTable->pItems[uItemID].pName);
667  } else {
668  return String(pItemsTable->pItems[uItemID].pName) + " " +
671  .pNameAdd;
672  }
673  }
674  }
675 
676  return String(pItemsTable->pItems[uItemID].pName);
677 }
678 
679 //----- (00456620) --------------------------------------------------------
680 void ItemsTable::GenerateItem(int treasure_level, unsigned int uTreasureType,
681  ItemGen* out_item) {
682  int treasureLevelMinus1; // ebx@3
683  int current_chance; // ebx@43
684  int tmp_chance; // ecx@47
685  int v17; // ebx@57
686  int v18; // edx@62
687  unsigned int special_chance; // edx@86
688  unsigned int v26; // edx@89
689  unsigned int v27; // eax@89
690  int v32; // ecx@91
691  int v33; // eax@91
692  // unsigned int v34; // eax@97
693  int v45; // eax@120
694  int v46; // edx@120
695  int j; // eax@121
696  int val_list[800]; // [sp+Ch] [bp-C88h]@33
697  int total_chance; // [sp+C8Ch] [bp-8h]@33
698  signed int v56; // [sp+CA0h] [bp+Ch]@55
699  int v57; // [sp+CA0h] [bp+Ch]@62
700 
701  if (!out_item) out_item = (ItemGen*)malloc(sizeof(ItemGen));
702  memset(out_item, 0, sizeof(*out_item));
703 
704  treasureLevelMinus1 = treasure_level - 1;
705  if (uTreasureType) { // generate known treasure type
706  ITEM_EQUIP_TYPE requested_equip;
707  PLAYER_SKILL_TYPE requested_skill = PLAYER_SKILL_INVALID;
708  switch (uTreasureType) {
709  case 20:
710  requested_equip = EQUIP_SINGLE_HANDED;
711  break;
712  case 21:
713  requested_equip = EQUIP_ARMOUR;
714  break;
715  case 22:
716  requested_skill = PLAYER_SKILL_MISC;
717  break;
718  case 23:
719  requested_skill = PLAYER_SKILL_SWORD;
720  break;
721  case 24:
722  requested_skill = PLAYER_SKILL_DAGGER;
723  break;
724  case 25:
725  requested_skill = PLAYER_SKILL_AXE;
726  break;
727  case 26:
728  requested_skill = PLAYER_SKILL_SPEAR;
729  break;
730  case 27:
731  requested_skill = PLAYER_SKILL_BOW;
732  break;
733  case 28:
734  requested_skill = PLAYER_SKILL_MACE;
735  break;
736  case 29:
737  requested_skill = PLAYER_SKILL_CLUB;
738  break;
739  case 30:
740  requested_skill = PLAYER_SKILL_STAFF;
741  break;
742  case 31:
743  requested_skill = PLAYER_SKILL_LEATHER;
744  break;
745  case 32:
746  requested_skill = PLAYER_SKILL_CHAIN;
747  break;
748  case 33:
749  requested_skill = PLAYER_SKILL_PLATE;
750  break;
751  case 34:
752  requested_equip = EQUIP_SHIELD;
753  break;
754  case 35:
755  requested_equip = EQUIP_HELMET;
756  break;
757  case 36:
758  requested_equip = EQUIP_BELT;
759  break;
760  case 37:
761  requested_equip = EQUIP_CLOAK;
762  break;
763  case 38:
764  requested_equip = EQUIP_GAUNTLETS;
765  break;
766  case 39:
767  requested_equip = EQUIP_BOOTS;
768  break;
769  case 40:
770  requested_equip = EQUIP_RING;
771  break;
772  case 41:
773  requested_equip = EQUIP_AMULET;
774  break;
775  case 42:
776  requested_equip = EQUIP_WAND;
777  break;
778  case 43:
779  requested_equip = EQUIP_SPELL_SCROLL;
780  break;
781  case 44:
782  requested_equip = EQUIP_POTION;
783  break;
784  case 45:
785  requested_equip = EQUIP_REAGENT;
786  break;
787  case 46:
788  requested_equip = EQUIP_GEM;
789  break;
790  default:
791  __debugbreak(); // check this condition
792  requested_equip = (ITEM_EQUIP_TYPE)(uTreasureType - 1);
793  break;
794  }
795  memset(val_list, 0, sizeof(val_list));
796  total_chance = 0;
797  j = 0;
798  // a2a = 1;
799  if (requested_skill ==
800  PLAYER_SKILL_INVALID) { // no skill for this item needed
801  for (uint i = 1; i < 500; ++i) {
802  if (pItems[i].uEquipType == requested_equip) {
803  val_list[j] = i;
804  ++j;
805  total_chance +=
806  pItems[i].uChanceByTreasureLvl[treasure_level - 1];
807  }
808  }
809  } else { // have needed skill
810  for (uint i = 1; i < 500; ++i) {
811  if (pItems[i].uSkillType == requested_skill) {
812  val_list[j] = i;
813  ++j;
814  total_chance +=
815  pItems[i].uChanceByTreasureLvl[treasure_level - 1];
816  }
817  }
818  }
819 
820  current_chance = 0;
821  if (total_chance) {
822  current_chance = rand() % total_chance + 1;
823  tmp_chance = 0;
824  j = 0;
825  while (tmp_chance < current_chance) {
826  out_item->uItemID = val_list[j];
827  tmp_chance += pItems[val_list[j]]
828  .uChanceByTreasureLvl[treasure_level - 1];
829  ++j;
830  }
831  } else {
832  out_item->uItemID = ITEM_LONGSWORD_1;
833  }
834  } else {
835  // artifact
836  if (treasureLevelMinus1 == 5) {
837  v56 = 0;
838  for (int i = 0; i < 29; ++i) v56 += pParty->pIsArtifactFound[i];
839  v17 = rand() % 29;
840  if ((rand() % 100 < 5) && !pParty->pIsArtifactFound[v17] &&
841  v56 < 13) {
842  pParty->pIsArtifactFound[v17] = 1;
843  out_item->uAttributes = 0;
844  out_item->uItemID = v17 + ITEM_ARTIFACT_PUCK;
845  SetSpecialBonus(out_item);
846  return;
847  }
848  }
849 
850  v57 = 0;
851  v18 = rand() % this->uChanceByTreasureLvlSumm[treasure_level - 1] + 1;
852  while (v57 < v18) {
853  ++out_item->uItemID;
854  v57 += pItems[out_item->uItemID]
855  .uChanceByTreasureLvl[treasureLevelMinus1];
856  }
857  }
858  if (out_item->GetItemEquipType() == EQUIP_POTION &&
859  out_item->uItemID !=
860  ITEM_POTION_BOTTLE) { // if it potion set potion spec
861  out_item->uEnchantmentType = 0;
862  for (int i = 0; i < 2; ++i)
863  out_item->uEnchantmentType += rand() % 4 + 1;
864  out_item->uEnchantmentType =
865  out_item->uEnchantmentType * treasure_level;
866  }
867 
869  !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 239))
871  if (pItemsTable->pItems[out_item->uItemID].uItemID_Rep_St)
872  out_item->uAttributes = 0;
873  else
874  out_item->uAttributes = 1;
875 
876  if (out_item->GetItemEquipType() != EQUIP_POTION) {
878  out_item->uEnchantmentType = 0;
879  }
880  // try get special enhansment
881  switch (out_item->GetItemEquipType()) {
882  case EQUIP_SINGLE_HANDED:
883  case EQUIP_TWO_HANDED:
884  case EQUIP_BOW:
885  if (!uBonusChanceWpSpecial[treasureLevelMinus1]) return;
886  if ((uint)(rand() % 100) >=
887  uBonusChanceWpSpecial[treasureLevelMinus1])
888  return;
889  break;
890  case EQUIP_ARMOUR:
891  case EQUIP_SHIELD:
892  case EQUIP_HELMET:
893  case EQUIP_BELT:
894  case EQUIP_CLOAK:
895  case EQUIP_GAUNTLETS:
896  case EQUIP_BOOTS:
897  case EQUIP_RING:
898 
899  if (!uBonusChanceStandart[treasureLevelMinus1]) return;
900  special_chance = rand() % 100;
901  if (special_chance < uBonusChanceStandart[treasureLevelMinus1]) {
902  v26 = rand() %
903  pEnchantmentsSumm[out_item->GetItemEquipType() - 3] +
904  1;
905  v27 = 0;
906  while (v27 < v26) {
907  ++out_item->uEnchantmentType;
908  v27 += pEnchantments[out_item->uEnchantmentType]
909  .to_item[out_item->GetItemEquipType() - 3];
910  }
911 
912  v33 = rand() % (bonus_ranges[treasureLevelMinus1].maxR -
913  bonus_ranges[treasureLevelMinus1].minR + 1);
914  out_item->m_enchantmentStrength =
915  v33 + bonus_ranges[treasureLevelMinus1].minR;
916  v32 = out_item->uEnchantmentType - 1;
917  if (v32 == 21 || v32 == 22 ||
918  v32 == 23) // Armsmaster skill, Dodge skill, Unarmed skill
919  out_item->m_enchantmentStrength =
920  out_item->m_enchantmentStrength / 2;
921  if (out_item->m_enchantmentStrength <= 0)
922  out_item->m_enchantmentStrength = 1;
923  return;
924 
925  } else if (special_chance >=
926  uBonusChanceStandart[treasureLevelMinus1] +
927  uBonusChanceSpecial[treasureLevelMinus1]) {
928  return;
929  }
930  break;
931  case EQUIP_WAND:
932  out_item->uNumCharges = rand() % 6 + out_item->GetDamageMod() + 1;
933  out_item->uMaxCharges = out_item->uNumCharges;
934  return;
935  default:
936  return;
937  }
938 
939  j = 0;
940  int spc_sum = 0;
941  int spc;
942  memset(&val_list, 0, 3200);
943  for (unsigned int i = 0; i < pSpecialEnchantments_count; ++i) {
944  int tr_lv = (pSpecialEnchantments[i].iTreasureLevel) & 3;
945 
946  // tr_lv 0 = treasure level 3/4
947  // tr_lv 1 = treasure level 3/4/5
948  // tr_lv 2 = treasure level 4/5
949  // tr_lv 3 = treasure level 5/6
950 
951  if ((treasure_level - 1 == 2) && (tr_lv == 1 || tr_lv == 0) ||
952  (treasure_level - 1 == 3) &&
953  (tr_lv == 2 || tr_lv == 1 || tr_lv == 0) ||
954  (treasure_level - 1 == 4) &&
955  (tr_lv == 3 || tr_lv == 2 || tr_lv == 1) ||
956  (treasure_level - 1 == 5) && (tr_lv == 3)) {
957  spc = pSpecialEnchantments[i]
958  .to_item_apply[out_item->GetItemEquipType()];
959  spc_sum += spc;
960  if (spc) {
961  val_list[j++] = i;
962  }
963  }
964  }
965 
966  v46 = rand() % spc_sum + 1; //случайные значения от 1 до spc_sum
967  j = 0;
968  v45 = 0;
969  while (v45 < v46) {
970  ++j;
971  out_item->special_enchantment = (ITEM_ENCHANTMENT)val_list[j];
972  v45 += pSpecialEnchantments[val_list[j]]
973  .to_item_apply[out_item->GetItemEquipType()];
974  }
975 }
976 
977 //----- (004505CC) --------------------------------------------------------
979  signed int uNumArtifactsNotFound; // esi@1
980  int artifacts_list[32];
981 
982  memset(artifacts_list, 0, sizeof(artifacts_list));
983  uNumArtifactsNotFound = 0;
984 
985  for (int i = 500; i < 529; ++i)
986  if (!pParty->pIsArtifactFound[i - 500])
987  artifacts_list[uNumArtifactsNotFound++] = i;
988 
989  Reset();
990  if (uNumArtifactsNotFound) {
991  uItemID = artifacts_list[rand() % uNumArtifactsNotFound];
993  return true;
994  } else {
995  return false;
996  }
997 }
998 
999 std::map<int, std::map<CHARACTER_ATTRIBUTE_TYPE, CEnchantment*>*>
1001 std::map<int, std::map<CHARACTER_ATTRIBUTE_TYPE, CEnchantment*>*>
1003 std::map<int, std::map<CHARACTER_ATTRIBUTE_TYPE, CEnchantment*>*>
1005 
1006 #define NEWBONUSINTOSPECIALLIST(x, y) \
1007  AddToMap(ItemGen::specialBonusMap, enchId, x, y);
1008 #define NEWBONUSINTOSPECIALLIST2(x, y, z) \
1009  AddToMap(ItemGen::specialBonusMap, enchId, x, y, z);
1010 
1011 #define NEWBONUSINTOREGULARLIST(x) \
1012  AddToMap(ItemGen::regularBonusMap, enchId, x);
1013 
1014 #define NEWBONUSINTOARTIFACTLIST(x, y) \
1015  AddToMap(ItemGen::artifactBonusMap, itemId, x, y);
1016 #define NEWBONUSINTOARTIFACTLIST2(x, y, z) \
1017  AddToMap(ItemGen::artifactBonusMap, itemId, x, y, z);
1018 
1020  std::map<int, std::map<CHARACTER_ATTRIBUTE_TYPE, CEnchantment*>*>& maptoadd,
1021  int enchId, CHARACTER_ATTRIBUTE_TYPE attrId, int bonusValue /*= 0*/,
1022  unsigned __int16 Player::*skillPtr /*= NULL*/) {
1023  auto key = maptoadd.find(enchId);
1024  std::map<CHARACTER_ATTRIBUTE_TYPE, CEnchantment*>* currMap;
1025  if (key == maptoadd.end()) {
1026  currMap = new std::map<CHARACTER_ATTRIBUTE_TYPE, CEnchantment*>;
1027  maptoadd[enchId] = currMap;
1028  } else {
1029  currMap = key->second;
1030  }
1031  Assert(currMap->find(attrId) == currMap->end(),
1032  "Attribute %d already present for enchantment %d", attrId, enchId);
1033  (*currMap)[attrId] = new CEnchantment(bonusValue, skillPtr);
1034 }
1035 
1037  int enchId = 1; // of Protection, +10 to all Resistances
1038  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_RESIST_FIRE, 10);
1039  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_RESIST_AIR, 10);
1040  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_RESIST_WATER, 10);
1041  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_RESIST_EARTH, 10);
1042  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_RESIST_MIND, 10);
1043  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_RESIST_BODY, 10);
1044 
1045  enchId = 2; // of The Gods, +10 to all Seven Statistics
1046  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_STRENGTH, 10);
1047  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_INTELLIGENCE, 10);
1048  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_WILLPOWER, 10);
1049  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_ENDURANCE, 10);
1050  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_ACCURACY, 10);
1051  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_SPEED, 10);
1052  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_LUCK, 10);
1053 
1054  enchId = 26; // of Air Magic
1055  NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_AIR, 0,
1056  &Player::skillAir);
1057 
1058  enchId = 27; // of Body Magic
1059  NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_BODY, 0,
1061 
1062  enchId = 28; // of Dark Magic
1063  NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_DARK, 0,
1065 
1066  enchId = 29; // of Earth Magic
1067  NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_EARTH, 0,
1069 
1070  enchId = 30; // of Fire Magic
1071  NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_FIRE, 0,
1073 
1074  enchId = 31; // of Light Magic
1075  NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_LIGHT, 0,
1077 
1078  enchId = 32; // of Mind Magic
1079  NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_MIND, 0,
1081 
1082  enchId = 33; // of Spirit Magic
1083  NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_SPIRIT, 0,
1085 
1086  enchId = 34; // of Water Magic
1087  NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_WATER, 0,
1089 
1090  enchId = 42; // of Doom
1091  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_STRENGTH, 1);
1092  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_INTELLIGENCE, 1);
1093  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_WILLPOWER, 1);
1094  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_ENDURANCE, 1);
1095  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_ACCURACY, 1);
1096  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_SPEED, 1);
1097  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_LUCK, 1);
1098  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_HEALTH, 1);
1099  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_MANA, 1);
1100  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_AC_BONUS, 1);
1101  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_RESIST_FIRE, 1);
1102  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_RESIST_AIR, 1);
1103  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_RESIST_WATER, 1);
1104  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_RESIST_EARTH, 1);
1105  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_RESIST_MIND, 1);
1106  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_RESIST_BODY, 1);
1107 
1108  enchId = 43; // of Earth
1109  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_ENDURANCE, 10);
1110  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_AC_BONUS, 10);
1111  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_HEALTH, 10);
1112 
1113  enchId = 44; // of Life
1114  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_HEALTH, 10);
1115 
1116  enchId = 45; // Rogues
1117  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_SPEED, 5);
1118  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_ACCURACY, 5);
1119 
1120  enchId = 46; // of The Dragon
1121  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_STRENGTH, 25);
1122 
1123  enchId = 47; // of The Eclipse
1124  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_MANA, 10);
1125 
1126  enchId = 48; // of The Golem
1127  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_ENDURANCE, 15);
1128  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_AC_BONUS, 5);
1129 
1130  enchId = 49; // of The Moon
1131  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_INTELLIGENCE, 10);
1132  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_LUCK, 10);
1133 
1134  enchId = 50; // of The Phoenix
1135  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_RESIST_FIRE, 30);
1136 
1137  enchId = 51; // of The Sky
1138  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_MANA, 10);
1139  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_SPEED, 10);
1140  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_INTELLIGENCE, 10);
1141 
1142  enchId = 52; // of The Stars
1143  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_ENDURANCE, 10);
1144  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_ACCURACY, 10);
1145 
1146  enchId = 53; // of The Sun
1147  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_STRENGTH, 10);
1148  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_WILLPOWER, 10);
1149 
1150  enchId = 54; // of The Troll
1151  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_ENDURANCE, 15);
1152 
1153  enchId = 55; // of The Unicorn
1154  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_LUCK, 15);
1155 
1156  enchId = 56; // Warriors
1157  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_STRENGTH, 5);
1158  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_ENDURANCE, 5);
1159 
1160  enchId = 57; // Wizards
1161  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_INTELLIGENCE, 5);
1162  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_WILLPOWER, 5);
1163 
1164  enchId = 60; // Monks'
1165  NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_DODGE, 3,
1167  NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_UNARMED, 3,
1169 
1170  enchId = 61; // Thieves'
1171  NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM, 3,
1173  NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_STEALING, 3,
1175 
1176  enchId = 62; // of Identifying
1177  NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_ITEM_ID, 3,
1179  NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID, 3,
1181 
1182  enchId = 67; // Assassins'
1183  NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM, 2,
1185 
1186  enchId = 68; // Barbarians'
1187  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_AC_BONUS, 5);
1188 
1189  enchId = 69; // of the Storm
1190  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_RESIST_AIR, 20);
1191 
1192  enchId = 70; // of the Ocean
1193  NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_RESIST_WATER, 10);
1194  NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_ALCHEMY, 2,
1196 }
1197 
1199  int enchId = 1; // of Might
1200  NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_STRENGTH);
1201 
1202  enchId = 2; // of Thought
1203  NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_INTELLIGENCE);
1204 
1205  enchId = 3; // of Charm
1206  NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_WILLPOWER);
1207 
1208  enchId = 4; // of Vigor
1209  NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_ENDURANCE);
1210 
1211  enchId = 5; // of Precision
1212  NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_ACCURACY);
1213 
1214  enchId = 6; // of Speed
1215  NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_SPEED);
1216 
1217  enchId = 7; // of Luck
1218  NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_LUCK);
1219 
1220  enchId = 8; // of Health
1221  NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_HEALTH);
1222 
1223  enchId = 9; // of Magic
1224  NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_MANA);
1225 
1226  enchId = 10; // of Defense
1227  NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_AC_BONUS);
1228 
1229  enchId = 11; // of Fire Resistance
1230  NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_RESIST_FIRE);
1231 
1232  enchId = 12; // of Air Resistance
1233  NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_RESIST_AIR);
1234 
1235  enchId = 13; // of Water Resistance
1236  NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_RESIST_WATER);
1237 
1238  enchId = 14; // of Earth Resistance
1239  NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_RESIST_EARTH);
1240 
1241  enchId = 15; // of Mind Resistance
1242  NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_RESIST_MIND);
1243 
1244  enchId = 16; // of Body Resistance
1245  NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_RESIST_BODY);
1246 
1247  enchId = 17; // of Alchemy
1248  NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_SKILL_ALCHEMY);
1249 
1250  enchId = 18; // of Stealing
1251  NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_SKILL_STEALING);
1252 
1253  enchId = 19; // of Disarming
1254  NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM);
1255 
1256  enchId = 20; // of Items
1257  NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_SKILL_ITEM_ID);
1258 
1259  enchId = 21; // of Monsters
1260  NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID);
1261 
1262  enchId = 22; // of Arms
1263  NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER);
1264 
1265  enchId = 23; // of Dodging
1266  NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_SKILL_DODGE);
1267 
1268  enchId = 24; // of the Fist
1269  NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_SKILL_UNARMED);
1270 }
1271 
1273  int itemId;
1274  itemId = ITEM_ARTIFACT_PUCK;
1275  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_STRENGTH, 40);
1276 
1277  itemId = ITEM_ARTIFACT_IRON_FEATHER;
1278  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_STRENGTH, 40);
1279 
1280  itemId = ITEM_ARTIFACT_WALLACE;
1281  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_WILLPOWER, 40);
1282  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER, 10);
1283 
1284  itemId = ITEM_ARTIFACT_CORSAIR;
1285  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_LUCK, 40);
1286  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM, 5);
1287  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_STEALING, 5);
1288 
1290  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_STRENGTH, 10);
1291  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_INTELLIGENCE, 10);
1292  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_WILLPOWER, 10);
1293  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_ENDURANCE, 10);
1294  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_ACCURACY, 10);
1295  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SPEED, 10);
1296  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_LUCK, 10);
1297 
1298  itemId = ITEM_ARTIFACT_YORUBA;
1299  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_ENDURANCE, 25);
1300 
1301  itemId = ITEM_ARTIFACT_SPLITTER;
1302  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_FIRE, 50);
1303 
1304  itemId = ITEM_ARTEFACT_ULLYSES,
1305  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_ACCURACY, 50);
1306 
1308  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_DODGE, 10);
1309  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_UNARMED, 10);
1310 
1311  itemId = ITEM_ARTIFACT_LEAGUE_BOOTS;
1312  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SPEED, 40);
1313  NEWBONUSINTOARTIFACTLIST2(CHARACTER_ATTRIBUTE_SKILL_WATER, 0,
1315 
1316  itemId = ITEM_ARTIFACT_RULERS_RING;
1317  NEWBONUSINTOARTIFACTLIST2(CHARACTER_ATTRIBUTE_SKILL_MIND, 0,
1319  NEWBONUSINTOARTIFACTLIST2(CHARACTER_ATTRIBUTE_SKILL_DARK, 0,
1321 
1322  itemId = ITEM_RELIC_MASH;
1323  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_STRENGTH, 150);
1324  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_INTELLIGENCE, -40);
1325  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_WILLPOWER, -40);
1326  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SPEED, -40);
1327 
1328  itemId = ITEM_RELIC_ETHRICS_STAFF;
1329  NEWBONUSINTOARTIFACTLIST2(CHARACTER_ATTRIBUTE_SKILL_DARK, 0,
1331  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_MEDITATION, 15);
1332 
1333  itemId = ITEM_RELIC_HARECS_LEATHER;
1334  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM, 5);
1335  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_STEALING, 5);
1336  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_LUCK, 50);
1337  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_FIRE, -10);
1338  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_WATER, -10);
1339  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_AIR, -10);
1340  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_EARTH, -10);
1341  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_MIND, -10);
1342  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_BODY, -10);
1343 
1344  itemId = ITEM_RELIC_OLD_NICK;
1345  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM, 5);
1346 
1347  itemId = ITEM_RELIC_AMUCK;
1348  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_STRENGTH, 100);
1349  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_ENDURANCE, 100);
1350  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_AC_BONUS, -15);
1351 
1352  itemId = ITEM_RELIC_GLORY_SHIELD;
1353  NEWBONUSINTOARTIFACTLIST2(CHARACTER_ATTRIBUTE_SKILL_SPIRIT, 0,
1355  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_SHIELD, 5);
1356  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_MIND, -10);
1357  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_BODY, -10);
1358 
1359  itemId = ITEM_RELIC_KELEBRIM;
1360  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_ENDURANCE, 50);
1361  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_EARTH, -30);
1362 
1363  itemId = ITEM_RELIC_TALEDONS_HELM;
1364  NEWBONUSINTOARTIFACTLIST2(CHARACTER_ATTRIBUTE_SKILL_LIGHT, 0,
1366  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_WILLPOWER, 15);
1367  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_STRENGTH, 15);
1368  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_LUCK, -40);
1369 
1370  itemId = ITEM_RELIC_SCHOLARS_CAP;
1371  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_LEARNING, +15);
1372  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_ENDURANCE, -50);
1373 
1374  itemId = ITEM_RELIC_PHYNAXIAN_CROWN;
1375  NEWBONUSINTOARTIFACTLIST2(CHARACTER_ATTRIBUTE_SKILL_FIRE, 0,
1377  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_WATER, +50);
1378  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_WILLPOWER, 30);
1379  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_AC_BONUS, -20);
1380 
1381  itemId = ITEM_RILIC_TITANS_BELT;
1382  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_STRENGTH, 75);
1383  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SPEED, -40);
1384 
1385  itemId = ITEM_RELIC_TWILIGHT;
1386  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SPEED, 50);
1387  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_LUCK, 50);
1388  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_FIRE, -15);
1389  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_WATER, -15);
1390  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_AIR, -15);
1391  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_EARTH, -15);
1392  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_MIND, -15);
1393  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_BODY, -15);
1394 
1395  itemId = ITEM_RELIC_ANIA_SELVING;
1396  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_ACCURACY, 150);
1397  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_BOW, 5);
1398  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_AC_BONUS, -25);
1399 
1400  itemId = ITEM_RELIC_JUSTICE;
1401  NEWBONUSINTOARTIFACTLIST2(CHARACTER_ATTRIBUTE_SKILL_MIND, 0,
1403  NEWBONUSINTOARTIFACTLIST2(CHARACTER_ATTRIBUTE_SKILL_BODY, 0,
1405  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SPEED, -40);
1406 
1407  itemId = ITEM_RELIC_MEKORIGS_HAMMER;
1408  NEWBONUSINTOARTIFACTLIST2(CHARACTER_ATTRIBUTE_SKILL_SPIRIT, 0,
1410  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_STRENGTH, 75);
1411  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_AIR, -50);
1412 
1414  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SPEED, 100);
1415  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_ACCURACY, 50);
1416  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_AIR, 50);
1417 
1419  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_WILLPOWER, -20);
1420  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_INTELLIGENCE, -20);
1421 
1422  itemId = ITEM_ARTIFACT_MINDS_EYE;
1423  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_WILLPOWER, 15);
1424  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_INTELLIGENCE, 15);
1425 
1426  itemId = ITEM_ELVEN_CHAINMAIL;
1427  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SPEED, 15);
1428  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_ACCURACY, 15);
1429 
1430  itemId = ITEM_FORGE_GAUNTLETS;
1431  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_STRENGTH, 15);
1432  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_ENDURANCE, 15);
1433  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_FIRE, 30);
1434 
1435  itemId = ITEM_ARTIFACT_HEROS_BELT;
1436  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_STRENGTH, 15);
1437  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER, 5);
1438 
1439  itemId = ITEM_ARTIFACT_LADYS_ESCORT;
1440  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_FIRE, 10);
1441  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_AIR, 10);
1442  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_WATER, 10);
1443  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_EARTH, 10);
1444  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_MIND, 10);
1445  NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_BODY, 10);
1446 }
1447 
1449  CHARACTER_ATTRIBUTE_TYPE attrToGet,
1450  int* additiveBonus,
1451  int* halfSkillBonus) {
1452  auto bonusList = ItemGen::specialBonusMap.find(this->special_enchantment);
1453  if (bonusList == ItemGen::specialBonusMap.end()) {
1454  return;
1455  }
1456  std::map<CHARACTER_ATTRIBUTE_TYPE, CEnchantment*>* currList =
1457  bonusList->second;
1458  if (currList->find(attrToGet) != currList->end()) {
1459  CEnchantment* currBonus = (*currList)[attrToGet];
1460  if (currBonus->statPtr != NULL) {
1461  if (currBonus->statBonus == 0) {
1462  *halfSkillBonus = owner->*currBonus->statPtr / 2;
1463  } else {
1464  if (*additiveBonus < currBonus->statBonus) {
1465  *additiveBonus = currBonus->statBonus;
1466  }
1467  }
1468  } else {
1469  *additiveBonus += currBonus->statBonus;
1470  }
1471  }
1472 }
1473 
1475  CHARACTER_ATTRIBUTE_TYPE attrToGet,
1476  int* bonusSum) {
1477  auto bonusList = ItemGen::artifactBonusMap.find(this->uItemID);
1478  if (bonusList == ItemGen::artifactBonusMap.end()) {
1479  return;
1480  }
1481  std::map<CHARACTER_ATTRIBUTE_TYPE, CEnchantment*>* currList =
1482  bonusList->second;
1483  if (currList->find(attrToGet) != currList->end()) {
1484  CEnchantment* currBonus = (*currList)[attrToGet];
1485  if (currBonus->statPtr != NULL) {
1486  *bonusSum = owner->*currBonus->statPtr / 2;
1487  } else {
1488  *bonusSum += currBonus->statBonus;
1489  }
1490  }
1491 }
1492 
1494  CHARACTER_ATTRIBUTE_TYPE attrToGet) {
1495  auto bonusList = ItemGen::specialBonusMap.find(this->uEnchantmentType);
1496  if (bonusList == ItemGen::specialBonusMap.end()) {
1497  return false;
1498  }
1499  std::map<CHARACTER_ATTRIBUTE_TYPE, CEnchantment*>* currList =
1500  bonusList->second;
1501  return (currList->find(attrToGet) != currList->end());
1502 }
1503 
1505  // to avoid nzi - is this safe??
1506  if (this->uItemID == 0)
1507  return EQUIP_NONE;
1508  else
1509  return pItemsTable->pItems[this->uItemID].uEquipType;
1510 }
1511 
1513  unsigned char skl = pItemsTable->pItems[this->uItemID].uSkillType;
1514  if (skl == PLAYER_SKILL_CLUB) {
1515  // club skill not used but some items load it
1516  skl = PLAYER_SKILL_MACE;
1517  }
1518  return skl;
1519 }
1520 
1522  return pItemsTable->pItems[this->uItemID].pIconName;
1523 }
1524 
1525 unsigned __int8 ItemGen::GetDamageDice() {
1526  return pItemsTable->pItems[this->uItemID].uDamageDice;
1527 }
1528 
1529 unsigned __int8 ItemGen::GetDamageRoll() {
1530  return pItemsTable->pItems[this->uItemID].uDamageRoll;
1531 }
1532 
1533 unsigned __int8 ItemGen::GetDamageMod() {
1534  return pItemsTable->pItems[this->uItemID].uDamageMod;
1535 }
1536 
1537 //----- (0043C91D) --------------------------------------------------------
1538 int GetItemTextureFilename(char* pOut, signed int item_id, int index,
1539  int shoulder) {
1540  int result; // eax@2
1541  ITEM_EQUIP_TYPE pEquipType;
1542 
1543  result = 0; // BUG fn is void
1544  pEquipType = pItemsTable->pItems[item_id].uEquipType;
1545  if (item_id > 500) {
1546  switch (item_id) {
1548  if (byte_5111F6_OwnedArtifacts[2] != 0) item_id = 234;
1549  break;
1550  case ITEM_ARTIFACT_YORUBA:
1551  if (byte_5111F6_OwnedArtifacts[1] != 0) item_id = 236;
1552  break;
1554  if (byte_5111F6_OwnedArtifacts[0] != 0) item_id = 235;
1555  break;
1556  case ITEM_ELVEN_CHAINMAIL:
1557  if (byte_5111F6_OwnedArtifacts[16] != 0) item_id = 73;
1558  break;
1560  if (byte_5111F6_OwnedArtifacts[3] != 0) item_id = 312;
1561  break;
1563  if (byte_5111F6_OwnedArtifacts[4] != 0) item_id = 239;
1564  break;
1566  if (byte_5111F6_OwnedArtifacts[5] != 0) item_id = 240;
1567  break;
1569  if (byte_5111F6_OwnedArtifacts[6] != 0) item_id = 241;
1570  break;
1572  if (byte_5111F6_OwnedArtifacts[7] != 0) item_id = 93;
1573  break;
1575  if (byte_5111F6_OwnedArtifacts[8] != 0) item_id = 344;
1576  break;
1578  if (byte_5111F6_OwnedArtifacts[9] != 0) item_id = 324;
1579  break;
1581  if (byte_5111F6_OwnedArtifacts[10] != 0) item_id = 104;
1582  break;
1583  case ITEM_RELIC_TWILIGHT:
1584  if (byte_5111F6_OwnedArtifacts[11] != 0) item_id = 325;
1585  break;
1587  if (byte_5111F6_OwnedArtifacts[12] != 0) item_id = 330;
1588  break;
1589  case ITEM_RARE_SUN_CLOAK:
1590  if (byte_5111F6_OwnedArtifacts[13] != 0) item_id = 347;
1591  break;
1592  case ITEM_RARE_MOON_CLOAK:
1593  if (byte_5111F6_OwnedArtifacts[14] != 0) item_id = 348;
1594  break;
1596  if (byte_5111F6_OwnedArtifacts[15] != 0) item_id = 350;
1597  break;
1598  default:
1599  return 0;
1600  }
1601  }
1602 
1603  switch (pEquipType) {
1604  case EQUIP_ARMOUR:
1605  if (!shoulder)
1606  return sprintf(pOut, "item%3.3dv%d", item_id, index);
1607  else if (shoulder == 1)
1608  return sprintf(pOut, "item%3.3dv%da1", item_id, index);
1609  else if (shoulder == 2)
1610  return sprintf(pOut, "item%3.3dv%da2", item_id, index);
1611  break;
1612  case EQUIP_CLOAK:
1613  if (!shoulder)
1614  return sprintf(pOut, "item%3.3dv%d", item_id, index);
1615  else
1616  return sprintf(pOut, "item%3.3dv%da1", item_id, index);
1617  default:
1618  return sprintf(pOut, "item%3.3dv%d", item_id, index);
1619  }
1620 
1621  result = item_id - 504;
1622  return result;
1623 }
1624 
1625 //----- (004BDAAF) --------------------------------------------------------
1626 bool ItemGen::MerchandiseTest(int _2da_idx) {
1627  bool test;
1628 
1629  if ((p2DEvents[_2da_idx - 1].uType != 4 ||
1630  (signed int)this->uItemID < 740 || (signed int)this->uItemID > 771) &&
1631  ((signed int)this->uItemID >= 600 ||
1632  (signed int)this->uItemID >= 529 &&
1633  (signed int)this->uItemID <= 599) ||
1634  this->IsStolen())
1635  return false;
1636  switch (p2DEvents[_2da_idx - 1].uType) {
1637  case BuildingType_WeaponShop: {
1638  test = this->GetItemEquipType() <= EQUIP_BOW;
1639  break;
1640  }
1641  case BuildingType_ArmorShop: {
1642  test = this->GetItemEquipType() >= EQUIP_ARMOUR &&
1643  this->GetItemEquipType() <= EQUIP_BOOTS;
1644  break;
1645  }
1646  case BuildingType_MagicShop: {
1647  test = this->GetPlayerSkillType() == PLAYER_SKILL_MISC ||
1648  this->GetItemEquipType() == EQIUP_ANY;
1649  break;
1650  }
1652  test = this->GetItemEquipType() == EQUIP_REAGENT ||
1653  this->GetItemEquipType() == EQUIP_POTION ||
1654  (this->GetItemEquipType() > EQUIP_POTION &&
1655  !(this->GetItemEquipType() != EQUIP_MESSAGE_SCROLL ||
1656  (signed int)this->uItemID < 740) &&
1657  this->uItemID != 771);
1658  break;
1659  }
1660  default: {
1661  test = false;
1662  break;
1663  }
1664  }
1665  return test;
1666 }
ITEM_ARTIFACT_CORSAIR
@ ITEM_ARTIFACT_CORSAIR
Definition: Items.h:156
CHARACTER_ATTRIBUTE_LUCK
@ CHARACTER_ATTRIBUTE_LUCK
Definition: Engine.h:527
EQUIP_HELMET
@ EQUIP_HELMET
Definition: Items.h:232
CHARACTER_ATTRIBUTE_SKILL_EARTH
@ CHARACTER_ATTRIBUTE_SKILL_EARTH
Definition: Engine.h:562
ItemsTable::IsMaterialNonCommon
bool IsMaterialNonCommon(ItemGen *pItem)
Definition: Items.cpp:487
ItemGen::uHolderPlayer
char uHolderPlayer
Definition: Items.h:352
ItemsTable::bonus_ranges
BonusRange bonus_ranges[6]
Definition: Items.h:479
ITEM_ARTIFACT_LEAGUE_BOOTS
@ ITEM_ARTIFACT_LEAGUE_BOOTS
Definition: Items.h:165
Player
Definition: Player.h:401
GetItemTextureFilename
int GetItemTextureFilename(char *pOut, signed int item_id, int index, int shoulder)
Definition: Items.cpp:1538
PLAYER_SKILL_BLASTER
@ PLAYER_SKILL_BLASTER
Definition: Player.h:178
PLAYER_SKILL_DAGGER
@ PLAYER_SKILL_DAGGER
Definition: Player.h:173
ITEM_RARE_SUN_CLOAK
@ ITEM_RARE_SUN_CLOAK
Definition: Items.h:200
CHARACTER_ATTRIBUTE_RESIST_FIRE
@ CHARACTER_ATTRIBUTE_RESIST_FIRE
Definition: Engine.h:532
ItemGen::GetDamageMod
unsigned __int8 GetDamageMod()
Definition: Items.cpp:1533
ITEM_ARTEFACT_ULLYSES
@ ITEM_ARTEFACT_ULLYSES
Definition: Items.h:163
CEnchantment
Definition: Items.h:253
DMGT_DARK
@ DMGT_DARK
Definition: Items.h:21
mask
GLenum GLint GLuint mask
Definition: SDL_opengl_glext.h:660
RemoveQuotes
char * RemoveQuotes(char *str)
Definition: Strings.h:17
Tokenize
std::vector< char * > Tokenize(char *input, const char separator)
Definition: Strings.cpp:30
LOD.h
Party::GetPlayingTime
GameTime & GetPlayingTime()
Definition: Party.h:230
pMonsterPlacementTXT_Raw
char * pMonsterPlacementTXT_Raw
Definition: mm7_data.cpp:678
PLAYER_SKILL_STAFF
@ PLAYER_SKILL_STAFF
Definition: Player.h:171
ITEM_ENCHANTMENT_OF_ICE
@ ITEM_ENCHANTMENT_OF_ICE
Definition: Items.h:43
ITEM_RELIC_HARECS_LEATHER
@ ITEM_RELIC_HARECS_LEATHER
Definition: Items.h:169
Party::pIsArtifactFound
std::array< char, 29 > pIsArtifactFound
Definition: Party.h:298
EQUIP_CLOAK
@ EQUIP_CLOAK
Definition: Items.h:234
Items.h
CHARACTER_ATTRIBUTE_MANA
@ CHARACTER_ATTRIBUTE_MANA
Definition: Engine.h:529
Monsters.h
EQUIP_BELT
@ EQUIP_BELT
Definition: Items.h:233
Player::skillItemId
unsigned __int16 skillItemId
Definition: Player.h:693
ItemsTable::pRndItemsTXT_Raw
char * pRndItemsTXT_Raw
Definition: Items.h:471
ItemsTable::uBonusChanceStandart
unsigned int uBonusChanceStandart[6]
Definition: Items.h:475
CHARACTER_ATTRIBUTE_SKILL_AIR
@ CHARACTER_ATTRIBUTE_SKILL_AIR
Definition: Engine.h:560
CEnchantment::statBonus
int statBonus
Definition: Items.h:258
end
GLuint GLuint end
Definition: SDL_opengl.h:1571
ITEM_RARE_VAMPIRES_CAPE
@ ITEM_RARE_VAMPIRES_CAPE
Definition: Items.h:203
pMonsterStats
struct MonsterStats * pMonsterStats
Definition: Monsters.cpp:8
Player::skillDodge
unsigned __int16 skillDodge
Definition: Player.h:702
ItemsTable::SetSpecialBonus
void SetSpecialBonus(ItemGen *pItem)
Definition: Items.cpp:472
ItemGen::GetItemEquipType
ITEM_EQUIP_TYPE GetItemEquipType()
Definition: Items.cpp:1504
MATERIAL_ARTEFACT
@ MATERIAL_ARTEFACT
Definition: Items.h:67
CHARACTER_ATTRIBUTE_SKILL_BOW
@ CHARACTER_ATTRIBUTE_SKILL_BOW
Definition: Engine.h:569
_449B57_test_bit
bool _449B57_test_bit(unsigned __int8 *a1, __int16 a2)
Definition: Party.cpp:1185
ITEM_ARTIFACT_YORUBA
@ ITEM_ARTIFACT_YORUBA
Definition: Items.h:158
Player::skillStealing
unsigned __int16 skillStealing
Definition: Player.h:706
LOD::File::LoadCompressedTexture
void * LoadCompressedTexture(const String &pContainer, size_t *data_size=nullptr)
Definition: LOD.cpp:921
DMGT_FIRE
@ DMGT_FIRE
Definition: Items.h:11
PLAYER_SKILL_AXE
@ PLAYER_SKILL_AXE
Definition: Player.h:174
EQUIP_BOOK
@ EQUIP_BOOK
Definition: Items.h:243
EQUIP_SHIELD
@ EQUIP_SHIELD
Definition: Items.h:231
CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER
@ CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER
Definition: Engine.h:544
CHARACTER_ATTRIBUTE_SKILL_BODY
@ CHARACTER_ATTRIBUTE_SKILL_BODY
Definition: Engine.h:565
BuildingType_ArmorShop
@ BuildingType_ArmorShop
Definition: Events2D.h:6
ITEM_ENCHANTMENT_OF_FLAME
@ ITEM_ENCHANTMENT_OF_FLAME
Definition: Items.h:48
EQUIP_REAGENT
@ EQUIP_REAGENT
Definition: Items.h:240
ITEM_RARE_MOON_CLOAK
@ ITEM_RARE_MOON_CLOAK
Definition: Items.h:201
FactionTable.h
PLAYER_SKILL_CLUB
@ PLAYER_SKILL_CLUB
Definition: Player.h:208
EQIUP_ANY
@ EQIUP_ANY
Definition: Items.h:244
Party::_quest_bits
unsigned __int8 _quest_bits[64]
Definition: Party.h:291
ITEM_RELIC_PHYNAXIAN_CROWN
@ ITEM_RELIC_PHYNAXIAN_CROWN
Definition: Items.h:176
localization
Localization * localization
Definition: Localization.cpp:11
GetDiceResult
int GetDiceResult(unsigned int uNumDice, unsigned int uDiceSides)
Definition: OurMath.cpp:194
ITEM_RELIC_JUSTICE
@ ITEM_RELIC_JUSTICE
Definition: Items.h:180
ItemsTable::LoadPotions
void LoadPotions()
Definition: Items.cpp:494
CHARACTER_ATTRIBUTE_AC_BONUS
@ CHARACTER_ATTRIBUTE_AC_BONUS
Definition: Engine.h:530
ITEM_ENCHANTMENT_OF_THUNDERBOLTS
@ ITEM_ENCHANTMENT_OF_THUNDERBOLTS
Definition: Items.h:46
ITEM_ENCHANTMENT_OF_POISON
@ ITEM_ENCHANTMENT_OF_POISON
Definition: Items.h:50
ItemGen::_439DF3_get_additional_damage
int _439DF3_get_additional_damage(DAMAGE_TYPE *a2, bool *vampiyr)
Definition: Items.cpp:42
PLAYER_SKILL_BOW
@ PLAYER_SKILL_BOW
Definition: Player.h:176
Player::skillLight
unsigned __int16 skillLight
Definition: Player.h:691
ptr_50C9A4_ItemToEnchant
ItemGen * ptr_50C9A4_ItemToEnchant
Definition: Items.cpp:35
EQUIP_MESSAGE_SCROLL
@ EQUIP_MESSAGE_SCROLL
Definition: Items.h:245
EQUIP_GOLD
@ EQUIP_GOLD
Definition: Items.h:246
CHARACTER_ATTRIBUTE_SKILL_LEARNING
@ CHARACTER_ATTRIBUTE_SKILL_LEARNING
Definition: Engine.h:571
CHARACTER_ATTRIBUTE_SKILL_SPIRIT
@ CHARACTER_ATTRIBUTE_SKILL_SPIRIT
Definition: Engine.h:563
ITEM_EQUIP_TYPE
ITEM_EQUIP_TYPE
Definition: Items.h:226
ITEM_FORGE_GAUNTLETS
@ ITEM_FORGE_GAUNTLETS
Definition: Items.h:187
ITEM_LONGSWORD_1
@ ITEM_LONGSWORD_1
Definition: Items.h:75
CHARACTER_ATTRIBUTE_SKILL_WATER
@ CHARACTER_ATTRIBUTE_SKILL_WATER
Definition: Engine.h:561
ItemsTable::potion_note
unsigned __int16 potion_note[50][50]
Definition: Items.h:469
pFactionTable
struct FactionTable * pFactionTable
Definition: mm7_data.cpp:672
ItemGen::AddToMap
static void AddToMap(std::map< int, std::map< CHARACTER_ATTRIBUTE_TYPE, CEnchantment * > * > &maptoadd, int enchId, CHARACTER_ATTRIBUTE_TYPE attrId, int bonusValue=0, uint16_t Player::*skillPtr=nullptr)
Definition: Items.cpp:1019
ItemGen::PopulateSpecialBonusMap
static void PopulateSpecialBonusMap()
Definition: Items.cpp:1036
input
GLenum GLenum GLenum input
Definition: SDL_opengl_glext.h:9377
ITEM_RELIC_AMUCK
@ ITEM_RELIC_AMUCK
Definition: Items.h:171
StorylineText
Definition: StorylineTextTable.h:18
ItemGen::Reset
void Reset()
Definition: Items.cpp:133
ItemGen::regularBonusMap
static std::map< int, std::map< CHARACTER_ATTRIBUTE_TYPE, CEnchantment * > * > regularBonusMap
Definition: Items.h:269
ITEM_ARTIFACT_MINDS_EYE
@ ITEM_ARTIFACT_MINDS_EYE
Definition: Items.h:185
byte_5111F6_OwnedArtifacts
std::array< char, 17 > byte_5111F6_OwnedArtifacts
Definition: mm7_data.cpp:592
pPotionNotesTXT_Raw
char * pPotionNotesTXT_Raw
Definition: mm7_data.cpp:683
index
GLuint index
Definition: SDL_opengl_glext.h:663
pPlayers
NZIArray< struct Player *, 5 > pPlayers
Definition: Player.cpp:46
Chest.h
Engine.h
CHARACTER_ATTRIBUTE_RESIST_WATER
@ CHARACTER_ATTRIBUTE_RESIST_WATER
Definition: Engine.h:534
ItemGen::uEnchantmentType
int uEnchantmentType
Definition: Items.h:327
CHARACTER_ATTRIBUTE_SKILL_SHIELD
@ CHARACTER_ATTRIBUTE_SKILL_SHIELD
Definition: Engine.h:570
Player::skillDisarmTrap
unsigned __int16 skillDisarmTrap
Definition: Player.h:701
CHARACTER_ATTRIBUTE_SKILL_FIRE
@ CHARACTER_ATTRIBUTE_SKILL_FIRE
Definition: Engine.h:559
ITEM_ARTIFACT_GHOULSBANE
@ ITEM_ARTIFACT_GHOULSBANE
Definition: Items.h:160
p2DEvents
_2devent p2DEvents[525]
Definition: Events.cpp:57
ITEM_RELIC_MASH
@ ITEM_RELIC_MASH
Definition: Items.h:167
Player::skillWater
unsigned __int16 skillWater
Definition: Player.h:686
result
GLuint64EXT * result
Definition: SDL_opengl_glext.h:9435
pMapStats
struct MapStats * pMapStats
Definition: mm7_data.cpp:20
EQUIP_SPELL_SCROLL
@ EQUIP_SPELL_SCROLL
Definition: Items.h:242
GameTime::Reset
void Reset()
Definition: Time.h:58
BonusRange::maxR
unsigned int maxR
Definition: Items.h:442
UIHouses.h
pItemsTable
struct ItemsTable * pItemsTable
Definition: Items.cpp:37
CHARACTER_ATTRIBUTE_HEALTH
@ CHARACTER_ATTRIBUTE_HEALTH
Definition: Engine.h:528
Player::skillAlchemy
unsigned __int16 skillAlchemy
Definition: Player.h:707
Localization.h
BuildingType_WeaponShop
@ BuildingType_WeaponShop
Definition: Events2D.h:5
ItemGen::uAttributes
unsigned int uAttributes
Definition: Items.h:349
ItemGen::special_enchantment
ITEM_ENCHANTMENT special_enchantment
Definition: Items.h:330
ITEM_ENCHANTMENT_OF_VENOM
@ ITEM_ENCHANTMENT_OF_VENOM
Definition: Items.h:51
ItemsTable::pStdItemsTXT_Raw
char * pStdItemsTXT_Raw
Definition: Items.h:472
Player::skillMonsterId
unsigned __int16 skillMonsterId
Definition: Player.h:704
ItemGen::uMaxCharges
char uMaxCharges
Definition: Items.h:351
ITEM_ENCHANTMENT_OF_ACID
@ ITEM_ENCHANTMENT_OF_ACID
Definition: Items.h:52
PLAYER_SKILL_MISC
@ PLAYER_SKILL_MISC
Definition: Player.h:209
MonsterStats::InitializePlacements
void InitializePlacements()
Definition: Monsters.cpp:451
GUIButton.h
DAMAGE_TYPE
DAMAGE_TYPE
Definition: Items.h:10
pParty
Party * pParty
Definition: Party.cpp:30
ItemEnchantment::pBonusStat
char * pBonusStat
Definition: Items.h:405
EQUIP_GEM
@ EQUIP_GEM
Definition: Items.h:247
CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID
@ CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID
Definition: Engine.h:543
EQUIP_ARMOUR
@ EQUIP_ARMOUR
Definition: Items.h:230
CHARACTER_ATTRIBUTE_SKILL_ITEM_ID
@ CHARACTER_ATTRIBUTE_SKILL_ITEM_ID
Definition: Engine.h:542
ItemGen::GetDisplayName
String GetDisplayName()
Definition: Items.cpp:610
ITEM_ARTIFACT_LADYS_ESCORT
@ ITEM_ARTIFACT_LADYS_ESCORT
Definition: Items.h:189
ITEM_ARTIFACT_HERMES_SANDALS
@ ITEM_ARTIFACT_HERMES_SANDALS
Definition: Items.h:182
ITEM_TEMP_BONUS
@ ITEM_TEMP_BONUS
Definition: Items.h:28
EQUIP_SINGLE_HANDED
@ EQUIP_SINGLE_HANDED
Definition: Items.h:227
StorylineText::Initialize
void Initialize()
Definition: StorylineTextTable.cpp:13
SpellStats::Initialize
void Initialize()
Definition: Spells.cpp:385
ITEM_SPELLBOOK_LIGHT_SUN_BURST
@ ITEM_SPELLBOOK_LIGHT_SUN_BURST
Definition: Items.h:151
ITEM_RELIC_TWILIGHT
@ ITEM_RELIC_TWILIGHT
Definition: Items.h:178
ItemsTable::GenerateItem
void GenerateItem(int treasure_level, unsigned int uTreasureType, ItemGen *pItem)
Definition: Items.cpp:680
PLAYER_SKILL_TYPE
PLAYER_SKILL_TYPE
Definition: Player.h:170
ITEM_ARTIFACT_IRON_FEATHER
@ ITEM_ARTIFACT_IRON_FEATHER
Definition: Items.h:154
CEnchantment
struct CEnchantment CEnchantment
MATERIAL_SPECIAL
@ MATERIAL_SPECIAL
Definition: Items.h:69
BonusRange::minR
unsigned int minR
Definition: Items.h:441
MapStats
Definition: MapInfo.h:75
ITEM_ARTIFACT_HEROS_BELT
@ ITEM_ARTIFACT_HEROS_BELT
Definition: Items.h:188
ItemGen::GetIconName
char * GetIconName()
Definition: Items.cpp:1521
MonsterStats
Definition: Monsters.h:186
CHARACTER_ATTRIBUTE_SKILL_MIND
@ CHARACTER_ATTRIBUTE_SKILL_MIND
Definition: Engine.h:564
ItemGen::uItemID
int uItemID
Definition: Items.h:326
byte_4E8168
std::array< std::array< char, 14 >, 7 > byte_4E8168
Definition: Items.cpp:25
CHARACTER_ATTRIBUTE_TYPE
CHARACTER_ATTRIBUTE_TYPE
Definition: Engine.h:520
DMGT_COLD
@ DMGT_COLD
Definition: Items.h:13
EQUIP_BOW
@ EQUIP_BOW
Definition: Items.h:229
ITEM_RILIC_TITANS_BELT
@ ITEM_RILIC_TITANS_BELT
Definition: Items.h:177
CHARACTER_ATTRIBUTE_RESIST_AIR
@ CHARACTER_ATTRIBUTE_RESIST_AIR
Definition: Engine.h:533
ItemGen::GetPlayerSkillType
unsigned char GetPlayerSkillType()
Definition: Items.cpp:1512
ITEM_RELIC_ANIA_SELVING
@ ITEM_RELIC_ANIA_SELVING
Definition: Items.h:179
CHARACTER_ATTRIBUTE_SKILL_STEALING
@ CHARACTER_ATTRIBUTE_SKILL_STEALING
Definition: Engine.h:540
CHARACTER_ATTRIBUTE_WILLPOWER
@ CHARACTER_ATTRIBUTE_WILLPOWER
Definition: Engine.h:523
ItemGen::PopulateRegularBonusMap
static void PopulateRegularBonusMap()
Definition: Items.cpp:1198
Log::Warning
void Warning(const wchar_t *pFormat,...)
Definition: Log.cpp:28
ItemGen::uBodyAnchor
unsigned __int8 uBodyAnchor
Definition: Items.h:350
ItemGen::expirte_time
GameTime expirte_time
Definition: Items.h:354
ItemGen::GetDamageDice
unsigned __int8 GetDamageDice()
Definition: Items.cpp:1525
ItemGen::GetDamageRoll
unsigned __int8 GetDamageRoll()
Definition: Items.cpp:1529
CHARACTER_ATTRIBUTE_SKILL_ALCHEMY
@ CHARACTER_ATTRIBUTE_SKILL_ALCHEMY
Definition: Engine.h:539
PLAYER_SKILL_LEATHER
@ PLAYER_SKILL_LEATHER
Definition: Player.h:180
BuildingType_MagicShop
@ BuildingType_MagicShop
Definition: Events2D.h:7
Party.h
PLAYER_SKILL_MACE
@ PLAYER_SKILL_MACE
Definition: Player.h:177
MATERIAL_COMMON
@ MATERIAL_COMMON
Definition: Items.h:66
CHARACTER_ATTRIBUTE_RESIST_MIND
@ CHARACTER_ATTRIBUTE_RESIST_MIND
Definition: Engine.h:536
EQUIP_POTION
@ EQUIP_POTION
Definition: Items.h:241
ItemGen::GetItemBonusSpecialEnchantment
void GetItemBonusSpecialEnchantment(Player *owner, CHARACTER_ATTRIBUTE_TYPE attrToGet, int *additiveBonus, int *halfSkillBonus)
Definition: Items.cpp:1448
ITEM_ENCHANTMENT_OF_FIRE
@ ITEM_ENCHANTMENT_OF_FIRE
Definition: Items.h:47
FactionTable
Definition: FactionTable.h:5
EQUIP_NONE
@ EQUIP_NONE
Definition: Items.h:248
pStorylineText
struct StorylineText * pStorylineText
Definition: StorylineTextTable.cpp:8
ItemsTable::Release
void Release()
Definition: Items.cpp:157
ITEM_ENCHANTMENT_OF_INFERNOS
@ ITEM_ENCHANTMENT_OF_INFERNOS
Definition: Items.h:49
ItemsTable::IsMaterialSpecial
bool IsMaterialSpecial(ItemGen *pItem)
Definition: Items.cpp:482
pHostileTXT_Raw
char * pHostileTXT_Raw
Definition: mm7_data.cpp:681
ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP
@ ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP
Definition: Items.h:183
ITEM_ENCHANTMENT_OF_DRAGON
@ ITEM_ENCHANTMENT_OF_DRAGON
Definition: Items.h:61
PLAYER_SKILL_SPEAR
@ PLAYER_SKILL_SPEAR
Definition: Player.h:175
ItemsTable::pSpecialEnchantments_count
unsigned int pSpecialEnchantments_count
Definition: Items.h:481
ITEM_ENCHANTMENT
ITEM_ENCHANTMENT
Definition: Items.h:38
ItemGen::IsIdentified
bool IsIdentified()
Definition: Items.h:306
ITEM_RELIC_KELEBRIM
@ ITEM_RELIC_KELEBRIM
Definition: Items.h:173
EQUIP_AMULET
@ EQUIP_AMULET
Definition: Items.h:238
ITEM_ENCHANTMENT_VAMPIRIC
@ ITEM_ENCHANTMENT_VAMPIRIC
Definition: Items.h:53
ITEM_RELIC_OLD_NICK
@ ITEM_RELIC_OLD_NICK
Definition: Items.h:170
ITEM_ENCHANTMENT_OF_LIGHTNING
@ ITEM_ENCHANTMENT_OF_LIGHTNING
Definition: Items.h:45
DMGT_ELECTR
@ DMGT_ELECTR
Definition: Items.h:12
DMGT_BODY
@ DMGT_BODY
Definition: Items.h:19
ItemGen::GetIdentifiedName
String GetIdentifiedName()
Definition: Items.cpp:619
PLAYER_SKILL_SHIELD
@ PLAYER_SKILL_SHIELD
Definition: Player.h:179
ItemsTable::uChanceByTreasureLvlSumm
unsigned int uChanceByTreasureLvlSumm[6]
Definition: Items.h:474
pEvents_LOD
LODFile_IconsBitmaps * pEvents_LOD
Definition: LOD.cpp:10
pSpellStats
struct SpellStats * pSpellStats
Definition: Spells.cpp:32
pHistoryTXT_Raw
char * pHistoryTXT_Raw
Definition: StorylineTextTable.cpp:7
ItemSpecialEnchantment::iTreasureLevel
int iTreasureLevel
Definition: Items.h:435
CHARACTER_ATTRIBUTE_ENDURANCE
@ CHARACTER_ATTRIBUTE_ENDURANCE
Definition: Engine.h:524
ItemsTable::pSpecialEnchantments
ItemSpecialEnchantment pSpecialEnchantments[72]
Definition: Items.h:462
Player::skillBody
unsigned __int16 skillBody
Definition: Player.h:690
ItemsTable::pSpcItemsTXT_Raw
char * pSpcItemsTXT_Raw
Definition: Items.h:473
EQUIP_TWO_HANDED
@ EQUIP_TWO_HANDED
Definition: Items.h:228
Player::skillMind
unsigned __int16 skillMind
Definition: Player.h:689
SpellStats
Definition: Spells.h:189
ItemGen::uNumCharges
int uNumCharges
Definition: Items.h:348
ItemSpecialEnchantment::pNameAdd
char * pNameAdd
Definition: Items.h:432
MapInfo.h
PLAYER_SKILL_CHAIN
@ PLAYER_SKILL_CHAIN
Definition: Player.h:181
MapStats::Initialize
void Initialize()
Definition: MapInfo.cpp:47
Player::skillDark
unsigned __int16 skillDark
Definition: Player.h:692
ItemGen::IsRegularEnchanmentForAttribute
bool IsRegularEnchanmentForAttribute(CHARACTER_ATTRIBUTE_TYPE attrToGet)
Definition: Items.cpp:1493
ITEM_ARTIFACT_WALLACE
@ ITEM_ARTIFACT_WALLACE
Definition: Items.h:155
ItemGen::specialBonusMap
static std::map< int, std::map< CHARACTER_ATTRIBUTE_TYPE, CEnchantment * > * > specialBonusMap
Definition: Items.h:270
ITEM_RELIC_MEKORIGS_HAMMER
@ ITEM_RELIC_MEKORIGS_HAMMER
Definition: Items.h:181
ItemsTable::Initialize
void Initialize()
Definition: Items.cpp:181
CHARACTER_ATTRIBUTE_ACCURACY
@ CHARACTER_ATTRIBUTE_ACCURACY
Definition: Engine.h:525
ItemsTable
Definition: Items.h:448
ITEM_ELVEN_CHAINMAIL
@ ITEM_ELVEN_CHAINMAIL
Definition: Items.h:186
ITEM_NULL
@ ITEM_NULL
Definition: Items.h:74
Player::skillEarth
unsigned __int16 skillEarth
Definition: Player.h:687
FactionTable::Initialize
void Initialize()
Definition: FactionTable.cpp:8
ItemGen::IsStolen
bool IsStolen()
Definition: Items.h:308
ItemsTable::pSpecialEnchantmentsSumm
unsigned int pSpecialEnchantmentsSumm[24]
Definition: Items.h:480
ITEM_RELIC_SCHOLARS_CAP
@ ITEM_RELIC_SCHOLARS_CAP
Definition: Items.h:175
PLAYER_SKILL_SWORD
@ PLAYER_SKILL_SWORD
Definition: Player.h:172
BuildingType_AlchemistShop
@ BuildingType_AlchemistShop
Definition: Events2D.h:8
ITEM_ENCHANTMENT_OF_DARKNESS
@ ITEM_ENCHANTMENT_OF_DARKNESS
Definition: Items.h:59
uint
unsigned int uint
Definition: MM7.h:4
ITEM_RARE_SHADOWS_MASK
@ ITEM_RARE_SHADOWS_MASK
Definition: Items.h:197
ITEM_ENCHANTMENT_OF_FROST
@ ITEM_ENCHANTMENT_OF_FROST
Definition: Items.h:42
ItemGen::GetItemBonusArtifact
void GetItemBonusArtifact(Player *owner, CHARACTER_ATTRIBUTE_TYPE attrToGet, int *bonusSum)
Definition: Items.cpp:1474
Localization::FormatString
String FormatString(unsigned int index,...) const
Definition: Localization.cpp:17
Player::skillUnarmed
unsigned __int16 skillUnarmed
Definition: Player.h:703
__debugbreak
void __cdecl __debugbreak(void)
EQUIP_WAND
@ EQUIP_WAND
Definition: Items.h:239
ITEM_POTION_BOTTLE
@ ITEM_POTION_BOTTLE
Definition: Items.h:120
MonsterStats::Initialize
void Initialize()
Definition: Monsters.cpp:491
PLAYER_SKILL_INVALID
@ PLAYER_SKILL_INVALID
Definition: Player.h:210
ItemsTable::pEnchantments
ItemEnchantment pEnchantments[24]
Definition: Items.h:461
EQUIP_GAUNTLETS
@ EQUIP_GAUNTLETS
Definition: Items.h:235
ItemGen::GenerateArtifact
bool GenerateArtifact()
Definition: Items.cpp:978
ItemEnchantment::to_item
unsigned char to_item[12]
Definition: Items.h:419
ITEM_ENCHANTMENT_OF_SPARKS
@ ITEM_ENCHANTMENT_OF_SPARKS
Definition: Items.h:44
ItemSpecialEnchantment::pBonusStatement
char * pBonusStatement
Definition: Items.h:431
EQUIP_RING
@ EQUIP_RING
Definition: Items.h:237
ItemEnchantment::pOfName
char * pOfName
Definition: Items.h:406
Player::skillAir
unsigned __int16 skillAir
Definition: Player.h:685
OurMath.h
ItemGen::PopulateArtifactBonusMap
static void PopulateArtifactBonusMap()
Definition: Items.cpp:1272
pMonstersTXT_Raw
char * pMonstersTXT_Raw
Definition: mm7_data.cpp:677
CEnchantment::statPtr
uint16_t Player::* statPtr
Definition: Items.h:257
CHARACTER_ATTRIBUTE_SKILL_LIGHT
@ CHARACTER_ATTRIBUTE_SKILL_LIGHT
Definition: Engine.h:566
ItemSpecialEnchantment::iValue
int iValue
Definition: Items.h:434
ItemGen::UpdateTempBonus
void UpdateTempBonus(GameTime time)
Definition: Items.cpp:146
InitializeBuildingResidents
void InitializeBuildingResidents()
Definition: UIHouses.cpp:3715
CHARACTER_ATTRIBUTE_SPEED
@ CHARACTER_ATTRIBUTE_SPEED
Definition: Engine.h:526
ITEM_ARTIFACT_SPLITTER
@ ITEM_ARTIFACT_SPLITTER
Definition: Items.h:159
ITEM_RELIC_GLORY_SHIELD
@ ITEM_RELIC_GLORY_SHIELD
Definition: Items.h:172
GUIWindow.h
ItemGen
Definition: Items.h:263
ItemGen::GetValue
unsigned int GetValue()
Definition: Items.cpp:588
ITEM_ARTEFACT_HANDS_OF_THE_MASTER
@ ITEM_ARTEFACT_HANDS_OF_THE_MASTER
Definition: Items.h:164
ITEM_LICH_JAR_FULL
@ ITEM_LICH_JAR_FULL
Definition: Items.h:206
ITEM_ENCHANTMENT_NULL
@ ITEM_ENCHANTMENT_NULL
Definition: Items.h:39
ITEM_RELIC_ETHRICS_STAFF
@ ITEM_RELIC_ETHRICS_STAFF
Definition: Items.h:168
logger
Log * logger
Definition: IocContainer.cpp:47
ITEM_ARTIFACT_RULERS_RING
@ ITEM_ARTIFACT_RULERS_RING
Definition: Items.h:166
res
GLuint res
Definition: SDL_opengl_glext.h:7940
ItemGen::m_enchantmentStrength
int m_enchantmentStrength
Definition: Items.h:328
ItemsTable::potion_data
unsigned __int16 potion_data[50][50]
Definition: Items.h:468
ITEM_RELIC_TALEDONS_HELM
@ ITEM_RELIC_TALEDONS_HELM
Definition: Items.h:174
CHARACTER_ATTRIBUTE_SKILL_DODGE
@ CHARACTER_ATTRIBUTE_SKILL_DODGE
Definition: Engine.h:545
ItemsTable::pEnchantmentsSumm
unsigned int pEnchantmentsSumm[9]
Definition: Items.h:478
Player::skillSpirit
unsigned __int16 skillSpirit
Definition: Player.h:688
StringPrintf
String StringPrintf(const char *fmt,...)
Definition: Strings.cpp:9
ItemsTable::uBonusChanceWpSpecial
unsigned int uBonusChanceWpSpecial[6]
Definition: Items.h:477
ITEM_ENCHANTMENT_OF_COLD
@ ITEM_ENCHANTMENT_OF_COLD
Definition: Items.h:41
ITEM_SPELLBOOK_LIGHT_DIVINE_INTERVENTION
@ ITEM_SPELLBOOK_LIGHT_DIVINE_INTERVENTION
Definition: Items.h:152
EQUIP_BOOTS
@ EQUIP_BOOTS
Definition: Items.h:236
StorylineTextTable.h
CHARACTER_ATTRIBUTE_SKILL_UNARMED
@ CHARACTER_ATTRIBUTE_SKILL_UNARMED
Definition: Engine.h:546
String
std::string String
Definition: Strings.h:10
ItemsTable::LoadPotionNotes
void LoadPotionNotes()
Definition: Items.cpp:541
CHARACTER_ATTRIBUTE_STRENGTH
@ CHARACTER_ATTRIBUTE_STRENGTH
Definition: Engine.h:521
ItemsTable::uBonusChanceSpecial
unsigned int uBonusChanceSpecial[6]
Definition: Items.h:476
ITEM_ARTIFACT_GOVERNORS_ARMOR
@ ITEM_ARTIFACT_GOVERNORS_ARMOR
Definition: Items.h:157
ItemsTable::pItemsTXT_Raw
char * pItemsTXT_Raw
Definition: Items.h:470
CHARACTER_ATTRIBUTE_RESIST_BODY
@ CHARACTER_ATTRIBUTE_RESIST_BODY
Definition: Engine.h:537
GameTime
Definition: Time.h:14
CHARACTER_ATTRIBUTE_SKILL_MEDITATION
@ CHARACTER_ATTRIBUTE_SKILL_MEDITATION
Definition: Engine.h:568
CHARACTER_ATTRIBUTE_INTELLIGENCE
@ CHARACTER_ATTRIBUTE_INTELLIGENCE
Definition: Engine.h:522
ItemGen::artifactBonusMap
static std::map< int, std::map< CHARACTER_ATTRIBUTE_TYPE, CEnchantment * > * > artifactBonusMap
Definition: Items.h:271
ItemsTable::uAllItemsCount
int uAllItemsCount
Definition: Items.h:459
pPotionsTXT_Raw
char * pPotionsTXT_Raw
Definition: mm7_data.cpp:682
ItemsTable::pItems
NZIArray< ItemDesc, 800 > pItems
Definition: Items.h:460
CHARACTER_ATTRIBUTE_SKILL_DARK
@ CHARACTER_ATTRIBUTE_SKILL_DARK
Definition: Engine.h:567
MATERIAL_RELIC
@ MATERIAL_RELIC
Definition: Items.h:68
Player::skillFire
unsigned __int16 skillFire
Definition: Player.h:684
ItemGen::MerchandiseTest
bool MerchandiseTest(int _2da_idx)
Definition: Items.cpp:1626
PLAYER_SKILL_PLATE
@ PLAYER_SKILL_PLATE
Definition: Player.h:182
ItemSpecialEnchantment::to_item_apply
char to_item_apply[12]
Definition: Items.h:433
CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM
@ CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM
Definition: Engine.h:541
CHARACTER_ATTRIBUTE_RESIST_EARTH
@ CHARACTER_ATTRIBUTE_RESIST_EARTH
Definition: Engine.h:535
ITEM_ARTIFACT_PUCK
@ ITEM_ARTIFACT_PUCK
Definition: Items.h:153