Mercurial > mm7
diff Actor.cpp @ 1966:7840fe323f67
stru319::LootActor(struct Actor *pActor) to Actor::LootActor
author | Grumpy7 |
---|---|
date | Fri, 25 Oct 2013 13:03:08 -0700 |
parents | 182d49f28170 |
children | 05787232b571 |
line wrap: on
line diff
--- a/Actor.cpp Fri Oct 25 11:23:34 2013 -0700 +++ b/Actor.cpp Fri Oct 25 13:03:08 2013 -0700 @@ -33,6 +33,7 @@ #include "Log.h" #include "Texts.h" #include "Level/Decoration.h" +#include "Viewport.h" @@ -2956,7 +2957,7 @@ { pPlayer = pPlayers[i]; if ( !pPlayer->pConditions[Condition_Dead] && !pPlayer->pConditions[Condition_Pertified] && !pPlayer->pConditions[Condition_Eradicated] ) - pPlayer->ReceiveDamage(v4, DMGT_5); + pPlayer->ReceiveDamage(v4, DMGT_MAGICAL); } } if (pTurnEngine->pending_actions) @@ -4116,3 +4117,166 @@ } return false; } + + +//----- (00426A5A) -------------------------------------------------------- +void Actor::LootActor() +{ + signed int v2; // edi@1 + char v3; // zf@1 + unsigned int v4; // eax@13 + unsigned int v5; // esi@13 + int v6; // eax@14 + unsigned __int8 v7; // al@30 + Party *v8; // esi@34 + char *v9; // [sp-4h] [bp-3Ch]@10 + char *v10; // [sp-4h] [bp-3Ch]@31 + char *v11; // [sp-4h] [bp-3Ch]@38 + ItemGen Dst; // [sp+Ch] [bp-2Ch]@1 + int v13; // [sp+30h] [bp-8h]@1 + int v14; // [sp+34h] [bp-4h]@1 + + pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem(); + Dst.Reset(); + v2 = 0; + v3 = ((unsigned int)&array_77EC08[1975].pEdgeList1[1] & this->uAttributes) == 0; + v13 = 0; + v14 = 0; + if ( v3 ) + { + if ( this->pMonsterInfo.uTreasureDiceRolls ) + { + do + { + ++v2; + v14 += rand() % this->pMonsterInfo.uTreasureDiceSides + 1; + } + while ( v2 < this->pMonsterInfo.uTreasureDiceRolls ); + if ( v14 ) + { + pParty->PartyFindsGold(v14, 0); + viewparams->bRedrawGameUI = 1; + } + } + } + else + { + if ( this->array_000234[3].uItemID != 0 && this->array_000234[3].GetItemEquipType() == 18 ) + { + v14 = this->array_000234[3].uSpecEnchantmentType; + this->array_000234[3].Reset(); + if ( v14 ) + { + pParty->PartyFindsGold(v14, 0); + viewparams->bRedrawGameUI = 1; + } + } + } + if ( this->uCarriedItemID ) + { + Dst.Reset(); + Dst.uItemID = this->uCarriedItemID; + v9 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName; + if ( v14 ) + sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[490], v14, v9); + else + sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], v9); + ShowStatusBarString(pTmpBuf2.data(), 2u); + v4 = Dst.uItemID; + v5 = Dst.uItemID; + if ( Dst.GetItemEquipType() == 12 ) + { + v5 = Dst.uItemID; + v6 = rand() % 6 + Dst.GetDamageMod() + 1; + Dst.uNumCharges = v6; + Dst.uMaxCharges = v6; + v4 = Dst.uItemID; + } + if ( pItemsTable->pItems[v5].uEquipType == 14 && v4 != 220 ) + Dst.uEnchantmentType = 2 * rand() % 4 + 2; + pItemsTable->SetSpecialBonus(&Dst); + if ( !pParty->AddItemToParty(&Dst) ) + pParty->SetHoldingItem(&Dst); + this->uCarriedItemID = 0; + if ( this->array_000234[0].uItemID ) + { + if ( !pParty->AddItemToParty(this->array_000234) ) + { + pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem(); + pParty->SetHoldingItem(this->array_000234); + } + this->array_000234[0].Reset(); + } + if ( this->array_000234[1].uItemID ) + { + if ( !pParty->AddItemToParty(&this->array_000234[1]) ) + { + pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem(); + pParty->SetHoldingItem(&this->array_000234[1]); + } + this->array_000234[1].Reset(); + } + this->Remove(); + return; + } + if ( (unsigned int)&array_77EC08[1975].pEdgeList1[1] & this->uAttributes ) + { + if ( this->array_000234[3].uItemID ) + { + memcpy(&Dst, &this->array_000234[3], sizeof(Dst)); + this->array_000234[3].Reset(); + v11 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName; + if ( v14 ) + sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[490], v14, v11); + else + sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], v11); + ShowStatusBarString(pTmpBuf2.data(), 2u); + if ( !pParty->AddItemToParty(&Dst) ) + pParty->SetHoldingItem(&Dst); + v13 = 1; + } + v8 = pParty; + goto LABEL_45; + } + if ( rand() % 100 >= this->pMonsterInfo.uTreasureDropChance || (v7 = this->pMonsterInfo.uTreasureLevel) == 0 ) + { + v8 = pParty; + goto LABEL_45; + } + pItemsTable->GenerateItem(v7, this->pMonsterInfo.uTreasureType, &Dst); + v10 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName; + if ( v14 ) + sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[490], v14, v10);//Вы нашли ^I[%d] золот^L[ой;ых;ых] и предмет (%s)! + else + sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], v10);//Вы нашли ^Pv[%s]! + ShowStatusBarString(pTmpBuf2.data(), 2); + v8 = pParty; + if ( !pParty->AddItemToParty(&Dst) ) + pParty->SetHoldingItem(&Dst); + v13 = 1; +LABEL_45: + if ( this->array_000234[0].uItemID ) + { + if ( !v8->AddItemToParty(this->array_000234) ) + { + pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem(); + v8->SetHoldingItem(this->array_000234); + v13 = 1; + } + this->array_000234[0].Reset(); + } + if ( this->array_000234[1].uItemID ) + { + if ( !v8->AddItemToParty(&this->array_000234[1]) ) + { + pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem(); + v8->SetHoldingItem(&this->array_000234[1]); + v13 = 1; + } + this->array_000234[1].Reset(); + } + if ( !v13 || rand() % 100 < 90 ) + { + this->Remove(); + } +} \ No newline at end of file