annotate Engine/Objects/Items.cpp @ 2508:491f0babd563

use_music_folder
author Ritor1
date Thu, 02 Oct 2014 11:52:31 +0600
parents a77c34acdbc9
children a902abdfc7f2
rev   line source
2497
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1 #define _CRTDBG_MAP_ALLOC
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2 #include <stdlib.h>
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
3 #include <crtdbg.h>
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
4
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
5 #define _CRT_SECURE_NO_WARNINGS
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
6 #include <stdlib.h>
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
7 #include <string>
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents: 2499
diff changeset
8 #include "..\..\GUI\UI\UIHouses.h"
2502
a77c34acdbc9 Media folder
Ritor1
parents: 2501
diff changeset
9 #include "GUI/GUIButton.h"
2497
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
10
2499
68cdef6879a0 engine folder
Ritor1
parents: 2497
diff changeset
11 #include "../ErrorHandling.h"
2497
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
12
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
13 #include "Items.h"
2499
68cdef6879a0 engine folder
Ritor1
parents: 2497
diff changeset
14 #include "../MapInfo.h"
2502
a77c34acdbc9 Media folder
Ritor1
parents: 2501
diff changeset
15 #include "GUI/GUIWindow.h"
2497
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
16 #include "Chest.h"
2499
68cdef6879a0 engine folder
Ritor1
parents: 2497
diff changeset
17 #include "../LOD.h"
2497
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
18 #include "Monsters.h"
2499
68cdef6879a0 engine folder
Ritor1
parents: 2497
diff changeset
19 #include "../Party.h"
68cdef6879a0 engine folder
Ritor1
parents: 2497
diff changeset
20 #include "../Tables/FactionTable.h"
68cdef6879a0 engine folder
Ritor1
parents: 2497
diff changeset
21 #include "../Tables/StorylineTextTable.h"
68cdef6879a0 engine folder
Ritor1
parents: 2497
diff changeset
22 #include "../texts.h"
68cdef6879a0 engine folder
Ritor1
parents: 2497
diff changeset
23 #include "../mm7_data.h"
68cdef6879a0 engine folder
Ritor1
parents: 2497
diff changeset
24 #include "../OurMath.h"
2497
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
25
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
26
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
27
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
28 struct ITEM_VARIATION
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
29 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
30 unsigned __int16 treasure_level;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
31 unsigned __int16 item_class[4];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
32 };
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
33
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
34
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
35 std::array<const char, 5> uItemsAmountPerShopType={ 0, 6, 8, 12, 12};
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
36
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
37 const ITEM_VARIATION shopWeap_variation_ord[15] ={
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
38 { 0, { 0, 0, 0, 0 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
39 { 1, { 23, 27, 20, 20 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
40 { 1, { 23, 24, 28, 20 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
41 { 2, { 23, 24, 25, 20 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
42 { 2, { 27, 27, 26, 26 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
43 { 4, { 24, 30, 25, 27 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
44 { 4, { 24, 30, 25, 27 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
45 { 3, { 30, 24, 20, 20 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
46 { 2, { 20, 20, 20, 20 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
47 { 3, { 27, 27, 26, 26 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
48 { 3, { 28, 28, 25, 25 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
49 { 2, { 23, 23, 24, 24 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
50 { 3, { 23, 23, 26, 26 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
51 { 2, { 30, 26, 26, 26 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
52 { 2, { 28, 25, 28, 29 }}};
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
53
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
54 const ITEM_VARIATION shopArmr_variation_ord[28] ={
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
55 { 1, { 35, 35, 38, 38 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
56 { 1, { 31, 31, 31, 34 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
57 { 1, { 35, 35, 38, 38 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
58 { 1, { 31, 31, 32, 34 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
59 { 2, { 35, 35, 38, 38 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
60 { 2, { 31, 32, 32, 33 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
61 { 2, { 35, 35, 38, 38 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
62 { 2, { 31, 31, 32, 32 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
63 { 4, { 35, 35, 38, 38 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
64 { 4, { 31, 32, 33, 34 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
65 { 4, { 35, 35, 38, 38 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
66 { 4, { 31, 32, 33, 34 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
67 { 3, { 35, 35, 38, 38 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
68 { 3, { 31, 31, 31, 31 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
69 { 2, { 35, 35, 38, 38 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
70 { 2, { 31, 32, 34, 34 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
71 { 3, { 35, 35, 38, 38 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
72 { 3, { 31, 31, 32, 32 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
73 { 3, { 35, 35, 38, 38 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
74 { 3, { 32, 32, 32, 33 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
75 { 3, { 35, 35, 38, 38 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
76 { 3, { 31, 31, 31, 32 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
77 { 3, { 35, 35, 38, 38 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
78 { 3, { 33, 31, 32, 34 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
79 { 3, { 35, 35, 38, 38 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
80 { 3, { 33, 31, 32, 34 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
81 { 4, { 35, 35, 38, 38 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
82 { 4, { 33, 31, 32, 34 }}};
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
83
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
84
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
85
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
86 const unsigned __int16 shopMagic_treasure_lvl[14]= {0, 1, 1, 2, 2, 4, 4, 3, 2, 2, 2, 2, 2, 2};
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
87 const unsigned __int16 shopAlch_treasure_lvl[13] = {0, 1, 1, 2, 2, 3, 3, 4, 4, 2, 2, 2, 2};
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
88
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
89 const ITEM_VARIATION shopWeap_variation_spc[15]={
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
90 { 0, { 0, 0, 0, 0 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
91 { 2, { 25, 30, 20, 20}},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
92 { 2, { 23, 24, 28, 20}},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
93 { 3, { 23, 24, 25, 20}},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
94 { 3, { 27, 27, 26, 26}},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
95 { 5, { 23, 26, 28, 27}},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
96 { 5, { 23, 26, 28, 27}},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
97 { 4, { 30, 24, 20, 20}},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
98 { 3, { 20, 20, 20, 20}},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
99 { 4, { 27, 27, 26, 26}},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
100 { 4, { 28, 28, 25, 25}},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
101 { 4, { 23, 23, 24, 24}},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
102 { 4, { 24, 24, 27, 20}},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
103 { 4, { 30, 26, 26, 26}},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
104 { 4, { 28, 25, 28, 29}}};
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
105
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
106 const ITEM_VARIATION shopArmr_variation_spc[28]={
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
107 { 2, { 35, 35, 38, 38 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
108 { 2, { 31, 31, 31, 34 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
109 { 2, { 35, 35, 38, 38 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
110 { 2, { 31, 31, 32, 34 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
111 { 3, { 35, 35, 38, 38 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
112 { 3, { 31, 32, 32, 33 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
113 { 3, { 35, 35, 38, 38 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
114 { 3, { 31, 31, 32, 32 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
115 { 5, { 35, 35, 38, 38 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
116 { 5, { 31, 32, 33, 34 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
117 { 5, { 35, 35, 38, 38 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
118 { 5, { 31, 32, 33, 34 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
119 { 4, { 35, 35, 38, 38 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
120 { 4, { 31, 31, 31, 31 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
121 { 3, { 35, 35, 38, 38 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
122 { 3, { 31, 32, 34, 34 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
123 { 4, { 35, 35, 38, 38 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
124 { 4, { 31, 31, 32, 33 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
125 { 4, { 35, 35, 38, 38 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
126 { 4, { 32, 32, 33, 34 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
127 { 4, { 35, 35, 38, 38 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
128 { 4, { 31, 31, 31, 32 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
129 { 4, { 35, 35, 38, 38 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
130 { 4, { 32, 32, 32, 32 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
131 { 4, { 35, 35, 38, 38 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
132 { 4, { 34, 34, 34, 34 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
133 { 5, { 35, 35, 38, 38 }},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
134 { 5, { 33, 33, 33, 33 }}
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
135 };
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
136
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
137 const unsigned __int16 shopMagicSpc_treasure_lvl[14] = {0, 2, 2, 3, 3, 5, 5, 4, 3, 3, 3, 3, 3, 3};
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
138 const unsigned __int16 shopAlchSpc_treasure_lvl[13] = {0, 2, 2, 3, 3, 4, 4, 5, 5, 3, 2, 2, 2};
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
139
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
140
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
141 std::array< std::array<char, 14>, 7> byte_4E8168={{ //byte_4E8178
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
142 { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
143 { 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
144 { 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
145 { 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
146 { 2, 2, 2, 2, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
147 { 2, 2, 2, 2, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6},
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
148 { 2, 2, 2, 2, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}}};
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
149
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
150 int sub_4BE571_AddItemToSet(int valueToAdd, int *outPutSet, int elemsAlreadyPresent, int elemsNeeded);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
151 int dword_F8B1DC_currentShopOption; // weak
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
152
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
153 ItemGen *ptr_50C9A4_ItemToEnchant;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
154
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
155 struct ItemsTable *pItemsTable; // 005D29E0
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
156
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
157
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
158
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
159
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
160
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
161 //----- (00439DF3) --------------------------------------------------------
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
162 int ItemGen::_439DF3_get_additional_damage(int *damage_type, bool *draintargetHP)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
163 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
164 *draintargetHP = false;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
165 *damage_type = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
166 if ( !uItemID )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
167 return 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
168 UpdateTempBonus(pParty->uTimePlayed);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
169 if (uItemID == 501 ) //Iron Feather -sword
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
170 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
171 *damage_type = 1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
172 return rand() % 10 + 6;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
173 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
174 if (uItemID == 507 ) //Ghoulsbane -axe
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
175 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
176 *damage_type = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
177 return rand() % 16 + 3;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
178 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
179 if ( uItemID == 510 ) //Ullyses -bow
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
180 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
181 *damage_type = 2;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
182 return rand() % 4 + 9;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
183 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
184 if ( uItemID == 517 ) //Old Nick -dagger
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
185 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
186 *damage_type = 8;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
187 return 8;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
188 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
189
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
190 switch (uSpecEnchantmentType)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
191 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
192 case 4: //Adds 3-4 points of Cold damage.
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
193 *damage_type = 2;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
194 return rand() % 2 + 3;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
195 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
196 case 5: //Adds 6-8 points of Cold damage.
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
197 *damage_type = 2;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
198 return rand() % 3 + 6;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
199 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
200 case 6: //Adds 9-12 points of Cold damage.
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
201 *damage_type = 2;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
202 return rand() % 4 + 9;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
203 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
204 case 7: //Adds 2-5 points of Electrical damage.
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
205 *damage_type = 1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
206 return rand() % 4 + 2;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
207 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
208 case 8: //Adds 4-10 points of Electrical damage.
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
209 *damage_type = 1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
210 return rand() % 7 + 4;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
211 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
212 case 9: //Adds 6-15 points of Electrical damage.
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
213 *damage_type = 1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
214 return rand() % 10 + 6;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
215 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
216 case 10: //Adds 1-6 points of Fire damage.
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
217 *damage_type = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
218 return GetDiceResult(1, 6);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
219 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
220 case 11: //Adds 2-12 points of Fire damage.
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
221 *damage_type = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
222 return GetDiceResult(2, 6);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
223 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
224 case 12: //Adds 3-18 points of Fire damage.
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
225 *damage_type = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
226 return GetDiceResult(3, 6);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
227 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
228 case 13: //Adds 5 points of Body damage.
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
229 *damage_type = 8;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
230 return 5;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
231 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
232 case 14: //Adds 8 points of Body damage.
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
233 *damage_type = 8;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
234 return 8;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
235 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
236 case 15: //Adds 12 points of Body damage.
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
237 *damage_type = 8;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
238 return 12;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
239 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
240 case 16: //Drain Hit Points from target.
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
241 case 41: //Drain Hit Points from target and Increased Weapon speed.
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
242 *damage_type = 10;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
243 *draintargetHP = true;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
244 return 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
245 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
246 case 46: //Adds 10-20 points of Fire damage and +25 Might.
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
247 *damage_type = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
248 return rand() % 11 + 10;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
249 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
250 default:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
251 *damage_type = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
252 return 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
253
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
254 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
255
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
256 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
257
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
258
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
259 //----- (00402F07) --------------------------------------------------------
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
260 void ItemGen::Reset()
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
261 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
262 this->uHolderPlayer = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
263 this->uAttributes = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
264 this->uNumCharges = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
265 this->uSpecEnchantmentType = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
266 this->m_enchantmentStrength = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
267 this->uEnchantmentType = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
268 this->uItemID = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
269 this->uBodyAnchor = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
270 this->uExpireTime = 0i64;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
271 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
272
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
273 //----- (00458260) --------------------------------------------------------
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
274 void ItemGen::UpdateTempBonus(__int64 uTimePlayed)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
275 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
276 if ( this->uAttributes & ITEM_TEMP_BONUS )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
277 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
278 if ( uTimePlayed > (signed __int64)this->uExpireTime )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
279 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
280 this->uEnchantmentType = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
281 this->uSpecEnchantmentType = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
282 this->uAttributes = this->uAttributes&(~ITEM_TEMP_BONUS);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
283 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
284 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
285 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
286
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
287 //----- (0045814E) --------------------------------------------------------
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
288 void ItemsTable::Release()
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
289 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
290 free(pMonstersTXT_Raw);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
291 free(pMonsterPlacementTXT_Raw);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
292 free(pSkillDescTXT_Raw);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
293 free(pSpcItemsTXT_Raw);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
294 free(pStdItemsTXT_Raw);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
295 free(pRndItemsTXT_Raw);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
296 free(pItemsTXT_Raw);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
297 free(pHostileTXT_Raw);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
298 free(pHistoryTXT_Raw);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
299 free(pPotionsTXT_Raw);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
300 free(pPotionNotesTXT_Raw);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
301 pMonstersTXT_Raw = nullptr;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
302 pMonsterPlacementTXT_Raw = nullptr;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
303 pSpcItemsTXT_Raw = nullptr;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
304 pSkillDescTXT_Raw = nullptr;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
305 pStdItemsTXT_Raw = nullptr;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
306 pRndItemsTXT_Raw = nullptr;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
307 pItemsTXT_Raw = nullptr;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
308 pHostileTXT_Raw = nullptr;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
309 pHistoryTXT_Raw = nullptr;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
310 pPotionsTXT_Raw = nullptr;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
311 pPotionNotesTXT_Raw = nullptr;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
312 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
313
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
314
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
315 //----- (00456D84) --------------------------------------------------------
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
316 void ItemsTable::Initialize()
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
317 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
318 std::map<std::string, ITEM_EQUIP_TYPE, ci_less> equipStatMap;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
319 equipStatMap["weapon"] = EQUIP_SINGLE_HANDED;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
320 equipStatMap["weapon2"] = EQUIP_TWO_HANDED;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
321 equipStatMap["weapon1or2"] = EQUIP_SINGLE_HANDED;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
322 equipStatMap["missile"] = EQUIP_BOW;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
323 equipStatMap["bow"] = EQUIP_BOW;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
324 equipStatMap["armor"] = EQUIP_ARMOUR;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
325 equipStatMap["shield"] = EQUIP_SHIELD;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
326 equipStatMap["helm"] = EQUIP_HELMET;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
327 equipStatMap["belt"] = EQUIP_BELT;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
328 equipStatMap["cloak"] = EQUIP_CLOAK;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
329 equipStatMap["gauntlets"] = EQUIP_GAUNTLETS;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
330 equipStatMap["boots"] = EQUIP_BOOTS;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
331 equipStatMap["ring"] = EQUIP_RING;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
332 equipStatMap["amulet"] = EQUIP_AMULET;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
333 equipStatMap["weaponw"] = EQUIP_WAND;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
334 equipStatMap["herb"] = EQUIP_REAGENT;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
335 equipStatMap["reagent"] = EQUIP_REAGENT;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
336 equipStatMap["bottle"] = EQUIP_POTION;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
337 equipStatMap["sscroll"] = EQUIP_SPELL_SCROLL;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
338 equipStatMap["book"] = EQUIP_BOOK;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
339 equipStatMap["mscroll"] = EQUIP_MESSAGE_SCROLL;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
340 equipStatMap["gold"] = EQUIP_GOLD;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
341 equipStatMap["gem"] = EQUIP_GEM;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
342
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
343 std::map<std::string, PLAYER_SKILL_TYPE, ci_less> equipSkillMap;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
344 equipSkillMap["staff"] = PLAYER_SKILL_STAFF;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
345 equipSkillMap["sword"] = PLAYER_SKILL_SWORD;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
346 equipSkillMap["dagger"] = PLAYER_SKILL_DAGGER;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
347 equipSkillMap["axe"] = PLAYER_SKILL_AXE;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
348 equipSkillMap["spear"] = PLAYER_SKILL_SPEAR;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
349 equipSkillMap["bow"] = PLAYER_SKILL_BOW;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
350 equipSkillMap["mace"] = PLAYER_SKILL_MACE;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
351 equipSkillMap["blaster"] = PLAYER_SKILL_BLASTER;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
352 equipSkillMap["shield"] = PLAYER_SKILL_SHIELD;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
353 equipSkillMap["leather"] = PLAYER_SKILL_LEATHER;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
354 equipSkillMap["chain"] = PLAYER_SKILL_CHAIN;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
355 equipSkillMap["plate"] = PLAYER_SKILL_PLATE;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
356 equipSkillMap["club"] = PLAYER_SKILL_CLUB;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
357
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
358 std::map<std::string, ITEM_MATERIAL, ci_less> materialMap;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
359 materialMap["artifact"] = MATERIAL_ARTEFACT;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
360 materialMap["relic"] = MATERIAL_RELIC;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
361 materialMap["special"] = MATERIAL_SPECIAL;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
362
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
363 char* test_string;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
364 int item_counter;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
365
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
366 pMapStats = new MapStats;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
367 pMapStats->Initialize();
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
368
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
369 pMonsterStats = new MonsterStats;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
370 pMonsterStats->Initialize();
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
371 pMonsterStats->InitializePlacements();
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
372
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
373 pSpellStats = new SpellStats;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
374 pSpellStats->Initialize();
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
375
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
376 LoadPotions();
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
377 LoadPotionNotes();
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
378
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
379 pFactionTable = new FactionTable;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
380 pFactionTable->Initialize();
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
381
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
382 pStorylineText = new StorylineText;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
383 pStorylineText->Initialize();
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
384
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
385 pStdItemsTXT_Raw = (char *)pEvents_LOD->LoadRaw("stditems.txt", 0);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
386 strtok(pStdItemsTXT_Raw, "\r");
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
387 strtok(NULL, "\r");
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
388 strtok(NULL, "\r");
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
389 strtok(NULL, "\r");
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
390 //Standard Bonuses by Group
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
391 for (int i=0;i<24;++i)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
392 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
393 test_string = strtok(NULL, "\r") + 1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
394 auto tokens = Tokenize(test_string, '\t');
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
395 pEnchantments[i].pBonusStat=RemoveQuotes(tokens[0]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
396 pEnchantments[i].pOfName=RemoveQuotes(tokens[1]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
397 for (int j = 0; j < 9; j++)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
398 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
399 pEnchantments[i].to_item[j]=atoi(tokens[j+2]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
400 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
401 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
402
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
403 memset(&pEnchantmentsSumm, 0, 36);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
404 for(int i=0;i<9;++i)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
405 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
406 for (int j=0;j<24;++j)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
407 pEnchantmentsSumm[i]+=pEnchantments[j].to_item[i];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
408 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
409
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
410 //Bonus range for Standard by Level
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
411 strtok(NULL, "\r");
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
412 strtok(NULL, "\r");
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
413 strtok(NULL, "\r");
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
414 strtok(NULL, "\r");
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
415 strtok(NULL, "\r");
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
416 for(int i=0;i<6;++i) //counted from 1
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
417 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
418 test_string = strtok(NULL, "\r") + 1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
419 auto tokens = Tokenize(test_string, '\t');
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
420 Assert(tokens.size() == 4, "Invalid number of tokens");
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
421 bonus_ranges[i].minR = atoi(tokens[2]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
422 bonus_ranges[i].maxR =atoi(tokens[3]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
423 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
424
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
425
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
426 pSpcItemsTXT_Raw = (char *)pEvents_LOD->LoadRaw("spcitems.txt", 0);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
427 strtok(pSpcItemsTXT_Raw, "\r");
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
428 strtok(NULL, "\r");
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
429 strtok(NULL, "\r");
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
430 strtok(NULL, "\r");
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
431 for (int i=0;i<72;++i)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
432 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
433 test_string = strtok(NULL, "\r") + 1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
434 auto tokens = Tokenize(test_string, '\t');
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
435 Assert(tokens.size() >= 17, "Invalid number of tokens");
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
436 pSpecialEnchantments[i].pBonusStatement=RemoveQuotes(tokens[0]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
437 pSpecialEnchantments[i].pNameAdd= RemoveQuotes(tokens[1]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
438 for (int j = 0; j < 12; j++)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
439 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
440 pSpecialEnchantments[i].to_item_apply[j]=atoi(tokens[j+2]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
441 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
442 int res;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
443 res=atoi(tokens[14]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
444 if(!res)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
445 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
446 ++tokens[14];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
447 while (*tokens[14]==' ')//fix X 2 case
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
448 ++tokens[14];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
449 res=atoi(tokens[14]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
450 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
451 pSpecialEnchantments[i].iValue=res;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
452 pSpecialEnchantments[i].iTreasureLevel= tolower(tokens[15][0]) - 97;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
453 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
454
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
455 pSpecialEnchantments_count = 71;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
456 memset(&pSpecialEnchantmentsSumm, 0, 96);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
457 for(int i=0;i<12;++i)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
458 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
459 for (unsigned int j=0;j<=pSpecialEnchantments_count;++j)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
460 pSpecialEnchantmentsSumm[i]+=pSpecialEnchantments[j].to_item_apply[i];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
461 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
462
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
463 InitializeBuildingResidents();
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
464
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
465 pItemsTXT_Raw = (char*) pEvents_LOD->LoadRaw("items.txt", 0);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
466 strtok(pItemsTXT_Raw, "\r");
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
467 strtok(NULL, "\r");
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
468 uAllItemsCount = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
469 item_counter = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
470 while (item_counter < 800)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
471 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
472 test_string = strtok(NULL, "\r") + 1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
473 auto tokens = Tokenize(test_string, '\t');
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
474 item_counter=atoi(tokens[0]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
475 uAllItemsCount=item_counter;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
476 pItems[item_counter].pIconName = RemoveQuotes(tokens[1]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
477 pItems[item_counter].pName = RemoveQuotes(tokens[2]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
478 pItems[item_counter].uValue=atoi(tokens[3]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
479 auto findResult = equipStatMap.find(tokens[4]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
480 pItems[item_counter].uEquipType = findResult == equipStatMap.end() ? EQUIP_NONE : findResult->second;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
481 auto findResult2 = equipSkillMap.find(tokens[5]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
482 pItems[item_counter].uSkillType = findResult2 == equipSkillMap.end() ? PLAYER_SKILL_MISC : findResult2->second;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
483 auto tokens2 = Tokenize(tokens[6], 'd');
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
484 if (tokens2.size() == 2)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
485 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
486 pItems[item_counter].uDamageDice=atoi(tokens2[0]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
487 pItems[item_counter].uDamageRoll=atoi(tokens2[1]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
488 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
489 else if (tolower(tokens2[0][0]) != 's')
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
490 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
491 pItems[item_counter].uDamageDice=atoi(tokens2[0]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
492 pItems[item_counter].uDamageRoll=1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
493 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
494 else
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
495 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
496 pItems[item_counter].uDamageDice=0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
497 pItems[item_counter].uDamageRoll=0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
498 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
499 pItems[item_counter].uDamageMod=atoi(tokens[7]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
500 auto findResult3 = materialMap.find(tokens[8]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
501 pItems[item_counter].uMaterial = findResult3 == materialMap.end() ? MATERIAL_COMMON : findResult3->second;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
502 pItems[item_counter].uItemID_Rep_St=atoi(tokens[9]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
503 pItems[item_counter].pUnidentifiedName = RemoveQuotes(tokens[10]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
504 pItems[item_counter].uSpriteID=atoi(tokens[11]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
505
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
506 pItems[item_counter]._additional_value=0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
507 pItems[item_counter]._bonus_type=0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
508 if (pItems[item_counter].uMaterial==MATERIAL_SPECIAL)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
509 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
510 for(int ii=0; ii<24; ++ii)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
511 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
512 if (!_stricmp(tokens[12],pEnchantments[ii].pOfName))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
513 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
514 pItems[item_counter]._bonus_type=ii+1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
515 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
516 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
517 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
518 if (!pItems[item_counter]._bonus_type)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
519 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
520 for(int ii=0; ii<72; ++ii)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
521 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
522 if (!_stricmp(tokens[12],pSpecialEnchantments[ii].pNameAdd))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
523 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
524 pItems[item_counter]._additional_value=ii+1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
525 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
526 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
527 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
528 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
529
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
530 if ((pItems[item_counter].uMaterial==MATERIAL_SPECIAL)&&(pItems[item_counter]._bonus_type))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
531 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
532 char b_s=atoi(tokens[13]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
533 if (b_s)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
534 pItems[item_counter]._bonus_strength=b_s;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
535 else
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
536 pItems[item_counter]._bonus_strength=1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
537 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
538 else
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
539 pItems[item_counter]._bonus_strength=0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
540 pItems[item_counter].uEquipX=atoi(tokens[14]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
541 pItems[item_counter].uEquipY=atoi(tokens[15]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
542 pItems[item_counter].pDescription = RemoveQuotes(tokens[16]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
543 item_counter++;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
544 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
545
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
546 uAllItemsCount = item_counter;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
547 pRndItemsTXT_Raw = (char *)pEvents_LOD->LoadRaw("rnditems.txt", 0);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
548 strtok(pRndItemsTXT_Raw, "\r");
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
549 strtok(NULL, "\r");
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
550 strtok(NULL, "\r");
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
551 strtok(NULL, "\r");
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
552 for (item_counter = 0; item_counter < 619; item_counter++)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
553 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
554 test_string = strtok(NULL, "\r") + 1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
555 auto tokens = Tokenize(test_string, '\t');
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
556 Assert(tokens.size() > 7, "Invalid number of tokens");
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
557 item_counter = atoi(tokens[0]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
558 pItems[item_counter].uChanceByTreasureLvl1=atoi(tokens[2]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
559 pItems[item_counter].uChanceByTreasureLvl2=atoi(tokens[3]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
560 pItems[item_counter].uChanceByTreasureLvl3=atoi(tokens[4]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
561 pItems[item_counter].uChanceByTreasureLvl4=atoi(tokens[5]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
562 pItems[item_counter].uChanceByTreasureLvl5=atoi(tokens[6]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
563 pItems[item_counter].uChanceByTreasureLvl6=atoi(tokens[7]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
564 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
565
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
566 //ChanceByTreasureLvl Summ - to calculate chance
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
567 memset(&uChanceByTreasureLvlSumm, 0, 24);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
568 for(int i=0;i<6;++i)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
569 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
570 for (int j=1;j<item_counter;++j)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
571 uChanceByTreasureLvlSumm[i]+=pItems[j].uChanceByTreasureLvl[i];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
572 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
573
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
574 strtok(NULL, "\r");
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
575 strtok(NULL, "\r");
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
576 strtok(NULL, "\r");
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
577 strtok(NULL, "\r");
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
578 strtok(NULL, "\r");
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
579 for (int i=0;i<3;++i)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
580 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
581 test_string = strtok(NULL, "\r") + 1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
582 auto tokens = Tokenize(test_string, '\t');
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
583 Assert(tokens.size() > 7, "Invalid number of tokens");
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
584 switch (i)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
585 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
586 case 0:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
587 uBonusChanceStandart[0]=atoi(tokens[2]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
588 uBonusChanceStandart[1]=atoi(tokens[3]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
589 uBonusChanceStandart[2]=atoi(tokens[4]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
590 uBonusChanceStandart[3]=atoi(tokens[5]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
591 uBonusChanceStandart[4]=atoi(tokens[6]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
592 uBonusChanceStandart[5]=atoi(tokens[7]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
593 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
594 case 1:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
595 uBonusChanceSpecial[0]=atoi(tokens[2]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
596 uBonusChanceSpecial[1]=atoi(tokens[3]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
597 uBonusChanceSpecial[2]=atoi(tokens[4]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
598 uBonusChanceSpecial[3]=atoi(tokens[5]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
599 uBonusChanceSpecial[4]=atoi(tokens[6]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
600 uBonusChanceSpecial[5]=atoi(tokens[7]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
601 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
602 case 2:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
603 uBonusChanceWpSpecial[0]=atoi(tokens[2]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
604 uBonusChanceWpSpecial[1]=atoi(tokens[3]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
605 uBonusChanceWpSpecial[2]=atoi(tokens[4]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
606 uBonusChanceWpSpecial[3]=atoi(tokens[5]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
607 uBonusChanceWpSpecial[4]=atoi(tokens[6]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
608 uBonusChanceWpSpecial[5]=atoi(tokens[7]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
609 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
610 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
611 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
612 free(pRndItemsTXT_Raw);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
613 pRndItemsTXT_Raw = nullptr;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
614
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
615 pSkillDescTXT_Raw = (char *)pEvents_LOD->LoadRaw("skilldes.txt", 0);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
616 strtok(pSkillDescTXT_Raw, "\r");
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
617 for (int i=0; i<37; ++i)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
618 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
619 test_string = strtok(NULL, "\r") + 1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
620 auto tokens = Tokenize(test_string, '\t');
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
621 Assert(tokens.size() >= 6, "Invalid number of tokens");
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
622 pSkillDesc[i] = RemoveQuotes(tokens[1]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
623 pNormalSkillDesc[i] = RemoveQuotes(tokens[2]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
624 pExpertSkillDesc[i] = RemoveQuotes(tokens[3]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
625 pMasterSkillDesc[i] = RemoveQuotes(tokens[4]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
626 pGrandSkillDesc[i] = RemoveQuotes(tokens[5]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
627 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
628
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
629 pStatsTXT_Raw = (char *)pEvents_LOD->LoadRaw("stats.txt", 0);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
630 strtok(pStatsTXT_Raw, "\r");
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
631 for (int i=0; i<26; ++i)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
632 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
633 test_string = strtok(NULL, "\r") + 1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
634 auto tokens = Tokenize(test_string, '\t');
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
635 Assert(tokens.size() == 2, "Invalid number of tokens");
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
636 switch (i)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
637 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
638 case 0:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
639 case 1:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
640 case 2:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
641 case 3:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
642 case 4:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
643 case 5:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
644 case 6:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
645 pAttributeDescriptions[i] = RemoveQuotes(tokens[1]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
646 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
647 case 7:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
648 pHealthPointsAttributeDescription = RemoveQuotes(tokens[1]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
649 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
650 case 8:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
651 pArmourClassAttributeDescription = RemoveQuotes(tokens[1]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
652 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
653 case 9:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
654 pSpellPointsAttributeDescription = RemoveQuotes(tokens[1]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
655 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
656 case 10:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
657 pPlayerConditionAttributeDescription = RemoveQuotes(tokens[1]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
658 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
659 case 11:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
660 pFastSpellAttributeDescription = RemoveQuotes(tokens[1]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
661 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
662 case 12:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
663 pPlayerAgeAttributeDescription = RemoveQuotes(tokens[1]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
664 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
665 case 13:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
666 pPlayerLevelAttributeDescription = RemoveQuotes(tokens[1]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
667 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
668 case 14:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
669 pPlayerExperienceAttributeDescription = RemoveQuotes(tokens[1]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
670 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
671 case 15:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
672 pAttackBonusAttributeDescription = RemoveQuotes(tokens[1]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
673 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
674 case 16:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
675 pAttackDamageAttributeDescription = RemoveQuotes(tokens[1]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
676 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
677 case 17:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
678 pMissleBonusAttributeDescription = RemoveQuotes(tokens[1]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
679 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
680 case 18:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
681 pMissleDamageAttributeDescription = RemoveQuotes(tokens[1]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
682 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
683 case 19:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
684 pFireResistanceAttributeDescription = RemoveQuotes(tokens[1]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
685 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
686 case 20:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
687 pAirResistanceAttributeDescription = RemoveQuotes(tokens[1]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
688 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
689 case 21:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
690 pWaterResistanceAttributeDescription = RemoveQuotes(tokens[1]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
691 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
692 case 22:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
693 pEarthResistanceAttributeDescription = RemoveQuotes(tokens[1]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
694 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
695 case 23:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
696 pMindResistanceAttributeDescription = RemoveQuotes(tokens[1]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
697 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
698 case 24:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
699 pBodyResistanceAttributeDescription = RemoveQuotes(tokens[1]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
700 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
701 case 25:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
702 pSkillPointsAttributeDescription = RemoveQuotes(tokens[1]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
703 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
704 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
705 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
706
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
707 pClassTXT_Raw = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
708 pClassTXT_Raw = (char *)pEvents_LOD->LoadRaw("class.txt", 0);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
709 strtok(pClassTXT_Raw, "\r");
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
710 for (int i=0; i<36; ++i)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
711 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
712 test_string = strtok(NULL, "\r") + 1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
713 auto tokens = Tokenize(test_string, '\t');
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
714 Assert(tokens.size() == 3, "Invalid number of tokens");
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
715 pClassDescriptions[i]=RemoveQuotes(tokens[1]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
716 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
717
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
718
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
719
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
720 ItemGen::PopulateSpecialBonusMap();
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
721 ItemGen::PopulateArtifactBonusMap();
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
722 ItemGen::PopulateRegularBonusMap();
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
723
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
724
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
725 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
726
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
727 //----- (00456D17) --------------------------------------------------------
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
728 void ItemsTable::SetSpecialBonus(ItemGen *pItem)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
729 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
730 if ( pItems[pItem->uItemID].uMaterial == MATERIAL_SPECIAL )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
731 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
732 pItem->uEnchantmentType = pItems[pItem->uItemID]._bonus_type;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
733 pItem->uSpecEnchantmentType = pItems[pItem->uItemID]._additional_value;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
734 pItem->m_enchantmentStrength = pItems[pItem->uItemID]._bonus_strength;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
735 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
736 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
737
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
738 //----- (00456D43) --------------------------------------------------------
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
739 bool ItemsTable::IsMaterialSpecial(ItemGen *pItem)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
740 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
741 return this->pItems[pItem->uItemID].uMaterial == MATERIAL_SPECIAL;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
742 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
743
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
744 //----- (00456D5E) --------------------------------------------------------
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
745 bool ItemsTable::IsMaterialNonCommon(ItemGen *pItem)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
746 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
747 return pItems[pItem->uItemID].uMaterial == MATERIAL_SPECIAL ||
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
748 pItems[pItem->uItemID].uMaterial == MATERIAL_RELIC ||
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
749 pItems[pItem->uItemID].uMaterial == MATERIAL_ARTEFACT;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
750 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
751
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
752
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
753 //----- (00453B3C) --------------------------------------------------------
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
754 void ItemsTable::LoadPotions()
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
755 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
756
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
757 CHAR Text[90];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
758 char* test_string;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
759 unsigned int uRow;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
760 unsigned int uColumn;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
761 unsigned __int8 potion_value;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
762
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
763 free(pPotionNotesTXT_Raw);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
764 auto tokens = Tokenize("", '\t');
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
765 char* pPotionsTXT_Raw = (char *)pEvents_LOD->LoadRaw("potion.txt", 0);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
766 test_string = strtok(pPotionsTXT_Raw ,"\r") + 1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
767 while (test_string)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
768 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
769 tokens = Tokenize(test_string, '\t');
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
770 if (!strcmp(tokens[0], "222"))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
771 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
772 test_string = strtok(NULL ,"\r") + 1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
773 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
774 if (!test_string)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
775 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
776 MessageBoxA(0, "Error Pre-Parsing Potion Table", "Load Error", MB_ICONHAND|MB_CANCELTRYCONTINUE);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
777 return;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
778 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
779
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
780 for (uRow = 0;uRow < 50; ++uRow)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
781 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
782 if (tokens.size() < 50)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
783 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
784 wsprintfA(Text, "Error Parsing Potion Table at Row: %d Column: %d", uRow, tokens.size());
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
785 MessageBoxA(0, Text, "Parsing Error", MB_ICONHAND|MB_CANCELTRYCONTINUE);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
786 return;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
787 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
788 for (uColumn = 0; uColumn < 50; ++uColumn)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
789 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
790 char* currValue = tokens[uColumn + 7];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
791 potion_value = atoi(currValue);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
792 if ( !potion_value && tolower(currValue[0]) == 'e')
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
793 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
794 potion_value = atoi(currValue + 1);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
795 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
796 this->potion_data[uRow][uColumn]=potion_value;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
797 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
798
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
799 test_string = strtok(NULL ,"\r") + 1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
800 if (!test_string)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
801 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
802 wsprintfA(Text, "Error Parsing Potion Table at Row: %d Column: %d", uRow, 0);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
803 MessageBoxA(0, Text, "Parsing Error", MB_ICONHAND|MB_CANCELTRYCONTINUE);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
804 return;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
805 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
806 tokens = Tokenize(test_string, '\t');
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
807 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
808 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
809
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
810 //----- (00453CE5) --------------------------------------------------------
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
811 void ItemsTable::LoadPotionNotes()
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
812 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
813
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
814 CHAR Text[90];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
815 char* test_string;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
816 unsigned int uRow;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
817 unsigned int uColumn;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
818 unsigned __int8 potion_note;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
819
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
820 free(pPotionNotesTXT_Raw);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
821 auto tokens = Tokenize("", '\t');
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
822 char* pPotionNotesTXT_Raw = (char *)pEvents_LOD->LoadRaw("potnotes.txt", 0);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
823 test_string = strtok(pPotionNotesTXT_Raw ,"\r") + 1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
824 while (test_string)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
825 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
826 tokens = Tokenize(test_string, '\t');
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
827 if (!strcmp(tokens[0], "222"))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
828 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
829 test_string = strtok(NULL ,"\r") + 1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
830 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
831 if (!test_string)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
832 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
833 MessageBoxA(0, "Error Pre-Parsing Potion Table", "Load Error", MB_ICONHAND|MB_CANCELTRYCONTINUE);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
834 return;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
835 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
836
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
837 for (uRow = 0;uRow < 50; ++uRow)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
838 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
839 if (tokens.size() < 50)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
840 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
841 wsprintfA(Text, "Error Parsing Potion Table at Row: %d Column: %d", uRow, tokens.size());
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
842 MessageBoxA(0, Text, "Parsing Error", MB_ICONHAND|MB_CANCELTRYCONTINUE);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
843 return;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
844 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
845 for (uColumn = 0; uColumn < 50; ++uColumn)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
846 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
847 char* currValue = tokens[uColumn + 7];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
848 potion_note = atoi(currValue);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
849 if ( !potion_note && tolower(currValue[0]) == 'e')
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
850 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
851 potion_note = atoi(currValue + 1);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
852 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
853 this->potion_note[uRow][uColumn]=potion_note;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
854 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
855
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
856 test_string = strtok(NULL ,"\r") + 1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
857 if (!test_string)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
858 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
859 wsprintfA(Text, "Error Parsing Potion Table at Row: %d Column: %d", uRow, 0);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
860 MessageBoxA(0, Text, "Parsing Error", MB_ICONHAND|MB_CANCELTRYCONTINUE);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
861 return;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
862 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
863 tokens = Tokenize(test_string, '\t');
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
864 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
865
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
866
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
867 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
868
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
869
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
870 //----- (00456442) --------------------------------------------------------
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
871 unsigned int ItemGen::GetValue()
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
872 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
873 unsigned int uBaseValue; // edi@1
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
874 unsigned int bonus;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
875
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
876 uBaseValue = pItemsTable->pItems[this->uItemID].uValue;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
877 if ( this->uAttributes & ITEM_TEMP_BONUS || pItemsTable->IsMaterialNonCommon(this) )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
878 return uBaseValue;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
879 if (uEnchantmentType )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
880 return uBaseValue + 100 * m_enchantmentStrength;;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
881 if (uSpecEnchantmentType )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
882 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
883 bonus = pItemsTable->pSpecialEnchantments[uSpecEnchantmentType].iTreasureLevel;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
884 if ( bonus > 10 )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
885 return uBaseValue + bonus;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
886 else
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
887 return uBaseValue * bonus;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
888 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
889 return uBaseValue;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
890 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
891
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
892 //----- (00456499) --------------------------------------------------------
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
893 const char *ItemGen::GetDisplayName()
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
894 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
895 if (IsIdentified())
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
896 return GetIdentifiedName();
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
897 else
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
898 return pItemsTable->pItems[uItemID].pUnidentifiedName;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
899 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
900
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
901 //----- (004564B3) --------------------------------------------------------
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
902 const char *ItemGen::GetIdentifiedName()
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
903 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
904 unsigned __int8 equip_type;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
905 const char *player_name;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
906 const char *nameModificator;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
907 const char *format_str;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
908
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
909 equip_type = GetItemEquipType();
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
910 if ( (equip_type == EQUIP_REAGENT) || (equip_type == EQUIP_POTION) || (equip_type == EQUIP_GOLD) )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
911 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
912 sprintf(item__getname_buffer.data(), "%s", pItemsTable->pItems[uItemID].pName);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
913 return item__getname_buffer.data();
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
914 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
915 sprintf(item__getname_buffer.data(), "%s", pItemsTable->pItems[uItemID].pName);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
916 if ( uItemID == ITEM_LICH_JAR_FULL ) //Lich Jar
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
917 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
918 if ( (uHolderPlayer >0 )&& (uHolderPlayer <= 4) )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
919 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
920 player_name = pPlayers[uHolderPlayer]->pName;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
921 if ( player_name[strlen(player_name) - 1] == 's' )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
922 format_str = pGlobalTXT_LocalizationStrings[655]; //"%s' Jar"
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
923 else
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
924 format_str = pGlobalTXT_LocalizationStrings[654]; //"%s's Jar"
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
925 sprintf(item__getname_buffer.data(), format_str, pPlayers[uHolderPlayer]->pName);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
926 return item__getname_buffer.data();
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
927 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
928 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
929 if ( !pItemsTable->IsMaterialNonCommon(this) )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
930 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
931 if ( uEnchantmentType )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
932 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
933 strcat(item__getname_buffer.data(), " ");
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
934 nameModificator = pItemsTable->pEnchantments[uEnchantmentType-1].pOfName;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
935 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
936 else
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
937 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
938 if ( !uSpecEnchantmentType )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
939 return item__getname_buffer.data();
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
940 if ( uSpecEnchantmentType == 16 //Drain Hit Points from target.
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
941 || uSpecEnchantmentType == 39 //Double damage vs Demons.
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
942 || uSpecEnchantmentType == 40 //Double damage vs Dragons
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
943 || uSpecEnchantmentType == 45 //+5 Speed and Accuracy
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
944 || uSpecEnchantmentType == 56 //+5 Might and Endurance.
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
945 || uSpecEnchantmentType == 57 //+5 Intellect and Personality.
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
946 || uSpecEnchantmentType == 58 //Increased Value.
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
947 || uSpecEnchantmentType == 60 //+3 Unarmed and Dodging skills
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
948 || uSpecEnchantmentType == 61 //+3 Stealing and Disarm skills.
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
949 || uSpecEnchantmentType == 59 //Increased Weapon speed.
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
950 || uSpecEnchantmentType == 63 //Double Damage vs. Elves.
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
951 || uSpecEnchantmentType == 64 //Double Damage vs. Undead.
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
952 || uSpecEnchantmentType == 67 //Adds 5 points of Body damage and +2 Disarm skill.
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
953 || uSpecEnchantmentType == 68 ) //Adds 6-8 points of Cold damage and +5 Armor Class.
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
954 { //enchantment and name positions inverted!
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
955 sprintf( item__getname_buffer.data(), "%s %s",
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
956 pItemsTable->pSpecialEnchantments[uSpecEnchantmentType-1].pNameAdd,
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
957 pItemsTable->pItems[uItemID].pName);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
958 return item__getname_buffer.data();
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
959 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
960 strcat(item__getname_buffer.data(), " ");
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
961 nameModificator = pItemsTable->pSpecialEnchantments[uSpecEnchantmentType-1].pNameAdd;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
962 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
963 strcat(item__getname_buffer.data(), nameModificator);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
964 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
965 return item__getname_buffer.data();
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
966 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
967
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
968
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
969 //----- (00456620) --------------------------------------------------------
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
970 void ItemsTable::GenerateItem(int treasure_level, unsigned int uTreasureType, ItemGen *out_item)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
971 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
972 int treasureLevelMinus1; // ebx@3
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
973 int current_chance; // ebx@43
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
974 int tmp_chance; // ecx@47
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
975 int v17; // ebx@57
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
976 int v18; // edx@62
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
977 unsigned int special_chance; // edx@86
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
978 unsigned int v26; // edx@89
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
979 unsigned int v27; // eax@89
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
980 int v32; // ecx@91
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
981 int v33; // eax@91
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
982 // unsigned int v34; // eax@97
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
983 int v45; // eax@120
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
984 int v46; // edx@120
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
985 int j; // eax@121
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
986 int val_list[800]; // [sp+Ch] [bp-C88h]@33
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
987 int total_chance; // [sp+C8Ch] [bp-8h]@33
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
988 signed int v56; // [sp+CA0h] [bp+Ch]@55
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
989 int v57; // [sp+CA0h] [bp+Ch]@62
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
990
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
991 if (!out_item)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
992 out_item = (ItemGen *)malloc(sizeof(ItemGen));
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
993 memset(out_item, 0, sizeof(*out_item));
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
994
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
995
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
996 treasureLevelMinus1 = treasure_level - 1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
997 if ( uTreasureType ) //generate known treasure type
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
998 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
999 ITEM_EQUIP_TYPE requested_equip;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1000 PLAYER_SKILL_TYPE requested_skill = PLAYER_SKILL_INVALID;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1001 switch (uTreasureType)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1002 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1003 case 20: requested_equip = EQUIP_SINGLE_HANDED; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1004 case 21: requested_equip = EQUIP_ARMOUR; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1005 case 22: requested_skill = PLAYER_SKILL_MISC; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1006 case 23: requested_skill = PLAYER_SKILL_SWORD; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1007 case 24: requested_skill = PLAYER_SKILL_DAGGER; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1008 case 25: requested_skill = PLAYER_SKILL_AXE; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1009 case 26: requested_skill = PLAYER_SKILL_SPEAR; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1010 case 27: requested_skill = PLAYER_SKILL_BOW; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1011 case 28: requested_skill = PLAYER_SKILL_MACE; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1012 case 29: requested_skill = PLAYER_SKILL_CLUB; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1013 case 30: requested_skill = PLAYER_SKILL_STAFF; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1014 case 31: requested_skill = PLAYER_SKILL_LEATHER; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1015 case 32: requested_skill = PLAYER_SKILL_CHAIN; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1016 case 33: requested_skill = PLAYER_SKILL_PLATE; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1017 case 34: requested_equip = EQUIP_SHIELD; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1018 case 35: requested_equip = EQUIP_HELMET; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1019 case 36: requested_equip = EQUIP_BELT; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1020 case 37: requested_equip = EQUIP_CLOAK; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1021 case 38: requested_equip = EQUIP_GAUNTLETS; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1022 case 39: requested_equip = EQUIP_BOOTS; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1023 case 40: requested_equip = EQUIP_RING; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1024 case 41: requested_equip = EQUIP_AMULET; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1025 case 42: requested_equip = EQUIP_WAND; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1026 case 43: requested_equip = EQUIP_SPELL_SCROLL; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1027 case 44: requested_equip = EQUIP_POTION; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1028 case 45: requested_equip = EQUIP_REAGENT; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1029 case 46: requested_equip = EQUIP_GEM; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1030 default:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1031 __debugbreak(); // check this condition
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1032 requested_equip = (ITEM_EQUIP_TYPE)(uTreasureType - 1);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1033 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1034 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1035 memset(val_list, 0, sizeof(val_list));
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1036 total_chance = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1037 j=0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1038 //a2a = 1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1039 if (requested_skill == PLAYER_SKILL_INVALID) // no skill for this item needed
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1040 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1041 for (uint i = 1; i < 500; ++i)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1042 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1043 if (pItems[i].uEquipType == requested_equip)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1044 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1045 val_list[j] = i;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1046 ++j;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1047 total_chance += pItems[i].uChanceByTreasureLvl[treasure_level - 1];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1048 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1049 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1050 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1051 else //have needed skill
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1052 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1053 for (uint i = 1; i < 500; ++i)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1054 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1055 if (pItems[i].uSkillType == requested_skill)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1056 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1057 val_list[j] = i;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1058 ++j;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1059 total_chance += pItems[i].uChanceByTreasureLvl[treasure_level - 1];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1060 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1061 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1062 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1063
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1064 current_chance = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1065 if ( total_chance )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1066 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1067 current_chance = rand() % total_chance + 1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1068 tmp_chance = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1069 j=0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1070 while(tmp_chance < current_chance)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1071 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1072 out_item->uItemID = val_list[j];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1073 tmp_chance += pItems[val_list[j]].uChanceByTreasureLvl[treasure_level - 1];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1074 ++j;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1075 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1076 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1077 else
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1078 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1079 out_item->uItemID = 1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1080 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1081 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1082 else
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1083 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1084 //artifact
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1085 if ( treasureLevelMinus1 == 5 )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1086 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1087 v56 = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1088 for(int i=0; i<29; ++i)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1089 v56 += pParty->pIsArtifactFound[i];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1090 v17 = rand() % 29;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1091 if ((rand() % 100 < 5) && !pParty->pIsArtifactFound[v17] && v56 < 13)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1092 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1093 pParty->pIsArtifactFound[v17] = 1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1094 out_item->uAttributes = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1095 out_item->uItemID = v17 + 500;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1096 SetSpecialBonus(out_item);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1097 return;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1098 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1099 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1100
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1101 v57 = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1102 v18 = rand() % this->uChanceByTreasureLvlSumm[treasure_level - 1] + 1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1103 while (v57 < v18)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1104 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1105 ++out_item->uItemID;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1106 v57 += pItems[out_item->uItemID].uChanceByTreasureLvl[treasureLevelMinus1];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1107 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1108 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1109 if (out_item->GetItemEquipType() == EQUIP_POTION && out_item->uItemID != ITEM_POTION_BOTTLE )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1110 {// if it potion set potion spec
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1111 out_item->uEnchantmentType = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1112 for (int i=0; i<2; ++i)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1113 out_item->uEnchantmentType += rand() % 4 + 1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1114 out_item->uEnchantmentType = out_item->uEnchantmentType * treasure_level;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1115 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1116
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1117 if ( out_item->uItemID == ITEM_SPELLBOOK_LIGHT_DIVINE_INTERVENTION
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1118 && !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 239) )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1119 out_item->uItemID = ITEM_SPELLBOOK_LIGHT_SUN_BURST;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1120 if ( pItemsTable->pItems[out_item->uItemID].uItemID_Rep_St )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1121 out_item->uAttributes = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1122 else
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1123 out_item->uAttributes = 1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1124
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1125 if ( out_item->GetItemEquipType() != EQUIP_POTION )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1126 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1127 out_item->uSpecEnchantmentType = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1128 out_item->uEnchantmentType = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1129 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1130 //try get special enhansment
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1131 switch (out_item->GetItemEquipType())
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1132 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1133 case EQUIP_SINGLE_HANDED:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1134 case EQUIP_TWO_HANDED :
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1135 case EQUIP_BOW :
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1136 if ( !uBonusChanceWpSpecial[treasureLevelMinus1] )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1137 return;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1138 if ((uint)(rand() % 100)>=uBonusChanceWpSpecial[treasureLevelMinus1])
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1139 return;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1140 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1141 case EQUIP_ARMOUR :
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1142 case EQUIP_SHIELD :
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1143 case EQUIP_HELMET :
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1144 case EQUIP_BELT :
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1145 case EQUIP_CLOAK :
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1146 case EQUIP_GAUNTLETS :
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1147 case EQUIP_BOOTS :
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1148 case EQUIP_RING :
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1149
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1150 if ( !uBonusChanceStandart[treasureLevelMinus1] )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1151 return;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1152 special_chance = rand() % 100;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1153 if ( special_chance < uBonusChanceStandart[treasureLevelMinus1])
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1154 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1155 v26 = rand() %pEnchantmentsSumm[out_item->GetItemEquipType()-3] + 1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1156 v27 = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1157 while(v27 < v26)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1158 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1159 ++out_item->uEnchantmentType;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1160 v27+=pEnchantments[out_item->uEnchantmentType].to_item[out_item->GetItemEquipType()-3];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1161 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1162
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1163 v33 = rand() % (bonus_ranges[treasureLevelMinus1].maxR - bonus_ranges[treasureLevelMinus1].minR + 1);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1164 out_item->m_enchantmentStrength = v33 + bonus_ranges[treasureLevelMinus1].minR;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1165 v32 = out_item->uEnchantmentType - 1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1166 if ( v32 == 21 || v32 == 22 || v32 == 23 ) //Armsmaster skill, Dodge skill, Unarmed skill
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1167 out_item->m_enchantmentStrength = out_item->m_enchantmentStrength/2;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1168 if ( out_item->m_enchantmentStrength <= 0 )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1169 out_item->m_enchantmentStrength = 1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1170 return;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1171
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1172 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1173 else if ( special_chance >= uBonusChanceStandart[treasureLevelMinus1] + uBonusChanceSpecial[treasureLevelMinus1] )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1174 return;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1175 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1176 case EQUIP_WAND:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1177 out_item->uNumCharges = rand() % 6 + out_item->GetDamageMod() + 1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1178 out_item->uMaxCharges = out_item->uNumCharges;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1179 return;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1180 default:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1181 return;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1182 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1183
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1184 j=0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1185 int spc_sum=0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1186 int spc;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1187 memset(&val_list, 0, 3200);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1188 for (unsigned int i=0; i<pSpecialEnchantments_count;++i)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1189 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1190 int tr_lv= pSpecialEnchantments[i].iTreasureLevel;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1191 if ((treasure_level - 1 == 2) && ( tr_lv == 1 || tr_lv == 0 ) ||
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1192 (treasure_level - 1 == 3) && (tr_lv == 2 || tr_lv == 1 || tr_lv == 0) ||
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1193 (treasure_level - 1 == 4) && (tr_lv == 3 || tr_lv == 2 || tr_lv == 1) ||
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1194 (treasure_level - 1 == 5) && (tr_lv == 3)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1195 )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1196 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1197 spc=pSpecialEnchantments[i].to_item_apply[out_item->GetItemEquipType()];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1198 spc_sum+=spc;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1199 if(spc)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1200 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1201 val_list[j++]=i;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1202 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1203 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1204 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1205
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1206 v46 = rand()%spc_sum+1;//ñëó÷àéíûå çíà÷åíèÿ îò 1 äî spc_sum
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1207 j=0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1208 v45 = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1209 while (v45<v46)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1210 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1211 ++j;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1212 out_item->uSpecEnchantmentType=val_list[j];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1213 v45+=pSpecialEnchantments[val_list[j]].to_item_apply[out_item->GetItemEquipType()];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1214 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1215 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1216
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1217 //----- (004505CC) --------------------------------------------------------
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1218 bool ItemGen::GenerateArtifact()
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1219 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1220 signed int uNumArtifactsNotFound; // esi@1
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1221 int artifacts_list[32];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1222
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1223 memset(artifacts_list, 0,sizeof(artifacts_list));
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1224 uNumArtifactsNotFound = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1225
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1226 for (int i=500;i<529;++i)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1227 if ( !pParty->pIsArtifactFound[i-500] )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1228 artifacts_list[uNumArtifactsNotFound++] = i;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1229
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1230 Reset();
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1231 if ( uNumArtifactsNotFound )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1232 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1233 uItemID = artifacts_list[rand() % uNumArtifactsNotFound];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1234 pItemsTable->SetSpecialBonus(this);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1235 return true;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1236 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1237 else
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1238 return false;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1239
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1240 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1241
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1242 std::map<int, std::map<CHARACTER_ATTRIBUTE_TYPE, CEnchantment*>* >ItemGen::regularBonusMap;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1243 std::map<int, std::map<CHARACTER_ATTRIBUTE_TYPE, CEnchantment*>* >ItemGen::specialBonusMap;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1244 std::map<int, std::map<CHARACTER_ATTRIBUTE_TYPE, CEnchantment*>* >ItemGen::artifactBonusMap;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1245
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1246 #define NEWBONUSINTOSPECIALLIST(x,y) AddToMap(ItemGen::specialBonusMap, enchId, x, y);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1247 #define NEWBONUSINTOSPECIALLIST2(x,y,z) AddToMap(ItemGen::specialBonusMap, enchId, x, y, z);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1248
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1249 #define NEWBONUSINTOREGULARLIST(x) AddToMap(ItemGen::regularBonusMap, enchId, x);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1250
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1251 #define NEWBONUSINTOARTIFACTLIST(x,y) AddToMap(ItemGen::artifactBonusMap, itemId, x, y);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1252 #define NEWBONUSINTOARTIFACTLIST2(x,y,z) AddToMap(ItemGen::artifactBonusMap, itemId, x, y, z);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1253
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1254 void ItemGen::AddToMap( std::map<int, std::map<CHARACTER_ATTRIBUTE_TYPE, CEnchantment*>* > &maptoadd, int enchId, CHARACTER_ATTRIBUTE_TYPE attrId, int bonusValue /*= 0*/, unsigned __int16 Player::* skillPtr /*= NULL*/ )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1255 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1256 auto key = maptoadd.find(enchId);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1257 std::map<CHARACTER_ATTRIBUTE_TYPE, CEnchantment*>* currMap;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1258 if (key == maptoadd.end())
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1259 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1260 currMap = new std::map<CHARACTER_ATTRIBUTE_TYPE, CEnchantment*>;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1261 maptoadd[enchId] = currMap;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1262 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1263 else
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1264 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1265 currMap = key->second;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1266 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1267 Assert(currMap->find(attrId) == currMap->end(), "Attribute %d already present for enchantment %d", attrId, enchId);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1268 (*currMap)[attrId] = new CEnchantment(bonusValue, skillPtr);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1269 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1270
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1271 void ItemGen::PopulateSpecialBonusMap()
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1272 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1273 int enchId = 1;// of Protection, +10 to all Resistances
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1274 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_RESIST_FIRE, 10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1275 NEWBONUSINTOSPECIALLIST( CHARACTER_ATTRIBUTE_RESIST_AIR, 10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1276 NEWBONUSINTOSPECIALLIST( CHARACTER_ATTRIBUTE_RESIST_WATER, 10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1277 NEWBONUSINTOSPECIALLIST( CHARACTER_ATTRIBUTE_RESIST_EARTH, 10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1278 NEWBONUSINTOSPECIALLIST( CHARACTER_ATTRIBUTE_RESIST_MIND, 10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1279 NEWBONUSINTOSPECIALLIST( CHARACTER_ATTRIBUTE_RESIST_BODY, 10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1280
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1281 enchId = 2;//of The Gods, +10 to all Seven Statistics
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1282 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_STRENGTH, 10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1283 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_INTELLIGENCE, 10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1284 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_WILLPOWER, 10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1285 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_ENDURANCE, 10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1286 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_ACCURACY, 10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1287 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_SPEED, 10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1288 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_LUCK, 10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1289
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1290 enchId = 26;//of Air Magic
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1291 NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_AIR,0, &Player::skillAir);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1292
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1293 enchId = 27;//of Body Magic
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1294 NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_BODY,0, &Player::skillBody);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1295
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1296 enchId = 28;//of Dark Magic
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1297 NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_DARK,0, &Player::skillDark);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1298
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1299 enchId = 29;//of Earth Magic
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1300 NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_EARTH,0, &Player::skillEarth);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1301
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1302 enchId = 30;//of Fire Magic
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1303 NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_FIRE,0, &Player::skillFire);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1304
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1305 enchId = 31;//of Light Magic
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1306 NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_LIGHT,0, &Player::skillLight);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1307
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1308 enchId = 32;//of Mind Magic
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1309 NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_MIND,0, &Player::skillMind);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1310
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1311 enchId = 33;//of Spirit Magic
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1312 NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_SPIRIT,0, &Player::skillSpirit);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1313
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1314 enchId = 34;//of Water Magic
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1315 NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_WATER,0, &Player::skillWater);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1316
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1317 enchId = 42;//of Doom
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1318 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_STRENGTH, 1);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1319 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_INTELLIGENCE, 1);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1320 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_WILLPOWER, 1);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1321 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_ENDURANCE, 1);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1322 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_ACCURACY, 1);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1323 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_SPEED, 1);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1324 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_LUCK, 1);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1325 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_HEALTH, 1);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1326 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_MANA, 1);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1327 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_AC_BONUS, 1);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1328 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_RESIST_FIRE, 1);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1329 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_RESIST_AIR, 1);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1330 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_RESIST_WATER, 1);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1331 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_RESIST_EARTH, 1);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1332 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_RESIST_MIND, 1);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1333 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_RESIST_BODY, 1);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1334
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1335 enchId = 43;//of Earth
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1336 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_ENDURANCE, 10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1337 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_AC_BONUS, 10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1338 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_HEALTH, 10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1339
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1340 enchId = 44;//of Life
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1341 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_HEALTH, 10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1342
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1343 enchId = 45;//Rogues
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1344 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_SPEED, 5);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1345 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_ACCURACY, 5);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1346
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1347 enchId = 46;//of The Dragon
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1348 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_STRENGTH, 25);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1349
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1350 enchId = 47;//of The Eclipse
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1351 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_MANA, 10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1352
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1353 enchId = 48;//of The Golem
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1354 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_ENDURANCE, 15);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1355 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_AC_BONUS, 5);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1356
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1357 enchId = 49;//of The Moon
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1358 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_INTELLIGENCE, 10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1359 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_LUCK, 10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1360
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1361 enchId = 50;//of The Phoenix
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1362 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_RESIST_FIRE, 30);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1363
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1364 enchId = 51;//of The Sky
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1365 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_MANA, 10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1366 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_SPEED, 10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1367 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_INTELLIGENCE, 10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1368
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1369 enchId = 52;//of The Stars
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1370 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_ENDURANCE, 10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1371 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_ACCURACY, 10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1372
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1373 enchId = 53;//of The Sun
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1374 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_STRENGTH, 10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1375 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_WILLPOWER, 10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1376
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1377 enchId = 54;//of The Troll
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1378 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_ENDURANCE, 15);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1379
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1380 enchId = 55;//of The Unicorn
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1381 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_LUCK, 15);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1382
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1383 enchId = 56;//Warriors
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1384 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_STRENGTH, 5);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1385 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_ENDURANCE, 5);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1386
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1387 enchId = 57;//Wizards
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1388 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_INTELLIGENCE, 5);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1389 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_WILLPOWER, 5);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1390
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1391 enchId = 60;//Monks'
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1392 NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_DODGE, 3, &Player::skillDodge);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1393 NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_UNARMED, 3, &Player::skillUnarmed);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1394
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1395 enchId = 61;//Thieves'
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1396 NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM, 3, &Player::skillStealing);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1397 NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_STEALING, 3, &Player::skillDisarmTrap);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1398
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1399 enchId = 62;//of Identifying
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1400 NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_ITEM_ID, 3, &Player::skillItemId);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1401 NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID, 3, &Player::skillMonsterId);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1402
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1403 enchId = 67;//Assassins'
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1404 NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM, 2, &Player::skillDisarmTrap);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1405
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1406 enchId = 68;//Barbarians'
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1407 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_AC_BONUS, 5);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1408
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1409 enchId = 69;//of the Storm
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1410 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_RESIST_AIR, 20);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1411
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1412 enchId = 70;//of the Ocean
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1413 NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_RESIST_WATER, 10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1414 NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_ALCHEMY, 2, &Player::skillAlchemy);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1415 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1416
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1417 void ItemGen::PopulateRegularBonusMap()
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1418 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1419 int enchId = 1;//of Might
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1420 NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_STRENGTH);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1421
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1422 enchId = 2;//of Thought
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1423 NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_INTELLIGENCE);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1424
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1425 enchId = 3;//of Charm
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1426 NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_WILLPOWER);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1427
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1428 enchId = 4;//of Vigor
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1429 NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_ENDURANCE);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1430
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1431 enchId = 5;//of Precision
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1432 NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_ACCURACY);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1433
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1434 enchId = 6;//of Speed
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1435 NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_SPEED);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1436
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1437 enchId = 7;//of Luck
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1438 NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_LUCK);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1439
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1440 enchId = 8;//of Health
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1441 NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_HEALTH);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1442
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1443 enchId = 9;//of Magic
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1444 NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_MANA);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1445
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1446 enchId = 10;//of Defense
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1447 NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_AC_BONUS);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1448
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1449 enchId = 11;//of Fire Resistance
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1450 NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_RESIST_FIRE);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1451
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1452 enchId = 12;//of Air Resistance
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1453 NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_RESIST_AIR);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1454
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1455 enchId = 13;//of Water Resistance
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1456 NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_RESIST_WATER);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1457
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1458 enchId = 14;//of Earth Resistance
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1459 NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_RESIST_EARTH);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1460
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1461 enchId = 15;//of Mind Resistance
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1462 NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_RESIST_MIND);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1463
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1464 enchId = 16;//of Body Resistance
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1465 NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_RESIST_BODY);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1466
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1467 enchId = 17;//of Alchemy
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1468 NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_SKILL_ALCHEMY);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1469
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1470 enchId = 18;//of Stealing
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1471 NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_SKILL_STEALING);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1472
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1473 enchId = 19;//of Disarming
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1474 NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1475
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1476 enchId = 20;//of Items
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1477 NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_SKILL_ITEM_ID);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1478
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1479 enchId = 21;//of Monsters
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1480 NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1481
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1482 enchId = 22;//of Arms
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1483 NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1484
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1485 enchId = 23;//of Dodging
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1486 NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_SKILL_DODGE);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1487
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1488 enchId = 24;//of the Fist
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1489 NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_SKILL_UNARMED);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1490 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1491
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1492 void ItemGen::PopulateArtifactBonusMap()
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1493 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1494 int itemId;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1495 itemId = ITEM_ARTIFACT_PUCK;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1496 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_STRENGTH, 40);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1497
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1498 itemId = ITEM_ARTIFACT_IRON_FEATHER;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1499 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_STRENGTH, 40);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1500
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1501 itemId = ITEM_ARTIFACT_WALLACE;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1502 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_WILLPOWER, 40);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1503 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER, 10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1504
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1505 itemId = ITEM_ARTIFACT_CORSAIR;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1506 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_LUCK, 40);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1507 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM, 5);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1508 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_STEALING, 5);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1509
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1510 itemId = ITEM_ARTIFACT_GOVERNORS_ARMOR;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1511 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_STRENGTH, 10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1512 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_INTELLIGENCE, 10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1513 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_WILLPOWER, 10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1514 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_ENDURANCE, 10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1515 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_ACCURACY, 10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1516 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SPEED, 10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1517 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_LUCK, 10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1518
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1519 itemId = ITEM_ARTIFACT_YORUBA;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1520 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_ENDURANCE, 25);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1521
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1522 itemId = ITEM_ARTIFACT_SPLITTER;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1523 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_FIRE, 50);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1524
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1525 itemId = ITEM_ARTEFACT_ULLYSES,
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1526 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_ACCURACY, 50);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1527
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1528 itemId = ITEM_ARTEFACT_HANDS_OF_THE_MASTER,
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1529 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_DODGE, 10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1530 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_UNARMED, 10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1531
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1532 itemId = ITEM_ARTIFACT_LEAGUE_BOOTS;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1533 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SPEED, 40);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1534 NEWBONUSINTOARTIFACTLIST2(CHARACTER_ATTRIBUTE_SKILL_WATER, 0, &Player::skillWater);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1535
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1536 itemId = ITEM_ARTIFACT_RULERS_RING;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1537 NEWBONUSINTOARTIFACTLIST2(CHARACTER_ATTRIBUTE_SKILL_MIND, 0, &Player::skillMind);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1538 NEWBONUSINTOARTIFACTLIST2(CHARACTER_ATTRIBUTE_SKILL_DARK, 0, &Player::skillDark);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1539
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1540 itemId = ITEM_RELIC_MASH;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1541 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_STRENGTH, 150);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1542 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_INTELLIGENCE, -40);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1543 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_WILLPOWER, -40);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1544 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SPEED, -40);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1545
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1546 itemId = ITEM_RELIC_ETHRICS_STAFF;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1547 NEWBONUSINTOARTIFACTLIST2(CHARACTER_ATTRIBUTE_SKILL_DARK, 0, &Player::skillDark);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1548 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_MEDITATION, 15);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1549
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1550 itemId = ITEM_RELIC_HARECS_LEATHER;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1551 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM, 5);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1552 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_STEALING, 5);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1553 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_LUCK, 50);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1554 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_FIRE, -10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1555 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_WATER, -10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1556 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_AIR, -10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1557 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_EARTH, -10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1558 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_MIND, -10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1559 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_BODY, -10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1560
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1561 itemId = ITEM_RELIC_OLD_NICK;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1562 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM, 5);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1563
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1564 itemId = ITEM_RELIC_AMUCK;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1565 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_STRENGTH, 100);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1566 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_ENDURANCE, 100);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1567 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_AC_BONUS, -15);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1568
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1569 itemId = ITEM_RELIC_GLORY_SHIELD;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1570 NEWBONUSINTOARTIFACTLIST2(CHARACTER_ATTRIBUTE_SKILL_SPIRIT, 0, &Player::skillSpirit);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1571 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_SHIELD, 5);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1572 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_MIND, -10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1573 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_BODY, -10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1574
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1575 itemId = ITEM_RELIC_KELEBRIM;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1576 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_ENDURANCE, 50);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1577 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_EARTH, -30);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1578
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1579 itemId = ITEM_RELIC_TALEDONS_HELM;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1580 NEWBONUSINTOARTIFACTLIST2(CHARACTER_ATTRIBUTE_SKILL_LIGHT, 0, &Player::skillLight);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1581 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_WILLPOWER, 15);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1582 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_STRENGTH, 15);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1583 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_LUCK, -40);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1584
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1585 itemId = ITEM_RELIC_SCHOLARS_CAP;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1586 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_LEARNING, +15);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1587 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_ENDURANCE, -50);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1588
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1589 itemId = ITEM_RELIC_PHYNAXIAN_CROWN;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1590 NEWBONUSINTOARTIFACTLIST2(CHARACTER_ATTRIBUTE_SKILL_FIRE, 0, &Player::skillFire);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1591 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_WATER, +50);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1592 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_WILLPOWER, 30);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1593 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_AC_BONUS, -20);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1594
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1595 itemId = ITEM_RILIC_TITANS_BELT;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1596 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_STRENGTH, 75);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1597 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SPEED, -40);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1598
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1599 itemId = ITEM_RELIC_TWILIGHT;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1600 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SPEED, 50);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1601 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_LUCK, 50);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1602 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_FIRE, -15);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1603 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_WATER, -15);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1604 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_AIR, -15);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1605 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_EARTH, -15);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1606 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_MIND, -15);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1607 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_BODY, -15);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1608
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1609 itemId = ITEM_RELIC_ANIA_SELVING;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1610 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_ACCURACY, 150);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1611 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_BOW, 5);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1612 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_AC_BONUS, -25);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1613
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1614 itemId = ITEM_RELIC_JUSTICE;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1615 NEWBONUSINTOARTIFACTLIST2(CHARACTER_ATTRIBUTE_SKILL_MIND, 0, &Player::skillMind);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1616 NEWBONUSINTOARTIFACTLIST2(CHARACTER_ATTRIBUTE_SKILL_BODY, 0, &Player::skillBody);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1617 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SPEED, -40);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1618
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1619 itemId = ITEM_RELIC_MEKORIGS_HAMMER;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1620 NEWBONUSINTOARTIFACTLIST2(CHARACTER_ATTRIBUTE_SKILL_SPIRIT, 0, &Player::skillSpirit);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1621 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_STRENGTH, 75);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1622 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_AIR, -50);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1623
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1624 itemId = ITEM_ARTIFACT_HERMES_SANDALS;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1625 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SPEED, 100);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1626 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_ACCURACY, 50);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1627 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_AIR, 50);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1628
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1629 itemId = ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1630 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_WILLPOWER, -20);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1631 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_INTELLIGENCE, -20);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1632
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1633 itemId = ITEM_ARTIFACT_MINDS_EYE;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1634 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_WILLPOWER, 15);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1635 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_INTELLIGENCE, 15);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1636
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1637 itemId = ITEM_ELVEN_CHAINMAIL;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1638 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SPEED, 15);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1639 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_ACCURACY, 15);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1640
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1641 itemId = ITEM_FORGE_GAUNTLETS;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1642 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_STRENGTH, 15);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1643 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_ENDURANCE, 15);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1644 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_FIRE, 30);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1645
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1646 itemId = ITEM_ARTIFACT_HEROS_BELT;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1647 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_STRENGTH, 15);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1648 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER, 5);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1649
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1650 itemId = ITEM_ARTIFACT_LADYS_ESCORT;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1651 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_FIRE, 10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1652 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_AIR, 10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1653 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_WATER, 10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1654 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_EARTH, 10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1655 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_MIND, 10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1656 NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_BODY, 10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1657 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1658
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1659 void ItemGen::GetItemBonusSpecialEnchantment( Player* owner, CHARACTER_ATTRIBUTE_TYPE attrToGet, int* additiveBonus, int* halfSkillBonus )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1660 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1661 auto bonusList = ItemGen::specialBonusMap.find(this->uSpecEnchantmentType);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1662 if (bonusList == ItemGen::specialBonusMap.end())
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1663 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1664 return;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1665 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1666 std::map<CHARACTER_ATTRIBUTE_TYPE, CEnchantment*>* currList = bonusList->second;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1667 if (currList->find(attrToGet) != currList->end())
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1668 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1669 CEnchantment* currBonus = (*currList)[attrToGet];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1670 if (currBonus->statPtr != NULL)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1671 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1672 if (currBonus->statBonus == 0)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1673 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1674 *halfSkillBonus = owner->*currBonus->statPtr / 2;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1675 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1676 else
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1677 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1678 if (*additiveBonus < currBonus->statBonus)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1679 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1680 *additiveBonus = currBonus->statBonus;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1681 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1682 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1683 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1684 else
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1685 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1686 *additiveBonus += currBonus->statBonus;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1687 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1688 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1689 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1690
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1691 void ItemGen::GetItemBonusArtifact( Player* owner, CHARACTER_ATTRIBUTE_TYPE attrToGet, int* bonusSum )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1692 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1693 auto bonusList = ItemGen::artifactBonusMap.find(this->uItemID);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1694 if (bonusList == ItemGen::artifactBonusMap.end())
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1695 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1696 return;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1697 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1698 std::map<CHARACTER_ATTRIBUTE_TYPE, CEnchantment*>* currList = bonusList->second;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1699 if (currList->find(attrToGet) != currList->end())
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1700 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1701 CEnchantment* currBonus = (*currList)[attrToGet];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1702 if (currBonus->statPtr != NULL)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1703 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1704 *bonusSum = owner->*currBonus->statPtr / 2;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1705 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1706 else
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1707 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1708 *bonusSum += currBonus->statBonus;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1709 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1710 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1711 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1712
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1713 bool ItemGen::IsRegularEnchanmentForAttribute( CHARACTER_ATTRIBUTE_TYPE attrToGet )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1714 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1715 auto bonusList = ItemGen::specialBonusMap.find(this->uEnchantmentType);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1716 if (bonusList == ItemGen::specialBonusMap.end())
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1717 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1718 return false;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1719 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1720 std::map<CHARACTER_ATTRIBUTE_TYPE, CEnchantment*>* currList = bonusList->second;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1721 return (currList->find(attrToGet) != currList->end());
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1722 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1723
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1724 ITEM_EQUIP_TYPE ItemGen::GetItemEquipType()
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1725 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1726 return pItemsTable->pItems[this->uItemID].uEquipType;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1727 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1728
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1729 unsigned char ItemGen::GetPlayerSkillType()
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1730 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1731 return pItemsTable->pItems[this->uItemID].uSkillType;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1732 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1733
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1734 char* ItemGen::GetIconName()
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1735 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1736 return pItemsTable->pItems[this->uItemID].pIconName;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1737 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1738
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1739 unsigned __int8 ItemGen::GetDamageDice()
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1740 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1741 return pItemsTable->pItems[this->uItemID].uDamageDice;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1742 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1743
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1744 unsigned __int8 ItemGen::GetDamageRoll()
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1745 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1746 return pItemsTable->pItems[this->uItemID].uDamageRoll;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1747 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1748
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1749 unsigned __int8 ItemGen::GetDamageMod()
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1750 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1751 return pItemsTable->pItems[this->uItemID].uDamageMod;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1752 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1753 //----- (004B8E3D) --------------------------------------------------------
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1754 void GenerateStandartShopItems()
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1755 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1756 signed int item_count;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1757 signed int shop_index;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1758 int treasure_lvl;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1759 int item_class;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1760 int mdf;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1761
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1762 shop_index = (signed int)window_SpeakInHouse->ptr_1C;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1763 if ( uItemsAmountPerShopType[p2DEvents[shop_index - 1].uType] )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1764 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1765 for (item_count = 0; item_count < uItemsAmountPerShopType[p2DEvents[shop_index - 1].uType]; ++item_count )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1766 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1767 if (shop_index <= 14) //weapon shop
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1768 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1769 treasure_lvl = shopWeap_variation_ord[shop_index].treasure_level;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1770 item_class = shopWeap_variation_ord[shop_index].item_class[rand() % 4];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1771 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1772 else if (shop_index <= 28) //armor shop
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1773 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1774 mdf = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1775 if (item_count > 3)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1776 ++mdf;// rechek offsets
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1777 treasure_lvl = shopArmr_variation_ord[2*(shop_index - 15) + mdf].treasure_level;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1778 item_class = shopArmr_variation_ord[2*(shop_index - 15) + mdf].item_class[rand() % 4];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1779 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1780 else if (shop_index <= 41) //magic shop
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1781 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1782 treasure_lvl = shopMagic_treasure_lvl[shop_index - 28];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1783 item_class = 22; //misc
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1784 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1785 else if (shop_index <= 53) //alchemist shop
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1786 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1787 if (item_count < 6)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1788 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1789 pParty->StandartItemsInShops[shop_index][item_count].Reset();
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1790 pParty->StandartItemsInShops[shop_index][item_count].uItemID = 220; //potion bottle
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1791 continue;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1792 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1793 else
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1794 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1795 treasure_lvl = shopAlch_treasure_lvl[shop_index - 41];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1796 item_class = 45; //reagent
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1797 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1798 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1799 pItemsTable->GenerateItem(treasure_lvl, item_class, &pParty->StandartItemsInShops[shop_index][item_count]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1800 pParty->StandartItemsInShops[shop_index][item_count].SetIdentified(); //identified
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1801 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1802 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1803 pParty->InTheShopFlags[shop_index] = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1804 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1805
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1806 //----- (004B8F94) --------------------------------------------------------
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1807 void GenerateSpecialShopItems()
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1808 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1809 signed int item_count;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1810 signed int shop_index;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1811 int treasure_lvl;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1812 int item_class;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1813 int mdf;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1814
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1815 shop_index = (signed int)window_SpeakInHouse->ptr_1C;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1816 if ( uItemsAmountPerShopType[p2DEvents[shop_index - 1].uType] )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1817 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1818 for ( item_count = 0; item_count < uItemsAmountPerShopType[p2DEvents[shop_index - 1].uType]; ++item_count )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1819 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1820 if (shop_index <= 14) //weapon shop
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1821 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1822 treasure_lvl = shopWeap_variation_spc[shop_index].treasure_level;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1823 item_class = shopWeap_variation_spc[shop_index].item_class[rand() % 4];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1824 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1825 else if (shop_index <= 28) //armor shop
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1826 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1827 mdf = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1828 if (item_count > 3)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1829 ++mdf;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1830 treasure_lvl = shopArmr_variation_spc[2*(shop_index - 15) + mdf].treasure_level;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1831 item_class = shopArmr_variation_spc[2*(shop_index - 15) + mdf].item_class[rand() % 4];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1832 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1833 else if (shop_index <= 41) //magic shop
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1834 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1835 treasure_lvl = shopMagicSpc_treasure_lvl[shop_index - 28];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1836 item_class = 22; //misc
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1837 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1838 else if (shop_index <= 53) //alchemist shop
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1839 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1840 if (item_count < 6)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1841 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1842 pParty->SpecialItemsInShops[shop_index][item_count].Reset();
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1843 pParty->SpecialItemsInShops[shop_index][item_count].uItemID = rand() % 32 + 740; //mscrool
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1844 continue;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1845 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1846 else
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1847 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1848 treasure_lvl = shopAlchSpc_treasure_lvl[shop_index - 41];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1849 item_class = 44; //potion
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1850 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1851 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1852 pItemsTable->GenerateItem(treasure_lvl, item_class, &pParty->SpecialItemsInShops[shop_index][item_count]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1853 pParty->SpecialItemsInShops[shop_index][item_count].SetIdentified(); //identified
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1854 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1855 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1856 pParty->InTheShopFlags[shop_index] = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1857 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1858
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1859
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1860 //----- (00450218) --------------------------------------------------------
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1861 void GenerateItemsInChest()
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1862 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1863 unsigned int mapType; // eax@1
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1864 MapInfo *currMapInfo; // esi@1
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1865 ItemGen *currItem; // ebx@2
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1866 int additionaItemCount; // ebp@4
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1867 int treasureLevelBot; // edi@4
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1868 int treasureLevelTop; // esi@4
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1869 signed int treasureLevelRange; // esi@4
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1870 int resultTreasureLevel; // edx@4
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1871 int goldAmount; // esi@8
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1872 int v11; // ebp@25
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1873 int v12; // esi@25
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1874 signed int whatToGenerateProb; // [sp+10h] [bp-18h]@1
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1875
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1876 mapType = pMapStats->GetMapInfo(pCurrentMapName);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1877 currMapInfo = &pMapStats->pInfos[mapType];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1878 for(int i=1; i<20;++i)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1879 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1880 for(int j=0; j<140;++j)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1881 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1882
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1883 currItem = &pChests[i].igChestItems[j];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1884 if ( currItem->uItemID < 0 )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1885 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1886 additionaItemCount = rand() % 5; //additional items in chect
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1887 treasureLevelBot = byte_4E8168[abs(currItem->uItemID)-1][2*currMapInfo->Treasure_prob];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1888 treasureLevelTop = byte_4E8168[abs(currItem->uItemID)-1][2*currMapInfo->Treasure_prob+1];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1889 treasureLevelRange = treasureLevelTop - treasureLevelBot + 1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1890 resultTreasureLevel = treasureLevelBot + rand() % treasureLevelRange; //treasure level
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1891 if (resultTreasureLevel<7)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1892 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1893 v11 = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1894 do
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1895 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1896 whatToGenerateProb = rand() % 100;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1897 if (whatToGenerateProb<20)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1898 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1899 currItem->Reset();
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1900 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1901 else if (whatToGenerateProb<60) //generate gold
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1902 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1903 goldAmount=0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1904 currItem->Reset();
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1905 switch (resultTreasureLevel)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1906 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1907 case 1: //small gold
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1908 goldAmount = rand() % 51 + 50;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1909 currItem->uItemID = 197;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1910 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1911 case 2://small gold
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1912 goldAmount = rand() % 101 + 100;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1913 currItem->uItemID = 197;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1914 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1915 case 3: //medium
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1916 goldAmount = rand() % 301 + 200;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1917 currItem->uItemID = 198;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1918 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1919 case 4: //medium
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1920 goldAmount = rand() % 501 + 500;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1921 currItem->uItemID = 198;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1922 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1923 case 5: //big
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1924 goldAmount = rand() % 1001 + 1000;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1925 currItem->uItemID = 199;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1926 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1927 case 6: //big
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1928 goldAmount = rand() % 3001 + 2000;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1929 currItem->uItemID = 199;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1930 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1931 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1932 currItem->SetIdentified();
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1933 currItem->uSpecEnchantmentType = goldAmount;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1934 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1935 else
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1936 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1937 pItemsTable->GenerateItem(resultTreasureLevel, 0, currItem);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1938 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1939 v12 = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1940 while ( !(pChests[i].igChestItems[v12].uItemID==0) &&(v12<140))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1941 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1942 ++v12;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1943 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1944 if (v12 >= 140)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1945 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1946 currItem=&pChests[i].igChestItems[v12];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1947 v11++;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1948 } while (v11 < additionaItemCount + 1); // + 1 because it's the item at pChests[i].igChestItems[j] and the additional ones
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1949 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1950 else
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1951 currItem->GenerateArtifact();
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1952 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1953 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1954 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1955
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1956 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1957
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1958
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1959
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1960
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1961 // 4505CC: using guessed type int var_A0[32];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1962 //----- (004B3703) --------------------------------------------------------
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1963 void FillAviableSkillsToTeach( int _this )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1964 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1965 const char *v30; // ecx@65
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1966 unsigned int v29; // edx@56
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1967 int v15; // ecx@19
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1968 int v33; // [sp-4h] [bp-2Ch]@23
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1969 int v34; // [sp-4h] [bp-2Ch]@43
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1970 int v21; // ecx@34
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1971 int v35[5]; // [sp+Ch] [bp-1Ch]@8
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1972 int v37=0; // [sp+24h] [bp-4h]@1*
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1973 int i=0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1974
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1975 dword_F8B1DC_currentShopOption = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1976
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1977 switch (_this)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1978 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1979 case 1: //shop weapon
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1980 for (int i=0; i<2; ++i)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1981 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1982 for (int j=0; j<4; ++j)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1983 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1984 if ( i )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1985 v21 = shopWeap_variation_spc[(unsigned int)window_SpeakInHouse->ptr_1C].item_class[j];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1986 else
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1987 v21 = shopWeap_variation_ord[(unsigned int)window_SpeakInHouse->ptr_1C].item_class[j];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1988
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1989 switch (v21)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1990 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1991 case 23: v34 = 37; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1992 case 24: v34 = 38; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1993 case 25: v34 = 39; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1994 case 26: v34 = 40; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1995 case 27: v34 = 41; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1996 case 28: v34 = 42; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1997 case 30: v34 = 36; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1998 default:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1999 continue;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2000 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2001 v37 = sub_4BE571_AddItemToSet(v34, v35, v37, 5);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2002 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2003 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2004 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2005 case 2: //shop armor
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2006
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2007 for (int i=0; i<2; ++i)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2008 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2009 for (int j=0; j<2; ++j)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2010 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2011 for (int k=0; k<4; ++k)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2012 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2013 if ( i )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2014 v15 = shopArmr_variation_spc[(unsigned int)window_SpeakInHouse->ptr_1C-15+j].item_class[k];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2015 else
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2016 v15 = shopArmr_variation_ord[(unsigned int)window_SpeakInHouse->ptr_1C-15+j].item_class[k];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2017 switch (v15)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2018 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2019 case 31: v33 = 45; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2020 case 32: v33 = 46; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2021 case 33: v33 = 47; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2022 case 34: v33 = 44; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2023 default:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2024 continue;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2025 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2026 v37 = sub_4BE571_AddItemToSet(v33, v35, v37, 5);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2027 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2028 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2029 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2030 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2031 case 3: //shop magic
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2032 v37 = 2;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2033 v35[0] = 57;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2034 v35[1] = 59;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2035 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2036 case 4: //shop alchemist
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2037 v37 = 2;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2038 v35[0] = 71;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2039 v35[1] = 68;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2040 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2041 case 21: //tavern
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2042 v37 = 3;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2043 v35[0] = 70;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2044 v35[1] = 65;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2045 v35[2] = 62;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2046 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2047 case 23: //temple
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2048 v37 = 3;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2049 v35[0] = 67;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2050 v35[1] = 66;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2051 v35[2] = 58;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2052 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2053 case 30: ///trainig
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2054 v37 = 2;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2055 v35[0] = 69;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2056 v35[1] = 60;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2057 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2058 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2059 for(i=0;i<v37;++i)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2060 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2061 v29=v35[i];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2062 switch(v29)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2063 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2064 case 40 :v30 = pSkillNames[4]; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2065 case 5 : v30 = pSkillNames[23]; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2066 case 36 :v30 = pSkillNames[0]; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2067 case 37 :v30 = pSkillNames[1]; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2068 case 38 :v30 = pSkillNames[2]; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2069 case 39 :v30 = pSkillNames[3]; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2070 case 41 :v30 = pSkillNames[5]; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2071 case 42 :v30 = pSkillNames[6]; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2072 case 44 :v30 = pSkillNames[8]; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2073 case 45 :v30 = pSkillNames[9]; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2074 case 46 :v30 = pSkillNames[10]; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2075 case 47 :v30 = pSkillNames[11]; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2076 case 66 :v30 = pSkillNames[30]; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2077 case 57 :v30 = pSkillNames[21]; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2078 case 58 :v30 = pSkillNames[22]; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2079 case 60 :v30 = pSkillNames[24]; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2080 case 62 :v30 = pSkillNames[26]; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2081 case 65 :v30 = pSkillNames[29]; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2082 case 67:v30 = pSkillNames[31]; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2083 case 68:v30 = pSkillNames[32]; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2084 case 69:v30 = pSkillNames[33]; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2085 case 70:v30 = pSkillNames[34]; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2086 case 71:v30 = pSkillNames[35]; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2087 default:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2088 v30 = pGlobalTXT_LocalizationStrings[127]; //"No Text!"
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2089 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2090 pShopOptions[dword_F8B1DC_currentShopOption] = const_cast<char *>(v30);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2091 ++dword_F8B1DC_currentShopOption;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2092 CreateButtonInColumn(i+1, v29);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2093 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2094 pDialogueWindow->_41D08F_set_keyboard_control_group(i, 1, 0, 2);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2095 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2096 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2097
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2098 //----- (004BE571) --------------------------------------------------------
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2099 int sub_4BE571_AddItemToSet(int valueToAdd, int *outPutSet, int elemsAlreadyPresent, int elemsNeeded)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2100 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2101 int i; // esi@3
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2102
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2103 if ( elemsAlreadyPresent < elemsNeeded )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2104 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2105 for ( i = 0; i < elemsAlreadyPresent; ++i )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2106 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2107 if ( valueToAdd == outPutSet[i] )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2108 return elemsAlreadyPresent;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2109 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2110 outPutSet[elemsAlreadyPresent] = valueToAdd;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2111 return elemsAlreadyPresent + 1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2112 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2113 return elemsNeeded;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2114 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2115 //----- (0043C91D) --------------------------------------------------------
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2116 int GetItemTextureFilename(char *pOut, signed int item_id, int index, int shoulder)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2117 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2118 int result; // eax@2
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2119 ITEM_EQUIP_TYPE pEquipType;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2120
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2121 result = 0; //BUG fn is void
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2122 pEquipType = pItemsTable->pItems[item_id].uEquipType;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2123 if ( item_id > 500 )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2124 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2125 switch ( item_id )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2126 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2127 case ITEM_RELIC_HARECS_LEATHER:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2128 if (byte_5111F6_OwnedArtifacts[2] != 0)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2129 item_id = 234;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2130 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2131 case ITEM_ARTIFACT_YORUBA:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2132 if (byte_5111F6_OwnedArtifacts[1] != 0)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2133 item_id = 236;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2134 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2135 case ITEM_ARTIFACT_GOVERNORS_ARMOR:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2136 if (byte_5111F6_OwnedArtifacts[0] != 0)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2137 item_id = 235;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2138 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2139 case ITEM_ELVEN_CHAINMAIL:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2140 if (byte_5111F6_OwnedArtifacts[16] != 0)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2141 item_id = 73;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2142 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2143 case ITEM_ARTIFACT_LEAGUE_BOOTS:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2144 if (byte_5111F6_OwnedArtifacts[3] != 0)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2145 item_id = 312;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2146 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2147 case ITEM_RELIC_TALEDONS_HELM:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2148 if (byte_5111F6_OwnedArtifacts[4] != 0)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2149 item_id = 239;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2150 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2151 case ITEM_RELIC_SCHOLARS_CAP:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2152 if (byte_5111F6_OwnedArtifacts[5] != 0)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2153 item_id = 240;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2154 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2155 case ITEM_RELIC_PHYNAXIAN_CROWN:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2156 if (byte_5111F6_OwnedArtifacts[6] != 0)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2157 item_id = 241;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2158 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2159 case ITEM_ARTIFACT_MINDS_EYE:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2160 if (byte_5111F6_OwnedArtifacts[7] != 0)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2161 item_id = 93;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2162 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2163 case ITEM_RARE_SHADOWS_MASK:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2164 if (byte_5111F6_OwnedArtifacts[8] != 0)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2165 item_id = 344;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2166 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2167 case ITEM_RILIC_TITANS_BELT:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2168 if (byte_5111F6_OwnedArtifacts[9] != 0)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2169 item_id = 324;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2170 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2171 case ITEM_ARTIFACT_HEROS_BELT:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2172 if (byte_5111F6_OwnedArtifacts[10] != 0)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2173 item_id = 104;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2174 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2175 case ITEM_RELIC_TWILIGHT:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2176 if (byte_5111F6_OwnedArtifacts[11] != 0)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2177 item_id = 325;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2178 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2179 case ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2180 if (byte_5111F6_OwnedArtifacts[12] != 0)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2181 item_id = 330;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2182 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2183 case ITEM_RARE_SUN_CLOAK:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2184 if (byte_5111F6_OwnedArtifacts[13] != 0)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2185 item_id = 347;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2186 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2187 case ITEM_RARE_MOON_CLOAK:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2188 if (byte_5111F6_OwnedArtifacts[14] != 0)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2189 item_id = 348;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2190 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2191 case ITEM_RARE_VAMPIRES_CAPE:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2192 if (byte_5111F6_OwnedArtifacts[15] != 0)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2193 item_id = 350;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2194 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2195 default:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2196 return 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2197 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2198 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2199
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2200 switch (pEquipType)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2201 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2202 case EQUIP_ARMOUR:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2203 if ( !shoulder )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2204 return sprintf(pOut, "item%3.3dv%d", item_id, index);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2205 else if ( shoulder == 1 )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2206 return sprintf(pOut, "item%3.3dv%da1", item_id, index);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2207 else if ( shoulder == 2 )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2208 return sprintf(pOut, "item%3.3dv%da2", item_id, index);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2209 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2210 case EQUIP_CLOAK:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2211 if ( !shoulder )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2212 return sprintf(pOut, "item%3.3dv%d", item_id, index);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2213 else
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2214 return sprintf(pOut, "item%3.3dv%da1", item_id, index);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2215 default:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2216 return sprintf(pOut, "item%3.3dv%d", item_id, index);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2217 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2218
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2219 result = item_id - 504;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2220 return result;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2221 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2222
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2223
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2224 //----- (004BDAAF) --------------------------------------------------------
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2225 bool ItemGen::MerchandiseTest(int _2da_idx)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2226 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2227 bool test;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2228
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2229 if ( (p2DEvents[_2da_idx - 1].uType != 4 || (signed int)this->uItemID < 740 || (signed int)this->uItemID > 771)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2230 && ((signed int)this->uItemID >= 600 || (signed int)this->uItemID >= 529 && (signed int)this->uItemID <= 599) || this->IsStolen())
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2231 return false;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2232 switch( p2DEvents[_2da_idx - 1].uType )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2233 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2234 case BuildingType_WeaponShop:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2235 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2236 test = this->GetItemEquipType() <= EQUIP_BOW;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2237 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2238 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2239 case BuildingType_ArmorShop:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2240 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2241 test = this->GetItemEquipType() >= EQUIP_ARMOUR && this->GetItemEquipType() <= EQUIP_BOOTS;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2242 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2243 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2244 case BuildingType_MagicShop:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2245 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2246 test = this->GetPlayerSkillType() == PLAYER_SKILL_MISC || this->GetItemEquipType() == EQIUP_ANY;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2247 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2248 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2249 case BuildingType_AlchemistShop:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2250 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2251 test = this->GetItemEquipType() == EQUIP_REAGENT || this->GetItemEquipType() == EQUIP_POTION
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2252 || (this->GetItemEquipType() > EQUIP_POTION && !(this->GetItemEquipType() != EQUIP_MESSAGE_SCROLL
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2253 || (signed int)this->uItemID < 740) && this->uItemID != 771);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2254 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2255 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2256 default:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2257 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2258 test = false;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2259 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2260 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2261 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2262 return test;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2263 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2264
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2265 //----- (00493F79) --------------------------------------------------------
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2266 void init_summoned_item(stru351_summoned_item *_this, __int64 duration)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2267 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2268 signed __int64 v2; // ST2C_8@1
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2269 signed __int64 v3; // qax@1
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2270 //signed __int64 v4; // ST1C_8@1
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2271 unsigned __int64 v5; // qax@1
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2272 unsigned int v6; // ebx@1
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2273
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2274 v2 = (signed __int64)((double)duration * 0.234375);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2275 v3 = v2 / 60 / 60;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2276 //v4 = v3;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2277 v5 = (unsigned int)v3 / 0x18;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2278 v6 = (unsigned int)(v5 / 7) >> 2;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2279 _this->field_0_expire_second = v2 % 60;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2280 _this->field_4_expire_minute = v2 / 60 % 60;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2281 _this->field_8_expire_hour = v3 % 24;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2282 _this->field_10_expire_week = v5 / 7 & 3;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2283 _this->field_C_expire_day = (unsigned int)v5 % 0x1C;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2284 _this->field_14_exprie_month = v6 % 0xC;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2285 _this->field_18_expire_year = v6 / 0xC + game_starting_year;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2286 }