Mercurial > mm7
comparison Player.cpp @ 917:ae9e2a339b09
disappear items fix
author | Ritor1 |
---|---|
date | Fri, 26 Apr 2013 17:35:19 +0600 |
parents | 897b10712a1a |
children | a78f08dbeb88 |
comparison
equal
deleted
inserted
replaced
916:897b10712a1a | 917:ae9e2a339b09 |
---|---|
232 v4 = this; | 232 v4 = this; |
233 v5 = (char *)this + 36 * a3; | 233 v5 = (char *)this + 36 * a3; |
234 v6 = p2DEvents[a4 - 1].fPriceMultiplier; | 234 v6 = p2DEvents[a4 - 1].fPriceMultiplier; |
235 //v6 = p2DEvents_minus1__20[13 * a4]; | 235 //v6 = p2DEvents_minus1__20[13 * a4]; |
236 v7 = ((ItemGen *)(v5 + 532))->GetValue(); | 236 v7 = ((ItemGen *)(v5 + 532))->GetValue(); |
237 v8 = _4B8102(v7, v6); | 237 v8 = GetPriceSell(v7, v6); |
238 if ( v5[552] & 2 ) | 238 if ( v5[552] & 2 ) |
239 v8 = 1; | 239 v8 = 1; |
240 if ( v8 < 1 ) | 240 if ( v8 < 1 ) |
241 v8 = 1; | 241 v8 = 1; |
242 RemoveItemAtInventoryIndex(a2); | 242 RemoveItemAtInventoryIndex(a2); |
338 LODWORD(v7) = 1; | 338 LODWORD(v7) = 1; |
339 return v7; | 339 return v7; |
340 } | 340 } |
341 | 341 |
342 //----- (004B8102) -------------------------------------------------------- | 342 //----- (004B8102) -------------------------------------------------------- |
343 int Player::_4B8102(int a2, float a3) | 343 int Player::GetPriceSell(int uRealValue, float price_multiplier) |
344 { | 344 { |
345 signed int v3; // esi@1 | 345 signed int v3; // esi@1 |
346 signed int result; // eax@3 | 346 signed int result; // eax@3 |
347 | 347 |
348 v3 = (unsigned __int64)(signed __int64)((double)a2 / (a3 + 2.0)) + a2 * GetMerchant() / 100; | 348 v3 = (unsigned __int64)(signed __int64)((double)uRealValue / (price_multiplier + 2.0)) + uRealValue * GetMerchant() / 100; |
349 if ( v3 > a2 ) | 349 if ( v3 > uRealValue ) |
350 v3 = a2; | 350 v3 = uRealValue; |
351 result = 1; | 351 result = 1; |
352 if ( v3 >= 1 ) | 352 if ( v3 >= 1 ) |
353 result = v3; | 353 result = v3; |
354 return result; | 354 return result; |
355 } | 355 } |
1792 } | 1792 } |
1793 // 506128: using guessed type int areWeLoadingTexture; | 1793 // 506128: using guessed type int areWeLoadingTexture; |
1794 | 1794 |
1795 //identf | 1795 //identf |
1796 //----- (00490EEE) -------------------------------------------------------- | 1796 //----- (00490EEE) -------------------------------------------------------- |
1797 int Player::_490EEE(ItemGen *pItem, int a3, int a4, int a5) | 1797 int Player::SelectPhrasesTransaction(ItemGen *pItem, int building_type, int BuildID_2Events, int ShopMenuType) |
1798 { | 1798 { |
1799 int v5; // eax@1 | 1799 int pSkillLevel; // eax@1 |
1800 int result; // eax@1 | 1800 int NotBuy; // eax@1 |
1801 unsigned int v7; // edx@1 | 1801 int result; |
1802 unsigned int v8; // ecx@1 | 1802 signed int pEquipType; // esi@1 |
1803 signed int v9; // esi@1 | 1803 float *pPriceMultiplier; // esi@26 |
1804 char v10; // zf@14 | 1804 int pPriceItemService; // edi@26 |
1805 unsigned __int8 v11; // zf@22 | 1805 |
1806 char v12; // sf@22 | 1806 pSkillLevel = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); |
1807 unsigned __int8 v13; // of@22 | 1807 NotBuy = 4; |
1808 float *v14; // esi@26 | 1808 pEquipType = pItemsTable->pItems[pItem->uItemID].uEquipType; |
1809 float v15; // ST04_4@26 | 1809 if ( (building_type != 4 || (signed int)pItem->uItemID < 740 || (signed int)pItem->uItemID > 771) |
1810 signed int v16; // eax@26 | 1810 && ((signed int)pItem->uItemID >= 600 || (signed int)pItem->uItemID >= 529 && (signed int)pItem->uItemID <= 599) ) |
1811 int v17; // edi@26 | |
1812 float v18; // ST04_4@30 | |
1813 signed int v19; // eax@30 | |
1814 float v20; // ST04_4@34 | |
1815 signed int v21; // eax@34 | |
1816 signed int v22; // eax@34 | |
1817 float v23; // ST04_4@37 | |
1818 signed int v24; // eax@37 | |
1819 int v26; // [sp+10h] [bp-8h]@1 | |
1820 Player *v27; // [sp+14h] [bp-4h]@1 | |
1821 | |
1822 v27 = this; | |
1823 v5 = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); | |
1824 v26 = v5; | |
1825 result = 4; | |
1826 v7 = pItem->uItemID; | |
1827 v8 = pItem->uItemID; | |
1828 v9 = pItemsTable->pItems[v8].uEquipType; | |
1829 if ( (a3 != 4 || (signed int)v7 < 740 || (signed int)v7 > 771) | |
1830 && ((signed int)v7 >= 600 || (signed int)v7 >= 529 && (signed int)v7 <= 599) ) | |
1831 return 5; | 1811 return 5; |
1832 if ( a3 == 1 ) | 1812 if ( building_type == BildingType_WeaponShop ) |
1833 { | 1813 { |
1834 v13 = __OFSUB__(v9, 2); | 1814 if ( pEquipType > EQUIP_BOW ) |
1835 v11 = v9 == 2; | 1815 return NotBuy; |
1836 v12 = v9 - 2 < 0; | 1816 if (pItem->Stolen()) |
1837 goto LABEL_24; | 1817 return 6; |
1838 } | 1818 } |
1839 if ( a3 == 2 ) | 1819 if ( building_type == BildingType_ArmorShop ) |
1840 { | 1820 { |
1841 if ( v9 < 3 ) | 1821 if ( pEquipType < 3 && pEquipType > 9 ) |
1822 return NotBuy; | |
1823 if (pItem->Stolen()) | |
1824 return 6; | |
1825 } | |
1826 if ( building_type == BildingType_MagicShop ) | |
1827 { | |
1828 if ( pItemsTable->pItems[pItem->uItemID].uSkillType == 38 ) | |
1829 { | |
1830 if (pItem->Stolen()) | |
1831 return 6; | |
1832 pPriceMultiplier = &p2DEvents[BuildID_2Events - 1].fPriceMultiplier; | |
1833 pPriceItemService = GetBuyingPrice(pItem->GetValue(), *pPriceMultiplier); | |
1834 if ( ShopMenuType == 3 )//Sell | |
1835 { | |
1836 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier); | |
1837 if (!pItem->Broken()) | |
1838 { | |
1839 if ( pSkillLevel ) | |
1840 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1841 else | |
1842 result = 1; | |
1843 return result; | |
1844 } | |
1845 pPriceItemService = 1; | |
1846 if ( pSkillLevel ) | |
1847 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1848 else | |
1849 result = 1; | |
1850 return result; | |
1851 } | |
1852 if ( ShopMenuType == 4 )//Identify | |
1853 { | |
1854 pPriceItemService = this->GetPriceIdentification(*pPriceMultiplier); | |
1855 if ( pSkillLevel ) | |
1856 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1857 else | |
1858 result = 1; | |
1859 return result; | |
1860 } | |
1861 if ( ShopMenuType == 5 )//Repair | |
1862 { | |
1863 pPriceItemService = this->GetPriceRepair(pItem->GetValue(), *pPriceMultiplier); | |
1864 if ( pSkillLevel ) | |
1865 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1866 else | |
1867 result = 1; | |
1868 return result; | |
1869 } | |
1870 if ( ShopMenuType != 6 )//Buy and ??? | |
1871 { | |
1872 if ( pSkillLevel ) | |
1873 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1874 else | |
1875 result = 1; | |
1876 return result; | |
1877 } | |
1878 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier) / 2; | |
1879 if (pItem->Broken()) | |
1880 pPriceItemService = 1; | |
1881 if ( pPriceItemService >= 1 ) | |
1882 { | |
1883 if ( pSkillLevel ) | |
1884 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1885 else | |
1886 result = 1; | |
1887 return result; | |
1888 } | |
1889 pPriceItemService = 1; | |
1890 if ( pSkillLevel ) | |
1891 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1892 else | |
1893 result = 1; | |
1842 return result; | 1894 return result; |
1843 v13 = __OFSUB__(v9, 9); | 1895 } |
1844 v11 = v9 == 9; | 1896 if ( pEquipType != EQUIP_BOOK ) |
1845 v12 = v9 - 9 < 0; | 1897 return NotBuy; |
1846 LABEL_24: | 1898 } |
1847 if ( !((unsigned __int8)(v12 ^ v13) | v11) ) | 1899 if ( building_type == BildingType_AlchemistShop ) |
1900 { | |
1901 if ( pEquipType < EQUIP_REAGENT ) | |
1902 return NotBuy; | |
1903 if ( pEquipType > EQUIP_POTION ) | |
1904 { | |
1905 if ( pEquipType != EQUIP_MESSAGE_SCROLL ) | |
1906 return NotBuy; | |
1907 } | |
1908 if (pItem->Stolen()) | |
1909 return 6; | |
1910 } | |
1911 pPriceMultiplier = &p2DEvents[BuildID_2Events - 1].fPriceMultiplier; | |
1912 pPriceItemService = GetBuyingPrice(pItem->GetValue(), *pPriceMultiplier); | |
1913 if ( ShopMenuType == 3 )//Sell | |
1914 { | |
1915 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier); | |
1916 if (!pItem->Broken()) | |
1917 { | |
1918 if ( pSkillLevel ) | |
1919 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1920 else | |
1921 result = 1; | |
1848 return result; | 1922 return result; |
1849 goto LABEL_16; | 1923 } |
1850 } | 1924 pPriceItemService = 1; |
1851 if ( a3 == 3 ) | 1925 if ( pSkillLevel ) |
1852 { | 1926 result = (pPriceItemService == pItem->GetValue()) + 2; |
1853 if ( pItemsTable->pItems[v8].uSkillType == 38 ) | 1927 else |
1854 goto LABEL_16; | 1928 result = 1; |
1855 v10 = v9 == 16; | |
1856 goto LABEL_15; | |
1857 } | |
1858 if ( a3 != 4 ) | |
1859 goto LABEL_26; | |
1860 if ( v9 < 13 ) | |
1861 return result; | 1929 return result; |
1862 if ( v9 > 14 ) | 1930 } |
1863 { | 1931 if ( ShopMenuType == 4 )//Identify |
1864 v10 = v9 == 17; | 1932 { |
1865 LABEL_15: | 1933 pPriceItemService = this->GetPriceIdentification(*pPriceMultiplier); |
1866 if ( !v10 ) | 1934 if ( pSkillLevel ) |
1867 return result; | 1935 result = (pPriceItemService == pItem->GetValue()) + 2; |
1868 } | 1936 else |
1869 LABEL_16: | 1937 result = 1; |
1870 if (pItem->Stolen()) | 1938 return result; |
1871 return 6; | 1939 } |
1872 LABEL_26: | 1940 if ( ShopMenuType == 5 )//Repair |
1873 //v14 = &p2DEvents_minus1__20[13 * a4]; | 1941 { |
1874 v14 = &p2DEvents[a4 - 1].fPriceMultiplier; | 1942 pPriceItemService = this->GetPriceRepair(pItem->GetValue(), *pPriceMultiplier); |
1875 v15 = *v14; | 1943 if ( pSkillLevel ) |
1876 v16 = pItem->GetValue(); | 1944 result = (pPriceItemService == pItem->GetValue()) + 2; |
1877 v17 = GetBuyingPrice(v16, v15); | 1945 else |
1878 if ( a5 == 3 ) | 1946 result = 1; |
1879 { | 1947 return result; |
1880 v23 = *v14; | 1948 } |
1881 v24 = pItem->GetValue(); | 1949 if ( ShopMenuType != 6 )//Buy and ??? |
1882 v17 = v27->_4B8102(v24, v23); | 1950 { |
1883 if (!pItem->Broken()) | 1951 if ( pSkillLevel ) |
1884 goto LABEL_39; | 1952 result = (pPriceItemService == pItem->GetValue()) + 2; |
1885 goto LABEL_38; | 1953 else |
1886 } | 1954 result = 1; |
1887 if ( a5 == 4 ) | 1955 return result; |
1888 { | 1956 } |
1889 v22 = v27->GetPriceIdentification(*v14); | 1957 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier) / 2; |
1890 goto LABEL_35; | |
1891 } | |
1892 if ( a5 == 5 ) | |
1893 { | |
1894 v20 = *v14; | |
1895 v21 = pItem->GetValue(); | |
1896 v22 = v27->GetPriceRepair(v21, v20); | |
1897 LABEL_35: | |
1898 v17 = v22; | |
1899 goto LABEL_39; | |
1900 } | |
1901 if ( a5 != 6 ) | |
1902 goto LABEL_39; | |
1903 v18 = *v14; | |
1904 v19 = pItem->GetValue(); | |
1905 v17 = v27->_4B8102(v19, v18) / 2; | |
1906 if (pItem->Broken()) | 1958 if (pItem->Broken()) |
1907 v17 = 1; | 1959 pPriceItemService = 1; |
1908 if ( v17 >= 1 ) | 1960 if ( pPriceItemService >= 1 ) |
1909 goto LABEL_39; | 1961 { |
1910 LABEL_38: | 1962 if ( pSkillLevel ) |
1911 v17 = 1; | 1963 result = (pPriceItemService == pItem->GetValue()) + 2; |
1912 LABEL_39: | 1964 else |
1913 if ( v26 ) | 1965 result = 1; |
1914 result = (v17 == pItem->GetValue()) + 2; | 1966 return result; |
1967 } | |
1968 pPriceItemService = 1; | |
1969 if ( pSkillLevel ) | |
1970 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1915 else | 1971 else |
1916 result = 1; | 1972 result = 1; |
1917 return result; | 1973 return result; |
1918 } | 1974 } |
1919 | 1975 |