# HG changeset patch # User Grumpy7 # Date 1378606222 -7200 # Node ID 58420268d87dc942823dfc42a759dba57eddbd15 # Parent 461c2eca401b93bd3dee8eadf317785892ea9a95 fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel diff -r 461c2eca401b -r 58420268d87d Player.cpp --- a/Player.cpp Sun Sep 08 03:27:10 2013 +0200 +++ b/Player.cpp Sun Sep 08 04:10:22 2013 +0200 @@ -1795,54 +1795,46 @@ //----- (0048D2EA) -------------------------------------------------------- char *Player::GetMeleeDamageString() { -signed int itemid; // eax@1 -int min_damage; // edi@3 -int max_damage; // eax@3 + signed int itemid; // eax@1 + int min_damage; // edi@3 + int max_damage; // eax@3 static char player__getmeleedamagestring_static_buff[40]; // idb - if ( pEquipment.uMainHand) - { - itemid= pOwnItems[this->pEquipment.uMainHand-1].uItemID; - if ( itemid < ITEM_BLASTER || itemid > ITEM_LASER_RIFLE ) //blasters - { - min_damage = GetMeleeDamageMinimal(); - max_damage = GetMeleeDamageMaximal(); - } - else - { //for blasters - min_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0); - max_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0); - } - if ( max_damage ) - { - if ( min_damage == max_damage ) - { - sprintf(player__getmeleedamagestring_static_buff, "%d", min_damage); - } - else - { - sprintf(player__getmeleedamagestring_static_buff, "%d - %d", min_damage, max_damage); - } - } - else - { - strcpy(player__getmeleedamagestring_static_buff, "N/A"); - } - - if (( itemid >= 135 )&&( itemid <= 159 )) //wands - { - strcpy(player__getmeleedamagestring_static_buff, pGlobalTXT_LocalizationStrings[595]); //"Wand" - } - } + if (pEquipment.uMainHand >= 0) + { + itemid = pOwnItems[this->pEquipment.uMainHand-1].uItemID; + } + + if (pEquipment.uMainHand >= 0 && ( itemid >= 135 ) && ( itemid <= 159 )) + { + strcpy(player__getmeleedamagestring_static_buff, pGlobalTXT_LocalizationStrings[595]); //"Wand" + return player__getmeleedamagestring_static_buff; + } + else if (pEquipment.uMainHand >= 0 && (itemid == ITEM_BLASTER || itemid == ITEM_LASER_RIFLE)) + { + min_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 1); + max_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 1); + } else - strcpy(player__getmeleedamagestring_static_buff, "N/A"); + { + min_damage = GetMeleeDamageMinimal(); + max_damage = GetMeleeDamageMaximal(); + } + if ( min_damage == max_damage ) + { + sprintf(player__getmeleedamagestring_static_buff, "%d", min_damage); + } + else + { + sprintf(player__getmeleedamagestring_static_buff, "%d - %d", min_damage, max_damage); + } return player__getmeleedamagestring_static_buff; } //----- (0048D396) -------------------------------------------------------- char *Player::GetRangedDamageString() - { +{ signed int itemid; // eax@1 int min_damage; // edi@3 int max_damage; // eax@3 @@ -1890,7 +1882,7 @@ //----- (0048D45A) -------------------------------------------------------- bool Player::CanTrainToNextLevel() { - int lvl = this->uLevel; + int lvl = this->uLevel + 1; int neededExp = ((lvl * (lvl - 1)) / 2 * 1000); return this->uExperience >= neededExp; } @@ -2021,7 +2013,7 @@ } //----- (0048D76C) -------------------------------------------------------- -bool Player::StealFromShop(ItemGen *a2, int a3, int a4, int a5, int *a6) +bool Player::StealFromShop(ItemGen *a2, int a3, int reputation, int a5, int *a6) { unsigned __int16 v6; // cx@8 int v7; // edi@8 @@ -2051,7 +2043,7 @@ if ( !pItemsTable->pItems[a2->uItemID].uEquipType || v10 == 1 || v10 == 2 ) v9 *= 3; v11 = dword_4EDEB4[rand() % 100 / 20] + v7 * dword_4EDEA0[v8]; - *a6 = 100 * (a4 + a3) + v9 + (a5 != 0 ? 0x1F4 : 0); + *a6 = 100 * (reputation + a3) + v9 + (a5 != 0 ? 0x1F4 : 0); if ( rand() % 100 >= 5 ) { if ( *a6 > v11 )