Mercurial > mm7
view Player.cpp @ 212:9f349addbe00
Слияние
author | Ritor1 |
---|---|
date | Sat, 16 Feb 2013 22:14:04 +0600 |
parents | 9b77686e2239 |
children | e6e348d66a75 8113753ed2ae |
line wrap: on
line source
#include <assert.h> #include "OSAPI.h" #include "Player.h" #include "PlayerFrameTable.h" #include "Texture.h" #include "AudioPlayer.h" #include "Party.h" #include "GUIButton.h" #include "LOD.h" #include "Monsters.h" #include "GUIWindow.h" #include "Viewport.h" #include "Actor.h" #include "Game.h" #include "Mouse.h" #include "TurnEngine.h" #include "Events.h" #include "Events2D.h" #include "Outdoor.h" #include "StorylineTextTable.h" #include "Autonotes.h" #include "Awards.h" #include "texts.h" #include "mm7_data.h" /* 381 */ #pragma pack(push, 1) struct PlayerCreation_AttributeProp { unsigned __int8 uBaseValue; char uMaxValue; char uDroppedStep; char uBaseStep; }; #pragma pack(pop) #pragma pack(push, 1) struct PlayerCreation_AttributePropsByRace { PlayerCreation_AttributeProp attr[7]; }; struct PlayerCreation_AttributeProps { union { unsigned __int8 _[4][7][4]; PlayerCreation_AttributePropsByRace race[4]; }; }; #pragma pack(pop) PlayerCreation_AttributeProps stru_4ED7B0 = { 11, 25, 1, 1, 11, 25, 1, 1, 11, 25, 1, 1, 9, 25, 1, 1, 11, 25, 1, 1, 11, 25, 1, 1, 9, 25, 1, 1, 7, 15, 2, 1, 14, 30, 1, 2, 11, 25, 1, 1, 7, 15, 2, 1, 14, 30, 1, 2, 11, 25, 1, 1, 9, 20, 1, 1, 14, 30, 1, 2, 7, 15, 2, 1, 7, 15, 2, 1, 11, 25, 1, 1, 11, 25, 1, 1, 14, 30, 1, 2, 9, 20, 1, 1, 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 }; // available skills per class ( 9 classes X 37 skills ) // 0 - not available // 1 - available // 2 - primary skill unsigned char pSkillAvailabilityPerClass[9][37] = // byte[] @ MM7.exe::004ED820 { {0, 2, 0, 1, 1, 1, 1, 0, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0}, {0, 1, 2, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 2, 1, 0}, {1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 2, 2, 1, 1, 0, 0, 0}, {0, 1, 1, 1, 0, 0, 2, 0, 1, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0}, {0, 1, 0, 1, 1, 2, 0, 0, 0, 1, 0, 0, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1}, {0, 1, 1, 2, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 2, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 2, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, {0, 0, 2, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 2, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, {2, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0} // some of these are started at 4ED94C, but needs to be here }; unsigned char pBaseHealthByClass[12] = {40, 35, 35, 30, 30, 30, 25, 20, 20, 0, 0, 0}; unsigned char pBaseManaByClass[12] = { 0, 0, 0, 5, 5, 0, 10, 10, 15, 0, 0, 0}; unsigned char pBaseHealthPerLevelByClass[36] = {5, 7, 9, 9, 4, 6, 8, 8, 5, 6, 8, 8, 4, 5, 6, 6, 3, 4, 6, 6, 4, 5, 6, 6, 2, 3, 4, 4, 2, 3, 4, 4, 2, 3, 3, 3}; unsigned char pBaseManaPerLevelByClass[36] = {0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 2, 3, 3, 1, 2, 3, 3, 0, 2, 3, 3, 3, 4, 5, 5, 3, 4, 5, 5, 3, 4, 6, 6}; unsigned char pConditionStrengthMultiplier[19] = {100, 100, 100, 120, 50, 200, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 100, 100}; unsigned char pConditionIntelligenceMultiplier[19] = {100, 100, 100, 50, 25, 10, 100, 100, 75, 60, 50, 30, 100, 100, 100, 100, 100, 1, 100}; unsigned char pConditionWillpowerMultiplier[19] = {100, 100, 100, 50, 25, 10, 100, 100, 75, 60, 50, 30, 100, 100, 100, 100, 100, 1, 100}; unsigned char pConditionEnduranceMultiplier[19] = {100, 100, 100, 100, 50, 150, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 100, 100}; unsigned char pConditionAccuracyMultiplier[19] = {100, 100, 100, 50, 10, 100, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 50, 100}; unsigned char pConditionSpeedMultiplier[19] = {100, 100, 100, 120, 20, 120, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 50, 100}; unsigned char pConditionLuckMultiplier[19] = {100, 100, 100, 100, 200, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100}; unsigned char pAgeingStrengthMultiplier[4] = {100, 75, 40, 10}; unsigned char pAgeingIntelligenceMultiplier[4] = {100, 150, 100, 10}; unsigned char pAgeingWillpowerMultiplier[4] = {100, 150, 100, 10}; unsigned char pAgeingEnduranceMultiplier[4] = {100, 75, 40, 10}; unsigned char pAgeingAccuracyMultiplier[4] = {100, 100, 40, 10}; unsigned char pAgeingSpeedMultiplier[4] = {100, 100, 40, 10}; unsigned char pAgeingLuckMultiplier[4] = {100, 100, 100, 100}; unsigned int pAgeingTable[4] = {50, 100, 150, 65535}; unsigned int pConditionImportancyTable[18] = {16, 15, 14, 17, 13, 2, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 1, 0}; short word_4EDFFC[30] = {500, 400, 350, 300, 275, 250, 225, 200, 175, 150, 125, 100, 75, 50, 40, 35, 30, 25, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 0, 0}; 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}; //----- (00490913) -------------------------------------------------------- signed int __cdecl PlayerCreation_ComputeAttributeBonus() { signed int v0; // edi@1 signed int v1; // esi@1 int v2; // ebx@2 int v3; // ecx@17 signed int v4; // eax@17 int v5; // edx@18 signed int v6; // ecx@18 signed int v8; // [sp+Ch] [bp-8h]@1 signed int v9; // [sp+10h] [bp-4h]@2 v8 = 50; v0 = 50; v1 = 0; do { v9 = 0; v2 = 7 * pParty->pPlayers[v1].GetRace(); do { if ( v9 ) { switch ( v9 ) { case 1: v0 = pParty->pPlayers[v1].uIntelligence; break; case 2: v0 = pParty->pPlayers[v1].uWillpower; break; case 3: v0 = pParty->pPlayers[v1].uEndurance; break; case 4: v0 = pParty->pPlayers[v1].uAccuracy; break; case 5: v0 = pParty->pPlayers[v1].uSpeed; break; case 6: v0 = pParty->pPlayers[v1].uLuck; break; } } else { v0 = pParty->pPlayers[v1].uMight; } v3 = v2 + v9; v4 = stru_4ED7B0.race[0].attr[v3].uBaseValue; if ( v0 >= v4 ) { v5 = stru_4ED7B0.race[0].attr[v3].uDroppedStep; v6 = stru_4ED7B0.race[0].attr[v3].uBaseStep; } else { v5 = stru_4ED7B0.race[0].attr[v3].uBaseStep; v6 = stru_4ED7B0.race[0].attr[v3].uDroppedStep; } v8 += v5 * (v4 - v0) / v6; ++v9; } while ( v9 <= 6 ); ++v1; } while ( v1 < 4 ); return v8; } //----- (00427730) -------------------------------------------------------- bool Player::CanCastSpell(unsigned int uRequiredMana) { int v2; // eax@1 bool result; // eax@2 v2 = this->sMana; if ( v2 >= (signed int)uRequiredMana ) { this->sMana = v2 - uRequiredMana; result = 1; } else { pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); result = 0; } return result; } //----- (004BE2DD) -------------------------------------------------------- void Player::_4BE2DD(unsigned int a2, int a3, int _2devent_idx) { Player *v4; // edi@1 char *v5; // esi@1 float v6; // ST04_4@1 signed int v7; // eax@1 signed int v8; // ebx@1 auto a4 = _2devent_idx; v4 = this; v5 = (char *)this + 36 * a3; v6 = p2DEvents[a4 - 1].fPriceMultiplier; //v6 = p2DEvents_minus1__20[13 * a4]; v7 = ((ItemGen *)(v5 + 532))->GetValue(); v8 = _4B8102(v7, v6); if ( v5[552] & 2 ) v8 = 1; if ( v8 < 1 ) v8 = 1; RemoveItemAtInventoryIndex(a2); Party::SetGold(pParty->uNumGold + v8); } //----- (0043EEF3) -------------------------------------------------------- bool Player::_43EEF3() { signed int v1; // esi@1 PlayerEquipment *v2; // edx@1 bool result; // eax@2 v1 = 0; v2 = &this->pEquipment; while ( 1 ) { result = v2->uOffHand; if ( v2->uOffHand ) { result = *(int *)&this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * result + 5]; if ( result ) { if ( result != 64 && result != 65 ) break; } } ++v1; v2 = (PlayerEquipment *)((char *)v2 + 4); if ( v1 >= 16 ) { LOBYTE(result) = 1; return result; } } LOBYTE(result) = 0; return result; } //----- (004B8040) -------------------------------------------------------- int Player::_4B8040_condition_time(unsigned int uCondition) { return (unsigned int)((signed __int64)((double)this->pConditions[uCondition] * 0.234375) / 60 / 60) / 0x18 % 7 + 1; } //----- (004B807C) -------------------------------------------------------- int Player::_4B807C(float a2) { Player *v2; // edi@1 unsigned int v3; // eax@1 int v4; // esi@1 unsigned int v5; // ebx@7 int v6; // eax@8 signed __int64 v7; // qax@13 unsigned int v9; // [sp-4h] [bp-14h]@4 signed int v10; // [sp+8h] [bp-8h]@4 int v11; // [sp+Ch] [bp-4h]@6 v2 = this; v3 = GetMajorConditionIdx(); v4 = 0; if ( (signed int)v3 >= 14 ) { if ( (signed int)v3 <= 15 ) { v10 = 5; v9 = v3; goto LABEL_6; } if ( v3 == 16 ) { v10 = 10; v9 = 16; LABEL_6: v11 = _4B8040_condition_time(v9); goto LABEL_13; } } v10 = 1; v5 = 0; do { v6 = _4B8040_condition_time(v5); if ( v6 > v4 ) v4 = v6; ++v5; } while ( (signed int)v5 <= 13 ); v11 = v4; if ( !v4 ) v11 = 1; LABEL_13: v7 = (signed __int64)((double)v11 * (double)v10 * a2); if ( (signed int)v7 < 1 ) LODWORD(v7) = 1; return v7; } //----- (004B8102) -------------------------------------------------------- int Player::_4B8102(int a2, float a3) { signed int v3; // esi@1 signed int result; // eax@3 v3 = (unsigned __int64)(signed __int64)((double)a2 / (a3 + 2.0)) + a2 * GetMerchant() / 100; if ( v3 > a2 ) v3 = a2; result = 1; if ( v3 >= 1 ) result = v3; return result; } //----- (004B8142) -------------------------------------------------------- int Player::_4B8142(int a2, float a3) { int result; // eax@1 result = (int)((100 - GetMerchant()) * (unsigned __int64)(signed __int64)((double)a2 * a3)) / 100; if ( result < a2 ) result = a2; if ( result < 1 ) result = 1; return result; } //----- (004B8179) -------------------------------------------------------- int Player::_4B8179(float a2) { signed int v2; // esi@1 int v3; // ecx@1 signed int result; // eax@3 v2 = (signed __int64)(a2 * 50.0); v3 = v2 * (100 - GetMerchant()) / 100; if ( v3 < v2 / 3 ) v3 = v2 / 3; result = 1; if ( v3 >= 1 ) result = v3; return result; } //----- (004B81C3) -------------------------------------------------------- int Player::_4B81C3(int a2, float a3) { signed int v3; // esi@1 int v4; // ecx@1 signed int result; // eax@3 v3 = (signed __int64)((double)a2 / (6.0 - a3)); v4 = v3 * (100 - GetMerchant()) / 100; if ( v4 < v3 / 3 ) v4 = v3 / 3; result = 1; if ( v4 >= 1 ) result = v4; return result; } //----- (004B8213) -------------------------------------------------------- int Player::_4B8213(int a2, float a3) { signed __int64 v3; // qax@1 v3 = (signed __int64)((double)a2 / (a3 + 2.0)); if ( (signed int)v3 < 1 ) LODWORD(v3) = 1; return v3; } //----- (004B8233) -------------------------------------------------------- int Player::_4B8233(int a2, float a3) { signed __int64 v3; // qax@1 v3 = (signed __int64)((double)a2 * a3); if ( (signed int)v3 < 1 ) LODWORD(v3) = 1; return v3; } //----- (004B824B) -------------------------------------------------------- int Player::_4B824B(float a2) { signed __int64 v2; // qax@1 v2 = (signed __int64)(a2 * 50.0); if ( (signed int)v2 < 1 ) LODWORD(v2) = 1; return v2; } //----- (004B8265) -------------------------------------------------------- int Player::_4B8265(int a2, float a3) { signed __int64 v3; // qax@1 v3 = (signed __int64)((double)a2 / (6.0 - a3)); if ( (signed int)v3 < 1 ) LODWORD(v3) = 1; return v3; } //----- (004B6FF9) -------------------------------------------------------- int Player::_4B6FF9() { Player *v1; // esi@1 signed int v2; // eax@1 char v3; // zf@4 v1 = this; v2 = (signed int)ptr_507BC0->ptr_1C; if ( v2 == 78 || v2 > 80 && v2 <= 82 ) { if ( GetMajorConditionIdx() == 18 ) goto LABEL_6; v3 = GetMajorConditionIdx() == 17; } else { v3 = GetMajorConditionIdx() == 18; } if ( !v3 ) return 1; LABEL_6: if ( v1->sHealth < GetMaxHealth() || v1->sMana < GetMaxMana() ) return 1; return 0; } //----- (00421E75) -------------------------------------------------------- unsigned int Player::GetItemIDAtInventoryIndex(int *a2) { int v2; // eax@1 unsigned int result; // eax@3 v2 = *a2; if ( *a2 >= 126 || v2 < 0 ) { result = 0; } else { result = this->pInventoryIndices[v2]; if ( (result & 0x80000000u) != 0 ) { *a2 = -1 - result; result = this->pInventoryIndices[-1 - result]; } } return result; } //----- (004160CA) -------------------------------------------------------- char Player::_4160CA(int a2) { Player *v2; // esi@1 signed int v3; // edx@1 signed int v4; // ebx@1 ItemGen *v5; // eax@1 int v6; // edi@2 signed int i; // edx@8 ItemGen **v8; // ecx@9 __int16 v10[137]; // [sp+Ch] [bp-118h]@1 __int16 v11; // [sp+11Eh] [bp-6h]@1 int v12; // [sp+120h] [bp-4h]@1 auto a1 = this; v12 = a2; v2 = a1; v3 = 0; v10[0] = 0; v4 = 0; memset(&v10[1], 0, 0x110u); v11 = 0; v5 = a1->pInventoryItems; do { v6 = 0; if ( (signed int)v5->uItemID > 0 && (signed int)v5->uItemID <= 134 ) v10[v4++] = v3; ++v3; ++v5; } while ( v3 < 138 ); if ( v4 ) { if ( v12 ) { if ( v12 > 0 ) { do { LOWORD(v5) = 9 * v10[v6]; if ( !(BYTE1(v2->pInventoryItems[v10[v6]].uAttributes) & 2) ) { v5 = (ItemGen *)((char *)&v2->pInventoryItems[v10[rand() % v4]] + 20); v5->uItemID |= 2u; } ++v6; } while ( v6 < v12 ); } } else { for ( i = 0; i < v4; ++i ) { v8 = (ItemGen **)&v2->pInventoryItems[v10[i]].uAttributes; v5 = *v8; if ( !(BYTE1(v5) & 2) ) { LOBYTE(v5) = (unsigned __int8)v5 | 2; *v8 = v5; } } } } return (char)v5; } //----- (004948B1) -------------------------------------------------------- void Player::PlaySound(PlayerSpeech speech, int a3) { //Player *pPlayer; // edi@1 //int v4; // eax@4 signed int v5; // esi@4 char *v6; // ebx@4 signed int v7; // ecx@5 unsigned __int8 v8; // al@6 int v9; // eax@10 //unsigned int pVoiceID; // ecx@10 int v11; // esi@10 signed int v12; // eax@11 signed int v13; // esi@12 int v14; // eax@12 //int v15; // eax@17 int pExpression; // ebx@17 signed int v17; // ecx@19 char *pSoundID; // edi@20 int v20[5]; // [sp+Ch] [bp-1Ch]@7 //Player *pPlayer2; // [sp+20h] [bp-8h]@1 int pPlayerNum; // [sp+24h] [bp-4h]@1 int pSoundId; // [sp+30h] [bp+8h]@4 //pPlayer = this; //pPlayer2 = this; pPlayerNum = 1; for (int i = 0; i < 4; ++i) if (&pParty->pPlayers[i] == this) { pPlayerNum = i + 1; break; } //v4 = a2;//102 v5 = 0; pSoundId = 0; v6 = (char *)&SoundSetAction[4 * speech];//byte_4ED280 &byte_4ED3D8[4 * v4] ??? if ( uVoicesVolumeMultiplier ) { v7 = 0; do { v8 = v6[v7]; if ( v8 ) v20[v5++] = v8; ++v7; } while ( v7 < 2 ); if ( v5 ) { v9 = rand(); //pVoiceID = uVoiceID; v11 = v20[v9 % v5]; if ( LOBYTE((&(&dlhu_texnames_by_face[19])[25 * v11 + 3])[uVoiceID]) ) { pSoundId = rand() % SLOBYTE((&(&dlhu_texnames_by_face[19])[25 * v11 + 3])[uVoiceID]) + 2 * (v11 + 50 * uVoiceID) + 4998; v12 = 8 * pPlayerNum + 312; LOBYTE(v12) = v12 | OBJECT_Player; pAudioPlayer->PlaySound((SoundID)pSoundId, v12, 0, -1, 0, 0, (pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0), 0); } } } v13 = 0; v14 = (int)(v6 + 3); do { if ( *(char *)v14 ) v20[v13++] = *(char *)v14; ++v14; } while ( -3 - (signed int)v6 + v14 < 5 ); if ( v13 ) { pPlayerNum = 0; pExpression = v20[rand() % v13]; if ( pExpression == 21 && pSoundId ) { v17 = 0; if ( (signed int)pSoundList->uNumSounds <= 0 ) { LABEL_23: v17 = 0; } else { pSoundID = (char *)&pSoundList->pSounds->uSoundID; while ( *(int *)pSoundID != pSoundId ) { ++v17; pSoundID += 120; if ( v17 >= (signed int)pSoundList->uNumSounds ) goto LABEL_23; } } if ( pSoundList->pSounds[v17].pSoundData[0] ) pPlayerNum = (sLastTrackLengthMS << 7) / 1000; } /*LOWORD(v14) = */PlayEmotion((CHARACTER_EXPRESSION_ID)pExpression, pPlayerNum); } //return v14; } // 4948B1: using guessed type int var_1C[5]; //----- (00494A25) -------------------------------------------------------- void Player::PlayEmotion(CHARACTER_EXPRESSION_ID new_expression, int a3) { //signed int v3; // eax@1 //CHARACTER_EXPRESSION_ID v4; // dx@1 signed int v5; // edi@15 PlayerFrame *v6; // esi@17 signed int v7; // eax@20 //LOWORD(v3) = this->expression; //v4 = expr; if (expression != CHARACTER_EXPRESSION_SLEEP && expression != CHARACTER_EXPRESSION_PERTIFIED || new_expression != CHARACTER_EXPRESSION_58) { int v3 = (unsigned)expression; if ( (signed int)(unsigned __int16)v3 >= 2 ) { if ( v3 <= 7 ) goto LABEL_12; if ( v3 > 8 ) { if ( v3 > 11 ) { if ( v3 == CHARACTER_EXPRESSION_PERTIFIED || v3 > 97 && v3 <= 99 ) return; goto LABEL_15; } LABEL_12: if (new_expression != CHARACTER_EXPRESSION_34 && new_expression != CHARACTER_EXPRESSION_35 && new_expression != CHARACTER_EXPRESSION_36) return; goto LABEL_15; } } } LABEL_15: //LOWORD(v3) = a3; v5 = 0; this->uExpressionTimeLength = a3; this->uExpressionTimePassed = 0; if ( !a3 ) { if ( (signed int)pPlayerFrameTable->uNumFrames <= 0 ) { LABEL_20: v7 = 0; } else { v6 = pPlayerFrameTable->pFrames; while ( v6->expression != new_expression ) { ++v5; ++v6; if ( v5 >= (signed int)pPlayerFrameTable->uNumFrames ) goto LABEL_20; } v7 = v5; } //v4 = expr; this->uExpressionTimeLength = 8 * pPlayerFrameTable->pFrames[a3].uAnimLength; } expression = new_expression; viewparams->bRedrawGameUI = 1; } //----- (0049327B) -------------------------------------------------------- int Player::_49327B(unsigned int uClass, int a3) { Player *v3; // esi@1 char v4; // zf@4 __int16 v5; // dx@9 signed int result; // eax@84 unsigned int v7; // [sp-8h] [bp-10h]@3 int v8; // [sp-4h] [bp-Ch]@3 v3 = this; if ( this->classType == uClass ) { LABEL_84: result = 1; } else { switch ( uClass ) { case 0u: v8 = a3; v7 = 1; goto LABEL_4; case 1u: if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->field_152, 17) || _49327B(2u, a3) ) goto LABEL_84; v8 = a3; v7 = 3; goto LABEL_4; case 2u: v5 = 19; goto LABEL_82; case 3u: v5 = 21; goto LABEL_82; case 4u: v8 = a3; v7 = 5; goto LABEL_4; case 5u: if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->field_152, 11) || _49327B(6u, a3) ) goto LABEL_84; v8 = a3; v7 = 7; goto LABEL_4; case 6u: if ( !a3 ) break; v5 = 13; goto LABEL_82; case 7u: if ( !a3 ) break; v5 = 15; goto LABEL_82; case 8u: v8 = a3; v7 = 9; goto LABEL_4; case 9u: if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->field_152, 23) || _49327B(0xAu, a3) ) goto LABEL_84; v8 = a3; v7 = 11; goto LABEL_4; case 0xAu: if ( !a3 ) break; v5 = 25; goto LABEL_82; case 0xBu: if ( !a3 ) break; v5 = 27; goto LABEL_82; case 0xCu: v8 = a3; v7 = 13; goto LABEL_4; case 0xDu: if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->field_152, 41) || _49327B(0xEu, a3) ) goto LABEL_84; v8 = a3; v7 = 15; goto LABEL_4; case 0xEu: if ( !a3 ) break; v5 = 43; goto LABEL_82; case 0xFu: if ( !a3 ) break; v5 = 45; goto LABEL_82; case 0x10u: v8 = a3; v7 = 17; goto LABEL_4; case 0x11u: if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->field_152, 35) || _49327B(0x12u, a3) ) goto LABEL_84; v8 = a3; v7 = 19; goto LABEL_4; case 0x12u: if ( !a3 ) break; v5 = 37; goto LABEL_82; case 0x13u: v5 = 39; goto LABEL_82; case 0x14u: v8 = a3; v7 = 21; goto LABEL_4; case 0x15u: if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->field_152, 29) || _49327B(0x16u, a3) ) goto LABEL_84; v8 = a3; v7 = 23; goto LABEL_4; case 0x16u: if ( !a3 ) break; v5 = 31; goto LABEL_82; case 0x17u: if ( !a3 ) break; v5 = 33; goto LABEL_82; case 0x18u: if ( !_49327B(0x19u, a3) ) goto LABEL_56; break; case 0x19u: LABEL_56: if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)v3->field_152, 63) || _49327B(0x1Au, a3) ) goto LABEL_84; v8 = a3; v7 = 27; goto LABEL_4; case 0x1Au: if ( !a3 ) break; v5 = 65; goto LABEL_82; case 0x1Bu: if ( !a3 ) break; v5 = 67; goto LABEL_82; case 0x1Cu: v8 = a3; v7 = 29; goto LABEL_4; case 0x1Du: if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->field_152, 69) || _49327B(0x1Eu, a3) ) goto LABEL_84; v8 = a3; v7 = 31; goto LABEL_4; case 0x1Eu: if ( !a3 ) break; v5 = 71; goto LABEL_82; case 0x1Fu: if ( !a3 ) break; v5 = 73; goto LABEL_82; case 0x20u: v8 = a3; v7 = 33; goto LABEL_4; case 0x21u: if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->field_152, 73) || _49327B(0x22u, a3) ) goto LABEL_84; v8 = a3; v7 = 35; LABEL_4: v4 = _49327B(v7, v8) == 0; goto LABEL_83; case 0x22u: if ( !a3 ) break; v5 = 77; goto LABEL_82; case 0x23u: if ( a3 ) { v5 = 79; LABEL_82: v4 = (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->field_152, v5) == 0; LABEL_83: if ( !v4 ) goto LABEL_84; } break; default: break; } result = 0; } return result; } //----- (00492C0B) -------------------------------------------------------- bool Player::CanAct() { bool result; // eax@2 if ( this->pConditions[2] | this->pConditions[12] | this->pConditions[13] | this->pConditions[14] | this->pConditions[15] | this->pConditions[16] ) result = 0; else result = 1; return result; } //----- (00492C40) -------------------------------------------------------- bool Player::CanSteal() { int v1; // eax@1 LOBYTE(v1) = GetActualSkillLevel(PLAYER_SKILL_STEALING); return v1 != 0; } //----- (00492C4E) -------------------------------------------------------- bool Player::CanEquip_RaceAndAlignmentCheck(unsigned int uItemID) { char v2; // zf@9 __int16 v4; // dx@13 char v5; // zf@15 if ( (signed int)uItemID > 532 ) // if (uItemID == 514 || // item233 ਪ 䠪, // uItemID == 516 || // item221 䠪, // uItemID == 524) // item325 ࠪ ५, { if ( uItemID == 533 ) { v2 = GetRace() == 1; } else { if ( uItemID != 534 ) { if ( uItemID == 535 ) // // if (uItemID == 530) // item093 䠪, { switch ( this->uVoiceID ) { default: return 1; case 4u: case 5u: case 6u: case 7u: case 0xAu: case 0xBu: case 0xEu: // // if (uItemID == 535) // item129 䠪, 騭 case 0xFu: case 0x12u: case 0x13u: case 0x15u: case 0x18u: return 0; } return 0; } if ( uItemID == 536 ) // // if (uItemID == 531) // item093 䠪, 祫 { switch ( this->uVoiceID ) { case 4u: case 5u: case 6u: case 7u: case 0xAu: case 0xBu: case 0xEu: case 0xFu: case 0x12u: case 0x13u: case 0x15u: case 0x18u: return 1; default: return 0; } return 0; } if ( uItemID != 604 ) // // if (uItemID == 532) // item073 䨩᪠ 㣠 䠪, return 1; v5 = _43EEF3() == 0; goto LABEL_23; } v2 = GetRace() == 3; // // if (uItemID == 533) // item113 㪠 䠪, } } else { if ( uItemID != 532 ) { if ( uItemID != 515 && uItemID != 517 ) // // if (uItemID == 534) // item104 䠪, 稭 { if ( uItemID == 521 ) // if (uItemID == 521 || // item239 䠪, // uItemID == 526) // item230 ࠢ ५, { LABEL_13: v4 = 99; LABEL_15: v5 = (unsigned __int16)_449B57_test_bit(pParty->_award_bits, v4) == 0; LABEL_23: if ( !v5 ) return 1; return 0; } if ( uItemID != 525 ) { if ( uItemID != 527 ) { if ( uItemID != 531 ) return 1; v2 = GetRace() == 2; goto LABEL_10; } goto LABEL_13; } } v4 = 100; goto LABEL_15; } v2 = GetRace() == 0; } LABEL_10: if ( v2 ) return 1; return 0; } //----- (00492D65) -------------------------------------------------------- int Player::SetCondition(unsigned int uConditionIdx, int a3) { Player *v3; // esi@1 Player **v4; // ebx@2 Player *v5; // ecx@21 Player *v6; // ecx@22 Player *v7; // ecx@29 Player *v8; // ecx@30 Player *v9; // ecx@37 Player *v10; // ecx@38 Player *v11; // ecx@45 Player *v12; // ecx@46 char *v13; // eax@49 Player *v14; // ecx@58 Player *v15; // ecx@59 Player *v16; // ecx@60 signed int result; // eax@76 signed int v18; // ecx@77 int v19; // eax@77 char v20; // al@80 signed int v21; // ebx@82 signed int v22; // esi@82 int v23; // [sp-8h] [bp-1Ch]@7 int v24; // [sp-8h] [bp-1Ch]@15 int v25; // [sp-8h] [bp-1Ch]@53 int v26; // [sp-4h] [bp-18h]@7 signed int v27; // [sp-4h] [bp-18h]@15 int v28; // [sp-4h] [bp-18h]@53 char *v29; // [sp+Ch] [bp-8h]@1 int v30; // [sp+10h] [bp-4h]@2 int v31; // [sp+20h] [bp+Ch]@82 v3 = this; v29 = (char *)this + 8 * uConditionIdx; if ( *(_QWORD *)v29 ) { LABEL_76: result = 0; } else { v4 = &pPlayers[1]; v30 = 0; do { if ( (*v4)->CanAct() ) ++v30; ++v4; } while ( (signed int)v4 <= (signed int)&pPlayers[4] ); switch ( uConditionIdx ) { case 0u: v26 = 0; v23 = 30; goto LABEL_81; case 1u: if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 ) goto LABEL_10; v26 = 0; v23 = 25; goto LABEL_81; case 2u: if ( a3 != 1 ) goto LABEL_82; if ( v3->HasEnchantedItemEquipped(22) ) goto LABEL_76; v27 = 3; v24 = 505; goto LABEL_16; case 3u: v26 = 0; v23 = 26; goto LABEL_81; case 4u: v26 = 0; v23 = 31; goto LABEL_81; case 5u: if ( a3 == 1 && (v3->HasEnchantedItemEquipped(19) || v5->WearsItem(505, 3) || v6->WearsItem(530, 6)) ) goto LABEL_76; v26 = 0; v23 = 29; goto LABEL_81; case 6u: case 8u: case 0xAu: if ( a3 == 1 ) { if ( (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 ) { --pParty->pPartyBuffs[13].uPower; if ( pParty->pPartyBuffs[13].uPower < 1u ) pParty->pPartyBuffs[13].Reset(); } if ( v3->HasEnchantedItemEquipped(21) || v7->WearsItem(505, 3) || v8->WearsItem(530, 6) ) goto LABEL_76; } v26 = 0; v23 = 27; goto LABEL_81; case 7u: case 9u: case 0xBu: if ( a3 != 1 ) goto LABEL_40; if ( SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) >= 0 && (SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[13].uExpireTime) > 0) ) goto LABEL_10; if ( v3->HasEnchantedItemEquipped(18) || v9->WearsItem(505, 3) || v10->WearsItem(530, 6) ) goto LABEL_76; LABEL_40: v26 = 0; v23 = 28; goto LABEL_81; case 0xCu: if ( a3 != 1 ) goto LABEL_82; if ( SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) >= 0 && (SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[13].uExpireTime) > 0) ) goto LABEL_10; if ( v3->HasEnchantedItemEquipped(20) || v11->WearsItem(505, 3) || v12->WearsItem(507, 16) ) goto LABEL_76; v27 = 6; v24 = 530; LABEL_16: if ( v3->WearsItem(v24, v27) ) goto LABEL_76; goto LABEL_82; case 0xDu: v3->PlaySound(SPEECH_32, 0); v13 = (char *)&v3->sHealth; goto LABEL_70; case 0xEu: if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 && pParty->pPartyBuffs[13].uSkill >= 4u ) goto LABEL_10; v28 = 0; v25 = 33; goto LABEL_67; case 0xFu: if ( a3 == 1 && (SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) >= 0 && (SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[13].uExpireTime) > 0) || v3->HasEnchantedItemEquipped(23) || v14->WearsItem(520, 16) || v15->WearsItem(505, 3) || v16->WearsItem(530, 6)) ) goto LABEL_76; v26 = 0; v23 = 34; goto LABEL_81; case 0x10u: if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 && pParty->pPartyBuffs[13].uSkill >= 4u ) { LABEL_10: --pParty->pPartyBuffs[13].uPower; if ( pParty->pPartyBuffs[13].uPower < 1u ) pParty->pPartyBuffs[13].Reset(); goto LABEL_76; } v28 = 0; v25 = SPEECH_35; LABEL_67: v3->PlaySound((PlayerSpeech)v25, v28); if ( v3->sHealth > 0 ) v3->sHealth = 0; v13 = (char *)&v3->sMana; LABEL_70: if ( *(int *)v13 > 0 ) *(int *)v13 = 0; LABEL_82: v21 = 0; *(_QWORD *)v29 = pParty->uTimePlayed; v31 = 0; v22 = 1; do { if ( pPlayers[v22]->CanAct() ) { ++v31; v21 = v22; } ++v22; } while ( v22 <= 4 ); if ( v30 == 2 ) { if ( v31 == 1 ) pPlayers[v21]->PlaySound(SPEECH_107, 0); } result = 1; break; case 0x11u: if ( v3->classType == PLAYER_CLASS_LICH || v3->Eradicated() || v3->Zombie() || !v3->Dead()) goto LABEL_76; memset(v3, 0, 0xA0u); v3->sHealth = v3->GetMaxHealth(); v18 = 0; v3->field_1928 = v3->uFace; v19 = v3->uVoiceID; v3->sMana = 0; v3->field_1924 = v19; switch ( v19 ) { case 0: case 1: case 2: case 3: case 8: case 9: case 12: case 13: case 16: case 17: case 20: case 23: v18 = 0; break; case 4: case 5: case 6: case 7: case 10: case 11: case 14: case 15: case 18: case 19: case 21: case 24: v18 = 1; break; default: break; } v26 = 0; v20 = (v18 != 0) + 23; v23 = SPEECH_99; v3->uFace = v20; v3->uVoiceID = v20; LABEL_81: v3->PlaySound((PlayerSpeech)v23, v26); goto LABEL_82; default: goto LABEL_82; } } return result; } //----- (00492528) -------------------------------------------------------- bool Player::CanFitItem(unsigned int uSlot, unsigned int uItemID) { unsigned int v3; // eax@1 Texture *v4; // esi@1 unsigned int v5; // ebx@1 signed int v6; // edi@5 int *v7; // ecx@6 signed int v8; // edx@7 int *v9; // eax@8 Player *v11; // [sp+Ch] [bp-4h]@1 unsigned int uItemIDa; // [sp+1Ch] [bp+Ch]@1 v11 = this; v3 = pIcons_LOD->LoadTexture(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); v4 = (Texture *)(v3 != -1 ? (int)&pIcons_LOD->pTextures[v3] : 0); v5 = GetSizeInInventorySlots(v3 != -1 ? pIcons_LOD->pTextures[v3].uTextureWidth : 24); uItemIDa = GetSizeInInventorySlots(v4->uTextureHeight); if ( !areWeLoadingTexture ) { v4->Release(); pIcons_LOD->_40F9C5(); } if ( (signed int)(v5 + (signed int)uSlot % 14) <= 14 && (signed int)(uItemIDa + (signed int)uSlot / 14) <= 9 ) { v6 = 0; if ( (signed int)uItemIDa <= 0 ) return 1; v7 = &v11->pInventoryIndices[uSlot]; while ( 1 ) { v8 = 0; if ( (signed int)v5 > 0 ) break; LABEL_11: ++v6; v7 += 14; if ( v6 >= (signed int)uItemIDa ) return 1; } v9 = v7; while ( !*v9 ) { ++v8; ++v9; if ( v8 >= (signed int)v5 ) goto LABEL_11; } } return 0; } // 506128: using guessed type int areWeLoadingTexture; //----- (004925E6) -------------------------------------------------------- unsigned int Player::FindFreeInventorySlot() { unsigned int result; // eax@1 ItemGen *v2; // ecx@1 result = 0; v2 = this->pInventoryItems; while ( v2->uItemID ) { ++result; ++v2; if ( (signed int)result >= 126 ) return -1; } return result; } //----- (00492600) -------------------------------------------------------- int Player::CreateItemInInventory(unsigned int uSlot, unsigned int uItemID) { signed int v3; // edx@1 ItemGen *v4; // eax@1 int result; // eax@8 unsigned int v6; // ebx@10 unsigned int v7; // eax@10 Texture *v8; // esi@10 void *v9; // esi@13 unsigned int v10; // [sp+0h] [bp-Ch]@10 Player *v11; // [sp+4h] [bp-8h]@1 signed int v12; // [sp+8h] [bp-4h]@4 unsigned int uItemIDa; // [sp+18h] [bp+Ch]@10 v11 = this; v3 = 0; v4 = this->pInventoryItems; while ( v4->uItemID ) { ++v3; ++v4; if ( v3 >= 126 ) { v12 = -1; goto LABEL_5; } } v12 = v3; LABEL_5: if ( v12 == -1 ) { if ( uActiveCharacter ) pPlayers[uActiveCharacter]->PlaySound(SPEECH_15, 0); result = 0; } else { v6 = uItemID; v7 = pIcons_LOD->LoadTexture(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); v8 = (Texture *)(v7 != -1 ? (int)&pIcons_LOD->pTextures[v7] : 0); v10 = GetSizeInInventorySlots(v7 != -1 ? pIcons_LOD->pTextures[v7].uTextureWidth : 24); uItemIDa = GetSizeInInventorySlots(v8->uTextureHeight); if ( !areWeLoadingTexture ) { v8->Release(); pIcons_LOD->_40F9C5(); } if ( (signed int)uItemIDa > 0 ) { v9 = &v11->pInventoryIndices[uSlot]; do { if ( (signed int)v10 > 0 ) memset32(v9, -1 - uSlot, v10); v9 = (char *)v9 + 56; --uItemIDa; } while ( uItemIDa ); } result = v12 + 1; v11->pInventoryIndices[uSlot] = v12 + 1; v11->pInventoryItems[v12].uItemID = v6; } return result; } // 506128: using guessed type int areWeLoadingTexture; //----- (00492700) -------------------------------------------------------- int Player::HasSkill(unsigned int uSkillType) { signed int result; // eax@3 if ( (signed int)uSkillType >= 37 || this->pActiveSkills[uSkillType] ) { result = 1; } else { sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[67], this->pName); ShowStatusBarString(pTmpBuf, 2u); result = 0; } return result; } //----- (00492745) -------------------------------------------------------- int Player::WearItem(unsigned int uItemID) { signed int v2; // eax@1 ItemGen *v3; // edx@1 int v4; // edi@6 char *v5; // eax@6 char *v6; // esi@6 v2 = 0; v3 = this->pInventoryItems; while ( v3->uItemID ) { ++v2; ++v3; if ( v2 >= 126 ) { v2 = -1; break; } } if ( v2 != -1 ) { v4 = v2 + 1; v5 = (char *)this + 36 * v2; v6 = &byte_4E8394[pItemsTable->pItems[uItemID].uEquipType + 4]; *(&this->pEquipment.uOffHand + (unsigned __int8)*v6) = v4; *((int *)v5 + 133) = uItemID; v5[556] = *v6 + 1; } return 0; } //----- (004927A8) -------------------------------------------------------- int Player::AddItem(unsigned int uSlot, unsigned int uItemID) { signed int v3; // ebx@2 signed int v4; // edi@3 unsigned int v5; // esi@3 unsigned int v7; // [sp-8h] [bp-18h]@8 unsigned int v8; // [sp-4h] [bp-14h]@8 Player *thisa; // [sp+Ch] [bp-4h]@1 thisa = this; if ( uSlot == -1 ) { v3 = 0; while ( 2 ) { v4 = 0; v5 = v3; do { if ( CanFitItem(v5, uItemID) ) { v8 = uItemID; v7 = v5; return CreateItemInInventory(v7, v8); } ++v4; v5 += 14; } while ( v4 < 9 ); ++v3; if ( v3 < 14 ) continue; break; } return 0; } if ( !CanFitItem(uSlot, uItemID) ) { pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); return 0; } v8 = uItemID; v7 = uSlot; return CreateItemInInventory(v7, v8); } //----- (00492826) -------------------------------------------------------- int Player::AddItem2(unsigned int uSlot, ItemGen *Src) { unsigned int v3; // ebx@1 unsigned int v4; // esi@3 signed int v5; // edi@3 unsigned int v7; // [sp-8h] [bp-18h]@9 ItemGen *v8; // [sp-4h] [bp-14h]@9 Player *thisa; // [sp+Ch] [bp-4h]@1 signed int uSlota; // [sp+18h] [bp+8h]@2 thisa = this; v3 = Src->uItemID; pItemsTable->SetSpecialBonus(Src); if ( uSlot == -1 ) { uSlota = 0; while ( 2 ) { v4 = uSlota; v5 = 0; do { if ( CanFitItem(v4, v3) ) { v8 = Src; v7 = v4; return CreateItemInInventory2(v7, v8); } ++v5; v4 += 14; } while ( v5 < 14 ); ++uSlota; if ( uSlota < 9 ) continue; break; } return 0; } if ( !CanFitItem(uSlot, v3) ) return 0; v8 = Src; v7 = uSlot; return CreateItemInInventory2(v7, v8); } //----- (0049289C) -------------------------------------------------------- int Player::CreateItemInInventory2(unsigned int uSlot, ItemGen *Src) { signed int v3; // ebx@1 ItemGen *v4; // eax@1 int result; // eax@6 unsigned int v6; // eax@7 Texture *v7; // esi@7 unsigned int v8; // edx@9 void *v9; // esi@10 unsigned int v10; // [sp+4h] [bp-Ch]@7 unsigned int v11; // [sp+8h] [bp-8h]@7 Player *v12; // [sp+Ch] [bp-4h]@1 unsigned int uSlota; // [sp+18h] [bp+8h]@10 v12 = this; v3 = 0; v4 = this->pInventoryItems; while ( v4->uItemID ) { ++v3; ++v4; if ( v3 >= 126 ) { v3 = -1; break; } } if ( v3 == -1 ) { result = 0; } else { v6 = pIcons_LOD->LoadTexture( pItemsTable->pItems[Src->uItemID].pIconName, TEXTURE_16BIT_PALETTE); v7 = (Texture *)(v6 != -1 ? (int)&pIcons_LOD->pTextures[v6] : 0); v10 = GetSizeInInventorySlots(v6 != -1 ? pIcons_LOD->pTextures[v6].uTextureWidth : 24); v11 = GetSizeInInventorySlots(v7->uTextureHeight); if ( !areWeLoadingTexture ) { v7->Release(); pIcons_LOD->_40F9C5(); } v8 = uSlot; if ( (signed int)v11 > 0 ) { uSlota = v11; v9 = &v12->pInventoryIndices[v8]; do { if ( (signed int)v10 > 0 ) memset32(v9, -1 - v8, v10); v9 = (char *)v9 + 56; --uSlota; } while ( uSlota ); } v12->pInventoryIndices[v8] = v3 + 1; memcpy(&v12->pInventoryItems[v3], Src, 0x24u); result = v3 + 1; } return result; } // 506128: using guessed type int areWeLoadingTexture; //----- (0049298B) -------------------------------------------------------- bool Player::_49298B(ItemGen *a2, int a3, int a4) { Player *v4; // ebx@1 unsigned int v5; // eax@1 Texture *v6; // esi@1 void *v7; // esi@4 unsigned int v9; // [sp+Ch] [bp-4h]@1 unsigned int a2a; // [sp+18h] [bp+8h]@1 v4 = this; v5 = pIcons_LOD->LoadTexture(pItemsTable->pItems[a2->uItemID].pIconName, TEXTURE_16BIT_PALETTE); v6 = (Texture *)(v5 != -1 ? (int)&pIcons_LOD->pTextures[v5] : 0); v9 = GetSizeInInventorySlots(v5 != -1 ? pIcons_LOD->pTextures[v5].uTextureWidth : 24); a2a = GetSizeInInventorySlots(v6->uTextureHeight); if ( !areWeLoadingTexture ) { v6->Release(); pIcons_LOD->_40F9C5(); } if ( (signed int)a2a > 0 ) { v7 = &v4->pInventoryIndices[a4]; do { if ( (signed int)v9 > 0 ) memset32(v7, -1 - a4, v9); v7 = (char *)v7 + 56; --a2a; } while ( a2a ); } v4->pInventoryIndices[a4] = a3 + 1; return 1; } // 506128: using guessed type int areWeLoadingTexture; //----- (00492A36) -------------------------------------------------------- unsigned int Player::RemoveItemAtInventoryIndex(unsigned int uSlot) { int *pIndices; // edi@1 ItemGen *v3; // ecx@1 unsigned int v4; // esi@1 unsigned int v5; // eax@1 Texture *v6; // esi@1 unsigned int result; // eax@1 unsigned int v8; // ebp@1 void *v9; // edx@4 unsigned int uSlota; // [sp+14h] [bp+4h]@1 pIndices = &this->pInventoryIndices[uSlot]; v3 = (ItemGen *)&this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *pIndices + 5]; v4 = v3->uItemID; v3->Reset(); v5 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v4].pIconName, TEXTURE_16BIT_PALETTE); v6 = (Texture *)(v5 != -1 ? (int)&pIcons_LOD->pTextures[v5] : 0); uSlota = GetSizeInInventorySlots(v5 != -1 ? pIcons_LOD->pTextures[v5].uTextureWidth : 24); result = GetSizeInInventorySlots(v6->uTextureHeight); v8 = result; if ( !areWeLoadingTexture ) { v6->Release(); result = pIcons_LOD->_40F9C5(); } if ( (signed int)v8 > 0 ) { v9 = pIndices; do { if ( (signed int)uSlota > 0 ) { result = 0; memset(v9, 0, 4 * uSlota); } v9 = (char *)v9 + 56; --v8; } while ( v8 ); } return result; } // 506128: using guessed type int areWeLoadingTexture; //----- (00490EEE) -------------------------------------------------------- int Player::_490EEE(ItemGen *pItem, int a3, int a4, int a5) { int v5; // eax@1 int result; // eax@1 unsigned int v7; // edx@1 unsigned int v8; // ecx@1 signed int v9; // esi@1 char v10; // zf@14 unsigned __int8 v11; // zf@22 char v12; // sf@22 unsigned __int8 v13; // of@22 float *v14; // esi@26 float v15; // ST04_4@26 signed int v16; // eax@26 int v17; // edi@26 float v18; // ST04_4@30 signed int v19; // eax@30 float v20; // ST04_4@34 signed int v21; // eax@34 signed int v22; // eax@34 float v23; // ST04_4@37 signed int v24; // eax@37 int v26; // [sp+10h] [bp-8h]@1 Player *v27; // [sp+14h] [bp-4h]@1 v27 = this; LOBYTE(v5) = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); v26 = v5; result = 4; v7 = pItem->uItemID; v8 = pItem->uItemID; v9 = pItemsTable->pItems[v8].uEquipType; if ( (a3 != 4 || (signed int)v7 < 740 || (signed int)v7 > 771) && ((signed int)v7 >= 600 || (signed int)v7 >= 529 && (signed int)v7 <= 599) ) return 5; if ( a3 == 1 ) { v13 = __OFSUB__(v9, 2); v11 = v9 == 2; v12 = v9 - 2 < 0; goto LABEL_24; } if ( a3 == 2 ) { if ( v9 < 3 ) return result; v13 = __OFSUB__(v9, 9); v11 = v9 == 9; v12 = v9 - 9 < 0; LABEL_24: if ( !((unsigned __int8)(v12 ^ v13) | v11) ) return result; goto LABEL_16; } if ( a3 == 3 ) { if ( pItemsTable->pItems[v8].uSkillType == 38 ) goto LABEL_16; v10 = v9 == 16; goto LABEL_15; } if ( a3 != 4 ) goto LABEL_26; if ( v9 < 13 ) return result; if ( v9 > 14 ) { v10 = v9 == 17; LABEL_15: if ( !v10 ) return result; } LABEL_16: if ( BYTE1(pItem->uAttributes) & 1 ) return 6; LABEL_26: //v14 = &p2DEvents_minus1__20[13 * a4]; v14 = &p2DEvents[a4 - 1].fPriceMultiplier; v15 = *v14; v16 = pItem->GetValue(); v17 = _4B8142(v16, v15); if ( a5 == 3 ) { v23 = *v14; v24 = pItem->GetValue(); v17 = v27->_4B8102(v24, v23); if ( !(pItem->uAttributes & 2) ) goto LABEL_39; goto LABEL_38; } if ( a5 == 4 ) { v22 = v27->_4B8179(*v14); goto LABEL_35; } if ( a5 == 5 ) { v20 = *v14; v21 = pItem->GetValue(); v22 = v27->_4B81C3(v21, v20); LABEL_35: v17 = v22; goto LABEL_39; } if ( a5 != 6 ) goto LABEL_39; v18 = *v14; v19 = pItem->GetValue(); v17 = v27->_4B8102(v19, v18) / 2; if ( pItem->uAttributes & 2 ) v17 = 1; if ( v17 >= 1 ) goto LABEL_39; LABEL_38: v17 = 1; LABEL_39: if ( v26 ) result = (v17 == pItem->GetValue()) + 2; else result = 1; return result; } //----- (0049107D) -------------------------------------------------------- int Player::GetBodybuilding() { char v1; // al@1 int v2; // ecx@1 int v4; // eax@3 signed int v6; // [sp-4h] [bp-4h]@2 v1 = GetActualSkillLevel(PLAYER_SKILL_BODYBUILDING); v2 = v1 & 0x3F; if ( v1 & 0x100 ) { v6 = 5; } else { if ( v1 >= 0 ) { v4 = ((v1 & 0x40) != 0) + 1; return v2 * v4; } v6 = 3; } v4 = v6; return v2 * v4; } //----- (004910A8) -------------------------------------------------------- int Player::GetMediatation() { char v1; // al@1 int v2; // ecx@1 int v4; // eax@3 signed int v6; // [sp-4h] [bp-4h]@2 v1 = GetActualSkillLevel(PLAYER_SKILL_MEDITATION); v2 = v1 & 0x3F; if ( v1 & 0x100 ) { v6 = 5; } else { if ( v1 >= 0 ) { v4 = ((v1 & 0x40) != 0) + 1; return v2 * v4; } v6 = 3; } v4 = v6; return v2 * v4; } //----- (004910D3) -------------------------------------------------------- int Player::CanIdentify(ItemGen *pItem) { unsigned __int16 v2; // ax@1 unsigned __int16 v3; // bx@1 int uSkillMult; // eax@3 int v5; // edi@7 signed int v6; // ebp@7 char *v7; // esi@7 signed int uSkillMultiplier; // [sp-4h] [bp-14h]@2 v2 = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_ITEM_ID); v3 = v2; if ( v2 & 1 ) { uSkillMultiplier = 5; } else { if ( (v2 & 0x80u) == 0 ) { uSkillMult = ((v2 & 0x40) != 0) + 1; v5 = uSkillMult * (v3 & 0x3F); v6 = 0; v7 = (char *)&pItemsTable->pItems[pItem->uItemID].pIconName; if ( CheckHiredNPCSpeciality(4) ) { v6 = 1; return v6; } if ( (signed int)SkillToMastery(v3) >= 4 ) v6 = 1; if ( v5 >= (unsigned __int8)v7[46] ) v6 = 1; return v6; } uSkillMultiplier = 3; } uSkillMult = uSkillMultiplier; v5 = uSkillMult * (v3 & 0x3F); v6 = 0; v7 = (char *)&pItemsTable->pItems[pItem->uItemID].pIconName; if ( CheckHiredNPCSpeciality(4) ) { v6 = 1; return v6; } if ( (signed int)SkillToMastery(v3) >= 4 ) v6 = 1; if ( v5 >= (unsigned __int8)v7[46] ) v6 = 1; return v6; } //----- (00491151) -------------------------------------------------------- int Player::CanRepair(ItemGen *a2) { unsigned __int16 v2; // ax@1 unsigned __int16 v3; // bx@1 int v4; // eax@3 int v5; // edi@7 signed int v6; // ebp@7 char v8; // al@10 signed int v10; // [sp-4h] [bp-14h]@2 LOBYTE(v2) = GetActualSkillLevel(PLAYER_SKILL_REPAIR); v3 = v2; if ( HIBYTE(v2) & 1 ) { v10 = 5; } else { if ( (v2 & 0x80u) == 0 ) { v4 = ((v2 & 0x40) != 0) + 1; goto LABEL_7; } v10 = 3; } v4 = v10; LABEL_7: v5 = v4 * (v3 & 0x3F); v6 = 0; auto v7 = &pItemsTable->pItems[a2->uItemID]; if (CheckHiredNPCSpeciality(1) && v7->uEquipType <= 2 || CheckHiredNPCSpeciality(2) && v7->uEquipType >= 3 && v7->uEquipType <= 9 || CheckHiredNPCSpeciality(3) && v7->uEquipType >= 9 ) return true; if ( (signed int)SkillToMastery(v3) >= 4 ) return true; if ( v5 >= *((char *)(v7 + 1) + 2) ) { __debugbreak(); // really odd return true; } return false; } //----- (004911F3) -------------------------------------------------------- int Player::GetMerchant() { Player *v1; // edi@1 unsigned __int16 v2; // ax@1 unsigned __int16 v3; // bx@1 int v4; // esi@1 int v5; // edi@1 int v7; // eax@3 int v8; // ecx@7 signed int v9; // [sp-4h] [bp-10h]@6 v1 = this; LOBYTE(v2) = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); v3 = v1->pActiveSkills[22]; v4 = v2 & 0x3F; v5 = v1->pActiveSkills[22] & 0x3F; if ( (signed int)SkillToMastery(v2) >= 4 ) return 10000; v7 = GetPartyReputation(); if ( !v4 ) return -v7; if ( HIBYTE(v3) & 1 ) { v9 = 5; } else { if ( (v3 & 0x80u) == 0 ) { v8 = ((v3 & 0x40) != 0) + 1; return v5 * (v8 - 1) - v7 + v4 + 7; } v9 = 3; } v8 = v9; return v5 * (v8 - 1) - v7 + v4 + 7; } //----- (0049125A) -------------------------------------------------------- int Player::GetPerception() { Player *v1; // edi@1 unsigned __int16 v2; // ax@1 unsigned __int16 v3; // bx@1 int v4; // esi@1 int v5; // edi@1 int v7; // eax@5 signed int v8; // [sp-4h] [bp-10h]@4 v1 = this; LOBYTE(v2) = GetActualSkillLevel(PLAYER_SKILL_PERCEPTION); v3 = v1->pActiveSkills[26]; v4 = v2 & 0x3F; v5 = v1->pActiveSkills[26] & 0x3F; if ( (signed int)SkillToMastery(v2) >= 4 ) return 10000; if ( HIBYTE(v3) & 1 ) { v8 = 5; } else { if ( (v3 & 0x80u) == 0 ) { v7 = ((v3 & 0x40) != 0) + 1; return v4 + v5 * (v7 - 1); } v8 = 3; } v7 = v8; return v4 + v5 * (v7 - 1); } //----- (004912B0) -------------------------------------------------------- int Player::GetDisarmTrap() { Player *v1; // ebp@1 unsigned __int16 v2; // ax@1 unsigned __int16 v3; // bx@1 int v4; // esi@1 int v5; // edi@1 int v7; // eax@7 signed int v8; // [sp-4h] [bp-14h]@6 v1 = this; LOBYTE(v2) = GetActualSkillLevel(PLAYER_SKILL_TRAP_DISARM); v3 = v1->pActiveSkills[29]; v4 = v2 & 0x3F; v5 = v1->pActiveSkills[29] & 0x3F; if ( (signed int)SkillToMastery(v2) >= 4 ) return 10000; if ( HasEnchantedItemEquipped(35) ) v4 *= 2; if ( HIBYTE(v3) & 1 ) { v8 = 5; } else { if ( (v3 & 0x80u) == 0 ) { v7 = ((v3 & 0x40) != 0) + 1; return v4 + v5 * (v7 - 1); } v8 = 3; } v7 = v8; return v4 + v5 * (v7 - 1); } //----- (00491317) -------------------------------------------------------- char Player::GetLearningPercent() { Player *v1; // esi@1 int v2; // eax@1 unsigned __int16 v3; // bx@1 int v4; // ecx@1 int v5; // eax@4 signed int v7; // [sp-4h] [bp-Ch]@3 v1 = this; LOBYTE(v2) = GetActualSkillLevel(PLAYER_SKILL_LEARNING); v3 = v1->pActiveSkills[36]; v4 = v2 & 0x3F; if ( v2 ) { if ( HIBYTE(v3) & 1 ) { v7 = 5; } else { if ( (v3 & 0x80u) == 0 ) { v5 = ((v3 & 0x40) != 0) + 1; goto LABEL_8; } v7 = 3; } v5 = v7; LABEL_8: v2 = (v1->pActiveSkills[36] & 0x3F) * (v5 - 1) + v4 + 9; } return v2; } //----- (0048C6AF) -------------------------------------------------------- Player::Player() { memset(&pEquipment, 0, sizeof(PlayerEquipment)); memset(pInventoryIndices, 0, 126 * sizeof(int)); for (uint i = 0; i < 126; ++i) pInventoryItems[i].Reset(); for (uint i = 0; i < 12; ++i) pEquippedItems[i].Reset(); for (uint i = 0; i < 24; ++i) { pPlayerBuffs[i].uSkill = 0; pPlayerBuffs[i].uSkill = 0; pPlayerBuffs[i].uPower = 0; pPlayerBuffs[i].uExpireTime = 0; pPlayerBuffs[i].uCaster = 0; pPlayerBuffs[i].uFlags = 0; } pName[0] = 0; uFace = 0; uVoiceID = 0; memset(pConditions, 0, 20 * sizeof(__int64)); field_BB = 0; uMight = uMightBonus = 0; uIntelligence = uIntelligenceBonus = 0; uWillpower = uWillpowerBonus = 0; uEndurance = uEnduranceBonus = 0; uSpeed = uSpeedBonus = 0; uAccuracy = uAccuracyBonus = 0; uLuck = uLuckBonus = 0; uLevel = sLevelModifier = 0; sAgeModifier = 0; memset(field_1F5, 0, 30); sResFireBase = sResFireBonus = 0; sResAirBase = sResAirBonus = 0; sResWaterBase = sResWaterBonus = 0; sResEarthBase = sResEarthBonus = 0; sResMagicBase = sResMagicBonus = 0; sResSpiritBase = sResSpiritBonus = 0; sResMindBase = sResMindBonus = 0; sResBodyBase = sResBodyBonus = 0; sResLightBase = sResLightBonus = 0; sResDarkBase = sResDarkBonus = 0; uTimeToRecovery = 0; uSkillPoints = 0; sHealth = 0; uFullHealthBonus = 0; _health_related = 0; sMana = 0; uFullManaBonus = 0; _mana_related = 0; uQuickSpell = 0; memset(pInstalledBeacons, 0, 5 * sizeof(LloydBeacon)); _some_attack_bonus = 0; field_1A91 = 0; _melee_dmg_bonus = 0; field_1A93 = 0; _ranged_atk_bonus = 0; field_1A95 = 0; _ranged_dmg_bonus = 0; field_1A97 = 0; expression = CHARACTER_EXPRESSION_INVALID; uExpressionTimePassed = 0; uExpressionTimeLength = 0; uNumDivineInterventionCastsThisDay = 0; uNumArmageddonCasts = 0; uNumFireSpikeCasts = 0; memset(field_1988, 0, 49 * sizeof(int)); memset(field_1A50, 0, 64 * sizeof(char)); field_E0 = 0; field_E4 = 0; field_E8 = 0; field_EC = 0; field_F0 = 0; field_F4 = 0; field_F8 = 0; field_FC = 0; field_100 = 0; field_104 = 0; } //----- (0048C6F6) -------------------------------------------------------- bool Party::AddItem(ItemGen *pItem) { unsigned int v2; // eax@1 unsigned int v3; // ecx@4 signed int v4; // edx@4 char *v5; // eax@8 unsigned int v6; // eax@10 Texture *v7; // ebx@10 signed int v8; // esi@10 Player *v9; // edi@11 int v10; // eax@11 bool result; // eax@15 std::string v12; // [sp-18h] [bp-40h]@9 const char *v13; // [sp-8h] [bp-30h]@9 int v14; // [sp-4h] [bp-2Ch]@9 int v15[4] = {0, 1, 2, 3}; // [sp+Ch] [bp-1Ch]@3 //int v16; // [sp+10h] [bp-18h]@3 //int v17; // [sp+14h] [bp-14h]@3 //int v18; // [sp+18h] [bp-10h]@3 Player *v19; // [sp+1Ch] [bp-Ch]@9 Party *v20; // [sp+20h] [bp-8h]@1 int v21; // [sp+24h] [bp-4h]@10 auto thos = this; v20 = thos; v2 = pItem->uItemID; if ( !BYTE2(pItemsTable->pItems[v2 + 1].uItemID) ) pItem->uAttributes |= 1u; ///v15 = 0; //v16 = 1; //v18 = 3; //v17 = 2; if ( uActiveCharacter ) { v3 = uActiveCharacter - 1; v4 = 0; do { v15[v4++] = v3++; if ( (signed int)v3 >= 4 ) v3 = 0; } while ( v4 < 4 ); } v5 = pItemsTable->pItems[v2].pIconName; if ( v5 ) { v6 = pIcons_LOD->LoadTexture(v5, TEXTURE_16BIT_PALETTE); v7 = (Texture *)(v6 != -1 ? &pIcons_LOD->pTextures[v6] : 0); v21 = areWeLoadingTexture; v8 = 0; while ( 1 ) { v9 = &v20->pPlayers[v15[v8]]; v19 = &v20->pPlayers[v15[v8]]; v10 = v19->AddItem(0xFFFFFFFFu, pItem->uItemID); if ( v10 ) break; ++v8; if ( v8 >= 4 ) { if ( !v21 ) { v7->Release(); pIcons_LOD->_40F9C5(); } goto LABEL_15; } } memcpy(&v9->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v10 + 5], pItem, 0x24u); pItem->Reset(); pAudioPlayer->PlaySound(SOUND_GoldReceived, 0, 0, -1, 0, 0, 0, 0); v19->PlaySound(SPEECH_60, 0); if ( !v21 ) { v7->Release(); pIcons_LOD->_40F9C5(); } result = 1; } else { MessageBoxW(nullptr, L"Invalid picture_name detected ::addItem()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Party.cpp:795", 0); LABEL_15: result = 0; } return result; } // 506128: using guessed type int areWeLoadingTexture; //----- (0048C855) -------------------------------------------------------- int Player::GetBaseStrength() { return this->uMight + GetItemsBonus(CHARACTER_ATTRIBUTE_STRENGTH, 0); } //----- (0048C86C) -------------------------------------------------------- int Player::GetBaseIntelligence() { return this->uIntelligence + GetItemsBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE, 0); } //----- (0048C883) -------------------------------------------------------- int Player::GetBaseWillpower() { return this->uWillpower + GetItemsBonus(CHARACTER_ATTRIBUTE_WILLPOWER, 0); } //----- (0048C89A) -------------------------------------------------------- int Player::GetBaseEndurance() { return this->uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0); } //----- (0048C8B1) -------------------------------------------------------- int Player::GetBaseAccuracy() { return this->uAccuracy + GetItemsBonus(CHARACTER_ATTRIBUTE_ACCURACY, 0); } //----- (0048C8C8) -------------------------------------------------------- int Player::GetBaseSpeed() { return this->uSpeed + GetItemsBonus(CHARACTER_ATTRIBUTE_SPEED, 0); } //----- (0048C8DF) -------------------------------------------------------- int Player::GetBaseLuck() { return this->uLuck + GetItemsBonus(CHARACTER_ATTRIBUTE_LUCK, 0); } //----- (0048C8F6) -------------------------------------------------------- int Player::GetBaseLevel() { return this->uLevel + GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL, 0); } //----- (0048C90D) -------------------------------------------------------- int Player::GetActualLevel() { return uLevel + sLevelModifier + GetMagicalBonus(CHARACTER_ATTRIBUTE_LEVEL) + GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL, 0); } //----- (0048C93C) -------------------------------------------------------- int Player::GetActualMight() { Player *v1; // esi@1 unsigned int v2; // eax@1 signed int v3; // ecx@1 signed int v4; // ebx@4 int v5; // edi@5 int v6; // ST14_4@5 v1 = this; v2 = this->sAgeModifier + GetBaseAge(); v3 = 0; while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) { ++v3; if ( v3 >= 4 ) { v4 = 100; goto LABEL_5; } } v4 = pAgeingStrengthMultiplier[v3]; LABEL_5: v5 = pConditionStrengthMultiplier[GetMajorConditionIdx()]; v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_STRENGTH, 0); return v5 * v4 * v1->uMight / 100 / 100 + GetMagicalBonus((CHARACTER_ATTRIBUTE_TYPE)0) + v6 + v1->uMightBonus; } //----- (0048C9C2) -------------------------------------------------------- int Player::GetActualIntelligence() { Player *v1; // esi@1 unsigned int sAge; // eax@1 signed int uAgeLevel; // ecx@1 signed int v4; // ebx@4 int v5; // edi@5 int v6; // ebp@5 v1 = this; sAge = this->sAgeModifier + GetBaseAge(); uAgeLevel = 0; while ( (signed int)sAge >= (signed int)pAgeingTable[uAgeLevel] ) { ++uAgeLevel; if ( uAgeLevel >= 4 ) { v4 = 100; goto LABEL_5; } } v4 = pAgeingIntelligenceMultiplier[uAgeLevel]; LABEL_5: v5 = pConditionIntelligenceMultiplier[GetMajorConditionIdx()]; v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE, 0); return v5 * v4 * v1->uIntelligence / 100 / 100 + GetMagicalBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE) + v6 + v1->uIntelligenceBonus; } //----- (0048CA3F) -------------------------------------------------------- int Player::GetActualWillpower() { int v5; // edi@5 uint uActualAge = GetBaseAge() + sAgeModifier; uint uAgeingMultiplier = 100; for (uint i = 0; i < 4; ++i) if (uActualAge >= pAgeingTable[i]) uAgeingMultiplier = pAgeingWillpowerMultiplier[i]; else break; v5 = pConditionWillpowerMultiplier[GetMajorConditionIdx()]; return v5 * uAgeingMultiplier * uWillpower / 100 / 100 + GetMagicalBonus(CHARACTER_ATTRIBUTE_WILLPOWER) + GetItemsBonus(CHARACTER_ATTRIBUTE_WILLPOWER, 0) + uWillpowerBonus; } //----- (0048CABC) -------------------------------------------------------- int Player::GetActualEndurance() { int v6; // ebp@5 uint uActualAge = GetBaseAge() + sAgeModifier; uint uAgeingMultiplier = 100; for (uint i = 0; i < 4; ++i) if (uActualAge >= pAgeingTable[i]) uAgeingMultiplier = pAgeingEnduranceMultiplier[i]; else break; auto uConditionMult = pConditionEnduranceMultiplier[GetMajorConditionIdx()]; auto uItemBonus = GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0); return uConditionMult * uAgeingMultiplier * uEndurance / 100 / 100 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ENDURANCE) + uItemBonus + uEnduranceBonus; } //----- (0048CB39) -------------------------------------------------------- int Player::GetActualAccuracy() { Player *v1; // esi@1 unsigned int v2; // eax@1 signed int v3; // ecx@1 signed int v4; // ebx@4 int v5; // edi@5 int v6; // ebp@5 v1 = this; v2 = this->sAgeModifier + GetBaseAge(); v3 = 0; while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) { ++v3; if ( v3 >= 4 ) { v4 = 100; goto LABEL_5; } } v4 = pAgeingAccuracyMultiplier[v3]; LABEL_5: v5 = pConditionAccuracyMultiplier[GetMajorConditionIdx()]; v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_ACCURACY, 0); return v5 * v4 * v1->uAccuracy / 100 / 100 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ACCURACY) + v6 + v1->uAccuracyBonus; } //----- (0048CBB6) -------------------------------------------------------- int Player::GetActualSpeed() { Player *v1; // esi@1 unsigned int v2; // eax@1 signed int v3; // ecx@1 signed int v4; // ebx@4 int v5; // edi@5 int v6; // ebp@5 v1 = this; v2 = this->sAgeModifier + GetBaseAge(); v3 = 0; while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) { ++v3; if ( v3 >= 4 ) { v4 = 100; goto LABEL_5; } } v4 = pAgeingSpeedMultiplier[v3]; LABEL_5: v5 = pConditionSpeedMultiplier[GetMajorConditionIdx()]; v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_SPEED, 0); return v5 * v4 * v1->uSpeed / 100 / 100 + GetMagicalBonus(CHARACTER_ATTRIBUTE_SPEED) + v6 + v1->uSpeedBonus; } //----- (0048CC33) -------------------------------------------------------- int Player::GetActualLuck() { Player *v1; // esi@1 unsigned int v2; // eax@7 signed int v3; // ecx@7 signed int v4; // ebx@10 int v5; // edi@11 int v6; // ebp@11 signed int v8; // [sp+10h] [bp-4h]@1 v8 = 0; v1 = this; if ( CheckHiredNPCSpeciality(0x1Bu) ) v8 = 5; if ( CheckHiredNPCSpeciality(0x1Cu) ) v8 += 20; if ( CheckHiredNPCSpeciality(0x2Fu) ) v8 += 10; v2 = v1->sAgeModifier + GetBaseAge(); v3 = 0; while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) { ++v3; if ( v3 >= 4 ) { v4 = 100; goto LABEL_11; } } v4 = pAgeingLuckMultiplier[v3]; LABEL_11: v5 = pConditionLuckMultiplier[GetMajorConditionIdx()]; v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_LUCK, 0); return GetMagicalBonus(CHARACTER_ATTRIBUTE_LUCK) + v6 + v8 + v5 * v4 * v1->uLuck / 100 / 100 + v1->uLuckBonus; } //----- (0048CCF5) -------------------------------------------------------- int Player::GetActualAttack(int a2) { Player *v2; // esi@1 int v3; // eax@1 int v4; // edi@1 int v5; // ebx@1 int v6; // ebp@1 v2 = this; v3 = GetActualAccuracy(); v4 = _48EA1B_get_static_effect(v3); v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_ATTACK); v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_ATTACK, a2); return v4 + v5 + v6 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ATTACK) + v2->_some_attack_bonus; } //----- (0048CD45) -------------------------------------------------------- int Player::GetMeleeDamageMinimal() { Player *v1; // edi@1 int v2; // eax@1 int v3; // esi@1 int v4; // esi@1 int v5; // esi@1 int v6; // esi@1 signed int result; // eax@1 v1 = this; v2 = GetActualMight(); v3 = _48EA1B_get_static_effect(v2); v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0) + v3; v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; v6 = v1->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; result = 1; if ( v6 >= 1 ) result = v6; return result; } //----- (0048CD90) -------------------------------------------------------- int Player::GetMeleeDamageMaximal() { Player *v1; // edi@1 int v2; // eax@1 int v3; // esi@1 int v4; // esi@1 int v5; // esi@1 int v6; // esi@1 signed int result; // eax@1 v1 = this; v2 = GetActualMight(); v3 = _48EA1B_get_static_effect(v2); v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0) + v3; v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; v6 = v1->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; result = 1; if ( v6 >= 1 ) result = v6; return result; } //----- (0048CDDB) -------------------------------------------------------- int Player::CalculateMeleeDamageTo(int a2, int a3, unsigned int uTargetActorID) { int v4; // esi@1 Player *v5; // edi@1 ItemGen *v6; // ebx@4 unsigned int v7; // ebp@4 unsigned int v8; // esi@4 int v9; // eax@4 int v10; // eax@9 char v11; // zf@9 int v12; // esi@10 int v13; // eax@11 enum MONSTER_SUPERTYPE v14; // edx@24 ItemGen *v15; // ebx@35 unsigned int v16; // ebp@35 unsigned int v17; // esi@35 int v18; // edx@38 int v19; // eax@40 enum MONSTER_SUPERTYPE v20; // edx@53 int v21; // esi@62 int v22; // eax@63 int v23; // ebx@63 int v24; // ebx@63 signed int result; // eax@64 MONSTER_SUPERTYPE v26; // [sp-4h] [bp-24h]@20 MONSTER_SUPERTYPE v27; // [sp-4h] [bp-24h]@49 int v28; // [sp+10h] [bp-10h]@1 int v29; // [sp+10h] [bp-10h]@33 signed int v30; // [sp+14h] [bp-Ch]@7 signed int v31; // [sp+14h] [bp-Ch]@36 int v32; // [sp+18h] [bp-8h]@1 int v33; // [sp+18h] [bp-8h]@8 int v34; // [sp+1Ch] [bp-4h]@1 int v35; // [sp+28h] [bp+8h]@37 v4 = 0; v5 = this; v34 = 0; v32 = 0; v28 = 0; if ( IsUnarmed() == 1 ) { v32 = rand() % 3 + 1; LABEL_61: v34 = v4; goto LABEL_62; } if ( HasItemEquipped(EQUIP_TWO_HANDED) ) { v6 = (ItemGen *)&v5->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v5->pEquipment.uMainHand + 5]; v7 = v6->uItemID; v8 = v6->uItemID; v9 = pItemsTable->pItems[v8].uDamageDice; if ( pItemsTable->pItems[v8].uSkillType == PLAYER_SKILL_SPEAR && !v5->pEquipment.uOffHand ) ++v9; v30 = pItemsTable->pItems[v8].uDamageRoll; if ( v9 > 0 ) { v33 = v9; do { v10 = rand(); v11 = v33-- == 1; v28 += v10 % v30 + 1; } while ( !v11 ); } v12 = pItemsTable->pItems[v8].uDamageMod + v28; if ( !uTargetActorID ) goto LABEL_28; v13 = v6->uAdditionalValue; if ( v13 == 64 || v7 == 507 || v7 == 508 || v7 == 527 ) { v14 = (MONSTER_SUPERTYPE)1; } else { if ( v13 == 39 ) { v26 = MONSTER_SUPERTYPE_KREEGAN; } else { if ( v13 == 40 ) { v26 = MONSTER_SUPERTYPE_DRAGON; } else { if ( v13 == 63 || v7 == 517 ) { v26 = MONSTER_SUPERTYPE_ELF; } else { if ( v13 != 65 ) { LABEL_28: if ( (signed int)SkillToMastery(v5->pActiveSkills[2]) >= 3 && pItemsTable->pItems[v6->uItemID].uSkillType == 2 && rand() % 100 < 10 ) v12 *= 3; v32 = v12; goto LABEL_33; } v26 = MONSTER_SUPERTYPE_TITAN; } } } v14 = v26; } if ( MonsterStats::BelongsToSupertype(uTargetActorID, v14) ) v12 *= 2; goto LABEL_28; } LABEL_33: v29 = 0; if ( !a3 ) { if ( v5->HasItemEquipped((ITEM_EQUIP_TYPE)0) ) { v15 = (ItemGen *)&v5->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v5->pEquipment.uOffHand + 5]; v16 = v15->uItemID; v17 = v15->uItemID; if ( pItemsTable->pItems[v17].uEquipType != 4 ) { v31 = pItemsTable->pItems[v17].uDamageRoll; if ( (signed int)pItemsTable->pItems[v17].uDamageDice > 0 ) { v35 = pItemsTable->pItems[v17].uDamageDice; do { v18 = rand() % v31; v11 = v35-- == 1; v29 += v18 + 1; } while ( !v11 ); } v4 = pItemsTable->pItems[v17].uDamageMod + v29; if ( !uTargetActorID ) goto LABEL_57; v19 = v15->uAdditionalValue; if ( v19 == 64 || v16 == 507 || v16 == 508 || v16 == 527 ) { v20 = (MONSTER_SUPERTYPE)1; } else { if ( v19 == 39 ) { v27 = MONSTER_SUPERTYPE_KREEGAN; } else { if ( v19 == 40 ) { v27 = MONSTER_SUPERTYPE_DRAGON; } else { if ( v19 == 63 || v16 == 517 ) { v27 = MONSTER_SUPERTYPE_ELF; } else { if ( v19 != 65 ) { LABEL_57: if ( pItemsTable->pItems[v15->uItemID].uSkillType == PLAYER_SKILL_DAGGER && SkillToMastery(v5->pActiveSkills[2] >= 3u) && rand() % 100 < 10 ) v4 *= 3; goto LABEL_61; } v27 = MONSTER_SUPERTYPE_TITAN; } } } v20 = v27; } if ( MonsterStats::BelongsToSupertype(uTargetActorID, v20) ) v4 *= 2; goto LABEL_57; } } } LABEL_62: v21 = v32 + v34; if ( !a2 ) { v22 = GetActualMight(); v23 = _48EA1B_get_static_effect(v22); v24 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v23; v21 += v5->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v24; } result = 1; if ( v21 >= 1 ) result = v21; return result; } //----- (0048D0B9) -------------------------------------------------------- int Player::GetRangedAttack() { Player *v1; // esi@1 int v2; // eax@1 int v3; // edi@3 int v4; // eax@4 int v5; // edi@4 int v6; // edi@4 int v7; // edi@4 v1 = this; v2 = *(int *)&this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * this->pEquipment.uMainHand + 5]; if ( v2 < 64 || v2 > 65 ) { v4 = GetActualAccuracy(); v5 = _48EA1B_get_static_effect(v4); v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK, 0) + v5; v7 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v6; v3 = v1->_ranged_atk_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v7; } else { v3 = GetActualAttack(1); } return v3; } //----- (0048D124) -------------------------------------------------------- int Player::GetRangedDamageMin() { Player *v1; // esi@1 int v2; // edi@1 int v3; // edi@1 int v4; // edi@1 unsigned __int16 v5; // ax@1 int result; // eax@6 v1 = this; v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_MIN, 0); v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v2; v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v3; v5 = v1->pActiveSkills[5]; if ( v5 && (signed int)SkillToMastery(v5) >= 4 && HasItemEquipped(EQUIP_BOW) ) v4 += v1->pActiveSkills[5] & 0x3F; if ( v4 >= 1 ) result = v4; else result = 0; return result; } //----- (0048D191) -------------------------------------------------------- int Player::GetRangedDamageMax() { Player *v1; // esi@1 int v2; // edi@1 int v3; // edi@1 int v4; // edi@1 unsigned __int16 v5; // ax@1 int result; // eax@6 v1 = this; v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_MAX, 0); v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v2; v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v3; v5 = v1->pActiveSkills[5]; if ( v5 && (signed int)SkillToMastery(v5) >= 4 && HasItemEquipped(EQUIP_BOW) ) v4 += v1->pActiveSkills[5] & 0x3F; if ( v4 >= 1 ) result = v4; else result = 0; return result; } //----- (0048D1FE) -------------------------------------------------------- bool Player::CalculateRangedDamageTo(int a2) { Player *v2; // ebx@1 bool result; // eax@1 ItemGen *v4; // ebx@2 unsigned int v5; // edi@2 unsigned int v6; // esi@2 int v7; // edx@4 char v8; // zf@4 int v9; // esi@5 int v10; // ebx@6 enum MONSTER_SUPERTYPE v11; // edx@7 unsigned __int16 v12; // ax@19 MONSTER_SUPERTYPE v13; // [sp-Ch] [bp-20h]@13 Player *v14; // [sp+4h] [bp-10h]@1 signed int v15; // [sp+8h] [bp-Ch]@2 int v16; // [sp+Ch] [bp-8h]@3 int v17; // [sp+10h] [bp-4h]@1 v17 = 0; v2 = this; v14 = this; result = HasItemEquipped(EQUIP_BOW); if ( !result ) return result; v4 = (ItemGen *)&v2->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v2->pEquipment.uBow + 5]; v5 = v4->uItemID; v6 = v4->uItemID; v15 = pItemsTable->pItems[v6].uDamageRoll; if ( (signed int)pItemsTable->pItems[v6].uDamageDice > 0 ) { v16 = pItemsTable->pItems[v6].uDamageDice; do { v7 = rand() % v15; v8 = v16-- == 1; v17 += v7 + 1; } while ( !v8 ); } v9 = pItemsTable->pItems[v6].uDamageMod + v17; if ( a2 ) { v10 = v4->uAdditionalValue; if ( v10 == 64 ) { v11 = (MONSTER_SUPERTYPE)1; goto LABEL_17; } if ( v10 == 39 || v5 == 508 ) { v13 = MONSTER_SUPERTYPE_KREEGAN; goto LABEL_16; } if ( v10 == 40 ) { v13 = MONSTER_SUPERTYPE_DRAGON; goto LABEL_16; } if ( v10 == 63 || v5 == 517 ) { v13 = MONSTER_SUPERTYPE_ELF; LABEL_16: v11 = v13; LABEL_17: if ( MonsterStats::BelongsToSupertype(a2, v11) ) v9 *= 2; goto LABEL_19; } } LABEL_19: v12 = v14->pActiveSkills[5]; if ( v12 ) { if ( (signed int)SkillToMastery(v12) >= 4 ) v9 += v14->pActiveSkills[5] & 0x3F; } return v9; } //----- (0048D2EA) -------------------------------------------------------- char *Player::GetMeleeDamageString() { Player *v1; // esi@1 signed int v2; // eax@1 signed int v3; // edi@3 signed int v4; // eax@3 signed int v5; // ST0C_4@6 char *v6; // edi@6 signed int v7; // ST08_4@7 unsigned int v8; // eax@8 signed int v9; // esi@9 static char player__getmeleedamagestring_static_buff[40]; // idb v1 = this; v2 = *(int *)&this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * this->pEquipment.uMainHand + 5]; if ( v2 < 64 || v2 > 65 ) { v3 = GetMeleeDamageMinimal(); v4 = GetMeleeDamageMaximal(); } else { v3 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0); v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0); } if ( v3 == v4 ) { v5 = v3; v6 = player__getmeleedamagestring_static_buff; sprintf(player__getmeleedamagestring_static_buff, "%d", v5); } else { v7 = v3; v6 = player__getmeleedamagestring_static_buff; sprintf(player__getmeleedamagestring_static_buff, "%d - %d", v7, v4); } v8 = v1->pEquipment.uMainHand; if ( v8 ) { v9 = *(int *)&v1->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v8 + 5]; if ( v9 >= 135 ) { if ( v9 <= 159 ) strcpy(v6, pGlobalTXT_LocalizationStrings[595]); } } return v6; } //----- (0048D396) -------------------------------------------------------- char *Player::GetRangedDamageString() { Player *v1; // esi@1 signed int v2; // eax@1 int v3; // edi@3 int v4; // eax@3 char *v5; // edi@6 int v6; // ST0C_4@8 int v7; // ST08_4@9 unsigned int v8; // eax@10 signed int v9; // esi@11 static char player__getrangeddamagestring_static_buff[40]; // idb v1 = this; v2 = *(int *)&this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * this->pEquipment.uMainHand + 5]; if ( v2 < 64 || v2 > 65 ) { v3 = GetRangedDamageMin(); v4 = GetRangedDamageMax(); } else { v3 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 1); v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 1); } if ( v4 ) { if ( v3 == v4 ) { v6 = v3; v5 = player__getrangeddamagestring_static_buff; sprintf(player__getrangeddamagestring_static_buff, "%d", v6); } else { v7 = v3; v5 = player__getrangeddamagestring_static_buff; sprintf(player__getrangeddamagestring_static_buff, "%d - %d", v7, v4); } } else { v5 = player__getrangeddamagestring_static_buff; strcpy(player__getrangeddamagestring_static_buff, "N/A"); } v8 = v1->pEquipment.uMainHand; if ( v8 ) { v9 = *(int *)&v1->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v8 + 5]; if ( v9 >= 135 ) { if ( v9 <= 159 ) strcpy(v5, pGlobalTXT_LocalizationStrings[595]); } } return v5; } //----- (0048D45A) -------------------------------------------------------- bool Player::CanTrainToNextLevel() { int v1; // edx@1 int v2; // eax@1 int i; // esi@1 v1 = this->uLevel; v2 = 0; for ( i = 0; i < v1; ++i ) v2 += i + 1; return (signed __int64)this->uExperience >= 1000 * v2; } //----- (0048D498) -------------------------------------------------------- unsigned int Player::GetExperienceDisplayColor() { unsigned int result; // eax@2 if ( CanTrainToNextLevel() ) result = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0); else result = 0; return result; } //----- (0048D4B3) -------------------------------------------------------- int Player::CalculateIncommingDamage(int resistance, signed int type) { Player *v3; // esi@1 int v4; // edi@8 int v6; // eax@21 signed int v7; // ebx@21 int v8; // eax@22 signed int v9; // ebx@22 int v10; // eax@23 signed int v11; // ebx@23 int v12; // eax@24 signed int v13; // edi@24 unsigned int v14; // eax@27 int v15; // eax@29 double v16; // st7@32 enum CHARACTER_ATTRIBUTE_TYPE v17; // [sp-4h] [bp-10h]@9 signed int v18; // [sp+8h] [bp-4h]@17 v3 = this; if ( !resistance ) { v17 = (CHARACTER_ATTRIBUTE_TYPE)10; goto LABEL_16; } if ( resistance == 1 ) { v17 = (CHARACTER_ATTRIBUTE_TYPE)11; goto LABEL_16; } if ( resistance == 2 ) { v17 = (CHARACTER_ATTRIBUTE_TYPE)12; goto LABEL_16; } if ( resistance == 3 ) { v17 = (CHARACTER_ATTRIBUTE_TYPE)13; goto LABEL_16; } if ( resistance == 6 ) { v17 = (CHARACTER_ATTRIBUTE_TYPE)33; goto LABEL_16; } if ( resistance == 7 ) { v17 = (CHARACTER_ATTRIBUTE_TYPE)14; goto LABEL_16; } if ( resistance == 8 ) { v17 = (CHARACTER_ATTRIBUTE_TYPE)15; LABEL_16: v4 = GetActualResistance(v17); goto LABEL_17; } v4 = 0; LABEL_17: v18 = type; if ( v3->classType == PLAYER_CLASS_LICH && v4 >= 200 ) return 0; if ( v4 ) { v6 = GetActualLuck(); v7 = _48EA1B_get_static_effect(v6) + v4 + 30; if ( rand() % v7 >= 30 ) { v18 = type >> 1; v8 = GetActualLuck(); v9 = _48EA1B_get_static_effect(v8) + v4 + 30; if ( rand() % v9 >= 30 ) { v18 = type >> 2; v10 = GetActualLuck(); v11 = _48EA1B_get_static_effect(v10) + v4 + 30; if ( rand() % v11 >= 30 ) { v18 = type >> 3; v12 = GetActualLuck(); v13 = _48EA1B_get_static_effect(v12) + v4 + 30; if ( rand() % v13 >= 30 ) v18 = type >> 4; } } } } if ( resistance == 4 ) { v14 = v3->pEquipment.uBody; if ( v14 ) { if ( !(v3->field_1F5[36 * v14 + 15] & 2) ) { v15 = GetEquippedItemSkillType(EQUIP_ARMOUR) - 10; if ( v15 ) { if ( v15 != 1 || (signed int)SkillToMastery(v3->pActiveSkills[11]) < 3 ) return v18; v16 = (double)v18 * 0.5; return (signed __int64)v16; } if ( (signed int)SkillToMastery(v3->pActiveSkills[10]) >= 4 ) { v16 = (double)v18 * 0.66670001; return (signed __int64)v16; } } } } return v18; } //----- (0048D62C) -------------------------------------------------------- int Player::GetEquippedItemEquipType(unsigned int uEquipSlot) { return pItemsTable->pItems[*(int *)&this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *(&this->pEquipment.uOffHand + uEquipSlot) + 5]].uEquipType; } //----- (0048D651) -------------------------------------------------------- int Player::GetEquippedItemSkillType(enum ITEM_EQUIP_TYPE uEquipSlot) { return pItemsTable->pItems[*(int *)&this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *(&this->pEquipment.uOffHand + uEquipSlot) + 5]].uSkillType; } //----- (0048D676) -------------------------------------------------------- bool Player::IsUnarmed() { return HasItemEquipped(EQUIP_TWO_HANDED) != 1 && (HasItemEquipped(EQUIP_ONE_OR_TWO_HANDS) != 1 || GetEquippedItemEquipType(0) == EQUIP_SHIELD); } //----- (0048D6AA) -------------------------------------------------------- bool Player::HasItemEquipped(ITEM_EQUIP_TYPE uEquipIndex) { auto i = pEquipment.pIndices[uEquipIndex]; if (i) return ~pInventoryItems[i - 1].uAttributes & 0x02; else return false; } //----- (0048D6D0) -------------------------------------------------------- bool Player::HasEnchantedItemEquipped(int uEnchantment) { for (uint i = 0; i < 16; ++i) { if (HasItemEquipped((ITEM_EQUIP_TYPE)i) && pInventoryItems[i].uAdditionalValue == uEnchantment) // *(int *)&this->field_1F6[36 * pEquipment[i] + 6] != uEnchantment) return true; } return false; } //----- (0048D709) -------------------------------------------------------- bool Player::WearsItem(int a1, signed int a2) { int v3; // edx@2 Player *v4; // ecx@2 int v6; // esi@5 int v7; // edx@6 if ( a2 >= 16 ) { v6 = 0; while ( !HasItemEquipped((ITEM_EQUIP_TYPE)v6) || *(int *)&this->pInventoryItems[a2-1].uItemID != a1 ) { ++v6; if ( (signed int)v6 >= 16 ) return 0; } return 1; } if ( HasItemEquipped((ITEM_EQUIP_TYPE)a2) && *(int *)&v4->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *(&v4->pEquipment.uOffHand + v3) + 5] == a1 ) return 1; return 0; } //----- (0048D76C) -------------------------------------------------------- bool Player::StealFromShop(ItemGen *a2, int a3, int a4, int a5, int *a6) { unsigned __int16 v6; // cx@8 int v7; // edi@8 unsigned int v8; // ebx@8 unsigned int v9; // esi@8 int v10; // eax@8 int v11; // edi@12 bool result; // eax@13 if ( !a2 || this->pConditions[16] || this->pConditions[14] || this->pConditions[15] || this->pConditions[4] || this->pConditions[13] || this->pConditions[2] ) { result = 0; } else { v6 = this->pActiveSkills[34]; v7 = v6 & 0x3F; v8 = SkillToMastery(v6); v9 = a2->GetValue(); v10 = pItemsTable->pItems[a2->uItemID].uEquipType; if ( !pItemsTable->pItems[a2->uItemID].uEquipType || v10 == 1 || v10 == 2 ) v9 *= 3; v11 = dword_4EDEB4[rand() % 100 / 20] + v7 * dword_4EDEA0[v8]; *a6 = 100 * (a4 + a3) + v9 + (a5 != 0 ? 0x1F4 : 0); if ( rand() % 100 >= 5 ) { if ( *a6 > v11 ) result = *a6 - v11 < 500; else result = 2; } else { result = 0; } } return result; } // 4EDEA0: using guessed type int dword_4EDEA0[]; // 4EDEB4: using guessed type int dword_4EDEB4[]; //----- (0048D88B) -------------------------------------------------------- int Player::StealFromActor(unsigned int uActorID, int _steal_perm, int reputation) { Player *v4; // esi@1 Actor *v5; // edi@1 unsigned __int16 v6; // cx@10 int v7; // ebx@10 unsigned int v8; // esi@10 int v9; // eax@10 int v10; // esi@10 int v11; // eax@13 signed int v12; // ebx@15 signed int v13; // edx@15 int v14; // ecx@15 unsigned __int16 v15; // si@21 unsigned int v16; // ebx@24 int v17; // esi@24 const void *v18; // eax@29 unsigned int v19; // esi@31 int v20; // eax@34 char v21; // zf@36 unsigned int v22; // ST0C_4@39 char *v23; // esi@39 const char *v25; // [sp-Ch] [bp-48h]@40 int v26; // [sp-8h] [bp-44h]@40 ItemGen v27; // [sp+8h] [bp-34h]@15 unsigned int v28; // [sp+2Ch] [bp-10h]@10 int v29; // [sp+30h] [bp-Ch]@10 int v30; // [sp+34h] [bp-8h]@10 Player *v31; // [sp+38h] [bp-4h]@1 signed int _steal_perma; // [sp+48h] [bp+Ch]@12 v4 = this; v5 = &pActors[uActorID]; v31 = this; if ( &pActors[uActorID] && !this->pConditions[16] && !this->pConditions[14] && !this->pConditions[15] && !this->pConditions[4] && !this->pConditions[13] && !this->pConditions[2] ) { if ( !(BYTE2(v5->uAttributes) & 0x80) ) pActors[uActorID].SetRandomGoldIfTheresNoItem(); v6 = v4->pActiveSkills[34]; v7 = v6 & 0x3F; v8 = SkillToMastery(v6); v9 = rand(); v28 = 4 * v8; v30 = dword_4EDEA0[v8]; v29 = dword_4EDEB4[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) ) { Actor::_43AC45(uActorID, 1); _steal_perma = 0; v26 = (int)v31->pName; v25 = pGlobalTXT_LocalizationStrings[376]; } else { v11 = rand(); if ( v11 % 100 >= 40 ) { if ( v11 % 100 >= 70 ) { v19 = 0; if ( v7 > 0 ) { do { --v7; v19 += rand() % dword_4EDEC4[v28 / 4] + 1; } while ( v7 ); } if ( pItemsTable->pItems[v5->array_000234[3].uItemID].uEquipType != 18 ) return _steal_perma; v20 = (int)&v5->array_000234[3].uAdditionalValue; if ( (signed int)v19 > v5->array_000234[3].uAdditionalValue ) v19 = v5->array_000234[3].uAdditionalValue; v21 = *(int *)v20 == v19; *(int *)v20 -= v19; if ( v21 ) v5->array_000234[3].uItemID = 0; if ( v19 ) { party_finds_gold(v19, 2); v22 = v19; v23 = pTmpBuf2; sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[302], v31->pName, v22); LABEL_43: ShowStatusBarString(v23, 2u); return _steal_perma; } } else { v27.Reset(); v12 = 0; v13 = 0; v14 = (int)v5->array_000234; while ( !*(int *)v14 || pItemsTable->pItems[*(int *)v14].uEquipType == 18 ) { ++v13; v14 += 36; if ( v13 >= 4 ) goto LABEL_21; } v12 = 1; LABEL_21: v15 = v5->uCarriedItemID; if ( v15 || v12 ) { v27.Reset(); if ( v15 ) { v16 = (signed __int16)v15; v5->uCarriedItemID = 0; v27.uItemID = (signed __int16)v15; v17 = (signed __int16)v15; if ( pItemsTable->pItems[v17].uEquipType == 12 ) v27.uNumCharges = rand() % 6 + pItemsTable->pItems[v17].uDamageMod + 1; if ( pItemsTable->pItems[v17].uEquipType == 14 ) { if ( v16 != 220 ) v27._bonus_type = 2 * rand() % 4 + 2; } } else { v18 = &v5->array_000234[rand() % 4]; memcpy(&v27, v18, sizeof(v27)); ((ItemGen *)v18)->Reset(); v16 = v27.uItemID; } sub_421B2C_PlaceInInventory_or_DropPickedItem(); sprintf( pTmpBuf2, pGlobalTXT_LocalizationStrings[304], v31->pName, pItemsTable->pItems[v16].pUnidentifiedName); ShowStatusBarString(pTmpBuf2, 2u); sub_421B2C_PlaceInInventory_or_DropPickedItem(); memcpy(&pParty->pPickedItem, &v27, sizeof(pParty->pPickedItem)); pMouse->SetCursorBitmapFromItemID(v16); return _steal_perma; } } } v26 = (int)v31->pName; v25 = pGlobalTXT_LocalizationStrings[377]; } v23 = pTmpBuf2; sprintf(pTmpBuf2, v25, v26); goto LABEL_43; } return 0; } // 4EDEA0: using guessed type int dword_4EDEA0[]; // 4EDEB4: using guessed type int dword_4EDEB4[]; // 4EDEC4: using guessed type int dword_4EDEC4[]; //----- (0048DBB9) -------------------------------------------------------- void Player::Heal(int amount) { Player *v2; // esi@1 signed int v3; // eax@3 v2 = this; if ( !this->pConditions[16] && !this->pConditions[14] ) { v3 = GetMaxHealth(); if ( v2->pConditions[17] ) v3 /= 2; v2->sHealth += amount; if ( v2->sHealth > v3 ) v2->sHealth = v3; if ( v2->pConditions[13] ) { if ( v2->sHealth > 0 ) { LODWORD(v2->pConditions[13]) = 0; HIDWORD(v2->pConditions[13]) = 0; } } } } //----- (0048DC1E) -------------------------------------------------------- int Player::ReceiveDamage(signed int type, int resistance) { Player *v3; // esi@1 signed int v4; // eax@1 int v5; // eax@1 bool v6; // ebx@1 unsigned int v7; // eax@8 char *v8; // ecx@9 int v9; // eax@9 //signed int typea; // [sp+14h] [bp+8h]@1 v3 = this; this->pConditions[2] = 0i64; v4 = CalculateIncommingDamage(resistance, type); v3->sHealth -= v4; //typea = v4; v5 = v3->sHealth; v6 = v5 < -10; LOBYTE(v6) = v5 <= -10; if ( v5 < 1 ) { if ( v3->sHealth + v3->uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1 || (signed __int64)v3->pPlayerBuffs[11].uExpireTime > 0 ) { SetCondition(0xDu, 0); } else { SetCondition(0xEu, 0); v6 = LODWORD(pParty->uTimePlayed); if ( v3->sHealth > 0 ) v3->sHealth = 0; } if ( v6 ) { v7 = v3->pEquipment.uBody; if ( v7 ) { v8 = &v3->field_1F5[36 * v7 + 15]; v9 = *(int *)v8; if ( !(BYTE1(v9) & 2) ) { LOBYTE(v9) = v9 | 2; *(int *)v8 = v9; } } } } if ( v4 && CanAct() ) PlaySound(SPEECH_24, 0); return v4; } //----- (0048DCF6) -------------------------------------------------------- int Player::_48DCF6(int a2, Actor *pActor) { signed int v3; // edi@1 signed int v4; // ebx@1 Player *v5; // esi@1 int v6; // eax@2 int v7; // eax@5 int v8; // eax@8 int v9; // ebx@8 int v10; // eax@8 int v11; // ebx@8 signed int v12; // edx@9 ItemGen *v13; // eax@9 int v14; // edx@16 unsigned int v15; // edx@17 int v16; // edx@26 unsigned int v17; // edx@27 Player *v18; // ecx@32 signed int v19; // edx@38 int *v20; // ecx@38 signed int v21; // eax@40 int v22; // eax@49 signed int v23; // ebx@49 unsigned int v24; // eax@60 int v25; // ecx@61 int v26; // ebx@74 void *v27; // ecx@76 unsigned int v28; // ebx@78 signed int result; // eax@86 SoundID v30; // [sp-20h] [bp-C0h]@56 signed int v31; // [sp-1Ch] [bp-BCh]@56 unsigned int v32; // [sp-18h] [bp-B8h]@56 signed int v33; // [sp-14h] [bp-B4h]@56 signed int v34; // [sp-10h] [bp-B0h]@56 int v35; // [sp-Ch] [bp-ACh]@56 unsigned int v36; // [sp-8h] [bp-A8h]@51 unsigned int v37; // [sp-8h] [bp-A8h]@56 unsigned int v38; // [sp-8h] [bp-A8h]@57 unsigned int v39; // [sp-8h] [bp-A8h]@68 enum CHARACTER_ATTRIBUTE_TYPE v40; // [sp-4h] [bp-A4h]@4 int v41; // [sp-4h] [bp-A4h]@51 int v42; // [sp-4h] [bp-A4h]@56 int v43; // [sp-4h] [bp-A4h]@57 signed int v44; // [sp-4h] [bp-A4h]@59 int v45; // [sp-4h] [bp-A4h]@68 char v46[140]; // [sp+Ch] [bp-94h]@13 unsigned int v47; // [sp+98h] [bp-8h]@1 int v48; // [sp+9Ch] [bp-4h]@1 v3 = 0; v4 = 0; v5 = this; v47 = 0; v48 = 0; switch ( a2 ) { case 1: v6 = GetActualWillpower(); goto LABEL_46; case 2: case 3: case 4: case 9: case 10: case 11: case 13: case 21: v6 = GetActualEndurance(); goto LABEL_46; case 5: case 12: case 23: v40 = (CHARACTER_ATTRIBUTE_TYPE)14; goto LABEL_5; case 15: v40 = (CHARACTER_ATTRIBUTE_TYPE)13; goto LABEL_5; case 6: case 7: case 8: case 14: case 16: v40 = (CHARACTER_ATTRIBUTE_TYPE)15; LABEL_5: v7 = GetActualResistance(v40); goto LABEL_47; case 22: v8 = GetActualWillpower(); v9 = _48EA1B_get_static_effect(v8); v10 = GetActualIntelligence(); v11 = (_48EA1B_get_static_effect(v10) + v9) >> 1; break; case 17: v12 = 0; v13 = this->pInventoryItems; do { if ( (signed int)v13->uItemID > 0 && (signed int)v13->uItemID <= 134 && !(v13->uAttributes & 2) ) v46[v4++] = v12; ++v12; ++v13; } while ( v12 < 138 ); goto LABEL_36; case 18: v14 = 0; do { if ( HasItemEquipped((ITEM_EQUIP_TYPE)v14) ) { if ( v15 == 3 ) v46[v4++] = LOBYTE(v5->pEquipment.uBody) - 1; if ( (!v15 || v15 == 1) && GetEquippedItemEquipType(v15) == 4 ) v46[v4++] = *((char *)&v5->pEquipment.uOffHand + 4 * v15) - 1; } v14 = v15 + 1; } while ( v14 < 16 ); goto LABEL_36; case 19: v16 = 0; do { if ( HasItemEquipped((ITEM_EQUIP_TYPE)v16) ) { if ( v17 == 2 ) v46[v4++] = LOBYTE(v5->pEquipment.uBow) - 1; if ( (!v17 || v17 == 1) && (!GetEquippedItemEquipType(v17) || GetEquippedItemEquipType(v17) == 1) ) v46[v4++] = *((char *)&v5->pEquipment.uOffHand + 4 * v17) - 1; } v16 = v17 + 1; } while ( v16 < 16 ); LABEL_36: if ( !v4 ) goto LABEL_87; v48 = (int)&v5->pInventoryItems[(unsigned __int8)v46[rand() % v4]]; v11 = 3 * (pItemsTable->pItems[*(int *)v48].uMaterial + pItemsTable->pItems[*(int *)v48].uDamageMod); break; case 20: v19 = 0; v20 = this->pInventoryIndices; do { if ( *v20 > 0 ) { v21 = *(int *)&v5->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *v20 + 5]; if ( v21 > 0 ) { if ( v21 <= 134 ) v46[v4++] = v19; } } ++v19; ++v20; } while ( v19 < 126 ); if ( !v4 ) goto LABEL_87; v47 = (unsigned __int8)v46[rand() % v4]; v6 = GetActualAccuracy(); LABEL_46: v7 = _48EA1B_get_static_effect(v6); LABEL_47: v11 = v7; break; default: v11 = 0; break; } v22 = GetActualLuck(); v23 = _48EA1B_get_static_effect(v22) + v11 + 30; if ( rand() % v23 >= 30 ) { LABEL_87: result = 0; } else { switch ( a2 ) { case 1: v41 = 1; v36 = 0; goto LABEL_56; case 2: v41 = 1; v36 = 1; goto LABEL_56; case 3: v41 = 1; v36 = 2; goto LABEL_56; case 23: v41 = 1; v36 = 3; goto LABEL_56; case 4: v41 = 1; v36 = 4; LABEL_56: SetCondition(v36, v41); v42 = 0; v37 = 0; v35 = 0; v34 = 0; v33 = -1; v32 = 0; v31 = 0; v30 = (SoundID)221; goto LABEL_83; case 5: v43 = 1; v38 = 5; goto LABEL_70; case 6: case 7: case 8: if ( a2 == 6 ) { v44 = 6; goto LABEL_60; } v25 = 2 * (a2 != 8) + 8; goto LABEL_65; case 9: if ( a2 == 6 ) { v44 = 7; LABEL_60: v24 = v44; } else { v25 = 2 * (a2 != 8) + 9; LABEL_65: v24 = v25; } SetCondition(v24, 1); v42 = 0; v37 = 0; v35 = 0; v34 = 0; v33 = -1; v32 = 0; v31 = 0; v30 = (SoundID)222; LABEL_83: pAudioPlayer->PlaySound(v30, v31, v32, v33, v34, v35, v37, v42); do { LABEL_84: if ( v5 == pPlayers[v3 + 1] ) break; ++v3; } while ( v3 < 4 ); pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); result = 1; break; case 12: v43 = 1; v38 = 12; goto LABEL_70; case 15: v45 = 1; v39 = 15; goto LABEL_73; case 13: v43 = 1; v38 = 13; LABEL_70: SetCondition(v38, v43); v42 = 0; v37 = 0; v35 = 0; v34 = 0; v33 = -1; v32 = 0; v31 = 0; v30 = (SoundID)224; goto LABEL_83; case 14: v45 = 1; v39 = 14; goto LABEL_73; case 16: v45 = 1; v39 = 16; LABEL_73: SetCondition(v39, v45); v42 = 0; v37 = 0; v35 = 0; v34 = 0; v33 = -1; v32 = 0; v31 = 0; v30 = (SoundID)225; goto LABEL_83; case 17: case 18: case 19: v26 = v48; if ( *(char *)(v48 + 21) & 2 ) goto LABEL_84; PlaySound(SPEECH_40, 0); *(int *)(v26 + 20) |= 2u; goto LABEL_79; case 20: PlaySound(SPEECH_40, 0); v27 = pActor->array_000234; if ( pActor->array_000234[0].uItemID ) { v27 = &pActor->array_000234[1]; if ( pActor->array_000234[1].uItemID ) goto LABEL_84; } v28 = v47; memcpy(v27, &v5->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v5->pInventoryIndices[v47] + 5], 0x24u); RemoveItemAtInventoryIndex(v28); LABEL_79: v42 = 0; v37 = 0; v35 = 0; v34 = 0; v33 = -1; v32 = 0; v31 = 0; v30 = (SoundID)47; goto LABEL_83; case 21: PlaySound(SPEECH_42, 0); ++v5->sAgeModifier; goto LABEL_82; case 22: PlaySound(SPEECH_41, 0); v5->sMana = 0; LABEL_82: v42 = 0; v37 = 0; v35 = 0; v34 = 0; v33 = -1; v32 = 0; v31 = 0; v30 = (SoundID)226; goto LABEL_83; default: goto LABEL_87; } } return result; } // 48DCF6: using guessed type char var_94[140]; //----- (0048E1A3) -------------------------------------------------------- unsigned int Player::GetSpellSchool(unsigned int uSpellID) { return LOBYTE(pSpellStats->pInfos[uSpellID].uSchool); } //----- (0048E1B5) -------------------------------------------------------- int Player::GetAttackRecoveryTime(int a2) { unsigned int v2; // ebx@1 char *v3; // edi@1 Player *v4; // esi@1 int v5; // eax@3 int v6; // eax@3 int v7; // eax@6 int v8; // eax@9 int v9; // eax@9 int v10; // eax@10 int v11; // edx@13 int v12; // ecx@14 int v13; // eax@15 int v14; // ebx@18 int v15; // eax@18 double v16; // st7@21 double v17; // st7@22 unsigned __int16 v18; // cx@27 Player *v19; // ecx@28 int v20; // eax@30 int v21; // eax@30 int v22; // eax@30 int v23; // ecx@30 unsigned int v24; // eax@30 int v25; // eax@31 int v26; // ebx@32 int v27; // eax@32 unsigned __int16 *v28; // ebx@36 int v29; // eax@42 int v30; // edi@43 signed int v31; // eax@49 int v32; // ecx@50 int result; // eax@54 float v34; // [sp+8h] [bp-38h]@27 float v35; // [sp+Ch] [bp-34h]@18 float v36; // [sp+10h] [bp-30h]@21 float v37; // [sp+14h] [bp-2Ch]@21 float v38; // [sp+18h] [bp-28h]@27 int v39; // [sp+1Ch] [bp-24h]@31 int v40; // [sp+20h] [bp-20h]@1 int v41; // [sp+24h] [bp-1Ch]@1 unsigned int v42; // [sp+28h] [bp-18h]@14 int v43; // [sp+2Ch] [bp-14h]@1 int v44; // [sp+30h] [bp-10h]@1 int v45; // [sp+34h] [bp-Ch]@1 int v46; // [sp+38h] [bp-8h]@1 int v47; // [sp+3Ch] [bp-4h]@1 v2 = 0; v3 = 0; v4 = this; v47 = (unsigned __int16)word_4EDED8[0]; v43 = 0; v45 = 0; v40 = 0; v41 = 0; v44 = 0; v46 = 0; if ( a2 ) { if ( !HasItemEquipped(EQUIP_BOW) ) goto LABEL_17; v5 = (int)&v4->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v4->pEquipment.uBow + 5]; v46 = v5; v3 = (char *)&pItemsTable->pItems[*(int *)v5].pIconName; v6 = (unsigned __int16)word_4EDED8[(unsigned __int8)v3[29]]; goto LABEL_4; } if ( IsUnarmed() == 1 ) { LOBYTE(v7) = GetActualSkillLevel(PLAYER_SKILL_UNARMED); if ( v7 ) { v6 = (unsigned __int16)word_4EDED8[1]; LABEL_4: v47 = v6; goto LABEL_17; } } if ( HasItemEquipped(EQUIP_TWO_HANDED) ) { v8 = (int)&v4->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v4->pEquipment.uMainHand + 5]; v46 = v8; v9 = *(int *)v8; v3 = (char *)&pItemsTable->pItems[v9].pIconName; if ( v3[28] == 12 ) v10 = *(&pSpellDatas[0].field_A + 10 * *((int *)&pSpellDatas[66].field_8 + v9)); else v10 = (unsigned __int16)word_4EDED8[(unsigned __int8)v3[29]]; v47 = v10; } if ( HasItemEquipped((ITEM_EQUIP_TYPE)0) ) { v12 = (int)&v4->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v4->pEquipment.uOffHand + 5]; v42 = (unsigned __int16)word_4EDED8[pItemsTable->pItems[*(int *)v12].uSkillType]; if ( (signed int)v42 > v47 ) { v13 = *(int *)v12; v46 = v12; v3 = (char *)(v11 + 48 * v13); v47 = v42; } v2 = 0; } LABEL_17: if ( HasItemEquipped(EQUIP_ARMOUR) ) { v14 = pItemsTable->pItems[*(int *)&v4->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v4->pEquipment.uBody + 5]].uSkillType; SkillToMastery(v4->pActiveSkills[9]); v15 = (unsigned __int16)word_4EDED8[v14]; v35 = 1.0; v43 = v15; if ( v14 == 9 ) { v36 = 0.0; } else { if ( v14 != 10 ) { if ( v14 != 11 ) { v36 = 1.0; v37 = 1.0; v16 = 1.0; LABEL_27: v18 = v4->pActiveSkills[v14]; v38 = v16; v43 = (signed __int64)((double)v43 * *(&v34 + SkillToMastery(v18))); v2 = 0; goto LABEL_28; } v17 = 0.5; v36 = 0.5; LABEL_26: v37 = v17; v16 = 0.0; goto LABEL_27; } v36 = 0.5; } v17 = 0.0; goto LABEL_26; } LABEL_28: if ( HasItemEquipped((ITEM_EQUIP_TYPE)v2) && v19->GetEquippedItemEquipType(v2) == 4 ) { v20 = 9 * v4->pEquipment.uOffHand; v35 = 1.0; v21 = 3 * *(int *)&v4->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * v20 + 5]; v36 = 0.0; v22 = pItemsTable->pItems[16 * v21 / 0x30u].uSkillType; v37 = 0.0; v23 = (unsigned __int16)word_4EDED8[v22]; v38 = 0.0; v45 = v23; v24 = SkillToMastery(v4->pActiveSkills[v22]); v45 = (signed __int64)((double)v45 * *(&v34 + v24)); } v25 = GetActualSpeed(); v39 = _48EA1B_get_static_effect(v25); v42 = v2; if ( v3 != (char *)v2 ) { v26 = (unsigned __int8)v3[29]; LOBYTE(v27) = GetActualSkillLevel((enum PLAYER_SKILL_TYPE)(unsigned __int8)v3[29]); if ( v27 && (v26 == 1 || v26 == 3 || v26 == 5) ) { v28 = &v4->pActiveSkills[v26]; if ( (signed int)SkillToMastery(*v28) >= 2 ) v40 = *(char *)v28 & 0x3F; } v2 = 0; if ( v3[29] == 7 ) v42 = 1; } if ( a2 == v2 ) { if ( v42 == v2 ) { LOBYTE(v29) = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER); if ( v29 != v2 ) { v30 = v29 & 0x3F; v44 = v29 & 0x3F; if ( (signed int)SkillToMastery(v29) >= 4 ) v44 += v30; } } } if ( SHIDWORD(v4->pPlayerBuffs[7].uExpireTime) >= (signed int)v2 && (SHIDWORD(v4->pPlayerBuffs[7].uExpireTime) > (signed int)v2 || LODWORD(v4->pPlayerBuffs[7].uExpireTime) > v2) ) v41 = 25; v31 = 0; if ( v46 != v2 ) { v32 = *(int *)(v46 + 12); if ( v32 == 59 || v32 == 41 || *(int *)v46 == 500 ) v31 = 20; } result = v47 + v43 + v45 - v44 - v31 - v41 - v40 - v39; if ( result < 0 ) result = 0; return result; } //----- (0048E4F8) -------------------------------------------------------- int Player::GetMaxHealth() { int v3; // esi@1 int v4; // esi@1 int v6; // esi@1 v3 = _48EA1B_get_static_effect(GetActualEndurance()); v4 = pBaseHealthPerLevelByClass[classType] * (GetActualLevel() + v3); v6 = uFullHealthBonus + pBaseHealthByClass[classType / 4] + GetSkillBonus(CHARACTER_ATTRIBUTE_HEALTH) + GetItemsBonus(CHARACTER_ATTRIBUTE_HEALTH, 0) + v4; if (v6 <= 0) return 1; return v6; } //----- (0048E565) -------------------------------------------------------- int Player::GetMaxMana() { int v2; // eax@2 int v3; // esi@4 int v4; // eax@5 int v5; // esi@5 int v6; // eax@5 int v7; // esi@6 int v8; // esi@6 int v9; // esi@6 int result; // eax@7 switch (classType) { case 5u: case 6u: case 7u: case 0x10u: case 0x11u: case 0x12u: case 0x13u: case 0x20u: case 0x21u: case 0x22u: case 0x23u: v2 = GetActualIntelligence(); v3 = _48EA1B_get_static_effect(v2); goto LABEL_6; case 9u: case 0xAu: case 0xBu: case 0xCu: case 0xDu: case 0xEu: case 0xFu: case 0x18u: case 0x19u: case 0x1Au: case 0x1Bu: v2 = GetActualWillpower(); v3 = _48EA1B_get_static_effect(v2); goto LABEL_6; case 0x15u: case 0x16u: case 0x17u: case 0x1Cu: case 0x1Du: case 0x1Eu: case 0x1Fu: v4 = GetActualWillpower(); v5 = _48EA1B_get_static_effect(v4); v6 = GetActualIntelligence(); v3 = _48EA1B_get_static_effect(v6) + v5; LABEL_6: v7 = pBaseManaPerLevelByClass[classType] * (GetActualLevel() + v3); v8 = GetItemsBonus(CHARACTER_ATTRIBUTE_MANA, 0) + v7; v9 = uFullManaBonus + pBaseManaByClass[classType / 4] + GetSkillBonus(CHARACTER_ATTRIBUTE_MANA) + v8; if ( v9 < 1 ) goto LABEL_7; result = v9; break; default: LABEL_7: result = 0; break; } return result; } //----- (0048E656) -------------------------------------------------------- int Player::GetBaseAC() { Player *v1; // edi@1 int v2; // eax@1 int v3; // esi@1 int v4; // esi@1 int v5; // esi@1 int result; // eax@2 v1 = this; v2 = GetActualSpeed(); v3 = _48EA1B_get_static_effect(v2); v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; if ( v5 >= 1 ) result = v5; else result = 0; return result; } //----- (0048E68F) -------------------------------------------------------- int Player::GetActualAC() { Player *v1; // edi@1 int v2; // eax@1 int v3; // esi@1 int v4; // esi@1 int v5; // esi@1 int v6; // esi@1 int result; // eax@2 v1 = this; v2 = GetActualSpeed(); v3 = _48EA1B_get_static_effect(v2); v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; v6 = v1->sACModifier + GetMagicalBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v5; if ( v6 >= 1 ) result = v6; else result = 0; return result; } //----- (0048E6DC) -------------------------------------------------------- unsigned int Player::GetBaseAge() { return ((__int64)(pParty->uTimePlayed * 0.234375) / 60 / 60 / 24) / 7 / 4 / 12 - uBirthYear + 1168; } //----- (0048E72C) -------------------------------------------------------- unsigned int Player::GetActualAge() { return this->sAgeModifier + GetBaseAge(); } //----- (0048E73F) -------------------------------------------------------- int Player::GetBaseResistance(enum CHARACTER_ATTRIBUTE_TYPE a2) { Player *v2; // ebx@1 signed int v3; // esi@1 enum CHARACTER_RACE v4; // eax@1 signed int v5; // edi@8 char v6; // zf@9 int v7; // esi@20 int result; // eax@21 signed int v9; // [sp-4h] [bp-10h]@11 v2 = this; v3 = 0; v4 = GetRace(); if ( a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE ) { v5 = 0; goto LABEL_16; } if ( a2 == CHARACTER_ATTRIBUTE_RESIST_AIR ) { v5 = 1; LABEL_16: v6 = v4 == 2; goto LABEL_17; } if ( a2 == CHARACTER_ATTRIBUTE_RESIST_WATER ) { v6 = v4 == 3; v5 = 2; goto LABEL_17; } if ( a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH ) { v5 = 3; v6 = v4 == 3; goto LABEL_17; } if ( a2 == CHARACTER_ATTRIBUTE_RESIST_MIND ) { v5 = 7; if ( v4 != 1 ) goto LABEL_20; v9 = 10; LABEL_19: v3 = v9; goto LABEL_20; } if ( a2 == CHARACTER_ATTRIBUTE_RESIST_BODY || a2 == 33 ) { v5 = 8; v6 = v4 == 0; LABEL_17: if ( !v6 ) goto LABEL_20; v9 = 5; goto LABEL_19; } v5 = 0; LABEL_20: v7 = GetItemsBonus(a2, 0) + v3; if ( v2->classType != PLAYER_CLASS_LICH || (result = 200, v7 + *(&v2->sResFireBase + v5) <= 200) ) result = v7 + *(&v2->sResFireBase + v5); return result; } //----- (0048E7D0) -------------------------------------------------------- int Player::GetActualResistance(enum CHARACTER_ATTRIBUTE_TYPE a2) { signed int v2; // edi@1 Player *v3; // esi@1 enum CHARACTER_RACE v4; // ebx@1 Player *v5; // ecx@8 char v6; // zf@18 int v7; // ebx@28 int result; // eax@28 signed int v9; // [sp+10h] [bp-8h]@1 signed int v10; // [sp+14h] [bp-4h]@1 v2 = 0; v3 = this; v10 = 0; v9 = 0; v4 = GetRace(); if ( CheckHiredNPCSpeciality(0x25u) ) v10 = 20; if ( (a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE || a2 == CHARACTER_ATTRIBUTE_RESIST_AIR || a2 == CHARACTER_ATTRIBUTE_RESIST_WATER || a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH) && SkillToMastery(v3->pActiveSkills[9]) == 4 && HasItemEquipped(EQUIP_ARMOUR) && GetEquippedItemSkillType(EQUIP_ARMOUR) == PLAYER_SKILL_LEATHER ) v10 += v3->pActiveSkills[9] & 0x3F; if ( a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE ) goto LABEL_25; if ( a2 == CHARACTER_ATTRIBUTE_RESIST_AIR ) { v2 = 1; LABEL_25: v6 = v4 == 2; LABEL_26: if ( v6 ) v9 = 5; goto LABEL_28; } if ( a2 == CHARACTER_ATTRIBUTE_RESIST_WATER ) { v6 = v4 == 3; v2 = 2; goto LABEL_26; } if ( a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH ) { v2 = 3; if ( v4 == 3 ) v10 += 5; } else { if ( a2 != CHARACTER_ATTRIBUTE_RESIST_MIND ) { if ( a2 != CHARACTER_ATTRIBUTE_RESIST_BODY && a2 != 33 ) goto LABEL_28; v2 = 8; v6 = v4 == 0; goto LABEL_26; } v2 = 7; if ( v4 == 1 ) v9 = 10; } LABEL_28: v7 = GetItemsBonus(a2, 0); result = v10 + GetMagicalBonus(a2) + v7 + v9 + *(&v3->sResFireBonus + v2) + *(&v3->sResFireBase + v2); if ( v3->classType == PLAYER_CLASS_LICH ) { if ( result > 200 ) result = 200; } return result; } //----- (0048E8F5) -------------------------------------------------------- bool Player::Recover(signed int a2) { Player *v2; // esi@1 signed __int64 v3; // qax@1 bool result; // eax@4 v2 = this; v3 = (signed __int64)((double)(a2 * _48EA46_calc_special_bonus_by_items(17)) * 0.01 + (double)a2); if ( v2->uTimeToRecovery - (signed int)v3 > 0 ) { v2->uTimeToRecovery -= v3; result = 1; } else { v2->uTimeToRecovery = 0; viewparams->bRedrawGameUI = 1; if ( !uActiveCharacter ) uActiveCharacter = pParty->GetNextActiveCharacter(); result = 0; } return result; } //----- (0048E96A) -------------------------------------------------------- void Player::SetRecoveryTime(signed int sRecoveryTime) { signed int v2; // edx@1 v2 = sRecoveryTime; if ( sRecoveryTime < 0 ) v2 = 0; if ( v2 > this->uTimeToRecovery ) this->uTimeToRecovery = v2; if ( pPlayers[uActiveCharacter] == this && !some_active_character ) uActiveCharacter = pParty->GetNextActiveCharacter(); viewparams->bRedrawGameUI = 1; } // 50C0C4: using guessed type int some_active_character; //----- (0048E9B7) -------------------------------------------------------- void Player::RandomizeName() { if (!uExpressionTimePassed) strcpy(pName, pNPCStats->pNPCNames[rand() % pNPCStats->uNumNPCNames[uSex]][uSex]); } //----- (0048E9F4) -------------------------------------------------------- unsigned int Player::GetMajorConditionIdx() { for (uint i = 0; i < 18; ++i) if (pConditions[pConditionImportancyTable[i]] != 0) return pConditionImportancyTable[i]; return 18; } //----- (0048EA1B) -------------------------------------------------------- int Player::_48EA1B_get_static_effect(int a2) { __int16 v2; // cx@1 int v3; // eax@1 v2 = word_4EDFFC[0]; v3 = 0; while ( a2 < v2 && v2 ) v2 = word_4EDFFC[v3++ + 1]; return player_stat_bonuses[v3]; } //----- (0048EA46) -------------------------------------------------------- int Player::_48EA46_calc_special_bonus_by_items(int a2) { int v2; // edi@1 int v3; // esi@1 int v4; // edx@2 int v5; // eax@3 char *v6; // eax@4 v2 = 0; v3 = 0; while ( 1 ) { if ( !HasItemEquipped((ITEM_EQUIP_TYPE)v3) ) goto LABEL_11; v5 = pEquipment.uOffHand - 1; // BUG // v5 = _this->cEquippedItems.uOffHand - 1; if ( a2 != 17 ) break; v6 = (char *)this + 36 * v5; if ( *((int *)v6 + 133) == 533 || *((int *)v6 + 136) == 17 ) return 50; LABEL_11: ++v3; if ( (signed int)v3 >= 16 ) return v2; } if ( a2 != 24 || this->pInventoryItems[v5].uAdditionalValue != 24 ) goto LABEL_11; return 5; } //----- (0048EAAE) -------------------------------------------------------- int Player::GetItemsBonus(CHARACTER_ATTRIBUTE_TYPE attr, int a3) { CHARACTER_ATTRIBUTE_TYPE v3; // esi@1 signed int v4; // eax@1 int v5; // edi@1 Player *v6; // ebx@1 Player *v8; // ecx@48 int v9; // eax@49 int v10; // edx@49 Player *v11; // ecx@55 int v12; // eax@56 int v13; // edx@56 int v14; // ecx@58 int v15; // eax@58 Player *v16; // ecx@61 int v17; // eax@62 Player *v18; // ecx@66 int v19; // eax@67 int v20; // eax@69 Player *v21; // ecx@75 int v22; // eax@76 int v23; // edx@76 int v24; // eax@79 int v25; // ecx@80 int v26; // edi@80 Player *v27; // ecx@84 int v28; // eax@85 int v29; // edx@85 Player *v30; // ecx@96 int v31; // ebp@97 int v32; // eax@98 unsigned int v33; // eax@100 int v34; // eax@103 char v35; // zf@104 char v36; // zf@107 unsigned __int8 v37; // zf@119 char v38; // sf@119 unsigned __int8 v39; // of@119 char v40; // zf@122 char v41; // zf@145 char v42; // zf@164 char v43; // zf@173 char v44; // zf@189 char v45; // zf@198 char v46; // zf@239 int v47; // eax@268 int v48; // eax@269 int v49; // eax@291 char v50; // zf@295 int v51; // eax@306 int v52; // eax@307 char v53; // zf@312 char v54; // zf@336 char v55; // zf@348 int v56; // eax@365 int v57; // ebx@368 signed int v58; // [sp-4h] [bp-20h]@10 signed int v59; // [sp-4h] [bp-20h]@71 signed int v60; // [sp-4h] [bp-20h]@347 int v61; // [sp+10h] [bp-Ch]@1 int v62; // [sp+14h] [bp-8h]@1 int v63; // [sp+18h] [bp-4h]@101 ItemGen *attra; // [sp+20h] [bp+4h]@101 unsigned int v65; // [sp+24h] [bp+8h]@95 v3 = attr; v4 = 36; v5 = 0; v6 = this; v62 = 0; v61 = 0; switch (attr) { case CHARACTER_ATTRIBUTE_LEVEL: if (HasEnchantedItemEquipped(25)) return 5; return 0; }; if ( (signed int)attr > 36 ) { switch ( attr ) { case 37: v58 = 15; goto LABEL_35; case 38: v58 = 16; goto LABEL_35; case 39: v58 = 17; goto LABEL_35; case 40: v58 = 18; goto LABEL_35; case 41: v58 = 19; goto LABEL_35; case 42: v58 = 20; goto LABEL_35; case 43: v58 = 25; goto LABEL_35; case 44: v58 = 5; goto LABEL_35; case 45: v58 = 8; goto LABEL_35; case 46: goto LABEL_36; default: break; } } else { if ( attr == 36 ) { v58 = 14; } else { if ( (signed int)attr > 21 ) { switch ( attr ) { case 22: v58 = 30; break; case 23: v58 = 31; break; case 34: v58 = 12; break; default: if ( attr != 35 ) goto LABEL_38; v58 = 13; break; } } else { switch ( attr ) { case 21: v58 = 33; break; case 16: v58 = 35; break; case 17: v58 = 34; break; case 18: v58 = 29; break; case 19: v58 = 21; break; default: if ( attr != 20 ) goto LABEL_38; v58 = 32; break; } } } LABEL_35: v4 = v58; LABEL_36: if ( !this->pActiveSkills[v4] ) return 0; } LABEL_38: if ( (signed int)attr > 28 ) { if ( (signed int)attr < 29 ) return v5 + v62 + v61; if ( (signed int)attr <= 30 ) { if ( HasItemEquipped(EQUIP_BOW) ) v5 = pItemsTable->pItems[*(int *)&v6->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v6->pEquipment.uBow + 5]].uDamageMod; return v5 + v62 + v61; } if ( attr == 31 ) { if ( !HasItemEquipped(EQUIP_BOW) ) return v5 + v62 + v61; v57 = *(int *)&v6->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v6->pEquipment.uBow + 5]; v5 = pItemsTable->pItems[v57].uDamageMod; v56 = pItemsTable->pItems[v57].uDamageDice; goto LABEL_366; } if ( attr == 32 ) { if ( !HasItemEquipped(EQUIP_BOW) ) return v5 + v62 + v61; v20 = *(int *)&v6->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v6->pEquipment.uBow + 5]; v5 = pItemsTable->pItems[v20].uDamageDice * pItemsTable->pItems[v20].uDamageRoll; LABEL_365: v56 = pItemsTable->pItems[v20].uDamageMod; LABEL_366: v5 += v56; return v5 + v62 + v61; } if ( (signed int)attr <= 33 || (signed int)attr > 46 ) return v5 + v62 + v61; LABEL_95: v65 = 0; while ( 1 ) { if ( !HasItemEquipped((ITEM_EQUIP_TYPE)v65) ) goto LABEL_361; v31 = *(&v6->pEquipment.uOffHand + v65) - 1; if ( v3 == 9 ) { v32 = GetEquippedItemEquipType(v65); if ( v32 >= 3 ) { if ( v32 <= 11 ) { v33 = v6->pInventoryItems[v31].uItemID; v5 += pItemsTable->pItems[v33].uDamageDice + pItemsTable->pItems[v33].uDamageMod; } } } v63 = (int)((char *)v6 + 36 * v31); attra = (ItemGen *)(v63 + 532); if ( pItemsTable->_456D5E_is_some_material((ItemGen *)(v63 + 532)) == 1 && !pItemsTable->_456D43_is_material_equals_3(attra) ) { v34 = attra->uItemID; switch ( attra->uItemID ) { case 0x1F4u: v35 = v3 == 5; goto LABEL_105; case 0x1F5u: v36 = v3 == 0; goto LABEL_108; case 0x1F6u: if ( v3 == 21 ) v61 += 10; v36 = v3 == 2; goto LABEL_108; case 0x1F7u: if ( v3 == 17 ) v61 += 5; if ( v3 == 18 ) v61 += 5; v36 = v3 == 6; goto LABEL_108; case 0x1F8u: goto LABEL_118; case 0x1F9u: v40 = v3 == 3; goto LABEL_123; case 0x1FAu: v35 = v3 == 10; goto LABEL_105; case 0x1FEu: v35 = v3 == 4; goto LABEL_105; case 0x1FFu: if ( v3 == 23 ) v61 += 10; if ( v3 == 22 ) v61 += 10; goto LABEL_361; case 0x200u: if ( v3 == 36 ) { LOBYTE(v34) = LOBYTE(v6->pActiveSkills[14]); v62 = ((unsigned int)v34 >> 1) & 0x1F; } v36 = v3 == 5; LABEL_108: if ( v36 ) v5 += 40; goto LABEL_361; case 0x201u: if ( v3 == 39 ) { LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); v34 = ((unsigned int)v34 >> 1) & 0x1F; v62 = v34; } goto LABEL_136; case 0x202u: if ( !v3 ) v5 += 150; if ( v3 == 1 ) v5 -= 40; if ( v3 == 2 ) v5 -= 40; goto LABEL_145; case 0x203u: if ( v3 == 42 ) { LOBYTE(v34) = LOBYTE(v6->pActiveSkills[20]); v62 = ((unsigned int)v34 >> 1) & 0x1F; } if ( v3 == 43 ) v61 += 15; goto LABEL_361; case 0x204u: if ( v3 == 17 ) v61 += 5; if ( v3 == 18 ) v61 += 5; if ( v3 == 6 ) v5 += 50; if ( v3 == 11 || v3 == 10 || v3 == 12 || v3 == 13 || v3 == 33 || v3 == 14 ) goto LABEL_166; v42 = v3 == 15; goto LABEL_165; case 0x205u: if ( v3 == 18 ) v61 += 5; goto LABEL_361; case 0x206u: if ( !v3 ) v5 += 100; if ( v3 == 3 ) v5 += 100; v43 = v3 == 9; goto LABEL_174; case 0x207u: if ( v3 == 45 ) v61 += 5; if ( v3 == 15 ) v5 -= 10; v42 = v3 == 14; LABEL_165: if ( v42 ) LABEL_166: v5 -= 10; goto LABEL_361; case 0x208u: v35 = v3 == 3; goto LABEL_105; case 0x209u: if ( v3 == 2 ) v5 += 15; if ( !v3 ) v5 += 15; v41 = v3 == 6; goto LABEL_146; case 0x20Au: if ( v3 == 46 ) v61 += 15; v44 = v3 == 3; goto LABEL_190; case 0x20Bu: if ( v3 == 34 ) { LOBYTE(v34) = LOBYTE(v6->pActiveSkills[12]); v62 = ((unsigned int)v34 >> 1) & 0x1F; } if ( v3 == 12 ) v5 += 50; if ( v3 == 2 ) v5 += 30; v45 = v3 == 9; goto LABEL_199; case 0x20Cu: if ( !v3 ) v5 += 75; goto LABEL_145; case 0x20Du: if ( v3 == 5 ) v5 += 50; if ( v3 == 6 ) v5 += 50; if ( v3 == 11 || v3 == 10 || v3 == 12 || v3 == 13 || v3 == 33 || v3 == 14 ) goto LABEL_374; v43 = v3 == 15; LABEL_174: if ( v43 ) LABEL_374: v5 -= 15; goto LABEL_361; case 0x20Eu: if ( v3 == 4 ) v5 += 150; if ( v3 == 44 ) v61 += 5; if ( v3 == 9 ) v5 -= 25; goto LABEL_361; case 0x20Fu: if ( v3 == 39 ) { LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); v34 = ((unsigned int)v34 >> 1) & 0x1F; v62 = v34; } if ( v3 == 40 ) { LOBYTE(v34) = LOBYTE(v6->pActiveSkills[18]); v62 = ((unsigned int)v34 >> 1) & 0x1F; } LABEL_145: v41 = v3 == 5; LABEL_146: if ( v41 ) v5 -= 40; goto LABEL_361; case 0x210u: if ( v3 == 38 ) { LOBYTE(v34) = LOBYTE(v6->pActiveSkills[16]); v62 = ((unsigned int)v34 >> 1) & 0x1F; } if ( !v3 ) v5 += 75; v44 = v3 == 11; LABEL_190: if ( v44 ) v5 -= 50; goto LABEL_361; case 0x211u: if ( v3 == 5 ) v5 += 100; if ( v3 == 4 ) v5 += 50; v35 = v3 == 11; LABEL_105: if ( v35 ) v5 += 50; goto LABEL_361; case 0x212u: if ( v3 == 1 ) v5 -= 20; v45 = v3 == 2; LABEL_199: if ( v45 ) v5 -= 20; goto LABEL_361; case 0x214u: if ( v3 == 1 ) v5 += 15; v46 = v3 == 2; goto LABEL_240; case 0x215u: if ( v3 == 5 ) v5 += 15; v46 = v3 == 4; goto LABEL_240; case 0x216u: if ( v3 == 10 ) v5 += 30; if ( !v3 ) v5 += 15; goto LABEL_315; case 0x217u: if ( v3 == 21 ) v61 += 5; if ( !v3 ) v5 += 15; goto LABEL_253; case 0x218u: goto LABEL_253; default: goto LABEL_361; } goto LABEL_361; } if ( *(int *)(v63 + 536) == v3 + 1 ) { if ( (signed int)v3 >= 0 ) { if ( (signed int)v3 <= 15 ) { v5 += *((int *)v6->pConditions + 9 * v31 + 135); } else { if ( (signed int)v3 <= 23 && v5 < *((int *)v6->pConditions + 9 * v31 + 135) ) v5 = *((int *)v6->pConditions + 9 * v31 + 135); } } goto LABEL_361; } v34 = *(int *)(v63 + 544); if ( v34 > 48 ) { switch ( v34 ) { case 54: goto LABEL_315; case 49: if ( v3 == 6 ) goto LABEL_121; v50 = v3 == 1; goto LABEL_296; case 51: if ( v3 != 5 && v3 != 1 ) goto LABEL_309; goto LABEL_121; case 52: if ( v3 == 3 ) goto LABEL_121; v50 = v3 == 4; goto LABEL_296; case 53: if ( !v3 ) goto LABEL_121; v50 = v3 == 2; goto LABEL_296; case 55: v46 = v3 == 6; goto LABEL_240; case 56: if ( !v3 ) goto LABEL_351; v53 = v3 == 3; goto LABEL_350; case 57: if ( v3 == 1 ) goto LABEL_351; v53 = v3 == 2; goto LABEL_350; case 50: if ( v3 == 10 ) v5 += 30; goto LABEL_361; case 60: if ( v3 != 23 ) goto LABEL_336; if ( v5 >= 3 ) goto LABEL_361; v5 = 3; LABEL_336: v54 = v3 == 22; goto LABEL_345; case 61: if ( v3 != 17 ) goto LABEL_340; if ( v5 >= 3 ) goto LABEL_361; v5 = 3; LABEL_340: v54 = v3 == 18; goto LABEL_345; case 62: if ( v3 != 19 ) goto LABEL_344; if ( v5 >= 3 ) goto LABEL_361; v5 = 3; LABEL_344: v54 = v3 == 20; LABEL_345: if ( !v54 ) goto LABEL_361; if ( v5 >= 3 ) goto LABEL_361; v60 = 3; goto LABEL_360; case 67: v55 = v3 == 18; goto LABEL_357; case 68: v53 = v3 == 9; goto LABEL_350; case 69: if ( v3 == 11 ) v5 += 20; break; case 70: if ( v3 == 12 ) v5 += 10; v55 = v3 == 16; LABEL_357: if ( v55 && v5 < 2 ) { v60 = 2; LABEL_360: v5 = v60; } break; default: goto LABEL_361; } goto LABEL_361; } if ( v34 == 48 ) { if ( v3 == 9 ) v5 += 5; LABEL_315: v46 = v3 == 3; LABEL_240: if ( v46 ) v5 += 15; goto LABEL_361; } if ( v34 > 32 ) { if ( v34 > 44 ) { v51 = v34 - 45; if ( !v51 ) { if ( v3 == 5 ) goto LABEL_351; v53 = v3 == 4; LABEL_350: if ( v53 ) LABEL_351: v5 += 5; goto LABEL_361; } v52 = v51 - 1; if ( !v52 ) { v40 = v3 == 0; LABEL_123: if ( v40 ) v5 += 25; goto LABEL_361; } if ( v52 == 1 ) { LABEL_309: v50 = v3 == 8; goto LABEL_296; } } else { if ( v34 == 44 ) { v50 = v3 == 7; goto LABEL_296; } v34 -= 33; if ( !v34 ) { if ( v3 != 38 ) goto LABEL_361; LOBYTE(v34) = LOBYTE(v6->pActiveSkills[16]); goto LABEL_138; } --v34; if ( !v34 ) { if ( v3 != 36 ) goto LABEL_361; LOBYTE(v34) = LOBYTE(v6->pActiveSkills[14]); goto LABEL_138; } v49 = v34 - 8; if ( !v49 ) { if ( (signed int)v3 >= 0 && (signed int)v3 <= 15 ) ++v5; goto LABEL_361; } if ( v49 == 1 ) { if ( v3 != 3 && v3 != 7 ) { v50 = v3 == 9; LABEL_296: if ( !v50 ) goto LABEL_361; } LABEL_121: v5 += 10; goto LABEL_361; } } } else { if ( v34 == 32 ) { if ( v3 != 39 ) goto LABEL_361; LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); goto LABEL_138; } if ( v34 > 28 ) { v34 -= 29; if ( v34 ) { --v34; if ( v34 ) { --v34; if ( v34 || v3 != 41 ) goto LABEL_361; LOBYTE(v34) = LOBYTE(v6->pActiveSkills[19]); } else { if ( v3 != 34 ) goto LABEL_361; LOBYTE(v34) = LOBYTE(v6->pActiveSkills[12]); } } else { if ( v3 != 37 ) goto LABEL_361; LOBYTE(v34) = LOBYTE(v6->pActiveSkills[15]); } goto LABEL_138; } if ( v34 == 28 ) { LABEL_136: if ( v3 == 42 ) { LOBYTE(v34) = LOBYTE(v6->pActiveSkills[20]); LABEL_138: v62 = ((unsigned int)v34 >> 1) & 0x1F; goto LABEL_361; } } else { v47 = v34 - 1; if ( v47 ) { v48 = v47 - 1; if ( v48 ) { v34 = v48 - 24; if ( v34 ) { --v34; if ( v34 || v3 != 40 ) goto LABEL_361; LOBYTE(v34) = LOBYTE(v6->pActiveSkills[18]); } else { if ( v3 != 35 ) goto LABEL_361; LOBYTE(v34) = LOBYTE(v6->pActiveSkills[13]); } goto LABEL_138; } LABEL_118: if ( (signed int)v3 < 0 ) goto LABEL_361; v39 = __OFSUB__((int)v3, 6); v37 = v3 == 6; v38 = v3 - 6 < 0; } else { LABEL_253: if ( (signed int)v3 < 10 ) goto LABEL_361; v39 = __OFSUB__((int)v3, 15); v37 = v3 == 15; v38 = v3 - 15 < 0; } if ( (unsigned __int8)(v38 ^ v39) | v37 ) goto LABEL_121; } } LABEL_361: ++v65; if ( (signed int)v65 >= 16 ) return v5 + v62 + v61; } } if ( attr == 28 ) { if ( IsUnarmed() != 1 ) { if ( v6->HasItemEquipped(EQUIP_TWO_HANDED) ) { v22 = this->GetEquippedItemEquipType(1u); if ( v22 >= 0 ) { if ( v22 <= 2 ) { v23 = this->pInventoryItems[this->pEquipment.uMainHand].uItemID; if ( v6->pEquipment.uOffHand || pItemsTable->pItems[v23].uSkillType != 4 ) { v24 = v23; v26 = pItemsTable->pItems[v23].uDamageRoll; v25 = pItemsTable->pItems[v23].uDamageDice; } else { v25 = pItemsTable->pItems[v24].uDamageRoll; v26 = pItemsTable->pItems[v24].uDamageDice + 1; } v5 = pItemsTable->pItems[v24].uDamageMod + v25 * v26; } } } if ( a3 || !v6->HasItemEquipped((ITEM_EQUIP_TYPE)0) || (v28 = v27->GetEquippedItemEquipType(0), v28 < 0) || v28 > 2 ) return v5 + v62 + v61; v15 = pItemsTable->pItems[v29].uDamageMod; v14 = pItemsTable->pItems[v29].uDamageDice * pItemsTable->pItems[v29].uDamageRoll; goto LABEL_88; } v59 = 3; LABEL_74: v5 = v59; return v5 + v62 + v61; } if ( (signed int)attr < 0 ) return v5 + v62 + v61; if ( (signed int)attr <= 23 ) goto LABEL_95; if ( (signed int)attr <= 24 ) return v5 + v62 + v61; if ( (signed int)attr <= 26 ) { if ( IsUnarmed() == 1 ) { v5 = 0; return v5 + v62 + v61; } if ( v6->HasItemEquipped(EQUIP_TWO_HANDED) ) { v17 = this->GetEquippedItemEquipType(1u); if ( v17 >= 0 ) { if ( v17 <= 2 ) v5 = pItemsTable->pItems[*(int *)&v6->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v6->pEquipment.uMainHand + 5]].uDamageMod; } } if ( a3 || !v6->HasItemEquipped((ITEM_EQUIP_TYPE)0) || (v19 = v18->GetEquippedItemEquipType(0), v19 < 0) || v19 > 2 ) return v5 + v62 + v61; v20 = *(int *)&v6->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v6->pEquipment.uOffHand + 5]; goto LABEL_365; } if ( attr == 27 ) { if ( IsUnarmed() == 1 ) { v5 = 1; return v5 + v62 + v61; } if ( v6->HasItemEquipped(EQUIP_TWO_HANDED) ) { v9 = this->GetEquippedItemEquipType(1u); if ( v9 >= 0 ) { if ( v9 <= 2 ) { v5 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uDamageDice + pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uDamageMod; if ( !v6->pEquipment.uOffHand ) { if ( pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uSkillType == 4 ) ++v5; } } } } if ( a3 || !v6->HasItemEquipped((ITEM_EQUIP_TYPE)0) || (v12 = v11->GetEquippedItemEquipType(0), v12 < 0) || v12 > 2 ) return v5 + v62 + v61; v14 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uOffHand].uItemID].uDamageMod; v15 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uOffHand].uItemID].uDamageDice; LABEL_88: v5 += v15 + v14; } return v5 + v62 + v61; } //----- (0048F73C) -------------------------------------------------------- int Player::GetMagicalBonus(enum CHARACTER_ATTRIBUTE_TYPE a2) { int result; // eax@1 int v3; // eax@4 int v4; // ecx@5 switch (a2) { case CHARACTER_ATTRIBUTE_LEVEL: return 0; } result = 0; if ( (signed int)a2 > 10 ) { if ( (signed int)a2 <= 15 ) { switch ( a2 ) { case CHARACTER_ATTRIBUTE_RESIST_BODY: v3 = this->pPlayerBuffs[2].uPower; v4 = pParty->pPartyBuffs[1].uPower; break; case CHARACTER_ATTRIBUTE_RESIST_AIR: v3 = this->pPlayerBuffs[0].uPower; v4 = pParty->pPartyBuffs[0].uPower; break; case CHARACTER_ATTRIBUTE_RESIST_WATER: v3 = this->pPlayerBuffs[22].uPower; v4 = pParty->pPartyBuffs[17].uPower; break; case CHARACTER_ATTRIBUTE_RESIST_EARTH: v3 = this->pPlayerBuffs[3].uPower; v4 = pParty->pPartyBuffs[4].uPower; break; default: if ( a2 != 14 ) return result; v3 = this->pPlayerBuffs[9].uPower; v4 = pParty->pPartyBuffs[12].uPower; break; } return v4 + v3; } if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) { if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) { v3 = this->pPlayerBuffs[8].uPower; v4 = pParty->pPartyBuffs[9].uPower; return v4 + v3; } if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK ) return result; } return this->pPlayerBuffs[1].uPower; } if ( a2 == 10 ) { v3 = this->pPlayerBuffs[5].uPower; v4 = pParty->pPartyBuffs[6].uPower; return v4 + v3; } switch ( a2 ) { case CHARACTER_ATTRIBUTE_STRENGTH: v3 = pPlayerBuffs[19].uPower; goto LABEL_5; case CHARACTER_ATTRIBUTE_INTELLIGENCE: v3 = pPlayerBuffs[17].uPower; goto LABEL_5; case CHARACTER_ATTRIBUTE_WILLPOWER: v3 = pPlayerBuffs[20].uPower; goto LABEL_5; case CHARACTER_ATTRIBUTE_ENDURANCE: v3 = pPlayerBuffs[16].uPower; goto LABEL_5; case CHARACTER_ATTRIBUTE_ACCURACY: v3 = pPlayerBuffs[15].uPower; goto LABEL_5; case CHARACTER_ATTRIBUTE_SPEED: v3 = pPlayerBuffs[21].uPower; goto LABEL_5; case CHARACTER_ATTRIBUTE_LUCK: v3 = pPlayerBuffs[18].uPower; LABEL_5: v4 = pParty->pPartyBuffs[2].uPower; return v4 + v3; case CHARACTER_ATTRIBUTE_AC_BONUS: v3 = this->pPlayerBuffs[14].uPower; v4 = pParty->pPartyBuffs[15].uPower; return v4 + v3; default: return result; } return result; } //----- (0048F882) -------------------------------------------------------- char Player::GetActualSkillLevel(enum PLAYER_SKILL_TYPE uSkillType) { signed int v2; // esi@1 unsigned __int16 v3; // ax@126 char result; // al@127 unsigned int v5; // [sp-4h] [bp-14h]@13 signed int v6; // [sp-4h] [bp-14h]@27 unsigned int v7; // [sp-4h] [bp-14h]@35 CHARACTER_ATTRIBUTE_TYPE v8; // [sp-4h] [bp-14h]@68 Player *v9; // [sp+Ch] [bp-4h]@1 v2 = 0; v9 = this; if ( uSkillType > PLAYER_SKILL_DODGE ) { if ( uSkillType != PLAYER_SKILL_UNARMED ) { if ( uSkillType == PLAYER_SKILL_MONSTER_ID ) { if ( CheckHiredNPCSpeciality(0x3Au) ) v2 = 6; if ( CheckHiredNPCSpeciality(0x39u) ) v2 += 6; goto LABEL_83; } if ( uSkillType == PLAYER_SKILL_ARMSMASTER ) { if ( CheckHiredNPCSpeciality(0xFu) ) v2 = 2; if ( CheckHiredNPCSpeciality(0x10u) ) v2 += 3; goto LABEL_64; } if ( uSkillType == PLAYER_SKILL_STEALING ) { if ( CheckHiredNPCSpeciality(0x33u) ) v2 = 8; goto LABEL_64; } if ( uSkillType == PLAYER_SKILL_ALCHEMY ) { if ( CheckHiredNPCSpeciality(0x17u) ) v2 = 4; if ( CheckHiredNPCSpeciality(0x18u) ) v2 += 8; goto LABEL_64; } if ( uSkillType == 36 ) // learning { if ( CheckHiredNPCSpeciality(0xDu) ) v2 = 10; if ( CheckHiredNPCSpeciality(0xEu) ) v2 += 15; if ( CheckHiredNPCSpeciality(4u) ) v2 += 5; goto LABEL_64; } goto LABEL_86; } if ( !CheckHiredNPCSpeciality(0x38u) ) goto LABEL_112; LABEL_85: v2 = 2; goto LABEL_86; } if ( uSkillType == PLAYER_SKILL_DODGE ) { if ( !CheckHiredNPCSpeciality(0x38u) ) goto LABEL_112; v6 = 2; goto LABEL_51; } if ( uSkillType <= PLAYER_SKILL_ITEM_ID ) { if ( uSkillType != PLAYER_SKILL_ITEM_ID ) { if ( (signed int)uSkillType < 0 ) goto LABEL_86; if ( uSkillType > PLAYER_SKILL_PLATE ) { if ( uSkillType <= PLAYER_SKILL_EARTH ) { if ( CheckHiredNPCSpeciality(0x11u) ) v2 = 2; if ( CheckHiredNPCSpeciality(0x12u) ) v2 += 3; v5 = 19; } else { if ( uSkillType > PLAYER_SKILL_BODY ) goto LABEL_86; if ( CheckHiredNPCSpeciality(0x35u) ) v2 = 2; if ( CheckHiredNPCSpeciality(0x36u) ) v2 += 3; v5 = 55; } if ( CheckHiredNPCSpeciality(v5) ) v2 += 4; if ( v9->classType == PLAYER_CLASS_31 && sub_476387() ) v2 += 3; LABEL_86: if ( uSkillType <= PLAYER_SKILL_DARK ) { if ( uSkillType == PLAYER_SKILL_DARK ) { v8 = (CHARACTER_ATTRIBUTE_TYPE)42; } else { if ( uSkillType > PLAYER_SKILL_EARTH ) { switch ( uSkillType ) { case 16: v8 = (CHARACTER_ATTRIBUTE_TYPE)38; break; case 17: v8 = (CHARACTER_ATTRIBUTE_TYPE)39; break; case 18: v8 = (CHARACTER_ATTRIBUTE_TYPE)40; break; default: if ( uSkillType != 19 ) goto LABEL_126; v8 = (CHARACTER_ATTRIBUTE_TYPE)41; break; } } else { switch ( uSkillType ) { case PLAYER_SKILL_EARTH: v8 = (CHARACTER_ATTRIBUTE_TYPE)37; break; case PLAYER_SKILL_BOW: v8 = (CHARACTER_ATTRIBUTE_TYPE)44; break; case PLAYER_SKILL_SHIELD: v8 = (CHARACTER_ATTRIBUTE_TYPE)45; break; case PLAYER_SKILL_FIRE: v8 = (CHARACTER_ATTRIBUTE_TYPE)34; break; case PLAYER_SKILL_AIR: v8 = (CHARACTER_ATTRIBUTE_TYPE)35; break; default: if ( uSkillType != 14 ) goto LABEL_126; v8 = (CHARACTER_ATTRIBUTE_TYPE)36; break; } } } goto LABEL_125; } if ( uSkillType <= PLAYER_SKILL_MONSTER_ID ) { if ( uSkillType != PLAYER_SKILL_MONSTER_ID ) goto LABEL_112; LABEL_83: v8 = (CHARACTER_ATTRIBUTE_TYPE)20; goto LABEL_125; } LABEL_64: switch ( uSkillType ) { case PLAYER_SKILL_ARMSMASTER: v8 = (CHARACTER_ATTRIBUTE_TYPE)21; break; case PLAYER_SKILL_STEALING: v8 = (CHARACTER_ATTRIBUTE_TYPE)17; break; case PLAYER_SKILL_ALCHEMY: v8 = (CHARACTER_ATTRIBUTE_TYPE)16; break; default: if ( uSkillType != 36 ) goto LABEL_126; v8 = (CHARACTER_ATTRIBUTE_TYPE)46; break; } goto LABEL_125; } if ( !CheckHiredNPCSpeciality(0x2Eu) ) goto LABEL_86; goto LABEL_85; } if ( !CheckHiredNPCSpeciality(0x39u) ) goto LABEL_112; v6 = 6; LABEL_51: v2 = v6; goto LABEL_112; } if ( uSkillType == PLAYER_SKILL_MERCHANT ) { if ( CheckHiredNPCSpeciality(0x14u) ) v2 = 4; if ( CheckHiredNPCSpeciality(0x15u) ) v2 += 6; if ( CheckHiredNPCSpeciality(0x30u) ) v2 += 3; v7 = 50; LABEL_47: if ( CheckHiredNPCSpeciality(v7) ) v2 += 8; goto LABEL_112; } if ( uSkillType != PLAYER_SKILL_PERCEPTION ) { if ( uSkillType != PLAYER_SKILL_TRAP_DISARM ) goto LABEL_86; if ( CheckHiredNPCSpeciality(0x19u) ) v2 = 4; if ( CheckHiredNPCSpeciality(0x1Au) ) v2 += 6; v7 = 51; goto LABEL_47; } if ( CheckHiredNPCSpeciality(0x16u) ) v2 = 6; if ( CheckHiredNPCSpeciality(0x2Fu) ) v2 += 5; LABEL_112: switch ( uSkillType ) { case PLAYER_SKILL_ITEM_ID: v8 = (CHARACTER_ATTRIBUTE_TYPE)19; break; case PLAYER_SKILL_MEDITATION: v8 = (CHARACTER_ATTRIBUTE_TYPE)43; break; case PLAYER_SKILL_TRAP_DISARM: v8 = (CHARACTER_ATTRIBUTE_TYPE)18; break; case PLAYER_SKILL_DODGE: v8 = (CHARACTER_ATTRIBUTE_TYPE)22; break; default: if ( uSkillType != 31 ) goto LABEL_126; v8 = (CHARACTER_ATTRIBUTE_TYPE)23; break; } LABEL_125: v2 += v9->GetItemsBonus(v8, 0); LABEL_126: v3 = v9->pActiveSkills[uSkillType]; if ( v2 + (v9->pActiveSkills[uSkillType] & 0x3F) < 60 ) result = v2 + v3; else result = v3 & 0xFC | 0x3C; return result; } //----- (0048FC00) -------------------------------------------------------- int Player::GetSkillBonus(enum CHARACTER_ATTRIBUTE_TYPE a2) { Player *v2; // esi@1 int v3; // eax@1 char v4; // di@1 signed int v5; // ebx@1 unsigned int v6; // eax@2 unsigned __int8 v7; // sf@5 unsigned __int8 v8; // of@5 PlayerEquipment *v9; // ebx@19 Player *v10; // ecx@20 enum PLAYER_SKILL_TYPE v11; // edi@21 int v12; // eax@21 int v13; // edi@21 char v14; // di@25 signed int v15; // esi@25 char v16; // al@32 int v18; // eax@36 unsigned int v19; // eax@37 ITEM_EQUIP_TYPE v20; // edi@40 int v21; // edx@41 int v22; // eax@42 enum PLAYER_SKILL_TYPE v23; // edi@45 unsigned __int16 v24; // ax@45 unsigned __int16 v25; // bx@45 unsigned int v26; // eax@45 unsigned __int8 v27; // sf@50 unsigned __int8 v28; // of@50 unsigned int v29; // eax@52 int v30; // eax@55 int v31; // eax@58 unsigned int v32; // eax@59 int v33; // eax@65 char v34; // si@65 ITEM_EQUIP_TYPE v35; // edi@69 int v36; // edx@70 int v37; // eax@71 enum PLAYER_SKILL_TYPE v38; // edi@74 int v39; // eax@74 int v40; // eax@89 char v41; // si@89 int v42; // eax@96 enum PLAYER_SKILL_TYPE v43; // edx@97 int v44; // eax@97 int v45; // eax@98 int v46; // eax@99 int v47; // eax@100 int v48; // eax@101 int v49; // eax@102 unsigned __int16 v50; // ax@113 char v51; // di@113 unsigned int v52; // eax@113 int v53; // edi@113 signed int i; // ecx@113 unsigned __int16 v55; // ax@118 char v56; // si@118 unsigned int v57; // eax@118 int v58; // esi@121 signed int j; // ecx@121 int v60; // edi@126 int v61; // eax@126 signed int v62; // [sp-4h] [bp-30h]@26 signed int v63; // [sp-4h] [bp-30h]@80 int v64; // [sp+Ch] [bp-20h]@104 int v65; // [sp+10h] [bp-1Ch]@104 int v66; // [sp+14h] [bp-18h]@104 int v67; // [sp+18h] [bp-14h]@104 int v68; // [sp+1Ch] [bp-10h]@69 PlayerEquipment *v69; // [sp+20h] [bp-Ch]@1 int v70; // [sp+24h] [bp-8h]@1 ITEM_EQUIP_TYPE v71; // [sp+28h] [bp-4h]@1 int a1; // [sp+34h] [bp+8h]@21 int a1a; // [sp+34h] [bp+8h]@74 signed int a1b; // [sp+34h] [bp+8h]@94 v2 = this; v70 = 0; v69 = 0; v71 = (ITEM_EQUIP_TYPE)0; LOBYTE(v3) = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER); v4 = v3; v5 = 1; if ( v3 ) { v6 = SkillToMastery(v3); if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) { if ( (signed int)v6 >= 4 ) goto LABEL_4; v8 = __OFSUB__(v6, 3); v7 = ((v6 - 3) & 0x80000000u) != 0; } else { if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) goto LABEL_11; if ( (signed int)v6 >= 4 ) { LABEL_4: v71 = (ITEM_EQUIP_TYPE)2; LABEL_11: v69 = (PlayerEquipment *)(v71 * (v4 & 0x3F)); goto LABEL_12; } v8 = __OFSUB__(v6, 2); v7 = ((v6 - 2) & 0x80000000u) != 0; } if ( !(v7 ^ v8) ) v71 = (ITEM_EQUIP_TYPE)1; goto LABEL_11; } LABEL_12: if ( a2 == CHARACTER_ATTRIBUTE_HEALTH ) { v60 = pBaseHealthPerLevelByClass[v2->classType]; v61 = v2->GetBodybuilding(); return v60 * v61; } if ( a2 == CHARACTER_ATTRIBUTE_MANA ) { v60 = pBaseManaPerLevelByClass[v2->classType]; v61 = v2->GetMediatation(); return v60 * v61; } if ( a2 != 9 ) { if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) { if ( a2 <= CHARACTER_ATTRIBUTE_ATTACK ) return v70; if ( a2 > CHARACTER_ATTRIBUTE_MELEE_DMG_MAX ) { if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK ) return v70; v71 = (ITEM_EQUIP_TYPE)0; v9 = &v2->pEquipment; while ( 1 ) { if ( v2->HasItemEquipped(v71) ) { v11 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v2->pInventoryItems[*(_DWORD *)v9].uItemID].uEquipType; LOBYTE(v12) = this->GetActualSkillLevel(v11); a1 = v12; SkillToMastery(v12); v13 = v11 - 5; if ( !v13 ) return a1 & 0x3F; if ( v13 == 2 ) break; } v71 = (ITEM_EQUIP_TYPE)((int)v71 + 1); v9 = (PlayerEquipment *)((char *)v9 + 4); if ( (signed int)v71 >= 16 ) return v70; } v14 = a1; v15 = 1; if ( (signed int)SkillToMastery(a1) >= 4 ) { v62 = 5; goto LABEL_31; } if ( (signed int)SkillToMastery(a1) >= 3 ) { v62 = 3; goto LABEL_31; } if ( (signed int)SkillToMastery(a1) < 2 ) goto LABEL_32; goto LABEL_30; } if ( v2->IsUnarmed() ) { LOBYTE(v18) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); v14 = v18; if ( !v18 ) return v70; v15 = 0; v19 = SkillToMastery(v18); if ( (signed int)v19 < 3 ) { if ( (signed int)v19 >= 2 ) v15 = 1; LABEL_32: v16 = v14; return v15 * (v16 & 0x3F); } LABEL_30: v62 = 2; LABEL_31: v15 = v62; goto LABEL_32; } v20 = (ITEM_EQUIP_TYPE)0; while ( 1 ) { if ( v2->HasItemEquipped(v20) ) { v22 = this->pInventoryItems[this->pEquipment.pIndices[v20]].uItemID; if ( pItemsTable->pItems[v22].uEquipType <= 1u ) break; } v20 = (ITEM_EQUIP_TYPE)((int)v20 + 1); if ( (signed int)v20 >= 16 ) return v70; } v71 = (ITEM_EQUIP_TYPE)0; v23 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v22].uSkillType; LOBYTE(v24) = v2->GetActualSkillLevel(v23); v25 = v24; v26 = SkillToMastery(v24); if ( !v23 ) { if ( (signed int)SkillToMastery(v25) >= 4 ) { LOBYTE(v31) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); LOBYTE(v25) = v31; if ( v31 ) { v15 = 0; v32 = SkillToMastery(v31); if ( (signed int)v32 < 3 ) { if ( (signed int)v32 >= 2 ) v15 = 1; } else { v15 = 2; } v16 = v25; return v15 * (v16 & 0x3F); } } goto LABEL_55; } if ( v23 == PLAYER_SKILL_DAGGER ) { v29 = SkillToMastery(v25); v28 = __OFSUB__(v29, 4); v27 = ((v29 - 4) & 0x80000000u) != 0; } else { if ( v23 <= PLAYER_SKILL_DAGGER ) goto LABEL_55; if ( v23 > PLAYER_SKILL_SPEAR ) { if ( v23 == PLAYER_SKILL_MACE ) { v28 = __OFSUB__(v26, 2); v27 = v26 - 2 < 0; goto LABEL_53; } LABEL_55: v30 = v71 * (v25 & 0x3F); return (int)((char *)v69 + v30); } v28 = __OFSUB__(v26, 3); v27 = v26 - 3 < 0; } LABEL_53: if ( !(v27 ^ v28) ) v71 = (ITEM_EQUIP_TYPE)1; goto LABEL_55; } if ( v2->IsUnarmed() == 1 ) { LOBYTE(v33) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); v34 = v33; if ( !v33 ) return v70; if ( (signed int)SkillToMastery(v33) >= 3 ) v5 = 2; v30 = v5 * (v34 & 0x3F); return (int)((char *)v69 + v30); } v35 = (ITEM_EQUIP_TYPE)0; v68 = 0; while ( 1 ) { if ( v2->HasItemEquipped(v35) ) { v37 = *(int *)&v2->pInventoryItems[v35].uItemID; if ( pItemsTable->pItems[v37].uEquipType <= 1u ) break; } v35 = (ITEM_EQUIP_TYPE)((int)v35 + 1); if ( (signed int)v35 >= 16 ) return v70; } v38 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v37].uSkillType; LOBYTE(v39) = v2->GetActualSkillLevel(v38); a1a = v39; SkillToMastery(v39); v71 = (ITEM_EQUIP_TYPE)0; if ( v38 ) { if ( (signed int)v38 > 0 ) { if ( (signed int)v38 <= 4 || v38 == 6 ) { v71 = (ITEM_EQUIP_TYPE)1; } else { if ( v38 == 7 ) { if ( (signed int)SkillToMastery(a1a) < 4 ) { if ( (signed int)SkillToMastery(a1a) < 3 ) { if ( (signed int)SkillToMastery(a1a) < 2 ) return v5 * (a1a & 0x3F); v63 = 2; } else { v63 = 3; } } else { v63 = 5; } v5 = v63; return v5 * (a1a & 0x3F); } } } } else { v71 = (ITEM_EQUIP_TYPE)1; if ( (signed int)SkillToMastery(a1a) >= 4 ) { LOBYTE(v40) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); v41 = v40; if ( v40 ) { if ( (signed int)SkillToMastery(v40) >= 3 ) v5 = 2; v68 = v5 * (v41 & 0x3F); } } } v30 = v68 + v71 * (a1a & 0x3F); return (int)((char *)v69 + v30); } a1b = 0; v71 = (ITEM_EQUIP_TYPE)0; v68 = 16; v69 = &v2->pEquipment; do { if ( !v69->uOffHand || (v42 = (int)((char *)v2 + 36 * v69->uOffHand), *(char *)(v42 + 516) & 2) ) goto LABEL_117; v43 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[*(int *)(v42 + 496)].uSkillType; v44 = pItemsTable->pItems[*(int *)(v42 + 496)].uSkillType; if ( !v44 ) { v64 = 0; v65 = 1; LABEL_111: v66 = 0; goto LABEL_112; } v45 = v44 - 1; if ( !v45 || (v46 = v45 - 3) == 0 ) { v64 = 0; v65 = 0; v66 = 0; v67 = 1; goto LABEL_113; } v47 = v46 - 4; if ( v47 ) { v48 = v47 - 1; if ( v48 ) { v49 = v48 - 1; if ( v49 ) { if ( v49 != 1 ) goto LABEL_117; a1b = 1; v64 = 1; v65 = 0; v66 = 0; v67 = 0; goto LABEL_113; } a1b = 1; v64 = 1; v65 = 0; goto LABEL_111; } v71 = (ITEM_EQUIP_TYPE)1; } else { a1b = 1; } v64 = 1; v65 = 0; v66 = 1; LABEL_112: v67 = 0; LABEL_113: LOBYTE(v50) = v2->GetActualSkillLevel(v43); v51 = v50; v52 = SkillToMastery(v50); v53 = v51 & 0x3F; for ( i = 0; i < (signed int)v52; ++i ) { if ( *(&v64 + i) ) v70 += v53; } LABEL_117: v69 = (PlayerEquipment *)((char *)v69 + 4); --v68; } while ( v68 ); v64 = 1; v65 = 1; v66 = 1; v67 = 0; LOBYTE(v55) = v2->GetActualSkillLevel(PLAYER_SKILL_DODGE); v56 = v55; v57 = SkillToMastery(v55); if ( !a1b && (!v71 || v57 == 4) ) { v58 = v56 & 0x3F; for ( j = 0; j < (signed int)v57; ++j ) { if ( *(&v64 + j) ) v70 += v58; } } return v70; } //----- (00490109) -------------------------------------------------------- // faces are: 0 1 2 3 human males // 4 5 6 7 human females // 8 9 elf males // 10 11 elf females // 12 13 dwarf males // 14 15 dwarf females // 16 17 goblin males // 18 19 goblin females // 20 lich male // 21 lich female // 22 underwater suits (unused) // 23 zombie male // 24 zombie female enum CHARACTER_RACE Player::GetRace() { if ( uFace > 15 ) { if ( uFace >= 16 && uFace <= 19 ) return CHARACTER_RACE_GOBLIN; } else { if ( uFace >= 12 ) { return CHARACTER_RACE_DWARF; } else { if ( uFace >= 0 ) { if ( uFace <= 7 ) { return CHARACTER_RACE_HUMAN; } else { if ( uFace <= 11 ) return CHARACTER_RACE_ELF; } } } } return CHARACTER_RACE_HUMAN; } //----- (00490141) -------------------------------------------------------- PLAYER_SEX Player::GetSexByVoice() { signed int result; // eax@1 result = 0; switch ( this->uVoiceID ) { case 0u: case 1u: case 2u: case 3u: case 8u: case 9u: case 0xCu: case 0xDu: case 0x10u: case 0x11u: case 0x14u: case 0x17u: return SEX_MALE; case 4u: case 5u: case 6u: case 7u: case 0xAu: case 0xBu: case 0xEu: case 0xFu: case 0x12u: case 0x13u: case 0x15u: case 0x18u: return SEX_FEMALE; default: assert(false); } } //----- (00490188) -------------------------------------------------------- void Player::SetInitialStats() { auto v1 = GetRace(); uMight = stru_4ED7B0.race[v1].attr[0].uBaseValue; uIntelligence = stru_4ED7B0.race[v1].attr[1].uBaseValue; uWillpower = stru_4ED7B0.race[v1].attr[2].uBaseValue; uEndurance = stru_4ED7B0.race[v1].attr[3].uBaseValue; uAccuracy = stru_4ED7B0.race[v1].attr[4].uBaseValue; uSpeed = stru_4ED7B0.race[v1].attr[5].uBaseValue; uLuck = stru_4ED7B0.race[v1].attr[6].uBaseValue; } //----- (004901FC) -------------------------------------------------------- int Player::SetSexByVoice() { __int64 v1; // qax@1 v1 = this->uVoiceID; switch ( (int)v1 ) { case 0: case 1: case 2: case 3: case 8: case 9: case 0xC: case 0xD: case 0x10: case 0x11: case 0x14: case 0x17: BYTE4(v1) = 0; break; case 4: case 5: case 6: case 7: case 0xA: case 0xB: case 0xE: case 0xF: case 0x12: case 0x13: case 0x15: case 0x18: BYTE4(v1) = 1; break; default: break; } this->uSex = (PLAYER_SEX)BYTE4(v1); return v1; } //----- (0049024A) -------------------------------------------------------- void Player::Reset(PLAYER_CLASS_TYPE cls) { sLevelModifier = 0; sAgeModifier = 0; classType = cls; uLuckBonus = 0; uSpeedBonus = 0; uAccuracyBonus = 0; uEnduranceBonus = 0; uWillpowerBonus = 0; uIntelligenceBonus = 0; uMightBonus = 0; uLevel = 1; uExperience = 251 + rand() % 100; uBirthYear = 1147 - rand() % 6; memset(pActiveSkills, 0, sizeof(pActiveSkills)); memset(field_152, 0, 64); memset(&spellbook, 0, sizeof(PlayerSpells)); for (uint i = 0; i < 37; ++i) { if (pSkillAvailabilityPerClass[classType / 4][i] != 2) continue; pActiveSkills[i] = 1; switch (i) { case PLAYER_SKILL_FIRE: spellbook.pFireSpellbook.bIsSpellbookAvailable = true; break; case PLAYER_SKILL_AIR: spellbook.pAirSpellbook.bIsSpellbookAvailable = true; break; case PLAYER_SKILL_WATER: spellbook.pWaterSpellbook.bIsSpellbookAvailable = true; break; case PLAYER_SKILL_EARTH: spellbook.pEarthSpellbook.bIsSpellbookAvailable = true; break; case PLAYER_SKILL_SPIRIT: spellbook.pSpiritSpellbook.bIsSpellbookAvailable = true; break; case PLAYER_SKILL_MIND: spellbook.pMindSpellbook.bIsSpellbookAvailable = 1; break; case PLAYER_SKILL_BODY: spellbook.pBodySpellbook.bIsSpellbookAvailable = 1; break; case PLAYER_SKILL_LIGHT: spellbook.pLightSpellbook.bIsSpellbookAvailable = 1; break; case PLAYER_SKILL_DARK: spellbook.pDarkSpellbook.bIsSpellbookAvailable = 1; break; } } sHealth = GetMaxHealth(); sMana = GetMaxMana(); } //----- (004903C9) -------------------------------------------------------- enum PLAYER_SKILL_TYPE Player::GetSkillIdxByOrder(signed int order) { enum PLAYER_SKILL_TYPE result; // eax@5 int v3; // edx@5 char *v4; // ecx@5 int v5; // esi@11 unsigned __int16 *v6; // edx@11 int v7; // esi@18 unsigned __int16 *pActiveSkill; // edx@18 if ( order >= 0 ) { if ( order <= 1 ) { result = (PLAYER_SKILL_TYPE)0; v7 = 0; pActiveSkill = this->pActiveSkills; do { if ( *pActiveSkill && pSkillAvailabilityPerClass[classType / 4][result] == 2 ) { if ( v7 == order ) return result; ++v7; } result = (PLAYER_SKILL_TYPE)((int)result + 1); ++pActiveSkill; } while ( (signed int)result < 37 ); } else { if ( order <= 3 ) { result = (PLAYER_SKILL_TYPE)0; v5 = 0; pActiveSkill = this->pActiveSkills; do { if ( *pActiveSkill && pSkillAvailabilityPerClass[classType / 4][result] == 1 ) { if ( v5 == order - 2 ) return result; ++v5; } result = (PLAYER_SKILL_TYPE)((int)result + 1); ++pActiveSkill; } while ( (signed int)result < 37 ); } else { if ( order <= 12 ) { result = (PLAYER_SKILL_TYPE)0; v3 = 0; v4 = (char *)pSkillAvailabilityPerClass[classType / 4]; do { if ( *v4 == 1 ) { if ( v3 == order - 4 ) return result; ++v3; } result = (PLAYER_SKILL_TYPE)((int)result + 1); ++v4; } while ( (signed int)result < 37 ); } } } } return (PLAYER_SKILL_TYPE)37; } //----- (0049048D) -------------------------------------------------------- //unsigned __int16 PartyCreation_BtnMinusClick(Player *_this, int eAttribute) void Player::DecreaseAttribute(int eAttribute) { int v2; // eax@1 int pBaseValue; // ecx@1 int pDroppedStep; // ebx@1 int pStep; // esi@1 unsigned __int16 result; // ax@7 int uMinValue; // [sp+Ch] [bp-4h]@1 v2 = eAttribute + 7 * GetRace(); pBaseValue = stru_4ED7B0.race[0].attr[v2].uBaseValue; pDroppedStep = stru_4ED7B0.race[0].attr[v2].uDroppedStep; uMinValue = pBaseValue - 2; pStep = stru_4ED7B0.race[0].attr[v2].uBaseStep; switch ( eAttribute ) { case CHARACTER_MIGHT: if ( this->uMight <= pBaseValue ) pStep = pDroppedStep; if ( this->uMight - pStep >= uMinValue ) this->uMight -= pStep; break; case CHARACTER_INTELLIGANCE: if ( this->uIntelligence <= pBaseValue ) pStep = pDroppedStep; if ( this->uIntelligence - pStep >= uMinValue ) this->uIntelligence -= pStep; break; case CHARACTER_WILLPOWER: if ( this->uWillpower <= pBaseValue ) pStep = pDroppedStep; if ( this->uWillpower - pStep >= uMinValue ) this->uWillpower -= pStep; break; case CHARACTER_ENDURANCE: if ( this->uEndurance <= pBaseValue ) pStep = pDroppedStep; if ( this->uEndurance - pStep >= uMinValue ) this->uEndurance -= pStep; break; case CHARACTER_ACCURACY: if ( this->uAccuracy <= pBaseValue ) pStep = pDroppedStep; if ( this->uAccuracy - pStep >= uMinValue ) this->uAccuracy -= pStep; break; case CHARACTER_SPEED: if ( this->uSpeed <= pBaseValue ) pStep = pDroppedStep; if ( this->uSpeed - pStep >= uMinValue ) this->uSpeed -= pStep; break; case CHARACTER_LUCK: if ( this->uLuck <= pBaseValue ) pStep = pDroppedStep; if ( this->uLuck - pStep >= uMinValue ) this->uLuck -= pStep; break; } } //----- (004905F5) -------------------------------------------------------- //signed int __thiscall PartyCreation_BtnPlusClick(Player *this, int eAttribute) int Player::IncreaseAttribute(int eAttribute) { Player *v2; // esi@1 int v3; // eax@1 int v4; // ebx@1 signed int v5; // edi@1 int v6; // eax@8 signed int v7; // eax@17 signed int result; // eax@18 int v9; // [sp+Ch] [bp-8h]@1 signed int v10; // [sp+10h] [bp-4h]@1 v2 = this; v3 = eAttribute + 7 * GetRace(); v4 = stru_4ED7B0.race[0].attr[v3].uMaxValue; v5 = stru_4ED7B0.race[0].attr[v3].uBaseStep; v9 = stru_4ED7B0.race[0].attr[v3].uBaseValue; v10 = stru_4ED7B0.race[0].attr[v3].uDroppedStep; PlayerCreation_ComputeAttributeBonus(); if ( eAttribute ) { switch ( eAttribute ) { case 1: v6 = v2->uIntelligence; break; case 2: v6 = v2->uWillpower; break; case 3: v6 = v2->uEndurance; break; case 4: v6 = v2->uAccuracy; break; case 5: v6 = v2->uSpeed; break; case 6: v6 = v2->uLuck; break; default: v6 = eAttribute; break; } } else { v6 = v2->uMight; } if ( v6 < v9 ) { v7 = v5; v5 = v10; v10 = v7; } result = PlayerCreation_ComputeAttributeBonus(); if ( result >= v10 ) { if ( eAttribute ) { switch ( eAttribute ) { case 1: result = (signed int)&v2->uIntelligence; break; case 2: result = (signed int)&v2->uWillpower; break; case 3: result = (signed int)&v2->uEndurance; break; case 4: result = (signed int)&v2->uAccuracy; break; case 5: result = (signed int)&v2->uSpeed; break; default: result = eAttribute - 6; if ( eAttribute != 6 ) return result; result = (signed int)&v2->uLuck; break; } } else { result = (signed int)&v2->uMight; } if ( v5 + *(short *)result <= v4 ) *(short *)result += v5; } return result; } //----- (0049070F) -------------------------------------------------------- void Player::Zero() { Player *v1; // esi@1 void *result; // eax@1 v1 = this; this->sLevelModifier = 0; this->sACModifier = 0; this->uLuckBonus = 0; this->uAccuracyBonus = 0; this->uSpeedBonus = 0; this->uEnduranceBonus = 0; this->uWillpowerBonus = 0; this->uIntelligenceBonus = 0; this->uMightBonus = 0; this->field_100 = 0; this->field_FC = 0; this->field_F8 = 0; this->field_F4 = 0; this->field_F0 = 0; this->field_EC = 0; this->field_E8 = 0; this->field_E4 = 0; this->field_E0 = 0; result = memset(&this->sResFireBonus, 0, 0x16u); v1->field_1A97 = 0; v1->_ranged_dmg_bonus = 0; v1->field_1A95 = 0; v1->_ranged_atk_bonus = 0; v1->field_1A93 = 0; v1->_melee_dmg_bonus = 0; v1->field_1A91 = 0; v1->_some_attack_bonus = 0; v1->_mana_related = 0; v1->uFullManaBonus = 0; v1->_health_related = 0; v1->uFullHealthBonus = 0; } //----- (004907E7) -------------------------------------------------------- __int16 Player::GetStatColor(unsigned int uStat) { Player *v2; // edi@1 __int16 uWhite; // si@1 // int uStartingHP; // eax@1 int v5; // edx@1 // unsigned __int8 v6; // zf@1 // char v7; // sf@1 unsigned __int8 v8; // of@1 __int16 result; // ax@2 __int16 uGreen; // [sp+8h] [bp-8h]@1 __int16 uRed; // [sp+Ch] [bp-4h]@1 v2 = this; uRed = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0x23u, 0); uGreen = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0); uWhite = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); v8 = stru_4ED7B0.race[GetRace()].attr[uStat].uBaseValue; int attribute_value = 0; switch (uStat) { case 0: attribute_value = uMight; break; case 1: attribute_value = uIntelligence; break; case 2: attribute_value = uWillpower; break; case 3: attribute_value = uEndurance; break; case 4: attribute_value = uSpeed; break; case 5: attribute_value = uAccuracy; break; case 6: attribute_value = uLuck; break; }; v5 = attribute_value; if ( v5 >= v8 ) { result = uGreen; if ( v5 == v8 ) result = uWhite; } else { result = uRed; } return result; } //----- (004908A8) -------------------------------------------------------- bool Player::DiscardConditionIfLastsLongerThan(unsigned int uCondition, unsigned __int64 uTime) { unsigned __int64 *result; // eax@1 result = (unsigned __int64 *)((char *)this + 8 * uCondition); if ( *result && (signed __int64)uTime < (signed __int64)*result ) { *(int *)result = 0; *((int *)result + 1) = 0; LOBYTE(result) = 1; } else { LOBYTE(result) = 0; } return (bool)result; } //----- (004680ED) -------------------------------------------------------- void Player::UseItem_DrinkPotion_etc(signed int a2, int a3) { Player *v3; // esi@1 unsigned int v4; // ebx@4 signed int v5; // eax@17 unsigned int v6; // eax@26 unsigned __int8 v7; // cf@37 int v8; // edx@39 int v9; // edx@40 int v10; // edx@41 int v11; // edx@42 int v12; // edx@43 char *v13; // eax@45 AudioPlayer *v14; // ecx@62 signed int v15; // edi@68 int v16; // edx@73 unsigned __int16 *v17; // edi@73 unsigned int v18; // eax@73 int v19; // eax@74 int v20; // eax@75 signed int v21; // eax@81 const char *v22; // eax@84 char *v23; // ecx@90 int v24; // esi@96 int v25; // eax@109 int v26; // eax@113 char *v27; // edi@114 signed __int64 v28; // qax@120 char *v29; // ecx@120 int v30; // edi@137 int v31; // ST30_4@137 int v32; // ST3C_4@137 int v33; // ST40_4@137 int v34; // ST34_4@137 int v35; // ST38_4@137 unsigned __int8 v36; // al@173 SoundID v37; // [sp-20h] [bp-4Ch]@18 SoundID v38; // [sp-20h] [bp-4Ch]@174 signed int v39; // [sp-1Ch] [bp-48h]@18 signed int v40; // [sp-1Ch] [bp-48h]@174 unsigned int v41; // [sp-18h] [bp-44h]@18 unsigned int v42; // [sp-18h] [bp-44h]@174 signed int v43; // [sp-14h] [bp-40h]@18 signed int v44; // [sp-14h] [bp-40h]@174 signed int v45; // [sp-10h] [bp-3Ch]@18 unsigned __int16 v46; // [sp-10h] [bp-3Ch]@120 signed int v47; // [sp-10h] [bp-3Ch]@174 int v48; // [sp-Ch] [bp-38h]@18 unsigned int v49; // [sp-Ch] [bp-38h]@33 unsigned __int16 v50; // [sp-Ch] [bp-38h]@120 int v51; // [sp-Ch] [bp-38h]@174 unsigned int v52; // [sp-8h] [bp-34h]@18 char *v53; // [sp-8h] [bp-34h]@33 int v54; // [sp-8h] [bp-34h]@34 unsigned int v55; // [sp-8h] [bp-34h]@60 int v56; // [sp-8h] [bp-34h]@66 const char *v57; // [sp-8h] [bp-34h]@69 const char *v58; // [sp-8h] [bp-34h]@89 int v59; // [sp-8h] [bp-34h]@120 unsigned int v60; // [sp-8h] [bp-34h]@174 int v61; // [sp-4h] [bp-30h]@18 char *v62; // [sp-4h] [bp-30h]@33 char *v63; // [sp-4h] [bp-30h]@34 int v64; // [sp-4h] [bp-30h]@60 int v65; // [sp-4h] [bp-30h]@66 const char *v66; // [sp-4h] [bp-30h]@69 signed int v67; // [sp-4h] [bp-30h]@77 const char *v68; // [sp-4h] [bp-30h]@89 int v69; // [sp-4h] [bp-30h]@110 unsigned __int8 v70; // [sp-4h] [bp-30h]@120 int v71; // [sp-4h] [bp-30h]@174 char *v72; // [sp+20h] [bp-Ch]@68 signed int v73; // [sp+24h] [bp-8h]@1 char *v74; // [sp+24h] [bp-8h]@23 int v75; // [sp+24h] [bp-8h]@73 Player *thisb; // [sp+28h] [bp-4h]@1 unsigned int thisa; // [sp+28h] [bp-4h]@22 thisb = this; v3 = &pParty->pPlayers[a2-1];//(Player *)&stru_AA1058[3].pSounds[6972 * a2 + 40552]; v73 = 1; if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3) ) return; v4 = 0; if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == 13 ) { if ( pParty->pPickedItem.uItemID != 160 ) { if ( pParty->pPickedItem.uItemID == 161 ) { v27 = (char *)&v3->sMana; *(int *)v27 += 2; LABEL_170: if ( *(int *)v27 > v3->GetMaxMana() ) *(int *)v27 = v3->GetMaxMana(); } else { if ( pParty->pPickedItem.uItemID != 162 ) { LABEL_167: v68 = pParty->pPickedItem.GetDisplayName(); v58 = pGlobalTXT_LocalizationStrings[36]; goto LABEL_90; } v69 = 2; LABEL_111: pParty->pPlayers[a2-1].Heal(v69);//((Player *)&stru_AA1058[3].pSounds[6972 * a2 + 40552])->Heal(v69); } LABEL_112: v3->PlaySound(SPEECH_36, 0); goto LABEL_173; } LABEL_172: pParty->pPlayers[a2-1].SetCondition(6u, 1); goto LABEL_173; } if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == 14 ) { switch ( pParty->pPickedItem.uItemID ) { case 0xDEu: v25 = pParty->pPickedItem._bonus_type + 10; goto LABEL_110; case 0xDFu: v26 = pParty->pPickedItem._bonus_type + 10; goto LABEL_114; case 0xE0u: LODWORD(v3->pConditions[1]) = 0; HIDWORD(v3->pConditions[1]) = 0; goto LABEL_112; case 0xE1u: LODWORD(v3->pConditions[11]) = 0; HIDWORD(v3->pConditions[11]) = 0; LODWORD(v3->pConditions[9]) = 0; HIDWORD(v3->pConditions[9]) = 0; LODWORD(v3->pConditions[7]) = 0; HIDWORD(v3->pConditions[7]) = 0; goto LABEL_112; case 0xE2u: LODWORD(v3->pConditions[10]) = 0; HIDWORD(v3->pConditions[10]) = 0; LODWORD(v3->pConditions[8]) = 0; HIDWORD(v3->pConditions[8]) = 0; LODWORD(v3->pConditions[6]) = 0; HIDWORD(v3->pConditions[6]) = 0; goto LABEL_112; case 0xE3u: LODWORD(v3->pConditions[2]) = 0; HIDWORD(v3->pConditions[2]) = 0; goto LABEL_112; case 0xE4u: if ( v3->pConditions[1] ) goto LABEL_173; v70 = 0; v59 = 0; v50 = 5; v46 = 3; v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[7]; goto LABEL_147; case 0xE5u: v70 = 0; v59 = 0; v50 = 5; v46 = 3; v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[8]; goto LABEL_147; case 0xE6u: v70 = 0; v59 = 0; v50 = 5; v46 = 3; v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[1]; goto LABEL_147; case 0xE7u: v70 = 0; v59 = 0; v50 = 3 * LOWORD(pParty->pPickedItem._bonus_type); v46 = 0; v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[11]; goto LABEL_147; case 0xE8u: v70 = 0; v59 = 0; v50 = 3 * LOWORD(pParty->pPickedItem._bonus_type); v46 = 0; v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[13]; goto LABEL_147; case 0xEAu: v70 = 0; v59 = 0; v50 = 5; v46 = 3; v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[14]; goto LABEL_147; case 0xEBu: v3->pPlayerBuffs[23].Apply( pParty->uTimePlayed + (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335), 3u, 5u, 0, 0); goto LABEL_173; case 0xEDu: LODWORD(v3->pConditions[3]) = 0; HIDWORD(v3->pConditions[3]) = 0; goto LABEL_112; case 0xEEu: LODWORD(v3->pConditions[0]) = 0; HIDWORD(v3->pConditions[0]) = 0; goto LABEL_112; case 0xEFu: LODWORD(v3->pConditions[5]) = 0; HIDWORD(v3->pConditions[5]) = 0; goto LABEL_112; case 0xF0u: v70 = 0; v59 = 0; v50 = 3 * LOWORD(pParty->pPickedItem._bonus_type); v46 = 0; v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[19]; goto LABEL_147; case 0xF1u: v70 = 0; v59 = 0; v50 = 3 * LOWORD(pParty->pPickedItem._bonus_type); v46 = 0; v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[17]; goto LABEL_147; case 0xF2u: v70 = 0; v59 = 0; v50 = 3 * LOWORD(pParty->pPickedItem._bonus_type); v46 = 0; v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[20]; goto LABEL_147; case 0xF3u: v70 = 0; v59 = 0; v50 = 3 * LOWORD(pParty->pPickedItem._bonus_type); v46 = 0; v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[16]; goto LABEL_147; case 0xF4u: v70 = 0; v59 = 0; v50 = 3 * LOWORD(pParty->pPickedItem._bonus_type); v46 = 0; v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[21]; goto LABEL_147; case 0xF5u: v70 = 0; v59 = 0; v50 = 3 * LOWORD(pParty->pPickedItem._bonus_type); v46 = 0; v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[15]; goto LABEL_147; case 0xFBu: LODWORD(v3->pConditions[12]) = 0; HIDWORD(v3->pConditions[12]) = 0; goto LABEL_112; case 0xFCu: v30 = LODWORD(v3->pConditions[14]); v31 = HIDWORD(v3->pConditions[14]); v32 = LODWORD(v3->pConditions[15]); v33 = HIDWORD(v3->pConditions[15]); v34 = LODWORD(v3->pConditions[16]); v35 = HIDWORD(v3->pConditions[16]); memset(&pParty->pPlayers[a2-1],0,0xA0u);//memset(&stru_AA1058[3].pSounds[6972 * a2 + 40552], 0, 0xA0u); HIDWORD(v3->pConditions[14]) = v31; LODWORD(v3->pConditions[15]) = v32; HIDWORD(v3->pConditions[15]) = v33; LODWORD(v3->pConditions[16]) = v34; LODWORD(v3->pConditions[14]) = v30; HIDWORD(v3->pConditions[16]) = v35; goto LABEL_112; case 0xFDu: v25 = 5 * pParty->pPickedItem._bonus_type; LABEL_110: v69 = v25; goto LABEL_111; case 0xFEu: v26 = 5 * pParty->pPickedItem._bonus_type; LABEL_114: v27 = (char *)&v3->sMana; *(int *)v27 += v26; goto LABEL_170; case 0xFFu: v70 = 0; v59 = 0; v50 = 3 * LOWORD(pParty->pPickedItem._bonus_type); v46 = 0; v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[18]; goto LABEL_147; case 0x100u: v70 = 0; v59 = 0; v50 = 3 * LOWORD(pParty->pPickedItem._bonus_type); v46 = 0; v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[5]; goto LABEL_147; case 0x101u: v70 = 0; v59 = 0; v50 = 3 * LOWORD(pParty->pPickedItem._bonus_type); v46 = 0; v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); v29 = (char *)v3->pPlayerBuffs; goto LABEL_147; case 0x102u: v70 = 0; v59 = 0; v50 = 3 * LOWORD(pParty->pPickedItem._bonus_type); v46 = 0; v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[22]; goto LABEL_147; case 0x103u: v70 = 0; v59 = 0; v50 = 3 * LOWORD(pParty->pPickedItem._bonus_type); v46 = 0; v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[3]; goto LABEL_147; case 0x104u: v70 = 0; v59 = 0; v50 = 3 * LOWORD(pParty->pPickedItem._bonus_type); v46 = 0; v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[9]; goto LABEL_147; case 0x105u: v70 = 0; v59 = 0; v50 = 3 * LOWORD(pParty->pPickedItem._bonus_type); v46 = 0; v28 = (signed __int64)((double)(230400 * pParty->pPickedItem._bonus_type) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[2]; LABEL_147: ((SpellBuff *)v29)->Apply(pParty->uTimePlayed + v28, v46, v50, v59, v70); goto LABEL_112; case 0x106u: LODWORD(v3->pConditions[15]) = 0; HIDWORD(v3->pConditions[15]) = 0; goto LABEL_112; case 0x108u: if ( !*(int *)&v3->field_1F5[3] ) { v3->uLuck += 50; *(int *)&v3->field_1F5[3] = 1; } goto LABEL_112; case 0x109u: if ( !*(int *)&v3->field_1F5[7] ) { v3->uSpeed += 50; *(int *)&v3->field_1F5[7] = 1; } goto LABEL_112; case 0x10Au: if ( !*(int *)&v3->field_1F5[11] ) { v3->uIntelligence += 50; *(int *)&v3->field_1F5[11] = 1; } goto LABEL_112; case 0x10Bu: if ( !*(int *)&v3->field_1F5[15] ) { v3->uEndurance += 50; *(int *)&v3->field_1F5[15] = 1; } goto LABEL_112; case 0x10Cu: if ( !*(int *)&v3->field_1F5[19] ) { v3->uWillpower += 50; *(int *)&v3->field_1F5[19] = 1; } goto LABEL_112; case 0x10Du: if ( !*(int *)&v3->field_1F5[23] ) { v3->uAccuracy += 50; *(int *)&v3->field_1F5[23] = 1; } goto LABEL_112; case 0x10Eu: if ( !*(int *)&v3->field_1F5[27] ) { v3->uMight += 50; *(int *)&v3->field_1F5[27] = 1; } goto LABEL_112; case 0x10Fu: v3->sAgeModifier = 0; goto LABEL_112; default: goto LABEL_167; case 0xDDu: goto LABEL_172; } goto LABEL_172; } if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType != 15 ) { if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType != 16 ) { if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType != 17 ) { if ( pParty->pPickedItem.uItemID == 616 ) { thisa = pParty->uCurrentMonthWeek + 1; if ( pParty->uCurrentMonth >= 7 ) v74 = 0; else v74 = aAttributeNames[pParty->uCurrentMonth]; switch ( pParty->uCurrentMonth ) { case 0u: v6 = pParty->uCurrentMonthWeek + 1; v3->uMight += thisa; goto LABEL_33; case 1u: v6 = pParty->uCurrentMonthWeek + 1; v3->uIntelligence += thisa; goto LABEL_33; case 2u: v6 = pParty->uCurrentMonthWeek + 1; v3->uWillpower += thisa; goto LABEL_33; case 3u: v6 = pParty->uCurrentMonthWeek + 1; v3->uEndurance += thisa; goto LABEL_33; case 4u: v6 = pParty->uCurrentMonthWeek + 1; v3->uAccuracy += thisa; goto LABEL_33; case 5u: v6 = pParty->uCurrentMonthWeek + 1; v3->uSpeed += thisa; goto LABEL_33; case 6u: v6 = pParty->uCurrentMonthWeek + 1; v3->uLuck += thisa; LABEL_33: v62 = pGlobalTXT_LocalizationStrings[121]; v53 = v74; v49 = v6; goto LABEL_53; case 7u: party_finds_gold(1000 * thisa, 0); v63 = pGlobalTXT_LocalizationStrings[97]; v54 = 1000 * thisa; goto LABEL_38; case 8u: Party::GiveFood(5 * thisa); v63 = pGlobalTXT_LocalizationStrings[653]; v54 = 5 * thisa; goto LABEL_38; case 9u: v63 = pGlobalTXT_LocalizationStrings[207]; v3->uSkillPoints += 2 * thisa; v54 = 2 * thisa; goto LABEL_38; case 0xAu: v63 = pGlobalTXT_LocalizationStrings[83]; v54 = 2500 * thisa; v7 = __CFADD__(2500 * thisa, LODWORD(v3->uExperience)); LODWORD(v3->uExperience) += 2500 * thisa; HIDWORD(v3->uExperience) += ((unsigned __int64)(signed int)(2500 * thisa) >> 32) + v7; LABEL_38: sprintf(pTmpBuf, "+%u %s", v54, v63); goto LABEL_54; case 0xBu: v8 = rand() % 6; if ( v8 ) { v9 = v8 - 1; if ( v9 ) { v10 = v9 - 1; if ( v10 ) { v11 = v10 - 1; if ( v11 ) { v12 = v11 - 1; if ( v12 ) { if ( v12 != 1 ) goto LABEL_52; v3->sResBodyBase += thisa; v13 = pGlobalTXT_LocalizationStrings[29]; } else { v3->sResMindBase += thisa; v13 = pGlobalTXT_LocalizationStrings[142]; } } else { v3->sResEarthBase += thisa; v13 = pGlobalTXT_LocalizationStrings[70]; } } else { v3->sResWaterBase += thisa; v13 = pGlobalTXT_LocalizationStrings[240]; } } else { v3->sResAirBase += thisa; v13 = pGlobalTXT_LocalizationStrings[6]; } } else { v3->sResFireBase += thisa; v13 = pGlobalTXT_LocalizationStrings[87]; } v74 = v13; LABEL_52: v62 = pGlobalTXT_LocalizationStrings[121]; v53 = v74; v49 = thisa; LABEL_53: sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62); LABEL_54: ShowStatusBarString(pTmpBuf, 2u); pMouse->RemoveHoldingItem(); pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, a2 - 1); v3->PlaySound(SPEECH_93, 0); pAudioPlayer->PlaySound((SoundID)(SOUND_Bell|0x2), 0, 0, -1, 0, 0, 0, 0); if ( pParty->uDaysPlayed == 6 || pParty->uDaysPlayed == 20 ) { v64 = 0; v55 = 16; } else { if ( pParty->uDaysPlayed == 12 || pParty->uDaysPlayed == 26 ) { v64 = 0; v55 = 14; } else { if ( pParty->uDaysPlayed != 4 && pParty->uDaysPlayed != 25 ) return; v64 = 0; v55 = 15; } } v3->SetCondition(v55, v64); v61 = 0; v52 = 0; v48 = 0; v45 = 0; v43 = -1; v41 = 0; v39 = 0; v37 = (SoundID)215; v14 = pAudioPlayer; goto LABEL_63; default: goto LABEL_54; } } if ( pParty->pPickedItem.uItemID == 630 ) { Party::GiveFood(1u); pAudioPlayer->PlaySound((SoundID)(SOUND_PlayerCantCastSpell|0x2), 0, 0, -1, 0, 0, 0, 0); } else { if ( pParty->pPickedItem.uItemID == 632 ) { v61 = 0; v52 = 0; v48 = 0; v45 = 0; v43 = -1; v41 = 0; v39 = 0; v37 = (SoundID)133; goto LABEL_93; } if ( pParty->pPickedItem.uItemID == 633 ) { v61 = 0; v52 = 0; v48 = 0; v45 = 0; v43 = -1; v41 = 0; v39 = 0; v37 = (SoundID)134; goto LABEL_93; } if ( pParty->pPickedItem.uItemID == 634 ) { v61 = 0; v52 = 0; v48 = 0; v45 = 0; v43 = -1; v41 = 0; v39 = 0; v37 = (SoundID)135; goto LABEL_93; } if ( pParty->pPickedItem.uItemID != 646 ) { if ( pParty->pPickedItem.uItemID == 650 ) { sub_44C28F_open_nwc_dungeon(); return; } goto LABEL_167; } pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, a2 - 1); v5 = 8 * a2 + 392; LOBYTE(v5) = (8 * a2 - 120) | 4; pAudioPlayer->PlaySound(SOUND_20001, v5, 0, -1, 0, 0, 0, 0); v3->AddVariable(VAR_NumSkillPoints, 2); } LABEL_187: pMouse->RemoveHoldingItem(); return; } if ( pParty->pPlayers[a2-1].CanAct() )//if ( ((Player *)&stru_AA1058[3].pSounds[6972 * a2 + 40552])->CanAct() ) { sub_467F48(pParty->pPickedItem.uItemID); v65 = 0; v56 = SPEECH_37; LABEL_67: v3->PlaySound((PlayerSpeech)v56, v65); return; } LABEL_89: v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; v58 = pGlobalTXT_LocalizationStrings[382]; LABEL_90: sprintf(pTmpBuf, v58, v68); v23 = pTmpBuf; LABEL_91: ShowStatusBarString(v23, 2u); v4 = 0; goto LABEL_92; } v15 = pParty->pPickedItem.uItemID - 400; v72 = (char *)&v3->pConditions[0] + pParty->pPickedItem.uItemID + 2; if ( *v72 ) { v66 = pParty->pPickedItem.GetDisplayName(); v57 = pGlobalTXT_LocalizationStrings[380]; LABEL_72: sprintf(pTmpBuf, v57, v66); ShowStatusBarString(pTmpBuf, 2u); LABEL_92: v61 = v4; v52 = v4; v48 = v4; v45 = v4; v43 = -1; v41 = v4; v39 = v4; v37 = (SoundID)27; LABEL_93: v14 = pAudioPlayer; LABEL_63: pAudioPlayer->PlaySound(v37, v39, v41, v43, v45, v48, v52, v61); return; } if ( !pParty->pPlayers[a2-1].CanAct() )//if ( !((Player *)&stru_AA1058[3].pSounds[6972 * a2 + 40552])->CanAct() ) { v66 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; v57 = pGlobalTXT_LocalizationStrings[382]; goto LABEL_72; } v16 = v15 % 11 + 1; v17 = &v3->pActiveSkills[v15 / 11 + 12]; v75 = v16; v18 = SkillToMastery(*v17) - 1; if ( v18 ) { v19 = v18 - 1; if ( v19 ) { v20 = v19 - 1; if ( v20 ) { if ( v20 != 1 ) { v21 = a2; LABEL_83: if ( v75 > v21 || !*v17 ) { v22 = pParty->pPickedItem.GetDisplayName(); sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[381], v22); ShowStatusBarString(pTmpBuf, 2u); v65 = 0; v56 = 20; goto LABEL_67; } *v72 = 1; v3->PlaySound(SPEECH_21, 0); v73 = 0; LABEL_173: v36 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType; if ( v36 == 14 ) { v71 = 0; v60 = 0; v51 = 0; v47 = 0; v44 = -1; v42 = 0; v40 = 0; v38 = (SoundID)210; } else { if ( v36 != 13 ) { LABEL_178: if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) { if ( !v73 ) goto LABEL_187; if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) { pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages; } } if ( v73 ) { if ( pParty->bTurnBasedModeOn ) { *(&pParty->field_16140 + a2) = 100; thisb->SetRecoveryTime(100); pTurnEngine->_40471C(); } else { thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); } } goto LABEL_187; } v71 = 0; v60 = 0; v51 = 0; v47 = 0; v44 = -1; v42 = 0; v40 = 0; v38 = (SoundID)211; } pAudioPlayer->PlaySound(v38, v40, v42, v44, v47, v51, v60, v71); goto LABEL_178; } v67 = 11; } else { v67 = 10; } } else { v67 = 7; } } else { v67 = 4; } v21 = v67; goto LABEL_83; } if ( pCurrentScreen == SCREEN_CASTING ) return; if ( !pParty->pPlayers[a2-1].CanAct() )//if ( !((Player *)&stru_AA1058[3].pSounds[6972 * a2 + 40552])->CanAct() ) goto LABEL_89; if ( bUnderwater == 1 ) { v23 = pGlobalTXT_LocalizationStrings[652]; goto LABEL_91; } dword_50C9AC = 1; v24 = pParty->pPickedItem.uItemID - 299; if ( pParty->pPickedItem.uItemID == 329 || v24 == 4 || v24 == 91 || v24 == 28 ) { pMouse->RemoveHoldingItem(); pGUIWindow_CurrentMenu->Release(); pIcons_LOD->_4114F2(); pCurrentScreen = SCREEN_GAME; viewparams->bRedrawGameUI = 1; _42777D_CastSpell_UseWand_ShootArrow(v24, a2 - 1, 0x85u, 1, 0); } else { _720984_unused = pParty->pPickedItem.uItemID; pMouse->RemoveHoldingItem(); if ( dword_50C9E8 < 40 ) { dword_50C9EC[3 * dword_50C9E8] = 146; dword_50C9F0[3 * dword_50C9E8] = v24; *(&dword_50C9E8 + 3 * dword_50C9E8 + 3) = a2 - 1; ++dword_50C9E8; } if ( pCurrentScreen && pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null && (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) { pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages; } } } // 4E28F8: using guessed type int pCurrentScreen; // 50C9AC: using guessed type int dword_50C9AC; // 50C9EC: using guessed type int dword_50C9EC[]; // 6BE3C4: using guessed type char bUnderwater; // 720984: using guessed type int 720984_unused; //----- (00449BB4) -------------------------------------------------------- char Player::CompareVariable(enum VariableType var, signed int a1) { Player *v3; // esi@1 signed int v4; // edi@1 unsigned int v5; // eax@8 int v6; // eax@9 enum CHARACTER_RACE v7; // eax@11 signed int v8; // eax@17 unsigned __int8 v9; // sf@17 unsigned __int8 v10; // of@17 int v11; // eax@19 unsigned int v12; // eax@20 unsigned int v13; // eax@25 unsigned __int8 v14; // cl@25 signed int v15; // ecx@28 ItemGen *v16; // eax@28 char v17; // zf@31 int v18; // edi@90 DDM_DLV_Header *v19; // eax@122 char v20; // cl@124 DDM_DLV_Header *v21; // eax@126 unsigned int v22; // edi@129 Player *v23; // esi@134 ItemGen *v24; // ecx@135 signed int v25; // edx@135 ITEM_EQUIP_TYPE v26; // ebx@155 char *v27; // edi@155 int v28; // ebx@161 int v29; // eax@161 v3 = this; v4 = -1; if ( var > VAR_AutoNotes ) { switch ( var ) { case VAR_Invisible: if ( SHIDWORD(pParty->pPartyBuffs[11].uExpireTime) >= 0 && (SHIDWORD(pParty->pPartyBuffs[11].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[11].uExpireTime) > 0) ) goto _return_true; goto _cmp_against_arg; case VAR_NumDeaths: v4 = pParty->uNumDeaths; goto _cmp_against_arg; case VAR_NumBounties: v4 = pParty->uNumBountiesCollected; goto _cmp_against_arg; case VAR_PrisonTerms: v4 = pParty->uNumPrisonTerms; goto _cmp_against_arg; case VAR_ArenaWinsPage: v4 = (unsigned __int8)pParty->uNumArenaPageWins; goto _cmp_against_arg; case VAR_ArenaWinsSquire: v4 = (unsigned __int8)pParty->uNumArenaSquireWins; goto _cmp_against_arg; case VAR_ArenaWinsKnight: v4 = (unsigned __int8)pParty->uNumArenaKnightWins; goto _cmp_against_arg; case VAR_ArenaWinsLord: v4 = (unsigned __int8)pParty->uNumArenaLordWins; goto _cmp_against_arg; case VAR_ReputationInCurrentLocation: v19 = &pOutdoor->ddm; if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) v19 = &pIndoor->dlv; v20 = v19->uReputation >= a1; goto _return; case VAR_History_28|VAR_Sex: v21 = &pOutdoor->ddm; if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) v21 = &pIndoor->dlv; v20 = v21->field_C_alert == a1; _return: LOBYTE(v6) = v20; return v6; case VAR_MonthEquals2|VAR_Sex: case VAR_MonthEquals2|VAR_Class: case VAR_Counter1: case VAR_Counter2: case VAR_Counter3: case VAR_Counter4: case VAR_Counter5: case VAR_Counter6: case VAR_Counter7: case VAR_Counter8: v22 = *(int *)&stru_AA1058[3].pSounds[8 * var + 44304]; if ( v22 | *(int *)&stru_AA1058[3].pSounds[8 * var + 44300] && (signed __int64)(__PAIR__(v22, *(int *)&stru_AA1058[3].pSounds[8 * var + 44300]) + (signed __int64)((double)(460800 * a1) * 0.033333335)) <= (signed __int64)pParty->uTimePlayed ) goto _return_true; goto _return_false; case VAR_NumSkillPoints: v4 = this->uSkillPoints; goto _cmp_against_arg; case VAR_CircusPrises: v4 = 0; v23 = pParty->pPlayers;//[0].pInventoryItems; do { v24 = v23->pInventoryItems; v25 = 138; do { switch ( v24->uItemID ) { case 0x1D6u: ++v4; break; case 0x1D7u: v4 += 3; break; case 0x1DDu: v4 += 5; break; } ++v24; --v25; } while ( v25 ); ++v23; } while ( v23 <= &pParty->pPlayers[3] ); goto _cmp_against_arg; case VAR_MonthEquals2: v17 = pParty->uCurrentMonth == a1; goto _return2; case VAR_IsFlying: if ( pParty->bFlying && SHIDWORD(pParty->pPartyBuffs[7].uExpireTime) >= 0 && (SHIDWORD(pParty->pPartyBuffs[7].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[7].uExpireTime) > 0) ) goto _return_true; goto _return_false; case VAR_HiredNPCHasSpeciality: LOBYTE(v6) = CheckHiredNPCSpeciality(a1); return v6; case VAR_NPCs2: return pNPCStats->pNewNPCData[a1].uFlags & 0x80; case VAR_MonthEquals|VAR_CurrentSP: v13 = 0x80u >> ((signed __int16)a1 - 1) % 8; v14 = this->field_1A50[((signed __int16)a1 - 1) >> 3]; goto LABEL_108; case VAR_ItemEquipped: v26 = (ITEM_EQUIP_TYPE)0; v27 = (char *)&this->pEquipment; break; case VAR_GoldInBank: v4 = pParty->uNumGoldInBank; goto _cmp_against_arg; case VAR_ThieverySkill|0x80: v28 = GetActualMight(); v29 = v3->GetBaseStrength(); goto LABEL_168; case VAR_DisarmTrapSkill|0x80: v28 = GetActualIntelligence(); v29 = v3->GetBaseIntelligence(); goto LABEL_168; case VAR_MonthEquals: v28 = GetActualWillpower(); v29 = v3->GetBaseWillpower(); goto LABEL_168; case VAR_MonthEquals|VAR_Sex: v28 = GetActualEndurance(); v29 = v3->GetBaseEndurance(); goto LABEL_168; case VAR_IdentifyMonsterSkill|0x80: v28 = GetActualSpeed(); v29 = v3->GetBaseSpeed(); goto LABEL_168; case VAR_ArmsmasterSkill|0x80: v28 = GetActualAccuracy(); v29 = v3->GetBaseAccuracy(); goto LABEL_168; case VAR_MonthEquals|VAR_MaxHP: v28 = GetActualLuck(); v29 = v3->GetBaseLuck(); LABEL_168: v10 = __OFSUB__(v28, v29); v9 = v28 - v29 < 0; LABEL_169: if ( v9 ^ v10 ) goto _cmp_against_arg; goto _return_true; default: goto _cmp_against_arg; } while ( !v3->HasItemEquipped(v26) || *(int *)&v3->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *(int *)v27 + 5] != a1 ) { v26 = (ITEM_EQUIP_TYPE)((int)v26 + 1); v27 += 4; if ( (signed int)v26 >= 16 ) { _return_false: LOBYTE(v6) = 0; return v6; } } goto _return_true; } if ( var == VAR_AutoNotes ) { v13 = 0x80u >> ((signed __int16)(a1 - 1) - 1) % 8; v14 = pParty->_autonote_bits[((signed __int16)(a1 - 1) - 1) >> 3]; LABEL_108: if ( !((unsigned __int8)v13 & v14) ) goto _cmp_against_arg; goto LABEL_109; } if ( var <= VAR_BaseLuck ) { if ( var != VAR_BaseLuck ) { switch ( var ) { case VAR_Hour: if ( (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24 == a1 ) goto _return_true; goto _return_false; case VAR_DayOfYear: v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 0x150 + 1; goto LABEL_9; case VAR_DayOfWeek: v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 7; LABEL_9: LOBYTE(v6) = v5 == a1; return v6; case VAR_Sex: v7 = (CHARACTER_RACE)this->uSex; goto _cmp_against_arg2; case VAR_Class: v7 = (CHARACTER_RACE)this->classType; goto _cmp_against_arg2; case VAR_Race: v7 = GetRace(); _cmp_against_arg2: if ( a1 == v7 ) goto _return_true; goto _cmp_against_arg; case VAR_CurrentHP: v4 = this->sHealth; goto _cmp_against_arg; case VAR_MaxHP: v8 = GetMaxHealth(); v10 = __OFSUB__(v3->sHealth, v8); v9 = v3->sHealth - v8 < 0; goto LABEL_169; case VAR_CurrentSP: v4 = this->sMana; goto _cmp_against_arg; case VAR_MaxSP: v11 = GetMaxMana(); v10 = __OFSUB__(v3->sMana, v11); v9 = v3->sMana - v11 < 0; goto LABEL_169; case VAR_ActualAC: v12 = GetActualAC(); goto _j_cmp_against_arg; case VAR_ACModifier: v4 = this->sACModifier; goto _cmp_against_arg; case VAR_BaseLevel: v4 = this->uLevel; goto _cmp_against_arg; case VAR_LevelModifier: v4 = this->sLevelModifier; goto _cmp_against_arg; case VAR_Age: v12 = GetActualAge(); goto _j_cmp_against_arg; case VAR_Award: v13 = 0x80u >> ((signed __int16)a1 - 1) % 8; v14 = this->field_152[((signed __int16)a1 - 1) >> 3]; goto LABEL_108; case VAR_Experience: v4 = LODWORD(this->uExperience); goto _cmp_against_arg; case VAR_QBits_QuestsDone: v13 = 0x80u >> ((signed __int16)a1 - 1) % 8; v14 = pParty->_award_bits[((signed __int16)a1 - 1) >> 3]; goto LABEL_108; case VAR_PlayerItemInHands: v15 = 0; v16 = v3->pInventoryItems; break; case VAR_FixedGold: v4 = pParty->uNumGold; goto _cmp_against_arg; case VAR_MightBonus: v4 = this->uMightBonus; goto _cmp_against_arg; case VAR_IntellectBonus: v4 = this->uIntelligenceBonus; goto _cmp_against_arg; case VAR_PersonalityBonus: v4 = this->uWillpowerBonus; goto _cmp_against_arg; case VAR_EnduranceBonus: v4 = this->uEnduranceBonus; goto _cmp_against_arg; case VAR_SpeedBonus: v4 = this->uSpeedBonus; goto _cmp_against_arg; case VAR_AccuracyBonus: v4 = this->uAccuracyBonus; goto _cmp_against_arg; case VAR_LuckBonus: v4 = this->uLuckBonus; goto _cmp_against_arg; case VAR_BaseMight: v4 = this->uMight; goto _cmp_against_arg; case VAR_BaseIntellect: v4 = this->uIntelligence; goto _cmp_against_arg; case VAR_BasePersonality: v4 = this->uWillpower; goto _cmp_against_arg; case VAR_BaseEndurance: v4 = this->uEndurance; goto _cmp_against_arg; case VAR_BaseSpeed: v4 = this->uSpeed; goto _cmp_against_arg; case VAR_BaseAccuracy: v4 = this->uAccuracy; goto _cmp_against_arg; case VAR_FixedFood: v4 = pParty->uNumFoodRations; goto _cmp_against_arg; default: goto _cmp_against_arg; } while ( v16->uItemID != a1 ) { ++v15; ++v16; if ( v15 >= 138 ) { v17 = pParty->pPickedItem.uItemID == a1; _return2: LOBYTE(v6) = v17; return v6; } } _return_true: LOBYTE(v6) = 1; return v6; } v4 = this->uLuck; goto _cmp_against_arg; } if ( var <= VAR_MagicResistance ) { if ( var == VAR_MagicResistance ) { v4 = this->sResMagicBase; } else { switch ( var ) { case VAR_FireResistance: v4 = this->sResFireBase; goto _cmp_against_arg; case VAR_AirResistance: v4 = this->sResAirBase; goto _cmp_against_arg; case VAR_WaterResistance: v4 = this->sResWaterBase; goto _cmp_against_arg; case VAR_EarthResistance: v4 = this->sResEarthBase; goto _cmp_against_arg; case VAR_SpiritResistance: v4 = this->sResSpiritBase; goto _cmp_against_arg; case VAR_MindResistance: v4 = this->sResMindBase; goto _cmp_against_arg; case VAR_BodyResistance: v4 = this->sResBodyBase; goto _cmp_against_arg; case VAR_LightResistance: v4 = this->sResLightBase; goto _cmp_against_arg; case VAR_DarkResistance: v4 = this->sResDarkBase; goto _cmp_against_arg; case VAR_ActualMight: v12 = GetActualMight(); goto _j_cmp_against_arg; case VAR_ActualIntellect: v12 = GetActualIntelligence(); goto _j_cmp_against_arg; case VAR_ActualPersonality: v12 = GetActualWillpower(); goto _j_cmp_against_arg; case VAR_ActualEndurance: v12 = GetActualEndurance(); goto _j_cmp_against_arg; case VAR_ActualSpeed: v12 = GetActualSpeed(); goto _j_cmp_against_arg; case VAR_ActualAccuracy: v12 = GetActualAccuracy(); goto _j_cmp_against_arg; case VAR_ActualLuck: v12 = GetActualLuck(); _j_cmp_against_arg: v4 = v12; break; default: goto _cmp_against_arg; } } goto _cmp_against_arg; } if ( var <= VAR_DisarmTrapSkill ) { if ( var != VAR_DisarmTrapSkill ) { if ( var <= VAR_MindResistanceBonus ) { switch ( var ) { case VAR_MindResistanceBonus: v4 = this->sResMindBonus; break; case VAR_FireResistanceBonus: v4 = this->sResFireBonus; break; case VAR_AirResistanceBonus: v4 = this->sResAirBonus; break; case VAR_WaterResistanceBonus: v4 = this->sResWaterBonus; break; case VAR_EarthResistanceBonus: v4 = this->sResEarthBonus; break; case VAR_SpiritResistanceBonus: v4 = this->sResSpiritBonus; break; } goto _cmp_against_arg; } if ( var == VAR_BodyResistanceBonus ) { v4 = this->sResBodyBonus; goto _cmp_against_arg; } if ( var == VAR_LightResistanceBonus ) { v4 = this->sResLightBonus; goto _cmp_against_arg; } if ( var == VAR_DarkResistanceBonus ) { v4 = this->sResDarkBonus; goto _cmp_against_arg; } if ( var == VAR_MagicResistanceBonus ) { v4 = this->sResMagicBonus; goto _cmp_against_arg; } if ( var <= VAR_MagicResistanceBonus || var > VAR_DiplomacySkill ) goto _cmp_against_arg; } LABEL_90: v18 = *((short *)&this->pConditions[16] + var); if ( a1 <= 63 ) v4 = v18 & 0x3F; else v4 = a1 & v18; goto _cmp_against_arg; } if ( var == 104 ) goto LABEL_90; if ( (signed int)var <= 104 ) goto _cmp_against_arg; if ( (signed int)var > 0x79 ) { if ( var != 122 ) { if ( (signed int)var > 122 && var <= VAR_ActiveSpells ) v4 = (unsigned __int8)byte_5E4C15[var]; goto _cmp_against_arg; } v4 = GetMajorConditionIdx(); if ( v4 != 18 ) { _cmp_against_arg: LOBYTE(v6) = v4 >= a1; return v6; } LABEL_109: v4 = a1; goto _cmp_against_arg; } return *((int *)this + 2 * var - 210); } //----- (0044A5CB) -------------------------------------------------------- void Player::SetVariable(enum VariableType var, signed int a3) { signed int v3; // ebx@1 Player *v4; // esi@1 unsigned int v5; // edi@1 unsigned int v6; // esi@13 unsigned int v7; // esi@14 signed int v8; // eax@17 ItemGen *v9; // ecx@17 int v10; // eax@21 signed int v11; // eax@30 Player *v12; // ecx@44 char *v13; // ecx@45 Player *v14; // ecx@49 int v15; // ecx@86 int v16; // esi@106 char v17; // al@106 int v18; // eax@107 Player *v19; // ecx@112 Player *v20; // ecx@127 int v21; // eax@127 int v22; // eax@145 char v23; // zf@146 DDM_DLV_Header *v24; // ecx@148 signed int v25; // eax@172 int v26; // [sp-8h] [bp-3Ch]@84 signed int v27; // [sp-4h] [bp-38h]@4 int v28; // [sp-4h] [bp-38h]@84 ItemGen item; // [sp+Ch] [bp-28h]@52 char v30; // [sp+32h] [bp-2h]@1 char v31; // [sp+33h] [bp-1h]@1 v3 = 0; v30 = 0; v31 = 0; v4 = this; v5 = 0; if ( this == pPlayers[2] ) { v3 = 1; goto LABEL_8; } if ( this == pPlayers[3] ) { v27 = 2; } else { if ( this != pPlayers[4] ) goto LABEL_8; v27 = 3; } v3 = v27; LABEL_8: if ( var > VAR_AutoNotes ) { if ( var <= VAR_GoldInBank ) { if ( var == VAR_GoldInBank ) { pParty->uNumGoldInBank = a3; return; } if ( var <= VAR_Counter8 ) { if ( (signed int)var >= 245 ) { *(int *)&stru_AA1058[3].pSounds[8 * var + 44300] = LODWORD(pParty->uTimePlayed); *(int *)&stru_AA1058[3].pSounds[8 * var + 44304] = HIDWORD(pParty->uTimePlayed); } else { switch ( var ) { case VAR_MonthEquals|VAR_CurrentSP: _449B7E_toggle_bit((unsigned char *)field_1A50, a3, 1u); break; case VAR_NPCs2: pParty->field_709 = 0; LOBYTE(pNPCStats->pNewNPCData[a3].uFlags) |= 0x80u; sub_44A56A(); viewparams->bRedrawGameUI = 1; break; case VAR_NumSkillPoints: this->uSkillPoints = a3; break; } } return; } if ( var < VAR_Counter9 ) return; if ( (signed int)var <= 274 ) { *(int *)&stru_AA1058[3].pSounds[8 * var + 44532] = LODWORD(pParty->uTimePlayed); *(int *)&stru_AA1058[3].pSounds[8 * var + 44536] = HIDWORD(pParty->uTimePlayed); } else { if ( var == VAR_ReputationInCurrentLocation ) { v24 = &pOutdoor->ddm; if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) v24 = &pIndoor->dlv; v24->uReputation = a3; if ( a3 > 10000 ) v24->uReputation = 10000; return; } if ( var <= VAR_ReputationInCurrentLocation || var > VAR_History_28 || (v22 = var - 276, pParty->field_3C.field_4F0[2 * v22 + 1] | pParty->field_3C.field_4F0[2 * v22]) || (pParty->field_3C.field_4F0[2 * (var - 276)] = LODWORD(pParty->uTimePlayed), v23 = *(&pStorylineText->field_0 + 3 * v22) == 0, pParty->field_3C.field_4F0[2 * (var - 276) + 1] = HIDWORD(pParty->uTimePlayed), v23) ) return; bFlashHistoryBook = 1; } LABEL_172: v25 = 8 * v3 + 400; LOBYTE(v25) = (8 * v3 - 112) | 4; pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5); return; } if ( var != 307 ) { switch ( var ) { case 308: pParty->uNumBountiesCollected = a3; break; case 309: pParty->uNumPrisonTerms = a3; break; case 310: pParty->uNumArenaPageWins = a3; break; case 311: pParty->uNumArenaSquireWins = a3; break; case 312: pParty->uNumArenaKnightWins = a3; break; case 313: pParty->uNumArenaLordWins = a3; break; } return; } pParty->uNumDeaths = a3; LABEL_168: if ( v30 != 1 ) { LABEL_170: if ( v31 != 1 ) return; v5 = 0; goto LABEL_172; } LABEL_169: pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, v3); goto LABEL_170; } if ( var == VAR_AutoNotes ) { if ( !((unsigned __int8)(0x80u >> ((signed __int16)a3 - 1) % 8) & pParty->_autonote_bits[((signed __int16)a3 - 1) >> 3]) //&& (&dword_723718_autonote_related)[8 * a3] ) && pAutonoteTxt[a3-1].pText ) { v20 = pPlayers[v3 + 1]; v30 = 1; v20->PlaySound(SPEECH_96, 0); v21 = pAutonoteTxt[a3-1].eType;// dword_72371C[2 * a3]; bFlashAutonotesBook = 1; dword_506568 = v21; } _449B7E_toggle_bit(pParty->_autonote_bits, a3, 1u); v31 = 1; goto LABEL_168; } if ( var <= VAR_ActualMight ) { if ( var != VAR_ActualMight ) { switch ( var ) { case VAR_RandomGold: v6 = rand() % a3 + 1; Party::SetGold(v6); sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[500], v6);// You have %lu gold ShowStatusBarString(pTmpBuf, 2u); GameUI_DrawFoodAndGold(); return; case VAR_RandomFood: v7 = rand() % a3 + 1; Party::SetFood(v7); sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[501], v7);// You have %lu food ShowStatusBarString(pTmpBuf, 2u); GameUI_DrawFoodAndGold(); goto LABEL_124; case VAR_Sex: this->uSex = (PLAYER_SEX)a3; goto LABEL_124; case VAR_Class: this->classType = (PLAYER_CLASS_TYPE)a3; if ( (char)a3 != 35 ) goto LABEL_124; v8 = 0; v9 = this->pInventoryItems; break; case VAR_CurrentHP: this->sHealth = a3; goto LABEL_124; case VAR_MaxHP: this->sHealth = GetMaxHealth(); return; case VAR_CurrentSP: this->sMana = a3; goto LABEL_124; case VAR_MaxSP: this->sMana = GetMaxMana(); return; case VAR_ACModifier: this->sACModifier = (unsigned __int8)a3; goto LABEL_124; case VAR_BaseLevel: this->uLevel = (unsigned __int8)a3; goto LABEL_124; case VAR_LevelModifier: this->sLevelModifier = (unsigned __int8)a3; goto LABEL_124; case VAR_Age: this->sAgeModifier = a3; return; case VAR_Award: if ( !((unsigned __int8)(0x80u >> ((signed __int16)a3 - 1) % 8) & pPlayers[v3 + 1]->field_152[((signed __int16)a3 - 1) >> 3]) //&& dword_723E80_award_related[2 * a3] ) && pAwards[a3-1].pText ) { v12 = pPlayers[v3 + 1]; v30 = 1; v31 = 1; v12->PlaySound(SPEECH_96, 0); } v13 = v4->field_152; goto LABEL_51; case VAR_Experience: this->uExperience = a3; goto LABEL_124; case VAR_QBits_QuestsDone: if ( !((unsigned __int8)(0x80u >> ((signed __int16)a3 - 1) % 8) & pParty->_award_bits[((signed __int16)a3 - 1) >> 3]) // && (&dword_722F10)[4 * a3] ) && pQuestTable[a3-1] ) { v14 = pPlayers[v3 + 1]; bFlashQuestBook = 1; v30 = 1; v31 = 1; v14->PlaySound(SPEECH_93, 0); } v13 = (char *)pParty->_award_bits; LABEL_51: _449B7E_toggle_bit((unsigned char *)v13, a3, 1u); goto LABEL_168; case VAR_PlayerItemInHands: item.Reset(); item.Reset(); item.uItemID = a3; item.uAttributes = 1; pParty->SetHoldingItem(&item); if ( a3 >= ITEM_ARTIFACT_PUCK && a3 <= ITEM_RELIC_MEKORIGS_HAMMER ) pParty->field_3C.pIsArtifactFound[a3] = 1; return; case VAR_FixedGold: Party::SetGold(a3); return; case VAR_BaseMight: this->uMight = (unsigned __int8)a3; goto LABEL_84; case VAR_BaseIntellect: this->uIntelligence = (unsigned __int8)a3; goto LABEL_84; case VAR_BasePersonality: this->uWillpower = (unsigned __int8)a3; goto LABEL_84; case VAR_BaseEndurance: this->uEndurance = (unsigned __int8)a3; goto LABEL_84; case VAR_BaseSpeed: this->uSpeed = (unsigned __int8)a3; goto LABEL_84; case VAR_BaseAccuracy: this->uAccuracy = (unsigned __int8)a3; goto LABEL_84; case VAR_BaseLuck: this->uLuck = (unsigned __int8)a3; goto LABEL_84; case VAR_FixedFood: Party::SetFood(a3); goto LABEL_124; case VAR_MightBonus: goto LABEL_64; case VAR_IntellectBonus: goto LABEL_68; case VAR_PersonalityBonus: goto LABEL_69; case VAR_EnduranceBonus: goto LABEL_70; case VAR_SpeedBonus: goto LABEL_71; case VAR_AccuracyBonus: goto LABEL_72; case VAR_LuckBonus: goto LABEL_73; default: return; } while ( v9->uItemID != 615 ) { ++v8; ++v9; if ( v8 >= 138 ) goto LABEL_22; } v10 = (int)((char *)v4 + 36 * v8); *(int *)(v10 + 532) = 601; *(char *)(v10 + 558) = v3 + 1; LABEL_22: if ( v4->sResFireBase < 20 ) v4->sResFireBase = 20; if ( v4->sResAirBase < 20 ) v4->sResAirBase = 20; if ( v4->sResWaterBase < 20 ) v4->sResWaterBase = 20; if ( v4->sResEarthBase < 20 ) v4->sResEarthBase = 20; v4->sResMindBase = 200; v4->sResBodyBase = 200; v11 = v4->GetSexByVoice(); v4->field_1924 = v4->uVoiceID; v4->field_1928 = v4->uFace; if ( v11 ) { v4->uFace = 21; v4->uVoiceID = 21; } else { v4->uFace = 20; v4->uVoiceID = 20; } ReloadPlayerPortraits(v3, v4->uFace); goto LABEL_124; } LABEL_64: this->uMightBonus = (unsigned __int8)a3; LABEL_111: v28 = 0; v26 = SPEECH_91; LABEL_112: v19 = pPlayers[v3 + 1]; v31 = 1; v19->PlaySound((PlayerSpeech)v26, v28); goto LABEL_169; } if ( var <= VAR_FireResistanceBonus ) { if ( var == VAR_FireResistanceBonus ) { this->sResFireBonus = (unsigned __int8)a3; goto LABEL_111; } switch ( var ) { case VAR_ActualIntellect: LABEL_68: this->uIntelligenceBonus = (unsigned __int8)a3; goto LABEL_111; case VAR_ActualPersonality: LABEL_69: this->uWillpowerBonus = (unsigned __int8)a3; goto LABEL_111; case VAR_ActualEndurance: LABEL_70: this->uEnduranceBonus = (unsigned __int8)a3; goto LABEL_111; case VAR_ActualSpeed: LABEL_71: this->uSpeedBonus = (unsigned __int8)a3; goto LABEL_111; case VAR_ActualAccuracy: LABEL_72: this->uAccuracyBonus = (unsigned __int8)a3; goto LABEL_111; case VAR_ActualLuck: LABEL_73: this->uLuckBonus = (unsigned __int8)a3; goto LABEL_111; case VAR_FireResistance: this->sResFireBase = (unsigned __int8)a3; goto LABEL_84; case VAR_AirResistance: this->sResAirBase = (unsigned __int8)a3; goto LABEL_84; case VAR_WaterResistance: this->sResWaterBase = (unsigned __int8)a3; goto LABEL_84; case VAR_EarthResistance: this->sResEarthBase = (unsigned __int8)a3; goto LABEL_84; case VAR_SpiritResistance: this->sResSpiritBase = (unsigned __int8)a3; goto LABEL_84; case VAR_MindResistance: this->sResMindBase = (unsigned __int8)a3; goto LABEL_84; case VAR_BodyResistance: this->sResBodyBase = (unsigned __int8)a3; goto LABEL_84; case VAR_LightResistance: this->sResLightBase = (unsigned __int8)a3; goto LABEL_84; case VAR_DarkResistance: this->sResDarkBase = (unsigned __int8)a3; goto LABEL_84; case VAR_MagicResistance: this->sResMagicBase = (unsigned __int8)a3; LABEL_84: v28 = 0; v26 = 92; goto LABEL_112; default: return; } return; } HIWORD(v15) = 0; if ( var > VAR_DisarmTrapSkill ) { if ( var != VAR_LearningSkill ) { if ( var <= VAR_LearningSkill ) return; if ( var <= VAR_Eradicated ) { v4->SetCondition(var - 105, 1); } else { if ( var != VAR_MajorCondition ) { if ( var > VAR_MajorCondition && var <= VAR_ActiveSpells ) byte_5E4C15[var] = a3; return; } memset(v4, 0, 0xA0u); } LABEL_124: v31 = 1; goto LABEL_169; } LABEL_106: v16 = (int)((char *)&v4->pConditions[16] + 2 * var); v17 = *(char *)v16; if ( a3 <= VAR_BodyResistanceBonus ) { LOWORD(v15) = (unsigned __int8)a3; v18 = v15 | v17 & VAR_BodyResistanceBonus; } else { LOWORD(v18) = (unsigned __int8)(a3 | v17 & 0xC0); } *(short *)v16 = v18; goto LABEL_124; } if ( var == VAR_DisarmTrapSkill ) goto LABEL_106; if ( var <= VAR_BodyResistanceBonus ) { switch ( var ) { case VAR_BodyResistanceBonus: v4->sResBodyBonus = (unsigned __int8)a3; break; case VAR_AirResistanceBonus: v4->sResAirBonus = (unsigned __int8)a3; break; case VAR_WaterResistanceBonus: v4->sResWaterBonus = (unsigned __int8)a3; break; case VAR_EarthResistanceBonus: v4->sResEarthBonus = (unsigned __int8)a3; break; case VAR_SpiritResistanceBonus: v4->sResSpiritBonus = (unsigned __int8)a3; break; default: if ( var != 62 ) return; v4->sResMindBonus = (unsigned __int8)a3; break; } goto LABEL_111; } if ( var == VAR_LightResistanceBonus ) { v4->sResLightBonus = (unsigned __int8)a3; goto LABEL_111; } if ( var == VAR_DarkResistanceBonus ) { v4->sResDarkBonus = (unsigned __int8)a3; goto LABEL_111; } if ( var == VAR_MagicResistanceBonus ) { v4->sResMagicBonus = (unsigned __int8)a3; goto LABEL_111; } if ( var > VAR_MagicResistanceBonus && var <= VAR_DiplomacySkill ) goto LABEL_106; } //----- (0044AFFB) -------------------------------------------------------- void Player::AddVariable(enum VariableType var, signed int val) { char v3; // bl@1 Player *v4; // esi@1 signed int uPlayerIdx; // edi@1 int v6; // eax@15 unsigned int v7; // esi@18 int *v8; // ebx@21 int v9; // eax@22 signed int v10; // eax@24 int v11; // eax@27 __int16 *v12; // esi@28 Player *v13; // ecx@34 Player *v14; // ecx@36 char *v15; // ecx@37 unsigned __int8 v16; // cf@38 Player *v17; // ecx@42 __int16 *v18; // esi@53 __int16 *v19; // esi@62 char *v20; // esi@107 __int16 v21; // dx@107 int v22; // ecx@107 Player *v23; // ecx@132 int v24; // eax@132 int v25; // eax@150 char v26; // zf@151 DDM_DLV_Header *v27; // eax@153 signed int v28; // eax@176 int v29; // [sp-8h] [bp-40h]@84 signed int v30; // [sp-4h] [bp-3Ch]@4 int v31; // [sp-4h] [bp-3Ch]@84 ItemGen item; // [sp+Ch] [bp-2Ch]@45 unsigned int v33; // [sp+30h] [bp-8h]@34 char v34; // [sp+37h] [bp-1h]@1 auto Dst = this; v3 = 0; v34 = 0; v4 = Dst; uPlayerIdx = 0; if ( Dst == pPlayers[2] ) { uPlayerIdx = 1; goto LABEL_8; } if ( Dst == pPlayers[3] ) { v30 = 2; } else { if ( Dst != pPlayers[4] ) goto LABEL_8; v30 = 3; } uPlayerIdx = v30; LABEL_8: if ( var <= VAR_AutoNotes ) { if ( var != VAR_AutoNotes ) { if ( var <= VAR_ActualMight ) { if ( var != VAR_ActualMight ) { switch ( var ) { case VAR_RandomGold: if ( !val ) val = 1; v6 = rand(); party_finds_gold(v6 % val + 1, 1); GameUI_DrawFoodAndGold(); return; case VAR_RandomFood: if ( !val ) val = 1; v7 = rand() % val + 1; Party::GiveFood(v7); sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[502], v7);// You find %lu food ShowStatusBarString(pTmpBuf, 2u); GameUI_DrawFoodAndGold(); goto _play_sound; case VAR_Sex: Dst->uSex = (PLAYER_SEX)val; goto _play_anim_and_exit; case VAR_Class: Dst->classType = (PLAYER_CLASS_TYPE)val; goto _play_anim_and_exit; case VAR_CurrentHP: v8 = &Dst->sHealth; *v8 += val; if ( Dst->sHealth <= Dst->GetMaxHealth() ) goto _play_anim_and_exit; v9 = v4->GetMaxHealth(); goto LABEL_23; case VAR_MaxHP: v10 = Dst->GetMaxHealth(); v4->_health_related = 0; v4->uFullHealthBonus = 0; v4->sHealth = v10; return; case VAR_CurrentSP: v8 = &Dst->sMana; *v8 += val; if ( Dst->sMana > GetMaxMana() ) { v9 = v4->GetMaxMana(); LABEL_23: *v8 = v9; } goto _play_anim_and_exit; case VAR_MaxSP: v11 = GetMaxMana(); v4->_mana_related = 0; v4->uFullManaBonus = 0; v4->sMana = v11; return; case VAR_ACModifier: v12 = &Dst->sACModifier; goto LABEL_29; case VAR_BaseLevel: v12 = (__int16 *)&Dst->uLevel; goto LABEL_29; case VAR_LevelModifier: v12 = &Dst->sLevelModifier; LABEL_29: *v12 += val; if ( *v12 > 255 ) *v12 = 255; goto _play_anim_and_exit; case VAR_Age: Dst->sAgeModifier += val; return; case VAR_Award: v13 = pPlayers[uPlayerIdx + 1]; v33 = 0x80u >> ((signed __int16)val - 1) % 8; if ( !((unsigned __int8)(0x80u >> ((signed __int16)val - 1) % 8) & v13->field_152[((signed __int16)val - 1) >> 3]) //&& dword_723E80_award_related[2 * val] ) && pAwards[val-1].pText ) { v14 = pPlayers[uPlayerIdx + 1]; v34 = 1; v3 = 1; v14->PlaySound(SPEECH_96, 0); } v15 = v4->field_152; goto LABEL_44; case VAR_Experience: v16 = __CFADD__(val, LODWORD(Dst->uExperience)); LODWORD(Dst->uExperience) += val; HIDWORD(Dst->uExperience) += ((unsigned __int64)val >> 32) + v16; if ( (signed __int64)Dst->uExperience > 4000000000i64 ) Dst->uExperience = 4000000000i64; goto _play_anim_and_exit; case VAR_QBits_QuestsDone: if ( !((unsigned __int8)(0x80u >> ((signed __int16)val - 1) % 8) & pParty->_award_bits[((signed __int16)val - 1) >> 3]) //&& (&dword_722F10)[4 * val] ) && pQuestTable[val-1] ) { v17 = pPlayers[uPlayerIdx + 1]; bFlashQuestBook = 1; v34 = 1; v3 = 1; v17->PlaySound(SPEECH_93, 0); } v15 = (char *)pParty->_award_bits; LABEL_44: _449B7E_toggle_bit((unsigned char *)v15, val, 1u); goto LABEL_173; case VAR_PlayerItemInHands: item.Reset(); item.Reset(); item.uAttributes = 1; item.uItemID = val; if ( val >= ITEM_ARTIFACT_PUCK && val <= ITEM_RELIC_MEKORIGS_HAMMER ) pParty->field_3C.pIsArtifactFound[val] = 1; if ( val >= ITEM_WAND_FIRE && val <= ITEM_WAND_INCENERATION ) { item.uNumCharges = rand() % 6 + pItemsTable->pItems[item.uItemID].uDamageMod + 1; item.uMaxCharges = LOBYTE(item.uNumCharges); } pParty->SetHoldingItem(&item); return; case VAR_FixedGold: party_finds_gold(val, 1); return; case VAR_BaseMight: v18 = (__int16 *)&Dst->uMight; goto LABEL_82; case VAR_BaseIntellect: v18 = (__int16 *)&Dst->uIntelligence; goto LABEL_82; case VAR_BasePersonality: v18 = (__int16 *)&Dst->uWillpower; goto LABEL_82; case VAR_BaseEndurance: v18 = (__int16 *)&Dst->uEndurance; goto LABEL_82; case VAR_BaseSpeed: v18 = (__int16 *)&Dst->uSpeed; goto LABEL_82; case VAR_BaseAccuracy: v18 = (__int16 *)&Dst->uAccuracy; goto LABEL_82; case VAR_BaseLuck: v18 = (__int16 *)&Dst->uLuck; goto LABEL_82; case VAR_FixedFood: Party::GiveFood(val); sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[502], val); ShowStatusBarString(pTmpBuf, 2u); if ( pParty->uNumFoodRations > 0xFFFF ) Party::SetFood(0xFFFFu); goto _play_sound; case VAR_MightBonus: goto LABEL_62; case VAR_IntellectBonus: goto LABEL_66; case VAR_PersonalityBonus: goto LABEL_67; case VAR_EnduranceBonus: goto LABEL_68; case VAR_SpeedBonus: goto LABEL_69; case VAR_AccuracyBonus: goto LABEL_70; case VAR_LuckBonus: goto LABEL_71; default: return; } return; } LABEL_62: v19 = (__int16 *)&Dst->uMightBonus; goto LABEL_113; } if ( var <= VAR_FireResistanceBonus ) { if ( var != VAR_FireResistanceBonus ) { switch ( var ) { case VAR_ActualIntellect: LABEL_66: v19 = (__int16 *)&Dst->uIntelligenceBonus; goto LABEL_113; case VAR_ActualPersonality: LABEL_67: v19 = (__int16 *)&Dst->uWillpowerBonus; goto LABEL_113; case VAR_ActualEndurance: LABEL_68: v19 = (__int16 *)&Dst->uEnduranceBonus; goto LABEL_113; case VAR_ActualSpeed: LABEL_69: v19 = (__int16 *)&Dst->uSpeedBonus; goto LABEL_113; case VAR_ActualAccuracy: LABEL_70: v19 = (__int16 *)&Dst->uAccuracyBonus; goto LABEL_113; case VAR_ActualLuck: LABEL_71: v19 = (__int16 *)&Dst->uLuckBonus; goto LABEL_113; case VAR_FireResistance: v18 = &Dst->sResFireBase; goto LABEL_82; case VAR_AirResistance: v18 = &Dst->sResAirBase; goto LABEL_82; case VAR_WaterResistance: v18 = &Dst->sResWaterBase; goto LABEL_82; case VAR_EarthResistance: v18 = &Dst->sResEarthBase; goto LABEL_82; case VAR_SpiritResistance: v18 = &Dst->sResSpiritBase; goto LABEL_82; case VAR_MindResistance: v18 = &Dst->sResMindBase; goto LABEL_82; case VAR_BodyResistance: v18 = &Dst->sResBodyBase; goto LABEL_82; case VAR_LightResistance: v18 = &Dst->sResLightBase; goto LABEL_82; case VAR_DarkResistance: v18 = &Dst->sResDarkBase; goto LABEL_82; case VAR_MagicResistance: v18 = &Dst->sResMagicBase; LABEL_82: *v18 += val; if ( *v18 > 255 ) *v18 = 255; v31 = 0; v29 = 92; goto LABEL_116; default: return; } return; } v19 = &Dst->sResFireBonus; LABEL_113: *v19 += val; if ( *v19 > 255 ) *v19 = 255; v31 = 0; v29 = SPEECH_91; LABEL_116: v3 = 1; pPlayers[uPlayerIdx + 1]->PlaySound((PlayerSpeech)v29, v31); goto _play_anim_and_maybe_sound; } if ( var <= VAR_DisarmTrapSkill ) { if ( var != VAR_DisarmTrapSkill ) { if ( var <= VAR_BodyResistanceBonus ) { switch ( var ) { case VAR_BodyResistanceBonus: v19 = &Dst->sResBodyBonus; break; case VAR_AirResistanceBonus: v19 = &Dst->sResAirBonus; break; case VAR_WaterResistanceBonus: v19 = &Dst->sResWaterBonus; break; case VAR_EarthResistanceBonus: v19 = &Dst->sResEarthBonus; break; case VAR_SpiritResistanceBonus: v19 = &Dst->sResSpiritBonus; break; default: if ( var != 62 ) return; v19 = &Dst->sResMindBonus; break; } goto LABEL_113; } if ( var == VAR_LightResistanceBonus ) { v19 = &Dst->sResLightBonus; goto LABEL_113; } if ( var == VAR_DarkResistanceBonus ) { v19 = &Dst->sResDarkBonus; goto LABEL_113; } if ( var == VAR_MagicResistanceBonus ) { v19 = &Dst->sResMagicBonus; goto LABEL_113; } if ( var <= VAR_MagicResistanceBonus || var > VAR_DiplomacySkill ) return; } goto LABEL_106; } if ( var == VAR_LearningSkill ) { LABEL_106: if ( val <= VAR_BodyResistanceBonus ) { *((short *)&Dst->pConditions[16] + var) = (unsigned __int8)val | *((char *)&Dst->pConditions[16] + 2 * var) & VAR_BodyResistanceBonus; } else { v20 = (char *)&Dst->pConditions[16] + 2 * var; v21 = *(short *)v20; v22 = (unsigned __int8)val + (v21 & VAR_BodyResistanceBonus); if ( v22 > 60 ) LOWORD(v22) = 60; LOBYTE(v21) = v21 & 0xC0; *(short *)v20 = v22 | v21; } goto _play_anim_and_exit; } if ( var <= VAR_LearningSkill ) return; if ( var <= VAR_Eradicated ) { Dst->SetCondition(var - 105, 0); } else { if ( var != VAR_MajorCondition ) { if ( var > VAR_MajorCondition && var <= VAR_ActiveSpells ) { if ( (unsigned __int8)val + (unsigned __int8)byte_5E4C15[var] <= 255 ) byte_5E4C15[var] += val; else byte_5E4C15[var] = -1; } return; } memset(Dst, 0, 0xA0u); } _play_anim_and_exit: v3 = 1; _play_anim_and_maybe_sound: pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); _maybe_play_sound: if ( v3 != 1 ) return; goto _play_sound; } if ( !((unsigned __int8)(0x80u >> ((signed __int16)val - 1) % 8) & pParty->_autonote_bits[((signed __int16)val - 1) >> 3]) //&& (&dword_723718_autonote_related)[8 * val] ) && pAutonoteTxt[val-1].pText ) { v23 = pPlayers[uPlayerIdx + 1]; v34 = 1; v23->PlaySound(SPEECH_96, 0); v24 = pAutonoteTxt[val-1].eType;//dword_72371C[2 * val]; bFlashAutonotesBook = 1; dword_506568 = v24; } _449B7E_toggle_bit(pParty->_autonote_bits, val, 1u); v3 = 1; LABEL_173: if ( v34 != 1 ) goto _maybe_play_sound; goto _play_anim_and_maybe_sound; } if ( var > VAR_GoldInBank ) { if ( var == 307 ) { pParty->uNumDeaths += val; goto LABEL_173; } switch ( var ) { case 308: pParty->uNumBountiesCollected += val; break; case 309: pParty->uNumPrisonTerms += val; break; case 310: pParty->uNumArenaPageWins += val; break; case 311: pParty->uNumArenaSquireWins += val; break; case 312: pParty->uNumArenaKnightWins += val; break; case 313: pParty->uNumArenaLordWins += val; break; } } else { if ( var == VAR_GoldInBank ) { pParty->uNumGoldInBank += val; return; } if ( var <= VAR_Counter8 ) { if ( (signed int)var >= 245 ) { *(int *)&stru_AA1058[3].pSounds[8 * var + 44300] = LODWORD(pParty->uTimePlayed); *(int *)&stru_AA1058[3].pSounds[8 * var + 44304] = HIDWORD(pParty->uTimePlayed); } else { switch ( var ) { case VAR_MonthEquals|VAR_CurrentSP: _449B7E_toggle_bit((unsigned char *)Dst->field_1A50, val, 1u); break; case VAR_NPCs2: pParty->field_709 = 0; LOBYTE(pNPCStats->pNewNPCData[val].uFlags) |= 0x80u; sub_44A56A(); viewparams->bRedrawGameUI = 1; break; case VAR_NumSkillPoints: Dst->uSkillPoints += val; break; } } return; } if ( var < VAR_Counter9 ) return; if ( (signed int)var <= 274 ) { *(int *)&stru_AA1058[3].pSounds[8 * var + 44532] = LODWORD(pParty->uTimePlayed); *(int *)&stru_AA1058[3].pSounds[8 * var + 44536] = HIDWORD(pParty->uTimePlayed); goto _play_sound; } if ( var != VAR_ReputationInCurrentLocation ) { if ( var <= VAR_ReputationInCurrentLocation || var > VAR_History_28 || (v25 = var - 276, pParty->field_3C.field_4F0[2 * v25 + 1] | pParty->field_3C.field_4F0[2 * v25]) || (pParty->field_3C.field_4F0[2 * (var - 276)] = LODWORD(pParty->uTimePlayed), v26 = *(&pStorylineText->field_0 + 3 * v25) == 0, pParty->field_3C.field_4F0[2 * (var - 276) + 1] = HIDWORD(pParty->uTimePlayed), v26) ) return; bFlashHistoryBook = 1; _play_sound: v28 = 8 * uPlayerIdx + 400; LOBYTE(v28) = (8 * uPlayerIdx - 112) | 4; pAudioPlayer->PlaySound(SOUND_20001, v28, 0, -1, 0, 0, 0, 0); return; } v27 = &pOutdoor->ddm; if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) v27 = &pIndoor->dlv; v27->uReputation += val; if ( v27->uReputation > 10000 ) v27->uReputation = 10000; } } // 506568: using guessed type int dword_506568; // 507948: using guessed type char bFlashHistoryBook; // 507949: using guessed type char bFlashAutonotesBook; // 50794A: using guessed type char bFlashQuestBook; // 72371C: using guessed type int dword_72371C[]; // 723E80: using guessed type int dword_723E80_award_related[]; //----- (0044B9C4) -------------------------------------------------------- void Player::SubtractVariable(enum VariableType var, void *a3) { unsigned int v3; // ebx@1 signed int v4; // esi@1 enum VariableType v5; // eax@8 int v6; // esi@11 int v7; // edi@14 signed int v8; // eax@17 char *v9; // eax@20 char v10; // sf@20 char *v11; // ecx@26 char *v12; // ecx@27 __int64 v13; // qax@27 unsigned __int8 v14; // cf@27 char *v15; // edx@29 char *v16; // eax@90 char *v17; // ecx@94 void *v18; // esi@97 signed int v19; // edx@97 char *v20; // ecx@98 int v21; // eax@100 __int16 v22; // dx@112 int v23; // [sp-8h] [bp-14h]@45 signed int v24; // [sp-4h] [bp-10h]@4 int v25; // [sp-4h] [bp-10h]@45 v3 = 0; v4 = 0; if ( this == pPlayers[2] ) { v4 = 1; goto LABEL_8; } if ( this == pPlayers[3] ) { v24 = 2; } else { if ( this != pPlayers[4] ) goto LABEL_8; v24 = 3; } v4 = v24; LABEL_8: v5 = var; if ( (signed int)var > 222 ) { if ( (signed int)var <= 307 ) { if ( var == 307 ) { pParty->uNumDeaths -= (unsigned int)a3; return; } if ( var == 223 ) { v11 = (char *)pParty->_autonote_bits; v22 = (short)a3 - 1; } else { if ( var != 231 ) { switch ( var ) { case 232: var = (VariableType)0; GetNewNPCData(uDialogue_SpeakingActorNPC_ID, (int)&var); dword_5B65CC = 0; if ( (void *)var == a3 ) { dword_5B65CC = (int)a3; } else { pParty->field_709 = 0; LOBYTE(pNPCStats->pNewNPCData[(int)a3].uFlags) &= 0x7Fu; sub_44A56A(); viewparams->bRedrawGameUI = 1; } break; case 241: v18 = a3; v19 = 0; if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) { v20 = (char *)&pNPCStats->pNewNPCData[0].uFlags; do { if ( *((void **)v20 + 4) == v18 ) { v21 = *(int *)v20; if ( (char)*(int *)v20 < 0 ) { LOBYTE(v21) = v21 & 0x7F; *(int *)v20 = v21; } } ++v19; v20 += 76; } while ( v19 < (signed int)pNPCStats->uNumNewNPCs ); } if ( (void *)pParty->pHirelings[0].uProfession == v18 ) memset(pParty->pHirelings, 0, 0x4Cu); if ( (void *)pParty->pHirelings[1].uProfession == v18 ) memset(&pParty->pHirelings[1], 0, 0x4Cu); pParty->field_709 = 0; sub_44A56A(); break; case 243: v17 = (char *)&this->uSkillPoints; if ( (unsigned int)a3 <= *(int *)v17 ) *(int *)v17 -= (int)a3; else *(int *)v17 = 0; break; case 275: v16 = (char *)&pOutdoor->ddm; if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) v16 = (char *)&pIndoor->dlv; *((int *)v16 + 2) -= (int)a3; if ( *((int *)v16 + 2) < -10000 ) *((int *)v16 + 2) = -10000; break; case 306: if ( (unsigned int)a3 <= pParty->uNumGoldInBank ) pParty->uNumGoldInBank -= (unsigned int)a3; else LABEL_88: dword_5B65C4 = 1; break; } return; } v11 = this->field_1A50; LABEL_112: v22 = (signed __int16)a3; } _449B7E_toggle_bit((unsigned char *)v11, v22, 0); return; } switch ( var ) { case 308: pParty->uNumBountiesCollected -= (unsigned int)a3; break; case 309: pParty->uNumPrisonTerms -= (int)a3; break; case 310: pParty->uNumArenaPageWins -= (char)a3; break; case 311: pParty->uNumArenaSquireWins -= (char)a3; break; case 312: pParty->uNumArenaKnightWins -= (char)a3; break; case 313: pParty->uNumArenaLordWins -= (char)a3; break; } } else { if ( (signed int)var >= 123 ) { byte_5E4C15[var] -= (char)a3; } else { switch ( var ) { case VAR_RandomGold: v6 = rand() % (signed int)a3 + 1; if ( v6 > pParty->uNumGold ) v6 = pParty->uNumGold; Party::TakeGold(v6); sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[503], v6); ShowStatusBarString(pTmpBuf, 2u); GameUI_DrawFoodAndGold(); return; case VAR_RandomFood: v7 = rand() % (signed int)a3 + 1; if ( v7 > pParty->uNumFoodRations ) v7 = pParty->uNumFoodRations; Party::TakeFood(v7); sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[504], v7); ShowStatusBarString(pTmpBuf, 2u); GameUI_DrawFoodAndGold(); goto LABEL_17; default: return; case VAR_CurrentHP: ReceiveDamage((signed int)a3, 4); goto LABEL_17; case VAR_CurrentSP: v9 = (char *)&this->sMana; v10 = this->sMana - (signed int)a3 < 0; *(int *)v9 -= (int)a3; if ( v10 ) *(int *)v9 = 0; goto LABEL_17; case VAR_ACModifier: this->sACModifier -= (unsigned __int8)a3; goto LABEL_17; case VAR_BaseLevel: this->uLevel -= (unsigned __int8)a3; goto LABEL_17; case VAR_LevelModifier: this->sLevelModifier -= (unsigned __int8)a3; goto LABEL_17; case VAR_Age: this->sAgeModifier -= (signed __int16)a3; return; case VAR_Award: v11 = this->field_152; goto LABEL_112; case VAR_Experience: v12 = (char *)&this->uExperience; v13 = (signed int)a3; v14 = *(int *)v12 < (unsigned int)a3; *(int *)v12 -= (int)a3; *((int *)v12 + 1) -= v14 + HIDWORD(v13); goto LABEL_17; case VAR_QBits_QuestsDone: _449B7E_toggle_bit(pParty->_award_bits, (__int16)a3, 0); pPlayers[v4 + 1]->PlaySound(SPEECH_96, 0); return; case VAR_PlayerItemInHands: v15 = (char *)this->pInventoryIndices; break; case VAR_FixedGold: if ( (unsigned int)a3 > pParty->uNumGold ) goto LABEL_88; Party::TakeGold((unsigned int)a3); return; case VAR_MightBonus: case VAR_ActualMight: this->uMightBonus -= (unsigned __int16)a3; goto LABEL_72; case VAR_IntellectBonus: case VAR_ActualIntellect: this->uIntelligenceBonus -= (unsigned __int16)a3; goto LABEL_72; case VAR_PersonalityBonus: case VAR_ActualPersonality: this->uWillpowerBonus -= (unsigned __int16)a3; goto LABEL_72; case VAR_EnduranceBonus: case VAR_ActualEndurance: this->uEnduranceBonus -= (unsigned __int16)a3; goto LABEL_72; case VAR_SpeedBonus: case VAR_ActualSpeed: this->uSpeedBonus -= (unsigned __int16)a3; goto LABEL_72; case VAR_AccuracyBonus: case VAR_ActualAccuracy: this->uAccuracyBonus -= (unsigned __int16)a3; goto LABEL_72; case VAR_LuckBonus: case VAR_ActualLuck: this->uLuckBonus -= (unsigned __int16)a3; goto LABEL_72; case VAR_BaseMight: this->uMight -= (unsigned __int16)a3; goto LABEL_45; case VAR_BaseIntellect: this->uIntelligence -= (unsigned __int16)a3; goto LABEL_45; case VAR_BasePersonality: this->uWillpower -= (unsigned __int16)a3; goto LABEL_45; case VAR_BaseEndurance: this->uEndurance -= (unsigned __int16)a3; goto LABEL_45; case VAR_BaseSpeed: this->uSpeed -= (unsigned __int16)a3; goto LABEL_45; case VAR_BaseAccuracy: this->uAccuracy -= (unsigned __int16)a3; goto LABEL_45; case VAR_BaseLuck: this->uLuck -= (unsigned __int16)a3; goto LABEL_45; case VAR_FireResistance: this->sResFireBase -= (signed __int16)a3; goto LABEL_45; case VAR_AirResistance: this->sResAirBase -= (signed __int16)a3; goto LABEL_45; case VAR_WaterResistance: this->sResWaterBase -= (signed __int16)a3; goto LABEL_45; case VAR_EarthResistance: this->sResEarthBase -= (signed __int16)a3; goto LABEL_45; case VAR_SpiritResistance: this->sResSpiritBase -= (signed __int16)a3; goto LABEL_45; case VAR_MindResistance: this->sResMindBase -= (signed __int16)a3; goto LABEL_45; case VAR_BodyResistance: this->sResBodyBase -= (signed __int16)a3; goto LABEL_45; case VAR_LightResistance: this->sResLightBase -= (signed __int16)a3; goto LABEL_45; case VAR_DarkResistance: this->sResDarkBase -= (signed __int16)a3; goto LABEL_45; case VAR_MagicResistance: this->sResMagicBase -= (signed __int16)a3; goto LABEL_45; case VAR_FireResistanceBonus: this->sResFireBonus -= (signed __int16)a3; goto LABEL_45; case VAR_AirResistanceBonus: this->sResAirBonus -= (signed __int16)a3; LABEL_45: v25 = 0; v23 = 92; goto LABEL_73; case VAR_WaterResistanceBonus: this->sResWaterBonus -= (signed __int16)a3; goto LABEL_72; case VAR_EarthResistanceBonus: this->sResEarthBonus -= (signed __int16)a3; goto LABEL_72; case VAR_SpiritResistanceBonus: this->sResSpiritBonus -= (signed __int16)a3; goto LABEL_72; case VAR_MindResistanceBonus: this->sResMindBonus -= (signed __int16)a3; goto LABEL_72; case VAR_BodyResistanceBonus: this->sResBodyBonus -= (signed __int16)a3; goto LABEL_72; case VAR_LightResistanceBonus: this->sResLightBonus -= (signed __int16)a3; goto LABEL_72; case VAR_DarkResistanceBonus: this->sResDarkBonus -= (signed __int16)a3; goto LABEL_72; case VAR_MagicResistanceBonus: this->sResMagicBonus -= (signed __int16)a3; LABEL_72: v25 = 0; v23 = SPEECH_91; LABEL_73: pPlayers[v4 + 1]->PlaySound((PlayerSpeech)v23, v25); goto LABEL_17; case VAR_FixedFood: Party::TakeFood((unsigned int)a3); goto LABEL_17; case VAR_StaffSkill: case VAR_SwordSkill: case VAR_DaggerSkill: case VAR_AxeSkill: case VAR_SpearSkill: case VAR_BowSkill: case VAR_MaceSkill: case VAR_BlasterSkill: case VAR_ShieldSkill: case VAR_LeatherSkill: case VAR_SkillChain: case VAR_PlateSkill: case VAR_FireSkill: case VAR_AirSkill: case VAR_WaterSkill: case VAR_EarthSkill: case VAR_SpiritSkill: case VAR_MindSkill: case VAR_BodySkill: case VAR_LightSkill: case VAR_DarkSkill: case VAR_IdentifyItemSkill: case VAR_MerchantSkill: case VAR_RepairSkill: case VAR_BodybuildingSkill: case VAR_MeditationSkill: case VAR_PerceptionSkill: case VAR_DiplomacySkill: case VAR_DisarmTrapSkill: case VAR_LearningSkill: *((short *)&this->pConditions[16] + var) -= (unsigned __int8)a3; goto LABEL_17; case VAR_Cursed: case VAR_Weak: case VAR_Asleep: case VAR_Afraid: case VAR_Drunk: case VAR_Insane: case VAR_PoisonedGreen: case VAR_DiseasedGreen: case VAR_PoisonedYellow: case VAR_DiseasedYellow: case VAR_PoisonedRed: case VAR_DiseasedRed: case VAR_Paralyzed: case VAR_Unconsious: case VAR_Dead: case VAR_Stoned: case VAR_Eradicated: *((int *)this + 2 * var - 210) = 0; *((int *)this + 2 * v5 - 209) = 0; LABEL_17: pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); v8 = 8 * v4 + 400; LOBYTE(v8) = (8 * v4 - 112) | 4; pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); return; } do { if ( *(void **)&this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *(int *)v15 + 5] == a3 ) { RemoveItemAtInventoryIndex(v3); return; } ++v3; v15 += 4; } while ( (signed int)v3 < 126 ); if ( (void *)pParty->pPickedItem.uItemID == a3 ) pMouse->RemoveHoldingItem(); } } } // 5B65C4: using guessed type int dword_5B65C4; // 5B65CC: using guessed type int dword_5B65CC;