diff 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
line wrap: on
line diff
--- a/Player.cpp	Sat Sep 14 06:56:05 2013 +0200
+++ b/Player.cpp	Sat Sep 14 07:21:56 2013 +0200
@@ -4430,680 +4430,670 @@
 
 //----- (004680ED) --------------------------------------------------------
 void Player::UseItem_DrinkPotion_etc(signed int player_num, int a3)
-    {
-    Player *v3; // esi@1
-    signed int v5; // eax@17
-    int v8; // edx@39
-    char *v13; // eax@45
-    signed int v15; // edi@68
-    int v16; // edx@73
-    unsigned __int16 v17; // edi@73
-    unsigned int v18; // eax@73
-    const char *v22; // eax@84
-    int scroll_id; // esi@96
-    int v25; // eax@109
-    int v26; // eax@113
-    int new_mana_val; // edi@114
-    signed __int64 v28; // qax@120
-    __int64 v30; // edi@137
-    __int64 v32; // ST3C_4@137
-    __int64 v34; // ST34_4@137
-    unsigned __int16 v50; // [sp-Ch] [bp-38h]@120
-    const char *v66; // [sp-4h] [bp-30h]@69
-    signed int v67; // [sp-4h] [bp-30h]@77
-    const char *v68; // [sp-4h] [bp-30h]@89
-    char v72; // [sp+20h] [bp-Ch]@68
-    signed int v73; // [sp+24h] [bp-8h]@1
-    char*  v74; // [sp+24h] [bp-8h]@23
-    Player *thisb; // [sp+28h] [bp-4h]@1
-    unsigned int thisa; // [sp+28h] [bp-4h]@22
-
-    thisb = this;
-    v3 = &pParty->pPlayers[player_num-1];
-    v73 = 1;
-    if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 3) )
-        return;
-    if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_REAGENT )
-        {
-        if ( pParty->pPickedItem.uItemID == 160 )
-            { 
-            pParty->pPlayers[player_num-1].SetCondition(Condition_Poison1, 1);
-            }
-        else if ( pParty->pPickedItem.uItemID == 161 )
-            {
-            new_mana_val = v3->sMana;
-            new_mana_val += 2;
-            if ( new_mana_val > v3->GetMaxMana() )
-                new_mana_val = v3->GetMaxMana();
-            v3->PlaySound(SPEECH_36, 0);
-            }
-        else if ( pParty->pPickedItem.uItemID == 162 )
-            {
-            pParty->pPlayers[player_num-1].Heal(2);
-            v3->PlaySound(SPEECH_36, 0);
-            
-            }
-        else
-            {    
-            v68 = pParty->pPickedItem.GetDisplayName();
-            sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[36], v68);//"%s can not be used that way"
-            ShowStatusBarString(pTmpBuf.data(), 2);
-            pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
-            return;
-            }
-        pAudioPlayer->PlaySound((SoundID)211, 0, 0, -1, 0, 0, 0, 0);
-
-        if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null)
-            {
-            pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
-            }
-        if ( v73 )
-            {
-            if ( pParty->bTurnBasedModeOn )
-                {
-                pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100;
-                thisb->SetRecoveryTime(100);
-                pTurnEngine->ApplyPlayerAction();
-                }
-            else
-                {
-                thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333));
-                }
-            }
-        pMouse->RemoveHoldingItem();
-        return;
-
-
-        }
-    if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_POTION )
-        {
-        switch ( pParty->pPickedItem.uItemID )
-            {
-        case 221: //Catalyst
-            pParty->pPlayers[player_num-1].SetCondition(Condition_Poison1, 1);
-            break;
-        case 222: //Cure Wounds
-            v25 = pParty->pPickedItem.uEnchantmentType + 10;
-            pParty->pPlayers[player_num-1].Heal(v25);
-            v3->PlaySound(SPEECH_36, 0);
-            break;
-        case 223: //Magic Potion
-            v26 = pParty->pPickedItem.uEnchantmentType + 10;
-            new_mana_val = v3->sMana;
-            new_mana_val += v26;
-            if ( new_mana_val > v3->GetMaxMana() )
-                new_mana_val = v3->GetMaxMana();
-            v3->PlaySound(SPEECH_36, 0);
-            break;
-        case 224: //Cure Weakness
-            v3->pConditions[Condition_Weak] = 0i64;
-            v3->PlaySound(SPEECH_36, 0);
-            break;
-        case 225: //Cure Disease
-            v3->pConditions[Condition_Disease3] = 0i64;      
-            v3->pConditions[Condition_Disease2] = 0i64;
-            v3->pConditions[Condition_Disease1] = 0i64;
-            v3->PlaySound(SPEECH_36, 0);
-            break;
-        case 226: //Cure Poison
-            v3->pConditions[Condition_Poison3] = 0i64;
-            v3->pConditions[Condition_Poison2] = 0i64;
-            v3->pConditions[Condition_Poison1] = 0i64;
-            v3->PlaySound(SPEECH_36, 0);
-            break;
-        case 227: //Awaken
-            v3->pConditions[Condition_Sleep] = 0i64;
-            v3->PlaySound(SPEECH_36, 0);
-            break;
-        case 228: //Haste
-            if ( !v3->pConditions[Condition_Weak] )
-                {
+{
+  Player *playerAffected; // esi@1
+  signed int v5; // eax@17
+  int v8; // edx@39
+  char *v13; // eax@45
+  signed int v15; // edi@68
+  int v16; // edx@73
+  unsigned __int16 v17; // edi@73
+  unsigned int v18; // eax@73
+  const char *v22; // eax@84
+  int scroll_id; // esi@96
+  int v25; // eax@109
+  int v26; // eax@113
+  int new_mana_val; // edi@114
+  signed __int64 v28; // qax@120
+  __int64 v30; // edi@137
+  __int64 v32; // ST3C_4@137
+  __int64 v34; // ST34_4@137
+  unsigned __int16 v50; // [sp-Ch] [bp-38h]@120
+  const char *v66; // [sp-4h] [bp-30h]@69
+  signed int v67; // [sp-4h] [bp-30h]@77
+  const char *v68; // [sp-4h] [bp-30h]@89
+  char v72; // [sp+20h] [bp-Ch]@68
+  signed int v73; // [sp+24h] [bp-8h]@1
+  char*  v74; // [sp+24h] [bp-8h]@23
+  Player *thisb; // [sp+28h] [bp-4h]@1
+  unsigned int thisa; // [sp+28h] [bp-4h]@22
+
+  thisb = this;
+  playerAffected = &pParty->pPlayers[player_num-1];
+  v73 = 1;
+  if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 3) )
+      return;
+  if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_REAGENT )
+  {
+    if ( pParty->pPickedItem.uItemID == 160 )
+    { 
+      playerAffected->SetCondition(Condition_Poison1, 1);
+    }
+    else if ( pParty->pPickedItem.uItemID == 161 )
+    {
+      new_mana_val = playerAffected->sMana;
+      new_mana_val += 2;
+      if ( new_mana_val > playerAffected->GetMaxMana() )
+        new_mana_val = playerAffected->GetMaxMana();
+      playerAffected->PlaySound(SPEECH_36, 0);
+    }
+    else if ( pParty->pPickedItem.uItemID == 162 )
+    {
+      playerAffected->Heal(2);
+      playerAffected->PlaySound(SPEECH_36, 0);
+    }
+    else
+    {    
+      v68 = pParty->pPickedItem.GetDisplayName();
+      sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[36], v68);//"%s can not be used that way"
+      ShowStatusBarString(pTmpBuf.data(), 2);
+      pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
+      return;
+    }
+    pAudioPlayer->PlaySound((SoundID)211, 0, 0, -1, 0, 0, 0, 0);
+
+    if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null)
+    {
+      pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
+    }
+    if ( v73 )
+    {
+      if ( pParty->bTurnBasedModeOn )
+      {
+        pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100;
+        thisb->SetRecoveryTime(100);
+        pTurnEngine->ApplyPlayerAction();
+      }
+      else
+      {
+        thisb->SetRecoveryTime(flt_6BE3A4_debug_recmod1 * 213.3333333333333);
+      }
+    }
+    pMouse->RemoveHoldingItem();
+    return;
+  }
+
+  if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_POTION )
+  {
+      switch ( pParty->pPickedItem.uItemID )
+      {
+          case 221: //Catalyst
+              playerAffected->SetCondition(Condition_Poison1, 1);
+              break;
+          case 222: //Cure Wounds
+              v25 = pParty->pPickedItem.uEnchantmentType + 10;
+              playerAffected->Heal(v25);
+              playerAffected->PlaySound(SPEECH_36, 0);
+              break;
+          case 223: //Magic Potion
+              v26 = pParty->pPickedItem.uEnchantmentType + 10;
+              new_mana_val = playerAffected->sMana;
+              new_mana_val += v26;
+              if ( new_mana_val > playerAffected->GetMaxMana() )
+                  new_mana_val = playerAffected->GetMaxMana();
+              playerAffected->PlaySound(SPEECH_36, 0);
+              break;
+          case 224: //Cure Weakness
+              playerAffected->pConditions[Condition_Weak] = 0i64;
+              playerAffected->PlaySound(SPEECH_36, 0);
+              break;
+          case 225: //Cure Disease
+              playerAffected->pConditions[Condition_Disease3] = 0i64;      
+              playerAffected->pConditions[Condition_Disease2] = 0i64;
+              playerAffected->pConditions[Condition_Disease1] = 0i64;
+              playerAffected->PlaySound(SPEECH_36, 0);
+              break;
+          case 226: //Cure Poison
+              playerAffected->pConditions[Condition_Poison3] = 0i64;
+              playerAffected->pConditions[Condition_Poison2] = 0i64;
+              playerAffected->pConditions[Condition_Poison1] = 0i64;
+              playerAffected->PlaySound(SPEECH_36, 0);
+              break;
+          case 227: //Awaken
+              playerAffected->pConditions[Condition_Sleep] = 0i64;
+              playerAffected->PlaySound(SPEECH_36, 0);
+              break;
+          case 228: //Haste
+              if ( !playerAffected->pConditions[Condition_Weak] )
+              {
                 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
-                v3->pPlayerBuffs[7].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0);
-                v3->PlaySound(SPEECH_36, 0);
-                }
-            break;
-        case 229: //Heroism
-            v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
-            v3->pPlayerBuffs[8].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0);
-            v3->PlaySound(SPEECH_36, 0);
-            break;
-        case 230: //Bless
-            v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
-            v3->pPlayerBuffs[1].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0);
-            v3->PlaySound(SPEECH_36, 0);
-            break;
-        case 231: //Preservation
-            v50 = 3 * pParty->pPickedItem.uEnchantmentType;
-            v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
-            v3->pPlayerBuffs[11].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
-            v3->PlaySound(SPEECH_36, 0);
-            break;
-        case 232: //Shield
-            v50 = 3 * pParty->pPickedItem.uEnchantmentType;
-            v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
-            v3->pPlayerBuffs[13].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
-            v3->PlaySound(SPEECH_36, 0);
-            break;
-        case 234: //Stoneskin
-            v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
-            v3->pPlayerBuffs[14].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0);
-            v3->PlaySound(SPEECH_36, 0);
-            break;
-        case 235: //Water Breathing
-            v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335),
-            v3->pPlayerBuffs[23].Apply(pParty->uTimePlayed +v28,  3, 5, 0, 0);
-            break;
-        case 237: //Remove Fear
-            v3->pConditions[Condition_Fear] = 0i64;
-            v3->PlaySound(SPEECH_36, 0);
-            break;
-        case 238: //Remove Curse
-            v3->pConditions[Condition_Cursed] = 0i64;
-            v3->PlaySound(SPEECH_36, 0);
-            break;
-        case 239: //Cure Insanity
-            v3->pConditions[Condition_Insane] = 0i64;
-            v3->PlaySound(SPEECH_36, 0);
-            break;
-        case 240: //Might Boost
-            v50 = 3 * pParty->pPickedItem.uEnchantmentType;
-            v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
-            v3->pPlayerBuffs[19].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
-            v3->PlaySound(SPEECH_36, 0);
-            break;
-        case 241: //Intellect Boost
-            v50 = 3 * pParty->pPickedItem.uEnchantmentType;
-            v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
-            v3->pPlayerBuffs[17].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
-            v3->PlaySound(SPEECH_36, 0);
-            break;
-        case 242: //Personality Boost
-            v50 = 3 * pParty->pPickedItem.uEnchantmentType;
-            v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
-            v3->pPlayerBuffs[20].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
-            v3->PlaySound(SPEECH_36, 0);
-            break;
-        case 243://Endurance Boost
-            v50 = 3 * pParty->pPickedItem.uEnchantmentType;
-            v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
-            v3->pPlayerBuffs[16].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
-            v3->PlaySound(SPEECH_36, 0);
-            break;
-        case 244: //Speed Boost
-            v50 = 3 * pParty->pPickedItem.uEnchantmentType;
-            v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
-            v3->pPlayerBuffs[21].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
-            v3->PlaySound(SPEECH_36, 0);
-            break;
-        case 245: //Accuracy Boost
-            v50 = 3 * pParty->pPickedItem.uEnchantmentType;
-            v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
-            v3->pPlayerBuffs[15].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
-            v3->PlaySound(SPEECH_36, 0);
-            break;
-        case 251: //Cure Paralysis
-            v3->pConditions[Condition_Paralyzed] = 0i64;
-            v3->PlaySound(SPEECH_36, 0);
-            break;
-        case 252://Divine Restoration
-            v30 = v3->pConditions[Condition_Dead];
-            v32 = v3->pConditions[Condition_Pertified];
-            v34 = v3->pConditions[Condition_Eradicated];    
-            memset(&pParty->pPlayers[player_num-1].pConditions,0,sizeof(pConditions));
-            v3->pConditions[Condition_Dead] = v30;
-            v3->pConditions[Condition_Pertified] = v32;
-            v3->pConditions[Condition_Eradicated] = v34;
-            v3->PlaySound(SPEECH_36, 0);
-            break;
-        case 253: //Divine Cure
-            v25 = 5 * pParty->pPickedItem.uEnchantmentType;
-            pParty->pPlayers[player_num-1].Heal(v25);
-            v3->PlaySound(SPEECH_36, 0);
-            break;
-        case 254: //Divine Power
-            v26 = 5 * pParty->pPickedItem.uEnchantmentType;
-            new_mana_val = v3->sMana;
-            new_mana_val += v26;
-            if ( new_mana_val > v3->GetMaxMana() )
-                new_mana_val = v3->GetMaxMana();
-            v3->PlaySound(SPEECH_36, 0);
-            break;
-        case 255: //Luck Boost
-            v50 = 3 * pParty->pPickedItem.uEnchantmentType;
-            v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
-            v3->pPlayerBuffs[18].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
-            v3->PlaySound(SPEECH_36, 0);
-            break;
-        case 256: //Fire Resistance
-            v50 = 3 * pParty->pPickedItem.uEnchantmentType;
-            v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
-            v3->pPlayerBuffs[5].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
-            v3->PlaySound(SPEECH_36, 0);
-            break;
-        case 257: //Air Resistance
-            v50 = 3 * pParty->pPickedItem.uEnchantmentType;
-            v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
-            v3->pPlayerBuffs[0].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
-            v3->PlaySound(SPEECH_36, 0);
-            break;
-        case 258: //Water Resistance
-            v50 = 3 * pParty->pPickedItem.uEnchantmentType;
-            v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
-            v3->pPlayerBuffs[22].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
-            v3->PlaySound(SPEECH_36, 0);
-            break;
-        case 259: //Earth Resistance
-            v50 = 3 * pParty->pPickedItem.uEnchantmentType;
-            v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
-            v3->pPlayerBuffs[3].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
-            v3->PlaySound(SPEECH_36, 0);
-            break;
-        case 260: //Mind Resistance
-            v50 = 3 * pParty->pPickedItem.uEnchantmentType;
-            v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
-            v3->pPlayerBuffs[9].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
-            v3->PlaySound(SPEECH_36, 0);
-            break;
-        case 261: //Body Resistance
-            v50 = 3 * pParty->pPickedItem.uEnchantmentType;
-            v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
-            v3->pPlayerBuffs[2].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
-            v3->PlaySound(SPEECH_36, 0);
-           break;
-        case 262: //Stone to Flesh
-            v3->pConditions[Condition_Pertified] = 0i64;
-            v3->PlaySound(SPEECH_36, 0);
-            break;
-        case 264: //Pure Luck
-            if ( !v3->pure_luck_used )
-                {
-                v3->uLuck += 50;
-                v3->pure_luck_used = 1;
-                }
-            v3->PlaySound(SPEECH_36, 0);
-            break;
-        case 265: //Pure Speed
-            if ( !v3->pure_speed_used )
-                {
-                v3->uSpeed += 50;
-                v3->pure_speed_used = 1;
-                }
-            v3->PlaySound(SPEECH_36, 0);
-            break;
-        case 266: //Pure Intellect
-            if ( !v3->pure_intellect_used )
-                {
-                v3->uIntelligence += 50;
-                v3->pure_intellect_used = 1;
-                }
-            v3->PlaySound(SPEECH_36, 0);
-           break;
-        case 267: //Pure Endurance
-            if ( !v3->pure_endurance_used )
-                {
-                v3->uEndurance += 50;
-                v3->pure_endurance_used = 1;
-                }
-            v3->PlaySound(SPEECH_36, 0);
-            break;
-        case 268:  //Pure Personality
-            if ( !v3->pure_willpower_used )
-                {
-                v3->uWillpower += 50;
-                v3->pure_willpower_used = 1;
-                }
-            v3->PlaySound(SPEECH_36, 0);
-            break;
-        case 269: //Pure Accuracy
-            if ( !v3->pure_accuracy_used )
-                {
-                v3->uAccuracy += 50;
-                v3->pure_accuracy_used = 1;
-                }
-            v3->PlaySound(SPEECH_36, 0);
-            break;
-        case 270: //Pure Might
-            if ( !v3->pure_might_used )
-                {
-                v3->uMight += 50;
-                v3->pure_might_used = 1;
-                }
-            v3->PlaySound(SPEECH_36, 0);
-            break;
-        case 271: //Rejuvenation
-            v3->sAgeModifier = 0;
-            v3->PlaySound(SPEECH_36, 0);
-           break;
-
-        default:
-            v68 = pParty->pPickedItem.GetDisplayName();
-            sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[36], v68);//"%s can not be used that way"
-            ShowStatusBarString(pTmpBuf.data(), 2u);
-            pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
-            return;
-            }
-        pAudioPlayer->PlaySound((SoundID)210, 0, 0, -1, 0, 0, 0, 0);
-        if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null)
-            {
-            if ( !v73 )
-                {
-                pMouse->RemoveHoldingItem();
-                return;
-                }
-            pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
-            }
-        if ( v73 )
-            {
-            if ( pParty->bTurnBasedModeOn )
-                {
-                pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100;
-                thisb->SetRecoveryTime(100);
-                pTurnEngine->ApplyPlayerAction();
-                }
-            else
-                {
-                thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333));
-                }
-            }
-        pMouse->RemoveHoldingItem();
+                playerAffected->pPlayerBuffs[7].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0);
+                playerAffected->PlaySound(SPEECH_36, 0);
+              }
+              break;
+          case 229: //Heroism
+              v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
+              playerAffected->pPlayerBuffs[8].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0);
+              playerAffected->PlaySound(SPEECH_36, 0);
+              break;
+          case 230: //Bless
+              v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
+              playerAffected->pPlayerBuffs[1].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0);
+              playerAffected->PlaySound(SPEECH_36, 0);
+              break;
+          case 231: //Preservation
+              v50 = 3 * pParty->pPickedItem.uEnchantmentType;
+              v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
+              playerAffected->pPlayerBuffs[11].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
+              playerAffected->PlaySound(SPEECH_36, 0);
+              break;
+          case 232: //Shield
+              v50 = 3 * pParty->pPickedItem.uEnchantmentType;
+              v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
+              playerAffected->pPlayerBuffs[13].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
+              playerAffected->PlaySound(SPEECH_36, 0);
+              break;
+          case 234: //Stoneskin
+              v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
+              playerAffected->pPlayerBuffs[14].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0);
+              playerAffected->PlaySound(SPEECH_36, 0);
+              break;
+          case 235: //Water Breathing
+              v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335),
+              playerAffected->pPlayerBuffs[23].Apply(pParty->uTimePlayed +v28,  3, 5, 0, 0);
+              break;
+          case 237: //Remove Fear
+              playerAffected->pConditions[Condition_Fear] = 0i64;
+              playerAffected->PlaySound(SPEECH_36, 0);
+              break;
+          case 238: //Remove Curse
+              playerAffected->pConditions[Condition_Cursed] = 0i64;
+              playerAffected->PlaySound(SPEECH_36, 0);
+              break;
+          case 239: //Cure Insanity
+              playerAffected->pConditions[Condition_Insane] = 0i64;
+              playerAffected->PlaySound(SPEECH_36, 0);
+              break;
+          case 240: //Might Boost
+              v50 = 3 * pParty->pPickedItem.uEnchantmentType;
+              v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
+              playerAffected->pPlayerBuffs[19].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
+              playerAffected->PlaySound(SPEECH_36, 0);
+              break;
+          case 241: //Intellect Boost
+              v50 = 3 * pParty->pPickedItem.uEnchantmentType;
+              v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
+              playerAffected->pPlayerBuffs[17].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
+              playerAffected->PlaySound(SPEECH_36, 0);
+              break;
+          case 242: //Personality Boost
+              v50 = 3 * pParty->pPickedItem.uEnchantmentType;
+              v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
+              playerAffected->pPlayerBuffs[20].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
+              playerAffected->PlaySound(SPEECH_36, 0);
+              break;
+          case 243://Endurance Boost
+              v50 = 3 * pParty->pPickedItem.uEnchantmentType;
+              v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
+              playerAffected->pPlayerBuffs[16].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
+              playerAffected->PlaySound(SPEECH_36, 0);
+              break;
+          case 244: //Speed Boost
+              v50 = 3 * pParty->pPickedItem.uEnchantmentType;
+              v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
+              playerAffected->pPlayerBuffs[21].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
+              playerAffected->PlaySound(SPEECH_36, 0);
+              break;
+          case 245: //Accuracy Boost
+              v50 = 3 * pParty->pPickedItem.uEnchantmentType;
+              v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
+              playerAffected->pPlayerBuffs[15].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
+              playerAffected->PlaySound(SPEECH_36, 0);
+              break;
+          case 251: //Cure Paralysis
+              playerAffected->pConditions[Condition_Paralyzed] = 0i64;
+              playerAffected->PlaySound(SPEECH_36, 0);
+              break;
+          case 252://Divine Restoration
+              v30 = playerAffected->pConditions[Condition_Dead];
+              v32 = playerAffected->pConditions[Condition_Pertified];
+              v34 = playerAffected->pConditions[Condition_Eradicated];    
+              memset(&playerAffected->pConditions,0,sizeof(pConditions));
+              playerAffected->pConditions[Condition_Dead] = v30;
+              playerAffected->pConditions[Condition_Pertified] = v32;
+              playerAffected->pConditions[Condition_Eradicated] = v34;
+              playerAffected->PlaySound(SPEECH_36, 0);
+              break;
+          case 253: //Divine Cure
+              v25 = 5 * pParty->pPickedItem.uEnchantmentType;
+              playerAffected->Heal(v25);
+              playerAffected->PlaySound(SPEECH_36, 0);
+              break;
+          case 254: //Divine Power
+              v26 = 5 * pParty->pPickedItem.uEnchantmentType;
+              new_mana_val = playerAffected->sMana;
+              new_mana_val += v26;
+              if ( new_mana_val > playerAffected->GetMaxMana() )
+                  new_mana_val = playerAffected->GetMaxMana();
+              playerAffected->PlaySound(SPEECH_36, 0);
+              break;
+          case 255: //Luck Boost
+              v50 = 3 * pParty->pPickedItem.uEnchantmentType;
+              v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
+              playerAffected->pPlayerBuffs[18].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
+              playerAffected->PlaySound(SPEECH_36, 0);
+              break;
+          case 256: //Fire Resistance
+              v50 = 3 * pParty->pPickedItem.uEnchantmentType;
+              v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
+              playerAffected->pPlayerBuffs[5].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
+              playerAffected->PlaySound(SPEECH_36, 0);
+              break;
+          case 257: //Air Resistance
+              v50 = 3 * pParty->pPickedItem.uEnchantmentType;
+              v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
+              playerAffected->pPlayerBuffs[0].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
+              playerAffected->PlaySound(SPEECH_36, 0);
+              break;
+          case 258: //Water Resistance
+              v50 = 3 * pParty->pPickedItem.uEnchantmentType;
+              v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
+              playerAffected->pPlayerBuffs[22].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
+              playerAffected->PlaySound(SPEECH_36, 0);
+              break;
+          case 259: //Earth Resistance
+              v50 = 3 * pParty->pPickedItem.uEnchantmentType;
+              v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
+              playerAffected->pPlayerBuffs[3].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
+              playerAffected->PlaySound(SPEECH_36, 0);
+              break;
+          case 260: //Mind Resistance
+              v50 = 3 * pParty->pPickedItem.uEnchantmentType;
+              v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
+              playerAffected->pPlayerBuffs[9].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
+              playerAffected->PlaySound(SPEECH_36, 0);
+              break;
+          case 261: //Body Resistance
+              v50 = 3 * pParty->pPickedItem.uEnchantmentType;
+              v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
+              playerAffected->pPlayerBuffs[2].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
+              playerAffected->PlaySound(SPEECH_36, 0);
+              break;
+          case 262: //Stone to Flesh
+              playerAffected->pConditions[Condition_Pertified] = 0i64;
+              playerAffected->PlaySound(SPEECH_36, 0);
+              break;
+          case 264: //Pure Luck
+              if ( !playerAffected->pure_luck_used )
+              {
+                playerAffected->uLuck += 50;
+                playerAffected->pure_luck_used = 1;
+              }
+              playerAffected->PlaySound(SPEECH_36, 0);
+              break;
+          case 265: //Pure Speed
+              if ( !playerAffected->pure_speed_used )
+              {
+                playerAffected->uSpeed += 50;
+                playerAffected->pure_speed_used = 1;
+              }
+              playerAffected->PlaySound(SPEECH_36, 0);
+              break;
+          case 266: //Pure Intellect
+              if ( !playerAffected->pure_intellect_used )
+              {
+                playerAffected->uIntelligence += 50;
+                playerAffected->pure_intellect_used = 1;
+              }
+              playerAffected->PlaySound(SPEECH_36, 0);
+              break;
+          case 267: //Pure Endurance
+              if ( !playerAffected->pure_endurance_used )
+              {
+                playerAffected->uEndurance += 50;
+                playerAffected->pure_endurance_used = 1;
+              }
+              playerAffected->PlaySound(SPEECH_36, 0);
+              break;
+          case 268:  //Pure Personality
+              if ( !playerAffected->pure_willpower_used )
+              {
+                playerAffected->uWillpower += 50;
+                playerAffected->pure_willpower_used = 1;
+              }
+              playerAffected->PlaySound(SPEECH_36, 0);
+              break;
+          case 269: //Pure Accuracy
+              if ( !playerAffected->pure_accuracy_used )
+              {
+                playerAffected->uAccuracy += 50;
+                playerAffected->pure_accuracy_used = 1;
+              }
+              playerAffected->PlaySound(SPEECH_36, 0);
+              break;
+          case 270: //Pure Might
+              if ( !playerAffected->pure_might_used )
+              {
+                playerAffected->uMight += 50;
+                playerAffected->pure_might_used = 1;
+              }
+              playerAffected->PlaySound(SPEECH_36, 0);
+              break;
+          case 271: //Rejuvenation
+              playerAffected->sAgeModifier = 0;
+              playerAffected->PlaySound(SPEECH_36, 0);
+              break;
+
+          default:
+          v68 = pParty->pPickedItem.GetDisplayName();
+          sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[36], v68);//"%s can not be used that way"
+          ShowStatusBarString(pTmpBuf.data(), 2u);
+          pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
+          return;
+      }
+      pAudioPlayer->PlaySound((SoundID)210, 0, 0, -1, 0, 0, 0, 0);
+      if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null)
+      {
+//         if ( !v73 )                                            v73 is always 1 at this point
+//         {
+//           pMouse->RemoveHoldingItem();
+//           return;
+//         }
+        pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
+      }
+      if ( v73 )
+      {
+        if ( pParty->bTurnBasedModeOn )
+        {
+          pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100;
+          thisb->SetRecoveryTime(100);
+          pTurnEngine->ApplyPlayerAction();
+        }
+        else
+        {
+          thisb->SetRecoveryTime(flt_6BE3A4_debug_recmod1 * 213.3333333333333);
+        }
+      }
+      pMouse->RemoveHoldingItem();
+      return;
+  }
+
+
+  if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_SPELL_SCROLL )
+  {
+    if ( pCurrentScreen == SCREEN_CASTING )
         return;
-    
-        }
-
-
-    if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_SPELL_SCROLL )
-        {
-
-
-        if ( pCurrentScreen == SCREEN_CASTING )
-            return;
-        if ( !pParty->pPlayers[player_num-1].CanAct() )
-            {
-
-            v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()];
-        sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v68);
+    if ( !playerAffected->CanAct() )
+    {
+
+      v68 = aCharacterConditionNames[playerAffected->GetMajorConditionIdx()];
+      sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v68);
+      ShowStatusBarString(pTmpBuf.data(), 2u);
+      pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
+      return;
+    }
+    if ( bUnderwater == 1 )
+    {
+      ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2u);//"You can not do that while you are underwater!"
+      pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
+      return;
+    }
+    dword_50C9AC = 1;
+    scroll_id = pParty->pPickedItem.uItemID - 299;
+    if ( scroll_id == 30 || scroll_id == 4 || scroll_id == 91 || scroll_id == 28 ) //Enchant Item scroll, Vampiric Weapon scroll ,Recharge Item ,Fire Aura
+    {
+      pMouse->RemoveHoldingItem();
+      pGUIWindow_CurrentMenu->Release();
+      pIcons_LOD->RemoveTexturesPackFromTextureList();
+      pCurrentScreen = SCREEN_GAME;
+      viewparams->bRedrawGameUI = 1;
+      _42777D_CastSpell_UseWand_ShootArrow(scroll_id, player_num - 1, 0x85u, 1, 0);
+    }
+    else
+    {
+      _720984_unused = pParty->pPickedItem.uItemID;
+      pMouse->RemoveHoldingItem();
+      pMessageQueue_50C9E8->AddMessage(UIMSG_SpellScrollUse, scroll_id, player_num - 1);
+      if ( pCurrentScreen && pGUIWindow_CurrentMenu
+        && (pGUIWindow_CurrentMenu->eWindowType != WINDOW_null))
+      {
+        pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
+      }
+    }
+    return;
+  }
+
+  if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_BOOK )
+  {  
+      v15 = pParty->pPickedItem.uItemID - 400;
+      v72 = playerAffected->spellbook.bHaveSpell[pParty->pPickedItem.uItemID-400];//(char *)&v3->pConditions[0] + pParty->pPickedItem.uItemID + 2;
+      if ( v72 )
+      {
+        v66 = pParty->pPickedItem.GetDisplayName();
+        sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[380], v66);//"You already know the %s spell"
         ShowStatusBarString(pTmpBuf.data(), 2u);
         pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
         return;
-            }
-        if ( bUnderwater == 1 )
-            {
-            ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2u);//"You can not do that while you are underwater!"
-            pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
-            return;
-            }
-        dword_50C9AC = 1;
-        scroll_id = pParty->pPickedItem.uItemID - 299;
-        if ( scroll_id == 30 || scroll_id == 4 || scroll_id == 91 || scroll_id == 28 ) //Enchant Item scroll, Vampiric Weapon scroll ,Recharge Item ,Fire Aura
-            {
-            pMouse->RemoveHoldingItem();
-            pGUIWindow_CurrentMenu->Release();
-            pIcons_LOD->RemoveTexturesPackFromTextureList();
-            pCurrentScreen = SCREEN_GAME;
-            viewparams->bRedrawGameUI = 1;
-            _42777D_CastSpell_UseWand_ShootArrow(scroll_id, player_num - 1, 0x85u, 1, 0);
-            }
-        else
-            {
-            _720984_unused = pParty->pPickedItem.uItemID;
-            pMouse->RemoveHoldingItem();
-            pMessageQueue_50C9E8->AddMessage(UIMSG_SpellScrollUse, scroll_id, player_num - 1);
-            if ( pCurrentScreen && pGUIWindow_CurrentMenu
-                && (pGUIWindow_CurrentMenu->eWindowType != WINDOW_null))
-                {
-                pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
-                }
-            }
+      }
+      if ( !playerAffected->CanAct() )
+      {
+        v66 = aCharacterConditionNames[playerAffected->GetMajorConditionIdx()];
+        sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v66);//"That player is %s"
+        ShowStatusBarString(pTmpBuf.data(), 2u);
+        pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
         return;
-        }
-
-    if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_BOOK )
-
-        {  
-        v15 = pParty->pPickedItem.uItemID - 400;
-        v72 = v3->spellbook.bHaveSpell[pParty->pPickedItem.uItemID-400];//(char *)&v3->pConditions[0] + pParty->pPickedItem.uItemID + 2;
-        if ( v72 )
-            {
-            v66 = pParty->pPickedItem.GetDisplayName();
-            sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[380], v66);//"You already know the %s spell"
-            ShowStatusBarString(pTmpBuf.data(), 2u);
-            pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
-            return;
-            }
-        if ( !pParty->pPlayers[player_num-1].CanAct() )
-            {
-            v66 = aCharacterConditionNames[v3->GetMajorConditionIdx()];
-            sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v66);//"That player is %s"
-            ShowStatusBarString(pTmpBuf.data(), 2u);
-            pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
-            return;
-            }
-        v16 = v15 % 11 + 1;
-        v17 = v3->pActiveSkills[v15 / 11 + 12];
-        v18 = SkillToMastery(v17) - 1;
-        switch (v18)
-            {
+      }
+      v16 = v15 % 11 + 1;
+      v17 = playerAffected->pActiveSkills[v15 / 11 + 12];
+      v18 = SkillToMastery(v17) - 1;
+      switch (v18)  
+      {
         case 0: v67 = 4; break;
         case 1: v67 = 7; break;
         case 2: v67 = 10; break;
         case 3: v67 = 11; break;
         default:
-            v67 = player_num;   
-            }
+          v67 = player_num;   
+      }
   
-        if ( v16 > v67 || !v17 )
-            {
-            v22 = pParty->pPickedItem.GetDisplayName();
-            sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[381], v22); //"You don't have the skill to learn %s"
-            ShowStatusBarString(pTmpBuf.data(), 2u);
-            v3->PlaySound((PlayerSpeech)20, 0);
-            return; 
-            }
-     //   v72 = 1;
-        v3->PlaySound(SPEECH_21, 0);
-        v73 = 0;
-
-
-        if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null)
-            {
-            if ( !v73 )
-                {
-                pMouse->RemoveHoldingItem();
-                return;
-                }
-            pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
-            }
-        if ( v73 )
+      if ( v16 > v67 || !v17 )
+      {
+        v22 = pParty->pPickedItem.GetDisplayName();
+        sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[381], v22); //"You don't have the skill to learn %s"
+        ShowStatusBarString(pTmpBuf.data(), 2u);
+        playerAffected->PlaySound((PlayerSpeech)20, 0);
+        return; 
+      }
+    //   v72 = 1;
+      playerAffected->PlaySound(SPEECH_21, 0);
+      v73 = 0;
+
+
+      if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null)
+      {
+        if ( !v73 )
+        {
+          pMouse->RemoveHoldingItem();
+          return;
+        }
+        pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
+      }
+//       if ( v73 )                                                v73 is always 0 at this point
+//       {
+//         if ( pParty->bTurnBasedModeOn )
+//         {
+//           pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100;
+//           thisb->SetRecoveryTime(100);
+//           pTurnEngine->ApplyPlayerAction();
+//         }
+//         else
+//         {
+//           thisb->SetRecoveryTime(flt_6BE3A4_debug_recmod1 * 213.3333333333333);
+//         }
+//       }
+      pMouse->RemoveHoldingItem();
+      return;
+  }
+
+  if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_MESSAGE_SCROLL )
+  {
+      if ( playerAffected->CanAct() )
+      {
+          CreateMsgScrollWindow(pParty->pPickedItem.uItemID);
+          playerAffected->PlaySound(SPEECH_37, 0);
+          return;
+      }
+      v68 = aCharacterConditionNames[playerAffected->GetMajorConditionIdx()];
+      sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v68);
+      ShowStatusBarString(pTmpBuf.data(), 2u);
+      pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
+      return;
+  }
+  else
+  {
+    if (pParty->pPickedItem.uItemID == 616) //Genie Lamp
+    {
+      thisa = pParty->uCurrentMonthWeek + 1;
+      if ( pParty->uCurrentMonth >= 7 )
+          v74 = NULL;
+      else
+          v74 = aAttributeNames[pParty->uCurrentMonth];
+      switch ( pParty->uCurrentMonth )
+      {
+        case 0:
+            playerAffected->uMight += thisa;
+            sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
+            break;
+        case 1:
+            playerAffected->uIntelligence += thisa;
+            sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
+            break;
+        case 2:
+            playerAffected->uWillpower += thisa;
+            sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
+            break;
+        case 3:
+            playerAffected->uEndurance += thisa;
+            sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
+            break;
+        case 4:
+            playerAffected->uAccuracy += thisa;
+            sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
+            break;
+        case 5:
+            playerAffected->uSpeed += thisa;
+            sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
+            break;
+        case 6:
+            playerAffected->uLuck += thisa;
+            sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
+            break;
+        case 7:
+            party_finds_gold(1000 * thisa, 0);
+            sprintf(pTmpBuf.data(), "+%u %s", 1000 * thisa, pGlobalTXT_LocalizationStrings[97]);//"Gold"
+            break;
+        case 8:
+            Party::GiveFood(5 * thisa); 
+            sprintf(pTmpBuf.data(), "+%u %s",5 * thisa , pGlobalTXT_LocalizationStrings[653]);//"Food"
+            break;
+        case 9u:
+            playerAffected->uSkillPoints += 2 * thisa;
+            sprintf(pTmpBuf.data(), "+%u %s", 2 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_SKILL_POINTS]);
+            break;
+        case 10:
+            playerAffected->uExperience += 2500 * thisa;
+            sprintf(pTmpBuf.data(), "+%u %s", 2500 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_EXPIRIENCE]);
+            break;
+        case 11:
+            v8 = rand() % 6;
+            switch (v8)
             {
-            if ( pParty->bTurnBasedModeOn )
-                {
-                pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100;
-                thisb->SetRecoveryTime(100);
-                pTurnEngine->ApplyPlayerAction();
-                }
-            else
-                {
-                thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333));
-                }
+            case 0:
+                playerAffected->sResFireBase += thisa;
+                v13 = pGlobalTXT_LocalizationStrings[87];
+                break;
+            case 1:
+                playerAffected->sResAirBase += thisa;
+                v13 = pGlobalTXT_LocalizationStrings[6];
+                break;
+            case 2:
+                playerAffected->sResWaterBase += thisa;
+                v13 = pGlobalTXT_LocalizationStrings[240];
+                break;
+            case 3:
+                playerAffected->sResEarthBase += thisa;
+                v13 = pGlobalTXT_LocalizationStrings[70];
+                break;
+            case 4:
+                playerAffected->sResMindBase += thisa;
+                v13 = pGlobalTXT_LocalizationStrings[142];
+                break;
+            case 5:
+                playerAffected->sResBodyBase += thisa;
+                v13 = pGlobalTXT_LocalizationStrings[29];
+                break;
             }
-        pMouse->RemoveHoldingItem();
+            sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v13, pGlobalTXT_LocalizationStrings[121]);
+            break;
+
+      }
+      ShowStatusBarString(pTmpBuf.data(), 2u);
+      pMouse->RemoveHoldingItem();
+      pGame->pStru6Instance->SetPlayerBuffAnim(SPELL_QUEST_COMPLETED, player_num - 1);
+      playerAffected->PlaySound(SPEECH_93, 0);
+      pAudioPlayer->PlaySound((SoundID)219, 0, 0, -1, 0, 0, 0, 0);
+      if ( pParty->uDaysPlayed == 6 || pParty->uDaysPlayed == 20 )
+          {
+          playerAffected->SetCondition(Condition_Eradicated, 0);
+          pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0);
+          }
+      else if ( pParty->uDaysPlayed == 12 || pParty->uDaysPlayed == 26 )
+          {
+          playerAffected->SetCondition(Condition_Dead, 0);
+          pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0);
+          }
+      else  if ( pParty->uDaysPlayed == 4 || pParty->uDaysPlayed == 25 )
+      {
+        playerAffected->SetCondition(Condition_Pertified, 0);
+        pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0);                 
+      }
+      return;
+      }
+      else if ( pParty->pPickedItem.uItemID == 630 ) //Red Apple
+      {
+          Party::GiveFood(1u);
+          pAudioPlayer->PlaySound(SOUND_EatApple, 0, 0, -1, 0, 0, 0, 0);
+      }
+      else if ( pParty->pPickedItem.uItemID == 632 ) //Lute
+      {
+        pAudioPlayer->PlaySound(SOUND_PlayLute,  0, 0, -1, 0, 0, 0, 0);
         return;
-
-        }
-
-    if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_MESSAGE_SCROLL )
-
-        {
-        if ( pParty->pPlayers[player_num-1].CanAct() )
-            {
-            CreateMsgScrollWindow(pParty->pPickedItem.uItemID);
-            v3->PlaySound(SPEECH_37, 0);
-            return;
-            }
-        v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()];
-        sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v68);
+      }
+      else if ( pParty->pPickedItem.uItemID == 633 ) //Faerie Pipes
+      {
+        pAudioPlayer->PlaySound(SOUND_PlayFaeriePipes,  0, 0, -1, 0, 0, 0, 0);
+        return;
+      }
+      else if ( pParty->pPickedItem.uItemID == 634 ) //Gryphonheart's Trumpet
+      {
+        pAudioPlayer->PlaySound(SOUND_PlayGryphonheartsTrumpet,  0, 0, -1, 0, 0, 0, 0);
+        return;
+      }
+      else if ( pParty->pPickedItem.uItemID == 646 ) //Horseshoe
+      {
+        pGame->pStru6Instance->SetPlayerBuffAnim(SPELL_QUEST_COMPLETED, player_num - 1);
+        v5 = PID(OBJECT_Player, player_num + 49);
+        pAudioPlayer->PlaySound(SOUND_20001, v5, 0, -1, 0, 0, 0, 0);
+        playerAffected->AddVariable(VAR_NumSkillPoints, 2);
+      }
+      else if ( pParty->pPickedItem.uItemID == 650 ) //Temple in a Bottle
+      {
+        TeleportToNWCDungeon();
+        return;
+      }
+      else
+      {
+        v68 = pParty->pPickedItem.GetDisplayName();
+        sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[36],v68);//"%s can not be used that way"
         ShowStatusBarString(pTmpBuf.data(), 2u);
         pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
         return;
-        }
-    else
-    {
-      if (pParty->pPickedItem.uItemID == 616) //Genie Lamp
-      {
-            thisa = pParty->uCurrentMonthWeek + 1;
-            if ( pParty->uCurrentMonth >= 7 )
-                v74 = NULL;
-            else
-                v74 = aAttributeNames[pParty->uCurrentMonth];
-            switch ( pParty->uCurrentMonth )
-                {
-            case 0:
-                v3->uMight += thisa;
-                sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
-                break;
-            case 1:
-                v3->uIntelligence += thisa;
-                sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
-                break;
-            case 2:
-                v3->uWillpower += thisa;
-                sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
-                break;
-            case 3:
-                v3->uEndurance += thisa;
-                sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
-                break;
-            case 4:
-                v3->uAccuracy += thisa;
-               sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
-                break;
-            case 5:
-                v3->uSpeed += thisa;
-                sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
-                break;
-            case 6:
-                v3->uLuck += thisa;
-               sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
-                break;
-            case 7:
-                party_finds_gold(1000 * thisa, 0);
-                sprintf(pTmpBuf.data(), "+%u %s", 1000 * thisa, pGlobalTXT_LocalizationStrings[97]);//"Gold"
-                break;
-            case 8:
-                Party::GiveFood(5 * thisa); 
-                sprintf(pTmpBuf.data(), "+%u %s",5 * thisa , pGlobalTXT_LocalizationStrings[653]);//"Food"
-                break;
-            case 9u:
-                v3->uSkillPoints += 2 * thisa;
-                sprintf(pTmpBuf.data(), "+%u %s", 2 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_SKILL_POINTS]);
-                break;
-            case 10:
-                v3->uExperience += 2500 * thisa;
-                sprintf(pTmpBuf.data(), "+%u %s", 2500 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_EXPIRIENCE]);
-                break;
-            case 11:
-                v8 = rand() % 6;
-                switch (v8)
-                    {
-                case 0:
-                    v3->sResFireBase += thisa;
-                    v13 = pGlobalTXT_LocalizationStrings[87];
-                    break;
-                case 1:
-                    v3->sResAirBase += thisa;
-                    v13 = pGlobalTXT_LocalizationStrings[6];
-                    break;
-                case 2:
-                    v3->sResWaterBase += thisa;
-                    v13 = pGlobalTXT_LocalizationStrings[240];
-                    break;
-                case 3:
-                    v3->sResEarthBase += thisa;
-                    v13 = pGlobalTXT_LocalizationStrings[70];
-                    break;
-                case 4:
-                    v3->sResMindBase += thisa;
-                    v13 = pGlobalTXT_LocalizationStrings[142];
-                    break;
-                case 5:
-                    v3->sResBodyBase += thisa;
-                    v13 = pGlobalTXT_LocalizationStrings[29];
-                    break;
-                    }
-                sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v13, pGlobalTXT_LocalizationStrings[121]);
-                break;
-
-                }
-            ShowStatusBarString(pTmpBuf.data(), 2u);
-            pMouse->RemoveHoldingItem();
-            pGame->pStru6Instance->SetPlayerBuffAnim(SPELL_QUEST_COMPLETED, player_num - 1);
-            v3->PlaySound(SPEECH_93, 0);
-            pAudioPlayer->PlaySound((SoundID)219, 0, 0, -1, 0, 0, 0, 0);
-            if ( pParty->uDaysPlayed == 6 || pParty->uDaysPlayed == 20 )
-                {
-                v3->SetCondition(Condition_Eradicated, 0);
-                pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0);
-                }
-            else if ( pParty->uDaysPlayed == 12 || pParty->uDaysPlayed == 26 )
-                {
-                v3->SetCondition(Condition_Dead, 0);
-                pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0);
-                }
-            else  if ( pParty->uDaysPlayed == 4 || pParty->uDaysPlayed == 25 )
-                {
-                v3->SetCondition(Condition_Pertified, 0);
-                pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0);                 
-                }
-            return;
-            }
-        else if ( pParty->pPickedItem.uItemID == 630 ) //Red Apple
-        {
-            Party::GiveFood(1u);
-            pAudioPlayer->PlaySound(SOUND_EatApple, 0, 0, -1, 0, 0, 0, 0);
-        }
-        else if ( pParty->pPickedItem.uItemID == 632 ) //Lute
-                {
-                pAudioPlayer->PlaySound(SOUND_PlayLute,  0, 0, -1, 0, 0, 0, 0);
-                return;
-                }
-        else if ( pParty->pPickedItem.uItemID == 633 ) //Faerie Pipes
-                {
-                pAudioPlayer->PlaySound(SOUND_PlayFaeriePipes,  0, 0, -1, 0, 0, 0, 0);
-                return;
-                }
-        else if ( pParty->pPickedItem.uItemID == 634 ) //Gryphonheart's Trumpet
-                {
-                pAudioPlayer->PlaySound(SOUND_PlayGryphonheartsTrumpet,  0, 0, -1, 0, 0, 0, 0);
-                return;
-                }
-        else if ( pParty->pPickedItem.uItemID == 646 ) //Horseshoe
-        {
-                pGame->pStru6Instance->SetPlayerBuffAnim(SPELL_QUEST_COMPLETED, player_num - 1);
-                v5 = PID(OBJECT_Player, player_num + 49);
-                pAudioPlayer->PlaySound(SOUND_20001, v5, 0, -1, 0, 0, 0, 0);
-                v3->AddVariable(VAR_NumSkillPoints, 2);
-                }
-        else if ( pParty->pPickedItem.uItemID == 650 ) //Temple in a Bottle
-                    {
-                    TeleportToNWCDungeon();
-                    return;
-                    }
-        else
-                {
-   
-                v68 = pParty->pPickedItem.GetDisplayName();
-                sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[36],v68);//"%s can not be used that way"
-                ShowStatusBarString(pTmpBuf.data(), 2u);
-                pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
-                return;
-                }
-
-        pMouse->RemoveHoldingItem();
-        return;
-        }
-
-    }
+      }
+
+      pMouse->RemoveHoldingItem();
+      return;
+  }
+}
 
 //----- (00449BB4) --------------------------------------------------------
 bool Player::CompareVariable( enum VariableType VarNum, signed int pValue )