comparison Player.cpp @ 1611:8e99b4a7176f

Слияние
author Ritor1
date Sat, 14 Sep 2013 10:28:23 +0600
parents 4b79ff62df3a
children 434b796cdfd3
comparison
equal deleted inserted replaced
1610:fa0e700bcc80 1611:8e99b4a7176f
153 10, // PLAYER_SKILL_SHIELD 153 10, // PLAYER_SKILL_SHIELD
154 10, // PLAYER_SKILL_LEATHER 154 10, // PLAYER_SKILL_LEATHER
155 20, // PLAYER_SKILL_CHAIN 155 20, // PLAYER_SKILL_CHAIN
156 30 // PLAYER_SKILL_PLATE 156 30 // PLAYER_SKILL_PLATE
157 }; 157 };
158
159
160 158
161 //----- (00490913) -------------------------------------------------------- 159 //----- (00490913) --------------------------------------------------------
162 int PlayerCreation_GetUnspentAttributePointCount() 160 int PlayerCreation_GetUnspentAttributePointCount()
163 { 161 {
164 signed int v0; // edi@1 162 signed int v0; // edi@1
1138 //----- (004910D3) -------------------------------------------------------- 1136 //----- (004910D3) --------------------------------------------------------
1139 bool Player::CanIdentify( ItemGen *pItem ) 1137 bool Player::CanIdentify( ItemGen *pItem )
1140 { 1138 {
1141 unsigned __int16 v2; // ax@1 1139 unsigned __int16 v2; // ax@1
1142 int v5; // edi@7 1140 int v5; // edi@7
1143 1141 return true;
1144 if (CheckHiredNPCSpeciality(Scholar)) 1142 if (CheckHiredNPCSpeciality(Scholar))
1145 return true; 1143 return true;
1146 1144
1147 v2 = GetActualSkillLevel(PLAYER_SKILL_ITEM_ID); 1145 v2 = GetActualSkillLevel(PLAYER_SKILL_ITEM_ID);
1148 if ( (signed int)SkillToMastery(v2) >= 4 ) 1146 if ( (signed int)SkillToMastery(v2) >= 4 )
1404 // 506128: using guessed type int areWeLoadingTexture; 1402 // 506128: using guessed type int areWeLoadingTexture;
1405 1403
1406 //----- (0048C855) -------------------------------------------------------- 1404 //----- (0048C855) --------------------------------------------------------
1407 int Player::GetBaseStrength() 1405 int Player::GetBaseStrength()
1408 { 1406 {
1409 return this->uMight + GetItemsBonus(CHARACTER_ATTRIBUTE_STRENGTH, 0); 1407 return this->uMight + GetItemsBonus(CHARACTER_ATTRIBUTE_STRENGTH);
1410 } 1408 }
1411 1409
1412 //----- (0048C86C) -------------------------------------------------------- 1410 //----- (0048C86C) --------------------------------------------------------
1413 int Player::GetBaseIntelligence() 1411 int Player::GetBaseIntelligence()
1414 { 1412 {
1415 return this->uIntelligence + GetItemsBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE, 0); 1413 return this->uIntelligence + GetItemsBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE);
1416 } 1414 }
1417 1415
1418 //----- (0048C883) -------------------------------------------------------- 1416 //----- (0048C883) --------------------------------------------------------
1419 int Player::GetBaseWillpower() 1417 int Player::GetBaseWillpower()
1420 { 1418 {
1421 return this->uWillpower + GetItemsBonus(CHARACTER_ATTRIBUTE_WILLPOWER, 0); 1419 return this->uWillpower + GetItemsBonus(CHARACTER_ATTRIBUTE_WILLPOWER);
1422 } 1420 }
1423 1421
1424 //----- (0048C89A) -------------------------------------------------------- 1422 //----- (0048C89A) --------------------------------------------------------
1425 int Player::GetBaseEndurance() 1423 int Player::GetBaseEndurance()
1426 { 1424 {
1427 return this->uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0); 1425 return this->uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE);
1428 } 1426 }
1429 1427
1430 //----- (0048C8B1) -------------------------------------------------------- 1428 //----- (0048C8B1) --------------------------------------------------------
1431 int Player::GetBaseAccuracy() 1429 int Player::GetBaseAccuracy()
1432 { 1430 {
1433 return this->uAccuracy + GetItemsBonus(CHARACTER_ATTRIBUTE_ACCURACY, 0); 1431 return this->uAccuracy + GetItemsBonus(CHARACTER_ATTRIBUTE_ACCURACY);
1434 } 1432 }
1435 1433
1436 //----- (0048C8C8) -------------------------------------------------------- 1434 //----- (0048C8C8) --------------------------------------------------------
1437 int Player::GetBaseSpeed() 1435 int Player::GetBaseSpeed()
1438 { 1436 {
1439 return this->uSpeed + GetItemsBonus(CHARACTER_ATTRIBUTE_SPEED, 0); 1437 return this->uSpeed + GetItemsBonus(CHARACTER_ATTRIBUTE_SPEED);
1440 } 1438 }
1441 1439
1442 //----- (0048C8DF) -------------------------------------------------------- 1440 //----- (0048C8DF) --------------------------------------------------------
1443 int Player::GetBaseLuck() 1441 int Player::GetBaseLuck()
1444 { 1442 {
1445 return this->uLuck + GetItemsBonus(CHARACTER_ATTRIBUTE_LUCK, 0); 1443 return this->uLuck + GetItemsBonus(CHARACTER_ATTRIBUTE_LUCK);
1446 } 1444 }
1447 1445
1448 //----- (0048C8F6) -------------------------------------------------------- 1446 //----- (0048C8F6) --------------------------------------------------------
1449 int Player::GetBaseLevel() 1447 int Player::GetBaseLevel()
1450 { 1448 {
1451 return this->uLevel + GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL, 0); 1449 return this->uLevel + GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL);
1452 } 1450 }
1453 1451
1454 //----- (0048C90D) -------------------------------------------------------- 1452 //----- (0048C90D) --------------------------------------------------------
1455 int Player::GetActualLevel() 1453 int Player::GetActualLevel()
1456 { 1454 {
1457 return uLevel + sLevelModifier + 1455 return uLevel + sLevelModifier +
1458 GetMagicalBonus(CHARACTER_ATTRIBUTE_LEVEL) + 1456 GetMagicalBonus(CHARACTER_ATTRIBUTE_LEVEL) +
1459 GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL, 0); 1457 GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL);
1460 } 1458 }
1461 1459
1462 //----- (0048C93C) -------------------------------------------------------- 1460 //----- (0048C93C) --------------------------------------------------------
1463 int Player::GetActualMight() 1461 int Player::GetActualMight()
1464 { 1462 {
1525 break; 1523 break;
1526 } 1524 }
1527 1525
1528 auto uConditionMult = pConditionAttributeModifier[attrId][GetMajorConditionIdx()]; 1526 auto uConditionMult = pConditionAttributeModifier[attrId][GetMajorConditionIdx()];
1529 int magicBonus = GetMagicalBonus(attrId); 1527 int magicBonus = GetMagicalBonus(attrId);
1530 int itemBonus = GetItemsBonus(attrId, 0); 1528 int itemBonus = GetItemsBonus(attrId);
1531 return uConditionMult * uAgeingMultiplier * this->*attrValue / 100 / 100 1529 return uConditionMult * uAgeingMultiplier * this->*attrValue / 100 / 100
1532 + magicBonus 1530 + magicBonus
1533 + itemBonus 1531 + itemBonus
1534 + this->*attrBonus; 1532 + this->*attrBonus;
1535 } 1533 }
1558 int v5; // esi@1 1556 int v5; // esi@1
1559 signed int result; // eax@1 1557 signed int result; // eax@1
1560 1558
1561 v2 = GetActualMight(); 1559 v2 = GetActualMight();
1562 v3 = GetParameterBonus(v2); 1560 v3 = GetParameterBonus(v2);
1563 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0) + v3; 1561 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN) + v3;
1564 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; 1562 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4;
1565 result = _melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; 1563 result = _melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5;
1566 if ( result < 1 ) 1564 if ( result < 1 )
1567 result = 1; 1565 result = 1;
1568 return result; 1566 return result;
1578 int v6; // esi@1 1576 int v6; // esi@1
1579 signed int result; // eax@1 1577 signed int result; // eax@1
1580 1578
1581 v2 = GetActualMight(); 1579 v2 = GetActualMight();
1582 v3 = GetParameterBonus(v2); 1580 v3 = GetParameterBonus(v2);
1583 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0) + v3; 1581 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX) + v3;
1584 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; 1582 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4;
1585 v6 = this->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; 1583 v6 = this->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5;
1586 result = 1; 1584 result = 1;
1587 if ( v6 >= 1 ) 1585 if ( v6 >= 1 )
1588 result = v6; 1586 result = v6;
1698 v2 = *(int *)&this->pInventoryItemList[this->pEquipment.uMainHand-1]; 1696 v2 = *(int *)&this->pInventoryItemList[this->pEquipment.uMainHand-1];
1699 if ( v2 < ITEM_BLASTER || v2 > ITEM_LASER_RIFLE ) 1697 if ( v2 < ITEM_BLASTER || v2 > ITEM_LASER_RIFLE )
1700 { 1698 {
1701 v4 = GetActualAccuracy(); 1699 v4 = GetActualAccuracy();
1702 v5 = GetParameterBonus(v4); 1700 v5 = GetParameterBonus(v4);
1703 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK, 0) + v5; 1701 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v5;
1704 v7 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v6; 1702 v7 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v6;
1705 v3 = this->_ranged_atk_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v7; 1703 v3 = this->_ranged_atk_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v7;
1706 } 1704 }
1707 else 1705 else
1708 { 1706 {
1717 int v2; // edi@1 1715 int v2; // edi@1
1718 int v3; // edi@1 1716 int v3; // edi@1
1719 int v4; // edi@1 1717 int v4; // edi@1
1720 int result; // eax@6 1718 int result; // eax@6
1721 1719
1722 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_MIN, 0); 1720 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_MIN);
1723 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v2; 1721 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v2;
1724 v4 = this->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v3; 1722 v4 = this->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v3;
1725 if ( v4 >= 1 ) 1723 if ( v4 >= 1 )
1726 result = v4; 1724 result = v4;
1727 else 1725 else
1735 int v2; // edi@1 1733 int v2; // edi@1
1736 int v3; // edi@1 1734 int v3; // edi@1
1737 int v4; // edi@1 1735 int v4; // edi@1
1738 int result; // eax@6 1736 int result; // eax@6
1739 1737
1740 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_MAX, 0); 1738 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_MAX);
1741 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v2; 1739 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v2;
1742 v4 = this->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v3; 1740 v4 = this->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v3;
1743 if ( v4 >= 1 ) 1741 if ( v4 >= 1 )
1744 result = v4; 1742 result = v4;
1745 else 1743 else
1811 strcpy(player__getmeleedamagestring_static_buff, pGlobalTXT_LocalizationStrings[595]); //"Wand" 1809 strcpy(player__getmeleedamagestring_static_buff, pGlobalTXT_LocalizationStrings[595]); //"Wand"
1812 return player__getmeleedamagestring_static_buff; 1810 return player__getmeleedamagestring_static_buff;
1813 } 1811 }
1814 else if (pEquipment.uMainHand >= 0 && (itemid == ITEM_BLASTER || itemid == ITEM_LASER_RIFLE)) 1812 else if (pEquipment.uMainHand >= 0 && (itemid == ITEM_BLASTER || itemid == ITEM_LASER_RIFLE))
1815 { 1813 {
1816 min_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 1); 1814 min_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, true);
1817 max_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 1); 1815 max_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, true);
1818 } 1816 }
1819 else 1817 else
1820 { 1818 {
1821 min_damage = GetMeleeDamageMinimal(); 1819 min_damage = GetMeleeDamageMinimal();
1822 max_damage = GetMeleeDamageMaximal(); 1820 max_damage = GetMeleeDamageMaximal();
1851 strcpy(player__getrangeddamagestring_static_buff, pGlobalTXT_LocalizationStrings[595]); //"Wand" 1849 strcpy(player__getrangeddamagestring_static_buff, pGlobalTXT_LocalizationStrings[595]); //"Wand"
1852 return player__getrangeddamagestring_static_buff; 1850 return player__getrangeddamagestring_static_buff;
1853 } 1851 }
1854 else if (pEquipment.uMainHand >= 0 && (itemid == ITEM_BLASTER || itemid == ITEM_LASER_RIFLE)) 1852 else if (pEquipment.uMainHand >= 0 && (itemid == ITEM_BLASTER || itemid == ITEM_LASER_RIFLE))
1855 { 1853 {
1856 min_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 1); 1854 min_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, true);
1857 max_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 1); 1855 max_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, true);
1858 } 1856 }
1859 else 1857 else
1860 { 1858 {
1861 min_damage = GetRangedDamageMin(); 1859 min_damage = GetRangedDamageMin();
1862 max_damage = GetRangedDamageMax(); 1860 max_damage = GetRangedDamageMax();
2259 recieved_dmg = CalculateIncommingDamage(dmg_type, amount); 2257 recieved_dmg = CalculateIncommingDamage(dmg_type, amount);
2260 sHealth -= recieved_dmg; 2258 sHealth -= recieved_dmg;
2261 broke_armor = sHealth <= -10; 2259 broke_armor = sHealth <= -10;
2262 if ( sHealth < 1 ) // 2260 if ( sHealth < 1 ) //
2263 { 2261 {
2264 if ( (sHealth + uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1) 2262 if ( (sHealth + uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE) >= 1)
2265 || pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime > 0 ) 2263 || pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime > 0 )
2266 { 2264 {
2267 SetCondUnconsciousWithBlockCheck(false); 2265 SetCondUnconsciousWithBlockCheck(false);
2268 } 2266 }
2269 else 2267 else
2661 ItemGen *weapon = nullptr; 2659 ItemGen *weapon = nullptr;
2662 ItemDesc *weapon_desc = nullptr; 2660 ItemDesc *weapon_desc = nullptr;
2663 uint weapon_recovery = base_recovery_times_per_weapon_type[0]; 2661 uint weapon_recovery = base_recovery_times_per_weapon_type[0];
2664 if (bRangedAttack) 2662 if (bRangedAttack)
2665 { 2663 {
2666 if ( !HasItemEquipped(EQUIP_BOW) ) 2664 if ( HasItemEquipped(EQUIP_BOW) )
2667 goto LABEL_17; 2665 {
2668 weapon = &pInventoryItemList[pEquipment.uBow - 1]; 2666 weapon = &pInventoryItemList[pEquipment.uBow - 1];
2669 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; 2667 weapon_desc = &pItemsTable->pItems[weapon->uItemID];
2670 weapon_recovery = base_recovery_times_per_weapon_type[weapon_desc->uSkillType]; 2668 weapon_recovery = base_recovery_times_per_weapon_type[weapon_desc->uSkillType];
2671 goto LABEL_17; 2669 }
2672 } 2670 }
2673 else if ( IsUnarmed() == 1 ) 2671 else if ( IsUnarmed() == 1 && GetActualSkillLevel(PLAYER_SKILL_UNARMED) > 0)
2674 { 2672 {
2675 if (GetActualSkillLevel(PLAYER_SKILL_UNARMED))
2676 {
2677 weapon_recovery = base_recovery_times_per_weapon_type[1]; 2673 weapon_recovery = base_recovery_times_per_weapon_type[1];
2678 goto LABEL_17; 2674 }
2679 } 2675 else if ( HasItemEquipped(EQUIP_MAIN_HAND) )
2680 }
2681
2682 if ( HasItemEquipped(EQUIP_MAIN_HAND) )
2683 { 2676 {
2684 weapon = &pInventoryItemList[pEquipment.uMainHand - 1]; 2677 weapon = &pInventoryItemList[pEquipment.uMainHand - 1];
2685 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; 2678 weapon_desc = &pItemsTable->pItems[weapon->uItemID];
2686 if (weapon_desc->uEquipType == EQUIP_WAND) 2679 if (weapon_desc->uEquipType == EQUIP_WAND)
2687 { 2680 {
2703 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; 2696 weapon_desc = &pItemsTable->pItems[weapon->uItemID];
2704 weapon_recovery = base_recovery_times_per_weapon_type[pItemsTable->pItems[weapon->uItemID].uSkillType]; 2697 weapon_recovery = base_recovery_times_per_weapon_type[pItemsTable->pItems[weapon->uItemID].uSkillType];
2705 } 2698 }
2706 } 2699 }
2707 2700
2708 LABEL_17:
2709 uint armour_recovery = 0; 2701 uint armour_recovery = 0;
2710 if ( HasItemEquipped(EQUIP_ARMOUR) ) 2702 if ( HasItemEquipped(EQUIP_ARMOUR) )
2711 { 2703 {
2712 auto armour_skill_type = pItemsTable->pItems[pInventoryItemList[pEquipment.uArmor - 1].uItemID].uSkillType; 2704 auto armour_skill_type = pItemsTable->pItems[pInventoryItemList[pEquipment.uArmor - 1].uItemID].uSkillType;
2713 uint base_armour_recovery = base_recovery_times_per_weapon_type[armour_skill_type]; 2705 uint base_armour_recovery = base_recovery_times_per_weapon_type[armour_skill_type];
2714 2706 float multiplier;
2715 float armour_recovery_multipliers[4]; 2707
2716 if (armour_skill_type == PLAYER_SKILL_LEATHER) 2708 if (armour_skill_type == PLAYER_SKILL_LEATHER)
2717 { 2709 {
2718 armour_recovery_multipliers[0] = 1.0f; 2710 multiplier = GetArmorRecoveryMultiplierFromSkillLevel(armour_skill_type, 1.0f, 0, 0, 0);
2719 armour_recovery_multipliers[1] = 0;
2720 armour_recovery_multipliers[2] = 0;
2721 armour_recovery_multipliers[3] = 0;
2722 } 2711 }
2723 else if (armour_skill_type == PLAYER_SKILL_CHAIN) 2712 else if (armour_skill_type == PLAYER_SKILL_CHAIN)
2724 { 2713 {
2725 armour_recovery_multipliers[0] = 1.0f; 2714 multiplier = GetArmorRecoveryMultiplierFromSkillLevel(armour_skill_type, 1.0f, 0.5f, 0, 0);
2726 armour_recovery_multipliers[1] = 0.5f;
2727 armour_recovery_multipliers[2] = 0;
2728 armour_recovery_multipliers[3] = 0;
2729 } 2715 }
2730 else if (armour_skill_type == PLAYER_SKILL_PLATE) 2716 else if (armour_skill_type == PLAYER_SKILL_PLATE)
2731 { 2717 {
2732 armour_recovery_multipliers[0] = 1.0f; 2718 multiplier = GetArmorRecoveryMultiplierFromSkillLevel(armour_skill_type, 1.0f, 0.5f, 0.5f, 0);
2733 armour_recovery_multipliers[1] = 0.5f;
2734 armour_recovery_multipliers[2] = 0.5f;
2735 armour_recovery_multipliers[3] = 0;
2736 } 2719 }
2737 else 2720 else
2738 { 2721 {
2739 Error("Unknown armour type"); // what kind of armour is that? 2722 Error("Unknown armour type"); // what kind of armour is that?
2740 armour_recovery_multipliers[0] = 1.0f; 2723 multiplier = GetArmorRecoveryMultiplierFromSkillLevel(armour_skill_type, 1.0f, 1.0f, 1.0f, 1.0f);
2741 armour_recovery_multipliers[1] = 1.0f; 2724 }
2742 armour_recovery_multipliers[2] = 1.0f; 2725
2743 armour_recovery_multipliers[3] = 1.0f; 2726 armour_recovery = (uint)(base_armour_recovery * multiplier);
2744 }
2745
2746 uint skill_mastery = SkillToMastery(pActiveSkills[armour_skill_type]);
2747 armour_recovery = base_armour_recovery * armour_recovery_multipliers[skill_mastery - 1];
2748 } 2727 }
2749 2728
2750 uint shield_recovery = 0; 2729 uint shield_recovery = 0;
2751 if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) == EQUIP_SHIELD) 2730 if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) == EQUIP_SHIELD)
2752 { 2731 {
2753 float shield_recovery_multipliers[4] = {1, 0, 0, 0};
2754
2755 auto shield = &pInventoryItemList[pEquipment.uShield - 1]; 2732 auto shield = &pInventoryItemList[pEquipment.uShield - 1];
2756 auto skill_type = pItemsTable->pItems[shield->uItemID].uSkillType; 2733 auto skill_type = pItemsTable->pItems[shield->uItemID].uSkillType;
2757 2734
2758 uint shield_base_recovery = base_recovery_times_per_weapon_type[skill_type]; 2735 uint shield_base_recovery = base_recovery_times_per_weapon_type[skill_type];
2759 shield_recovery = shield_base_recovery * SkillToMastery(pActiveSkills[skill_type]); 2736 float multiplier = GetArmorRecoveryMultiplierFromSkillLevel(skill_type, 1.0f, 0, 0, 0);
2737 shield_recovery = (uint)(shield_base_recovery * multiplier);
2760 } 2738 }
2761 2739
2762 uint player_speed_recovery_reduction = GetParameterBonus(GetActualSpeed()), 2740 uint player_speed_recovery_reduction = GetParameterBonus(GetActualSpeed()),
2763 sword_axe_bow_recovery_reduction = 0; 2741 sword_axe_bow_recovery_reduction = 0;
2764 bool shooting_laser = false; 2742 bool shooting_laser = false;
2783 if (SkillToMastery(armsmaster_level) >= 4) 2761 if (SkillToMastery(armsmaster_level) >= 4)
2784 armsmaster_recovery_reduction *= 2; 2762 armsmaster_recovery_reduction *= 2;
2785 } 2763 }
2786 } 2764 }
2787 2765
2788 uint v41 = 0; 2766 uint hasteRecoveryReduction = 0;
2789 if (pPlayerBuffs[PLAYER_BUFF_7].uExpireTime > 0) 2767 if (pPlayerBuffs[PLAYER_BUFF_7].uExpireTime > 0 || pParty->pPartyBuffs[PARTY_BUFF_HASTE].uExpireTime > 0 )
2790 v41 = 25; 2768 hasteRecoveryReduction = 25;
2791 2769
2792 uint weapon_enchantment_recovery_reduction = 0; 2770 uint weapon_enchantment_recovery_reduction = 0;
2793 if ( weapon ) 2771 if ( weapon )
2794 { 2772 {
2795 if (weapon->uSpecEnchantmentType == 59 || 2773 if (weapon->uSpecEnchantmentType == 59 ||
2796 weapon->uSpecEnchantmentType == 41 || 2774 weapon->uSpecEnchantmentType == 41 ||
2797 weapon->uSpecEnchantmentType == 500) 2775 weapon->uSpecEnchantmentType == 500)
2798 weapon_enchantment_recovery_reduction = 20; 2776 weapon_enchantment_recovery_reduction = 20;
2799 } 2777 }
2800
2801 2778
2802 int recovery = weapon_recovery + 2779 int recovery = weapon_recovery +
2803 armour_recovery + 2780 armour_recovery +
2804 shield_recovery 2781 shield_recovery
2805 - armsmaster_recovery_reduction 2782 - armsmaster_recovery_reduction
2806 - weapon_enchantment_recovery_reduction 2783 - weapon_enchantment_recovery_reduction
2807 - v41 2784 - hasteRecoveryReduction
2808 - sword_axe_bow_recovery_reduction 2785 - sword_axe_bow_recovery_reduction
2809 - player_speed_recovery_reduction; 2786 - player_speed_recovery_reduction;
2810 2787
2811 if (recovery < 0) 2788 if (recovery < 0)
2812 recovery = 0; 2789 recovery = 0;
2813 return recovery; 2790 return recovery;
2791 }
2792
2793
2794 //----- new --------------------------------------------------------
2795 float Player::GetArmorRecoveryMultiplierFromSkillLevel( unsigned char armour_skill_type, float mult1, float mult2, float mult3, float mult4 )
2796 {
2797 uint skill_mastery = SkillToMastery(pActiveSkills[armour_skill_type]);
2798 switch (skill_mastery)
2799 {
2800 case 1: return mult1; break;
2801 case 2: return mult2; break;
2802 case 3: return mult3; break;
2803 case 4: return mult4; break;
2804 }
2805 Error("Unexpected input value: %d", armour_skill_type);
2806 return 0;
2814 } 2807 }
2815 2808
2816 //----- (0048E4F8) -------------------------------------------------------- 2809 //----- (0048E4F8) --------------------------------------------------------
2817 int Player::GetMaxHealth() 2810 int Player::GetMaxHealth()
2818 { 2811 {
2823 v3 = GetParameterBonus(GetActualEndurance()); 2816 v3 = GetParameterBonus(GetActualEndurance());
2824 v4 = pBaseHealthPerLevelByClass[classType] * (GetActualLevel() + v3); 2817 v4 = pBaseHealthPerLevelByClass[classType] * (GetActualLevel() + v3);
2825 v6 = uFullHealthBonus 2818 v6 = uFullHealthBonus
2826 + pBaseHealthByClass[classType / 4] 2819 + pBaseHealthByClass[classType / 4]
2827 + GetSkillBonus(CHARACTER_ATTRIBUTE_HEALTH) 2820 + GetSkillBonus(CHARACTER_ATTRIBUTE_HEALTH)
2828 + GetItemsBonus(CHARACTER_ATTRIBUTE_HEALTH, 0) + v4; 2821 + GetItemsBonus(CHARACTER_ATTRIBUTE_HEALTH) + v4;
2829 if (v6 <= 0) 2822 return max(1, v6);
2830 return 1;
2831 return v6;
2832 } 2823 }
2833 2824
2834 //----- (0048E565) -------------------------------------------------------- 2825 //----- (0048E565) --------------------------------------------------------
2835 int Player::GetMaxMana() 2826 int Player::GetMaxMana()
2836 { 2827 {
2840 int v5; // esi@5 2831 int v5; // esi@5
2841 int v6; // eax@5 2832 int v6; // eax@5
2842 int v7; // esi@6 2833 int v7; // esi@6
2843 int v8; // esi@6 2834 int v8; // esi@6
2844 int v9; // esi@6 2835 int v9; // esi@6
2845 int result; // eax@7
2846 2836
2847 switch (classType) 2837 switch (classType)
2848 { 2838 {
2849 case PLAYER_CLASS_ROGUE: 2839 case PLAYER_CLASS_ROGUE:
2850 case PLAYER_CLASS_SPY: 2840 case PLAYER_CLASS_SPY:
2889 default: 2879 default:
2890 return 0; 2880 return 0;
2891 break; 2881 break;
2892 } 2882 }
2893 v7 = pBaseManaPerLevelByClass[classType] * (GetActualLevel() + v3); 2883 v7 = pBaseManaPerLevelByClass[classType] * (GetActualLevel() + v3);
2894 v8 = GetItemsBonus(CHARACTER_ATTRIBUTE_MANA, 0) + v7; 2884 v8 = GetItemsBonus(CHARACTER_ATTRIBUTE_MANA) + v7;
2895 v9 = uFullManaBonus 2885 v9 = uFullManaBonus
2896 + pBaseManaByClass[classType / 4] 2886 + pBaseManaByClass[classType / 4]
2897 + GetSkillBonus(CHARACTER_ATTRIBUTE_MANA) 2887 + GetSkillBonus(CHARACTER_ATTRIBUTE_MANA)
2898 + v8; 2888 + v8;
2899 return max(0,v9); 2889 return max(0,v9);
2900 } 2890 }
2901 2891
2902 //----- (0048E656) -------------------------------------------------------- 2892 //----- (0048E656) --------------------------------------------------------
2903 int Player::GetBaseAC() 2893 int Player::GetBaseAC()
2904 { 2894 {
2905 Player *v1; // edi@1
2906 int v2; // eax@1 2895 int v2; // eax@1
2907 int v3; // esi@1 2896 int v3; // esi@1
2908 int v4; // esi@1 2897 int v4; // esi@1
2909 int v5; // esi@1 2898 int v5; // esi@1
2910 int result; // eax@2 2899
2911
2912 v1 = this;
2913 v2 = GetActualSpeed(); 2900 v2 = GetActualSpeed();
2914 v3 = GetParameterBonus(v2); 2901 v3 = GetParameterBonus(v2);
2915 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; 2902 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v3;
2916 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; 2903 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4;
2917 if ( v5 >= 1 ) 2904 return max(0, v5);
2918 result = v5;
2919 else
2920 result = 0;
2921 return result;
2922 } 2905 }
2923 2906
2924 //----- (0048E68F) -------------------------------------------------------- 2907 //----- (0048E68F) --------------------------------------------------------
2925 int Player::GetActualAC() 2908 int Player::GetActualAC()
2926 { 2909 {
2927 Player *v1; // edi@1
2928 int v2; // eax@1 2910 int v2; // eax@1
2929 int v3; // esi@1 2911 int v3; // esi@1
2930 int v4; // esi@1 2912 int v4; // esi@1
2931 int v5; // esi@1 2913 int v5; // esi@1
2932 int v6; // esi@1 2914 int v6; // esi@1
2933 int result; // eax@2 2915
2934
2935 v1 = this;
2936 v2 = GetActualSpeed(); 2916 v2 = GetActualSpeed();
2937 v3 = GetParameterBonus(v2); 2917 v3 = GetParameterBonus(v2);
2938 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; 2918 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v3;
2939 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; 2919 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4;
2940 v6 = v1->sACModifier + GetMagicalBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v5; 2920 v6 = this->sACModifier + GetMagicalBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v5;
2941 if ( v6 >= 1 ) 2921 return max(0, v6);
2942 result = v6;
2943 else
2944 result = 0;
2945 return result;
2946 } 2922 }
2947 2923
2948 //----- (0048E6DC) -------------------------------------------------------- 2924 //----- (0048E6DC) --------------------------------------------------------
2949 unsigned int Player::GetBaseAge() 2925 unsigned int Player::GetBaseAge()
2950 { 2926 {
2951 return ((__int64)(pParty->uTimePlayed * 0.234375) / 60 / 60 / 24) / 7 / 4 / 12 - uBirthYear + game_starting_year; 2927 return (unsigned int)(((__int64)(pParty->uTimePlayed * 0.234375) / 60 / 60 / 24) / 7 / 4 / 12 - uBirthYear + game_starting_year);
2952 } 2928 }
2953 2929
2954 //----- (0048E72C) -------------------------------------------------------- 2930 //----- (0048E72C) --------------------------------------------------------
2955 unsigned int Player::GetActualAge() 2931 unsigned int Player::GetActualAge()
2956 { 2932 {
2958 } 2934 }
2959 2935
2960 //----- (0048E73F) -------------------------------------------------------- 2936 //----- (0048E73F) --------------------------------------------------------
2961 int Player::GetBaseResistance(enum CHARACTER_ATTRIBUTE_TYPE a2) 2937 int Player::GetBaseResistance(enum CHARACTER_ATTRIBUTE_TYPE a2)
2962 { 2938 {
2963 Player *v2; // ebx@1
2964 signed int v3; // esi@1
2965 enum CHARACTER_RACE v4; // eax@1
2966 signed int v5; // edi@8
2967 char v6; // zf@9
2968 int v7; // esi@20 2939 int v7; // esi@20
2969 int result; // eax@21 2940 int racialBonus = 0;
2970 signed int v9; // [sp-4h] [bp-10h]@11 2941 __int16* resStat;
2971 2942
2972 v2 = this; 2943 switch (a2)
2973 v3 = 0; 2944 {
2974 v4 = GetRace(); 2945 case CHARACTER_ATTRIBUTE_RESIST_FIRE:
2975 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE ) 2946 resStat = &sResFireBase;
2976 { 2947 if (IsRaceGoblin())
2977 v5 = 0; 2948 racialBonus = 5;
2978 goto LABEL_16; 2949 break;
2979 } 2950 case CHARACTER_ATTRIBUTE_RESIST_AIR:
2980 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_AIR ) 2951 resStat = &sResAirBase;
2981 { 2952 if (IsRaceGoblin())
2982 v5 = 1; 2953 racialBonus = 5;
2983 LABEL_16: 2954 break;
2984 v6 = v4 == 2; 2955 case CHARACTER_ATTRIBUTE_RESIST_WATER:
2985 goto LABEL_17; 2956 resStat = &sResWaterBase;
2986 } 2957 if (IsRaceDwarf())
2987 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_WATER ) 2958 racialBonus = 5;
2988 { 2959 break;
2989 v6 = v4 == 3; 2960 case CHARACTER_ATTRIBUTE_RESIST_EARTH:
2990 v5 = 2; 2961 resStat = &sResEarthBase;
2991 goto LABEL_17; 2962 if (IsRaceDwarf())
2992 } 2963 racialBonus = 5;
2993 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH ) 2964 break;
2994 { 2965 case CHARACTER_ATTRIBUTE_RESIST_MIND:
2995 v5 = 3; 2966 resStat = &sResMindBase;
2996 v6 = v4 == 3; 2967 if (IsRaceElf())
2997 goto LABEL_17; 2968 racialBonus = 10;
2998 } 2969 break;
2999 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_MIND ) 2970 case CHARACTER_ATTRIBUTE_RESIST_BODY:
3000 { 2971 case CHARACTER_ATTRIBUTE_RESIST_SPIRIT:
3001 v5 = 7; 2972 resStat = &sResBodyBase;
3002 if ( v4 != 1 ) 2973 if (IsRaceHuman())
3003 goto LABEL_20; 2974 racialBonus = 5;
3004 v9 = 10; 2975 break;
3005 LABEL_19: 2976 }
3006 v3 = v9; 2977 v7 = GetItemsBonus(a2) + racialBonus;
3007 goto LABEL_20; 2978 return v7 + *resStat;
3008 }
3009 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_BODY || a2 == 33 )
3010 {
3011 v5 = 8;
3012 v6 = v4 == 0;
3013 LABEL_17:
3014 if ( !v6 )
3015 goto LABEL_20;
3016 v9 = 5;
3017 goto LABEL_19;
3018 }
3019 v5 = 0;
3020 LABEL_20:
3021 v7 = GetItemsBonus(a2, 0) + v3;
3022 if ( v2->classType != PLAYER_CLASS_LICH || (result = 200, v7 + *(&v2->sResFireBase + v5) <= 200) )
3023 result = v7 + *(&v2->sResFireBase + v5);
3024 return result;
3025 } 2979 }
3026 2980
3027 //----- (0048E7D0) -------------------------------------------------------- 2981 //----- (0048E7D0) --------------------------------------------------------
3028 int Player::GetActualResistance(enum CHARACTER_ATTRIBUTE_TYPE a2) 2982 int Player::GetActualResistance(enum CHARACTER_ATTRIBUTE_TYPE a2)
3029 { 2983 {
3030 signed int v2; // edi@1 2984 signed int v10 = 0; // [sp+14h] [bp-4h]@1
3031 Player *v3; // esi@1 2985 __int16* resStat;
3032 enum CHARACTER_RACE v4; // ebx@1 2986 int result;
3033 char v6; // zf@18 2987 int baseRes;
3034 int v7; // ebx@28 2988
3035 int result; // eax@28 2989 int leatherArmorSkillLevel = GetActualSkillLevel(PLAYER_SKILL_LEATHER);
3036 signed int v9; // [sp+10h] [bp-8h]@1
3037 signed int v10; // [sp+14h] [bp-4h]@1
3038
3039 v2 = 0;
3040 v3 = this;
3041 v10 = 0;
3042 v9 = 0;
3043 v4 = GetRace();
3044 if ( CheckHiredNPCSpeciality(Enchanter) ) 2990 if ( CheckHiredNPCSpeciality(Enchanter) )
3045 v10 = 20; 2991 v10 = 20;
3046 if ( (a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE 2992 if ( (a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE
3047 || a2 == CHARACTER_ATTRIBUTE_RESIST_AIR 2993 || a2 == CHARACTER_ATTRIBUTE_RESIST_AIR
3048 || a2 == CHARACTER_ATTRIBUTE_RESIST_WATER 2994 || a2 == CHARACTER_ATTRIBUTE_RESIST_WATER
3049 || a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH) 2995 || a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH)
3050 && SkillToMastery(v3->pActiveSkills[9]) == 4 2996 && SkillToMastery(leatherArmorSkillLevel) == 4
3051 && HasItemEquipped(EQUIP_ARMOUR) 2997 && HasItemEquipped(EQUIP_ARMOUR)
3052 && GetEquippedItemSkillType(EQUIP_ARMOUR) == PLAYER_SKILL_LEATHER ) 2998 && GetEquippedItemSkillType(EQUIP_ARMOUR) == PLAYER_SKILL_LEATHER )
3053 v10 += v3->pActiveSkills[9] & 0x3F; 2999 v10 += leatherArmorSkillLevel & 0x3F;
3054 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE ) 3000 switch (a2)
3055 goto LABEL_25; 3001 {
3056 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_AIR ) 3002 case CHARACTER_ATTRIBUTE_RESIST_FIRE:
3057 { 3003 resStat = &sResFireBonus;
3058 v2 = 1; 3004 break;
3059 LABEL_25: 3005 case CHARACTER_ATTRIBUTE_RESIST_AIR:
3060 v6 = v4 == 2; 3006 resStat = &sResAirBonus;
3061 LABEL_26: 3007 break;
3062 if ( v6 ) 3008 case CHARACTER_ATTRIBUTE_RESIST_WATER:
3063 v9 = 5; 3009 resStat = &sResWaterBonus;
3064 goto LABEL_28; 3010 break;
3065 } 3011 case CHARACTER_ATTRIBUTE_RESIST_EARTH:
3066 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_WATER ) 3012 resStat = &sResEarthBonus;
3067 { 3013 break;
3068 v6 = v4 == 3; 3014 case CHARACTER_ATTRIBUTE_RESIST_MIND:
3069 v2 = 2; 3015 resStat = &sResMindBonus;
3070 goto LABEL_26; 3016 break;
3071 } 3017 case CHARACTER_ATTRIBUTE_RESIST_BODY:
3072 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH ) 3018 case CHARACTER_ATTRIBUTE_RESIST_SPIRIT:
3073 { 3019 resStat = &sResBodyBonus;
3074 v2 = 3; 3020 break;
3075 if ( v4 == 3 ) 3021 }
3076 v10 += 5; 3022 baseRes = GetBaseResistance(a2);
3077 } 3023 result = v10 + GetMagicalBonus(a2) + baseRes + *(resStat);
3078 else
3079 {
3080 if ( a2 != CHARACTER_ATTRIBUTE_RESIST_MIND )
3081 {
3082 if ( a2 != CHARACTER_ATTRIBUTE_RESIST_BODY && a2 != 33 )
3083 goto LABEL_28;
3084 v2 = 8;
3085 v6 = v4 == 0;
3086 goto LABEL_26;
3087 }
3088 v2 = 7;
3089 if ( v4 == 1 )
3090 v9 = 10;
3091 }
3092 LABEL_28:
3093 v7 = GetItemsBonus(a2, 0);
3094 result = v10 + GetMagicalBonus(a2) + v7 + v9 + *(&v3->sResFireBonus + v2) + *(&v3->sResFireBase + v2);
3095 if ( v3->classType == PLAYER_CLASS_LICH )
3096 {
3097 if ( result > 200 )
3098 result = 200;
3099 }
3100 return result; 3024 return result;
3101 } 3025 }
3102 3026
3103 //----- (0048E8F5) -------------------------------------------------------- 3027 //----- (0048E8F5) --------------------------------------------------------
3104 bool Player::Recover(int dt) 3028 bool Player::Recover(int dt)
3105 { 3029 {
3106 //Player *v2; // esi@1 3030 int v3; // qax@1
3107 signed __int64 v3; // qax@1 3031
3108 //bool result; // eax@4 3032 v3 = (int)(dt * GetSpecialItemBonus(17) * 0.01 + dt);
3109
3110 //v2 = this;
3111 v3 = (signed __int64)((double)(dt * _48EA46_calc_special_bonus_by_items(17)) * 0.01 + (double)dt);
3112 3033
3113 Log::Warning(L"Recover(dt = %u/%u - %u", dt, (uint)v3, (uint)uTimeToRecovery); 3034 Log::Warning(L"Recover(dt = %u/%u - %u", dt, (uint)v3, (uint)uTimeToRecovery);
3114 3035
3115 if (uTimeToRecovery > v3) 3036 if (uTimeToRecovery > v3)
3116 { 3037 {
3159 return 18; 3080 return 18;
3160 } 3081 }
3161 3082
3162 //----- (0048EA1B) -------------------------------------------------------- 3083 //----- (0048EA1B) --------------------------------------------------------
3163 int Player::GetParameterBonus( int player_parameter ) 3084 int Player::GetParameterBonus( int player_parameter )
3164 { 3085 {
3165 int i; // eax@1 3086 int i; // eax@1
3166 i = 0; 3087 i = 0;
3167 while (param_to_bonus_table[i]) 3088 while (param_to_bonus_table[i])
3168 { 3089 {
3169 if (player_parameter >= param_to_bonus_table[i]) 3090 if (player_parameter >= param_to_bonus_table[i])
3170 break; 3091 break;
3171 ++i; 3092 ++i;
3172 } 3093 }
3173 return parameter_to_bonus_value[i]; 3094 return parameter_to_bonus_value[i];
3174 } 3095 }
3175 3096
3176 //----- (0048EA46) -------------------------------------------------------- 3097 //----- (0048EA46) --------------------------------------------------------
3177 int Player::_48EA46_calc_special_bonus_by_items(int a2) 3098 int Player::GetSpecialItemBonus( int enchantmentId )
3178 { 3099 {
3179 int inv_indx; // eax@3 3100 int inv_indx; // eax@3
3180 3101
3181 for (int i=EQUIP_OFF_HAND; i<EQUIP_BOOK; ++i ) 3102 for (int i = EQUIP_OFF_HAND; i < EQUIP_BOOK; ++i )
3182 { 3103 {
3183 if ( !HasItemEquipped((ITEM_EQUIP_TYPE)i) ) 3104 if ( HasItemEquipped((ITEM_EQUIP_TYPE)i) )
3184 continue; 3105 {
3185 inv_indx = pEquipment.pIndices[i] - 1; 3106 inv_indx = pEquipment.pIndices[i] - 1;
3186 if (a2==17) 3107 if (enchantmentId == 17)
3187 { 3108 {
3188 if ((pInventoryItemList[inv_indx].uSpecEnchantmentType==17)||(pInventoryItemList[inv_indx].uItemID==533)) //Elven Chainmail+Increases rate of Recovery 3109 if ((pInventoryItemList[inv_indx].uSpecEnchantmentType == 17) || (pInventoryItemList[inv_indx].uItemID == 533)) //Elven Chainmail+Increases rate of Recovery
3189 return 50; 3110 return 50;
3190 } 3111 }
3191 if (a2==24) 3112 if (enchantmentId == 24)
3192 { 3113 {
3193 if (pInventoryItemList[inv_indx].uSpecEnchantmentType==24) //Increased Knockback. 3114 if (pInventoryItemList[inv_indx].uSpecEnchantmentType == 24) //Increased Knockback.
3194 return 5; 3115 return 5;
3195 } 3116 }
3196 } 3117 }
3118 }
3197 return 0; 3119 return 0;
3198 } 3120 }
3199 3121
3200 //----- (0048EAAE) -------------------------------------------------------- 3122 //----- (0048EAAE) --------------------------------------------------------
3201 int Player::GetItemsBonus(CHARACTER_ATTRIBUTE_TYPE attr, int a3) 3123 int Player::GetItemsBonus( enum CHARACTER_ATTRIBUTE_TYPE attr, bool getOnlyMainHandDmg /*= false*/ )
3202 { 3124 {
3203 CHARACTER_ATTRIBUTE_TYPE v3; // esi@1
3204 // signed int v4; // eax@1
3205 int v5; // edi@1 3125 int v5; // edi@1
3206 Player *v6; // ebx@1
3207 Player *v8; // ecx@48
3208 int v9; // eax@49 3126 int v9; // eax@49
3209 int v10; // edx@49
3210 Player *v11; // ecx@55
3211 int v12; // eax@56
3212 int v13; // edx@56
3213 int v14; // ecx@58 3127 int v14; // ecx@58
3214 int v15; // eax@58 3128 int v15; // eax@58
3215 Player *v16; // ecx@61
3216 int v17; // eax@62 3129 int v17; // eax@62
3217 Player *v18; // ecx@66
3218 int v19; // eax@67
3219 int v20; // eax@69 3130 int v20; // eax@69
3220 Player *v21; // ecx@75
3221 int v22; // eax@76 3131 int v22; // eax@76
3222 int v23; // edx@76 3132 int v23; // edx@76
3223 //int v24; // eax@79
3224 int v25; // ecx@80 3133 int v25; // ecx@80
3225 int v26; // edi@80 3134 int v26; // edi@80
3226 Player *v27; // ecx@84
3227 int v28; // eax@85
3228 int v29; // edx@85
3229 Player *v30; // ecx@96
3230 int v31; // ebp@97 3135 int v31; // ebp@97
3231 int v32; // eax@98 3136 int v32; // eax@98
3232 unsigned int v33; // eax@100 3137 unsigned int v33; // eax@100
3233 int v34; // eax@103
3234 char v35; // zf@104
3235 char v36; // zf@107
3236 unsigned __int8 v37; // zf@119
3237 char v38; // sf@119
3238 unsigned __int8 v39; // of@119
3239 char v40; // zf@122
3240 char v41; // zf@145
3241 char v42; // zf@164
3242 char v43; // zf@173
3243 char v44; // zf@189
3244 char v45; // zf@198
3245 char v46; // zf@239
3246 int v47; // eax@268
3247 int v48; // eax@269
3248 int v49; // eax@291
3249 char v50; // zf@295
3250 int v51; // eax@306
3251 int v52; // eax@307
3252 char v53; // zf@312
3253 char v54; // zf@336
3254 char v55; // zf@348
3255 int v56; // eax@365 3138 int v56; // eax@365
3256 int v57; // ebx@368 3139 int v57; // ebx@368
3257 signed int v58; // [sp-4h] [bp-20h]@10 3140 signed int v58; // [sp-4h] [bp-20h]@10
3258 signed int v59; // [sp-4h] [bp-20h]@71
3259 signed int v60; // [sp-4h] [bp-20h]@347
3260 int v61; // [sp+10h] [bp-Ch]@1 3141 int v61; // [sp+10h] [bp-Ch]@1
3261 int v62; // [sp+14h] [bp-8h]@1 3142 int v62; // [sp+14h] [bp-8h]@1
3262 int v63; // [sp+18h] [bp-4h]@101 3143 ItemGen *currEquippedItem; // [sp+20h] [bp+4h]@101
3263 ItemGen *attra; // [sp+20h] [bp+4h]@101
3264 unsigned int v65; // [sp+24h] [bp+8h]@95
3265 bool no_skills; 3144 bool no_skills;
3266 3145
3267 v3 = attr;
3268 v5 = 0; 3146 v5 = 0;
3269 v6 = this;
3270 v62 = 0; 3147 v62 = 0;
3271 v61 = 0; 3148 v61 = 0;
3272
3273 3149
3274 no_skills=false; 3150 no_skills=false;
3275 switch (attr) 3151 switch (attr)
3276 { 3152 {
3277 case CHARACTER_ATTRIBUTE_SKILL_ALCHEMY: v58 = PLAYER_SKILL_ALCHEMY; break; 3153 case CHARACTER_ATTRIBUTE_SKILL_ALCHEMY: v58 = PLAYER_SKILL_ALCHEMY; break;
3278 case CHARACTER_ATTRIBUTE_SKILL_STEALING: v58 = PLAYER_SKILL_STEALING; break; 3154 case CHARACTER_ATTRIBUTE_SKILL_STEALING: v58 = PLAYER_SKILL_STEALING; break;
3279 case CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM: v58 = PLAYER_SKILL_TRAP_DISARM; break; 3155 case CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM: v58 = PLAYER_SKILL_TRAP_DISARM; break;
3280 case CHARACTER_ATTRIBUTE_SKILL_ITEM_ID: v58 = PLAYER_SKILL_ITEM_ID; break; 3156 case CHARACTER_ATTRIBUTE_SKILL_ITEM_ID: v58 = PLAYER_SKILL_ITEM_ID; break;
3281 case CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID: v58 = PLAYER_SKILL_MONSTER_ID; break; 3157 case CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID: v58 = PLAYER_SKILL_MONSTER_ID; break;
3282 case CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER: v58 = PLAYER_SKILL_ARMSMASTER; break; 3158 case CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER: v58 = PLAYER_SKILL_ARMSMASTER; break;
3283 case CHARACTER_ATTRIBUTE_SKILL_DODGE: v58 = PLAYER_SKILL_DODGE; break; 3159 case CHARACTER_ATTRIBUTE_SKILL_DODGE: v58 = PLAYER_SKILL_DODGE; break;
3284 case CHARACTER_ATTRIBUTE_SKILL_UNARMED: v58 = PLAYER_SKILL_UNARMED; break; 3160 case CHARACTER_ATTRIBUTE_SKILL_UNARMED: v58 = PLAYER_SKILL_UNARMED; break;
3285 case CHARACTER_ATTRIBUTE_SKILL_FIRE: v58 = PLAYER_SKILL_FIRE; break; 3161 case CHARACTER_ATTRIBUTE_SKILL_FIRE: v58 = PLAYER_SKILL_FIRE; break;
3286 case CHARACTER_ATTRIBUTE_SKILL_AIR: v58 = PLAYER_SKILL_AIR; break; 3162 case CHARACTER_ATTRIBUTE_SKILL_AIR: v58 = PLAYER_SKILL_AIR; break;
3287 case CHARACTER_ATTRIBUTE_SKILL_WATER: v58 = PLAYER_SKILL_WATER; break; 3163 case CHARACTER_ATTRIBUTE_SKILL_WATER: v58 = PLAYER_SKILL_WATER; break;
3288 case CHARACTER_ATTRIBUTE_SKILL_EARTH: v58 = PLAYER_SKILL_EARTH; break; 3164 case CHARACTER_ATTRIBUTE_SKILL_EARTH: v58 = PLAYER_SKILL_EARTH; break;
3289 case CHARACTER_ATTRIBUTE_SKILL_SPIRIT: v58 = PLAYER_SKILL_SPIRIT; break; 3165 case CHARACTER_ATTRIBUTE_SKILL_SPIRIT: v58 = PLAYER_SKILL_SPIRIT; break;
3290 case CHARACTER_ATTRIBUTE_SKILL_MIND: v58 = PLAYER_SKILL_MIND; break; 3166 case CHARACTER_ATTRIBUTE_SKILL_MIND: v58 = PLAYER_SKILL_MIND; break;
3291 case CHARACTER_ATTRIBUTE_SKILL_BODY: v58 = PLAYER_SKILL_BODY; break; 3167 case CHARACTER_ATTRIBUTE_SKILL_BODY: v58 = PLAYER_SKILL_BODY; break;
3292 case CHARACTER_ATTRIBUTE_SKILL_LIGHT: v58 = PLAYER_SKILL_LIGHT; break; 3168 case CHARACTER_ATTRIBUTE_SKILL_LIGHT: v58 = PLAYER_SKILL_LIGHT; break;
3293 case CHARACTER_ATTRIBUTE_SKILL_DARK: v58 = PLAYER_SKILL_DARK; break; 3169 case CHARACTER_ATTRIBUTE_SKILL_DARK: v58 = PLAYER_SKILL_DARK; break;
3294 case CHARACTER_ATTRIBUTE_SKILL_MEDITATION: v58 = PLAYER_SKILL_MEDITATION; break; 3170 case CHARACTER_ATTRIBUTE_SKILL_MEDITATION: v58 = PLAYER_SKILL_MEDITATION; break;
3295 case CHARACTER_ATTRIBUTE_SKILL_BOW: v58 = PLAYER_SKILL_BOW; break; 3171 case CHARACTER_ATTRIBUTE_SKILL_BOW: v58 = PLAYER_SKILL_BOW; break;
3296 case CHARACTER_ATTRIBUTE_SKILL_SHIELD: v58 = PLAYER_SKILL_SHIELD; break; 3172 case CHARACTER_ATTRIBUTE_SKILL_SHIELD: v58 = PLAYER_SKILL_SHIELD; break;
3297 case CHARACTER_ATTRIBUTE_SKILL_LEARNING: v58 = PLAYER_SKILL_LEARNING; break; 3173 case CHARACTER_ATTRIBUTE_SKILL_LEARNING: v58 = PLAYER_SKILL_LEARNING; break;
3298 default: 3174 default:
3299 no_skills=true; 3175 no_skills=true;
3300 } 3176 }
3301 if (!no_skills) 3177 if (!no_skills)
3302 { 3178 {
3303 if ( !this->pActiveSkills[v58] ) 3179 if ( !this->pActiveSkills[v58] )
3180 return 0;
3181 }
3182
3183 switch(attr) //TODO would be nice to move these into separate functions
3184 {
3185 case CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS:
3186 case CHARACTER_ATTRIBUTE_RANGED_ATTACK:
3187 if ( HasItemEquipped(EQUIP_BOW) )
3188 v5 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uBow-1].uItemID].uDamageMod;
3189 return v5;
3190 break;
3191
3192 case CHARACTER_ATTRIBUTE_RANGED_DMG_MIN:
3193 if ( !HasItemEquipped(EQUIP_BOW) )
3304 return 0; 3194 return 0;
3305 } 3195 v57 = this->pOwnItems[this->pEquipment.uBow-1].uItemID;
3306
3307 if ( (signed int)attr > 28 )
3308 {
3309 if ( (signed int)attr < 29 )
3310 return v5 + v62 + v61;
3311 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS )
3312 {
3313 if ( HasItemEquipped(EQUIP_BOW) )
3314 v5 = pItemsTable->pItems[v6->pOwnItems[v6->pEquipment.uBow-1].uItemID].uDamageMod;
3315 return v5 + v62 + v61;
3316 }
3317 if ( attr == CHARACTER_ATTRIBUTE_RANGED_DMG_MIN )
3318 {
3319 if ( !HasItemEquipped(EQUIP_BOW) )
3320 return v5 + v62 + v61;
3321 v57 = v6->pOwnItems[v6->pEquipment.uBow-1].uItemID;
3322 v5 = pItemsTable->pItems[v57].uDamageMod; 3196 v5 = pItemsTable->pItems[v57].uDamageMod;
3323 v56 = pItemsTable->pItems[v57].uDamageDice; 3197 v56 = pItemsTable->pItems[v57].uDamageDice;
3324 v5 += v56; 3198 return v5 + v56;
3325 return v5 + v62 + v61; 3199 break;
3326 } 3200
3327 if ( attr == CHARACTER_ATTRIBUTE_RANGED_DMG_MAX ) 3201 case CHARACTER_ATTRIBUTE_RANGED_DMG_MAX:
3328 {
3329 if ( !HasItemEquipped(EQUIP_BOW) ) 3202 if ( !HasItemEquipped(EQUIP_BOW) )
3330 return v5 + v62 + v61; 3203 return 0;
3331 v20 = v6->pOwnItems[v6->pEquipment.uBow-1].uItemID; 3204 v20 = this->pOwnItems[this->pEquipment.uBow-1].uItemID;
3332 v5 = pItemsTable->pItems[v20].uDamageDice * pItemsTable->pItems[v20].uDamageRoll; 3205 v5 = pItemsTable->pItems[v20].uDamageDice * pItemsTable->pItems[v20].uDamageRoll;
3333 LABEL_365:
3334 v56 = pItemsTable->pItems[v20].uDamageMod; 3206 v56 = pItemsTable->pItems[v20].uDamageMod;
3335 LABEL_366: 3207 return v5 + v56;
3336 v5 += v56; 3208
3337 return v5 + v62 + v61; 3209 case CHARACTER_ATTRIBUTE_LEVEL:
3338 } 3210 if ( !Player::HasEnchantedItemEquipped(25) )
3339 if ( (signed int)attr <= 33 || (signed int)attr > 46 ) 3211 return 0;
3340 return v5 + v62 + v61; 3212 return 5;
3341 LABEL_95: 3213 break;
3342 v65 = 0; 3214
3343 while ( 1 ) 3215 case CHARACTER_ATTRIBUTE_MELEE_DMG_MAX:
3344 { 3216 if ( IsUnarmed() )
3345 if ( !HasItemEquipped((ITEM_EQUIP_TYPE)v65) ) 3217 {
3346 goto LABEL_361; 3218 return 3;
3347 v31 = *(&v6->pEquipment.uShield + v65) - 1; 3219 }
3348 if ( v3 == 9 ) 3220 else
3349 { 3221 {
3350 v32 = GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v65); 3222 if ( this->HasItemEquipped(EQUIP_MAIN_HAND) )
3351 if ( v32 >= 3 )
3352 { 3223 {
3353 if ( v32 <= 11 ) 3224 v22 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND);
3225 if ( v22 >= 0 && v22 <= 2)
3354 { 3226 {
3355 v33 = v6->pInventoryItemList[v31].uItemID; 3227 v23 = this->pOwnItems[this->pEquipment.uMainHand].uItemID;
3356 v5 += pItemsTable->pItems[v33].uDamageDice + pItemsTable->pItems[v33].uDamageMod; 3228 v26 = pItemsTable->pItems[v23].uDamageRoll;
3229 if ( this->pEquipment.uShield || pItemsTable->pItems[v23].uSkillType != 4 )
3230 {
3231 v25 = pItemsTable->pItems[v23].uDamageDice;
3232 }
3233 else
3234 {
3235 v25 = pItemsTable->pItems[v23].uDamageDice + 1;
3236 }
3237 v5 = pItemsTable->pItems[v23].uDamageMod + v25 * v26;
3357 } 3238 }
3358 } 3239 }
3359 } 3240 if ( getOnlyMainHandDmg || !this->HasItemEquipped(EQUIP_OFF_HAND) || (GetEquippedItemEquipType(EQUIP_OFF_HAND) < 0 && GetEquippedItemEquipType(EQUIP_OFF_HAND) > 2))
3360 v63 = (int)((char *)v6 + 36 * v31);
3361 attra = (ItemGen *)(v63 + 532);
3362 if ( pItemsTable->IsMaterialNonCommon((ItemGen *)(v63 + 532)) == 1
3363 && !pItemsTable->IsMaterialSpecial(attra) )
3364 {
3365 v34 = attra->uItemID;
3366 switch ( attra->uItemID )
3367 { 3241 {
3368 case 0x1F4u: 3242 return v5;
3369 v35 = v3 == 5;
3370 goto LABEL_105;
3371 case 0x1F5u:
3372 v36 = v3 == 0;
3373 goto LABEL_108;
3374 case 0x1F6u:
3375 if ( v3 == 21 )
3376 v61 += 10;
3377 v36 = v3 == 2;
3378 goto LABEL_108;
3379 case 0x1F7u:
3380 if ( v3 == 17 )
3381 v61 += 5;
3382 if ( v3 == 18 )
3383 v61 += 5;
3384 v36 = v3 == 6;
3385 goto LABEL_108;
3386 case 0x1F8u:
3387 goto LABEL_118;
3388 case 0x1F9u:
3389 v40 = v3 == 3;
3390 goto LABEL_123;
3391 case 0x1FAu:
3392 v35 = v3 == 10;
3393 goto LABEL_105;
3394 case 0x1FEu:
3395 v35 = v3 == 4;
3396 goto LABEL_105;
3397 case 0x1FFu:
3398 if ( v3 == 23 )
3399 v61 += 10;
3400 if ( v3 == 22 )
3401 v61 += 10;
3402 goto LABEL_361;
3403 case 0x200u:
3404 if ( v3 == 36 )
3405 {
3406 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[14]);
3407 v62 = ((unsigned int)v34 >> 1) & 0x1F;
3408 }
3409 v36 = v3 == 5;
3410 LABEL_108:
3411 if ( v36 )
3412 v5 += 40;
3413 goto LABEL_361;
3414 case 0x201u:
3415 if ( v3 == 39 )
3416 {
3417 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]);
3418 v34 = ((unsigned int)v34 >> 1) & 0x1F;
3419 v62 = v34;
3420 }
3421 goto LABEL_136;
3422 case 0x202u:
3423 if ( !v3 )
3424 v5 += 150;
3425 if ( v3 == 1 )
3426 v5 -= 40;
3427 if ( v3 == 2 )
3428 v5 -= 40;
3429 goto LABEL_145;
3430 case 0x203u:
3431 if ( v3 == 42 )
3432 {
3433 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[20]);
3434 v62 = ((unsigned int)v34 >> 1) & 0x1F;
3435 }
3436 if ( v3 == 43 )
3437 v61 += 15;
3438 goto LABEL_361;
3439 case 0x204u:
3440 if ( v3 == 17 )
3441 v61 += 5;
3442 if ( v3 == 18 )
3443 v61 += 5;
3444 if ( v3 == 6 )
3445 v5 += 50;
3446 if ( v3 == 11 || v3 == 10 || v3 == 12 || v3 == 13 || v3 == 33 || v3 == 14 )
3447 goto LABEL_166;
3448 v42 = v3 == 15;
3449 goto LABEL_165;
3450 case 0x205u:
3451 if ( v3 == 18 )
3452 v61 += 5;
3453 goto LABEL_361;
3454 case 0x206u:
3455 if ( !v3 )
3456 v5 += 100;
3457 if ( v3 == 3 )
3458 v5 += 100;
3459 v43 = v3 == 9;
3460 goto LABEL_174;
3461 case 0x207u:
3462 if ( v3 == 45 )
3463 v61 += 5;
3464 if ( v3 == 15 )
3465 v5 -= 10;
3466 v42 = v3 == 14;
3467 LABEL_165:
3468 if ( v42 )
3469 LABEL_166:
3470 v5 -= 10;
3471 goto LABEL_361;
3472 case 0x208u:
3473 v35 = v3 == 3;
3474 goto LABEL_105;
3475 case 0x209u:
3476 if ( v3 == 2 )
3477 v5 += 15;
3478 if ( !v3 )
3479 v5 += 15;
3480 v41 = v3 == 6;
3481 goto LABEL_146;
3482 case 0x20Au:
3483 if ( v3 == 46 )
3484 v61 += 15;
3485 v44 = v3 == 3;
3486 goto LABEL_190;
3487 case 0x20Bu:
3488 if ( v3 == 34 )
3489 {
3490 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[12]);
3491 v62 = ((unsigned int)v34 >> 1) & 0x1F;
3492 }
3493 if ( v3 == 12 )
3494 v5 += 50;
3495 if ( v3 == 2 )
3496 v5 += 30;
3497 v45 = v3 == 9;
3498 goto LABEL_199;
3499 case 0x20Cu:
3500 if ( !v3 )
3501 v5 += 75;
3502 goto LABEL_145;
3503 case 0x20Du:
3504 if ( v3 == 5 )
3505 v5 += 50;
3506 if ( v3 == 6 )
3507 v5 += 50;
3508 if ( v3 == 11 || v3 == 10 || v3 == 12 || v3 == 13 || v3 == 33 || v3 == 14 )
3509 goto LABEL_374;
3510 v43 = v3 == 15;
3511 LABEL_174:
3512 if ( v43 )
3513 LABEL_374:
3514 v5 -= 15;
3515 goto LABEL_361;
3516 case 0x20Eu:
3517 if ( v3 == 4 )
3518 v5 += 150;
3519 if ( v3 == 44 )
3520 v61 += 5;
3521 if ( v3 == 9 )
3522 v5 -= 25;
3523 goto LABEL_361;
3524 case 0x20Fu:
3525 if ( v3 == 39 )
3526 {
3527 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]);
3528 v34 = ((unsigned int)v34 >> 1) & 0x1F;
3529 v62 = v34;
3530 }
3531 if ( v3 == 40 )
3532 {
3533 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[18]);
3534 v62 = ((unsigned int)v34 >> 1) & 0x1F;
3535 }
3536 LABEL_145:
3537 v41 = v3 == 5;
3538 LABEL_146:
3539 if ( v41 )
3540 v5 -= 40;
3541 goto LABEL_361;
3542 case 0x210u:
3543 if ( v3 == 38 )
3544 {
3545 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[16]);
3546 v62 = ((unsigned int)v34 >> 1) & 0x1F;
3547 }
3548 if ( !v3 )
3549 v5 += 75;
3550 v44 = v3 == 11;
3551 LABEL_190:
3552 if ( v44 )
3553 v5 -= 50;
3554 goto LABEL_361;
3555 case 0x211u:
3556 if ( v3 == 5 )
3557 v5 += 100;
3558 if ( v3 == 4 )
3559 v5 += 50;
3560 v35 = v3 == 11;
3561 LABEL_105:
3562 if ( v35 )
3563 v5 += 50;
3564 goto LABEL_361;
3565 case 0x212u:
3566 if ( v3 == 1 )
3567 v5 -= 20;
3568 v45 = v3 == 2;
3569 LABEL_199:
3570 if ( v45 )
3571 v5 -= 20;
3572 goto LABEL_361;
3573 case 0x214u:
3574 if ( v3 == 1 )
3575 v5 += 15;
3576 v46 = v3 == 2;
3577 goto LABEL_240;
3578 case 0x215u:
3579 if ( v3 == 5 )
3580 v5 += 15;
3581 v46 = v3 == 4;
3582 goto LABEL_240;
3583 case 0x216u:
3584 if ( v3 == 10 )
3585 v5 += 30;
3586 if ( !v3 )
3587 v5 += 15;
3588 goto LABEL_315;
3589 case 0x217u:
3590 if ( v3 == 21 )
3591 v61 += 5;
3592 if ( !v3 )
3593 v5 += 15;
3594 goto LABEL_253;
3595 case 0x218u:
3596 goto LABEL_253;
3597 default:
3598 goto LABEL_361;
3599 }
3600 goto LABEL_361;
3601 }
3602 if ( *(int *)(v63 + 536) == v3 + 1 )
3603 {
3604 if ( (signed int)v3 >= 0 )
3605 {
3606 if ( (signed int)v3 <= 15 )
3607 {
3608 v5 += *((int *)v6->pConditions + 9 * v31 + 135);
3609 }
3610 else
3611 {
3612 if ( (signed int)v3 <= 23 && v5 < *((int *)v6->pConditions + 9 * v31 + 135) )
3613 v5 = *((int *)v6->pConditions + 9 * v31 + 135);
3614 }
3615 }
3616 goto LABEL_361;
3617 }
3618 v34 = *(int *)(v63 + 544);
3619 if ( v34 > 48 )
3620 {
3621 switch ( v34 )
3622 {
3623 case 54:
3624 goto LABEL_315;
3625 case 49:
3626 if ( v3 == 6 )
3627 goto LABEL_121;
3628 v50 = v3 == 1;
3629 goto LABEL_296;
3630 case 51:
3631 if ( v3 != 5 && v3 != 1 )
3632 goto LABEL_309;
3633 goto LABEL_121;
3634 case 52:
3635 if ( v3 == 3 )
3636 goto LABEL_121;
3637 v50 = v3 == 4;
3638 goto LABEL_296;
3639 case 53:
3640 if ( !v3 )
3641 goto LABEL_121;
3642 v50 = v3 == 2;
3643 goto LABEL_296;
3644 case 55:
3645 v46 = v3 == 6;
3646 goto LABEL_240;
3647 case 56:
3648 if ( !v3 )
3649 goto LABEL_351;
3650 v53 = v3 == 3;
3651 goto LABEL_350;
3652 case 57:
3653 if ( v3 == 1 )
3654 goto LABEL_351;
3655 v53 = v3 == 2;
3656 goto LABEL_350;
3657 case 50:
3658 if ( v3 == 10 )
3659 v5 += 30;
3660 goto LABEL_361;
3661 case 60:
3662 if ( v3 != 23 )
3663 goto LABEL_336;
3664 if ( v5 >= 3 )
3665 goto LABEL_361;
3666 v5 = 3;
3667 LABEL_336:
3668 v54 = v3 == 22;
3669 goto LABEL_345;
3670 case 61:
3671 if ( v3 != 17 )
3672 goto LABEL_340;
3673 if ( v5 >= 3 )
3674 goto LABEL_361;
3675 v5 = 3;
3676 LABEL_340:
3677 v54 = v3 == 18;
3678 goto LABEL_345;
3679 case 62:
3680 if ( v3 != 19 )
3681 goto LABEL_344;
3682 if ( v5 >= 3 )
3683 goto LABEL_361;
3684 v5 = 3;
3685 LABEL_344:
3686 v54 = v3 == 20;
3687 LABEL_345:
3688 if ( !v54 )
3689 goto LABEL_361;
3690 if ( v5 >= 3 )
3691 goto LABEL_361;
3692 v60 = 3;
3693 goto LABEL_360;
3694 case 67:
3695 v55 = v3 == 18;
3696 goto LABEL_357;
3697 case 68:
3698 v53 = v3 == 9;
3699 goto LABEL_350;
3700 case 69:
3701 if ( v3 == 11 )
3702 v5 += 20;
3703 break;
3704 case 70:
3705 if ( v3 == 12 )
3706 v5 += 10;
3707 v55 = v3 == 16;
3708 LABEL_357:
3709 if ( v55 && v5 < 2 )
3710 {
3711 v60 = 2;
3712 LABEL_360:
3713 v5 = v60;
3714 }
3715 break;
3716 default:
3717 goto LABEL_361;
3718 }
3719 goto LABEL_361;
3720 }
3721 if ( v34 == 48 )
3722 {
3723 if ( v3 == 9 )
3724 v5 += 5;
3725 LABEL_315:
3726 v46 = v3 == 3;
3727 LABEL_240:
3728 if ( v46 )
3729 v5 += 15;
3730 goto LABEL_361;
3731 }
3732 if ( v34 > 32 )
3733 {
3734 if ( v34 > 44 )
3735 {
3736 v51 = v34 - 45;
3737 if ( !v51 )
3738 {
3739 if ( v3 == 5 )
3740 goto LABEL_351;
3741 v53 = v3 == 4;
3742 LABEL_350:
3743 if ( v53 )
3744 LABEL_351:
3745 v5 += 5;
3746 goto LABEL_361;
3747 }
3748 v52 = v51 - 1;
3749 if ( !v52 )
3750 {
3751 v40 = v3 == 0;
3752 LABEL_123:
3753 if ( v40 )
3754 v5 += 25;
3755 goto LABEL_361;
3756 }
3757 if ( v52 == 1 )
3758 {
3759 LABEL_309:
3760 v50 = v3 == 8;
3761 goto LABEL_296;
3762 }
3763 } 3243 }
3764 else 3244 else
3765 { 3245 {
3766 if ( v34 == 44 ) 3246 v23 = this->pOwnItems[this->pEquipment.uShield].uItemID;
3247 v15 = pItemsTable->pItems[v23].uDamageMod;
3248 v14 = pItemsTable->pItems[v23].uDamageDice * pItemsTable->pItems[v23].uDamageRoll;
3249 return v5 + v15 + v14;
3250 }
3251 }
3252 break;
3253
3254 case CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS:
3255 case CHARACTER_ATTRIBUTE_ATTACK:
3256 if ( IsUnarmed() )
3257 {
3258 return 0;
3259 }
3260 if ( this->HasItemEquipped(EQUIP_MAIN_HAND) )
3261 {
3262 v17 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND);
3263 if ( v17 >= 0 && v17 <= 2)
3264 {
3265 v5 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand-1].uItemID].uDamageMod;
3266 }
3267 }
3268 if ( getOnlyMainHandDmg || !this->HasItemEquipped(EQUIP_OFF_HAND) || (this->GetEquippedItemEquipType(EQUIP_OFF_HAND) < 0) || this->GetEquippedItemEquipType(EQUIP_OFF_HAND) > 2 )
3269 return v5;
3270 else
3271 {
3272 v20 = this->pOwnItems[this->pEquipment.uShield - 1].uItemID;
3273 v56 = pItemsTable->pItems[v20].uDamageMod;
3274 return v5 + v56;
3275 }
3276 break;
3277
3278 case CHARACTER_ATTRIBUTE_MELEE_DMG_MIN:
3279 if ( IsUnarmed() )
3280 {
3281 return 1;
3282 }
3283 if ( this->HasItemEquipped(EQUIP_MAIN_HAND) )
3284 {
3285 v9 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND);
3286 if ( v9 >= 0 && v9 <= 2)
3287 {
3288 v5 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uDamageDice +
3289 pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uDamageMod;
3290 if ( !this->pEquipment.uShield && pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uSkillType == 4)
3767 { 3291 {
3768 v50 = v3 == 7; 3292 ++v5;
3769 goto LABEL_296;
3770 }
3771 v34 -= 33;
3772 if ( !v34 )
3773 {
3774 if ( v3 != 38 )
3775 goto LABEL_361;
3776 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[16]);
3777 goto LABEL_138;
3778 }
3779 --v34;
3780 if ( !v34 )
3781 {
3782 if ( v3 != 36 )
3783 goto LABEL_361;
3784 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[14]);
3785 goto LABEL_138;
3786 }
3787 v49 = v34 - 8;
3788 if ( !v49 )
3789 {
3790 if ( (signed int)v3 >= 0 && (signed int)v3 <= 15 )
3791 ++v5;
3792 goto LABEL_361;
3793 }
3794 if ( v49 == 1 )
3795 {
3796 if ( v3 != 3 && v3 != 7 )
3797 {
3798 v50 = v3 == 9;
3799 LABEL_296:
3800 if ( !v50 )
3801 goto LABEL_361;
3802 }
3803 LABEL_121:
3804 v5 += 10;
3805 goto LABEL_361;
3806 } 3293 }
3807 } 3294 }
3808 } 3295 }
3296
3297 if ( getOnlyMainHandDmg || !this->HasItemEquipped(EQUIP_OFF_HAND) || (this->GetEquippedItemEquipType(EQUIP_OFF_HAND) < 0) || this->GetEquippedItemEquipType(EQUIP_OFF_HAND) > 2 )
3298 {
3299 return v5;
3300 }
3809 else 3301 else
3810 { 3302 {
3811 if ( v34 == 32 ) 3303 v14 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uShield].uItemID].uDamageMod;
3304 v15 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uShield].uItemID].uDamageDice;
3305 return v5 + v15 + v14;
3306 }
3307 break;
3308
3309 case CHARACTER_ATTRIBUTE_STRENGTH:
3310 case CHARACTER_ATTRIBUTE_INTELLIGENCE:
3311 case CHARACTER_ATTRIBUTE_WILLPOWER:
3312 case CHARACTER_ATTRIBUTE_ENDURANCE:
3313 case CHARACTER_ATTRIBUTE_ACCURACY:
3314 case CHARACTER_ATTRIBUTE_SPEED:
3315 case CHARACTER_ATTRIBUTE_LUCK:
3316 case CHARACTER_ATTRIBUTE_HEALTH:
3317 case CHARACTER_ATTRIBUTE_MANA:
3318 case CHARACTER_ATTRIBUTE_AC_BONUS:
3319
3320 case CHARACTER_ATTRIBUTE_RESIST_FIRE:
3321 case CHARACTER_ATTRIBUTE_RESIST_AIR:
3322 case CHARACTER_ATTRIBUTE_RESIST_WATER:
3323 case CHARACTER_ATTRIBUTE_RESIST_EARTH:
3324 case CHARACTER_ATTRIBUTE_RESIST_MIND:
3325 case CHARACTER_ATTRIBUTE_RESIST_BODY:
3326 case CHARACTER_ATTRIBUTE_RESIST_SPIRIT:
3327
3328 case CHARACTER_ATTRIBUTE_SKILL_ALCHEMY:
3329 case CHARACTER_ATTRIBUTE_SKILL_STEALING:
3330 case CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM:
3331 case CHARACTER_ATTRIBUTE_SKILL_ITEM_ID:
3332 case CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID:
3333 case CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER:
3334 case CHARACTER_ATTRIBUTE_SKILL_DODGE:
3335 case CHARACTER_ATTRIBUTE_SKILL_UNARMED:
3336
3337 case CHARACTER_ATTRIBUTE_SKILL_FIRE:
3338 case CHARACTER_ATTRIBUTE_SKILL_AIR:
3339 case CHARACTER_ATTRIBUTE_SKILL_WATER:
3340 case CHARACTER_ATTRIBUTE_SKILL_EARTH:
3341 case CHARACTER_ATTRIBUTE_SKILL_SPIRIT:
3342 case CHARACTER_ATTRIBUTE_SKILL_MIND:
3343 case CHARACTER_ATTRIBUTE_SKILL_BODY:
3344 case CHARACTER_ATTRIBUTE_SKILL_LIGHT:
3345 case CHARACTER_ATTRIBUTE_SKILL_DARK:
3346 case CHARACTER_ATTRIBUTE_SKILL_MEDITATION:
3347 case CHARACTER_ATTRIBUTE_SKILL_BOW:
3348 case CHARACTER_ATTRIBUTE_SKILL_SHIELD:
3349 case CHARACTER_ATTRIBUTE_SKILL_LEARNING:
3350 for (int i = 0; i < 16; i++)
3351 {
3352 if ( HasItemEquipped((ITEM_EQUIP_TYPE)i) )
3812 { 3353 {
3813 if ( v3 != 39 ) 3354 v31 = this->pEquipment.pIndices[i] - 1;
3814 goto LABEL_361; 3355 currEquippedItem = &this->pInventoryItemList[v31];
3815 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); 3356 if ( attr == CHARACTER_ATTRIBUTE_AC_BONUS )
3816 goto LABEL_138;
3817 }
3818 if ( v34 > 28 )
3819 {
3820 v34 -= 29;
3821 if ( v34 )
3822 { 3357 {
3823 --v34; 3358 v32 = GetEquippedItemEquipType((ITEM_EQUIP_TYPE)i);
3824 if ( v34 ) 3359 if ( v32 >= 3 && v32 <= 11 )
3825 { 3360 {
3826 --v34; 3361 v33 = currEquippedItem->uItemID;
3827 if ( v34 || v3 != 41 ) 3362 v5 += pItemsTable->pItems[v33].uDamageDice + pItemsTable->pItems[v33].uDamageMod;
3828 goto LABEL_361;
3829 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[19]);
3830 } 3363 }
3831 else 3364 }
3365 if ( pItemsTable->IsMaterialNonCommon((ItemGen *)(currEquippedItem))
3366 && !pItemsTable->IsMaterialSpecial(currEquippedItem) )
3367 {
3368 currEquippedItem->GetItemBonusArtifact(this, attr, &v62);
3369 }
3370 else if ( currEquippedItem->uEnchantmentType != 0 )
3371 {
3372 if (currEquippedItem->IsRegularEnchanmentForAttribute(attr))
3832 { 3373 {
3833 if ( v3 != 34 ) 3374 if ( attr > CHARACTER_ATTRIBUTE_RESIST_BODY && v5 < currEquippedItem->m_enchantmentStrength )
3834 goto LABEL_361; 3375 v5 = currEquippedItem->m_enchantmentStrength;
3835 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[12]); 3376 else
3377 v5 += currEquippedItem->m_enchantmentStrength;
3836 } 3378 }
3837 } 3379 }
3838 else 3380 else
3839 { 3381 {
3840 if ( v3 != 37 ) 3382 currEquippedItem->GetItemBonusSpecialEnchantment(this, attr, &v5, &v61);
3841 goto LABEL_361;
3842 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[15]);
3843 }
3844 goto LABEL_138;
3845 }
3846 if ( v34 == 28 )
3847 {
3848 LABEL_136:
3849 if ( v3 == 42 )
3850 {
3851 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[20]);
3852 LABEL_138:
3853 v62 = ((unsigned int)v34 >> 1) & 0x1F;
3854 goto LABEL_361;
3855 } 3383 }
3856 } 3384 }
3857 else 3385 }
3858 {
3859 v47 = v34 - 1;
3860 if ( v47 )
3861 {
3862 v48 = v47 - 1;
3863 if ( v48 )
3864 {
3865 v34 = v48 - 24;
3866 if ( v34 )
3867 {
3868 --v34;
3869 if ( v34 || v3 != 40 )
3870 goto LABEL_361;
3871 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[18]);
3872 }
3873 else
3874 {
3875 if ( v3 != 35 )
3876 goto LABEL_361;
3877 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[13]);
3878 }
3879 goto LABEL_138;
3880 }
3881 LABEL_118:
3882 if ( (signed int)v3 < 0 )
3883 goto LABEL_361;
3884 v39 = __OFSUB__((int)v3, 6);
3885 v37 = v3 == 6;
3886 v38 = v3 - 6 < 0;
3887 }
3888 else
3889 {
3890 LABEL_253:
3891 if ( (signed int)v3 < 10 )
3892 goto LABEL_361;
3893 v39 = __OFSUB__((int)v3, 15);
3894 v37 = v3 == 15;
3895 v38 = v3 - 15 < 0;
3896 }
3897 if ( (unsigned __int8)(v38 ^ v39) | v37 )
3898 goto LABEL_121;
3899 }
3900 }
3901 LABEL_361:
3902 ++v65;
3903 if ( (signed int)v65 >= 16 )
3904 return v5 + v62 + v61;
3905 }
3906 }
3907 if ( attr == CHARACTER_ATTRIBUTE_MELEE_DMG_MAX )
3908 {
3909 if ( IsUnarmed() != 1 )
3910 {
3911 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) )
3912 {
3913 v22 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND);
3914 if ( v22 >= 0 )
3915 {
3916 if ( v22 <= 2 )
3917 {
3918 v23 = this->pOwnItems[this->pEquipment.uMainHand].uItemID;
3919 if ( v6->pEquipment.uShield || pItemsTable->pItems[v23].uSkillType != 4 )
3920 {
3921 v26 = pItemsTable->pItems[v23].uDamageRoll;
3922 v25 = pItemsTable->pItems[v23].uDamageDice;
3923 }
3924 else
3925 {
3926 v25 = pItemsTable->pItems[v23].uDamageRoll;
3927 v26 = pItemsTable->pItems[v23].uDamageDice + 1;
3928 }
3929 v5 = pItemsTable->pItems[v23].uDamageMod + v25 * v26;
3930 }
3931 }
3932 }
3933
3934 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) )
3935 {
3936
3937 v28 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND);
3938 if ((v28 < 0) || v28 > 2 )
3939 return v5 + v62 + v61;
3940 }
3941 v15 = pItemsTable->pItems[v23].uDamageMod;
3942 v14 = pItemsTable->pItems[v23].uDamageDice * pItemsTable->pItems[v23].uDamageRoll;
3943 v5 += v15 + v14;
3944 return v5 + v62 + v61; 3386 return v5 + v62 + v61;
3945 } 3387 break;
3946 v59 = 3; 3388 default:
3947 LABEL_74: 3389 return 0;
3948 v5 = v59; 3390 }
3949 return v5 + v62 + v61;
3950 }
3951 if ( (signed int)attr < 0 )
3952 return v5 + v62 + v61;
3953 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_SKILL_UNARMED )
3954 goto LABEL_95;
3955 if ( attr == CHARACTER_ATTRIBUTE_LEVEL )
3956 {
3957 if ( !Player::HasEnchantedItemEquipped(25) )
3958 return v5 + v62 + v61;
3959 v5 = 5;
3960 return v5 + v62 + v61;
3961 }
3962 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_LEVEL )
3963 return v5 + v62 + v61;
3964 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS )
3965 {
3966 if ( IsUnarmed() == 1 )
3967 {
3968 v5 = 0;
3969 return v5 + v62 + v61;
3970 }
3971 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) )
3972 {
3973 v17 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND);
3974 if ( v17 >= 0 )
3975 {
3976 if ( v17 <= 2 )
3977 v5 = pItemsTable->pItems[v6->pOwnItems[v6->pEquipment.uMainHand-1].uItemID].uDamageMod;
3978 }
3979 }
3980 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v19 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v19 < 0) || v19 > 2 )
3981 return v5 + v62 + v61;
3982 v20 = v6->pOwnItems[v6->pEquipment.uShield - 1].uItemID;
3983 v56 = pItemsTable->pItems[v20].uDamageMod;
3984 v5 += v56;
3985 return v5 + v62 + v61;
3986 }
3987 if ( attr == CHARACTER_ATTRIBUTE_MELEE_DMG_MIN )
3988 {
3989 if ( IsUnarmed() == 1 )
3990 {
3991 v5 = 1;
3992 return v5 + v62 + v61;
3993 }
3994 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) )
3995 {
3996 v9 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND);
3997 if ( v9 >= 0 )
3998 {
3999 if ( v9 <= 2 )
4000 {
4001 v5 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uDamageDice +
4002 pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uDamageMod;
4003 if ( !v6->pEquipment.uShield )
4004 {
4005 if ( pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uSkillType == 4 )
4006 ++v5;
4007 }
4008 }
4009 }
4010 }
4011
4012 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND))
4013 {
4014 v12 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND);
4015 if ((v12 < 0) || v12 > 2 )
4016 return v5 + v62 + v61;
4017 }
4018 v14 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uShield].uItemID].uDamageMod;
4019 v15 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uShield].uItemID].uDamageDice;
4020 LABEL_88:
4021 v5 += v15 + v14;
4022 }
4023 return v5 + v62 + v61;
4024 } 3391 }
4025 3392
4026 //----- (0048F73C) -------------------------------------------------------- 3393 //----- (0048F73C) --------------------------------------------------------
4027 int Player::GetMagicalBonus(enum CHARACTER_ATTRIBUTE_TYPE a2) 3394 int Player::GetMagicalBonus(enum CHARACTER_ATTRIBUTE_TYPE a2)
4028 { 3395 {
4135 { 3502 {
4136 if ( CheckHiredNPCSpeciality(Hunter) ) 3503 if ( CheckHiredNPCSpeciality(Hunter) )
4137 bonus_value = 6; 3504 bonus_value = 6;
4138 if ( CheckHiredNPCSpeciality(Sage) ) 3505 if ( CheckHiredNPCSpeciality(Sage) )
4139 bonus_value += 6; 3506 bonus_value += 6;
4140 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID, 0); 3507 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID);
4141 } 3508 }
4142 break; 3509 break;
4143 3510
4144 case PLAYER_SKILL_ARMSMASTER: 3511 case PLAYER_SKILL_ARMSMASTER:
4145 { 3512 {
4146 if ( CheckHiredNPCSpeciality(Armsmaster) ) 3513 if ( CheckHiredNPCSpeciality(Armsmaster) )
4147 bonus_value = 2; 3514 bonus_value = 2;
4148 if ( CheckHiredNPCSpeciality(Weaponsmaster) ) 3515 if ( CheckHiredNPCSpeciality(Weaponsmaster) )
4149 bonus_value += 3; 3516 bonus_value += 3;
4150 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER, 0); 3517 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER);
4151 } 3518 }
4152 break; 3519 break;
4153 3520
4154 case PLAYER_SKILL_STEALING: 3521 case PLAYER_SKILL_STEALING:
4155 { 3522 {
4156 if (CheckHiredNPCSpeciality(Burglar)) 3523 if (CheckHiredNPCSpeciality(Burglar))
4157 bonus_value = 8; 3524 bonus_value = 8;
4158 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_STEALING, 0); 3525 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_STEALING);
4159 } 3526 }
4160 break; 3527 break;
4161 3528
4162 3529
4163 case PLAYER_SKILL_ALCHEMY: 3530 case PLAYER_SKILL_ALCHEMY:
4164 { 3531 {
4165 if ( CheckHiredNPCSpeciality(Herbalist) ) 3532 if ( CheckHiredNPCSpeciality(Herbalist) )
4166 bonus_value = 4; 3533 bonus_value = 4;
4167 if ( CheckHiredNPCSpeciality(Apothecary) ) 3534 if ( CheckHiredNPCSpeciality(Apothecary) )
4168 bonus_value += 8; 3535 bonus_value += 8;
4169 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ALCHEMY, 0); 3536 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ALCHEMY);
4170 } 3537 }
4171 break; 3538 break;
4172 3539
4173 case PLAYER_SKILL_LEARNING: 3540 case PLAYER_SKILL_LEARNING:
4174 { 3541 {
4176 bonus_value = 10; 3543 bonus_value = 10;
4177 if ( CheckHiredNPCSpeciality(Instructor) ) 3544 if ( CheckHiredNPCSpeciality(Instructor) )
4178 bonus_value += 15; 3545 bonus_value += 15;
4179 if ( CheckHiredNPCSpeciality(Scholar) ) 3546 if ( CheckHiredNPCSpeciality(Scholar) )
4180 bonus_value += 5; 3547 bonus_value += 5;
4181 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_LEARNING, 0); 3548 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_LEARNING);
4182 } 3549 }
4183 break; 3550 break;
4184 3551
4185 case PLAYER_SKILL_UNARMED: 3552 case PLAYER_SKILL_UNARMED:
4186 { 3553 {
4187 if (CheckHiredNPCSpeciality(Monk) ) 3554 if (CheckHiredNPCSpeciality(Monk) )
4188 bonus_value = 2; 3555 bonus_value = 2;
4189 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_UNARMED, 0); 3556 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_UNARMED);
4190 } 3557 }
4191 break; 3558 break;
4192 3559
4193 case PLAYER_SKILL_DODGE: 3560 case PLAYER_SKILL_DODGE:
4194 { 3561 {
4195 if ( CheckHiredNPCSpeciality(Monk) ) 3562 if ( CheckHiredNPCSpeciality(Monk) )
4196 bonus_value = 2; 3563 bonus_value = 2;
4197 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_DODGE, 0); 3564 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_DODGE);
4198 } 3565 }
4199 break; 3566 break;
4200 3567
4201 case PLAYER_SKILL_BOW: 3568 case PLAYER_SKILL_BOW:
4202 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_BOW, 0); 3569 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_BOW);
4203 break; 3570 break;
4204 case PLAYER_SKILL_SHIELD: 3571 case PLAYER_SKILL_SHIELD:
4205 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_SHIELD, 0); 3572 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_SHIELD);
4206 break; 3573 break;
4207 3574
4208 case PLAYER_SKILL_EARTH: 3575 case PLAYER_SKILL_EARTH:
4209 if ( CheckHiredNPCSpeciality(Apprentice) ) 3576 if ( CheckHiredNPCSpeciality(Apprentice) )
4210 bonus_value = 2; 3577 bonus_value = 2;
4212 bonus_value += 3; 3579 bonus_value += 3;
4213 if ( CheckHiredNPCSpeciality(Spellmaster) ) 3580 if ( CheckHiredNPCSpeciality(Spellmaster) )
4214 bonus_value += 4; 3581 bonus_value += 4;
4215 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) 3582 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() )
4216 bonus_value += 3; 3583 bonus_value += 3;
4217 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_EARTH, 0); 3584 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_EARTH);
4218 break; 3585 break;
4219 case PLAYER_SKILL_FIRE: 3586 case PLAYER_SKILL_FIRE:
4220 if ( CheckHiredNPCSpeciality(Apprentice) ) 3587 if ( CheckHiredNPCSpeciality(Apprentice) )
4221 bonus_value = 2; 3588 bonus_value = 2;
4222 if ( CheckHiredNPCSpeciality(Mystic) ) 3589 if ( CheckHiredNPCSpeciality(Mystic) )
4223 bonus_value += 3; 3590 bonus_value += 3;
4224 if ( CheckHiredNPCSpeciality(Spellmaster) ) 3591 if ( CheckHiredNPCSpeciality(Spellmaster) )
4225 bonus_value += 4; 3592 bonus_value += 4;
4226 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) 3593 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() )
4227 bonus_value += 3; 3594 bonus_value += 3;
4228 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_FIRE, 0); 3595 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_FIRE);
4229 break; 3596 break;
4230 case PLAYER_SKILL_AIR: 3597 case PLAYER_SKILL_AIR:
4231 if ( CheckHiredNPCSpeciality(Apprentice) ) 3598 if ( CheckHiredNPCSpeciality(Apprentice) )
4232 bonus_value = 2; 3599 bonus_value = 2;
4233 if ( CheckHiredNPCSpeciality(Mystic) ) 3600 if ( CheckHiredNPCSpeciality(Mystic) )
4234 bonus_value += 3; 3601 bonus_value += 3;
4235 if ( CheckHiredNPCSpeciality(Spellmaster) ) 3602 if ( CheckHiredNPCSpeciality(Spellmaster) )
4236 bonus_value += 4; 3603 bonus_value += 4;
4237 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) 3604 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() )
4238 bonus_value += 3; 3605 bonus_value += 3;
4239 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_AIR, 0); 3606 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_AIR);
4240 break; 3607 break;
4241 case PLAYER_SKILL_WATER: 3608 case PLAYER_SKILL_WATER:
4242 if ( CheckHiredNPCSpeciality(Apprentice) ) 3609 if ( CheckHiredNPCSpeciality(Apprentice) )
4243 bonus_value = 2; 3610 bonus_value = 2;
4244 if ( CheckHiredNPCSpeciality(Mystic) ) 3611 if ( CheckHiredNPCSpeciality(Mystic) )
4245 bonus_value += 3; 3612 bonus_value += 3;
4246 if ( CheckHiredNPCSpeciality(Spellmaster) ) 3613 if ( CheckHiredNPCSpeciality(Spellmaster) )
4247 bonus_value += 4; 3614 bonus_value += 4;
4248 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) 3615 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() )
4249 bonus_value += 3; 3616 bonus_value += 3;
4250 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_WATER, 0); 3617 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_WATER);
4251 break; 3618 break;
4252 case PLAYER_SKILL_SPIRIT: 3619 case PLAYER_SKILL_SPIRIT:
4253 if ( CheckHiredNPCSpeciality(Acolyte2) ) 3620 if ( CheckHiredNPCSpeciality(Acolyte2) )
4254 bonus_value = 2; 3621 bonus_value = 2;
4255 if ( CheckHiredNPCSpeciality(Initiate) ) 3622 if ( CheckHiredNPCSpeciality(Initiate) )
4256 bonus_value += 3; 3623 bonus_value += 3;
4257 if ( CheckHiredNPCSpeciality(Prelate) ) 3624 if ( CheckHiredNPCSpeciality(Prelate) )
4258 bonus_value += 4; 3625 bonus_value += 4;
4259 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_SPIRIT, 0); 3626 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_SPIRIT);
4260 break; 3627 break;
4261 case PLAYER_SKILL_MIND: 3628 case PLAYER_SKILL_MIND:
4262 if ( CheckHiredNPCSpeciality(Acolyte2) ) 3629 if ( CheckHiredNPCSpeciality(Acolyte2) )
4263 bonus_value = 2; 3630 bonus_value = 2;
4264 if ( CheckHiredNPCSpeciality(Initiate) ) 3631 if ( CheckHiredNPCSpeciality(Initiate) )
4265 bonus_value += 3; 3632 bonus_value += 3;
4266 if ( CheckHiredNPCSpeciality(Prelate) ) 3633 if ( CheckHiredNPCSpeciality(Prelate) )
4267 bonus_value += 4; 3634 bonus_value += 4;
4268 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MIND, 0); 3635 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MIND);
4269 break; 3636 break;
4270 case PLAYER_SKILL_BODY: 3637 case PLAYER_SKILL_BODY:
4271 if ( CheckHiredNPCSpeciality(Acolyte2) ) 3638 if ( CheckHiredNPCSpeciality(Acolyte2) )
4272 bonus_value = 2; 3639 bonus_value = 2;
4273 if ( CheckHiredNPCSpeciality(Initiate) ) 3640 if ( CheckHiredNPCSpeciality(Initiate) )
4274 bonus_value += 3; 3641 bonus_value += 3;
4275 if ( CheckHiredNPCSpeciality(Prelate) ) 3642 if ( CheckHiredNPCSpeciality(Prelate) )
4276 bonus_value += 4; 3643 bonus_value += 4;
4277 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_BODY, 0); 3644 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_BODY);
4278 break; 3645 break;
4279 case PLAYER_SKILL_LIGHT: 3646 case PLAYER_SKILL_LIGHT:
4280 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_LIGHT, 0); 3647 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_LIGHT);
4281 break; 3648 break;
4282 case PLAYER_SKILL_DARK: 3649 case PLAYER_SKILL_DARK:
4283 { 3650 {
4284 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_DARK, 0); 3651 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_DARK);
4285 } 3652 }
4286 break; 3653 break;
4287 3654
4288 case PLAYER_SKILL_MERCHANT: 3655 case PLAYER_SKILL_MERCHANT:
4289 { 3656 {
4306 bonus_value += 5; 3673 bonus_value += 5;
4307 } 3674 }
4308 break; 3675 break;
4309 3676
4310 case PLAYER_SKILL_ITEM_ID: 3677 case PLAYER_SKILL_ITEM_ID:
4311 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ITEM_ID, 0); 3678 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ITEM_ID);
4312 break; 3679 break;
4313 case PLAYER_SKILL_MEDITATION: 3680 case PLAYER_SKILL_MEDITATION:
4314 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MEDITATION, 0); 3681 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MEDITATION);
4315 break; 3682 break;
4316 case PLAYER_SKILL_TRAP_DISARM: 3683 case PLAYER_SKILL_TRAP_DISARM:
4317 { 3684 {
4318 if ( CheckHiredNPCSpeciality(Tinker) ) 3685 if ( CheckHiredNPCSpeciality(Tinker) )
4319 bonus_value = 4; 3686 bonus_value = 4;
4320 if ( CheckHiredNPCSpeciality(Locksmith) ) 3687 if ( CheckHiredNPCSpeciality(Locksmith) )
4321 bonus_value += 6; 3688 bonus_value += 6;
4322 if ( CheckHiredNPCSpeciality(Burglar) ) 3689 if ( CheckHiredNPCSpeciality(Burglar) )
4323 bonus_value += 8; 3690 bonus_value += 8;
4324 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM, 0); 3691 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM);
4325 } 3692 }
4326 break; 3693 break;
4327 } 3694 }
4328 3695
4329 skill_value = pActiveSkills[uSkillType]; 3696 skill_value = pActiveSkills[uSkillType];