changeset 1020:3413ad40cc88

Merge
author Gloval
date Tue, 21 May 2013 07:24:49 +0400
parents 32ec62bbaa2c (diff) 9ac94d00012e (current diff)
children 67e33708d815
files GUIWindow.h Player.cpp UIHouses.cpp mm7_5.cpp
diffstat 6 files changed, 418 insertions(+), 485 deletions(-) [+]
line wrap: on
line diff
--- a/GUIWindow.h	Tue May 21 02:24:31 2013 +0200
+++ b/GUIWindow.h	Tue May 21 07:24:49 2013 +0400
@@ -119,7 +119,7 @@
   UIMSG_HiredNPC_CastSpell = 143,
   UIMSG_PlayerCreation_VoicePrev = 144,
   UIMSG_PlayerCreation_VoiceNext = 145,
-  UIMSG_92 = 146,
+  UIMSG_SpellScrollUse = 146,
 
   UIMSG_StartNPCDialogue = 161,
   UIMSG_ArrowUp = 162,
--- a/Items.h	Tue May 21 02:24:31 2013 +0200
+++ b/Items.h	Tue May 21 07:24:49 2013 +0400
@@ -145,10 +145,10 @@
 
 
 
-  int uItemID;
-  int uEnchantmentType;
-  int _bonus_strength;
-  int uSpecEnchantmentType; // 25  +5 levels
+  int uItemID; //0
+  int uEnchantmentType; //4
+  int _bonus_strength;  //8
+  int uSpecEnchantmentType; // 25  +5 levels //0c
                             // 16  Drain Hit Points from target.
                             // 39  Double damage vs Demons.
                             // 40  Double damage vs Dragons
@@ -165,8 +165,8 @@
                             // 68  Adds 6-8 points of Cold damage and +5 Armor Class.
                             // 71  Prevents drowning damage.
                             // 72  Prevents falling damage.
-  int uNumCharges;
-  unsigned int uAttributes;
+  int uNumCharges; //10
+  unsigned int uAttributes;  //14
   unsigned __int8 uBodyAnchor;
   char uMaxCharges;
   char uHolderPlayer;
--- a/Player.cpp	Tue May 21 02:24:31 2013 +0200
+++ b/Player.cpp	Tue May 21 07:24:49 2013 +0400
@@ -2190,7 +2190,14 @@
   uLevel = sLevelModifier = 0;
   sAgeModifier = 0;
 
-  memset(field_1F5, 0, 30);
+//  memset(field_1F5, 0, 30);
+  pure_luck_used=0;      
+  pure_speed_used=0; 
+  pure_intellect_used=0;  
+  pure_endurance_used=0;  
+  pure_willpower_used=0;       
+  pure_accuracy_used=0;      
+  pure_might_used=0;  
 
   sResFireBase = sResFireBonus = 0;
   sResAirBase = sResAirBonus = 0;
@@ -3258,7 +3265,8 @@
     v14 = v3->pEquipment.uArmor;
     if ( v14 )
     {
-      if ( !(v3->field_1F5[36 * v14 + 15] & 2) )
+     // if ( !(v3->field_1F5[36 * v14 + 15] & 2) )
+      if (v3->pOwnItems[v14-1].uAttributes&2) 
       {
         v15 = GetEquippedItemSkillType(EQUIP_ARMOUR) - 10;
         if ( v15 )
@@ -3604,11 +3612,11 @@
     if ( v3->sHealth + v3->uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1
       || (signed __int64)v3->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime > 0 )
     {
-      SetCondition(0xDu, 0);
+      SetCondition(Condition_Unconcious, 0);
     }
     else
     {
-      SetCondition(0xEu, 0);
+      SetCondition(Condition_Dead, 0);
       v6 = LODWORD(pParty->uTimePlayed);
       if ( v3->sHealth > 0 )
         v3->sHealth = 0;
@@ -3618,7 +3626,8 @@
       v7 = v3->pEquipment.uArmor;
       if ( v7 )
       {
-        v8 = &v3->field_1F5[36 * v7 + 15];
+//        v8 = &v3->field_1F5[36 * v7 + 15];
+        v8=(char*)&v3->pOwnItems[v7-1].uAttributes;
         v9 = *(int *)v8;
         if ( !(BYTE1(v9) & 2) )
         {
@@ -6827,7 +6836,7 @@
 }
 
 //----- (004680ED) --------------------------------------------------------
-void Player::UseItem_DrinkPotion_etc(signed int a2, int a3)
+void Player::UseItem_DrinkPotion_etc(signed int player_num, int a3)
 {
   Player *v3; // esi@1
   unsigned int v4; // ebx@4
@@ -6850,17 +6859,17 @@
   signed int v21; // eax@81
   const char *v22; // eax@84
   char *v23; // ecx@90
-  int v24; // esi@96
+  int scroll_id; // esi@96
   int v25; // eax@109
   int v26; // eax@113
-  char *v27; // edi@114
+  int new_mana_val; // edi@114
   signed __int64 v28; // qax@120
   char *v29; // ecx@120
-  int v30; // edi@137
+  __int64 v30; // edi@137
   int v31; // ST30_4@137
-  int v32; // ST3C_4@137
+  __int64 v32; // ST3C_4@137
   int v33; // ST40_4@137
-  int v34; // ST34_4@137
+  __int64 v34; // ST34_4@137
   int v35; // ST38_4@137
   unsigned __int8 v36; // al@173
   SoundID v37; // [sp-20h] [bp-4Ch]@18
@@ -6906,354 +6915,324 @@
   unsigned int thisa; // [sp+28h] [bp-4h]@22
 
   thisb = this;
-  v3 = &pParty->pPlayers[a2-1];
+  v3 = &pParty->pPlayers[player_num-1];
   v73 = 1;
   if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3) )
     return;
   v4 = 0;
-  if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == 13 )
+  if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_REAGENT )
   {
     if ( pParty->pPickedItem.uItemID != 160 )
     {
       if ( pParty->pPickedItem.uItemID == 161 )
       {
-        v27 = (char *)&v3->sMana;
-        *(int *)v27 += 2;
-LABEL_170:
-        if ( *(int *)v27 > v3->GetMaxMana() )
-          *(int *)v27 = v3->GetMaxMana();
+        new_mana_val = v3->sMana;
+        new_mana_val += 2;
+
+        if ( new_mana_val > v3->GetMaxMana() )
+          new_mana_val = v3->GetMaxMana();
       }
       else
       {
         if ( pParty->pPickedItem.uItemID != 162 )
         {
-LABEL_167:
+
           v68 = pParty->pPickedItem.GetDisplayName();
           v58 = pGlobalTXT_LocalizationStrings[36];
           goto LABEL_90;
         }
         v69 = 2;
-LABEL_111:
-        pParty->pPlayers[a2-1].Heal(v69);
-      }
-LABEL_112:
+
+        pParty->pPlayers[player_num-1].Heal(v69);
+      }
       v3->PlaySound(SPEECH_36, 0);
       goto LABEL_173;
     }
-LABEL_172:
-    pParty->pPlayers[a2-1].SetCondition(6u, 1);
+    pParty->pPlayers[player_num-1].SetCondition(Condition_Poison1, 1);
     goto LABEL_173;
   }
-  if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == 14 )
+  if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_POTION )
   {
     switch ( pParty->pPickedItem.uItemID )
     {
-      case 0xDEu:
+      case 221: //Catalyst
+          pParty->pPlayers[player_num-1].SetCondition(Condition_Poison1, 1);
+          goto LABEL_173;
+      case 222: //Cure Wounds
         v25 = pParty->pPickedItem.uEnchantmentType + 10;
-        goto LABEL_110;
-      case 0xDFu:
+        pParty->pPlayers[player_num-1].Heal(v25);
+        v3->PlaySound(SPEECH_36, 0);
+         goto LABEL_173;
+      case 223: //Magic Potion
         v26 = pParty->pPickedItem.uEnchantmentType + 10;
-        goto LABEL_114;
-      case 0xE0u:
-        LODWORD(v3->pConditions[1]) = 0;
-        HIDWORD(v3->pConditions[1]) = 0;
-        goto LABEL_112;
-      case 0xE1u:
-        LODWORD(v3->pConditions[11]) = 0;
-        HIDWORD(v3->pConditions[11]) = 0;
-        LODWORD(v3->pConditions[9]) = 0;
-        HIDWORD(v3->pConditions[9]) = 0;
-        LODWORD(v3->pConditions[7]) = 0;
-        HIDWORD(v3->pConditions[7]) = 0;
-        goto LABEL_112;
-      case 0xE2u:
-        LODWORD(v3->pConditions[10]) = 0;
-        HIDWORD(v3->pConditions[10]) = 0;
-        LODWORD(v3->pConditions[8]) = 0;
-        HIDWORD(v3->pConditions[8]) = 0;
-        LODWORD(v3->pConditions[6]) = 0;
-        HIDWORD(v3->pConditions[6]) = 0;
-        goto LABEL_112;
-      case 0xE3u:
-        LODWORD(v3->pConditions[2]) = 0;
-        HIDWORD(v3->pConditions[2]) = 0;
-        goto LABEL_112;
-      case 0xE4u:
-        if ( v3->pConditions[1] )
-          goto LABEL_173;
-        v70 = 0;
-        v59 = 0;
-        v50 = 5;
-        v46 = 3;
+        new_mana_val = v3->sMana;
+        new_mana_val += v26;
+        if ( new_mana_val > v3->GetMaxMana() )
+            new_mana_val = v3->GetMaxMana();
+        v3->PlaySound(SPEECH_36, 0);
+        goto LABEL_173;
+      case 224: //Cure Weakness
+        v3->pConditions[Condition_Weak] = 0i64;
+        v3->PlaySound(SPEECH_36, 0);
+        goto LABEL_173;
+      case 225: //Cure Disease
+        v3->pConditions[Condition_Disease3] = 0i64;      
+        v3->pConditions[Condition_Disease2] = 0i64;
+        v3->pConditions[Condition_Disease1] = 0i64;
+        v3->PlaySound(SPEECH_36, 0);
+        goto LABEL_173;
+      case 226: //Cure Poison
+        v3->pConditions[Condition_Poison3] = 0i64;
+        v3->pConditions[Condition_Poison2] = 0i64;
+        v3->pConditions[Condition_Poison1] = 0i64;
+        v3->PlaySound(SPEECH_36, 0);
+        goto LABEL_173;
+      case 227: //Awaken
+        v3->pConditions[Condition_Sleep] = 0i64;
+        v3->PlaySound(SPEECH_36, 0);
+        goto LABEL_173;
+      case 228: //Haste
+        if ( !v3->pConditions[Condition_Weak] )
+            {
+            v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
+            v3->pPlayerBuffs[7].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0);
+            v3->PlaySound(SPEECH_36, 0);
+            }
+        goto LABEL_173;
+      case 229: //Heroism
         v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
-        v29 = (char *)&v3->pPlayerBuffs[7];
-        goto LABEL_147;
-      case 0xE5u:
-        v70 = 0;
-        v59 = 0;
-        v50 = 5;
-        v46 = 3;
+        v3->pPlayerBuffs[8].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0);
+        v3->PlaySound(SPEECH_36, 0);
+        goto LABEL_173;
+      case 230: //Bless
         v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
-        v29 = (char *)&v3->pPlayerBuffs[8];
-        goto LABEL_147;
-      case 0xE6u:
-        v70 = 0;
-        v59 = 0;
-        v50 = 5;
-        v46 = 3;
-        v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
-        v29 = (char *)&v3->pPlayerBuffs[1];
-        goto LABEL_147;
-      case 0xE7u:
-        v70 = 0;
-        v59 = 0;
+        v3->pPlayerBuffs[1].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0);
+        v3->PlaySound(SPEECH_36, 0);
+        goto LABEL_173;
+      case 231: //Preservation
         v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType);
-        v46 = 0;
         v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
-        v29 = (char *)&v3->pPlayerBuffs[11];
-        goto LABEL_147;
-      case 0xE8u:
-        v70 = 0;
-        v59 = 0;
+        v3->pPlayerBuffs[11].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
+        v3->PlaySound(SPEECH_36, 0);
+        goto LABEL_173;
+      case 232: //Shield
         v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType);
-        v46 = 0;
         v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
-        v29 = (char *)&v3->pPlayerBuffs[13];
-        goto LABEL_147;
-      case 0xEAu:
-        v70 = 0;
-        v59 = 0;
-        v50 = 5;
-        v46 = 3;
+        v3->pPlayerBuffs[13].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
+        v3->PlaySound(SPEECH_36, 0);
+        goto LABEL_173;
+      case 234: //Stoneskin
         v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
-        v29 = (char *)&v3->pPlayerBuffs[14];
-        goto LABEL_147;
-      case 0xEBu:
-        v3->pPlayerBuffs[23].Apply(
-          pParty->uTimePlayed + (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335),
-          3u,
-          5u,
-          0,
-          0);
+        v3->pPlayerBuffs[14].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0);
+        v3->PlaySound(SPEECH_36, 0);
+        goto LABEL_173;
+      case 235: //Water Breathing
+        v28 =   (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335),
+        v3->pPlayerBuffs[23].Apply(pParty->uTimePlayed +v28,  3, 5, 0, 0);
         goto LABEL_173;
-      case 0xEDu:
-        LODWORD(v3->pConditions[3]) = 0;
-        HIDWORD(v3->pConditions[3]) = 0;
-        goto LABEL_112;
-      case 0xEEu:
-        LODWORD(v3->pConditions[0]) = 0;
-        HIDWORD(v3->pConditions[0]) = 0;
-        goto LABEL_112;
-      case 0xEFu:
-        LODWORD(v3->pConditions[5]) = 0;
-        HIDWORD(v3->pConditions[5]) = 0;
-        goto LABEL_112;
-      case 0xF0u:
-        v70 = 0;
-        v59 = 0;
+      case 237: //Remove Fear
+        v3->pConditions[Condition_Fear] = 0i64;
+        v3->PlaySound(SPEECH_36, 0);
+        goto LABEL_173;
+      case 238: //Remove Curse
+        v3->pConditions[Condition_Cursed] = 0i64;
+        v3->PlaySound(SPEECH_36, 0);
+        goto LABEL_173;
+      case 239: //Cure Insanity
+        v3->pConditions[Condition_Insane] = 0i64;
+        v3->PlaySound(SPEECH_36, 0);
+        goto LABEL_173;
+      case 240: //Might Boost
         v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType);
-        v46 = 0;
         v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
-        v29 = (char *)&v3->pPlayerBuffs[19];
-        goto LABEL_147;
-      case 0xF1u:
-        v70 = 0;
-        v59 = 0;
-        v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType);
-        v46 = 0;
-        v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
-        v29 = (char *)&v3->pPlayerBuffs[17];
-        goto LABEL_147;
-      case 0xF2u:
-        v70 = 0;
-        v59 = 0;
+        v3->pPlayerBuffs[19].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
+        v3->PlaySound(SPEECH_36, 0);
+        goto LABEL_173;
+      case 241: //Intellect Boost
         v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType);
-        v46 = 0;
         v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
-        v29 = (char *)&v3->pPlayerBuffs[20];
-        goto LABEL_147;
-      case 0xF3u:
-        v70 = 0;
-        v59 = 0;
+        v3->pPlayerBuffs[17].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
+        v3->PlaySound(SPEECH_36, 0);
+        goto LABEL_173;
+      case 242: //Personality Boost
         v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType);
-        v46 = 0;
         v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
-        v29 = (char *)&v3->pPlayerBuffs[16];
-        goto LABEL_147;
-      case 0xF4u:
-        v70 = 0;
-        v59 = 0;
+        v3->pPlayerBuffs[20].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
+        v3->PlaySound(SPEECH_36, 0);
+        goto LABEL_173;
+      case 243://Endurance Boost
         v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType);
-        v46 = 0;
         v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
-        v29 = (char *)&v3->pPlayerBuffs[21];
-        goto LABEL_147;
-      case 0xF5u:
-        v70 = 0;
-        v59 = 0;
+        v3->pPlayerBuffs[16].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
+        v3->PlaySound(SPEECH_36, 0);
+        goto LABEL_173;
+      case 244: //Speed Boost
         v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType);
-        v46 = 0;
         v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
-        v29 = (char *)&v3->pPlayerBuffs[15];
-        goto LABEL_147;
-      case 0xFBu:
-        LODWORD(v3->pConditions[12]) = 0;
-        HIDWORD(v3->pConditions[12]) = 0;
-        goto LABEL_112;
-      case 0xFCu:
-        v30 = LODWORD(v3->pConditions[14]);
-        v31 = HIDWORD(v3->pConditions[14]);
-        v32 = LODWORD(v3->pConditions[15]);
-        v33 = HIDWORD(v3->pConditions[15]);
-        v34 = LODWORD(v3->pConditions[16]);
-        v35 = HIDWORD(v3->pConditions[16]);
-        memset(&pParty->pPlayers[a2-1],0,0xA0u);
-        HIDWORD(v3->pConditions[14]) = v31;
-        LODWORD(v3->pConditions[15]) = v32;
-        HIDWORD(v3->pConditions[15]) = v33;
-        LODWORD(v3->pConditions[16]) = v34;
-        LODWORD(v3->pConditions[14]) = v30;
-        HIDWORD(v3->pConditions[16]) = v35;
-        goto LABEL_112;
-      case 0xFDu:
+       v3->pPlayerBuffs[21].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
+        v3->PlaySound(SPEECH_36, 0);
+        goto LABEL_173;
+      case 245: //Accuracy Boost
+        v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType);
+        v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
+        v3->pPlayerBuffs[15].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
+        v3->PlaySound(SPEECH_36, 0);
+        goto LABEL_173;
+      case 251: //Cure Paralysis
+        v3->pConditions[Condition_Paralyzed] = 0i64;
+        v3->PlaySound(SPEECH_36, 0);
+        goto LABEL_173;
+      case 252://Divine Restoration
+        v30 = v3->pConditions[Condition_Dead];
+        v32 = v3->pConditions[Condition_Pertified];
+        v34 = v3->pConditions[Condition_Eradicated];    
+        memset(&pParty->pPlayers[player_num-1].pConditions,0,sizeof(pConditions));
+        v3->pConditions[Condition_Dead] = v30;
+        v3->pConditions[Condition_Pertified] = v32;
+        v3->pConditions[Condition_Eradicated] = v34;
+        v3->PlaySound(SPEECH_36, 0);
+        goto LABEL_173;
+      case 253: //Divine Cure
         v25 = 5 * pParty->pPickedItem.uEnchantmentType;
-LABEL_110:
-        v69 = v25;
-        goto LABEL_111;
-      case 0xFEu:
+        pParty->pPlayers[player_num-1].Heal(v25);
+        v3->PlaySound(SPEECH_36, 0);
+        goto LABEL_173;
+      case 254: //Divine Power
         v26 = 5 * pParty->pPickedItem.uEnchantmentType;
-LABEL_114:
-        v27 = (char *)&v3->sMana;
-        *(int *)v27 += v26;
-        goto LABEL_170;
-      case 0xFFu:
-        v70 = 0;
-        v59 = 0;
-        v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType);
-        v46 = 0;
-        v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
-        v29 = (char *)&v3->pPlayerBuffs[18];
-        goto LABEL_147;
-      case 0x100u:
-        v70 = 0;
-        v59 = 0;
+        new_mana_val = v3->sMana;
+        new_mana_val += v26;
+        if ( new_mana_val > v3->GetMaxMana() )
+             new_mana_val = v3->GetMaxMana();
+        v3->PlaySound(SPEECH_36, 0);
+        goto LABEL_173;
+      case 255: //Luck Boost
         v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType);
-        v46 = 0;
         v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
-        v29 = (char *)&v3->pPlayerBuffs[5];
-        goto LABEL_147;
-      case 0x101u:
-        v70 = 0;
-        v59 = 0;
+        v3->pPlayerBuffs[18].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
+        v3->PlaySound(SPEECH_36, 0);
+        goto LABEL_173;
+      case 256: //Fire Resistance
         v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType);
-        v46 = 0;
         v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
-        v29 = (char *)v3->pPlayerBuffs;
-        goto LABEL_147;
-      case 0x102u:
-        v70 = 0;
-        v59 = 0;
+        v3->pPlayerBuffs[5].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
+        v3->PlaySound(SPEECH_36, 0);
+        goto LABEL_173;
+      case 257: //Air Resistance
         v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType);
-        v46 = 0;
+        v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
+        v3->pPlayerBuffs[0].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
+        v3->PlaySound(SPEECH_36, 0);
+        goto LABEL_173;
+      case 258: //Water Resistance
+        v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType);
         v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
-        v29 = (char *)&v3->pPlayerBuffs[22];
-        goto LABEL_147;
-      case 0x103u:
-        v70 = 0;
-        v59 = 0;
+        v3->pPlayerBuffs[22].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
+        v3->PlaySound(SPEECH_36, 0);
+        goto LABEL_173;
+      case 259: //Earth Resistance
         v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType);
-        v46 = 0;
         v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
-        v29 = (char *)&v3->pPlayerBuffs[3];
-        goto LABEL_147;
-      case 0x104u:
-        v70 = 0;
-        v59 = 0;
+        v3->pPlayerBuffs[3].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
+        v3->PlaySound(SPEECH_36, 0);
+        goto LABEL_173;
+      case 260: //Mind Resistance
         v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType);
-        v46 = 0;
         v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
-        v29 = (char *)&v3->pPlayerBuffs[9];
-        goto LABEL_147;
-      case 0x105u:
-        v70 = 0;
-        v59 = 0;
+        v3->pPlayerBuffs[9].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
+        v3->PlaySound(SPEECH_36, 0);
+        goto LABEL_173;
+      case 261: //Body Resistance
         v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType);
-        v46 = 0;
         v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
-        v29 = (char *)&v3->pPlayerBuffs[2];
-LABEL_147:
-        ((SpellBuff *)v29)->Apply(pParty->uTimePlayed + v28, v46, v50, v59, v70);
-        goto LABEL_112;
-      case 0x106u:
-        LODWORD(v3->pConditions[15]) = 0;
-        HIDWORD(v3->pConditions[15]) = 0;
-        goto LABEL_112;
-      case 0x108u:
-        if ( !*(int *)&v3->field_1F5[3] )
+        v3->pPlayerBuffs[2].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
+        v3->PlaySound(SPEECH_36, 0);
+        goto LABEL_173;
+      case 262: //Stone to Flesh
+        v3->pConditions[Condition_Pertified] = 0i64;
+        v3->PlaySound(SPEECH_36, 0);
+        goto LABEL_173;
+      case 264: //Pure Luck
+        if ( !v3->pure_luck_used )
         {
           v3->uLuck += 50;
-          *(int *)&v3->field_1F5[3] = 1;
+          v3->pure_luck_used = 1;
         }
-        goto LABEL_112;
-      case 0x109u:
-        if ( !*(int *)&v3->field_1F5[7] )
+        v3->PlaySound(SPEECH_36, 0);
+        goto LABEL_173;
+      case 265: //Pure Speed
+        if ( !v3->pure_speed_used )
         {
           v3->uSpeed += 50;
-          *(int *)&v3->field_1F5[7] = 1;
+          v3->pure_speed_used = 1;
         }
-        goto LABEL_112;
-      case 0x10Au:
-        if ( !*(int *)&v3->field_1F5[11] )
+        v3->PlaySound(SPEECH_36, 0);
+        goto LABEL_173;
+      case 266: //Pure Intellect
+        if ( !v3->pure_intellect_used )
         {
           v3->uIntelligence += 50;
-          *(int *)&v3->field_1F5[11] = 1;
+          v3->pure_intellect_used = 1;
         }
-        goto LABEL_112;
-      case 0x10Bu:
-        if ( !*(int *)&v3->field_1F5[15] )
+        v3->PlaySound(SPEECH_36, 0);
+        goto LABEL_173;
+      case 267: //Pure Endurance
+        if ( !v3->pure_endurance_used )
         {
           v3->uEndurance += 50;
-          *(int *)&v3->field_1F5[15] = 1;
+          v3->pure_endurance_used = 1;
         }
-        goto LABEL_112;
-      case 0x10Cu:
-        if ( !*(int *)&v3->field_1F5[19] )
+        v3->PlaySound(SPEECH_36, 0);
+        goto LABEL_173;
+      case 268:  //Pure Personality
+        if ( !v3->pure_willpower_used )
         {
           v3->uWillpower += 50;
-          *(int *)&v3->field_1F5[19] = 1;
+          v3->pure_willpower_used = 1;
         }
-        goto LABEL_112;
-      case 0x10Du:
-        if ( !*(int *)&v3->field_1F5[23] )
+        v3->PlaySound(SPEECH_36, 0);
+        goto LABEL_173;
+      case 269: //Pure Accuracy
+        if ( !v3->pure_accuracy_used )
         {
           v3->uAccuracy += 50;
-          *(int *)&v3->field_1F5[23] = 1;
+          v3->pure_accuracy_used = 1;
         }
-        goto LABEL_112;
-      case 0x10Eu:
-        if ( !*(int *)&v3->field_1F5[27] )
+        v3->PlaySound(SPEECH_36, 0);
+        goto LABEL_173;
+      case 270: //Pure Might
+        if ( !v3->pure_might_used )
         {
           v3->uMight += 50;
-          *(int *)&v3->field_1F5[27] = 1;
+          v3->pure_might_used = 1;
         }
-        goto LABEL_112;
-      case 0x10Fu:
+        v3->PlaySound(SPEECH_36, 0);
+        goto LABEL_173;
+      case 271: //Rejuvenation
         v3->sAgeModifier = 0;
-        goto LABEL_112;
-      case 0xDDu:
-        goto LABEL_172;
+        v3->PlaySound(SPEECH_36, 0);
+        goto LABEL_173;
+     
       default:
-        goto LABEL_167;
-    }
-    goto LABEL_172;
-  }
-  if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType != 15 )
-  {
-    if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType != 16 )
-    {
-      if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType != 17 )
-      {
-        if ( pParty->pPickedItem.uItemID == 616 )
+          v68 = pParty->pPickedItem.GetDisplayName();
+          v58 = pGlobalTXT_LocalizationStrings[36];  //"%s can not be used that way"
+          sprintfex(pTmpBuf, v58, v68);
+          ShowStatusBarString(pTmpBuf, 2u);
+          pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
+          return;
+
+    }
+    pParty->pPlayers[player_num-1].SetCondition(Condition_Poison1, 1);
+    goto LABEL_173;
+  }
+
+
+  if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType != EQUIP_SPELL_SCROLL )
+  {
+    if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType != EQUIP_BOOK )
+    {
+      if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType != EQUIP_MESSAGE_SCROLL )
+      {
+        if ( pParty->pPickedItem.uItemID == 616 ) //Genie Lamp
         {
           thisa = pParty->uCurrentMonthWeek + 1;
           if ( pParty->uCurrentMonth >= 7 )
@@ -7262,215 +7241,180 @@
             v74 = aAttributeNames[pParty->uCurrentMonth];
           switch ( pParty->uCurrentMonth )
           {
-            case 0u:
+            case 0:
               v6 = pParty->uCurrentMonthWeek + 1;
               v3->uMight += thisa;
-              goto LABEL_33;
-            case 1u:
+              v62 = pGlobalTXT_LocalizationStrings[121]; //"Permanent"	
+              v53 = v74;
+              v49 = v6;
+              sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62);
+              break;
+            case 1:
               v6 = pParty->uCurrentMonthWeek + 1;
               v3->uIntelligence += thisa;
-              goto LABEL_33;
-            case 2u:
+              v62 = pGlobalTXT_LocalizationStrings[121];
+              v53 = v74;
+              v49 = v6;
+              sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62);
+              break;
+            case 2:
               v6 = pParty->uCurrentMonthWeek + 1;
               v3->uWillpower += thisa;
-              goto LABEL_33;
-            case 3u:
+              v62 = pGlobalTXT_LocalizationStrings[121];
+              v53 = v74;
+              v49 = v6;
+              sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62);
+              break;
+            case 3:
               v6 = pParty->uCurrentMonthWeek + 1;
               v3->uEndurance += thisa;
-              goto LABEL_33;
-            case 4u:
+              v62 = pGlobalTXT_LocalizationStrings[121];
+              v53 = v74;
+              v49 = v6;
+              sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62);
+              break;
+            case 4:
               v6 = pParty->uCurrentMonthWeek + 1;
               v3->uAccuracy += thisa;
-              goto LABEL_33;
-            case 5u:
+              v62 = pGlobalTXT_LocalizationStrings[121];
+              v53 = v74;
+              v49 = v6;
+              sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62);
+              break;
+            case 5:
               v6 = pParty->uCurrentMonthWeek + 1;
               v3->uSpeed += thisa;
-              goto LABEL_33;
-            case 6u:
+              v62 = pGlobalTXT_LocalizationStrings[121];
+              v53 = v74;
+              v49 = v6;
+              sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62);
+              break;
+            case 6:
               v6 = pParty->uCurrentMonthWeek + 1;
               v3->uLuck += thisa;
-LABEL_33:
               v62 = pGlobalTXT_LocalizationStrings[121];
               v53 = v74;
               v49 = v6;
-              goto LABEL_53;
-            case 7u:
+              sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62);
+              break;
+            case 7:
               party_finds_gold(1000 * thisa, 0);
-              v63 = pGlobalTXT_LocalizationStrings[97];
+              v63 = pGlobalTXT_LocalizationStrings[97];//"Gold"
               v54 = 1000 * thisa;
-              goto LABEL_38;
-            case 8u:
-              Party::GiveFood(5 * thisa);
-              v63 = pGlobalTXT_LocalizationStrings[653];
+              sprintf(pTmpBuf, "+%u %s", v54, v63);
+              break;
+            case 8:
+              Party::GiveFood(5 * thisa); 
+              v63 = pGlobalTXT_LocalizationStrings[653]; //"Food"
               v54 = 5 * thisa;
-              goto LABEL_38;
+              sprintf(pTmpBuf, "+%u %s", v54, v63);
+              break;
             case 9u:
-              v63 = pGlobalTXT_LocalizationStrings[207];
+              v63 = pGlobalTXT_LocalizationStrings[LOCSTR_SKILL_POINTS];
               v3->uSkillPoints += 2 * thisa;
               v54 = 2 * thisa;
-              goto LABEL_38;
-            case 0xAu:
-              v63 = pGlobalTXT_LocalizationStrings[83];
+               sprintf(pTmpBuf, "+%u %s", v54, v63);
+              break;
+            case 10:
+              v63 = pGlobalTXT_LocalizationStrings[LOCSTR_EXPIRIENCE];
               v54 = 2500 * thisa;
-              v7 = __CFADD__(2500 * thisa, LODWORD(v3->uExperience));
-              LODWORD(v3->uExperience) += 2500 * thisa;
-              HIDWORD(v3->uExperience) += ((unsigned __int64)(signed int)(2500 * thisa) >> 32) + v7;
-LABEL_38:
+              v3->uExperience += 2500 * thisa;
               sprintf(pTmpBuf, "+%u %s", v54, v63);
-              goto LABEL_54;
-            case 0xBu:
+              break;
+            case 11:
               v8 = rand() % 6;
-              if ( v8 )
-              {
-                v9 = v8 - 1;
-                if ( v9 )
-                {
-                  v10 = v9 - 1;
-                  if ( v10 )
+              switch (v8)
                   {
-                    v11 = v10 - 1;
-                    if ( v11 )
-                    {
-                      v12 = v11 - 1;
-                      if ( v12 )
-                      {
-                        if ( v12 != 1 )
-                          goto LABEL_52;
-                        v3->sResBodyBase += thisa;
-                        v13 = pGlobalTXT_LocalizationStrings[29];
-                      }
-                      else
-                      {
-                        v3->sResMindBase += thisa;
-                        v13 = pGlobalTXT_LocalizationStrings[142];
-                      }
-                    }
-                    else
-                    {
-                      v3->sResEarthBase += thisa;
-                      v13 = pGlobalTXT_LocalizationStrings[70];
-                    }
+              case 0:
+                  v3->sResFireBase += thisa;
+                  v13 = pGlobalTXT_LocalizationStrings[87];
+                  break;
+               case 1:
+                   v3->sResAirBase += thisa;
+                   v13 = pGlobalTXT_LocalizationStrings[6];
+                   break;
+               case 2:
+                   v3->sResWaterBase += thisa;
+                   v13 = pGlobalTXT_LocalizationStrings[240];
+                   break;
+               case 3:
+                   v3->sResEarthBase += thisa;
+                   v13 = pGlobalTXT_LocalizationStrings[70];
+                    break;
+               case 4:
+                   v3->sResMindBase += thisa;
+                   v13 = pGlobalTXT_LocalizationStrings[142];
+                   break;
+               case 5:
+                   v3->sResBodyBase += thisa;
+                   v13 = pGlobalTXT_LocalizationStrings[29];
+                   break;
                   }
-                  else
-                  {
-                    v3->sResWaterBase += thisa;
-                    v13 = pGlobalTXT_LocalizationStrings[240];
-                  }
-                }
-                else
-                {
-                  v3->sResAirBase += thisa;
-                  v13 = pGlobalTXT_LocalizationStrings[6];
-                }
+              v62 = pGlobalTXT_LocalizationStrings[121];
+              v53 = v13;
+              v49 = thisa;
+              sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62);
+              break;
+           
+          }
+          ShowStatusBarString(pTmpBuf, 2u);
+          pMouse->RemoveHoldingItem();
+          pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, player_num - 1);
+          v3->PlaySound(SPEECH_93, 0);
+          pAudioPlayer->PlaySound((SoundID)(SOUND_Bell|0x2), 0, 0, -1, 0, 0, 0, 0);
+          if ( pParty->uDaysPlayed == 6 || pParty->uDaysPlayed == 20 )
+              {
+              v3->SetCondition(Condition_Eradicated, 0);
+              pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0);
               }
-              else
-              {
-                v3->sResFireBase += thisa;
-                v13 = pGlobalTXT_LocalizationStrings[87];
-              }
-              v74 = v13;
-LABEL_52:
-              v62 = pGlobalTXT_LocalizationStrings[121];
-              v53 = v74;
-              v49 = thisa;
-LABEL_53:
-              sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62);
-LABEL_54:
-              ShowStatusBarString(pTmpBuf, 2u);
-              pMouse->RemoveHoldingItem();
-              pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, a2 - 1);
-              v3->PlaySound(SPEECH_93, 0);
-              pAudioPlayer->PlaySound((SoundID)(SOUND_Bell|0x2), 0, 0, -1, 0, 0, 0, 0);
-              if ( pParty->uDaysPlayed == 6 || pParty->uDaysPlayed == 20 )
-              {
-                v64 = 0;
-                v55 = 16;
-              }
-              else
-              {
-                if ( pParty->uDaysPlayed == 12 || pParty->uDaysPlayed == 26 )
+          else if ( pParty->uDaysPlayed == 12 || pParty->uDaysPlayed == 26 )
                 {
-                  v64 = 0;
-                  v55 = 14;
+                  v3->SetCondition(Condition_Dead, 0);
+                  pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0);
                 }
-                else
-                {
-                  if ( pParty->uDaysPlayed != 4 && pParty->uDaysPlayed != 25 )
-                    return;
-                  v64 = 0;
-                  v55 = 15;
-                }
+           else  if ( pParty->uDaysPlayed == 4 || pParty->uDaysPlayed == 25 )
+              {
+              v3->SetCondition(Condition_Pertified, 0);
+              pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0);                 
               }
-              v3->SetCondition(v55, v64);
-              v61 = 0;
-              v52 = 0;
-              v48 = 0;
-              v45 = 0;
-              v43 = -1;
-              v41 = 0;
-              v39 = 0;
-              v37 = (SoundID)215;
-              v14 = pAudioPlayer;
-              goto LABEL_63;
-            default:
-              goto LABEL_54;
-          }
+            return;
         }
-        if ( pParty->pPickedItem.uItemID == 630 )
+        if ( pParty->pPickedItem.uItemID == 630 ) //Red Apple
         {
           Party::GiveFood(1u);
           pAudioPlayer->PlaySound((SoundID)(SOUND_PlayerCantCastSpell|0x2), 0, 0, -1, 0, 0, 0, 0);
         }
         else
         {
-          if ( pParty->pPickedItem.uItemID == 632 )
+          if ( pParty->pPickedItem.uItemID == 632 ) //Lute
           {
-            v61 = 0;
-            v52 = 0;
-            v48 = 0;
-            v45 = 0;
-            v43 = -1;
-            v41 = 0;
-            v39 = 0;
-            v37 = (SoundID)133;
-            goto LABEL_93;
+            pAudioPlayer->PlaySound((SoundID)133,  0, 0, -1, 0, 0, 0, 0);
+            return;
           }
-          if ( pParty->pPickedItem.uItemID == 633 )
+          if ( pParty->pPickedItem.uItemID == 633 ) //Faerie Pipes
           {
-            v61 = 0;
-            v52 = 0;
-            v48 = 0;
-            v45 = 0;
-            v43 = -1;
-            v41 = 0;
-            v39 = 0;
-            v37 = (SoundID)134;
-            goto LABEL_93;
+            pAudioPlayer->PlaySound((SoundID)134,  0, 0, -1, 0, 0, 0, 0);
+            return;
           }
-          if ( pParty->pPickedItem.uItemID == 634 )
+          if ( pParty->pPickedItem.uItemID == 634 ) //Gryphonheart's Trumpet
           {
-            v61 = 0;
-            v52 = 0;
-            v48 = 0;
-            v45 = 0;
-            v43 = -1;
-            v41 = 0;
-            v39 = 0;
-            v37 = (SoundID)135;
-            goto LABEL_93;
+            pAudioPlayer->PlaySound((SoundID)135,  0, 0, -1, 0, 0, 0, 0);
+            return;
           }
           if ( pParty->pPickedItem.uItemID != 646 )
           {
-            if ( pParty->pPickedItem.uItemID == 650 )
+            if ( pParty->pPickedItem.uItemID == 650 ) //Temple in a Bottle
             {
               sub_44C28F_open_nwc_dungeon();
               return;
             }
-            goto LABEL_167;
+            v68 = pParty->pPickedItem.GetDisplayName();
+            v58 = pGlobalTXT_LocalizationStrings[36];
+            goto LABEL_90;
           }
-          pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, a2 - 1);
-          v5 = 8 * a2 + 392;
-          LOBYTE(v5) = PID(OBJECT_Player,a2 - 120);
+          pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, player_num - 1);
+          v5 = 8 * player_num + 392;
+          LOBYTE(v5) = PID(OBJECT_Player,player_num - 120);
           pAudioPlayer->PlaySound(SOUND_20001, v5, 0, -1, 0, 0, 0, 0);
           v3->AddVariable(VAR_NumSkillPoints, 2);
         }
@@ -7478,7 +7422,7 @@
         pMouse->RemoveHoldingItem();
         return;
       }
-      if ( pParty->pPlayers[a2-1].CanAct() )
+      if ( pParty->pPlayers[player_num-1].CanAct() )
       {
         sub_467F48(pParty->pPickedItem.uItemID);
         v65 = 0;
@@ -7522,7 +7466,7 @@
       pAudioPlayer->PlaySound(v37, v39, v41, v43, v45, v48, v52, v61);
       return;
     }
-    if ( !pParty->pPlayers[a2-1].CanAct() )
+    if ( !pParty->pPlayers[player_num-1].CanAct() )
     {
       v66 = aCharacterConditionNames[v3->GetMajorConditionIdx()];
       v57 = pGlobalTXT_LocalizationStrings[382];
@@ -7542,23 +7486,22 @@
         {
           if ( v20 != 1 )
           {
-            v21 = a2;
+            v21 = player_num;
 LABEL_83:
             if ( v75 > v21 || !*v17 )
             {
               v22 = pParty->pPickedItem.GetDisplayName();
               sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[381], v22);
               ShowStatusBarString(pTmpBuf, 2u);
-              v65 = 0;
-              v56 = 20;
-              goto LABEL_67;
+              v3->PlaySound((PlayerSpeech)20, 0);
+              return; 
             }
             *v72 = 1;
             v3->PlaySound(SPEECH_21, 0);
             v73 = 0;
 LABEL_173:
             v36 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType;
-            if ( v36 == 14 )
+            if ( v36 == EQUIP_POTION )
             {
               v71 = 0;
               v60 = 0;
@@ -7571,27 +7514,20 @@
             }
             else
             {
-              if ( v36 != 13 )
+              if ( v36 != EQUIP_REAGENT )
               {
 LABEL_178:
                 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null)
                 {
                   if ( !v73 )
                     goto LABEL_187;
-                  /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
-                  {
-                    pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
-                    pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
-                    *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
-                    ++pMessageQueue_50CBD0->uNumMessages;
-                  }*/
                   pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
                 }
                 if ( v73 )
                 {
                   if ( pParty->bTurnBasedModeOn )
                   {
-                    *(&pParty->field_16140 + a2) = 100;
+                    *(&pParty->field_16140 + player_num) = 100;
                     thisb->SetRecoveryTime(100);
                     pTurnEngine->_40471C();
                   }
@@ -7635,7 +7571,7 @@
   }
   if ( pCurrentScreen == SCREEN_CASTING )
     return;
-  if ( !pParty->pPlayers[a2-1].CanAct() )
+  if ( !pParty->pPlayers[player_num-1].CanAct() )
     goto LABEL_89;
   if ( bUnderwater == 1 )
   {
@@ -7643,37 +7579,24 @@
     goto LABEL_91;
   }
   dword_50C9AC = 1;
-  v24 = pParty->pPickedItem.uItemID - 299;
-  if ( pParty->pPickedItem.uItemID == 329 || v24 == 4 || v24 == 91 || v24 == 28 )
+  scroll_id = pParty->pPickedItem.uItemID - 299;
+  if ( scroll_id == 30 || scroll_id == 4 || scroll_id == 91 || scroll_id == 28 ) //Enchant Item scroll, Vampiric Weapon scroll ,Recharge Item ,Fire Aura
   {
     pMouse->RemoveHoldingItem();
     pGUIWindow_CurrentMenu->Release();
     pIcons_LOD->_4114F2();
     pCurrentScreen = SCREEN_GAME;
     viewparams->bRedrawGameUI = 1;
-    _42777D_CastSpell_UseWand_ShootArrow(v24, a2 - 1, 0x85u, 1, 0);
+    _42777D_CastSpell_UseWand_ShootArrow(scroll_id, player_num - 1, 0x85u, 1, 0);
   }
   else
   {
     _720984_unused = pParty->pPickedItem.uItemID;
     pMouse->RemoveHoldingItem();
-    /*if ( dword_50C9E8 < 40 )
-    {
-      dword_50C9EC[3 * dword_50C9E8] = 146;
-      dword_50C9EC[3 * dword_50C9E8 + 1] = v24;
-      dword_50C9EC[3 * dword_50C9E8 + 2] = a2 - 1;
-      ++dword_50C9E8;
-    }*/
-    pMessageQueue_50C9E8->AddMessage(UIMSG_92, v24, a2 - 1);
-    if ( pCurrentScreen
-      && pGUIWindow_CurrentMenu
-      && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null)
-      //&& (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
-    {
-      /*pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
-      pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
-      *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
-      ++pMessageQueue_50CBD0->uNumMessages;*/
+    pMessageQueue_50C9E8->AddMessage(UIMSG_SpellScrollUse, scroll_id, player_num - 1);
+    if ( pCurrentScreen && pGUIWindow_CurrentMenu
+      && (pGUIWindow_CurrentMenu->eWindowType != WINDOW_null))
+    {
       pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
     }
   }
--- a/Player.h	Tue May 21 02:24:31 2013 +0200
+++ b/Player.h	Tue May 21 07:24:49 2013 +0400
@@ -682,8 +682,15 @@
   };
   unsigned char _guilds_member_bits[64];
   PlayerSpells spellbook;
-  char field_1F5[30]; // used to be [31]
-  union
+  char field__1F5[2]; // used to be [31]
+  int pure_luck_used;      
+  int pure_speed_used; 
+  int pure_intellect_used;  
+  int pure_endurance_used;  
+  int pure_willpower_used;       
+  int pure_accuracy_used;      
+  int pure_might_used;    
+  union  //214h
       {
       struct  
           {
--- a/UIHouses.cpp	Tue May 21 02:24:31 2013 +0200
+++ b/UIHouses.cpp	Tue May 21 07:24:49 2013 +0400
@@ -3072,7 +3072,7 @@
       if( (v2 = pMouse->GetCursorPos(&a2)->x - 14, v106.x = (v2 >> 5) + 14 * ((pMouse->GetCursorPos(&v87)->y - 17) >> 5),
           pMouse->GetCursorPos(&v100)->x <= 13) || pMouse->GetCursorPos(&v92)->x >= 462
             || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v106.x), !pNumActiveItem)
-            || (pNumActiveItem = 9 * pNumActiveItem, !(pPlayer->field_1F5[4 * pNumActiveItem + 15] & 2)) )
+            || (!(pPlayer->pOwnItems[pNumActiveItem-1].uAttributes& 2)) )
             return;
       v4 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1];
       v10 = pPlayer->SelectPhrasesTransaction(v4, BildingType_ArmorShop, (int)window_SpeakInHouse->ptr_1C, 5);
@@ -4275,10 +4275,10 @@
             pMouse->GetCursorPos(&v140)->x <= 13)
             || pMouse->GetCursorPos(&v138)->x >= 462
             || (v32 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&pItemCount), v11 = 0, !v32)
-            || (v33 = 9 * v32, !(pPlayers[uActiveCharacter]->field_1F5[4 * v33 + 15] & 2)) )
+            || (!(pPlayers[uActiveCharacter]->pOwnItems[v32-1].uAttributes& 2)) )
         return;
       v116 = &pPlayers[uActiveCharacter]->pInventoryItems[v33 - 1];
-      v35 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItems[v33 - 1], BildingType_ArmorShop, (int)window_SpeakInHouse->ptr_1C, 5);
+      v35 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItems[v32 - 1], BildingType_ArmorShop, window_SpeakInHouse->par1C, 5);
       v15 = (char *)pMerchantsRepairPhrases[v35];
       v36 = BuilDialogueString(v15, uActiveCharacter - 1, v116, (char *)window_SpeakInHouse->ptr_1C, 5, 0);
       v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138;
@@ -6009,7 +6009,8 @@
           *(int *)result <= 13)
       || (result = (int)pMouse->GetCursorPos(&v104), *(int *)result >= 462)
       || (result = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result)
-      || (result *= 9, !(pPlayers[uActiveCharacter]->field_1F5[4 * result + 15] & 2)) )
+     // || (result *= 9, !(pPlayers[uActiveCharacter]->field_1F5[4 * result + 15] & 2)) )
+        || (!(pPlayers[uActiveCharacter]->pOwnItems[result-1].uAttributes& 2)) )
       return;
     item = &pPlayers[uActiveCharacter]->pInventoryItems[result - 1];
     v29 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItems[result - 1], BildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 5);
--- a/mm7_5.cpp	Tue May 21 02:24:31 2013 +0200
+++ b/mm7_5.cpp	Tue May 21 07:24:49 2013 +0400
@@ -2820,7 +2820,7 @@
             _42777D_CastSpell_UseWand_ShootArrow(uMessageParam, v199, 0, 0, 0);
         continue;
 
-        case UIMSG_92:
+        case UIMSG_SpellScrollUse:
 			__debugbreak();
           if ( pTurnEngine->field_4 != 3 )
             _42777D_CastSpell_UseWand_ShootArrow(uMessageParam, v199, 133, 1, 0);
@@ -10862,7 +10862,8 @@
             {
               v19 = v0->AddItem(-1, 0xDCu);
               if ( v19 )
-                *(int *)&v0->field_1F5[36 * v19 + 15] = 1;
+               // *(int *)&v0->field_1F5[36 * v19 + 15] = 1;
+                 v0->pOwnItems[v19-1].uAttributes=ITEM_IDENTIFIED;
               v20 = v47 + 50 * v15;
               v0->pInventoryItems[pOut.z].uItemID = v51;
               v0->pInventoryItems[pOut.z].uEnchantmentType = (pParty->pPickedItem.uEnchantmentType
@@ -10886,7 +10887,8 @@
                 *(int *)(a2.y + 536) = pParty->pPickedItem.uEnchantmentType;
               v21 = v0->AddItem(-1, 0xDCu);
               if ( v21 )
-                *(int *)&v0->field_1F5[36 * v21 + 15] = 1;
+                //*(int *)&v0->field_1F5[36 * v21 + 15] = 1;
+                v0->pOwnItems[v21-1].uAttributes=ITEM_IDENTIFIED;
               goto LABEL_74;
             }
             goto LABEL_115;