diff Player.cpp @ 1708:f8414042db1f

Moving NZIArray to a separate class, fixing a few inventory bugs
author Grumpy7
date Mon, 23 Sep 2013 07:07:06 +0200
parents ef42788fef1d
children 8251e59fd7c1
line wrap: on
line diff
--- a/Player.cpp	Sun Sep 22 19:48:02 2013 +0200
+++ b/Player.cpp	Mon Sep 23 07:07:06 2013 +0200
@@ -3139,7 +3139,7 @@
           v22 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND);
           if ( v22 >= 0 && v22 <= 2)
           {
-            v23 = this->pOwnItems[this->pEquipment.uMainHand].uItemID;
+            v23 = this->pOwnItems[this->pEquipment.uMainHand - 1].uItemID;
             v26 = pItemsTable->pItems[v23].uDamageRoll;
             if ( this->pEquipment.uShield || pItemsTable->pItems[v23].uSkillType != 4 )
             {
@@ -3152,13 +3152,13 @@
             v5 = pItemsTable->pItems[v23].uDamageMod + v25 * v26;
           }
         }
-        if ( getOnlyMainHandDmg || !this->HasItemEquipped(EQUIP_OFF_HAND) ||  (GetEquippedItemEquipType(EQUIP_OFF_HAND) < 0 && GetEquippedItemEquipType(EQUIP_OFF_HAND) > 2))
+        if ( getOnlyMainHandDmg || !this->HasItemEquipped(EQUIP_OFF_HAND) ||  (GetEquippedItemEquipType(EQUIP_OFF_HAND) < 0 || GetEquippedItemEquipType(EQUIP_OFF_HAND) > 2))
         {
             return v5;
         }
         else
         {
-          v23 = this->pOwnItems[this->pEquipment.uShield].uItemID;
+          v23 = this->pOwnItems[this->pEquipment.uShield - 1].uItemID;
           v15 = pItemsTable->pItems[v23].uDamageMod;
           v14 = pItemsTable->pItems[v23].uDamageDice * pItemsTable->pItems[v23].uDamageRoll;
           return v5 + v15 + v14;
@@ -3200,9 +3200,9 @@
         v9 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND);
         if ( v9 >= 0 && v9 <= 2)
         {
-          v5 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uDamageDice +
-            pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uDamageMod;
-          if ( !this->pEquipment.uShield && pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uSkillType == 4)
+          v5 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand - 1].uItemID].uDamageDice +
+            pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand - 1].uItemID].uDamageMod;
+          if ( !this->pEquipment.uShield && pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand - 1].uItemID].uSkillType == 4)
           {
             ++v5;
           }
@@ -3773,7 +3773,7 @@
     {
       if ( this->HasItemEquipped((ITEM_EQUIP_TYPE)i) )
       {
-        int currItemId = this->pInventoryItemList[this->pEquipment.pIndices[i]].uItemID;
+        int currItemId = this->pInventoryItemList[this->pEquipment.pIndices[i] - 1].uItemID;
         if ( pItemsTable->pItems[currItemId].uEquipType == EQUIP_MAIN_HAND || pItemsTable->pItems[currItemId].uEquipType == EQUIP_OFF_HAND )
         {
           PLAYER_SKILL_TYPE currItemSkillType = (PLAYER_SKILL_TYPE)pItemsTable->pItems[currItemId].uSkillType;