comparison Player.cpp @ 2276:e2433db49428

ActorHasItems
author Ritor1
date Fri, 14 Mar 2014 10:47:22 +0600
parents aff7a7b072b7
children 69661f22ff03
comparison
equal deleted inserted replaced
2275:8193a64c7461 2276:e2433db49428
2019 if ( v11 % 100 >= 70 ) //stealing gold 2019 if ( v11 % 100 >= 70 ) //stealing gold
2020 { 2020 {
2021 enchBonusSum = 0; 2021 enchBonusSum = 0;
2022 for (int i = 0; i < v7; i++) 2022 for (int i = 0; i < v7; i++)
2023 enchBonusSum += rand() % StealingEnchantmentBonusForSkill[stealingMastery] + 1; 2023 enchBonusSum += rand() % StealingEnchantmentBonusForSkill[stealingMastery] + 1;
2024 if ( actroPtr->array_000234[3].GetItemEquipType() != EQUIP_GOLD ) 2024 if ( actroPtr->ActorHasItems[3].GetItemEquipType() != EQUIP_GOLD )
2025 return 2; 2025 return 2;
2026 enchTypePtr = &actroPtr->array_000234[3].uSpecEnchantmentType; 2026 enchTypePtr = &actroPtr->ActorHasItems[3].uSpecEnchantmentType;
2027 if ( (int)enchBonusSum >= *enchTypePtr ) 2027 if ( (int)enchBonusSum >= *enchTypePtr )
2028 { 2028 {
2029 actroPtr->array_000234[3].uItemID = 0; 2029 actroPtr->ActorHasItems[3].uItemID = 0;
2030 *enchTypePtr = 0; 2030 *enchTypePtr = 0;
2031 } 2031 }
2032 else 2032 else
2033 *enchTypePtr -= enchBonusSum; 2033 *enchTypePtr -= enchBonusSum;
2034 if ( enchBonusSum ) 2034 if ( enchBonusSum )
2046 tempItem.Reset(); 2046 tempItem.Reset();
2047 HasFullItemSlots = false; 2047 HasFullItemSlots = false;
2048 int i; 2048 int i;
2049 for (i = 0; i < 4; i++) 2049 for (i = 0; i < 4; i++)
2050 { 2050 {
2051 if ( actroPtr->array_000234[i].uItemID != 0 && actroPtr->array_000234[i].GetItemEquipType() != EQUIP_GOLD ) 2051 if ( actroPtr->ActorHasItems[i].uItemID != 0 && actroPtr->ActorHasItems[i].GetItemEquipType() != EQUIP_GOLD )
2052 break; 2052 break;
2053 } 2053 }
2054 if (i == 4) 2054 if (i == 4)
2055 HasFullItemSlots = true; 2055 HasFullItemSlots = true;
2056 carriedItemId = actroPtr->uCarriedItemID; 2056 carriedItemId = actroPtr->uCarriedItemID;
2066 else if ( pItemsTable->pItems[carriedItemId].uEquipType == EQUIP_POTION && carriedItemId != ITEM_POTION_BOTTLE) 2066 else if ( pItemsTable->pItems[carriedItemId].uEquipType == EQUIP_POTION && carriedItemId != ITEM_POTION_BOTTLE)
2067 tempItem.uEnchantmentType = 2 * rand() % 4 + 2; 2067 tempItem.uEnchantmentType = 2 * rand() % 4 + 2;
2068 } 2068 }
2069 else 2069 else
2070 { 2070 {
2071 ItemGen* itemToSteal = &actroPtr->array_000234[rand() % 4]; 2071 ItemGen* itemToSteal = &actroPtr->ActorHasItems[rand() % 4];
2072 memcpy(&tempItem, itemToSteal, sizeof(tempItem)); 2072 memcpy(&tempItem, itemToSteal, sizeof(tempItem));
2073 itemToSteal->Reset(); 2073 itemToSteal->Reset();
2074 carriedItemId = tempItem.uItemID; 2074 carriedItemId = tempItem.uItemID;
2075 } 2075 }
2076 if (carriedItemId != 0) // looks odd in current context, but avoids accessing zeroth element of pItemsTable->pItems 2076 if (carriedItemId != 0) // looks odd in current context, but avoids accessing zeroth element of pItemsTable->pItems
2411 pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); 2411 pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
2412 return 1; 2412 return 1;
2413 break; 2413 break;
2414 case SPECIAL_ATTACK_STEAL: 2414 case SPECIAL_ATTACK_STEAL:
2415 PlaySound(SPEECH_40, 0); 2415 PlaySound(SPEECH_40, 0);
2416 v27 = pActor->array_000234; 2416 v27 = pActor->ActorHasItems;
2417 if ( pActor->array_000234[0].uItemID ) 2417 if ( pActor->ActorHasItems[0].uItemID )
2418 { 2418 {
2419 v27 = &pActor->array_000234[1]; 2419 v27 = &pActor->ActorHasItems[1];
2420 if ( pActor->array_000234[1].uItemID ) 2420 if ( pActor->ActorHasItems[1].uItemID )
2421 { 2421 {
2422 pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); 2422 pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
2423 return 1; 2423 return 1;
2424 } 2424 }
2425 } 2425 }