annotate Items.cpp @ 462:37090bd974f9

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