# HG changeset patch # User Grumpy7 # Date 1379759923 -7200 # Node ID 2a309997c42f8dea4e5f8d3df5cb7401a31dbdb2 # Parent f84b8b2a875c2bb3ed80d429d17e12d142179e9a Player::StealFromShop started cleanup, fixing a few errors caused by not commiting everything diff -r f84b8b2a875c -r 2a309997c42f Items.cpp --- a/Items.cpp Fri Sep 20 10:51:42 2013 +0200 +++ b/Items.cpp Sat Sep 21 12:38:43 2013 +0200 @@ -2388,7 +2388,7 @@ bool ItemGen::IsRegularEnchanmentForAttribute( CHARACTER_ATTRIBUTE_TYPE attrToGet ) { - auto bonusList = ItemGen::specialBonusMap.find(this->uSpecEnchantmentType); + auto bonusList = ItemGen::specialBonusMap.find(this->uEnchantmentType); if (bonusList == ItemGen::specialBonusMap.end()) { return false; diff -r f84b8b2a875c -r 2a309997c42f Player.cpp --- a/Player.cpp Fri Sep 20 10:51:42 2013 +0200 +++ b/Player.cpp Sat Sep 21 12:38:43 2013 +0200 @@ -60,6 +60,9 @@ +std::array StealingMasteryBonuses = {0, 100, 200, 300, 500}; +std::array StealingRandomBonuses = {-200, -100, 0, 100, 200}; +std::array StealingEnchantmentBonusForSkill = {0, 2, 4, 6, 10}; @@ -2022,12 +2025,12 @@ bool result; // eax@13 if ( !itemToSteal - || this->pConditions[16] - || this->pConditions[14] - || this->pConditions[15] - || this->pConditions[4] - || this->pConditions[13] - || this->pConditions[2] ) + || this->IsEradicated() + || this->IsDead() + || this->IsPertified() + || this->pConditions[Condition_Drunk] + || this->IsUnconcious() + || this->IsAsleep() ) { result = 0; } @@ -2040,7 +2043,7 @@ v10 = pItemsTable->pItems[itemToSteal->uItemID].uEquipType; if ( !pItemsTable->pItems[itemToSteal->uItemID].uEquipType || v10 == 1 || v10 == 2 ) itemvalue *= 3; - v11 = dword_4EDEB4[rand() % 100 / 20] + v7 * dword_4EDEA0[v8]; + v11 = StealingRandomBonuses[rand() % 100 / 20] + v7 * StealingMasteryBonuses[v8]; *a6 = 100 * (reputation + a3) + itemvalue + (a5 != 0 ? 0x1F4 : 0); if ( rand() % 100 >= 5 ) { @@ -2108,9 +2111,8 @@ v7 = v6 & 0x3F; v8 = SkillToMastery(v6); v9 = rand(); - v28 = 4 * v8; - v30 = dword_4EDEA0[v8]; - v29 = dword_4EDEB4[v9 % 100 / 20]; + v30 = StealingMasteryBonuses[v8]; + v29 = StealingRandomBonuses[v9 % 100 / 20]; v10 = v5->pMonsterInfo.uLevel + 100 * (_steal_perm + reputation); if ( rand() % 100 < 5 || v10 > v29 + v7 * v30 || (_steal_perma = 2, BYTE2(v5->uAttributes) & 8) ) { @@ -2132,7 +2134,7 @@ do { --v7; - v19 += rand() % dword_4EDEC4[v28 / 4] + 1; + v19 += rand() % StealingEnchantmentBonusForSkill[v8] + 1; } while ( v7 ); } @@ -7949,6 +7951,11 @@ return pConditions[Condition_Paralyzed] != 0; } +bool Player::IsDrunk() +{ + return pConditions[Condition_Drunk] != 0; +} + void Player::SetCursed( bool state ) { pConditions[Condition_Cursed] = state; diff -r f84b8b2a875c -r 2a309997c42f Player.h --- a/Player.h Fri Sep 20 10:51:42 2013 +0200 +++ b/Player.h Sat Sep 21 12:38:43 2013 +0200 @@ -613,6 +613,7 @@ bool IsUnconcious(); bool IsAsleep(); bool IsParalyzed(); + bool IsDrunk(); void SetCursed(bool state); void SetWeak(bool state); diff -r f84b8b2a875c -r 2a309997c42f mm7_5.cpp --- a/mm7_5.cpp Fri Sep 20 10:51:42 2013 +0200 +++ b/mm7_5.cpp Sat Sep 21 12:38:43 2013 +0200 @@ -3052,7 +3052,7 @@ OnChestLeftClick(); continue; case UIMSG_InventoryLeftClick: - OnInventoryLeftClick(); + pPlayers[uActiveCharacter]->OnInventoryLeftClick(); continue; case UIMSG_MouseLeftClickInGame: if ( !pRenderer->pRenderD3D ) diff -r f84b8b2a875c -r 2a309997c42f mm7_6.cpp --- a/mm7_6.cpp Fri Sep 20 10:51:42 2013 +0200 +++ b/mm7_6.cpp Sat Sep 21 12:38:43 2013 +0200 @@ -767,7 +767,7 @@ if ( a3 ) v8 = pPlayer->GetRangedAttack(); else - v8 = pPlayer->GetActualAttack(0); + v8 = pPlayer->GetActualAttack(false); v9 = rand() % (v7 + 2 * v8 + 30); if ( a3 == 2 ) { diff -r f84b8b2a875c -r 2a309997c42f mm7_data.cpp --- a/mm7_data.cpp Fri Sep 20 10:51:42 2013 +0200 +++ b/mm7_data.cpp Sat Sep 21 12:38:43 2013 +0200 @@ -783,9 +783,6 @@ 3, 0, 2, 0, 0, 1, 0, 4, 0, 2, 0, 0, 4, 4, 4, 4, 0, 0, 0, 4, 0, 4, 1, 2, 0, 3, 2, 1, 0, 0, 0, 0, 4, 0, 0, 3, 3, 3, 0, 2, 0, 0, 1, 0, 4, 0, 2, 0, 0, 4, 4, 4, 4, 0, 0, 0, 0, 4, 4, 1, 2, 0, 3, 2, 1, 0, 0, 0, 0, 4, 0, 0, 3, 3, }}; -std::array dword_4EDEA0; // weak -std::array dword_4EDEB4; // weak -std::array dword_4EDEC4; // weak _UNKNOWN unk_4EDF40; // weak std::array pHiredNPCsIconsOffsetsX = {489, 559}; std::array pHiredNPCsIconsOffsetsY = {152, 152}; diff -r f84b8b2a875c -r 2a309997c42f mm7_data.h --- a/mm7_data.h Fri Sep 20 10:51:42 2013 +0200 +++ b/mm7_data.h Sat Sep 21 12:38:43 2013 +0200 @@ -511,9 +511,6 @@ extern std::array, 110> SoundSetAction; // weak extern std::array<__int16, 4> pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing; extern std::array< std::array, 36> byte_4ED970_skill_learn_ability_by_class_table; -extern std::array dword_4EDEA0; // weak -extern std::array dword_4EDEB4; // weak -extern std::array dword_4EDEC4; // weak extern _UNKNOWN unk_4EDF40; // weak extern std::array pHiredNPCsIconsOffsetsX; extern std::array pHiredNPCsIconsOffsetsY;