annotate Items.cpp @ 1578:56cc81b1ed49

workaround for crash on startup fixes for logs
author Beri Levi berilevi@gmail.com
date Tue, 10 Sep 2013 19:33:21 +0300
parents 9f8b3e904e14
children 75fafd8ced59 bb2378f58767
rev   line source
1165
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1104
diff changeset
1 #ifdef _MSC_VER
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1104
diff changeset
2 #define _CRT_SECURE_NO_WARNINGS
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1104
diff changeset
3 #endif
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1104
diff changeset
4
0
Ritor1
parents:
diff changeset
5 #include <stdlib.h>
Ritor1
parents:
diff changeset
6
Ritor1
parents:
diff changeset
7 #include "Items.h"
Ritor1
parents:
diff changeset
8 #include "MapInfo.h"
Ritor1
parents:
diff changeset
9 #include "Allocator.h"
461
197461e5acec moved shop generators to item.cpp
Gloval
parents: 436
diff changeset
10 #include "GUIWindow.h"
197461e5acec moved shop generators to item.cpp
Gloval
parents: 436
diff changeset
11 #include "Events2D.h"
197461e5acec moved shop generators to item.cpp
Gloval
parents: 436
diff changeset
12 #include "Chest.h"
0
Ritor1
parents:
diff changeset
13 #include "LOD.h"
Ritor1
parents:
diff changeset
14 #include "Monsters.h"
Ritor1
parents:
diff changeset
15 #include "Party.h"
Ritor1
parents:
diff changeset
16 #include "FactionTable.h"
Ritor1
parents:
diff changeset
17 #include "StorylineTextTable.h"
189
038a4d09406f new texts file, fix text rendender error
Gloval
parents: 0
diff changeset
18 #include "texts.h"
0
Ritor1
parents:
diff changeset
19 #include "mm7_data.h"
Ritor1
parents:
diff changeset
20
Ritor1
parents:
diff changeset
21
Ritor1
parents:
diff changeset
22
463
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
23 struct ITEM_VARIATION
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
24 {
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
25 unsigned __int16 treasure_level;
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
26 unsigned __int16 item_class[4];
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
27 };
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
28
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
29
1202
0dbf6c4dd029 arrays to std::arrays phase 1
Grumpy7
parents: 1165
diff changeset
30 std::array<const char, 5> uItemsAmountPerShopType={ 0, 6, 8, 12, 12};
463
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
31
526
214d9d47cf1f Chest working, but items are not laid correctly
Gloval
parents: 484
diff changeset
32 const ITEM_VARIATION shopWeap_variation_ord[15] ={
463
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
33 { 0, { 0, 0, 0, 0 }},
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
34 { 1, { 23, 27, 20, 20 }},
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
35 { 1, { 23, 24, 28, 20 }},
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
36 { 2, { 23, 24, 25, 20 }},
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
37 { 2, { 27, 27, 26, 26 }},
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
38 { 4, { 24, 30, 25, 27 }},
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
39 { 4, { 24, 30, 25, 27 }},
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
40 { 3, { 30, 24, 20, 20 }},
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
41 { 2, { 20, 20, 20, 20 }},
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
42 { 3, { 27, 27, 26, 26 }},
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
43 { 3, { 28, 28, 25, 25 }},
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
44 { 2, { 23, 23, 24, 24 }},
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
45 { 3, { 23, 23, 26, 26 }},
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
46 { 2, { 30, 26, 26, 26 }},
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
47 { 2, { 28, 25, 28, 29 }}};
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
48
526
214d9d47cf1f Chest working, but items are not laid correctly
Gloval
parents: 484
diff changeset
49 const ITEM_VARIATION shopArmr_variation_ord[28] ={
463
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
50 { 1, { 35, 35, 38, 38 }},
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
51 { 1, { 31, 31, 31, 34 }},
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
52 { 1, { 35, 35, 38, 38 }},
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
53 { 1, { 31, 31, 32, 34 }},
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
54 { 2, { 35, 35, 38, 38 }},
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
55 { 2, { 31, 32, 32, 33 }},
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
56 { 2, { 35, 35, 38, 38 }},
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
57 { 2, { 31, 31, 32, 32 }},
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
58 { 4, { 35, 35, 38, 38 }},
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
59 { 4, { 31, 32, 33, 34 }},
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
60 { 4, { 35, 35, 38, 38 }},
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
61 { 4, { 31, 32, 33, 34 }},
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
62 { 3, { 35, 35, 38, 38 }},
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
63 { 3, { 31, 31, 31, 31 }},
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
64 { 2, { 35, 35, 38, 38 }},
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
65 { 2, { 31, 32, 34, 34 }},
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
66 { 3, { 35, 35, 38, 38 }},
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
67 { 3, { 31, 31, 32, 32 }},
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
68 { 3, { 35, 35, 38, 38 }},
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
69 { 3, { 32, 32, 32, 33 }},
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
70 { 3, { 35, 35, 38, 38 }},
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
71 { 3, { 31, 31, 31, 32 }},
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
72 { 3, { 35, 35, 38, 38 }},
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
73 { 3, { 33, 31, 32, 34 }},
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
74 { 3, { 35, 35, 38, 38 }},
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
75 { 3, { 33, 31, 32, 34 }},
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
76 { 4, { 35, 35, 38, 38 }},
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
77 { 4, { 33, 31, 32, 34 }}};
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
78
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
79
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
80
526
214d9d47cf1f Chest working, but items are not laid correctly
Gloval
parents: 484
diff changeset
81 const unsigned __int16 shopMagic_treasure_lvl[14]= {0, 1, 1, 2, 2, 4, 4, 3, 2, 2, 2, 2, 2, 2};
214d9d47cf1f Chest working, but items are not laid correctly
Gloval
parents: 484
diff changeset
82 const unsigned __int16 shopAlch_treasure_lvl[13] = {0, 1, 1, 2, 2, 3, 3, 4, 4, 2, 2, 2, 2};
463
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
83
526
214d9d47cf1f Chest working, but items are not laid correctly
Gloval
parents: 484
diff changeset
84 const ITEM_VARIATION shopWeap_variation_spc[15]={
463
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
85 { 0, { 0, 0, 0, 0 }},
470
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
86 { 2, { 25, 30, 20, 20}},
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
87 { 2, { 23, 24, 28, 20}},
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
88 { 3, { 23, 24, 25, 20}},
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
89 { 3, { 27, 27, 26, 26}},
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
90 { 5, { 23, 26, 28, 27}},
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
91 { 5, { 23, 26, 28, 27}},
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
92 { 4, { 30, 24, 20, 20}},
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
93 { 3, { 20, 20, 20, 20}},
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
94 { 4, { 27, 27, 26, 26}},
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
95 { 4, { 28, 28, 25, 25}},
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
96 { 4, { 23, 23, 24, 24}},
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
97 { 4, { 24, 24, 27, 20}},
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
98 { 4, { 30, 26, 26, 26}},
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
99 { 4, { 28, 25, 28, 29}}};
463
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
100
526
214d9d47cf1f Chest working, but items are not laid correctly
Gloval
parents: 484
diff changeset
101 const ITEM_VARIATION shopArmr_variation_spc[28]={
470
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
102 { 2, { 35, 35, 38, 38 }},
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
103 { 2, { 31, 31, 31, 34 }},
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
104 { 2, { 35, 35, 38, 38 }},
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
105 { 2, { 31, 31, 32, 34 }},
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
106 { 3, { 35, 35, 38, 38 }},
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
107 { 3, { 31, 32, 32, 33 }},
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
108 { 3, { 35, 35, 38, 38 }},
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
109 { 3, { 31, 31, 32, 32 }},
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
110 { 5, { 35, 35, 38, 38 }},
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
111 { 5, { 31, 32, 33, 34 }},
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
112 { 5, { 35, 35, 38, 38 }},
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
113 { 5, { 31, 32, 33, 34 }},
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
114 { 4, { 35, 35, 38, 38 }},
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
115 { 4, { 31, 31, 31, 31 }},
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
116 { 3, { 35, 35, 38, 38 }},
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
117 { 3, { 31, 32, 34, 34 }},
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
118 { 4, { 35, 35, 38, 38 }},
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
119 { 4, { 31, 31, 32, 33 }},
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
120 { 4, { 35, 35, 38, 38 }},
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
121 { 4, { 32, 32, 33, 34 }},
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
122 { 4, { 35, 35, 38, 38 }},
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
123 { 4, { 31, 31, 31, 32 }},
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
124 { 4, { 35, 35, 38, 38 }},
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
125 { 4, { 32, 32, 32, 32 }},
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
126 { 4, { 35, 35, 38, 38 }},
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
127 { 4, { 34, 34, 34, 34 }},
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
128 { 5, { 35, 35, 38, 38 }},
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
129 { 5, { 33, 33, 33, 33 }}
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
130 };
463
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
131
526
214d9d47cf1f Chest working, but items are not laid correctly
Gloval
parents: 484
diff changeset
132 const unsigned __int16 shopMagicSpc_treasure_lvl[14] = {0, 2, 2, 3, 3, 5, 5, 4, 3, 3, 3, 3, 3, 3};
214d9d47cf1f Chest working, but items are not laid correctly
Gloval
parents: 484
diff changeset
133 const unsigned __int16 shopAlchSpc_treasure_lvl[13] = {0, 2, 2, 3, 3, 4, 4, 5, 5, 3, 2, 2, 2};
214d9d47cf1f Chest working, but items are not laid correctly
Gloval
parents: 484
diff changeset
134
214d9d47cf1f Chest working, but items are not laid correctly
Gloval
parents: 484
diff changeset
135
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
136 std::array< std::array<char, 14>, 7> byte_4E8168={{ //byte_4E8178
526
214d9d47cf1f Chest working, but items are not laid correctly
Gloval
parents: 484
diff changeset
137 { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
214d9d47cf1f Chest working, but items are not laid correctly
Gloval
parents: 484
diff changeset
138 { 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2},
214d9d47cf1f Chest working, but items are not laid correctly
Gloval
parents: 484
diff changeset
139 { 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3},
214d9d47cf1f Chest working, but items are not laid correctly
Gloval
parents: 484
diff changeset
140 { 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4},
214d9d47cf1f Chest working, but items are not laid correctly
Gloval
parents: 484
diff changeset
141 { 2, 2, 2, 2, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5},
214d9d47cf1f Chest working, but items are not laid correctly
Gloval
parents: 484
diff changeset
142 { 2, 2, 2, 2, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6},
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
143 { 2, 2, 2, 2, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}}};
0
Ritor1
parents:
diff changeset
144
475
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
145 int sub_4BE571(int a1, int *a2, int a3, int a4);
0
Ritor1
parents:
diff changeset
146
Ritor1
parents:
diff changeset
147 ItemGen *ptr_50C9A4;
Ritor1
parents:
diff changeset
148
315
2a09e1d6fc8f Some 0041D895 GameUI_DrawItemInfo overhaul
Nomad
parents: 296
diff changeset
149 struct ItemsTable *pItemsTable; // 005D29E0
0
Ritor1
parents:
diff changeset
150
Ritor1
parents:
diff changeset
151
Ritor1
parents:
diff changeset
152
Ritor1
parents:
diff changeset
153
Ritor1
parents:
diff changeset
154
Ritor1
parents:
diff changeset
155 //----- (00439DF3) --------------------------------------------------------
385
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
156 int ItemGen::_439DF3_get_additional_damage(int *damage_type, bool *draintargetHP)
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
157 {
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
158 *damage_type = 0;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
159 if ( !uItemID )
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
160 return 0;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
161 UpdateTempBonus(pParty->uTimePlayed);
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
162 if (uItemID == 501 ) //Iron Feather -sword
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
163 {
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
164 *damage_type = 1;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
165 return rand() % 10 + 6;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
166 }
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
167 if (uItemID == 507 ) //Ghoulsbane -axe
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
168 {
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
169 *damage_type = 0;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
170 return rand() % 16 + 3;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
171 }
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
172 if ( uItemID == 510 ) //Ullyses -bow
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
173 {
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
174 *damage_type = 2;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
175 return rand() % 4 + 9;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
176 }
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
177 if ( uItemID == 517 ) //Old Nick -dagger
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
178 {
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
179 *damage_type = 8;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
180 return 8;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
181 }
0
Ritor1
parents:
diff changeset
182
385
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
183 switch (uSpecEnchantmentType)
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
184 {
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
185 case 4: //Adds 3-4 points of Cold damage.
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
186 *damage_type = 2;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
187 return rand() % 2 + 3;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
188 break;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
189 case 5: //Adds 6-8 points of Cold damage.
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
190 *damage_type = 2;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
191 return rand() % 3 + 6;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
192 break;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
193 case 6: //Adds 9-12 points of Cold damage.
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
194 *damage_type = 2;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
195 return rand() % 4 + 9;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
196 break;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
197 case 7: //Adds 2-5 points of Electrical damage.
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
198 *damage_type = 1;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
199 return rand() % 4 + 2;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
200 break;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
201 case 8: //Adds 4-10 points of Electrical damage.
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
202 *damage_type = 1;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
203 return rand() % 7 + 4;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
204 break;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
205 case 9: //Adds 6-15 points of Electrical damage.
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
206 *damage_type = 1;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
207 return rand() % 10 + 6;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
208 break;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
209 case 10: //Adds 1-6 points of Fire damage.
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
210 *damage_type = 0;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
211 return GetDiceResult(1, 6);
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
212 break;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
213 case 11: //Adds 2-12 points of Fire damage.
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
214 *damage_type = 0;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
215 return GetDiceResult(2, 6);
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
216 break;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
217 case 12: //Adds 3-18 points of Fire damage.
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
218 *damage_type = 0;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
219 return GetDiceResult(3, 6);
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
220 break;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
221 case 13: //Adds 5 points of Body damage.
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
222 *damage_type = 8;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
223 return 5;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
224 break;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
225 case 14: //Adds 8 points of Body damage.
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
226 *damage_type = 8;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
227 return 8;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
228 break;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
229 case 15: //Adds 12 points of Body damage.
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
230 *damage_type = 8;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
231 return 12;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
232 break;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
233 case 16: //Drain Hit Points from target.
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
234 case 41: //Drain Hit Points from target and Increased Weapon speed.
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
235 *damage_type = 10;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
236 *draintargetHP = true;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
237 return 0;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
238 break;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
239 case 46: //Adds 10-20 points of Fire damage and +25 Might.
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
240 *damage_type = 0;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
241 return rand() % 11 + 10;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
242 break;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
243 default:
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
244 *damage_type = 0;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
245 return 0;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
246
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
247 }
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
248
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
249 }
0
Ritor1
parents:
diff changeset
250
Ritor1
parents:
diff changeset
251
Ritor1
parents:
diff changeset
252 //----- (00402F07) --------------------------------------------------------
Ritor1
parents:
diff changeset
253 void ItemGen::Reset()
Ritor1
parents:
diff changeset
254 {
377
243418228760 GetIdentifiedName
Gloval
parents: 375
diff changeset
255 this->uHolderPlayer = 0;
0
Ritor1
parents:
diff changeset
256 this->uAttributes = 0;
Ritor1
parents:
diff changeset
257 this->uNumCharges = 0;
377
243418228760 GetIdentifiedName
Gloval
parents: 375
diff changeset
258 this->uSpecEnchantmentType = 0;
0
Ritor1
parents:
diff changeset
259 this->_bonus_strength = 0;
570
f54481c85df8 itemgen working, i hope
Gloval
parents: 559
diff changeset
260 this->uEnchantmentType = 0;
0
Ritor1
parents:
diff changeset
261 this->uItemID = 0;
Ritor1
parents:
diff changeset
262 this->uBodyAnchor = 0;
Ritor1
parents:
diff changeset
263 this->uExpireTime = 0i64;
Ritor1
parents:
diff changeset
264 }
Ritor1
parents:
diff changeset
265
Ritor1
parents:
diff changeset
266 //----- (00458260) --------------------------------------------------------
Ritor1
parents:
diff changeset
267 void ItemGen::UpdateTempBonus(__int64 uTimePlayed)
Ritor1
parents:
diff changeset
268 {
463
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
269 if ( this->uAttributes & ITEM_TEMP_BONUS )
0
Ritor1
parents:
diff changeset
270 {
Ritor1
parents:
diff changeset
271 if ( uTimePlayed > (signed __int64)this->uExpireTime )
Ritor1
parents:
diff changeset
272 {
570
f54481c85df8 itemgen working, i hope
Gloval
parents: 559
diff changeset
273 this->uEnchantmentType = 0;
377
243418228760 GetIdentifiedName
Gloval
parents: 375
diff changeset
274 this->uSpecEnchantmentType = 0;
463
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
275 this->uAttributes = this->uAttributes&(~ITEM_TEMP_BONUS);
0
Ritor1
parents:
diff changeset
276 }
Ritor1
parents:
diff changeset
277 }
Ritor1
parents:
diff changeset
278 }
Ritor1
parents:
diff changeset
279
Ritor1
parents:
diff changeset
280 //----- (0045814E) --------------------------------------------------------
374
Gloval
parents: 365
diff changeset
281 void ItemsTable::Release()
0
Ritor1
parents:
diff changeset
282 {
Ritor1
parents:
diff changeset
283 if ( pMonstersTXT_Raw )
Ritor1
parents:
diff changeset
284 pAllocator->FreeChunk(pMonstersTXT_Raw);
Ritor1
parents:
diff changeset
285 if ( pMonsterPlacementTXT_Raw )
Ritor1
parents:
diff changeset
286 pAllocator->FreeChunk(pMonsterPlacementTXT_Raw);
Ritor1
parents:
diff changeset
287 if ( pSkillDescTXT_Raw )
Ritor1
parents:
diff changeset
288 pAllocator->FreeChunk(pSkillDescTXT_Raw);
374
Gloval
parents: 365
diff changeset
289 if (pSpcItemsTXT_Raw )
Gloval
parents: 365
diff changeset
290 pAllocator->FreeChunk(pSpcItemsTXT_Raw);
Gloval
parents: 365
diff changeset
291 if ( pStdItemsTXT_Raw )
Gloval
parents: 365
diff changeset
292 pAllocator->FreeChunk(pStdItemsTXT_Raw);
Gloval
parents: 365
diff changeset
293 if ( pRndItemsTXT_Raw )
Gloval
parents: 365
diff changeset
294 pAllocator->FreeChunk(pRndItemsTXT_Raw);
Gloval
parents: 365
diff changeset
295 if ( pItemsTXT_Raw )
Gloval
parents: 365
diff changeset
296 pAllocator->FreeChunk(pItemsTXT_Raw);
0
Ritor1
parents:
diff changeset
297 if ( pHostileTXT_Raw )
Ritor1
parents:
diff changeset
298 pAllocator->FreeChunk(pHostileTXT_Raw);
Ritor1
parents:
diff changeset
299 if ( pHistoryTXT_Raw )
Ritor1
parents:
diff changeset
300 pAllocator->FreeChunk(pHistoryTXT_Raw);
Ritor1
parents:
diff changeset
301 if ( pPotionsTXT_Raw )
Ritor1
parents:
diff changeset
302 pAllocator->FreeChunk(pPotionsTXT_Raw);
Ritor1
parents:
diff changeset
303 if ( pPotionNotesTXT_Raw )
Ritor1
parents:
diff changeset
304 pAllocator->FreeChunk(pPotionNotesTXT_Raw);
374
Gloval
parents: 365
diff changeset
305 pSpcItemsTXT_Raw = NULL;
Gloval
parents: 365
diff changeset
306 pSkillDescTXT_Raw = NULL;
Gloval
parents: 365
diff changeset
307 pStdItemsTXT_Raw = NULL;
Gloval
parents: 365
diff changeset
308 pRndItemsTXT_Raw = NULL;
Gloval
parents: 365
diff changeset
309 pItemsTXT_Raw = NULL;
0
Ritor1
parents:
diff changeset
310 }
Ritor1
parents:
diff changeset
311
1082
Gloval
parents: 1018
diff changeset
312
0
Ritor1
parents:
diff changeset
313 //----- (00456D84) --------------------------------------------------------
Ritor1
parents:
diff changeset
314 void ItemsTable::Initialize()
224
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
315 {
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
316 int i,j;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
317 char* test_string;
229
Gloval
parents: 224
diff changeset
318 unsigned char c;
224
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
319 bool break_loop;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
320 unsigned int temp_str_len;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
321 char* tmp_pos;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
322 int decode_step;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
323 int item_counter;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
324
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
325 pMapStats = new MapStats;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
326 pMapStats->Initialize();
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
327
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
328 pMonsterStats = new MonsterStats;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
329 pMonsterStats->Initialize();
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
330 pMonsterStats->InitializePlacements();
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
331
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
332 pSpellStats = new SpellStats;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
333 pSpellStats->Initialize();
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
334
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
335 LoadPotions();
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
336 LoadPotionNotes();
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
337
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
338 pFactionTable = new FactionTable;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
339 pFactionTable->Initialize();
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
340
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
341 pStorylineText = new StorylineText;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
342 pStorylineText->Initialize();
0
Ritor1
parents:
diff changeset
343
224
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
344 pStdItemsTXT_Raw = NULL;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
345 pStdItemsTXT_Raw = (char *)pEvents_LOD->LoadRaw("stditems.txt", 0);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
346 strtok(pStdItemsTXT_Raw, "\r");
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
347 strtok(NULL, "\r");
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
348 strtok(NULL, "\r");
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
349 strtok(NULL, "\r");
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
350 //Standard Bonuses by Group
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
351 for (i=0;i<24;++i)
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
352 {
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
353 test_string = strtok(NULL, "\r") + 1;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
354 break_loop = false;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
355 decode_step=0;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
356 do
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
357 {
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
358 c = *(unsigned char*)test_string;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
359 temp_str_len = 0;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
360 while((c!='\t')&&(c>0))
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
361 {
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
362 ++temp_str_len;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
363 c=test_string[temp_str_len];
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
364 }
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
365 tmp_pos=test_string+temp_str_len;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
366 if (*tmp_pos == 0)
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
367 break_loop = true;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
368 *tmp_pos = 0;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
369 if (temp_str_len)
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
370 {
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
371 switch (decode_step)
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
372 {
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
373 case 0:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
374 pEnchantments[i].pBonusStat=RemoveQuotes(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
375 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
376 case 1:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
377 pEnchantments[i].pOfName= RemoveQuotes(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
378 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
379 default:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
380 pEnchantments[i].to_item[decode_step-2]=atoi(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
381 }
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
382 }
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
383 else
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
384 {
570
f54481c85df8 itemgen working, i hope
Gloval
parents: 559
diff changeset
385 if (decode_step)
224
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
386 break_loop = true;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
387 }
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
388 ++decode_step;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
389 test_string=tmp_pos+1;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
390 } while ((decode_step<11)&&!break_loop);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
391 }
0
Ritor1
parents:
diff changeset
392
224
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
393 memset(&pEnchantmentsSumm, 0, 36);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
394 for(i=0;i<9;++i)
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
395 {
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
396 for (j=0;j<24;++j)
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
397 pEnchantmentsSumm[i]+=pEnchantments[j].to_item[i];
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
398 }
0
Ritor1
parents:
diff changeset
399
224
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
400 //Bonus range for Standard by Level
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
401 strtok(NULL, "\r");
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
402 strtok(NULL, "\r");
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
403 strtok(NULL, "\r");
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
404 strtok(NULL, "\r");
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
405 strtok(NULL, "\r");
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
406 for(i=0;i<6;++i) //counted from 1
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
407 {
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
408 test_string = strtok(NULL, "\r") + 1;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
409 break_loop = false;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
410 decode_step=0;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
411 do
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
412 {
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
413 c = *(unsigned char*)test_string;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
414 temp_str_len = 0;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
415 while((c!='\t')&&(c>0))
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
416 {
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
417 ++temp_str_len;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
418 c=test_string[temp_str_len];
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
419 }
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
420 tmp_pos=test_string+temp_str_len;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
421 if (*tmp_pos == 0)
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
422 break_loop = true;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
423 *tmp_pos = 0;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
424 if (decode_step==2)
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
425 bonus_ranges[i].minR = atoi(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
426 else if (decode_step==3)
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
427 bonus_ranges[i].maxR =atoi(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
428 ++decode_step;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
429 test_string=tmp_pos+1;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
430 } while ((decode_step<4)&&!break_loop);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
431 }
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
432
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
433
224
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
434 pSpcItemsTXT_Raw = 0;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
435 pSpcItemsTXT_Raw = (char *)pEvents_LOD->LoadRaw("spcitems.txt", 0);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
436 strtok(pSpcItemsTXT_Raw, "\r");
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
437 strtok(NULL, "\r");
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
438 strtok(NULL, "\r");
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
439 strtok(NULL, "\r");
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
440 for (i=0;i<72;++i)
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
441 {
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
442 test_string = strtok(NULL, "\r") + 1;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
443 break_loop = false;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
444 decode_step=0;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
445 do
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
446 {
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
447 c = *(unsigned char*)test_string;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
448 temp_str_len = 0;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
449 while((c!='\t')&&(c>0))
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
450 {
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
451 ++temp_str_len;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
452 c=test_string[temp_str_len];
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
453 }
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
454 tmp_pos=test_string+temp_str_len;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
455 if (*tmp_pos == 0)
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
456 break_loop = true;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
457 *tmp_pos = 0;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
458 if (temp_str_len)
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
459 {
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
460 switch (decode_step)
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
461 {
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
462 case 0:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
463 pSpecialEnchantments[i].pBonusStatement=RemoveQuotes(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
464 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
465 case 1:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
466 pSpecialEnchantments[i].pNameAdd= RemoveQuotes(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
467 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
468 case 14:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
469 int res;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
470 res=atoi(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
471 if(!res)
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
472 {
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
473 ++test_string;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
474 while (*test_string==' ')//fix X 2 case
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
475 ++test_string;
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
476 res=atoi(test_string);
224
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
477 }
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
478 pSpecialEnchantments[i].iValue=res;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
479 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
480 case 15:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
481 pSpecialEnchantments[i].iTreasureLevel= tolower(*test_string) - 97;;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
482 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
483 default:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
484 pSpecialEnchantments[i].to_item_apply[decode_step-2]=atoi(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
485 }
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
486 }
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
487 else
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
488 {
570
f54481c85df8 itemgen working, i hope
Gloval
parents: 559
diff changeset
489 if (decode_step)
224
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
490 break_loop = true;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
491 }
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
492 ++decode_step;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
493 test_string=tmp_pos+1;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
494 } while ((decode_step<16)&&!break_loop);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
495 }
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
496
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
497 pSpecialEnchantments_count = 71;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
498 memset(&pSpecialEnchantmentsSumm, 0, 96);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
499 for(i=0;i<12;++i)
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
500 {
570
f54481c85df8 itemgen working, i hope
Gloval
parents: 559
diff changeset
501 for (j=0;j<=pSpecialEnchantments_count;++j)
224
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
502 pSpecialEnchantmentsSumm[i]+=pSpecialEnchantments[j].to_item_apply[i];
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
503 }
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
504
224
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
505 Initialize2DA();
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
506
224
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
507 pItemsTXT_Raw = NULL;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
508 pItemsTXT_Raw = (char*) pEvents_LOD->LoadRaw("items.txt", 0);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
509 strtok(pItemsTXT_Raw, "\r");
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
510 strtok(NULL, "\r");
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
511 uAllItemsCount = 0;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
512 item_counter = 0;
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
513 while (true)
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
514 {
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
515 test_string = strtok(NULL, "\r") + 1;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
516 break_loop = false;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
517 decode_step=0;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
518 do
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
519 {
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
520 c = *(unsigned char*)test_string;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
521 temp_str_len = 0;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
522 while((c!='\t')&&(c>0))
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
523 {
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
524 ++temp_str_len;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
525 c=test_string[temp_str_len];
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
526 }
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
527 tmp_pos=test_string+temp_str_len;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
528 if (*tmp_pos == 0)
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
529 break_loop = true;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
530 *tmp_pos = 0;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
531 if (temp_str_len)
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
532 {
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
533 switch (decode_step)
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
534 {
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
535 case 0: //Item #
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
536 item_counter=atoi(test_string);
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
537 uAllItemsCount=item_counter;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
538 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
539 case 1: //Pic File
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
540 pItems[item_counter].pIconName = RemoveQuotes(test_string);
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
541 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
542 case 2: //Name
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
543 pItems[item_counter].pName = RemoveQuotes(test_string);
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
544 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
545 case 3: //Value
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
546 pItems[item_counter].uValue=atoi(test_string);
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
547 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
548 case 4: //Equip Stat
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
549 {
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1082
diff changeset
550 if ( !_stricmp(test_string, "weapon") )
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
551 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 762
diff changeset
552 pItems[item_counter].uEquipType = EQUIP_OFF_HAND;
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
553 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
554 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1082
diff changeset
555 if ( !_stricmp(test_string, "weapon2") )
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
556 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 762
diff changeset
557 pItems[item_counter].uEquipType = EQUIP_MAIN_HAND;
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
558 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
559 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1082
diff changeset
560 if ( !_stricmp(test_string, "weapon1or2") )
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
561 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 762
diff changeset
562 pItems[item_counter].uEquipType = EQUIP_OFF_HAND;
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
563 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
564 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1082
diff changeset
565 if ( !(_stricmp(test_string, "missile")&&_stricmp(test_string, "bow")))
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
566 {
365
0f35f908547f fixed missing dagger
Gloval
parents: 315
diff changeset
567 pItems[item_counter].uEquipType = EQUIP_BOW;
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
568 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
569 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1082
diff changeset
570 if ( !_stricmp(test_string, "armor") )
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
571 {
365
0f35f908547f fixed missing dagger
Gloval
parents: 315
diff changeset
572 pItems[item_counter].uEquipType = EQUIP_ARMOUR;
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
573 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
574 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1082
diff changeset
575 if ( !_stricmp(test_string, "shield") )
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
576 {
365
0f35f908547f fixed missing dagger
Gloval
parents: 315
diff changeset
577 pItems[item_counter].uEquipType = EQUIP_SHIELD;
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
578 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
579 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1082
diff changeset
580 if ( !_stricmp(test_string, "helm") )
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
581 {
365
0f35f908547f fixed missing dagger
Gloval
parents: 315
diff changeset
582 pItems[item_counter].uEquipType = EQUIP_HELMET;
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
583 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
584 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1082
diff changeset
585 if ( !_stricmp(test_string, "belt") )
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
586 {
365
0f35f908547f fixed missing dagger
Gloval
parents: 315
diff changeset
587 pItems[item_counter].uEquipType = EQUIP_BELT;
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
588 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
589 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1082
diff changeset
590 if ( !_stricmp(test_string, "cloak") )
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
591 {
365
0f35f908547f fixed missing dagger
Gloval
parents: 315
diff changeset
592 pItems[item_counter].uEquipType = EQUIP_CLOAK;
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
593 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
594 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1082
diff changeset
595 if ( !_stricmp(test_string, "gauntlets") )
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
596 {
365
0f35f908547f fixed missing dagger
Gloval
parents: 315
diff changeset
597 pItems[item_counter].uEquipType = EQUIP_GAUNTLETS;
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
598 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
599 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1082
diff changeset
600 if ( !_stricmp(test_string, "boots") )
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
601 {
365
0f35f908547f fixed missing dagger
Gloval
parents: 315
diff changeset
602 pItems[item_counter].uEquipType = EQUIP_BOOTS;
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
603 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
604 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1082
diff changeset
605 if ( !_stricmp(test_string, "ring") )
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
606 {
365
0f35f908547f fixed missing dagger
Gloval
parents: 315
diff changeset
607 pItems[item_counter].uEquipType = EQUIP_RING;
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
608 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
609 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1082
diff changeset
610 if ( !_stricmp(test_string, "amulet") )
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
611 {
365
0f35f908547f fixed missing dagger
Gloval
parents: 315
diff changeset
612 pItems[item_counter].uEquipType = EQUIP_AMULET;
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
613 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
614 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1082
diff changeset
615 if ( !_stricmp(test_string, "weaponw") )
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
616 {
365
0f35f908547f fixed missing dagger
Gloval
parents: 315
diff changeset
617 pItems[item_counter].uEquipType = EQUIP_WAND;
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
618 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
619 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1082
diff changeset
620 if ( !(_stricmp(test_string, "herb")&&_stricmp(test_string, "reagent")))
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
621 {
365
0f35f908547f fixed missing dagger
Gloval
parents: 315
diff changeset
622 pItems[item_counter].uEquipType = EQUIP_REAGENT;
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
623 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
624 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1082
diff changeset
625 if ( !_stricmp(test_string, "bottle") )
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
626 {
365
0f35f908547f fixed missing dagger
Gloval
parents: 315
diff changeset
627 pItems[item_counter].uEquipType = EQUIP_POTION;
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
628 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
629 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1082
diff changeset
630 if ( !_stricmp(test_string, "sscroll") )
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
631 {
374
Gloval
parents: 365
diff changeset
632 pItems[item_counter].uEquipType = EQUIP_SPELL_SCROLL;
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
633 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
634 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1082
diff changeset
635 if ( !_stricmp(test_string, "book") )
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
636 {
365
0f35f908547f fixed missing dagger
Gloval
parents: 315
diff changeset
637 pItems[item_counter].uEquipType = EQUIP_BOOK;
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
638 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
639 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1082
diff changeset
640 if ( !_stricmp(test_string, "mscroll") )
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
641 {
374
Gloval
parents: 365
diff changeset
642 pItems[item_counter].uEquipType = EQUIP_MESSAGE_SCROLL;
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
643 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
644 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1082
diff changeset
645 if ( !_stricmp(test_string, "gold") )
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
646 {
365
0f35f908547f fixed missing dagger
Gloval
parents: 315
diff changeset
647 pItems[item_counter].uEquipType = EQUIP_GOLD;
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
648 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
649 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1082
diff changeset
650 if ( !_stricmp(test_string, "gem") )
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
651 {
365
0f35f908547f fixed missing dagger
Gloval
parents: 315
diff changeset
652 pItems[item_counter].uEquipType = EQUIP_GEM;
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
653 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
654 }
365
0f35f908547f fixed missing dagger
Gloval
parents: 315
diff changeset
655 pItems[item_counter].uEquipType = EQUIP_NONE;
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
656 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
657 }
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
658 case 5: //Skill Group
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
659 {
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1082
diff changeset
660 if ( !_stricmp(test_string, "staff") )
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
661 {
374
Gloval
parents: 365
diff changeset
662 pItems[item_counter].uSkillType = PLAYER_SKILL_STAFF;
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
663 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
664 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1082
diff changeset
665 if ( !_stricmp(test_string, "sword") )
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
666 {
374
Gloval
parents: 365
diff changeset
667 pItems[item_counter].uSkillType = PLAYER_SKILL_SWORD;
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
668 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
669 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1082
diff changeset
670 if ( !_stricmp(test_string, "dagger") )
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
671 {
374
Gloval
parents: 365
diff changeset
672 pItems[item_counter].uSkillType = PLAYER_SKILL_DAGGER;
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
673 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
674 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1082
diff changeset
675 if ( !_stricmp(test_string, "axe") )
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
676 {
374
Gloval
parents: 365
diff changeset
677 pItems[item_counter].uSkillType = PLAYER_SKILL_AXE;
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
678 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
679 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1082
diff changeset
680 if ( !_stricmp(test_string, "spear") )
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
681 {
374
Gloval
parents: 365
diff changeset
682 pItems[item_counter].uSkillType = PLAYER_SKILL_SPEAR;
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
683 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
684 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1082
diff changeset
685 if ( !_stricmp(test_string, "bow") )
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
686 {
374
Gloval
parents: 365
diff changeset
687 pItems[item_counter].uSkillType = PLAYER_SKILL_BOW;
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
688 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
689 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1082
diff changeset
690 if ( !_stricmp(test_string, "mace") )
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
691 {
374
Gloval
parents: 365
diff changeset
692 pItems[item_counter].uSkillType = PLAYER_SKILL_MACE;
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
693 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
694 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1082
diff changeset
695 if ( !_stricmp(test_string, "blaster") )
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
696 {
374
Gloval
parents: 365
diff changeset
697 pItems[item_counter].uSkillType = PLAYER_SKILL_BLASTER;
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
698 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
699 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1082
diff changeset
700 if ( !_stricmp(test_string, "shield") )
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
701 {
374
Gloval
parents: 365
diff changeset
702 pItems[item_counter].uSkillType = PLAYER_SKILL_SHIELD;
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
703 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
704 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1082
diff changeset
705 if ( !_stricmp(test_string, "leather") )
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
706 {
374
Gloval
parents: 365
diff changeset
707 pItems[item_counter].uSkillType = PLAYER_SKILL_LEATHER;
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
708 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
709 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1082
diff changeset
710 if ( !_stricmp(test_string, "chain") )
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
711 {
374
Gloval
parents: 365
diff changeset
712 pItems[item_counter].uSkillType = PLAYER_SKILL_CHAIN;
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
713 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
714 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1082
diff changeset
715 if ( !_stricmp(test_string, "plate") )
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
716 {
374
Gloval
parents: 365
diff changeset
717 pItems[item_counter].uSkillType = PLAYER_SKILL_PLATE;
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
718 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
719 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1082
diff changeset
720 if ( !_stricmp(test_string, "club") )
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
721 {
374
Gloval
parents: 365
diff changeset
722 pItems[item_counter].uSkillType = PLAYER_SKILL_CLUB;
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
723 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
724 }
385
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
725 pItems[item_counter].uSkillType = PLAYER_SKILL_MISC;
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
726 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
727 }
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
728 case 6: //Mod1
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
729 {
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
730 int ii;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
731 char* test_char;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
732 int tst_len;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
733 tst_len=strlen(test_string);
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
734 pItems[item_counter].uDamageDice=0;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
735 pItems[item_counter].uDamageRoll=0;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
736 test_char=test_string;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
737 for (ii=0; ii<tst_len; ++ii)
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
738 {
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
739 if (tolower(*test_char)=='d')
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
740 {
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
741 *test_char=0;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
742 pItems[item_counter].uDamageDice=atoi(test_string);
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
743 pItems[item_counter].uDamageRoll=atoi(test_char+1);
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
744 *test_char='d';
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
745 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
746 }
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
747 ++test_char;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
748 }
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
749 test_char=test_string;
559
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
750 if ((ii==tst_len)&&(tolower(*test_char)!='s'))
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
751 {
559
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
752 pItems[item_counter].uDamageDice=atoi(test_char);
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
753 pItems[item_counter].uDamageRoll=1;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
754 }
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
755 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
756 }
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
757 case 7: //Mod2
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
758 pItems[item_counter].uDamageMod=atoi(test_string);
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
759 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
760 case 8: //material
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
761 {
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1082
diff changeset
762 if ( !_stricmp(test_string, "artifact") )
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
763 {
377
243418228760 GetIdentifiedName
Gloval
parents: 375
diff changeset
764 pItems[item_counter].uMaterial = MATERIAL_ARTEFACT;
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
765 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
766 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1082
diff changeset
767 if ( !_stricmp(test_string, "relic") )
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
768 {
377
243418228760 GetIdentifiedName
Gloval
parents: 375
diff changeset
769 pItems[item_counter].uMaterial = MATERIAL_RELIC;
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
770 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
771 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1082
diff changeset
772 if ( !_stricmp(test_string, "special") )
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
773 {
377
243418228760 GetIdentifiedName
Gloval
parents: 375
diff changeset
774 pItems[item_counter].uMaterial = MATERIAL_SPECIAL;
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
775 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
776 }
377
243418228760 GetIdentifiedName
Gloval
parents: 375
diff changeset
777 pItems[item_counter].uMaterial = MATERIAL_COMMON;
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
778 break;}
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
779 case 9: //ID/Rep/St
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
780 pItems[item_counter].uItemID_Rep_St=atoi(test_string);
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
781 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
782 case 10: //Not identified name
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
783 pItems[item_counter].pUnidentifiedName = RemoveQuotes(test_string);
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
784 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
785 case 11: //Sprite Index
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
786 pItems[item_counter].uSpriteID=atoi(test_string);
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
787 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
788 case 12: //VarA
224
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
789 {
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
790 pItems[item_counter]._additional_value=0;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
791 pItems[item_counter]._bonus_type=0;
377
243418228760 GetIdentifiedName
Gloval
parents: 375
diff changeset
792 if (pItems[item_counter].uMaterial==MATERIAL_SPECIAL)
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
793 {
224
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
794 for(int ii=0; ii<24; ++ii)
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
795 {
1165
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1104
diff changeset
796 if (_stricmp(test_string,pEnchantments[ii].pBonusStat))
224
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
797 {
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
798 pItems[item_counter]._bonus_type=ii+1;
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
799 break;
224
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
800 }
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
801 }
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
802 if (!pItems[item_counter]._bonus_type)
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
803 {
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
804 for(int ii=0; ii<72; ++ii)
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
805 {
1165
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1104
diff changeset
806 if (_stricmp(test_string,pSpecialEnchantments[ii].pBonusStatement))
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
807 {
224
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
808 pItems[item_counter]._additional_value=ii+1;
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
809 }
224
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
810 }
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
811 }
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
812 }
224
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
813
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
814 break;
224
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
815 }
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
816 case 13: //VarB
377
243418228760 GetIdentifiedName
Gloval
parents: 375
diff changeset
817 if ((pItems[item_counter].uMaterial==MATERIAL_SPECIAL)&&(pItems[item_counter]._bonus_type))
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
818 {
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
819 char b_s=atoi(test_string);
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
820 if (b_s)
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
821 pItems[item_counter]._bonus_strength=b_s;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
822 else
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
823 pItems[item_counter]._bonus_strength=1;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
824 }
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
825 else
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
826 pItems[item_counter]._bonus_strength=0;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
827 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
828 case 14: //Equip X
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
829 pItems[item_counter].uEquipX=atoi(test_string);
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
830 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
831 case 15: //Equip Y
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
832 pItems[item_counter].uEquipY=atoi(test_string);
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
833 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
834 case 16: //Notes
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
835 pItems[item_counter].pDescription = RemoveQuotes(test_string);
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
836 break;
224
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
837
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
838 }
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
839 }
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
840 else
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
841 {
570
f54481c85df8 itemgen working, i hope
Gloval
parents: 559
diff changeset
842 if (decode_step)
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
843 break_loop = true;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
844 }
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
845 ++decode_step;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
846 test_string=tmp_pos+1;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
847 } while ((decode_step<17)&&!break_loop);
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
848 ++item_counter;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
849 if (item_counter>799)
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
850 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
851 }
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
852
224
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
853
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
854 pRndItemsTXT_Raw = NULL;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
855 uAllItemsCount = item_counter;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
856 pRndItemsTXT_Raw = (char *)pEvents_LOD->LoadRaw("rnditems.txt", 0);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
857 strtok(pRndItemsTXT_Raw, "\r");
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
858 strtok(NULL, "\r");
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
859 strtok(NULL, "\r");
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
860 strtok(NULL, "\r");
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
861 item_counter = 0;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
862 while (true)
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
863 {
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
864 test_string = strtok(NULL, "\r") + 1;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
865 break_loop = false;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
866 decode_step=0;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
867 do
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
868 {
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
869 c = *(unsigned char*)test_string;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
870 temp_str_len = 0;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
871 while((c!='\t')&&(c>0))
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
872 {
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
873 ++temp_str_len;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
874 c=test_string[temp_str_len];
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
875 }
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
876 tmp_pos=test_string+temp_str_len;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
877 if (*tmp_pos == 0)
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
878 break_loop = true;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
879 *tmp_pos = 0;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
880 if (temp_str_len)
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
881 {
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
882 switch (decode_step)
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
883 {
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
884 case 0:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
885 item_counter=atoi(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
886 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
887 case 2:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
888 pItems[item_counter].uChanceByTreasureLvl1=atoi(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
889 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
890 case 3:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
891 pItems[item_counter].uChanceByTreasureLvl2=atoi(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
892 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
893 case 4:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
894 pItems[item_counter].uChanceByTreasureLvl3=atoi(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
895 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
896 case 5:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
897 pItems[item_counter].uChanceByTreasureLvl4=atoi(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
898 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
899 case 6:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
900 pItems[item_counter].uChanceByTreasureLvl5=atoi(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
901 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
902 case 7:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
903 pItems[item_counter].uChanceByTreasureLvl6=atoi(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
904 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
905 }
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
906 }
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
907 else
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
908 {
570
f54481c85df8 itemgen working, i hope
Gloval
parents: 559
diff changeset
909 if (decode_step)
224
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
910 break_loop = true;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
911 }
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
912 ++decode_step;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
913 test_string=tmp_pos+1;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
914 } while ((decode_step<8)&&!break_loop);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
915 ++item_counter;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
916 if (item_counter>618)
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
917 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
918 }
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
919
1006
e865f349aa41 ui cleanup
Gloval
parents: 972
diff changeset
920 //ChanceByTreasureLvl Summ - to calculate chance
224
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
921 memset(&uChanceByTreasureLvlSumm, 0, 24);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
922 for(i=0;i<6;++i)
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
923 {
598
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
924 for (j=1;j<item_counter;++j)
224
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
925 uChanceByTreasureLvlSumm[i]+=pItems[j].uChanceByTreasureLvl[i];
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
926 }
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
927
224
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
928 strtok(NULL, "\r");
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
929 strtok(NULL, "\r");
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
930 strtok(NULL, "\r");
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
931 strtok(NULL, "\r");
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
932 strtok(NULL, "\r");
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
933 for (i=0;i<3;++i)
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
934 {
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
935 test_string = strtok(NULL, "\r") + 1;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
936 break_loop = false;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
937 decode_step=0;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
938 do
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
939 {
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
940 c = *(unsigned char*)test_string;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
941 temp_str_len = 0;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
942 while((c!='\t')&&(c>0))
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
943 {
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
944 ++temp_str_len;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
945 c=test_string[temp_str_len];
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
946 }
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
947 tmp_pos=test_string+temp_str_len;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
948 if (*tmp_pos == 0)
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
949 break_loop = true;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
950 *tmp_pos = 0;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
951 if (temp_str_len)
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
952 {
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
953 switch (decode_step)
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
954 {
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
955 case 2:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
956 switch (i)
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
957 {
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
958 case 0:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
959 uBonusChanceStandart[0]=atoi(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
960 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
961 case 1:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
962 uBonusChanceSpecial[0]=atoi(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
963 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
964 case 2:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
965 uBonusChanceWpSpecial[0]=atoi(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
966 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
967 }
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
968 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
969 case 3:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
970 switch (i)
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
971 {
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
972 case 0:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
973 uBonusChanceStandart[1]=atoi(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
974 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
975 case 1:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
976 uBonusChanceSpecial[1]=atoi(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
977 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
978 case 2:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
979 uBonusChanceWpSpecial[1]=atoi(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
980 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
981 }
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
982 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
983 case 4:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
984 switch (i)
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
985 {
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
986 case 0:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
987 uBonusChanceStandart[2]=atoi(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
988 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
989 case 1:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
990 uBonusChanceSpecial[2]=atoi(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
991 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
992 case 2:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
993 uBonusChanceWpSpecial[2]=atoi(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
994 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
995 }
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
996 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
997 case 5:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
998 switch (i)
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
999 {
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1000 case 0:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1001 uBonusChanceStandart[3]=atoi(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1002 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1003 case 1:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1004 uBonusChanceSpecial[3]=atoi(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1005 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1006 case 2:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1007 uBonusChanceWpSpecial[3]=atoi(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1008 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1009 }
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1010 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1011 case 6:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1012 switch (i)
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1013 {
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1014 case 0:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1015 uBonusChanceStandart[4]=atoi(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1016 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1017 case 1:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1018 uBonusChanceSpecial[4]=atoi(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1019 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1020 case 2:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1021 uBonusChanceWpSpecial[4]=atoi(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1022 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1023 }
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1024 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1025 case 7:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1026 switch (i)
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1027 {
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1028 case 0:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1029 uBonusChanceStandart[5]=atoi(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1030 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1031 case 1:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1032 uBonusChanceSpecial[5]=atoi(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1033 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1034 case 2:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1035 uBonusChanceWpSpecial[5]=atoi(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1036 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1037 }
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1038 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1039 }
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1040 }
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1041 else
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1042 {
570
f54481c85df8 itemgen working, i hope
Gloval
parents: 559
diff changeset
1043 if (decode_step)
224
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1044 break_loop = true;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1045 }
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1046 ++decode_step;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1047 test_string=tmp_pos+1;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1048 } while ((decode_step<8)&&!break_loop);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1049 }
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1050
705
e39702f35283 memory allocation partly reworked
zipi
parents: 598
diff changeset
1051 if ( pRndItemsTXT_Raw )
e39702f35283 memory allocation partly reworked
zipi
parents: 598
diff changeset
1052 {
e39702f35283 memory allocation partly reworked
zipi
parents: 598
diff changeset
1053 pAllocator->FreeChunk(pRndItemsTXT_Raw);
e39702f35283 memory allocation partly reworked
zipi
parents: 598
diff changeset
1054 pRndItemsTXT_Raw = NULL;
e39702f35283 memory allocation partly reworked
zipi
parents: 598
diff changeset
1055 }
e39702f35283 memory allocation partly reworked
zipi
parents: 598
diff changeset
1056
224
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1057 pSkillDescTXT_Raw = NULL;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1058 pSkillDescTXT_Raw = (char *)pEvents_LOD->LoadRaw("skilldes.txt", 0);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1059 strtok(pSkillDescTXT_Raw, "\r");
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1060 for (i=0; i<37; ++i)
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1061 {
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1062 test_string = strtok(NULL, "\r") + 1;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1063 break_loop = false;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1064 decode_step=0;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1065 do
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1066 {
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1067 c = *(unsigned char*)test_string;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1068 temp_str_len = 0;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1069 while((c!='\t')&&(c>0))
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1070 {
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1071 ++temp_str_len;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1072 c=test_string[temp_str_len];
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1073 }
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1074 tmp_pos=test_string+temp_str_len;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1075 if (*tmp_pos == 0)
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1076 break_loop = true;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1077 *tmp_pos = 0;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1078 if (temp_str_len)
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1079 {
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1080 switch (decode_step)
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1081 {
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1082 case 1:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1083 pSkillDesc[i] = RemoveQuotes(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1084 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1085 case 2:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1086 pNormalSkillDesc[i] = RemoveQuotes(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1087 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1088 case 3:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1089 pExpertSkillDesc[i] = RemoveQuotes(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1090 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1091 case 4:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1092 pMasterSkillDesc[i] = RemoveQuotes(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1093 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1094 case 5:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1095 pGrandSkillDesc[i] = RemoveQuotes(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1096 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1097 }
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1098 }
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1099 else
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1100 {
570
f54481c85df8 itemgen working, i hope
Gloval
parents: 559
diff changeset
1101 if (decode_step)
224
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1102 break_loop = true;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1103 }
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1104 ++decode_step;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1105 test_string=tmp_pos+1;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1106 } while ((decode_step<6)&&!break_loop);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1107 }
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1108
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1109 pStatsTXT_Raw = 0;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1110 pStatsTXT_Raw = (char *)pEvents_LOD->LoadRaw("stats.txt", 0);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1111 strtok(pStatsTXT_Raw, "\r");
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1112 for (i=0; i<26; ++i)
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1113 {
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1114 test_string = strtok(NULL, "\r") + 1;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1115 break_loop = false;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1116 decode_step=0;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1117 do
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1118 {
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1119 c = *(unsigned char*)test_string;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1120 temp_str_len = 0;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1121 while((c!='\t')&&(c>0))
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1122 {
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1123 ++temp_str_len;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1124 c=test_string[temp_str_len];
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1125 }
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1126 tmp_pos=test_string+temp_str_len;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1127 if (*tmp_pos == 0)
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1128 break_loop = true;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1129 *tmp_pos = 0;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1130 if (temp_str_len)
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1131 {
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1132 switch (i)
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1133 {
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1134 case 0:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1135 case 1:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1136 case 2:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1137 case 3:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1138 case 4:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1139 case 5:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1140 case 6:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1141 pAttributeDescriptions[i] = RemoveQuotes(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1142 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1143 case 7:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1144 pHealthPointsAttributeDescription = RemoveQuotes(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1145 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1146 case 8:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1147 pArmourClassAttributeDescription = RemoveQuotes(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1148 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1149 case 9:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1150 pSpellPointsAttributeDescription = RemoveQuotes(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1151 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1152 case 10:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1153 pPlayerConditionAttributeDescription = RemoveQuotes(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1154 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1155 case 11:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1156 pFastSpellAttributeDescription = RemoveQuotes(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1157 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1158 case 12:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1159 pPlayerAgeAttributeDescription = RemoveQuotes(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1160 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1161 case 13:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1162 pPlayerLevelAttributeDescription = RemoveQuotes(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1163 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1164 case 14:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1165 pPlayerExperienceAttributeDescription = RemoveQuotes(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1166 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1167 case 15:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1168 pAttackBonusAttributeDescription = RemoveQuotes(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1169 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1170 case 16:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1171 pAttackDamageAttributeDescription = RemoveQuotes(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1172 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1173 case 17:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1174 pMissleBonusAttributeDescription = RemoveQuotes(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1175 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1176 case 18:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1177 pMissleDamageAttributeDescription = RemoveQuotes(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1178 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1179 case 19:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1180 pFireResistanceAttributeDescription = RemoveQuotes(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1181 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1182 case 20:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1183 pAirResistanceAttributeDescription = RemoveQuotes(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1184 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1185 case 21:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1186 pWaterResistanceAttributeDescription = RemoveQuotes(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1187 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1188 case 22:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1189 pEarthResistanceAttributeDescription = RemoveQuotes(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1190 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1191 case 23:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1192 pMindResistanceAttributeDescription = RemoveQuotes(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1193 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1194 case 24:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1195 pBodyResistanceAttributeDescription = RemoveQuotes(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1196 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1197 case 25:
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1198 pSkillPointsAttributeDescription = RemoveQuotes(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1199 break;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1200 }
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1201 }
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1202 else
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1203 {
570
f54481c85df8 itemgen working, i hope
Gloval
parents: 559
diff changeset
1204 if (decode_step)
224
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1205 break_loop = true;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1206 }
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1207 ++decode_step;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1208 test_string=tmp_pos+1;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1209 } while ((decode_step<2)&&!break_loop);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1210 }
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1211
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1212
224
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1213 pClassTXT_Raw = 0;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1214 pClassTXT_Raw = (char *)pEvents_LOD->LoadRaw("class.txt", 0);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1215 strtok(pClassTXT_Raw, "\r");
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1216 for (i=0; i<36; ++i)
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1217 {
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1218 test_string = strtok(NULL, "\r") + 1;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1219 break_loop = false;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1220 decode_step=0;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1221 do
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1222 {
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1223 c = *(unsigned char*)test_string;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1224 temp_str_len = 0;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1225 while((c!='\t')&&(c>0))
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1226 {
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1227 ++temp_str_len;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1228 c=test_string[temp_str_len];
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1229 }
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1230 tmp_pos=test_string+temp_str_len;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1231 if (*tmp_pos == 0)
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1232 break_loop = true;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1233 *tmp_pos = 0;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1234 if (temp_str_len)
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1235 {
229
Gloval
parents: 224
diff changeset
1236 //if(i)
224
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1237 pClassDescriptions[i]=RemoveQuotes(test_string);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1238 }
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1239 else
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1240 {
570
f54481c85df8 itemgen working, i hope
Gloval
parents: 559
diff changeset
1241 if (decode_step)
224
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1242 break_loop = true;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1243 }
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1244 ++decode_step;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1245 test_string=tmp_pos+1;
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1246 } while ((decode_step<2)&&!break_loop);
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1247 }
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1248
224
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1249 }
0
Ritor1
parents:
diff changeset
1250
Ritor1
parents:
diff changeset
1251 //----- (00456D17) --------------------------------------------------------
Ritor1
parents:
diff changeset
1252 void ItemsTable::SetSpecialBonus(ItemGen *pItem)
Ritor1
parents:
diff changeset
1253 {
385
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
1254 if ( pItems[pItem->uItemID].uMaterial == MATERIAL_SPECIAL )
0
Ritor1
parents:
diff changeset
1255 {
570
f54481c85df8 itemgen working, i hope
Gloval
parents: 559
diff changeset
1256 pItem->uEnchantmentType = pItems[pItem->uItemID]._bonus_type;
385
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
1257 pItem->uSpecEnchantmentType = pItems[pItem->uItemID]._additional_value;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
1258 pItem->_bonus_strength = pItems[pItem->uItemID]._bonus_strength;
0
Ritor1
parents:
diff changeset
1259 }
Ritor1
parents:
diff changeset
1260 }
Ritor1
parents:
diff changeset
1261
Ritor1
parents:
diff changeset
1262 //----- (00456D43) --------------------------------------------------------
377
243418228760 GetIdentifiedName
Gloval
parents: 375
diff changeset
1263 bool ItemsTable::IsMaterialSpecial(ItemGen *pItem)
0
Ritor1
parents:
diff changeset
1264 {
377
243418228760 GetIdentifiedName
Gloval
parents: 375
diff changeset
1265 return this->pItems[pItem->uItemID].uMaterial == MATERIAL_SPECIAL;
0
Ritor1
parents:
diff changeset
1266 }
Ritor1
parents:
diff changeset
1267
Ritor1
parents:
diff changeset
1268 //----- (00456D5E) --------------------------------------------------------
377
243418228760 GetIdentifiedName
Gloval
parents: 375
diff changeset
1269 bool ItemsTable::IsMaterialNonCommon(ItemGen *pItem)
0
Ritor1
parents:
diff changeset
1270 {
385
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
1271 return pItems[pItem->uItemID].uMaterial == MATERIAL_SPECIAL ||
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
1272 pItems[pItem->uItemID].uMaterial == MATERIAL_RELIC ||
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
1273 pItems[pItem->uItemID].uMaterial == MATERIAL_ARTEFACT;
0
Ritor1
parents:
diff changeset
1274 }
Ritor1
parents:
diff changeset
1275
Ritor1
parents:
diff changeset
1276
Ritor1
parents:
diff changeset
1277 //----- (00453B3C) --------------------------------------------------------
Ritor1
parents:
diff changeset
1278 void ItemsTable::LoadPotions()
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1279 {
0
Ritor1
parents:
diff changeset
1280
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1281 CHAR Text[90]; // [sp+Ch] [bp-6Ch]@26
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1282 char* test_string;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1283 unsigned int uRow;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1284 unsigned int uColumn;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1285 unsigned __int8 potion_value;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1286
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1287 if ( pPotionsTXT_Raw )
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1288 pAllocator->FreeChunk(pPotionsTXT_Raw);
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1289 pPotionsTXT_Raw = NULL;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1290 pPotionsTXT_Raw = (char *)pEvents_LOD->LoadRaw("potion.txt", 0);
193
821fd955c379 fixed potion data parsing. Somehow 3d render was affected
Gloval
parents: 189
diff changeset
1291 test_string = strtok(pPotionsTXT_Raw,"\t\r\n");
821fd955c379 fixed potion data parsing. Somehow 3d render was affected
Gloval
parents: 189
diff changeset
1292 while ( 1 )
821fd955c379 fixed potion data parsing. Somehow 3d render was affected
Gloval
parents: 189
diff changeset
1293 {
821fd955c379 fixed potion data parsing. Somehow 3d render was affected
Gloval
parents: 189
diff changeset
1294 if ( !test_string )
821fd955c379 fixed potion data parsing. Somehow 3d render was affected
Gloval
parents: 189
diff changeset
1295 {
821fd955c379 fixed potion data parsing. Somehow 3d render was affected
Gloval
parents: 189
diff changeset
1296 MessageBoxA(0, "Error Pre-Parsing Potion Table", "Load Error", MB_ICONHAND|MB_CANCELTRYCONTINUE);
821fd955c379 fixed potion data parsing. Somehow 3d render was affected
Gloval
parents: 189
diff changeset
1297 return;
821fd955c379 fixed potion data parsing. Somehow 3d render was affected
Gloval
parents: 189
diff changeset
1298 }
821fd955c379 fixed potion data parsing. Somehow 3d render was affected
Gloval
parents: 189
diff changeset
1299 if ( !strcmp(test_string, "222") )
821fd955c379 fixed potion data parsing. Somehow 3d render was affected
Gloval
parents: 189
diff changeset
1300 break;
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1301
193
821fd955c379 fixed potion data parsing. Somehow 3d render was affected
Gloval
parents: 189
diff changeset
1302 test_string = strtok(NULL, "\t\r\n");
821fd955c379 fixed potion data parsing. Somehow 3d render was affected
Gloval
parents: 189
diff changeset
1303 }
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1304 while ( 1 )
193
821fd955c379 fixed potion data parsing. Somehow 3d render was affected
Gloval
parents: 189
diff changeset
1305 {
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1306 test_string = strtok(NULL, "\t\r\n");
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1307
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1308 if ( !test_string )
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1309 {
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1310 MessageBoxA(0, "Error Pre-Parsing Potion Table", "Load Error", MB_ICONHAND|MB_CANCELTRYCONTINUE);
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1311 return;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1312 }
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1313 if ( !strcmp(test_string, "222") )
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1314 break;
193
821fd955c379 fixed potion data parsing. Somehow 3d render was affected
Gloval
parents: 189
diff changeset
1315 }
821fd955c379 fixed potion data parsing. Somehow 3d render was affected
Gloval
parents: 189
diff changeset
1316
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1317 for (uRow = 0;uRow < 50; ++uRow)
193
821fd955c379 fixed potion data parsing. Somehow 3d render was affected
Gloval
parents: 189
diff changeset
1318 {
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1319 int skip_count;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1320 for (skip_count = 0;skip_count < 6; ++skip_count)
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1321 {
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1322 if ( !strtok(NULL, "\r\t\n") )
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1323 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1324 }
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1325 if ( skip_count != 6 )
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1326 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1327 for (uColumn = 0; uColumn < 50; ++uColumn)
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1328 {
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1329 test_string = strtok(NULL, "\r\t\n");
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1330 if ( !test_string )
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1331 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1332 potion_value = atoi(test_string);
233
0df4136b6aac store_line
Gloval
parents: 230
diff changeset
1333 unsigned char c=*test_string;
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1334 if ( !potion_value )
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1335 {
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1336 if ( tolower(c) == 'e' )
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1337 potion_value = atoi(test_string + 1);
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1338 else
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1339 potion_value = 0;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1340 }
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1341 this->potion_data[uRow][uColumn]=potion_value;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1342 }
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1343 if ( uColumn != 50 )
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1344 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1345 strtok(NULL, "\r\t\n");
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1346 }
193
821fd955c379 fixed potion data parsing. Somehow 3d render was affected
Gloval
parents: 189
diff changeset
1347
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1348 if ( uRow != 50 )
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1349 {
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1350 wsprintfA(Text, "Error Parsing Potion Table at Row: %d Column: %d", uRow, uColumn);
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1351 MessageBoxA(0, Text, "Parsing Error", MB_ICONHAND|MB_CANCELTRYCONTINUE);
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1352 }
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1353 if ( pPotionsTXT_Raw )
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1354 {
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1355 pAllocator->FreeChunk(pPotionsTXT_Raw);
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1356 pPotionsTXT_Raw = 0;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1357 }
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1358 }
0
Ritor1
parents:
diff changeset
1359
Ritor1
parents:
diff changeset
1360 //----- (00453CE5) --------------------------------------------------------
Ritor1
parents:
diff changeset
1361 void ItemsTable::LoadPotionNotes()
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1362 {
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1363
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1364 CHAR Text[90];
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1365 char* test_string;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1366 unsigned int uRow;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1367 unsigned int uColumn;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1368 unsigned __int8 potion_note;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1369
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1370 if ( pPotionNotesTXT_Raw )
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1371 pAllocator->FreeChunk(pPotionNotesTXT_Raw);
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1372 pPotionNotesTXT_Raw = NULL;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1373 pPotionNotesTXT_Raw = (char *)pEvents_LOD->LoadRaw("potnotes.txt", 0);
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1374 test_string = strtok(pPotionNotesTXT_Raw ,"\t\r\n");
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1375 while ( 1 )
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1376 {
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1377 if ( !test_string )
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1378 {
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1379 MessageBoxA(0, "Error Pre-Parsing Potion Table", "Load Error", MB_ICONHAND|MB_CANCELTRYCONTINUE);
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1380 return;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1381 }
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1382 if ( !strcmp(test_string, "222") )
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1383 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1384 test_string = strtok(NULL, "\t\r\n");
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1385 }
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1386 while ( 1 )
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1387 {
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1388 test_string = strtok(NULL, "\t\r\n");
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1389
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1390 if ( !test_string )
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1391 {
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1392 MessageBoxA(0, "Error Pre-Parsing Potion Table", "Load Error", MB_ICONHAND|MB_CANCELTRYCONTINUE);
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1393 return;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1394 }
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1395 if ( !strcmp(test_string, "222") )
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1396 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1397 }
0
Ritor1
parents:
diff changeset
1398
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1399 for (uRow = 0;uRow < 50; ++uRow)
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1400 {
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1401 int skip_count;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1402 for (skip_count = 0;skip_count < 6; ++skip_count)
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1403 {
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1404 if ( !strtok(NULL, "\r\t\n") )
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1405 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1406 }
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1407 if ( skip_count != 6 )
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1408 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1409 for (uColumn = 0; uColumn < 50; ++uColumn)
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1410 {
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1411 test_string = strtok(NULL, "\r\t\n");
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1412 if ( !test_string )
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1413 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1414 potion_note = atoi(test_string);
233
0df4136b6aac store_line
Gloval
parents: 230
diff changeset
1415 unsigned char c=*test_string;
222
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1416 if ( !potion_note )
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1417 {
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1418 if ( tolower(c) == 'e' )
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1419 potion_note = atoi(test_string + 1);
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1420 else
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1421 potion_note = 0;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1422 }
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1423 this->potion_note[uRow][uColumn]=potion_note;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1424 }
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1425 if ( uColumn != 50 )
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1426 break;
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1427 strtok(NULL, "\r\t\n");
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1428 }
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1429 if ( uRow != 50 )
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1430 {
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1431 wsprintfA(Text, "Error Parsing Potion Table at Row: %d Column: %d", uRow, uColumn);
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1432 MessageBoxA(0, Text, "Parsing Error", MB_ICONHAND|MB_CANCELTRYCONTINUE);
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1433 }
8113753ed2ae more item init fixing
Gloval
parents: 193
diff changeset
1434 }
0
Ritor1
parents:
diff changeset
1435
Ritor1
parents:
diff changeset
1436
Ritor1
parents:
diff changeset
1437 //----- (00456442) --------------------------------------------------------
Ritor1
parents:
diff changeset
1438 unsigned int ItemGen::GetValue()
463
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1439 {
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1440 unsigned int uBaseValue; // edi@1
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1441 unsigned int bonus;
0
Ritor1
parents:
diff changeset
1442
463
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1443 uBaseValue = pItemsTable->pItems[this->uItemID].uValue;
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1444 if ( this->uAttributes & ITEM_TEMP_BONUS || pItemsTable->IsMaterialNonCommon(this) )
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1445 return uBaseValue;
570
f54481c85df8 itemgen working, i hope
Gloval
parents: 559
diff changeset
1446 if (uEnchantmentType )
463
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1447 return uBaseValue + 100 * _bonus_strength;;
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1448 if (uSpecEnchantmentType )
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1449 {
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1450 bonus = pItemsTable->pSpecialEnchantments[uSpecEnchantmentType].iTreasureLevel;
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1451 if ( bonus > 10 )
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1452 return uBaseValue + bonus;
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1453 else
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1454 return uBaseValue * bonus;
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1455 }
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1456 return uBaseValue;
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1457 }
0
Ritor1
parents:
diff changeset
1458
Ritor1
parents:
diff changeset
1459 //----- (00456499) --------------------------------------------------------
Ritor1
parents:
diff changeset
1460 const char *ItemGen::GetDisplayName()
Ritor1
parents:
diff changeset
1461 {
1567
9f8b3e904e14 Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents: 1545
diff changeset
1462 if (IsIdentified())
366
85edec9da96b _4B910F_shop_interaction
Nomad
parents: 365
diff changeset
1463 return GetIdentifiedName();
0
Ritor1
parents:
diff changeset
1464 else
366
85edec9da96b _4B910F_shop_interaction
Nomad
parents: 365
diff changeset
1465 return pItemsTable->pItems[uItemID].pUnidentifiedName;
0
Ritor1
parents:
diff changeset
1466 }
Ritor1
parents:
diff changeset
1467
Ritor1
parents:
diff changeset
1468 //----- (004564B3) --------------------------------------------------------
Ritor1
parents:
diff changeset
1469 const char *ItemGen::GetIdentifiedName()
Ritor1
parents:
diff changeset
1470 {
377
243418228760 GetIdentifiedName
Gloval
parents: 375
diff changeset
1471 unsigned __int8 equip_type;
243418228760 GetIdentifiedName
Gloval
parents: 375
diff changeset
1472 const char *player_name;
243418228760 GetIdentifiedName
Gloval
parents: 375
diff changeset
1473 const char *nameModificator;
243418228760 GetIdentifiedName
Gloval
parents: 375
diff changeset
1474 const char *format_str;
0
Ritor1
parents:
diff changeset
1475
377
243418228760 GetIdentifiedName
Gloval
parents: 375
diff changeset
1476 equip_type = pItemsTable->pItems[uItemID].uEquipType;
243418228760 GetIdentifiedName
Gloval
parents: 375
diff changeset
1477 if ( (equip_type == EQUIP_REAGENT) || (equip_type == EQUIP_POTION) || (equip_type == EQUIP_GOLD) )
0
Ritor1
parents:
diff changeset
1478 {
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
1479 sprintf(item__getname_buffer.data(), "%s", pItemsTable->pItems[uItemID].pName);
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
1480 return item__getname_buffer.data();
0
Ritor1
parents:
diff changeset
1481 }
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
1482 sprintf(item__getname_buffer.data(), "%s", pItemsTable->pItems[uItemID].pName);
1358
61010a655c94 a few itemID changed to their enum values + added a few new ones
Grumpy7
parents: 1297
diff changeset
1483 if ( uItemID == ITEM_LICH_JAR_FULL ) //Lich Jar
0
Ritor1
parents:
diff changeset
1484 {
377
243418228760 GetIdentifiedName
Gloval
parents: 375
diff changeset
1485 if ( (uHolderPlayer >0 )&& (uHolderPlayer <= 4) )
0
Ritor1
parents:
diff changeset
1486 {
377
243418228760 GetIdentifiedName
Gloval
parents: 375
diff changeset
1487 player_name = pPlayers[uHolderPlayer]->pName;
243418228760 GetIdentifiedName
Gloval
parents: 375
diff changeset
1488 strlen(player_name);
243418228760 GetIdentifiedName
Gloval
parents: 375
diff changeset
1489 if ( player_name[strlen(player_name) - 1] == 's' )
243418228760 GetIdentifiedName
Gloval
parents: 375
diff changeset
1490 format_str = pGlobalTXT_LocalizationStrings[655]; //"%s' Jar"
0
Ritor1
parents:
diff changeset
1491 else
377
243418228760 GetIdentifiedName
Gloval
parents: 375
diff changeset
1492 format_str = pGlobalTXT_LocalizationStrings[654]; //"%s's Jar"
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
1493 sprintf(item__getname_buffer.data(), format_str, pPlayers[uHolderPlayer]->pName);
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
1494 return item__getname_buffer.data();
0
Ritor1
parents:
diff changeset
1495 }
Ritor1
parents:
diff changeset
1496 }
377
243418228760 GetIdentifiedName
Gloval
parents: 375
diff changeset
1497 if ( !pItemsTable->IsMaterialNonCommon(this) )
0
Ritor1
parents:
diff changeset
1498 {
570
f54481c85df8 itemgen working, i hope
Gloval
parents: 559
diff changeset
1499 if ( uEnchantmentType )
0
Ritor1
parents:
diff changeset
1500 {
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
1501 strcat(item__getname_buffer.data(), " ");
570
f54481c85df8 itemgen working, i hope
Gloval
parents: 559
diff changeset
1502 nameModificator = pItemsTable->pEnchantments[uEnchantmentType-1].pOfName;
0
Ritor1
parents:
diff changeset
1503 }
Ritor1
parents:
diff changeset
1504 else
Ritor1
parents:
diff changeset
1505 {
377
243418228760 GetIdentifiedName
Gloval
parents: 375
diff changeset
1506 if ( !uSpecEnchantmentType )
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
1507 return item__getname_buffer.data();
377
243418228760 GetIdentifiedName
Gloval
parents: 375
diff changeset
1508 if ( uSpecEnchantmentType == 16 //Drain Hit Points from target.
243418228760 GetIdentifiedName
Gloval
parents: 375
diff changeset
1509 || uSpecEnchantmentType == 39 //Double damage vs Demons.
243418228760 GetIdentifiedName
Gloval
parents: 375
diff changeset
1510 || uSpecEnchantmentType == 40 //Double damage vs Dragons
243418228760 GetIdentifiedName
Gloval
parents: 375
diff changeset
1511 || uSpecEnchantmentType == 45 //+5 Speed and Accuracy
243418228760 GetIdentifiedName
Gloval
parents: 375
diff changeset
1512 || uSpecEnchantmentType == 56 //+5 Might and Endurance.
243418228760 GetIdentifiedName
Gloval
parents: 375
diff changeset
1513 || uSpecEnchantmentType == 57 //+5 Intellect and Personality.
243418228760 GetIdentifiedName
Gloval
parents: 375
diff changeset
1514 || uSpecEnchantmentType == 58 //Increased Value.
243418228760 GetIdentifiedName
Gloval
parents: 375
diff changeset
1515 || uSpecEnchantmentType == 60 //+3 Unarmed and Dodging skills
243418228760 GetIdentifiedName
Gloval
parents: 375
diff changeset
1516 || uSpecEnchantmentType == 61 //+3 Stealing and Disarm skills.
243418228760 GetIdentifiedName
Gloval
parents: 375
diff changeset
1517 || uSpecEnchantmentType == 59 //Increased Weapon speed.
243418228760 GetIdentifiedName
Gloval
parents: 375
diff changeset
1518 || uSpecEnchantmentType == 63 //Double Damage vs. Elves.
243418228760 GetIdentifiedName
Gloval
parents: 375
diff changeset
1519 || uSpecEnchantmentType == 64 //Double Damage vs. Undead.
243418228760 GetIdentifiedName
Gloval
parents: 375
diff changeset
1520 || uSpecEnchantmentType == 67 //Adds 5 points of Body damage and +2 Disarm skill.
243418228760 GetIdentifiedName
Gloval
parents: 375
diff changeset
1521 || uSpecEnchantmentType == 68 ) //Adds 6-8 points of Cold damage and +5 Armor Class.
243418228760 GetIdentifiedName
Gloval
parents: 375
diff changeset
1522 { //enchantment and name positions inverted!
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
1523 sprintf( item__getname_buffer.data(), "%s %s",
377
243418228760 GetIdentifiedName
Gloval
parents: 375
diff changeset
1524 pItemsTable->pSpecialEnchantments[uSpecEnchantmentType-1].pNameAdd,
243418228760 GetIdentifiedName
Gloval
parents: 375
diff changeset
1525 pItemsTable->pItems[uItemID].pName);
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
1526 return item__getname_buffer.data();
0
Ritor1
parents:
diff changeset
1527 }
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
1528 strcat(item__getname_buffer.data(), " ");
377
243418228760 GetIdentifiedName
Gloval
parents: 375
diff changeset
1529 nameModificator = pItemsTable->pSpecialEnchantments[uSpecEnchantmentType-1].pNameAdd;
0
Ritor1
parents:
diff changeset
1530 }
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
1531 strcat(item__getname_buffer.data(), nameModificator);
0
Ritor1
parents:
diff changeset
1532 }
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
1533 return item__getname_buffer.data();
0
Ritor1
parents:
diff changeset
1534 }
Ritor1
parents:
diff changeset
1535
Ritor1
parents:
diff changeset
1536
Ritor1
parents:
diff changeset
1537 //----- (00456620) --------------------------------------------------------
385
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
1538 void ItemsTable::GenerateItem(int treasure_level, unsigned int uTreasureType, ItemGen *out_item)
559
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1539 {
0
Ritor1
parents:
diff changeset
1540
559
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1541 ItemsTable *v5; // edi@1
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1542 int v6; // ebx@3
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1543 int *v7; // ecx@33
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1544 //int v8; // eax@34
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1545 //int v9; // eax@39
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1546 int current_chance; // ebx@43
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1547 int tmp_chance; // ecx@47
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1548 unsigned int *v12; // edx@48
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1549 unsigned int v13; // eax@49
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1550 signed int v14; // ebx@52
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1551 int v15; // eax@53
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1552 signed int v16; // eax@55
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1553 int v17; // ebx@57
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1554 int v18; // edx@62
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1555 signed int v19; // ebx@70
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1556 unsigned __int8 v20; // al@81
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1557 int v21; // eax@84
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1558 int v22; // ebx@85
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1559 int v23; // eax@86
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1560 int v24; // ebx@86
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1561 int special_chance; // edx@86
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1562 int v26; // edx@89
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1563 unsigned int v27; // eax@89
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1564 int i; // ebx@89
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1565 unsigned int v29; // ecx@90
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1566 int v30; // ebx@91
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1567 int v31; // eax@91
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1568 int v32; // ecx@91
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1569 int v33; // eax@91
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1570 int v34; // eax@97
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1571 unsigned __int8 v35; // sf@97
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1572 unsigned __int8 v36; // of@97
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1573 int v37; // ebx@98
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1574 int v38; // edx@99
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1575 signed int v39; // ebx@101
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1576 int v40; // ecx@102
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1577 char v41; // zf@107
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1578 char v42; // al@108
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1579 char v43; // al@111
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1580 int *v44; // edx@118
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1581 int v45; // eax@120
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1582 int v46; // edx@120
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1583 int j; // eax@121
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1584 unsigned int v48; // ecx@123
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1585 int v49; // eax@123
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1586 int v50; // eax@123
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1587 int val_list[800]; // [sp+Ch] [bp-C88h]@33
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1588 int total_chance; // [sp+C8Ch] [bp-8h]@33
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1589 int v53; // [sp+C90h] [bp-4h]@1
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1590 int v54; // [sp+C9Ch] [bp+8h]@3
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1591 //int v55; // [sp+CA0h] [bp+Ch]@34
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1592 signed int v56; // [sp+CA0h] [bp+Ch]@55
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1593 int v57; // [sp+CA0h] [bp+Ch]@62
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1594 int *v58; // [sp+CA0h] [bp+Ch]@102
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1595 int v59; // [sp+CA0h] [bp+Ch]@123
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1596 //signed int a2a; // [sp+CA4h] [bp+10h]@33
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1597 int a2b; // [sp+CA4h] [bp+10h]@101
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1598 int a2c; // [sp+CA4h] [bp+10h]@120
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1599
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1600 v5 = this;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1601 if (!out_item)
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1602 out_item = (ItemGen *)pAllocator->AllocNamedChunk(out_item, sizeof(*out_item), "newItemGen");
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1603 memset(out_item, 0, sizeof(*out_item));
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1604
228
46ae2602aceb Item generation doesn't crash (thou still generates weird stuff)
Nomad
parents: 224
diff changeset
1605
559
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1606 v6 = treasure_level - 1;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1607 v54 = treasure_level - 1;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1608 if ( uTreasureType ) //generate known treasure type
0
Ritor1
parents:
diff changeset
1609 {
559
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1610 ITEM_EQUIP_TYPE requested_equip;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1611 PLAYER_SKILL_TYPE requested_skill = PLAYER_SKILL_INVALID;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1612 switch (uTreasureType)
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1613 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 762
diff changeset
1614 case 20: requested_equip = EQUIP_OFF_HAND; break;
559
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1615 case 21: requested_equip = EQUIP_ARMOUR; break;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1616 case 22: requested_skill = PLAYER_SKILL_MISC; break;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1617 case 23: requested_skill = PLAYER_SKILL_SWORD; break;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1618 case 24: requested_skill = PLAYER_SKILL_DAGGER; break;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1619 case 25: requested_skill = PLAYER_SKILL_AXE; break;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1620 case 26: requested_skill = PLAYER_SKILL_SPEAR; break;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1621 case 27: requested_skill = PLAYER_SKILL_BOW; break;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1622 case 28: requested_skill = PLAYER_SKILL_MACE; break;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1623 case 29: requested_skill = PLAYER_SKILL_CLUB; break;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1624 case 30: requested_skill = PLAYER_SKILL_STAFF; break;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1625 case 31: requested_skill = PLAYER_SKILL_LEATHER; break;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1626 case 32: requested_skill = PLAYER_SKILL_CHAIN; break;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1627 case 33: requested_skill = PLAYER_SKILL_PLATE; break;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1628 case 34: requested_equip = EQUIP_SHIELD; break;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1629 case 35: requested_equip = EQUIP_HELMET; break;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1630 case 36: requested_equip = EQUIP_BELT; break;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1631 case 37: requested_equip = EQUIP_CLOAK; break;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1632 case 38: requested_equip = EQUIP_GAUNTLETS; break;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1633 case 39: requested_equip = EQUIP_BOOTS; break;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1634 case 40: requested_equip = EQUIP_RING; break;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1635 case 41: requested_equip = EQUIP_AMULET; break;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1636 case 42: requested_equip = EQUIP_WAND; break;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1637 case 43: requested_equip = EQUIP_SPELL_SCROLL; break;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1638 case 44: requested_equip = EQUIP_POTION; break;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1639 case 45: requested_equip = EQUIP_REAGENT; break;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1640 case 46: requested_equip = EQUIP_GEM; break;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1641 default:
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1642 __debugbreak(); // check this condition
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1643 requested_equip = (ITEM_EQUIP_TYPE)(uTreasureType - 1);
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1644 break;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1645 }
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1646 memset(val_list, 0, sizeof(val_list));
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1647 total_chance = 0;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1648 j=0;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1649 //a2a = 1;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1650 if (requested_skill == PLAYER_SKILL_INVALID) // no skill for this item needed
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1651 {
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1652 for (uint i = 1; i < 500; ++i)
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1653 {
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1654 if (pItems[i].uEquipType == requested_equip)
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1655 {
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1656 val_list[j] = i;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1657 ++j;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1658 total_chance += pItems[i].uChanceByTreasureLvl[treasure_level - 1];
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1659 }
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1660 }
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1661 }
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1662 else //have needed skill
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1663 {
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1664 for (uint i = 1; i < 500; ++i)
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1665 {
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1666 if (pItems[i].uSkillType == requested_skill)
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1667 {
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1668 val_list[j] = i;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1669 ++j;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1670 total_chance += pItems[i].uChanceByTreasureLvl[treasure_level - 1];
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1671 }
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1672 }
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1673 }
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1674
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1675 current_chance = 0;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1676 if ( total_chance )
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1677 current_chance = rand() % total_chance;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1678
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1679 out_item->uItemID = val_list[0];
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1680 if (!out_item->uItemID)
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1681 out_item->uItemID = 1;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1682
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1683 if ( pItems[out_item->uItemID].uChanceByTreasureLvl[treasure_level - 1] < current_chance )
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1684 {
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1685 j=0;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1686 tmp_chance=pItems[out_item->uItemID].uChanceByTreasureLvl[treasure_level - 1];
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1687 do
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1688 {
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1689 ++j;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1690 out_item->uItemID = val_list[j];
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1691 tmp_chance += pItems[val_list[j]].uChanceByTreasureLvl[treasure_level - 1];
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1692 }
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1693 while ( tmp_chance < current_chance );
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1694 }
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1695
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1696 if (pItems[out_item->uItemID].uEquipType == EQUIP_POTION && out_item->uItemID != ITEM_POTION_BOTTLE )
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1697 {// if it potion set potion spec
570
f54481c85df8 itemgen working, i hope
Gloval
parents: 559
diff changeset
1698 out_item->uEnchantmentType = 0;
559
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1699 for (int i=0; i<2; ++i)
570
f54481c85df8 itemgen working, i hope
Gloval
parents: 559
diff changeset
1700 out_item->uEnchantmentType += rand() % 4 + 1;
f54481c85df8 itemgen working, i hope
Gloval
parents: 559
diff changeset
1701 out_item->uEnchantmentType = out_item->uEnchantmentType * treasure_level;
559
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1702 }
0
Ritor1
parents:
diff changeset
1703 }
559
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1704 else
0
Ritor1
parents:
diff changeset
1705 {
559
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1706 //artifact
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1707 v56 = 0;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1708 for(int i=0; i<29; ++i)
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1709 v56 += pParty->pIsArtifactFound[i];
228
46ae2602aceb Item generation doesn't crash (thou still generates weird stuff)
Nomad
parents: 224
diff changeset
1710
559
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1711 v17 = rand() % 29;
385
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
1712
559
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1713 if ( v6 == 5 && (rand() % 100 < 5) && !pParty->pIsArtifactFound[v17] && v56 < 13 )
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1714 {
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1715 pParty->pIsArtifactFound[v17] = 1;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1716 out_item->uAttributes = 0;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1717 out_item->uItemID = v17 + 500;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1718 SetSpecialBonus(out_item);
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1719 return;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1720 }
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1721
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1722 v57 = 0;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1723 v18 = rand() % v5->uChanceByTreasureLvlSumm[treasure_level - 1];
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1724 out_item->uItemID = 0;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1725 if ( v18 > 0 )
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1726 {
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1727 do
598
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
1728 {
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
1729 v57 += pItems[out_item->uItemID + 1].uChanceByTreasureLvl[v6];
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
1730 ++out_item->uItemID;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
1731 }
559
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1732 while ( v57 < v18 );
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1733 }
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1734
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1735 if ( !v18 )
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1736 out_item->uItemID = 1;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1737 if ( !out_item->uItemID )
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1738 out_item->uItemID = 1;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1739 if (pItems[out_item->uItemID].uEquipType == EQUIP_POTION && out_item->uItemID != ITEM_POTION_BOTTLE )
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1740 {// if it potion set potion spec
570
f54481c85df8 itemgen working, i hope
Gloval
parents: 559
diff changeset
1741 out_item->uEnchantmentType = 0;
559
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1742 for (int i=0; i<2; ++i)
570
f54481c85df8 itemgen working, i hope
Gloval
parents: 559
diff changeset
1743 out_item->uEnchantmentType += rand() % 4 + 1;
f54481c85df8 itemgen working, i hope
Gloval
parents: 559
diff changeset
1744 out_item->uEnchantmentType = out_item->uEnchantmentType * treasure_level;
559
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1745 }
570
f54481c85df8 itemgen working, i hope
Gloval
parents: 559
diff changeset
1746 out_item->uEnchantmentType = out_item->uEnchantmentType * treasure_level;
559
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1747 }
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1748
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1749 if ( out_item->uItemID == ITEM_SPELLBOOK_LIGHT_DIVINE_INTERVENTION
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1750 && !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 239) )
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1751 out_item->uItemID = ITEM_SPELLBOOK_LIGHT_SUN_BURST;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1752 if ( pItemsTable->pItems[out_item->uItemID + 1].uItemID_Rep_St )
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1753 out_item->uAttributes = 0;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1754 else
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1755 out_item->uAttributes = 1;
385
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
1756
559
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1757 if ( pItems[out_item->uItemID].uEquipType != EQUIP_POTION )
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1758 {
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1759 out_item->uSpecEnchantmentType = 0;
570
f54481c85df8 itemgen working, i hope
Gloval
parents: 559
diff changeset
1760 out_item->uEnchantmentType = 0;
559
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1761 }
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1762 //try get special enhansment
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1763 switch (pItems[out_item->uItemID].uEquipType)
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1764 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 762
diff changeset
1765 case EQUIP_OFF_HAND:
cfc65feef029 * Player Recovery Times
Nomad
parents: 762
diff changeset
1766 case EQUIP_MAIN_HAND :
559
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1767 case EQUIP_BOW :
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1768 if ( !uBonusChanceWpSpecial[v6] )
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1769 return;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1770 if ((rand() % 100)>=uBonusChanceWpSpecial[v6])
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1771 return;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1772 break;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1773 case EQUIP_ARMOUR :
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1774 case EQUIP_SHIELD :
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1775 case EQUIP_HELMET :
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1776 case EQUIP_BELT :
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1777 case EQUIP_CLOAK :
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1778 case EQUIP_GAUNTLETS :
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1779 case EQUIP_BOOTS :
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1780 case EQUIP_RING :
570
f54481c85df8 itemgen working, i hope
Gloval
parents: 559
diff changeset
1781
559
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1782 if ( !uBonusChanceStandart[v6] )
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1783 return;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1784 special_chance = rand() % 100;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1785 if ( special_chance < uBonusChanceStandart[v6])
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1786 {
570
f54481c85df8 itemgen working, i hope
Gloval
parents: 559
diff changeset
1787 v26 = rand() %pEnchantmentsSumm[pItems[out_item->uItemID].uEquipType-3];
f54481c85df8 itemgen working, i hope
Gloval
parents: 559
diff changeset
1788 out_item->uEnchantmentType = 0;
f54481c85df8 itemgen working, i hope
Gloval
parents: 559
diff changeset
1789 v27=pEnchantments[out_item->uEnchantmentType].to_item[pItems[out_item->uItemID].uEquipType-3];
f54481c85df8 itemgen working, i hope
Gloval
parents: 559
diff changeset
1790 if (v26>v27 )
f54481c85df8 itemgen working, i hope
Gloval
parents: 559
diff changeset
1791 {
f54481c85df8 itemgen working, i hope
Gloval
parents: 559
diff changeset
1792 do
559
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1793 {
570
f54481c85df8 itemgen working, i hope
Gloval
parents: 559
diff changeset
1794 ++out_item->uEnchantmentType;
f54481c85df8 itemgen working, i hope
Gloval
parents: 559
diff changeset
1795 v27+=pEnchantments[out_item->uEnchantmentType].to_item[pItems[out_item->uItemID].uEquipType-3];
f54481c85df8 itemgen working, i hope
Gloval
parents: 559
diff changeset
1796 } while (v26>v27);
f54481c85df8 itemgen working, i hope
Gloval
parents: 559
diff changeset
1797 }
f54481c85df8 itemgen working, i hope
Gloval
parents: 559
diff changeset
1798 ++out_item->uEnchantmentType;
f54481c85df8 itemgen working, i hope
Gloval
parents: 559
diff changeset
1799
f54481c85df8 itemgen working, i hope
Gloval
parents: 559
diff changeset
1800 v33 = rand() % (bonus_ranges[v6].maxR - bonus_ranges[v6].minR + 1);
f54481c85df8 itemgen working, i hope
Gloval
parents: 559
diff changeset
1801 out_item->_bonus_strength = v33 + bonus_ranges[v6].minR;
f54481c85df8 itemgen working, i hope
Gloval
parents: 559
diff changeset
1802 v32 = out_item->uEnchantmentType - 1;
f54481c85df8 itemgen working, i hope
Gloval
parents: 559
diff changeset
1803 if ( v32 == 21 || v32 == 22 || v32 == 23 ) //Armsmaster skill, Dodge skill, Unarmed skill
f54481c85df8 itemgen working, i hope
Gloval
parents: 559
diff changeset
1804 out_item->_bonus_strength = out_item->_bonus_strength/2;
559
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1805 if ( out_item->_bonus_strength <= 0 )
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1806 out_item->_bonus_strength = 1;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1807 return;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1808
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1809 }
570
f54481c85df8 itemgen working, i hope
Gloval
parents: 559
diff changeset
1810 if ( !uBonusChanceSpecial[v6])
f54481c85df8 itemgen working, i hope
Gloval
parents: 559
diff changeset
1811 return;
559
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1812 v34 = uBonusChanceStandart[v6] + uBonusChanceSpecial[v6];
570
f54481c85df8 itemgen working, i hope
Gloval
parents: 559
diff changeset
1813 if ( special_chance>v34 )
559
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1814 return;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1815 break;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1816 case EQUIP_WAND:
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1817 out_item->uNumCharges = rand() % 6 + pItemsTable->pItems[out_item->uItemID].uDamageMod + 1;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1818 out_item->uMaxCharges = out_item->uNumCharges;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1819 default:
224
9917d3b4925e items init refactored
Gloval
parents: 223
diff changeset
1820 return;
559
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1821 }
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1822
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1823 j=0;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1824 int spc_sum=0;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1825 int spc;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1826 memset(&val_list, 0, 3200);
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1827 for (int i=0; i<pSpecialEnchantments_count;++i)
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1828 {
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1829 int tr_lv= pSpecialEnchantments[i].iTreasureLevel;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1830 switch ( treasure_level - 1 )
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1831 {
0
Ritor1
parents:
diff changeset
1832 case 2:
559
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1833 if ((tr_lv==1)||(tr_lv==0))
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1834 {
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1835 spc=pSpecialEnchantments[i].to_item_apply[pItems[out_item->uItemID].uEquipType];
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1836 spc_sum+=spc;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1837 if(spc)
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1838 {
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1839 val_list[j++]=i;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1840 }
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1841 }
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1842 break;
0
Ritor1
parents:
diff changeset
1843 case 3:
559
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1844 if ((tr_lv==2)||(tr_lv==1)||(tr_lv==0))
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1845 {
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1846 spc=pSpecialEnchantments[i].to_item_apply[pItems[out_item->uItemID].uEquipType];
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1847 spc_sum+=spc;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1848 if(spc)
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1849 {
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1850 val_list[j++]=i;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1851 }
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1852 }
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1853 break;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1854 case 4:
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1855 if ((tr_lv==3)||(tr_lv==2)||(tr_lv==1))
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1856 {
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1857 spc=pSpecialEnchantments[i].to_item_apply[pItems[out_item->uItemID].uEquipType];
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1858 spc_sum+=spc;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1859 if(spc)
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1860 {
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1861 val_list[j++]=i;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1862 }
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1863 }
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1864 break;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1865 case 5:
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1866 if (tr_lv==3)
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1867 {
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1868 spc=pSpecialEnchantments[i].to_item_apply[pItems[out_item->uItemID].uEquipType];
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1869 spc_sum+=spc;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1870 if(spc)
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1871 {
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1872 val_list[j++]=i;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1873 }
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1874 }
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1875 break;
0
Ritor1
parents:
diff changeset
1876 }
559
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1877 }
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1878
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1879 v46 = rand()%spc_sum+1;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1880 j=0;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1881 out_item->uSpecEnchantmentType =val_list[j];
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1882 v45=pSpecialEnchantments[val_list[j]].to_item_apply[pItems[out_item->uItemID].uEquipType];
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1883 if (v45<v46)
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1884 {
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1885 do
245
f070b49d40dd goto cleaning
zipi
parents: 243
diff changeset
1886 {
559
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1887 ++j;
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1888 out_item->uSpecEnchantmentType=val_list[j];
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1889 v45+=pSpecialEnchantments[val_list[j]].to_item_apply[pItems[out_item->uItemID].uEquipType];
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1890 } while (v45<v46);
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1891 }
09108e73f2f4 item gen fixes (not full)
Gloval
parents: 526
diff changeset
1892 ++out_item->uSpecEnchantmentType;
0
Ritor1
parents:
diff changeset
1893 }
Ritor1
parents:
diff changeset
1894
Ritor1
parents:
diff changeset
1895 //----- (004505CC) --------------------------------------------------------
Ritor1
parents:
diff changeset
1896 bool ItemGen::GenerateArtifact()
Ritor1
parents:
diff changeset
1897 {
Ritor1
parents:
diff changeset
1898 signed int uNumArtifactsNotFound; // esi@1
463
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1899 int artifacts_list[32];
0
Ritor1
parents:
diff changeset
1900
385
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
1901 memset(artifacts_list, 0,sizeof(artifacts_list));
0
Ritor1
parents:
diff changeset
1902 uNumArtifactsNotFound = 0;
385
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
1903
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
1904 for (int i=500;i<529;++i)
484
4bd56919f075 avard quest guild bits
Gloval
parents: 475
diff changeset
1905 if ( !pParty->pIsArtifactFound[i-500] )
385
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
1906 artifacts_list[uNumArtifactsNotFound++] = i;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
1907
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
1908 Reset();
0
Ritor1
parents:
diff changeset
1909 if ( uNumArtifactsNotFound )
Ritor1
parents:
diff changeset
1910 {
385
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
1911 uItemID = artifacts_list[rand() % uNumArtifactsNotFound];
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
1912 pItemsTable->SetSpecialBonus(this);
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
1913 return true;
0
Ritor1
parents:
diff changeset
1914 }
Ritor1
parents:
diff changeset
1915 else
385
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
1916 return false;
b509ef97807a additional dmg
Gloval
parents: 377
diff changeset
1917
0
Ritor1
parents:
diff changeset
1918 }
461
197461e5acec moved shop generators to item.cpp
Gloval
parents: 436
diff changeset
1919 //----- (004B8E3D) --------------------------------------------------------
463
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1920 void GenerateStandartShopItems()
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1921 {
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1922 signed int item_count;
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1923 signed int shop_index;
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1924 int treasure_lvl;
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1925 int item_class;
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1926 int mdf;
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1927
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1928 shop_index = (signed int)window_SpeakInHouse->ptr_1C;
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1929 if ( uItemsAmountPerShopType[p2DEvents[shop_index - 1].uType] )
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1930 {
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1931 for (item_count=0; item_count<=uItemsAmountPerShopType[p2DEvents[shop_index - 1].uType]; ++item_count )
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1932 {
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1933 if (shop_index<=14) //weapon shop
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1934 {
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1935 treasure_lvl = shopWeap_variation_ord[shop_index].treasure_level;
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1936 item_class =shopWeap_variation_ord[shop_index].item_class[rand() % 4];
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1937 }
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1938 else if (shop_index<=28) //armor shop
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1939 {
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1940 mdf =0;
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1941 if (item_count > 3)
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1942 ++mdf;// rechek offsets
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1943 treasure_lvl = shopArmr_variation_ord[2*(shop_index-15)+mdf].treasure_level;
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1944 item_class =shopArmr_variation_ord[2*(shop_index-15)+mdf].item_class[rand() % 4];
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1945 }
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1946 else if (shop_index<=41) //magic shop
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1947 {
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1948 treasure_lvl = shopMagic_treasure_lvl[shop_index-28];
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1949 item_class = 22; //misc
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1950 }
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1951 else if (shop_index<=53) //alchemist shop
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1952 {
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1953 if (item_count<6)
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1954 {
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1955 pParty->StandartItemsInShops[shop_index][item_count].Reset();
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1956 pParty->StandartItemsInShops[shop_index][item_count].uItemID = 220; //potion bottle
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1957 continue;
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1958 }
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1959 else
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1960 {
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1961 treasure_lvl = shopAlch_treasure_lvl[shop_index-41];
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1962 item_class = 45; //reagent
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1963 }
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1964 }
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1965 pItemsTable->GenerateItem(treasure_lvl, item_class, &pParty->StandartItemsInShops[shop_index][item_count]);
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1966 pParty->StandartItemsInShops[shop_index][item_count].SetIdentified(); //identified
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1967 }
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1968 }
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1969 pParty->InTheShopFlags[shop_index] = 0;
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1970 }
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1971
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1972 //----- (004B8F94) --------------------------------------------------------
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1973 void GenerateSpecialShopItems()
461
197461e5acec moved shop generators to item.cpp
Gloval
parents: 436
diff changeset
1974 {
463
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1975 signed int item_count;
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1976 signed int shop_index;
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1977 int treasure_lvl;
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1978 int item_class;
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1979 int mdf;
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1980
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1981 shop_index = (signed int)window_SpeakInHouse->ptr_1C;
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1982 if ( uItemsAmountPerShopType[p2DEvents[shop_index - 1].uType] )
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1983 {
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1984 for (item_count=0; item_count<=uItemsAmountPerShopType[p2DEvents[shop_index - 1].uType]; ++item_count )
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1985 {
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1986 if (shop_index<=14) //weapon shop
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1987 {
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1988 treasure_lvl = shopWeap_variation_spc[shop_index].treasure_level;
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1989 item_class = shopWeap_variation_spc[shop_index].item_class[rand() % 4];
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1990 }
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1991 else if (shop_index<=28) //armor shop
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1992 {
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1993 mdf =0;
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1994 if (item_count > 3)
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1995 ++mdf;
470
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
1996 treasure_lvl = shopArmr_variation_spc[2*(shop_index-15)+mdf].treasure_level;
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
1997 item_class =shopArmr_variation_spc[2*(shop_index-15)+mdf].item_class[rand() % 4];
463
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1998 }
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
1999 else if (shop_index<=41) //magic shop
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
2000 {
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
2001 treasure_lvl = shopMagicSpc_treasure_lvl[shop_index-28];
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
2002 item_class = 22; //misc
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
2003 }
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
2004 else if (shop_index<=53) //alchemist shop
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
2005 {
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
2006 if (item_count<6)
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
2007 {
470
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
2008 pParty->SpecialItemsInShops[shop_index][item_count].Reset();
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
2009 pParty->SpecialItemsInShops[shop_index][item_count].uItemID = rand() % 32 + 740; //mscrool
463
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
2010 continue;
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
2011 }
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
2012 else
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
2013 {
470
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
2014 treasure_lvl = shopAlchSpc_treasure_lvl[shop_index-41];
463
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
2015 item_class = 44; //potion
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
2016 }
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
2017 }
470
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
2018 pItemsTable->GenerateItem(treasure_lvl, item_class, &pParty->SpecialItemsInShops[shop_index][item_count]);
fcdaa804074f Tables for shopgenerators
Gloval
parents: 463
diff changeset
2019 pParty->SpecialItemsInShops[shop_index][item_count].SetIdentified(); //identified
463
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
2020 }
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
2021 }
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
2022 pParty->InTheShopFlags[shop_index] = 0;
461
197461e5acec moved shop generators to item.cpp
Gloval
parents: 436
diff changeset
2023 }
197461e5acec moved shop generators to item.cpp
Gloval
parents: 436
diff changeset
2024
197461e5acec moved shop generators to item.cpp
Gloval
parents: 436
diff changeset
2025
463
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
2026 //----- (00450218) --------------------------------------------------------
598
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2027 void GenerateItemsInChest()
526
214d9d47cf1f Chest working, but items are not laid correctly
Gloval
parents: 484
diff changeset
2028 {
598
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2029 unsigned int v0; // eax@1
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2030 Chest *v1; // ebx@1
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2031 MapInfo *v2; // esi@1
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2032 ItemGen *v3; // ebx@2
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2033 int v4; // ebp@4
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2034 int v5; // edi@4
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2035 int v6; // esi@4
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2036 int v7; // eax@4
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2037 signed int v8; // esi@4
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2038 int v9; // edx@4
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2039 int v10; // esi@8
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2040 int v11; // ebp@25
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2041 int v12; // esi@25
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2042 signed int v13; // ebp@27
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2043 ItemGen *v14; // edi@28
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2044 signed int v15; // edx@32
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2045 signed __int64 v16; // qtt@32
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2046 int v17; // esi@34
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2047 signed int v18; // [sp+10h] [bp-18h]@1
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2048 int v19; // [sp+14h] [bp-14h]@4
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2049 MapInfo *v20; // [sp+18h] [bp-10h]@1
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2050 Chest *v21; // [sp+1Ch] [bp-Ch]@1
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2051 int v22; // [sp+20h] [bp-8h]@26
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2052 signed int v23; // [sp+24h] [bp-4h]@2
461
197461e5acec moved shop generators to item.cpp
Gloval
parents: 436
diff changeset
2053
598
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2054 v18 = rand() % 100; //main random
1477
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1358
diff changeset
2055 v0 = pMapStats->GetMapInfo(pCurrentMapName);
598
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2056 // v1 = pChests;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2057 v2 = &pMapStats->pInfos[v0];
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2058 //v21 = pChests;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2059 //v20 = &pMapStats->pInfos[v0];
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2060 for(int i=1; i<20;++i)
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2061 {
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2062 for(int j=0; j<140;++j)
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2063 {
526
214d9d47cf1f Chest working, but items are not laid correctly
Gloval
parents: 484
diff changeset
2064
598
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2065 v3 = &pChests[i].igChestItems[j];
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2066 if ( v3->uItemID < 0 )
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2067 {
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2068 v4 = rand() % 5; //additional items in chect
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2069 v5 = (unsigned __int8)byte_4E8168[abs((int)v3->uItemID)-1][2*v2->Treasure_prob];
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2070 v6 = (unsigned __int8)byte_4E8168[abs((int)v3->uItemID)-1][2*v2->Treasure_prob+1];
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2071 v8 = v6 - v5 + 1;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2072 v9 = v5 + rand() % v8; //treasure level
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2073 if (v9<7)
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2074 {
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2075 if (v18<20)
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2076 {
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2077 v3->Reset();
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2078 }
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2079 else if (v18<60) //generate gold
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2080 {
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2081 v10=0;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2082 v3->Reset();
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2083 switch (v9)
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2084 {
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2085 case 1: //small gold
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2086 v10 = rand() % 51 + 50;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2087 v3->uItemID = 197;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2088 break;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2089 case 2://small gold
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2090 v10 = rand() % 101 + 100;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2091 v3->uItemID = 197;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2092 break;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2093 case 3: //medium
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2094 v10 = rand() % 301 + 200;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2095 v3->uItemID = 198;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2096 break;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2097 case 4: //medium
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2098 v10 = rand() % 501 + 500;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2099 v3->uItemID = 198;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2100 break;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2101 case 5: //big
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2102 v10 = rand() % 1001 + 1000;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2103 v3->uItemID = 199;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2104 break;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2105 case 6: //big
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2106 v10 = rand() % 3001 + 2000;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2107 v3->uItemID = 199;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2108 break;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2109 }
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2110 v3->SetIdentified();
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2111 v3->uSpecEnchantmentType = v10;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2112 }
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2113 else
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2114 {
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2115 pItemsTable->GenerateItem(v9, 0, v3);
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2116 }
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2117
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2118 v12 = 0;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2119 //generate more items
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2120 for (v11=0; v11<v4; ++v11)
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2121 {
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2122
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2123 if ( v12 >= 140 )
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2124 break;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2125 while ( !(pChests[i].igChestItems[v12].uItemID==0) &&(v12<140))
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2126 {
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2127 ++v12;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2128 }
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2129 v14=&pChests[i].igChestItems[v12];
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2130 v18 = rand() % 100;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2131 if (v18<20)
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2132 {
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2133 v3->Reset();
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2134 }
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2135 else if (v18<60) //generate gold
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2136 {
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2137 v10=0;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2138 v3->Reset();
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2139 switch (v9)
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2140 {
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2141 case 1: //small gold
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2142 v10 = rand() % 51 + 50;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2143 v14->uItemID = 197;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2144 break;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2145 case 2://small gold
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2146 v10 = rand() % 101 + 100;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2147 v14->uItemID = 197;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2148 break;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2149 case 3: //medium
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2150 v10 = rand() % 301 + 200;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2151 v14->uItemID = 198;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2152 break;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2153 case 4: //medium
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2154 v10 = rand() % 501 + 500;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2155 v14->uItemID = 198;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2156 break;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2157 case 5: //big
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2158 v10 = rand() % 1001 + 1000;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2159 v14->uItemID = 199;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2160 break;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2161 case 6: //big
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2162 v10 = rand() % 3001 + 2000;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2163 v14->uItemID = 199;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2164 break;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2165 }
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2166 v14->SetIdentified();
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2167 v14->uSpecEnchantmentType = v10;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2168 }
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2169 else
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2170 {
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2171 pItemsTable->GenerateItem(v9, 0, v14);
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2172 }
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2173 ++v12;
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2174 }
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2175 }
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2176 else
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2177 v3->GenerateArtifact();
526
214d9d47cf1f Chest working, but items are not laid correctly
Gloval
parents: 484
diff changeset
2178 }
598
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2179 }
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2180 }
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2181
f8a4a2e0b4c9 fixed random iten generator, chest generator
Gloval
parents: 570
diff changeset
2182 }
461
197461e5acec moved shop generators to item.cpp
Gloval
parents: 436
diff changeset
2183
197461e5acec moved shop generators to item.cpp
Gloval
parents: 436
diff changeset
2184
197461e5acec moved shop generators to item.cpp
Gloval
parents: 436
diff changeset
2185
197461e5acec moved shop generators to item.cpp
Gloval
parents: 436
diff changeset
2186
463
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
2187 // 4505CC: using guessed type int var_A0[32];
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
2188 //----- (004B3703) --------------------------------------------------------
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2189 void FillAviableSkillsToTeach( int _this )
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2190 {
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2191 char *v30; // ecx@65
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2192 unsigned int v29; // edx@56
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2193 int v15; // ecx@19
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2194 int v33; // [sp-4h] [bp-2Ch]@23
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2195 int v34; // [sp-4h] [bp-2Ch]@43
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2196 int v21; // ecx@34
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2197 int v35[5]; // [sp+Ch] [bp-1Ch]@8
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2198 int v37=0; // [sp+24h] [bp-4h]@1*
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2199 int i=0;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2200
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2201 dword_F8B1DC = 0;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2202
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2203 switch (_this)
463
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
2204 {
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2205 case 1: //shop weapon
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2206 for (int i=0; i<2; ++i)
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2207 {
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2208 for (int j=0; j<4; ++j)
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2209 {
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2210 if ( i )
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2211 v21 = shopWeap_variation_spc[(unsigned int)window_SpeakInHouse->ptr_1C].item_class[j];
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2212 else
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2213 v21 = shopWeap_variation_ord[(unsigned int)window_SpeakInHouse->ptr_1C].item_class[j];
463
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
2214
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2215 switch (v21)
463
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
2216 {
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2217 case 23: v34 = 37; break;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2218 case 24: v34 = 38; break;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2219 case 25: v34 = 39; break;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2220 case 26: v34 = 40; break;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2221 case 27: v34 = 41; break;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2222 case 28: v34 = 42; break;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2223 case 30: v34 = 36; break;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2224 default:
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2225 continue;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2226 }
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2227 v37 = sub_4BE571(v34, v35, v37, 5);
463
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
2228 }
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
2229 }
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2230 break;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2231 case 2: //shop armor
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2232
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2233 for (int i=0; i<2; ++i)
463
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
2234 {
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2235 for (int j=0; j<2; ++j)
463
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
2236 {
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2237 for (int k=0; k<4; ++k)
463
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
2238 {
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2239 if ( i )
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2240 v15 = shopArmr_variation_spc[(unsigned int)window_SpeakInHouse->ptr_1C-15+j].item_class[k];
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2241 else
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2242 v15 = shopArmr_variation_ord[(unsigned int)window_SpeakInHouse->ptr_1C-15+j].item_class[k];
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2243 switch (v15)
463
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
2244 {
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2245 case 31: v33 = 45; break;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2246 case 32: v33 = 46; break;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2247 case 33: v33 = 47; break;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2248 case 34: v33 = 44; break;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2249 default:
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2250 continue;
463
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
2251 }
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2252 v37 = sub_4BE571(v33, v35, v37, 5);
463
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
2253 }
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
2254 }
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
2255 }
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2256 break;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2257 case 3: //shop magic
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2258 v37 = 2;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2259 v35[0] = 57;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2260 v35[1] = 59;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2261 break;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2262 case 4: //shop alchemist
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2263 v37 = 2;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2264 v35[0] = 71;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2265 v35[1] = 68;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2266 break;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2267 case 21: //tavern
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2268 v37 = 3;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2269 v35[0] = 70;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2270 v35[1] = 65;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2271 v35[2] = 62;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2272 break;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2273 case 23: //temple
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2274 v37 = 3;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2275 v35[0] = 67;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2276 v35[1] = 66;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2277 v35[2] = 58;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2278 break;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2279 case 30: ///trainig
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2280 v37 = 2;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2281 v35[0] = 69;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2282 v35[1] = 60;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2283 break;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2284 }
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2285 for(i=0;i<v37;++i)
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2286 {
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2287 v29=v35[i];
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2288 switch(v29)
463
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
2289 {
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2290 case 40 :v30 = pSkillNames[4]; break;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2291 case 5 : v30 = pSkillNames[23]; break;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2292 case 36 :v30 = pSkillNames[0]; break;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2293 case 37 :v30 = pSkillNames[1]; break;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2294 case 38 :v30 = pSkillNames[2]; break;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2295 case 39 :v30 = pSkillNames[3]; break;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2296 case 41 :v30 = pSkillNames[5]; break;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2297 case 42 :v30 = pSkillNames[6]; break;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2298 case 44 :v30 = pSkillNames[8]; break;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2299 case 45 :v30 = pSkillNames[9]; break;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2300 case 46 :v30 = pSkillNames[10]; break;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2301 case 47 :v30 = pSkillNames[11]; break;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2302 case 66 :v30 = pSkillNames[30]; break;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2303 case 57 :v30 = pSkillNames[21]; break;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2304 case 58 :v30 = pSkillNames[22]; break;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2305 case 60 :v30 = pSkillNames[24]; break;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2306 case 62 :v30 = pSkillNames[26]; break;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2307 case 65 :v30 = pSkillNames[29]; break;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2308 case 67:v30 = pSkillNames[31]; break;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2309 case 68:v30 = pSkillNames[32]; break;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2310 case 69:v30 = pSkillNames[33]; break;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2311 case 70:v30 = pSkillNames[34]; break;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2312 case 71:v30 = pSkillNames[35]; break;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2313 default:
463
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
2314 v30 = pGlobalTXT_LocalizationStrings[127]; //"No Text!"
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
2315 }
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2316 pShopOptions[dword_F8B1DC] = v30;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2317 ++dword_F8B1DC;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2318 CreateButtonInColumn(i+1, v29);
463
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 461
diff changeset
2319 }
972
c8a0f6d89c70 Some inqury on selecting Knight bug.
Nomad
parents: 901
diff changeset
2320 pDialogueWindow->_41D08F_set_keyboard_control_group(i, 1, 0, 2);
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2321 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 470
diff changeset
2322 }
475
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
2323
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
2324 //----- (004BE571) --------------------------------------------------------
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
2325 int sub_4BE571(int a1, int *a2, int a3, int a4)
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
2326 {
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
2327 int result; // eax@1
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
2328 int i; // esi@3
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
2329
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
2330 result = a3;
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
2331 if ( a3 < a4 )
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
2332 {
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
2333 for ( i = 0; i < a3; ++i )
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
2334 {
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
2335 if ( a1 == a2[i] )
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
2336 break;
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
2337 }
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
2338 if ( i == a3 )
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
2339 {
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
2340 a2[a3] = a1;
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
2341 result = a3 + 1;
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
2342 }
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
2343 return result;
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
2344 }
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
2345 else
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
2346 {
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
2347 return a4;
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
2348 }
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
2349 }
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2350 //----- (0043C91D) --------------------------------------------------------
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2351 int __fastcall GetItemTextureFilename(char *pOut, signed int item_id, int index, int shoulder)
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2352 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2353 int result; // eax@2
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2354 char v5; // zf@3
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2355 const char *v6; // [sp-Ch] [bp-18h]@88
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2356 signed int v7; // [sp-8h] [bp-14h]@61
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2357 int v8; // [sp-4h] [bp-10h]@61
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2358 signed int v9; // [sp-4h] [bp-10h]@69
475
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
2359
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2360 result = 0; //BUG fn is void
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2361 if ( item_id <= 500 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2362 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2363 //v5 = *((char *)&pBloodsplatContainer->std__vector_pBloodsplats[62].field_20 + a2 + 2) == 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2364 v5 = party_has_equipment[(item_id - 100) + 32 + 2] == 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2365 switch ( item_id )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2366 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2367 case 516:
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2368 v5 = byte_5111F6[2] == 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2369 break;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2370 case 505:
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2371 v5 = byte_5111F6[1] == 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2372 break;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2373 case 504:
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2374 v5 = byte_5111F6[0] == 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2375 break;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2376 case 533:
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2377 v5 = byte_5111F6[16] == 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2378 break;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2379 case 512:
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2380 v5 = byte_5111F6[3] == 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2381 break;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2382 case 521:
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2383 v5 = byte_5111F6[4] == 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2384 break;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2385 case 522:
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2386 v5 = byte_5111F6[5] == 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2387 break;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2388 case 523:
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2389 v5 = byte_5111F6[6] == 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2390 break;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2391 case 532:
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2392 v5 = byte_5111F6[7] == 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2393 break;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2394 case 544:
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2395 v5 = byte_5111F6[8] == 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2396 break;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2397 case 524:
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2398 v5 = byte_5111F6[9] == 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2399 break;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2400 case 535:
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2401 v5 = byte_5111F6[10] == 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2402 break;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2403 case 525:
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2404 v5 = byte_5111F6[11] == 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2405 break;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2406 case 530:
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2407 v5 = byte_5111F6[12] == 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2408 break;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2409 case 547:
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2410 v5 = byte_5111F6[13] == 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2411 break;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2412 case 548:
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2413 v5 = byte_5111F6[14] == 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2414 break;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2415 case 550:
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2416 v5 = byte_5111F6[15] == 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2417 break;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2418 default:
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2419 break;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2420 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2421 if ( v5 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2422 return result;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2423 result = 516;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2424 if ( item_id < 66 || item_id > 78 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2425 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2426 if ( item_id == 516 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2427 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2428 if ( !shoulder )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2429 return sprintf(pOut, "item%3.3dv%d", 234, index);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2430 if ( shoulder == 1 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2431 return sprintf(pOut, "item%3.3dv%da1", 234, index);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2432 if ( shoulder == 2 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2433 return sprintf(pOut, "item%3.3dv%da2", 234, index);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2434 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2435 if ( item_id != 504 && item_id != 505 && item_id != 533 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2436 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2437 if ( (item_id < 100 || item_id > 104) && item_id != 524 && item_id != 535 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2438 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2439 if ( item_id >= 115 && item_id <= 119 || item_id == 512 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2440 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2441 if ( item_id == 512 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2442 item_id = 312;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2443 return sprintf(pOut, "item%3.3dv%d", item_id, index);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2444 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2445 if ( (item_id < 89 || item_id > 99) && item_id != 521 && item_id != 522 && item_id != 523 && item_id != 532 && item_id != 544 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2446 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2447 result = 525;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2448 if ( (item_id < 105 || item_id > 109) && item_id != 525 && item_id != 530 && item_id != 547 && item_id != 548 && item_id != 550 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2449 return result;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2450 switch ( item_id )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2451 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2452 case 525:
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2453 item_id = 325;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2454 break;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2455 case 530:
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2456 item_id = 330;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2457 break;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2458 case 547:
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2459 item_id = 347;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2460 break;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2461 case 548:
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2462 item_id = 348;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2463 break;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2464 case 550:
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2465 item_id = 350;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2466 break;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2467 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2468 if ( !shoulder )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2469 return sprintf(pOut, "item%3.3dv%d", item_id, index);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2470 return sprintf(pOut, "item%3.3dv%da1", item_id, index);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2471 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2472 if ( item_id == 521 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2473 return sprintf(pOut, "item%3.3dv%d", 239, index);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2474 if ( item_id == 522 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2475 return sprintf(pOut, "item%3.3dv%d", 240, index);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2476 if ( item_id == 523 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2477 return sprintf(pOut, "item%3.3dv%d", 241, index);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2478 if ( item_id != 532 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2479 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2480 if ( item_id == 544 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2481 item_id = 344;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2482 return sprintf(pOut, "item%3.3dv%d", item_id, index);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2483 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2484 return sprintf(pOut, "item%3.3dv%d", 93, index);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2485 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2486 if ( item_id == 524 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2487 return sprintf(pOut, "item%3.3dv%d", 324, index);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2488 if ( item_id == 535 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2489 item_id = 104;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2490 return sprintf(pOut, "item%3.3dv%d", item_id, index);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2491 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2492 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2493 if ( item_id != 516 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2494 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2495 switch ( item_id )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2496 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2497 case 504:
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2498 item_id = 235;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2499 break;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2500 case 505:
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2501 item_id = 236;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2502 break;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2503 case 533:
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2504 item_id = 73;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2505 break;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2506 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2507 if ( !shoulder )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2508 return sprintf(pOut, "item%3.3dv%d", item_id, index);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2509 if ( shoulder == 1 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2510 return sprintf(pOut, "item%3.3dv%da1", item_id, index);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2511 if ( shoulder == 2 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2512 return sprintf(pOut, "item%3.3dv%da2", item_id, index);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2513 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2514 if ( !shoulder )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2515 return sprintf(pOut, "item%3.3dv%d", 234, index);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2516 if ( shoulder == 1 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2517 return sprintf(pOut, "item%3.3dv%da1", 234, index);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2518 if ( shoulder == 2 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2519 return sprintf(pOut, "item%3.3dv%da2", 234, index);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2520 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2521 result = item_id - 504;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2522 return result;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1231
diff changeset
2523 }
475
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
2524