comparison Player.cpp @ 1565:58420268d87d

fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
author Grumpy7
date Sun, 08 Sep 2013 04:10:22 +0200
parents 461c2eca401b
children 9f8b3e904e14
comparison
equal deleted inserted replaced
1564:461c2eca401b 1565:58420268d87d
1793 } 1793 }
1794 1794
1795 //----- (0048D2EA) -------------------------------------------------------- 1795 //----- (0048D2EA) --------------------------------------------------------
1796 char *Player::GetMeleeDamageString() 1796 char *Player::GetMeleeDamageString()
1797 { 1797 {
1798 signed int itemid; // eax@1 1798 signed int itemid; // eax@1
1799 int min_damage; // edi@3 1799 int min_damage; // edi@3
1800 int max_damage; // eax@3 1800 int max_damage; // eax@3
1801 1801
1802 static char player__getmeleedamagestring_static_buff[40]; // idb 1802 static char player__getmeleedamagestring_static_buff[40]; // idb
1803 1803
1804 if ( pEquipment.uMainHand) 1804 if (pEquipment.uMainHand >= 0)
1805 { 1805 {
1806 itemid= pOwnItems[this->pEquipment.uMainHand-1].uItemID; 1806 itemid = pOwnItems[this->pEquipment.uMainHand-1].uItemID;
1807 if ( itemid < ITEM_BLASTER || itemid > ITEM_LASER_RIFLE ) //blasters 1807 }
1808 { 1808
1809 min_damage = GetMeleeDamageMinimal(); 1809 if (pEquipment.uMainHand >= 0 && ( itemid >= 135 ) && ( itemid <= 159 ))
1810 max_damage = GetMeleeDamageMaximal(); 1810 {
1811 } 1811 strcpy(player__getmeleedamagestring_static_buff, pGlobalTXT_LocalizationStrings[595]); //"Wand"
1812 else 1812 return player__getmeleedamagestring_static_buff;
1813 { //for blasters 1813 }
1814 min_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0); 1814 else if (pEquipment.uMainHand >= 0 && (itemid == ITEM_BLASTER || itemid == ITEM_LASER_RIFLE))
1815 max_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0); 1815 {
1816 } 1816 min_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 1);
1817 if ( max_damage ) 1817 max_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 1);
1818 { 1818 }
1819 if ( min_damage == max_damage )
1820 {
1821 sprintf(player__getmeleedamagestring_static_buff, "%d", min_damage);
1822 }
1823 else
1824 {
1825 sprintf(player__getmeleedamagestring_static_buff, "%d - %d", min_damage, max_damage);
1826 }
1827 }
1828 else
1829 {
1830 strcpy(player__getmeleedamagestring_static_buff, "N/A");
1831 }
1832
1833 if (( itemid >= 135 )&&( itemid <= 159 )) //wands
1834 {
1835 strcpy(player__getmeleedamagestring_static_buff, pGlobalTXT_LocalizationStrings[595]); //"Wand"
1836 }
1837 }
1838 else 1819 else
1839 strcpy(player__getmeleedamagestring_static_buff, "N/A"); 1820 {
1821 min_damage = GetMeleeDamageMinimal();
1822 max_damage = GetMeleeDamageMaximal();
1823 }
1824 if ( min_damage == max_damage )
1825 {
1826 sprintf(player__getmeleedamagestring_static_buff, "%d", min_damage);
1827 }
1828 else
1829 {
1830 sprintf(player__getmeleedamagestring_static_buff, "%d - %d", min_damage, max_damage);
1831 }
1840 return player__getmeleedamagestring_static_buff; 1832 return player__getmeleedamagestring_static_buff;
1841 } 1833 }
1842 1834
1843 //----- (0048D396) -------------------------------------------------------- 1835 //----- (0048D396) --------------------------------------------------------
1844 char *Player::GetRangedDamageString() 1836 char *Player::GetRangedDamageString()
1845 { 1837 {
1846 signed int itemid; // eax@1 1838 signed int itemid; // eax@1
1847 int min_damage; // edi@3 1839 int min_damage; // edi@3
1848 int max_damage; // eax@3 1840 int max_damage; // eax@3
1849 1841
1850 static char player__getrangeddamagestring_static_buff[40]; // idb 1842 static char player__getrangeddamagestring_static_buff[40]; // idb
1888 } 1880 }
1889 1881
1890 //----- (0048D45A) -------------------------------------------------------- 1882 //----- (0048D45A) --------------------------------------------------------
1891 bool Player::CanTrainToNextLevel() 1883 bool Player::CanTrainToNextLevel()
1892 { 1884 {
1893 int lvl = this->uLevel; 1885 int lvl = this->uLevel + 1;
1894 int neededExp = ((lvl * (lvl - 1)) / 2 * 1000); 1886 int neededExp = ((lvl * (lvl - 1)) / 2 * 1000);
1895 return this->uExperience >= neededExp; 1887 return this->uExperience >= neededExp;
1896 } 1888 }
1897 1889
1898 //----- (0048D498) -------------------------------------------------------- 1890 //----- (0048D498) --------------------------------------------------------
2019 } 2011 }
2020 return false; 2012 return false;
2021 } 2013 }
2022 2014
2023 //----- (0048D76C) -------------------------------------------------------- 2015 //----- (0048D76C) --------------------------------------------------------
2024 bool Player::StealFromShop(ItemGen *a2, int a3, int a4, int a5, int *a6) 2016 bool Player::StealFromShop(ItemGen *a2, int a3, int reputation, int a5, int *a6)
2025 { 2017 {
2026 unsigned __int16 v6; // cx@8 2018 unsigned __int16 v6; // cx@8
2027 int v7; // edi@8 2019 int v7; // edi@8
2028 unsigned int v8; // ebx@8 2020 unsigned int v8; // ebx@8
2029 unsigned int v9; // esi@8 2021 unsigned int v9; // esi@8
2049 v9 = a2->GetValue(); 2041 v9 = a2->GetValue();
2050 v10 = pItemsTable->pItems[a2->uItemID].uEquipType; 2042 v10 = pItemsTable->pItems[a2->uItemID].uEquipType;
2051 if ( !pItemsTable->pItems[a2->uItemID].uEquipType || v10 == 1 || v10 == 2 ) 2043 if ( !pItemsTable->pItems[a2->uItemID].uEquipType || v10 == 1 || v10 == 2 )
2052 v9 *= 3; 2044 v9 *= 3;
2053 v11 = dword_4EDEB4[rand() % 100 / 20] + v7 * dword_4EDEA0[v8]; 2045 v11 = dword_4EDEB4[rand() % 100 / 20] + v7 * dword_4EDEA0[v8];
2054 *a6 = 100 * (a4 + a3) + v9 + (a5 != 0 ? 0x1F4 : 0); 2046 *a6 = 100 * (reputation + a3) + v9 + (a5 != 0 ? 0x1F4 : 0);
2055 if ( rand() % 100 >= 5 ) 2047 if ( rand() % 100 >= 5 )
2056 { 2048 {
2057 if ( *a6 > v11 ) 2049 if ( *a6 > v11 )
2058 result = *a6 - v11 < 500; 2050 result = *a6 - v11 < 500;
2059 else 2051 else