Mercurial > mm7
changeset 277:24de34910d3e
Слияние
author | Ritor1 |
---|---|
date | Sun, 17 Feb 2013 17:41:36 +0600 |
parents | f809f0465769 (current diff) e3fd201a58f0 (diff) |
children | 0191c3a3271c |
files | mm7_5.cpp |
diffstat | 7 files changed, 1393 insertions(+), 1574 deletions(-) [+] |
line wrap: on
line diff
--- a/AudioPlayer.cpp Sun Feb 17 17:41:15 2013 +0600 +++ b/AudioPlayer.cpp Sun Feb 17 17:41:36 2013 +0600 @@ -2065,7 +2065,7 @@ int Data; // [sp+Ch] [bp-8h]@1 HKEY hKey; // [sp+10h] [bp-4h]@1 char v6; // [sp+1Ch] [bp+8h]@0 - + v6=0; //to fix hKey = 0; cbData = 4; Data = 0;
--- a/Items.cpp Sun Feb 17 17:41:15 2013 +0600 +++ b/Items.cpp Sun Feb 17 17:41:36 2013 +0600 @@ -241,1215 +241,942 @@ //----- (00456D84) -------------------------------------------------------- void ItemsTable::Initialize() -{ - //ItemsTable *v1; // edi@1 - char *v2; // eax@1 - char *v3; // eax@2 - char v4; // cl@3 - int v5; // esi@3 - char *v6; // esi@21 - char *v7; // eax@21 - char *v8; // ecx@22 - char *v9; // eax@26 - char v10; // dl@27 - int v11; // ecx@27 - int v12; // esi@31 - char *v13; // eax@39 - int v14; // esi@40 - char v15; // cl@41 - int v16; // eax@41 - char v17; // zf@53 - int v18; // eax@57 - int *v19; // esi@66 - char *v20; // edx@66 - int v21; // eax@66 - char *v22; // ecx@68 - char *v23; // eax@71 - int v24; // esi@71 - char *v25; // ebx@72 - char v26; // cl@73 - int v27; // eax@73 - char *v28; // ST3C_4@160 - char *v29; // ST3C_4@163 - char *v30; // eax@175 - char *v31; // eax@188 - char v32; // al@190 - char *v33; // eax@199 - const char *v34; // ebx@199 - int v35; // esi@199 - char *v36; // eax@200 - char v37; // dl@201 - int v38; // ecx@201 - char *v39; // esi@229 - char *v40; // eax@229 - char *v41; // ecx@230 - char *v42; // esi@233 - char *v43; // eax@234 - char v44; // dl@235 - int v45; // ecx@235 - signed int v46; // edi@287 - char *v47; // ecx@288 - char v48; // dl@289 - int v49; // eax@289 - int v50; // esi@293 - signed int v51; // edi@312 - char *v52; // ecx@312 - char v53; // dl@313 - int v54; // eax@313 - int v55; // esi@317 - signed int v56; // edi@348 - char *v57; // eax@348 - char v58; // dl@349 - int v59; // ecx@349 - int v60; // esi@353 - char *Str; // [sp+Ch] [bp-18h]@1 - signed int Stra; // [sp+Ch] [bp-18h]@22 - signed int Strb; // [sp+Ch] [bp-18h]@25 - signed int Strc; // [sp+Ch] [bp-18h]@39 - signed int Strd; // [sp+Ch] [bp-18h]@66 - signed int Stre; // [sp+Ch] [bp-18h]@156 - const char **Strf; // [sp+Ch] [bp-18h]@176 - const char **Strg; // [sp+Ch] [bp-18h]@182 - signed int Strh; // [sp+Ch] [bp-18h]@230 - signed int Stri; // [sp+Ch] [bp-18h]@311 - char **Strj; // [sp+Ch] [bp-18h]@347 - int v72; // [sp+10h] [bp-14h]@7 - signed int v73; // [sp+10h] [bp-14h]@21 - int v74; // [sp+10h] [bp-14h]@45 - int v75; // [sp+10h] [bp-14h]@77 - int v76; // [sp+10h] [bp-14h]@205 - signed int v77; // [sp+10h] [bp-14h]@229 - int v78; // [sp+10h] [bp-14h]@239 - signed int v79; // [sp+14h] [bp-10h]@1 - char *v80; // [sp+14h] [bp-10h]@39 - char *v81; // [sp+14h] [bp-10h]@175 - char *v82; // [sp+14h] [bp-10h]@188 - int v83; // [sp+18h] [bp-Ch]@67 - size_t v84; // [sp+18h] [bp-Ch]@156 - signed int v85; // [sp+18h] [bp-Ch]@176 - signed int v86; // [sp+18h] [bp-Ch]@182 - signed int v87; // [sp+18h] [bp-Ch]@233 - signed int v88; // [sp+1Ch] [bp-8h]@2 - signed int v89; // [sp+1Ch] [bp-8h]@26 - signed int v90; // [sp+1Ch] [bp-8h]@40 - signed int v91; // [sp+1Ch] [bp-8h]@72 - signed int v92; // [sp+1Ch] [bp-8h]@200 - signed int v93; // [sp+1Ch] [bp-8h]@234 - signed int v94; // [sp+1Ch] [bp-8h]@288 - signed int v95; // [sp+1Ch] [bp-8h]@312 - signed int v96; // [sp+1Ch] [bp-8h]@348 - signed int v97; // [sp+20h] [bp-4h]@2 - signed int v98; // [sp+20h] [bp-4h]@26 - signed int v99; // [sp+20h] [bp-4h]@40 - signed int v100; // [sp+20h] [bp-4h]@72 - signed int v101; // [sp+20h] [bp-4h]@200 - signed int v102; // [sp+20h] [bp-4h]@234 - signed int v103; // [sp+20h] [bp-4h]@288 + { + int i,j; + char* test_string; + char c; + bool break_loop; + unsigned int temp_str_len; + char* tmp_pos; + int decode_step; + int item_counter; + + pMapStats = new MapStats; + pMapStats->Initialize(); + + pMonsterStats = new MonsterStats; + pMonsterStats->Initialize(); + pMonsterStats->InitializePlacements(); + + pSpellStats = new SpellStats; + pSpellStats->Initialize(); + + LoadPotions(); + LoadPotionNotes(); + + pFactionTable = new FactionTable; + pFactionTable->Initialize(); + + pStorylineText = new StorylineText; + pStorylineText->Initialize(); + + pStdItemsTXT_Raw = NULL; + pStdItemsTXT_Raw = (char *)pEvents_LOD->LoadRaw("stditems.txt", 0); + strtok(pStdItemsTXT_Raw, "\r"); + strtok(NULL, "\r"); + strtok(NULL, "\r"); + strtok(NULL, "\r"); + //Standard Bonuses by Group + for (i=0;i<24;++i) + { + test_string = strtok(NULL, "\r") + 1; + break_loop = false; + decode_step=0; + do + { + c = *(unsigned char*)test_string; + temp_str_len = 0; + while((c!='\t')&&(c>0)) + { + ++temp_str_len; + c=test_string[temp_str_len]; + } + tmp_pos=test_string+temp_str_len; + if (*tmp_pos == 0) + break_loop = true; + *tmp_pos = 0; + if (temp_str_len) + { + switch (decode_step) + { + case 0: + pEnchantments[i].pBonusStat=RemoveQuotes(test_string); + break; + case 1: + pEnchantments[i].pOfName= RemoveQuotes(test_string); + break; + default: + pEnchantments[i].to_item[decode_step-2]=atoi(test_string); + } + } + else + { + if (!decode_step) + break_loop = true; + } + ++decode_step; + test_string=tmp_pos+1; + } while ((decode_step<11)&&!break_loop); + } + + memset(&pEnchantmentsSumm, 0, 36); + for(i=0;i<9;++i) + { + for (j=0;j<24;++j) + pEnchantmentsSumm[i]+=pEnchantments[j].to_item[i]; + } - //v1 = this; + //Bonus range for Standard by Level + strtok(NULL, "\r"); + strtok(NULL, "\r"); + strtok(NULL, "\r"); + strtok(NULL, "\r"); + strtok(NULL, "\r"); + for(i=0;i<6;++i) //counted from 1 + { + test_string = strtok(NULL, "\r") + 1; + break_loop = false; + decode_step=0; + do + { + c = *(unsigned char*)test_string; + temp_str_len = 0; + while((c!='\t')&&(c>0)) + { + ++temp_str_len; + c=test_string[temp_str_len]; + } + tmp_pos=test_string+temp_str_len; + if (*tmp_pos == 0) + break_loop = true; + *tmp_pos = 0; + if (decode_step==2) + bonus_ranges[i].minR = atoi(test_string); + else if (decode_step==3) + bonus_ranges[i].maxR =atoi(test_string); + ++decode_step; + test_string=tmp_pos+1; + } while ((decode_step<4)&&!break_loop); + } - pMapStats = new MapStats; - pMapStats->Initialize(); - - pMonsterStats = new MonsterStats; - pMonsterStats->Initialize(); - pMonsterStats->InitializePlacements(); - pSpellStats = new SpellStats; - pSpellStats->Initialize(); - - LoadPotions(); - LoadPotionNotes(); + pSpcItemsTXT_Raw = 0; + pSpcItemsTXT_Raw = (char *)pEvents_LOD->LoadRaw("spcitems.txt", 0); + strtok(pSpcItemsTXT_Raw, "\r"); + strtok(NULL, "\r"); + strtok(NULL, "\r"); + strtok(NULL, "\r"); + for (i=0;i<72;++i) + { + test_string = strtok(NULL, "\r") + 1; + break_loop = false; + decode_step=0; + do + { + c = *(unsigned char*)test_string; + temp_str_len = 0; + while((c!='\t')&&(c>0)) + { + ++temp_str_len; + c=test_string[temp_str_len]; + } + tmp_pos=test_string+temp_str_len; + if (*tmp_pos == 0) + break_loop = true; + *tmp_pos = 0; + if (temp_str_len) + { + switch (decode_step) + { + case 0: + pSpecialEnchantments[i].pBonusStatement=RemoveQuotes(test_string); + break; + case 1: + pSpecialEnchantments[i].pNameAdd= RemoveQuotes(test_string); + break; + case 14: + int res; + res=atoi(test_string); + if(!res) + { + ++test_string; + while (*test_string==' ')//fix X 2 case + ++test_string; + res=atoi(test_string); + } + pSpecialEnchantments[i].iValue=res; + break; + case 15: + pSpecialEnchantments[i].iTreasureLevel= tolower(*test_string) - 97;; + break; + default: + pSpecialEnchantments[i].to_item_apply[decode_step-2]=atoi(test_string); + } + } + else + { + if (!decode_step) + break_loop = true; + } + ++decode_step; + test_string=tmp_pos+1; + } while ((decode_step<16)&&!break_loop); + } - pFactionTable = new FactionTable; - pFactionTable->Initialize(); + pSpecialEnchantments_count = 71; + memset(&pSpecialEnchantmentsSumm, 0, 96); + for(i=0;i<12;++i) + { + for (j=0;j<pSpecialEnchantments_count;++j) + pSpecialEnchantmentsSumm[i]+=pSpecialEnchantments[j].to_item_apply[i]; + } - pStorylineText = new StorylineText; - pStorylineText->Initialize(); + + + Initialize2DA(); - pStdItemsTXT_Raw = 0; - v2 = (char *)pEvents_LOD->LoadRaw("stditems.txt", 0); - pStdItemsTXT_Raw = v2; - strtok(v2, "\r"); - strtok(0, "\r"); - strtok(0, "\r"); - strtok(0, "\r"); - Str = (char *)&pEnchantments[0].pParam; - v79 = 24; - do - { - v3 = strtok(0, "\r") + 1; - v97 = 0; - v88 = 0; - do - { - v4 = *v3; - v5 = 0; - while ( v4 != 9 && v4 ) - { - ++v5; - v4 = v3[v5]; - } - v72 = (int)&v3[v5]; - if ( !v3[v5] ) - v88 = 1; - v3[v5] = 0; - if ( v5 ) - { - if ( v97 ) - { - if ( v97 == 1 ) - { - *(unsigned int *)Str = (int)RemoveQuotes(v3); - } - else - { - if ( v97 > 1 ) - Str[v97 + 6] = atoi(v3); - } - } - else - { - *((char **)Str + 1) = RemoveQuotes(v3); - } - } - else - { - if ( !v97 ) - v88 = 1; - } - ++v97; - v3 = (char *)(v72 + 1); - } - while ( v97 <= 10 && !v88 ); - Str += 20; - --v79; - } - while ( v79 ); - v6 = (char *)&field_116D8[3]; - memset(&field_116D8[3], 0, 0x24u); - v7 = &pEnchantments[0].field_8[4]; - v73 = 9; - do - { - v8 = v7; - Stra = 24; - do - { - *(unsigned int *)v6 += (unsigned __int8)*v8; - v8 += 20; - --Stra; - } - while ( Stra ); - v6 += 4; - ++v7; - --v73; - } - while ( v73 ); - strtok(0, "\r"); - strtok(0, "\r"); - strtok(0, "\r"); - strtok(0, "\r"); - strtok(0, "\r"); - Strb = 17856; - do - { - v9 = strtok(0, "\r") + 1; - v98 = 0; - v89 = 0; - do - { - v10 = *v9; - v11 = 0; - while ( v10 != 9 && v10 ) - { - ++v11; - v10 = v9[v11]; - } - v12 = (int)&v9[v11]; - if ( !v9[v11] ) - v89 = 1; - *(unsigned char *)v12 = 0; - if ( v11 && v98 > 1 ) - *(&pItems[0].uItemID + v98 + Strb) = atoi(v9); - ++v98; - v9 = (char *)(v12 + 1); - } - while ( v98 < 4 && !v89 ); - Strb += 2; - } - while ( Strb < 17868 ); - pSpcItemsTXT_Raw = 0; - v13 = (char *)pEvents_LOD->LoadRaw("spcitems.txt", 0); - pSpcItemsTXT_Raw = v13; - strtok(v13, "\r"); - strtok(0, "\r"); - strtok(0, "\r"); - strtok(0, "\r"); - v80 = (char *)&pSpecialEnchantments[0].pParam; - Strc = 72; - do - { - v99 = 0; - v14 = (int)(strtok(0, "\r") + 1); - v90 = 0; - do - { - v15 = *(unsigned char *)v14; - v16 = 0; - while ( v15 != 9 && v15 ) - { - ++v16; - v15 = *(unsigned char *)(v16 + v14); - } - v74 = v16 + v14; - if ( !*(unsigned char *)(v16 + v14) ) - v90 = 1; - *(unsigned char *)(v16 + v14) = 0; - if ( v16 ) - { - if ( v99 ) - { - if ( v99 == 1 ) - { - *(char **)v80 = RemoveQuotes((char *)v14); - } - else - { - if ( v99 <= 1 ) - { - v17 = v99 == 14; - } - else - { - v17 = v99 == 14; - if ( v99 < 14 ) - { - v80[v99 + 6] = atoi((const char *)v14); - goto LABEL_63; - } - } - if ( v17 ) - { - v18 = atoi((const char *)v14); - *((unsigned int *)v80 + 5) = v18; - if ( !v18 ) - *((unsigned int *)v80 + 5) = atoi((const char *)(v14 + 1)); - } - else - { - if ( v99 == 15 ) - v80[24] = tolower(*(unsigned char *)v14) - 97; - } - } - } - else - { - *((char **)v80 + 1) = RemoveQuotes((char *)v14); - } - } - else - { - if ( !v99 ) - v90 = 1; - } -LABEL_63: - ++v99; - v14 = v74 + 1; - } - while ( v99 <= 15 && !v90 ); - v80 += 28; - --Strc; - } - while ( Strc ); - v19 = field_11738; - memset(field_11738, 0, 0x60u); - v20 = &pSpecialEnchantments[0].field_8[4]; - Strd = 12; - v21 = 71; - field_11798 = 71; - do - { - v83 = 0; - if ( v21 > 0 ) - { - v22 = v20; - do - { - *v19 += (unsigned __int8)*v22; - ++v83; - v21 = field_11798; - v22 += 28; - } - while ( v83 < v21 ); - } - ++v19; - ++v20; - --Strd; - } - while ( Strd ); - Initialize2DA(); - pItemsTXT_Raw = 0; - v23 = (char *)pEvents_LOD->LoadRaw("items.txt", 0); - pItemsTXT_Raw = v23; - strtok(v23, "\r"); - v24 = 0; - strtok(0, "\r"); - pItems[0].uItemID = 0; - while ( 2 ) - { - v100 = 0; - v25 = strtok(0, "\r") + 1; - v91 = 0; - while ( 2 ) - { - v26 = *v25; - v27 = 0; - while ( v26 != 9 && v26 ) - { - ++v27; - v26 = v25[v27]; - } - v75 = (int)&v25[v27]; - if ( !v25[v27] ) - v91 = 1; - v25[v27] = 0; - if ( v27 ) - { - switch ( v100 ) - { - case 0: - v24 = atoi(v25); - break; - case 1: - pItems[v24].pIconName = (char *)RemoveQuotes(v25); - break; - case 2: - pItems[v24].pName = (char *)RemoveQuotes(v25); - break; - case 3: - pItems[v24].uValue = atoi(v25); - break; - case 4: - if ( !_strcmpi(v25, "weapon") ) - goto LABEL_89; - if ( _strcmpi(v25, "weapon2") ) - { - if ( _strcmpi(v25, "weapon1or2") ) - { - if ( _strcmpi(v25, "missile") && _strcmpi(v25, "bow") ) - { - if ( _strcmpi(v25, "armor") ) - { - if ( _strcmpi(v25, "shield") ) - { - if ( _strcmpi(v25, "helm") ) - { - if ( _strcmpi(v25, "belt") ) - { - if ( _strcmpi(v25, "cloak") ) - { - if ( _strcmpi(v25, "gauntlets") ) - { - if ( _strcmpi(v25, "boots") ) - { - if ( _strcmpi(v25, "ring") ) - { - if ( _strcmpi(v25, "amulet") ) - { - if ( _strcmpi(v25, "weaponw") ) - { - if ( _strcmpi(v25, "herb") && _strcmpi(v25, "reagent") ) - { - if ( _strcmpi(v25, "bottle") ) - { - if ( _strcmpi(v25, "sscroll") ) - { - if ( _strcmpi(v25, "book") ) - { - if ( _strcmpi(v25, "mscroll") ) - { - if ( _strcmpi(v25, "gold") ) - { - if ( _strcmpi(v25, "gem") ) - pItems[v24].uEquipType = 20; - else - pItems[v24].uEquipType = 19; - } - else - { - pItems[v24].uEquipType = 18; - } - } - else - { - pItems[v24].uEquipType = 17; - } - } - else - { - pItems[v24].uEquipType = 16; - } - } - else - { - pItems[v24].uEquipType = 15; - } - } - else - { - pItems[v24].uEquipType = 14; - } - } - else - { - pItems[v24].uEquipType = 13; - } - } - else - { - pItems[v24].uEquipType = 12; - } - } - else - { - pItems[v24].uEquipType = 11; - } - } - else - { - pItems[v24].uEquipType = 10; - } - } - else - { - pItems[v24].uEquipType = 9; - } - } - else - { - pItems[v24].uEquipType = 8; - } - } - else - { - pItems[v24].uEquipType = 7; - } - } - else - { - pItems[v24].uEquipType = 6; - } - } - else - { - pItems[v24].uEquipType = 5; - } - } - else - { - pItems[v24].uEquipType = 4; - } - } - else - { - pItems[v24].uEquipType = 3; - } - } - else - { - pItems[v24].uEquipType = 2; - } - } - else - { -LABEL_89: - pItems[v24].uEquipType = 0; - } - } - else - { - pItems[v24].uEquipType = 1; - } - break; - case 5: - if ( _strcmpi(v25, "staff") ) - { - if ( _strcmpi(v25, "sword") ) - { - if ( _strcmpi(v25, "dagger") ) - { - if ( _strcmpi(v25, "axe") ) - { - if ( _strcmpi(v25, "spear") ) - { - if ( _strcmpi(v25, "bow") ) - { - if ( _strcmpi(v25, "mace") ) - { - if ( _strcmpi(v25, "blaster") ) - { - if ( _strcmpi(v25, "shield") ) - { - if ( _strcmpi(v25, "leather") ) - { - if ( _strcmpi(v25, "chain") ) - { - if ( _strcmpi(v25, "plate") ) - { - if ( _strcmpi(v25, "club") ) - pItems[v24].uSkillType = 38; - else - pItems[v24].uSkillType = 37; - } - else - { - pItems[v24].uSkillType = 11; - } - } - else - { - pItems[v24].uSkillType = 10; - } - } - else - { - pItems[v24].uSkillType = 9; - } - } - else - { - pItems[v24].uSkillType = 8; - } - } - else - { - pItems[v24].uSkillType = 7; - } - } - else - { - pItems[v24].uSkillType = 6; - } - } - else - { - pItems[v24].uSkillType = 5; - } - } - else - { - pItems[v24].uSkillType = 4; - } - } - else - { - pItems[v24].uSkillType = 3; - } - } - else - { - pItems[v24].uSkillType = 2; - } - } - else - { - pItems[v24].uSkillType = 1; - } - } - else - { - pItems[v24].uSkillType = 0; - } - break; - case 6: - Stre = 0; - v84 = strlen(v25); - if ( (signed int)v84 > 0 ) - { - while ( tolower((unsigned __int8)v25[Stre]) != 'd' ) - { - ++Stre; - if ( Stre >= (signed int)v84 ) - goto LABEL_161; - } - v25[Stre] = 0; - v28 = (char *)&pItems[v24]; - v28[34] = atoi(v25); - v28[35] = atoi(&v25[Stre + 1]); - v25[Stre] = 'd'; - } -LABEL_161: - if ( Stre == v84 && tolower((unsigned __int8)*v25) != 115 ) - { - v29 = (char *)&pItems[v24]; - v29[34] = atoi(v25); - v29[35] = 1; - } - break; - case 7: - pItems[v24].uDamageMod = atoi(v25); - break; - case 8: - if ( _strcmpi(v25, "artifact") ) - { - if ( _strcmpi(v25, "relic") ) - { - if ( _strcmpi(v25, "special") ) - pItems[v24].uMaterial = 0; - else - pItems[v24].uMaterial = 3; - } - else - { - pItems[v24].uMaterial = 2; - } - } - else - { - pItems[v24].uMaterial = 1; - } - break; - case 9: - BYTE2(pItems[v24 + 1].uItemID) = atoi(v25); - break; - case 10: - pItems[v24].pUnidentifiedName = (char *)RemoveQuotes(v25); - break; - case 11: - pItems[v24].uSpriteID = atoi(v25); - break; - case 12: - v30 = (char *)&pItems[v24]; - v81 = v30; - if ( v30[37] == 3 ) - { - v85 = 0; - Strf = (const char **)&pEnchantments[0].pParam; - while ( _strcmpi(*Strf, v25) ) - { - ++v85; - Strf += 5; - if ( v85 >= 24 ) - goto LABEL_181; - } - v81[39] = v85 + 1; -LABEL_181: - if ( !v81[39] ) - { - v86 = 0; - Strg = (const char **)&pSpecialEnchantments[0].pParam; - while ( _strcmpi(*Strg, v25) ) - { - ++v86; - Strg += 7; - if ( v86 >= 72 ) - goto LABEL_196; - } - v81[38] = v86 + 1; - } - } - else - { - v30[38] = 0; - v30[39] = 0; - } - break; - case 13: - v31 = (char *)&pItems[v24]; - v82 = v31; - if ( v31[37] == 3 && v31[39] ) - { - v32 = atoi(v25); - v82[40] = v32; - if ( !v32 ) - v82[40] = 1; - } - else - { - v31[40] = 0; - } - break; - case 14: - pItems[v24].uEquipX = atoi(v25); - break; - case 15: - pItems[v24].uEquipY = atoi(v25); - break; - case 16: - pItems[v24].pDescription = (char *)RemoveQuotes(v25); - break; - default: - break; - } - } -LABEL_196: - ++v100; - v25 = (char *)(v75 + 1); - if ( v100 <= 16 && !v91 ) - continue; - break; - } - ++v24; - if ( v24 < 800 ) - continue; - break; - } - pRndItemsTXT_Raw = 0; - pItems[0].uItemID = v24; - v33 = (char *)pEvents_LOD->LoadRaw("rnditems.txt", 0); - v34 = "\r"; - pRndItemsTXT_Raw = v33; - strtok(v33, "\r"); - v35 = 0; - strtok(0, "\r"); - strtok(0, "\r"); - strtok(0, "\r"); - do - { - v101 = 0; - v36 = strtok(0, "\r") + 1; - v92 = 0; - do - { - v37 = *v36; - v38 = 0; - while ( v37 != 9 && v37 ) - { - ++v38; - v37 = v36[v38]; - } - v76 = (int)&v36[v38]; - if ( !v36[v38] ) - v92 = 1; - *(unsigned char *)v76 = 0; - if ( v38 ) - { - if ( v101 ) - { - switch ( v101 ) - { - case 2: pItems[v35].field_2C[0] = atoi(v36); break; - case 3: pItems[v35].field_2C[1] = atoi(v36); break; - case 4: pItems[v35].field_2C[2] = atoi(v36); break; - case 5: pItems[v35].field_2C[3] = atoi(v36); break; - case 6: - *((unsigned char *)&pItems[0].uItemID + 16 * (3 * v35 + 3)) = atoi(v36); - break; - case 7: - BYTE1(pItems[v35 + 1].uItemID) = atoi(v36); - break; - } - } - else - { - v35 = atoi(v36); - } - } - else - { - if ( !v101 ) - v92 = 1; - } - ++v101; - v36 = (char *)(v76 + 1); - } - while ( v101 <= 7 && !v92 ); - ++v35; - } - while ( v35 < 619 ); - if ( pRndItemsTXT_Raw ) - { - pAllocator->FreeChunk(pRndItemsTXT_Raw); - pRndItemsTXT_Raw = 0; - } - v39 = (char *)field_11684; - memset(field_11684, 0, 0x18u); - v40 = pItems[0].field_2C; - v77 = 6; - do - { - v41 = v40; - Strh = 800; - do - { - *(unsigned int *)v39 += (unsigned __int8)*v41; - v41 += 48; - --Strh; - } - while ( Strh ); - v39 += 4; - ++v40; - --v77; - } - while ( v77 ); - v42 = 0; - strtok(0, "\r"); - strtok(0, "\r"); - strtok(0, "\r"); - strtok(0, "\r"); - strtok(0, "\r"); - v87 = 0; - do - { - v43 = strtok(v42, "\r") + 1; - v102 = (signed int)v42; - v93 = (signed int)v42; - do - { - v44 = *v43; - v45 = 0; - while ( v44 != 9 && v44 ) - { - ++v45; - v44 = v43[v45]; - } - v78 = (int)&v43[v45]; - if ( !v43[v45] ) - v93 = 1; - v42 = 0; - *(unsigned char *)v78 = 0; - if ( v45 ) - { - switch ( v102 ) - { - case 2: - if ( v87 ) - { - if ( v87 == 1 ) - { - *(unsigned int *)&field_1169C[24] = atoi(v43); - } - else - { - if ( v87 == 2 ) - *(unsigned int *)&field_1169C[48] = atoi(v43); - } - } - else - { - *(unsigned int *)&field_1169C[0] = atoi(v43); - } - break; - case 3: - if ( v87 ) - { - if ( v87 == 1 ) - { - *(unsigned int *)&field_1169C[28] = atoi(v43); - } - else - { - if ( v87 == 2 ) - *(unsigned int *)&field_1169C[52] = atoi(v43); - } - } - else - { - *(unsigned int *)&field_1169C[4] = atoi(v43); - } - break; - case 4: - if ( v87 ) - { - if ( v87 == 1 ) - { - *(unsigned int *)&field_1169C[32] = atoi(v43); - } - else - { - if ( v87 == 2 ) - *(unsigned int *)&field_1169C[56] = atoi(v43); - } - } - else - { - *(unsigned int *)&field_1169C[8] = atoi(v43); - } - break; - case 5: - if ( v87 ) - { - if ( v87 == 1 ) - { - *(unsigned int *)&field_1169C[36] = atoi(v43); - } - else - { - if ( v87 == 2 ) - field_116D8[0] = atoi(v43); - } - } - else - { - *(unsigned int *)&field_1169C[12] = atoi(v43); - } - break; - case 6: - if ( v87 ) - { - if ( v87 == 1 ) - { - *(unsigned int *)&field_1169C[40] = atoi(v43); - } - else - { - if ( v87 == 2 ) - field_116D8[1] = atoi(v43); - } - } - else - { - *(unsigned int *)&field_1169C[16] = atoi(v43); - } - break; - case 7: - if ( v87 ) - { - if ( v87 == 1 ) - { - *(unsigned int *)&field_1169C[44] = atoi(v43); - } - else - { - if ( v87 == 2 ) - field_116D8[2] = atoi(v43); - } - } - else - { - *(unsigned int *)&field_1169C[20] = atoi(v43); - } - break; - } - } - ++v102; - v43 = (char *)(v78 + 1); - } - while ( v102 <= 7 && !v93 ); - ++v87; - } - while ( v87 < 3 ); - pSkillDescTXT_Raw = 0; - pSkillDescTXT_Raw = (char *)pEvents_LOD->LoadRaw("skilldes.txt", 0); - strtok(pSkillDescTXT_Raw, "\r"); - v46 = 0; - do - { - v103 = 0; - v94 = 0; - v47 = strtok(0, "\r") + 1; - do - { - v48 = *v47; - v49 = 0; - while ( v48 != 9 && v48 ) - { - ++v49; - v48 = v47[v49]; - } - v50 = (int)&v47[v49]; - if ( !v47[v49] ) - v94 = 1; - *(unsigned char *)v50 = 0; - if ( v49 ) - { - switch ( v103 ) - { - case 1: - pSkillDesc[v46] = (char *)RemoveQuotes(v47); - break; - case 2: - pNormalSkillDesc[v46] = (char *)RemoveQuotes(v47); - break; - case 3: - pExpertSkillDesc[v46] = (char *)RemoveQuotes(v47); - break; - case 4: - pMasterSkillDesc[v46] = (char *)RemoveQuotes(v47); - break; - case 5: - pGrandSkillDesc[v46] = (char *)RemoveQuotes(v47); - break; - } - } - else - { - if ( !v103 ) - v94 = 1; - } - ++v103; - v47 = (char *)(v50 + 1); - } - while ( v103 <= 5 && !v94 ); - ++v46; - } - while ( v46 < 37 ); - pStatsTXT_Raw = 0; - pStatsTXT_Raw = (char *)pEvents_LOD->LoadRaw("stats.txt", 0); - strtok(pStatsTXT_Raw, "\r"); - Stri = 0; - do - { - v51 = 0; - v95 = 0; - v52 = strtok(0, v34) + 1; - do - { - v53 = *v52; - v54 = 0; - if ( *v52 != 9 ) - { - do - { - if ( !v53 ) - break; - ++v54; - v53 = v52[v54]; - } - while ( v53 != 9 ); - v34 = "\r"; - } - v55 = (int)&v52[v54]; - if ( !v52[v54] ) - v95 = 1; - *(unsigned char *)v55 = 0; - if ( v54 ) - { - if ( v51 ) - { - switch ( Stri ) - { - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - pAttributeDescriptions[Stri] = (char *)RemoveQuotes(v52); - break; - case 7: - pHealthPointsAttributeDescription = (char *)RemoveQuotes(v52); - break; - case 8: - pArmourClassAttributeDescription = (char *)RemoveQuotes(v52); - break; - case 9: - pSpellPointsAttributeDescription = (char *)RemoveQuotes(v52); - break; - case 10: - pPlayerConditionAttributeDescription = (char *)RemoveQuotes(v52); - break; - case 11: - pFastSpellAttributeDescription = (char *)RemoveQuotes(v52); - break; - case 12: - pPlayerAgeAttributeDescription = (char *)RemoveQuotes(v52); - break; - case 13: - pPlayerLevelAttributeDescription = (char *)RemoveQuotes(v52); - break; - case 14: - pPlayerExperienceAttributeDescription = (char *)RemoveQuotes(v52); - break; - case 15: - pAttackBonusAttributeDescription = (char *)RemoveQuotes(v52); - break; - case 16: - pAttackDamageAttributeDescription = (char *)RemoveQuotes(v52); - break; - case 17: - pMissleBonusAttributeDescription = (char *)RemoveQuotes(v52); - break; - case 18: - pMissleDamageAttributeDescription = (char *)RemoveQuotes(v52); - break; - case 19: - pFireResistanceAttributeDescription = (char *)RemoveQuotes(v52); - break; - case 20: - pAirResistanceAttributeDescription = (char *)RemoveQuotes(v52); - break; - case 21: - pWaterResistanceAttributeDescription = (char *)RemoveQuotes(v52); - break; - case 22: - pEarthResistanceAttributeDescription = (char *)RemoveQuotes(v52); - break; - case 23: - pMindResistanceAttributeDescription = (char *)RemoveQuotes(v52); - break; - case 24: - pBodyResistanceAttributeDescription = (char *)RemoveQuotes(v52); - break; - case 25: - pSkillPointsAttributeDescription = (char *)RemoveQuotes(v52); - break; - default: - break; - } - } - } - else - { - if ( !v51 ) - v95 = 1; - } - ++v51; - v52 = (char *)(v55 + 1); - } - while ( v51 < 2 && !v95 ); - ++Stri; - } - while ( Stri < 26 ); - pClassTXT_Raw = 0; - pClassTXT_Raw = (char *)pEvents_LOD->LoadRaw("class.txt", 0); - strtok(pClassTXT_Raw, v34); - Strj = pClassDescriptions; - do - { - v56 = 0; - v57 = strtok(0, v34) + 1; - v96 = 0; - do - { - v58 = *v57; - v59 = 0; - if ( *v57 != 9 ) - { - do - { - if ( !v58 ) - break; - ++v59; - v58 = v57[v59]; - } - while ( v58 != 9 ); - v34 = "\r"; - } - v60 = (int)&v57[v59]; - if ( !v57[v59] ) - v96 = 1; - *(unsigned char *)v60 = 0; - if ( v59 ) - { - if ( v56 ) - *Strj = (char *)RemoveQuotes(v57); - } - else - { - if ( !v56 ) - v96 = 1; - } - ++v56; - v57 = (char *)(v60 + 1); - } - while ( v56 < 2 && !v96 ); - ++Strj; - } - while ( (signed int)Strj <= (signed int)&pClassDescriptions[35] ); -} + pItemsTXT_Raw = NULL; + pItemsTXT_Raw = (char*) pEvents_LOD->LoadRaw("items.txt", 0); + strtok(pItemsTXT_Raw, "\r"); + strtok(NULL, "\r"); + uAllItemsCount = 0; + item_counter = 0; + while (true) + { + test_string = strtok(NULL, "\r") + 1; + break_loop = false; + decode_step=0; + do + { + c = *(unsigned char*)test_string; + temp_str_len = 0; + while((c!='\t')&&(c>0)) + { + ++temp_str_len; + c=test_string[temp_str_len]; + } + tmp_pos=test_string+temp_str_len; + if (*tmp_pos == 0) + break_loop = true; + *tmp_pos = 0; + if (temp_str_len) + { + switch (decode_step) + { + case 0: //Item # + item_counter=atoi(test_string); + uAllItemsCount=item_counter; + break; + case 1: //Pic File + pItems[item_counter].pIconName = RemoveQuotes(test_string); + break; + case 2: //Name + pItems[item_counter].pName = RemoveQuotes(test_string); + break; + case 3: //Value + pItems[item_counter].uValue=atoi(test_string); + break; + case 4: //Equip Stat + { + if ( !_strcmpi(test_string, "weapon") ) + { + pItems[item_counter].uEquipType = 0; + break; + } + if ( !_strcmpi(test_string, "weapon2") ) + { + pItems[item_counter].uEquipType = 1; + break; + } + if ( !_strcmpi(test_string, "weapon1or2") ) + { + pItems[item_counter].uEquipType = 0; + break; + } + if ( !(_strcmpi(test_string, "missile")&&_strcmpi(test_string, "bow"))) + { + pItems[item_counter].uEquipType = 2; + break; + } + if ( !_strcmpi(test_string, "armor") ) + { + pItems[item_counter].uEquipType = 3; + break; + } + if ( !_strcmpi(test_string, "shield") ) + { + pItems[item_counter].uEquipType = 4; + break; + } + if ( !_strcmpi(test_string, "helm") ) + { + pItems[item_counter].uEquipType = 5; + break; + } + if ( !_strcmpi(test_string, "belt") ) + { + pItems[item_counter].uEquipType = 6; + break; + } + if ( !_strcmpi(test_string, "cloak") ) + { + pItems[item_counter].uEquipType = 7; + break; + } + if ( !_strcmpi(test_string, "gauntlets") ) + { + pItems[item_counter].uEquipType = 8; + break; + } + if ( !_strcmpi(test_string, "boots") ) + { + pItems[item_counter].uEquipType = 9; + break; + } + if ( !_strcmpi(test_string, "ring") ) + { + pItems[item_counter].uEquipType = 10; + break; + } + if ( !_strcmpi(test_string, "amulet") ) + { + pItems[item_counter].uEquipType = 11; + break; + } + if ( !_strcmpi(test_string, "weaponw") ) + { + pItems[item_counter].uEquipType = 12; + break; + } + if ( !(_strcmpi(test_string, "herb")&&_strcmpi(test_string, "reagent"))) + { + pItems[item_counter].uEquipType = 13; + break; + } + if ( !_strcmpi(test_string, "bottle") ) + { + pItems[item_counter].uEquipType = 14; + break; + } + if ( !_strcmpi(test_string, "sscroll") ) + { + pItems[item_counter].uEquipType = 15; + break; + } + if ( !_strcmpi(test_string, "book") ) + { + pItems[item_counter].uEquipType = 16; + break; + } + if ( !_strcmpi(test_string, "mscroll") ) + { + pItems[item_counter].uEquipType = 17; + break; + } + if ( !_strcmpi(test_string, "gold") ) + { + pItems[item_counter].uEquipType = 18; + break; + } + if ( !_strcmpi(test_string, "gem") ) + { + pItems[item_counter].uEquipType = 19; + break; + } + pItems[item_counter].uEquipType = 20; + break; + } + case 5: //Skill Group + { + if ( !_strcmpi(test_string, "staff") ) + { + pItems[item_counter].uSkillType = 0; + break; + } + if ( !_strcmpi(test_string, "sword") ) + { + pItems[item_counter].uSkillType = 1; + break; + } + if ( !_strcmpi(test_string, "dagger") ) + { + pItems[item_counter].uSkillType = 2; + break; + } + if ( !_strcmpi(test_string, "axe") ) + { + pItems[item_counter].uSkillType = 3; + break; + } + if ( !_strcmpi(test_string, "spear") ) + { + pItems[item_counter].uSkillType = 4; + break; + } + if ( !_strcmpi(test_string, "bow") ) + { + pItems[item_counter].uSkillType = 5; + break; + } + if ( !_strcmpi(test_string, "mace") ) + { + pItems[item_counter].uSkillType = 6; + break; + } + if ( !_strcmpi(test_string, "blaster") ) + { + pItems[item_counter].uSkillType = 7; + break; + } + if ( !_strcmpi(test_string, "shield") ) + { + pItems[item_counter].uSkillType = 8; + break; + } + if ( !_strcmpi(test_string, "leather") ) + { + pItems[item_counter].uSkillType = 9; + break; + } + if ( !_strcmpi(test_string, "chain") ) + { + pItems[item_counter].uSkillType = 10; + break; + } + if ( !_strcmpi(test_string, "plate") ) + { + pItems[item_counter].uSkillType = 11; + break; + } + if ( !_strcmpi(test_string, "club") ) + { + pItems[item_counter].uSkillType = 37; + break; + } + pItems[item_counter].uSkillType = 38; + break; + } + case 6: //Mod1 + { + int ii; + char* test_char; + int tst_len; + tst_len=strlen(test_string); + pItems[item_counter].uDamageDice=0; + pItems[item_counter].uDamageRoll=0; + test_char=test_string; + for (ii=0; ii<tst_len; ++ii) + { + if (tolower(*test_char)=='d') + { + *test_char=0; + pItems[item_counter].uDamageDice=atoi(test_string); + pItems[item_counter].uDamageRoll=atoi(test_char+1); + *test_char='d'; + break; + } + ++test_char; + } + test_char=test_string; + if ((ii==tst_len)&&(tolower(*test_char)=='s')) + { + pItems[item_counter].uDamageDice=atoi(test_char+1); + pItems[item_counter].uDamageRoll=1; + } + break; + } + case 7: //Mod2 + pItems[item_counter].uDamageMod=atoi(test_string); + break; + case 8: //material + { + if ( !_strcmpi(test_string, "artifact") ) + { + pItems[item_counter].uMaterial = 1; + break; + } + if ( !_strcmpi(test_string, "relic") ) + { + pItems[item_counter].uMaterial = 2; + break; + } + if ( !_strcmpi(test_string, "special") ) + { + pItems[item_counter].uMaterial = 3; + break; + } + pItems[item_counter].uMaterial = 0; + break;} + case 9: //ID/Rep/St + pItems[item_counter].uItemID_Rep_St=atoi(test_string); + break; + case 10: //Not identified name + pItems[item_counter].pUnidentifiedName = RemoveQuotes(test_string); + break; + case 11: //Sprite Index + pItems[item_counter].uSpriteID=atoi(test_string); + break; + case 12: //VarA + { + pItems[item_counter]._additional_value=0; + pItems[item_counter]._bonus_type=0; + if (pItems[item_counter].uMaterial==3) + { + for(int ii=0; ii<24; ++ii) + { + if (stricmp(test_string,pEnchantments[ii].pBonusStat)) + { + pItems[item_counter]._bonus_type=ii+1; + break; + } + } + if (!pItems[item_counter]._bonus_type) + { + for(int ii=0; ii<72; ++ii) + { + if (stricmp(test_string,pSpecialEnchantments[ii].pBonusStatement)) + { + pItems[item_counter]._additional_value=ii+1; + } + } + } + } + + break; + } + case 13: //VarB + if ((pItems[item_counter].uMaterial==3)&&(pItems[item_counter]._bonus_type)) + { + char b_s=atoi(test_string); + if (b_s) + pItems[item_counter]._bonus_strength=b_s; + else + pItems[item_counter]._bonus_strength=1; + } + else + pItems[item_counter]._bonus_strength=0; + break; + case 14: //Equip X + pItems[item_counter].uEquipX=atoi(test_string); + break; + case 15: //Equip Y + pItems[item_counter].uEquipY=atoi(test_string); + break; + case 16: //Notes + pItems[item_counter].pDescription = RemoveQuotes(test_string); + break; + + } + } + else + { + if (!decode_step) + break_loop = true; + } + ++decode_step; + test_string=tmp_pos+1; + } while ((decode_step<17)&&!break_loop); + ++item_counter; + if (item_counter>799) + break; + } + + + pRndItemsTXT_Raw = NULL; + uAllItemsCount = item_counter; + pRndItemsTXT_Raw = (char *)pEvents_LOD->LoadRaw("rnditems.txt", 0); + strtok(pRndItemsTXT_Raw, "\r"); + strtok(NULL, "\r"); + strtok(NULL, "\r"); + strtok(NULL, "\r"); + item_counter = 0; + while (true) + { + test_string = strtok(NULL, "\r") + 1; + break_loop = false; + decode_step=0; + do + { + c = *(unsigned char*)test_string; + temp_str_len = 0; + while((c!='\t')&&(c>0)) + { + ++temp_str_len; + c=test_string[temp_str_len]; + } + tmp_pos=test_string+temp_str_len; + if (*tmp_pos == 0) + break_loop = true; + *tmp_pos = 0; + if (temp_str_len) + { + switch (decode_step) + { + case 0: + item_counter=atoi(test_string); + break; + case 2: + pItems[item_counter].uChanceByTreasureLvl1=atoi(test_string); + break; + case 3: + pItems[item_counter].uChanceByTreasureLvl2=atoi(test_string); + break; + case 4: + pItems[item_counter].uChanceByTreasureLvl3=atoi(test_string); + break; + case 5: + pItems[item_counter].uChanceByTreasureLvl4=atoi(test_string); + break; + case 6: + pItems[item_counter].uChanceByTreasureLvl5=atoi(test_string); + break; + case 7: + pItems[item_counter].uChanceByTreasureLvl6=atoi(test_string); + break; + } + } + else + { + if (!decode_step) + break_loop = true; + } + ++decode_step; + test_string=tmp_pos+1; + } while ((decode_step<8)&&!break_loop); + ++item_counter; + if (item_counter>618) + break; + } + + if ( pRndItemsTXT_Raw ) + { + pAllocator->FreeChunk(pRndItemsTXT_Raw); + pRndItemsTXT_Raw = NULL; + } + //ChanceByTreasureLvl Summ - anti cheating? + memset(&uChanceByTreasureLvlSumm, 0, 24); + for(i=0;i<6;++i) + { + for (j=0;j<800;++j) + uChanceByTreasureLvlSumm[i]+=pItems[j].uChanceByTreasureLvl[i]; + } + + strtok(NULL, "\r"); + strtok(NULL, "\r"); + strtok(NULL, "\r"); + strtok(NULL, "\r"); + strtok(NULL, "\r"); + for (i=0;i<3;++i) + { + test_string = strtok(NULL, "\r") + 1; + break_loop = false; + decode_step=0; + do + { + c = *(unsigned char*)test_string; + temp_str_len = 0; + while((c!='\t')&&(c>0)) + { + ++temp_str_len; + c=test_string[temp_str_len]; + } + tmp_pos=test_string+temp_str_len; + if (*tmp_pos == 0) + break_loop = true; + *tmp_pos = 0; + if (temp_str_len) + { + switch (decode_step) + { + case 2: + switch (i) + { + case 0: + uBonusChanceStandart[0]=atoi(test_string); + break; + case 1: + uBonusChanceSpecial[0]=atoi(test_string); + break; + case 2: + uBonusChanceWpSpecial[0]=atoi(test_string); + break; + } + break; + case 3: + switch (i) + { + case 0: + uBonusChanceStandart[1]=atoi(test_string); + break; + case 1: + uBonusChanceSpecial[1]=atoi(test_string); + break; + case 2: + uBonusChanceWpSpecial[1]=atoi(test_string); + break; + } + break; + case 4: + switch (i) + { + case 0: + uBonusChanceStandart[2]=atoi(test_string); + break; + case 1: + uBonusChanceSpecial[2]=atoi(test_string); + break; + case 2: + uBonusChanceWpSpecial[2]=atoi(test_string); + break; + } + break; + case 5: + switch (i) + { + case 0: + uBonusChanceStandart[3]=atoi(test_string); + break; + case 1: + uBonusChanceSpecial[3]=atoi(test_string); + break; + case 2: + uBonusChanceWpSpecial[3]=atoi(test_string); + break; + } + break; + case 6: + switch (i) + { + case 0: + uBonusChanceStandart[4]=atoi(test_string); + break; + case 1: + uBonusChanceSpecial[4]=atoi(test_string); + break; + case 2: + uBonusChanceWpSpecial[4]=atoi(test_string); + break; + } + break; + case 7: + switch (i) + { + case 0: + uBonusChanceStandart[5]=atoi(test_string); + break; + case 1: + uBonusChanceSpecial[5]=atoi(test_string); + break; + case 2: + uBonusChanceWpSpecial[5]=atoi(test_string); + break; + } + break; + } + } + else + { + if (!decode_step) + break_loop = true; + } + ++decode_step; + test_string=tmp_pos+1; + } while ((decode_step<8)&&!break_loop); + } + + pSkillDescTXT_Raw = NULL; + pSkillDescTXT_Raw = (char *)pEvents_LOD->LoadRaw("skilldes.txt", 0); + strtok(pSkillDescTXT_Raw, "\r"); + for (i=0; i<37; ++i) + { + test_string = strtok(NULL, "\r") + 1; + break_loop = false; + decode_step=0; + do + { + c = *(unsigned char*)test_string; + temp_str_len = 0; + while((c!='\t')&&(c>0)) + { + ++temp_str_len; + c=test_string[temp_str_len]; + } + tmp_pos=test_string+temp_str_len; + if (*tmp_pos == 0) + break_loop = true; + *tmp_pos = 0; + if (temp_str_len) + { + switch (decode_step) + { + case 1: + pSkillDesc[i] = RemoveQuotes(test_string); + break; + case 2: + pNormalSkillDesc[i] = RemoveQuotes(test_string); + break; + case 3: + pExpertSkillDesc[i] = RemoveQuotes(test_string); + break; + case 4: + pMasterSkillDesc[i] = RemoveQuotes(test_string); + break; + case 5: + pGrandSkillDesc[i] = RemoveQuotes(test_string); + break; + } + } + else + { + if (!decode_step) + break_loop = true; + } + ++decode_step; + test_string=tmp_pos+1; + } while ((decode_step<6)&&!break_loop); + } + + pStatsTXT_Raw = 0; + pStatsTXT_Raw = (char *)pEvents_LOD->LoadRaw("stats.txt", 0); + strtok(pStatsTXT_Raw, "\r"); + for (i=0; i<26; ++i) + { + test_string = strtok(NULL, "\r") + 1; + break_loop = false; + decode_step=0; + do + { + c = *(unsigned char*)test_string; + temp_str_len = 0; + while((c!='\t')&&(c>0)) + { + ++temp_str_len; + c=test_string[temp_str_len]; + } + tmp_pos=test_string+temp_str_len; + if (*tmp_pos == 0) + break_loop = true; + *tmp_pos = 0; + if (temp_str_len) + { + switch (i) + { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + pAttributeDescriptions[i] = RemoveQuotes(test_string); + break; + case 7: + pHealthPointsAttributeDescription = RemoveQuotes(test_string); + break; + case 8: + pArmourClassAttributeDescription = RemoveQuotes(test_string); + break; + case 9: + pSpellPointsAttributeDescription = RemoveQuotes(test_string); + break; + case 10: + pPlayerConditionAttributeDescription = RemoveQuotes(test_string); + break; + case 11: + pFastSpellAttributeDescription = RemoveQuotes(test_string); + break; + case 12: + pPlayerAgeAttributeDescription = RemoveQuotes(test_string); + break; + case 13: + pPlayerLevelAttributeDescription = RemoveQuotes(test_string); + break; + case 14: + pPlayerExperienceAttributeDescription = RemoveQuotes(test_string); + break; + case 15: + pAttackBonusAttributeDescription = RemoveQuotes(test_string); + break; + case 16: + pAttackDamageAttributeDescription = RemoveQuotes(test_string); + break; + case 17: + pMissleBonusAttributeDescription = RemoveQuotes(test_string); + break; + case 18: + pMissleDamageAttributeDescription = RemoveQuotes(test_string); + break; + case 19: + pFireResistanceAttributeDescription = RemoveQuotes(test_string); + break; + case 20: + pAirResistanceAttributeDescription = RemoveQuotes(test_string); + break; + case 21: + pWaterResistanceAttributeDescription = RemoveQuotes(test_string); + break; + case 22: + pEarthResistanceAttributeDescription = RemoveQuotes(test_string); + break; + case 23: + pMindResistanceAttributeDescription = RemoveQuotes(test_string); + break; + case 24: + pBodyResistanceAttributeDescription = RemoveQuotes(test_string); + break; + case 25: + pSkillPointsAttributeDescription = RemoveQuotes(test_string); + break; + } + } + else + { + if (!decode_step) + break_loop = true; + } + ++decode_step; + test_string=tmp_pos+1; + } while ((decode_step<2)&&!break_loop); + } + + + pClassTXT_Raw = 0; + pClassTXT_Raw = (char *)pEvents_LOD->LoadRaw("class.txt", 0); + strtok(pClassTXT_Raw, "\r"); + for (i=0; i<36; ++i) + { + test_string = strtok(NULL, "\r") + 1; + break_loop = false; + decode_step=0; + do + { + c = *(unsigned char*)test_string; + temp_str_len = 0; + while((c!='\t')&&(c>0)) + { + ++temp_str_len; + c=test_string[temp_str_len]; + } + tmp_pos=test_string+temp_str_len; + if (*tmp_pos == 0) + break_loop = true; + *tmp_pos = 0; + if (temp_str_len) + { + if(i) + pClassDescriptions[i]=RemoveQuotes(test_string); + } + else + { + if (!decode_step) + break_loop = true; + } + ++decode_step; + test_string=tmp_pos+1; + } while ((decode_step<2)&&!break_loop); + } + + } //----- (00456D17) -------------------------------------------------------- void ItemsTable::SetSpecialBonus(ItemGen *pItem) @@ -1483,18 +1210,18 @@ //----- (00453B3C) -------------------------------------------------------- void ItemsTable::LoadPotions() -{ - - CHAR Text[90]; // [sp+Ch] [bp-6Ch]@26 - char* test_string; - unsigned int uRow; - unsigned int uColumn; - unsigned __int8 potion_value; + { - if ( pPotionsTXT_Raw ) - pAllocator->FreeChunk(pPotionsTXT_Raw); - pPotionsTXT_Raw = NULL; - pPotionsTXT_Raw = (char *)pEvents_LOD->LoadRaw("potion.txt", 0); + CHAR Text[90]; // [sp+Ch] [bp-6Ch]@26 + char* test_string; + unsigned int uRow; + unsigned int uColumn; + unsigned __int8 potion_value; + + if ( pPotionsTXT_Raw ) + pAllocator->FreeChunk(pPotionsTXT_Raw); + pPotionsTXT_Raw = NULL; + pPotionsTXT_Raw = (char *)pEvents_LOD->LoadRaw("potion.txt", 0); test_string = strtok(pPotionsTXT_Raw,"\t\r\n"); while ( 1 ) { @@ -1505,142 +1232,140 @@ } if ( !strcmp(test_string, "222") ) break; - + test_string = strtok(NULL, "\t\r\n"); } - while ( 1 ) - { - test_string = strtok(NULL, "\t\r\n"); - - if ( !test_string ) + while ( 1 ) { - MessageBoxA(0, "Error Pre-Parsing Potion Table", "Load Error", MB_ICONHAND|MB_CANCELTRYCONTINUE); - return; + test_string = strtok(NULL, "\t\r\n"); + + if ( !test_string ) + { + MessageBoxA(0, "Error Pre-Parsing Potion Table", "Load Error", MB_ICONHAND|MB_CANCELTRYCONTINUE); + return; + } + if ( !strcmp(test_string, "222") ) + break; } -if ( !strcmp(test_string, "222") ) - break; - } - for (uRow = 0;uRow < 50; ++uRow) - { - int skip_count; - for (skip_count = 0;skip_count < 6; ++skip_count) - { - if ( !strtok(NULL, "\r\t\n") ) - break; - } - if ( skip_count != 6 ) - break; - for (uColumn = 0; uColumn < 50; ++uColumn) + for (uRow = 0;uRow < 50; ++uRow) { - test_string = strtok(NULL, "\r\t\n"); - if ( !test_string ) - break; - potion_value = atoi(test_string); - char c=*test_string; - if ( !potion_value ) - { - if ( tolower(c) == 'e' ) - potion_value = atoi(test_string + 1); - else - potion_value = 0; - } - this->potion_data[uRow][uColumn]=potion_value; - } - if ( uColumn != 50 ) - break; - strtok(NULL, "\r\t\n"); - } + int skip_count; + for (skip_count = 0;skip_count < 6; ++skip_count) + { + if ( !strtok(NULL, "\r\t\n") ) + break; + } + if ( skip_count != 6 ) + break; + for (uColumn = 0; uColumn < 50; ++uColumn) + { + test_string = strtok(NULL, "\r\t\n"); + if ( !test_string ) + break; + potion_value = atoi(test_string); + char c=*test_string; + if ( !potion_value ) + { + if ( tolower(c) == 'e' ) + potion_value = atoi(test_string + 1); + else + potion_value = 0; + } + this->potion_data[uRow][uColumn]=potion_value; + } + if ( uColumn != 50 ) + break; + strtok(NULL, "\r\t\n"); + } - if ( uRow != 50 ) - { - wsprintfA(Text, "Error Parsing Potion Table at Row: %d Column: %d", uRow, uColumn); - MessageBoxA(0, Text, "Parsing Error", MB_ICONHAND|MB_CANCELTRYCONTINUE); - } - if ( pPotionsTXT_Raw ) - { - pAllocator->FreeChunk(pPotionsTXT_Raw); - pPotionsTXT_Raw = 0; - } -} + if ( uRow != 50 ) + { + wsprintfA(Text, "Error Parsing Potion Table at Row: %d Column: %d", uRow, uColumn); + MessageBoxA(0, Text, "Parsing Error", MB_ICONHAND|MB_CANCELTRYCONTINUE); + } + if ( pPotionsTXT_Raw ) + { + pAllocator->FreeChunk(pPotionsTXT_Raw); + pPotionsTXT_Raw = 0; + } + } //----- (00453CE5) -------------------------------------------------------- void ItemsTable::LoadPotionNotes() -{ - - CHAR Text[90]; - char* test_string; - unsigned int uRow; - unsigned int uColumn; - unsigned __int8 potion_note; + { + + CHAR Text[90]; + char* test_string; + unsigned int uRow; + unsigned int uColumn; + unsigned __int8 potion_note; + + if ( pPotionNotesTXT_Raw ) + pAllocator->FreeChunk(pPotionNotesTXT_Raw); + pPotionNotesTXT_Raw = NULL; + pPotionNotesTXT_Raw = (char *)pEvents_LOD->LoadRaw("potnotes.txt", 0); + test_string = strtok(pPotionNotesTXT_Raw ,"\t\r\n"); + while ( 1 ) + { + if ( !test_string ) + { + MessageBoxA(0, "Error Pre-Parsing Potion Table", "Load Error", MB_ICONHAND|MB_CANCELTRYCONTINUE); + return; + } + if ( !strcmp(test_string, "222") ) + break; + test_string = strtok(NULL, "\t\r\n"); + } + while ( 1 ) + { + test_string = strtok(NULL, "\t\r\n"); + + if ( !test_string ) + { + MessageBoxA(0, "Error Pre-Parsing Potion Table", "Load Error", MB_ICONHAND|MB_CANCELTRYCONTINUE); + return; + } + if ( !strcmp(test_string, "222") ) + break; + } - if ( pPotionNotesTXT_Raw ) - pAllocator->FreeChunk(pPotionNotesTXT_Raw); - pPotionNotesTXT_Raw = NULL; - pPotionNotesTXT_Raw = (char *)pEvents_LOD->LoadRaw("potnotes.txt", 0); - test_string = strtok(pPotionNotesTXT_Raw ,"\t\r\n"); - while ( 1 ) - { - - if ( !test_string ) - { - MessageBoxA(0, "Error Pre-Parsing Potion Table", "Load Error", MB_ICONHAND|MB_CANCELTRYCONTINUE); - return; - } - if ( !strcmp(test_string, "222") ) - break; - test_string = strtok(NULL, "\t\r\n"); - } - while ( 1 ) - { - test_string = strtok(NULL, "\t\r\n"); - - if ( !test_string ) - { - MessageBoxA(0, "Error Pre-Parsing Potion Table", "Load Error", MB_ICONHAND|MB_CANCELTRYCONTINUE); - return; - } - if ( !strcmp(test_string, "222") ) - break; - } - - for (uRow = 0;uRow < 50; ++uRow) - { - int skip_count; - for (skip_count = 0;skip_count < 6; ++skip_count) - { - if ( !strtok(NULL, "\r\t\n") ) - break; - } - if ( skip_count != 6 ) - break; - for (uColumn = 0; uColumn < 50; ++uColumn) - { - test_string = strtok(NULL, "\r\t\n"); - if ( !test_string ) - break; - potion_note = atoi(test_string); - char c=*test_string; - if ( !potion_note ) - { - if ( tolower(c) == 'e' ) - potion_note = atoi(test_string + 1); - else - potion_note = 0; - } - this->potion_note[uRow][uColumn]=potion_note; - } - if ( uColumn != 50 ) - break; - strtok(NULL, "\r\t\n"); - } - - if ( uRow != 50 ) - { - wsprintfA(Text, "Error Parsing Potion Table at Row: %d Column: %d", uRow, uColumn); - MessageBoxA(0, Text, "Parsing Error", MB_ICONHAND|MB_CANCELTRYCONTINUE); - } -} + for (uRow = 0;uRow < 50; ++uRow) + { + int skip_count; + for (skip_count = 0;skip_count < 6; ++skip_count) + { + if ( !strtok(NULL, "\r\t\n") ) + break; + } + if ( skip_count != 6 ) + break; + for (uColumn = 0; uColumn < 50; ++uColumn) + { + test_string = strtok(NULL, "\r\t\n"); + if ( !test_string ) + break; + potion_note = atoi(test_string); + char c=*test_string; + if ( !potion_note ) + { + if ( tolower(c) == 'e' ) + potion_note = atoi(test_string + 1); + else + potion_note = 0; + } + this->potion_note[uRow][uColumn]=potion_note; + } + if ( uColumn != 50 ) + break; + strtok(NULL, "\r\t\n"); + } + if ( uRow != 50 ) + { + wsprintfA(Text, "Error Parsing Potion Table at Row: %d Column: %d", uRow, uColumn); + MessageBoxA(0, Text, "Parsing Error", MB_ICONHAND|MB_CANCELTRYCONTINUE); + } + } //----- (00456442) -------------------------------------------------------- @@ -1669,7 +1394,7 @@ } else { - v3 = *(unsigned int *)&pItemsTable->pEnchantments[23].field_8[28 * v4 + 8]; + v3 = *(unsigned int *)&pItemsTable->pEnchantments[23].to_item[28 * v4 + 8]; if ( (unsigned int)v3 > 0xA ) return uBaseValue + v3; result = uBaseValue * v3; @@ -1765,12 +1490,12 @@ sprintf( item__getname_buffer, "%s %s", - *(unsigned int *)&pItemsTable->pEnchantments[22].field_8[28 * v7 + 8], + *(unsigned int *)&pItemsTable->pEnchantments[22].to_item[28 * v7 + 8], pItemsTable->pItems[v1->uItemID].pName); return v4; } strcat(item__getname_buffer, " "); - v9 = *(const char **)&pItemsTable->pEnchantments[22].field_8[28 * v1->uAdditionalValue + 8]; + v9 = *(const char **)&pItemsTable->pEnchantments[22].to_item[28 * v1->uAdditionalValue + 8]; } strcat(item__getname_buffer, v9); } @@ -1779,14 +1504,14 @@ //----- (00456620) -------------------------------------------------------- -void ItemsTable::GenerateItem(int a2, int a3, ItemGen *out_item) +void ItemsTable::GenerateItem(int a2, int a3, ItemGen *pItem) { - //ItemGen *v4; // esi@1 - //ItemsTable *v5; // edi@1 + ItemGen *v4; // esi@1 + ItemsTable *v5; // edi@1 int v6; // ebx@3 int *v7; // ecx@33 - //int v8; // eax@34 - //int v9; // eax@39 + int v8; // eax@34 + int v9; // eax@39 int v10; // ebx@43 int v11; // ecx@47 unsigned int *v12; // edx@48 @@ -1828,101 +1553,163 @@ unsigned int v48; // ecx@123 int v49; // eax@123 int v50; // eax@123 - int Dst[800]; // [sp+Ch] [bp-C88h]@33 + unsigned char Dst[0xC80]; // [sp+Ch] [bp-C88h]@33 int v52; // [sp+C8Ch] [bp-8h]@33 - //int v53; // [sp+C90h] [bp-4h]@1 + int v53; // [sp+C90h] [bp-4h]@1 int v54; // [sp+C9Ch] [bp+8h]@3 - //int v55; // [sp+CA0h] [bp+Ch]@34 + int v55; // [sp+CA0h] [bp+Ch]@34 signed int v56; // [sp+CA0h] [bp+Ch]@55 int v57; // [sp+CA0h] [bp+Ch]@62 int *v58; // [sp+CA0h] [bp+Ch]@102 int v59; // [sp+CA0h] [bp+Ch]@123 - //signed int a2a; // [sp+CA4h] [bp+10h]@33 + signed int a2a; // [sp+CA4h] [bp+10h]@33 int a2b; // [sp+CA4h] [bp+10h]@101 int a2c; // [sp+CA4h] [bp+10h]@120 - //v53 = -1; - //v4 = pItem; - //v5 = this; - if ( !out_item ) - out_item = (ItemGen *)pAllocator->AllocNamedChunk(out_item, sizeof(*out_item), "newItemGen"); - memset(out_item, 0, sizeof(*out_item)); + v53 = -1; + v4 = pItem; + v5 = this; + if ( !pItem ) + v4 = (ItemGen *)pAllocator->AllocNamedChunk(pItem, 0x24u, "newItemGen"); + memset(v4, 0, 0x24u); v6 = a2 - 1; v54 = a2 - 1; if ( a3 ) { - ITEM_EQUIP_TYPE requested_equip; - PLAYER_SKILL_TYPE requested_skill = PLAYER_SKILL_INVALID; - switch (a3) + switch ( a3 ) { - case 20: requested_equip = EQUIP_ONE_OR_TWO_HANDS; break; - case 21: requested_equip = EQUIP_ARMOUR; break; - case 22: requested_skill = (PLAYER_SKILL_TYPE)38; __debugbreak();/*check this skill*/ break; - case 23: requested_skill = PLAYER_SKILL_SWORD; break; - case 24: requested_skill = PLAYER_SKILL_DAGGER; break; - case 25: requested_skill = PLAYER_SKILL_AXE; break; - case 26: requested_skill = PLAYER_SKILL_SPEAR; break; - case 27: requested_skill = PLAYER_SKILL_BOW; break; - case 28: requested_skill = PLAYER_SKILL_MACE; break; - case 29: requested_skill = (PLAYER_SKILL_TYPE)37; __debugbreak();/*check this skill*/break; - case 30: requested_skill = PLAYER_SKILL_STAFF; break; - case 31: requested_skill = PLAYER_SKILL_LEATHER; break; - case 32: requested_skill = PLAYER_SKILL_CHAIN; break; - case 33: requested_skill = PLAYER_SKILL_PLATE; break; - case 34: requested_equip = EQUIP_SHIELD; break; - case 35: requested_equip = EQUIP_HELMET; break; - case 36: requested_equip = EQUIP_BELT; break; - case 37: requested_equip = EQUIP_CLOAK; break; - case 38: requested_equip = EQUIP_GAUNTLETS; break; - case 39: requested_equip = EQUIP_BOOTS; break; - case 40: requested_equip = EQUIP_RING; break; - case 41: requested_equip = EQUIP_AMULET; break; - case 42: requested_equip = EQUIP_C; break; - case 43: requested_equip = EQUIP_F; break; - case 44: requested_equip = EQUIP_POTION; break; - case 45: requested_equip = EQUIP_REAGENT; break; - case 46: requested_equip = EQUIP_GEM; break; + case 20: + a3 = EQUIP_ONE_OR_TWO_HANDS; + break; + case 21: + a3 = 3; + break; + case 22: + v53 = 38; + break; + case 23: + v53 = 1; + break; + case 24: + v53 = 2; + break; + case 25: + v53 = 3; + break; + case 26: + v53 = 4; + break; + case 27: + v53 = 5; + break; + case 28: + v53 = 6; + break; + case 30: + v53 = 0; + break; + case 31: + v53 = 9; + break; + case 32: + v53 = 10; + break; + case 33: + v53 = 0xBu; + break; + case 34: + a3 = 4; + break; + case 35: + a3 = 5; + break; + case 36: + a3 = 6; + break; + case 37: + a3 = 7; + break; + case 38: + a3 = 8; + break; + case 39: + a3 = EQUIP_BOOTS; + break; + case 40: + a3 = EQUIP_RING; + break; + case 41: + a3 = 0xBu; + break; + case 42: + a3 = EQUIP_C; + break; + case 43: + a3 = EQUIP_F; + break; + case 44: + a3 = EQUIP_POTION; + break; + case 45: + a3 = EQUIP_REAGENT; + break; + case 46: + a3 = EQUIP_GEM; + break; + case 29: + v53 = 37; + break; default: - __debugbreak(); // check this condition - requested_equip = (ITEM_EQUIP_TYPE)(a3 - 1); + --a3; break; } - - memset(Dst, 0, sizeof(Dst)); - + memset(&Dst, 0, 0xC80u); v52 = 0; - v7 = Dst; - - if (requested_skill == PLAYER_SKILL_INVALID) + v7 = (int *)&Dst; + a2a = 1; + if ( v53 == -1 ) { - for (uint i = 1; i < 500; ++i) + v53 = (int)&v5->pItems[1].uEquipType; + v9 = (int)(&v5->pItems[1].uChanceByTreasureLvl[0] + v6); + do { - if (pItems[i].uEquipType == requested_equip) + if ( *(unsigned char *)v53 == a3 ) { - *v7++ = i; - v52 += pItems[i].field_2C[v6]; + *v7 = a2a; + ++v7; + v52 += *(unsigned char *)v9; } + ++a2a; + v53 += 48; + v9 += 48; } + while ( a2a < 500 ); } else { - for (uint i = 1; i < 500; ++i) + v55 = (int)&v5->pItems[1].uSkillType; + v8 = (int)(&v5->pItems[1].uChanceByTreasureLvl[0] + v6); + do { - if (pItems[i].uSkillType == requested_skill) + if ( *(unsigned char *)v55 == v53 ) { - *v7++ = i; - v52 += pItems[i].field_2C[v6]; + *v7 = a2a; + ++v7; + v52 += *(unsigned char *)v8; } + ++a2a; + v55 += 48; + v8 += 48; } + while ( a2a < 500 ); } - v10 = 0; if ( v52 ) v10 = rand() % v52; - out_item->uItemID = *Dst; - if ( !*Dst ) - out_item->uItemID = 1; - v11 = pItems[out_item->uItemID].field_2C[v54]; + v4->uItemID = *(uint *)Dst; + if ( !Dst ) + v4->uItemID = 1; + v11 = *(&v5->pItems[v4->uItemID].uChanceByTreasureLvl[0] + v54); if ( v11 < v10 ) { v12 = (uint *)Dst; @@ -1930,24 +1717,24 @@ { ++v12; v13 = *v12; - out_item->uItemID = *v12; - v11 += pItems[v13].field_2C[v54]; + v4->uItemID = *v12; + v11 += *(&v5->pItems[v13].uChanceByTreasureLvl[0] + v54); } while ( v11 < v10 ); } - if (pItems[out_item->uItemID].uEquipType == EQUIP_POTION && out_item->uItemID != ITEM_POTION_BOTTLE) + if ( v5->pItems[v4->uItemID].uEquipType == EQUIP_POTION && v4->uItemID != ITEM_POTION_BOTTLE ) { - out_item->_bonus_type = 0; + v4->_bonus_type = 0; v14 = 2; do { - out_item->_bonus_type += rand() % 4 + 1; - v15 = out_item->_bonus_type; + v4->_bonus_type += rand() % 4 + 1; + v15 = v4->_bonus_type; --v14; } while ( v14 ); LABEL_72: - out_item->_bonus_type = v15 * (v54 + 1); + v4->_bonus_type = v15 * (v54 + 1); goto LABEL_73; } } @@ -1962,32 +1749,32 @@ if ( v54 == 5 && rand() % 100 < 5 && !pParty->field_7BA[v17] && v56 < 13 ) { pParty->field_7BA[v17] = 1; - out_item->uAttributes = 0; - out_item->uItemID = v17 + 500; - SetSpecialBonus(out_item); + v4->uAttributes = 0; + v4->uItemID = v17 + 500; + v5->SetSpecialBonus(v4); return; } v57 = 0; - v18 = rand() % field_11684[v54]; - out_item->uItemID = 0; + v18 = rand() % 10;// v5->field_11684[v54]; + v4->uItemID = 0; if ( v18 > 0 ) { do - v57 += pItems[out_item->uItemID++ + 1].field_2C[v54]; + v57 += *(&v5->pItems[v4->uItemID++ + 1].uChanceByTreasureLvl[0] + v54); while ( v57 < v18 ); } if ( !v18 ) - out_item->uItemID = 1; - if ( !out_item->uItemID ) - out_item->uItemID = 1; - if ( pItems[out_item->uItemID].uEquipType == EQUIP_POTION && out_item->uItemID != ITEM_POTION_BOTTLE ) + v4->uItemID = 1; + if ( !v4->uItemID ) + v4->uItemID = 1; + if ( v5->pItems[v4->uItemID].uEquipType == EQUIP_POTION && v4->uItemID != ITEM_POTION_BOTTLE ) { - out_item->_bonus_type = 0; + v4->_bonus_type = 0; v19 = 2; do { - out_item->_bonus_type += rand() % 4 + 1; - v15 = out_item->_bonus_type; + v4->_bonus_type += rand() % 4 + 1; + v15 = v4->_bonus_type; --v19; } while ( v19 ); @@ -1995,22 +1782,22 @@ } } LABEL_73: - if (out_item->uItemID == ITEM_SPELLBOOK_LIGHT_DIVINE_INTERVENTION + if ( v4->uItemID == ITEM_SPELLBOOK_LIGHT_DIVINE_INTERVENTION && !(unsigned __int16)_449B57_test_bit(pParty->_award_bits, 239) ) - out_item->uItemID = ITEM_SPELLBOOK_LIGHT_SUN_BURST; - if ( BYTE2(pItems[out_item->uItemID + 1].uItemID) ) - out_item->uAttributes = 0; + v4->uItemID = ITEM_SPELLBOOK_LIGHT_SUN_BURST; + if ( pItemsTable->pItems[v4->uItemID + 1].uItemID_Rep_St ) + v4->uAttributes = 0; else - out_item->uAttributes = 1; - if (pItems[out_item->uItemID].uEquipType != EQUIP_POTION ) + v4->uAttributes = 1; + if ( v5->pItems[v4->uItemID].uEquipType != EQUIP_POTION ) { - out_item->uAdditionalValue = 0; - out_item->_bonus_type = 0; + v4->uAdditionalValue = 0; + v4->_bonus_type = 0; } - v20 = pItems[out_item->uItemID].uEquipType; + v20 = v5->pItems[v4->uItemID].uEquipType; if ( v20 <= EQUIP_BOW ) { - v37 = (int)&field_1169C[4 * v54 + 48]; + v37 = 10;//(int)&v5->field_1169C[4 * v54 + 48]; if ( !*(unsigned int *)v37 ) return; v38 = rand() % 100; @@ -2023,13 +1810,13 @@ { if ( v20 == EQUIP_C ) { - v21 = rand() % 6 + pItems[out_item->uItemID].uDamageMod + 1; - out_item->uNumCharges = v21; - out_item->uMaxCharges = v21; + v21 = rand() % 6 + pItemsTable->pItems[v4->uItemID].uDamageMod + 1; + v4->uNumCharges = v21; + v4->uMaxCharges = v21; } return; } - v22 = (int)&field_1169C[4 * v54]; + v22 = (int)&v5->uBonusChanceStandart[v54]; if ( !*(unsigned int *)v22 ) return; v23 = rand(); @@ -2037,34 +1824,34 @@ v25 = v23 % 100; if ( v23 % 100 < v24 ) goto LABEL_127; - if ( !*(unsigned int *)&field_1169C[4 * v54 + 24] ) - return; + if ( !v5->uBonusChanceSpecial[v54] ) + return; if ( v25 < v24 ) { LABEL_127: - v26 = rand() % field_116D8[pItems[out_item->uItemID].uEquipType]; - v27 = out_item->uItemID; - out_item->_bonus_type = 0; - for ( i = pEnchantments[0].field_8[pItems[v27].uEquipType + 1]; + v26 = rand() % 10;//v5->field_116D8[v5->pItems[v4->uItemID].uEquipType]; + v27 = v4->uItemID; + v4->_bonus_type = 0; + for ( i = v5->pEnchantments[0].to_item[v5->pItems[v27].uEquipType + 1]; i < v26; - i += pEnchantments[out_item->_bonus_type].field_8[pItems[v29].uEquipType + 1] ) + i += v5->pEnchantments[v4->_bonus_type].to_item[v5->pItems[v29].uEquipType + 1] ) { - v29 = out_item->uItemID; - ++out_item->_bonus_type; + v29 = v4->uItemID; + ++v4->_bonus_type; } - ++out_item->_bonus_type; - v30 = field_116D8[2 * v54 + 12]; + ++v4->_bonus_type; + v30 = 10;// v5->field_116D8[2 * v54 + 12]; v31 = rand(); - v32 = out_item->_bonus_type - 1; - v33 = v31 % (field_116D8[2 * v54 + 13] - v30 + 1) + v30; - out_item->_bonus_strength = v33; + v32 = v4->_bonus_type - 1; + v33 = v31 % 10;//(v5->field_116D8[2 * v54 + 13] - v30 + 1) + v30; + v4->_bonus_strength = v33; if ( v32 == 21 || v32 == 22 || v32 == 23 ) - out_item->_bonus_strength = v33 >> 1; - if ( out_item->_bonus_strength <= 0 ) - out_item->_bonus_strength = 1; + v4->_bonus_strength = v33 >> 1; + if ( v4->_bonus_strength <= 0 ) + v4->_bonus_strength = 1; return; } - v34 = v24 + *(unsigned int *)&field_1169C[4 * v54 + 24]; + v34 = v24 + 10;//*(unsigned int *)&v5->field_1169C[4 * v54 + 24]; v36 = __OFSUB__(v25, v34); v35 = v25 - v34 < 0; } @@ -2073,11 +1860,11 @@ memset(&Dst, 0, 0xC80u); v39 = 0; a2b = 0; - if ( field_11798 > 0 ) + if ( v5->pSpecialEnchantments_count > 0 ) { - v52 = -16 - (uint)this; + v52 = -16 - (uint)v5; v58 = (int *)&Dst; - v40 = (int)&pSpecialEnchantments[1]; + v40 = (int)&v5->pSpecialEnchantments[1]; do { switch ( v54 ) @@ -2092,8 +1879,8 @@ if ( !*(unsigned char *)v40 || v43 == 1 ) { LABEL_117: - v39 += *((unsigned char *)&pItems[0].uItemID + v40 + v52 + pItems[out_item->uItemID].uEquipType); - if ( *((unsigned char *)&pItems[0].uItemID + v40 + v52 + pItems[out_item->uItemID].uEquipType) ) + v39 += *((unsigned char *)&v5->uAllItemsCount + v40 + v52 + v5->pItems[v4->uItemID].uEquipType); + if ( *((unsigned char *)&v5->uAllItemsCount + v40 + v52 + v5->pItems[v4->uItemID].uEquipType) ) { v44 = v58; ++v58; @@ -2121,27 +1908,27 @@ ++a2b; v40 += 28; } - while ( a2b < field_11798 ); + while ( a2b < v5->pSpecialEnchantments_count ); } v45 = rand(); - out_item->uAdditionalValue = *Dst; + v4->uAdditionalValue = *(uint *)Dst; v46 = v45 % v39 + 1; - a2c = *((unsigned char *)&pItems[0].uItemID + 28 * (*(uint *)Dst + 1389) + pItems[out_item->uItemID].uEquipType); + a2c = *((unsigned char *)&v5->uAllItemsCount + 28 * (*(uint *)Dst + 1389) + v5->pItems[v4->uItemID].uEquipType); if ( a2c < v46 ) { for ( j = (int *)&Dst; ; j = (int *)v59 ) { - v48 = out_item->uItemID; + v48 = v4->uItemID; v49 = (int)(j + 1); v59 = v49; v50 = *(unsigned int *)v49; - out_item->uAdditionalValue = v50; - a2c += *((unsigned char *)&pItems[0].uItemID + 28 * (v50 + 1389) + pItems[v48].uEquipType); + v4->uAdditionalValue = v50; + a2c += *((unsigned char *)&v5->uAllItemsCount + 28 * (v50 + 1389) + v5->pItems[v48].uEquipType); if ( a2c >= v46 ) break; } } - ++out_item->uAdditionalValue; + ++v4->uAdditionalValue; } //----- (004505CC) --------------------------------------------------------
--- a/Items.h Sun Feb 17 17:41:15 2013 +0600 +++ b/Items.h Sun Feb 17 17:41:36 2013 +0600 @@ -72,7 +72,7 @@ EQUIP_BOOTS = 0x9, EQUIP_RING = 0xA, EQUIP_AMULET = 0xB, - EQUIP_C = 0xC, // wand? + EQUIP_C = 0xC, EQUIP_REAGENT = 0xD, EQUIP_POTION = 0xE, EQUIP_F = 0xF, @@ -123,30 +123,43 @@ /* 175 */ #pragma pack(push, 1) struct ItemDesc -{ - unsigned int uItemID; - char *pIconName; - char *pName; - char *pUnidentifiedName; - char *pDescription; - unsigned int uValue; - unsigned __int16 uSpriteID; - __int16 field_1A; - unsigned __int16 uEquipX; - unsigned __int16 uEquipY; - unsigned __int8 uEquipType; - unsigned __int8 uSkillType; - unsigned __int8 uDamageDice; - unsigned __int8 uDamageRoll; - unsigned __int8 uDamageMod; - unsigned __int8 uMaterial; - char _additional_value; - char _bonus_type; - char _bonus_strength; - char field_29; - char field_2A; - char field_2B; - char field_2C[4]; +{ //Item # |Pic File|Name|Value|Equip Stat|Skill Group|Mod1|Mod2|material| + ///ID/Rep/St|Not identified name|Sprite Index|VarA|VarB|Equip X|Equip Y|Notes + char *pIconName; //0 4 + char *pName; //4 8 + char *pUnidentifiedName; //8 c + char *pDescription; //0c 10 + unsigned int uValue; //10 14 + unsigned __int16 uSpriteID; //14 18 + __int16 field_1A; //16 + unsigned __int16 uEquipX; //18 1c + unsigned __int16 uEquipY; //1a 1e + unsigned __int8 uEquipType; //1c 20 + unsigned __int8 uSkillType; //1d 21 + unsigned __int8 uDamageDice; //1e 22 + unsigned __int8 uDamageRoll; //1f 23 + unsigned __int8 uDamageMod; //20 24 + unsigned __int8 uMaterial; //21 25 + char _additional_value; //22 26 + char _bonus_type; //23 27 + char _bonus_strength; //24 28 + char field_25; // 25 29 + char field_26; //26 2A + char field_27; // 27 2b + union + { + unsigned __int8 uChanceByTreasureLvl[6]; + struct { + unsigned __int8 uChanceByTreasureLvl1; // 28 2c + unsigned __int8 uChanceByTreasureLvl2; // 29 2d + unsigned __int8 uChanceByTreasureLvl3; // 2A 2e + unsigned __int8 uChanceByTreasureLvl4; // 2B 2f + unsigned __int8 uChanceByTreasureLvl5; // 2C 30 + unsigned __int8 uChanceByTreasureLvl6; // 2D 32 + }; + }; + unsigned char uItemID_Rep_St; //2e 32 + char field_2f; }; #pragma pack(pop) @@ -155,26 +168,46 @@ /* 177 */ #pragma pack(push, 1) struct ItemEnchantment -{ - char *pName; - char *pParam; - char field_8[12]; -}; + { //Bonus|Sta|Of Name|Arm|Shld|Helm|Belt|Cape|Gaunt|Boot|Ring|Amul + char *pBonusStat; + char *pOfName; +/* union{ + struct { + unsigned char to_arm; + unsigned char to_shld; + unsigned char to_helm; + unsigned char to_belt; + unsigned char to_cape; + unsigned char to_gaunt; + unsigned char to_boot; + unsigned char to_ring; + unsigned char to_amul; + }; */ + unsigned char to_item[12]; + // }; + }; #pragma pack(pop) /* 178 */ #pragma pack(push, 1) struct ItemSpecialEnchantment -{ - char *pName; - char *pParam; - char field_8[12]; - int field_14; - int field_18; +{ //Bonus Stat|Name Add|W1|W2|Miss|Arm|Shld|Helm|Belt|Cape|Gaunt|Boot|Ring|Amul|Value|Lvl|Description fo special Bonuses and values + + char *pBonusStatement; + char *pNameAdd; + char to_item_apply[12]; + int iValue; + int iTreasureLevel; }; #pragma pack(pop) - +#pragma pack(push, 1) +struct BonusRange +{ + unsigned int minR; + unsigned int maxR; +}; +#pragma pack(pop) /* 176 */ #pragma pack(push, 1) @@ -189,30 +222,29 @@ bool _456D5E_is_some_material(ItemGen *pItem); char *Release(); - - ItemDesc pItems[638]; - char align1[18]; - unsigned __int8 potion_data[50][50]; //int8!!!! not int16 as in decomp code. hexrays wrong!! - unsigned __int8 potion_note[50][50]; - char align2[2758]; - ItemEnchantment pEnchantments[24]; - ItemSpecialEnchantment pSpecialEnchantments[72]; - char field_9FC0[5000]; + int uAllItemsCount; + ItemDesc pItems[800]; //4-9604h + ItemEnchantment pEnchantments[24]; //9604h + ItemSpecialEnchantment pSpecialEnchantments[72]; //97E4h + char field_9FC4[5000]; char field_B348[5000]; char field_C6D0[5000]; char field_DA58[5000]; - char field_EDE0[5000]; - char field_10168[5000]; - char field_114F0[388]; - char *pItemsTXT_Raw; + char field_EDE0[180]; + unsigned __int16 potion_data[50][50]; // 77B2h*2=EF64h -102ECh + unsigned __int16 potion_note[50][50]; // 8176h*2=102ECh -11674h + char *pItemsTXT_Raw; //11674h char *pRndItemsTXT_Raw; - char *pStdItemsTXT_Raw; - char *pSpcItemsTXT_Raw; - int field_11684[6]; - char field_1169C[60]; - int field_116D8[24]; - int field_11738[24]; - int field_11798; + char *pStdItemsTXT_Raw; //1167Ch + char *pSpcItemsTXT_Raw; //11680h + unsigned int uChanceByTreasureLvlSumm[6]; //11684 + unsigned int uBonusChanceStandart[6]; //1169c + unsigned int uBonusChanceSpecial[6]; //116B4 + unsigned int uBonusChanceWpSpecial[6]; //116cc -116e4 + unsigned int pEnchantmentsSumm[9]; //116E4h -11708h + BonusRange bonus_ranges[6]; //45C2h*4 =11708h + unsigned int pSpecialEnchantmentsSumm[24]; //11738h + unsigned int pSpecialEnchantments_count; //11798h char field_1179C; }; #pragma pack(pop)
--- a/Player.cpp Sun Feb 17 17:41:15 2013 +0600 +++ b/Player.cpp Sun Feb 17 17:41:36 2013 +0600 @@ -2348,7 +2348,7 @@ v20 = thos; v2 = pItem->uItemID; - if ( !BYTE2(pItemsTable->pItems[v2 + 1].uItemID) ) + if ( !pItemsTable->pItems[v2].uItemID_Rep_St ) pItem->uAttributes |= 1u; ///v15 = 0; //v16 = 1;
--- a/mm7_1.cpp Sun Feb 17 17:41:15 2013 +0600 +++ b/mm7_1.cpp Sun Feb 17 17:41:36 2013 +0600 @@ -2780,7 +2780,7 @@ goto LABEL_65; } v60 = _this->_bonus_strength; - v55 = *((int *)&pItemsTable->pEnchantments[23].pName + 7 * v26); + v55 = *((int *)&pItemsTable->pEnchantments[23].pBonusStat + 7 * v26); v50 = pGlobalTXT_LocalizationStrings[210]; v46 = "%s: %s"; }
--- a/mm7_5.cpp Sun Feb 17 17:41:15 2013 +0600 +++ b/mm7_5.cpp Sun Feb 17 17:41:36 2013 +0600 @@ -15885,10 +15885,10 @@ v0->pInventoryItems[pOut.z]._bonus_type = (pParty->pPickedItem._bonus_type + v0->pInventoryItems[pOut.z]._bonus_type) / 2; - v0->SetVariable(VAR_AutoNotes, *(short *)&pItemsTable->field_10168[2 * v20 + 388]); + v0->SetVariable(VAR_AutoNotes, *(short *)&pItemsTable->potion_note[2 * v20 ]);//field_10168 + 388 LABEL_74: v22 = (int)((char *)v0 + 36 * pOut.z); - if ( !BYTE2(pItemsTable->pItems[*(int *)(v22 + 532) + 1].uItemID) ) + if ( !(pItemsTable->pItems[*(int *)(v22 + 532) ].uItemID_Rep_St) ) *(int *)(v22 + 552) |= 1u; if ( !dword_4E455C ) goto LABEL_92;
--- a/mm7_6.cpp Sun Feb 17 17:41:15 2013 +0600 +++ b/mm7_6.cpp Sun Feb 17 17:41:36 2013 +0600 @@ -5265,12 +5265,12 @@ v313 = *(char *)(LODWORD(v725) + 28); if ( v313 == 3 | v313 == 4 | v313 == 5 | v313 == 6 | v313 == 7 | v313 == 8 | v313 == 9 | v313 == 10 | v313 == 11 ) { - v314 = rand() % pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType]; + v314 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType]; *(int *)(v245 + 4) = 0; - for ( j = pItemsTable->pEnchantments[0].field_8[pItemsTable->pItems[*(int *)v245].uEquipType + for ( j = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + 1]; ; - j += pItemsTable->pEnchantments[*(int *)(v245 + 4)].field_8[pItemsTable->pItems[*(int *)v245].uEquipType + j += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + 1] ) { ++*(int *)(v245 + 4); @@ -5278,8 +5278,8 @@ break; } v254 = rand(); - v255 = pItemsTable->field_116D8[17]; - v256 = pItemsTable->field_116D8[16]; + v255 = 10;//pItemsTable->field_116D8[17]; + v256 = 10;//pItemsTable->field_116D8[16]; LABEL_611: *(int *)(v245 + 8) = v256 + v254 % (v255 - v256 + 1); LABEL_612: @@ -5352,11 +5352,11 @@ if ( rand() % 100 < 80 && !(*(char *)(LODWORD(v273) + 28) == 0 | *(char *)(LODWORD(v273) + 28) == 1 | *(char *)(LODWORD(v273) + 28) == 2) ) { - v275 = rand() % pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType]; + v275 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType]; *(int *)(v245 + 4) = 0; - for ( k = pItemsTable->pEnchantments[0].field_8[pItemsTable->pItems[*(int *)v245].uEquipType + 1]; + for ( k = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + 1]; ; - k += pItemsTable->pEnchantments[*(int *)(v245 + 4)].field_8[pItemsTable->pItems[*(int *)v245].uEquipType + k += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + 1] ) { ++*(int *)(v245 + 4); @@ -5364,23 +5364,23 @@ break; } v254 = rand(); - v255 = pItemsTable->field_116D8[19]; - v256 = pItemsTable->field_116D8[18]; + v255 = 10;//pItemsTable->field_116D8[19]; + v256 = 10;//pItemsTable->field_116D8[18]; goto LABEL_611; } - v277 = pItemsTable->field_11798; + v277 = pItemsTable->pSpecialEnchantments_count; v278 = 0; v725 = 0.0; HIDWORD(v733) = 0; - if ( pItemsTable->field_11798 > 0 ) + if ( pItemsTable->pSpecialEnchantments_count > 0 ) { v730 = (int)&v679; do { - v279 = LOBYTE(pItemsTable->pSpecialEnchantments[v278 + 1].pName); + v279 = LOBYTE(pItemsTable->pSpecialEnchantments[v278 + 1].pBonusStatement); if ( !v279 || v279 == 1 ) { - v280 = *(&pItemsTable->pSpecialEnchantments[0].field_8[pItemsTable->pItems[*(int *)v245].uEquipType + v280 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4] + v278 * 28); LODWORD(v725) += v280; @@ -5399,7 +5399,7 @@ v282 = rand() % SLODWORD(v725); v283 = v679; *(int *)(v245 + 12) = v679; - v284 = pItemsTable->pSpecialEnchantments[v283].field_8[pItemsTable->pItems[*(int *)v245].uEquipType + 4]; + v284 = pItemsTable->pSpecialEnchantments[v283].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4]; v285 = v282 + 1; if ( v284 < v285 ) { @@ -5409,7 +5409,7 @@ v732 = v287; v288 = *(int *)v287; *(int *)(v245 + 12) = v288; - v284 += pItemsTable->pSpecialEnchantments[v288].field_8[pItemsTable->pItems[*(int *)v245].uEquipType + v284 += pItemsTable->pSpecialEnchantments[v288].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4]; if ( v284 >= v285 ) break; @@ -5450,11 +5450,11 @@ if ( rand() % 100 < 80 && !(*(char *)(LODWORD(v250) + 28) == 0 | *(char *)(LODWORD(v250) + 28) == 1 | *(char *)(LODWORD(v250) + 28) == 2) ) { - v252 = rand() % pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType]; + v252 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType]; *(int *)(v245 + 4) = 0; - for ( m = pItemsTable->pEnchantments[0].field_8[pItemsTable->pItems[*(int *)v245].uEquipType + 1]; + for ( m = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + 1]; ; - m += pItemsTable->pEnchantments[*(int *)(v245 + 4)].field_8[pItemsTable->pItems[*(int *)v245].uEquipType + m += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + 1] ) { ++*(int *)(v245 + 4); @@ -5462,23 +5462,23 @@ break; } v254 = rand(); - v255 = pItemsTable->field_116D8[21]; - v256 = pItemsTable->field_116D8[20]; + v255 = 10;// pItemsTable->field_116D8[21]; + v256 = 10;//pItemsTable->field_116D8[20]; goto LABEL_611; } - v257 = pItemsTable->field_11798; + v257 = pItemsTable->pSpecialEnchantments_count; v258 = 0; v725 = 0.0; HIDWORD(v733) = 0; - if ( pItemsTable->field_11798 > 0 ) + if ( pItemsTable->pSpecialEnchantments_count > 0 ) { v730 = (int)&v679; do { - v259 = LOBYTE(pItemsTable->pSpecialEnchantments[v258 + 1].pName); + v259 = LOBYTE(pItemsTable->pSpecialEnchantments[v258 + 1].pBonusStatement); if ( !v259 || v259 == 1 ) { - v260 = *(&pItemsTable->pSpecialEnchantments[0].field_8[pItemsTable->pItems[*(int *)v245].uEquipType + v260 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4] + v258 * 28); LODWORD(v725) += v260; @@ -5497,7 +5497,7 @@ v262 = rand() % SLODWORD(v725); v263 = v679; *(int *)(v245 + 12) = v679; - v264 = pItemsTable->pSpecialEnchantments[v263].field_8[pItemsTable->pItems[*(int *)v245].uEquipType + 4]; + v264 = pItemsTable->pSpecialEnchantments[v263].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4]; v265 = v262 + 1; if ( v264 < v265 ) { @@ -5507,7 +5507,7 @@ v732 = v267; v268 = *(int *)v267; *(int *)(v245 + 12) = v268; - v264 += pItemsTable->pSpecialEnchantments[v268].field_8[pItemsTable->pItems[*(int *)v245].uEquipType + v264 += pItemsTable->pSpecialEnchantments[v268].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4]; if ( v264 >= v265 ) break; @@ -5550,20 +5550,20 @@ } if ( rand() % 100 >= 80 ) { - v297 = pItemsTable->field_11798; + v297 = pItemsTable->pSpecialEnchantments_count; v294 = _this; v298 = 0; v725 = 0.0; HIDWORD(v733) = 0; - if ( pItemsTable->field_11798 > 0 ) + if ( pItemsTable->pSpecialEnchantments_count > 0 ) { v730 = (int)&v679; do { - v299 = LOBYTE(pItemsTable->pSpecialEnchantments[v298 + 1].pName); + v299 = LOBYTE(pItemsTable->pSpecialEnchantments[v298 + 1].pBonusStatement); if ( !v299 || v299 == 1 ) { - v300 = *(&pItemsTable->pSpecialEnchantments[0].field_8[pItemsTable->pItems[v294->uItemID].uEquipType + 4] + v300 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4] + v298 * 28); LODWORD(v725) += v300; if ( v300 ) @@ -5581,7 +5581,7 @@ v302 = rand() % SLODWORD(v725); v303 = v679; v294->uAdditionalValue = v679; - v304 = pItemsTable->pSpecialEnchantments[v303].field_8[pItemsTable->pItems[v294->uItemID].uEquipType + 4]; + v304 = pItemsTable->pSpecialEnchantments[v303].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4]; v305 = v302 + 1; if ( v304 < v305 ) { @@ -5591,7 +5591,7 @@ v732 = v307; v308 = *(int *)v307; v294->uAdditionalValue = v308; - v304 += pItemsTable->pSpecialEnchantments[v308].field_8[pItemsTable->pItems[v294->uItemID].uEquipType + 4]; + v304 += pItemsTable->pSpecialEnchantments[v308].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4]; if ( v304 >= v305 ) break; } @@ -5602,19 +5602,19 @@ { v293 = rand(); v294 = _this; - v295 = v293 % pItemsTable->field_116D8[pItemsTable->pItems[_this->uItemID].uEquipType]; + v295 = v293 % 10;// pItemsTable->field_116D8[pItemsTable->pItems[_this->uItemID].uEquipType]; _this->_bonus_type = 0; - for ( kk = pItemsTable->pEnchantments[0].field_8[pItemsTable->pItems[v294->uItemID].uEquipType + 1]; + for ( kk = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[v294->uItemID].uEquipType + 1]; ; - kk += pItemsTable->pEnchantments[v294->_bonus_type].field_8[pItemsTable->pItems[v294->uItemID].uEquipType + kk += pItemsTable->pEnchantments[v294->_bonus_type].to_item[pItemsTable->pItems[v294->uItemID].uEquipType + 1] ) { ++v294->_bonus_type; if ( kk >= v295 ) break; } - v294->_bonus_strength = pItemsTable->field_116D8[18] - + rand() % (pItemsTable->field_116D8[19] - pItemsTable->field_116D8[18] + 1); + v294->_bonus_strength = 10//pItemsTable->field_116D8[18] + + rand() % 10;//(pItemsTable->field_116D8[19] - pItemsTable->field_116D8[18] + 1); } v294->uAttributes |= 0x20u; goto LABEL_1055; @@ -8575,14 +8575,14 @@ if ( !(a1a.uAttributes & 0x10) ) { v13 = 0; - if ( (signed int)pItemsTable->pItems[0].uItemID > 0 ) + if ( (signed int)pItemsTable->uAllItemsCount > 0 ) { v14 = (char *)&pItemsTable->pItems[0].uSpriteID; while ( *(short *)v14 != v9 ) { ++v13; v14 += 48; - if ( (signed int)v13 >= (signed int)pItemsTable->pItems[0].uItemID ) + if ( (signed int)v13 >= (signed int)pItemsTable->uAllItemsCount ) goto LABEL_16; } a1a.stru_24.uItemID = v13;