diff UI/UIHouses.cpp @ 1739:1776d4f033a7

WeaponShop cleared
author Ritor1
date Fri, 27 Sep 2013 15:19:32 +0600
parents 8251e59fd7c1
children 19684d4bbe9a
line wrap: on
line diff
--- a/UI/UIHouses.cpp	Thu Sep 26 17:39:39 2013 +0600
+++ b/UI/UIHouses.cpp	Fri Sep 27 15:19:32 2013 +0600
@@ -988,41 +988,14 @@
 void __fastcall OnSelectShopDialogueOption(signed int uMessageParam)
 {
   int experience_for_next_level; // eax@5
-  GUIWindow *v8; // esi@10
   int v16; // eax@32
-  int v17; // eax@33
-  int v18; // eax@34
-  int v19; // eax@35
-  __int16 v20; // ax@37
-  __int16 v21; // ax@76
-  __int16 v22; // ax@107
-  __int16 v23; // ax@132
   __int16 v24; // ax@163
-  unsigned int v34; // eax@211
   signed int v36; // esi@227
-  int v37; // ecx@227
-  int v38; // esi@230
-  int v39; // edx@235
-  int v40; // edi@243
-  unsigned __int64 v41; // qax@243
-  signed int v43; // edi@244
-  int v44; // edx@244
-  int v45; // eax@246
-  unsigned int v46; // eax@247
-  void *v47; // eax@250
-  signed int v48; // edi@250
-  int v49; // eax@252
-  int v50; // eax@256
-  unsigned int v51; // eax@257
-  void *v52; // eax@260
-  signed int v53; // edi@260
-  int v54; // eax@262
+  int pPrice; // ecx@227
 
   if ( !pDialogueWindow->pNumPresenceButton )
     return;
   pRenderer->ClearZBuffer(0, 479);
-  if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN)
-    v8 = window_SpeakInHouse;
   if (dialog_menu_id == HOUSE_DIALOGUE_MAIN)
   {
     if ( in_current_building_type == BuildingType_Training )
@@ -1044,11 +1017,9 @@
       pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation"
                                                        pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);
       pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", nullptr);
-      v8 = window_SpeakInHouse;
     }
     if ( in_current_building_type != BuildingType_Training )
     {
-      v8 = window_SpeakInHouse;
       if ((in_current_building_type == BuildingType_Stables || in_current_building_type == BuildingType_Boats) &&
            transport_schedule[transport_routes[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_STABLES_HARMONDALE][uMessageParam - HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1]].pSchedule[pParty->uDaysPlayed % 7]
           || in_current_building_type != BuildingType_Temple || uMessageParam != BuildingType_MindGuild )
@@ -1058,21 +1029,16 @@
         pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation"
                                                          pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);
         pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", nullptr);
-        v8 = window_SpeakInHouse;
       }
       else if (uActiveCharacter)
       {
         if ( !pPlayers[uActiveCharacter]->IsPlayerHealableByTemple() )
           return;
-        v8 = window_SpeakInHouse;
       }
     }
     dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam;
     if ( in_current_building_type < BuildingType_19 )
-    {
       ShopTexture = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(off_4F03B8[(int)in_current_building_type], TEXTURE_16BIT_PALETTE)];
-      v8 = window_SpeakInHouse;
-    }
   }
   
   //NEW
@@ -1095,12 +1061,8 @@
       {
         for ( uint i = 0; i < 12; ++i )
         {
-          if ( pParty->SpellBooksInGuilds[v8->par1C-139][i].uItemID )
-          {
-            v34 = pIcons_LOD->LoadTexture(pParty->SpellBooksInGuilds[v8->par1C-139][i].GetIconName(), TEXTURE_16BIT_PALETTE);
-            v8 = window_SpeakInHouse;
-            ItemsInShopTexture[i] = &pIcons_LOD->pTextures[v34];
-          }
+          if ( pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C - 139][i].uItemID )
+            ItemsInShopTexture[i] = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C - 139][i].GetIconName(), TEXTURE_16BIT_PALETTE)];
         }
       }
       else//generation new books
@@ -1115,17 +1077,17 @@
     {
       if ( uMessageParam == HOUSE_DIALOGUE_TOWNHALL_MESSAGE )
       {
-        if ( pParty->field_3C.bountyHunting_next_generation_time[(int)((char *)v8->ptr_1C - 102)] < (signed __int64)pParty->uTimePlayed )//new generation
+        if ( pParty->field_3C.bountyHunting_next_generation_time[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] < (signed __int64)pParty->uTimePlayed )//new generation
         {
-          pParty->monster_for_hunting_killed[(int)((char *)v8->ptr_1C - 102)] = false;
-          pParty->field_3C.bountyHunting_next_generation_time[(int)((char *)v8->ptr_1C - 102)] = (signed __int64)((double)(309657600 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) * 0.033333335);
-          pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)] = rand() % 258 + 1;
+          pParty->monster_for_hunting_killed[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = false;
+          pParty->field_3C.bountyHunting_next_generation_time[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = (signed __int64)((double)(309657600 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) * 0.033333335);
+          pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand() % 258 + 1;
           v16 = (int)((char *)window_SpeakInHouse->ptr_1C - 102);
           if ( !v16 )
           {
             while ( 1 )
             {
-              v24 = pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)];
+              v24 = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)];
               if ( (unsigned __int16)v24 < 115 || (unsigned __int16)v24 > 132 )
               {
                 if ( ((unsigned __int16)v24 < 235 || (unsigned __int16)v24 > 252)
@@ -1141,144 +1103,144 @@
                   && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) )
                   break;
               }
-              pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)] = rand() % 258 + 1;
+              pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand() % 258 + 1;
             }
           }
           if ( v16 == 1 )
           {
             while ( 1 )
             {
-              v23 = pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)];
-              if ( (unsigned __int16)v23 < 115 || (unsigned __int16)v23 > 132 )
+              v24 = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)];
+              if ( (unsigned __int16)v24 < 115 || (unsigned __int16)v24 > 132 )
               {
-                if ( ((unsigned __int16)v23 < 0xE8u || (unsigned __int16)v23 > 0xF9u)
-                  && ((unsigned __int16)v23 < 0x85u || (unsigned __int16)v23 > 0x96u)
-                  && ((unsigned __int16)v23 < 0x97u || (unsigned __int16)v23 > 0xBAu)
-                  && ((unsigned __int16)v23 < 0xBEu || (unsigned __int16)v23 > 0xC0u)
-                  && ((unsigned __int16)v23 < 0xC4u || (unsigned __int16)v23 > 0xC6u)
-                  && ((unsigned __int16)v23 < 0x2Bu || (unsigned __int16)v23 > 0x2Du)
-                  && ((unsigned __int16)v23 < 0x52u || (unsigned __int16)v23 > 0x54u)
-                  && ((unsigned __int16)v23 < 4 || (unsigned __int16)v23 > 6)
-                  && ((unsigned __int16)v23 < 0x37u || (unsigned __int16)v23 > 0x39u)
-                  && ((unsigned __int16)v23 < 0x3Au || (unsigned __int16)v23 > 0x3Cu)
-                  && ((unsigned __int16)v23 < 0x3Du || (unsigned __int16)v23 > 0x3Fu)
-                  && ((unsigned __int16)v23 < 0xFDu || (unsigned __int16)v23 > 0xFFu)
-                  && ((unsigned __int16)v23 < 0x61u || (unsigned __int16)v23 > 0x63u)
-                  && ((unsigned __int16)v23 < 0xCDu || (unsigned __int16)v23 > 0xCFu) )
+                if ( ((unsigned __int16)v24 < 0xE8u || (unsigned __int16)v24 > 0xF9u)
+                  && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u)
+                  && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu)
+                  && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u)
+                  && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u)
+                  && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du)
+                  && ((unsigned __int16)v24 < 0x52u || (unsigned __int16)v24 > 0x54u)
+                  && ((unsigned __int16)v24 < 4 || (unsigned __int16)v24 > 6)
+                  && ((unsigned __int16)v24 < 0x37u || (unsigned __int16)v24 > 0x39u)
+                  && ((unsigned __int16)v24 < 0x3Au || (unsigned __int16)v24 > 0x3Cu)
+                  && ((unsigned __int16)v24 < 0x3Du || (unsigned __int16)v24 > 0x3Fu)
+                  && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu)
+                  && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u)
+                  && ((unsigned __int16)v24 < 0xCDu || (unsigned __int16)v24 > 0xCFu) )
                   break;
               }
-              pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)] = rand() % 258 + 1;
+              pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand() % 258 + 1;
             }
           }
           if ( v16 == 2 )
           {
             while ( 1 )
             {
-              v22 = pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)];
-              if ( (unsigned __int16)v22 < 0x73u || (unsigned __int16)v22 > 0x84u )
+              v24 = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)];
+              if ( (unsigned __int16)v24 < 0x73u || (unsigned __int16)v24 > 0x84u )
               {
-                if ( ((unsigned __int16)v22 < 0xE8u || (unsigned __int16)v22 > 0xF9u)
-                  && ((unsigned __int16)v22 < 0x85u || (unsigned __int16)v22 > 0x96u)
-                  && ((unsigned __int16)v22 < 0x97u || (unsigned __int16)v22 > 0xBAu)
-                  && ((unsigned __int16)v22 < 0xBEu || (unsigned __int16)v22 > 0xC0u)
-                  && ((unsigned __int16)v22 < 0xC4u || (unsigned __int16)v22 > 0xC6u)
-                  && ((unsigned __int16)v22 < 0x2Bu || (unsigned __int16)v22 > 0x2Du)
-                  && ((unsigned __int16)v22 < 0x31u || (unsigned __int16)v22 > 0x33u)
-                  && ((unsigned __int16)v22 < 0x34u || (unsigned __int16)v22 > 0x36u)
-                  && ((unsigned __int16)v22 < 0xFDu || (unsigned __int16)v22 > 0xFFu)
-                  && ((unsigned __int16)v22 < 0x61u || (unsigned __int16)v22 > 0x63u)
-                  && ((unsigned __int16)v22 < 0x1Cu || (unsigned __int16)v22 > 0x1Eu) )
+                if ( ((unsigned __int16)v24 < 0xE8u || (unsigned __int16)v24 > 0xF9u)
+                  && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u)
+                  && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu)
+                  && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u)
+                  && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u)
+                  && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du)
+                  && ((unsigned __int16)v24 < 0x31u || (unsigned __int16)v24 > 0x33u)
+                  && ((unsigned __int16)v24 < 0x34u || (unsigned __int16)v24 > 0x36u)
+                  && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu)
+                  && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u)
+                  && ((unsigned __int16)v24 < 0x1Cu || (unsigned __int16)v24 > 0x1Eu) )
                   break;
               }
-              pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)] = rand() % 258 + 1;
+              pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand() % 258 + 1;
             }
           }
           if ( v16 == 3 )
           {
             while ( 1 )
             {
-              v21 = pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)];
-              if ( (unsigned __int16)v21 < 0x73u || (unsigned __int16)v21 > 0x84u )
+              v24 = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)];
+              if ( (unsigned __int16)v24 < 0x73u || (unsigned __int16)v24 > 0x84u )
               {
-                if ( ((unsigned __int16)v21 < 0xE8u || (unsigned __int16)v21 > 0xF9u)
-                  && ((unsigned __int16)v21 < 0x85u || (unsigned __int16)v21 > 0x96u)
-                  && ((unsigned __int16)v21 < 0x97u || (unsigned __int16)v21 > 0xBAu)
-                  && ((unsigned __int16)v21 < 0xBEu || (unsigned __int16)v21 > 0xC0u)
-                  && ((unsigned __int16)v21 < 0xC4u || (unsigned __int16)v21 > 0xC6u)
-                  && ((unsigned __int16)v21 < 0x2Bu || (unsigned __int16)v21 > 0x2Du)
-                  && ((unsigned __int16)v21 < 0x5Eu || (unsigned __int16)v21 > 0x60u)
-                  && ((unsigned __int16)v21 < 0x43u || (unsigned __int16)v21 > 0x45u)
-                  && ((unsigned __int16)v21 < 0x4Fu || (unsigned __int16)v21 > 0x51u)
-                  && ((unsigned __int16)v21 < 0xC1u || (unsigned __int16)v21 > 0xC3u)
-                  && ((unsigned __int16)v21 < 0x13u || (unsigned __int16)v21 > 0x15u)
-                  && ((unsigned __int16)v21 < 0xFDu || (unsigned __int16)v21 > 0xFFu)
-                  && ((unsigned __int16)v21 < 0x61u || (unsigned __int16)v21 > 0x63u)
-                  && ((unsigned __int16)v21 < 0x6Au || (unsigned __int16)v21 > 0x6Cu) )
+                if ( ((unsigned __int16)v24 < 0xE8u || (unsigned __int16)v24 > 0xF9u)
+                  && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u)
+                  && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu)
+                  && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u)
+                  && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u)
+                  && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du)
+                  && ((unsigned __int16)v24 < 0x5Eu || (unsigned __int16)v24 > 0x60u)
+                  && ((unsigned __int16)v24 < 0x43u || (unsigned __int16)v24 > 0x45u)
+                  && ((unsigned __int16)v24 < 0x4Fu || (unsigned __int16)v24 > 0x51u)
+                  && ((unsigned __int16)v24 < 0xC1u || (unsigned __int16)v24 > 0xC3u)
+                  && ((unsigned __int16)v24 < 0x13u || (unsigned __int16)v24 > 0x15u)
+                  && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu)
+                  && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u)
+                  && ((unsigned __int16)v24 < 0x6Au || (unsigned __int16)v24 > 0x6Cu) )
                   break;
               }
-              pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)] = rand() % 258 + 1;
+              pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand() % 258 + 1;
             }
           }
           if ( v16 == 4 )
           {
             while ( 1 )
             {
-              v20 = pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)];
-              if ( (unsigned __int16)v20 < 0x73u || (unsigned __int16)v20 > 0x84u )
+              v24 = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)];
+              if ( (unsigned __int16)v24 < 0x73u || (unsigned __int16)v24 > 0x84u )
               {
-                if ( ((unsigned __int16)v20 < 0xE8u || (unsigned __int16)v20 > 0xF9u)
-                  && ((unsigned __int16)v20 < 0x85u || (unsigned __int16)v20 > 0x96u)
-                  && ((unsigned __int16)v20 < 0x97u || (unsigned __int16)v20 > 0xBAu)
-                  && ((unsigned __int16)v20 < 0xBEu || (unsigned __int16)v20 > 0xC0u)
-                  && ((unsigned __int16)v20 < 0xC4u || (unsigned __int16)v20 > 0xC6u)
-                  && ((unsigned __int16)v20 < 0x2Bu || (unsigned __int16)v20 > 0x2Du)
-                  && ((unsigned __int16)v20 < 0x6Du || (unsigned __int16)v20 > 0x6Fu)
-                  && ((unsigned __int16)v20 < 0x46u || (unsigned __int16)v20 > 0x48u)
-                  && ((unsigned __int16)v20 < 0x100u || (unsigned __int16)v20 > 0x102u)
-                  && ((unsigned __int16)v20 < 0xD9u || (unsigned __int16)v20 > 0xDBu)
-                  && ((unsigned __int16)v20 < 0xC7u || (unsigned __int16)v20 > 0xC9u)
-                  && ((unsigned __int16)v20 < 0xE5u || (unsigned __int16)v20 > 0xE7u)
-                  && ((unsigned __int16)v20 < 0xDFu || (unsigned __int16)v20 > 0xE1u)
-                  && ((unsigned __int16)v20 < 0x5Bu || (unsigned __int16)v20 > 0x5Du)
-                  && ((unsigned __int16)v20 < 0x49u || (unsigned __int16)v20 > 0x4Bu)
-                  && ((unsigned __int16)v20 < 0xFDu || (unsigned __int16)v20 > 0xFFu)
-                  && ((unsigned __int16)v20 < 0x61u || (unsigned __int16)v20 > 0x63u)
-                  && ((unsigned __int16)v20 < 0x10u || (unsigned __int16)v20 > 0x12u) )
+                if ( ((unsigned __int16)v24 < 0xE8u || (unsigned __int16)v24 > 0xF9u)
+                  && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u)
+                  && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu)
+                  && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u)
+                  && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u)
+                  && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du)
+                  && ((unsigned __int16)v24 < 0x6Du || (unsigned __int16)v24 > 0x6Fu)
+                  && ((unsigned __int16)v24 < 0x46u || (unsigned __int16)v24 > 0x48u)
+                  && ((unsigned __int16)v24 < 0x100u || (unsigned __int16)v24 > 0x102u)
+                  && ((unsigned __int16)v24 < 0xD9u || (unsigned __int16)v24 > 0xDBu)
+                  && ((unsigned __int16)v24 < 0xC7u || (unsigned __int16)v24 > 0xC9u)
+                  && ((unsigned __int16)v24 < 0xE5u || (unsigned __int16)v24 > 0xE7u)
+                  && ((unsigned __int16)v24 < 0xDFu || (unsigned __int16)v24 > 0xE1u)
+                  && ((unsigned __int16)v24 < 0x5Bu || (unsigned __int16)v24 > 0x5Du)
+                  && ((unsigned __int16)v24 < 0x49u || (unsigned __int16)v24 > 0x4Bu)
+                  && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu)
+                  && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u)
+                  && ((unsigned __int16)v24 < 0x10u || (unsigned __int16)v24 > 0x12u) )
                   break;
               }
-              pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)] = rand() % 258 + 1;
+              pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand() % 258 + 1;
             }
           }
         }
-        bountyHunting_monster_id_for_hunting = pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)];
-        if ( !pParty->monster_for_hunting_killed[(int)((char *)v8->ptr_1C - 102)] )
+        bountyHunting_monster_id_for_hunting = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)];
+        if ( !pParty->monster_for_hunting_killed[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] )
         {
           bountyHunting_text = pNPCTopics[351].pText;//"В этом месяцу назначена награда за голову %s..."
-          if ( !pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)] )
+          if ( !pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] )
             bountyHunting_text = pNPCTopics[353].pText;//"Кое кто уже приходил в этом месяце за наградой"
         }
         else
         {
-          if ( pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)] > 0 )//get prize
+          if ( pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] > 0 )//get prize
           {
-            party_finds_gold(100 * pMonsterStats->pInfos[(unsigned __int16)pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)]].uLevel, 0);
+            party_finds_gold(100 * pMonsterStats->pInfos[(unsigned __int16)pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]].uLevel, 0);
             for ( uint i = 0; i < 4; ++i )
               pParty->pPlayers[i].SetVariable(VAR_Award, 86);
-            pParty->uNumBountiesCollected += 100 * pMonsterStats->pInfos[pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)]].uLevel;
-            pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)] = 0;
-            pParty->monster_for_hunting_killed[(int)((char *)v8->ptr_1C - 102)] = false;
+            pParty->uNumBountiesCollected += 100 * pMonsterStats->pInfos[pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]].uLevel;
+            pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = 0;
+            pParty->monster_for_hunting_killed[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = false;
           }
           bountyHunting_text = pNPCTopics[352].pText;//"Поздравляю! Вы успешно..."
         }
       }
       else if ( uMessageParam == HOUSE_DIALOGUE_TOWNHALL_PAY_FINE )
-        pKeyActionMap->EnterText(1, 10, v8);
+        pKeyActionMap->EnterText(1, 10, window_SpeakInHouse);
       break;
     }
     case BuildingType_Bank:
     {
       if ( dialog_menu_id >= 7 && dialog_menu_id <= 8 )
-        pKeyActionMap->EnterText(1, 10, v8);
+        pKeyActionMap->EnterText(1, 10, window_SpeakInHouse);
       return;
       break;
     }
@@ -1299,272 +1261,6 @@
     }
   }
 
-  /*
-  if ( in_current_building_type > BuildingType_Tavern )
-  {
-    if ( in_current_building_type == BuildingType_Bank )
-    {
-      if ( dialog_menu_id >= 7 && dialog_menu_id <= 8 )
-        pKeyActionMap->EnterText(1, 10, v8);
-      return;
-    }
-    if ( in_current_building_type != BuildingType_Temple && in_current_building_type != BuildingType_Training )
-      return;
-  }
-  //else
-  if ( in_current_building_type < BuildingType_Tavern )
-  {
-      if (in_current_building_type <= 0)
-        return;
-      if ( in_current_building_type > BuildingType_AlchemistShop )
-      {
-        if ( in_current_building_type <= BuildingType_16 )
-        {
-          if ( (signed __int64)__PAIR__(
-                                 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44472],
-                                 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44468]) >= (signed __int64)pParty->uTimePlayed )
-          {
-            v32 = 0;
-            do
-            {
-              //v33 = *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v32 + 12 * (unsigned int)v8->ptr_1C));
-				v33 = pParty->SpellBooksInGuilds[v8->par1C-139][v32].uItemID;
-              if ( v33 )
-              {
-                v34 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v33].pIconName, TEXTURE_16BIT_PALETTE);
-                v8 = window_SpeakInHouse;
-                ItemsInShopTexture[v32] = &pIcons_LOD->pTextures[v34];
-              }
-              ++v32;
-            }
-            while ( v32 < 12 );
-          }
-          else
-          {
-            SpellBookGenerator();
-            v30 = window_SpeakInHouse->ptr_1C;
-            v31 = pParty->uTimePlayed
-                + (signed __int64)((double)(0xA8C000
-                                          //* (signed int)p2DEvents_minus1[26 * (unsigned int)ptr_507BC0->ptr_1C])
-                                          * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C)
-                                 * 0.033333335);
-            *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44468] = v31;
-            *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44472] = HIDWORD(v31);
-          }
-          return;
-        }
-        if ( in_current_building_type != BuildingType_TownHall )
-          return;
-		if ( in_current_building_type == BuildingType_TownHall )
-		{
-			if ( uMessageParam == 99 )
-			{
-			  v10 = (int)((char *)v8->ptr_1C - 102);
-			  v56 = v10;
-			  v11 = 8 * v10 + 11325428;
-			  if ( (signed __int64)__PAIR__(pParty->field_3C.field_0[2 * v10 + 1], pParty->field_3C.field_0[2 * v10]) >= (signed __int64)pParty->uTimePlayed )
-			  {
-				v13 = 0;
-			  }
-			  else
-			  {
-				v12 = v10;
-				v13 = 0;
-				pParty->field_75A[v12] = 0;
-				*(_QWORD *)v11 = (signed __int64)((double)(309657600 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) * 0.033333335);
-				v14 = rand() % 258;
-				v15 = window_SpeakInHouse;
-				pParty->field_750[v12] = v14 + 1;
-				v16 = (int)((char *)v15->ptr_1C - 102);
-				if ( v16 )
-				{
-				  v17 = v16 - 1;
-				  if ( v17 )
-				  {
-					v18 = v17 - 1;
-					if ( v18 )
-					{
-					  v19 = v18 - 1;
-					  if ( v19 )
-					  {
-						if ( v19 == 1 )
-						{
-						  while ( 1 )
-						  {
-							v20 = pParty->field_750[v12];
-							if ( (unsigned __int16)v20 < 0x73u || (unsigned __int16)v20 > 0x84u )
-							{
-							  if ( ((unsigned __int16)v20 < 0xE8u || (unsigned __int16)v20 > 0xF9u)
-								&& ((unsigned __int16)v20 < 0x85u || (unsigned __int16)v20 > 0x96u)
-								&& ((unsigned __int16)v20 < 0x97u || (unsigned __int16)v20 > 0xBAu)
-								&& ((unsigned __int16)v20 < 0xBEu || (unsigned __int16)v20 > 0xC0u)
-								&& ((unsigned __int16)v20 < 0xC4u || (unsigned __int16)v20 > 0xC6u)
-								&& ((unsigned __int16)v20 < 0x2Bu || (unsigned __int16)v20 > 0x2Du)
-								&& ((unsigned __int16)v20 < 0x6Du || (unsigned __int16)v20 > 0x6Fu)
-								&& ((unsigned __int16)v20 < 0x46u || (unsigned __int16)v20 > 0x48u)
-								&& ((unsigned __int16)v20 < 0x100u || (unsigned __int16)v20 > 0x102u)
-								&& ((unsigned __int16)v20 < 0xD9u || (unsigned __int16)v20 > 0xDBu)
-								&& ((unsigned __int16)v20 < 0xC7u || (unsigned __int16)v20 > 0xC9u)
-								&& ((unsigned __int16)v20 < 0xE5u || (unsigned __int16)v20 > 0xE7u)
-								&& ((unsigned __int16)v20 < 0xDFu || (unsigned __int16)v20 > 0xE1u)
-								&& ((unsigned __int16)v20 < 0x5Bu || (unsigned __int16)v20 > 0x5Du)
-								&& ((unsigned __int16)v20 < 0x49u || (unsigned __int16)v20 > 0x4Bu)
-								&& ((unsigned __int16)v20 < 0xFDu || (unsigned __int16)v20 > 0xFFu)
-								&& ((unsigned __int16)v20 < 0x61u || (unsigned __int16)v20 > 0x63u)
-								&& ((unsigned __int16)v20 < 0x10u || (unsigned __int16)v20 > 0x12u) )
-								break;
-							}
-							pParty->field_750[v12] = rand() % 258 + 1;
-						  }
-						}
-					  }
-					  else
-					  {
-						while ( 1 )
-						{
-						  v21 = pParty->field_750[v12];
-						  if ( (unsigned __int16)v21 < 0x73u || (unsigned __int16)v21 > 0x84u )
-						  {
-							if ( ((unsigned __int16)v21 < 0xE8u || (unsigned __int16)v21 > 0xF9u)
-							  && ((unsigned __int16)v21 < 0x85u || (unsigned __int16)v21 > 0x96u)
-							  && ((unsigned __int16)v21 < 0x97u || (unsigned __int16)v21 > 0xBAu)
-							  && ((unsigned __int16)v21 < 0xBEu || (unsigned __int16)v21 > 0xC0u)
-							  && ((unsigned __int16)v21 < 0xC4u || (unsigned __int16)v21 > 0xC6u)
-							  && ((unsigned __int16)v21 < 0x2Bu || (unsigned __int16)v21 > 0x2Du)
-							  && ((unsigned __int16)v21 < 0x5Eu || (unsigned __int16)v21 > 0x60u)
-							  && ((unsigned __int16)v21 < 0x43u || (unsigned __int16)v21 > 0x45u)
-							  && ((unsigned __int16)v21 < 0x4Fu || (unsigned __int16)v21 > 0x51u)
-							  && ((unsigned __int16)v21 < 0xC1u || (unsigned __int16)v21 > 0xC3u)
-							  && ((unsigned __int16)v21 < 0x13u || (unsigned __int16)v21 > 0x15u)
-							  && ((unsigned __int16)v21 < 0xFDu || (unsigned __int16)v21 > 0xFFu)
-							  && ((unsigned __int16)v21 < 0x61u || (unsigned __int16)v21 > 0x63u)
-							  && ((unsigned __int16)v21 < 0x6Au || (unsigned __int16)v21 > 0x6Cu) )
-							  break;
-						  }
-						  pParty->field_750[v12] = rand() % 258 + 1;
-						}
-					  }
-					}
-					else
-					{
-					  while ( 1 )
-					  {
-						v22 = pParty->field_750[v12];
-						if ( (unsigned __int16)v22 < 0x73u || (unsigned __int16)v22 > 0x84u )
-						{
-						  if ( ((unsigned __int16)v22 < 0xE8u || (unsigned __int16)v22 > 0xF9u)
-							&& ((unsigned __int16)v22 < 0x85u || (unsigned __int16)v22 > 0x96u)
-							&& ((unsigned __int16)v22 < 0x97u || (unsigned __int16)v22 > 0xBAu)
-							&& ((unsigned __int16)v22 < 0xBEu || (unsigned __int16)v22 > 0xC0u)
-							&& ((unsigned __int16)v22 < 0xC4u || (unsigned __int16)v22 > 0xC6u)
-							&& ((unsigned __int16)v22 < 0x2Bu || (unsigned __int16)v22 > 0x2Du)
-							&& ((unsigned __int16)v22 < 0x31u || (unsigned __int16)v22 > 0x33u)
-							&& ((unsigned __int16)v22 < 0x34u || (unsigned __int16)v22 > 0x36u)
-							&& ((unsigned __int16)v22 < 0xFDu || (unsigned __int16)v22 > 0xFFu)
-							&& ((unsigned __int16)v22 < 0x61u || (unsigned __int16)v22 > 0x63u)
-							&& ((unsigned __int16)v22 < 0x1Cu || (unsigned __int16)v22 > 0x1Eu) )
-							break;
-						}
-						pParty->field_750[v12] = rand() % 258 + 1;
-					  }
-					}
-				  }
-				  else
-				  {
-					while ( 1 )
-					{
-					  v23 = pParty->field_750[v12];
-					  if ( (unsigned __int16)v23 < 0x73u || (unsigned __int16)v23 > 0x84u )
-					  {
-						if ( ((unsigned __int16)v23 < 0xE8u || (unsigned __int16)v23 > 0xF9u)
-						  && ((unsigned __int16)v23 < 0x85u || (unsigned __int16)v23 > 0x96u)
-						  && ((unsigned __int16)v23 < 0x97u || (unsigned __int16)v23 > 0xBAu)
-						  && ((unsigned __int16)v23 < 0xBEu || (unsigned __int16)v23 > 0xC0u)
-						  && ((unsigned __int16)v23 < 0xC4u || (unsigned __int16)v23 > 0xC6u)
-						  && ((unsigned __int16)v23 < 0x2Bu || (unsigned __int16)v23 > 0x2Du)
-						  && ((unsigned __int16)v23 < 0x52u || (unsigned __int16)v23 > 0x54u)
-						  && ((unsigned __int16)v23 < 4u || (unsigned __int16)v23 > 6u)
-						  && ((unsigned __int16)v23 < 0x37u || (unsigned __int16)v23 > 0x39u)
-						  && ((unsigned __int16)v23 < 0x3Au || (unsigned __int16)v23 > 0x3Cu)
-						  && ((unsigned __int16)v23 < 0x3Du || (unsigned __int16)v23 > 0x3Fu)
-						  && ((unsigned __int16)v23 < 0xFDu || (unsigned __int16)v23 > 0xFFu)
-						  && ((unsigned __int16)v23 < 0x61u || (unsigned __int16)v23 > 0x63u)
-						  && ((unsigned __int16)v23 < 0xCDu || (unsigned __int16)v23 > 0xCFu) )
-						  break;
-					  }
-					  pParty->field_750[v12] = rand() % 258 + 1;
-					}
-				  }
-				}
-				else
-				{
-				  while ( 1 )
-				  {
-					v24 = pParty->field_750[v12];
-					if ( (unsigned __int16)v24 < 0x73u || (unsigned __int16)v24 > 0x84u )
-					{
-					  if ( ((unsigned __int16)v24 < 0xEBu || (unsigned __int16)v24 > 0xFCu)
-						&& ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u)
-						&& ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu)
-						&& ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u)
-						&& ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u)
-						&& ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du)
-						&& ((unsigned __int16)v24 < 0xCDu || (unsigned __int16)v24 > 0xCFu)
-						&& ((unsigned __int16)v24 < 0x5Eu || (unsigned __int16)v24 > 0x60u)
-						&& ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu)
-						&& ((unsigned __int16)v24 < 0x6Du || (unsigned __int16)v24 > 0x6Fu)
-						&& ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) )
-						break;
-					}
-					pParty->field_750[v12] = rand() % 258 + 1;
-				  }
-				}
-				v10 = v56;
-			  }
-			  v25 = v10;
-			  v26 = pParty->field_750[v25];
-			  v27 = pParty->field_75A[v25] == v13;
-			  bountyHunting_monster_id_for_hunting = pParty->field_750[v25];
-			  if ( v27 )
-			  {
-				//v1 = 0;
-				v27 = v26 == v13;
-				v29 = (int)pNPCTopics[351].pText;
-				if ( v27 )
-				  v29 = (int)pNPCTopics[353].pText;
-				bountyHunting_text = (char *)v29;
-			  }
-			  else
-			  {
-				if ( v26 != v13 )
-				{
-				  party_finds_gold(100 * pMonsterStats->pInfos[(unsigned __int16)v26].uLevel, 0);
-				  v28 = pParty->pPlayers;
-				  do
-				  {
-					v28->SetVariable(VAR_Award, 86);
-					++v28;
-				  }
-				  while ( (signed int)v28 < (signed int)pParty->pHirelings );
-				  pParty->uNumBountiesCollected += 100 * pMonsterStats->pInfos[pParty->field_750[v25]].uLevel;
-				  pParty->field_750[v25] = v13;
-				  pParty->field_75A[v25] = v13;
-				}
-				//v1 = 0;
-				bountyHunting_text = pNPCTopics[352].pText;
-			  }
-			}
-			else if ( uMessageParam == 100 )
-			{
-			  pKeyActionMap->EnterText(1, 10, v8);
-			}
-		}
-	  }
-  }
-  */
-  
-
-//LABEL_196:
   switch ( uMessageParam )
   {
     case HOUSE_DIALOGUE_LEARN_SKILLS:
@@ -1589,13 +1285,6 @@
     }
     case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT:
     {
-      /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
-      {
-        pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_PlayArcomage;
-        pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v1;
-        *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = v1;
-        ++pMessageQueue_50CBD0->uNumMessages;
-      }*/
       pMessageQueue_50CBD0->AddMessage(UIMSG_PlayArcomage, 0, 0);
       dialog_menu_id = HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT;
       break;
@@ -1603,7 +1292,7 @@
     case HOUSE_DIALOGUE_SHOP_BUY_STANDARD:
     case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL:
     {
-      if ( pParty->field_3C.Shops_next_generation_time[(unsigned int)v8->ptr_1C] < (signed __int64)pParty->uTimePlayed )
+      if ( pParty->field_3C.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] < (signed __int64)pParty->uTimePlayed )
       {
         GenerateStandartShopItems();
         GenerateSpecialShopItems();
@@ -1613,59 +1302,47 @@
       {
         if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] )
         {
-          for ( v43 = 0; v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType]; ++v43 )
+          for ( uint i = 0; i < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType]; ++i )
           {
-            if ( pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v43].uItemID )
-            {
-              v46 = pIcons_LOD->LoadTexture(pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v43].GetIconName(), TEXTURE_16BIT_PALETTE);
-              ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v46];
-            }
+            if ( pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][i].uItemID )
+              ItemsInShopTexture[i] = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][i].GetIconName(), TEXTURE_16BIT_PALETTE)];
           }
         }
         if ( in_current_building_type == BuildingType_WeaponShop )
         {
-          v48 = 0;
           if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] )
           {
-            do
+            for ( uint i = 0; i < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType]; ++i )
             {
-              if ( pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v48].uItemID)
-                word_F8B158[v48] = rand() % (300 - ItemsInShopTexture[v48]->uTextureHeight);
-              ++v48;
-              }
-              while ( v48 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] );
+              if ( pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][i].uItemID)
+                weapons_Ypos[i] = rand() % (300 - ItemsInShopTexture[i]->uTextureHeight);
             }
           }
         }
-        if ( uMessageParam == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL )
+      }
+      if ( uMessageParam == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL )
+      {
+        if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] )
+        {
+          for ( uint i = 0; i < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType]; ++i )
+          {
+            if ( pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID )
+              ItemsInShopTexture[i] = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].GetIconName(), TEXTURE_16BIT_PALETTE)];
+          }
+        }
+        if ( in_current_building_type == BuildingType_WeaponShop )
         {
           if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] )
           {
-            for ( v43 = 0; v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType]; ++v43 )
+            for ( uint i = 0; i < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType]; ++i )
             {
-              if ( pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v43].uItemID )
-              {
-                v51 = pIcons_LOD->LoadTexture(pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v43].GetIconName(), TEXTURE_16BIT_PALETTE);
-                ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v51];
-              }
-            }
-          }
-          if ( in_current_building_type == BuildingType_WeaponShop )
-          {
-            v53 = 0;
-            if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] )
-            {
-              do
-              {
-                if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v53].uItemID)
-                  word_F8B158[v53] = rand() % (300 - ItemsInShopTexture[v53]->uTextureHeight);
-                ++v53;
-              }
-              while ( v53 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType ] );
+              if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID)
+                weapons_Ypos[i] = rand() % (300 - ItemsInShopTexture[i]->uTextureHeight);
             }
           }
         }
-        break;
+      }
+      break;
     }
     case HOUSE_DIALOGUE_SHOP_SELL:
     case HOUSE_DIALOGUE_SHOP_IDENTIFY:
@@ -1686,29 +1363,25 @@
     {
       if( uMessageParam >= HOUSE_DIALOGUE_36 && uMessageParam <= HOUSE_DIALOGUE_GUILD_LEARN_SKILL )
       {
-        v36 = (signed __int64)(p2DEvents[(unsigned int)v8->ptr_1C - 1].flt_24 * 500.0);
-        v37 = v36 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
-        if ( v37 < v36 / 3 )
-        v37 = v36 / 3;
-        //if (false)
-        if(byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][uMessageParam-36])
-        //if ( *(&byte_4ED94C[37 * v35->uClass] + v55) )
+        v36 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
+        pPrice = v36 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
+        if ( pPrice < v36 / 3 )
+        pPrice = v36 / 3;
+        if(byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][uMessageParam - 36])
         {
-          //v38 = (int)(&pPlayers[uActiveCharacter]->uIntelligence + uMessageParam);
           if ( !pPlayers[uActiveCharacter]->pActiveSkills[uMessageParam - 36] )
           {
-            if ( pParty->uNumGold < v37 )
+            if ( pParty->uNumGold < pPrice )
             {
               ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);
               if ( in_current_building_type == BuildingType_Training || in_current_building_type == BuildingType_Tavern )
-                v39 = 4;
+                PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Goodbye);
               else
-                v39 = 2;
-              PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v39);
+                PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
             }
             else
             {
-              Party::TakeGold(v37);
+              Party::TakeGold(pPrice);
               dword_F8B1E4 = 1;
               pPlayers[uActiveCharacter]->pActiveSkills[uMessageParam - 36] = 1;
               pPlayers[uActiveCharacter]->PlaySound(SPEECH_78, 0);
@@ -1719,192 +1392,6 @@
       break;
     }
   }
-  /*
-  if ( uMessageParam != 95 && uMessageParam != 2 )
-  {
-    if ( uMessageParam == 3 )
-    {
-      dialog_menu_id = 3;
-    }
-    else
-    {
-      if ( uMessageParam == 4 )
-      {
-        dialog_menu_id = 4;
-      }
-      else
-      {
-        if ( uMessageParam != 5 )
-        {
-          if ( uMessageParam > 35 )
-          {
-            if ( uMessageParam <= 72 )
-            {
-              v35 = pPlayers[uActiveCharacter];
-              //v36 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)v8->ptr_1C] * 500.0);
-              v36 = (signed __int64)(p2DEvents[(unsigned int)v8->ptr_1C - 1].flt_24 * 500.0);
-              v37 = v36 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
-              if ( v37 < v36 / 3 )
-                v37 = v36 / 3;
-              
-              __debugbreak();
-              //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23]
-              // or
-              //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36]
-              // or
-              //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1]
-
-              if (false)
-              //if ( *(&byte_4ED94C[37 * v35->uClass] + v55) )
-              {
-                v38 = (int)(&v35->uIntelligence + uMessageParam);
-                if ( !*(short *)v38 )
-                {
-                  if ( pParty->uNumGold < v37 )
-                  {
-                    ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
-                    if ( in_current_building_type == BuildingType_Training || in_current_building_type == BuildingType_Tavern )
-                      v39 = 4;
-                    else
-                      v39 = 2;
-                    PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, v39);
-                  }
-                  else
-                  {
-                    Party::TakeGold(v37);
-                    dword_F8B1E4 = 1;
-                    *(short *)v38 = 1;
-                    v35->PlaySound(SPEECH_78, 0);
-                  }
-                }
-              }
-            }
-            else
-            {
-              if ( uMessageParam == 94 )
-              {
-                pDialogueWindow->eWindowType = WINDOW_MainMenu;
-                UI_CreateEndConversationButton();
-                InitializaDialogueOptions_Shops(in_current_building_type);
-              }
-            }
-          }
-          return;
-        }
-        dialog_menu_id = 5;
-      }
-    }
-    sub_421B2C_PlaceInInventory_or_DropPickedItem();
-    return;
-  }
-  if ( pParty->field_3C.Shops_next_generation_time[(unsigned int)v8->ptr_1C] < (signed __int64)pParty->uTimePlayed )
-  {
-    GenerateStandartShopItems();
-    GenerateSpecialShopItems();
-    v8 = window_SpeakInHouse;
-    v40 = window_SpeakInHouse->par1C;
-    //v3 = dword_F8B198;
-    v41 = pParty->uTimePlayed
-        //+ (signed __int64)((double)(11059200 * (signed int)p2DEvents_minus1[26 * (unsigned int)ptr_507BC0->ptr_1C])
-        + (signed __int64)((double)(11059200 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C)
-                         * 0.033333335);
-    pParty->field_3C.Shops_next_generation_time[v40] = v41;
-   
-  }
-  v42 = v8->ptr_1C;
-  v43 = 0;
-  //v44 = p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C];
-  v44 = p2DEvents[(unsigned int)v8->ptr_1C - 1].uType;
-  if ( uMessageParam == 2 )
-  {
-    if ( uItemsAmountPerShopType[v44] )
-    {
-      do
-      {
-        v45 = pParty->StandartItemsInShops[(int)v42][v43].uItemID;
-        if ( v45 )
-        {
-          v46 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v45].pIconName, TEXTURE_16BIT_PALETTE);
-          //v3 = dword_F8B198;
-          v8 = window_SpeakInHouse;
-          ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v46];
-        }
-        v42 = v8->ptr_1C;
-        ++v43;
-      }
-      //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] );
-      while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] );
-    }
-    if ( in_current_building_type == BuildingType_WeaponShop )
-    {
-      v47 = v8->ptr_1C;
-      v48 = 0;
-      //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] )
-      if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] )
-      {
-        do
-        {
-         // if ( pParty->field_777C[9 * (v48 + 12 * (int)v47)] )
-		 if ( pParty->StandartItemsInShops[(int)v47][v48].uItemID);
-          {
-            v49 = rand();
-            v8 = window_SpeakInHouse;
-            word_F8B158[v48] = v49 % (300 - ItemsInShopTexture[v48]->uTextureHeight);
-          }
-          v47 = v8->ptr_1C;
-          ++v48;
-        }
-        //while ( v48 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] );
-        while ( v48 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] );
-      }
-    }
-  }
-  if ( uMessageParam == 95 )
-  {
-    if ( uItemsAmountPerShopType[v44] )
-    {
-      do
-      {
-        //v50 = pParty->field_C59C[9 * (v43 + 12 * (int)v42) + 724];
-	  v50=pParty->SpecialItemsInShops[(unsigned int)v42][(signed int)v43].uItemID;
-        if ( v50 )
-        {
-          v51 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v50].pIconName, TEXTURE_16BIT_PALETTE);
-          //v3 = dword_F8B198;
-          v8 = window_SpeakInHouse;
-          ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v51];
-        }
-        v42 = v8->ptr_1C;
-        ++v43;
-      }
-      //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] );
-      while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] );
-    }
-    if ( in_current_building_type == BuildingType_WeaponShop )
-    {
-      v52 = v8->ptr_1C;
-      v53 = 0;
-      //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] )
-      if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] )
-      {
-        do
-        {
-         // if ( pParty->field_C59C[9 * (v53 + 12 * (int)v52) + 724] )
-		if (pParty->SpecialItemsInShops[(unsigned int)v52][v53].uItemID)
-          {
-            v54 = rand();
-            v8 = window_SpeakInHouse;
-            word_F8B158[v53] = v54 % (300 - ItemsInShopTexture[v53]->uTextureHeight);
-          }
-          v52 = v8->ptr_1C;
-          ++v53;
-        }
-        //while ( v53 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] );
-        while ( v53 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType ] );
-      }
-    }
-  }
-*/
 }
 //----- (004B6943) --------------------------------------------------------
 void  TravelByTransport()