comparison UI/UIPopup.cpp @ 1733:dc5f145b3d5d

alchemy fix
author Ritor1
date Thu, 26 Sep 2013 14:17:25 +0600
parents 79b9306f573a
children 421c29d4ab3e
comparison
equal deleted inserted replaced
1730:79b9306f573a 1733:dc5f145b3d5d
1585 } 1585 }
1586 int no_rightlick_in_inventory = false; // 0050CDCC 1586 int no_rightlick_in_inventory = false; // 0050CDCC
1587 //----- (00416196) -------------------------------------------------------- 1587 //----- (00416196) --------------------------------------------------------
1588 void Inventory_ItemPopupAndAlchemy() 1588 void Inventory_ItemPopupAndAlchemy()
1589 { 1589 {
1590 int v14; // edx@25 1590 int potion1_id; // edx@25
1591 unsigned int v15; // edi@25 1591 unsigned int potion2_id; // edi@25
1592 signed int v16; // edx@27 1592 signed int potionID; // edx@27
1593 int v17; // eax@54 1593 unsigned int pOut_y; // edx@57
1594 unsigned int v18; // edx@57
1595 int v19; // eax@65
1596 int v20; // edi@67
1597 int v21; // eax@72
1598 int v22; // ecx@74
1599 int v23; // edx@78
1600 int v24; // eax@79
1601 int v25; // eax@80
1602 int v26; // eax@84
1603 ItemGen *v27; // esi@98
1604 double v31; // st7@112 1594 double v31; // st7@112
1605 double v36; // st7@132
1606 signed __int64 v37; // qax@135
1607 Vec3_int_ v39; // [sp-18h] [bp-A8h]@83 1595 Vec3_int_ v39; // [sp-18h] [bp-A8h]@83
1608 GUIWindow message_window; // [sp+Ch] [bp-84h]@137 1596 GUIWindow message_window; // [sp+Ch] [bp-84h]@137
1609 int v45; // [sp+64h] [bp-2Ch]@10
1610 POINT a2; // [sp+78h] [bp-18h]@2 1597 POINT a2; // [sp+78h] [bp-18h]@2
1611 unsigned int damage_level; // [sp+8Ch] [bp-4h]@23 1598 unsigned int damage_level; // [sp+8Ch] [bp-4h]@23
1612 1599
1613 if (no_rightlick_in_inventory) 1600 if (no_rightlick_in_inventory)
1614 return; 1601 return;
1615 1602
1616 pMouse->GetCursorPos(&a2); 1603 pMouse->GetCursorPos(&a2);
1617 int item_pid = (pRenderer->pActiveZBuffer[a2.x + pSRZBufferLineOffsets[a2.y]] & 0xFFFF) - 1; 1604 int item_pid = (pRenderer->pActiveZBuffer[a2.x + pSRZBufferLineOffsets[a2.y]] & 0xFFFF) - 1;
1618 auto item = &pPlayers[uActiveCharacter]->pInventoryItemList[item_pid]; 1605 auto item = &pPlayers[uActiveCharacter]->pInventoryItemList[item_pid];
1619 1606
1620 if (a2.x <= 13 || a2.x >= 462) 1607 if (a2.x <= 13 || a2.x >= 462)//items out of inventory(вещи вне инвентаря)
1621 { 1608 {
1622 GameUI_DrawItemInfo(item); 1609 GameUI_DrawItemInfo(item);
1623 return; 1610 return;
1624 } 1611 }
1625 1612
1658 message_window.DrawMessageBox(0); 1645 message_window.DrawMessageBox(0);
1659 return; 1646 return;
1660 } 1647 }
1661 1648
1662 int alchemy_skill_points = (int8_t)pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_ALCHEMY) & 0x3F; 1649 int alchemy_skill_points = (int8_t)pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_ALCHEMY) & 0x3F;
1663 int alchemy_skill_level = SkillToMastery(pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_ALCHEMY)) - 1; 1650 int alchemy_skill_level = SkillToMastery(pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_ALCHEMY));
1664 1651
1665 // for potion bottle(простая бутылка) 1652 // for potion bottle(простая бутылка)
1666 if (pParty->pPickedItem.uItemID == ITEM_POTION_BOTTLE) 1653 if (pParty->pPickedItem.uItemID == ITEM_POTION_BOTTLE)
1667 { 1654 {
1668 GameUI_DrawItemInfo(item); 1655 GameUI_DrawItemInfo(item);
1669 return; 1656 return;
1670 } 1657 }
1671 //for recharge potion(зелье перезарядка) 1658 //for recharge potion(зелье перезарядка)
1672 if (pParty->pPickedItem.uItemID == ITEM_POTION_RECHARGE_ITEM) 1659 if (pParty->pPickedItem.uItemID == ITEM_POTION_RECHARGE_ITEM)
1673 { 1660 {
1674 if (item->uItemID != ITEM_POTION_BOTTLE && // cant recharge bottle 1661 if (item->uItemID < ITEM_POTION_BOTTLE || item->uItemID > ITEM_POTION_REJUVENATION)// all potions
1675 item->uItemID < ITEM_POTION_CATALYST && // cant recharge
1676 item->uItemID > ITEM_POTION_REJUVENATION) // all potions
1677 { 1662 {
1678 if (item->GetItemEquipType() != EQUIP_WAND) // can recharge only wands 1663 if (item->GetItemEquipType() != EQUIP_WAND) // can recharge only wands
1679 { 1664 {
1680 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); 1665 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
1681 return; 1666 return;
1682 } 1667 }
1683 1668
1684 v36 = (70.0 - (double)pParty->pPickedItem.uEnchantmentType) * 0.01; 1669 v31 = (70.0 - (double)pParty->pPickedItem.uEnchantmentType) * 0.01;
1685 if ( v36 < 0.0 ) 1670 if ( v31 < 0.0 )
1686 v36 = 0.0; 1671 v31 = 0.0;
1687 v37 = (signed __int64)((double)item->uMaxCharges - v36 * (double)item->uMaxCharges); 1672 item->uMaxCharges = (signed __int64)((double)item->uMaxCharges - v31 * (double)item->uMaxCharges);
1688 item->uMaxCharges = v37; 1673 item->uNumCharges = (signed __int64)((double)item->uMaxCharges - v31 * (double)item->uMaxCharges);
1689 item->uNumCharges = v37;
1690 1674
1691 pMouse->RemoveHoldingItem(); 1675 pMouse->RemoveHoldingItem();
1692 no_rightlick_in_inventory = 1; 1676 no_rightlick_in_inventory = 1;
1693 return; 1677 return;
1694 } 1678 }
1696 return; 1680 return;
1697 } 1681 }
1698 // for harden potion(зелье закалка) 1682 // for harden potion(зелье закалка)
1699 else if (pParty->pPickedItem.uItemID == ITEM_POTION_HARDEN_ITEM) 1683 else if (pParty->pPickedItem.uItemID == ITEM_POTION_HARDEN_ITEM)
1700 { 1684 {
1701 if (item->uItemID != ITEM_POTION_BOTTLE && // cant harden bottle 1685 if (item->uItemID < ITEM_POTION_BOTTLE || item->uItemID > ITEM_POTION_REJUVENATION) // bottle and all potions
1702 item->uItemID < ITEM_POTION_CATALYST && // cant harden
1703 item->uItemID > ITEM_POTION_REJUVENATION) // all potions
1704 { 1686 {
1705 if (item->IsBroken() || // cant harden broken items 1687 if (item->IsBroken() || // cant harden broken items
1706 item->uItemID >= ITEM_ARTIFACT_PUCK || // cant harden artifacts 1688 item->uItemID >= ITEM_ARTIFACT_PUCK || // cant harden artifacts
1707 item->GetItemEquipType() < EQUIP_OFF_HAND || 1689 item->GetItemEquipType() < EQUIP_OFF_HAND ||
1708 item->GetItemEquipType() > EQUIP_WAND) 1690 item->GetItemEquipType() > EQUIP_WAND)
1721 } 1703 }
1722 GameUI_DrawItemInfo(item); 1704 GameUI_DrawItemInfo(item);
1723 return; 1705 return;
1724 } 1706 }
1725 // several potions(несколько зелий) 1707 // several potions(несколько зелий)
1726 else if (pParty->pPickedItem.uItemID >= ITEM_POTION_FLAMING_POTION && 1708 else if (pParty->pPickedItem.uItemID >= ITEM_POTION_FLAMING_POTION && pParty->pPickedItem.uItemID <= ITEM_POTION_SWIFT_POTION ||
1727 pParty->pPickedItem.uItemID <= ITEM_POTION_SWIFT_POTION ||
1728 pParty->pPickedItem.uItemID == ITEM_POTION_SLAYING_POTION) 1709 pParty->pPickedItem.uItemID == ITEM_POTION_SLAYING_POTION)
1729 { 1710 {
1730 if (item->uItemID != ITEM_POTION_BOTTLE && // cant enchant bottle 1711 if ( item->uItemID < ITEM_POTION_BOTTLE || item->uItemID > ITEM_POTION_REJUVENATION) // all potions
1731 item->uItemID < ITEM_POTION_CATALYST && // cant enchant
1732 item->uItemID > ITEM_POTION_REJUVENATION) // all potions
1733 { 1712 {
1734 if (item->uItemID >= ITEM_BLASTER && item->uItemID <= ITEM_LASER_RIFLE || 1713 if (item->uItemID >= ITEM_BLASTER && item->uItemID <= ITEM_LASER_RIFLE ||
1735 item->uItemID >= ITEM_ARTIFACT_PUCK || 1714 item->uItemID >= ITEM_ARTIFACT_PUCK ||
1736 item->IsBroken() || 1715 item->IsBroken() ||
1737 item->uSpecEnchantmentType || 1716 item->uSpecEnchantmentType ||
1759 }; 1738 };
1760 item->uSpecEnchantmentType = _4E2904_enchantment_by_potion_lut[pParty->pPickedItem.uItemID - 240]; 1739 item->uSpecEnchantmentType = _4E2904_enchantment_by_potion_lut[pParty->pPickedItem.uItemID - 240];
1761 v31 = (double)(1800 * pParty->pPickedItem.uEnchantmentType * 128); 1740 v31 = (double)(1800 * pParty->pPickedItem.uEnchantmentType * 128);
1762 } 1741 }
1763 1742
1764 v27->uExpireTime = pParty->uTimePlayed + v31 * 0.033333335; 1743 item->uExpireTime = pParty->uTimePlayed + v31 * 0.033333335;
1765 v27->uAttributes = alchemy_skill_level | 0x18; 1744 item->uAttributes = alchemy_skill_level | 0x18;
1766 1745
1767 _50C9A8_item_enchantment_timer = 256; 1746 _50C9A8_item_enchantment_timer = 256;
1768 pMouse->RemoveHoldingItem(); 1747 pMouse->RemoveHoldingItem();
1769 no_rightlick_in_inventory = true; 1748 no_rightlick_in_inventory = true;
1770 return; 1749 return;
1817 pPlayers[uActiveCharacter]->PlaySound(SPEECH_DO_POTION_FINE, 0); 1796 pPlayers[uActiveCharacter]->PlaySound(SPEECH_DO_POTION_FINE, 0);
1818 dword_4E455C = 0; 1797 dword_4E455C = 0;
1819 } 1798 }
1820 return; 1799 return;
1821 } 1800 }
1822
1823 //potions mixing(смешивание двух зелий) 1801 //potions mixing(смешивание двух зелий)
1824 if (pParty->pPickedItem.uItemID < ITEM_REAGENT_WIDOWSWEEP_BERRIES || 1802 if (pParty->pPickedItem.uItemID >= ITEM_POTION_CATALYST && pParty->pPickedItem.uItemID <= ITEM_POTION_REJUVENATION &&
1825 pParty->pPickedItem.uItemID > ITEM_REAGENT_PHILOSOPHERS_STONE || 1803 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID >= ITEM_POTION_CATALYST &&
1826 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID != ITEM_POTION_BOTTLE) 1804 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID <= ITEM_POTION_REJUVENATION)
1827 { 1805 {
1828 if (pParty->pPickedItem.uItemID < ITEM_POTION_CATALYST || 1806 potion1_id = item->uItemID - ITEM_POTION_CURE_WOUNDS;
1829 pParty->pPickedItem.uItemID > ITEM_POTION_REJUVENATION || 1807 potion2_id = pParty->pPickedItem.uItemID - ITEM_POTION_CURE_WOUNDS;
1830 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID < ITEM_POTION_CATALYST ||
1831 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID > ITEM_POTION_REJUVENATION)
1832 {
1833 if (pParty->pPickedItem.uItemID != ITEM_POTION_HARDEN_ITEM &&
1834 (pParty->pPickedItem.uItemID < ITEM_POTION_FLAMING_POTION || pParty->pPickedItem.uItemID > ITEM_POTION_SWIFT_POTION) &&
1835 pParty->pPickedItem.uItemID != ITEM_POTION_SLAYING_POTION &&
1836 pParty->pPickedItem.uItemID != ITEM_POTION_RECHARGE_ITEM)
1837 GameUI_DrawItemInfo(item);
1838 return;
1839 }
1840
1841 // src not reagent, dst not bottle
1842 // src potion, dst potion
1843
1844 v14 = item->uItemID - ITEM_POTION_CURE_WOUNDS;
1845 v15 = pParty->pPickedItem.uItemID - ITEM_POTION_CURE_WOUNDS;
1846 1808
1847 if ( pParty->pPickedItem.uItemID == ITEM_POTION_CATALYST || item->uItemID == ITEM_POTION_CATALYST ) 1809 if ( pParty->pPickedItem.uItemID == ITEM_POTION_CATALYST || item->uItemID == ITEM_POTION_CATALYST )
1848 v16 = 5; 1810 potionID = 5;
1849 else 1811 else
1850 v16 = pItemsTable->potion_data[v15][v14 + 2]; 1812 potionID = pItemsTable->potion_data[potion2_id][potion1_id];
1851 damage_level = v16; 1813 damage_level = 0;
1852 if ( alchemy_skill_points ) 1814 if ( alchemy_skill_points )
1853 { 1815 {
1854 if ( v16 < ITEM_POTION_CURE_DISEASE || v16 > ITEM_POTION_AWAKEN )//< 225 >227 1816 if ( potionID < ITEM_POTION_CURE_DISEASE || potionID > ITEM_POTION_AWAKEN )//< 225 >227
1855 { 1817 {
1856 if ( v16 >= ITEM_POTION_HASTE && v16 <= ITEM_POTION_CURE_INSANITY )//228 >= v16 <= 239 1818 if ( potionID >= ITEM_POTION_HASTE && potionID <= ITEM_POTION_CURE_INSANITY && alchemy_skill_level == 1)//228 >= potionID <= 239
1857 { 1819 damage_level = 2;
1858 if ( alchemy_skill_points == 1 ) 1820 if ( potionID >= ITEM_POTION_MIGHT_BOOST && potionID <= ITEM_POTION_BODY_RESISTANE && alchemy_skill_level <= 2)//240 >= potionID <= 261
1859 damage_level = 2; 1821 damage_level = 3;
1860 } 1822 if ( potionID >= ITEM_POTION_STONE_TO_FLESH && alchemy_skill_level <= 3 )// 262 < potionID
1861 if ( v16 >= ITEM_POTION_MIGHT_BOOST && v16 <= ITEM_POTION_BODY_RESISTANE )//240 >= v16 <= 261
1862 {
1863 if ( alchemy_skill_points <= 2 )
1864 damage_level = 3;
1865 }
1866 if ( v16 >= ITEM_POTION_STONE_TO_FLESH && alchemy_skill_points != 4 )//>= 262
1867 damage_level = 4; 1823 damage_level = 4;
1868 } 1824 }
1869 } 1825 }
1870 else 1826 else//no skill(нет навыка)
1871 { 1827 {
1872 if ( v16 >= ITEM_POTION_CURE_DISEASE && v16 <= ITEM_POTION_AWAKEN )//225 <= v16 <= 227 1828 if ( potionID >= ITEM_POTION_CURE_DISEASE && potionID <= ITEM_POTION_AWAKEN )//225 <= v16 <= 227
1873 damage_level = 1; 1829 damage_level = 1;
1874 if ( v16 >= ITEM_POTION_HASTE && v16 <= ITEM_POTION_CURE_INSANITY )//228 <= v16 <= 239 1830 if ( potionID >= ITEM_POTION_HASTE && potionID <= ITEM_POTION_CURE_INSANITY )//228 <= v16 <= 239
1875 damage_level = 2; 1831 damage_level = 2;
1876 if ( v16 >= ITEM_POTION_MIGHT_BOOST && v16 <= ITEM_POTION_BODY_RESISTANE )//240 <= v16 <= 261 1832 if ( potionID >= ITEM_POTION_MIGHT_BOOST && potionID <= ITEM_POTION_BODY_RESISTANE )//240 <= v16 <= 261
1877 damage_level = 3; 1833 damage_level = 3;
1878 if ( v16 >= ITEM_POTION_STONE_TO_FLESH )//262 <= v16 1834 if ( potionID >= ITEM_POTION_STONE_TO_FLESH )//262 <= v16
1879 damage_level = 4; 1835 damage_level = 4;
1880 } 1836 }
1881 int pOut_y = 0; 1837
1882 int pOut_x = item_pid + 1; 1838 int pOut_x = item_pid + 1;
1883 v17 = (int)pPlayers[uActiveCharacter]->pInventoryMatrix; 1839 for ( uint i = 0; i < 126; ++i )
1884 while ( *(int *)v17 != pOut_x ) 1840 {
1885 { 1841 if ( pPlayers[uActiveCharacter]->pInventoryMatrix[i] == pOut_x )
1886 ++pOut_y; 1842 {
1887 v17 += 4; 1843 pOut_y = i;
1888 if ( pOut_y >= 126 ) 1844 break;
1889 { 1845 }
1890 v18 = pOut_y; 1846 }
1891 goto LABEL_59; 1847 if ( !potionID )
1892 }
1893 }
1894 v18 = pOut_y;
1895 LABEL_59:
1896 if ( !damage_level )
1897 { 1848 {
1898 GameUI_DrawItemInfo(item); 1849 GameUI_DrawItemInfo(item);
1899 return; 1850 return;
1900 } 1851 }
1901 if ( damage_level == 1 ) 1852 if ( damage_level == 1 )
1902 { 1853 {
1903 pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v18); 1854 pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(pOut_y);
1904 v26 = rand(); 1855 pPlayers[uActiveCharacter]->ReceiveDamage(rand() % 11 + 10, DMGT_FIRE);
1905 pPlayers[uActiveCharacter]->ReceiveDamage(v26 % 11 + 10, DMGT_FIRE);
1906 pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); 1856 pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0);
1907
1908 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); 1857 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
1909
1910 v39.z = pParty->vPosition.z + pParty->sEyelevel; 1858 v39.z = pParty->vPosition.z + pParty->sEyelevel;
1911 } 1859 v39.x = pParty->vPosition.x;
1912 else 1860 v39.y = pParty->vPosition.y;
1913 { 1861
1914 if ( damage_level == 2 ) 1862 int rot_x, rot_y, rot_z;
1915 { 1863 Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, &rot_x, &rot_y, &rot_z);
1916 pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v18); 1864 sub_42F7EB_DropItemAt(0x41Bu, rot_x, rot_y, rot_z, 0, 1, 0, 0, 0);
1917 v25 = rand(); 1865 if ( dword_4E455C )
1918 pPlayers[uActiveCharacter]->ReceiveDamage(v25 % 71 + 30, DMGT_FIRE); 1866 {
1919 v23 = 1; 1867 if ( pPlayers[uActiveCharacter]->CanAct() )
1920 } 1868 pPlayers[uActiveCharacter]->PlaySound(SPEECH_17, 0);
1921 else 1869 ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2);//Ой!
1922 { 1870 dword_4E455C = 0;
1923 if ( damage_level == 3 ) 1871 }
1872 pMouse->RemoveHoldingItem();
1873 no_rightlick_in_inventory = 1;
1874 return;
1875 }
1876 if ( damage_level == 2 )
1877 {
1878 pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(pOut_y);
1879 pPlayers[uActiveCharacter]->ReceiveDamage(rand() % 71 + 30, DMGT_FIRE);
1880 pPlayers[uActiveCharacter]->ItemsEnchant(1);
1881 pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0);
1882 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
1883
1884 v39.z = pParty->vPosition.z + pParty->sEyelevel;
1885 v39.x = pParty->vPosition.x;
1886 v39.y = pParty->vPosition.y;
1887
1888 int rot_x, rot_y, rot_z;
1889 Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, &rot_x, &rot_y, &rot_z);
1890 sub_42F7EB_DropItemAt(0x41Bu, rot_x, rot_y, rot_z, 0, 1, 0, 0, 0);
1891 if ( dword_4E455C )
1892 {
1893 if ( pPlayers[uActiveCharacter]->CanAct() )
1894 pPlayers[uActiveCharacter]->PlaySound(SPEECH_17, 0);
1895 ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2);//Ой!
1896 dword_4E455C = 0;
1897 }
1898 pMouse->RemoveHoldingItem();
1899 no_rightlick_in_inventory = 1;
1900 return;
1901 }
1902 if ( damage_level == 3 )
1903 {
1904 pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(pOut_y);
1905 pPlayers[uActiveCharacter]->ReceiveDamage(rand() % 201 + 50, DMGT_FIRE);
1906 pPlayers[uActiveCharacter]->ItemsEnchant(5);
1907 pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0);
1908
1909 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
1910
1911 v39.z = pParty->vPosition.z + pParty->sEyelevel;
1912 v39.x = pParty->vPosition.x;
1913 v39.y = pParty->vPosition.y;
1914
1915 int rot_x, rot_y, rot_z;
1916 Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, &rot_x, &rot_y, &rot_z);
1917 sub_42F7EB_DropItemAt(0x41Bu, rot_x, rot_y, rot_z, 0, 1, 0, 0, 0);
1918 if ( dword_4E455C )
1919 {
1920 if ( pPlayers[uActiveCharacter]->CanAct() )
1921 pPlayers[uActiveCharacter]->PlaySound(SPEECH_17, 0);
1922 ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2);//Ой!
1923 dword_4E455C = 0;
1924 }
1925 pMouse->RemoveHoldingItem();
1926 no_rightlick_in_inventory = 1;
1927 return;
1928 }
1929 if ( damage_level == 4 )
1930 {
1931 pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(pOut_y);
1932 pPlayers[uActiveCharacter]->SetCondition(0x10u, 0);
1933 pPlayers[uActiveCharacter]->ItemsEnchant(0);
1934 pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0);
1935
1936 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
1937
1938 v39.z = pParty->vPosition.z + pParty->sEyelevel;
1939 v39.x = pParty->vPosition.x;
1940 v39.y = pParty->vPosition.y;
1941
1942 int rot_x, rot_y, rot_z;
1943 Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, &rot_x, &rot_y, &rot_z);
1944 sub_42F7EB_DropItemAt(0x41Bu, rot_x, rot_y, rot_z, 0, 1, 0, 0, 0);
1945 if ( dword_4E455C )
1946 {
1947 if ( pPlayers[uActiveCharacter]->CanAct() )
1948 pPlayers[uActiveCharacter]->PlaySound(SPEECH_17, 0);
1949 ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2);//Ой!
1950 dword_4E455C = 0;
1951 }
1952 pMouse->RemoveHoldingItem();
1953 no_rightlick_in_inventory = 1;
1954 return;
1955 }
1956 if ( damage_level == 0 )
1957 {
1958 if ( alchemy_skill_points )
1959 {
1960 if ( pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID == 221 || pParty->pPickedItem.uItemID == 221 )//catalyst(катализатор)
1924 { 1961 {
1925 pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v18); 1962 if ( pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID == 221 )
1926 v24 = rand(); 1963 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = pParty->pPickedItem.uItemID;
1927 pPlayers[uActiveCharacter]->ReceiveDamage(v24 % 201 + 50, DMGT_FIRE); 1964 if ( pParty->pPickedItem.uItemID == 221 )
1928 v23 = 5; 1965 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType = pParty->pPickedItem.uEnchantmentType;
1929 } 1966 }
1930 else 1967 else
1931 { 1968 {
1932 if ( damage_level != 4 ) 1969 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = potionID;
1933 { 1970 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType = (pParty->pPickedItem.uEnchantmentType
1934 if ( damage_level != 5 ) 1971 + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType) / 2;
1935 { 1972 pPlayers[uActiveCharacter]->SetVariable(VAR_AutoNotes, pItemsTable->potion_note[potion1_id][potion2_id]);
1936 v19 = pPlayers[uActiveCharacter]->AddItem(-1, 0xDCu);
1937 if ( v19 )
1938 pPlayers[uActiveCharacter]->pOwnItems[v19-1].uAttributes = ITEM_IDENTIFIED;
1939 v20 = v14 + 50 * v15;
1940 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = damage_level;
1941 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType = (pParty->pPickedItem.uEnchantmentType
1942 + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType)
1943 / 2;
1944 pPlayers[uActiveCharacter]->SetVariable(VAR_AutoNotes, *(short *)&pItemsTable->potion_note[2 * v20 ]);//field_10168 + 388
1945 v22 = (int)((char *)pPlayers[uActiveCharacter] + 36 * item_pid);
1946 if ( !(pItemsTable->pItems[*(int *)(v22 + 532) ].uItemID_Rep_St) )
1947 *(int *)(v22 + 552) |= 1u;
1948 if ( !dword_4E455C )
1949 {
1950 pMouse->RemoveHoldingItem();
1951 no_rightlick_in_inventory = 1;
1952 return;
1953 }
1954 pPlayers[uActiveCharacter]->PlaySound(SPEECH_DO_POTION_FINE, 0);
1955 dword_4E455C = 0;
1956 pMouse->RemoveHoldingItem();
1957 no_rightlick_in_inventory = 1;
1958 return;
1959 }
1960 if ( alchemy_skill_points )
1961 {
1962 if ( *(int *)(pPlayers[uActiveCharacter] + 36 * item_pid + 532) == 221 )
1963 *(int *)(pPlayers[uActiveCharacter] + 36 * item_pid + 532) = pParty->pPickedItem.uItemID;
1964 else
1965 *(int *)(pPlayers[uActiveCharacter] + 36 * item_pid + 536) = pParty->pPickedItem.uEnchantmentType;
1966 v21 = pPlayers[uActiveCharacter]->AddItem(-1, 0xDCu);
1967 if ( v21 )
1968 //*(int *)&v0->field_1F5[36 * v21 + 15] = 1;
1969 pPlayers[uActiveCharacter]->pOwnItems[v21-1].uAttributes=ITEM_IDENTIFIED;
1970 v22 = (int)((char *)pPlayers[uActiveCharacter] + 36 * item_pid);
1971 if ( !(pItemsTable->pItems[*(int *)(v22 + 532) ].uItemID_Rep_St) )
1972 *(int *)(v22 + 552) |= 1u;
1973 if ( !dword_4E455C )
1974 {
1975 pMouse->RemoveHoldingItem();
1976 no_rightlick_in_inventory = 1;
1977 return;
1978 }
1979 pPlayers[uActiveCharacter]->PlaySound(SPEECH_DO_POTION_FINE, 0);
1980 dword_4E455C = 0;
1981 pMouse->RemoveHoldingItem();
1982 no_rightlick_in_inventory = 1;
1983 return;
1984 }
1985 GameUI_DrawItemInfo(item);
1986 return;
1987 }
1988 pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v18);
1989 pPlayers[uActiveCharacter]->SetCondition(0x10u, 0);
1990 v23 = 0;
1991 } 1973 }
1992 } 1974 int bottle = pPlayers[uActiveCharacter]->AddItem(-1, 220);//бутылка
1993 pPlayers[uActiveCharacter]->ItemsEnchant(v23); 1975 if ( bottle )
1994 pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); 1976 pPlayers[uActiveCharacter]->pOwnItems[bottle - 1].uAttributes = ITEM_IDENTIFIED;
1995 1977 if ( !(pItemsTable->pItems[pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID].uItemID_Rep_St) )
1996 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); 1978 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uAttributes |= 1;
1997 1979 if ( !dword_4E455C )
1998 v39.z = pParty->vPosition.z + pParty->sEyelevel; 1980 {
1999 } 1981 pMouse->RemoveHoldingItem();
2000 v39.x = pParty->vPosition.x; 1982 no_rightlick_in_inventory = 1;
2001 v39.y = pParty->vPosition.y; 1983 return;
2002 1984 }
2003 int rot_x, rot_y, rot_z; 1985 pPlayers[uActiveCharacter]->PlaySound(SPEECH_DO_POTION_FINE, 0);
2004 Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, &rot_x, &rot_y, &rot_z); 1986 dword_4E455C = 0;
2005 sub_42F7EB_DropItemAt(0x41Bu, rot_x, rot_y, rot_z, 0, 1, 0, 0, 0); 1987 pMouse->RemoveHoldingItem();
2006 if ( dword_4E455C ) 1988 no_rightlick_in_inventory = 1;
2007 { 1989 return;
2008 if ( pPlayers[uActiveCharacter]->CanAct() ) 1990 }
2009 pPlayers[uActiveCharacter]->PlaySound(SPEECH_17, 0); 1991 GameUI_DrawItemInfo(item);
2010 ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2u); 1992 return;
2011 dword_4E455C = 0; 1993 }
2012 } 1994 }
2013 pMouse->RemoveHoldingItem(); 1995 GameUI_DrawItemInfo(item);
2014 no_rightlick_in_inventory = 1;
2015 return;
2016 }
2017 pMouse->RemoveHoldingItem();
2018 no_rightlick_in_inventory = true;
2019 return; 1996 return;
2020 } 1997 }