Mercurial > mm7
comparison Player.cpp @ 1686:df30a0c901e5
Player::StealFromShop finishing cleanup
author | Grumpy7 |
---|---|
date | Sat, 21 Sep 2013 18:48:10 +0200 |
parents | 2a309997c42f |
children | 5f01f1ed97f4 |
comparison
equal
deleted
inserted
replaced
1685:2a309997c42f | 1686:df30a0c901e5 |
---|---|
58 {{14, 30, 1, 2}, {11, 25, 1, 1}, {11, 25, 1, 1}, {14, 30, 1, 2}, { 7, 15, 2, 1}, { 7, 15, 2, 1}, {9, 20, 1, 1}} | 58 {{14, 30, 1, 2}, {11, 25, 1, 1}, {11, 25, 1, 1}, {14, 30, 1, 2}, { 7, 15, 2, 1}, { 7, 15, 2, 1}, {9, 20, 1, 1}} |
59 }; | 59 }; |
60 | 60 |
61 | 61 |
62 | 62 |
63 std::array<int, 5> StealingMasteryBonuses = {0, 100, 200, 300, 500}; | 63 std::array<int, 5> StealingMasteryBonuses = {0, 100, 200, 300, 500}; //dword_4EDEA0 |
64 std::array<int, 5> StealingRandomBonuses = {-200, -100, 0, 100, 200}; | 64 std::array<int, 5> StealingRandomBonuses = {-200, -100, 0, 100, 200}; //dword_4EDEB4 |
65 std::array<int, 5> StealingEnchantmentBonusForSkill = {0, 2, 4, 6, 10}; | 65 std::array<int, 5> StealingEnchantmentBonusForSkill = {0, 2, 4, 6, 10}; //dword_4EDEC4 |
66 | 66 |
67 | 67 |
68 | 68 |
69 // available skills per class ( 9 classes X 37 skills ) | 69 // available skills per class ( 9 classes X 37 skills ) |
70 // 0 - not available | 70 // 0 - not available |
2012 } | 2012 } |
2013 return false; | 2013 return false; |
2014 } | 2014 } |
2015 | 2015 |
2016 //----- (0048D76C) -------------------------------------------------------- | 2016 //----- (0048D76C) -------------------------------------------------------- |
2017 bool Player::StealFromShop(ItemGen *itemToSteal, int a3, int reputation, int a5, int *a6) //check stealing in IDA pro once I get home. The whole thing looks odd, dword_4EDEB4 and dword_4EDEA0 are never filled, might be a bug, might me on purpose | 2017 int Player::StealFromShop( ItemGen *itemToSteal, int extraStealDifficulty, int reputation, int a5, int *fineIfFailed ) //returns an int, but is the return value is compared to zero, so might change to bool |
2018 { | 2018 { |
2019 unsigned __int16 v6; // cx@8 | 2019 unsigned __int16 v6; // cx@8 |
2020 int v7; // edi@8 | 2020 int v7; // edi@8 |
2021 unsigned int v8; // ebx@8 | 2021 unsigned int v8; // ebx@8 |
2022 unsigned int itemvalue; // esi@8 | 2022 unsigned int itemvalue; // esi@8 |
2023 int v10; // eax@8 | 2023 int v10; // eax@8 |
2024 int v11; // edi@12 | 2024 int currMaxItemValue; // edi@12 |
2025 bool result; // eax@13 | |
2026 | 2025 |
2027 if ( !itemToSteal | 2026 if ( !itemToSteal |
2028 || this->IsEradicated() | 2027 || this->IsEradicated() |
2029 || this->IsDead() | 2028 || this->IsDead() |
2030 || this->IsPertified() | 2029 || this->IsPertified() |
2031 || this->pConditions[Condition_Drunk] | 2030 || this->pConditions[Condition_Drunk] |
2032 || this->IsUnconcious() | 2031 || this->IsUnconcious() |
2033 || this->IsAsleep() ) | 2032 || this->IsAsleep() ) |
2034 { | 2033 { |
2035 result = 0; | 2034 return 0; |
2036 } | 2035 } |
2037 else | 2036 else |
2038 { | 2037 { |
2039 v6 = this->pActiveSkills[34]; | 2038 v6 = this->pActiveSkills[34]; |
2040 v7 = v6 & 0x3F; | 2039 v7 = v6 & 0x3F; |
2041 v8 = SkillToMastery(v6); | 2040 v8 = SkillToMastery(v6); |
2042 itemvalue = itemToSteal->GetValue(); | 2041 itemvalue = itemToSteal->GetValue(); |
2043 v10 = pItemsTable->pItems[itemToSteal->uItemID].uEquipType; | 2042 v10 = pItemsTable->pItems[itemToSteal->uItemID].uEquipType; |
2044 if ( !pItemsTable->pItems[itemToSteal->uItemID].uEquipType || v10 == 1 || v10 == 2 ) | 2043 if ( v10 == 0 || v10 == 1 || v10 == 2 ) |
2045 itemvalue *= 3; | 2044 itemvalue *= 3; |
2046 v11 = StealingRandomBonuses[rand() % 100 / 20] + v7 * StealingMasteryBonuses[v8]; | 2045 currMaxItemValue = StealingRandomBonuses[rand() % 5] + v7 * StealingMasteryBonuses[v8]; |
2047 *a6 = 100 * (reputation + a3) + itemvalue + (a5 != 0 ? 0x1F4 : 0); | 2046 *fineIfFailed = 100 * (reputation + extraStealDifficulty) + itemvalue; |
2047 if (a5) | |
2048 { | |
2049 *fineIfFailed += 500; | |
2050 } | |
2048 if ( rand() % 100 >= 5 ) | 2051 if ( rand() % 100 >= 5 ) |
2049 { | 2052 { |
2050 if ( *a6 > v11 ) | 2053 if ( *fineIfFailed > currMaxItemValue ) |
2051 result = *a6 - v11 < 500; | 2054 if (*fineIfFailed - currMaxItemValue < 500) |
2055 { | |
2056 return 1; | |
2057 } | |
2058 else | |
2059 { | |
2060 return 0; | |
2061 } | |
2052 else | 2062 else |
2053 result = 2; | 2063 return 2; |
2054 } | 2064 } |
2055 else | 2065 else |
2056 { | 2066 { |
2057 result = 0; | 2067 return 0; |
2058 } | 2068 } |
2059 } | 2069 } |
2060 return result; | |
2061 } | 2070 } |
2062 // 4EDEA0: using guessed type int dword_4EDEA0[]; | 2071 // 4EDEA0: using guessed type int dword_4EDEA0[]; |
2063 // 4EDEB4: using guessed type int dword_4EDEB4[]; | 2072 // 4EDEB4: using guessed type int dword_4EDEB4[]; |
2064 | 2073 |
2065 //----- (0048D88B) -------------------------------------------------------- | 2074 //----- (0048D88B) -------------------------------------------------------- |