diff UI/UICharacter.cpp @ 2156:eaaaa50d34e9

GetItemBonusEnchantment
author Ritor1
date Fri, 10 Jan 2014 17:42:37 +0600
parents d28d3c006077
children c6d8253d4cbc
line wrap: on
line diff
--- a/UI/UICharacter.cpp	Thu Jan 09 02:34:20 2014 +0200
+++ b/UI/UICharacter.cpp	Fri Jan 10 17:42:37 2014 +0600
@@ -2178,6 +2178,7 @@
   if ( player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_BODY) > 99 || player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_BODY) > 99 )
     a2 = "%s\f%05u\t180%d\f00000 / %d\n";
   pY += LOBYTE(pFontArrus->uFontHeight) - 2;
+  int it = player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_BODY);
   sprintf(pTmpBuf.data(), a2, pGlobalTXT_LocalizationStrings[29],
           UI_GetHealthManaAndOtherQualitiesStringColor(player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_BODY), player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_BODY)),
           player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_BODY), player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_BODY));
@@ -2331,14 +2332,13 @@
   int v23; // eax@62
   int v26; // eax@69
   int v34; // esi@90
-  int v36; // esi@93
-  ItemGen *v38; // edi@93
   ItemGen _this; // [sp+Ch] [bp-40h]@1
   unsigned int v48; // [sp+30h] [bp-1Ch]@88
   unsigned int v50; // [sp+38h] [bp-14h]@50
   int v51; // [sp+3Ch] [bp-10h]@1
   int v52; // [sp+40h] [bp-Ch]@5
   ITEM_EQUIP_TYPE pEquipType;
+  CastSpellInfo *pSpellInfo;
 
   v51 = 0;
   _this.Reset();
@@ -2618,7 +2618,7 @@
           pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0);
           return;
         }
-        if ( v1 )//взять двуручный меч кода нет щита(замещение оружия)
+        if ( v1 )//взять двуручный меч когда нет щита(замещение оружия)
         {
           if ( v2 )
           {
@@ -2639,7 +2639,7 @@
           v52 = pPlayers[uActiveCharacter]->FindFreeInventoryListSlot();
           if ( v52 >= 0 )
           {
-            if ( v2 )//взять двуручный меч кода есть щит(замещение щитом)
+            if ( v2 )//взять двуручный меч когда есть щит(замещение щитом)
             {
               v2--;
               memcpy(&_this, &pParty->pPickedItem, sizeof(_this));
@@ -2672,10 +2672,10 @@
   v34 = pRenderer->pActiveZBuffer[pMouse->uMouseClickX + pSRZBufferLineOffsets[pMouse->uMouseClickY]] & 0xFFFF;
   if ( v34 )
   {
-    v36 = v34 - 1;
-    v38 = &pPlayers[uActiveCharacter]->pInventoryItemList[v36];
-    pEquipType = v38->GetItemEquipType();
-    if ( v38->uItemID == ITEM_WETSUIT )
+    //v36 = v34 - 1;
+    //v38 = &pPlayers[uActiveCharacter]->pInventoryItemList[v34 - 1];
+    pEquipType = pPlayers[uActiveCharacter]->pInventoryItemList[v34 - 1].GetItemEquipType();
+    if ( pPlayers[uActiveCharacter]->pInventoryItemList[v34 - 1].uItemID == ITEM_WETSUIT )
     {
       if ( bUnderwater )
       {
@@ -2686,11 +2686,17 @@
     }
     if ( _50C9A0_IsEnchantingInProgress )//наложить закл на экипировку
     {
-      *((char *)pGUIWindow_Settings->ptr_1C + 8) &= 0x7Fu;//CastSpellInfo
+      /* *((char *)pGUIWindow_Settings->ptr_1C + 8) &= 0x7Fu;//CastSpellInfo
       *((short *)pGUIWindow_Settings->ptr_1C + 2) = uActiveCharacter - 1;
       *((int *)pGUIWindow_Settings->ptr_1C + 3) = v36;
-      *((short *)pGUIWindow_Settings->ptr_1C + 3) = pEquipType;
-      ptr_50C9A4_ItemToEnchant = v38;
+      *((short *)pGUIWindow_Settings->ptr_1C + 3) = pEquipType;*/
+      pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C;
+      pSpellInfo->uFlags &= 0x7F;
+      pSpellInfo->uPlayerID_2 = uActiveCharacter - 1;
+      pSpellInfo->spell_target_pid = v34 - 1;
+      pSpellInfo->field_6 = pEquipType;
+
+      ptr_50C9A4_ItemToEnchant = &pPlayers[uActiveCharacter]->pInventoryItemList[v34 - 1];
       _50C9A0_IsEnchantingInProgress = 0;
       if ( pMessageQueue_50CBD0->uNumMessages )
         pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
@@ -2703,9 +2709,9 @@
     {
       if ( !ptr_50C9A4_ItemToEnchant )//снять вещь
       {
-        pParty->SetHoldingItem(v38);
-        pPlayers[uActiveCharacter]->pEquipment.pIndices[pPlayers[uActiveCharacter]->pInventoryItemList[v36].uBodyAnchor - 1] = 0;
-        v38->Reset();
+        pParty->SetHoldingItem(&pPlayers[uActiveCharacter]->pInventoryItemList[v34 - 1]);
+        pPlayers[uActiveCharacter]->pEquipment.pIndices[pPlayers[uActiveCharacter]->pInventoryItemList[v34 - 1].uBodyAnchor - 1] = 0;
+        pPlayers[uActiveCharacter]->pInventoryItemList[v34 - 1].Reset();
       }
     }
   }