Mercurial > mm7
changeset 559:09108e73f2f4
item gen fixes (not full)
author | Gloval |
---|---|
date | Tue, 05 Mar 2013 01:08:01 +0400 |
parents | c314e671d29c |
children | 4f14053d6105 |
files | Items.cpp Items.h mm7_1.cpp |
diffstat | 3 files changed, 350 insertions(+), 386 deletions(-) [+] |
line wrap: on
line diff
--- a/Items.cpp Mon Mar 04 00:16:39 2013 +0400 +++ b/Items.cpp Tue Mar 05 01:08:01 2013 +0400 @@ -746,9 +746,9 @@ ++test_char; } test_char=test_string; - if ((ii==tst_len)&&(tolower(*test_char)=='s')) + if ((ii==tst_len)&&(tolower(*test_char)!='s')) { - pItems[item_counter].uDamageDice=atoi(test_char+1); + pItems[item_counter].uDamageDice=atoi(test_char); pItems[item_counter].uDamageRoll=1; } break; @@ -1534,391 +1534,357 @@ //----- (00456620) -------------------------------------------------------- void ItemsTable::GenerateItem(int treasure_level, unsigned int uTreasureType, ItemGen *out_item) -{ - -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 v10; // ebx@43 - int v11; // ecx@47 - unsigned int *v12; // edx@48 - unsigned int v13; // eax@49 - signed int v14; // ebx@52 - int v15; // eax@53 - signed int v16; // eax@55 - int v17; // ebx@57 - int v18; // edx@62 - signed int v19; // ebx@70 - unsigned __int8 v20; // al@81 - int v21; // eax@84 - int v22; // ebx@85 - int v23; // eax@86 - int v24; // ebx@86 - int v25; // edx@86 - int v26; // edx@89 - unsigned int v27; // eax@89 - int i; // ebx@89 - unsigned int v29; // ecx@90 - int v30; // ebx@91 - int v31; // eax@91 - int v32; // ecx@91 - int v33; // eax@91 - int v34; // eax@97 - unsigned __int8 v35; // sf@97 - unsigned __int8 v36; // of@97 - int v37; // ebx@98 - int v38; // edx@99 - signed int v39; // ebx@101 - int v40; // ecx@102 - char v41; // zf@107 - char v42; // al@108 - char v43; // al@111 - int *v44; // edx@118 - int v45; // eax@120 - int v46; // edx@120 - int *j; // eax@121 - unsigned int v48; // ecx@123 - int v49; // eax@123 - int v50; // eax@123 - int Dst[800]; // [sp+Ch] [bp-C88h]@33 - int v52; // [sp+C8Ch] [bp-8h]@33 - int v53; // [sp+C90h] [bp-4h]@1 - int v54; // [sp+C9Ch] [bp+8h]@3 - //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 - int a2b; // [sp+CA4h] [bp+10h]@101 - int a2c; // [sp+CA4h] [bp+10h]@120 + { - v53 = -1; - v5 = this; - if (!out_item) - out_item = (ItemGen *)pAllocator->AllocNamedChunk(out_item, sizeof(*out_item), "newItemGen"); - memset(out_item, 0, sizeof(*out_item)); + ItemsTable *v5; // edi@1 + int v6; // ebx@3 + int *v7; // ecx@33 + //int v8; // eax@34 + //int v9; // eax@39 + int current_chance; // ebx@43 + int tmp_chance; // ecx@47 + unsigned int *v12; // edx@48 + unsigned int v13; // eax@49 + signed int v14; // ebx@52 + int v15; // eax@53 + signed int v16; // eax@55 + int v17; // ebx@57 + int v18; // edx@62 + signed int v19; // ebx@70 + unsigned __int8 v20; // al@81 + int v21; // eax@84 + int v22; // ebx@85 + int v23; // eax@86 + int v24; // ebx@86 + int special_chance; // edx@86 + int v26; // edx@89 + unsigned int v27; // eax@89 + int i; // ebx@89 + unsigned int v29; // ecx@90 + int v30; // ebx@91 + int v31; // eax@91 + int v32; // ecx@91 + int v33; // eax@91 + int v34; // eax@97 + unsigned __int8 v35; // sf@97 + unsigned __int8 v36; // of@97 + int v37; // ebx@98 + int v38; // edx@99 + signed int v39; // ebx@101 + int v40; // ecx@102 + char v41; // zf@107 + char v42; // al@108 + char v43; // al@111 + int *v44; // edx@118 + int v45; // eax@120 + int v46; // edx@120 + int j; // eax@121 + unsigned int v48; // ecx@123 + int v49; // eax@123 + int v50; // eax@123 + int val_list[800]; // [sp+Ch] [bp-C88h]@33 + int total_chance; // [sp+C8Ch] [bp-8h]@33 + int v53; // [sp+C90h] [bp-4h]@1 + int v54; // [sp+C9Ch] [bp+8h]@3 + //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 + int a2b; // [sp+CA4h] [bp+10h]@101 + int a2c; // [sp+CA4h] [bp+10h]@120 + + v5 = this; + if (!out_item) + out_item = (ItemGen *)pAllocator->AllocNamedChunk(out_item, sizeof(*out_item), "newItemGen"); + memset(out_item, 0, sizeof(*out_item)); + - v4 = out_item; - v6 = treasure_level - 1; - v54 = treasure_level - 1; - if ( uTreasureType ) //generate known treasure type - { - ITEM_EQUIP_TYPE requested_equip; - PLAYER_SKILL_TYPE requested_skill = PLAYER_SKILL_INVALID; - switch (uTreasureType) - { - case 20: requested_equip = EQUIP_ONE_OR_TWO_HANDS; break; - case 21: requested_equip = EQUIP_ARMOUR; break; - case 22: requested_skill = PLAYER_SKILL_MISC; 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_CLUB; 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_WAND; break; - case 43: requested_equip = EQUIP_SPELL_SCROLL; break; - case 44: requested_equip = EQUIP_POTION; break; - case 45: requested_equip = EQUIP_REAGENT; break; - case 46: requested_equip = EQUIP_GEM; break; - default: - __debugbreak(); // check this condition - requested_equip = (ITEM_EQUIP_TYPE)(uTreasureType - 1); - break; - } - memset(Dst, 0, sizeof(Dst)); - v52 = 0; - v7 = Dst; - //a2a = 1; - if (requested_skill == PLAYER_SKILL_INVALID) // no skill for this item needed - { - for (uint i = 1; i < 500; ++i) - { - if (pItems[i].uEquipType == requested_equip) + v6 = treasure_level - 1; + v54 = treasure_level - 1; + if ( uTreasureType ) //generate known treasure type { - *v7++ = i; - v52 += pItems[i].uChanceByTreasureLvl[v6]; + ITEM_EQUIP_TYPE requested_equip; + PLAYER_SKILL_TYPE requested_skill = PLAYER_SKILL_INVALID; + switch (uTreasureType) + { + case 20: requested_equip = EQUIP_ONE_OR_TWO_HANDS; break; + case 21: requested_equip = EQUIP_ARMOUR; break; + case 22: requested_skill = PLAYER_SKILL_MISC; 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_CLUB; 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_WAND; break; + case 43: requested_equip = EQUIP_SPELL_SCROLL; break; + case 44: requested_equip = EQUIP_POTION; break; + case 45: requested_equip = EQUIP_REAGENT; break; + case 46: requested_equip = EQUIP_GEM; break; + default: + __debugbreak(); // check this condition + requested_equip = (ITEM_EQUIP_TYPE)(uTreasureType - 1); + break; + } + memset(val_list, 0, sizeof(val_list)); + total_chance = 0; + j=0; + //a2a = 1; + if (requested_skill == PLAYER_SKILL_INVALID) // no skill for this item needed + { + for (uint i = 1; i < 500; ++i) + { + if (pItems[i].uEquipType == requested_equip) + { + val_list[j] = i; + ++j; + total_chance += pItems[i].uChanceByTreasureLvl[treasure_level - 1]; + } + } + } + else //have needed skill + { + for (uint i = 1; i < 500; ++i) + { + if (pItems[i].uSkillType == requested_skill) + { + val_list[j] = i; + ++j; + total_chance += pItems[i].uChanceByTreasureLvl[treasure_level - 1]; + } + } + } + + current_chance = 0; + if ( total_chance ) + current_chance = rand() % total_chance; + + out_item->uItemID = val_list[0]; + if (!out_item->uItemID) + out_item->uItemID = 1; + + if ( pItems[out_item->uItemID].uChanceByTreasureLvl[treasure_level - 1] < current_chance ) + { + j=0; + tmp_chance=pItems[out_item->uItemID].uChanceByTreasureLvl[treasure_level - 1]; + do + { + ++j; + out_item->uItemID = val_list[j]; + tmp_chance += pItems[val_list[j]].uChanceByTreasureLvl[treasure_level - 1]; + } + while ( tmp_chance < current_chance ); + } + + if (pItems[out_item->uItemID].uEquipType == EQUIP_POTION && out_item->uItemID != ITEM_POTION_BOTTLE ) + {// if it potion set potion spec + out_item->uEncantmentType = 0; + for (int i=0; i<2; ++i) + out_item->uEncantmentType += rand() % 4 + 1; + out_item->uEncantmentType = out_item->uEncantmentType * treasure_level; + } } - } - } - else //have needed skill - { - for (uint i = 1; i < 500; ++i) - { - if (pItems[i].uSkillType == requested_skill) + else { - *v7++ = i; - v52 += pItems[i].uChanceByTreasureLvl[v6]; - } - } - } - - v10 = 0; - if ( v52 ) - v10 = rand() % v52; - - out_item->uItemID = *Dst; - if (!out_item->uItemID) - out_item->uItemID = 1; + //artifact + v56 = 0; + for(int i=0; i<29; ++i) + v56 += pParty->pIsArtifactFound[i]; - v11 = pItems[out_item->uItemID].uChanceByTreasureLvl[v6]; - if ( v11 < v10 ) - { - v12 = (uint *)Dst; - do - { - ++v12; - v13 = *v12; - out_item->uItemID = *v12; - v11 += pItems[v13].uChanceByTreasureLvl[v6]; - } - while ( v11 < v10 ); - } - - if (pItems[out_item->uItemID].uEquipType == EQUIP_POTION && out_item->uItemID != ITEM_POTION_BOTTLE ) - {// if it potion set potion spec - out_item->uEncantmentType = 0; - for (int i=0; i<2; ++i) - out_item->uEncantmentType += rand() % 4 + 1; - out_item->uEncantmentType = out_item->uEncantmentType * treasure_level; - } - } - else - { - v16 = 0; - v56 = 0; - do - v56 += pParty->pIsArtifactFound[v16++]; - while ( v16 < 29 ); - v17 = rand() % 29; - - if ( v6 == 5 && rand() % 100 < 5 && !pParty->pIsArtifactFound[v17] && v56 < 13 ) - { - pParty->pIsArtifactFound[v17] = 1; - out_item->uAttributes = 0; - out_item->uItemID = v17 + 500; - SetSpecialBonus(out_item); - return; - } + v17 = rand() % 29; - v57 = 0; - v18 = rand() % v5->uChanceByTreasureLvlSumm[v54];// v5->field_11684[v54]; - out_item->uItemID = 0; - if ( v18 > 0 ) - { - do - v57 += pItems[out_item->uItemID++ + 1].uChanceByTreasureLvl[v6]; - while ( v57 < v18 ); - } + if ( v6 == 5 && (rand() % 100 < 5) && !pParty->pIsArtifactFound[v17] && v56 < 13 ) + { + pParty->pIsArtifactFound[v17] = 1; + out_item->uAttributes = 0; + out_item->uItemID = v17 + 500; + SetSpecialBonus(out_item); + return; + } + + v57 = 0; + v18 = rand() % v5->uChanceByTreasureLvlSumm[treasure_level - 1]; + out_item->uItemID = 0; + if ( v18 > 0 ) + { + do + v57 += pItems[out_item->uItemID++ + 1].uChanceByTreasureLvl[v6]; + 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 ) + {// if it potion set potion spec + out_item->uEncantmentType = 0; + for (int i=0; i<2; ++i) + out_item->uEncantmentType += rand() % 4 + 1; + out_item->uEncantmentType = out_item->uEncantmentType * treasure_level; + } + out_item->uEncantmentType = out_item->uEncantmentType * treasure_level; + } + + if ( out_item->uItemID == ITEM_SPELLBOOK_LIGHT_DIVINE_INTERVENTION + && !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 239) ) + out_item->uItemID = ITEM_SPELLBOOK_LIGHT_SUN_BURST; + if ( pItemsTable->pItems[out_item->uItemID + 1].uItemID_Rep_St ) + out_item->uAttributes = 0; + else + out_item->uAttributes = 1; - 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 ) - {// if it potion set potion spec - out_item->uEncantmentType = 0; - for (int i=0; i<2; ++i) - out_item->uEncantmentType += rand() % 4 + 1; - out_item->uEncantmentType = out_item->uEncantmentType * treasure_level; - } - out_item->uEncantmentType = out_item->uEncantmentType * treasure_level; - } - if ( v4->uItemID == ITEM_SPELLBOOK_LIGHT_DIVINE_INTERVENTION - && !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 239) ) - v4->uItemID = ITEM_SPELLBOOK_LIGHT_SUN_BURST; - if ( pItemsTable->pItems[v4->uItemID + 1].uItemID_Rep_St ) - v4->uAttributes = 0; - else - v4->uAttributes = 1; - if ( pItems[out_item->uItemID].uEquipType != EQUIP_POTION ) - { - out_item->uSpecEnchantmentType = 0; - out_item->uEncantmentType = 0; - } - v20 = pItems[out_item->uItemID].uEquipType; - if ( v20 <= EQUIP_BOW ) - { - v37 = v5->uBonusChanceWpSpecial[v54]; - if ( !v37 ) - return; - v38 = rand() % 100; - v36 = __OFSUB__(v38, v37); - v35 = v38 - v37 < 0; - } - else - { - if ( v20 > EQUIP_AMULET ) - { - if ( v20 == EQUIP_WAND ) - { - v21 = rand() % 6 + pItemsTable->pItems[v4->uItemID].uDamageMod + 1; - out_item->uNumCharges = v21; - out_item->uMaxCharges = v21; - } - return; - } - v22 = uBonusChanceStandart[v6]; - if ( !v22 ) - return; - v24 = v22; - v25 = rand() % 100; - if ( !uBonusChanceSpecial[v6] && !(v25 < v24)) + if ( pItems[out_item->uItemID].uEquipType != EQUIP_POTION ) + { + out_item->uSpecEnchantmentType = 0; + out_item->uEncantmentType = 0; + } + //try get special enhansment + switch (pItems[out_item->uItemID].uEquipType) + { + case EQUIP_ONE_OR_TWO_HANDS: + case EQUIP_TWO_HANDED : + case EQUIP_BOW : + if ( !uBonusChanceWpSpecial[v6] ) + return; + if ((rand() % 100)>=uBonusChanceWpSpecial[v6]) + return; + break; + case EQUIP_ARMOUR : + case EQUIP_SHIELD : + case EQUIP_HELMET : + case EQUIP_BELT : + case EQUIP_CLOAK : + case EQUIP_GAUNTLETS : + case EQUIP_BOOTS : + case EQUIP_RING : + v22 = uBonusChanceStandart[v6]; + if ( !uBonusChanceStandart[v6] ) + return; + v24 = v22; + special_chance = rand() % 100; + if ( !uBonusChanceSpecial[v6] && !(special_chance < uBonusChanceStandart[v6])) + return; + if ( special_chance < uBonusChanceStandart[v6]) + { + v26 = rand() % v5->uBonusChanceWpSpecial[v5->pItems[out_item->uItemID].uEquipType + 3]; + v27 = out_item->uItemID; + out_item->uEncantmentType = 0; + for ( i = pEnchantments[0].to_item[pItems[v27].uEquipType + 1]; + i < v26; + i += pEnchantments[out_item->uEncantmentType].to_item[pItems[v29].uEquipType + 1] ) + { + v29 = out_item->uItemID; + ++out_item->uEncantmentType; + } + ++out_item->uEncantmentType; + v30 = bonus_ranges[v6].minR; + v32 = out_item->uEncantmentType - 1; + v33 = rand() % (bonus_ranges[v6].maxR - v30 + 1) + v30; + out_item->_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; + return; + + } + v34 = uBonusChanceStandart[v6] + uBonusChanceSpecial[v6]; + if ( special_chance<v34 ) + return; + break; + case EQUIP_WAND: + out_item->uNumCharges = rand() % 6 + pItemsTable->pItems[out_item->uItemID].uDamageMod + 1; + out_item->uMaxCharges = out_item->uNumCharges; + default: return; - if ( v25 < v24 || v25 < v24) - { - v26 = rand() % v5->uBonusChanceWpSpecial[v5->pItems[v4->uItemID].uEquipType + 3]; - v27 = v4->uItemID; - v4->uEncantmentType = 0; - for ( i = pEnchantments[0].to_item[pItems[v27].uEquipType + 1]; - i < v26; - i += pEnchantments[v4->uEncantmentType].to_item[pItems[v29].uEquipType + 1] ) - { - v29 = v4->uItemID; - ++v4->uEncantmentType; - } - ++v4->uEncantmentType; - v30 = 10;// v5->field_116D8[2 * v54 + 12]; - v31 = rand(); - v32 = v4->uEncantmentType - 1; - v33 = v31 % 10;//(v5->field_116D8[2 * v54 + 13] - v30 + 1) + v30; - v4->_bonus_strength = v33; - if ( v32 == 21 || v32 == 22 || v32 == 23 ) - v4->_bonus_strength = v33 >> 1; - if ( v4->_bonus_strength <= 0 ) - v4->_bonus_strength = 1; - return; - } - v34 = v24 + 10;//*(unsigned int *)&v5->field_1169C[4 * v54 + 24]; - v36 = __OFSUB__(v25, v34); - v35 = v25 - v34 < 0; - } - if ( !(v35 ^ v36) ) - return; - memset(&Dst, 0, 0xC80u); - v39 = 0; - a2b = 0; - if ( pSpecialEnchantments_count > 0 ) - { - v52 = -16 - (uint)this; - v58 = (int *)&Dst; - v40 = (int)&pSpecialEnchantments[1]; - do - { - switch ( v6 ) - { + } + + j=0; + int spc_sum=0; + int spc; + memset(&val_list, 0, 3200); + for (int i=0; i<pSpecialEnchantments_count;++i) + { + int tr_lv= pSpecialEnchantments[i].iTreasureLevel; + switch ( treasure_level - 1 ) + { case 2: - if ( !*(unsigned char *)v40 ) - { - v39 += *((unsigned char *)&uAllItemsCount + v40 + v52 + pItems[v4->uItemID].uEquipType); - if ( *((unsigned char *)&uAllItemsCount + v40 + v52 + pItems[v4->uItemID].uEquipType) ) - { - v44 = v58; - ++v58; - *v44 = a2b; - } - ++a2b; - v40 += 28; - continue; - } - v41 = *(unsigned char *)v40 == 1; - break; + if ((tr_lv==1)||(tr_lv==0)) + { + spc=pSpecialEnchantments[i].to_item_apply[pItems[out_item->uItemID].uEquipType]; + spc_sum+=spc; + if(spc) + { + val_list[j++]=i; + } + } + break; case 3: - v43 = *(unsigned char *)v40; - if ( !*(unsigned char *)v40 || v43 == 1 ) - { - v39 += *((unsigned char *)&uAllItemsCount + v40 + v52 + pItems[v4->uItemID].uEquipType); - if ( *((unsigned char *)&uAllItemsCount + v40 + v52 + pItems[v4->uItemID].uEquipType) ) - { - v44 = v58; - ++v58; - *v44 = a2b; + if ((tr_lv==2)||(tr_lv==1)||(tr_lv==0)) + { + spc=pSpecialEnchantments[i].to_item_apply[pItems[out_item->uItemID].uEquipType]; + spc_sum+=spc; + if(spc) + { + val_list[j++]=i; + } + } + break; + case 4: + if ((tr_lv==3)||(tr_lv==2)||(tr_lv==1)) + { + spc=pSpecialEnchantments[i].to_item_apply[pItems[out_item->uItemID].uEquipType]; + spc_sum+=spc; + if(spc) + { + val_list[j++]=i; + } + } + break; + case 5: + if (tr_lv==3) + { + spc=pSpecialEnchantments[i].to_item_apply[pItems[out_item->uItemID].uEquipType]; + spc_sum+=spc; + if(spc) + { + val_list[j++]=i; + } + } + break; } - ++a2b; - v40 += 28; - continue; - } - v41 = v43 == 2; - break; - case 4: - v42 = *(unsigned char *)v40; - if ( *(unsigned char *)v40 == 1 || v42 == 2 ) - { - v39 += *((unsigned char *)&uAllItemsCount + v40 + v52 + pItems[v4->uItemID].uEquipType); - if ( *((unsigned char *)&uAllItemsCount + v40 + v52 + pItems[v4->uItemID].uEquipType) ) + } + + v46 = rand()%spc_sum+1; + j=0; + out_item->uSpecEnchantmentType =val_list[j]; + v45=pSpecialEnchantments[val_list[j]].to_item_apply[pItems[out_item->uItemID].uEquipType]; + if (v45<v46) + { + do { - v44 = v58; - ++v58; - *v44 = a2b; - } - ++a2b; - v40 += 28; - continue; - } - v41 = v42 == 3; - break; - default: - if ( v6 != 5 ) - { - ++a2b; - v40 += 28; - continue; - } - v41 = *(unsigned char *)v40 == 3; - break; - } - if ( v41 ) - { - v39 += *((unsigned char *)&uAllItemsCount + v40 + v52 + pItems[v4->uItemID].uEquipType); - if ( *((unsigned char *)&uAllItemsCount + v40 + v52 + pItems[v4->uItemID].uEquipType) ) - { - v44 = v58; - ++v58; - *v44 = a2b; - } - } -LABEL_119: - ++a2b; - v40 += 28; - } - while ( a2b < pSpecialEnchantments_count ); - } - v45 = rand(); - v4->uSpecEnchantmentType = *(uint *)Dst; - v46 = v45 % v39 + 1; - a2c = *((unsigned char *)&uAllItemsCount + 28 * (*(uint *)Dst + 1389) + pItems[v4->uItemID].uEquipType); - if ( a2c < v46 ) - { - for ( j = (int *)&Dst; ; j = (int *)v59 ) - { - v48 = v4->uItemID; - v49 = (int)(j + 1); - v59 = v49; - v50 = *(unsigned int *)v49; - v4->uSpecEnchantmentType = v50; - a2c += *((unsigned char *)&uAllItemsCount + 28 * (v50 + 1389) + pItems[v48].uEquipType); - if ( a2c >= v46 ) - break; - } - } - ++v4->uSpecEnchantmentType; + ++j; + out_item->uSpecEnchantmentType=val_list[j]; + v45+=pSpecialEnchantments[val_list[j]].to_item_apply[pItems[out_item->uItemID].uEquipType]; + } while (v45<v46); + } + ++out_item->uSpecEnchantmentType; } //----- (004505CC) --------------------------------------------------------
--- a/Items.h Mon Mar 04 00:16:39 2013 +0400 +++ b/Items.h Tue Mar 05 01:08:01 2013 +0400 @@ -157,7 +157,7 @@ /* 175 */ #pragma pack(push, 1) -struct ItemDesc +struct ItemDesc //30h { //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 @@ -225,14 +225,14 @@ /* 178 */ #pragma pack(push, 1) -struct ItemSpecialEnchantment +struct ItemSpecialEnchantment //1Ch { //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; + char *pBonusStatement; //0 + char *pNameAdd; //4 + char to_item_apply[12]; //8 + int iValue; //14 + int iTreasureLevel; //18 }; #pragma pack(pop)
--- a/mm7_1.cpp Mon Mar 04 00:16:39 2013 +0400 +++ b/mm7_1.cpp Tue Mar 05 01:08:01 2013 +0400 @@ -2509,14 +2509,12 @@ if ( inspect_item->uEncantmentType ) { sprintf(out_text + 200, "%s: %s +%d", pGlobalTXT_LocalizationStrings[210], - pItemsTable->pEnchantments[inspect_item->uEncantmentType-1].pOfName, inspect_item->_bonus_strength); //"Special" + pItemsTable->pEnchantments[inspect_item->uEncantmentType-1].pBonusStat, inspect_item->_bonus_strength); //"Special" } else if ( inspect_item->uSpecEnchantmentType ) - { - - + { sprintf(out_text + 200, "%s: %s", pGlobalTXT_LocalizationStrings[210], - pItemsTable->pSpecialEnchantments[inspect_item->uSpecEnchantmentType-1].pNameAdd, inspect_item->_bonus_strength); + pItemsTable->pSpecialEnchantments[inspect_item->uSpecEnchantmentType-1].pBonusStatement, inspect_item->_bonus_strength); } else if ( inspect_item->uNumCharges )