changeset 680:3f504ad074a8

Слияние
author Ritor1
date Tue, 12 Mar 2013 23:26:58 +0600
parents c76775d819d6 (current diff) 431a8b0c2bf1 (diff)
children b54755fa0dbc
files UIHouses.cpp
diffstat 20 files changed, 402 insertions(+), 501 deletions(-) [+]
line wrap: on
line diff
--- a/Actor.cpp	Tue Mar 12 23:26:43 2013 +0600
+++ b/Actor.cpp	Tue Mar 12 23:26:58 2013 +0600
@@ -3883,6 +3883,7 @@
     break;
 
     case Removed:
+    case Disabled:
       return;
 
     default:
--- a/Events2D.h	Tue Mar 12 23:26:43 2013 +0600
+++ b/Events2D.h	Tue Mar 12 23:26:58 2013 +0600
@@ -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	Tue Mar 12 23:26:43 2013 +0600
+++ b/GUIWindow.h	Tue Mar 12 23:26:58 2013 +0600
@@ -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/LOD.cpp	Tue Mar 12 23:26:43 2013 +0600
+++ b/LOD.cpp	Tue Mar 12 23:26:58 2013 +0600
@@ -3094,6 +3094,7 @@
   uint id = LoadTexture(pContainer, uTextureType);
   if (id == -1)
   {
+    assert(false);
     Log::Warning(L"LOD error\\no container: \"%S\"", pContainer);
     return nullptr;
   }
@@ -3120,11 +3121,12 @@
 //  if (!uNumLoadedFiles)
 //  {
 //LABEL_5:
-    if (uNumLoadedFiles >= 1000)
+    assert(uNumLoadedFiles < 1000);
+    /*if (uNumLoadedFiles >= 1000)
     {
       Log::Warning(L"Maximum texture number exceeded");
       AbortWithError();
-    }
+    }*/
     if (LoadTextureFromLOD(&pTextures[uNumLoadedFiles], pContainer, uTextureType) == -1)
     {
       v6 = 0;
--- a/NPC.cpp	Tue Mar 12 23:26:43 2013 +0600
+++ b/NPC.cpp	Tue Mar 12 23:26:58 2013 +0600
@@ -456,6 +456,9 @@
 			decode_step=0;
 			do 
 				{
+                while (*test_string == '\t')  // some steps are separated by multiple \t's
+                  ++test_string;
+                
 				c = *(unsigned char*)test_string;
 				temp_str_len = 0;
 				while((c!='\t')&&(c>0))
--- a/NPC.h	Tue Mar 12 23:26:43 2013 +0600
+++ b/NPC.h	Tue Mar 12 23:26:58 2013 +0600
@@ -1,71 +1,68 @@
 #pragma once
 
-/*
-enum NPCProffession
-	{
-	Smith	1
-	Armorer	2
-	Alchemist	3
-	Scholar	4
-	Guide	5
-	Tracker	6
-	Pathfinder	7
-	Sailor	8
-	Navigator	9
-	Healer	10
-	Expert Healer	11
-	Master Healer	12
-	Teacher	13
-	Instructor	14
-	Arms Master	15
-	Weapons Master	16
-	Apprentice	17
-	Mystic	18
-	Spell Master	19
-	Trader	20
-	Merchant	21
-	Scout	22
-	Herbalist	23
-	Apothecary	24
-	Tinker	25
-	Locksmith	26
-	Fool	27
-	Chimney Sweep	28
-	Porter	29
-	Quarter Master	30
-	Factor	31
-	Banker	32
-	Cook	33
-	Chef	34
-	Horseman	35
-	Bard	36
-	Enchanter	37
-	Cartographer	38
-	Wind Master	39
-	Water Master	40
-	Gate Master	41
-	Acolyte	42
-	Piper	43
-	Explorer	44
-	Pirate	45
-	Squire	46
-	Psychic	47
-	Gypsy	48
-	Diplomat	49
-	Duper	50
-	Burglar	51
-	Fallen Wizard	52
-	Acolyte	53
-	Initiate	54
-	Prelate	55
-	Monk	56
-	Sage	57
-	Hunter	58
+enum NPCProf
+{
+  Smith	= 1,           // GM Weapon Repair;
+  Armorer = 2,         // GM Armor Repair;
+  Alchemist = 3,       // GM Potion Repair;
+  Scholar = 4,         // GM Item ID;               Learning: +5
+  Guide = 5,           // Travel by foot: -1 day;
+  Tracker = 6,         // Travel by foot: -2 days;
+  Pathfinder = 7,      // Travel by foot: -3 days;
+  Sailor = 8,          // Travel by sea: -2 days;
+  Navigator = 9,       // Travel by sea: -3 days;
+  Healer = 10,
+  ExpertHealer = 11,
+  MasterHealer = 12,
+  Teacher = 13,        // Learning: +10;
+  Instructor = 14,     // Learning: +15;
+  Armsmaster = 15,     // Armsmaster: +2;
+  Weaponsmaster = 16,  // Armsmaster: +3;
+  Apprentice = 17,     // Fire: +2;         Air: +2;    Water: +2;   Earth: +2;
+  Mystic = 18,         // Fire: +3;         Air: +3;    Water: +3;   Earth: +3;
+  Spellmaster = 19,    // Fire: +4;         Air: +4;    Water: +4;   Earth: +4;
+  Trader = 20,         // Merchant: +4;
+  Merchant = 21,       // Merchant: +6;
+  Scout = 22,          // Perception: +6;
+  Herbalist = 23,      // Alchemy: +4;
+  Apothecary = 24,     // Alchemy: +8;
+  Tinker = 25,         // Traps: +4;
+  Locksmith = 26,      // Traps: +6;
+  Fool = 27,           // Luck: +5;
+  ChimneySweep = 28,   // Luck: +20;
+  Porter = 29,         // Food for rest: -1;
+  QuarterMaster = 30,  // Food for rest: -2;
+  Factor = 31,         // Gold finds: +10%;
+  Banker = 32,         // Gold finds: +20%;
+  Cook = 33,
+  Chef = 34,
+  Horseman = 35,       // Travel by foot: -2 days;
+  Bard = 36,
+  Enchanter = 37,      // Resist All: +20;
+  Cartographer = 38,   // Wizard Eye level 2;
+  WindMaster = 39,
+  WaterMaster = 40,
+  GateMaster = 41,
+  Acolyte = 42,
+  Piper = 43,
+  Explorer = 44,       // Travel by foot -1 day;     Travel by sea: -1 day;
+  Pirate = 45,         // Travel by sea: -2 days;    Gold finds: +10%;      Reputation: +5;
+  Squire = 46,
+  Psychic = 47,        // Perception: +5;            Luck: +10;
+  Gypsy = 48,          // Food for rest: -1;         Merchant: +3;          Reputation: +5;
+  Diplomat = 49,
+  Duper = 50,          // Merchant: +8;              Reputation: +5;
+  Burglar = 51,        // Traps: +8;                 Stealing: +8;          Reputation: +5;
+  FallenWizard = 52,   // Reputation: +5;
+  Acolyte2 = 53,       // Spirit: +2;                Mind: +2;              Body: +2;
+  Initiate = 54,       // Spirit: +3;                Mind: +3;              Body: +3;
+  Prelate = 55,        // Spirit: +4;                Mind: +4;              Body: +4;
+  Monk = 56,           // Unarmed: +2;               Dodge: +2;
+  Sage = 57,           // Monster ID: +6
+  Hunter = 58          // Monster ID: +6
+};
 
 
-	};
-	*/
-
 
 struct NPCTopic
 {
@@ -88,100 +85,7 @@
   int fame;  //c
   int rep;  //10
   unsigned int Location2D;  //14
-  unsigned int uProfession; //18      CheckHiredNPCSpeciality(uProfession)
-                                  /*   
-
-      v0 = uDefaultTravelTime_ByFoot;
-  if ( CheckHiredNPCSpeciality(5u) )
-    --v0;
-  if ( CheckHiredNPCSpeciality(6u) )
-    v0 -= 2;
-  if ( CheckHiredNPCSpeciality(7u) )
-    v0 -= 3;
-  if ( CheckHiredNPCSpeciality(0x2Cu) )
-    --v0;
-
-
-      case PLAYER_SKILL_MONSTER_ID:
-      if ( CheckHiredNPCSpeciality(58) )
-        skill += 6;
-      if ( CheckHiredNPCSpeciality(57) )
-        skill += 6;
-
-    case PLAYER_SKILL_ARMSMASTER:
-        if ( CheckHiredNPCSpeciality(15) )
-          skill += 2;
-        if ( CheckHiredNPCSpeciality(16) )
-          skill += 3;
-
-    case PLAYER_SKILL_STEALING:
-      if (CheckHiredNPCSpeciality(51))
-        skill +=
-
-    case PLAYER_SKILL_ALCHEMY:
-        if ( CheckHiredNPCSpeciality(23) )
-          skill += 4;
-        if ( CheckHiredNPCSpeciality(24) )
-	  skill += 8
-
-    case PLAYER_SKILL_LEARNING:
-        if ( CheckHiredNPCSpeciality(13) )
-          skill += 10;
-        if ( CheckHiredNPCSpeciality(14) )
-          skill += 15;
-        if ( CheckHiredNPCSpeciality(4) )
-          skill += 5;
-
-    case PLAYER_SKILL_UNARMED:	
-      if (CheckHiredNPCSpeciality(56) )
-       skill +
-
-    case PLAYER_SKILL_DODGE:
-      if ( CheckHiredNPCSpeciality(56) )
-       skill+
-
-    case PLAYER_SKILL_MERCHANT:
-        if ( CheckHiredNPCSpeciality(20) )
-          skill += 4;
-        if ( CheckHiredNPCSpeciality(21) )
-          skill += 6;
-        if ( CheckHiredNPCSpeciality(48) )
-          skill += 3;
-        if ( CheckHiredNPCSpeciality(50) )
-          skill += 8;
-
-    case PLAYER_SKILL_PERCEPTION:
-      if ( CheckHiredNPCSpeciality(22) )
-        v2 = 6;
-      if ( CheckHiredNPCSpeciality(47) )
-        v2 += 5;
-
-    case PLAYER_SKILL_TRAP_DISARM:
-      if ( CheckHiredNPCSpeciality(25) )
-        v2 = 4;
-      if ( CheckHiredNPCSpeciality(26) )
-        v2 += 6;
-      if ( CheckHiredNPCSpeciality(51) )
-        v2 += 8;
-
-      FIRE WATER EARTH AIR
-          if ( CheckHiredNPCSpeciality(17) )
-            v2 = 2;
-          if ( CheckHiredNPCSpeciality(18) )
-            v2 += 3;
-          if ( CheckHiredNPCSpeciality(19) )
-            v2 += 4;
-          if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() )
-            v2 += 3;
-
-      SPIRIT MIND BODY
-          if ( CheckHiredNPCSpeciality(53) )
-            v2 = 2;
-          if ( CheckHiredNPCSpeciality(54) )
-            v2 += 3;
-          if ( CheckHiredNPCSpeciality(55) )
-            v2 += 4;
-  */
+  unsigned int uProfession; //18
   int greet;  //1c
   int joins;  //20
   int field_24;
--- a/Player.cpp	Tue Mar 12 23:26:43 2013 +0600
+++ b/Player.cpp	Tue Mar 12 23:26:58 2013 +0600
@@ -1965,6 +1965,9 @@
   signed int v6; // ebp@7
   char *v7; // esi@7
   signed int uSkillMultiplier; // [sp-4h] [bp-14h]@2
+  
+  if (CheckHiredNPCSpeciality(Scholar))
+    return true;
 
   v2 = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_ITEM_ID);
   v3 = v2;
@@ -1980,11 +1983,7 @@
       v5 = uSkillMult * (v3 & 0x3F);
       v6 = 0;
       v7 = (char *)&pItemsTable->pItems[pItem->uItemID].pIconName;
-      if ( CheckHiredNPCSpeciality(4) )
-      {
-        v6 = 1;
-        return v6;
-      }
+
       if ( (signed int)SkillToMastery(v3) >= 4 )
         v6 = 1;
       if ( v5 >= (unsigned __int8)v7[46] )
@@ -1997,11 +1996,7 @@
   v5 = uSkillMult * (v3 & 0x3F);
   v6 = 0;
   v7 = (char *)&pItemsTable->pItems[pItem->uItemID].pIconName;
-  if ( CheckHiredNPCSpeciality(4) )
-  {
-    v6 = 1;
-    return v6;
-  }
+
   if ( (signed int)SkillToMastery(v3) >= 4 )
     v6 = 1;
   if ( v5 >= (unsigned __int8)v7[46] )
@@ -2020,6 +2015,13 @@
   char v8; // al@10
   signed int v10; // [sp-4h] [bp-14h]@2
 
+  
+  auto v7 = &pItemsTable->pItems[a2->uItemID];
+  if (CheckHiredNPCSpeciality(Smith) && v7->uEquipType <= 2 ||
+      CheckHiredNPCSpeciality(Armorer) && v7->uEquipType >= 3 && v7->uEquipType <= 9 ||
+      CheckHiredNPCSpeciality(Alchemist) && v7->uEquipType >= 9 )
+    return true;
+
   LOBYTE(v2) = GetActualSkillLevel(PLAYER_SKILL_REPAIR);
   v3 = v2;
   if ( HIBYTE(v2) & 1 )
@@ -2039,11 +2041,6 @@
 LABEL_7:
   v5 = v4 * (v3 & 0x3F);
   v6 = 0;
-  auto v7 = &pItemsTable->pItems[a2->uItemID];
-  if (CheckHiredNPCSpeciality(1) && v7->uEquipType <= 2 ||
-      CheckHiredNPCSpeciality(2) && v7->uEquipType >= 3 && v7->uEquipType <= 9 ||
-      CheckHiredNPCSpeciality(3) && v7->uEquipType >= 9 )
-    return true;
   if ( (signed int)SkillToMastery(v3) >= 4 )
     return true;
   if ( v5 >= *((char *)(v7 + 1) + 2) )
@@ -2629,11 +2626,11 @@
 
   v8 = 0;
   v1 = this;
-  if ( CheckHiredNPCSpeciality(0x1Bu) )
+  if ( CheckHiredNPCSpeciality(Fool) )
     v8 = 5;
-  if ( CheckHiredNPCSpeciality(0x1Cu) )
+  if ( CheckHiredNPCSpeciality(ChimneySweep) )
     v8 += 20;
-  if ( CheckHiredNPCSpeciality(0x2Fu) )
+  if ( CheckHiredNPCSpeciality(Psychic) )
     v8 += 10;
   v2 = v1->sAgeModifier + GetBaseAge();
   v3 = 0;
@@ -4499,7 +4496,7 @@
   v10 = 0;
   v9 = 0;
   v4 = GetRace();
-  if ( CheckHiredNPCSpeciality(0x25u) )
+  if ( CheckHiredNPCSpeciality(Enchanter) )
     v10 = 20;
   if ( (a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE
      || a2 == CHARACTER_ATTRIBUTE_RESIST_AIR
@@ -5653,9 +5650,9 @@
   {
     case PLAYER_SKILL_MONSTER_ID:
     {
-      if ( CheckHiredNPCSpeciality(58) )
+      if ( CheckHiredNPCSpeciality(Hunter) )
         v2 = 6;
-      if ( CheckHiredNPCSpeciality(57) )
+      if ( CheckHiredNPCSpeciality(Sage) )
         v2 += 6;
       v8 = (CHARACTER_ATTRIBUTE_TYPE)20;
       v2 += GetItemsBonus(v8, 0);
@@ -5664,9 +5661,9 @@
 
     case PLAYER_SKILL_ARMSMASTER:
     {
-        if ( CheckHiredNPCSpeciality(15) )
+        if ( CheckHiredNPCSpeciality(Armsmaster) )
           v2 = 2;
-        if ( CheckHiredNPCSpeciality(16) )
+        if ( CheckHiredNPCSpeciality(Weaponsmaster) )
           v2 += 3;
         v8 = (CHARACTER_ATTRIBUTE_TYPE)21;
       v2 += GetItemsBonus(v8, 0);
@@ -5675,7 +5672,7 @@
 
     case PLAYER_SKILL_STEALING:
     {
-      if (CheckHiredNPCSpeciality(51))
+      if (CheckHiredNPCSpeciality(Burglar))
           v2 = 8;
       v8 = (CHARACTER_ATTRIBUTE_TYPE)17;
       v2 += GetItemsBonus(v8, 0);
@@ -5685,9 +5682,9 @@
 
     case PLAYER_SKILL_ALCHEMY:
     {
-        if ( CheckHiredNPCSpeciality(23) )
+        if ( CheckHiredNPCSpeciality(Herbalist) )
           v2 = 4;
-        if ( CheckHiredNPCSpeciality(24) )
+        if ( CheckHiredNPCSpeciality(Apothecary) )
           v2 += 8;
         v8 = (CHARACTER_ATTRIBUTE_TYPE)16;
       v2 += GetItemsBonus(v8, 0);
@@ -5696,11 +5693,11 @@
 
     case PLAYER_SKILL_LEARNING:
     {
-        if ( CheckHiredNPCSpeciality(13) )
+        if ( CheckHiredNPCSpeciality(Teacher) )
           v2 = 10;
-        if ( CheckHiredNPCSpeciality(14) )
+        if ( CheckHiredNPCSpeciality(Instructor) )
           v2 += 15;
-        if ( CheckHiredNPCSpeciality(4) )
+        if ( CheckHiredNPCSpeciality(Scholar) )
           v2 += 5;
         v8 = (CHARACTER_ATTRIBUTE_TYPE)46;
       v2 += GetItemsBonus(v8, 0);
@@ -5709,7 +5706,7 @@
 
     case PLAYER_SKILL_UNARMED:
     {
-      if (CheckHiredNPCSpeciality(56) )
+      if (CheckHiredNPCSpeciality(Monk) )
         v2 = 2;
       v8 = (CHARACTER_ATTRIBUTE_TYPE)23;
       v2 += GetItemsBonus(v8, 0);
@@ -5718,7 +5715,7 @@
 
     case PLAYER_SKILL_DODGE:
     {
-      if ( CheckHiredNPCSpeciality(56) )
+      if ( CheckHiredNPCSpeciality(Monk) )
         v2 = 2;
       v8 = (CHARACTER_ATTRIBUTE_TYPE)22;
       v2 += GetItemsBonus(v8, 0);
@@ -5735,11 +5732,11 @@
     break;
 
     case PLAYER_SKILL_EARTH:
-      if ( CheckHiredNPCSpeciality(17) )
+      if ( CheckHiredNPCSpeciality(Apprentice) )
             v2 = 2;
-          if ( CheckHiredNPCSpeciality(18) )
+          if ( CheckHiredNPCSpeciality(Mystic) )
             v2 += 3;
-          if ( CheckHiredNPCSpeciality(19) )
+          if ( CheckHiredNPCSpeciality(Spellmaster) )
             v2 += 4;
           if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() )
             v2 += 3;
@@ -5747,11 +5744,11 @@
       v2 += GetItemsBonus(v8, 0);
     break;
     case PLAYER_SKILL_FIRE:
-      if ( CheckHiredNPCSpeciality(17) )
+      if ( CheckHiredNPCSpeciality(Apprentice) )
             v2 = 2;
-          if ( CheckHiredNPCSpeciality(18) )
+          if ( CheckHiredNPCSpeciality(Mystic) )
             v2 += 3;
-          if ( CheckHiredNPCSpeciality(19) )
+          if ( CheckHiredNPCSpeciality(Spellmaster) )
             v2 += 4;
           if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() )
             v2 += 3;
@@ -5759,11 +5756,11 @@
       v2 += GetItemsBonus(v8, 0);
     break;
     case PLAYER_SKILL_AIR:
-      if ( CheckHiredNPCSpeciality(17) )
+      if ( CheckHiredNPCSpeciality(Apprentice) )
             v2 = 2;
-          if ( CheckHiredNPCSpeciality(18) )
+          if ( CheckHiredNPCSpeciality(Mystic) )
             v2 += 3;
-          if ( CheckHiredNPCSpeciality(19) )
+          if ( CheckHiredNPCSpeciality(Spellmaster) )
             v2 += 4;
           if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() )
             v2 += 3;
@@ -5771,11 +5768,11 @@
       v2 += GetItemsBonus(v8, 0);
     break;
     case PLAYER_SKILL_WATER:
-      if ( CheckHiredNPCSpeciality(17) )
+      if ( CheckHiredNPCSpeciality(Apprentice) )
             v2 = 2;
-          if ( CheckHiredNPCSpeciality(18) )
+          if ( CheckHiredNPCSpeciality(Mystic) )
             v2 += 3;
-          if ( CheckHiredNPCSpeciality(19) )
+          if ( CheckHiredNPCSpeciality(Spellmaster) )
             v2 += 4;
           if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() )
             v2 += 3;
@@ -5783,31 +5780,31 @@
       v2 += GetItemsBonus(v8, 0);
     break;
     case PLAYER_SKILL_SPIRIT:
-          if ( CheckHiredNPCSpeciality(53) )
+          if ( CheckHiredNPCSpeciality(Acolyte2) )
             v2 = 2;
-          if ( CheckHiredNPCSpeciality(54) )
+          if ( CheckHiredNPCSpeciality(Initiate) )
             v2 += 3;
-          if ( CheckHiredNPCSpeciality(55) )
+          if ( CheckHiredNPCSpeciality(Prelate) )
             v2 += 4;
       v8 = (CHARACTER_ATTRIBUTE_TYPE)38;
       v2 += GetItemsBonus(v8, 0);
     break;
     case PLAYER_SKILL_MIND:
-          if ( CheckHiredNPCSpeciality(53) )
+          if ( CheckHiredNPCSpeciality(Acolyte2) )
             v2 = 2;
-          if ( CheckHiredNPCSpeciality(54) )
+          if ( CheckHiredNPCSpeciality(Initiate) )
             v2 += 3;
-          if ( CheckHiredNPCSpeciality(55) )
+          if ( CheckHiredNPCSpeciality(Prelate) )
             v2 += 4;
       v8 = (CHARACTER_ATTRIBUTE_TYPE)39;
       v2 += GetItemsBonus(v8, 0);
     break;
     case PLAYER_SKILL_BODY:
-          if ( CheckHiredNPCSpeciality(53) )
+          if ( CheckHiredNPCSpeciality(Acolyte2) )
             v2 = 2;
-          if ( CheckHiredNPCSpeciality(54) )
+          if ( CheckHiredNPCSpeciality(Initiate) )
             v2 += 3;
-          if ( CheckHiredNPCSpeciality(55) )
+          if ( CheckHiredNPCSpeciality(Prelate) )
             v2 += 4;
       v8 = (CHARACTER_ATTRIBUTE_TYPE)40;
       v2 += GetItemsBonus(v8, 0);
@@ -5825,22 +5822,22 @@
 
     case PLAYER_SKILL_MERCHANT:
     {
-        if ( CheckHiredNPCSpeciality(20) )
+        if ( CheckHiredNPCSpeciality(Trader) )
           v2 = 4;
-        if ( CheckHiredNPCSpeciality(21) )
+        if ( CheckHiredNPCSpeciality(Merchant) )
           v2 += 6;
-        if ( CheckHiredNPCSpeciality(48) )
+        if ( CheckHiredNPCSpeciality(Gypsy) )
           v2 += 3;
-        if ( CheckHiredNPCSpeciality(50) )
+        if ( CheckHiredNPCSpeciality(Duper) )
           v2 += 8;
     }
     break;
 
     case PLAYER_SKILL_PERCEPTION:
     {
-      if ( CheckHiredNPCSpeciality(22) )
+      if ( CheckHiredNPCSpeciality(Scout) )
         v2 = 6;
-      if ( CheckHiredNPCSpeciality(47) )
+      if ( CheckHiredNPCSpeciality(Psychic) )
         v2 += 5;
     }
     break;
@@ -5855,11 +5852,11 @@
     break;
     case PLAYER_SKILL_TRAP_DISARM:
     {
-      if ( CheckHiredNPCSpeciality(25) )
+      if ( CheckHiredNPCSpeciality(Tinker) )
         v2 = 4;
-      if ( CheckHiredNPCSpeciality(26) )
+      if ( CheckHiredNPCSpeciality(Locksmith) )
         v2 += 6;
-      if ( CheckHiredNPCSpeciality(51) )
+      if ( CheckHiredNPCSpeciality(Burglar) )
         v2 += 8;
       v8 = (CHARACTER_ATTRIBUTE_TYPE)18;
       v2 += GetItemsBonus(v8, 0);
--- a/Player.h	Tue Mar 12 23:26:43 2013 +0600
+++ b/Player.h	Tue Mar 12 23:26:58 2013 +0600
@@ -85,8 +85,8 @@
   SPEECH_68 = 68,
   SPEECH_69 = 69,
   SPEECH_70 = 70,
-  SPEECH_71 = 71,
-  SPEECH_72 = 72,
+  SPEECH_CarriageReady = 71, // travelling by carriage
+  SPEECH_SetSail = 72,       // travelling by sea
   SPEECH_73 = 73,
   SPEECH_74 = 74,
   SPEECH_75 = 75,
--- a/Render.cpp	Tue Mar 12 23:26:43 2013 +0600
+++ b/Render.cpp	Tue Mar 12 23:26:58 2013 +0600
@@ -8137,14 +8137,14 @@
       v31 = v31 * -1.0;
     if ( v4->uTintColor && v26->bTinting )
     {
-      v11 = GetActorTintColor(v8, 0, pSoftBillboarda, 0, 0);
+      v11 = ::GetActorTintColor(v8, 0, pSoftBillboarda, 0, 0);
       v12 = sub_4A19D8(v4->uTintColor, v11);
       if ( v28 )
         v12 = (unsigned int)((char *)&array_77EC08[1852].pEdgeList1[17] + 3) & ((unsigned int)v12 >> 1);
     }
     else
     {
-      v12 = GetActorTintColor(v8, 0, pSoftBillboarda, 0, 0);
+      v12 = ::GetActorTintColor(v8, 0, pSoftBillboarda, 0, 0);
     }
     v13 = (double)v25;
     pBillboardRenderListD3D[v9].pQuards[0].specular = 0;
--- a/UIHouses.cpp	Tue Mar 12 23:26:43 2013 +0600
+++ b/UIHouses.cpp	Tue Mar 12 23:26:58 2013 +0600
@@ -1037,29 +1037,23 @@
     {
       if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
           return;
-      pColorText = pColorYellow;
-      if ( pDialogueWindow->pCurrentPosActiveItem != 2 )
-        pColorText = pColorWhite;
-      sprintf(Dest, format_4E2DC8, pColorText);
-      sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[178], pOutString);
+
+      sprintf(Dest, "\xC" "%05d", pDialogueWindow->pCurrentPosActiveItem == 2 ? pColorYellow : pColorWhite);
+      sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[178], pOutString); // Rent room for %d gold
       strcat(Dest, pTmpBuf2);
       pTextHeight = pFontArrus->CalcTextHeight(Dest, &dialog_window, 0, 0);
       strcat(Dest, "\n \n");
-      pColorText = pColorYellow;
-      if ( pDialogueWindow->pCurrentPosActiveItem != 3 )
-        pColorText = pColorWhite;
-      sprintf(a1, format_4E2DC8, pColorText);
-      sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[86],
-        (signed __int64)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier,
+
+      sprintf(a1, "\xC" "%05d", pDialogueWindow->pCurrentPosActiveItem == 3 ? pColorYellow : pColorWhite);
+      sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[86], // Buy food for %d days for %d gold
+        (unsigned int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier,
          v83);
       strcat(a1, pTmpBuf2);
       v88 = pFontArrus->CalcTextHeight(a1, &dialog_window, 0, 0);
       strcat(a1, "\n \n");
-      pColorText = pColorYellow;
-      if ( pDialogueWindow->pCurrentPosActiveItem != 4 )
-        pColorText = pColorWhite;
-      sprintf(v77, format_4E2DC8, pColorText);
-      strcat(v77, pGlobalTXT_LocalizationStrings[160]);
+
+      sprintf(v77, "\xC" "%05d", pDialogueWindow->pCurrentPosActiveItem == 4 ? pColorYellow : pColorWhite);
+      strcat(v77, pGlobalTXT_LocalizationStrings[160]); // Learn Skills
       v82 = pFontArrus->CalcTextHeight(v77, &dialog_window, 0, 0);
       strcat(v77, "\n \n");
       v75[0] = 0;
@@ -1067,11 +1061,8 @@
       v31 = (signed int)window_SpeakInHouse->ptr_1C;
       if ( v31 >= 108 && v31 <= 120 )
       {
-        pColorText = pColorYellow;
-        if ( pDialogueWindow->pCurrentPosActiveItem != 5 )
-          pColorText = pColorWhite;
-        sprintf(v75, format_4E2DC8, pColorText);
-        strcat(v75, pGlobalTXT_LocalizationStrings[611]);
+        sprintf(v75, "\xC" "%05d", pDialogueWindow->pCurrentPosActiveItem == 5 ? pColorYellow : pColorWhite);
+        strcat(v75, pGlobalTXT_LocalizationStrings[611]); // Play Arcomage
         pTextHeight = pFontArrus->CalcTextHeight(v75, &dialog_window, 0, 0);
       }
       v34 = pDialogueWindow->pStartingPosActiveItem;
@@ -1081,7 +1072,7 @@
       pOutString = (GUIFont *)pDialogueWindow->pStartingPosActiveItem;
       if ( !(v37 ^ v34 < v35) )
       {
-        sprintf(pTmpBuf, "%s%s%s%s", &Dest, &a1, &v77, &v75);
+        sprintf(pTmpBuf, "%s%s%s%s", Dest, a1, v77, v75);
         dialog_window.DrawTitleText(pFontArrus, 0, 146, 0, pTmpBuf, 3);
         return;
       }
@@ -3838,12 +3829,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
@@ -3902,12 +3893,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
 
@@ -3918,31 +3909,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 )
@@ -3957,7 +3949,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);
@@ -3975,7 +3968,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;
@@ -3985,19 +3978,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] )
@@ -4010,24 +4003,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
@@ -4037,7 +4030,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);
             }
@@ -4048,7 +4041,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;
@@ -4058,11 +4051,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;
@@ -4091,7 +4084,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;
@@ -4114,12 +4107,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
@@ -4130,7 +4123,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);
@@ -4156,7 +4149,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));
@@ -4164,7 +4157,7 @@
               }
               else
               {
-                v64 = (char *)i;
+                v64 = (char *)v11;
                 v61 = (char *)(v46 + 1);
                 v59 = pGlobalTXT_LocalizationStrings[537];// "Train to level %d for %d gold"
               }
@@ -4175,7 +4168,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;
@@ -4185,7 +4178,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;
@@ -4193,25 +4186,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_1.cpp	Tue Mar 12 23:26:43 2013 +0600
+++ b/mm7_1.cpp	Tue Mar 12 23:26:58 2013 +0600
@@ -3601,11 +3601,11 @@
 	if(v0->classType == PLAYER_CLASS_WARLOCK)
 		++uRestUI_FoodRequiredToRest;
   }
-  if ( CheckHiredNPCSpeciality(0x1Du) )
+  if ( CheckHiredNPCSpeciality(Porter) )
     --uRestUI_FoodRequiredToRest;
-  if ( CheckHiredNPCSpeciality(0x1Eu) )
+  if ( CheckHiredNPCSpeciality(QuarterMaster) )
     uRestUI_FoodRequiredToRest -= 2;
-  if ( CheckHiredNPCSpeciality(0x30u) )
+  if ( CheckHiredNPCSpeciality(Gypsy) )
     --uRestUI_FoodRequiredToRest;
   if ( uRestUI_FoodRequiredToRest < 1 )
     uRestUI_FoodRequiredToRest = 1;
@@ -3698,7 +3698,7 @@
   Player **ppPlayers; // ecx@1
   Player *pPlayer; // eax@2
   unsigned int v3; // eax@15
-  char v4; // al@17
+  //char v4; // al@17
   bool v5; // eax@21
   GUIButton Dst; // [sp+8h] [bp-DCh]@19
   //double v7; // [sp+C4h] [bp-20h]@17
@@ -3751,18 +3751,18 @@
       _507CD4_RestUI_hourglass_anim_controller = 0;
     }
     v9 = v3;
-    v8 = (double)v3 * 0.001953125 * 120.0;
+    v8 = (double)v3 / 512.0 * 120.0;
     //v7 = v8 + 6.7553994e15;
     HIDWORD(v9) = floorf(v8 + 0.5f);//LODWORD(v7);
-    v4 = (int)floorf(v8 + 0.5f) % 256 + 1;//LOBYTE(v7) + 1;
-    byte_4E2BC8 = v4;
-    if ( (unsigned __int8)(v4) >= 0x78u )
+    hourglass_icon_idx = (int)floorf(v8 + 0.5f) % 256 + 1;//LOBYTE(v7) + 1;
+    //hourglass_icon_idx = v4;
+    if (hourglass_icon_idx >= 120 )
     {
-      v4 = 1;
-      byte_4E2BC8 = 1;
+      //v4 = 1;
+      hourglass_icon_idx = 1;
     }
-    sprintf(pTmpBuf, "hglas%03d", (unsigned __int8)v4);
-    pTexture_RestUI_CurrentHourglassFrame = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pTmpBuf, TEXTURE_16BIT_PALETTE)];
+    sprintf(pTmpBuf, "hglas%03d", hourglass_icon_idx);
+    pTexture_RestUI_CurrentHourglassFrame = pIcons_LOD->LoadTexturePtr(pTmpBuf, TEXTURE_16BIT_PALETTE);
     pRenderer->DrawTextureIndexed(0x10Bu, 0x9Fu, pTexture_RestUI_CurrentHourglassFrame);
     memset(&Dst, 0, 0xBCu);
     Dst.uX = 24;
@@ -3927,11 +3927,11 @@
       }
       while ( (signed int)v2 < v14 );
     }
-    if ( CheckHiredNPCSpeciality(0x1Fu) )
+    if ( CheckHiredNPCSpeciality(Factor) )
       v4 += (signed int)(10 * v4) / 100;
-    if ( CheckHiredNPCSpeciality(0x20u) )
+    if ( CheckHiredNPCSpeciality(Banker) )
       v4 += (signed int)(20 * v4) / 100;
-    if ( CheckHiredNPCSpeciality(0x2Du) )
+    if ( CheckHiredNPCSpeciality(Pirate) )
       v4 += (signed int)(10 * v4) / 100;
     if ( v3 )
     {
--- a/mm7_2.cpp	Tue Mar 12 23:26:43 2013 +0600
+++ b/mm7_2.cpp	Tue Mar 12 23:26:58 2013 +0600
@@ -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;
     }
@@ -9932,10 +9932,10 @@
   }
   
   pAllocator = Allocator::Create();
-  if (!pAllocator->Initialize(26 * 1024))
+  if (!pAllocator->Initialize(48 * 1024))
   {
     MessageBoxW(nullptr,
-                L"Unable to Allocate 26Mb of RAM",
+                L"Unable to Allocate 48Mb of RAM",
                 L"More RAM Memory Required", MB_ICONEXCLAMATION);
     return false;
   }
@@ -10446,7 +10446,7 @@
 }
 
 bool new_sky = false;
-bool change_seasons = false;
+bool change_seasons = true;
 
 //----- (00462C94) --------------------------------------------------------
 bool MM_Main(const wchar_t *pCmdLine)
--- a/mm7_3.cpp	Tue Mar 12 23:26:43 2013 +0600
+++ b/mm7_3.cpp	Tue Mar 12 23:26:58 2013 +0600
@@ -3917,15 +3917,15 @@
   if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor )
     v0 = &pIndoor->dlv;
   v1 = 0;
-  if ( CheckHiredNPCSpeciality(0x2Du) )
-    v1 = 5;
-  if ( CheckHiredNPCSpeciality(0x33u) )
+  if ( CheckHiredNPCSpeciality(Pirate) )
+    v1 += 5;
+  if ( CheckHiredNPCSpeciality(Burglar) )
     v1 += 5;
-  if ( CheckHiredNPCSpeciality(0x30u) )
+  if ( CheckHiredNPCSpeciality(Gypsy) )
     v1 += 5;
-  if ( CheckHiredNPCSpeciality(0x32u) )
+  if ( CheckHiredNPCSpeciality(Duper) )
     v1 += 5;
-  if ( CheckHiredNPCSpeciality(0x34u) )
+  if ( CheckHiredNPCSpeciality(FallenWizard) )
     v1 += 5;
   return v1 + v0->uReputation;
 }
@@ -11946,7 +11946,7 @@
   uBlue = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0, 0xFFu);
   auto bWizardEyeActive = pParty->WizardEyeActive();
   auto uWizardEyeSkillLevel = pParty->WizardEyeSkillLevel();
-  if (CheckHiredNPCSpeciality(0x26u))
+  if (CheckHiredNPCSpeciality(Cartographer))
   {
     bWizardEyeActive = true;
     uWizardEyeSkillLevel = 2;
@@ -13864,13 +13864,13 @@
   signed int v0; // esi@1
 
   v0 = uDefaultTravelTime_ByFoot;
-  if ( CheckHiredNPCSpeciality(5u) )
+  if ( CheckHiredNPCSpeciality(Guide) )
     --v0;
-  if ( CheckHiredNPCSpeciality(6u) )
+  if ( CheckHiredNPCSpeciality(Tracker) )
     v0 -= 2;
-  if ( CheckHiredNPCSpeciality(7u) )
+  if ( CheckHiredNPCSpeciality(Pathfinder) )
     v0 -= 3;
-  if ( CheckHiredNPCSpeciality(0x2Cu) )
+  if ( CheckHiredNPCSpeciality(Explorer) )
     --v0;
   if ( v0 < 1 )
     v0 = 1;
--- a/mm7_4.cpp	Tue Mar 12 23:26:43 2013 +0600
+++ b/mm7_4.cpp	Tue Mar 12 23:26:58 2013 +0600
@@ -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,8 +10811,8 @@
 
 
 //----- (004BC49B) --------------------------------------------------------
-void OnSelectDialogueOption(DIALOGUE_TYPE newDialogueType)
-    {
+void OnSelectNPCDialogueOption(DIALOGUE_TYPE newDialogueType)
+{
     //unsigned int v1; // esi@1
     NPCData *speakingNPC; // ebp@1
     //unsigned int v3; // eax@1
@@ -10830,17 +10830,16 @@
     const char *v15; // [sp-4h] [bp-14h]@60
 
     //v1 = _this;
-    speakingNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID);
+  speakingNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID);
     //v3 = v1;
-    uDialogueType = newDialogueType;
-    if ( !speakingNPC->uFlags )
-        {
-        speakingNPC->uFlags = 1;
+  uDialogueType = newDialogueType;
+  if (!speakingNPC->uFlags)
+  {
+    speakingNPC->uFlags = 1;
         //v3 = uDialogueType;
-        }
-    if ((newDialogueType>DIALOGUE_24)||(newDialogueType<DIALOGUE_19))
-        {
-
+  }
+  if ((newDialogueType > DIALOGUE_24) || (newDialogueType < DIALOGUE_19))
+  {
         if (newDialogueType != DIALOGUE_76)
             {
             if (newDialogueType == DIALOGUE_PROFESSION_DETAILS)
@@ -11350,8 +11349,8 @@
   int v29; // eax@62
   unsigned int v30; // ecx@62
   char *v31; // eax@63
-  char v32; // [sp-3Ch] [bp-2CCh]@62
-  int v33; // [sp-38h] [bp-2C8h]@62
+  MapInfo v32; // [sp-3Ch] [bp-2CCh]@62
+  /*int v33; // [sp-38h] [bp-2C8h]@62
   int v34; // [sp-34h] [bp-2C4h]@62
   int v35; // [sp-30h] [bp-2C0h]@62
   int v36; // [sp-2Ch] [bp-2BCh]@62
@@ -11365,17 +11364,17 @@
   char *v44; // [sp-Ch] [bp-29Ch]@62
   unsigned int v45; // [sp-8h] [bp-298h]@62
   char *v46; // [sp-4h] [bp-294h]@62
-  const char *v47[5]; // [sp+0h] [bp-290h]@7
-  char v48; // [sp+14h] [bp-27Ch]@37
-  char v49; // [sp+78h] [bp-218h]@68
-  char v50; // [sp+DCh] [bp-1B4h]@68
-  char v51; // [sp+140h] [bp-150h]@68
-  char Dest; // [sp+1A4h] [bp-ECh]@36
+  const char *v47[5]; // [sp+0h] [bp-290h]@7*/
+  char v48[100]; // [sp+14h] [bp-27Ch]@37
+  char v49[100]; // [sp+78h] [bp-218h]@68
+  char v50[100]; // [sp+DCh] [bp-1B4h]@68
+  char v51[100]; // [sp+140h] [bp-150h]@68
+  char Dest[100]; // [sp+1A4h] [bp-ECh]@36
   GUIWindow v53; // [sp+208h] [bp-88h]@1
   int v54; // [sp+25Ch] [bp-34h]@36
   int v55; // [sp+260h] [bp-30h]@36
   unsigned int v56; // [sp+264h] [bp-2Ch]@1
-  __int16 v57[2]; // [sp+268h] [bp-28h]@1
+  int v57; // [sp+268h] [bp-28h]@1
   Player *v58; // [sp+26Ch] [bp-24h]@36
   GUIWindow *v59; // [sp+270h] [bp-20h]@1
   unsigned int v60; // [sp+274h] [bp-1Ch]@36
@@ -11394,7 +11393,7 @@
   v53.uFrameX = 483;
   v53.uFrameWidth = 148;
   v53.uFrameZ = 334;
-  *(int *)v57 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
+  v57 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
   v56 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
   v3 = 52 * (unsigned int)v0->ptr_1C;
   //v59 = (GUIWindow *)((((p2DEvents_minus1___00[v3 / 2] != 27) - 1) & 0xFFFFFFE7) + 50);
@@ -11414,8 +11413,8 @@
       v17 = LOBYTE(pFontArrus->uFontHeight) - 3;
       v59 = pDialogueWindow;
       v54 = v17;
-      strcpy(&Dest, "");
-      sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[405], s1);
+      strcpy(Dest, "");
+      sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[405], s1); // Price: %lu gold
       v18 = pFontArrus->CalcTextHeight(pTmpBuf2, &v53, 0, 0);
       v19 = v16->pNumPresenceButton;
       v20 = v18 + v17 + 146;
@@ -11426,13 +11425,13 @@
       if ( v21 >= v21 + v19 )
         goto LABEL_71;
       s1 = 2;
-      a1 = &v48;
+      a1 = v48;
       while ( 1 )
       {
-        v47[1] = (const char *)v60;
+        int v47 = v60;
         v22 = window_SpeakInHouse->ptr_1C;
-        v23 = (Player *)(unsigned __int8)*(&_4F0D38_TravelInfo[4 * (signed int)v22] + v62);
-        v61 = (Player *)(unsigned __int8)*(&_4F0D38_TravelInfo[4 * (signed int)v22] + v62);
+        v23 = (Player *)(unsigned __int8)*(&_4F0D38_TravelInfo[4 * (unsigned int)v22] + v62); // negindex. actual address is around + 0x36
+        v61 = (Player *)(unsigned __int8)*(&_4F0D38_TravelInfo[4 * (unsigned int)v22] + v62); // + 0x3F for sea travels, less for land
         v24 = v16->GetControl(v60);
         if ( v23 != v58
           && ((signed int)s1 >= 6 ? (v25 = 1) : (v25 = (unsigned __int8)*(&byte_4F09B1[32 * (int)v23]
@@ -11444,49 +11443,35 @@
           v58 = v61;
           v27 = (const char *)v56;
           if ( pDialogueWindow->pCurrentPosActiveItem != s1 )
-            v27 = *(const char **)v57;
-          v47[1] = v27;
-          sprintf(a1, format_4E2DC8, v27);
+            v27 = (const char *)v57;
+          //v32.uRedbookTrackID = v27;
+          sprintf(a1, "\xC" "%05d", v27);
           v66 = (unsigned __int8)byte_4F09B8[v26 * 4];
           if ( (signed int)window_SpeakInHouse->ptr_1C >= 63 )
           {
-            if ( CheckHiredNPCSpeciality(8u) )
+            if ( CheckHiredNPCSpeciality(Sailor) )
               v66 -= 2;
-            if ( CheckHiredNPCSpeciality(9u) )
+            if ( CheckHiredNPCSpeciality(Navigator) )
               v66 -= 3;
-            v47[1] = (const char *)45;
+            //v47 = Pirate;
+            if ( CheckHiredNPCSpeciality(Pirate) )
+              v66 -= 2;
           }
           else
           {
-            v47[1] = (const char *)35;
-          }
-          if ( CheckHiredNPCSpeciality((unsigned int)v47[1]) )
-            v66 -= 2;
-          if ( CheckHiredNPCSpeciality(0x2Cu) )
+            //v47 = Horseman;
+            if ( CheckHiredNPCSpeciality(Horseman) )
+              v66 -= 2;
+          }
+          if ( CheckHiredNPCSpeciality(Explorer) )
             --v66;
           if ( v66 < 1 )
             v66 = 1;
           if ( v61 != (Player *)v2 )
           {
-            memcpy(&v32, (char *)&pMapStats + 68 * (unsigned __int8)byte_4F09B0[v26 * 4], 0x44u);
-            sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[404],
-              v66,
-              *(int *)&v32,
-              v33,
-              v34,
-              v35,
-              v36,
-              v37,
-              v38,
-              v39,
-              v40,
-              v41,
-              v42,
-              v43,
-              v44,
-              v45,
-              v46,
-              *(_QWORD *)v47);
+            memcpy(&v32, &pMapStats->pInfos[(unsigned __int8)byte_4F09B0[v26 * 4]], 0x44u);
+            sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[404], // Time - %d days, destination %s
+              v66, v32.pName);
             strcat(a1, pTmpBuf);
             v28 = a1;
             a1 += 100;
@@ -11523,23 +11508,20 @@
       }
       if ( v63 != v55 )
       {
-        v47[1] = &Dest;
+        /*v47[1] = &Dest;
         v47[0] = &v51;
         v46 = &v50;
         v45 = (unsigned int)&v49;
         v44 = &v48;
-        v43 = pTmpBuf2;
-        sprintf(pTmpBuf, "%s\n \n%s%s%s%s%s", pTmpBuf2, &v48, &v49, &v50, &v51, &Dest);
+        v43 = pTmpBuf2;*/
+        sprintf(pTmpBuf, "%s\n \n%s%s%s%s%s", pTmpBuf2, v48, v49, v50, v51, Dest);
         v53.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
       }
       else
       {
 LABEL_71:
-        v47[1] = (const char *)3;
-        v47[0] = pGlobalTXT_LocalizationStrings[561];
-        v46 = *(char **)v57;
-        v45 = (174 - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[561], &v53, 0, 0)) / 2 + 138;
-        v53.DrawTitleText(pFontArrus, 0, v45, (unsigned __int16)v46, v47[0], (unsigned int)v47[1]);
+        v53.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[561], &v53, 0, 0)) / 2 + 138,
+                          v57, pGlobalTXT_LocalizationStrings[561], 3);
         pAudioPlayer->StopChannels(-1, -1);
       }
     }
@@ -11560,8 +11542,8 @@
         pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
       }
       Party::TakeGold(s1);
-      v47[1] = (const char *)7;
-      v5 = &byte_4F09B0[32 * (unsigned __int8)*(&byte_4F0CCF[4 * (unsigned int)window_SpeakInHouse->ptr_1C] + dialog_menu_id)];
+      //v47[1] = (const char *)7;
+      v5 = &byte_4F09B0[32 * (unsigned __int8)*(&byte_4F0CCF[4 * (unsigned int)window_SpeakInHouse->ptr_1C] + dialog_menu_id)];  // negindex with ptr_1C around +0x36
       if ( v5[pParty->uDaysPlayed % 7 + 1] )
       {
         if ( _strcmpi(pCurrentMapName, pMapStats->pInfos[(unsigned __int8)*v5].pFilename) )
@@ -11597,25 +11579,28 @@
         }
         HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2);
         v12 = (unsigned __int8)v5[8];
+        int _v47;
         if ( (signed int)window_SpeakInHouse->ptr_1C >= 63 )
         {
-          v63 = SPEECH_72;
+          v63 = SPEECH_SetSail;
           v13 = 2500;
-          if ( CheckHiredNPCSpeciality(8u) )
+          if ( CheckHiredNPCSpeciality(Sailor) )
             v12 -= 2;
-          if ( CheckHiredNPCSpeciality(9u) )
+          if ( CheckHiredNPCSpeciality(Navigator) )
             v12 -= 3;
-          v47[1] = (const char *)45;
+          //_v47 = 45;
+          if ( CheckHiredNPCSpeciality(Pirate) )
+            v12 -= 2;
         }
         else
         {
-          v63 = SPEECH_71;
+          v63 = SPEECH_CarriageReady;
           v13 = 1500;
-          v47[1] = (const char *)35;
-        }
-        if ( CheckHiredNPCSpeciality((unsigned int)v47[1]) )
-          v12 -= 2;
-        if ( CheckHiredNPCSpeciality(0x2Cu) )
+          //_v47 = 35;
+          if ( CheckHiredNPCSpeciality(Horseman) )
+            v12 -= 2;
+        }
+        if ( CheckHiredNPCSpeciality(Explorer) )
           --v12;
         if ( v12 < 1 )
           v12 = 1;
--- a/mm7_5.cpp	Tue Mar 12 23:26:43 2013 +0600
+++ b/mm7_5.cpp	Tue Mar 12 23:26:58 2013 +0600
@@ -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);
@@ -15116,10 +15116,10 @@
 			break;
 			}
 		case WINDOW_Rest:
-			{
+	    {
 			RestUI_Draw();
 			break;
-			}
+		}
 		case WINDOW_Dialogue:
 			{
 			DrawDialogueUI();
@@ -16641,21 +16641,21 @@
   {
     strcpy(a2, "%s\n\n");
     v24 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 1);
-    sprintf(Source, format_4E2DC8, v24);
+    sprintf(Source, "\xC" "%05d", v24);
     strcat(a2, Source);
     strcat(a2, "%s\t%03d:\t%03d%s\t000\n");
     v25 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 2);
-    sprintf(Source, format_4E2DC8, v25);
+    sprintf(Source, "\xC" "%05d", v25);
     strcat(a2, Source);
     strcat(a2, "%s\t%03d:\t%03d%s\t000\n");
     v26 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 3);
-    sprintf(Source, format_4E2DC8, v26);
+    sprintf(Source, "\xC" "%05d", v26);
     strcat(a2, Source);
     strcat(a2, "%s\t%03d:\t%03d%s\t000\n");
     v27 = pPlayer->classType;
     v28 = uPlayerSkillType;
     v29 = GetSkillColor(v27, uPlayerSkillType, 4);
-    sprintf(Source, format_4E2DC8, v29);
+    sprintf(Source, "\xC" "%05d", v29);
     strcat(a2, Source);
     strcat(a2, "%s\t%03d:\t%03d%s\t000\n");
 
@@ -16670,24 +16670,24 @@
   {
     strcpy(a2, "%s\n\n");
     v9 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 1);
-    sprintf(Source, format_4E2DC8, v9);
+    sprintf(Source, "\xC" "%05d", v9);
     strcat(a2, Source);
     strcat(a2, "%s\t%03d:\t%03d%s\t000\n");
     v10 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 2);
-    sprintf(Source, format_4E2DC8, v10);
+    sprintf(Source, "\xC" "%05d", v10);
     strcat(a2, Source);
     strcat(a2, "%s\t%03d:\t%03d%s\t000\n");
     v11 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 3);
-    sprintf(Source, format_4E2DC8, v11);
+    sprintf(Source, "\xC" "%05d", v11);
     strcat(a2, Source);
     strcat(a2, "%s\t%03d:\t%03d%s\t000\n");
     v12 = uPlayerSkillType;
     v13 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 4);
-    sprintf(Source, format_4E2DC8, v13);
+    sprintf(Source, "\xC" "%05d", v13);
     strcat(a2, Source);
     strcat(a2, "%s\t%03d:\t%03d%s\t000\n\n");
     v14 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
-    sprintf(Source, format_4E2DC8, v14);
+    sprintf(Source, "\xC" "%05d", v14);
     strcat(a2, Source);
     strcat(a2, "%s: +%d");
     v15 = v12;
@@ -17139,7 +17139,7 @@
   v2 = pIcons_LOD->LoadTexture("fr_stats", TEXTURE_16BIT_PALETTE);
   pRenderer->DrawTextureIndexed(8, 8, (Texture *)(v2 != -1 ? (int)&pIcons_LOD->pTextures[v2] : 0));
   v3 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
-  sprintf(pTmpBuf, format_4E2DC8, v3);
+  sprintf(pTmpBuf, "\xC" "%05d", v3);
   sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[429], pPlayer->pName, pClassNames[pPlayer->classType]);//^Pi[%s] %s
   strcat(pTmpBuf, pTmpBuf2);
   if ( pPlayer->uSkillPoints )
--- a/mm7_6.cpp	Tue Mar 12 23:26:43 2013 +0600
+++ b/mm7_6.cpp	Tue Mar 12 23:26:58 2013 +0600
@@ -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	Tue Mar 12 23:26:43 2013 +0600
+++ b/mm7_data.cpp	Tue Mar 12 23:26:58 2013 +0600
@@ -487,7 +487,7 @@
 char _4E2AD8_ui_colors[72];
 char _4E2B21_buff_spell_tooltip_colors[80];
 char byte_4E2B70[777]; // weak
-char byte_4E2BC8; // weak
+unsigned char hourglass_icon_idx = 12; // weak
 
 char aSS[777]; // idb
 char ascii_4E2C54[6];
@@ -524,7 +524,7 @@
 char format_4E2D90[8];
 char aS03d03dS000_0[777]; // idb
 char aS03d03dS000[777]; // idb
-const char *format_4E2DC8 = "\f%05d";
+//const char *format_4E2DC8 = "\f%05d";
 char aS[777]; // idb
 char aLuSLuS[777]; // idb
 char byte_4E2DE8; // idb
@@ -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	Tue Mar 12 23:26:43 2013 +0600
+++ b/mm7_data.h	Tue Mar 12 23:26:58 2013 +0600
@@ -473,7 +473,7 @@
 extern char _4E2AD8_ui_colors[72];
 extern char _4E2B21_buff_spell_tooltip_colors[80];
 extern char byte_4E2B70[]; // weak
-extern char byte_4E2BC8; // weak
+extern unsigned char hourglass_icon_idx; // weak
 
 extern char aSS[]; // idb
 extern char ascii_4E2C54[6];
@@ -510,7 +510,7 @@
 extern char format_4E2D90[8];
 extern char aS03d03dS000_0[]; // idb
 extern char aS03d03dS000[]; // idb
-extern const char *format_4E2DC8;
+//extern const char *format_4E2DC8;
 extern char aS[]; // idb
 extern char aLuSLuS[]; // idb
 extern char byte_4E2DE8; // idb
@@ -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	Tue Mar 12 23:26:43 2013 +0600
+++ b/mm7text_ru.cpp	Tue Mar 12 23:26:58 2013 +0600
@@ -874,6 +874,7 @@
   {"", 0},
   {"", 0},
   {"", 0},
+  {"", 0},
   {"", 1},
   {"", 0},
   {"", 0},
@@ -1165,8 +1166,9 @@
   char buf[8192];
   assert(strlen(str) < sizeof(buf));
 
-  bool integer_token_defined = false;
-  int integer_token = 0;
+  int next_integer_token = 0;
+  bool integer_tokens_defined[10] = {false, false, false, false, false, false, false, false, false, false};
+  int integer_tokens[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
 
   bool gender_token_defined = false;
   int gender_token = 0;
@@ -1183,9 +1185,10 @@
         if (src[2] != '[')
           goto _invalid_token;
         src += 3;  // ^I[
-
-        if (sscanf(src, "%d", &integer_token))
-          integer_token_defined = true;
+        
+        assert(next_integer_token < 10);
+        if (sscanf(src, "%d", &integer_tokens[next_integer_token]))
+          integer_tokens_defined[next_integer_token++] = true;
 
         auto int_begin = src;
         while (*src++ != ']');
@@ -1198,9 +1201,19 @@
 
       case 'L':
       {
-        if (src[2] != '[')
+        int integer_token_idx = 0;
+        if (src[2] >= '1' && src[2] <= '9')
+        {
+          if (src[3] != '[')
+            goto _invalid_token;
+          integer_token_idx = src[2] - '1';
+
+          src += 1;
+        }
+        else if (src[2] != '[')
           goto _invalid_token;
-        assert(integer_token_defined);
+
+        assert(integer_tokens_defined[integer_token_idx]);
         src += 3; // ^L[
 
         auto ending1 = src;
@@ -1213,7 +1226,7 @@
         char *actual_ending = nullptr;
         int   actual_ending_len = 0;
 
-        int modulo = abs(integer_token) % 10;
+        int modulo = abs(integer_tokens[integer_token_idx]) % 10;
         if (modulo == 1)
         {
           actual_ending = ending1;
@@ -1328,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);
--- a/texts.cpp	Tue Mar 12 23:26:43 2013 +0600
+++ b/texts.cpp	Tue Mar 12 23:26:58 2013 +0600
@@ -305,7 +305,7 @@
 	aNPCProfessionNames[27] = pGlobalTXT_LocalizationStrings[329];
 	aNPCProfessionNames[28] = pGlobalTXT_LocalizationStrings[330];
 	aNPCProfessionNames[29] = pGlobalTXT_LocalizationStrings[331];
-	aNPCProfessionNames[20] = pGlobalTXT_LocalizationStrings[332];
+	aNPCProfessionNames[30] = pGlobalTXT_LocalizationStrings[332];
 	aNPCProfessionNames[31] = pGlobalTXT_LocalizationStrings[333];
 	aNPCProfessionNames[32] = pGlobalTXT_LocalizationStrings[334];
 	aNPCProfessionNames[33] = pGlobalTXT_LocalizationStrings[335];