comparison Player.cpp @ 1618:f5b13e6be493

Player::UseItem_DrinkPotion_etc some minor edits(brace indentation, a few warnings), commented out 2 sections which never get used
author Grumpy7
date Sat, 14 Sep 2013 07:21:56 +0200
parents 8e3c6d7631f1
children eceabd56f399
comparison
equal deleted inserted replaced
1617:8e3c6d7631f1 1618:f5b13e6be493
4428 return false; 4428 return false;
4429 } 4429 }
4430 4430
4431 //----- (004680ED) -------------------------------------------------------- 4431 //----- (004680ED) --------------------------------------------------------
4432 void Player::UseItem_DrinkPotion_etc(signed int player_num, int a3) 4432 void Player::UseItem_DrinkPotion_etc(signed int player_num, int a3)
4433 { 4433 {
4434 Player *v3; // esi@1 4434 Player *playerAffected; // esi@1
4435 signed int v5; // eax@17 4435 signed int v5; // eax@17
4436 int v8; // edx@39 4436 int v8; // edx@39
4437 char *v13; // eax@45 4437 char *v13; // eax@45
4438 signed int v15; // edi@68 4438 signed int v15; // edi@68
4439 int v16; // edx@73 4439 int v16; // edx@73
4440 unsigned __int16 v17; // edi@73 4440 unsigned __int16 v17; // edi@73
4441 unsigned int v18; // eax@73 4441 unsigned int v18; // eax@73
4442 const char *v22; // eax@84 4442 const char *v22; // eax@84
4443 int scroll_id; // esi@96 4443 int scroll_id; // esi@96
4444 int v25; // eax@109 4444 int v25; // eax@109
4445 int v26; // eax@113 4445 int v26; // eax@113
4446 int new_mana_val; // edi@114 4446 int new_mana_val; // edi@114
4447 signed __int64 v28; // qax@120 4447 signed __int64 v28; // qax@120
4448 __int64 v30; // edi@137 4448 __int64 v30; // edi@137
4449 __int64 v32; // ST3C_4@137 4449 __int64 v32; // ST3C_4@137
4450 __int64 v34; // ST34_4@137 4450 __int64 v34; // ST34_4@137
4451 unsigned __int16 v50; // [sp-Ch] [bp-38h]@120 4451 unsigned __int16 v50; // [sp-Ch] [bp-38h]@120
4452 const char *v66; // [sp-4h] [bp-30h]@69 4452 const char *v66; // [sp-4h] [bp-30h]@69
4453 signed int v67; // [sp-4h] [bp-30h]@77 4453 signed int v67; // [sp-4h] [bp-30h]@77
4454 const char *v68; // [sp-4h] [bp-30h]@89 4454 const char *v68; // [sp-4h] [bp-30h]@89
4455 char v72; // [sp+20h] [bp-Ch]@68 4455 char v72; // [sp+20h] [bp-Ch]@68
4456 signed int v73; // [sp+24h] [bp-8h]@1 4456 signed int v73; // [sp+24h] [bp-8h]@1
4457 char* v74; // [sp+24h] [bp-8h]@23 4457 char* v74; // [sp+24h] [bp-8h]@23
4458 Player *thisb; // [sp+28h] [bp-4h]@1 4458 Player *thisb; // [sp+28h] [bp-4h]@1
4459 unsigned int thisa; // [sp+28h] [bp-4h]@22 4459 unsigned int thisa; // [sp+28h] [bp-4h]@22
4460 4460
4461 thisb = this; 4461 thisb = this;
4462 v3 = &pParty->pPlayers[player_num-1]; 4462 playerAffected = &pParty->pPlayers[player_num-1];
4463 v73 = 1; 4463 v73 = 1;
4464 if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 3) ) 4464 if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 3) )
4465 return;
4466 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_REAGENT )
4467 {
4468 if ( pParty->pPickedItem.uItemID == 160 )
4469 {
4470 playerAffected->SetCondition(Condition_Poison1, 1);
4471 }
4472 else if ( pParty->pPickedItem.uItemID == 161 )
4473 {
4474 new_mana_val = playerAffected->sMana;
4475 new_mana_val += 2;
4476 if ( new_mana_val > playerAffected->GetMaxMana() )
4477 new_mana_val = playerAffected->GetMaxMana();
4478 playerAffected->PlaySound(SPEECH_36, 0);
4479 }
4480 else if ( pParty->pPickedItem.uItemID == 162 )
4481 {
4482 playerAffected->Heal(2);
4483 playerAffected->PlaySound(SPEECH_36, 0);
4484 }
4485 else
4486 {
4487 v68 = pParty->pPickedItem.GetDisplayName();
4488 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[36], v68);//"%s can not be used that way"
4489 ShowStatusBarString(pTmpBuf.data(), 2);
4490 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
4491 return;
4492 }
4493 pAudioPlayer->PlaySound((SoundID)211, 0, 0, -1, 0, 0, 0, 0);
4494
4495 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null)
4496 {
4497 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
4498 }
4499 if ( v73 )
4500 {
4501 if ( pParty->bTurnBasedModeOn )
4502 {
4503 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100;
4504 thisb->SetRecoveryTime(100);
4505 pTurnEngine->ApplyPlayerAction();
4506 }
4507 else
4508 {
4509 thisb->SetRecoveryTime(flt_6BE3A4_debug_recmod1 * 213.3333333333333);
4510 }
4511 }
4512 pMouse->RemoveHoldingItem();
4513 return;
4514 }
4515
4516 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_POTION )
4517 {
4518 switch ( pParty->pPickedItem.uItemID )
4519 {
4520 case 221: //Catalyst
4521 playerAffected->SetCondition(Condition_Poison1, 1);
4522 break;
4523 case 222: //Cure Wounds
4524 v25 = pParty->pPickedItem.uEnchantmentType + 10;
4525 playerAffected->Heal(v25);
4526 playerAffected->PlaySound(SPEECH_36, 0);
4527 break;
4528 case 223: //Magic Potion
4529 v26 = pParty->pPickedItem.uEnchantmentType + 10;
4530 new_mana_val = playerAffected->sMana;
4531 new_mana_val += v26;
4532 if ( new_mana_val > playerAffected->GetMaxMana() )
4533 new_mana_val = playerAffected->GetMaxMana();
4534 playerAffected->PlaySound(SPEECH_36, 0);
4535 break;
4536 case 224: //Cure Weakness
4537 playerAffected->pConditions[Condition_Weak] = 0i64;
4538 playerAffected->PlaySound(SPEECH_36, 0);
4539 break;
4540 case 225: //Cure Disease
4541 playerAffected->pConditions[Condition_Disease3] = 0i64;
4542 playerAffected->pConditions[Condition_Disease2] = 0i64;
4543 playerAffected->pConditions[Condition_Disease1] = 0i64;
4544 playerAffected->PlaySound(SPEECH_36, 0);
4545 break;
4546 case 226: //Cure Poison
4547 playerAffected->pConditions[Condition_Poison3] = 0i64;
4548 playerAffected->pConditions[Condition_Poison2] = 0i64;
4549 playerAffected->pConditions[Condition_Poison1] = 0i64;
4550 playerAffected->PlaySound(SPEECH_36, 0);
4551 break;
4552 case 227: //Awaken
4553 playerAffected->pConditions[Condition_Sleep] = 0i64;
4554 playerAffected->PlaySound(SPEECH_36, 0);
4555 break;
4556 case 228: //Haste
4557 if ( !playerAffected->pConditions[Condition_Weak] )
4558 {
4559 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
4560 playerAffected->pPlayerBuffs[7].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0);
4561 playerAffected->PlaySound(SPEECH_36, 0);
4562 }
4563 break;
4564 case 229: //Heroism
4565 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
4566 playerAffected->pPlayerBuffs[8].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0);
4567 playerAffected->PlaySound(SPEECH_36, 0);
4568 break;
4569 case 230: //Bless
4570 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
4571 playerAffected->pPlayerBuffs[1].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0);
4572 playerAffected->PlaySound(SPEECH_36, 0);
4573 break;
4574 case 231: //Preservation
4575 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
4576 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
4577 playerAffected->pPlayerBuffs[11].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
4578 playerAffected->PlaySound(SPEECH_36, 0);
4579 break;
4580 case 232: //Shield
4581 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
4582 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
4583 playerAffected->pPlayerBuffs[13].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
4584 playerAffected->PlaySound(SPEECH_36, 0);
4585 break;
4586 case 234: //Stoneskin
4587 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
4588 playerAffected->pPlayerBuffs[14].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0);
4589 playerAffected->PlaySound(SPEECH_36, 0);
4590 break;
4591 case 235: //Water Breathing
4592 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335),
4593 playerAffected->pPlayerBuffs[23].Apply(pParty->uTimePlayed +v28, 3, 5, 0, 0);
4594 break;
4595 case 237: //Remove Fear
4596 playerAffected->pConditions[Condition_Fear] = 0i64;
4597 playerAffected->PlaySound(SPEECH_36, 0);
4598 break;
4599 case 238: //Remove Curse
4600 playerAffected->pConditions[Condition_Cursed] = 0i64;
4601 playerAffected->PlaySound(SPEECH_36, 0);
4602 break;
4603 case 239: //Cure Insanity
4604 playerAffected->pConditions[Condition_Insane] = 0i64;
4605 playerAffected->PlaySound(SPEECH_36, 0);
4606 break;
4607 case 240: //Might Boost
4608 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
4609 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
4610 playerAffected->pPlayerBuffs[19].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
4611 playerAffected->PlaySound(SPEECH_36, 0);
4612 break;
4613 case 241: //Intellect Boost
4614 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
4615 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
4616 playerAffected->pPlayerBuffs[17].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
4617 playerAffected->PlaySound(SPEECH_36, 0);
4618 break;
4619 case 242: //Personality Boost
4620 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
4621 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
4622 playerAffected->pPlayerBuffs[20].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
4623 playerAffected->PlaySound(SPEECH_36, 0);
4624 break;
4625 case 243://Endurance Boost
4626 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
4627 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
4628 playerAffected->pPlayerBuffs[16].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
4629 playerAffected->PlaySound(SPEECH_36, 0);
4630 break;
4631 case 244: //Speed Boost
4632 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
4633 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
4634 playerAffected->pPlayerBuffs[21].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
4635 playerAffected->PlaySound(SPEECH_36, 0);
4636 break;
4637 case 245: //Accuracy Boost
4638 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
4639 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
4640 playerAffected->pPlayerBuffs[15].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
4641 playerAffected->PlaySound(SPEECH_36, 0);
4642 break;
4643 case 251: //Cure Paralysis
4644 playerAffected->pConditions[Condition_Paralyzed] = 0i64;
4645 playerAffected->PlaySound(SPEECH_36, 0);
4646 break;
4647 case 252://Divine Restoration
4648 v30 = playerAffected->pConditions[Condition_Dead];
4649 v32 = playerAffected->pConditions[Condition_Pertified];
4650 v34 = playerAffected->pConditions[Condition_Eradicated];
4651 memset(&playerAffected->pConditions,0,sizeof(pConditions));
4652 playerAffected->pConditions[Condition_Dead] = v30;
4653 playerAffected->pConditions[Condition_Pertified] = v32;
4654 playerAffected->pConditions[Condition_Eradicated] = v34;
4655 playerAffected->PlaySound(SPEECH_36, 0);
4656 break;
4657 case 253: //Divine Cure
4658 v25 = 5 * pParty->pPickedItem.uEnchantmentType;
4659 playerAffected->Heal(v25);
4660 playerAffected->PlaySound(SPEECH_36, 0);
4661 break;
4662 case 254: //Divine Power
4663 v26 = 5 * pParty->pPickedItem.uEnchantmentType;
4664 new_mana_val = playerAffected->sMana;
4665 new_mana_val += v26;
4666 if ( new_mana_val > playerAffected->GetMaxMana() )
4667 new_mana_val = playerAffected->GetMaxMana();
4668 playerAffected->PlaySound(SPEECH_36, 0);
4669 break;
4670 case 255: //Luck Boost
4671 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
4672 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
4673 playerAffected->pPlayerBuffs[18].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
4674 playerAffected->PlaySound(SPEECH_36, 0);
4675 break;
4676 case 256: //Fire Resistance
4677 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
4678 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
4679 playerAffected->pPlayerBuffs[5].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
4680 playerAffected->PlaySound(SPEECH_36, 0);
4681 break;
4682 case 257: //Air Resistance
4683 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
4684 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
4685 playerAffected->pPlayerBuffs[0].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
4686 playerAffected->PlaySound(SPEECH_36, 0);
4687 break;
4688 case 258: //Water Resistance
4689 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
4690 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
4691 playerAffected->pPlayerBuffs[22].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
4692 playerAffected->PlaySound(SPEECH_36, 0);
4693 break;
4694 case 259: //Earth Resistance
4695 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
4696 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
4697 playerAffected->pPlayerBuffs[3].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
4698 playerAffected->PlaySound(SPEECH_36, 0);
4699 break;
4700 case 260: //Mind Resistance
4701 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
4702 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
4703 playerAffected->pPlayerBuffs[9].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
4704 playerAffected->PlaySound(SPEECH_36, 0);
4705 break;
4706 case 261: //Body Resistance
4707 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
4708 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
4709 playerAffected->pPlayerBuffs[2].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
4710 playerAffected->PlaySound(SPEECH_36, 0);
4711 break;
4712 case 262: //Stone to Flesh
4713 playerAffected->pConditions[Condition_Pertified] = 0i64;
4714 playerAffected->PlaySound(SPEECH_36, 0);
4715 break;
4716 case 264: //Pure Luck
4717 if ( !playerAffected->pure_luck_used )
4718 {
4719 playerAffected->uLuck += 50;
4720 playerAffected->pure_luck_used = 1;
4721 }
4722 playerAffected->PlaySound(SPEECH_36, 0);
4723 break;
4724 case 265: //Pure Speed
4725 if ( !playerAffected->pure_speed_used )
4726 {
4727 playerAffected->uSpeed += 50;
4728 playerAffected->pure_speed_used = 1;
4729 }
4730 playerAffected->PlaySound(SPEECH_36, 0);
4731 break;
4732 case 266: //Pure Intellect
4733 if ( !playerAffected->pure_intellect_used )
4734 {
4735 playerAffected->uIntelligence += 50;
4736 playerAffected->pure_intellect_used = 1;
4737 }
4738 playerAffected->PlaySound(SPEECH_36, 0);
4739 break;
4740 case 267: //Pure Endurance
4741 if ( !playerAffected->pure_endurance_used )
4742 {
4743 playerAffected->uEndurance += 50;
4744 playerAffected->pure_endurance_used = 1;
4745 }
4746 playerAffected->PlaySound(SPEECH_36, 0);
4747 break;
4748 case 268: //Pure Personality
4749 if ( !playerAffected->pure_willpower_used )
4750 {
4751 playerAffected->uWillpower += 50;
4752 playerAffected->pure_willpower_used = 1;
4753 }
4754 playerAffected->PlaySound(SPEECH_36, 0);
4755 break;
4756 case 269: //Pure Accuracy
4757 if ( !playerAffected->pure_accuracy_used )
4758 {
4759 playerAffected->uAccuracy += 50;
4760 playerAffected->pure_accuracy_used = 1;
4761 }
4762 playerAffected->PlaySound(SPEECH_36, 0);
4763 break;
4764 case 270: //Pure Might
4765 if ( !playerAffected->pure_might_used )
4766 {
4767 playerAffected->uMight += 50;
4768 playerAffected->pure_might_used = 1;
4769 }
4770 playerAffected->PlaySound(SPEECH_36, 0);
4771 break;
4772 case 271: //Rejuvenation
4773 playerAffected->sAgeModifier = 0;
4774 playerAffected->PlaySound(SPEECH_36, 0);
4775 break;
4776
4777 default:
4778 v68 = pParty->pPickedItem.GetDisplayName();
4779 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[36], v68);//"%s can not be used that way"
4780 ShowStatusBarString(pTmpBuf.data(), 2u);
4781 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
4782 return;
4783 }
4784 pAudioPlayer->PlaySound((SoundID)210, 0, 0, -1, 0, 0, 0, 0);
4785 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null)
4786 {
4787 // if ( !v73 ) v73 is always 1 at this point
4788 // {
4789 // pMouse->RemoveHoldingItem();
4790 // return;
4791 // }
4792 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
4793 }
4794 if ( v73 )
4795 {
4796 if ( pParty->bTurnBasedModeOn )
4797 {
4798 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100;
4799 thisb->SetRecoveryTime(100);
4800 pTurnEngine->ApplyPlayerAction();
4801 }
4802 else
4803 {
4804 thisb->SetRecoveryTime(flt_6BE3A4_debug_recmod1 * 213.3333333333333);
4805 }
4806 }
4807 pMouse->RemoveHoldingItem();
4808 return;
4809 }
4810
4811
4812 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_SPELL_SCROLL )
4813 {
4814 if ( pCurrentScreen == SCREEN_CASTING )
4465 return; 4815 return;
4466 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_REAGENT ) 4816 if ( !playerAffected->CanAct() )
4467 { 4817 {
4468 if ( pParty->pPickedItem.uItemID == 160 ) 4818
4469 { 4819 v68 = aCharacterConditionNames[playerAffected->GetMajorConditionIdx()];
4470 pParty->pPlayers[player_num-1].SetCondition(Condition_Poison1, 1); 4820 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v68);
4471 } 4821 ShowStatusBarString(pTmpBuf.data(), 2u);
4472 else if ( pParty->pPickedItem.uItemID == 161 ) 4822 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
4473 { 4823 return;
4474 new_mana_val = v3->sMana; 4824 }
4475 new_mana_val += 2; 4825 if ( bUnderwater == 1 )
4476 if ( new_mana_val > v3->GetMaxMana() ) 4826 {
4477 new_mana_val = v3->GetMaxMana(); 4827 ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2u);//"You can not do that while you are underwater!"
4478 v3->PlaySound(SPEECH_36, 0); 4828 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
4479 } 4829 return;
4480 else if ( pParty->pPickedItem.uItemID == 162 ) 4830 }
4481 { 4831 dword_50C9AC = 1;
4482 pParty->pPlayers[player_num-1].Heal(2); 4832 scroll_id = pParty->pPickedItem.uItemID - 299;
4483 v3->PlaySound(SPEECH_36, 0); 4833 if ( scroll_id == 30 || scroll_id == 4 || scroll_id == 91 || scroll_id == 28 ) //Enchant Item scroll, Vampiric Weapon scroll ,Recharge Item ,Fire Aura
4484 4834 {
4485 } 4835 pMouse->RemoveHoldingItem();
4486 else 4836 pGUIWindow_CurrentMenu->Release();
4487 { 4837 pIcons_LOD->RemoveTexturesPackFromTextureList();
4488 v68 = pParty->pPickedItem.GetDisplayName(); 4838 pCurrentScreen = SCREEN_GAME;
4489 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[36], v68);//"%s can not be used that way" 4839 viewparams->bRedrawGameUI = 1;
4490 ShowStatusBarString(pTmpBuf.data(), 2); 4840 _42777D_CastSpell_UseWand_ShootArrow(scroll_id, player_num - 1, 0x85u, 1, 0);
4491 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); 4841 }
4492 return; 4842 else
4493 } 4843 {
4494 pAudioPlayer->PlaySound((SoundID)211, 0, 0, -1, 0, 0, 0, 0); 4844 _720984_unused = pParty->pPickedItem.uItemID;
4495 4845 pMouse->RemoveHoldingItem();
4496 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) 4846 pMessageQueue_50C9E8->AddMessage(UIMSG_SpellScrollUse, scroll_id, player_num - 1);
4497 { 4847 if ( pCurrentScreen && pGUIWindow_CurrentMenu
4498 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); 4848 && (pGUIWindow_CurrentMenu->eWindowType != WINDOW_null))
4499 } 4849 {
4500 if ( v73 ) 4850 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
4501 { 4851 }
4502 if ( pParty->bTurnBasedModeOn ) 4852 }
4503 { 4853 return;
4504 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100; 4854 }
4505 thisb->SetRecoveryTime(100); 4855
4506 pTurnEngine->ApplyPlayerAction(); 4856 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_BOOK )
4507 } 4857 {
4508 else 4858 v15 = pParty->pPickedItem.uItemID - 400;
4509 { 4859 v72 = playerAffected->spellbook.bHaveSpell[pParty->pPickedItem.uItemID-400];//(char *)&v3->pConditions[0] + pParty->pPickedItem.uItemID + 2;
4510 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); 4860 if ( v72 )
4511 } 4861 {
4512 } 4862 v66 = pParty->pPickedItem.GetDisplayName();
4513 pMouse->RemoveHoldingItem(); 4863 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[380], v66);//"You already know the %s spell"
4514 return;
4515
4516
4517 }
4518 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_POTION )
4519 {
4520 switch ( pParty->pPickedItem.uItemID )
4521 {
4522 case 221: //Catalyst
4523 pParty->pPlayers[player_num-1].SetCondition(Condition_Poison1, 1);
4524 break;
4525 case 222: //Cure Wounds
4526 v25 = pParty->pPickedItem.uEnchantmentType + 10;
4527 pParty->pPlayers[player_num-1].Heal(v25);
4528 v3->PlaySound(SPEECH_36, 0);
4529 break;
4530 case 223: //Magic Potion
4531 v26 = pParty->pPickedItem.uEnchantmentType + 10;
4532 new_mana_val = v3->sMana;
4533 new_mana_val += v26;
4534 if ( new_mana_val > v3->GetMaxMana() )
4535 new_mana_val = v3->GetMaxMana();
4536 v3->PlaySound(SPEECH_36, 0);
4537 break;
4538 case 224: //Cure Weakness
4539 v3->pConditions[Condition_Weak] = 0i64;
4540 v3->PlaySound(SPEECH_36, 0);
4541 break;
4542 case 225: //Cure Disease
4543 v3->pConditions[Condition_Disease3] = 0i64;
4544 v3->pConditions[Condition_Disease2] = 0i64;
4545 v3->pConditions[Condition_Disease1] = 0i64;
4546 v3->PlaySound(SPEECH_36, 0);
4547 break;
4548 case 226: //Cure Poison
4549 v3->pConditions[Condition_Poison3] = 0i64;
4550 v3->pConditions[Condition_Poison2] = 0i64;
4551 v3->pConditions[Condition_Poison1] = 0i64;
4552 v3->PlaySound(SPEECH_36, 0);
4553 break;
4554 case 227: //Awaken
4555 v3->pConditions[Condition_Sleep] = 0i64;
4556 v3->PlaySound(SPEECH_36, 0);
4557 break;
4558 case 228: //Haste
4559 if ( !v3->pConditions[Condition_Weak] )
4560 {
4561 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
4562 v3->pPlayerBuffs[7].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0);
4563 v3->PlaySound(SPEECH_36, 0);
4564 }
4565 break;
4566 case 229: //Heroism
4567 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
4568 v3->pPlayerBuffs[8].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0);
4569 v3->PlaySound(SPEECH_36, 0);
4570 break;
4571 case 230: //Bless
4572 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
4573 v3->pPlayerBuffs[1].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0);
4574 v3->PlaySound(SPEECH_36, 0);
4575 break;
4576 case 231: //Preservation
4577 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
4578 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
4579 v3->pPlayerBuffs[11].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
4580 v3->PlaySound(SPEECH_36, 0);
4581 break;
4582 case 232: //Shield
4583 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
4584 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
4585 v3->pPlayerBuffs[13].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
4586 v3->PlaySound(SPEECH_36, 0);
4587 break;
4588 case 234: //Stoneskin
4589 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
4590 v3->pPlayerBuffs[14].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0);
4591 v3->PlaySound(SPEECH_36, 0);
4592 break;
4593 case 235: //Water Breathing
4594 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335),
4595 v3->pPlayerBuffs[23].Apply(pParty->uTimePlayed +v28, 3, 5, 0, 0);
4596 break;
4597 case 237: //Remove Fear
4598 v3->pConditions[Condition_Fear] = 0i64;
4599 v3->PlaySound(SPEECH_36, 0);
4600 break;
4601 case 238: //Remove Curse
4602 v3->pConditions[Condition_Cursed] = 0i64;
4603 v3->PlaySound(SPEECH_36, 0);
4604 break;
4605 case 239: //Cure Insanity
4606 v3->pConditions[Condition_Insane] = 0i64;
4607 v3->PlaySound(SPEECH_36, 0);
4608 break;
4609 case 240: //Might Boost
4610 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
4611 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
4612 v3->pPlayerBuffs[19].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
4613 v3->PlaySound(SPEECH_36, 0);
4614 break;
4615 case 241: //Intellect Boost
4616 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
4617 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
4618 v3->pPlayerBuffs[17].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
4619 v3->PlaySound(SPEECH_36, 0);
4620 break;
4621 case 242: //Personality Boost
4622 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
4623 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
4624 v3->pPlayerBuffs[20].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
4625 v3->PlaySound(SPEECH_36, 0);
4626 break;
4627 case 243://Endurance Boost
4628 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
4629 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
4630 v3->pPlayerBuffs[16].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
4631 v3->PlaySound(SPEECH_36, 0);
4632 break;
4633 case 244: //Speed Boost
4634 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
4635 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
4636 v3->pPlayerBuffs[21].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
4637 v3->PlaySound(SPEECH_36, 0);
4638 break;
4639 case 245: //Accuracy Boost
4640 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
4641 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
4642 v3->pPlayerBuffs[15].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
4643 v3->PlaySound(SPEECH_36, 0);
4644 break;
4645 case 251: //Cure Paralysis
4646 v3->pConditions[Condition_Paralyzed] = 0i64;
4647 v3->PlaySound(SPEECH_36, 0);
4648 break;
4649 case 252://Divine Restoration
4650 v30 = v3->pConditions[Condition_Dead];
4651 v32 = v3->pConditions[Condition_Pertified];
4652 v34 = v3->pConditions[Condition_Eradicated];
4653 memset(&pParty->pPlayers[player_num-1].pConditions,0,sizeof(pConditions));
4654 v3->pConditions[Condition_Dead] = v30;
4655 v3->pConditions[Condition_Pertified] = v32;
4656 v3->pConditions[Condition_Eradicated] = v34;
4657 v3->PlaySound(SPEECH_36, 0);
4658 break;
4659 case 253: //Divine Cure
4660 v25 = 5 * pParty->pPickedItem.uEnchantmentType;
4661 pParty->pPlayers[player_num-1].Heal(v25);
4662 v3->PlaySound(SPEECH_36, 0);
4663 break;
4664 case 254: //Divine Power
4665 v26 = 5 * pParty->pPickedItem.uEnchantmentType;
4666 new_mana_val = v3->sMana;
4667 new_mana_val += v26;
4668 if ( new_mana_val > v3->GetMaxMana() )
4669 new_mana_val = v3->GetMaxMana();
4670 v3->PlaySound(SPEECH_36, 0);
4671 break;
4672 case 255: //Luck Boost
4673 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
4674 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
4675 v3->pPlayerBuffs[18].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
4676 v3->PlaySound(SPEECH_36, 0);
4677 break;
4678 case 256: //Fire Resistance
4679 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
4680 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
4681 v3->pPlayerBuffs[5].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
4682 v3->PlaySound(SPEECH_36, 0);
4683 break;
4684 case 257: //Air Resistance
4685 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
4686 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
4687 v3->pPlayerBuffs[0].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
4688 v3->PlaySound(SPEECH_36, 0);
4689 break;
4690 case 258: //Water Resistance
4691 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
4692 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
4693 v3->pPlayerBuffs[22].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
4694 v3->PlaySound(SPEECH_36, 0);
4695 break;
4696 case 259: //Earth Resistance
4697 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
4698 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
4699 v3->pPlayerBuffs[3].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
4700 v3->PlaySound(SPEECH_36, 0);
4701 break;
4702 case 260: //Mind Resistance
4703 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
4704 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
4705 v3->pPlayerBuffs[9].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
4706 v3->PlaySound(SPEECH_36, 0);
4707 break;
4708 case 261: //Body Resistance
4709 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
4710 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
4711 v3->pPlayerBuffs[2].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
4712 v3->PlaySound(SPEECH_36, 0);
4713 break;
4714 case 262: //Stone to Flesh
4715 v3->pConditions[Condition_Pertified] = 0i64;
4716 v3->PlaySound(SPEECH_36, 0);
4717 break;
4718 case 264: //Pure Luck
4719 if ( !v3->pure_luck_used )
4720 {
4721 v3->uLuck += 50;
4722 v3->pure_luck_used = 1;
4723 }
4724 v3->PlaySound(SPEECH_36, 0);
4725 break;
4726 case 265: //Pure Speed
4727 if ( !v3->pure_speed_used )
4728 {
4729 v3->uSpeed += 50;
4730 v3->pure_speed_used = 1;
4731 }
4732 v3->PlaySound(SPEECH_36, 0);
4733 break;
4734 case 266: //Pure Intellect
4735 if ( !v3->pure_intellect_used )
4736 {
4737 v3->uIntelligence += 50;
4738 v3->pure_intellect_used = 1;
4739 }
4740 v3->PlaySound(SPEECH_36, 0);
4741 break;
4742 case 267: //Pure Endurance
4743 if ( !v3->pure_endurance_used )
4744 {
4745 v3->uEndurance += 50;
4746 v3->pure_endurance_used = 1;
4747 }
4748 v3->PlaySound(SPEECH_36, 0);
4749 break;
4750 case 268: //Pure Personality
4751 if ( !v3->pure_willpower_used )
4752 {
4753 v3->uWillpower += 50;
4754 v3->pure_willpower_used = 1;
4755 }
4756 v3->PlaySound(SPEECH_36, 0);
4757 break;
4758 case 269: //Pure Accuracy
4759 if ( !v3->pure_accuracy_used )
4760 {
4761 v3->uAccuracy += 50;
4762 v3->pure_accuracy_used = 1;
4763 }
4764 v3->PlaySound(SPEECH_36, 0);
4765 break;
4766 case 270: //Pure Might
4767 if ( !v3->pure_might_used )
4768 {
4769 v3->uMight += 50;
4770 v3->pure_might_used = 1;
4771 }
4772 v3->PlaySound(SPEECH_36, 0);
4773 break;
4774 case 271: //Rejuvenation
4775 v3->sAgeModifier = 0;
4776 v3->PlaySound(SPEECH_36, 0);
4777 break;
4778
4779 default:
4780 v68 = pParty->pPickedItem.GetDisplayName();
4781 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[36], v68);//"%s can not be used that way"
4782 ShowStatusBarString(pTmpBuf.data(), 2u);
4783 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
4784 return;
4785 }
4786 pAudioPlayer->PlaySound((SoundID)210, 0, 0, -1, 0, 0, 0, 0);
4787 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null)
4788 {
4789 if ( !v73 )
4790 {
4791 pMouse->RemoveHoldingItem();
4792 return;
4793 }
4794 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
4795 }
4796 if ( v73 )
4797 {
4798 if ( pParty->bTurnBasedModeOn )
4799 {
4800 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100;
4801 thisb->SetRecoveryTime(100);
4802 pTurnEngine->ApplyPlayerAction();
4803 }
4804 else
4805 {
4806 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333));
4807 }
4808 }
4809 pMouse->RemoveHoldingItem();
4810 return;
4811
4812 }
4813
4814
4815 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_SPELL_SCROLL )
4816 {
4817
4818
4819 if ( pCurrentScreen == SCREEN_CASTING )
4820 return;
4821 if ( !pParty->pPlayers[player_num-1].CanAct() )
4822 {
4823
4824 v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()];
4825 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v68);
4826 ShowStatusBarString(pTmpBuf.data(), 2u); 4864 ShowStatusBarString(pTmpBuf.data(), 2u);
4827 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); 4865 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
4828 return; 4866 return;
4829 } 4867 }
4830 if ( bUnderwater == 1 ) 4868 if ( !playerAffected->CanAct() )
4831 { 4869 {
4832 ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2u);//"You can not do that while you are underwater!" 4870 v66 = aCharacterConditionNames[playerAffected->GetMajorConditionIdx()];
4833 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); 4871 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v66);//"That player is %s"
4834 return; 4872 ShowStatusBarString(pTmpBuf.data(), 2u);
4835 } 4873 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
4836 dword_50C9AC = 1;
4837 scroll_id = pParty->pPickedItem.uItemID - 299;
4838 if ( scroll_id == 30 || scroll_id == 4 || scroll_id == 91 || scroll_id == 28 ) //Enchant Item scroll, Vampiric Weapon scroll ,Recharge Item ,Fire Aura
4839 {
4840 pMouse->RemoveHoldingItem();
4841 pGUIWindow_CurrentMenu->Release();
4842 pIcons_LOD->RemoveTexturesPackFromTextureList();
4843 pCurrentScreen = SCREEN_GAME;
4844 viewparams->bRedrawGameUI = 1;
4845 _42777D_CastSpell_UseWand_ShootArrow(scroll_id, player_num - 1, 0x85u, 1, 0);
4846 }
4847 else
4848 {
4849 _720984_unused = pParty->pPickedItem.uItemID;
4850 pMouse->RemoveHoldingItem();
4851 pMessageQueue_50C9E8->AddMessage(UIMSG_SpellScrollUse, scroll_id, player_num - 1);
4852 if ( pCurrentScreen && pGUIWindow_CurrentMenu
4853 && (pGUIWindow_CurrentMenu->eWindowType != WINDOW_null))
4854 {
4855 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
4856 }
4857 }
4858 return; 4874 return;
4859 } 4875 }
4860 4876 v16 = v15 % 11 + 1;
4861 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_BOOK ) 4877 v17 = playerAffected->pActiveSkills[v15 / 11 + 12];
4862 4878 v18 = SkillToMastery(v17) - 1;
4863 { 4879 switch (v18)
4864 v15 = pParty->pPickedItem.uItemID - 400; 4880 {
4865 v72 = v3->spellbook.bHaveSpell[pParty->pPickedItem.uItemID-400];//(char *)&v3->pConditions[0] + pParty->pPickedItem.uItemID + 2;
4866 if ( v72 )
4867 {
4868 v66 = pParty->pPickedItem.GetDisplayName();
4869 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[380], v66);//"You already know the %s spell"
4870 ShowStatusBarString(pTmpBuf.data(), 2u);
4871 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
4872 return;
4873 }
4874 if ( !pParty->pPlayers[player_num-1].CanAct() )
4875 {
4876 v66 = aCharacterConditionNames[v3->GetMajorConditionIdx()];
4877 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v66);//"That player is %s"
4878 ShowStatusBarString(pTmpBuf.data(), 2u);
4879 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
4880 return;
4881 }
4882 v16 = v15 % 11 + 1;
4883 v17 = v3->pActiveSkills[v15 / 11 + 12];
4884 v18 = SkillToMastery(v17) - 1;
4885 switch (v18)
4886 {
4887 case 0: v67 = 4; break; 4881 case 0: v67 = 4; break;
4888 case 1: v67 = 7; break; 4882 case 1: v67 = 7; break;
4889 case 2: v67 = 10; break; 4883 case 2: v67 = 10; break;
4890 case 3: v67 = 11; break; 4884 case 3: v67 = 11; break;
4891 default: 4885 default:
4892 v67 = player_num; 4886 v67 = player_num;
4887 }
4888
4889 if ( v16 > v67 || !v17 )
4890 {
4891 v22 = pParty->pPickedItem.GetDisplayName();
4892 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[381], v22); //"You don't have the skill to learn %s"
4893 ShowStatusBarString(pTmpBuf.data(), 2u);
4894 playerAffected->PlaySound((PlayerSpeech)20, 0);
4895 return;
4896 }
4897 // v72 = 1;
4898 playerAffected->PlaySound(SPEECH_21, 0);
4899 v73 = 0;
4900
4901
4902 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null)
4903 {
4904 if ( !v73 )
4905 {
4906 pMouse->RemoveHoldingItem();
4907 return;
4908 }
4909 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
4910 }
4911 // if ( v73 ) v73 is always 0 at this point
4912 // {
4913 // if ( pParty->bTurnBasedModeOn )
4914 // {
4915 // pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100;
4916 // thisb->SetRecoveryTime(100);
4917 // pTurnEngine->ApplyPlayerAction();
4918 // }
4919 // else
4920 // {
4921 // thisb->SetRecoveryTime(flt_6BE3A4_debug_recmod1 * 213.3333333333333);
4922 // }
4923 // }
4924 pMouse->RemoveHoldingItem();
4925 return;
4926 }
4927
4928 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_MESSAGE_SCROLL )
4929 {
4930 if ( playerAffected->CanAct() )
4931 {
4932 CreateMsgScrollWindow(pParty->pPickedItem.uItemID);
4933 playerAffected->PlaySound(SPEECH_37, 0);
4934 return;
4935 }
4936 v68 = aCharacterConditionNames[playerAffected->GetMajorConditionIdx()];
4937 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v68);
4938 ShowStatusBarString(pTmpBuf.data(), 2u);
4939 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
4940 return;
4941 }
4942 else
4943 {
4944 if (pParty->pPickedItem.uItemID == 616) //Genie Lamp
4945 {
4946 thisa = pParty->uCurrentMonthWeek + 1;
4947 if ( pParty->uCurrentMonth >= 7 )
4948 v74 = NULL;
4949 else
4950 v74 = aAttributeNames[pParty->uCurrentMonth];
4951 switch ( pParty->uCurrentMonth )
4952 {
4953 case 0:
4954 playerAffected->uMight += thisa;
4955 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"
4956 break;
4957 case 1:
4958 playerAffected->uIntelligence += thisa;
4959 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"
4960 break;
4961 case 2:
4962 playerAffected->uWillpower += thisa;
4963 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"
4964 break;
4965 case 3:
4966 playerAffected->uEndurance += thisa;
4967 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"
4968 break;
4969 case 4:
4970 playerAffected->uAccuracy += thisa;
4971 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"
4972 break;
4973 case 5:
4974 playerAffected->uSpeed += thisa;
4975 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"
4976 break;
4977 case 6:
4978 playerAffected->uLuck += thisa;
4979 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"
4980 break;
4981 case 7:
4982 party_finds_gold(1000 * thisa, 0);
4983 sprintf(pTmpBuf.data(), "+%u %s", 1000 * thisa, pGlobalTXT_LocalizationStrings[97]);//"Gold"
4984 break;
4985 case 8:
4986 Party::GiveFood(5 * thisa);
4987 sprintf(pTmpBuf.data(), "+%u %s",5 * thisa , pGlobalTXT_LocalizationStrings[653]);//"Food"
4988 break;
4989 case 9u:
4990 playerAffected->uSkillPoints += 2 * thisa;
4991 sprintf(pTmpBuf.data(), "+%u %s", 2 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_SKILL_POINTS]);
4992 break;
4993 case 10:
4994 playerAffected->uExperience += 2500 * thisa;
4995 sprintf(pTmpBuf.data(), "+%u %s", 2500 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_EXPIRIENCE]);
4996 break;
4997 case 11:
4998 v8 = rand() % 6;
4999 switch (v8)
5000 {
5001 case 0:
5002 playerAffected->sResFireBase += thisa;
5003 v13 = pGlobalTXT_LocalizationStrings[87];
5004 break;
5005 case 1:
5006 playerAffected->sResAirBase += thisa;
5007 v13 = pGlobalTXT_LocalizationStrings[6];
5008 break;
5009 case 2:
5010 playerAffected->sResWaterBase += thisa;
5011 v13 = pGlobalTXT_LocalizationStrings[240];
5012 break;
5013 case 3:
5014 playerAffected->sResEarthBase += thisa;
5015 v13 = pGlobalTXT_LocalizationStrings[70];
5016 break;
5017 case 4:
5018 playerAffected->sResMindBase += thisa;
5019 v13 = pGlobalTXT_LocalizationStrings[142];
5020 break;
5021 case 5:
5022 playerAffected->sResBodyBase += thisa;
5023 v13 = pGlobalTXT_LocalizationStrings[29];
5024 break;
4893 } 5025 }
4894 5026 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v13, pGlobalTXT_LocalizationStrings[121]);
4895 if ( v16 > v67 || !v17 ) 5027 break;
4896 { 5028
4897 v22 = pParty->pPickedItem.GetDisplayName(); 5029 }
4898 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[381], v22); //"You don't have the skill to learn %s" 5030 ShowStatusBarString(pTmpBuf.data(), 2u);
4899 ShowStatusBarString(pTmpBuf.data(), 2u); 5031 pMouse->RemoveHoldingItem();
4900 v3->PlaySound((PlayerSpeech)20, 0); 5032 pGame->pStru6Instance->SetPlayerBuffAnim(SPELL_QUEST_COMPLETED, player_num - 1);
4901 return; 5033 playerAffected->PlaySound(SPEECH_93, 0);
4902 } 5034 pAudioPlayer->PlaySound((SoundID)219, 0, 0, -1, 0, 0, 0, 0);
4903 // v72 = 1; 5035 if ( pParty->uDaysPlayed == 6 || pParty->uDaysPlayed == 20 )
4904 v3->PlaySound(SPEECH_21, 0); 5036 {
4905 v73 = 0; 5037 playerAffected->SetCondition(Condition_Eradicated, 0);
4906 5038 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0);
4907 5039 }
4908 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) 5040 else if ( pParty->uDaysPlayed == 12 || pParty->uDaysPlayed == 26 )
4909 { 5041 {
4910 if ( !v73 ) 5042 playerAffected->SetCondition(Condition_Dead, 0);
4911 { 5043 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0);
4912 pMouse->RemoveHoldingItem(); 5044 }
4913 return; 5045 else if ( pParty->uDaysPlayed == 4 || pParty->uDaysPlayed == 25 )
4914 } 5046 {
4915 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); 5047 playerAffected->SetCondition(Condition_Pertified, 0);
4916 } 5048 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0);
4917 if ( v73 ) 5049 }
4918 { 5050 return;
4919 if ( pParty->bTurnBasedModeOn ) 5051 }
4920 { 5052 else if ( pParty->pPickedItem.uItemID == 630 ) //Red Apple
4921 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100; 5053 {
4922 thisb->SetRecoveryTime(100); 5054 Party::GiveFood(1u);
4923 pTurnEngine->ApplyPlayerAction(); 5055 pAudioPlayer->PlaySound(SOUND_EatApple, 0, 0, -1, 0, 0, 0, 0);
4924 } 5056 }
4925 else 5057 else if ( pParty->pPickedItem.uItemID == 632 ) //Lute
4926 { 5058 {
4927 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); 5059 pAudioPlayer->PlaySound(SOUND_PlayLute, 0, 0, -1, 0, 0, 0, 0);
4928 }
4929 }
4930 pMouse->RemoveHoldingItem();
4931 return; 5060 return;
4932 5061 }
4933 } 5062 else if ( pParty->pPickedItem.uItemID == 633 ) //Faerie Pipes
4934 5063 {
4935 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_MESSAGE_SCROLL ) 5064 pAudioPlayer->PlaySound(SOUND_PlayFaeriePipes, 0, 0, -1, 0, 0, 0, 0);
4936 5065 return;
4937 { 5066 }
4938 if ( pParty->pPlayers[player_num-1].CanAct() ) 5067 else if ( pParty->pPickedItem.uItemID == 634 ) //Gryphonheart's Trumpet
4939 { 5068 {
4940 CreateMsgScrollWindow(pParty->pPickedItem.uItemID); 5069 pAudioPlayer->PlaySound(SOUND_PlayGryphonheartsTrumpet, 0, 0, -1, 0, 0, 0, 0);
4941 v3->PlaySound(SPEECH_37, 0); 5070 return;
4942 return; 5071 }
4943 } 5072 else if ( pParty->pPickedItem.uItemID == 646 ) //Horseshoe
4944 v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; 5073 {
4945 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v68); 5074 pGame->pStru6Instance->SetPlayerBuffAnim(SPELL_QUEST_COMPLETED, player_num - 1);
5075 v5 = PID(OBJECT_Player, player_num + 49);
5076 pAudioPlayer->PlaySound(SOUND_20001, v5, 0, -1, 0, 0, 0, 0);
5077 playerAffected->AddVariable(VAR_NumSkillPoints, 2);
5078 }
5079 else if ( pParty->pPickedItem.uItemID == 650 ) //Temple in a Bottle
5080 {
5081 TeleportToNWCDungeon();
5082 return;
5083 }
5084 else
5085 {
5086 v68 = pParty->pPickedItem.GetDisplayName();
5087 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[36],v68);//"%s can not be used that way"
4946 ShowStatusBarString(pTmpBuf.data(), 2u); 5088 ShowStatusBarString(pTmpBuf.data(), 2u);
4947 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); 5089 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
4948 return; 5090 return;
4949 } 5091 }
4950 else 5092
4951 { 5093 pMouse->RemoveHoldingItem();
4952 if (pParty->pPickedItem.uItemID == 616) //Genie Lamp 5094 return;
4953 { 5095 }
4954 thisa = pParty->uCurrentMonthWeek + 1; 5096 }
4955 if ( pParty->uCurrentMonth >= 7 )
4956 v74 = NULL;
4957 else
4958 v74 = aAttributeNames[pParty->uCurrentMonth];
4959 switch ( pParty->uCurrentMonth )
4960 {
4961 case 0:
4962 v3->uMight += thisa;
4963 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"
4964 break;
4965 case 1:
4966 v3->uIntelligence += thisa;
4967 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"
4968 break;
4969 case 2:
4970 v3->uWillpower += thisa;
4971 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"
4972 break;
4973 case 3:
4974 v3->uEndurance += thisa;
4975 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"
4976 break;
4977 case 4:
4978 v3->uAccuracy += thisa;
4979 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"
4980 break;
4981 case 5:
4982 v3->uSpeed += thisa;
4983 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"
4984 break;
4985 case 6:
4986 v3->uLuck += thisa;
4987 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"
4988 break;
4989 case 7:
4990 party_finds_gold(1000 * thisa, 0);
4991 sprintf(pTmpBuf.data(), "+%u %s", 1000 * thisa, pGlobalTXT_LocalizationStrings[97]);//"Gold"
4992 break;
4993 case 8:
4994 Party::GiveFood(5 * thisa);
4995 sprintf(pTmpBuf.data(), "+%u %s",5 * thisa , pGlobalTXT_LocalizationStrings[653]);//"Food"
4996 break;
4997 case 9u:
4998 v3->uSkillPoints += 2 * thisa;
4999 sprintf(pTmpBuf.data(), "+%u %s", 2 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_SKILL_POINTS]);
5000 break;
5001 case 10:
5002 v3->uExperience += 2500 * thisa;
5003 sprintf(pTmpBuf.data(), "+%u %s", 2500 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_EXPIRIENCE]);
5004 break;
5005 case 11:
5006 v8 = rand() % 6;
5007 switch (v8)
5008 {
5009 case 0:
5010 v3->sResFireBase += thisa;
5011 v13 = pGlobalTXT_LocalizationStrings[87];
5012 break;
5013 case 1:
5014 v3->sResAirBase += thisa;
5015 v13 = pGlobalTXT_LocalizationStrings[6];
5016 break;
5017 case 2:
5018 v3->sResWaterBase += thisa;
5019 v13 = pGlobalTXT_LocalizationStrings[240];
5020 break;
5021 case 3:
5022 v3->sResEarthBase += thisa;
5023 v13 = pGlobalTXT_LocalizationStrings[70];
5024 break;
5025 case 4:
5026 v3->sResMindBase += thisa;
5027 v13 = pGlobalTXT_LocalizationStrings[142];
5028 break;
5029 case 5:
5030 v3->sResBodyBase += thisa;
5031 v13 = pGlobalTXT_LocalizationStrings[29];
5032 break;
5033 }
5034 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v13, pGlobalTXT_LocalizationStrings[121]);
5035 break;
5036
5037 }
5038 ShowStatusBarString(pTmpBuf.data(), 2u);
5039 pMouse->RemoveHoldingItem();
5040 pGame->pStru6Instance->SetPlayerBuffAnim(SPELL_QUEST_COMPLETED, player_num - 1);
5041 v3->PlaySound(SPEECH_93, 0);
5042 pAudioPlayer->PlaySound((SoundID)219, 0, 0, -1, 0, 0, 0, 0);
5043 if ( pParty->uDaysPlayed == 6 || pParty->uDaysPlayed == 20 )
5044 {
5045 v3->SetCondition(Condition_Eradicated, 0);
5046 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0);
5047 }
5048 else if ( pParty->uDaysPlayed == 12 || pParty->uDaysPlayed == 26 )
5049 {
5050 v3->SetCondition(Condition_Dead, 0);
5051 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0);
5052 }
5053 else if ( pParty->uDaysPlayed == 4 || pParty->uDaysPlayed == 25 )
5054 {
5055 v3->SetCondition(Condition_Pertified, 0);
5056 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0);
5057 }
5058 return;
5059 }
5060 else if ( pParty->pPickedItem.uItemID == 630 ) //Red Apple
5061 {
5062 Party::GiveFood(1u);
5063 pAudioPlayer->PlaySound(SOUND_EatApple, 0, 0, -1, 0, 0, 0, 0);
5064 }
5065 else if ( pParty->pPickedItem.uItemID == 632 ) //Lute
5066 {
5067 pAudioPlayer->PlaySound(SOUND_PlayLute, 0, 0, -1, 0, 0, 0, 0);
5068 return;
5069 }
5070 else if ( pParty->pPickedItem.uItemID == 633 ) //Faerie Pipes
5071 {
5072 pAudioPlayer->PlaySound(SOUND_PlayFaeriePipes, 0, 0, -1, 0, 0, 0, 0);
5073 return;
5074 }
5075 else if ( pParty->pPickedItem.uItemID == 634 ) //Gryphonheart's Trumpet
5076 {
5077 pAudioPlayer->PlaySound(SOUND_PlayGryphonheartsTrumpet, 0, 0, -1, 0, 0, 0, 0);
5078 return;
5079 }
5080 else if ( pParty->pPickedItem.uItemID == 646 ) //Horseshoe
5081 {
5082 pGame->pStru6Instance->SetPlayerBuffAnim(SPELL_QUEST_COMPLETED, player_num - 1);
5083 v5 = PID(OBJECT_Player, player_num + 49);
5084 pAudioPlayer->PlaySound(SOUND_20001, v5, 0, -1, 0, 0, 0, 0);
5085 v3->AddVariable(VAR_NumSkillPoints, 2);
5086 }
5087 else if ( pParty->pPickedItem.uItemID == 650 ) //Temple in a Bottle
5088 {
5089 TeleportToNWCDungeon();
5090 return;
5091 }
5092 else
5093 {
5094
5095 v68 = pParty->pPickedItem.GetDisplayName();
5096 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[36],v68);//"%s can not be used that way"
5097 ShowStatusBarString(pTmpBuf.data(), 2u);
5098 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
5099 return;
5100 }
5101
5102 pMouse->RemoveHoldingItem();
5103 return;
5104 }
5105
5106 }
5107 5097
5108 //----- (00449BB4) -------------------------------------------------------- 5098 //----- (00449BB4) --------------------------------------------------------
5109 bool Player::CompareVariable( enum VariableType VarNum, signed int pValue ) 5099 bool Player::CompareVariable( enum VariableType VarNum, signed int pValue )
5110 { 5100 {
5111 Player *v3; // esi@1 5101 Player *v3; // esi@1