changeset 651:2bf48d11d742

Training hall UI fixed
author Nomad
date Tue, 12 Mar 2013 03:10:35 +0200
parents 14d13880daa9
children 1ff57450f090
files Events2D.h GUIWindow.h UIHouses.cpp mm7_2.cpp mm7_4.cpp mm7_5.cpp mm7_6.cpp mm7_data.cpp mm7_data.h mm7text_ru.cpp
diffstat 10 files changed, 130 insertions(+), 124 deletions(-) [+]
line wrap: on
line diff
--- a/Events2D.h	Mon Mar 11 23:52:33 2013 +0200
+++ b/Events2D.h	Tue Mar 12 03:10:35 2013 +0200
@@ -1,39 +1,40 @@
 #pragma once
 
 /*  296 */
-enum BildingType : unsigned short
-	{
-	BildingType_WeaponShop = 0x1,
-	BildingType_ArmorShop = 0x2,
-	BildingType_MagicShop = 0x3,
-	BildingType_AlchemistShop = 0x4,
-	BildingType_FireGuild = 0x5,
-	BildingType_AirGuild = 0x6,
-	BildingType_WaterGuild = 0x7,
-	BildingType_EarthGuild = 0x8,
-	BildingType_SpiritGuild = 0x9,
-	BildingType_MindGuild = 0xA,
-	BildingType_BodyGuild = 0xB,
-	BildingType_LightGuild = 0xC,
-	BildingType_DarkGuild = 0xD,
-	BildingType_14 = 0xE,
-	BildingType_15 = 0xF,
-	BildingType_16 = 0x10,
-	BildingType_TownHall = 0x11,
-	BildingType_18 = 0x12,
-	BildingType_19 = 0x13,
-	BildingType_Throne_Room = 0x14,
-	BildingType_Tavern = 0x15,
-	BildingType_Bank = 0x16,
-	BildingType_Temple = 0x17,
-	BildingType_Unic = 0x19,
-	BildingType_1A = 0x1A,
-	BildingType_Stables = 0x1B,
-	BildingType_Boats = 0x1C,
-	BildingType_House = 0x1D,
-	BildingType_Training = 0x1E,
-	BildingType_Jail = 0x1F,
-	};
+enum BildingType: unsigned short
+{
+  BildingType_WeaponShop = 1,
+  BildingType_ArmorShop = 2,
+  BildingType_MagicShop = 3,
+  BildingType_AlchemistShop = 4,
+  BildingType_FireGuild = 5,
+  BildingType_AirGuild = 6,
+  BildingType_WaterGuild = 7,
+  BildingType_EarthGuild = 8,
+  BildingType_SpiritGuild = 9,
+  BildingType_MindGuild = 10,
+  BildingType_BodyGuild = 11,
+  BildingType_LightGuild = 12,
+  BildingType_DarkGuild = 13,
+  BildingType_14 = 14,
+  BildingType_15 = 15,
+  BildingType_16 = 16,
+  BildingType_TownHall = 17,
+  BildingType_18 = 18,
+  BildingType_19 = 19,
+  BildingType_Throne_Room = 20,
+  BildingType_Tavern = 21,
+  BildingType_Bank = 22,
+  BildingType_Temple = 23,
+  BuildingType_24 = 24,
+  BildingType_Unic = 25,
+  BildingType_1A = 26,
+  BildingType_Stables = 27,
+  BildingType_Boats = 28,
+  BildingType_House = 29,
+  BildingType_Training = 30,
+  BildingType_Jail = 31
+};
 
 /*  168 */
 #pragma pack(push, 1)
--- a/GUIWindow.h	Mon Mar 11 23:52:33 2013 +0200
+++ b/GUIWindow.h	Tue Mar 12 03:10:35 2013 +0200
@@ -240,7 +240,7 @@
   UIMSG_85 = 0x85,
   UIMSG_StartHireling1Dialogue = 0x86,
   UIMSG_StartHireling2Dialogue = 0x87,
-  UIMSG_SelectDialogueOption = 0x88,
+  UIMSG_SelectNPCDialogueOption = 0x88,
   UIMSG_8C = 0x8C,
   UIMSG_8D = 0x8D,
   UIMSG_CastSpellFromBook = 0x8E,
@@ -309,7 +309,7 @@
   UIMSG_16F = 0x16F,
   UIMSG_170 = 0x170,
   UIMSG_Game_Action = 0x194,
-  UIMSG_ClickLearnSkillDialog = 0x195,
+  UIMSG_SelectShopDialogueOption = 0x195,
   UIMSG_OpenRestUI = 0x199,
   UIMSG_19A = 0x19A,
   UIMSG_TransitionUI_Confirm = 0x19B,
@@ -402,7 +402,7 @@
 
 
 
-void OnSelectDialogueOption(DIALOGUE_TYPE newDialogueType);
+void OnSelectNPCDialogueOption(DIALOGUE_TYPE newDialogueType);
 
 
 
--- a/UIHouses.cpp	Mon Mar 11 23:52:33 2013 +0200
+++ b/UIHouses.cpp	Tue Mar 12 03:10:35 2013 +0200
@@ -3830,12 +3830,12 @@
 {
   Player *v0; // ebx@1
   int color2; // eax@1
-  unsigned int v2; // ecx@1
-  int v3; // eax@1
-  signed int v4; // edx@1
-  int v5; // edi@3
-  unsigned int v6; // esi@3
-  void *v7; // ecx@3
+  //unsigned int v2; // ecx@1
+  //int v3; // eax@1
+  //signed int v4; // edx@1
+  unsigned __int64 v5; // edi@3
+  //unsigned int v6; // esi@3
+  //void *v7; // ecx@3
   int v8; // edx@4
   double v9; // st7@6
   signed int v10; // esi@6
@@ -3894,12 +3894,12 @@
   int v63; // [sp-4h] [bp-88h]@52
   char *v64; // [sp-4h] [bp-88h]@63
   GUIWindow v65; // [sp+Ch] [bp-78h]@1
-  __int64 v66; // [sp+60h] [bp-24h]@3
+  //__int64 v66; // [sp+60h] [bp-24h]@3
   unsigned int white; // [sp+68h] [bp-1Ch]@1
   int v68; // [sp+6Ch] [bp-18h]@3
   int v69; // [sp+70h] [bp-14h]@6
-  unsigned int i; // [sp+74h] [bp-10h]@1
-  int v71; // [sp+78h] [bp-Ch]@1
+  //unsigned int i; // [sp+74h] [bp-10h]@1
+  //int v71; // [sp+78h] [bp-Ch]@1
   int v72; // [sp+7Ch] [bp-8h]@16
   int v73; // [sp+80h] [bp-4h]@14
 
@@ -3910,31 +3910,32 @@
   v65.uFrameZ = 334;
   white = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
   color2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u);
-  v2 = v0->uLevel;
-  v71 = color2;
-  v3 = 0;
-  v4 = 0;
-  for ( i = v2; v4 < (signed int)v2; ++v4 )
-    v3 += v4 + 1;
-  v5 = 1000 * v3;
-  v6 = HIDWORD(v0->uExperience);
-  v7 = window_SpeakInHouse->ptr_1C;
-  v68 = (unsigned __int16)word_4F0866[(signed int)v7];
-  v66 = 1000 * v3;
-  if ( (signed __int64)__PAIR__(v6, LODWORD(v0->uExperience)) >= v66 )
+  //v71 = color2;
+  //v2 = v0->uLevel;
+  //v3 = 0;
+  //v4 = 0;
+  //for ( i = v2; v4 < (signed int)v2; ++v4 )
+  //  v3 += v4 + 1;
+  //v5 = 1000 * v3;
+  v5 = 1000ui64 * v0->uLevel * (v0->uLevel + 1) / 2;  // E n = n(n + 1) / 2
+  //v6 = HIDWORD(v0->uExperience);
+  //v7 = window_SpeakInHouse->ptr_1C;
+  v68 = pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - 89];
+  //v66 = 1000 * v3;
+  if (v0->uExperience >= v5)
   {
     v8 = v0->classType % 4 + 1;
     if ( v8 == 4 )
       v8 = 3;
-    v9 = (double)(signed int)i;
-    i = 0;
+    v9 = (double)v0->uLevel;
+    //i = 0;
     v69 = v8;
     //v10 = (signed __int64)(v9 * p2DEvents_minus1__20[13 * (signed int)v7] * (double)v8);
-    v10 = (signed __int64)(v9 * p2DEvents[(signed int)v7 - 1].fPriceMultiplier * (double)v8);
+    v10 = (signed __int64)(v9 * p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier * (double)v8);
     v11 = v10 * (100 - v0->GetMerchant()) / 100;
     if ( v11 < v10 / 3 )
       v11 = v10 / 3;
-    i = v11;
+    //i = v11;
   }
   result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
   if ( result )
@@ -3949,7 +3950,8 @@
           result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
           if ( result )
           {
-            i = 0;
+            //i = 0;
+            int _v0 = 0;
             v13 = pDialogueWindow;
             //v14 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0);
             v14 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
@@ -3967,7 +3969,7 @@
               if ( byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v17] && !v0->pActiveSkills[v17] )
               {
                 v18 = pFontArrus->CalcTextHeight(pSkillNames[v17], &v65, 0, 0);
-                i += v18;
+                _v0 += v18;
                 ++v72;
               }
               ++v15;
@@ -3977,19 +3979,19 @@
             {
               sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v73);// "Skill Cost: %lu"
               v65.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
-              v73 = (signed int)(149 - i) / v72;
+              v73 = (signed int)(149 - _v0) / v72;
               if ( v73 > 32 )
                 v73 = 32;
               result = v13->pStartingPosActiveItem;
-              v19 = (signed int)(149 - v72 * v73 - i) / 2 - v73 / 2 + 162;
-              i = result;
+              v19 = (signed int)(149 - v72 * v73 - _v0) / 2 - v73 / 2 + 162;
+              int _v1 = result;
               v68 = v19;
               if ( result < result + v13->pNumPresenceButton )
               {
                 v72 = 2;
                 do
                 {
-                  v20 = v13->GetControl(i);
+                  v20 = v13->GetControl(_v1);
                   v21 = v20;
                   v22 = v20->uControlParam - 36;
                   if ( !byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v22] || v0->pActiveSkills[v22] )
@@ -4002,24 +4004,24 @@
                   {
                     v23 = pSkillNames[v22];
                     v21->uY = v73 + v68;
-                    HIDWORD(v66) = (int)v23;
+                    //HIDWORD(v66) = (int)v23;
                     v24 = pFontArrus->CalcTextHeight(v23, &v65, 0, 0);
                     v25 = v21->uY;
                     v21->uHeight = v24;
                     v26 = v25 + v24 - 1;
                     v21->uW = v26;
                     v68 = v26;
-                    v27 = v71;
+                    v27 = color2;
                     if ( pDialogueWindow->pCurrentPosActiveItem != v72 )
                       v27 = white;
-                    v65.DrawTitleText(pFontArrus, 0, v25, v27, (char *)HIDWORD(v66), 3u);
+                    v65.DrawTitleText(pFontArrus, 0, v25, v27, v23, 3u);
                   }
                   v28 = v13->pStartingPosActiveItem;
-                  ++i;
+                  ++_v1;
                   result = v13->pNumPresenceButton + v28;
                   ++v72;
                 }
-                while ( (signed int)i < result );
+                while ( (signed int)_v1 < result );
               }
             }
             else
@@ -4029,7 +4031,7 @@
                                                 // "Seek knowledge elsewhere %s the %s"
               strcat(pTmpBuf, "\n \n");
               strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further."
-              v29 = v71;
+              v29 = color2;
               v30 = pFontArrus->CalcTextHeight(pTmpBuf, &v65, 0, 0);
               result = (int)v65.DrawTitleText(pFontArrus, 0, (174 - v30) / 2 + 138, v29, pTmpBuf, 3u);
             }
@@ -4040,7 +4042,7 @@
       if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
       {
         v31 = pNPCTopics[122].pText;
-        v32 = v71;
+        v32 = color2;
         v33 = pFontArrus->CalcTextHeight(pNPCTopics[122].pText, &v65, 0, 0);
         v65.DrawTitleText(pFontArrus, 0, (212 - v33) / 2 + 101, v32, v31, 3u);
         result = (int)pDialogueWindow;
@@ -4050,11 +4052,11 @@
       v34 = v0->uLevel;
       if ( v34 < v68 )
       {
-        if ( (signed __int64)v0->uExperience >= v66 )
+        if ( (signed __int64)v0->uExperience >= v5 )
         {
-          if ( pParty->uNumGold >= i )
+          if ( pParty->uNumGold >= v11)
           {
-            Party::TakeGold(i);
+            Party::TakeGold(v11);
             HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2);
             ++v0->uLevel;
             v0->uSkillPoints += v0->uLevel / 10 + 5;
@@ -4083,7 +4085,7 @@
                 pOutdoor->SetFog();
             }
             v0->PlaySound(SPEECH_87, 0);
-            sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[430], v0->pName, v0->uLevel, v0->uLevel / 10 + 5);// 
+            sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[430], v0->pName, v0->uLevel, v0->uLevel / 10 + 5);// 
                                                 // "%s is now Level %lu and has earned %lu Skill Points!"
             ShowStatusBarString(pTmpBuf, 2u);
             goto LABEL_56;
@@ -4106,12 +4108,12 @@
           pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
           return 1; // void function actually
         }
-        sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[538], v5 - LODWORD(v0->uExperience), v34 + 1);// 
+        sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[538], (unsigned int)(v5 - v0->uExperience), v34 + 1);// 
                                                 // "You need %d more experience to train to level %d"
         v35 = 0;
         v62 = 3;
         v60 = pTmpBuf;
-        v58 = v71;
+        v58 = color2;
         v36 = (212 - pFontArrus->CalcTextHeight(pTmpBuf, &v65, 0, 0)) / 2 + 88;
       }
       else
@@ -4122,7 +4124,7 @@
         v35 = 0;
         v62 = 3;
         v60 = pTmpBuf;
-        v58 = v71;
+        v58 = color2;
         v36 = (212 - pFontArrus->CalcTextHeight(pTmpBuf, &v65, 0, 0)) / 2 + 101;
       }
       v65.DrawTitleText(pFontArrus, v35, v36, v58, v60, v62);
@@ -4148,7 +4150,7 @@
             v46 = v0->uLevel;
             if ( v46 < v68 )
             {
-              if ( (signed __int64)v0->uExperience < v66 )
+              if ( (signed __int64)v0->uExperience < v5 )
               {
                 v64 = (char *)(v46 + 1);
                 v61 = (char *)(v5 - LODWORD(v0->uExperience));
@@ -4156,7 +4158,7 @@
               }
               else
               {
-                v64 = (char *)i;
+                v64 = (char *)v11;
                 v61 = (char *)(v46 + 1);
                 v59 = pGlobalTXT_LocalizationStrings[537];// "Train to level %d for %d gold"
               }
@@ -4167,7 +4169,7 @@
               v61 = pGlobalTXT_LocalizationStrings[536];// ""With your skills, you should be working here as a teacher.""
               v59 = "%s\n \n%s";
             }
-            sprintf(*v45, v59, v61, v64);
+            sprintfex(*v45, v59, v61, v64);
           }
           v47 = pFontArrus->CalcTextHeight(*v45, &v65, 0, 0);
           v43 = pDialogueWindow;
@@ -4177,7 +4179,7 @@
         }
         while ( v73 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
       }
-      HIDWORD(v66) = (174 - v72) / 2;
+      //HIDWORD(v66) = (174 - v72) / 2;
       result = v43->pStartingPosActiveItem;
       v48 = result + v43->pNumPresenceButton;
       v49 = (2 * (87 - (174 - v72) / 2) - v72) / 2 - (174 - v72) / 2 / 2 + 138;
@@ -4185,25 +4187,25 @@
       v73 = v43->pStartingPosActiveItem;
       if ( v50 ^ __OFSUB__(result, v48) )
       {
-        i = 2;
+        int _v3 = 2;
         v51 = pShopOptions;
         do
         {
           v52 = v43->GetControl(v73);
           v53 = v52;
-          v52->uY = HIDWORD(v66) + v49;
+          v52->uY = (174 - v72) / 2 + v49;
           v54 = pFontArrus->CalcTextHeight(*v51, &v65, 0, 0);
           v55 = v53->uY;
           v53->uHeight = v54;
           v56 = v54 + v55 - 1;
           v53->uW = v56;
           v49 = v56;
-          v57 = v71;
-          if ( pDialogueWindow->pCurrentPosActiveItem != i )
+          v57 = color2;
+          if ( pDialogueWindow->pCurrentPosActiveItem != _v3 )
             v57 = white;
           v65.DrawTitleText(pFontArrus, 0, v55, v57, *v51, 3u);
           v43 = pDialogueWindow;
-          ++i;
+          ++_v3;
           ++v51;
           ++v73;
           result = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
--- a/mm7_2.cpp	Mon Mar 11 23:52:33 2013 +0200
+++ b/mm7_2.cpp	Tue Mar 12 03:10:35 2013 +0200
@@ -824,9 +824,9 @@
 }
 
 //----- (004BCACC) --------------------------------------------------------
-void __fastcall DrawLearnSkillDialog(signed int uMessageParam)
-{
-  unsigned int v1; // edi@1
+void __fastcall OnSelectShopDialogueOption(signed int uMessageParam)
+{
+  //unsigned int v1; // edi@1
   //signed int v2; // ebx@1
   //signed int v3; // ecx@2
   int v4; // eax@5
@@ -883,7 +883,7 @@
   //signed int v55; // [sp+10h] [bp-10h]@1
   int v56; // [sp+14h] [bp-Ch]@31
 
-  v1 = 0;
+  //v1 = 0;
   //v2 = a1;
   //v55 = a1;
   if ( !pDialogueWindow->pNumPresenceButton )
@@ -910,15 +910,15 @@
 			  v4 += v5++ + 1;
 			while ( v5 < pPlayers[uActiveCharacter]->uLevel );
 		  }
-		  if ( pPlayers[uActiveCharacter]->uLevel < (unsigned __int16)word_4F0866[(unsigned int)window_SpeakInHouse->ptr_1C]
-			&& (signed __int64)pPlayers[uActiveCharacter]->uExperience < 1000 * v4 )
+		  if (pPlayers[uActiveCharacter]->uLevel < pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - 89] &&
+			  (signed __int64)pPlayers[uActiveCharacter]->uExperience < 1000 * v4)
 			return;
 		}
 		pDialogueWindow->Release();
-		pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, v1, v1);
-		pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, v1, 0x71u, v1, v1, pGlobalTXT_LocalizationStrings[74],// "End Conversation"
-					   (Texture *)(uTextureID_BUTTDESC2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTDESC2] : 0), v1);
-		pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, v1, 0x51u, v1, v1, "", (Texture *)v1);
+		pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0);
+		pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation"
+					                                    pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);
+		pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, 0x51u, 0, 0, "", nullptr);
 //	LABEL_10:
 		//v3 = dword_F8B198;
 		v8 = window_SpeakInHouse;
@@ -927,20 +927,20 @@
 	  {
 		  v8 = window_SpeakInHouse;
 		  if ( (in_current_building_type == BildingType_Stables || in_current_building_type == BildingType_Boats)
-			&& (v1 = 0, *(&byte_4F09B1[32 * (unsigned __int8)*(&byte_4F0CCF[4 * (unsigned int)window_SpeakInHouse->ptr_1C] + uMessageParam)] + pParty->uDaysPlayed % 7))
+			&& (*(&byte_4F09B1[32 * (unsigned __int8)*(&byte_4F0CCF[4 * (unsigned int)window_SpeakInHouse->ptr_1C] + uMessageParam)] + pParty->uDaysPlayed % 7))
 			|| in_current_building_type != BildingType_Temple || uMessageParam != BildingType_MindGuild )
 		  {
 		//LABEL_9:
 			pDialogueWindow->Release();
-			pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, v1, v1);
-			pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, v1, 0x71u, v1, v1, pGlobalTXT_LocalizationStrings[74],// "End Conversation"
-						   (Texture *)(uTextureID_BUTTDESC2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTDESC2] : 0), v1);
-			pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, v1, 0x51u, v1, v1, "", (Texture *)v1);
+			pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0);
+			pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation"
+						                                    pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);
+			pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, 0x51u, 0, 0, "", nullptr);
 	//	LABEL_10:
 			//v3 = dword_F8B198;
 			v8 = window_SpeakInHouse;
 		  }
-		  else if ( uActiveCharacter != v1 )
+		  else if (uActiveCharacter)
 		  {
 			if ( !pPlayers[uActiveCharacter]->_4B6FF9() )
 			  return;
@@ -973,7 +973,7 @@
   {
     if ( in_current_building_type != BildingType_Tavern )
     {
-      if ( in_current_building_type <= (signed int)v1 )
+      if (in_current_building_type <= 0)
         return;
       if ( in_current_building_type > BildingType_AlchemistShop )
       {
@@ -1184,7 +1184,7 @@
           word_F8B1A0 = pParty->field_750[v25];
           if ( v27 )
           {
-            v1 = 0;
+            //v1 = 0;
             v27 = v26 == v13;
             v29 = (int)pNPCTopics[351].pText;
             if ( v27 )
@@ -1207,7 +1207,7 @@
               pParty->field_750[v25] = v13;
               pParty->field_75A[v25] = v13;
             }
-            v1 = 0;
+            //v1 = 0;
             dword_F8B1A4 = pNPCTopics[352].pText;
           }
         }
@@ -1247,7 +1247,7 @@
           *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = v1;
           ++pMessageQueue_50CBD0->uNumMessages;
         }*/
-        pMessageQueue_50CBD0->AddMessage(UIMSG_PlayArcomage, v1, v1);
+        pMessageQueue_50CBD0->AddMessage(UIMSG_PlayArcomage, 0, 0);
         dialog_menu_id = 104;
         break;
     }
--- a/mm7_4.cpp	Mon Mar 11 23:52:33 2013 +0200
+++ b/mm7_4.cpp	Tue Mar 12 03:10:35 2013 +0200
@@ -9292,7 +9292,7 @@
   }
   if ( v0 <= &_4F0882_evt_VAR_PlayerItemInHands_vals[53] )
   {
-	  ptr_F8B1E8 = (char *)pNPCTopics[666].pText;
+	  ptr_F8B1E8 = (char *)pNPCTopics[666].pText; // Here's %s that you lost. Be careful
 	  v4 = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11];
 	  contract_approved = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11];
 	  pParty->pPlayers[0].AddVariable(VAR_PlayerItemInHands, v4);
@@ -10811,7 +10811,7 @@
 
 
 //----- (004BC49B) --------------------------------------------------------
-void OnSelectDialogueOption(DIALOGUE_TYPE newDialogueType)
+void OnSelectNPCDialogueOption(DIALOGUE_TYPE newDialogueType)
     {
     //unsigned int v1; // esi@1
     NPCData *speakingNPC; // ebp@1
--- a/mm7_5.cpp	Mon Mar 11 23:52:33 2013 +0200
+++ b/mm7_5.cpp	Tue Mar 12 03:10:35 2013 +0200
@@ -396,11 +396,11 @@
         case UIMSG_ClickNPCTopic:
           ClickNPCTopic(uMessageParam);
           continue;
-        case UIMSG_ClickLearnSkillDialog:
-          DrawLearnSkillDialog(uMessageParam);
-          continue;
-        case UIMSG_SelectDialogueOption:
-          OnSelectDialogueOption((DIALOGUE_TYPE)uMessageParam);
+        case UIMSG_SelectShopDialogueOption:
+          OnSelectShopDialogueOption(uMessageParam);
+          continue;
+        case UIMSG_SelectNPCDialogueOption:
+          OnSelectNPCDialogueOption((DIALOGUE_TYPE)uMessageParam);
           continue;
         case UIMSG_19A:
           _4B4224_UpdateNPCTopics(uMessageParam);
--- a/mm7_6.cpp	Mon Mar 11 23:52:33 2013 +0200
+++ b/mm7_6.cpp	Tue Mar 12 03:10:35 2013 +0200
@@ -7576,7 +7576,7 @@
     CASE(UIMSG_Quit)
     CASE(UIMSG_StartHireling1Dialogue)
     CASE(UIMSG_StartHireling2Dialogue)
-    CASE(UIMSG_SelectDialogueOption)
+    CASE(UIMSG_SelectNPCDialogueOption)
     CASE(UIMSG_CastSpellFromBook)
     CASE(UIMSG_PlayerCreation_VoicePrev)
     CASE(UIMSG_PlayerCreation_VoiceNext)
--- a/mm7_data.cpp	Mon Mar 11 23:52:33 2013 +0200
+++ b/mm7_data.cpp	Tue Mar 12 03:10:35 2013 +0200
@@ -1476,7 +1476,7 @@
 	   56, 56, 59, 59, 60, 60};
 __int16 word_4F0754[49];
 //__int16 word_4F07B6[88];
-__int16 word_4F0866[14];
+//__int16 _word_4F0866_pMaxLevelPerTrainingHallType_negindexing[14];
 __int16 _4F0882_evt_VAR_PlayerItemInHands_vals[54]=
 {
 	0x0D4, 0x270, 0x0D5, 0x21C, 0x0D6, 0x2BE, 0x0D7, 0x2BD, 0x0D8, 0x289, 
@@ -1485,8 +1485,9 @@
 	0x0E2, 0x1E7, 0x0E3, 0x287, 0x0E4, 0x272, 0x0E5, 0x267, 0x0E6,
 	0x275, 0x0E7, 0x25A, 0x0E8, 0x2A4, 0x0E9, 0x2A5, 0x0EA, 0x2A3,
 	0x0EB, 0x25C, 0x0EC, 0x25D, 0x0ED, 0x259, 0x0F1, 0x21E
-}
-;
+};
+unsigned short pMaxLevelPerTrainingHallType[6] = {5, 15, 25, 25, 200, 200};
+
 int price_for_membership[11]={100, 100, 50, 50, 50, 50, 50, 50, 50, 1000, 1000}; // weak
 char byte_4F09B0[777]; // weak
 char byte_4F09B1[777]; // weak
--- a/mm7_data.h	Mon Mar 11 23:52:33 2013 +0200
+++ b/mm7_data.h	Tue Mar 12 03:10:35 2013 +0200
@@ -1008,8 +1008,9 @@
 extern int guild_mambership_flags[32];
 extern __int16 word_4F0754[49];
 //extern __int16 word_4F07B6[88];
-extern __int16 word_4F0866[14];
+//extern __int16 _word_4F0866_pMaxLevelPerTrainingHallType_negindexing[14];
 extern __int16 _4F0882_evt_VAR_PlayerItemInHands_vals[54];
+extern unsigned short pMaxLevelPerTrainingHallType[];
 extern int price_for_membership[]; // weak
 extern char byte_4F09B0[]; // weak
 extern char byte_4F09B1[]; // weak
@@ -2324,7 +2325,7 @@
 void __cdecl ArenaFight();
 void  SpellBookGenerator();
 struct GUIButton *__cdecl UI_CreateEndConversationButton();
-void __fastcall DrawLearnSkillDialog(signed int uMessageParam);
+void __fastcall OnSelectShopDialogueOption(signed int uMessageParam);
 signed int __cdecl sub_4BD8B5();
 bool __fastcall sub_4BDAAF(ItemGen *a1, int _2da_idx);
 void __cdecl sub_4BDB56_buy_skill____();
--- a/mm7text_ru.cpp	Mon Mar 11 23:52:33 2013 +0200
+++ b/mm7text_ru.cpp	Tue Mar 12 03:10:35 2013 +0200
@@ -874,6 +874,7 @@
   {"Тони", 0},
   {"Тор", 0},
   {"Тран", 0},
+  {"Траян", 0},
   {"Трейси", 1},
   {"Трент", 0},
   {"Трентон", 0},
@@ -1340,7 +1341,7 @@
           case 'P': case 'p':
           {
             auto token_begin = src;
-            int token_len = 0;
+            int token_len = 1;
             for (int i = 0; token_begin[i] != ']'; ++i)
               token_len++;
             strncpy(dst, token_begin, token_len);