annotate Items.cpp @ 762:cf2fbac6edc9

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