Mercurial > mm7
comparison Player.cpp @ 353:95be2dcecadf
Partial refactor for Player::GetActualSkillLevel
author | Nomad |
---|---|
date | Thu, 21 Feb 2013 03:49:33 +0200 |
parents | ec6cc5cefa4b |
children | 7f5538ed7875 |
comparison
equal
deleted
inserted
replaced
352:ec6cc5cefa4b | 353:95be2dcecadf |
---|---|
5641 } | 5641 } |
5642 return result; | 5642 return result; |
5643 } | 5643 } |
5644 | 5644 |
5645 //----- (0048F882) -------------------------------------------------------- | 5645 //----- (0048F882) -------------------------------------------------------- |
5646 char Player::GetActualSkillLevel(enum PLAYER_SKILL_TYPE uSkillType) | 5646 char Player::GetActualSkillLevel(PLAYER_SKILL_TYPE uSkillType) |
5647 { | 5647 { |
5648 signed int v2; // esi@1 | 5648 signed int v2; // esi@1 |
5649 unsigned __int16 v3; // ax@126 | 5649 unsigned __int16 v3; // ax@126 |
5650 char result; // al@127 | 5650 char result; // al@127 |
5651 unsigned int v5; // [sp-4h] [bp-14h]@13 | 5651 unsigned int v5; // [sp-4h] [bp-14h]@13 |
5652 signed int v6; // [sp-4h] [bp-14h]@27 | 5652 signed int v6; // [sp-4h] [bp-14h]@27 |
5653 unsigned int v7; // [sp-4h] [bp-14h]@35 | 5653 //unsigned int v7; // [sp-4h] [bp-14h]@35 |
5654 CHARACTER_ATTRIBUTE_TYPE v8; // [sp-4h] [bp-14h]@68 | 5654 CHARACTER_ATTRIBUTE_TYPE v8; // [sp-4h] [bp-14h]@68 |
5655 Player *v9; // [sp+Ch] [bp-4h]@1 | 5655 //Player *v9; // [sp+Ch] [bp-4h]@1 |
5656 | 5656 |
5657 v2 = 0; | 5657 v2 = 0; |
5658 v9 = this; | 5658 switch (uSkillType) |
5659 if ( uSkillType > PLAYER_SKILL_DODGE ) | 5659 { |
5660 { | 5660 case PLAYER_SKILL_MONSTER_ID: |
5661 if ( uSkillType != PLAYER_SKILL_UNARMED ) | 5661 { |
5662 { | 5662 if ( CheckHiredNPCSpeciality(58) ) |
5663 if ( uSkillType == PLAYER_SKILL_MONSTER_ID ) | 5663 v2 = 6; |
5664 { | 5664 if ( CheckHiredNPCSpeciality(57) ) |
5665 if ( CheckHiredNPCSpeciality(0x3Au) ) | 5665 v2 += 6; |
5666 v2 = 6; | 5666 v8 = (CHARACTER_ATTRIBUTE_TYPE)20; |
5667 if ( CheckHiredNPCSpeciality(0x39u) ) | 5667 v2 += GetItemsBonus(v8, 0); |
5668 } | |
5669 break; | |
5670 | |
5671 case PLAYER_SKILL_ARMSMASTER: | |
5672 { | |
5673 if ( CheckHiredNPCSpeciality(15) ) | |
5674 v2 = 2; | |
5675 if ( CheckHiredNPCSpeciality(16) ) | |
5676 v2 += 3; | |
5677 v8 = (CHARACTER_ATTRIBUTE_TYPE)21; | |
5678 v2 += GetItemsBonus(v8, 0); | |
5679 } | |
5680 break; | |
5681 | |
5682 case PLAYER_SKILL_STEALING: | |
5683 { | |
5684 if (CheckHiredNPCSpeciality(51)) | |
5685 v2 = 8; | |
5686 v8 = (CHARACTER_ATTRIBUTE_TYPE)17; | |
5687 v2 += GetItemsBonus(v8, 0); | |
5688 } | |
5689 break; | |
5690 | |
5691 | |
5692 case PLAYER_SKILL_ALCHEMY: | |
5693 { | |
5694 if ( CheckHiredNPCSpeciality(23) ) | |
5695 v2 = 4; | |
5696 if ( CheckHiredNPCSpeciality(24) ) | |
5697 v2 += 8; | |
5698 v8 = (CHARACTER_ATTRIBUTE_TYPE)16; | |
5699 v2 += GetItemsBonus(v8, 0); | |
5700 } | |
5701 break; | |
5702 | |
5703 case PLAYER_SKILL_LEARNING: | |
5704 { | |
5705 if ( CheckHiredNPCSpeciality(13) ) | |
5706 v2 = 10; | |
5707 if ( CheckHiredNPCSpeciality(14) ) | |
5708 v2 += 15; | |
5709 if ( CheckHiredNPCSpeciality(4) ) | |
5710 v2 += 5; | |
5711 v8 = (CHARACTER_ATTRIBUTE_TYPE)46; | |
5712 v2 += GetItemsBonus(v8, 0); | |
5713 } | |
5714 break; | |
5715 | |
5716 case PLAYER_SKILL_UNARMED: | |
5717 { | |
5718 if (CheckHiredNPCSpeciality(56) ) | |
5719 v2 = 2; | |
5720 v8 = (CHARACTER_ATTRIBUTE_TYPE)23; | |
5721 v2 += GetItemsBonus(v8, 0); | |
5722 } | |
5723 break; | |
5724 | |
5725 case PLAYER_SKILL_DODGE: | |
5726 { | |
5727 if ( CheckHiredNPCSpeciality(56) ) | |
5728 v2 = 2; | |
5729 v8 = (CHARACTER_ATTRIBUTE_TYPE)22; | |
5730 v2 += GetItemsBonus(v8, 0); | |
5731 } | |
5732 break; | |
5733 | |
5734 case PLAYER_SKILL_BOW: | |
5735 v8 = (CHARACTER_ATTRIBUTE_TYPE)44; | |
5736 v2 += GetItemsBonus(v8, 0); | |
5737 break; | |
5738 case PLAYER_SKILL_SHIELD: | |
5739 v8 = (CHARACTER_ATTRIBUTE_TYPE)45; | |
5740 v2 += GetItemsBonus(v8, 0); | |
5741 break; | |
5742 | |
5743 case PLAYER_SKILL_EARTH: | |
5744 if ( CheckHiredNPCSpeciality(17) ) | |
5745 v2 = 2; | |
5746 if ( CheckHiredNPCSpeciality(18) ) | |
5747 v2 += 3; | |
5748 if ( CheckHiredNPCSpeciality(19) ) | |
5749 v2 += 4; | |
5750 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5751 v2 += 3; | |
5752 v8 = (CHARACTER_ATTRIBUTE_TYPE)37; | |
5753 v2 += GetItemsBonus(v8, 0); | |
5754 break; | |
5755 case PLAYER_SKILL_FIRE: | |
5756 if ( CheckHiredNPCSpeciality(17) ) | |
5757 v2 = 2; | |
5758 if ( CheckHiredNPCSpeciality(18) ) | |
5759 v2 += 3; | |
5760 if ( CheckHiredNPCSpeciality(19) ) | |
5761 v2 += 4; | |
5762 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5763 v2 += 3; | |
5764 v8 = (CHARACTER_ATTRIBUTE_TYPE)34; | |
5765 v2 += GetItemsBonus(v8, 0); | |
5766 break; | |
5767 case PLAYER_SKILL_AIR: | |
5768 if ( CheckHiredNPCSpeciality(17) ) | |
5769 v2 = 2; | |
5770 if ( CheckHiredNPCSpeciality(18) ) | |
5771 v2 += 3; | |
5772 if ( CheckHiredNPCSpeciality(19) ) | |
5773 v2 += 4; | |
5774 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5775 v2 += 3; | |
5776 v8 = (CHARACTER_ATTRIBUTE_TYPE)35; | |
5777 v2 += GetItemsBonus(v8, 0); | |
5778 break; | |
5779 case PLAYER_SKILL_WATER: | |
5780 if ( CheckHiredNPCSpeciality(17) ) | |
5781 v2 = 2; | |
5782 if ( CheckHiredNPCSpeciality(18) ) | |
5783 v2 += 3; | |
5784 if ( CheckHiredNPCSpeciality(19) ) | |
5785 v2 += 4; | |
5786 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5787 v2 += 3; | |
5788 v8 = (CHARACTER_ATTRIBUTE_TYPE)36; | |
5789 v2 += GetItemsBonus(v8, 0); | |
5790 break; | |
5791 case PLAYER_SKILL_SPIRIT: | |
5792 if ( CheckHiredNPCSpeciality(53) ) | |
5793 v2 = 2; | |
5794 if ( CheckHiredNPCSpeciality(54) ) | |
5795 v2 += 3; | |
5796 if ( CheckHiredNPCSpeciality(55) ) | |
5797 v2 += 4; | |
5798 v8 = (CHARACTER_ATTRIBUTE_TYPE)38; | |
5799 v2 += GetItemsBonus(v8, 0); | |
5800 break; | |
5801 case PLAYER_SKILL_MIND: | |
5802 if ( CheckHiredNPCSpeciality(53) ) | |
5803 v2 = 2; | |
5804 if ( CheckHiredNPCSpeciality(54) ) | |
5805 v2 += 3; | |
5806 if ( CheckHiredNPCSpeciality(55) ) | |
5807 v2 += 4; | |
5808 v8 = (CHARACTER_ATTRIBUTE_TYPE)39; | |
5809 v2 += GetItemsBonus(v8, 0); | |
5810 break; | |
5811 case PLAYER_SKILL_BODY: | |
5812 if ( CheckHiredNPCSpeciality(53) ) | |
5813 v2 = 2; | |
5814 if ( CheckHiredNPCSpeciality(54) ) | |
5815 v2 += 3; | |
5816 if ( CheckHiredNPCSpeciality(55) ) | |
5817 v2 += 4; | |
5818 v8 = (CHARACTER_ATTRIBUTE_TYPE)40; | |
5819 v2 += GetItemsBonus(v8, 0); | |
5820 break; | |
5821 case PLAYER_SKILL_LIGHT: | |
5822 v8 = (CHARACTER_ATTRIBUTE_TYPE)41; | |
5823 v2 += GetItemsBonus(v8, 0); | |
5824 break; | |
5825 case PLAYER_SKILL_DARK: | |
5826 { | |
5827 v8 = (CHARACTER_ATTRIBUTE_TYPE)42; | |
5828 v2 += GetItemsBonus(v8, 0); | |
5829 } | |
5830 break; | |
5831 | |
5832 case PLAYER_SKILL_MERCHANT: | |
5833 { | |
5834 if ( CheckHiredNPCSpeciality(20) ) | |
5835 v2 = 4; | |
5836 if ( CheckHiredNPCSpeciality(21) ) | |
5668 v2 += 6; | 5837 v2 += 6; |
5669 goto LABEL_83; | 5838 if ( CheckHiredNPCSpeciality(48) ) |
5670 } | |
5671 if ( uSkillType == PLAYER_SKILL_ARMSMASTER ) | |
5672 { | |
5673 if ( CheckHiredNPCSpeciality(0xFu) ) | |
5674 v2 = 2; | |
5675 if ( CheckHiredNPCSpeciality(0x10u) ) | |
5676 v2 += 3; | 5839 v2 += 3; |
5677 goto LABEL_64; | 5840 if ( CheckHiredNPCSpeciality(50) ) |
5678 } | |
5679 if ( uSkillType == PLAYER_SKILL_STEALING ) | |
5680 { | |
5681 if ( CheckHiredNPCSpeciality(0x33u) ) | |
5682 v2 = 8; | |
5683 goto LABEL_64; | |
5684 } | |
5685 if ( uSkillType == PLAYER_SKILL_ALCHEMY ) | |
5686 { | |
5687 if ( CheckHiredNPCSpeciality(0x17u) ) | |
5688 v2 = 4; | |
5689 if ( CheckHiredNPCSpeciality(0x18u) ) | |
5690 v2 += 8; | 5841 v2 += 8; |
5691 goto LABEL_64; | 5842 } |
5692 } | 5843 break; |
5693 if ( uSkillType == 36 ) // learning | 5844 |
5694 { | 5845 case PLAYER_SKILL_PERCEPTION: |
5695 if ( CheckHiredNPCSpeciality(0xDu) ) | 5846 { |
5696 v2 = 10; | 5847 if ( CheckHiredNPCSpeciality(22) ) |
5697 if ( CheckHiredNPCSpeciality(0xEu) ) | 5848 v2 = 6; |
5698 v2 += 15; | 5849 if ( CheckHiredNPCSpeciality(47) ) |
5699 if ( CheckHiredNPCSpeciality(4u) ) | 5850 v2 += 5; |
5700 v2 += 5; | 5851 } |
5701 goto LABEL_64; | 5852 break; |
5702 } | 5853 |
5703 goto LABEL_86; | |
5704 } | |
5705 if ( !CheckHiredNPCSpeciality(0x38u) ) | |
5706 goto LABEL_112; | |
5707 LABEL_85: | |
5708 v2 = 2; | |
5709 goto LABEL_86; | |
5710 } | |
5711 if ( uSkillType == PLAYER_SKILL_DODGE ) | |
5712 { | |
5713 if ( !CheckHiredNPCSpeciality(0x38u) ) | |
5714 goto LABEL_112; | |
5715 v6 = 2; | |
5716 goto LABEL_51; | |
5717 } | |
5718 if ( uSkillType <= PLAYER_SKILL_ITEM_ID ) | |
5719 { | |
5720 if ( uSkillType != PLAYER_SKILL_ITEM_ID ) | |
5721 { | |
5722 if ( (signed int)uSkillType < 0 ) | |
5723 goto LABEL_86; | |
5724 if ( uSkillType > PLAYER_SKILL_PLATE ) | |
5725 { | |
5726 if ( uSkillType <= PLAYER_SKILL_EARTH ) | |
5727 { | |
5728 if ( CheckHiredNPCSpeciality(0x11u) ) | |
5729 v2 = 2; | |
5730 if ( CheckHiredNPCSpeciality(0x12u) ) | |
5731 v2 += 3; | |
5732 v5 = 19; | |
5733 } | |
5734 else | |
5735 { | |
5736 if ( uSkillType > PLAYER_SKILL_BODY ) | |
5737 goto LABEL_86; | |
5738 if ( CheckHiredNPCSpeciality(0x35u) ) | |
5739 v2 = 2; | |
5740 if ( CheckHiredNPCSpeciality(0x36u) ) | |
5741 v2 += 3; | |
5742 v5 = 55; | |
5743 } | |
5744 if ( CheckHiredNPCSpeciality(v5) ) | |
5745 v2 += 4; | |
5746 if ( v9->classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5747 v2 += 3; | |
5748 LABEL_86: | |
5749 if ( uSkillType <= PLAYER_SKILL_DARK ) | |
5750 { | |
5751 if ( uSkillType == PLAYER_SKILL_DARK ) | |
5752 { | |
5753 v8 = (CHARACTER_ATTRIBUTE_TYPE)42; | |
5754 } | |
5755 else | |
5756 { | |
5757 if ( uSkillType > PLAYER_SKILL_EARTH ) | |
5758 { | |
5759 switch ( uSkillType ) | |
5760 { | |
5761 case 16: | |
5762 v8 = (CHARACTER_ATTRIBUTE_TYPE)38; | |
5763 break; | |
5764 case 17: | |
5765 v8 = (CHARACTER_ATTRIBUTE_TYPE)39; | |
5766 break; | |
5767 case 18: | |
5768 v8 = (CHARACTER_ATTRIBUTE_TYPE)40; | |
5769 break; | |
5770 default: | |
5771 if ( uSkillType != 19 ) | |
5772 goto LABEL_126; | |
5773 v8 = (CHARACTER_ATTRIBUTE_TYPE)41; | |
5774 break; | |
5775 } | |
5776 } | |
5777 else | |
5778 { | |
5779 switch ( uSkillType ) | |
5780 { | |
5781 case PLAYER_SKILL_EARTH: | |
5782 v8 = (CHARACTER_ATTRIBUTE_TYPE)37; | |
5783 break; | |
5784 case PLAYER_SKILL_BOW: | |
5785 v8 = (CHARACTER_ATTRIBUTE_TYPE)44; | |
5786 break; | |
5787 case PLAYER_SKILL_SHIELD: | |
5788 v8 = (CHARACTER_ATTRIBUTE_TYPE)45; | |
5789 break; | |
5790 case PLAYER_SKILL_FIRE: | |
5791 v8 = (CHARACTER_ATTRIBUTE_TYPE)34; | |
5792 break; | |
5793 case PLAYER_SKILL_AIR: | |
5794 v8 = (CHARACTER_ATTRIBUTE_TYPE)35; | |
5795 break; | |
5796 default: | |
5797 if ( uSkillType != 14 ) | |
5798 goto LABEL_126; | |
5799 v8 = (CHARACTER_ATTRIBUTE_TYPE)36; | |
5800 break; | |
5801 } | |
5802 } | |
5803 } | |
5804 goto LABEL_125; | |
5805 } | |
5806 if ( uSkillType <= PLAYER_SKILL_MONSTER_ID ) | |
5807 { | |
5808 if ( uSkillType != PLAYER_SKILL_MONSTER_ID ) | |
5809 goto LABEL_112; | |
5810 LABEL_83: | |
5811 v8 = (CHARACTER_ATTRIBUTE_TYPE)20; | |
5812 goto LABEL_125; | |
5813 } | |
5814 LABEL_64: | |
5815 switch ( uSkillType ) | |
5816 { | |
5817 case PLAYER_SKILL_ARMSMASTER: | |
5818 v8 = (CHARACTER_ATTRIBUTE_TYPE)21; | |
5819 break; | |
5820 case PLAYER_SKILL_STEALING: | |
5821 v8 = (CHARACTER_ATTRIBUTE_TYPE)17; | |
5822 break; | |
5823 case PLAYER_SKILL_ALCHEMY: | |
5824 v8 = (CHARACTER_ATTRIBUTE_TYPE)16; | |
5825 break; | |
5826 default: | |
5827 if ( uSkillType != 36 ) | |
5828 goto LABEL_126; | |
5829 v8 = (CHARACTER_ATTRIBUTE_TYPE)46; | |
5830 break; | |
5831 } | |
5832 goto LABEL_125; | |
5833 } | |
5834 if ( !CheckHiredNPCSpeciality(0x2Eu) ) | |
5835 goto LABEL_86; | |
5836 goto LABEL_85; | |
5837 } | |
5838 if ( !CheckHiredNPCSpeciality(0x39u) ) | |
5839 goto LABEL_112; | |
5840 v6 = 6; | |
5841 LABEL_51: | |
5842 v2 = v6; | |
5843 goto LABEL_112; | |
5844 } | |
5845 if ( uSkillType == PLAYER_SKILL_MERCHANT ) | |
5846 { | |
5847 if ( CheckHiredNPCSpeciality(0x14u) ) | |
5848 v2 = 4; | |
5849 if ( CheckHiredNPCSpeciality(0x15u) ) | |
5850 v2 += 6; | |
5851 if ( CheckHiredNPCSpeciality(0x30u) ) | |
5852 v2 += 3; | |
5853 v7 = 50; | |
5854 LABEL_47: | |
5855 if ( CheckHiredNPCSpeciality(v7) ) | |
5856 v2 += 8; | |
5857 goto LABEL_112; | |
5858 } | |
5859 if ( uSkillType != PLAYER_SKILL_PERCEPTION ) | |
5860 { | |
5861 if ( uSkillType != PLAYER_SKILL_TRAP_DISARM ) | |
5862 goto LABEL_86; | |
5863 if ( CheckHiredNPCSpeciality(0x19u) ) | |
5864 v2 = 4; | |
5865 if ( CheckHiredNPCSpeciality(0x1Au) ) | |
5866 v2 += 6; | |
5867 v7 = 51; | |
5868 goto LABEL_47; | |
5869 } | |
5870 if ( CheckHiredNPCSpeciality(0x16u) ) | |
5871 v2 = 6; | |
5872 if ( CheckHiredNPCSpeciality(0x2Fu) ) | |
5873 v2 += 5; | |
5874 LABEL_112: | |
5875 switch ( uSkillType ) | |
5876 { | |
5877 case PLAYER_SKILL_ITEM_ID: | 5854 case PLAYER_SKILL_ITEM_ID: |
5878 v8 = (CHARACTER_ATTRIBUTE_TYPE)19; | 5855 v8 = (CHARACTER_ATTRIBUTE_TYPE)19; |
5856 v2 += GetItemsBonus(v8, 0); | |
5879 break; | 5857 break; |
5880 case PLAYER_SKILL_MEDITATION: | 5858 case PLAYER_SKILL_MEDITATION: |
5881 v8 = (CHARACTER_ATTRIBUTE_TYPE)43; | 5859 v8 = (CHARACTER_ATTRIBUTE_TYPE)43; |
5882 break; | 5860 v2 += GetItemsBonus(v8, 0); |
5861 break; | |
5883 case PLAYER_SKILL_TRAP_DISARM: | 5862 case PLAYER_SKILL_TRAP_DISARM: |
5863 { | |
5864 if ( CheckHiredNPCSpeciality(25) ) | |
5865 v2 = 4; | |
5866 if ( CheckHiredNPCSpeciality(26) ) | |
5867 v2 += 6; | |
5868 if ( CheckHiredNPCSpeciality(51) ) | |
5869 v2 += 8; | |
5884 v8 = (CHARACTER_ATTRIBUTE_TYPE)18; | 5870 v8 = (CHARACTER_ATTRIBUTE_TYPE)18; |
5885 break; | 5871 v2 += GetItemsBonus(v8, 0); |
5886 case PLAYER_SKILL_DODGE: | 5872 } |
5887 v8 = (CHARACTER_ATTRIBUTE_TYPE)22; | 5873 break; |
5888 break; | 5874 } |
5889 default: | 5875 |
5890 if ( uSkillType != 31 ) | 5876 v3 = pActiveSkills[uSkillType]; |
5891 goto LABEL_126; | 5877 if ( v2 + (pActiveSkills[uSkillType] & 0x3F) < 60 ) |
5892 v8 = (CHARACTER_ATTRIBUTE_TYPE)23; | |
5893 break; | |
5894 } | |
5895 LABEL_125: | |
5896 v2 += v9->GetItemsBonus(v8, 0); | |
5897 LABEL_126: | |
5898 v3 = v9->pActiveSkills[uSkillType]; | |
5899 if ( v2 + (v9->pActiveSkills[uSkillType] & 0x3F) < 60 ) | |
5900 result = v2 + v3; | 5878 result = v2 + v3; |
5901 else | 5879 else |
5902 result = v3 & 0xFC | 0x3C; | 5880 result = v3 & 0xFC | 0x3C; |
5903 return result; | 5881 return result; |
5904 } | 5882 } |