changeset 1032:9408f98f4929

use item cleaned
author Gloval
date Wed, 22 May 2013 00:09:14 +0400
parents f93d17337113
children aa848c90181f
files Player.cpp
diffstat 1 files changed, 160 insertions(+), 339 deletions(-) [+]
line wrap: on
line diff
--- a/Player.cpp	Tue May 21 14:34:14 2013 +0200
+++ b/Player.cpp	Wed May 22 00:09:14 2013 +0400
@@ -4531,31 +4531,25 @@
 //----- (0048EA46) --------------------------------------------------------
 int Player::_48EA46_calc_special_bonus_by_items(int a2)
 {
-  int v3; // esi@1
-  int v4; // edx@2
-  int v5; // eax@3
-  char *v6; // eax@4
-
-  v3 = 0;
-  while ( 1 )
-  {
-    if ( !HasItemEquipped((ITEM_EQUIP_TYPE)v3) )
-      goto LABEL_11;
-    v5 = pEquipment.pIndices[v3]  - 1;
-    if ( a2 != 17 )
-    {
-      if ( a2 != 24 || this->pInventoryItems[v5].uSpecEnchantmentType != 24 )
-        goto LABEL_11;
-      return 5;
-    }
-    v6 = (char *)this + 36 * v5;
-    if ( *((int *)v6 + 133) == 533 || *((int *)v6 + 136) == 17 )
-      return 50;
-LABEL_11:
-    ++v3;
-    if ( (signed int)v3 >= 16 )
-      return 0;
-  }
+  int inv_indx; // eax@3
+
+  for (int i=EQUIP_OFF_HAND; i<EQUIP_BOOK; ++i )
+      {
+      if ( !HasItemEquipped((ITEM_EQUIP_TYPE)i) )
+          continue;
+      inv_indx = pEquipment.pIndices[i]  - 1;
+      if (a2==17)
+          {
+          if ((pInventoryItems[inv_indx].uSpecEnchantmentType==17)||(pInventoryItems[inv_indx].uItemID=533)) //Elven Chainmail+Increases rate of Recovery
+              return 50;
+          }
+      if (a2==24)
+          {
+          if (pInventoryItems[inv_indx].uSpecEnchantmentType==24) //Increased Knockback.
+              return 5;
+          }
+      }
+  return 0;
 }
 
 //----- (0048EAAE) --------------------------------------------------------
@@ -6836,78 +6830,29 @@
 void Player::UseItem_DrinkPotion_etc(signed int player_num, int a3)
     {
     Player *v3; // esi@1
-    unsigned int v4; // ebx@4
     signed int v5; // eax@17
-    unsigned int v6; // eax@26
-    unsigned __int8 v7; // cf@37
     int v8; // edx@39
-    int v9; // edx@40
-    int v10; // edx@41
-    int v11; // edx@42
-    int v12; // edx@43
     char *v13; // eax@45
-    AudioPlayer *v14; // ecx@62
     signed int v15; // edi@68
     int v16; // edx@73
     unsigned __int16 v17; // edi@73
     unsigned int v18; // eax@73
-    int v19; // eax@74
-    int v20; // eax@75
-    signed int v21; // eax@81
     const char *v22; // eax@84
-    char *v23; // ecx@90
     int scroll_id; // esi@96
     int v25; // eax@109
     int v26; // eax@113
     int new_mana_val; // edi@114
     signed __int64 v28; // qax@120
-    char *v29; // ecx@120
     __int64 v30; // edi@137
-    int v31; // ST30_4@137
     __int64 v32; // ST3C_4@137
-    int v33; // ST40_4@137
     __int64 v34; // ST34_4@137
-    int v35; // ST38_4@137
-    unsigned __int8 v36; // al@173
-    SoundID v37; // [sp-20h] [bp-4Ch]@18
-    SoundID v38; // [sp-20h] [bp-4Ch]@174
-    signed int v39; // [sp-1Ch] [bp-48h]@18
-    signed int v40; // [sp-1Ch] [bp-48h]@174
-    unsigned int v41; // [sp-18h] [bp-44h]@18
-    unsigned int v42; // [sp-18h] [bp-44h]@174
-    signed int v43; // [sp-14h] [bp-40h]@18
-    signed int v44; // [sp-14h] [bp-40h]@174
-    signed int v45; // [sp-10h] [bp-3Ch]@18
-    unsigned __int16 v46; // [sp-10h] [bp-3Ch]@120
-    signed int v47; // [sp-10h] [bp-3Ch]@174
-    int v48; // [sp-Ch] [bp-38h]@18
-    unsigned int v49; // [sp-Ch] [bp-38h]@33
     unsigned __int16 v50; // [sp-Ch] [bp-38h]@120
-    int v51; // [sp-Ch] [bp-38h]@174
-    unsigned int v52; // [sp-8h] [bp-34h]@18
-    char *v53; // [sp-8h] [bp-34h]@33
-    int v54; // [sp-8h] [bp-34h]@34
-    unsigned int v55; // [sp-8h] [bp-34h]@60
-    int v56; // [sp-8h] [bp-34h]@66
-    const char *v57; // [sp-8h] [bp-34h]@69
-    const char *v58; // [sp-8h] [bp-34h]@89
-    int v59; // [sp-8h] [bp-34h]@120
-    unsigned int v60; // [sp-8h] [bp-34h]@174
-    int v61; // [sp-4h] [bp-30h]@18
-    char *v62; // [sp-4h] [bp-30h]@33
-    char *v63; // [sp-4h] [bp-30h]@34
-    int v64; // [sp-4h] [bp-30h]@60
-    int v65; // [sp-4h] [bp-30h]@66
     const char *v66; // [sp-4h] [bp-30h]@69
     signed int v67; // [sp-4h] [bp-30h]@77
     const char *v68; // [sp-4h] [bp-30h]@89
-    int v69; // [sp-4h] [bp-30h]@110
-    unsigned __int8 v70; // [sp-4h] [bp-30h]@120
-    int v71; // [sp-4h] [bp-30h]@174
     char v72; // [sp+20h] [bp-Ch]@68
     signed int v73; // [sp+24h] [bp-8h]@1
-    char *v74; // [sp+24h] [bp-8h]@23
-    int v75; // [sp+24h] [bp-8h]@73
+    char*  v74; // [sp+24h] [bp-8h]@23
     Player *thisb; // [sp+28h] [bp-4h]@1
     unsigned int thisa; // [sp+28h] [bp-4h]@22
 
@@ -6916,7 +6861,6 @@
     v73 = 1;
     if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3) )
         return;
-    v4 = 0;
     if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_REAGENT )
         {
         if ( pParty->pPickedItem.uItemID == 160 )
@@ -6940,13 +6884,33 @@
         else
             {    
             v68 = pParty->pPickedItem.GetDisplayName();
-            v58 = pGlobalTXT_LocalizationStrings[36];//"%s can not be used that way"
-            sprintfex(pTmpBuf, v58, v68);
+            sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[36], v68);//"%s can not be used that way"
             ShowStatusBarString(pTmpBuf, 2);
             pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
             return;
             }
-        goto LABEL_173;
+        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->_40471C();
+                }
+            else
+                {
+                thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333));
+                }
+            }
+        pMouse->RemoveHoldingItem();
+        return;
+
 
         }
     if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_POTION )
@@ -7008,13 +6972,13 @@
             v3->PlaySound(SPEECH_36, 0);
             break;
         case 231: //Preservation
-            v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType);
+            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 * LOWORD(pParty->pPickedItem.uEnchantmentType);
+            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);
@@ -7041,37 +7005,37 @@
             v3->PlaySound(SPEECH_36, 0);
             break;
         case 240: //Might Boost
-            v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType);
+            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 * LOWORD(pParty->pPickedItem.uEnchantmentType);
+            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 * LOWORD(pParty->pPickedItem.uEnchantmentType);
+            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 * LOWORD(pParty->pPickedItem.uEnchantmentType);
+            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 * LOWORD(pParty->pPickedItem.uEnchantmentType);
+            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 * LOWORD(pParty->pPickedItem.uEnchantmentType);
+            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);
@@ -7104,43 +7068,43 @@
             v3->PlaySound(SPEECH_36, 0);
             break;
         case 255: //Luck Boost
-            v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType);
+            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 * LOWORD(pParty->pPickedItem.uEnchantmentType);
+            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);
-            goto LABEL_173;
+            break;
         case 257: //Air Resistance
-            v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType);
+            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 * LOWORD(pParty->pPickedItem.uEnchantmentType);
+            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 * LOWORD(pParty->pPickedItem.uEnchantmentType);
+            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 * LOWORD(pParty->pPickedItem.uEnchantmentType);
+            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 * LOWORD(pParty->pPickedItem.uEnchantmentType);
+            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);
@@ -7212,15 +7176,37 @@
 
         default:
             v68 = pParty->pPickedItem.GetDisplayName();
-            v58 = pGlobalTXT_LocalizationStrings[36];  //"%s can not be used that way"
-            sprintfex(pTmpBuf, v58, v68);
+            sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[36], v68);//"%s can not be used that way"
             ShowStatusBarString(pTmpBuf, 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);
             }
-       // pParty->pPlayers[player_num-1].SetCondition(Condition_Poison1, 1);
-        goto LABEL_173;
+        if ( v73 )
+            {
+            if ( pParty->bTurnBasedModeOn )
+                {
+                pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100;
+                thisb->SetRecoveryTime(100);
+                pTurnEngine->_40471C();
+                }
+            else
+                {
+                thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333));
+                }
+            }
+        pMouse->RemoveHoldingItem();
+        return;
+    
         }
 
 
@@ -7233,39 +7219,16 @@
         if ( !pParty->pPlayers[player_num-1].CanAct() )
             {
 
-            
             v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()];
-        v58 = pGlobalTXT_LocalizationStrings[382];
-        sprintfex(pTmpBuf, v58, v68);
-        v23 = pTmpBuf;
-
-        ShowStatusBarString(v23, 2u);
-        v4 = 0;
-        v61 = v4;
-        v52 = v4;
-        v48 = v4;
-        v45 = v4;
-        v43 = -1;
-        v41 = v4;
-        v39 = v4;
-        v37 = (SoundID)27;
-        pAudioPlayer->PlaySound(v37, v39, v41, v43, v45, v48, v52, v61);
+        sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[382], v68);
+        ShowStatusBarString(pTmpBuf, 2u);
+        pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
         return;
             }
         if ( bUnderwater == 1 )
             {
-            v23 = pGlobalTXT_LocalizationStrings[652]; //"You can not do that while you are underwater!"
-            ShowStatusBarString(v23, 2u);
-            v4 = 0;
-            v61 = v4;
-            v52 = v4;
-            v48 = v4;
-            v45 = v4;
-            v43 = -1;
-            v41 = v4;
-            v39 = v4;
-            v37 = (SoundID)27;
-            pAudioPlayer->PlaySound(v37, v39, v41, v43, v45, v48, v52, v61);
+            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;
@@ -7301,143 +7264,70 @@
         if ( v72 )
             {
             v66 = pParty->pPickedItem.GetDisplayName();
-            v57 = pGlobalTXT_LocalizationStrings[380];//"You already know the %s spell"
-LABEL_72:
-            sprintf(pTmpBuf, v57, v66);
+            sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[380], v66);//"You already know the %s spell"
             ShowStatusBarString(pTmpBuf, 2u);
-LABEL_92:
-            v61 = v4;
-            v52 = v4;
-            v48 = v4;
-            v45 = v4;
-            v43 = -1;
-            v41 = v4;
-            v39 = v4;
-            v37 = (SoundID)27;
-LABEL_93:
-            v14 = pAudioPlayer;
-LABEL_63:
-            pAudioPlayer->PlaySound(v37, v39, v41, v43, v45, v48, v52, v61);
+            pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
             return;
             }
         if ( !pParty->pPlayers[player_num-1].CanAct() )
             {
             v66 = aCharacterConditionNames[v3->GetMajorConditionIdx()];
-            v57 = pGlobalTXT_LocalizationStrings[382];//"That player is %s"
-            sprintf(pTmpBuf, v57, v66);
+            sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[382], v66);//"That player is %s"
             ShowStatusBarString(pTmpBuf, 2u);
-            v61 = v4;
-            v52 = v4;
-            v48 = v4;
-            v45 = v4;
-            v43 = -1;
-            v41 = v4;
-            v39 = v4;
-            v37 = (SoundID)27;
-            v14 = pAudioPlayer;
-            pAudioPlayer->PlaySound(v37, v39, v41, v43, v45, v48, v52, v61);
+            pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
             return;
             }
         v16 = v15 % 11 + 1;
         v17 = v3->pActiveSkills[v15 / 11 + 12];
-        v75 = v16;
         v18 = SkillToMastery(v17) - 1;
-        if ( v18 )
+        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;   
+            }
+  
+        if ( v16 > v67 || !v17 )
             {
-            v19 = v18 - 1;
-            if ( v19 )
+            v22 = pParty->pPickedItem.GetDisplayName();
+            sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[381], v22); //"You don't have the skill to learn %s"
+            ShowStatusBarString(pTmpBuf, 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 )
                 {
-                v20 = v19 - 1;
-                if ( v20 )
-                    {
-                    if ( v20 != 1 )
-                        {
-                        v21 = player_num;
-LABEL_83:
-                        if ( v75 > v21 || !v17 )
-                            {
-                            v22 = pParty->pPickedItem.GetDisplayName();
-                            sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[381], v22);
-                            ShowStatusBarString(pTmpBuf, 2u);
-                            v3->PlaySound((PlayerSpeech)20, 0);
-                            return; 
-                            }
-                        v72 = 1;
-                        v3->PlaySound(SPEECH_21, 0);
-                        v73 = 0;
-LABEL_173:
-                        v36 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType;
-                        if ( v36 == EQUIP_POTION )
-                            {
-                            v71 = 0;
-                            v60 = 0;
-                            v51 = 0;
-                            v47 = 0;
-                            v44 = -1;
-                            v42 = 0;
-                            v40 = 0;
-                            v38 = (SoundID)210;
-                            }
-                        else
-                            {
-                            if ( v36 != EQUIP_REAGENT )
-                                {
-LABEL_178:
-                                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->field_16140 + player_num) = 100;
-                                        thisb->SetRecoveryTime(100);
-                                        pTurnEngine->_40471C();
-                                        }
-                                    else
-                                        {
-                                        thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333));
-                                        }
-                                    }
-                                pMouse->RemoveHoldingItem();
-                                return;
-                                }
-                            v71 = 0;
-                            v60 = 0;
-                            v51 = 0;
-                            v47 = 0;
-                            v44 = -1;
-                            v42 = 0;
-                            v40 = 0;
-                            v38 = (SoundID)211;
-                            }
-                        pAudioPlayer->PlaySound(v38, v40, v42, v44, v47, v51, v60, v71);
-                        goto LABEL_178;
-                        }
-                    v67 = 11;
-                    }
-                else
-                    {
-                    v67 = 10;
-                    }
+                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->_40471C();
                 }
             else
                 {
-                v67 = 7;
+                thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333));
                 }
             }
-        else
-            {
-            v67 = 4;
-            }
-        v21 = v67;
-        goto LABEL_83;
+        pMouse->RemoveHoldingItem();
+        return;
+
         }
 
     if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_MESSAGE_SCROLL )
@@ -7446,30 +7336,13 @@
         if ( pParty->pPlayers[player_num-1].CanAct() )
             {
             CreateMsgScrollWindow(pParty->pPickedItem.uItemID);
-            v65 = 0;
-            v56 = SPEECH_37;
-LABEL_67:
-            v3->PlaySound((PlayerSpeech)v56, v65);
+            v3->PlaySound(SPEECH_37, 0);
             return;
             }
-LABEL_89:
         v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()];
-        v58 = pGlobalTXT_LocalizationStrings[382];
-LABEL_90:
-        sprintfex(pTmpBuf, v58, v68);
-        v23 = pTmpBuf;
-LABEL_91:
-        ShowStatusBarString(v23, 2u);
-        v4 = 0;
-        v61 = v4;
-        v52 = v4;
-        v48 = v4;
-        v45 = v4;
-        v43 = -1;
-        v41 = v4;
-        v39 = v4;
-        v37 = (SoundID)27;
-        pAudioPlayer->PlaySound(v37, v39, v41, v43, v45, v48, v52, v61);
+        sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[382], v68);
+        ShowStatusBarString(pTmpBuf, 2u);
+        pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
         return;
         }
     else
@@ -7478,90 +7351,54 @@
             {
             thisa = pParty->uCurrentMonthWeek + 1;
             if ( pParty->uCurrentMonth >= 7 )
-                v74 = 0;
+                v74 = NULL;
             else
                 v74 = aAttributeNames[pParty->uCurrentMonth];
             switch ( pParty->uCurrentMonth )
                 {
             case 0:
-                v6 = pParty->uCurrentMonthWeek + 1;
                 v3->uMight += thisa;
-                v62 = pGlobalTXT_LocalizationStrings[121]; //"Permanent"	
-                v53 = v74;
-                v49 = v6;
-                sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62);
+                sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
                 break;
             case 1:
-                v6 = pParty->uCurrentMonthWeek + 1;
                 v3->uIntelligence += thisa;
-                v62 = pGlobalTXT_LocalizationStrings[121];
-                v53 = v74;
-                v49 = v6;
-                sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62);
+                sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
                 break;
             case 2:
-                v6 = pParty->uCurrentMonthWeek + 1;
                 v3->uWillpower += thisa;
-                v62 = pGlobalTXT_LocalizationStrings[121];
-                v53 = v74;
-                v49 = v6;
-                sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62);
+                sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
                 break;
             case 3:
-                v6 = pParty->uCurrentMonthWeek + 1;
                 v3->uEndurance += thisa;
-                v62 = pGlobalTXT_LocalizationStrings[121];
-                v53 = v74;
-                v49 = v6;
-                sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62);
+                sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
                 break;
             case 4:
-                v6 = pParty->uCurrentMonthWeek + 1;
                 v3->uAccuracy += thisa;
-                v62 = pGlobalTXT_LocalizationStrings[121];
-                v53 = v74;
-                v49 = v6;
-                sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62);
+               sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
                 break;
             case 5:
-                v6 = pParty->uCurrentMonthWeek + 1;
                 v3->uSpeed += thisa;
-                v62 = pGlobalTXT_LocalizationStrings[121];
-                v53 = v74;
-                v49 = v6;
-                sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62);
+                sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
                 break;
             case 6:
-                v6 = pParty->uCurrentMonthWeek + 1;
                 v3->uLuck += thisa;
-                v62 = pGlobalTXT_LocalizationStrings[121];
-                v53 = v74;
-                v49 = v6;
-                sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62);
+               sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
                 break;
             case 7:
                 party_finds_gold(1000 * thisa, 0);
-                v63 = pGlobalTXT_LocalizationStrings[97];//"Gold"
-                v54 = 1000 * thisa;
-                sprintf(pTmpBuf, "+%u %s", v54, v63);
+                sprintf(pTmpBuf, "+%u %s", 1000 * thisa, pGlobalTXT_LocalizationStrings[97]);//"Gold"
                 break;
             case 8:
                 Party::GiveFood(5 * thisa); 
-                v63 = pGlobalTXT_LocalizationStrings[653]; //"Food"
-                v54 = 5 * thisa;
-                sprintf(pTmpBuf, "+%u %s", v54, v63);
+                sprintf(pTmpBuf, "+%u %s",5 * thisa , pGlobalTXT_LocalizationStrings[653]);//"Food"
                 break;
             case 9u:
-                v63 = pGlobalTXT_LocalizationStrings[LOCSTR_SKILL_POINTS];
                 v3->uSkillPoints += 2 * thisa;
-                v54 = 2 * thisa;
-                sprintf(pTmpBuf, "+%u %s", v54, v63);
+                sprintf(pTmpBuf, "+%u %s", 2 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_SKILL_POINTS]);
                 break;
             case 10:
-                v63 = pGlobalTXT_LocalizationStrings[LOCSTR_EXPIRIENCE];
-                v54 = 2500 * thisa;
                 v3->uExperience += 2500 * thisa;
-                sprintf(pTmpBuf, "+%u %s", v54, v63);
+                sprintf(pTmpBuf, "+%u %s", 2500 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_EXPIRIENCE]);
                 break;
             case 11:
                 v8 = rand() % 6;
@@ -7592,10 +7429,7 @@
                     v13 = pGlobalTXT_LocalizationStrings[29];
                     break;
                     }
-                v62 = pGlobalTXT_LocalizationStrings[121];
-                v53 = v13;
-                v49 = thisa;
-                sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62);
+                sprintf(pTmpBuf, "+%u %s %s", thisa, v13, pGlobalTXT_LocalizationStrings[121]);
                 break;
 
                 }
@@ -7603,7 +7437,7 @@
             pMouse->RemoveHoldingItem();
             pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, player_num - 1);
             v3->PlaySound(SPEECH_93, 0);
-            pAudioPlayer->PlaySound((SoundID)(SOUND_Bell|0x2), 0, 0, -1, 0, 0, 0, 0);
+            pAudioPlayer->PlaySound((SoundID)219, 0, 0, -1, 0, 0, 0, 0);
             if ( pParty->uDaysPlayed == 6 || pParty->uDaysPlayed == 20 )
                 {
                 v3->SetCondition(Condition_Eradicated, 0);
@@ -7642,11 +7476,10 @@
                 pAudioPlayer->PlaySound((SoundID)135,  0, 0, -1, 0, 0, 0, 0);
                 return;
                 }
-        else if ( pParty->pPickedItem.uItemID == 646 )
+        else if ( pParty->pPickedItem.uItemID == 646 ) //Horseshoe
                 {
                 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, player_num - 1);
-                v5 = 8 * player_num + 392;
-                LOBYTE(v5) = PID(OBJECT_Player,player_num - 120);
+                v5 = PID(OBJECT_Player,player_num + 49);
                 pAudioPlayer->PlaySound(SOUND_20001, v5, 0, -1, 0, 0, 0, 0);
                 v3->AddVariable(VAR_NumSkillPoints, 2);
                 }
@@ -7659,24 +7492,12 @@
                 {
    
                 v68 = pParty->pPickedItem.GetDisplayName();
-                v58 = pGlobalTXT_LocalizationStrings[36];
-                sprintfex(pTmpBuf, v58, v68);
-                v23 = pTmpBuf;
-                ShowStatusBarString(v23, 2u);
-                v4 = 0;
-                v61 = v4;
-                v52 = v4;
-                v48 = v4;
-                v45 = v4;
-                v43 = -1;
-                v41 = v4;
-                v39 = v4;
-                v37 = (SoundID)27;
-                pAudioPlayer->PlaySound(v37, v39, v41, v43, v45, v48, v52, v61);
+                sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[36],v68);//"%s can not be used that way"
+                ShowStatusBarString(pTmpBuf, 2u);
+                pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
                 return;
                 }
-   
-LABEL_187:
+
         pMouse->RemoveHoldingItem();
         return;
         }