comparison Player.cpp @ 1048:d36681a9e4f8

Слияние
author Ritor1
date Thu, 23 May 2013 11:17:01 +0600
parents b725a9cdec0c c5498375832a
children efe228ab5003
comparison
equal deleted inserted replaced
1047:76ce871b0076 1048:d36681a9e4f8
101 unsigned char pAgeingEnduranceMultiplier[4] = {100, 75, 40, 10}; 101 unsigned char pAgeingEnduranceMultiplier[4] = {100, 75, 40, 10};
102 unsigned char pAgeingAccuracyMultiplier[4] = {100, 100, 40, 10}; 102 unsigned char pAgeingAccuracyMultiplier[4] = {100, 100, 40, 10};
103 unsigned char pAgeingSpeedMultiplier[4] = {100, 100, 40, 10}; 103 unsigned char pAgeingSpeedMultiplier[4] = {100, 100, 40, 10};
104 unsigned char pAgeingLuckMultiplier[4] = {100, 100, 100, 100}; 104 unsigned char pAgeingLuckMultiplier[4] = {100, 100, 100, 100};
105 105
106 unsigned int pAgeingTable[4] = {50, 100, 150, 65535}; 106 signed int pAgeingTable[4] = {50, 100, 150, 0xFFFF};
107 107
108 unsigned int pConditionImportancyTable[18] = {16, 15, 14, 17, 13, 2, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 1, 0}; 108 unsigned int pConditionImportancyTable[18] = {16, 15, 14, 17, 13, 2, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 1, 0};
109 109
110 short word_4EDFFC[30] = {500, 400, 350, 300, 275, 250, 225, 200, 175, 110 short param_to_bonus_table[29] = {500, 400, 350, 300, 275, 250, 225, 200, 175,
111 150, 125, 100, 75, 50, 40, 35, 30, 25, 21, 111 150, 125, 100, 75, 50, 40, 35, 30, 25, 21,
112 19, 17, 15, 13, 11, 9, 7, 5, 3, 0, 0}; 112 19, 17, 15, 13, 11, 9, 7, 5, 3, 0};
113 signed int player_stat_bonuses[30] = {30, 25, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, 0}; 113 signed int parameter_to_bonus_value[29] = {30, 25, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6};
114 114
115 115
116 unsigned char pEquipTypeToBodyAnchor[20] = {1, 1, 2, 3, 0, 4, 5, 6, 7, 8, 10, 9, 1, 0, 0, 0, 0, 0, 0, 0}; 116 unsigned char pEquipTypeToBodyAnchor[20] = {1, 1, 2, 3, 0, 4, 5, 6, 7, 8, 10, 9, 1, 0, 0, 0, 0, 0, 0, 0};
117 117
118 118
262 262
263 263
264 264
265 265
266 //----- (004B8040) -------------------------------------------------------- 266 //----- (004B8040) --------------------------------------------------------
267 int Player::_4B8040_condition_time(unsigned int uCondition) 267 int Player::GetConditionDayOfWeek( unsigned int uCondition )
268 { 268 {
269 return (unsigned int)((signed __int64)((double)this->pConditions[uCondition] * 0.234375) / 60 / 60) / 0x18 % 7 + 1; 269 return (unsigned int)(((signed __int64)((double)this->pConditions[uCondition] * 0.234375) / 60 / 60) / 24) % 7 + 1;
270 } 270 }
271 271
272 //----- (004B807C) -------------------------------------------------------- 272 //----- (004B807C) --------------------------------------------------------
273 int Player::_4B807C(float a2) 273 int Player::_4B807C(float a2)
274 { 274 {
296 if ( v3 == 16 ) 296 if ( v3 == 16 )
297 { 297 {
298 v10 = 10; 298 v10 = 10;
299 v9 = 16; 299 v9 = 16;
300 LABEL_6: 300 LABEL_6:
301 v11 = _4B8040_condition_time(v9); 301 v11 = GetConditionDayOfWeek(v9);
302 goto LABEL_13; 302 goto LABEL_13;
303 } 303 }
304 } 304 }
305 v10 = 1; 305 v10 = 1;
306 v5 = 0; 306 v5 = 0;
307 do 307 do
308 { 308 {
309 v6 = _4B8040_condition_time(v5); 309 v6 = GetConditionDayOfWeek(v5);
310 if ( v6 > v4 ) 310 if ( v6 > v4 )
311 v4 = v6; 311 v4 = v6;
312 ++v5; 312 ++v5;
313 } 313 }
314 while ( (signed int)v5 <= 13 ); 314 while ( (signed int)v5 <= 13 );
2572 } 2572 }
2573 2573
2574 //----- (0048CC33) -------------------------------------------------------- 2574 //----- (0048CC33) --------------------------------------------------------
2575 int Player::GetActualLuck() 2575 int Player::GetActualLuck()
2576 { 2576 {
2577 Player *v1; // esi@1 2577 signed int curr_age; // eax@7
2578 unsigned int v2; // eax@7 2578 signed int i; // ecx@7
2579 signed int v3; // ecx@7 2579 signed int age_luck_pc; // ebx@10
2580 signed int v4; // ebx@10 2580 int condition_luck_pc; // edi@11
2581 int v5; // edi@11 2581 int items_luck_bonus; // ebp@11
2582 int v6; // ebp@11 2582 signed int npc_luck_bonus; // [sp+10h] [bp-4h]@1
2583 signed int v8; // [sp+10h] [bp-4h]@1 2583 signed int magic_luck_bonus; // [sp+10h] [bp-4h]@1
2584 2584 int full_luck;
2585 v8 = 0; 2585
2586 v1 = this; 2586 npc_luck_bonus = 0;
2587 if ( CheckHiredNPCSpeciality(Fool) ) 2587 if ( CheckHiredNPCSpeciality(Fool) )
2588 v8 = 5; 2588 npc_luck_bonus = 5;
2589 if ( CheckHiredNPCSpeciality(ChimneySweep) ) 2589 if ( CheckHiredNPCSpeciality(ChimneySweep) )
2590 v8 += 20; 2590 npc_luck_bonus += 20;
2591 if ( CheckHiredNPCSpeciality(Psychic) ) 2591 if ( CheckHiredNPCSpeciality(Psychic) )
2592 v8 += 10; 2592 npc_luck_bonus += 10;
2593 v2 = v1->sAgeModifier + GetBaseAge(); 2593 curr_age = sAgeModifier + GetBaseAge();
2594 v3 = 0; 2594 i = 0;
2595 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) 2595 while ( curr_age >= pAgeingTable[i] )
2596 { 2596 {
2597 ++v3; 2597 ++i;
2598 if ( v3 >= 4 ) 2598 if ( i >= 4 )
2599 { 2599 break;
2600 v4 = 100; 2600 }
2601 goto LABEL_11; 2601 if (i < 4)
2602 } 2602 age_luck_pc = pAgeingLuckMultiplier[i];
2603 } 2603 else
2604 v4 = pAgeingLuckMultiplier[v3]; 2604 age_luck_pc = 100;
2605 LABEL_11: 2605
2606 v5 = pConditionLuckMultiplier[GetMajorConditionIdx()]; 2606 condition_luck_pc = pConditionLuckMultiplier[GetMajorConditionIdx()];
2607 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_LUCK, 0); 2607 items_luck_bonus = GetItemsBonus(CHARACTER_ATTRIBUTE_LUCK, 0);
2608 return GetMagicalBonus(CHARACTER_ATTRIBUTE_LUCK) 2608 magic_luck_bonus = GetMagicalBonus(CHARACTER_ATTRIBUTE_LUCK);
2609 + v6 2609 full_luck = magic_luck_bonus + items_luck_bonus + npc_luck_bonus+ uLuckBonus
2610 + v8 2610 + condition_luck_pc * age_luck_pc * uLuck / 100 / 100;
2611 + v5 * v4 * v1->uLuck / 100 / 100 2611 return full_luck;
2612 + v1->uLuckBonus;
2613 } 2612 }
2614 2613
2615 //----- (0048CCF5) -------------------------------------------------------- 2614 //----- (0048CCF5) --------------------------------------------------------
2616 int Player::GetActualAttack(int a2) 2615 int Player::GetActualAttack(int a2)
2617 { 2616 {
2621 int v5; // ebx@1 2620 int v5; // ebx@1
2622 int v6; // ebp@1 2621 int v6; // ebp@1
2623 2622
2624 v2 = this; 2623 v2 = this;
2625 v3 = GetActualAccuracy(); 2624 v3 = GetActualAccuracy();
2626 v4 = _48EA1B_get_static_effect(v3); 2625 v4 = GetParameterBonus(v3);
2627 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_ATTACK); 2626 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_ATTACK);
2628 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_ATTACK, a2); 2627 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_ATTACK, a2);
2629 return v4 + v5 + v6 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ATTACK) + v2->_some_attack_bonus; 2628 return v4 + v5 + v6 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ATTACK) + v2->_some_attack_bonus;
2630 } 2629 }
2631 2630
2638 int v4; // esi@1 2637 int v4; // esi@1
2639 int v5; // esi@1 2638 int v5; // esi@1
2640 int v6; // esi@1 2639 int v6; // esi@1
2641 signed int result; // eax@1 2640 signed int result; // eax@1
2642 2641
2643 v1 = this; 2642
2644 v2 = GetActualMight(); 2643 v2 = GetActualMight();
2645 v3 = _48EA1B_get_static_effect(v2); 2644 v3 = GetParameterBonus(v2);
2646 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0) + v3; 2645 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0) + v3;
2647 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; 2646 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4;
2648 v6 = v1->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; 2647 result = _melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5;
2649 result = 1; 2648 if ( result < 1 )
2650 if ( v6 >= 1 ) 2649 result = 1;
2651 result = v6;
2652 return result; 2650 return result;
2653 } 2651 }
2654 2652
2655 //----- (0048CD90) -------------------------------------------------------- 2653 //----- (0048CD90) --------------------------------------------------------
2656 int Player::GetMeleeDamageMaximal() 2654 int Player::GetMeleeDamageMaximal()
2663 int v6; // esi@1 2661 int v6; // esi@1
2664 signed int result; // eax@1 2662 signed int result; // eax@1
2665 2663
2666 v1 = this; 2664 v1 = this;
2667 v2 = GetActualMight(); 2665 v2 = GetActualMight();
2668 v3 = _48EA1B_get_static_effect(v2); 2666 v3 = GetParameterBonus(v2);
2669 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0) + v3; 2667 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0) + v3;
2670 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; 2668 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4;
2671 v6 = v1->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; 2669 v6 = v1->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5;
2672 result = 1; 2670 result = 1;
2673 if ( v6 >= 1 ) 2671 if ( v6 >= 1 )
2866 LABEL_62: 2864 LABEL_62:
2867 v21 = v32 + v34; 2865 v21 = v32 + v34;
2868 if ( !a2 ) 2866 if ( !a2 )
2869 { 2867 {
2870 v22 = GetActualMight(); 2868 v22 = GetActualMight();
2871 v23 = _48EA1B_get_static_effect(v22); 2869 v23 = GetParameterBonus(v22);
2872 v24 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v23; 2870 v24 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v23;
2873 v21 += v5->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v24; 2871 v21 += v5->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v24;
2874 } 2872 }
2875 result = 1; 2873 result = 1;
2876 if ( v21 >= 1 ) 2874 if ( v21 >= 1 )
2892 v1 = this; 2890 v1 = this;
2893 v2 = *(int *)&this->pInventoryItems[this->pEquipment.uMainHand-1]; 2891 v2 = *(int *)&this->pInventoryItems[this->pEquipment.uMainHand-1];
2894 if ( v2 < 64 || v2 > 65 ) 2892 if ( v2 < 64 || v2 > 65 )
2895 { 2893 {
2896 v4 = GetActualAccuracy(); 2894 v4 = GetActualAccuracy();
2897 v5 = _48EA1B_get_static_effect(v4); 2895 v5 = GetParameterBonus(v4);
2898 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK, 0) + v5; 2896 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK, 0) + v5;
2899 v7 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v6; 2897 v7 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v6;
2900 v3 = v1->_ranged_atk_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v7; 2898 v3 = v1->_ranged_atk_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v7;
2901 } 2899 }
2902 else 2900 else
2915 int v4; // edi@1 2913 int v4; // edi@1
2916 unsigned __int16 v5; // ax@1 2914 unsigned __int16 v5; // ax@1
2917 int result; // eax@6 2915 int result; // eax@6
2918 2916
2919 v1 = this; 2917 v1 = this;
2920 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_MIN, 0); 2918 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_MIN, 0);
2921 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v2; 2919 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v2;
2922 v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v3; 2920 v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v3;
2923 v5 = v1->pActiveSkills[5]; 2921 v5 = v1->pActiveSkills[5];
2924 if ( v5 && (signed int)SkillToMastery(v5) >= 4 && HasItemEquipped(EQUIP_BOW) ) 2922 if ( v5 && (signed int)SkillToMastery(v5) >= 4 && HasItemEquipped(EQUIP_BOW) )
2925 v4 += v1->pActiveSkills[5] & 0x3F; 2923 v4 += v1->pActiveSkills[5] & 0x3F;
2926 if ( v4 >= 1 ) 2924 if ( v4 >= 1 )
2927 result = v4; 2925 result = v4;
2939 int v4; // edi@1 2937 int v4; // edi@1
2940 unsigned __int16 v5; // ax@1 2938 unsigned __int16 v5; // ax@1
2941 int result; // eax@6 2939 int result; // eax@6
2942 2940
2943 v1 = this; 2941 v1 = this;
2944 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_MAX, 0); 2942 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_MAX, 0);
2945 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v2; 2943 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v2;
2946 v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v3; 2944 v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v3;
2947 v5 = v1->pActiveSkills[5]; 2945 v5 = v1->pActiveSkills[5];
2948 if ( v5 && (signed int)SkillToMastery(v5) >= 4 && HasItemEquipped(EQUIP_BOW) ) 2946 if ( v5 && (signed int)SkillToMastery(v5) >= 4 && HasItemEquipped(EQUIP_BOW) )
2949 v4 += v1->pActiveSkills[5] & 0x3F; 2947 v4 += v1->pActiveSkills[5] & 0x3F;
2950 if ( v4 >= 1 ) 2948 if ( v4 >= 1 )
2951 result = v4; 2949 result = v4;
3036 } 3034 }
3037 3035
3038 //----- (0048D2EA) -------------------------------------------------------- 3036 //----- (0048D2EA) --------------------------------------------------------
3039 char *Player::GetMeleeDamageString() 3037 char *Player::GetMeleeDamageString()
3040 { 3038 {
3041 Player *v1; // esi@1 3039 signed int itemid; // eax@1
3042 signed int v2; // eax@1 3040 int min_damage; // edi@3
3043 signed int v3; // edi@3 3041 int max_damage; // eax@3
3044 signed int v4; // eax@3
3045 signed int v5; // ST0C_4@6
3046 char *v6; // edi@6
3047 signed int v7; // ST08_4@7
3048 unsigned int v8; // eax@8
3049 signed int v9; // esi@9
3050 3042
3051 static char player__getmeleedamagestring_static_buff[40]; // idb 3043 static char player__getmeleedamagestring_static_buff[40]; // idb
3052 3044
3053 v1 = this; 3045 if ( pEquipment.uMainHand)
3054 v2 = *(int *)&this->pInventoryItems[this->pEquipment.uMainHand-1]; 3046 {
3055 if ( v2 < 64 || v2 > 65 ) 3047 itemid= pOwnItems[this->pEquipment.uMainHand-1].uItemID;
3056 { 3048 if ( itemid < 64 || itemid > 65 ) //blasters
3057 v3 = GetMeleeDamageMinimal(); 3049 {
3058 v4 = GetMeleeDamageMaximal(); 3050 min_damage = GetMeleeDamageMinimal();
3059 } 3051 max_damage = GetMeleeDamageMaximal();
3052 }
3053 else
3054 { //for blasters
3055 min_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0);
3056 max_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0);
3057 }
3058 if ( max_damage )
3059 {
3060 if ( min_damage == max_damage )
3061 {
3062 sprintf(player__getmeleedamagestring_static_buff, "%d", min_damage);
3063 }
3064 else
3065 {
3066 sprintf(player__getmeleedamagestring_static_buff, "%d - %d", min_damage, max_damage);
3067 }
3068 }
3069 else
3070 {
3071 strcpy(player__getmeleedamagestring_static_buff, "N/A");
3072 }
3073
3074 if (( itemid >= 135 )&&( itemid <= 159 )) //wands
3075 {
3076 strcpy(player__getmeleedamagestring_static_buff, pGlobalTXT_LocalizationStrings[595]); //"Wand"
3077 }
3078 }
3060 else 3079 else
3061 { 3080 strcpy(player__getmeleedamagestring_static_buff, "N/A");
3062 v3 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0); 3081 return player__getmeleedamagestring_static_buff;
3063 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0);
3064 }
3065 if ( v3 == v4 )
3066 {
3067 v5 = v3;
3068 v6 = player__getmeleedamagestring_static_buff;
3069 sprintf(player__getmeleedamagestring_static_buff, "%d", v5);
3070 }
3071 else
3072 {
3073 v7 = v3;
3074 v6 = player__getmeleedamagestring_static_buff;
3075 sprintf(player__getmeleedamagestring_static_buff, "%d - %d", v7, v4);
3076 }
3077 v8 = v1->pEquipment.uMainHand;
3078 if ( v8 )
3079 {
3080 v9 = *(int *)&v1->pInventoryItems[v8-1];
3081 if ( v9 >= 135 )
3082 {
3083 if ( v9 <= 159 )
3084 strcpy(v6, pGlobalTXT_LocalizationStrings[595]);
3085 }
3086 }
3087 return v6;
3088 } 3082 }
3089 3083
3090 //----- (0048D396) -------------------------------------------------------- 3084 //----- (0048D396) --------------------------------------------------------
3091 char *Player::GetRangedDamageString() 3085 char *Player::GetRangedDamageString()
3092 { 3086 {
3093 Player *v1; // esi@1 3087 signed int itemid; // eax@1
3094 signed int v2; // eax@1 3088 int min_damage; // edi@3
3095 int v3; // edi@3 3089 int max_damage; // eax@3
3096 int v4; // eax@3 3090
3097 char *v5; // edi@6 3091 static char player__getrangeddamagestring_static_buff[40]; // idb
3098 int v6; // ST0C_4@8 3092 if ( pEquipment.uMainHand)
3099 int v7; // ST08_4@9 3093 {
3100 unsigned int v8; // eax@10 3094 itemid= pOwnItems[this->pEquipment.uMainHand-1].uItemID;
3101 signed int v9; // esi@11 3095 if ( itemid < 64 || itemid > 65 ) //blasters
3102 3096 {
3103 static char player__getrangeddamagestring_static_buff[40]; // idb 3097 min_damage = GetRangedDamageMin();
3104 3098 max_damage = GetRangedDamageMax();
3105 v1 = this; 3099 }
3106 v2 = *(int *)&this->pInventoryItems[this->pEquipment.uMainHand-1]; 3100 else
3107 if ( v2 < 64 || v2 > 65 ) 3101 { //for blasters
3108 { 3102 min_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 1);
3109 v3 = GetRangedDamageMin(); 3103 max_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 1);
3110 v4 = GetRangedDamageMax(); 3104 }
3111 } 3105 if ( max_damage )
3112 else 3106 {
3113 { 3107 if ( min_damage == max_damage )
3114 v3 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 1); 3108 {
3115 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 1); 3109 sprintf(player__getrangeddamagestring_static_buff, "%d", min_damage);
3116 } 3110 }
3117 if ( v4 ) 3111 else
3118 { 3112 {
3119 if ( v3 == v4 ) 3113 sprintf(player__getrangeddamagestring_static_buff, "%d - %d", min_damage, max_damage);
3120 { 3114 }
3121 v6 = v3; 3115 }
3122 v5 = player__getrangeddamagestring_static_buff; 3116 else
3123 sprintf(player__getrangeddamagestring_static_buff, "%d", v6); 3117 {
3124 } 3118 strcpy(player__getrangeddamagestring_static_buff, "N/A");
3119 }
3120
3121 if (( itemid >= 135 )&&( itemid <= 159 )) //wands
3122 {
3123 strcpy(player__getrangeddamagestring_static_buff, pGlobalTXT_LocalizationStrings[595]); //"Wand"
3124 }
3125 }
3125 else 3126 else
3126 { 3127 strcpy(player__getrangeddamagestring_static_buff, "N/A");
3127 v7 = v3; 3128 return player__getrangeddamagestring_static_buff;
3128 v5 = player__getrangeddamagestring_static_buff; 3129 }
3129 sprintf(player__getrangeddamagestring_static_buff, "%d - %d", v7, v4);
3130 }
3131 }
3132 else
3133 {
3134 v5 = player__getrangeddamagestring_static_buff;
3135 strcpy(player__getrangeddamagestring_static_buff, "N/A");
3136 }
3137 v8 = v1->pEquipment.uMainHand;
3138 if ( v8 )
3139 {
3140 v9 = *(int *)&v1->pInventoryItems[v8-1];
3141 if ( v9 >= 135 )
3142 {
3143 if ( v9 <= 159 )
3144 strcpy(v5, pGlobalTXT_LocalizationStrings[595]);
3145 }
3146 }
3147 return v5;
3148 }
3149 3130
3150 //----- (0048D45A) -------------------------------------------------------- 3131 //----- (0048D45A) --------------------------------------------------------
3151 bool Player::CanTrainToNextLevel() 3132 bool Player::CanTrainToNextLevel()
3152 { 3133 {
3153 int v1; // edx@1 3134 int v1; // edx@1
3172 result = ui_character_default_text_color; 3153 result = ui_character_default_text_color;
3173 return result; 3154 return result;
3174 } 3155 }
3175 3156
3176 //----- (0048D4B3) -------------------------------------------------------- 3157 //----- (0048D4B3) --------------------------------------------------------
3177 int Player::CalculateIncommingDamage(int resistance, signed int type) 3158 int Player::CalculateIncommingDamage( DAMAGE_TYPE dmg_type, int amount )
3178 { 3159 {
3179 Player *v3; // esi@1 3160
3180 int v4; // edi@8 3161 int resist_value; // edi@8
3181 int v6; // eax@21 3162 int player_luck; // eax@21
3182 signed int v7; // ebx@21 3163 signed int res_rand_divider; // ebx@2
3183 int v8; // eax@22 3164 int armor_skill; // eax@29
3184 signed int v9; // ebx@22 3165 enum CHARACTER_ATTRIBUTE_TYPE player_resist; // [sp-4h] [bp-10h]@9
3185 int v10; // eax@23 3166 signed int result_amount_dmg; // [sp+8h] [bp-4h]@17
3186 signed int v11; // ebx@23 3167
3187 int v12; // eax@24 3168 player_resist=CHARACTER_ATTRIBUTE_STRENGTH;
3188 signed int v13; // edi@24 3169 switch(dmg_type)
3189 unsigned int v14; // eax@27 3170 {
3190 int v15; // eax@29 3171 case DMGT_FIRE: player_resist=CHARACTER_ATTRIBUTE_RESIST_FIRE; break;
3191 double v16; // st7@32 3172 case DMGT_ELECTR: player_resist=CHARACTER_ATTRIBUTE_RESIST_AIR; break;
3192 enum CHARACTER_ATTRIBUTE_TYPE v17; // [sp-4h] [bp-10h]@9 3173 case DMGT_COLD: player_resist=CHARACTER_ATTRIBUTE_RESIST_WATER; break;
3193 signed int v18; // [sp+8h] [bp-4h]@17 3174 case DMGT_3: player_resist=CHARACTER_ATTRIBUTE_RESIST_EARTH; break;
3194 3175
3195 v3 = this; 3176 case DMGT_SPIRIT: player_resist=CHARACTER_ATTRIBUTE_RESIST_SPIRIT;break;
3196 if ( !resistance ) 3177 case DMGT_MIND: player_resist=CHARACTER_ATTRIBUTE_RESIST_MIND; break;
3197 { 3178 case DMGT_BODY: player_resist=CHARACTER_ATTRIBUTE_RESIST_BODY; break;
3198 v17 = (CHARACTER_ATTRIBUTE_TYPE)10; 3179 }
3199 goto LABEL_16; 3180 if (player_resist)
3200 } 3181 resist_value = GetActualResistance(player_resist);
3201 if ( resistance == 1 ) 3182 else
3202 { 3183 resist_value = 0;
3203 v17 = (CHARACTER_ATTRIBUTE_TYPE)11; 3184
3204 goto LABEL_16; 3185 result_amount_dmg = amount;
3205 } 3186 if ( classType == PLAYER_CLASS_LICH && resist_value >= 200 )
3206 if ( resistance == 2 )
3207 {
3208 v17 = (CHARACTER_ATTRIBUTE_TYPE)12;
3209 goto LABEL_16;
3210 }
3211 if ( resistance == 3 )
3212 {
3213 v17 = (CHARACTER_ATTRIBUTE_TYPE)13;
3214 goto LABEL_16;
3215 }
3216 if ( resistance == 6 )
3217 {
3218 v17 = (CHARACTER_ATTRIBUTE_TYPE)33;
3219 goto LABEL_16;
3220 }
3221 if ( resistance == 7 )
3222 {
3223 v17 = (CHARACTER_ATTRIBUTE_TYPE)14;
3224 goto LABEL_16;
3225 }
3226 if ( resistance == 8 )
3227 {
3228 v17 = (CHARACTER_ATTRIBUTE_TYPE)15;
3229 LABEL_16:
3230 v4 = GetActualResistance(v17);
3231 goto LABEL_17;
3232 }
3233 v4 = 0;
3234 LABEL_17:
3235 v18 = type;
3236 if ( v3->classType == PLAYER_CLASS_LICH && v4 >= 200 )
3237 return 0; 3187 return 0;
3238 if ( v4 ) 3188 player_luck = GetActualLuck();
3239 { 3189 res_rand_divider = GetParameterBonus(player_luck) + resist_value + 30;
3240 v6 = GetActualLuck(); 3190
3241 v7 = _48EA1B_get_static_effect(v6) + v4 + 30; 3191 if ( resist_value )
3242 if ( rand() % v7 >= 30 ) 3192 {
3243 { 3193 if ( rand() % res_rand_divider >= 30 )
3244 v18 = type >> 1; 3194 {
3245 v8 = GetActualLuck(); 3195 result_amount_dmg = amount >> 1;
3246 v9 = _48EA1B_get_static_effect(v8) + v4 + 30; 3196 if ( rand() % res_rand_divider >= 30 )
3247 if ( rand() % v9 >= 30 ) 3197 {
3248 { 3198 result_amount_dmg = amount >> 2;
3249 v18 = type >> 2; 3199 if ( rand() % res_rand_divider >= 30 )
3250 v10 = GetActualLuck();
3251 v11 = _48EA1B_get_static_effect(v10) + v4 + 30;
3252 if ( rand() % v11 >= 30 )
3253 { 3200 {
3254 v18 = type >> 3; 3201 result_amount_dmg = amount >> 3;
3255 v12 = GetActualLuck(); 3202 if ( rand() % res_rand_divider >= 30 )
3256 v13 = _48EA1B_get_static_effect(v12) + v4 + 30; 3203 result_amount_dmg = amount >> 4;
3257 if ( rand() % v13 >= 30 )
3258 v18 = type >> 4;
3259 } 3204 }
3260 } 3205 }
3261 } 3206 }
3262 } 3207 }
3263 if ( resistance == 4 ) 3208 if (( dmg_type == DMGT_PHISYCAL )&&( pEquipment.uArmor ))
3264 { 3209 {
3265 v14 = v3->pEquipment.uArmor; 3210 if (!pOwnItems[pEquipment.uArmor-1].Broken())
3266 if ( v14 ) 3211 {
3267 { 3212 armor_skill = GetEquippedItemSkillType(EQUIP_ARMOUR);
3268 // if ( !(v3->field_1F5[36 * v14 + 15] & 2) ) 3213 if ( armor_skill==PLAYER_SKILL_PLATE )
3269 if (v3->pOwnItems[v14-1].uAttributes&2)
3270 {
3271 v15 = GetEquippedItemSkillType(EQUIP_ARMOUR) - 10;
3272 if ( v15 )
3273 { 3214 {
3274 if ( v15 != 1 || (signed int)SkillToMastery(v3->pActiveSkills[11]) < 3 ) 3215 if ( SkillToMastery(pActiveSkills[PLAYER_SKILL_PLATE]) >= 3 )
3275 return v18; 3216 return (int)(double)result_amount_dmg * 0.5;
3276 v16 = (double)v18 * 0.5;
3277 return (signed __int64)v16;
3278 } 3217 }
3279 if ( (signed int)SkillToMastery(v3->pActiveSkills[10]) >= 4 ) 3218 if (armor_skill==PLAYER_SKILL_CHAIN )
3280 { 3219 {
3281 v16 = (double)v18 * 0.66670001; 3220 if (SkillToMastery(pActiveSkills[PLAYER_SKILL_CHAIN]) == 4)
3282 return (signed __int64)v16; 3221 return (int)(double)result_amount_dmg * 0.66670001;
3283 } 3222 }
3284 } 3223 }
3285 } 3224 }
3286 } 3225 return result_amount_dmg;
3287 return v18;
3288 } 3226 }
3289 3227
3290 //----- (0048D62C) -------------------------------------------------------- 3228 //----- (0048D62C) --------------------------------------------------------
3291 ITEM_EQUIP_TYPE Player::GetEquippedItemEquipType(ITEM_EQUIP_TYPE uEquipSlot) 3229 ITEM_EQUIP_TYPE Player::GetEquippedItemEquipType(ITEM_EQUIP_TYPE uEquipSlot)
3292 { 3230 {
3309 //----- (0048D6AA) -------------------------------------------------------- 3247 //----- (0048D6AA) --------------------------------------------------------
3310 bool Player::HasItemEquipped(ITEM_EQUIP_TYPE uEquipIndex) 3248 bool Player::HasItemEquipped(ITEM_EQUIP_TYPE uEquipIndex)
3311 { 3249 {
3312 auto i = pEquipment.pIndices[uEquipIndex]; 3250 auto i = pEquipment.pIndices[uEquipIndex];
3313 if (i) 3251 if (i)
3314 return ~pInventoryItems[i - 1].uAttributes & 0x02; 3252 return ~(pInventoryItems[i - 1].uAttributes & ITEM_BROKEN);
3315 else return false; 3253 else
3254 return false;
3316 } 3255 }
3317 3256
3318 //----- (0048D6D0) -------------------------------------------------------- 3257 //----- (0048D6D0) --------------------------------------------------------
3319 bool Player::HasEnchantedItemEquipped(int uEnchantment) 3258 bool Player::HasEnchantedItemEquipped(int uEnchantment)
3320 { 3259 {
3586 } 3525 }
3587 } 3526 }
3588 } 3527 }
3589 3528
3590 //----- (0048DC1E) -------------------------------------------------------- 3529 //----- (0048DC1E) --------------------------------------------------------
3591 int Player::ReceiveDamage(signed int type, int resistance) 3530 int Player::ReceiveDamage( signed int amount, DAMAGE_TYPE dmg_type )
3592 { 3531 {
3593 Player *v3; // esi@1 3532 signed int recieved_dmg; // eax@1
3594 signed int v4; // eax@1 3533 unsigned int armor_indx; // eax@8
3595 int v5; // eax@1 3534 bool broke_armor;
3596 bool v6; // ebx@1 3535
3597 unsigned int v7; // eax@8 3536 pConditions[Condition_Sleep] = 0i64;
3598 char *v8; // ecx@9 3537 recieved_dmg = CalculateIncommingDamage(dmg_type, amount);
3599 int v9; // eax@9 3538 sHealth -= recieved_dmg;
3600 //signed int typea; // [sp+14h] [bp+8h]@1 3539 broke_armor = sHealth <= -10;
3601 3540 if ( sHealth < 1 ) //
3602 v3 = this; 3541 {
3603 this->pConditions[Condition_Sleep] = 0i64; 3542 if ( (sHealth + uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1)
3604 v4 = CalculateIncommingDamage(resistance, type); 3543 || pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime > 0i64 )
3605 v3->sHealth -= v4;
3606 //typea = v4;
3607 v5 = v3->sHealth;
3608 v6 = v5 < -10;
3609 LOBYTE(v6) = v5 <= -10;
3610 if ( v5 < 1 )
3611 {
3612 if ( v3->sHealth + v3->uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1
3613 || (signed __int64)v3->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime > 0 )
3614 { 3544 {
3615 SetCondition(Condition_Unconcious, 0); 3545 SetCondition(Condition_Unconcious, 0);
3616 } 3546 }
3617 else 3547 else
3618 { 3548 {
3619 SetCondition(Condition_Dead, 0); 3549 SetCondition(Condition_Dead, 0);
3620 v6 = LODWORD(pParty->uTimePlayed); 3550 //v6 = LODWORD(pParty->uTimePlayed); ???? if equals 0 do not broke armor?
3621 if ( v3->sHealth > 0 ) 3551 if ( sHealth > 0 )
3622 v3->sHealth = 0; 3552 sHealth = 0;
3623 } 3553 }
3624 if ( v6 ) 3554 if (broke_armor )
3625 { 3555 {
3626 v7 = v3->pEquipment.uArmor; 3556 armor_indx = pEquipment.uArmor;
3627 if ( v7 ) 3557 if ( armor_indx )
3628 { 3558 {
3629 // v8 = &v3->field_1F5[36 * v7 + 15]; 3559 if ( !pOwnItems[armor_indx-1].uAttributes & ITEM_ENCHANTED)
3630 v8=(char*)&v3->pOwnItems[v7-1].uAttributes;
3631 v9 = *(int *)v8;
3632 if ( !(BYTE1(v9) & 2) )
3633 { 3560 {
3634 LOBYTE(v9) = v9 | 2; 3561 pOwnItems[armor_indx-1].uAttributes|=ITEM_BROKEN;
3635 *(int *)v8 = v9;
3636 } 3562 }
3637 } 3563 }
3638 } 3564 }
3639 } 3565 }
3640 if ( v4 && CanAct() ) 3566 if ( recieved_dmg && CanAct() )
3641 PlaySound(SPEECH_24, 0); 3567 PlaySound(SPEECH_24, 0);
3642 return v4; 3568 return recieved_dmg;
3643 } 3569 }
3644 3570
3645 //----- (0048DCF6) -------------------------------------------------------- 3571 //----- (0048DCF6) --------------------------------------------------------
3646 int Player::_48DCF6(int a2, Actor *pActor) 3572 int Player::_48DCF6(int a2, Actor *pActor)
3647 { 3573 {
3728 LABEL_5: 3654 LABEL_5:
3729 v7 = GetActualResistance(v40); 3655 v7 = GetActualResistance(v40);
3730 goto LABEL_47; 3656 goto LABEL_47;
3731 case 22: 3657 case 22:
3732 v8 = GetActualWillpower(); 3658 v8 = GetActualWillpower();
3733 v9 = _48EA1B_get_static_effect(v8); 3659 v9 = GetParameterBonus(v8);
3734 v10 = GetActualIntelligence(); 3660 v10 = GetActualIntelligence();
3735 v11 = (_48EA1B_get_static_effect(v10) + v9) >> 1; 3661 v11 = (GetParameterBonus(v10) + v9) >> 1;
3736 break; 3662 break;
3737 case 17: 3663 case 17:
3738 v12 = 0; 3664 v12 = 0;
3739 v13 = this->pInventoryItems; 3665 v13 = this->pInventoryItems;
3740 do 3666 do
3803 if ( !v4 ) 3729 if ( !v4 )
3804 goto LABEL_87; 3730 goto LABEL_87;
3805 v47 = (unsigned __int8)v46[rand() % v4]; 3731 v47 = (unsigned __int8)v46[rand() % v4];
3806 v6 = GetActualAccuracy(); 3732 v6 = GetActualAccuracy();
3807 LABEL_46: 3733 LABEL_46:
3808 v7 = _48EA1B_get_static_effect(v6); 3734 v7 = GetParameterBonus(v6);
3809 LABEL_47: 3735 LABEL_47:
3810 v11 = v7; 3736 v11 = v7;
3811 break; 3737 break;
3812 default: 3738 default:
3813 v11 = 0; 3739 v11 = 0;
3814 break; 3740 break;
3815 } 3741 }
3816 v22 = GetActualLuck(); 3742 v22 = GetActualLuck();
3817 v23 = _48EA1B_get_static_effect(v22) + v11 + 30; 3743 v23 = GetParameterBonus(v22) + v11 + 30;
3818 if ( rand() % v23 >= 30 ) 3744 if ( rand() % v23 >= 30 )
3819 { 3745 {
3820 LABEL_87: 3746 LABEL_87:
3821 result = 0; 3747 result = 0;
3822 } 3748 }
4108 4034
4109 uint shield_base_recovery = base_recovery_times_per_weapon_type[skill_type]; 4035 uint shield_base_recovery = base_recovery_times_per_weapon_type[skill_type];
4110 shield_recovery = shield_base_recovery * SkillToMastery(pActiveSkills[skill_type]); 4036 shield_recovery = shield_base_recovery * SkillToMastery(pActiveSkills[skill_type]);
4111 } 4037 }
4112 4038
4113 uint player_speed_recovery_reduction = _48EA1B_get_static_effect(GetActualSpeed()), 4039 uint player_speed_recovery_reduction = GetParameterBonus(GetActualSpeed()),
4114 sword_axe_bow_recovery_reduction = 0; 4040 sword_axe_bow_recovery_reduction = 0;
4115 bool shooting_laser = false; 4041 bool shooting_laser = false;
4116 if (weapon_desc) 4042 if (weapon_desc)
4117 { 4043 {
4118 if (GetActualSkillLevel((PLAYER_SKILL_TYPE)weapon_desc->uSkillType) && 4044 if (GetActualSkillLevel((PLAYER_SKILL_TYPE)weapon_desc->uSkillType) &&
4169 { 4095 {
4170 int v3; // esi@1 4096 int v3; // esi@1
4171 int v4; // esi@1 4097 int v4; // esi@1
4172 int v6; // esi@1 4098 int v6; // esi@1
4173 4099
4174 v3 = _48EA1B_get_static_effect(GetActualEndurance()); 4100 v3 = GetParameterBonus(GetActualEndurance());
4175 v4 = pBaseHealthPerLevelByClass[classType] * (GetActualLevel() + v3); 4101 v4 = pBaseHealthPerLevelByClass[classType] * (GetActualLevel() + v3);
4176 v6 = uFullHealthBonus 4102 v6 = uFullHealthBonus
4177 + pBaseHealthByClass[classType / 4] 4103 + pBaseHealthByClass[classType / 4]
4178 + GetSkillBonus(CHARACTER_ATTRIBUTE_HEALTH) 4104 + GetSkillBonus(CHARACTER_ATTRIBUTE_HEALTH)
4179 + GetItemsBonus(CHARACTER_ATTRIBUTE_HEALTH, 0) + v4; 4105 + GetItemsBonus(CHARACTER_ATTRIBUTE_HEALTH, 0) + v4;
4207 case 0x20u: 4133 case 0x20u:
4208 case 0x21u: 4134 case 0x21u:
4209 case 0x22u: 4135 case 0x22u:
4210 case 0x23u: 4136 case 0x23u:
4211 v2 = GetActualIntelligence(); 4137 v2 = GetActualIntelligence();
4212 v3 = _48EA1B_get_static_effect(v2); 4138 v3 = GetParameterBonus(v2);
4213 goto LABEL_6; 4139 goto LABEL_6;
4214 case 9u: 4140 case 9u:
4215 case 0xAu: 4141 case 0xAu:
4216 case 0xBu: 4142 case 0xBu:
4217 case 0xCu: 4143 case 0xCu:
4221 case 0x18u: 4147 case 0x18u:
4222 case 0x19u: 4148 case 0x19u:
4223 case 0x1Au: 4149 case 0x1Au:
4224 case 0x1Bu: 4150 case 0x1Bu:
4225 v2 = GetActualWillpower(); 4151 v2 = GetActualWillpower();
4226 v3 = _48EA1B_get_static_effect(v2); 4152 v3 = GetParameterBonus(v2);
4227 goto LABEL_6; 4153 goto LABEL_6;
4228 case 0x15u: 4154 case 0x15u:
4229 case 0x16u: 4155 case 0x16u:
4230 case 0x17u: 4156 case 0x17u:
4231 case 0x1Cu: 4157 case 0x1Cu:
4232 case 0x1Du: 4158 case 0x1Du:
4233 case 0x1Eu: 4159 case 0x1Eu:
4234 case 0x1Fu: 4160 case 0x1Fu:
4235 v4 = GetActualWillpower(); 4161 v4 = GetActualWillpower();
4236 v5 = _48EA1B_get_static_effect(v4); 4162 v5 = GetParameterBonus(v4);
4237 v6 = GetActualIntelligence(); 4163 v6 = GetActualIntelligence();
4238 v3 = _48EA1B_get_static_effect(v6) + v5; 4164 v3 = GetParameterBonus(v6) + v5;
4239 LABEL_6: 4165 LABEL_6:
4240 v7 = pBaseManaPerLevelByClass[classType] * (GetActualLevel() + v3); 4166 v7 = pBaseManaPerLevelByClass[classType] * (GetActualLevel() + v3);
4241 v8 = GetItemsBonus(CHARACTER_ATTRIBUTE_MANA, 0) + v7; 4167 v8 = GetItemsBonus(CHARACTER_ATTRIBUTE_MANA, 0) + v7;
4242 v9 = uFullManaBonus 4168 v9 = uFullManaBonus
4243 + pBaseManaByClass[classType / 4] 4169 + pBaseManaByClass[classType / 4]
4265 int v5; // esi@1 4191 int v5; // esi@1
4266 int result; // eax@2 4192 int result; // eax@2
4267 4193
4268 v1 = this; 4194 v1 = this;
4269 v2 = GetActualSpeed(); 4195 v2 = GetActualSpeed();
4270 v3 = _48EA1B_get_static_effect(v2); 4196 v3 = GetParameterBonus(v2);
4271 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; 4197 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3;
4272 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; 4198 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4;
4273 if ( v5 >= 1 ) 4199 if ( v5 >= 1 )
4274 result = v5; 4200 result = v5;
4275 else 4201 else
4288 int v6; // esi@1 4214 int v6; // esi@1
4289 int result; // eax@2 4215 int result; // eax@2
4290 4216
4291 v1 = this; 4217 v1 = this;
4292 v2 = GetActualSpeed(); 4218 v2 = GetActualSpeed();
4293 v3 = _48EA1B_get_static_effect(v2); 4219 v3 = GetParameterBonus(v2);
4294 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; 4220 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3;
4295 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; 4221 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4;
4296 v6 = v1->sACModifier + GetMagicalBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v5; 4222 v6 = v1->sACModifier + GetMagicalBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v5;
4297 if ( v6 >= 1 ) 4223 if ( v6 >= 1 )
4298 result = v6; 4224 result = v6;
4514 4440
4515 return 18; 4441 return 18;
4516 } 4442 }
4517 4443
4518 //----- (0048EA1B) -------------------------------------------------------- 4444 //----- (0048EA1B) --------------------------------------------------------
4519 int Player::_48EA1B_get_static_effect(int a2) 4445 int Player::GetParameterBonus( int player_parameter )
4520 { 4446 {
4521 __int16 v2; // cx@1 4447 int i; // eax@1
4522 int v3; // eax@1 4448 i = 0;
4523 4449 while (param_to_bonus_table[i])
4524 v2 = word_4EDFFC[0]; 4450 {
4525 v3 = 0; 4451 if (player_parameter >= param_to_bonus_table[i])
4526 while ( a2 < v2 && v2 ) 4452 break;
4527 v2 = word_4EDFFC[v3++ + 1]; 4453 ++i;
4528 return player_stat_bonuses[v3]; 4454 }
4455 return parameter_to_bonus_value[i];
4529 } 4456 }
4530 4457
4531 //----- (0048EA46) -------------------------------------------------------- 4458 //----- (0048EA46) --------------------------------------------------------
4532 int Player::_48EA46_calc_special_bonus_by_items(int a2) 4459 int Player::_48EA46_calc_special_bonus_by_items(int a2)
4533 { 4460 {
4534 int v3; // esi@1 4461 int inv_indx; // eax@3
4535 int v4; // edx@2 4462
4536 int v5; // eax@3 4463 for (int i=EQUIP_OFF_HAND; i<EQUIP_BOOK; ++i )
4537 char *v6; // eax@4 4464 {
4538 4465 if ( !HasItemEquipped((ITEM_EQUIP_TYPE)i) )
4539 v3 = 0; 4466 continue;
4540 while ( 1 ) 4467 inv_indx = pEquipment.pIndices[i] - 1;
4541 { 4468 if (a2==17)
4542 if ( !HasItemEquipped((ITEM_EQUIP_TYPE)v3) ) 4469 {
4543 goto LABEL_11; 4470 if ((pInventoryItems[inv_indx].uSpecEnchantmentType==17)||(pInventoryItems[inv_indx].uItemID=533)) //Elven Chainmail+Increases rate of Recovery
4544 v5 = pEquipment.pIndices[v3] - 1; 4471 return 50;
4545 if ( a2 != 17 ) 4472 }
4546 { 4473 if (a2==24)
4547 if ( a2 != 24 || this->pInventoryItems[v5].uSpecEnchantmentType != 24 ) 4474 {
4548 goto LABEL_11; 4475 if (pInventoryItems[inv_indx].uSpecEnchantmentType==24) //Increased Knockback.
4549 return 5; 4476 return 5;
4550 } 4477 }
4551 v6 = (char *)this + 36 * v5; 4478 }
4552 if ( *((int *)v6 + 133) == 533 || *((int *)v6 + 136) == 17 ) 4479 return 0;
4553 return 50;
4554 LABEL_11:
4555 ++v3;
4556 if ( (signed int)v3 >= 16 )
4557 return 0;
4558 }
4559 } 4480 }
4560 4481
4561 //----- (0048EAAE) -------------------------------------------------------- 4482 //----- (0048EAAE) --------------------------------------------------------
4562 int Player::GetItemsBonus(CHARACTER_ATTRIBUTE_TYPE attr, int a3) 4483 int Player::GetItemsBonus(CHARACTER_ATTRIBUTE_TYPE attr, int a3)
4563 { 4484 {
4564 CHARACTER_ATTRIBUTE_TYPE v3; // esi@1 4485 CHARACTER_ATTRIBUTE_TYPE v3; // esi@1
4565 signed int v4; // eax@1 4486 // signed int v4; // eax@1
4566 int v5; // edi@1 4487 int v5; // edi@1
4567 Player *v6; // ebx@1 4488 Player *v6; // ebx@1
4568 Player *v8; // ecx@48 4489 Player *v8; // ecx@48
4569 int v9; // eax@49 4490 int v9; // eax@49
4570 int v10; // edx@49 4491 int v10; // edx@49
4621 int v61; // [sp+10h] [bp-Ch]@1 4542 int v61; // [sp+10h] [bp-Ch]@1
4622 int v62; // [sp+14h] [bp-8h]@1 4543 int v62; // [sp+14h] [bp-8h]@1
4623 int v63; // [sp+18h] [bp-4h]@101 4544 int v63; // [sp+18h] [bp-4h]@101
4624 ItemGen *attra; // [sp+20h] [bp+4h]@101 4545 ItemGen *attra; // [sp+20h] [bp+4h]@101
4625 unsigned int v65; // [sp+24h] [bp+8h]@95 4546 unsigned int v65; // [sp+24h] [bp+8h]@95
4547 bool no_skills;
4626 4548
4627 v3 = attr; 4549 v3 = attr;
4628 v4 = 36;
4629 v5 = 0; 4550 v5 = 0;
4630 v6 = this; 4551 v6 = this;
4631 v62 = 0; 4552 v62 = 0;
4632 v61 = 0; 4553 v61 = 0;
4633 4554
4555
4556 no_skills=false;
4634 switch (attr) 4557 switch (attr)
4635 { 4558 {
4636 case CHARACTER_ATTRIBUTE_LEVEL: 4559 case CHARACTER_ATTRIBUTE_SKILL_ALCHEMY: v58 = PLAYER_SKILL_ALCHEMY; break;
4637 if (HasEnchantedItemEquipped(25)) 4560 case CHARACTER_ATTRIBUTE_SKILL_STEALING: v58 = PLAYER_SKILL_STEALING; break;
4638 return 5; 4561 case CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM: v58 = PLAYER_SKILL_TRAP_DISARM; break;
4639 return 0; 4562 case CHARACTER_ATTRIBUTE_SKILL_ITEM_ID: v58 = PLAYER_SKILL_ITEM_ID; break;
4640 }; 4563 case CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID: v58 = PLAYER_SKILL_MONSTER_ID; break;
4641 4564 case CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER: v58 = PLAYER_SKILL_ARMSMASTER; break;
4642 if ( (signed int)attr > 36 ) 4565 case CHARACTER_ATTRIBUTE_SKILL_DODGE: v58 = PLAYER_SKILL_DODGE; break;
4643 { 4566 case CHARACTER_ATTRIBUTE_SKILL_UNARMED: v58 = PLAYER_SKILL_UNARMED; break;
4644 switch ( attr ) 4567 case CHARACTER_ATTRIBUTE_SKILL_FIRE: v58 = PLAYER_SKILL_FIRE; break;
4645 { 4568 case CHARACTER_ATTRIBUTE_SKILL_AIR: v58 = PLAYER_SKILL_AIR; break;
4646 case 37: 4569 case CHARACTER_ATTRIBUTE_SKILL_WATER: v58 = PLAYER_SKILL_WATER; break;
4647 v58 = 15; 4570 case CHARACTER_ATTRIBUTE_SKILL_EARTH: v58 = PLAYER_SKILL_EARTH; break;
4648 goto LABEL_35; 4571 case CHARACTER_ATTRIBUTE_SKILL_SPIRIT: v58 = PLAYER_SKILL_SPIRIT; break;
4649 case 38: 4572 case CHARACTER_ATTRIBUTE_SKILL_MIND: v58 = PLAYER_SKILL_MIND; break;
4650 v58 = 16; 4573 case CHARACTER_ATTRIBUTE_SKILL_BODY: v58 = PLAYER_SKILL_BODY; break;
4651 goto LABEL_35; 4574 case CHARACTER_ATTRIBUTE_SKILL_LIGHT: v58 = PLAYER_SKILL_LIGHT; break;
4652 case 39: 4575 case CHARACTER_ATTRIBUTE_SKILL_DARK: v58 = PLAYER_SKILL_DARK; break;
4653 v58 = 17; 4576 case CHARACTER_ATTRIBUTE_SKILL_MEDITATION: v58 = PLAYER_SKILL_MEDITATION; break;
4654 goto LABEL_35; 4577 case CHARACTER_ATTRIBUTE_SKILL_BOW: v58 = PLAYER_SKILL_BOW; break;
4655 case 40: 4578 case CHARACTER_ATTRIBUTE_SKILL_SHIELD: v58 = PLAYER_SKILL_SHIELD; break;
4656 v58 = 18; 4579 case CHARACTER_ATTRIBUTE_SKILL_LEARNING: v58 = PLAYER_SKILL_LEARNING; break;
4657 goto LABEL_35; 4580 default:
4658 case 41: 4581 no_skills=true;
4659 v58 = 19; 4582 }
4660 goto LABEL_35; 4583 if (!no_skills)
4661 case 42: 4584 {
4662 v58 = 20; 4585 if ( !this->pActiveSkills[v58] )
4663 goto LABEL_35; 4586 return 0;
4664 case 43: 4587 }
4665 v58 = 25; 4588
4666 goto LABEL_35;
4667 case 44:
4668 v58 = 5;
4669 goto LABEL_35;
4670 case 45:
4671 v58 = 8;
4672 goto LABEL_35;
4673 case 46:
4674 goto LABEL_36;
4675 default:
4676 break;
4677 }
4678 }
4679 else
4680 {
4681 if ( attr == 36 )
4682 {
4683 v58 = 14;
4684 }
4685 else
4686 {
4687 if ( (signed int)attr > 21 )
4688 {
4689 switch ( attr )
4690 {
4691 case 22:
4692 v58 = 30;
4693 break;
4694 case 23:
4695 v58 = 31;
4696 break;
4697 case 34:
4698 v58 = 12;
4699 break;
4700 default:
4701 if ( attr != 35 )
4702 goto LABEL_38;
4703 v58 = 13;
4704 break;
4705 }
4706 }
4707 else
4708 {
4709 switch ( attr )
4710 {
4711 case 21:
4712 v58 = 33;
4713 break;
4714 case 16:
4715 v58 = 35;
4716 break;
4717 case 17:
4718 v58 = 34;
4719 break;
4720 case 18:
4721 v58 = 29;
4722 break;
4723 case 19:
4724 v58 = 21;
4725 break;
4726 default:
4727 if ( attr != 20 )
4728 goto LABEL_38;
4729 v58 = 32;
4730 break;
4731 }
4732 }
4733 }
4734 LABEL_35:
4735 v4 = v58;
4736 LABEL_36:
4737 if ( !this->pActiveSkills[v4] )
4738 return 0;
4739 }
4740 LABEL_38:
4741 if ( (signed int)attr > 28 ) 4589 if ( (signed int)attr > 28 )
4742 { 4590 {
4743 if ( (signed int)attr < 29 ) 4591 if ( (signed int)attr < 29 )
4744 return v5 + v62 + v61; 4592 return v5 + v62 + v61;
4745 if ( (signed int)attr <= 30 ) 4593 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS )
4746 { 4594 {
4747 if ( HasItemEquipped(EQUIP_BOW) ) 4595 if ( HasItemEquipped(EQUIP_BOW) )
4748 v5 = pItemsTable->pItems[*(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1]].uDamageMod; 4596 v5 = pItemsTable->pItems[v6->pOwnItems[v6->pEquipment.uBow-1].uItemID].uDamageMod;
4749 return v5 + v62 + v61; 4597 return v5 + v62 + v61;
4750 } 4598 }
4751 if ( attr == 31 ) 4599 if ( attr == CHARACTER_ATTRIBUTE_RANGED_DMG_MIN )
4752 { 4600 {
4753 if ( !HasItemEquipped(EQUIP_BOW) ) 4601 if ( !HasItemEquipped(EQUIP_BOW) )
4754 return v5 + v62 + v61; 4602 return v5 + v62 + v61;
4755 v57 = *(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1]; 4603 v57 = v6->pOwnItems[v6->pEquipment.uBow-1].uItemID;
4756 v5 = pItemsTable->pItems[v57].uDamageMod; 4604 v5 = pItemsTable->pItems[v57].uDamageMod;
4757 v56 = pItemsTable->pItems[v57].uDamageDice; 4605 v56 = pItemsTable->pItems[v57].uDamageDice;
4758 goto LABEL_366; 4606 v5 += v56;
4759 } 4607 return v5 + v62 + v61;
4760 if ( attr == 32 ) 4608 }
4609 if ( attr == CHARACTER_ATTRIBUTE_RANGED_DMG_MAX )
4761 { 4610 {
4762 if ( !HasItemEquipped(EQUIP_BOW) ) 4611 if ( !HasItemEquipped(EQUIP_BOW) )
4763 return v5 + v62 + v61; 4612 return v5 + v62 + v61;
4764 v20 = *(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1]; 4613 v20 = v6->pOwnItems[v6->pEquipment.uBow-1].uItemID;
4765 v5 = pItemsTable->pItems[v20].uDamageDice * pItemsTable->pItems[v20].uDamageRoll; 4614 v5 = pItemsTable->pItems[v20].uDamageDice * pItemsTable->pItems[v20].uDamageRoll;
4766 LABEL_365: 4615 LABEL_365:
4767 v56 = pItemsTable->pItems[v20].uDamageMod; 4616 v56 = pItemsTable->pItems[v20].uDamageMod;
4768 LABEL_366: 4617 LABEL_366:
4769 v5 += v56; 4618 v5 += v56;
5335 ++v65; 5184 ++v65;
5336 if ( (signed int)v65 >= 16 ) 5185 if ( (signed int)v65 >= 16 )
5337 return v5 + v62 + v61; 5186 return v5 + v62 + v61;
5338 } 5187 }
5339 } 5188 }
5340 if ( attr == 28 ) 5189 if ( attr == CHARACTER_ATTRIBUTE_MELEE_DMG_MAX )
5341 { 5190 {
5342 if ( IsUnarmed() != 1 ) 5191 if ( IsUnarmed() != 1 )
5343 { 5192 {
5344 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) 5193 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) )
5345 { 5194 {
5346 v22 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); 5195 v22 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND);
5347 if ( v22 >= 0 ) 5196 if ( v22 >= 0 )
5348 { 5197 {
5349 if ( v22 <= 2 ) 5198 if ( v22 <= 2 )
5350 { 5199 {
5351 v23 = this->pInventoryItems[this->pEquipment.uMainHand].uItemID; 5200 v23 = this->pOwnItems[this->pEquipment.uMainHand].uItemID;
5352 if ( v6->pEquipment.uShield || pItemsTable->pItems[v23].uSkillType != 4 ) 5201 if ( v6->pEquipment.uShield || pItemsTable->pItems[v23].uSkillType != 4 )
5353 { 5202 {
5354 v24 = v23; 5203 v24 = v23;
5355 v26 = pItemsTable->pItems[v23].uDamageRoll; 5204 v26 = pItemsTable->pItems[v23].uDamageRoll;
5356 v25 = pItemsTable->pItems[v23].uDamageDice; 5205 v25 = pItemsTable->pItems[v23].uDamageDice;
5362 } 5211 }
5363 v5 = pItemsTable->pItems[v24].uDamageMod + v25 * v26; 5212 v5 = pItemsTable->pItems[v24].uDamageMod + v25 * v26;
5364 } 5213 }
5365 } 5214 }
5366 } 5215 }
5367 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v28 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v28 < 0) || v28 > 2 ) 5216
5368 return v5 + v62 + v61; 5217 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) )
5218 {
5219
5220 v28 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND);
5221 if ((v28 < 0) || v28 > 2 )
5222 return v5 + v62 + v61;
5223 }
5369 v15 = pItemsTable->pItems[v29].uDamageMod; 5224 v15 = pItemsTable->pItems[v29].uDamageMod;
5370 v14 = pItemsTable->pItems[v29].uDamageDice * pItemsTable->pItems[v29].uDamageRoll; 5225 v14 = pItemsTable->pItems[v29].uDamageDice * pItemsTable->pItems[v29].uDamageRoll;
5371 goto LABEL_88; 5226 v5 += v15 + v14;
5227 return v5 + v62 + v61
5372 } 5228 }
5373 v59 = 3; 5229 v59 = 3;
5374 LABEL_74: 5230 LABEL_74:
5375 v5 = v59; 5231 v5 = v59;
5376 return v5 + v62 + v61; 5232 return v5 + v62 + v61;
5377 } 5233 }
5378 if ( (signed int)attr < 0 ) 5234 if ( (signed int)attr < 0 )
5379 return v5 + v62 + v61; 5235 return v5 + v62 + v61;
5380 if ( (signed int)attr <= 23 ) 5236 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_SKILL_UNARMED )
5381 goto LABEL_95; 5237 goto LABEL_95;
5382 if ( (signed int)attr <= 24 ) 5238 if ( attr == CHARACTER_ATTRIBUTE_LEVEL )
5239 {
5240 if ( !Player::HasEnchantedItemEquipped(25) )
5241 return v5 + v62 + v61;
5242 v5 = 5;
5243 return v5 + v62 + v61;
5244 }
5245 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_LEVEL )
5383 return v5 + v62 + v61; 5246 return v5 + v62 + v61;
5384 if ( (signed int)attr <= 26 ) 5247 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS )
5385 { 5248 {
5386 if ( IsUnarmed() == 1 ) 5249 if ( IsUnarmed() == 1 )
5387 { 5250 {
5388 v5 = 0; 5251 v5 = 0;
5389 return v5 + v62 + v61; 5252 return v5 + v62 + v61;
5392 { 5255 {
5393 v17 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); 5256 v17 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND);
5394 if ( v17 >= 0 ) 5257 if ( v17 >= 0 )
5395 { 5258 {
5396 if ( v17 <= 2 ) 5259 if ( v17 <= 2 )
5397 v5 = pItemsTable->pItems[*(int *)&v6->pInventoryItems[v6->pEquipment.uMainHand-1]].uDamageMod; 5260 v5 = pItemsTable->pItems[v6->pOwnItems[v6->pEquipment.uMainHand-1].uItemID].uDamageMod;
5398 } 5261 }
5399 } 5262 }
5400 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v19 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v19 < 0) || v19 > 2 ) 5263 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v19 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v19 < 0) || v19 > 2 )
5401 return v5 + v62 + v61; 5264 return v5 + v62 + v61;
5402 v20 = *(int *)&v6->pInventoryItems[v6->pEquipment.uShield - 1]; 5265 v20 = v6->pOwnItems[v6->pEquipment.uShield - 1].uItemID;
5403 goto LABEL_365; 5266 v56 = pItemsTable->pItems[v20].uDamageMod;
5404 } 5267 v5 += v56;
5405 if ( attr == 27 ) 5268 return v5 + v62 + v61;
5269 }
5270 if ( attr == CHARACTER_ATTRIBUTE_MELEE_DMG_MIN )
5406 { 5271 {
5407 if ( IsUnarmed() == 1 ) 5272 if ( IsUnarmed() == 1 )
5408 { 5273 {
5409 v5 = 1; 5274 v5 = 1;
5410 return v5 + v62 + v61; 5275 return v5 + v62 + v61;
5414 v9 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); 5279 v9 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND);
5415 if ( v9 >= 0 ) 5280 if ( v9 >= 0 )
5416 { 5281 {
5417 if ( v9 <= 2 ) 5282 if ( v9 <= 2 )
5418 { 5283 {
5419 v5 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uDamageDice + 5284 v5 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uDamageDice +
5420 pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uDamageMod; 5285 pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uDamageMod;
5421 if ( !v6->pEquipment.uShield ) 5286 if ( !v6->pEquipment.uShield )
5422 { 5287 {
5423 if ( pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uSkillType == 4 ) 5288 if ( pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uSkillType == 4 )
5424 ++v5; 5289 ++v5;
5425 } 5290 }
5426 } 5291 }
5427 } 5292 }
5428 } 5293 }
5429 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v12 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v12 < 0) || v12 > 2 ) 5294
5430 return v5 + v62 + v61; 5295 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND))
5431 v14 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uShield].uItemID].uDamageMod; 5296 {
5432 v15 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uShield].uItemID].uDamageDice; 5297 v12 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND);
5298 if ((v12 < 0) || v12 > 2 )
5299 return v5 + v62 + v61;
5300 }
5301 v14 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uShield].uItemID].uDamageMod;
5302 v15 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uShield].uItemID].uDamageDice;
5433 LABEL_88: 5303 LABEL_88:
5434 v5 += v15 + v14; 5304 v5 += v15 + v14;
5435 } 5305 }
5436 return v5 + v62 + v61; 5306 return v5 + v62 + v61;
5437 } 5307 }
5553 { 5423 {
5554 if ( CheckHiredNPCSpeciality(Hunter) ) 5424 if ( CheckHiredNPCSpeciality(Hunter) )
5555 v2 = 6; 5425 v2 = 6;
5556 if ( CheckHiredNPCSpeciality(Sage) ) 5426 if ( CheckHiredNPCSpeciality(Sage) )
5557 v2 += 6; 5427 v2 += 6;
5558 v8 = (CHARACTER_ATTRIBUTE_TYPE)20; 5428 v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID, 0);
5559 v2 += GetItemsBonus(v8, 0);
5560 } 5429 }
5561 break; 5430 break;
5562 5431
5563 case PLAYER_SKILL_ARMSMASTER: 5432 case PLAYER_SKILL_ARMSMASTER:
5564 { 5433 {
5565 if ( CheckHiredNPCSpeciality(Armsmaster) ) 5434 if ( CheckHiredNPCSpeciality(Armsmaster) )
5566 v2 = 2; 5435 v2 = 2;
5567 if ( CheckHiredNPCSpeciality(Weaponsmaster) ) 5436 if ( CheckHiredNPCSpeciality(Weaponsmaster) )
5568 v2 += 3; 5437 v2 += 3;
5569 v8 = (CHARACTER_ATTRIBUTE_TYPE)21; 5438 v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER, 0);
5570 v2 += GetItemsBonus(v8, 0);
5571 } 5439 }
5572 break; 5440 break;
5573 5441
5574 case PLAYER_SKILL_STEALING: 5442 case PLAYER_SKILL_STEALING:
5575 { 5443 {
5576 if (CheckHiredNPCSpeciality(Burglar)) 5444 if (CheckHiredNPCSpeciality(Burglar))
5577 v2 = 8; 5445 v2 = 8;
5578 v8 = (CHARACTER_ATTRIBUTE_TYPE)17; 5446 v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_STEALING, 0);
5579 v2 += GetItemsBonus(v8, 0);
5580 } 5447 }
5581 break; 5448 break;
5582 5449
5583 5450
5584 case PLAYER_SKILL_ALCHEMY: 5451 case PLAYER_SKILL_ALCHEMY:
5585 { 5452 {
5586 if ( CheckHiredNPCSpeciality(Herbalist) ) 5453 if ( CheckHiredNPCSpeciality(Herbalist) )
5587 v2 = 4; 5454 v2 = 4;
5588 if ( CheckHiredNPCSpeciality(Apothecary) ) 5455 if ( CheckHiredNPCSpeciality(Apothecary) )
5589 v2 += 8; 5456 v2 += 8;
5590 v8 = (CHARACTER_ATTRIBUTE_TYPE)16; 5457 v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ALCHEMY, 0);
5591 v2 += GetItemsBonus(v8, 0);
5592 } 5458 }
5593 break; 5459 break;
5594 5460
5595 case PLAYER_SKILL_LEARNING: 5461 case PLAYER_SKILL_LEARNING:
5596 { 5462 {
5598 v2 = 10; 5464 v2 = 10;
5599 if ( CheckHiredNPCSpeciality(Instructor) ) 5465 if ( CheckHiredNPCSpeciality(Instructor) )
5600 v2 += 15; 5466 v2 += 15;
5601 if ( CheckHiredNPCSpeciality(Scholar) ) 5467 if ( CheckHiredNPCSpeciality(Scholar) )
5602 v2 += 5; 5468 v2 += 5;
5603 v8 = (CHARACTER_ATTRIBUTE_TYPE)46; 5469 v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_LEARNING, 0);
5604 v2 += GetItemsBonus(v8, 0);
5605 } 5470 }
5606 break; 5471 break;
5607 5472
5608 case PLAYER_SKILL_UNARMED: 5473 case PLAYER_SKILL_UNARMED:
5609 { 5474 {
5610 if (CheckHiredNPCSpeciality(Monk) ) 5475 if (CheckHiredNPCSpeciality(Monk) )
5611 v2 = 2; 5476 v2 = 2;
5612 v8 = (CHARACTER_ATTRIBUTE_TYPE)23; 5477 v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_UNARMED, 0);
5613 v2 += GetItemsBonus(v8, 0);
5614 } 5478 }
5615 break; 5479 break;
5616 5480
5617 case PLAYER_SKILL_DODGE: 5481 case PLAYER_SKILL_DODGE:
5618 { 5482 {
5619 if ( CheckHiredNPCSpeciality(Monk) ) 5483 if ( CheckHiredNPCSpeciality(Monk) )
5620 v2 = 2; 5484 v2 = 2;
5621 v8 = (CHARACTER_ATTRIBUTE_TYPE)22; 5485 v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_DODGE, 0);
5622 v2 += GetItemsBonus(v8, 0);
5623 } 5486 }
5624 break; 5487 break;
5625 5488
5626 case PLAYER_SKILL_BOW: 5489 case PLAYER_SKILL_BOW:
5627 v8 = (CHARACTER_ATTRIBUTE_TYPE)44; 5490 v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_BOW, 0);
5628 v2 += GetItemsBonus(v8, 0);
5629 break; 5491 break;
5630 case PLAYER_SKILL_SHIELD: 5492 case PLAYER_SKILL_SHIELD:
5631 v8 = (CHARACTER_ATTRIBUTE_TYPE)45; 5493 v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_SHIELD, 0);
5632 v2 += GetItemsBonus(v8, 0);
5633 break; 5494 break;
5634 5495
5635 case PLAYER_SKILL_EARTH: 5496 case PLAYER_SKILL_EARTH:
5636 if ( CheckHiredNPCSpeciality(Apprentice) ) 5497 if ( CheckHiredNPCSpeciality(Apprentice) )
5637 v2 = 2; 5498 v2 = 2;
5639 v2 += 3; 5500 v2 += 3;
5640 if ( CheckHiredNPCSpeciality(Spellmaster) ) 5501 if ( CheckHiredNPCSpeciality(Spellmaster) )
5641 v2 += 4; 5502 v2 += 4;
5642 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) 5503 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() )
5643 v2 += 3; 5504 v2 += 3;
5644 v8 = (CHARACTER_ATTRIBUTE_TYPE)37; 5505 v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_EARTH, 0);
5645 v2 += GetItemsBonus(v8, 0);
5646 break; 5506 break;
5647 case PLAYER_SKILL_FIRE: 5507 case PLAYER_SKILL_FIRE:
5648 if ( CheckHiredNPCSpeciality(Apprentice) ) 5508 if ( CheckHiredNPCSpeciality(Apprentice) )
5649 v2 = 2; 5509 v2 = 2;
5650 if ( CheckHiredNPCSpeciality(Mystic) ) 5510 if ( CheckHiredNPCSpeciality(Mystic) )
5651 v2 += 3; 5511 v2 += 3;
5652 if ( CheckHiredNPCSpeciality(Spellmaster) ) 5512 if ( CheckHiredNPCSpeciality(Spellmaster) )
5653 v2 += 4; 5513 v2 += 4;
5654 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) 5514 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() )
5655 v2 += 3; 5515 v2 += 3;
5656 v8 = (CHARACTER_ATTRIBUTE_TYPE)34; 5516 v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_FIRE, 0);
5657 v2 += GetItemsBonus(v8, 0);
5658 break; 5517 break;
5659 case PLAYER_SKILL_AIR: 5518 case PLAYER_SKILL_AIR:
5660 if ( CheckHiredNPCSpeciality(Apprentice) ) 5519 if ( CheckHiredNPCSpeciality(Apprentice) )
5661 v2 = 2; 5520 v2 = 2;
5662 if ( CheckHiredNPCSpeciality(Mystic) ) 5521 if ( CheckHiredNPCSpeciality(Mystic) )
5663 v2 += 3; 5522 v2 += 3;
5664 if ( CheckHiredNPCSpeciality(Spellmaster) ) 5523 if ( CheckHiredNPCSpeciality(Spellmaster) )
5665 v2 += 4; 5524 v2 += 4;
5666 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) 5525 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() )
5667 v2 += 3; 5526 v2 += 3;
5668 v8 = (CHARACTER_ATTRIBUTE_TYPE)35; 5527 v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_AIR, 0);
5669 v2 += GetItemsBonus(v8, 0);
5670 break; 5528 break;
5671 case PLAYER_SKILL_WATER: 5529 case PLAYER_SKILL_WATER:
5672 if ( CheckHiredNPCSpeciality(Apprentice) ) 5530 if ( CheckHiredNPCSpeciality(Apprentice) )
5673 v2 = 2; 5531 v2 = 2;
5674 if ( CheckHiredNPCSpeciality(Mystic) ) 5532 if ( CheckHiredNPCSpeciality(Mystic) )
5675 v2 += 3; 5533 v2 += 3;
5676 if ( CheckHiredNPCSpeciality(Spellmaster) ) 5534 if ( CheckHiredNPCSpeciality(Spellmaster) )
5677 v2 += 4; 5535 v2 += 4;
5678 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) 5536 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() )
5679 v2 += 3; 5537 v2 += 3;
5680 v8 = (CHARACTER_ATTRIBUTE_TYPE)36; 5538 v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_WATER, 0);
5681 v2 += GetItemsBonus(v8, 0);
5682 break; 5539 break;
5683 case PLAYER_SKILL_SPIRIT: 5540 case PLAYER_SKILL_SPIRIT:
5684 if ( CheckHiredNPCSpeciality(Acolyte2) ) 5541 if ( CheckHiredNPCSpeciality(Acolyte2) )
5685 v2 = 2; 5542 v2 = 2;
5686 if ( CheckHiredNPCSpeciality(Initiate) ) 5543 if ( CheckHiredNPCSpeciality(Initiate) )
5687 v2 += 3; 5544 v2 += 3;
5688 if ( CheckHiredNPCSpeciality(Prelate) ) 5545 if ( CheckHiredNPCSpeciality(Prelate) )
5689 v2 += 4; 5546 v2 += 4;
5690 v8 = (CHARACTER_ATTRIBUTE_TYPE)38; 5547 v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_SPIRIT, 0);
5691 v2 += GetItemsBonus(v8, 0);
5692 break; 5548 break;
5693 case PLAYER_SKILL_MIND: 5549 case PLAYER_SKILL_MIND:
5694 if ( CheckHiredNPCSpeciality(Acolyte2) ) 5550 if ( CheckHiredNPCSpeciality(Acolyte2) )
5695 v2 = 2; 5551 v2 = 2;
5696 if ( CheckHiredNPCSpeciality(Initiate) ) 5552 if ( CheckHiredNPCSpeciality(Initiate) )
5697 v2 += 3; 5553 v2 += 3;
5698 if ( CheckHiredNPCSpeciality(Prelate) ) 5554 if ( CheckHiredNPCSpeciality(Prelate) )
5699 v2 += 4; 5555 v2 += 4;
5700 v8 = (CHARACTER_ATTRIBUTE_TYPE)39; 5556 v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MIND, 0);
5701 v2 += GetItemsBonus(v8, 0);
5702 break; 5557 break;
5703 case PLAYER_SKILL_BODY: 5558 case PLAYER_SKILL_BODY:
5704 if ( CheckHiredNPCSpeciality(Acolyte2) ) 5559 if ( CheckHiredNPCSpeciality(Acolyte2) )
5705 v2 = 2; 5560 v2 = 2;
5706 if ( CheckHiredNPCSpeciality(Initiate) ) 5561 if ( CheckHiredNPCSpeciality(Initiate) )
5707 v2 += 3; 5562 v2 += 3;
5708 if ( CheckHiredNPCSpeciality(Prelate) ) 5563 if ( CheckHiredNPCSpeciality(Prelate) )
5709 v2 += 4; 5564 v2 += 4;
5710 v8 = (CHARACTER_ATTRIBUTE_TYPE)40; 5565 v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_BODY, 0);
5711 v2 += GetItemsBonus(v8, 0);
5712 break; 5566 break;
5713 case PLAYER_SKILL_LIGHT: 5567 case PLAYER_SKILL_LIGHT:
5714 v8 = (CHARACTER_ATTRIBUTE_TYPE)41; 5568 v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_LIGHT, 0);
5715 v2 += GetItemsBonus(v8, 0);
5716 break; 5569 break;
5717 case PLAYER_SKILL_DARK: 5570 case PLAYER_SKILL_DARK:
5718 { 5571 {
5719 v8 = (CHARACTER_ATTRIBUTE_TYPE)42; 5572 v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_DARK, 0);
5720 v2 += GetItemsBonus(v8, 0);
5721 } 5573 }
5722 break; 5574 break;
5723 5575
5724 case PLAYER_SKILL_MERCHANT: 5576 case PLAYER_SKILL_MERCHANT:
5725 { 5577 {
5742 v2 += 5; 5594 v2 += 5;
5743 } 5595 }
5744 break; 5596 break;
5745 5597
5746 case PLAYER_SKILL_ITEM_ID: 5598 case PLAYER_SKILL_ITEM_ID:
5747 v8 = (CHARACTER_ATTRIBUTE_TYPE)19; 5599 v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ITEM_ID, 0);
5748 v2 += GetItemsBonus(v8, 0);
5749 break; 5600 break;
5750 case PLAYER_SKILL_MEDITATION: 5601 case PLAYER_SKILL_MEDITATION:
5751 v8 = (CHARACTER_ATTRIBUTE_TYPE)43; 5602 v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MEDITATION, 0);
5752 v2 += GetItemsBonus(v8, 0);
5753 break; 5603 break;
5754 case PLAYER_SKILL_TRAP_DISARM: 5604 case PLAYER_SKILL_TRAP_DISARM:
5755 { 5605 {
5756 if ( CheckHiredNPCSpeciality(Tinker) ) 5606 if ( CheckHiredNPCSpeciality(Tinker) )
5757 v2 = 4; 5607 v2 = 4;
5758 if ( CheckHiredNPCSpeciality(Locksmith) ) 5608 if ( CheckHiredNPCSpeciality(Locksmith) )
5759 v2 += 6; 5609 v2 += 6;
5760 if ( CheckHiredNPCSpeciality(Burglar) ) 5610 if ( CheckHiredNPCSpeciality(Burglar) )
5761 v2 += 8; 5611 v2 += 8;
5762 v8 = (CHARACTER_ATTRIBUTE_TYPE)18; 5612 v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM, 0);
5763 v2 += GetItemsBonus(v8, 0);
5764 } 5613 }
5765 break; 5614 break;
5766 } 5615 }
5767 5616
5768 v3 = pActiveSkills[uSkillType]; 5617 v3 = pActiveSkills[uSkillType];
6603 pDroppedStep = StatTable[0][v2].uDroppedStep; 6452 pDroppedStep = StatTable[0][v2].uDroppedStep;
6604 uMinValue = pBaseValue - 2; 6453 uMinValue = pBaseValue - 2;
6605 pStep = StatTable[0][v2].uBaseStep; 6454 pStep = StatTable[0][v2].uBaseStep;
6606 switch ( eAttribute ) 6455 switch ( eAttribute )
6607 { 6456 {
6608 case CHARACTER_MIGHT: 6457 case CHARACTER_ATTRIBUTE_STRENGTH:
6609 if ( this->uMight <= pBaseValue ) 6458 if ( this->uMight <= pBaseValue )
6610 pStep = pDroppedStep; 6459 pStep = pDroppedStep;
6611 if ( this->uMight - pStep >= uMinValue ) 6460 if ( this->uMight - pStep >= uMinValue )
6612 this->uMight -= pStep; 6461 this->uMight -= pStep;
6613 break; 6462 break;
6614 case CHARACTER_INTELLIGANCE: 6463 case CHARACTER_ATTRIBUTE_INTELLIGENCE:
6615 if ( this->uIntelligence <= pBaseValue ) 6464 if ( this->uIntelligence <= pBaseValue )
6616 pStep = pDroppedStep; 6465 pStep = pDroppedStep;
6617 if ( this->uIntelligence - pStep >= uMinValue ) 6466 if ( this->uIntelligence - pStep >= uMinValue )
6618 this->uIntelligence -= pStep; 6467 this->uIntelligence -= pStep;
6619 break; 6468 break;
6620 case CHARACTER_WILLPOWER: 6469 case CHARACTER_ATTRIBUTE_WILLPOWER:
6621 if ( this->uWillpower <= pBaseValue ) 6470 if ( this->uWillpower <= pBaseValue )
6622 pStep = pDroppedStep; 6471 pStep = pDroppedStep;
6623 if ( this->uWillpower - pStep >= uMinValue ) 6472 if ( this->uWillpower - pStep >= uMinValue )
6624 this->uWillpower -= pStep; 6473 this->uWillpower -= pStep;
6625 break; 6474 break;
6626 case CHARACTER_ENDURANCE: 6475 case CHARACTER_ATTRIBUTE_ENDURANCE:
6627 if ( this->uEndurance <= pBaseValue ) 6476 if ( this->uEndurance <= pBaseValue )
6628 pStep = pDroppedStep; 6477 pStep = pDroppedStep;
6629 if ( this->uEndurance - pStep >= uMinValue ) 6478 if ( this->uEndurance - pStep >= uMinValue )
6630 this->uEndurance -= pStep; 6479 this->uEndurance -= pStep;
6631 break; 6480 break;
6632 case CHARACTER_ACCURACY: 6481 case CHARACTER_ATTRIBUTE_ACCURACY:
6633 if ( this->uAccuracy <= pBaseValue ) 6482 if ( this->uAccuracy <= pBaseValue )
6634 pStep = pDroppedStep; 6483 pStep = pDroppedStep;
6635 if ( this->uAccuracy - pStep >= uMinValue ) 6484 if ( this->uAccuracy - pStep >= uMinValue )
6636 this->uAccuracy -= pStep; 6485 this->uAccuracy -= pStep;
6637 break; 6486 break;
6638 case CHARACTER_SPEED: 6487 case CHARACTER_ATTRIBUTE_SPEED:
6639 if ( this->uSpeed <= pBaseValue ) 6488 if ( this->uSpeed <= pBaseValue )
6640 pStep = pDroppedStep; 6489 pStep = pDroppedStep;
6641 if ( this->uSpeed - pStep >= uMinValue ) 6490 if ( this->uSpeed - pStep >= uMinValue )
6642 this->uSpeed -= pStep; 6491 this->uSpeed -= pStep;
6643 break; 6492 break;
6644 case CHARACTER_LUCK: 6493 case CHARACTER_ATTRIBUTE_LUCK:
6645 if ( this->uLuck <= pBaseValue ) 6494 if ( this->uLuck <= pBaseValue )
6646 pStep = pDroppedStep; 6495 pStep = pDroppedStep;
6647 if ( this->uLuck - pStep >= uMinValue ) 6496 if ( this->uLuck - pStep >= uMinValue )
6648 this->uLuck -= pStep; 6497 this->uLuck -= pStep;
6649 break; 6498 break;
6834 6683
6835 //----- (004680ED) -------------------------------------------------------- 6684 //----- (004680ED) --------------------------------------------------------
6836 void Player::UseItem_DrinkPotion_etc(signed int player_num, int a3) 6685 void Player::UseItem_DrinkPotion_etc(signed int player_num, int a3)
6837 { 6686 {
6838 Player *v3; // esi@1 6687 Player *v3; // esi@1
6839 unsigned int v4; // ebx@4
6840 signed int v5; // eax@17 6688 signed int v5; // eax@17
6841 unsigned int v6; // eax@26
6842 unsigned __int8 v7; // cf@37
6843 int v8; // edx@39 6689 int v8; // edx@39
6844 int v9; // edx@40
6845 int v10; // edx@41
6846 int v11; // edx@42
6847 int v12; // edx@43
6848 char *v13; // eax@45 6690 char *v13; // eax@45
6849 AudioPlayer *v14; // ecx@62
6850 signed int v15; // edi@68 6691 signed int v15; // edi@68
6851 int v16; // edx@73 6692 int v16; // edx@73
6852 unsigned __int16 v17; // edi@73 6693 unsigned __int16 v17; // edi@73
6853 unsigned int v18; // eax@73 6694 unsigned int v18; // eax@73
6854 int v19; // eax@74
6855 int v20; // eax@75
6856 signed int v21; // eax@81
6857 const char *v22; // eax@84 6695 const char *v22; // eax@84
6858 char *v23; // ecx@90
6859 int scroll_id; // esi@96 6696 int scroll_id; // esi@96
6860 int v25; // eax@109 6697 int v25; // eax@109
6861 int v26; // eax@113 6698 int v26; // eax@113
6862 int new_mana_val; // edi@114 6699 int new_mana_val; // edi@114
6863 signed __int64 v28; // qax@120 6700 signed __int64 v28; // qax@120
6864 char *v29; // ecx@120
6865 __int64 v30; // edi@137 6701 __int64 v30; // edi@137
6866 int v31; // ST30_4@137
6867 __int64 v32; // ST3C_4@137 6702 __int64 v32; // ST3C_4@137
6868 int v33; // ST40_4@137
6869 __int64 v34; // ST34_4@137 6703 __int64 v34; // ST34_4@137
6870 int v35; // ST38_4@137
6871 unsigned __int8 v36; // al@173
6872 SoundID v37; // [sp-20h] [bp-4Ch]@18
6873 SoundID v38; // [sp-20h] [bp-4Ch]@174
6874 signed int v39; // [sp-1Ch] [bp-48h]@18
6875 signed int v40; // [sp-1Ch] [bp-48h]@174
6876 unsigned int v41; // [sp-18h] [bp-44h]@18
6877 unsigned int v42; // [sp-18h] [bp-44h]@174
6878 signed int v43; // [sp-14h] [bp-40h]@18
6879 signed int v44; // [sp-14h] [bp-40h]@174
6880 signed int v45; // [sp-10h] [bp-3Ch]@18
6881 unsigned __int16 v46; // [sp-10h] [bp-3Ch]@120
6882 signed int v47; // [sp-10h] [bp-3Ch]@174
6883 int v48; // [sp-Ch] [bp-38h]@18
6884 unsigned int v49; // [sp-Ch] [bp-38h]@33
6885 unsigned __int16 v50; // [sp-Ch] [bp-38h]@120 6704 unsigned __int16 v50; // [sp-Ch] [bp-38h]@120
6886 int v51; // [sp-Ch] [bp-38h]@174
6887 unsigned int v52; // [sp-8h] [bp-34h]@18
6888 char *v53; // [sp-8h] [bp-34h]@33
6889 int v54; // [sp-8h] [bp-34h]@34
6890 unsigned int v55; // [sp-8h] [bp-34h]@60
6891 int v56; // [sp-8h] [bp-34h]@66
6892 const char *v57; // [sp-8h] [bp-34h]@69
6893 const char *v58; // [sp-8h] [bp-34h]@89
6894 int v59; // [sp-8h] [bp-34h]@120
6895 unsigned int v60; // [sp-8h] [bp-34h]@174
6896 int v61; // [sp-4h] [bp-30h]@18
6897 char *v62; // [sp-4h] [bp-30h]@33
6898 char *v63; // [sp-4h] [bp-30h]@34
6899 int v64; // [sp-4h] [bp-30h]@60
6900 int v65; // [sp-4h] [bp-30h]@66
6901 const char *v66; // [sp-4h] [bp-30h]@69 6705 const char *v66; // [sp-4h] [bp-30h]@69
6902 signed int v67; // [sp-4h] [bp-30h]@77 6706 signed int v67; // [sp-4h] [bp-30h]@77
6903 const char *v68; // [sp-4h] [bp-30h]@89 6707 const char *v68; // [sp-4h] [bp-30h]@89
6904 int v69; // [sp-4h] [bp-30h]@110
6905 unsigned __int8 v70; // [sp-4h] [bp-30h]@120
6906 int v71; // [sp-4h] [bp-30h]@174
6907 char v72; // [sp+20h] [bp-Ch]@68 6708 char v72; // [sp+20h] [bp-Ch]@68
6908 signed int v73; // [sp+24h] [bp-8h]@1 6709 signed int v73; // [sp+24h] [bp-8h]@1
6909 char *v74; // [sp+24h] [bp-8h]@23 6710 char* v74; // [sp+24h] [bp-8h]@23
6910 int v75; // [sp+24h] [bp-8h]@73
6911 Player *thisb; // [sp+28h] [bp-4h]@1 6711 Player *thisb; // [sp+28h] [bp-4h]@1
6912 unsigned int thisa; // [sp+28h] [bp-4h]@22 6712 unsigned int thisa; // [sp+28h] [bp-4h]@22
6913 6713
6914 thisb = this; 6714 thisb = this;
6915 v3 = &pParty->pPlayers[player_num-1]; 6715 v3 = &pParty->pPlayers[player_num-1];
6916 v73 = 1; 6716 v73 = 1;
6917 if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3) ) 6717 if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3) )
6918 return; 6718 return;
6919 v4 = 0;
6920 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_REAGENT ) 6719 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_REAGENT )
6921 { 6720 {
6922 if ( pParty->pPickedItem.uItemID == 160 ) 6721 if ( pParty->pPickedItem.uItemID == 160 )
6923 { 6722 {
6924 pParty->pPlayers[player_num-1].SetCondition(Condition_Poison1, 1); 6723 pParty->pPlayers[player_num-1].SetCondition(Condition_Poison1, 1);
6938 6737
6939 } 6738 }
6940 else 6739 else
6941 { 6740 {
6942 v68 = pParty->pPickedItem.GetDisplayName(); 6741 v68 = pParty->pPickedItem.GetDisplayName();
6943 v58 = pGlobalTXT_LocalizationStrings[36];//"%s can not be used that way" 6742 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[36], v68);//"%s can not be used that way"
6944 sprintfex(pTmpBuf, v58, v68);
6945 ShowStatusBarString(pTmpBuf, 2); 6743 ShowStatusBarString(pTmpBuf, 2);
6946 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); 6744 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
6947 return; 6745 return;
6948 } 6746 }
6949 goto LABEL_173; 6747 pAudioPlayer->PlaySound((SoundID)211, 0, 0, -1, 0, 0, 0, 0);
6748
6749 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null)
6750 {
6751 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
6752 }
6753 if ( v73 )
6754 {
6755 if ( pParty->bTurnBasedModeOn )
6756 {
6757 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100;
6758 thisb->SetRecoveryTime(100);
6759 pTurnEngine->_40471C();
6760 }
6761 else
6762 {
6763 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333));
6764 }
6765 }
6766 pMouse->RemoveHoldingItem();
6767 return;
6768
6950 6769
6951 } 6770 }
6952 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_POTION ) 6771 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_POTION )
6953 { 6772 {
6954 switch ( pParty->pPickedItem.uItemID ) 6773 switch ( pParty->pPickedItem.uItemID )
7006 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); 6825 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
7007 v3->pPlayerBuffs[1].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); 6826 v3->pPlayerBuffs[1].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0);
7008 v3->PlaySound(SPEECH_36, 0); 6827 v3->PlaySound(SPEECH_36, 0);
7009 break; 6828 break;
7010 case 231: //Preservation 6829 case 231: //Preservation
7011 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); 6830 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
7012 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); 6831 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
7013 v3->pPlayerBuffs[11].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); 6832 v3->pPlayerBuffs[11].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
7014 v3->PlaySound(SPEECH_36, 0); 6833 v3->PlaySound(SPEECH_36, 0);
7015 break; 6834 break;
7016 case 232: //Shield 6835 case 232: //Shield
7017 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); 6836 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
7018 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); 6837 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
7019 v3->pPlayerBuffs[13].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); 6838 v3->pPlayerBuffs[13].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
7020 v3->PlaySound(SPEECH_36, 0); 6839 v3->PlaySound(SPEECH_36, 0);
7021 break; 6840 break;
7022 case 234: //Stoneskin 6841 case 234: //Stoneskin
7039 case 239: //Cure Insanity 6858 case 239: //Cure Insanity
7040 v3->pConditions[Condition_Insane] = 0i64; 6859 v3->pConditions[Condition_Insane] = 0i64;
7041 v3->PlaySound(SPEECH_36, 0); 6860 v3->PlaySound(SPEECH_36, 0);
7042 break; 6861 break;
7043 case 240: //Might Boost 6862 case 240: //Might Boost
7044 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); 6863 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
7045 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); 6864 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
7046 v3->pPlayerBuffs[19].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); 6865 v3->pPlayerBuffs[19].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
7047 v3->PlaySound(SPEECH_36, 0); 6866 v3->PlaySound(SPEECH_36, 0);
7048 break; 6867 break;
7049 case 241: //Intellect Boost 6868 case 241: //Intellect Boost
7050 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); 6869 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
7051 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); 6870 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
7052 v3->pPlayerBuffs[17].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); 6871 v3->pPlayerBuffs[17].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
7053 v3->PlaySound(SPEECH_36, 0); 6872 v3->PlaySound(SPEECH_36, 0);
7054 break; 6873 break;
7055 case 242: //Personality Boost 6874 case 242: //Personality Boost
7056 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); 6875 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
7057 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); 6876 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
7058 v3->pPlayerBuffs[20].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); 6877 v3->pPlayerBuffs[20].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
7059 v3->PlaySound(SPEECH_36, 0); 6878 v3->PlaySound(SPEECH_36, 0);
7060 break; 6879 break;
7061 case 243://Endurance Boost 6880 case 243://Endurance Boost
7062 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); 6881 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
7063 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); 6882 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
7064 v3->pPlayerBuffs[16].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); 6883 v3->pPlayerBuffs[16].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
7065 v3->PlaySound(SPEECH_36, 0); 6884 v3->PlaySound(SPEECH_36, 0);
7066 break; 6885 break;
7067 case 244: //Speed Boost 6886 case 244: //Speed Boost
7068 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); 6887 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
7069 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); 6888 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
7070 v3->pPlayerBuffs[21].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); 6889 v3->pPlayerBuffs[21].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
7071 v3->PlaySound(SPEECH_36, 0); 6890 v3->PlaySound(SPEECH_36, 0);
7072 break; 6891 break;
7073 case 245: //Accuracy Boost 6892 case 245: //Accuracy Boost
7074 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); 6893 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
7075 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); 6894 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
7076 v3->pPlayerBuffs[15].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); 6895 v3->pPlayerBuffs[15].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
7077 v3->PlaySound(SPEECH_36, 0); 6896 v3->PlaySound(SPEECH_36, 0);
7078 break; 6897 break;
7079 case 251: //Cure Paralysis 6898 case 251: //Cure Paralysis
7102 if ( new_mana_val > v3->GetMaxMana() ) 6921 if ( new_mana_val > v3->GetMaxMana() )
7103 new_mana_val = v3->GetMaxMana(); 6922 new_mana_val = v3->GetMaxMana();
7104 v3->PlaySound(SPEECH_36, 0); 6923 v3->PlaySound(SPEECH_36, 0);
7105 break; 6924 break;
7106 case 255: //Luck Boost 6925 case 255: //Luck Boost
7107 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); 6926 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
7108 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); 6927 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
7109 v3->pPlayerBuffs[18].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); 6928 v3->pPlayerBuffs[18].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
7110 v3->PlaySound(SPEECH_36, 0); 6929 v3->PlaySound(SPEECH_36, 0);
7111 break; 6930 break;
7112 case 256: //Fire Resistance 6931 case 256: //Fire Resistance
7113 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); 6932 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
7114 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); 6933 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
7115 v3->pPlayerBuffs[5].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); 6934 v3->pPlayerBuffs[5].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
7116 v3->PlaySound(SPEECH_36, 0); 6935 v3->PlaySound(SPEECH_36, 0);
7117 goto LABEL_173; 6936 break;
7118 case 257: //Air Resistance 6937 case 257: //Air Resistance
7119 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); 6938 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
7120 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); 6939 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
7121 v3->pPlayerBuffs[0].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); 6940 v3->pPlayerBuffs[0].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
7122 v3->PlaySound(SPEECH_36, 0); 6941 v3->PlaySound(SPEECH_36, 0);
7123 break; 6942 break;
7124 case 258: //Water Resistance 6943 case 258: //Water Resistance
7125 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); 6944 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
7126 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); 6945 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
7127 v3->pPlayerBuffs[22].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); 6946 v3->pPlayerBuffs[22].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
7128 v3->PlaySound(SPEECH_36, 0); 6947 v3->PlaySound(SPEECH_36, 0);
7129 break; 6948 break;
7130 case 259: //Earth Resistance 6949 case 259: //Earth Resistance
7131 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); 6950 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
7132 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); 6951 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
7133 v3->pPlayerBuffs[3].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); 6952 v3->pPlayerBuffs[3].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
7134 v3->PlaySound(SPEECH_36, 0); 6953 v3->PlaySound(SPEECH_36, 0);
7135 break; 6954 break;
7136 case 260: //Mind Resistance 6955 case 260: //Mind Resistance
7137 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); 6956 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
7138 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); 6957 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
7139 v3->pPlayerBuffs[9].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); 6958 v3->pPlayerBuffs[9].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
7140 v3->PlaySound(SPEECH_36, 0); 6959 v3->PlaySound(SPEECH_36, 0);
7141 break; 6960 break;
7142 case 261: //Body Resistance 6961 case 261: //Body Resistance
7143 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); 6962 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
7144 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); 6963 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
7145 v3->pPlayerBuffs[2].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); 6964 v3->pPlayerBuffs[2].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
7146 v3->PlaySound(SPEECH_36, 0); 6965 v3->PlaySound(SPEECH_36, 0);
7147 break; 6966 break;
7148 case 262: //Stone to Flesh 6967 case 262: //Stone to Flesh
7210 v3->PlaySound(SPEECH_36, 0); 7029 v3->PlaySound(SPEECH_36, 0);
7211 break; 7030 break;
7212 7031
7213 default: 7032 default:
7214 v68 = pParty->pPickedItem.GetDisplayName(); 7033 v68 = pParty->pPickedItem.GetDisplayName();
7215 v58 = pGlobalTXT_LocalizationStrings[36]; //"%s can not be used that way" 7034 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[36], v68);//"%s can not be used that way"
7216 sprintfex(pTmpBuf, v58, v68);
7217 ShowStatusBarString(pTmpBuf, 2u); 7035 ShowStatusBarString(pTmpBuf, 2u);
7218 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); 7036 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
7219 return; 7037 return;
7220
7221 } 7038 }
7222 // pParty->pPlayers[player_num-1].SetCondition(Condition_Poison1, 1); 7039 pAudioPlayer->PlaySound((SoundID)210, 0, 0, -1, 0, 0, 0, 0);
7223 goto LABEL_173; 7040 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null)
7041 {
7042 if ( !v73 )
7043 {
7044 pMouse->RemoveHoldingItem();
7045 return;
7046 }
7047 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
7048 }
7049 if ( v73 )
7050 {
7051 if ( pParty->bTurnBasedModeOn )
7052 {
7053 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100;
7054 thisb->SetRecoveryTime(100);
7055 pTurnEngine->_40471C();
7056 }
7057 else
7058 {
7059 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333));
7060 }
7061 }
7062 pMouse->RemoveHoldingItem();
7063 return;
7064
7224 } 7065 }
7225 7066
7226 7067
7227 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_SPELL_SCROLL ) 7068 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_SPELL_SCROLL )
7228 { 7069 {
7231 if ( pCurrentScreen == SCREEN_CASTING ) 7072 if ( pCurrentScreen == SCREEN_CASTING )
7232 return; 7073 return;
7233 if ( !pParty->pPlayers[player_num-1].CanAct() ) 7074 if ( !pParty->pPlayers[player_num-1].CanAct() )
7234 { 7075 {
7235 7076
7236
7237 v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; 7077 v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()];
7238 v58 = pGlobalTXT_LocalizationStrings[382]; 7078 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[382], v68);
7239 sprintfex(pTmpBuf, v58, v68); 7079 ShowStatusBarString(pTmpBuf, 2u);
7240 v23 = pTmpBuf; 7080 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
7241
7242 ShowStatusBarString(v23, 2u);
7243 v4 = 0;
7244 v61 = v4;
7245 v52 = v4;
7246 v48 = v4;
7247 v45 = v4;
7248 v43 = -1;
7249 v41 = v4;
7250 v39 = v4;
7251 v37 = (SoundID)27;
7252 pAudioPlayer->PlaySound(v37, v39, v41, v43, v45, v48, v52, v61);
7253 return; 7081 return;
7254 } 7082 }
7255 if ( bUnderwater == 1 ) 7083 if ( bUnderwater == 1 )
7256 { 7084 {
7257 v23 = pGlobalTXT_LocalizationStrings[652]; //"You can not do that while you are underwater!" 7085 ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2u);//"You can not do that while you are underwater!"
7258 ShowStatusBarString(v23, 2u); 7086 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
7259 v4 = 0;
7260 v61 = v4;
7261 v52 = v4;
7262 v48 = v4;
7263 v45 = v4;
7264 v43 = -1;
7265 v41 = v4;
7266 v39 = v4;
7267 v37 = (SoundID)27;
7268 pAudioPlayer->PlaySound(v37, v39, v41, v43, v45, v48, v52, v61);
7269 return; 7087 return;
7270 } 7088 }
7271 dword_50C9AC = 1; 7089 dword_50C9AC = 1;
7272 scroll_id = pParty->pPickedItem.uItemID - 299; 7090 scroll_id = pParty->pPickedItem.uItemID - 299;
7273 if ( scroll_id == 30 || scroll_id == 4 || scroll_id == 91 || scroll_id == 28 ) //Enchant Item scroll, Vampiric Weapon scroll ,Recharge Item ,Fire Aura 7091 if ( scroll_id == 30 || scroll_id == 4 || scroll_id == 91 || scroll_id == 28 ) //Enchant Item scroll, Vampiric Weapon scroll ,Recharge Item ,Fire Aura
7299 v15 = pParty->pPickedItem.uItemID - 400; 7117 v15 = pParty->pPickedItem.uItemID - 400;
7300 v72 = v3->spellbook.bHaveSpell[pParty->pPickedItem.uItemID-400];//(char *)&v3->pConditions[0] + pParty->pPickedItem.uItemID + 2; 7118 v72 = v3->spellbook.bHaveSpell[pParty->pPickedItem.uItemID-400];//(char *)&v3->pConditions[0] + pParty->pPickedItem.uItemID + 2;
7301 if ( v72 ) 7119 if ( v72 )
7302 { 7120 {
7303 v66 = pParty->pPickedItem.GetDisplayName(); 7121 v66 = pParty->pPickedItem.GetDisplayName();
7304 v57 = pGlobalTXT_LocalizationStrings[380];//"You already know the %s spell" 7122 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[380], v66);//"You already know the %s spell"
7305 LABEL_72:
7306 sprintf(pTmpBuf, v57, v66);
7307 ShowStatusBarString(pTmpBuf, 2u); 7123 ShowStatusBarString(pTmpBuf, 2u);
7308 LABEL_92: 7124 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
7309 v61 = v4;
7310 v52 = v4;
7311 v48 = v4;
7312 v45 = v4;
7313 v43 = -1;
7314 v41 = v4;
7315 v39 = v4;
7316 v37 = (SoundID)27;
7317 LABEL_93:
7318 v14 = pAudioPlayer;
7319 LABEL_63:
7320 pAudioPlayer->PlaySound(v37, v39, v41, v43, v45, v48, v52, v61);
7321 return; 7125 return;
7322 } 7126 }
7323 if ( !pParty->pPlayers[player_num-1].CanAct() ) 7127 if ( !pParty->pPlayers[player_num-1].CanAct() )
7324 { 7128 {
7325 v66 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; 7129 v66 = aCharacterConditionNames[v3->GetMajorConditionIdx()];
7326 v57 = pGlobalTXT_LocalizationStrings[382];//"That player is %s" 7130 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[382], v66);//"That player is %s"
7327 sprintf(pTmpBuf, v57, v66);
7328 ShowStatusBarString(pTmpBuf, 2u); 7131 ShowStatusBarString(pTmpBuf, 2u);
7329 v61 = v4; 7132 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
7330 v52 = v4;
7331 v48 = v4;
7332 v45 = v4;
7333 v43 = -1;
7334 v41 = v4;
7335 v39 = v4;
7336 v37 = (SoundID)27;
7337 v14 = pAudioPlayer;
7338 pAudioPlayer->PlaySound(v37, v39, v41, v43, v45, v48, v52, v61);
7339 return; 7133 return;
7340 } 7134 }
7341 v16 = v15 % 11 + 1; 7135 v16 = v15 % 11 + 1;
7342 v17 = v3->pActiveSkills[v15 / 11 + 12]; 7136 v17 = v3->pActiveSkills[v15 / 11 + 12];
7343 v75 = v16;
7344 v18 = SkillToMastery(v17) - 1; 7137 v18 = SkillToMastery(v17) - 1;
7345 if ( v18 ) 7138 switch (v18)
7346 { 7139 {
7347 v19 = v18 - 1; 7140 case 0: v67 = 4; break;
7348 if ( v19 ) 7141 case 1: v67 = 7; break;
7142 case 2: v67 = 10; break;
7143 case 3: v67 = 11; break;
7144 default:
7145 v67 = player_num;
7146 }
7147
7148 if ( v16 > v67 || !v17 )
7149 {
7150 v22 = pParty->pPickedItem.GetDisplayName();
7151 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[381], v22); //"You don't have the skill to learn %s"
7152 ShowStatusBarString(pTmpBuf, 2u);
7153 v3->PlaySound((PlayerSpeech)20, 0);
7154 return;
7155 }
7156 // v72 = 1;
7157 v3->PlaySound(SPEECH_21, 0);
7158 v73 = 0;
7159
7160
7161 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null)
7162 {
7163 if ( !v73 )
7349 { 7164 {
7350 v20 = v19 - 1; 7165 pMouse->RemoveHoldingItem();
7351 if ( v20 ) 7166 return;
7352 { 7167 }
7353 if ( v20 != 1 ) 7168 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
7354 { 7169 }
7355 v21 = player_num; 7170 if ( v73 )
7356 LABEL_83: 7171 {
7357 if ( v75 > v21 || !v17 ) 7172 if ( pParty->bTurnBasedModeOn )
7358 { 7173 {
7359 v22 = pParty->pPickedItem.GetDisplayName(); 7174 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100;
7360 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[381], v22); 7175 thisb->SetRecoveryTime(100);
7361 ShowStatusBarString(pTmpBuf, 2u); 7176 pTurnEngine->_40471C();
7362 v3->PlaySound((PlayerSpeech)20, 0);
7363 return;
7364 }
7365 v72 = 1;
7366 v3->PlaySound(SPEECH_21, 0);
7367 v73 = 0;
7368 LABEL_173:
7369 v36 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType;
7370 if ( v36 == EQUIP_POTION )
7371 {
7372 v71 = 0;
7373 v60 = 0;
7374 v51 = 0;
7375 v47 = 0;
7376 v44 = -1;
7377 v42 = 0;
7378 v40 = 0;
7379 v38 = (SoundID)210;
7380 }
7381 else
7382 {
7383 if ( v36 != EQUIP_REAGENT )
7384 {
7385 LABEL_178:
7386 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null)
7387 {
7388 if ( !v73 )
7389 {
7390 pMouse->RemoveHoldingItem();
7391 return;
7392 }
7393 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
7394 }
7395 if ( v73 )
7396 {
7397 if ( pParty->bTurnBasedModeOn )
7398 {
7399 *(&pParty->field_16140 + player_num) = 100;
7400 thisb->SetRecoveryTime(100);
7401 pTurnEngine->_40471C();
7402 }
7403 else
7404 {
7405 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333));
7406 }
7407 }
7408 pMouse->RemoveHoldingItem();
7409 return;
7410 }
7411 v71 = 0;
7412 v60 = 0;
7413 v51 = 0;
7414 v47 = 0;
7415 v44 = -1;
7416 v42 = 0;
7417 v40 = 0;
7418 v38 = (SoundID)211;
7419 }
7420 pAudioPlayer->PlaySound(v38, v40, v42, v44, v47, v51, v60, v71);
7421 goto LABEL_178;
7422 }
7423 v67 = 11;
7424 }
7425 else
7426 {
7427 v67 = 10;
7428 }
7429 } 7177 }
7430 else 7178 else
7431 { 7179 {
7432 v67 = 7; 7180 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333));
7433 } 7181 }
7434 } 7182 }
7435 else 7183 pMouse->RemoveHoldingItem();
7436 { 7184 return;
7437 v67 = 4; 7185
7438 }
7439 v21 = v67;
7440 goto LABEL_83;
7441 } 7186 }
7442 7187
7443 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_MESSAGE_SCROLL ) 7188 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_MESSAGE_SCROLL )
7444 7189
7445 { 7190 {
7446 if ( pParty->pPlayers[player_num-1].CanAct() ) 7191 if ( pParty->pPlayers[player_num-1].CanAct() )
7447 { 7192 {
7448 CreateMsgScrollWindow(pParty->pPickedItem.uItemID); 7193 CreateMsgScrollWindow(pParty->pPickedItem.uItemID);
7449 v65 = 0; 7194 v3->PlaySound(SPEECH_37, 0);
7450 v56 = SPEECH_37;
7451 LABEL_67:
7452 v3->PlaySound((PlayerSpeech)v56, v65);
7453 return; 7195 return;
7454 } 7196 }
7455 LABEL_89:
7456 v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; 7197 v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()];
7457 v58 = pGlobalTXT_LocalizationStrings[382]; 7198 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[382], v68);
7458 LABEL_90: 7199 ShowStatusBarString(pTmpBuf, 2u);
7459 sprintfex(pTmpBuf, v58, v68); 7200 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
7460 v23 = pTmpBuf;
7461 LABEL_91:
7462 ShowStatusBarString(v23, 2u);
7463 v4 = 0;
7464 v61 = v4;
7465 v52 = v4;
7466 v48 = v4;
7467 v45 = v4;
7468 v43 = -1;
7469 v41 = v4;
7470 v39 = v4;
7471 v37 = (SoundID)27;
7472 pAudioPlayer->PlaySound(v37, v39, v41, v43, v45, v48, v52, v61);
7473 return; 7201 return;
7474 } 7202 }
7475 else 7203 else
7476 { 7204 {
7477 if ( pParty->pPickedItem.uItemID == 616 ) //Genie Lamp 7205 if ( pParty->pPickedItem.uItemID == 616 ) //Genie Lamp
7478 { 7206 {
7479 thisa = pParty->uCurrentMonthWeek + 1; 7207 thisa = pParty->uCurrentMonthWeek + 1;
7480 if ( pParty->uCurrentMonth >= 7 ) 7208 if ( pParty->uCurrentMonth >= 7 )
7481 v74 = 0; 7209 v74 = NULL;
7482 else 7210 else
7483 v74 = aAttributeNames[pParty->uCurrentMonth]; 7211 v74 = aAttributeNames[pParty->uCurrentMonth];
7484 switch ( pParty->uCurrentMonth ) 7212 switch ( pParty->uCurrentMonth )
7485 { 7213 {
7486 case 0: 7214 case 0:
7487 v6 = pParty->uCurrentMonthWeek + 1;
7488 v3->uMight += thisa; 7215 v3->uMight += thisa;
7489 v62 = pGlobalTXT_LocalizationStrings[121]; //"Permanent" 7216 sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"
7490 v53 = v74;
7491 v49 = v6;
7492 sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62);
7493 break; 7217 break;
7494 case 1: 7218 case 1:
7495 v6 = pParty->uCurrentMonthWeek + 1;
7496 v3->uIntelligence += thisa; 7219 v3->uIntelligence += thisa;
7497 v62 = pGlobalTXT_LocalizationStrings[121]; 7220 sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"
7498 v53 = v74;
7499 v49 = v6;
7500 sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62);
7501 break; 7221 break;
7502 case 2: 7222 case 2:
7503 v6 = pParty->uCurrentMonthWeek + 1;
7504 v3->uWillpower += thisa; 7223 v3->uWillpower += thisa;
7505 v62 = pGlobalTXT_LocalizationStrings[121]; 7224 sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"
7506 v53 = v74;
7507 v49 = v6;
7508 sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62);
7509 break; 7225 break;
7510 case 3: 7226 case 3:
7511 v6 = pParty->uCurrentMonthWeek + 1;
7512 v3->uEndurance += thisa; 7227 v3->uEndurance += thisa;
7513 v62 = pGlobalTXT_LocalizationStrings[121]; 7228 sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"
7514 v53 = v74;
7515 v49 = v6;
7516 sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62);
7517 break; 7229 break;
7518 case 4: 7230 case 4:
7519 v6 = pParty->uCurrentMonthWeek + 1;
7520 v3->uAccuracy += thisa; 7231 v3->uAccuracy += thisa;
7521 v62 = pGlobalTXT_LocalizationStrings[121]; 7232 sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"
7522 v53 = v74;
7523 v49 = v6;
7524 sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62);
7525 break; 7233 break;
7526 case 5: 7234 case 5:
7527 v6 = pParty->uCurrentMonthWeek + 1;
7528 v3->uSpeed += thisa; 7235 v3->uSpeed += thisa;
7529 v62 = pGlobalTXT_LocalizationStrings[121]; 7236 sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"
7530 v53 = v74;
7531 v49 = v6;
7532 sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62);
7533 break; 7237 break;
7534 case 6: 7238 case 6:
7535 v6 = pParty->uCurrentMonthWeek + 1;
7536 v3->uLuck += thisa; 7239 v3->uLuck += thisa;
7537 v62 = pGlobalTXT_LocalizationStrings[121]; 7240 sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"
7538 v53 = v74;
7539 v49 = v6;
7540 sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62);
7541 break; 7241 break;
7542 case 7: 7242 case 7:
7543 party_finds_gold(1000 * thisa, 0); 7243 party_finds_gold(1000 * thisa, 0);
7544 v63 = pGlobalTXT_LocalizationStrings[97];//"Gold" 7244 sprintf(pTmpBuf, "+%u %s", 1000 * thisa, pGlobalTXT_LocalizationStrings[97]);//"Gold"
7545 v54 = 1000 * thisa;
7546 sprintf(pTmpBuf, "+%u %s", v54, v63);
7547 break; 7245 break;
7548 case 8: 7246 case 8:
7549 Party::GiveFood(5 * thisa); 7247 Party::GiveFood(5 * thisa);
7550 v63 = pGlobalTXT_LocalizationStrings[653]; //"Food" 7248 sprintf(pTmpBuf, "+%u %s",5 * thisa , pGlobalTXT_LocalizationStrings[653]);//"Food"
7551 v54 = 5 * thisa;
7552 sprintf(pTmpBuf, "+%u %s", v54, v63);
7553 break; 7249 break;
7554 case 9u: 7250 case 9u:
7555 v63 = pGlobalTXT_LocalizationStrings[LOCSTR_SKILL_POINTS];
7556 v3->uSkillPoints += 2 * thisa; 7251 v3->uSkillPoints += 2 * thisa;
7557 v54 = 2 * thisa; 7252 sprintf(pTmpBuf, "+%u %s", 2 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_SKILL_POINTS]);
7558 sprintf(pTmpBuf, "+%u %s", v54, v63);
7559 break; 7253 break;
7560 case 10: 7254 case 10:
7561 v63 = pGlobalTXT_LocalizationStrings[LOCSTR_EXPIRIENCE];
7562 v54 = 2500 * thisa;
7563 v3->uExperience += 2500 * thisa; 7255 v3->uExperience += 2500 * thisa;
7564 sprintf(pTmpBuf, "+%u %s", v54, v63); 7256 sprintf(pTmpBuf, "+%u %s", 2500 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_EXPIRIENCE]);
7565 break; 7257 break;
7566 case 11: 7258 case 11:
7567 v8 = rand() % 6; 7259 v8 = rand() % 6;
7568 switch (v8) 7260 switch (v8)
7569 { 7261 {
7590 case 5: 7282 case 5:
7591 v3->sResBodyBase += thisa; 7283 v3->sResBodyBase += thisa;
7592 v13 = pGlobalTXT_LocalizationStrings[29]; 7284 v13 = pGlobalTXT_LocalizationStrings[29];
7593 break; 7285 break;
7594 } 7286 }
7595 v62 = pGlobalTXT_LocalizationStrings[121]; 7287 sprintf(pTmpBuf, "+%u %s %s", thisa, v13, pGlobalTXT_LocalizationStrings[121]);
7596 v53 = v13;
7597 v49 = thisa;
7598 sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62);
7599 break; 7288 break;
7600 7289
7601 } 7290 }
7602 ShowStatusBarString(pTmpBuf, 2u); 7291 ShowStatusBarString(pTmpBuf, 2u);
7603 pMouse->RemoveHoldingItem(); 7292 pMouse->RemoveHoldingItem();
7604 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, player_num - 1); 7293 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, player_num - 1);
7605 v3->PlaySound(SPEECH_93, 0); 7294 v3->PlaySound(SPEECH_93, 0);
7606 pAudioPlayer->PlaySound((SoundID)(SOUND_Bell|0x2), 0, 0, -1, 0, 0, 0, 0); 7295 pAudioPlayer->PlaySound((SoundID)219, 0, 0, -1, 0, 0, 0, 0);
7607 if ( pParty->uDaysPlayed == 6 || pParty->uDaysPlayed == 20 ) 7296 if ( pParty->uDaysPlayed == 6 || pParty->uDaysPlayed == 20 )
7608 { 7297 {
7609 v3->SetCondition(Condition_Eradicated, 0); 7298 v3->SetCondition(Condition_Eradicated, 0);
7610 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0); 7299 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0);
7611 } 7300 }
7640 else if ( pParty->pPickedItem.uItemID == 634 ) //Gryphonheart's Trumpet 7329 else if ( pParty->pPickedItem.uItemID == 634 ) //Gryphonheart's Trumpet
7641 { 7330 {
7642 pAudioPlayer->PlaySound((SoundID)135, 0, 0, -1, 0, 0, 0, 0); 7331 pAudioPlayer->PlaySound((SoundID)135, 0, 0, -1, 0, 0, 0, 0);
7643 return; 7332 return;
7644 } 7333 }
7645 else if ( pParty->pPickedItem.uItemID == 646 ) 7334 else if ( pParty->pPickedItem.uItemID == 646 ) //Horseshoe
7646 { 7335 {
7647 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, player_num - 1); 7336 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, player_num - 1);
7648 v5 = 8 * player_num + 392; 7337 v5 = PID(OBJECT_Player,player_num + 49);
7649 LOBYTE(v5) = PID(OBJECT_Player,player_num - 120);
7650 pAudioPlayer->PlaySound(SOUND_20001, v5, 0, -1, 0, 0, 0, 0); 7338 pAudioPlayer->PlaySound(SOUND_20001, v5, 0, -1, 0, 0, 0, 0);
7651 v3->AddVariable(VAR_NumSkillPoints, 2); 7339 v3->AddVariable(VAR_NumSkillPoints, 2);
7652 } 7340 }
7653 else if ( pParty->pPickedItem.uItemID == 650 ) //Temple in a Bottle 7341 else if ( pParty->pPickedItem.uItemID == 650 ) //Temple in a Bottle
7654 { 7342 {
7657 } 7345 }
7658 else 7346 else
7659 { 7347 {
7660 7348
7661 v68 = pParty->pPickedItem.GetDisplayName(); 7349 v68 = pParty->pPickedItem.GetDisplayName();
7662 v58 = pGlobalTXT_LocalizationStrings[36]; 7350 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[36],v68);//"%s can not be used that way"
7663 sprintfex(pTmpBuf, v58, v68); 7351 ShowStatusBarString(pTmpBuf, 2u);
7664 v23 = pTmpBuf; 7352 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
7665 ShowStatusBarString(v23, 2u);
7666 v4 = 0;
7667 v61 = v4;
7668 v52 = v4;
7669 v48 = v4;
7670 v45 = v4;
7671 v43 = -1;
7672 v41 = v4;
7673 v39 = v4;
7674 v37 = (SoundID)27;
7675 pAudioPlayer->PlaySound(v37, v39, v41, v43, v45, v48, v52, v61);
7676 return; 7353 return;
7677 } 7354 }
7678 7355
7679 LABEL_187:
7680 pMouse->RemoveHoldingItem(); 7356 pMouse->RemoveHoldingItem();
7681 return; 7357 return;
7682 } 7358 }
7683 7359
7684 } 7360 }
7685 7361
7686 //----- (00449BB4) -------------------------------------------------------- 7362 //----- (00449BB4) --------------------------------------------------------
7687 bool Player::CompareVariable( enum VariableType VarNum, signed int pValue ) 7363 bool Player::CompareVariable( enum VariableType VarNum, signed int pValue )
7688 { 7364 {
7689 Player *v3; // esi@1 7365 Player *v3; // esi@1
7690 signed int v4; // edi@1 7366 signed int v4; // edi@1
7691 unsigned int v5; // eax@8 7367 unsigned int v5; // eax@8
7692 int v6; // eax@9 7368 int v6; // eax@9
7693 enum CHARACTER_RACE v7; // eax@11 7369 enum CHARACTER_RACE v7; // eax@11
7818 LOBYTE(v6) = CheckHiredNPCSpeciality(pValue); 7494 LOBYTE(v6) = CheckHiredNPCSpeciality(pValue);
7819 return v6; 7495 return v6;
7820 case VAR_NPCs2: 7496 case VAR_NPCs2:
7821 return pNPCStats->pNewNPCData[pValue].Hired(); 7497 return pNPCStats->pNewNPCData[pValue].Hired();
7822 case VAR_MonthEquals|VAR_CurrentSP: 7498 case VAR_MonthEquals|VAR_CurrentSP:
7823 test_bit_value = 0x80u >> ((signed __int16)a1 - 1) % 8; 7499 test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8;
7824 our_bit_value = this->field_1A50[((signed __int16)a1 - 1)/8]; 7500 our_bit_value = this->field_1A50[((signed __int16)pValue - 1)/8];
7825 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) 7501 if ( !((unsigned __int8)test_bit_value & our_bit_value) )
7826 return v4 >= pValue; 7502 return v4 >= pValue;
7827 v4 = pValue; 7503 v4 = pValue;
7828 return v4 >= pValue; 7504 return v4 >= pValue;
7829 case VAR_ItemEquipped: 7505 case VAR_ItemEquipped:
7880 } 7556 }
7881 return true; 7557 return true;
7882 } 7558 }
7883 if ( VarNum == VAR_AutoNotes ) 7559 if ( VarNum == VAR_AutoNotes )
7884 { 7560 {
7885 test_bit_value = 0x80u >> ((signed __int16)(a1 - 1) - 1) % 8; 7561 test_bit_value = 0x80u >> ((signed __int16)(pValue - 1) - 1) % 8;
7886 our_bit_value = pParty->_autonote_bits[((signed __int16)(a1 - 1) - 1) /8]; 7562 our_bit_value = pParty->_autonote_bits[((signed __int16)(pValue - 1) - 1) /8];
7887 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) 7563 if ( !((unsigned __int8)test_bit_value & our_bit_value) )
7888 return false; 7564 return false;
7889 return true; 7565 return true;
7890 } 7566 }
7891 if ( VarNum <= VAR_BaseLuck ) 7567 if ( VarNum <= VAR_BaseLuck )
7950 return v4 >= pValue; 7626 return v4 >= pValue;
7951 case VAR_Age: 7627 case VAR_Age:
7952 v12 = GetActualAge(); 7628 v12 = GetActualAge();
7953 goto _j_cmp_against_arg; 7629 goto _j_cmp_against_arg;
7954 case VAR_Award: 7630 case VAR_Award:
7955 test_bit_value = 0x80u >> ((signed __int16)a1 - 1) % 8; 7631 test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8;
7956 our_bit_value = this->_guilds_member_bits[((signed __int16)a1 - 1) /8]; 7632 our_bit_value = this->_guilds_member_bits[((signed __int16)pValue - 1) /8];
7957 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) 7633 if ( !((unsigned __int8)test_bit_value & our_bit_value) )
7958 return true; 7634 return true;
7959 return false; 7635 return false;
7960 case VAR_Experience: 7636 case VAR_Experience:
7961 v4 = LODWORD(this->uExperience); 7637 v4 = LODWORD(this->uExperience);
8251 _449B7E_toggle_bit((unsigned char *)field_1A50, var_value, 1u); 7927 _449B7E_toggle_bit((unsigned char *)field_1A50, var_value, 1u);
8252 break; 7928 break;
8253 case VAR_NPCs2: 7929 case VAR_NPCs2:
8254 pParty->field_709 = 0; 7930 pParty->field_709 = 0;
8255 LOBYTE(pNPCStats->pNewNPCData[var_value].uFlags) |= 0x80u; 7931 LOBYTE(pNPCStats->pNewNPCData[var_value].uFlags) |= 0x80u;
8256 Party__CountHirelings(); 7932 pParty->CountHirelings();
8257 viewparams->bRedrawGameUI = 1; 7933 viewparams->bRedrawGameUI = true;
8258 break; 7934 break;
8259 case VAR_NumSkillPoints: 7935 case VAR_NumSkillPoints:
8260 this->uSkillPoints = var_value; 7936 this->uSkillPoints = var_value;
8261 break; 7937 break;
8262 } 7938 }
9207 _449B7E_toggle_bit((unsigned char *)Dst->field_1A50, val, 1u); 8883 _449B7E_toggle_bit((unsigned char *)Dst->field_1A50, val, 1u);
9208 break; 8884 break;
9209 case VAR_NPCs2: 8885 case VAR_NPCs2:
9210 pParty->field_709 = 0; 8886 pParty->field_709 = 0;
9211 LOBYTE(pNPCStats->pNewNPCData[val].uFlags) |= 0x80u; 8887 LOBYTE(pNPCStats->pNewNPCData[val].uFlags) |= 0x80u;
9212 Party__CountHirelings(); 8888 pParty->CountHirelings();
9213 viewparams->bRedrawGameUI = 1; 8889 viewparams->bRedrawGameUI = true;
9214 break; 8890 break;
9215 case VAR_NumSkillPoints: 8891 case VAR_NumSkillPoints:
9216 Dst->uSkillPoints += val; 8892 Dst->uSkillPoints += val;
9217 break; 8893 break;
9218 } 8894 }
9323 } 8999 }
9324 else 9000 else
9325 { 9001 {
9326 pParty->field_709 = 0; 9002 pParty->field_709 = 0;
9327 LOBYTE(pNPCStats->pNewNPCData[(int)pValue].uFlags) &= 0x7Fu; 9003 LOBYTE(pNPCStats->pNewNPCData[(int)pValue].uFlags) &= 0x7Fu;
9328 Party__CountHirelings(); 9004 pParty->CountHirelings();
9329 viewparams->bRedrawGameUI = 1; 9005 viewparams->bRedrawGameUI = true;
9330 } 9006 }
9331 break; 9007 break;
9332 case 241: 9008 case 241:
9333 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) 9009 if ( (signed int)pNPCStats->uNumNewNPCs > 0 )
9334 { 9010 {
9350 if ( pParty->pHirelings[0].uProfession == pValue ) 9026 if ( pParty->pHirelings[0].uProfession == pValue )
9351 memset(pParty->pHirelings, 0, 0x4Cu); 9027 memset(pParty->pHirelings, 0, 0x4Cu);
9352 if ( pParty->pHirelings[1].uProfession == pValue ) 9028 if ( pParty->pHirelings[1].uProfession == pValue )
9353 memset(&pParty->pHirelings[1], 0, 0x4Cu); 9029 memset(&pParty->pHirelings[1], 0, 0x4Cu);
9354 pParty->field_709 = 0; 9030 pParty->field_709 = 0;
9355 Party__CountHirelings(); 9031 pParty->CountHirelings();
9356 break; 9032 break;
9357 case 243: 9033 case 243:
9358 v17 = (char *)&this->uSkillPoints; 9034 v17 = (char *)&this->uSkillPoints;
9359 result = *v17; 9035 result = *v17;
9360 if ( (unsigned int)pValue <= *(int *)v17 ) 9036 if ( (unsigned int)pValue <= *(int *)v17 )
9452 v8 = 8 * v4 + 400; 9128 v8 = 8 * v4 + 400;
9453 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); 9129 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112);
9454 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); 9130 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0);
9455 return result; 9131 return result;
9456 case VAR_CurrentHP: 9132 case VAR_CurrentHP:
9457 ReceiveDamage((signed int)pValue, 4); 9133 ReceiveDamage((signed int)pValue, DMGT_PHISYCAL);
9458 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); 9134 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4);
9459 v8 = 8 * v4 + 400; 9135 v8 = 8 * v4 + 400;
9460 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); 9136 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112);
9461 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); 9137 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0);
9462 return result; 9138 return result;