changeset 1733:dc5f145b3d5d

alchemy fix
author Ritor1
date Thu, 26 Sep 2013 14:17:25 +0600
parents 79b9306f573a
children cacde83196e4
files UI/UIPopup.cpp
diffstat 1 files changed, 168 insertions(+), 191 deletions(-) [+]
line wrap: on
line diff
--- a/UI/UIPopup.cpp	Wed Sep 25 17:31:39 2013 +0600
+++ b/UI/UIPopup.cpp	Thu Sep 26 14:17:25 2013 +0600
@@ -1587,26 +1587,13 @@
 //----- (00416196) --------------------------------------------------------
 void Inventory_ItemPopupAndAlchemy()
 {
-  int v14; // edx@25
-  unsigned int v15; // edi@25
-  signed int v16; // edx@27
-  int v17; // eax@54
-  unsigned int v18; // edx@57
-  int v19; // eax@65
-  int v20; // edi@67
-  int v21; // eax@72
-  int v22; // ecx@74
-  int v23; // edx@78
-  int v24; // eax@79
-  int v25; // eax@80
-  int v26; // eax@84
-  ItemGen *v27; // esi@98
+  int potion1_id; // edx@25
+  unsigned int potion2_id; // edi@25
+  signed int potionID; // edx@27
+  unsigned int pOut_y; // edx@57
   double v31; // st7@112
-  double v36; // st7@132
-  signed __int64 v37; // qax@135
   Vec3_int_ v39; // [sp-18h] [bp-A8h]@83
   GUIWindow message_window; // [sp+Ch] [bp-84h]@137
-  int v45; // [sp+64h] [bp-2Ch]@10
   POINT a2; // [sp+78h] [bp-18h]@2
   unsigned int damage_level; // [sp+8Ch] [bp-4h]@23
 
@@ -1617,7 +1604,7 @@
   int item_pid = (pRenderer->pActiveZBuffer[a2.x + pSRZBufferLineOffsets[a2.y]] & 0xFFFF) - 1;
   auto item = &pPlayers[uActiveCharacter]->pInventoryItemList[item_pid];
 
-  if (a2.x <= 13 || a2.x >= 462)
+  if (a2.x <= 13 || a2.x >= 462)//items out of inventory(вещи вне инвентаря)
   {
     GameUI_DrawItemInfo(item);
     return;
@@ -1660,7 +1647,7 @@
   }
 
   int alchemy_skill_points = (int8_t)pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_ALCHEMY) & 0x3F;
-  int alchemy_skill_level = SkillToMastery(pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_ALCHEMY)) - 1;
+  int alchemy_skill_level = SkillToMastery(pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_ALCHEMY));
 
 // for potion bottle(простая бутылка)
   if (pParty->pPickedItem.uItemID == ITEM_POTION_BOTTLE)
@@ -1671,9 +1658,7 @@
 //for recharge potion(зелье перезарядка)
   if (pParty->pPickedItem.uItemID == ITEM_POTION_RECHARGE_ITEM)
   {
-    if (item->uItemID != ITEM_POTION_BOTTLE &&     // cant recharge bottle
-        item->uItemID < ITEM_POTION_CATALYST &&    // cant recharge
-        item->uItemID > ITEM_POTION_REJUVENATION)  //              all potions
+    if (item->uItemID < ITEM_POTION_BOTTLE || item->uItemID > ITEM_POTION_REJUVENATION)// all potions
     {
       if (item->GetItemEquipType() != EQUIP_WAND) // can recharge only wands
       {
@@ -1681,12 +1666,11 @@
         return;
       }
 
-      v36 = (70.0 - (double)pParty->pPickedItem.uEnchantmentType) * 0.01;
-      if ( v36 < 0.0 )
-        v36 = 0.0;
-      v37 = (signed __int64)((double)item->uMaxCharges - v36 * (double)item->uMaxCharges);
-      item->uMaxCharges = v37;
-      item->uNumCharges = v37;
+      v31 = (70.0 - (double)pParty->pPickedItem.uEnchantmentType) * 0.01;
+      if ( v31 < 0.0 )
+        v31 = 0.0;
+      item->uMaxCharges = (signed __int64)((double)item->uMaxCharges - v31 * (double)item->uMaxCharges);
+      item->uNumCharges = (signed __int64)((double)item->uMaxCharges - v31 * (double)item->uMaxCharges);
 
       pMouse->RemoveHoldingItem();
       no_rightlick_in_inventory = 1;
@@ -1698,9 +1682,7 @@
 // for harden potion(зелье закалка)
   else if (pParty->pPickedItem.uItemID == ITEM_POTION_HARDEN_ITEM)
   {
-    if (item->uItemID != ITEM_POTION_BOTTLE &&        // cant harden bottle
-        item->uItemID < ITEM_POTION_CATALYST &&       // cant harden
-        item->uItemID > ITEM_POTION_REJUVENATION)     //              all potions
+    if (item->uItemID < ITEM_POTION_BOTTLE || item->uItemID > ITEM_POTION_REJUVENATION) // bottle and all potions
     {
       if (item->IsBroken() ||                         // cant harden broken items
           item->uItemID >= ITEM_ARTIFACT_PUCK ||      // cant harden artifacts
@@ -1723,13 +1705,10 @@
     return;
   }
 // several potions(несколько зелий)
-  else if (pParty->pPickedItem.uItemID >= ITEM_POTION_FLAMING_POTION &&
-           pParty->pPickedItem.uItemID <= ITEM_POTION_SWIFT_POTION ||
+  else if (pParty->pPickedItem.uItemID >= ITEM_POTION_FLAMING_POTION && pParty->pPickedItem.uItemID <= ITEM_POTION_SWIFT_POTION ||
            pParty->pPickedItem.uItemID == ITEM_POTION_SLAYING_POTION)
   {
-    if (item->uItemID != ITEM_POTION_BOTTLE &&        // cant enchant bottle
-        item->uItemID < ITEM_POTION_CATALYST &&       // cant enchant
-        item->uItemID > ITEM_POTION_REJUVENATION)     //              all potions
+    if ( item->uItemID < ITEM_POTION_BOTTLE || item->uItemID > ITEM_POTION_REJUVENATION) // all potions
     {
       if (item->uItemID >= ITEM_BLASTER && item->uItemID <= ITEM_LASER_RIFLE ||
           item->uItemID >= ITEM_ARTIFACT_PUCK ||
@@ -1761,8 +1740,8 @@
         v31 = (double)(1800 * pParty->pPickedItem.uEnchantmentType * 128);
       }
 
-      v27->uExpireTime = pParty->uTimePlayed + v31 * 0.033333335;
-      v27->uAttributes = alchemy_skill_level | 0x18;
+      item->uExpireTime = pParty->uTimePlayed + v31 * 0.033333335;
+      item->uAttributes = alchemy_skill_level | 0x18;
 
       _50C9A8_item_enchantment_timer = 256;
       pMouse->RemoveHoldingItem();
@@ -1819,202 +1798,200 @@
     }
     return;
   }
-
 //potions mixing(смешивание двух зелий)
-  if (pParty->pPickedItem.uItemID < ITEM_REAGENT_WIDOWSWEEP_BERRIES ||
-      pParty->pPickedItem.uItemID > ITEM_REAGENT_PHILOSOPHERS_STONE ||
-      pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID != ITEM_POTION_BOTTLE)
+  if (pParty->pPickedItem.uItemID >= ITEM_POTION_CATALYST && pParty->pPickedItem.uItemID <= ITEM_POTION_REJUVENATION &&
+      pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID >= ITEM_POTION_CATALYST &&
+      pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID <= ITEM_POTION_REJUVENATION)
   {
-    if (pParty->pPickedItem.uItemID < ITEM_POTION_CATALYST ||
-        pParty->pPickedItem.uItemID > ITEM_POTION_REJUVENATION ||
-        pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID < ITEM_POTION_CATALYST ||
-        pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID > ITEM_POTION_REJUVENATION)
-    {
-      if (pParty->pPickedItem.uItemID != ITEM_POTION_HARDEN_ITEM &&
-          (pParty->pPickedItem.uItemID < ITEM_POTION_FLAMING_POTION || pParty->pPickedItem.uItemID > ITEM_POTION_SWIFT_POTION) &&
-          pParty->pPickedItem.uItemID != ITEM_POTION_SLAYING_POTION &&
-          pParty->pPickedItem.uItemID != ITEM_POTION_RECHARGE_ITEM)
-       GameUI_DrawItemInfo(item);
-       return;
-    }
-
-    // src not reagent,  dst not bottle
-    // src potion,       dst potion
-
-    v14 = item->uItemID - ITEM_POTION_CURE_WOUNDS;
-    v15 = pParty->pPickedItem.uItemID - ITEM_POTION_CURE_WOUNDS;
+    potion1_id = item->uItemID - ITEM_POTION_CURE_WOUNDS;
+    potion2_id = pParty->pPickedItem.uItemID - ITEM_POTION_CURE_WOUNDS;
 
     if ( pParty->pPickedItem.uItemID == ITEM_POTION_CATALYST || item->uItemID == ITEM_POTION_CATALYST )
-      v16 = 5;
+      potionID = 5;
     else
-      v16 = pItemsTable->potion_data[v15][v14 + 2];
-    damage_level = v16;
+      potionID = pItemsTable->potion_data[potion2_id][potion1_id];
+    damage_level = 0;
     if ( alchemy_skill_points )
     {
-      if ( v16 < ITEM_POTION_CURE_DISEASE || v16 > ITEM_POTION_AWAKEN )//< 225 >227
+      if ( potionID < ITEM_POTION_CURE_DISEASE || potionID > ITEM_POTION_AWAKEN )//< 225 >227
       {
-        if ( v16 >= ITEM_POTION_HASTE && v16 <= ITEM_POTION_CURE_INSANITY )//228 >= v16 <= 239
-        {
-          if ( alchemy_skill_points == 1 )
-            damage_level = 2;
-        }
-        if ( v16 >= ITEM_POTION_MIGHT_BOOST && v16 <= ITEM_POTION_BODY_RESISTANE )//240 >= v16 <= 261
-        {
-          if ( alchemy_skill_points <= 2 )
-            damage_level = 3;
-        }
-        if ( v16 >= ITEM_POTION_STONE_TO_FLESH && alchemy_skill_points != 4 )//>= 262
+        if ( potionID >= ITEM_POTION_HASTE && potionID <= ITEM_POTION_CURE_INSANITY && alchemy_skill_level == 1)//228 >= potionID <= 239
+          damage_level = 2;
+        if ( potionID >= ITEM_POTION_MIGHT_BOOST && potionID <= ITEM_POTION_BODY_RESISTANE && alchemy_skill_level <= 2)//240 >= potionID <= 261
+          damage_level = 3;
+        if ( potionID >= ITEM_POTION_STONE_TO_FLESH && alchemy_skill_level <= 3 )// 262 < potionID
           damage_level = 4;
       }
     }
-    else
+    else//no skill(нет навыка)
     {
-      if ( v16 >= ITEM_POTION_CURE_DISEASE && v16 <= ITEM_POTION_AWAKEN )//225 <= v16 <= 227
+      if ( potionID >= ITEM_POTION_CURE_DISEASE && potionID <= ITEM_POTION_AWAKEN )//225 <= v16 <= 227
         damage_level = 1;
-      if ( v16 >= ITEM_POTION_HASTE && v16 <= ITEM_POTION_CURE_INSANITY )//228 <= v16 <= 239
+      if ( potionID >= ITEM_POTION_HASTE && potionID <= ITEM_POTION_CURE_INSANITY )//228 <= v16 <= 239
         damage_level = 2;
-      if ( v16 >= ITEM_POTION_MIGHT_BOOST && v16 <= ITEM_POTION_BODY_RESISTANE )//240 <= v16 <= 261
+      if ( potionID >= ITEM_POTION_MIGHT_BOOST && potionID <= ITEM_POTION_BODY_RESISTANE )//240 <= v16 <= 261
         damage_level = 3;
-      if ( v16 >= ITEM_POTION_STONE_TO_FLESH )//262 <= v16
+      if ( potionID >= ITEM_POTION_STONE_TO_FLESH )//262 <= v16
         damage_level = 4;
     }
-    int pOut_y = 0;
+    
     int pOut_x = item_pid + 1;
-    v17 = (int)pPlayers[uActiveCharacter]->pInventoryMatrix;
-    while ( *(int *)v17 != pOut_x )
+    for ( uint i = 0; i < 126; ++i )
     {
-      ++pOut_y;
-      v17 += 4;
-      if ( pOut_y >= 126 )
+      if ( pPlayers[uActiveCharacter]->pInventoryMatrix[i] == pOut_x )
       {
-        v18 = pOut_y;
-        goto LABEL_59;
+        pOut_y = i;
+        break;
       }
     }
-    v18 = pOut_y;
-LABEL_59:
-    if ( !damage_level )
+    if ( !potionID )
     {
       GameUI_DrawItemInfo(item);
       return;
     }
     if ( damage_level == 1 )
     {
-      pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v18);
-      v26 = rand();
-      pPlayers[uActiveCharacter]->ReceiveDamage(v26 % 11 + 10, DMGT_FIRE);
+      pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(pOut_y);
+      pPlayers[uActiveCharacter]->ReceiveDamage(rand() % 11 + 10, DMGT_FIRE);
+      pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0);
+      pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
+      v39.z = pParty->vPosition.z + pParty->sEyelevel;
+      v39.x = pParty->vPosition.x;
+      v39.y = pParty->vPosition.y;
+
+      int rot_x, rot_y, rot_z;
+      Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, &rot_x, &rot_y, &rot_z);
+      sub_42F7EB_DropItemAt(0x41Bu, rot_x, rot_y, rot_z, 0, 1, 0, 0, 0);
+      if ( dword_4E455C )
+      {
+        if ( pPlayers[uActiveCharacter]->CanAct() )
+          pPlayers[uActiveCharacter]->PlaySound(SPEECH_17, 0);
+        ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2);//Ой!
+        dword_4E455C = 0;
+      }
+      pMouse->RemoveHoldingItem();
+      no_rightlick_in_inventory = 1;
+      return;
+    }
+    if ( damage_level == 2 )
+    {
+      pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(pOut_y);
+      pPlayers[uActiveCharacter]->ReceiveDamage(rand() % 71 + 30, DMGT_FIRE);
+      pPlayers[uActiveCharacter]->ItemsEnchant(1);
+      pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0);
+      pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
+
+      v39.z = pParty->vPosition.z + pParty->sEyelevel;
+      v39.x = pParty->vPosition.x;
+      v39.y = pParty->vPosition.y;
+
+      int rot_x, rot_y, rot_z;
+      Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, &rot_x, &rot_y, &rot_z);
+      sub_42F7EB_DropItemAt(0x41Bu, rot_x, rot_y, rot_z, 0, 1, 0, 0, 0);
+      if ( dword_4E455C )
+      {
+        if ( pPlayers[uActiveCharacter]->CanAct() )
+          pPlayers[uActiveCharacter]->PlaySound(SPEECH_17, 0);
+        ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2);//Ой!
+        dword_4E455C = 0;
+      }
+      pMouse->RemoveHoldingItem();
+      no_rightlick_in_inventory = 1;
+      return;
+    }
+    if ( damage_level == 3 )
+    {
+      pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(pOut_y);
+      pPlayers[uActiveCharacter]->ReceiveDamage(rand() % 201 + 50, DMGT_FIRE);
+      pPlayers[uActiveCharacter]->ItemsEnchant(5);
       pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0);
 
       pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
 
       v39.z = pParty->vPosition.z + pParty->sEyelevel;
-    }
-    else
-    {
-      if ( damage_level == 2 )
-      {
-        pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v18);
-        v25 = rand();
-        pPlayers[uActiveCharacter]->ReceiveDamage(v25 % 71 + 30, DMGT_FIRE);
-        v23 = 1;
-      }
-      else
+      v39.x = pParty->vPosition.x;
+      v39.y = pParty->vPosition.y;
+
+      int rot_x, rot_y, rot_z;
+      Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, &rot_x, &rot_y, &rot_z);
+      sub_42F7EB_DropItemAt(0x41Bu, rot_x, rot_y, rot_z, 0, 1, 0, 0, 0);
+      if ( dword_4E455C )
       {
-        if ( damage_level == 3 )
-        {
-          pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v18);
-          v24 = rand();
-          pPlayers[uActiveCharacter]->ReceiveDamage(v24 % 201 + 50, DMGT_FIRE);
-          v23 = 5;
-        }
-        else
-        {
-          if ( damage_level != 4 )
-          {
-            if ( damage_level != 5 )
-            {
-              v19 = pPlayers[uActiveCharacter]->AddItem(-1, 0xDCu);
-              if ( v19 )
-                 pPlayers[uActiveCharacter]->pOwnItems[v19-1].uAttributes = ITEM_IDENTIFIED;
-              v20 = v14 + 50 * v15;
-              pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = damage_level;
-              pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType = (pParty->pPickedItem.uEnchantmentType
-                                                       + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType)
-                                                      / 2;
-              pPlayers[uActiveCharacter]->SetVariable(VAR_AutoNotes, *(short *)&pItemsTable->potion_note[2 * v20 ]);//field_10168  + 388
-              v22 = (int)((char *)pPlayers[uActiveCharacter] + 36 * item_pid);
-              if ( !(pItemsTable->pItems[*(int *)(v22 + 532) ].uItemID_Rep_St) )
-                *(int *)(v22 + 552) |= 1u;
-              if ( !dword_4E455C )
-			  {
-				pMouse->RemoveHoldingItem();
-				no_rightlick_in_inventory = 1;
-				return;
-			  }
-              pPlayers[uActiveCharacter]->PlaySound(SPEECH_DO_POTION_FINE, 0);
-			  dword_4E455C = 0;
-			  pMouse->RemoveHoldingItem();
-			  no_rightlick_in_inventory = 1;
-			  return;
-            }
-            if ( alchemy_skill_points )
-            {
-              if ( *(int *)(pPlayers[uActiveCharacter] + 36 * item_pid + 532) == 221 )
-                *(int *)(pPlayers[uActiveCharacter] + 36 * item_pid + 532) = pParty->pPickedItem.uItemID;
-              else
-                *(int *)(pPlayers[uActiveCharacter] + 36 * item_pid + 536) = pParty->pPickedItem.uEnchantmentType;
-              v21 = pPlayers[uActiveCharacter]->AddItem(-1, 0xDCu);
-              if ( v21 )
-                //*(int *)&v0->field_1F5[36 * v21 + 15] = 1;
-                pPlayers[uActiveCharacter]->pOwnItems[v21-1].uAttributes=ITEM_IDENTIFIED;
-              v22 = (int)((char *)pPlayers[uActiveCharacter] + 36 * item_pid);
-              if ( !(pItemsTable->pItems[*(int *)(v22 + 532) ].uItemID_Rep_St) )
-                *(int *)(v22 + 552) |= 1u;
-              if ( !dword_4E455C )
-              {
-                pMouse->RemoveHoldingItem();
-                no_rightlick_in_inventory = 1;
-                return;
-              }
-              pPlayers[uActiveCharacter]->PlaySound(SPEECH_DO_POTION_FINE, 0);
-              dword_4E455C = 0;
-              pMouse->RemoveHoldingItem();
-              no_rightlick_in_inventory = 1;
-              return;
-            }
-            GameUI_DrawItemInfo(item);
-            return;
-          }
-          pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v18);
-          pPlayers[uActiveCharacter]->SetCondition(0x10u, 0);
-          v23 = 0;
-        }
+        if ( pPlayers[uActiveCharacter]->CanAct() )
+          pPlayers[uActiveCharacter]->PlaySound(SPEECH_17, 0);
+        ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2);//Ой!
+        dword_4E455C = 0;
       }
-      pPlayers[uActiveCharacter]->ItemsEnchant(v23);
+      pMouse->RemoveHoldingItem();
+      no_rightlick_in_inventory = 1;
+      return;
+    }
+    if ( damage_level == 4 )
+    {
+      pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(pOut_y);
+      pPlayers[uActiveCharacter]->SetCondition(0x10u, 0);
+      pPlayers[uActiveCharacter]->ItemsEnchant(0);
       pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0);
 
       pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
 
       v39.z = pParty->vPosition.z + pParty->sEyelevel;
-    }
-    v39.x = pParty->vPosition.x;
-    v39.y = pParty->vPosition.y;
+      v39.x = pParty->vPosition.x;
+      v39.y = pParty->vPosition.y;
 
-    int rot_x, rot_y, rot_z;
-    Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, &rot_x, &rot_y, &rot_z);
-    sub_42F7EB_DropItemAt(0x41Bu, rot_x, rot_y, rot_z, 0, 1, 0, 0, 0);
-    if ( dword_4E455C )
+      int rot_x, rot_y, rot_z;
+      Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, &rot_x, &rot_y, &rot_z);
+      sub_42F7EB_DropItemAt(0x41Bu, rot_x, rot_y, rot_z, 0, 1, 0, 0, 0);
+      if ( dword_4E455C )
+      {
+        if ( pPlayers[uActiveCharacter]->CanAct() )
+          pPlayers[uActiveCharacter]->PlaySound(SPEECH_17, 0);
+        ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2);//Ой!
+        dword_4E455C = 0;
+      }
+      pMouse->RemoveHoldingItem();
+      no_rightlick_in_inventory = 1;
+      return;
+    }
+    if ( damage_level == 0 )
     {
-      if ( pPlayers[uActiveCharacter]->CanAct() )
-        pPlayers[uActiveCharacter]->PlaySound(SPEECH_17, 0);
-      ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2u);
-      dword_4E455C = 0;
+      if ( alchemy_skill_points )
+      {
+        if ( pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID == 221 || pParty->pPickedItem.uItemID == 221 )//catalyst(катализатор)
+        {
+          if ( pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID == 221 )
+            pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = pParty->pPickedItem.uItemID;
+          if ( pParty->pPickedItem.uItemID == 221 )
+            pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType = pParty->pPickedItem.uEnchantmentType;
+        }
+        else
+        {
+          pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = potionID;
+          pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType = (pParty->pPickedItem.uEnchantmentType
+                                            + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType) / 2;
+          pPlayers[uActiveCharacter]->SetVariable(VAR_AutoNotes, pItemsTable->potion_note[potion1_id][potion2_id]);
+        }
+        int bottle = pPlayers[uActiveCharacter]->AddItem(-1, 220);//бутылка
+        if ( bottle )
+          pPlayers[uActiveCharacter]->pOwnItems[bottle - 1].uAttributes = ITEM_IDENTIFIED;
+        if ( !(pItemsTable->pItems[pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID].uItemID_Rep_St) )
+          pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uAttributes |= 1;
+        if ( !dword_4E455C )
+        {
+          pMouse->RemoveHoldingItem();
+          no_rightlick_in_inventory = 1;
+          return;
+        }
+        pPlayers[uActiveCharacter]->PlaySound(SPEECH_DO_POTION_FINE, 0);
+        dword_4E455C = 0;
+        pMouse->RemoveHoldingItem();
+        no_rightlick_in_inventory = 1;
+        return;
+      }
+      GameUI_DrawItemInfo(item);
+      return;
     }
-    pMouse->RemoveHoldingItem();
-    no_rightlick_in_inventory = 1;
-    return;
   }
-  pMouse->RemoveHoldingItem();
-  no_rightlick_in_inventory = true;
+  GameUI_DrawItemInfo(item);
   return;
 }