changeset 1565:58420268d87d

fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
author Grumpy7
date Sun, 08 Sep 2013 04:10:22 +0200
parents 461c2eca401b
children 1e5086f7d401
files Player.cpp
diffstat 1 files changed, 34 insertions(+), 42 deletions(-) [+]
line wrap: on
line diff
--- 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 )