changeset 997:1c13fbaad0c5

Слияние
author Ritor1
date Tue, 14 May 2013 10:07:33 +0600
parents bdbbdfa77ea6 (current diff) ada1ed5f44a1 (diff)
children e4383e6dfbef
files GUIWindow.h mm7_5.cpp mm7_6.cpp
diffstat 11 files changed, 1795 insertions(+), 1895 deletions(-) [+]
line wrap: on
line diff
--- a/GUIWindow.h	Tue May 14 10:07:21 2013 +0600
+++ b/GUIWindow.h	Tue May 14 10:07:33 2013 +0600
@@ -461,7 +461,7 @@
 
 
 
-void QuickRefDraw();
+void GameUI_QuickRef_Draw();
 
 
 
@@ -477,11 +477,16 @@
 const char *CharacterUI_GetSkillDescText(unsigned int uPlayerID, PLAYER_SKILL_TYPE uPlayerSkillType);
 char CharacterUI_SkillsTab_ShowHint();
 void CharacterUI_StatsTab_ShowHint();
-char CharacterUI_StatsTab_Draw(unsigned int uPlayerID); // idb
+char CharacterUI_StatsTab_Draw(Player *player);
+void CharacterUI_SkillsTab_CreateButtons();
 void CharacterUI_SkillsTab_Draw(Player *player);
-void CharacterUI_AwardsTab_Draw(unsigned int uPlayerID); // idb
+void CharacterUI_AwardsTab_Draw(Player *player);
 void CharacterUI_InventoryTab_Draw(Player *player, bool a2);
-void CharacterUI_CharacterScreen_Draw(unsigned int uPlayerIdx); // idb
+void CharacterUI_CharacterScreen_Draw(Player *player);
+void CharacterUI_DrawPaperdoll(Player *player);
+void CharacterUI_DrawPaperdollWithRingOverlay(Player *player);
+void CharacterUI_ReleaseButtons();
+
 
 
 
@@ -652,4 +657,5 @@
 extern unsigned int ui_color_text_bonus;
 extern unsigned int ui_color_text_bonus_neg;
 extern unsigned int ui_color_text_skill_upgradeable;
-extern unsigned int ui_color_text_skill_not_upgradeable;
\ No newline at end of file
+extern unsigned int ui_color_text_skill_not_upgradeable;
+extern unsigned int ui_color_text_awards[6];
\ No newline at end of file
--- a/Player.h	Tue May 14 10:07:21 2013 +0600
+++ b/Player.h	Tue May 14 10:07:33 2013 +0600
@@ -138,10 +138,10 @@
 /*  339 */
 enum CHARACTER_RACE
 {
-  CHARACTER_RACE_HUMAN = 0x0,
-  CHARACTER_RACE_ELF = 0x1,
-  CHARACTER_RACE_GOBLIN = 0x2,
-  CHARACTER_RACE_DWARF = 0x3,
+  CHARACTER_RACE_HUMAN = 0,
+  CHARACTER_RACE_ELF = 1,
+  CHARACTER_RACE_GOBLIN = 2,
+  CHARACTER_RACE_DWARF = 3,
 };
 enum CHARACTER_ATTRIBUTE
 {
--- a/Render.cpp	Tue May 14 10:07:21 2013 +0600
+++ b/Render.cpp	Tue May 14 10:07:33 2013 +0600
@@ -10586,7 +10586,7 @@
 }
 
 //----- (004A601E) --------------------------------------------------------
-void Render::_4A601E(signed int a2, signed int a3, Texture *pTexture, int a5)
+void Render::ZBuffer_Fill_2(signed int a2, signed int a3, Texture *pTexture, int a5)
 {
   signed int v5; // edx@3
   int v6; // ebx@3
--- a/Render.h	Tue May 14 10:07:21 2013 +0600
+++ b/Render.h	Tue May 14 10:07:33 2013 +0600
@@ -342,7 +342,7 @@
   void DrawTextureRGB(unsigned int uOutX, unsigned int uOutY, RGBTexture *a4);
   void _4A5D33(unsigned int a2, unsigned int a3, int a4, int a5, RGBTexture *pTexture);
   void DrawTextureIndexed(unsigned int uX, unsigned int uY, Texture *a4);
-  void _4A601E(signed int a2, signed int a3, Texture *pTexture, int a5);
+  void ZBuffer_Fill_2(signed int a2, signed int a3, Texture *pTexture, int a5);
   void DrawMaskToZBuffer(signed int uOutX, unsigned int uOutY, Texture *pTexture, int zVal);
   void DrawTextureTransparent(unsigned int uX, unsigned int uY, Texture *pTexture);
   void _4A63E6(unsigned int a2, unsigned int a3, Texture *a4, Texture *a5, int a6, int a7, int a8);
--- a/UICharacter.cpp	Tue May 14 10:07:21 2013 +0600
+++ b/UICharacter.cpp	Tue May 14 10:07:33 2013 +0600
@@ -52,6 +52,7 @@
 unsigned int ui_color_text_bonus_neg;
 unsigned int ui_color_text_skill_upgradeable;
 unsigned int ui_color_text_skill_not_upgradeable;
+unsigned int ui_color_text_awards[6];
 void set_default_ui_skin()
 {
   ui_color_text_default = TargetColor(255, 255, 255);
@@ -62,6 +63,13 @@
 
   ui_color_text_skill_upgradeable = TargetColor(0, 175, 255);
   ui_color_text_skill_not_upgradeable = TargetColor(255, 0, 0);
+
+  ui_color_text_awards[0] = TargetColor(248, 108, 160);
+  ui_color_text_awards[1] = TargetColor(112, 220, 248);
+  ui_color_text_awards[2] = TargetColor(192, 192, 240);
+  ui_color_text_awards[3] = TargetColor( 64, 244,  96);
+  ui_color_text_awards[4] = TargetColor(232, 244,  96);
+  ui_color_text_awards[5] = TargetColor(240, 252, 192);
 }
 
 
@@ -182,27 +190,9 @@
 
 
 
-    
-unsigned int GetAwardColor(unsigned int priority)
-{
-  static unsigned __int8 pAwardsTextColors[6][3] =
-  {
-    {248, 108, 160},
-    {112, 220, 248},
-    {192, 192, 240},
-    { 64, 244,  96},
-    {232, 244,  96},
-    {240, 252, 192}
-  };
-
-  return TargetColor(pAwardsTextColors[priority % 6][0],
-                     pAwardsTextColors[priority % 6][1],
-                     pAwardsTextColors[priority % 6][2]);
-}
-
 
 //----- (0041A000) --------------------------------------------------------
-void CharacterUI_AwardsTab_Draw(unsigned int uPlayerID)
+void CharacterUI_AwardsTab_Draw(Player *player)
 {
     //unsigned int v1; // esi@1
     //unsigned int v2; // ebx@1
@@ -227,28 +217,28 @@
     //int v21; // [sp+C8h] [bp-8h]@14
     //int v22; // [sp+CCh] [bp-4h]@40
 
-    auto player = &pParty->pPlayers[uPlayerID - 1];
-    //v1 = uPlayerID;
-    pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("fr_award", TEXTURE_16BIT_PALETTE));
-    sprintfex(pTmpBuf, "%s \f%05d", pGlobalTXT_LocalizationStrings[LOCSTR_AVARDS_FOR], TargetColor(0xFF, 0xFF, 0x9B));
-    sprintfex(Source, pGlobalTXT_LocalizationStrings[LOCSTR_S_THE_S], player->pName, pClassNames[player->classType]);
-    strcat(pTmpBuf, Source);
-    strcat(pTmpBuf, "\f00000");
-    pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, 18, 0, pTmpBuf, 0, 0, 0);
-    result = dword_506528;
-    a1.uFrameX = 12;
-    a1.uFrameY = 48;
-    a1.uFrameWidth = 424;
-    a1.uFrameHeight = 290;
-    a1.uFrameZ = 435;
-    a1.uFrameW = 337;
-    if ( BtnDown_flag && num_achieved_awards + dword_506528 < num_achieved_awards_2 )
-        result = dword_506528++ + 1;
-    if ( BtnUp_flag && result )
-        {
-        --result;
-        dword_506528 = result;
-        }
+  pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("fr_award", TEXTURE_16BIT_PALETTE));
+  sprintfex(pTmpBuf, "%s \f%05d", pGlobalTXT_LocalizationStrings[LOCSTR_AVARDS_FOR], ui_color_text_header);
+  sprintfex(Source, pGlobalTXT_LocalizationStrings[LOCSTR_S_THE_S], player->pName, pClassNames[player->classType]);
+  strcat(pTmpBuf, Source);
+  strcat(pTmpBuf, "\f00000");
+
+  pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, 18, 0, pTmpBuf, 0, 0, 0);
+  result = dword_506528;
+  a1.uFrameX = 12;
+  a1.uFrameY = 48;
+  a1.uFrameWidth = 424;
+  a1.uFrameHeight = 290;
+  a1.uFrameZ = 435;
+  a1.uFrameW = 337;
+  if (BtnDown_flag && num_achieved_awards + dword_506528 < num_achieved_awards_2)
+    result = dword_506528++ + 1;
+  if (BtnUp_flag && result)
+  {
+    --result;
+    dword_506528 = result;
+  }
+
     if ( dword_50651C < 0 )
         {
         result += num_achieved_awards;
@@ -300,7 +290,7 @@
               v6 = pTmpBuf;
 
 
-            a1.DrawText(pFontArrus, 0, 0, GetAwardColor(pAwards[v5].uPriority), v6, 0, 0, 0);
+            a1.DrawText(pFontArrus, 0, 0, ui_color_text_awards[pAwards[v5].uPriority % 6], v6, 0, 0, 0);
             a1.uFrameY = pFontArrus->CalcTextHeight(v6, &a1, 0, 0) + a1.uFrameY + 4;
             if (a1.uFrameY > a1.uFrameHeight)
               break;
@@ -322,95 +312,7 @@
   return ((signed int)(uNumPixels - 14) >> 5) + 1;
 }
 
-//----- (0041A2D1) --------------------------------------------------------
-void CharacterUI_InventoryTab_Draw(Player *player, bool a2)
-{
-        Texture *v7; // esi@6
-        signed int v11; // edx@6
-        int v13; // eax@13
-        signed int v14; // edx@13
-        int v15; // eax@13
-        unsigned int v17; // edi@15
-        Texture *pTexture; // ebx@24
-        unsigned int uCellX; // [sp+30h] [bp-8h]@5
-        unsigned int uCellY; // [sp+34h] [bp-4h]@5
 
-  pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_CharacterUI_InventoryBackground));
-  if (a2)
-    pRenderer->DrawTextureIndexed(8, 305, pIcons_LOD->LoadTexturePtr("fr_strip", TEXTURE_16BIT_PALETTE));
-
-  int i = 0;
-  for (uint i = 0; i < 126; ++i)
-  {
-    int v26 = (int)(player->pInventoryIndices + i);
-
-    if (player->pInventoryIndices[i] <= 0)
-      continue;
-
-    int item_idx = player->pInventoryIndices[i];
-    auto item = &player->pInventoryItems[item_idx - 1];
-    if (!item->uItemID)
-      continue;
-
-    uCellY = 32 * (i / 14) + 17;
-    uCellX = 32 * (i % 14) + 14;
-
-    uint item_texture_id = pIcons_LOD->LoadTexture(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
-    v7 = pIcons_LOD->GetTexture(item_texture_id);
-
-                    v11 = v7->uTextureWidth;
-                    if (v11 < 14)
-                        v11 = 14;
-
-                    if ( (v11 - 14) / 32 == 0 && v7->uTextureWidth < 32)
-                        uCellX += (32 - v7->uTextureWidth) / 2;
-                    v13 = v11 - 14;
-                    LOBYTE(v13) = v13 & 0xE0;
-                    v15 = v13 + 32;
-                    v14 = v7->uTextureHeight;
-                    if (v14 < 14 )
-                        v14 = 14;
-                    v17 = uCellX + ((v15 - v7->uTextureWidth) >> 1) + pSRZBufferLineOffsets[uCellY + ((((v14 - 14) & 0xFFFFFFE0) - v7->uTextureHeight + 32) >> 1)];
-
-
-    if (!(item->uAttributes & 0xF0))
-    {
-      if (item->Identified() || pCurrentScreen != SCREEN_HOUSE)
-      {
-        if (item->Broken())
-          pRenderer->DrawTransparentRedShade(uCellX, uCellY, v7);
-        else
-          pRenderer->DrawTextureTransparent(uCellX, uCellY, v7);
-      }
-      else
-        pRenderer->DrawTransparentGreenShade(uCellX, uCellY, v7);
-
-      ZBuffer_Fill(&pRenderer->pActiveZBuffer[v17], item_texture_id, item_idx);
-      continue;
-    }
-    else
-    {
-      switch (item->uAttributes & 0xF0)
-      {
-        case ITEM_AURA_EFFECT_RED:    pTexture = pIcons_LOD->LoadTexturePtr("sptext01", TEXTURE_16BIT_PALETTE); break;
-        case ITEM_AURA_EFFECT_BLUE:   pTexture = pIcons_LOD->LoadTexturePtr("sp28a", TEXTURE_16BIT_PALETTE);    break;
-        case ITEM_AURA_EFFECT_GREEN:  pTexture = pIcons_LOD->LoadTexturePtr("sp30a", TEXTURE_16BIT_PALETTE);    break;
-        case ITEM_AURA_EFFECT_PURPLE: pTexture = pIcons_LOD->LoadTexturePtr("sp91a", TEXTURE_16BIT_PALETTE);    break;
-      }
-
-      _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed;
-      if (_50C9A8_item_enchantment_timer <= 0)
-      {
-        _50C9A8_item_enchantment_timer = 0;
-        LOBYTE(item->uAttributes) &= 0xF;
-        ptr_50C9A4 = 0;
-      }
-
-      pRenderer->_4A63E6(uCellX, uCellY, v7, pTexture, GetTickCount() * 0.1, 0, 255);
-      ZBuffer_Fill(&pRenderer->pActiveZBuffer[v17], item_texture_id, item_idx);
-    }
-  }
-}
 
 //----- (0041A556) --------------------------------------------------------
 void draw_leather()
@@ -418,265 +320,67 @@
   pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_Leather));
 }
 
-    //----- (0041A57E) --------------------------------------------------------
-    void QuickRefDraw()
-        {
-        unsigned int v0; // ebx@1
-        //unsigned int v1; // eax@1
-        Player *pPlayer; // ebp@2
-        int v3; // eax@6
-        int v4; // edi@6
-        unsigned int v5; // eax@7
-        unsigned int v6; // edi@9
-        unsigned int v7; // edi@11
-        signed int v8; // eax@13
-        unsigned int v9; // eax@13
-        unsigned int v10; // edi@13
-        int v11; // eax@15
-        unsigned int v12; // eax@15
-        unsigned int v13; // edi@15
-        int v14; // eax@17
-        int v15; // ST18_4@17
-        int v16; // ebx@17
-        int v17; // eax@17
-        unsigned int v18; // eax@17
-        unsigned int v19; // edi@17
-        int v20; // eax@19
-        unsigned int v21; // edi@19
-        char *v22; // eax@21
-        unsigned int v23; // edi@21
-        int v24; // eax@23
-        unsigned int v25; // edi@23
-        char *v26; // eax@25
-        unsigned int v27; // edi@25
-        int v28; // ecx@27
-        char *v29; // eax@27
-        signed int v30; // edx@27
-        unsigned int v31; // edi@31
-        unsigned int v32; // edi@33
-        const char *v33; // ST10_4@35
-        unsigned int v34; // eax@35
-        unsigned int v35; // edi@35
-        unsigned __int8 v36; // al@37
-        char *v37; // eax@38
-        int v38; // eax@41
-        signed int v39; // edi@42
-        char *v40; // eax@45
-        unsigned int v41; // eax@45
-        signed int v43; // [sp+10h] [bp-1Ch]@1
-        unsigned int v44; // [sp+14h] [bp-18h]@2
-        int v45; // [sp+18h] [bp-14h]@1
-        unsigned int v46; // [sp+1Ch] [bp-10h]@1
-        unsigned int v47; // [sp+20h] [bp-Ch]@1
-        unsigned int v48; // [sp+24h] [bp-8h]@33
-        //unsigned int v49; // [sp+28h] [bp-4h]@1
+
+//----- (0041ABFD) --------------------------------------------------------
+void CharacterUI_CharacterScreen_Draw(Player *player)
+{
+  pRenderer->ClearZBuffer(0, 479);
+  switch (pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0])
+  {
+    case WINDOW_CharacterWindow_Stats:                                // stats
+      CharacterUI_ReleaseButtons();
+      sub_419379();
+      CharacterUI_StatsTab_Draw(player);
+      pRenderer->DrawTextureIndexed(pCharacterScreen_StatsBtn->uX,
+                                    pCharacterScreen_StatsBtn->uY,
+                                    pIcons_LOD->LoadTexturePtr("ib-cd1-d", TEXTURE_16BIT_PALETTE));
+    break;
 
-        v0 = 0;
-        v47 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
-        //v49 = TargetColor(0xFFu, 0, 0);
-        v46 = TargetColor(0, 0xFFu, 0);
-        //v1 = pIcons_LOD->LoadTexture("quikref", TEXTURE_16BIT_PALETTE);
-        pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("quikref", TEXTURE_16BIT_PALETTE));
-        v43 = 0;
-        v45 = LOBYTE(pFontArrus->uFontHeight) + 1;
-        do
-            {
-            pPlayer = &pParty->pPlayers[v43];
-            v44 = 94 * v43 + 89;
-            if ( v43 == v0 )
-                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, 0x12u, v0, pGlobalTXT_LocalizationStrings[149], 60, v0);//Name
-            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 94 * v43 + 89, 0x12u, v47, pPlayer->pName, 84, v0);
-            if ( v43 == v0 )
-                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, 0x2Fu, v0, pGlobalTXT_LocalizationStrings[131], 60, v0); //.
-            v3 = pPlayer->GetActualLevel();
-            sprintf(pTmpBuf, "%lu", v3);
-            v4 = pPlayer->GetBaseLevel();
-            if ( pPlayer->GetActualLevel() <= v4 )
-                v5 = pPlayer->GetExperienceDisplayColor();
-            else
-                v5 = TargetColor(0, 0xFFu, v0);
-            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, 0x2Fu, v5, pTmpBuf, 84, v0);
-            v6 = v45 + 47;
-            if ( v43 == v0 )
-                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v45 + 47, v0, pGlobalTXT_LocalizationStrings[41], 60, v0);//
-            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v6, v0, pClassNames[pPlayer->classType], 84, v0);
-            v7 = v45 + v6;
-            if ( v43 == v0 )
-                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v7, v0, pGlobalTXT_LocalizationStrings[107], 60, v0);//.
-            sprintf(pTmpBuf, "%d", pPlayer->sHealth);
-            v8 = pPlayer->GetMaxHealth();
-            v9 = UI_GetHealthManaStringColor(pPlayer->sHealth, v8);
-            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v7, v9, pTmpBuf, 84, v0);
-            v10 = v45 + v7;
-            if ( v43 == v0 )
-                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v10, v0, pGlobalTXT_LocalizationStrings[209], 60, v0);//
-            sprintf(pTmpBuf, "%d", pPlayer->sMana);
-            v11 = pPlayer->GetMaxMana();
-            v12 = UI_GetHealthManaStringColor(pPlayer->sMana, v11);
-            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v10, v12, pTmpBuf, 84, v0);
-            v13 = v45 + v10;
-            if ( v43 == v0 )
-                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v13, v0, pGlobalTXT_LocalizationStrings[0], 60, v0);// 
-            v14 = pPlayer->GetActualAC();
-            sprintf(pTmpBuf, "%d", v14);
-            v15 = v0;
-            v16 = pPlayer->GetBaseAC();
-            v17 = pPlayer->GetActualAC();
-            v18 = UI_GetHealthManaStringColor(v17, v16);
-            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v13, v18, pTmpBuf, 84, v15);
-            v0 = 0;
-            v19 = v45 + v13;
-            if ( !v43 )
-                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v19, 0, pGlobalTXT_LocalizationStrings[18], 60, 0);//
-            v20 = pPlayer->GetActualAttack(0);
-            sprintf(pTmpBuf, "%+d", v20);
-            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v19, 0, pTmpBuf, 84, 0);
-            v21 = v45 + v19;
-            if ( !v43 )
-                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v21, 0, pGlobalTXT_LocalizationStrings[66], 60, 0);//.
-            v22 = pPlayer->GetMeleeDamageString();
-            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v21, 0, v22, 84, 0);
-            v23 = v45 + v21;
-            if ( !v43 )
-                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v23, 0, pGlobalTXT_LocalizationStrings[203], 60, 0);// 
-            v24 = pPlayer->GetRangedAttack();
-            sprintf(pTmpBuf, "%+d", v24);
-            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v23, 0, pTmpBuf, 84, 0);
-            v25 = v45 + v23;
-            if ( !v43 )
-                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v25, 0, pGlobalTXT_LocalizationStrings[66], 60, 0);//.
-            v26 = pPlayer->GetRangedDamageString();
-            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v25, 0, v26, 84, 0);
-            v27 = v45 + v25;
-            if ( !v43 )
-                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v27, 0, pGlobalTXT_LocalizationStrings[205], 60, 0);//
-            v28 = 0;
-            v29 = (char *)pPlayer->pActiveSkills;
-            v30 = 36;
-            do
-                {
-                if ( *(short *)v29 )
-                    ++v28;
-                v29 += 2;
-                --v30;
-                }
-                while ( v30 );
-                sprintf(pTmpBuf, "%lu", v28);
-                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v27, 0, pTmpBuf, 84, 0);
-                v31 = v45 + v27;
-                if ( !v43 )
-                    pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v31, 0, pGlobalTXT_LocalizationStrings[168], 60, 0);//
-                sprintf(pTmpBuf, "%lu", pPlayer->uSkillPoints);
-                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v31, pPlayer->uSkillPoints != 0 ? v46 : 0, pTmpBuf, 84, 0);
-                v32 = v45 + v31;
-                v48 = pPlayer->GetMajorConditionIdx();
-                if ( !v43 )
-                    pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v32, 0, pGlobalTXT_LocalizationStrings[45], 60, 0);//.
-                v33 = aCharacterConditionNames[v48];
-                v34 = GetConditionDrawColor(v48);
-                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v32, v34, v33, 84, 0);
-                v35 = v45 + v32;
-                if ( !v43 )
-                    pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v35, 0, pGlobalTXT_LocalizationStrings[170], 60, 0);//..
-                v36 = pPlayer->uQuickSpell;
-                if ( v36 )
-                    v37 = pSpellStats->pInfos[v36].pShortName;
-                else
-                    v37 = pGlobalTXT_LocalizationStrings[153];//
-                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v35, 0, v37, 84, 0);
-                ++v43;
-            }
-            while ( v43 < 4 );
+    case WINDOW_CharacterWindow_Skills:                                // skills
+      if (dword_507CC0 != uActiveCharacter)
+      {
+        CharacterUI_ReleaseButtons();
+        CharacterUI_SkillsTab_CreateButtons();
+      }
+      sub_419379();
+      CharacterUI_SkillsTab_Draw(player);
+      pRenderer->DrawTextureIndexed(pCharacterScreen_SkillsBtn->uX,
+                                    pCharacterScreen_SkillsBtn->uY,
+                                    pIcons_LOD->LoadTexturePtr("ib-cd2-d", TEXTURE_16BIT_PALETTE));
+    break;
 
-            v38 = GetPartyReputation();
-            if ( v38 >= 0 )
-                {
-                if ( v38 <= 5 )
-                    v39 = TargetColor(0xFF, 0xFF, 0xFF);
-                else
-                    v39 = TargetColor(0xFF, 0, 0);
-                }
-            else
-                v39 = v46;
-
-            v40 = GetReputationString(v38);
-            sprintf(pTmpBuf, "%s: \f%05d%s\f00000", pGlobalTXT_LocalizationStrings[180], v39, v40);//Reputation
-            pGUIWindow_CurrentMenu->DrawText(pFontArrus, 22, 323, 0, pTmpBuf, 0, 0, 0);
-            v41 = pParty->GetPartyFame();
-            sprintf(pTmpBuf, "\r261%s: %d", pGlobalTXT_LocalizationStrings[84], v41);// Fame 
-            pGUIWindow_CurrentMenu->DrawText(pFontArrus, 0, 323, 0, pTmpBuf, 0, 0, 0);
-        }
-
-    //----- (0041ABFD) --------------------------------------------------------
-void __thiscall CharacterUI_CharacterScreen_Draw(unsigned int uPlayerIdx)
-{
-  unsigned int v2; // eax@6
-  Texture *pTexture; // ecx@6
-  GUIButton *pButton; // eax@6
-  unsigned int v5; // eax@7
-  unsigned int v6; // eax@10
-  unsigned int v7; // eax@11
+    case WINDOW_CharacterWindow_Awards:                                // awards
+      CharacterUI_ReleaseButtons();
+      sub_419379();
+      sub_419220();
+      CharacterUI_AwardsTab_Draw(player);
+      pRenderer->DrawTextureIndexed(pCharacterScreen_AwardsBtn->uX,
+                                    pCharacterScreen_AwardsBtn->uY,
+                                    pIcons_LOD->LoadTexturePtr("ib-cd4-d", TEXTURE_16BIT_PALETTE));
+    break;
 
-  if ( uPlayerIdx )
-  {
-    pRenderer->ClearZBuffer(0, 479);
-    switch ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] )
-    {
-      case WINDOW_CharacterWindow_Stats:                                // stats
-        sub_4196A0();
-        sub_419379();
-        CharacterUI_StatsTab_Draw(uPlayerIdx);
-        v7 = pIcons_LOD->LoadTexture("ib-cd1-d", TEXTURE_16BIT_PALETTE);
-        pTexture = pIcons_LOD->GetTexture(v7);
-        pButton = pCharacterScreen_StatsBtn;
-        pRenderer->DrawTextureIndexed(pButton->uX, pButton->uY, pTexture);
-        break;
-      case WINDOW_CharacterWindow_Skills:                                // skills
-        if ( dword_507CC0 != uActiveCharacter )
-        {
-          sub_4196A0();
-          CharacterUI_SkillScreen_Draw();
-        }
-        sub_419379();
-        CharacterUI_SkillsTab_Draw(pPlayers[uPlayerIdx]);
-        v6 = pIcons_LOD->LoadTexture("ib-cd2-d", TEXTURE_16BIT_PALETTE);
-        pTexture = pIcons_LOD->GetTexture(v6);
-        pButton = pCharacterScreen_SkillsBtn;
-        pRenderer->DrawTextureIndexed(pButton->uX, pButton->uY, pTexture);
-        break;
-      case WINDOW_CharacterWindow_Awards:                                // awards
-        sub_4196A0();
-        sub_419379();
-        sub_419220();
-        CharacterUI_AwardsTab_Draw(uPlayerIdx);
-        v5 = pIcons_LOD->LoadTexture("ib-cd4-d", TEXTURE_16BIT_PALETTE);
-        pTexture = pIcons_LOD->GetTexture(v5);
-        pButton = pCharacterScreen_AwardsBtn;
-        pRenderer->DrawTextureIndexed(pButton->uX, pButton->uY, pTexture);
-        break;
-      case WINDOW_CharacterWindow_Inventory:                                                        // inventory and other
-        sub_4196A0();
-        sub_419379();
-        CharacterUI_InventoryTab_Draw(pPlayers[uPlayerIdx], false);
-        v2 = pIcons_LOD->LoadTexture("ib-cd3-d", TEXTURE_16BIT_PALETTE);
-        pTexture = pIcons_LOD->GetTexture(v2);
-        pButton = pCharacterScreen_InventoryBtn;
-        pRenderer->DrawTextureIndexed(pButton->uX, pButton->uY, pTexture);
-        break;
-      default:
-        break;
-    }
-    if ( bRingsShownInCharScreen )
-      CharacterUI_DrawPaperdollWithRingOverlay(uPlayerIdx);
-    else
-      CharacterUI_DrawPaperdoll(uPlayerIdx);
+    case WINDOW_CharacterWindow_Inventory:                             // inventory and other
+      CharacterUI_ReleaseButtons();
+      sub_419379();
+      CharacterUI_InventoryTab_Draw(player, false);
+      pRenderer->DrawTextureIndexed(pCharacterScreen_InventoryBtn->uX,
+                                    pCharacterScreen_InventoryBtn->uY,
+                                    pIcons_LOD->LoadTexturePtr("ib-cd3-d", TEXTURE_16BIT_PALETTE));
+    break;
+
+    default: break;
   }
+
+  if (bRingsShownInCharScreen)
+    CharacterUI_DrawPaperdollWithRingOverlay(player);
+  else
+    CharacterUI_DrawPaperdoll(player);
 }
 
 //----- (0043CC7C) --------------------------------------------------------
-void __fastcall CharacterUI_DrawPaperdoll(unsigned int uPlayerID)
+void CharacterUI_DrawPaperdoll(Player *player)
 {
-  signed int pSex; // eax@1
+  //signed int pSex; // eax@1
   unsigned int v6; // ecx@9
   int v7; // ecx@10
   unsigned int pMainHandNum4; // eax@14
@@ -827,25 +531,33 @@
         signed int IsDwarf; // [sp+40h] [bp-Ch]@4
 
   pIcons_LOD->LoadTexture("sptext01", TEXTURE_16BIT_PALETTE);
-  pSex = pPlayers[uPlayerID]->GetSexByVoice();
-  if ( pPlayers[uPlayerID]->GetRace() && pPlayers[uPlayerID]->GetRace() != 1 && pPlayers[uPlayerID]->GetRace() != 2 )
+  if (player->GetRace() == CHARACTER_RACE_DWARF)
   {
     IsDwarf = 1;
-    pBodyComplection = (pSex != 0) + 2;
+    pBodyComplection = player->GetSexByVoice() == SEX_MALE ? 2 : 3;
   }
   else
   {
     IsDwarf = 0;
-    pBodyComplection = pSex != 0;
+    pBodyComplection = player->GetSexByVoice() == SEX_MALE ? 0 : 1;
   }
+
+  int uPlayerID = 0;
+  for (uint i = 0; i < 4; ++i)
+    if (pPlayers[i + 1] == player)
+    {
+      uPlayerID = i + 1;
+      break;
+    }
+
   pRenderer->ResetTextureClipRect();
-  pRenderer->DrawTextureIndexed(0x1D3u, 0, pIcons_LOD->GetTexture(uTextureID_BACKDOLL));//
+  pRenderer->DrawTextureIndexed(467, 0, pIcons_LOD->GetTexture(uTextureID_BACKDOLL));//
   if ( IsPlayerWearingWatersuit[uPlayerID] )//
   {
     pRenderer->DrawTextureTransparent(pPaperdoll_BodyX, pPaperdoll_BodyY, pIcons_LOD->GetTexture(papredoll_dbods[uPlayerID - 1]));
     if ( !bRingsShownInCharScreen )
-      pRenderer->DrawMaskToZBuffer(pPaperdoll_BodyX, pPaperdoll_BodyY, pIcons_LOD->GetTexture(papredoll_dbods[uPlayerID - 1]), pPlayers[uPlayerID]->pEquipment.uArmor);
-    v6 = pPlayers[uPlayerID]->pEquipment.uMainHand;
+      pRenderer->DrawMaskToZBuffer(pPaperdoll_BodyX, pPaperdoll_BodyY, pIcons_LOD->GetTexture(papredoll_dbods[uPlayerID - 1]), player->pEquipment.uArmor);
+    v6 = player->pEquipment.uMainHand;
     if ( !v6 || (v7 = *(int *)&pPlayers[uPlayerID]->pInventoryItems[v6-1], pItemsTable->pItems[v7].uEquipType != 1)
          && (pItemsTable->pItems[v7].uSkillType != 4 || pPlayers[uPlayerID]->pEquipment.uShield) )
          pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_LeftHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdoll_LeftHand[pBodyComplection][1],
@@ -1424,7 +1136,7 @@
         pX_Helm = pPaperdoll_BodyX + paperdoll_Helm[pBodyComplection][v125][0];
         pY_Helm = pPaperdoll_BodyY + paperdoll_Helm[pBodyComplection][v125][1];
         if ( IsDwarf != 1 || item_Helm->uItemID != 92 )
-          v127 = paperdoll_helm_texture[pSex][v125];
+          v127 = paperdoll_helm_texture[player->GetSexByVoice()][v125];
         else
           v127 = papredoll_dbrds[11];
         if ( item_Helm->uAttributes & 0xF0 )
@@ -1604,154 +1316,179 @@
   pRenderer->DrawTextureTransparent(468, 0, pIcons_LOD->GetTexture(uTextureID_right_panel_loop));//
 }
 
-//----- (0043E825) --------------------------------------------------------
-void __fastcall CharacterUI_DrawPaperdollWithRingOverlay(unsigned int uPlayerID)
+
+
+
+
+
+
+//----- (0041A2D1) --------------------------------------------------------
+void CharacterUI_InventoryTab_Draw(Player *player, bool a2)
 {
-  int v3; // ecx@1
-  unsigned int pItemTextureNum; // ebx@3
-  //int v9; // edi@17
-  char v13; // sf@24
-  unsigned __int8 v14; // of@24
-  unsigned int pItemNum; // eax@25
-  //int v20; // edi@40
-  //int v21; // eax@41
-  //int v33; // esi@61
-  const char *spell_texture_name; // [sp-8h] [bp-38h]@8
-  Texture *spell_texture; // [sp+10h] [bp-20h]@14
-  int v41; // [sp+10h] [bp-20h]@26
-  unsigned int pY_Ring; // [sp+14h] [bp-1Ch]@3
-  unsigned int pX_Ring; // [sp+18h] [bp-18h]@3
-  int v48; // [sp+24h] [bp-Ch]@1
-  ItemGen *item;
+        Texture *v7; // esi@6
+        signed int v11; // edx@6
+        int v13; // eax@13
+        signed int v14; // edx@13
+        int v15; // eax@13
+        unsigned int v17; // edi@15
+        Texture *pTexture; // ebx@24
+        unsigned int uCellX; // [sp+30h] [bp-8h]@5
+        unsigned int uCellY; // [sp+34h] [bp-4h]@5
+
+  pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_CharacterUI_InventoryBackground));
+  if (a2)
+    pRenderer->DrawTextureIndexed(8, 305, pIcons_LOD->LoadTexturePtr("fr_strip", TEXTURE_16BIT_PALETTE));
+
+  int i = 0;
+  for (uint i = 0; i < 126; ++i)
+  {
+    int v26 = (int)(player->pInventoryIndices + i);
+
+    if (player->pInventoryIndices[i] <= 0)
+      continue;
 
-  pIcons_LOD->LoadTexture("sptext01", TEXTURE_16BIT_PALETTE);
-  CharacterUI_DrawPaperdoll(uPlayerID);
-  pRenderer->DrawTextureTransparent(0x1D9u, 0, pIcons_LOD->GetTexture(uTextureID_BACKHAND));
-  pRenderer->DrawTextureTransparent(0x1D4u, 0, pIcons_LOD->GetTexture(uTextureID_right_panel_loop));
-  pRenderer->DrawTextureIndexed(pCharacterScreen_DetalizBtn->uX, pCharacterScreen_DetalizBtn->uY, pIcons_LOD->GetTexture(uTextureID_detaliz_close_button));
-  v3 = 0;
-  v48 = 0;
-  do
-  {
-    pItemNum = pPlayers[uPlayerID]->pEquipment.uRings[v3];
-    if ( pPlayers[uPlayerID]->pEquipment.uRings[v3] )
+    int item_idx = player->pInventoryIndices[i];
+    auto item = &player->pInventoryItems[item_idx - 1];
+    if (!item->uItemID)
+      continue;
+
+    uCellY = 32 * (i / 14) + 17;
+    uCellX = 32 * (i % 14) + 14;
+
+    uint item_texture_id = pIcons_LOD->LoadTexture(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
+    v7 = pIcons_LOD->GetTexture(item_texture_id);
+
+                    v11 = v7->uTextureWidth;
+                    if (v11 < 14)
+                        v11 = 14;
+
+                    if ( (v11 - 14) / 32 == 0 && v7->uTextureWidth < 32)
+                        uCellX += (32 - v7->uTextureWidth) / 2;
+                    v13 = v11 - 14;
+                    LOBYTE(v13) = v13 & 0xE0;
+                    v15 = v13 + 32;
+                    v14 = v7->uTextureHeight;
+                    if (v14 < 14 )
+                        v14 = 14;
+                    v17 = uCellX + ((v15 - v7->uTextureWidth) >> 1) + pSRZBufferLineOffsets[uCellY + ((((v14 - 14) & 0xFFFFFFE0) - v7->uTextureHeight + 32) >> 1)];
+
+    if (item->uAttributes & 0xF0)
     {
-      item = &pPlayers[uPlayerID]->pInventoryItems[pItemNum - 1];
-      pX_Ring = pPaperdollRingsX[v3];
-      pY_Ring = pPaperdollRingsY[v3];
-      pItemTextureNum = pIcons_LOD->LoadTexture(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
-      if ( item->uAttributes & 0xF0 )
+      switch (item->uAttributes & 0xF0)
       {
-        if ( (item->uAttributes & 0xF0) == 16 )
-          spell_texture_name = "sptext01";
-        if ( (item->uAttributes & 0xF0) == 32 )
-          spell_texture_name = "sp28a";
-        if ( (item->uAttributes & 0xF0) == 64 )
-          spell_texture_name = "sp30a";
-        if ( (item->uAttributes & 0xF0) == 128 )
-          spell_texture_name = "sp91a";
-        spell_texture = pIcons_LOD->LoadTexturePtr(spell_texture_name, TEXTURE_16BIT_PALETTE);
-        _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed;
-        if ( _50C9A8_item_enchantment_timer <= 0 )
-        {
-          _50C9A8_item_enchantment_timer = 0;
-          item->uAttributes &= 0xFu;
-          ptr_50C9A4 = 0;
-        }
-        pRenderer->_4A63E6(pX_Ring, pY_Ring, pIcons_LOD->GetTexture(pItemTextureNum), spell_texture, GetTickCount() * 0.1, 0, 255);
+        case ITEM_AURA_EFFECT_RED:    pTexture = pIcons_LOD->LoadTexturePtr("sptext01", TEXTURE_16BIT_PALETTE); break;
+        case ITEM_AURA_EFFECT_BLUE:   pTexture = pIcons_LOD->LoadTexturePtr("sp28a", TEXTURE_16BIT_PALETTE);    break;
+        case ITEM_AURA_EFFECT_GREEN:  pTexture = pIcons_LOD->LoadTexturePtr("sp30a", TEXTURE_16BIT_PALETTE);    break;
+        case ITEM_AURA_EFFECT_PURPLE: pTexture = pIcons_LOD->LoadTexturePtr("sp91a", TEXTURE_16BIT_PALETTE);    break;
       }
-      else
-      {
-        if (item->Broken())
-          pRenderer->DrawTransparentRedShade(pX_Ring, pY_Ring, pIcons_LOD->GetTexture(pItemTextureNum));
-        else if (!item->Identified())
-          pRenderer->DrawTransparentGreenShade(pX_Ring, pY_Ring, pIcons_LOD->GetTexture(pItemTextureNum));
-        else
-          pRenderer->DrawTextureTransparent(pX_Ring, pY_Ring, pIcons_LOD->GetTexture(pItemTextureNum));
 
-        pRenderer->_4A601E(pX_Ring, pY_Ring, pIcons_LOD->GetTexture(pItemTextureNum), pItemNum);
-      }
-    }
-    v3++;
-    pItemNum = pPlayers[uPlayerID]->pEquipment.uRings[v3];
-    v14 = (v48 + 1) > 5;
-    v13 = v48 - 4 < 0;
-    v48++;
-  }
-  while ( (unsigned __int8)(v13 ^ v14) | (v48 == 4) );
-  pItemNum = pPlayers[uPlayerID]->pEquipment.uAmulet;
-  if ( pItemNum )
-  {
-    v41 = pPlayers[uPlayerID]->pEquipment.uAmulet;
-    item = &pPlayers[uPlayerID]->pInventoryItems[pItemNum - 1];
-    pItemTextureNum = pIcons_LOD->LoadTexture(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
-    if ( item->uAttributes & 0xF0 )
-    {
-      if ( (item->uAttributes & 0xF0) == 16 )
-        spell_texture_name = "sptext01";
-      if ( (item->uAttributes & 0xF0) == 32 )
-        spell_texture_name = "sp28a";
-      if ( (item->uAttributes & 0xF0) == 64 )
-        spell_texture_name = "sp30a";
-      if ( (item->uAttributes & 0xF0) == 128 )
-        spell_texture_name = "sp91a";
-      spell_texture = pIcons_LOD->LoadTexturePtr(spell_texture_name, TEXTURE_16BIT_PALETTE);
       _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed;
-      if ( _50C9A8_item_enchantment_timer <= 0 )
+      if (_50C9A8_item_enchantment_timer <= 0)
       {
         _50C9A8_item_enchantment_timer = 0;
-        item->uAttributes &= 0xFu;
+        LOBYTE(item->uAttributes) &= 0xF;
         ptr_50C9A4 = 0;
       }
-      pRenderer->_4A63E6(493, 91, pIcons_LOD->GetTexture(pItemTextureNum), spell_texture, GetTickCount() * 0.1, 0, 255);
+
+      pRenderer->_4A63E6(uCellX, uCellY, v7, pTexture, GetTickCount() * 0.1, 0, 255);
+      ZBuffer_Fill(&pRenderer->pActiveZBuffer[v17], item_texture_id, item_idx);
     }
     else
     {
-      if (item->Broken())
-        pRenderer->DrawTransparentRedShade(493, 91, pIcons_LOD->GetTexture(pItemTextureNum));
-      else if (!item->Identified())
-        pRenderer->DrawTransparentGreenShade(493, 91, pIcons_LOD->GetTexture(pItemTextureNum));
+      if (item->Identified() || pCurrentScreen != SCREEN_HOUSE)
+      {
+        if (item->Broken())
+          pRenderer->DrawTransparentRedShade(uCellX, uCellY, v7);
+        else
+          pRenderer->DrawTextureTransparent(uCellX, uCellY, v7);
+      }
       else
-        pRenderer->DrawTextureTransparent(493, 91, pIcons_LOD->GetTexture(pItemTextureNum));
+        pRenderer->DrawTransparentGreenShade(uCellX, uCellY, v7);
 
-      pRenderer->_4A601E(493, 91, pIcons_LOD->GetTexture(pItemTextureNum), v41);
+      ZBuffer_Fill(&pRenderer->pActiveZBuffer[v17], item_texture_id, item_idx);
+      continue;
     }
   }
-  pItemNum = pPlayers[uPlayerID]->pEquipment.uGlove;
-  if ( !pItemNum )
-    return;
-  item = &pPlayers[uPlayerID]->pInventoryItems[pItemNum - 1];
-  pItemTextureNum = pIcons_LOD->LoadTexture(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
-  if ( !(item->uAttributes & 0xF0) )
+}
+
+
+
+static void CharacterUI_DrawItem(int x, int y, ItemGen *item, int id)
+{
+  auto item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
+
+  if (item->uAttributes & 0xF0) // enchant animation
   {
-    if (item->Broken())
-      pRenderer->DrawTransparentRedShade(586, 88, pIcons_LOD->GetTexture(pItemTextureNum));
-    else if (!item->Identified())
-      pRenderer->DrawTransparentGreenShade(586, 88, pIcons_LOD->GetTexture(pItemTextureNum));
-    else
-      pRenderer->DrawTextureTransparent(586, 88, pIcons_LOD->GetTexture(pItemTextureNum));
+    Texture *enchantment_texture = nullptr;
+    switch (item->uAttributes & 0xF0)
+    {
+      case ITEM_AURA_EFFECT_RED:    enchantment_texture = pIcons_LOD->LoadTexturePtr("sptext01", TEXTURE_16BIT_PALETTE); break;
+      case ITEM_AURA_EFFECT_BLUE:   enchantment_texture = pIcons_LOD->LoadTexturePtr("sp28a", TEXTURE_16BIT_PALETTE);    break;
+      case ITEM_AURA_EFFECT_GREEN:  enchantment_texture = pIcons_LOD->LoadTexturePtr("sp30a", TEXTURE_16BIT_PALETTE);    break;
+      case ITEM_AURA_EFFECT_PURPLE: enchantment_texture = pIcons_LOD->LoadTexturePtr("sp91a", TEXTURE_16BIT_PALETTE);    break;
+    }
 
-    pRenderer->_4A601E(586, 88,pIcons_LOD->GetTexture(pItemTextureNum), pItemNum);
+    _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed;
+    if (_50C9A8_item_enchantment_timer <= 0)
+    {
+      _50C9A8_item_enchantment_timer = 0;
+      item->uAttributes &= 0xF;
+      ptr_50C9A4 = 0;
+    }
+    pRenderer->_4A63E6(x, y, item_texture, enchantment_texture, GetTickCount() * 0.1, 0, 255);
   }
   else
   {
-    if ( (item->uAttributes & 0xF0) == 16 )
-      spell_texture_name = "sptext01";
-    if ( (item->uAttributes & 0xF0) == 32 )
-      spell_texture_name = "sp28a";
-    if ( (item->uAttributes & 0xF0) == 64 )
-      spell_texture_name = "sp30a";
-    if ( (item->uAttributes & 0xF0) == 128 )
-      spell_texture_name = "sp91a";
-    spell_texture = pIcons_LOD->LoadTexturePtr(spell_texture_name, TEXTURE_16BIT_PALETTE);
-    _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed;
-    if ( _50C9A8_item_enchantment_timer <= 0 )
-    {
-      _50C9A8_item_enchantment_timer = 0;
-      item->uAttributes &= 0xFu;
-      ptr_50C9A4 = 0;
-    }
-    pRenderer->_4A63E6(586, 88, pIcons_LOD->GetTexture(pItemTextureNum), spell_texture, GetTickCount() * 0.1, 0, 255);
+    if (item->Broken())
+      pRenderer->DrawTransparentRedShade(x, y, item_texture);
+    else if (!item->Identified())
+      pRenderer->DrawTransparentGreenShade(x, y, item_texture);
+    else
+      pRenderer->DrawTextureTransparent(x, y, item_texture);
+
+    pRenderer->ZBuffer_Fill_2(x, y, item_texture, id);
+  }
+}
+
+
+//----- (0043E825) --------------------------------------------------------
+void CharacterUI_DrawPaperdollWithRingOverlay(Player *player)
+{
+  CharacterUI_DrawPaperdoll(player);
+
+  pRenderer->DrawTextureTransparent(0x1D9u, 0, pIcons_LOD->GetTexture(uTextureID_BACKHAND));
+  pRenderer->DrawTextureTransparent(0x1D4u, 0, pIcons_LOD->GetTexture(uTextureID_right_panel_loop));
+  pRenderer->DrawTextureIndexed(pCharacterScreen_DetalizBtn->uX,
+                                pCharacterScreen_DetalizBtn->uY,
+                                pIcons_LOD->GetTexture(uTextureID_detaliz_close_button));
+
+  for (uint i = 0; i < 6; ++i)
+  {
+    if (!player->pEquipment.uRings[i])
+      continue;
+    
+    static int pPaperdollRingsX[6] = {0x1EA, 0x21A, 0x248, 0x1EA, 0x21A, 0x248};
+    static int pPaperdollRingsY[6] = {0x0CA, 0x0CA, 0x0CA, 0x0FA, 0x0FA, 0x0FA};
+
+    CharacterUI_DrawItem(pPaperdollRingsX[i],
+                         pPaperdollRingsY[i],
+                         &player->pInventoryItems[player->pEquipment.uRings[i] - 1],
+                         player->pEquipment.uRings[i]);
+  }
+
+
+  if (player->pEquipment.uAmulet)
+  {
+    CharacterUI_DrawItem(493, 91,
+                         &player->pInventoryItems[player->pEquipment.uAmulet - 1],
+                         player->pEquipment.uAmulet);
+  }
+
+  if (player->pEquipment.uGlove)
+  {
+    CharacterUI_DrawItem(586, 88,
+                         &player->pInventoryItems[player->pEquipment.uGlove - 1],
+                         player->pEquipment.uGlove);
   }
 }
 
@@ -2011,8 +1748,8 @@
 }
 
 //----- (00419401) --------------------------------------------------------
-void __cdecl CharacterUI_SkillScreen_Draw()
-    {
+void CharacterUI_SkillsTab_CreateButtons()
+{
     unsigned int v0; // ecx@3
     GUIButton *pButton; // eax@3
     GUIFont *v2; // eax@8
@@ -2036,7 +1773,7 @@
 
     a2 = 0;
     if ( dword_507CC0 )
-        sub_4196A0();
+        CharacterUI_ReleaseButtons();
     v0 = uActiveCharacter;
     dword_507CC0 = uActiveCharacter;
     for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext )
@@ -2130,10 +1867,10 @@
     }
 
 //----- (00418511) --------------------------------------------------------
-char CharacterUI_StatsTab_Draw(unsigned int uPlayerID)
+char CharacterUI_StatsTab_Draw(Player *player)
 {
-        Player *pPlayer; // edi@1
-        unsigned int v4; // eax@2
+        //Player *pPlayer; // edi@1
+        //unsigned int v4; // eax@2
         int v7; // ebp@4
         int v8; // eax@4
         unsigned int v9; // eax@4
@@ -2165,7 +1902,7 @@
         unsigned int v60; // eax@8
         unsigned int v62; // eax@8
         signed int v64; // eax@8
-        unsigned __int8 v66; // al@8
+        //unsigned __int8 v66; // al@8
         char *v67; // eax@9
         signed int v70; // ebp@11
         signed int v71; // eax@11
@@ -2209,203 +1946,202 @@
         int v135; // [sp+18h] [bp-8h]@27
         int v136; // [sp+18h] [bp-8h]@33
 
-        pPlayer = &pParty->pPlayers[uPlayerID-1];
-        pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("fr_stats", TEXTURE_16BIT_PALETTE));
-        sprintf(pTmpBuf, "\f%05d", TargetColor(0xFF, 0xFF, 0x9B));
-        sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[429], pPlayer->pName, pClassNames[pPlayer->classType]);//^Pi[%s] %s
-        strcat(pTmpBuf, pTmpBuf2);
-        if ( pPlayer->uSkillPoints )
-            v4 = TargetColor(0, 0xFFu, 0);
-        else
-            v4 = 0xFFFFu;
-        sprintf(pTmpBuf2,  "\f00000\r180%s: \f%05d%d\f00000\n\n\n", pGlobalTXT_LocalizationStrings[207], v4, pPlayer->uSkillPoints);//Skill points
-        strcat(pTmpBuf, pTmpBuf2);
-        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, 18, 0, pTmpBuf, 0, 0, 0);
+        //pPlayer = &pParty->pPlayers[uPlayerID-1];
+        //pPlayer = player;
+  pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("fr_stats", TEXTURE_16BIT_PALETTE));
+  sprintf(pTmpBuf, "\f%05d", ui_color_text_header);
+  sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[429], player->pName, pClassNames[player->classType]);//"^Pi[%s] %s" / "%s the %s"
+  strcat(pTmpBuf, pTmpBuf2);
+  sprintfex(pTmpBuf2,  "\f00000\r180%s: \f%05d%d\f00000\n\n\n",
+            pGlobalTXT_LocalizationStrings[207], // "Skill points"
+            player->uSkillPoints ? ui_color_text_bonus : ui_color_text_default,
+            player->uSkillPoints);
+  strcat(pTmpBuf, pTmpBuf2);
+  pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, 18, 0, pTmpBuf, 0, 0, 0);
+
+  v10 = 53;
+  v7 = player->GetBaseStrength();
+  v8 = player->GetActualMight();
+  v9 = UI_GetHealthManaStringColor(v8, v7);
+  sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[144], v9, v8, v7);//Might
+  pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0);
 
-        v10 = 53;
-        v7 = pPlayer->GetBaseStrength();
-        v8 = pPlayer->GetActualMight();
-        v9 = UI_GetHealthManaStringColor(v8, v7);
-        sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[144], v9, v8, v7);//Might
-        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0);
+  v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
+  v13 = player->GetBaseIntelligence();
+  v14 = player->GetActualIntelligence();
+  v15 = UI_GetHealthManaStringColor(v14, v13);
+  sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[116], v15, v14, v13);//Intellect
+  pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0);
+
+  v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
+  v19 = player->GetBaseWillpower();
+  v20 = player->GetActualWillpower();
+  v21 = UI_GetHealthManaStringColor(v20, v19);
+  sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[163], v21, v20, v19);//
+  pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0);
+
+  v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
+  v25 = player->GetBaseEndurance();
+  v26 = player->GetActualEndurance();
+  v27 = UI_GetHealthManaStringColor(v26, v25);
+  sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[75], v27, v26, v25);//
+  pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0);
+
+  v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
+  v31 = player->GetBaseAccuracy();
+  v32 = player->GetActualAccuracy();
+  v33 = UI_GetHealthManaStringColor(v32, v31);
+  sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[1], v33, v32, v31);
+  pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0);
 
         v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
-        v13 = pPlayer->GetBaseIntelligence();
-        v14 = pPlayer->GetActualIntelligence();
-        v15 = UI_GetHealthManaStringColor(v14, v13);
-        sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[116], v15, v14, v13);//Intellect
-        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0);
-
-        v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
-        v19 = pPlayer->GetBaseWillpower();
-        v20 = pPlayer->GetActualWillpower();
-        v21 = UI_GetHealthManaStringColor(v20, v19);
-        sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[163], v21, v20, v19);//
-        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0);
-
-        v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
-        v25 = pPlayer->GetBaseEndurance();
-        v26 = pPlayer->GetActualEndurance();
-        v27 = UI_GetHealthManaStringColor(v26, v25);
-        sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[75], v27, v26, v25);//
-        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0);
-
-        v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
-        v31 = pPlayer->GetBaseAccuracy();
-        v32 = pPlayer->GetActualAccuracy();
-        v33 = UI_GetHealthManaStringColor(v32, v31);
-        sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[1], v33, v32, v31);
-        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0);
-
-        v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
-        v37 = pPlayer->GetBaseSpeed();
-        v38 = pPlayer->GetActualSpeed();
+        v37 = player->GetBaseSpeed();
+        v38 = player->GetActualSpeed();
         v39 = UI_GetHealthManaStringColor(v38, v37);
         sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[211], v39, v38, v37);
         pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0);
 
         v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
-        v43 = pPlayer->GetBaseLuck();
-        v44 = pPlayer->GetActualLuck();
+        v43 = player->GetBaseLuck();
+        v44 = player->GetActualLuck();
         v45 = UI_GetHealthManaStringColor(v44, v43);
         sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n\n", pGlobalTXT_LocalizationStrings[136], v45, v44, v43);
         pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0);
 
         a2 = "%s\f%05u\r424%d\f00000 /\t185%d\n";
         v10 += 2 * LOBYTE(pFontArrus->uFontHeight) + 5;
-        if ( pPlayer->GetMaxHealth() >= 1000 )
+        if ( player->GetMaxHealth() >= 1000 )
             a2 = "%s\f%05u\r388%d\f00000 / %d\n";
-        v49 = pPlayer->GetMaxHealth();
-        v50 = UI_GetHealthManaStringColor(pPlayer->sHealth, v49);
-        sprintf(pTmpBuf, a2, pGlobalTXT_LocalizationStrings[108], v50, pPlayer->sHealth, v49);
+        v49 = player->GetMaxHealth();
+        v50 = UI_GetHealthManaStringColor(player->sHealth, v49);
+        sprintf(pTmpBuf, a2, pGlobalTXT_LocalizationStrings[108], v50, player->sHealth, v49);
         pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0);
 
         a2a = "%s\f%05u\r424%d\f00000 /\t185%d\n";
         v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
-        if ( pPlayer->GetMaxMana() >= 1000 )
+        if ( player->GetMaxMana() >= 1000 )
             a2a = "%s\f%05u\r388%d\f00000 / %d\n";
-        v53 = pPlayer->GetMaxMana();
-        v54 = UI_GetHealthManaStringColor(pPlayer->sMana, v53);
-        sprintf(pTmpBuf, a2a, pGlobalTXT_LocalizationStrings[212], v54, pPlayer->sMana, v53);
+        v53 = player->GetMaxMana();
+        v54 = UI_GetHealthManaStringColor(player->sMana, v53);
+        sprintf(pTmpBuf, a2a, pGlobalTXT_LocalizationStrings[212], v54, player->sMana, v53);
         pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0);
 
         v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
-        v58 = pPlayer->GetBaseAC();
-        v59 = pPlayer->GetActualAC();
+        v58 = player->GetBaseAC();
+        v59 = player->GetActualAC();
         v60 = UI_GetHealthManaStringColor(v59, v58);
         sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n\n", pGlobalTXT_LocalizationStrings[12], v60, v59, v58);
         pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0);
 
         v10 += 2 * LOBYTE(pFontArrus->uFontHeight) - 2;
-        v62 = pPlayer->GetMajorConditionIdx();
+        v62 = player->GetMajorConditionIdx();
         v64 = GetConditionDrawColor(v62);
         sprintf(pTmpBuf, "%s: \f%05d%s\n", pGlobalTXT_LocalizationStrings[47], v64, aCharacterConditionNames[v62]);
         pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x1Au, v10, 0, pTmpBuf, 226, 0);
 
         v10 += LOBYTE(pFontArrus->uFontHeight) + - 1;
-        v66 = pPlayer->uQuickSpell;
-        if ( v66 )
-            v67 = pSpellStats->pInfos[v66].pShortName;
+        if (player->uQuickSpell)
+            v67 = pSpellStats->pInfos[player->uQuickSpell].pShortName;
         else
             v67 = pGlobalTXT_LocalizationStrings[153];
         sprintf(pTmpBuf, "%s: %s", pGlobalTXT_LocalizationStrings[172], v67);
         pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x1Au, v10, 0, pTmpBuf, 226, 0);
 
         v10 = 50;
-        v70 = pPlayer->GetBaseAge();
-        v71 = pPlayer->GetActualAge();
+        v70 = player->GetBaseAge();
+        v71 = player->GetActualAge();
         v72 = UI_GetHealthManaStringColor(v71, v70);
         sprintf(pTmpBuf, "%s\f%05u\t100%d\f00000 / %d\n", pGlobalTXT_LocalizationStrings[5], v72, v71, v70);
         pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0);
 
         a2b = "%s\f%05u\t100%d\f00000 / %d\n";
         v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
-        if ( pPlayer->GetBaseLevel() > 99 )
-            a2b = format_4E2E68;
-        v75 = pPlayer->GetBaseLevel();
-        v76 = pPlayer->GetActualLevel();
+        if ( player->GetBaseLevel() > 99 )
+            a2b = "%s\f%05u\t180%d\f00000 / %d\n";
+        v75 = player->GetBaseLevel();
+        v76 = player->GetActualLevel();
         v77 = UI_GetHealthManaStringColor(v76, v75);
         sprintf(pTmpBuf, a2b, pGlobalTXT_LocalizationStrings[131], v77, v76, v75);
         pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0);
 
         v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
-        if ( (signed __int64)pPlayer->uExperience <= 9999999 )
-            v78 = pGlobalTXT_LocalizationStrings[83];
+        if (player->uExperience <= 9999999)
+            v78 = pGlobalTXT_LocalizationStrings[83]; // "Experience"
         else
-            v78 = pGlobalTXT_LocalizationStrings[17];
-        v81 = pPlayer->GetExperienceDisplayColor();
-        sprintf(pTmpBuf, "%s\r180\f%05d%lu\f00000\n\n", v78, v81, LODWORD(pPlayer->uExperience));
+            v78 = pGlobalTXT_LocalizationStrings[17]; // "Exp."
+        v81 = player->GetExperienceDisplayColor();
+        sprintf(pTmpBuf, "%s\r180\f%05d%lu\f00000\n\n", v78, v81, LODWORD(player->uExperience));
         pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0);
 
         v10 += 2 * LOBYTE(pFontArrus->uFontHeight);
-        v83 = pPlayer->GetActualAttack(0);
+        v83 = player->GetActualAttack(0);
         sprintf(pTmpBuf, "%s\t100%+d\n", pGlobalTXT_LocalizationStrings[18], v83);
         pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0);
 
         v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
-        v85 = pPlayer->GetMeleeDamageString();
+        v85 = player->GetMeleeDamageString();
         sprintf(pTmpBuf, "%s\t100 %s\n", pGlobalTXT_LocalizationStrings[53], v85);
         pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0);
 
         v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
-        v87 = pPlayer->GetRangedAttack();
+        v87 = player->GetRangedAttack();
         sprintf(pTmpBuf, "%s\t100%+d\n", pGlobalTXT_LocalizationStrings[203], v87);
         pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0);
 
         v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
-        v89 = pPlayer->GetRangedDamageString();
+        v89 = player->GetRangedDamageString();
         sprintf(pTmpBuf, "%s\t100 %s\n\n", pGlobalTXT_LocalizationStrings[53], v89);
         pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0);
 
         a2c = format_4E2E10;
         v10 += 2 * LOBYTE(pFontArrus->uFontHeight) - 4;
-        v131 = pPlayer->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_FIRE);
-        v90 = pPlayer->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_FIRE);
+        v131 = player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_FIRE);
+        v90 = player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_FIRE);
         if ( v131 > 99 || v90 > 99 )
-            a2c = format_4E2E68;
+            a2c = "%s\f%05u\t180%d\f00000 / %d\n";
         v92 = UI_GetHealthManaStringColor(v131, v90);
         sprintf(pTmpBuf, a2c, pGlobalTXT_LocalizationStrings[87], v92, v131, v90);
         pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0);
 
         a2d = format_4E2E10;
         v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
-        v132 = pPlayer->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_AIR);
-        v93 = pPlayer->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_AIR);
+        v132 = player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_AIR);
+        v93 = player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_AIR);
         if ( v132 > 99 || v93 > 99 )
-            a2d = format_4E2E68;
+            a2d = "%s\f%05u\t180%d\f00000 / %d\n";
         v95 = UI_GetHealthManaStringColor(v132, v93);
         sprintf(pTmpBuf, a2d, pGlobalTXT_LocalizationStrings[6], v95, v132, v93);
         pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0);
 
         a2e = format_4E2E10;
         v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
-        v133 = pPlayer->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_WATER);
-        v96 = pPlayer->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_WATER);
+        v133 = player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_WATER);
+        v96 = player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_WATER);
         if ( v133 > 99 || v96 > 99 )
-            a2e = format_4E2E68;
+            a2e = "%s\f%05u\t180%d\f00000 / %d\n";
         v98 = UI_GetHealthManaStringColor(v133, v96);
         sprintf(pTmpBuf, a2e, pGlobalTXT_LocalizationStrings[240], v98, v133, v96);
         pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0);
 
         a2f = format_4E2E10;
         v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
-        v134 = pPlayer->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_EARTH);
-        v99 = pPlayer->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_EARTH);
+        v134 = player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_EARTH);
+        v99 = player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_EARTH);
         if ( v134 > 99 )
-            a2f = format_4E2E68;
+            a2f = "%s\f%05u\t180%d\f00000 / %d\n";
         v101 = UI_GetHealthManaStringColor(v134, v99);
         sprintf(pTmpBuf, a2f, pGlobalTXT_LocalizationStrings[70], v101, v134, v99);
         pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0);
 
         a2g = format_4E2E10;
         v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
-        v135 = pPlayer->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_MIND);
-        v102 = pPlayer->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_MIND);
+        v135 = player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_MIND);
+        v102 = player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_MIND);
         if ( v135 > 99 || v102 > 99 )
-            a2g = format_4E2E68;
+            a2g = "%s\f%05u\t180%d\f00000 / %d\n";
         v104 = UI_GetHealthManaStringColor(v135, v102);
         sprintf(pTmpBuf, a2g, pGlobalTXT_LocalizationStrings[142], v104, v135, v102);
-        if ( pPlayer->classType == PLAYER_CLASS_LICH && v102 == 200 )
+        if ( player->classType == PLAYER_CLASS_LICH && v102 == 200 )
         {
             v106 = UI_GetHealthManaStringColor(v135, 200);
             sprintf(pTmpBuf, format_4E2E00, pGlobalTXT_LocalizationStrings[142], v106, pGlobalTXT_LocalizationStrings[625]);
@@ -2414,13 +2150,13 @@
 
         a2h = format_4E2E10;
         v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
-        v136 = pPlayer->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_BODY);
-        v107 = pPlayer->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_BODY);
+        v136 = player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_BODY);
+        v107 = player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_BODY);
         if ( v136 > 99 || v107 > 99 )
-            a2h = format_4E2E68;
+            a2h = "%s\f%05u\t180%d\f00000 / %d\n";
         v109 = UI_GetHealthManaStringColor(v136, v107);
         sprintf(pTmpBuf, a2h, pGlobalTXT_LocalizationStrings[29], v109, v136, v107);
-        if ( pPlayer->classType == PLAYER_CLASS_LICH && v107 == 200 )
+        if ( player->classType == PLAYER_CLASS_LICH && v107 == 200 )
         {
             v111 = UI_GetHealthManaStringColor(v136, 200);
             sprintf(pTmpBuf, format_4E2E00, pGlobalTXT_LocalizationStrings[29], v111, pGlobalTXT_LocalizationStrings[625]);
--- a/UiGame.cpp	Tue May 14 10:07:21 2013 +0600
+++ b/UiGame.cpp	Tue May 14 10:07:33 2013 +0600
@@ -48,6 +48,196 @@
 
 
 
+
+//----- (0041A57E) --------------------------------------------------------
+void GameUI_QuickRef_Draw()
+{
+        unsigned int v0; // ebx@1
+        //unsigned int v1; // eax@1
+        Player *pPlayer; // ebp@2
+        int v3; // eax@6
+        int v4; // edi@6
+        unsigned int v5; // eax@7
+        unsigned int v6; // edi@9
+        unsigned int v7; // edi@11
+        signed int v8; // eax@13
+        unsigned int v9; // eax@13
+        unsigned int v10; // edi@13
+        int v11; // eax@15
+        unsigned int v12; // eax@15
+        unsigned int v13; // edi@15
+        int v14; // eax@17
+        int v15; // ST18_4@17
+        int v16; // ebx@17
+        int v17; // eax@17
+        unsigned int v18; // eax@17
+        unsigned int v19; // edi@17
+        int v20; // eax@19
+        unsigned int v21; // edi@19
+        char *v22; // eax@21
+        unsigned int v23; // edi@21
+        int v24; // eax@23
+        unsigned int v25; // edi@23
+        char *v26; // eax@25
+        unsigned int v27; // edi@25
+        int v28; // ecx@27
+        char *v29; // eax@27
+        signed int v30; // edx@27
+        unsigned int v31; // edi@31
+        unsigned int v32; // edi@33
+        const char *v33; // ST10_4@35
+        unsigned int v34; // eax@35
+        unsigned int v35; // edi@35
+        unsigned __int8 v36; // al@37
+        char *v37; // eax@38
+        int v38; // eax@41
+        signed int v39; // edi@42
+        char *v40; // eax@45
+        unsigned int v41; // eax@45
+        signed int v43; // [sp+10h] [bp-1Ch]@1
+        unsigned int v44; // [sp+14h] [bp-18h]@2
+        int v45; // [sp+18h] [bp-14h]@1
+        unsigned int v46; // [sp+1Ch] [bp-10h]@1
+        unsigned int v47; // [sp+20h] [bp-Ch]@1
+        unsigned int v48; // [sp+24h] [bp-8h]@33
+        //unsigned int v49; // [sp+28h] [bp-4h]@1
+
+        v0 = 0;
+        v47 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
+        //v49 = TargetColor(0xFFu, 0, 0);
+        v46 = TargetColor(0, 0xFFu, 0);
+        //v1 = pIcons_LOD->LoadTexture("quikref", TEXTURE_16BIT_PALETTE);
+        pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("quikref", TEXTURE_16BIT_PALETTE));
+        v43 = 0;
+        v45 = LOBYTE(pFontArrus->uFontHeight) + 1;
+        do
+            {
+            pPlayer = &pParty->pPlayers[v43];
+            v44 = 94 * v43 + 89;
+            if ( v43 == v0 )
+                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, 0x12u, v0, pGlobalTXT_LocalizationStrings[149], 60, v0);//Name
+            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 94 * v43 + 89, 0x12u, v47, pPlayer->pName, 84, v0);
+            if ( v43 == v0 )
+                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, 0x2Fu, v0, pGlobalTXT_LocalizationStrings[131], 60, v0); //.
+            v3 = pPlayer->GetActualLevel();
+            sprintf(pTmpBuf, "%lu", v3);
+            v4 = pPlayer->GetBaseLevel();
+            if ( pPlayer->GetActualLevel() <= v4 )
+                v5 = pPlayer->GetExperienceDisplayColor();
+            else
+                v5 = TargetColor(0, 0xFFu, v0);
+            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, 0x2Fu, v5, pTmpBuf, 84, v0);
+            v6 = v45 + 47;
+            if ( v43 == v0 )
+                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v45 + 47, v0, pGlobalTXT_LocalizationStrings[41], 60, v0);//
+            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v6, v0, pClassNames[pPlayer->classType], 84, v0);
+            v7 = v45 + v6;
+            if ( v43 == v0 )
+                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v7, v0, pGlobalTXT_LocalizationStrings[107], 60, v0);//.
+            sprintf(pTmpBuf, "%d", pPlayer->sHealth);
+            v8 = pPlayer->GetMaxHealth();
+            v9 = UI_GetHealthManaStringColor(pPlayer->sHealth, v8);
+            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v7, v9, pTmpBuf, 84, v0);
+            v10 = v45 + v7;
+            if ( v43 == v0 )
+                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v10, v0, pGlobalTXT_LocalizationStrings[209], 60, v0);//
+            sprintf(pTmpBuf, "%d", pPlayer->sMana);
+            v11 = pPlayer->GetMaxMana();
+            v12 = UI_GetHealthManaStringColor(pPlayer->sMana, v11);
+            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v10, v12, pTmpBuf, 84, v0);
+            v13 = v45 + v10;
+            if ( v43 == v0 )
+                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v13, v0, pGlobalTXT_LocalizationStrings[0], 60, v0);// 
+            v14 = pPlayer->GetActualAC();
+            sprintf(pTmpBuf, "%d", v14);
+            v15 = v0;
+            v16 = pPlayer->GetBaseAC();
+            v17 = pPlayer->GetActualAC();
+            v18 = UI_GetHealthManaStringColor(v17, v16);
+            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v13, v18, pTmpBuf, 84, v15);
+            v0 = 0;
+            v19 = v45 + v13;
+            if ( !v43 )
+                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v19, 0, pGlobalTXT_LocalizationStrings[18], 60, 0);//
+            v20 = pPlayer->GetActualAttack(0);
+            sprintf(pTmpBuf, "%+d", v20);
+            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v19, 0, pTmpBuf, 84, 0);
+            v21 = v45 + v19;
+            if ( !v43 )
+                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v21, 0, pGlobalTXT_LocalizationStrings[66], 60, 0);//.
+            v22 = pPlayer->GetMeleeDamageString();
+            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v21, 0, v22, 84, 0);
+            v23 = v45 + v21;
+            if ( !v43 )
+                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v23, 0, pGlobalTXT_LocalizationStrings[203], 60, 0);// 
+            v24 = pPlayer->GetRangedAttack();
+            sprintf(pTmpBuf, "%+d", v24);
+            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v23, 0, pTmpBuf, 84, 0);
+            v25 = v45 + v23;
+            if ( !v43 )
+                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v25, 0, pGlobalTXT_LocalizationStrings[66], 60, 0);//.
+            v26 = pPlayer->GetRangedDamageString();
+            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v25, 0, v26, 84, 0);
+            v27 = v45 + v25;
+            if ( !v43 )
+                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v27, 0, pGlobalTXT_LocalizationStrings[205], 60, 0);//
+            v28 = 0;
+            v29 = (char *)pPlayer->pActiveSkills;
+            v30 = 36;
+            do
+                {
+                if ( *(short *)v29 )
+                    ++v28;
+                v29 += 2;
+                --v30;
+                }
+                while ( v30 );
+                sprintf(pTmpBuf, "%lu", v28);
+                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v27, 0, pTmpBuf, 84, 0);
+                v31 = v45 + v27;
+                if ( !v43 )
+                    pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v31, 0, pGlobalTXT_LocalizationStrings[168], 60, 0);//
+                sprintf(pTmpBuf, "%lu", pPlayer->uSkillPoints);
+                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v31, pPlayer->uSkillPoints != 0 ? v46 : 0, pTmpBuf, 84, 0);
+                v32 = v45 + v31;
+                v48 = pPlayer->GetMajorConditionIdx();
+                if ( !v43 )
+                    pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v32, 0, pGlobalTXT_LocalizationStrings[45], 60, 0);//.
+                v33 = aCharacterConditionNames[v48];
+                v34 = GetConditionDrawColor(v48);
+                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v32, v34, v33, 84, 0);
+                v35 = v45 + v32;
+                if ( !v43 )
+                    pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v35, 0, pGlobalTXT_LocalizationStrings[170], 60, 0);//..
+                v36 = pPlayer->uQuickSpell;
+                if ( v36 )
+                    v37 = pSpellStats->pInfos[v36].pShortName;
+                else
+                    v37 = pGlobalTXT_LocalizationStrings[153];//
+                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v35, 0, v37, 84, 0);
+                ++v43;
+            }
+            while ( v43 < 4 );
+
+            v38 = GetPartyReputation();
+            if ( v38 >= 0 )
+                {
+                if ( v38 <= 5 )
+                    v39 = TargetColor(0xFF, 0xFF, 0xFF);
+                else
+                    v39 = TargetColor(0xFF, 0, 0);
+                }
+            else
+                v39 = v46;
+
+            v40 = GetReputationString(v38);
+            sprintf(pTmpBuf, "%s: \f%05d%s\f00000", pGlobalTXT_LocalizationStrings[180], v39, v40);//Reputation
+            pGUIWindow_CurrentMenu->DrawText(pFontArrus, 22, 323, 0, pTmpBuf, 0, 0, 0);
+            v41 = pParty->GetPartyFame();
+            sprintf(pTmpBuf, "\r261%s: %d", pGlobalTXT_LocalizationStrings[84], v41);// Fame 
+            pGUIWindow_CurrentMenu->DrawText(pFontArrus, 0, 323, 0, pTmpBuf, 0, 0, 0);
+        }
+
 //----- (0041AD6E) --------------------------------------------------------
 void __cdecl GameUI_DrawRightPanelItems()
 {
--- a/mm7_1.cpp	Tue May 14 10:07:21 2013 +0600
+++ b/mm7_1.cpp	Tue May 14 10:07:33 2013 +0600
@@ -74,7 +74,7 @@
 }
 
 //----- (004196A0) --------------------------------------------------------
-void __cdecl sub_4196A0()
+void CharacterUI_ReleaseButtons()
 {
   GUIButton *i; // esi@2
   GUIButton *j; // esi@7
--- a/mm7_5.cpp	Tue May 14 10:07:21 2013 +0600
+++ b/mm7_5.cpp	Tue May 14 10:07:33 2013 +0600
@@ -1399,7 +1399,7 @@
                       pVideoPlayer->Unload();
                       continue;
                     case SCREEN_CHARACTERS:
-                      sub_4196A0();
+                      CharacterUI_ReleaseButtons();
                       sub_419379();
                       pIcons_LOD->_4114F2();
                       if ( pGUIWindow_Settings )
@@ -1486,7 +1486,8 @@
                   pIcons_LOD->_4355F7();
                   continue;
                 }
-                sub_4196A0();
+LABEL_319:
+                CharacterUI_ReleaseButtons();
                 sub_419379();
                 pIcons_LOD->_4114F2();
               }
@@ -2958,15 +2959,15 @@
           continue;
         case UIMSG_ClickStatsBtn:
           pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 100;
-          sub_4196A0();
+          CharacterUI_ReleaseButtons();
           sub_419379();
           GUIWindow::Create(pCharacterScreen_StatsBtn->uX, pCharacterScreen_StatsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_StatsBtn, 0);
           continue;
         case UIMSG_ClickSkillsBtn:
           pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 101;
-          sub_4196A0();
+          CharacterUI_ReleaseButtons();
           sub_419379();
-          CharacterUI_SkillScreen_Draw();
+          CharacterUI_SkillsTab_CreateButtons();
           GUIWindow::Create(pCharacterScreen_SkillsBtn->uX, pCharacterScreen_SkillsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_SkillsBtn, 0);
           continue;
         case UIMSG_SkillUp:
@@ -2995,7 +2996,7 @@
         case UIMSG_ClickInventoryBtn:
           pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103;
           sub_419379();
-          sub_4196A0();
+          CharacterUI_ReleaseButtons();
           GUIWindow::Create(pCharacterScreen_InventoryBtn->uX, pCharacterScreen_InventoryBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_InventoryBtn, 0);
           continue;
         case UIMSG_ClickExitCharacterWindowBtn:
@@ -3003,7 +3004,7 @@
           continue;
         case UIMSG_ClickAwardsBtn:
           sub_419379();
-          sub_4196A0();
+          CharacterUI_ReleaseButtons();
           sub_419220();
           pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 102;
           GUIWindow::Create(pCharacterScreen_AwardsBtn->uX, pCharacterScreen_AwardsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_AwardsBtn, 0);
@@ -10254,7 +10255,7 @@
       }
       case WINDOW_CharacterRecord:
       {
-        CharacterUI_CharacterScreen_Draw(uActiveCharacter);
+        CharacterUI_CharacterScreen_Draw(pPlayers[uActiveCharacter]);
         continue;
       }
       case WINDOW_Options:
@@ -10274,7 +10275,7 @@
       }
       case WINDOW_QuickReference:
       {
-        QuickRefDraw();
+        GameUI_QuickRef_Draw();
         continue;
       }
       case WINDOW_Rest:
@@ -10356,7 +10357,7 @@
         pRenderer->ClearZBuffer(0, 479);
         draw_leather();
         CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
-        CharacterUI_DrawPaperdoll(uActiveCharacter);
+        CharacterUI_DrawPaperdoll(pPlayers[uActiveCharacter]);
         pRenderer->DrawTextureTransparent(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pIcons_LOD->GetTexture(uTextureID_x_x_u));
         continue;
       }
--- a/mm7_6.cpp	Tue May 14 10:07:21 2013 +0600
+++ b/mm7_6.cpp	Tue May 14 10:07:33 2013 +0600
@@ -2485,10 +2485,10 @@
   //__int16 v73; // ST1C_2@222
   //__int16 v74; // ST18_2@222
   //stru6 *v75; // eax@222
-  int v76; // ecx@223
-  int v77; // ecx@224
-  int v78; // ecx@225
-  int v79; // eax@227
+  //int v76; // ecx@223
+  //int v77; // ecx@224
+  //int v78; // ecx@225
+  //int v79; // eax@227
   //int v80; // eax@232
   //__int16 v81; // ST18_2@245
   //stru6 *v82; // eax@245
@@ -2500,7 +2500,7 @@
   //__int16 v88; // ST18_2@245
   //stru6 *v89; // eax@245
   double v90; // st7@245
-  int v91; // eax@250
+  //int v91; // eax@250
   Player *v92; // eax@255
   //__int16 v93; // ST18_2@260
   //stru6 *v94; // eax@260
@@ -2510,10 +2510,10 @@
   //stru6 *v98; // eax@260
   //__int16 v99; // ST18_2@260
   //stru6 *v100; // eax@260
-  int v101; // ecx@261
-  int v102; // ecx@262
-  int v103; // ecx@263
-  int v104; // eax@265
+  //int v101; // ecx@261
+  //int v102; // ecx@262
+  //int v103; // ecx@263
+  //int v104; // eax@265
   int v105; // edi@271
   //__int16 v106; // ST18_2@272
   //stru6 *v107; // eax@272
@@ -2532,10 +2532,10 @@
   //int v120; // eax@286
   //int v121; // eax@286
   signed int v122; // eax@286
-  int v123; // ecx@288
-  int v124; // ecx@289
-  int v125; // ecx@290
-  int v126; // eax@292
+  //int v123; // ecx@288
+  //int v124; // ecx@289
+  //int v125; // ecx@290
+  //int v126; // eax@292
   int v127; // eax@296
   //__int16 v128; // ST18_2@303
   //stru6 *v129; // eax@303
@@ -2547,9 +2547,9 @@
   //stru6 *v135; // eax@303
   //unsigned __int64 v136; // qax@304
   //char *v137; // ecx@304
-  int v138; // ecx@305
+  //int v138; // ecx@305
   int v139; // ecx@306
-  int v140; // eax@308
+  //int v140; // eax@308
   //__int16 v141; // ST18_2@311
   //stru6 *v142; // eax@311
   //__int16 v143; // ST18_2@311
@@ -2566,10 +2566,10 @@
   int v154; // eax@322
   int v155; // eax@323
   int v156; // eax@323
-  int v157; // eax@326
+  //int v157; // eax@326
   double v158; // st7@326
   double v159; // st6@326
-  signed __int64 v160; // qtt@334
+  //signed __int64 v160; // qtt@334
   //int v161; // eax@339
   int v162; // edi@340
   //int v163; // eax@340
@@ -2579,10 +2579,10 @@
   //stru6 *v167; // eax@340
   signed int v168; // edi@343
   int v169; // eax@344
-  int v170; // ecx@346
-  int v171; // ecx@347
-  int v172; // ecx@348
-  int v173; // edi@350
+  //int v170; // ecx@346
+  //int v171; // ecx@347
+  //int v172; // ecx@348
+  //int v173; // edi@350
   signed int v174; // edi@355
   //__int16 v175; // ST18_2@357
   //stru6 *v176; // eax@357
@@ -2602,8 +2602,8 @@
   //const char *v190; // ecx@377
   signed int v191; // edi@379
   int v192; // ecx@382
-  int v193; // ecx@383
-  int v194; // ecx@384
+  //int v193; // ecx@383
+  //int v194; // ecx@384
   int v195; // eax@386
   int v196; // eax@387
   //__int16 v197; // ST18_2@395
@@ -2628,13 +2628,13 @@
   double v216; // st7@415
   double v217; // st6@415
   signed __int64 v218; // qtt@423
-  int v219; // ecx@425
-  int v220; // ecx@426
-  int v221; // edi@428
+  //int v219; // ecx@425
+  //int v220; // ecx@426
+  //int v221; // edi@428
   Player *v222; // edi@434
   char v223; // al@438
-  int v224; // ecx@442
-  int v225; // ecx@443
+  //int v224; // ecx@442
+  //int v225; // ecx@443
   //int v226; // eax@451
   int v227; // esi@453
   unsigned int v228; // edi@454
@@ -2682,7 +2682,7 @@
   char *v270; // eax@531
   char v271; // al@531
   char v272; // cf@534
-  float v273; // esi@541
+  //float v273; // esi@541
   char v274; // al@541
   int v275; // edx@544
   int k; // esi@544
@@ -2729,9 +2729,9 @@
   const char *v317; // ecx@617
   Player *v318; // ecx@619
   unsigned int v319; // edi@627
-  int v320; // ecx@629
-  int v321; // ecx@630
-  int v322; // edi@632
+  //int v320; // ecx@629
+  //int v321; // ecx@630
+  //int v322; // edi@632
   int v323; // edi@635
   char *v324; // eax@635
   Player *v325; // ecx@640
@@ -2748,18 +2748,18 @@
   //stru6 *v336; // eax@658
   //__int16 v337; // ST18_2@658
   //stru6 *v338; // eax@658
-  int v339; // ecx@659
-  int v340; // ecx@660
-  int v341; // eax@663
+  //int v339; // ecx@659
+  //int v340; // ecx@660
+  //int v341; // eax@663
   signed int v342; // edi@668
   signed int v343; // edi@670
   unsigned __int64 v344; // ST08_8@670
   //__int16 v345; // ST1C_2@671
   //__int16 v346; // ST18_2@671
   //stru6 *v347; // eax@671
-  int v348; // ecx@672
-  int v349; // ecx@673
-  int v350; // edi@676
+  //int v348; // ecx@672
+  //int v349; // ecx@673
+  //int v350; // edi@676
   Player *v351; // edi@680
   //__int16 v352; // ST18_2@685
   //stru6 *v353; // eax@685
@@ -2784,7 +2784,7 @@
   int v372; // ecx@710
   int v373; // eax@715
   int v374; // eax@717
-  Player *v375; // edi@717
+  //Player *v375; // edi@717
   int v376; // eax@717
   Player *v377; // ecx@719
   int v378; // ecx@721
@@ -2802,27 +2802,27 @@
   //__int16 v390; // ST18_2@740
   //stru6 *v391; // eax@740
   int v392; // ecx@742
-  int v393; // ecx@743
-  int v394; // ecx@744
-  int v395; // edi@747
+  //int v393; // ecx@743
+  //int v394; // ecx@744
+  //int v395; // edi@747
   int v396; // eax@752
   int v397; // eax@757
   int v398; // eax@757
   int v399; // eax@757
-  char *v400; // esi@757
+  //char *v400; // esi@757
   //Game *v401; // ecx@759
   //__int16 v402; // ST1C_2@759
   //__int16 v403; // ST18_2@759
   //stru6 *v404; // eax@759
-  int v405; // ecx@761
-  int v406; // ecx@762
-  int v407; // edi@765
+  //int v405; // ecx@761
+  //int v406; // ecx@762
+  //int v407; // edi@765
   //__int16 v408; // ST1C_2@769
   //__int16 v409; // ST18_2@769
   //stru6 *v410; // eax@769
-  int v411; // ecx@772
-  int v412; // ecx@773
-  int v413; // edi@775
+  //int v411; // ecx@772
+  //int v412; // ecx@773
+  //int v413; // edi@775
   //__int16 v414; // ST1C_2@781
   //__int16 v415; // ST18_2@781
   //stru6 *v416; // eax@781
@@ -2851,18 +2851,18 @@
   //stru6 *v439; // eax@843
   int v440; // eax@843
   int v441; // eax@847
-  int v442; // ecx@850
-  int v443; // ecx@851
-  int v444; // eax@853
+  //int v442; // ecx@850
+  //int v443; // ecx@851
+  //int v444; // eax@853
   signed int v445; // edi@857
   int v446; // ecx@862
   LevelDecoration *v447; // edi@864
   __int16 v448; // ax@864
   char *v449; // esi@870
   int v450; // eax@870
-  int v451; // ecx@875
-  int v452; // ecx@876
-  int v453; // edi@878
+  //int v451; // ecx@875
+  //int v452; // ecx@876
+  //int v453; // edi@878
   //__int16 v454; // ST1C_2@884
   //__int16 v455; // ST18_2@884
   //stru6 *v456; // eax@884
@@ -2873,16 +2873,16 @@
   Actor *v461; // eax@897
   unsigned __int16 v462; // cx@897
   signed int v463; // edx@897
-  int v464; // ecx@905
-  int v465; // ecx@906
-  int v466; // edi@909
+  //int v464; // ecx@905
+  //int v465; // ecx@906
+  //int v466; // edi@909
   //__int16 v467; // ST1C_2@913
   //__int16 v468; // ST18_2@913
   //stru6 *v469; // eax@913
   int v470; // edi@913
   int v471; // eax@917
   int v472; // eax@917
-  char *v473; // esi@918
+  //char *v473; // esi@918
   //__int16 v474; // ST18_2@920
   //stru6 *v475; // eax@920
   //__int16 v476; // ST18_2@920
@@ -2924,14 +2924,14 @@
   //int v512; // eax@946
   SpellBuff *v513; // edi@946
   int v514; // ecx@950
-  int v515; // ecx@951
+  //int v515; // ecx@951
   int v516; // eax@953
   //int v517; // eax@956
   Actor *v518; // edx@957
   __int16 v519; // cx@958
-  int v520; // ecx@968
-  int v521; // ecx@969
-  int v522; // eax@971
+  //int v520; // ecx@968
+  //int v521; // ecx@969
+  //int v522; // eax@971
   //__int16 v523; // ST18_2@975
   //stru6 *v524; // eax@975
   //__int16 v525; // ST18_2@975
@@ -2957,11 +2957,11 @@
   //__int16 v545; // ST18_2@991
   //stru6 *v546; // eax@991
   //__int16 v547; // ST18_2@991
-  stru6 *v548; // eax@991
+  //stru6 *v548; // eax@991
   double v549; // st7@991
   unsigned __int16 v550; // di@991
   int v551; // ecx@993
-  int v552; // ecx@994
+  //int v552; // ecx@994
   Player *v553; // edi@1001
   //__int16 v554; // ST18_2@1002
   //stru6 *v555; // eax@1002
@@ -3003,7 +3003,7 @@
   char v591; // al@1048
   int v592; // esi@1052
   int v593; // ecx@1057
-  int v594; // ecx@1058
+  //int v594; // ecx@1058
   //int v595; // eax@1064
   int v596; // esi@1066
   unsigned int v597; // edi@1067
@@ -3087,7 +3087,7 @@
   const char *v675; // [sp+4h] [bp-E80h]@800
   int v676; // [sp+4h] [bp-E80h]@807
   int v677; // [sp+4h] [bp-E80h]@861
-  int v678; // [sp+4h] [bp-E80h]@997
+  //int v678; // [sp+4h] [bp-E80h]@997
   int v679; // [sp+14h] [bp-E70h]@515
   AIDirection a3; // [sp+C94h] [bp-1F0h]@21
   int v681[4]; // [sp+CB0h] [bp-1D4h]@1137
@@ -3162,8 +3162,6 @@
   LODWORD(v733) = 0;
   v723 = 0;
   v727 = 0.0;
-  //n = 0;
-  //while ( 1 )
   for(n = 0; n < 10; ++n)
   {
     pCastSpell = &this[n];
@@ -3219,7 +3217,7 @@
     if (pCastSpell->forced_spell_skill_level)
     {
       v11 = pCastSpell->forced_spell_skill_level;
-      v723 = v11 & 0x3F;
+      v723 = v11 & 0x3F; // 6 bytes
       v2 = v723;
     }
     else
@@ -3253,21 +3251,7 @@
       v11 = pPlayer->pActiveSkills[LODWORD(v725)];
     }
 
-    if ( HIBYTE(v11) & 1 )
-    {
-      v731 = 4;
-    }
-    else
-    {
-      if ( (v11 & 0x80u) == 0 )
-      {
-        v731 = ((v11 & 0x40) != 0) + 1;
-      }
-      else
-      {
-        v731 = 3;
-      }
-    }
+	v731 = SkillToMastery(v11);
 
     if (pCastSpell->forced_spell_skill_level)
       uRequiredMana = 0;
@@ -3655,7 +3639,24 @@
 			pSpellSprite.vPosition.y = pParty->vPosition.y;
 			v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2;
 			v660 = pParty->vPosition.y;
-			goto LABEL_153;
+			pSpellSprite.uAttributes = 0;
+			pSpellSprite.vPosition.x = pParty->vPosition.x;
+			pSpellSprite.vPosition.z = v51;
+			v52 = pIndoor->GetSector(pParty->vPosition.x, v660, v671);
+			pSpellSprite.uSpriteFrameID = 0;
+			pSpellSprite.uSectorID = v52;
+			pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
+			pSpellSprite.spell_target_pid = a2;
+			pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
+			pSpellSprite.uFacing = LOWORD(v715.uYawAngle);
+			pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
+			if ( pParty->bTurnBasedModeOn == 1 )
+				LOBYTE(pSpellSprite.uAttributes) |= 4u;
+			v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed;
+			if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 )
+				++pTurnEngine->field_1C;
+			LODWORD(v727) = 1;
+			break;
       }
       case SPELL_LIGHT_SUNRAY:
       {
@@ -3678,7 +3679,23 @@
 				v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
 				v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
 				v660 = pParty->vPosition.y;
-				goto LABEL_153;
+				pSpellSprite.uAttributes = 0;
+				pSpellSprite.vPosition.x = pParty->vPosition.x;
+				pSpellSprite.vPosition.z = v51;
+				v52 = pIndoor->GetSector(pParty->vPosition.x, v660, v671);
+				pSpellSprite.uSpriteFrameID = 0;
+				pSpellSprite.uSectorID = v52;
+				pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
+				pSpellSprite.spell_target_pid = a2;
+				pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
+				pSpellSprite.uFacing = LOWORD(v715.uYawAngle);
+				pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
+				if ( pParty->bTurnBasedModeOn == 1 )
+					LOBYTE(pSpellSprite.uAttributes) |= 4u;
+				v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed;
+				if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 )
+					++pTurnEngine->field_1C;
+				LODWORD(v727) = 1;
 			}
 			break;
       }
@@ -3701,32 +3718,33 @@
 		v672 = 0;
 		*(short *)(v55 + 150) = 0;
 		v661 = (Actor *)v55;
-		goto LABEL_165;
+		pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, v672);
+		LODWORD(v727) = 1;
+		break;
       }
       case SPELL_EARTH_SLOW:
       {
 			if ( v731 == 2 )
 			{
 				v57 = 300 * v2;
-			}
-			else
-			{
-				if ( v731 == 3 )
-				{
+				amount = 2;
+			}
+			else if ( v731 == 3 )
+			{
 				amount = 4;
 				v57 = 300 * v2;
-				goto LABEL_174;
-				}
-				if ( v731 == 4 )
-				{
+			}
+			else if ( v731 == 4 )
+			{
 				v57 = 300 * v2;
 				amount = 8;
-				goto LABEL_174;
-				}
+			}
+			else
+			{
 				v57 = 180 * v2;
-			}
-			amount = 2;
-	LABEL_174:
+				amount = 2;
+			}
+//	LABEL_174:
 			LODWORD(v733) = v57;
 			if ( !pPlayer->CanCastSpell(uRequiredMana) )
 				break;
@@ -3749,7 +3767,9 @@
 			*((char *)&pActors[0].uAttributes + v59 + 2) |= 8u;
 			v672 = 0;
 			v661 = (Actor *)LODWORD(v718);
-			goto LABEL_165;
+			pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, v672);
+			LODWORD(v727) = 1;
+			break;
       }
       case SPELL_MIND_CHARM:
       {
@@ -3783,7 +3803,29 @@
 		pSpellSprite.spell_skill = v731;
 		v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
 		v61 = PID_ID(a2);
-		goto LABEL_1086;
+			v600 = pActors[v61].vPosition.y;
+			v601 = pActors[v61].vPosition.x;
+			pSpellSprite.uObjectDescID = v60;
+			pSpellSprite.vPosition.x = v601;
+			v602 = pActors[v61].uActorHeight;
+			v603 = pActors[v61].vPosition.z;
+			pSpellSprite.vPosition.y = v600;
+			v676 = v603 + v602;
+			v665 = v600;
+			pSpellSprite.vPosition.z = v603 + v602;
+			v657 = v601;
+			pSpellSprite.uAttributes = 0;
+			pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676);
+			pSpellSprite.uSpriteFrameID = 0;
+			pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
+			pSpellSprite.spell_target_pid = a2;
+			pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
+			pSpellSprite.uFacing = LOWORD(v715.uYawAngle);
+			LOBYTE(pSpellSprite.uAttributes) |= 0x80u;
+			pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
+			pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1);
+			LODWORD(v727) = 1;
+			break;
       }
       case SPELL_DARK_SHRINKING_RAY:
       {
@@ -3840,7 +3882,7 @@
 			if ( !v65 )
 			{
 				amount = 12;
-	LABEL_195:
+//	LABEL_195:
 				LODWORD(v733) = 3600 * v2;
 			}
 			else if ( v65 == 1 )
@@ -3850,7 +3892,7 @@
 			}
 			}
 			}
-	LABEL_196:
+//	LABEL_196:
 			if ( !pPlayer->CanCastSpell(uRequiredMana) )
 				break;
 			v730c = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2];
@@ -3925,36 +3967,12 @@
       case SPELL_MIND_PROTECTION_FROM_MIND:
       case SPELL_BODY_PROTECTION_FROM_BODY:
       {
-        v76 = v731 - 1;
         LODWORD(v733) = 3600 * v2;
-        if ( v76 )
-        {
-          v77 = v76 - 1;
-          if ( v77 )
-          {
-            v78 = v77 - 1;
-            if ( v78 )
-            {
-              if ( v78 != 1 )
-                goto LABEL_232;
-              v79 = 4 * v2;
-            }
-            else
-            {
-              v79 = 3 * v2;
-            }
-          }
-          else
-          {
-            v79 = 2 * v2;
-          }
-          amount = v79;
-        }
-        else
-        {
-          amount = v2;
-        }
-LABEL_232:
+		if ( v731 > 0 && v731 <= 4)
+		{
+	        amount = v731 * v2;
+        }		
+//LABEL_232:
         //v80 = v3->spellnum;
         switch (pCastSpell->spellnum)
         {
@@ -3993,73 +4011,56 @@
       }
       case SPELL_FIRE_HASTE:
       {
-			if ( v731 <= 0 )
-				goto LABEL_254;
-			if ( v731 <= 2 )
-			{
-				v91 = 60 * (v2 + 60);
-			}
-			else
-			{
-				if ( v731 == 3 )
-				{
-				v91 = 180 * (v2 + 20);
-				}
-				else
-				{
-				if ( v731 != 4 )
-					goto LABEL_254;
-				v91 = 240 * (v2 + 15);
-				}
-			}
-			LODWORD(v733) = v91;
-	LABEL_254:
+			if ( v731 == 1 || v731 == 2 )
+			{
+				LODWORD(v733) = 60 * (v2 + 60);
+			}
+			else if ( v731 == 3 )
+			{
+				LODWORD(v733) = 180 * (v2 + 20);
+			}
+			else if ( v731 == 4 )
+			{
+				LODWORD(v733) = 240 * (v2 + 15);
+			}
 			if ( pPlayer->CanCastSpell(uRequiredMana) )
 			{
 				v92 = pParty->pPlayers;//[0].pConditions[1];
 				LODWORD(v727) = 1;
 				do
 				{
-				if ( v92->pConditions )
-					LODWORD(v727) = 0;
-				++v92;
+					if ( v92->pConditions )
+						LODWORD(v727) = 0;
+					++v92;
 				}
 				while ( v92 <= &pParty->pPlayers[3] );
 				if (LODWORD(v727))
 				{
-				pParty->pPartyBuffs[PARTY_BUFF_HASTE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0);
-
-				pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
-				pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
-				pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
-				pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
+					pParty->pPartyBuffs[PARTY_BUFF_HASTE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0);
+
+					pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
+					pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
+					pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
+					pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
 				}
 			}
 			break;
       }
       case SPELL_SPIRIT_BLESS:
       {
-			v101 = v731 - 1;
-			if ( v101 && (v102 = v101 - 1) != 0 )
-			{
-				v103 = v102 - 1;
-				if ( v103 )
-				{
-				if ( v103 != 1 )
-					goto LABEL_269;
-				v104 = 3600 * (v2 + 1);
-				}
-				else
-				{
-				v104 = 900 * (v2 + 4);
-				}
-			}
-			else
-			{
-				v104 = 300 * (v2 + 12);
-			}
-			LODWORD(v733) = v104;
-	LABEL_269:
+			if ( v731 == 1 || v731 == 2 )
+			{
+				LODWORD(v733) = 300 * (v2 + 12);
+			}
+			else if ( v731 == 3 )
+			{
+				LODWORD(v733) = 900 * (v2 + 4);
+			}
+			else if ( v731 == 4 )
+			{
+				LODWORD(v733) = 3600 * (v2 + 1);
+			}
+//	LABEL_269:
 			amount = v2 + 5;
 			if ( !pPlayer->CanCastSpell(uRequiredMana) )
 				break;
@@ -4170,28 +4171,21 @@
 		case SPELL_AIR_SHIELD:
 		case SPELL_EARTH_STONESKIN:
 		case SPELL_SPIRIT_HEROISM:
-			{
-			v123 = v731 - 1;
-			if ( v123 && (v124 = v123 - 1) != 0 )
-			{
-				v125 = v124 - 1;
-				if ( v125 )
-				{
-				if ( v125 != 1 )
-					goto LABEL_296;
-				v126 = 3600 * (v2 + 1);
-				}
-				else
-				{
-				v126 = 900 * (v2 + 4);
-				}
-			}
-			else
-			{
-				v126 = 300 * (v2 + 12);
-			}
-			LODWORD(v733) = v126;
-	LABEL_296:
+		{
+			if( v731 == 1 || v731 == 2 )
+			{
+				LODWORD(v733) = 300 * (v2 + 12);
+			}
+			else if ( v731 == 3 )
+			{
+				LODWORD(v733) = 900 * (v2 + 4);
+			}
+			else if ( v731 == 4 )
+			{
+				LODWORD(v733) = 3600 * (v2 + 1);
+			}
+
+//	LABEL_296:
 			v127 = pCastSpell->spellnum;
 			if ( v127 == 17 )
 			{
@@ -4227,12 +4221,10 @@
 			}
 		case SPELL_FIRE_IMMOLATION:
 			{
-			v138 = v731 - 2;
-			if ( v138 && (v139 = v138 - 1) != 0 && v139 == 1 )
-				v140 = 600 * v2;
+			if ( v731 == 4  && v139 == 1 )
+				LODWORD(v733) = 600 * v2;
 			else
-				v140 = 60 * v2;
-			LODWORD(v733) = v140;
+				LODWORD(v733) = 60 * v2;
 			if ( !pPlayer->CanCastSpell(uRequiredMana) )
 				break;
 
@@ -4301,16 +4293,18 @@
 				*(float *)&v721 = v159;
 				a2 = rand() % 1000;
 				*((float *)&v733 + 1) = (double)(rand() % 1000) + *(float *)&y - *(float *)&v732;
-				v725 = v159 * v159;
+				//v725 = v159 * v159;
 				*(float *)&_this = v158 * v158;
-				if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + *(float *)&_this + v725) <= 1.0 )
+				//if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + *(float *)&_this + v725) <= 1.0 )
+				if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + *(float *)&_this + v159 * v159) <= 1.0 )
 				{
 					LODWORD(v687) = 0;
 					HIDWORD(v687) = 0;
 				}
 				else
 				{
-					x = (signed __int64)sqrt(*(float *)&_this + v725);
+					//x = (signed __int64)sqrt(*(float *)&_this + v725);
+					x = (signed __int64)sqrt(*(float *)&_this + v159 * v159);
 					v687 = __PAIR__(
 							stru_5C6E00->Atan2(x, (signed __int64)*((float *)&v733 + 1)),
 							stru_5C6E00->Atan2((signed __int64)v718, (signed __int64)*(float *)&v721));
@@ -4416,24 +4410,19 @@
 			}
 		case SPELL_AIR_FEATHER_FALL:
 			{
-			v170 = v731 - 1;
-			if ( !v170 )
-			{
-				v173 = 300 * v2;
-				goto LABEL_353;
-			}
-			v171 = v170 - 1;
-			if ( !v171 )
-			{
-				v173 = 600 * v2;
-				goto LABEL_353;
-			}
-			v172 = v171 - 1;
-			if ( !v172 || v172 == 1 )
-			{
-				v173 = 3600 * v2;
-	LABEL_353:
-				LODWORD(v733) = v173;
+			if ( v731 == 1 )
+			{
+				LODWORD(v733) = 300 * v2;
+			}
+			else if ( v731 == 2 )
+			{
+				LODWORD(v733) = 600 * v2;
+			}
+			else if ( v731 == 3 || v731 == 4 )
+			{
+				LODWORD(v733) = 3600 * v2;
+	//LABEL_353:
+				//LODWORD(v733) = v173;
 			}
 			if ( !pPlayer->CanCastSpell(uRequiredMana) )
 				break;
@@ -4541,39 +4530,32 @@
 		case SPELL_AIR_INVISIBILITY:
 			{
 			v192 = v731 - 1;
-			if ( !v192 )
+			if ( v731 == 1 )
 			{
 				amount = v2;
-				//goto LABEL_391;
-				v195 = 600 * v2;
-				goto LABEL_392;
-			}
-			v193 = v192 - 1;
-			if ( !v193 )
+				LODWORD(v733) = 600 * v2;
+			}
+			else if ( v731 == 2 )
 			{
 				v196 = 2 * v2;
-	//LABEL_389:
 				amount = v196;
-	//LABEL_391:
-				v195 = 600 * v2;
-				goto LABEL_392;
-			}
-			v194 = v193 - 1;
-			if ( !v194 )
+				LODWORD(v733) = 600 * v2;
+			}
+			else if ( v731 == 3 )
 			{
 				v196 = 3 * v2;
 				//goto LABEL_389;
 				amount = v196;
-				v195 = 600 * v2;
-				goto LABEL_392;
-			}
-			if ( v194 != 1 )
-				goto LABEL_393;
+				LODWORD(v733) = 600 * v2;
+			}
+			else if ( v731 == 4 )
+			{
 			amount = 4 * v2;
 			v195 = 3600 * v2;
-	LABEL_392:
+//	LABEL_392:
 			LODWORD(v733) = v195;
-	LABEL_393:
+			}
+//	LABEL_393:
 			if (pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW))
 			{
 				ShowStatusBarString(pGlobalTXT_LocalizationStrings[638], 2);  // There are hostile creatures nearby!
@@ -4719,31 +4701,16 @@
 		}
 
 		case SPELL_WATER_AWAKEN:
-			{
-			v219 = v731 - 2;
-			if ( v219 )
-			{
-				v220 = v219 - 1;
-				if ( v220 )
-				{
-				if ( v220 == 1 )
-				{
-					amount = 0;
-					goto LABEL_433;
-				}
-				v221 = 180 * v2;
-				}
-				else
-				{
-				v221 = 86400 * v2;
-				}
-			}
-			else
-			{
-				v221 = 3600 * v2;
-			}
-			amount = v221;
-	LABEL_433:
+		{
+			if ( v731 == 1 )
+				amount = 180 * v2;
+			else if ( v731 == 2)
+				amount = 3600 * v2;
+			else if ( v731 == 3 )
+				amount = 86400 * v2;
+			else if ( v731 == 4 )
+				amount = 0;
+//	LABEL_433:
 			if ( !pPlayer->CanCastSpell(uRequiredMana) )
 				break;
 			v222 = pParty->pPlayers;
@@ -4779,27 +4746,15 @@
 			}
 			}
 		case SPELL_WATER_POISON_SPRAY:
-			{
-			v224 = v731 - 2;
-			if ( v224 )
-			{
-				v225 = v224 - 1;
-				if ( v225 )
-				{
-				if ( v225 == 1 )
-					amount = 7;
-				else
-					amount = 1;
-				}
-				else
-				{
+		{
+			if ( v731 == 1 )
+				amount = 1;
+			else if ( v731 == 2 )
+				amount = 3;
+			else if ( v731 == 3 )
 				amount = 5;
-				}
-			}
-			else
-			{
-				amount = 3;
-			}
+			else if ( v731 == 4 )
+				amount = 7;
 			if ( !pPlayer->CanCastSpell(uRequiredMana) )
 				break;
 			HIDWORD(v733) = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360;
@@ -4814,7 +4769,7 @@
 				v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
 				v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
 				v660 = pParty->vPosition.y;
-	LABEL_153:
+//	LABEL_153:
 				pSpellSprite.uAttributes = 0;
 				pSpellSprite.vPosition.x = pParty->vPosition.x;
 				pSpellSprite.vPosition.z = v51;
@@ -4927,25 +4882,21 @@
 		{
 			v241 = (double)v723 * 0.0099999998 + 0.5;
 		}
-		else
-		{
-			if ( v731 == 3 )
-			{
+		else if ( v731 == 3 )
+		{
 			v241 = (double)v723 * 0.0099999998 + 0.69999999;
-			}
-			else
-			{
-			if ( v731 != 4 )
-			{
-				v241 = 0.0;
-				goto LABEL_484;
-			}
+		}
+		else if ( v731 == 4 )
+		{
 			v241 = (double)v723 * 0.0099999998 + 0.80000001;
-			}
+		}
+		else
+		{
+			v241 = 0.0;
 		}
 		if ( v241 > 1.0 )
 			v241 = 1.0;
-LABEL_484:
+//LABEL_484:
 		v732 = (unsigned __int8)v240[25];
 		v242 = (signed __int64)((double)v732 * v241);
 		v243 = y;
@@ -5029,24 +4980,26 @@
 								v254 = rand();
 								v255 = 10;//pItemsTable->field_116D8[17];
 								v256 = 10;//pItemsTable->field_116D8[16];
-LABEL_611:
+//LABEL_611:
 								*(int *)(v245 + 8) = v256 + v254 % (v255 - v256 + 1);
-LABEL_612:
+//LABEL_612:
 								_this->uItemID |= 0x20u;
 
 								_50C9A8_item_enchantment_timer = 256;
 								LODWORD(v727) = 1;
 								break;
 							}
-							goto LABEL_616;
 							}
-LABEL_613:
+							else
+							{
+//LABEL_613:					
 							v316 = _this->uItemID;
 							if ( !(BYTE1(v316) & 2) )
 							{
 							LOBYTE(v316) = v316 | 2;
 							_this->uItemID = v316;
 							}
+							}
 						}
 						}
 					}
@@ -5055,17 +5008,17 @@
 				}
 			}
 			}
-LABEL_616:
+//LABEL_616:
 			if ( LODWORD(v727) == 0 )
 			{
-			v317 = pGlobalTXT_LocalizationStrings[428];
-			if ( v730 == 0 )
-				v317 = pGlobalTXT_LocalizationStrings[585];
-			ShowStatusBarString(v317, 2u);
-			pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
-			v318 =  &pParty->pPlayers[pCastSpell->uPlayerID_2];
-			pCastSpell->spellnum = 0;
-			v318->PlaySound(SPEECH_43, 0);
+				v317 = pGlobalTXT_LocalizationStrings[428];
+				if ( v730 == 0 )
+					v317 = pGlobalTXT_LocalizationStrings[585];
+				ShowStatusBarString(v317, 2u);
+				pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+				v318 =  &pParty->pPlayers[pCastSpell->uPlayerID_2];
+				pCastSpell->spellnum = 0;
+				v318->PlaySound(SPEECH_43, 0);
 			}
 			break;
 		}
@@ -5073,87 +5026,125 @@
 		{
 			if ( v731 == 3 )
 			{
-			v245 = (int)&v244[36 * a2 + 532];
-			v269 = *(int *)v245;
-			if ( *(int *)v245 > 134
-				|| *(int *)(v245 + 12) != 0
-				|| *(int *)(v245 + 4) != 0
-				|| *(int *)(v245 + 8) != 0
-				|| (_this = (ItemGen *)(v245 + 20), *(char *)(v245 + 20) & 2) )
-				goto LABEL_616;
-			v270 = (char *)&pItemsTable->pItems[v269].pIconName;
-			LODWORD(v725) = (int)v270;
-			v271 = v270[28];
-			if ( v271 && v271 != 1 && v271 != 2 )
-				v272 = ((ItemGen *)v245)->GetValue() < 0x1C2;
-			else
-				v272 = ((ItemGen *)v245)->GetValue() < 0xFA;
-			if ( v272 )
-			{
-				uRequiredMana = 1;
-				v730 = 0;
-			}
-			if ( rand() % 100 >= SHIDWORD(v733) )
-				uRequiredMana = 1;
-			if (uRequiredMana)
-				goto LABEL_613;
-			v273 = v725;
-			v274 = *(char *)(LODWORD(v725) + 28);
-			if ( v274 == 0 | v274 == 1 | v274 == 2 | v274 == 3 | v274 == 4 | v274 == 5 | v274 == 6 | v274 == 7 | v274 == 8 | v274 == 9 | v274 == 10 | v274 == 11 )
-			{
-				if ( rand() % 100 < 80
-				&& !(*(char *)(LODWORD(v273) + 28) == 0 | *(char *)(LODWORD(v273) + 28) == 1 | *(char *)(LODWORD(v273) + 28) == 2) )
+				v245 = (int)&v244[36 * a2 + 532];
+				v269 = *(int *)v245;
+				if ( *(int *)v245 > 134
+					|| *(int *)(v245 + 12) != 0
+					|| *(int *)(v245 + 4) != 0
+					|| *(int *)(v245 + 8) != 0
+					|| (_this = (ItemGen *)(v245 + 20), *(char *)(v245 + 20) & 2) )
 				{
-				v275 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType];
-				*(int *)(v245 + 4) = 0;
-				for ( k = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + 1];
-						;
-						k += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType
-																					+ 1] )
+					if ( LODWORD(v727) == 0 )
+					{
+						v317 = pGlobalTXT_LocalizationStrings[428];
+						if ( v730 == 0 )
+							v317 = pGlobalTXT_LocalizationStrings[585];
+						ShowStatusBarString(v317, 2u);
+						pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+						v318 =  &pParty->pPlayers[pCastSpell->uPlayerID_2];
+						pCastSpell->spellnum = 0;
+						v318->PlaySound(SPEECH_43, 0);
+					}
+					break;
+				}
+				v270 = (char *)&pItemsTable->pItems[v269].pIconName;
+				LODWORD(v725) = (int)v270;
+				v271 = v270[28];
+				if ( v271 && v271 != 1 && v271 != 2 )
+					v272 = ((ItemGen *)v245)->GetValue() < 0x1C2;
+				else
+					v272 = ((ItemGen *)v245)->GetValue() < 0xFA;
+				if ( v272 )
 				{
-					++*(int *)(v245 + 4);
-					if ( k >= v275 )
+					uRequiredMana = 1;
+					v730 = 0;
+				}
+				if ( rand() % 100 >= SHIDWORD(v733) )
+					uRequiredMana = 1;
+				if (uRequiredMana)
+				{
+					v316 = _this->uItemID;
+					if ( !(BYTE1(v316) & 2) )
+					{
+					LOBYTE(v316) = v316 | 2;
+					_this->uItemID = v316;
+					}
+					if ( LODWORD(v727) == 0 )
+					{
+						v317 = pGlobalTXT_LocalizationStrings[428];
+						if ( v730 == 0 )
+							v317 = pGlobalTXT_LocalizationStrings[585];
+						ShowStatusBarString(v317, 2u);
+						pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+						v318 =  &pParty->pPlayers[pCastSpell->uPlayerID_2];
+						pCastSpell->spellnum = 0;
+						v318->PlaySound(SPEECH_43, 0);
+					}
 					break;
 				}
-				v254 = rand();
-				v255 = 10;//pItemsTable->field_116D8[19];
-				v256 = 10;//pItemsTable->field_116D8[18];
-				goto LABEL_611;
-				}
-				v277 = pItemsTable->pSpecialEnchantments_count;
-				v278 = 0;
-				v725 = 0.0;
-				HIDWORD(v733) = 0;
-				if ( pItemsTable->pSpecialEnchantments_count > 0 )
+				//v273 = v725;
+				v274 = *(char *)(LODWORD(v725) + 28);
+				if ( v274 == 0 | v274 == 1 | v274 == 2 | v274 == 3 | v274 == 4 | v274 == 5 | v274 == 6 | v274 == 7 | v274 == 8 | v274 == 9 | v274 == 10 | v274 == 11 )
 				{
-				v730 = (int)&v679;
-				do
-				{
-					v279 = LOBYTE(pItemsTable->pSpecialEnchantments[v278 + 1].pBonusStatement);
-					if ( !v279 || v279 == 1 )
+					if ( rand() % 100 < 80
+					//&& !(*(char *)(LODWORD(v273) + 28) == 0 | *(char *)(LODWORD(v273) + 28) == 1 | *(char *)(LODWORD(v273) + 28) == 2) )
+					&& !(*(char *)(LODWORD(v725) + 28) == 0 | *(char *)(LODWORD(v725) + 28) == 1 | *(char *)(LODWORD(v725) + 28) == 2) )
 					{
-					v280 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType
-																		+ 4]
-							+ v278 * 28);
-					LODWORD(v725) += v280;
-					if ( v280 )
-					{
-						v281 = v730;
-						v730 += 4;
-						*(int *)v281 = HIDWORD(v733);
-					}
+						v275 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType];
+						*(int *)(v245 + 4) = 0;
+						for ( k = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + 1];
+								;
+								k += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType
+																							+ 1] )
+						{
+							++*(int *)(v245 + 4);
+							if ( k >= v275 )
+							break;
+						}
+						v254 = rand();
+						v255 = 10;//pItemsTable->field_116D8[19];
+						v256 = 10;//pItemsTable->field_116D8[18];
+						*(int *)(v245 + 8) = v256 + v254 % (v255 - v256 + 1);
+						_this->uItemID |= 0x20u;
+
+						_50C9A8_item_enchantment_timer = 256;
+						LODWORD(v727) = 1;
+						break;
 					}
-					++HIDWORD(v733);
-					++v278;
-				}
-				while ( SHIDWORD(v733) < v277 );
-				}
-				v282 = rand() % SLODWORD(v725);
-				v283 = v679;
-				*(int *)(v245 + 12) = v679;
-				v284 = pItemsTable->pSpecialEnchantments[v283].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4];
-				v285 = v282 + 1;
-				if ( v284 < v285 )
+					v277 = pItemsTable->pSpecialEnchantments_count;
+					v278 = 0;
+					v725 = 0.0;
+					HIDWORD(v733) = 0;
+					if ( pItemsTable->pSpecialEnchantments_count > 0 )
+					{
+						v730 = (int)&v679;
+						do
+						{
+							v279 = LOBYTE(pItemsTable->pSpecialEnchantments[v278 + 1].pBonusStatement);
+							if ( !v279 || v279 == 1 )
+							{
+								v280 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType
+																					+ 4]
+										+ v278 * 28);
+								LODWORD(v725) += v280;
+								if ( v280 )
+								{
+									v281 = v730;
+									v730 += 4;
+									*(int *)v281 = HIDWORD(v733);
+								}
+							}
+							++HIDWORD(v733);
+							++v278;
+						}
+						while ( SHIDWORD(v733) < v277 );
+					}
+					v282 = rand() % SLODWORD(v725);
+					v283 = v679;
+					*(int *)(v245 + 12) = v679;
+					v284 = pItemsTable->pSpecialEnchantments[v283].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4];
+					v285 = v282 + 1;
+																		if ( v284 < v285 )
 				{
 				for ( l = &v679; ; l = (int *)v732 )
 				{
@@ -5167,112 +5158,168 @@
 					break;
 				}
 				}
-				++*(int *)(v245 + 12);
-				goto LABEL_612;
-			}
+					++*(int *)(v245 + 12);
+					_this->uItemID |= 0x20u;
+
+					_50C9A8_item_enchantment_timer = 256;
+					LODWORD(v727) = 1;
+					break;
+				}
 			}
 			else
 			{
-			__debugbreak(); // v726 is most probably the caster, filled in case 54
-			if ( v731 != 4
-				|| (v245 = (int)&v726->pInventoryItems[a2], v246 = *(int *)v245, *(int *)v245 > 134)
-				|| v726->pInventoryItems[a2].uSpecEnchantmentType != 0
-				|| v726->pInventoryItems[a2].uEnchantmentType != 0
-				|| v726->pInventoryItems[a2]._bonus_strength != 0
-				|| (_this = (ItemGen *)((char *)&v726->pInventoryItems[a2] + 20), v726->pInventoryItems[a2].Broken()) )
-				goto LABEL_616;
-			v247 = (char *)&pItemsTable->pItems[v246].pIconName;
-			LODWORD(v725) = (int)v247;
-			v248 = v247[28];
-			if ( v248 && v248 != 1 && v248 != 2 )
-				v249 = v726->pInventoryItems[a2].GetValue() < 0x1C2;
-			else
-				v249 = v726->pInventoryItems[a2].GetValue() < 0xFA;
-			if ( v249 )
-			{
-				uRequiredMana = 1;
-				v730 = 0;
-			}
-			if ( rand() % 100 >= SHIDWORD(v733) )
-				uRequiredMana = 1;
-			if (uRequiredMana)
-				goto LABEL_613;
-			v250 = v725;
-			v251 = *(char *)(LODWORD(v725) + 28);
-			if ( v251 == 0 | v251 == 1 | v251 == 2 | v251 == 3 | v251 == 4 | v251 == 5 | v251 == 6 | v251 == 7 | v251 == 8 | v251 == 9 | v251 == 10 | v251 == 11 )
-			{
-				if ( rand() % 100 < 80
-				&& !(*(char *)(LODWORD(v250) + 28) == 0 | *(char *)(LODWORD(v250) + 28) == 1 | *(char *)(LODWORD(v250) + 28) == 2) )
+				__debugbreak(); // v726 is most probably the caster, filled in case 54
+				if ( v731 != 4
+					|| (v245 = (int)&v726->pInventoryItems[a2], v246 = *(int *)v245, *(int *)v245 > 134)
+					|| v726->pInventoryItems[a2].uSpecEnchantmentType != 0
+					|| v726->pInventoryItems[a2].uEnchantmentType != 0
+					|| v726->pInventoryItems[a2]._bonus_strength != 0
+					|| (_this = (ItemGen *)((char *)&v726->pInventoryItems[a2] + 20), v726->pInventoryItems[a2].Broken()) )
 				{
-				v252 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType];
-				*(int *)(v245 + 4) = 0;
-				for ( m = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + 1];
-						;
-						m += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType
-																					+ 1] )
+					if ( LODWORD(v727) == 0 )
+					{
+						v317 = pGlobalTXT_LocalizationStrings[428];
+						if ( v730 == 0 )
+							v317 = pGlobalTXT_LocalizationStrings[585];
+						ShowStatusBarString(v317, 2u);
+						pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+						v318 =  &pParty->pPlayers[pCastSpell->uPlayerID_2];
+						pCastSpell->spellnum = 0;
+						v318->PlaySound(SPEECH_43, 0);
+					}
+					break;
+				}
+				v247 = (char *)&pItemsTable->pItems[v246].pIconName;
+				LODWORD(v725) = (int)v247;
+				v248 = v247[28];
+				if ( v248 && v248 != 1 && v248 != 2 )
+					v249 = v726->pInventoryItems[a2].GetValue() < 0x1C2;
+				else
+					v249 = v726->pInventoryItems[a2].GetValue() < 0xFA;
+				if ( v249 )
 				{
-					++*(int *)(v245 + 4);
-					if ( m >= v252 )
+					uRequiredMana = 1;
+					v730 = 0;
+				}
+				if ( rand() % 100 >= SHIDWORD(v733) )
+					uRequiredMana = 1;
+				if (uRequiredMana)
+				{
+					v316 = _this->uItemID;
+					if ( !(BYTE1(v316) & 2) )
+					{
+					LOBYTE(v316) = v316 | 2;
+					_this->uItemID = v316;
+					}
+					if ( LODWORD(v727) == 0 )
+					{
+						v317 = pGlobalTXT_LocalizationStrings[428];
+						if ( v730 == 0 )
+							v317 = pGlobalTXT_LocalizationStrings[585];
+						ShowStatusBarString(v317, 2u);
+						pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+						v318 =  &pParty->pPlayers[pCastSpell->uPlayerID_2];
+						pCastSpell->spellnum = 0;
+						v318->PlaySound(SPEECH_43, 0);
+					}
 					break;
 				}
-				v254 = rand();
-				v255 = 10;// pItemsTable->field_116D8[21];
-				v256 =  10;//pItemsTable->field_116D8[20];
-				goto LABEL_611;
-				}
-				v257 = pItemsTable->pSpecialEnchantments_count;
-				v258 = 0;
-				v725 = 0.0;
-				HIDWORD(v733) = 0;
-				if ( pItemsTable->pSpecialEnchantments_count > 0 )
+				v250 = v725;
+				v251 = *(char *)(LODWORD(v725) + 28);
+				if ( v251 == 0 | v251 == 1 | v251 == 2 | v251 == 3 | v251 == 4 | v251 == 5 | v251 == 6 | v251 == 7 | v251 == 8 | v251 == 9 | v251 == 10 | v251 == 11 )
 				{
-				v730 = (int)&v679;
-				do
-				{
-					v259 = LOBYTE(pItemsTable->pSpecialEnchantments[v258 + 1].pBonusStatement);
-					if ( !v259 || v259 == 1 )
+					if ( rand() % 100 < 80
+					&& !(*(char *)(LODWORD(v250) + 28) == 0 | *(char *)(LODWORD(v250) + 28) == 1 | *(char *)(LODWORD(v250) + 28) == 2) )
+					{
+					v252 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType];
+					*(int *)(v245 + 4) = 0;
+					for ( m = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + 1];
+							;
+							m += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType
+																						+ 1] )
 					{
-					v260 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType
-																		+ 4]
-							+ v258 * 28);
-					LODWORD(v725) += v260;
-					if ( v260 )
+						++*(int *)(v245 + 4);
+						if ( m >= v252 )
+						break;
+					}
+					v254 = rand();
+					v255 = 10;// pItemsTable->field_116D8[21];
+					v256 =  10;//pItemsTable->field_116D8[20];
+						*(int *)(v245 + 8) = v256 + v254 % (v255 - v256 + 1);
+						_this->uItemID |= 0x20u;
+
+						_50C9A8_item_enchantment_timer = 256;
+						LODWORD(v727) = 1;
+						break;
+					}
+					v257 = pItemsTable->pSpecialEnchantments_count;
+					v258 = 0;
+					v725 = 0.0;
+					HIDWORD(v733) = 0;
+					if ( pItemsTable->pSpecialEnchantments_count > 0 )
 					{
-						v261 = v730;
-						v730 += 4;
-						*(int *)v261 = HIDWORD(v733);
-					}
+						v730 = (int)&v679;
+						do
+						{
+							v259 = LOBYTE(pItemsTable->pSpecialEnchantments[v258 + 1].pBonusStatement);
+							if ( !v259 || v259 == 1 )
+							{
+								v260 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType
+																					+ 4]
+										+ v258 * 28);
+								LODWORD(v725) += v260;
+								if ( v260 )
+								{
+									v261 = v730;
+									v730 += 4;
+									*(int *)v261 = HIDWORD(v733);
+								}
+							}
+							++HIDWORD(v733);
+							++v258;
+						}
+						while ( SHIDWORD(v733) < v257 );
 					}
-					++HIDWORD(v733);
-					++v258;
-				}
-				while ( SHIDWORD(v733) < v257 );
-				}
-				v262 = rand() % SLODWORD(v725);
-				v263 = v679;
-				*(int *)(v245 + 12) = v679;
-				v264 = pItemsTable->pSpecialEnchantments[v263].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4];
-				v265 = v262 + 1;
-				if ( v264 < v265 )
-				{
-				for ( ii = &v679; ; ii = (int *)v732 )
-				{
-					v267 = (int)(ii + 1);
-					v732 = v267;
-					v268 = *(int *)v267;
-					*(int *)(v245 + 12) = v268;
-					v264 += pItemsTable->pSpecialEnchantments[v268].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType
-																		+ 4];
-					if ( v264 >= v265 )
+					v262 = rand() % SLODWORD(v725);
+					v263 = v679;
+					*(int *)(v245 + 12) = v679;
+					v264 = pItemsTable->pSpecialEnchantments[v263].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4];
+					v265 = v262 + 1;
+					if ( v264 < v265 )
+					{
+						for ( ii = &v679; ; ii = (int *)v732 )
+						{
+							v267 = (int)(ii + 1);
+							v732 = v267;
+							v268 = *(int *)v267;
+							*(int *)(v245 + 12) = v268;
+							v264 += pItemsTable->pSpecialEnchantments[v268].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType
+																				+ 4];
+							if ( v264 >= v265 )
+							break;
+						}
+					}
+					++*(int *)(v245 + 12);
+					_this->uItemID |= 0x20u;
+
+					_50C9A8_item_enchantment_timer = 256;
+					LODWORD(v727) = 1;
 					break;
 				}
-				}
-				++*(int *)(v245 + 12);
-				goto LABEL_612;
-			}
 			}
 			//v1 = 0;
-			goto LABEL_616;
+			if ( LODWORD(v727) == 0 )
+			{
+				v317 = pGlobalTXT_LocalizationStrings[428];
+				if ( v730 == 0 )
+					v317 = pGlobalTXT_LocalizationStrings[585];
+				ShowStatusBarString(v317, 2u);
+				pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+				v318 =  &pParty->pPlayers[pCastSpell->uPlayerID_2];
+				pCastSpell->spellnum = 0;
+				v318->PlaySound(SPEECH_43, 0);
+			}
+			break;
 		}
 		v289 = (ItemGen *)&v244[36 * a2 + 532];
 		_this = v289;
@@ -5286,7 +5333,20 @@
 			|| v291 == 1
 			|| v291 == 2
 			|| _this->Broken())
-			goto LABEL_616;
+		{
+			if ( LODWORD(v727) == 0 )
+			{
+				v317 = pGlobalTXT_LocalizationStrings[428];
+				if ( v730 == 0 )
+					v317 = pGlobalTXT_LocalizationStrings[585];
+				ShowStatusBarString(v317, 2u);
+				pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+				v318 =  &pParty->pPlayers[pCastSpell->uPlayerID_2];
+				pCastSpell->spellnum = 0;
+				v318->PlaySound(SPEECH_43, 0);
+			}
+			break;
+		}
 		if ( _this->GetValue() < 0x1C2 )
 			uRequiredMana = 1;
 		if ( rand() % 100 >= SHIDWORD(v733) )
@@ -5434,23 +5494,12 @@
 			}
 		case SPELL_EARTH_STONE_TO_FLESH:
 			{
-		v320 = v731 - 2;
-		if ( !v320 )
-			goto LABEL_632;
-		v321 = v320 - 1;
-		if ( v321 )
-		{
-			if ( v321 == 1 )
-			goto LABEL_634;
-LABEL_632:
-			v322 = 3600 * v2;
-		}
-		else
-		{
-			v322 = 86400 * v2;
-		}
-		amount = v322;
-LABEL_634:
+		__debugbreak(); // missing GM ?
+		if ( v731 == 1 || v731 == 2)
+			amount = 3600 * v2;
+		if ( v731 == 3 )
+			amount = 86400 * v2;
+//LABEL_634:
 		if ( !pPlayer->CanCastSpell(uRequiredMana) )
 			break;
 		v323 = pCastSpell->uPlayerID_2;
@@ -5471,7 +5520,9 @@
 		v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335);
 		v656 = 15;
 		v325 = &pParty->pPlayers[v323];
-		goto LABEL_641;
+		v325->DiscardConditionIfLastsLongerThan(v656, v663);
+		LODWORD(v727) = 1;
+		break;
 		}
 		case SPELL_EARTH_ROCK_BLAST:
 			{
@@ -5572,30 +5623,15 @@
 		case SPELL_SPIRIT_FATE:
 			{
 		LODWORD(v733) = 300;
-		v339 = v731 - 2;
-		if ( v339 )
-		{
-			v340 = v339 - 1;
-			if ( v340 )
-			{
-			if ( v340 != 1 )
-			{
-				amount = v2;
-				goto LABEL_667;
-			}
-			v341 = 6 * v2;
-			}
-			else
-			{
-			v341 = 4 * v2;
-			}
-		}
-		else
-		{
-			v341 = 2 * v2;
-		}
-		amount = v341;
-LABEL_667:
+		if ( v731 == 1 )
+			amount = v2;
+		else if( v731 == 2 )
+			amount = 2 * v2;
+		else if( v731 == 3 )
+			amount = 4 * v2;
+		else if( v731 == 4)
+			amount = 6 * v2;
+//LABEL_667:
 		if ( !pPlayer->CanCastSpell(uRequiredMana) )
 			break;
 		v342 = pCastSpell->spell_target_pid;
@@ -5616,7 +5652,7 @@
 			BYTE2(pActors[v343].uAttributes) |= 8u;
 			v672 = 0;
 			v661 = &pActors[v343];
-LABEL_165:
+//LABEL_165:
 			pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, v672);
 		}
 		LODWORD(v727) = 1;
@@ -5624,26 +5660,13 @@
 			}
 		case SPELL_SPIRIT_REMOVE_CURSE:
 			{
-		v348 = v731 - 2;
-		if ( !v348 )
-			goto LABEL_677;
-		v349 = v348 - 1;
-		if ( v349 )
-		{
-			if ( v349 == 1 )
-			{
+		if ( v731 == 1 || v731 == 2 )
+			amount = 3600 * v2;
+		else if( v731 == 3)
+			amount = 86400 * v2;
+		else if ( v731 == 4 )
 			amount = 0;
-			goto LABEL_679;
-			}
-LABEL_677:
-			v350 = 3600 * v2;
-		}
-		else
-		{
-			v350 = 86400 * v2;
-		}
-		amount = v350;
-LABEL_679:
+//LABEL_679:
 		if ( !pPlayer->CanCastSpell(uRequiredMana) )
 			break;
 		v351 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
@@ -5786,7 +5809,9 @@
 			(signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
 		}
 		v377 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
-		goto LABEL_720;
+		v377->SetCondition(1, 0);
+		LODWORD(v727) = 1;
+		break;
 			}
 		case SPELL_SPIRIT_SHARED_LIFE:
 			{
@@ -5847,29 +5872,15 @@
 		case SPELL_SPIRIT_RESSURECTION:
 			{
 		v392 = v731 - 1;
-		if ( !v392 )
-		{
-			v395 = 180 * v2;
-			amount = v395;
-			goto LABEL_751;
-		}
-		v393 = v392 - 1;
-		if ( !v393 )
-		{
-			v395 = 10800 * v2;
-			amount = v395;
-			goto LABEL_751;
-		}
-		v394 = v393 - 1;
-		if ( !v394 )
-		{
-			v395 = 259200 * v2;
-			amount = v395;
-			goto LABEL_751;
-		}
-		if ( v394 == 1 )
+		if ( v731 == 1 )
+			amount = 180 * v2;
+		else if ( v731 == 2 )
+			amount = 10800 * v2;
+		else if ( v731 == 3 )
+			amount = 259200 * v2;
+		else if ( v731 == 4 )
 			amount = 0;
-LABEL_751:
+//LABEL_751:
 		if ( !pPlayer->CanCastSpell(uRequiredMana) )
 			break;
 		v396 = pCastSpell->uPlayerID_2;
@@ -5911,26 +5922,13 @@
 			}
 		case SPELL_MIND_CURE_PARALYSIS:
 			{
-		v405 = v731 - 2;
-		if ( !v405 )
-			goto LABEL_766;
-		v406 = v405 - 1;
-		if ( v406 )
-		{
-			if ( v406 == 1 )
-			{
+		if ( v731 == 1 || v731 == 2 )
+			amount = 3600 * v2;
+		else if ( v731 == 4 )
 			amount = 0;
-			goto LABEL_768;
-			}
-LABEL_766:
-			v407 = 3600 * v2;
-		}
-		else
-		{
-			v407 = 86400 * v2;
-		}
-		amount = v407;
-LABEL_768:
+		else if( v731 == 3 )
+			amount = 86400 * v2;
+//LABEL_768:
 		if ( !pPlayer->CanCastSpell(uRequiredMana) )
 			break;
 
@@ -5952,35 +5950,21 @@
 		v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335);
 		v656 = 12;
 		v325 = &pParty->pPlayers[v323];
-		goto LABEL_641;
-
+		v325->DiscardConditionIfLastsLongerThan(v656, v663);
+		LODWORD(v727) = 1;
+		break;
 			}
 		case SPELL_MIND_REMOVE_FEAR:
-			{
-		v411 = v731 - 2;
-		if ( v411 )
-		{
-			v412 = v411 - 1;
-			if ( v412 )
-			{
-			if ( v412 == 1 )
-			{
+		{
+			if( v731 == 1)
+				amount = 180 * v2;
+			else if( v731 == 2 )
+				amount = 3600 * v2;
+			else if( v731 == 3)
+				amount = 86400 * v2;
+			else if( v731 == 4 )
 				amount = 0;
-				goto LABEL_780;
-			}
-			v413 = 180 * v2;
-			}
-			else
-			{
-			v413 = 86400 * v2;
-			}
-		}
-		else
-		{
-			v413 = 3600 * v2;
-		}
-		amount = v413;
-LABEL_780:
+//LABEL_780:
 		if ( !pPlayer->CanCastSpell(uRequiredMana) )
 			break;
 
@@ -6002,196 +5986,267 @@
 		v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335);
 		v656 = 3;
 		v325 = &pParty->pPlayers[v323];
-		goto LABEL_641;
-			}
+		v325->DiscardConditionIfLastsLongerThan(v656, v663);
+		LODWORD(v727) = 1;
+		break;
+		}
 		case SPELL_MIND_TELEPATHY:
-			{
-		if ( !pPlayer->CanCastSpell(uRequiredMana) )
-			break;
-		if (PID_TYPE(a2) != OBJECT_Actor)
-		{
+		{
+			if ( !pPlayer->CanCastSpell(uRequiredMana) )
+				break;
+			if (PID_TYPE(a2) != OBJECT_Actor)
+			{
+				LODWORD(v727) = 1;
+				break;
+			}
+			v417 = (int)&pActors[PID_ID(a2)];
+			v730 = v417;
+			if ( !(*(char *)(v417 + 38) & 0x80) )
+			{
+				((Actor *)v417)->SetRandomGoldIfTheresNoItem();
+				v417 = v730;
+			}
+			v418 = *(int *)(v417 + 672);
+			HIDWORD(v733) = 0;
+			if ( pItemsTable->pItems[v418].uEquipType == 18 )
+				HIDWORD(v733) = *(int *)(v417 + 684);
+
+			//ItemGen::ItemGen(&v683);
+			v683.Reset();
+
+			v419 = *(short *)(v730 + 180);
+			if (v419)
+			{
+				v683.uItemID = v419;
+				//goto LABEL_799;
+			}
+			else
+			{
+				v420 = 0;
+				v421 = v730 + 564;
+				while ( !*(int *)v421 || pItemsTable->pItems[*(int *)v421].uEquipType == 18 )
+				{
+					++v420;
+					v421 += 36;
+					if ( v420 >= 4 )
+						break;
+				}
+				if ( v420 < 4 )
+				{
+				memcpy(&v683, (const void *)(v730 + 36 * v420 + 564), sizeof(v683));
+				v2 = v723;
+				//v1 = 0;
+				}
+			}
+//	LABEL_799:
+			if ( HIDWORD(v733) != 0 )
+			{
+				v675 = (const char *)HIDWORD(v733);
+				if (v683.uItemID)
+				{
+					v422 = v683.GetDisplayName();
+					sprintf(pTmpBuf2, "(%s), and %d gold", v422, v675);
+					ShowStatusBarString(pTmpBuf2, 2u);
+					pSpellSprite.stru_24.Reset();
+					pSpellSprite.spell_id = pCastSpell->spellnum;
+					pSpellSprite.spell_level = v2;
+					pSpellSprite.spell_skill = v731;
+					pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
+					pSpellSprite.vPosition.x = *(short *)(v730 + 142);
+					pSpellSprite.vPosition.y = *(short *)(v730 + 144);
+					v676 = *(short *)(v730 + 138);
+					v665 = pSpellSprite.vPosition.y;
+					pSpellSprite.vPosition.z = *(short *)(v730 + 138);
+					v657 = pSpellSprite.vPosition.x;
+				}
+				else
+				{
+					v664 = "%d gold";
+					sprintf(pTmpBuf2, v664, v675);
+					ShowStatusBarString(pTmpBuf2, 2u);
+					pSpellSprite.stru_24.Reset();
+					pSpellSprite.spell_id = pCastSpell->spellnum;
+					pSpellSprite.spell_level = v2;
+					pSpellSprite.spell_skill = v731;
+					pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
+					pSpellSprite.vPosition.x = *(short *)(v730 + 142);
+					pSpellSprite.vPosition.y = *(short *)(v730 + 144);
+					v676 = *(short *)(v730 + 138);
+					v665 = pSpellSprite.vPosition.y;
+					pSpellSprite.vPosition.z = *(short *)(v730 + 138);
+					v657 = pSpellSprite.vPosition.x;
+				}
+			}
+			else
+			{
+				if (v683.uItemID)
+				{
+					v675 = v683.GetDisplayName();
+					v664 = "(%s)";
+					sprintf(pTmpBuf2, v664, v675);
+					ShowStatusBarString(pTmpBuf2, 2u);
+					pSpellSprite.stru_24.Reset();
+					pSpellSprite.spell_id = pCastSpell->spellnum;
+					pSpellSprite.spell_level = v2;
+					pSpellSprite.spell_skill = v731;
+					pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
+					pSpellSprite.vPosition.x = *(short *)(v730 + 142);
+					pSpellSprite.vPosition.y = *(short *)(v730 + 144);
+					v676 = *(short *)(v730 + 138);
+					v665 = pSpellSprite.vPosition.y;
+					pSpellSprite.vPosition.z = *(short *)(v730 + 138);
+					v657 = pSpellSprite.vPosition.x;
+				}
+				else
+				{
+					strcpy(pTmpBuf2, "nothing");
+					ShowStatusBarString(pTmpBuf2, 2u);
+					pSpellSprite.stru_24.Reset();
+					pSpellSprite.spell_id = pCastSpell->spellnum;
+					pSpellSprite.spell_level = v2;
+					pSpellSprite.spell_skill = v731;
+					pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
+					pSpellSprite.vPosition.x = *(short *)(v730 + 142);
+					pSpellSprite.vPosition.y = *(short *)(v730 + 144);
+					v676 = *(short *)(v730 + 138);
+					v665 = pSpellSprite.vPosition.y;
+					pSpellSprite.vPosition.z = *(short *)(v730 + 138);
+					v657 = pSpellSprite.vPosition.x;
+				}
+			}
+			pSpellSprite.uAttributes = 0;
+			pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676);
+			pSpellSprite.uSpriteFrameID = 0;
+			pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
+			pSpellSprite.spell_target_pid = a2;
+			pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
+			pSpellSprite.uFacing = LOWORD(v715.uYawAngle);
+			LOBYTE(pSpellSprite.uAttributes) |= 0x80u;
+			pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
+			pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1);
 			LODWORD(v727) = 1;
 			break;
 		}
-		v417 = (int)&pActors[PID_ID(a2)];
-		v730 = v417;
-		if ( !(*(char *)(v417 + 38) & 0x80) )
-		{
-			((Actor *)v417)->SetRandomGoldIfTheresNoItem();
-			v417 = v730;
-		}
-		v418 = *(int *)(v417 + 672);
-		HIDWORD(v733) = 0;
-		if ( pItemsTable->pItems[v418].uEquipType == 18 )
-			HIDWORD(v733) = *(int *)(v417 + 684);
-
-		//ItemGen::ItemGen(&v683);
-		v683.Reset();
-
-		v419 = *(short *)(v730 + 180);
-		if (v419)
-		{
-			v683.uItemID = v419;
-			goto LABEL_799;
-		}
-		v420 = 0;
-		v421 = v730 + 564;
-		while ( !*(int *)v421 || pItemsTable->pItems[*(int *)v421].uEquipType == 18 )
-		{
-			++v420;
-			v421 += 36;
-			if ( v420 >= 4 )
-			goto LABEL_799;
-		}
-		memcpy(&v683, (const void *)(v730 + 36 * v420 + 564), sizeof(v683));
-		v2 = v723;
-		//v1 = 0;
-LABEL_799:
-		if ( HIDWORD(v733) != 0 )
-		{
-			v675 = (const char *)HIDWORD(v733);
-			if (v683.uItemID)
-			{
-			v422 = v683.GetDisplayName();
-			sprintf(pTmpBuf2, "(%s), and %d gold", v422, v675);
-			ShowStatusBarString(pTmpBuf2, 2u);
-			pSpellSprite.stru_24.Reset();
-			pSpellSprite.spell_id = pCastSpell->spellnum;
-			pSpellSprite.spell_level = v2;
-			pSpellSprite.spell_skill = v731;
-			pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
-			pSpellSprite.vPosition.x = *(short *)(v730 + 142);
-			pSpellSprite.vPosition.y = *(short *)(v730 + 144);
-			v676 = *(short *)(v730 + 138);
-			v665 = pSpellSprite.vPosition.y;
-			pSpellSprite.vPosition.z = *(short *)(v730 + 138);
-			v657 = pSpellSprite.vPosition.x;
-			goto LABEL_1087;
-			}
-			v664 = "%d gold";
-			sprintf(pTmpBuf2, v664, v675);
-			ShowStatusBarString(pTmpBuf2, 2u);
-			pSpellSprite.stru_24.Reset();
-			pSpellSprite.spell_id = pCastSpell->spellnum;
-			pSpellSprite.spell_level = v2;
-			pSpellSprite.spell_skill = v731;
-			pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
-			pSpellSprite.vPosition.x = *(short *)(v730 + 142);
-			pSpellSprite.vPosition.y = *(short *)(v730 + 144);
-			v676 = *(short *)(v730 + 138);
-			v665 = pSpellSprite.vPosition.y;
-			pSpellSprite.vPosition.z = *(short *)(v730 + 138);
-			v657 = pSpellSprite.vPosition.x;
-			goto LABEL_1087;
-		}
-		if (v683.uItemID)
-		{
-			v675 = v683.GetDisplayName();
-			v664 = "(%s)";
-			sprintf(pTmpBuf2, v664, v675);
-			ShowStatusBarString(pTmpBuf2, 2u);
+		case SPELL_MIND_BERSERK:
+		{
+			v423 = v731 - 2;
+			if ( !v423 )
+				v425 = 300 * v2;
+			else
+			{
+				v424 = v423 - 1;
+				if ( v424 )
+				{
+					if ( v424 == 1 )
+						v425 = 3600 * v2;
+					else
+//LABEL_813:
+						v425 = 300 * v2;
+				}
+				else
+				{
+					v425 = 600 * v2;
+				}
+			}
+			amount = v425;
+			if ( !pPlayer->CanCastSpell(uRequiredMana) )
+				break;
+			v426 = PID_ID(a2);
+			if (PID_TYPE(a2) != OBJECT_Actor)
+			{
+				LODWORD(v727) = 1;
+				break;
+			}
+			v730 = 836 * v426;
+			if ( stru_50C198.GetMagicalResistance(&pActors[v426], 7u) )
+			{
+				pActors[v426].pActorBuffs[1].Reset();
+				pActors[v426].pActorBuffs[12].Reset();
+				pActors[v426].pActorBuffs[9].Apply(
+				pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335),
+				v731, 0, 0, 0);
+				pActors[v426].pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long;
+			}
 			pSpellSprite.stru_24.Reset();
 			pSpellSprite.spell_id = pCastSpell->spellnum;
 			pSpellSprite.spell_level = v2;
 			pSpellSprite.spell_skill = v731;
-			pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
-			pSpellSprite.vPosition.x = *(short *)(v730 + 142);
-			pSpellSprite.vPosition.y = *(short *)(v730 + 144);
-			v676 = *(short *)(v730 + 138);
-			v665 = pSpellSprite.vPosition.y;
-			pSpellSprite.vPosition.z = *(short *)(v730 + 138);
-			v657 = pSpellSprite.vPosition.x;
-			goto LABEL_1087;
-		}
-		strcpy(pTmpBuf2, "nothing");
-		ShowStatusBarString(pTmpBuf2, 2u);
-		pSpellSprite.stru_24.Reset();
-		pSpellSprite.spell_id = pCastSpell->spellnum;
-		pSpellSprite.spell_level = v2;
-		pSpellSprite.spell_skill = v731;
-		pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
-		pSpellSprite.vPosition.x = *(short *)(v730 + 142);
-		pSpellSprite.vPosition.y = *(short *)(v730 + 144);
-		v676 = *(short *)(v730 + 138);
-		v665 = pSpellSprite.vPosition.y;
-		pSpellSprite.vPosition.z = *(short *)(v730 + 138);
-		v657 = pSpellSprite.vPosition.x;
-		goto LABEL_1087;
-			}
-		case SPELL_MIND_BERSERK:
-			{
-		v423 = v731 - 2;
-		if ( !v423 )
-			goto LABEL_813;
-		v424 = v423 - 1;
-		if ( v424 )
-		{
-			if ( v424 == 1 )
-			v425 = 3600 * v2;
-			else
-LABEL_813:
-			v425 = 300 * v2;
-		}
-		else
-		{
-			v425 = 600 * v2;
-		}
-		amount = v425;
-		if ( !pPlayer->CanCastSpell(uRequiredMana) )
-			break;
-		v426 = PID_ID(a2);
-		if (PID_TYPE(a2) != OBJECT_Actor)
-		{
+			v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
+			v61 = v426;
+			v600 = pActors[v61].vPosition.y;
+			v601 = pActors[v61].vPosition.x;
+			pSpellSprite.uObjectDescID = v60;
+			pSpellSprite.vPosition.x = v601;
+			v602 = pActors[v61].uActorHeight;
+			v603 = pActors[v61].vPosition.z;
+			pSpellSprite.vPosition.y = v600;
+			v676 = v603 + v602;
+			v665 = v600;
+			pSpellSprite.vPosition.z = v603 + v602;
+			v657 = v601;
+			pSpellSprite.uAttributes = 0;
+			pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676);
+			pSpellSprite.uSpriteFrameID = 0;
+			pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
+			pSpellSprite.spell_target_pid = a2;
+			pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
+			pSpellSprite.uFacing = LOWORD(v715.uYawAngle);
+			LOBYTE(pSpellSprite.uAttributes) |= 0x80u;
+			pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
+			pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1);
 			LODWORD(v727) = 1;
 			break;
 		}
-		v730 = 836 * v426;
-		if ( stru_50C198.GetMagicalResistance(&pActors[v426], 7u) )
-		{
-			pActors[v426].pActorBuffs[1].Reset();
-			pActors[v426].pActorBuffs[12].Reset();
-			pActors[v426].pActorBuffs[9].Apply(
-			pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335),
-			v731, 0, 0, 0);
-			pActors[v426].pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long;
-		}
-		pSpellSprite.stru_24.Reset();
-		pSpellSprite.spell_id = pCastSpell->spellnum;
-		pSpellSprite.spell_level = v2;
-		pSpellSprite.spell_skill = v731;
-		v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
-		v61 = v426;
-		goto LABEL_1086;
-
-			}
 		case SPELL_MIND_ENSLAVE:
-			{
-		if ( !pPlayer->CanCastSpell(uRequiredMana) )
-			break;
-		amount = 600 * v2;
-		if (PID_TYPE(a2) != OBJECT_Actor)
-		{
+		{
+			if ( !pPlayer->CanCastSpell(uRequiredMana) )
+				break;
+			amount = 600 * v2;
+			if (PID_TYPE(a2) != OBJECT_Actor)
+			{
+				LODWORD(v727) = 1;
+				break;
+			}
+			v730 = 836 * PID_ID(a2);
+			if ( MonsterStats::BelongsToSupertype(pActors[PID_ID(a2)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) )
+				break;
+			if ( stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 7u) )
+			{
+				pActors[PID_ID(a2)].pActorBuffs[9].Reset();
+				pActors[PID_ID(a2)].pActorBuffs[1].Reset();
+				pActors[PID_ID(a2)].pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335),
+				v731, 0, 0, 0);
+			}
+			pSpellSprite.stru_24.Reset();
+			pSpellSprite.spell_id = pCastSpell->spellnum;
+			pSpellSprite.spell_level = v2;
+			pSpellSprite.spell_skill = v731;
+			v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
+			v61 = PID_ID(a2);
+			v600 = pActors[v61].vPosition.y;
+			v601 = pActors[v61].vPosition.x;
+			pSpellSprite.uObjectDescID = v60;
+			pSpellSprite.vPosition.x = v601;
+			v602 = pActors[v61].uActorHeight;
+			v603 = pActors[v61].vPosition.z;
+			pSpellSprite.vPosition.y = v600;
+			v676 = v603 + v602;
+			v665 = v600;
+			pSpellSprite.vPosition.z = v603 + v602;
+			v657 = v601;
+			pSpellSprite.uAttributes = 0;
+			pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676);
+			pSpellSprite.uSpriteFrameID = 0;
+			pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
+			pSpellSprite.spell_target_pid = a2;
+			pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
+			pSpellSprite.uFacing = LOWORD(v715.uYawAngle);
+			LOBYTE(pSpellSprite.uAttributes) |= 0x80u;
+			pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
+			pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1);
 			LODWORD(v727) = 1;
 			break;
 		}
-		v730 = 836 * PID_ID(a2);
-		if ( MonsterStats::BelongsToSupertype(pActors[PID_ID(a2)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) )
-			break;
-		if ( stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 7u) )
-		{
-			pActors[PID_ID(a2)].pActorBuffs[9].Reset();
-			pActors[PID_ID(a2)].pActorBuffs[1].Reset();
-			pActors[PID_ID(a2)].pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335),
-			v731, 0, 0, 0);
-		}
-		pSpellSprite.stru_24.Reset();
-		pSpellSprite.spell_id = pCastSpell->spellnum;
-		pSpellSprite.spell_level = v2;
-		pSpellSprite.spell_skill = v731;
-		v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
-		v61 = PID_ID(a2);
-		goto LABEL_1086;
-			}
 		case SPELL_MIND_MASS_FEAR:
 		{
 		v428 = v731 - 2;
@@ -6266,7 +6321,7 @@
 				(signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335));
 			}
 			v377 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
-LABEL_720:
+//LABEL_720:
 			v377->SetCondition(1, 0);
 		}
 		LODWORD(v727) = 1;
@@ -6274,23 +6329,12 @@
 			}
 		case SPELL_EARTH_TELEKINESIS:
 			{
-		v442 = v731 - 2;
-		if ( !v442 )
-			goto LABEL_855;
-		v443 = v442 - 1;
-		if ( v443 )
-		{
-			if ( v443 == 1 )
-			v444 = 4 * v2;
-			else
-LABEL_855:
-			v444 = 2 * v2;
-		}
-		else
-		{
-			v444 = 3 * v2;
-		}
-		amount = v444;
+		if ( v731 == 1 || v731 == 2 )
+			amount = 2 * v2;
+		else if( v731 == 3 )
+			amount = 3 * v2;
+		else if ( v731 == 4 )
+			amount = 4 * v2;
 		if ( !pPlayer->CanCastSpell(uRequiredMana) )
 			break;
 		v445 = PID_ID(a2);
@@ -6362,30 +6406,15 @@
 			}
 		case SPELL_BODY_CURE_WEAKNESS:
 			{
-		v451 = v731 - 2;
-		if ( v451 )
-		{
-			v452 = v451 - 1;
-			if ( v452 )
-			{
-			if ( v452 == 1 )
-			{
-				amount = 0;
-				goto LABEL_883;
-			}
-			v453 = 180 * v2;
-			}
-			else
-			{
-			v453 = 86400 * v2;
-			}
-		}
-		else
-		{
-			v453 = 3600 * v2;
-		}
-		amount = v453;
-LABEL_883:
+		if ( v731 == 1 )
+			amount = 180 * v2;
+		else if( v731 == 2 )
+			amount = 3600 * v2;
+		else if( v731 == 3 )
+			amount = 86400 * v2;
+		else if ( v731 == 4 )
+			amount = 0;
+//LABEL_883:
 		if ( !pPlayer->CanCastSpell(uRequiredMana) )
 			break;
 
@@ -6407,8 +6436,10 @@
 		v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335);
 		v656 = 1;
 		v325 = &pParty->pPlayers[v323];
-		goto LABEL_641;
-			}
+		v325->DiscardConditionIfLastsLongerThan(v656, v663);
+		LODWORD(v727) = 1;
+		break;
+		}
 		case SPELL_BODY_FIRST_AID:
 			{
 		v457 = v731 - 2;
@@ -6469,26 +6500,13 @@
 			}
 		case SPELL_BODY_CURE_POISON:
 			{
-		v464 = v731 - 2;
-		if ( !v464 )
-			goto LABEL_910;
-		v465 = v464 - 1;
-		if ( v465 )
-		{
-			if ( v465 == 1 )
-			{
+		if ( v731 == 1 || v731 == 2 )
+			amount = 3600 * v2;
+		else if( v731 == 3)
+			amount = 86400 * v2;
+		else if ( v731 == 4 )
 			amount = 0;
-			goto LABEL_912;
-			}
-LABEL_910:
-			v466 = 3600 * v2;
-		}
-		else
-		{
-			v466 = 86400 * v2;
-		}
-		amount = v466;
-LABEL_912:
+//LABEL_912:
 		if ( !pPlayer->CanCastSpell(uRequiredMana) )
 			break;
 
@@ -6523,9 +6541,11 @@
 			(signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
 		v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2);
 		v656 = 10;
-		goto LABEL_937;
-
-			}
+		v325 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
+		v325->DiscardConditionIfLastsLongerThan(v656, v663);
+		LODWORD(v727) = 1;
+		break;
+		}
 		case SPELL_BODY_PROTECTION_FROM_MAGIC:
 			{
 		amount = v2;
@@ -6611,9 +6631,9 @@
 			(signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
 			v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2);
 			v656 = 11;
-LABEL_937:
+//LABEL_937:
 			v325 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
-LABEL_641:
+//LABEL_641:
 			v325->DiscardConditionIfLastsLongerThan(v656, v663);
 		}
 			LODWORD(v727) = 1;
@@ -6700,28 +6720,21 @@
 		case SPELL_LIGHT_SUMMON_ELEMENTAL:
 			{
 		v514 = v731 - 2;
-		if ( !v514 )
-			goto LABEL_955;
-		v515 = v514 - 1;
-		if ( v515 )
-		{
-			if ( v515 == 1 )
+		if ( v731 == 1 || v731 == 2 )
+		{
+			v516 = 300 * v2;
+			amount = 1;
+		}
+		else if( v731 == 3 )
+		{
+			v516 = 900 * v2;
+			amount = 3;
+		}
+		else if ( v731 == 4 )
 			{
 			v516 = 900 * v2;
 			amount = 5;
 			}
-			else
-			{
-LABEL_955:
-			v516 = 300 * v2;
-			amount = 1;
-			}
-		}
-		else
-		{
-			v516 = 900 * v2;
-			amount = 3;
-		}
 		v733 = __PAIR__(0, v516);
 
 		if ( (signed int)uNumActors > 0 )
@@ -6753,30 +6766,21 @@
 			}
 		case SPELL_LIGHT_DAY_OF_THE_GODS:
 			{
-		v520 = v731 - 2;
-		if ( !v520 )
-			goto LABEL_973;
-		v521 = v520 - 1;
-		if ( v521 )
-		{
-			if ( v521 == 1 )
-			{
-			LODWORD(v733) = 18000 * v2;
-			v522 = 5 * v2 + 10;
-			}
-			else
-			{
-LABEL_973:
+		if ( v731 == 1 || v731 == 2 )
+		{
 			LODWORD(v733) = 10800 * v2;
-			v522 = 3 * v2 + 10;
-			}
-		}
-		else
+			amount = 3 * v2 + 10;
+		}
+		else if( v731 == 3 )
 		{
 			LODWORD(v733) = 14400 * v2;
-			v522 = 4 * v2 + 10;
-		}
-		amount = v522;
+			amount = 4 * v2 + 10;
+		}
+		else if ( v731 == 4 )
+		{
+			LODWORD(v733) = 18000 * v2;
+			amount = 5 * v2 + 10;
+		}
 		if ( !pPlayer->CanCastSpell(uRequiredMana) )
 			break;
 
@@ -6887,27 +6891,22 @@
 		case SPELL_LIGHT_HOUR_OF_POWER:
 		{
 		v551 = v731 - 2;
-		if ( !v551 )
-			goto LABEL_998;
-		v552 = v551 - 1;
-		if ( v552 )
-		{
-			if ( v552 == 1 )
-			{
+		if ( v731 == 1 || v731 == 2 )
+		{
+			HIDWORD(v733) = 4;
+			amount = 4;
+		}
+		else if( v731 == 3 )
+		{
+			HIDWORD(v733) = 12;
+			amount = 12;
+		}
+		else if( v731 == 4 )
+		{
 			amount = 15;
 			HIDWORD(v733) = 20;
-			goto LABEL_1000;
-			}
-LABEL_998:
-			v678 = 4;
-		}
-		else
-		{
-			v678 = 12;
-		}
-		amount = v678;
-		HIDWORD(v733) = v678;
-LABEL_1000:
+		}
+//LABEL_1000:
 		if ( !pPlayer->CanCastSpell(uRequiredMana) )
 			break;
 		y = (char *)(60 * (v2 * HIDWORD(v733) + 60));
@@ -7138,21 +7137,12 @@
 		case SPELL_DARK_SHARPMETAL:
 		{
 		v593 = v731 - 2;
-		if ( !v593 )
-			goto LABEL_1062;
-		v594 = v593 - 1;
-		if ( v594 )
-		{
-			if ( v594 == 1 )
+		if( v731 == 1 || v731 == 2 )
+			amount = 5;
+		else if( v731 == 3 )
+			amount = 7;
+		else if( v731 == 4 )
 			amount = 9;
-			else
-LABEL_1062:
-			amount = 5;
-		}
-		else
-		{
-			amount = 7;
-		}
 		if ( !pPlayer->CanCastSpell(uRequiredMana) )
 			break;
 		auto _v726 = ((signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360);
@@ -7200,320 +7190,316 @@
 		}
 
 		case SPELL_DARK_CONTROL_UNDEAD:
-			{
-		if ( !pPlayer->CanCastSpell(uRequiredMana) )
-			break;
-		if ( v731 == 1 || v731 == 2 )
-		{
-			v598 = 180 * v2;
-			LODWORD(v733) = v598;
-			goto LABEL_1082;
-		}
-		if ( v731 == 3 )
-		{
-			v598 = 300 * v2;
-			LODWORD(v733) = v598;
-			goto LABEL_1082;
-		}
-		if ( v731 == 4 )
-			LODWORD(v733) = 29030400;
-LABEL_1082:
-		if (PID_TYPE(a2) != OBJECT_Actor)
-		{
+		{
+			if ( !pPlayer->CanCastSpell(uRequiredMana) )
+				break;
+			if ( v731 == 1 || v731 == 2 )
+			{
+				v598 = 180 * v2;
+				LODWORD(v733) = v598;
+			}
+			else if ( v731 == 3 )
+			{
+				v598 = 300 * v2;
+				LODWORD(v733) = v598;
+			}
+			else if ( v731 == 4 )
+				LODWORD(v733) = 29030400;
+//	LABEL_1082:
+			if (PID_TYPE(a2) != OBJECT_Actor)
+			{
+				LODWORD(v727) = 1;
+				break;
+			}
+			v730 = 836 * PID_ID(a2);
+			if ( !MonsterStats::BelongsToSupertype(pActors[PID_ID(a2)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) )
+				break;
+			if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 0xAu) )
+			{
+				ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
+				pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+				pCastSpell->spellnum = 0;
+				continue;
+			}
+			pActors[PID_ID(a2)].pActorBuffs[9].Reset();
+			pActors[PID_ID(a2)].pActorBuffs[1].Reset();
+			pActors[PID_ID(a2)].pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335),
+				v731, 0, 0, 0);
+			pSpellSprite.stru_24.Reset();
+			pSpellSprite.spell_id = pCastSpell->spellnum;
+			pSpellSprite.spell_level = v2;
+			pSpellSprite.spell_skill = v731;
+			v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
+			v61 = PID_ID(a2);
+//	LABEL_1086:
+			v600 = pActors[v61].vPosition.y;
+			v601 = pActors[v61].vPosition.x;
+			pSpellSprite.uObjectDescID = v60;
+			pSpellSprite.vPosition.x = v601;
+			v602 = pActors[v61].uActorHeight;
+			v603 = pActors[v61].vPosition.z;
+			pSpellSprite.vPosition.y = v600;
+			v676 = v603 + v602;
+			v665 = v600;
+			pSpellSprite.vPosition.z = v603 + v602;
+			v657 = v601;
+//	LABEL_1087:
+			pSpellSprite.uAttributes = 0;
+			pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676);
+			pSpellSprite.uSpriteFrameID = 0;
+			pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
+			pSpellSprite.spell_target_pid = a2;
+			pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
+			pSpellSprite.uFacing = LOWORD(v715.uYawAngle);
+			LOBYTE(pSpellSprite.uAttributes) |= 0x80u;
+			pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
+			pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1);
 			LODWORD(v727) = 1;
 			break;
 		}
-		v730 = 836 * PID_ID(a2);
-		if ( !MonsterStats::BelongsToSupertype(pActors[PID_ID(a2)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) )
-			break;
-		if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 0xAu) )
-		{
-			ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
-			pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
-			pCastSpell->spellnum = 0;
-			continue;
-		}
-		pActors[PID_ID(a2)].pActorBuffs[9].Reset();
-		pActors[PID_ID(a2)].pActorBuffs[1].Reset();
-		pActors[PID_ID(a2)].pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335),
-			v731, 0, 0, 0);
-		pSpellSprite.stru_24.Reset();
-		pSpellSprite.spell_id = pCastSpell->spellnum;
-		pSpellSprite.spell_level = v2;
-		pSpellSprite.spell_skill = v731;
-		v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
-		v61 = PID_ID(a2);
-LABEL_1086:
-		v600 = pActors[v61].vPosition.y;
-		v601 = pActors[v61].vPosition.x;
-		pSpellSprite.uObjectDescID = v60;
-		pSpellSprite.vPosition.x = v601;
-		v602 = pActors[v61].uActorHeight;
-		v603 = pActors[v61].vPosition.z;
-		pSpellSprite.vPosition.y = v600;
-		v676 = v603 + v602;
-		v665 = v600;
-		pSpellSprite.vPosition.z = v603 + v602;
-		v657 = v601;
-LABEL_1087:
-		pSpellSprite.uAttributes = 0;
-		pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676);
-		pSpellSprite.uSpriteFrameID = 0;
-		pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
-		pSpellSprite.spell_target_pid = a2;
-		pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
-		pSpellSprite.uFacing = LOWORD(v715.uYawAngle);
-		LOBYTE(pSpellSprite.uAttributes) |= 0x80u;
-		pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
-		pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1);
-		LODWORD(v727) = 1;
-		break;
-		}
 		case SPELL_DARK_SACRIFICE:
-			{
-		if ( !pPlayer->CanCastSpell(uRequiredMana) )
-			break;
-		HIDWORD(v733) = 0;
-		memset(&achieved_awards, 0, 4000);
-		_this = 0;
-		v605 = (char *)pParty->pHirelings;
-		do
-		{
-			if ( *(int *)v605)
-			{
-			v606 = HIDWORD(v733)++;
-			achieved_awards[v606] = (AwardType)(int)((char *)&_this->uItemID + 1);
-			}
-			_this = (ItemGen *)((char *)_this + 1);
-			v605 += 76;
-		}
-		while ( (signed int)v605 < (signed int)&pParty->pPickedItem );
-		_this = 0;
-		if ( (signed int)pNPCStats->uNumNewNPCs > 0)
-		{
-			v730 = (int)pNPCStats->pNewNPCData;
-            __debugbreak(); // data offset
-			HIDWORD(v733) = 4 * HIDWORD(v733) + 6043152;
+		{
+			if ( !pPlayer->CanCastSpell(uRequiredMana) )
+				break;
+			HIDWORD(v733) = 0;
+			memset(&achieved_awards, 0, 4000);
+			_this = 0;
+			v605 = (char *)pParty->pHirelings;
 			do
 			{
-			if ( *(char *)(v730 + 8) & 0x80
-				&& (!pParty->pHirelings[0].pName || strcmp(*(const char **)v730, pParty->pHirelings[0].pName))
-				&& (!pParty->pHirelings[1].pName || strcmp(*(const char **)v730, pParty->pHirelings[1].pName)) )
-			{
-				v607 = HIDWORD(v733);
-				HIDWORD(v733) += 4;
-				*(int *)v607 = (int)_this + 3;
-			}
-			_this = (ItemGen *)((char *)_this + 1);
-			v730 += 76;
-			}
-			while ( (signed int)this < (signed int)pNPCStats->uNumNewNPCs );
-		}
-		v608 = pCastSpell->uPlayerID_2;
-		if ( v608 != 4 && v608 != 5
-			|| (v609 = (signed int)*(&pFontCChar + v608 + (unsigned __int8)pParty->field_709), v609 <= 0)
-			|| v609 >= 3 )
-		{
-			ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
-			pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
-			pCastSpell->spellnum = 0;
-			continue;
-		}
-		v610 = 76 * v609;
-		*((int *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + 19 * v609) = 0;
-		v611 = pIconsFrameTable->FindIcon("spell96");
-		*(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + v610 + 4) = pIconsFrameTable->GetIconAnimLength(v611);
-		*(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[3].field_18 + v610) = 1;
-		v612 = pParty->pPlayers;
-		do
-		{
-			v612->sHealth = v612->GetMaxHealth();
-			v612->sMana = v612->GetMaxMana();
-			++v612;
-		}
-		while ( v612 <= &pParty->pPlayers[3] );
-		v613 = &pOutdoor->ddm;
-		if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor)
-			v613 = &pIndoor->dlv;
-		v613->uReputation += 15;
-		if ( v613->uReputation > 10000 )
-			v613->uReputation = 10000;
-		LODWORD(v727) = 1;
-		break;
-			}
-		case SPELL_DARK_PAIN_REFLECTION:
-			{
-		if ( v731 <= 0 )
-			goto LABEL_1119;
-		if ( v731 <= 3 )
-		{
-			v614 = 300 * (v2 + 12);
-		}
-		else
-		{
-			if ( v731 != 4 )
-			goto LABEL_1119;
-			v614 = 900 * (v2 + 4);
-		}
-		LODWORD(v733) = v614;
-LABEL_1119:
-		v615 = v2 + 5;
-		amount = v615;
-		if ( !pPlayer->CanCastSpell(uRequiredMana) )
-			break;
-		if ( v731 != 3 && v731 != 4 )
-		{
-			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
-
-			pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v615, v716, 0);
+				if ( *(int *)v605)
+				{
+					v606 = HIDWORD(v733)++;
+					achieved_awards[v606] = (AwardType)(int)((char *)&_this->uItemID + 1);
+				}
+				_this = (ItemGen *)((char *)_this + 1);
+				v605 += 76;
+			}
+			while ( (signed int)v605 < (signed int)&pParty->pPickedItem );
+			_this = 0;
+			if ( (signed int)pNPCStats->uNumNewNPCs > 0)
+			{
+				v730 = (int)pNPCStats->pNewNPCData;
+				__debugbreak(); // data offset
+				HIDWORD(v733) = 4 * HIDWORD(v733) + 6043152;
+				do
+				{
+					if ( *(char *)(v730 + 8) & 0x80
+						&& (!pParty->pHirelings[0].pName || strcmp(*(const char **)v730, pParty->pHirelings[0].pName))
+						&& (!pParty->pHirelings[1].pName || strcmp(*(const char **)v730, pParty->pHirelings[1].pName)) )
+					{
+						v607 = HIDWORD(v733);
+						HIDWORD(v733) += 4;
+						*(int *)v607 = (int)_this + 3;
+					}
+					_this = (ItemGen *)((char *)_this + 1);
+					v730 += 76;
+				}
+				while ( (signed int)this < (signed int)pNPCStats->uNumNewNPCs );
+			}
+			v608 = pCastSpell->uPlayerID_2;
+			if ( v608 != 4 && v608 != 5
+				|| (v609 = (signed int)*(&pFontCChar + v608 + (unsigned __int8)pParty->field_709), v609 <= 0)
+				|| v609 >= 3 )
+			{
+				ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
+				pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+				pCastSpell->spellnum = 0;
+				continue;
+			}
+			v610 = 76 * v609;
+			*((int *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + 19 * v609) = 0;
+			v611 = pIconsFrameTable->FindIcon("spell96");
+			*(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + v610 + 4) = pIconsFrameTable->GetIconAnimLength(v611);
+			*(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[3].field_18 + v610) = 1;
+			v612 = pParty->pPlayers;
+			do
+			{
+				v612->sHealth = v612->GetMaxHealth();
+				v612->sMana = v612->GetMaxMana();
+				++v612;
+			}
+			while ( v612 <= &pParty->pPlayers[3] );
+			v613 = &pOutdoor->ddm;
+			if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor)
+				v613 = &pIndoor->dlv;
+			v613->uReputation += 15;
+			if ( v613->uReputation > 10000 )
+				v613->uReputation = 10000;
 			LODWORD(v727) = 1;
 			break;
 		}
-		a2 = 0;
-		v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335);
-		v619 = pParty->pPlayers;//[0].pPlayerBuffs[10];
-		do
-		{
-			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2);
-			v619->pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].Apply(pParty->uTimePlayed + v717, v731, amount, v716, 0);
-			++a2;
-			++v619;
-		}
-		while ( v619 <= &pParty->pPlayers[3] );
-			LODWORD(v727) = 1;
-			break;
-			}
-		case SPELL_DARK_SOULDRINKER:
-		{
-		if ( !pPlayer->CanCastSpell(uRequiredMana) )
-			break;
-		pGame->GetIndoorCamera();
-		v623 = (signed __int64)pGame->pIndoorCameraD3D->GetPickDepth();
-		HIDWORD(v733) = sub_46A6AC((int)dword_50BF30, 100, v623);
-		v707.x = 0;
-		v707.y = 0;
-		v707.z = 0;
-		pSpellSprite.stru_24.Reset();
-		pSpellSprite.spell_id = pCastSpell->spellnum;
-		pSpellSprite.spell_level = v2;
-		pSpellSprite.spell_skill = v731;
-		pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
-		pSpellSprite.uAttributes = 0;
-		pSpellSprite.uSectorID = 0;
-		pSpellSprite.uSpriteFrameID = 0;
-		pSpellSprite.field_60_distance_related_prolly_lod = 0;
-		pSpellSprite.uFacing = 0;
-		pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
-		pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
-		a2 = 0;
-		int _v726 = 0;
-		if ( SHIDWORD(v733) > 0 )
-		{
-			_v726 = (HIDWORD(v733) * (7 * v2 + 25));
+		case SPELL_DARK_PAIN_REFLECTION:
+		{
+			if ( v731 > 0 && v731 <= 4 )
+			{
+				if ( v731 <= 3 )
+				{
+					v614 = 300 * (v2 + 12);
+				}
+				if ( v731 == 4 )
+				{
+					v614 = 900 * (v2 + 4);
+				}
+				LODWORD(v733) = v614;
+			}
+			v615 = v2 + 5;
+			amount = v615;
+			if ( !pPlayer->CanCastSpell(uRequiredMana) )
+				break;
+			if ( v731 != 3 && v731 != 4 )
+			{
+				pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
+
+				pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v615, v716, 0);
+				LODWORD(v727) = 1;
+				break;
+			}
+			a2 = 0;
+			v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335);
+			v619 = pParty->pPlayers;//[0].pPlayerBuffs[10];
 			do
 			{
-			v625 = dword_50BF30[a2];
-			pSpellSprite.vPosition.x = pActors[v625].vPosition.x;
-			pSpellSprite.vPosition.y = pActors[v625].vPosition.y;
-			//v732 = pActors[v625].uActorHeight;
-			pSpellSprite.vPosition.z = pActors[v625].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v625].uActorHeight * unk_4D8548);
-			pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
-			v627 = pSpellSprite.Create(0, 0, 0, 0);
-			v628 = a2;
-			DamageMonsterFromParty(PID(OBJECT_Item, v627), dword_50BF30[a2], &v707);
-			a2 = v628 + 1;
-			}
-			while ( v628 + 1 < SHIDWORD(v733) );
-		}
-		v730 = 0;
-		v629 = 1;
-		do
-		{
-			v630 = pPlayers[v629];
-			if ( !v630->pConditions[2]
-			&& !v630->pConditions[12]
-			&& !v630->pConditions[13]
-			&& !v630->pConditions[14]
-			&& !v630->pConditions[15]
-			&& !v630->pConditions[16] )
-			{
-			v631 = v730++;
-			v681[v631] = v629;
-			}
-			++v629;
-		}
-		while ( v629 <= 4 );
-		v732 = (signed __int64)((double)(signed int)_v726 / (double)v730);
-		HIDWORD(v733) = 0;
-		if ( v730 > 0 )
-		{
+				pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2);
+				v619->pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].Apply(pParty->uTimePlayed + v717, v731, amount, v716, 0);
+				++a2;
+				++v619;
+			}
+			while ( v619 <= &pParty->pPlayers[3] );
+			LODWORD(v727) = 1;
+			break;
+		}
+		case SPELL_DARK_SOULDRINKER:
+		{
+			if ( !pPlayer->CanCastSpell(uRequiredMana) )
+				break;
+			pGame->GetIndoorCamera();
+			v623 = (signed __int64)pGame->pIndoorCameraD3D->GetPickDepth();
+			HIDWORD(v733) = sub_46A6AC((int)dword_50BF30, 100, v623);
+			v707.x = 0;
+			v707.y = 0;
+			v707.z = 0;
+			pSpellSprite.stru_24.Reset();
+			pSpellSprite.spell_id = pCastSpell->spellnum;
+			pSpellSprite.spell_level = v2;
+			pSpellSprite.spell_skill = v731;
+			pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
+			pSpellSprite.uAttributes = 0;
+			pSpellSprite.uSectorID = 0;
+			pSpellSprite.uSpriteFrameID = 0;
+			pSpellSprite.field_60_distance_related_prolly_lod = 0;
+			pSpellSprite.uFacing = 0;
+			pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
+			pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
+			a2 = 0;
+			int _v726 = 0;
+			if ( SHIDWORD(v733) > 0 )
+			{
+				_v726 = (HIDWORD(v733) * (7 * v2 + 25));
+				do
+				{
+					v625 = dword_50BF30[a2];
+					pSpellSprite.vPosition.x = pActors[v625].vPosition.x;
+					pSpellSprite.vPosition.y = pActors[v625].vPosition.y;
+					//v732 = pActors[v625].uActorHeight;
+					pSpellSprite.vPosition.z = pActors[v625].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v625].uActorHeight * unk_4D8548);
+					pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
+					v627 = pSpellSprite.Create(0, 0, 0, 0);
+					v628 = a2;
+					DamageMonsterFromParty(PID(OBJECT_Item, v627), dword_50BF30[a2], &v707);
+					a2 = v628 + 1;
+				}
+				while ( v628 + 1 < SHIDWORD(v733) );
+			}
+			v730 = 0;
+			v629 = 1;
 			do
 			{
-			//v632 = 4 * v681[HIDWORD(v733)] + 10965188;
-			v726 = pPlayers[v681[HIDWORD(v733)]];
-			//v633 = pPlayers[v681[HIDWORD(v733)]];
-			v726->sHealth += v732;
-			//v726 = *(Player **)v632;
-			//v634 = v726->GetMaxHealth();
-			if ( v726->sHealth > v726->GetMaxHealth())
-				v726->sHealth = v726->GetMaxHealth();
-			v635 = HIDWORD(v733);
-
-			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, WORD2(v733));
-			HIDWORD(v733) = v635 + 1;
-			}
-			while ( v635 + 1 < v730 );
-		}
-		pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0, 0x40u);
+				v630 = pPlayers[v629];
+				if ( !v630->pConditions[2]
+				&& !v630->pConditions[12]
+				&& !v630->pConditions[13]
+				&& !v630->pConditions[14]
+				&& !v630->pConditions[15]
+								&& !v630->pConditions[16] )
+				{
+					v631 = v730++;
+					v681[v631] = v629;
+				}
+				++v629;
+			}
+			while ( v629 <= 4 );
+			v732 = (signed __int64)((double)(signed int)_v726 / (double)v730);
+			HIDWORD(v733) = 0;
+			if ( v730 > 0 )
+			{
+				do
+				{
+					//v632 = 4 * v681[HIDWORD(v733)] + 10965188;
+					v726 = pPlayers[v681[HIDWORD(v733)]];
+					//v633 = pPlayers[v681[HIDWORD(v733)]];
+					v726->sHealth += v732;
+					//v726 = *(Player **)v632;
+					//v634 = v726->GetMaxHealth();
+					if ( v726->sHealth > v726->GetMaxHealth())
+						v726->sHealth = v726->GetMaxHealth();
+					v635 = HIDWORD(v733);
+
+					pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, WORD2(v733));
+					HIDWORD(v733) = v635 + 1;
+					}
+					while ( v635 + 1 < v730 );
+			}
+			pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0, 0x40u);
 			LODWORD(v727) = 1;
 			break;
 		}
 
 		case SPELL_DARK_ARMAGEDDON:
 		{
-		if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
-		{
-			ShowStatusBarString(pGlobalTXT_LocalizationStrings[499], 2);  // Can't cast Armageddon indoors!
-			pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
-			pCastSpell->spellnum = 0;
-			continue;
-		}
-		v640 = v731 - 2;
-		if ( !v640 || (v641 = v640 - 1) == 0 || (amount = 4, v641 != 1) )
-			amount = 3;
-		if ( pPlayer->uNumArmageddonCasts >= amount || pParty->armageddon_timer > 0 )
-		{
-			ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
-			pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
-			pCastSpell->spellnum = 0;
-			continue;
-		}
-		if ( !pPlayer->CanCastSpell(uRequiredMana) )
-			break;
-		pParty->armageddon_timer = 256;
-		pParty->field_16140 = v2;
-		++pPlayer->uNumArmageddonCasts;
-		if ( pParty->bTurnBasedModeOn == 1 )
-			++pTurnEngine->field_1C;
-		auto _v726 = 50;
-		do
-		{
-			v642 = rand() % 4096 - 2048;
-			v643 = rand();
-			v721 = v642 + pParty->vPosition.x;
-			y = (char *)(pParty->vPosition.y + v643 % 4096 - 2048);
-			v732 = GetTerrainHeightsAroundParty2(v642 + pParty->vPosition.x, (int)y, (int *)&v710, 0);
-			v644 = rand();
-			sub_42F7EB_DropItemAt(0xFE6u, v721, (int)y, v732 + 16, v644 % 500 + 500, 1, 0, 0, 0);
-			--_v726;
-		}
-		while ( _v726 != 0 );
+			if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
+			{
+				ShowStatusBarString(pGlobalTXT_LocalizationStrings[499], 2);  // Can't cast Armageddon indoors!
+				pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+				pCastSpell->spellnum = 0;
+				continue;
+			}
+			v640 = v731 - 2;
+			if ( !v640 || (v641 = v640 - 1) == 0 || (amount = 4, v641 != 1) )
+				amount = 3;
+			if ( pPlayer->uNumArmageddonCasts >= amount || pParty->armageddon_timer > 0 )
+			{
+				ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
+				pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+				pCastSpell->spellnum = 0;
+				continue;
+			}
+			if ( !pPlayer->CanCastSpell(uRequiredMana) )
+				break;
+			pParty->armageddon_timer = 256;
+			pParty->field_16140 = v2;
+			++pPlayer->uNumArmageddonCasts;
+			if ( pParty->bTurnBasedModeOn == 1 )
+				++pTurnEngine->field_1C;
+			auto _v726 = 50;
+			do
+			{
+				v642 = rand() % 4096 - 2048;
+				v643 = rand();
+				v721 = v642 + pParty->vPosition.x;
+				y = (char *)(pParty->vPosition.y + v643 % 4096 - 2048);
+				v732 = GetTerrainHeightsAroundParty2(v642 + pParty->vPosition.x, (int)y, (int *)&v710, 0);
+				v644 = rand();
+				sub_42F7EB_DropItemAt(0xFE6u, v721, (int)y, v732 + 16, v644 % 500 + 500, 1, 0, 0, 0);
+				--_v726;
+			}
+			while ( _v726 != 0 );
 			LODWORD(v727) = 1;
 			break;
 		}
 
 		default:
-		break;
+			break;
 	}
 	if ( pCastSpell->field_8 & 0x20 )
 	{
@@ -7542,22 +7528,13 @@
 			pPlayer->PlaySound(SPEECH_49, 0);
 			if ( v727 != 0.0 )
 				pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[pCastSpell->spellnum], 0, 0, -1, 0, pCastSpell->sound_id, 0,	0);
-			pCastSpell->spellnum = 0;
-			v2 = v723;
-			continue;
 		}
 	}
 	pCastSpell->spellnum = 0;
 	v2 = v723;
 	continue;
-
-//LABEL_1166:
-//    ++n;
-//    if ( n >= 10 )
-//      return;
   }
   
-
 }
 //----- (0042EB42) --------------------------------------------------------
 __int16 ObjectList::ObjectIDByItemID(unsigned __int16 uItemID)
--- a/mm7_data.cpp	Tue May 14 10:07:21 2013 +0600
+++ b/mm7_data.cpp	Tue May 14 10:07:33 2013 +0600
@@ -544,7 +544,6 @@
 char aS100S[777]; // idb
 char aS100D[777]; // idb
 char aS180[6]; // idb
-const char *format_4E2E68 = "%s\f%05u\t180%d\f00000 / %d\n";
 char aS_6[2]; // idb
 char aSS_0[777]; // idb
 char aS_5[4]; // idb
@@ -754,8 +753,6 @@
   0x83, 0xD8,
   0x7B, 0xD8,
 };
-int pPaperdollRingsX[6] = {0x1EA, 0x21A, 0x248, 0x1EA, 0x21A, 0x248};
-int pPaperdollRingsY[6] = {0x0CA, 0x0CA, 0x0CA, 0x0FA, 0x0FA, 0x0FA};
 char aItem092v3[777]; // idb
 char aIbCd5D[777]; // idb
 char aItem281pc02d[777]; // idb
@@ -1497,8 +1494,8 @@
 int Book_PageBtn5_flag; //dword_506538
 int Book_PageBtn4_flag; // dword_50653C
 int Book_PageBtn3_flag; //dword_506540
-int BtnDown_flag; //dword_506544
-int BtnUp_flag; //dword_506548
+int BtnDown_flag; //BtnDown_flag
+int BtnUp_flag; //BtnUp_flag
 int quick_spell_at_page; // weak
 char byte_506550; // weak
 char *aMoonPhaseNames[5];
@@ -1604,7 +1601,7 @@
 int dword_50C998_turnbased_icon_1A; // weak
 int uSpriteID_Spell11; // idb
 _UNKNOWN unk_50C9A0; // weak
-int _50C9A8_item_enchantment_timer; // weak
+int _50C9A8_item_enchantment_timer = 0; // weak
 int dword_50C9AC; // weak
 int dword_50C9D0; // weak
 int dword_50C9D4; // weak
--- a/mm7_data.h	Tue May 14 10:07:21 2013 +0600
+++ b/mm7_data.h	Tue May 14 10:07:33 2013 +0600
@@ -461,7 +461,6 @@
 extern char aS100S[]; // idb
 extern char aS100D[]; // idb
 extern char aS180[6]; // idb
-extern const char *format_4E2E68; // format 2 text of resistance in Stats screen
 extern char aS_6[2]; // idb
 extern char aSS_0[]; // idb
 extern char aS_5[4]; // idb
@@ -582,8 +581,6 @@
 extern int pPaperdoll_SecondLeftHand[4][2];
 extern int pPaperdoll_RightHand[4][2];
 extern int pPaperdollLeftEmptyHand[4][2];
-extern int pPaperdollRingsX[6];
-extern int pPaperdollRingsY[6];
 extern char aItem092v3[]; // idb
 extern char aIbCd5D[]; // idb
 extern char aItem281pc02d[]; // idb
@@ -925,8 +922,8 @@
 extern int Book_PageBtn5_flag; //dword_506538
 extern int Book_PageBtn4_flag; //dword_50653C
 extern int Book_PageBtn3_flag; //dword_506540
-extern int BtnDown_flag; //dword_506544
-extern int BtnUp_flag; //dword_506548
+extern int BtnDown_flag; //BtnDown_flag
+extern int BtnUp_flag; //BtnUp_flag
 extern int quick_spell_at_page; // weak
 extern char byte_506550; // weak
 extern char *aMoonPhaseNames[5];
@@ -1596,8 +1593,6 @@
 void FillAwardsData();
 void sub_419220();
 void sub_419379();
-void CharacterUI_SkillScreen_Draw();
-void sub_4196A0();
 unsigned int __fastcall GetSizeInInventorySlots(unsigned int uNumPixels);
 void __cdecl draw_leather();
 void __cdecl GameUI_DrawRightPanelItems();
@@ -1687,8 +1682,6 @@
 int __stdcall DirectInputMouse_enumerator(int, int); // weak
 void CharacterUI_LoadPaperdollTextures();
 int __fastcall GetItemTextureFilename(char *pOut, signed int item_id, int index, int shoulder);
-void __fastcall CharacterUI_DrawPaperdoll(unsigned int uPlayerID); // idb
-void __fastcall CharacterUI_DrawPaperdollWithRingOverlay(unsigned int uPlayerID); // idb
 bool _43ED6F_check_party_races(bool b);
 bool __thiscall sub_43EDB9_get_some_race_sex_relation_2(unsigned int _this);
 bool __fastcall Player_has_item(unsigned int uItemID, struct Player *pPlayer, char a3);