changeset 2243:9e1bd714d1d2

Слияние
author Ritor1
date Mon, 24 Feb 2014 16:19:09 +0600
parents c4f87fb3cfee (current diff) 9df0477a5e2b (diff)
children 66c509997062
files
diffstat 6 files changed, 269 insertions(+), 347 deletions(-) [+]
line wrap: on
line diff
--- a/GUIWindow.h	Mon Feb 24 16:19:01 2014 +0600
+++ b/GUIWindow.h	Mon Feb 24 16:19:09 2014 +0600
@@ -239,6 +239,7 @@
   DIALOGUE_EVT_F = 0x18,
   DIALOGUE_76 = 76,
   DIALOGUE_PROFESSION_DETAILS = 77,
+  DIALOGUE_SKILL_TRAINER = 78,
   DIALOGUE_84 = 84,
   DIALOGUE_ARENA_SELECT_PAGE = 85,
   DIALOGUE_ARENA_SELECT_SQUIRE = 86,
--- a/NPC.cpp	Mon Feb 24 16:19:01 2014 +0600
+++ b/NPC.cpp	Mon Feb 24 16:19:09 2014 +0600
@@ -1442,7 +1442,7 @@
           {
             v12 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number];
             *(short *)v12 &= 0x3Fu;
-            switch ( dword_F8B1B0 )
+            switch ( dword_F8B1B0_MasteryBeingTaught )
             {
               case 2:
                 v15 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number];
--- a/mm7_4.cpp	Mon Feb 24 16:19:01 2014 +0600
+++ b/mm7_4.cpp	Mon Feb 24 16:19:09 2014 +0600
@@ -1823,372 +1823,293 @@
 }
 
 //----- (004B254D) --------------------------------------------------------
-char * _4B254D_SkillMasteryTeacher(int _this)
+const char * _4B254D_SkillMasteryTeacher(int trainerInfo)
 {
-  //Player *v1; // esi@1
-  int v2; // edx@1
-  int v3; // ecx@1
-  int v4; // edi@1
+  int teacherLevel; // edx@1
+  int skillBeingTaught; // ecx@1
   int pClassType; // eax@7
-  int v6; // eax@7
-  int v7; // ebx@7
-  //int v8; // ebx@8
-  signed int v9; // esi@8
-  int v10; // eax@8
-  char *v11; // ecx@8
-  //int v12; // edi@9
-  //char *v13; // edx@9
-  signed int v14; // edi@10
-  unsigned int v16; // eax@29
-  //int v17; // eax@36
-  char v18; // cl@46
-  __int16 v19; // dx@56
-  int v20; // eax@60
-  //char *v21; // [sp-Ch] [bp-38h]@82
-  //const char *v22; // [sp-8h] [bp-34h]@21
-  //unsigned int v23; // [sp-8h] [bp-34h]@38
-  //char *v24; // [sp-8h] [bp-34h]@82
-  const char *v25; // [sp-4h] [bp-30h]@14
-  //int v26; // [sp-4h] [bp-30h]@38
-  //int v27; // [sp-4h] [bp-30h]@82
-  char v28[4]; // [sp+Ch] [bp-20h]@9
-  int v29; // [sp+10h] [bp-1Ch]@13
-  int v30; // [sp+14h] [bp-18h]@15
-  int v31; // [sp+18h] [bp-14h]@16
-  unsigned __int16 a1[2]; // [sp+1Ch] [bp-10h]@7
-  //int v33; // [sp+20h] [bp-Ch]@7
-  int v34; // [sp+24h] [bp-8h]@7
-  char *v35; // [sp+28h] [bp-4h]@1
+  int currClassMaxMastery; // eax@7
+  int pointsInSkillWOutMastery; // ebx@7
+  int classBaseId; // eax@8
+  unsigned int skillMastery; // eax@29
+  unsigned __int16 pointsInSkill; // [sp+1Ch] [bp-10h]@7
+  int masteryLevelBeingTaught; // [sp+24h] [bp-8h]@7
 
   contract_approved = 0;
-  v2 = (_this - 200) % 3;
-  v3 = (_this - 200) / 3;
-  v4 = v2;
-  v35 = (char *)pNPCTopics[127].pText;
-  dword_F8B1AC_award_bit_number = v3;
-  if ( v2 )
-  {
-    if ( v2 == 1 )
-    {
-      gold_transaction_amount = 5000;
-      dword_F8B1B0 = 3;
-    }
-    else
-    {
-      if ( v2 == 2 )
-      {
-        gold_transaction_amount = 8000;
-        dword_F8B1B0 = 4;
-      }
-    }
-  }
-  else
-  {
-    gold_transaction_amount = 2000;
-    dword_F8B1B0 = 2;
-  }
-  pClassType = pPlayers[uActiveCharacter]->classType;
-  //v33 = pClassType;
-  v6 = byte_4ED970_skill_learn_ability_by_class_table[pClassType][v3];
-  *(int *)a1 = pPlayers[uActiveCharacter]->pActiveSkills[v3];
-  v7 = a1[0] & 0x3F;
-  v34 = v2 + 2;
-  if ( v6 < v2 + 2 )
+  teacherLevel = (trainerInfo - 200) % 3;
+  skillBeingTaught = (trainerInfo - 200) / 3;
+  Player* activePlayer = pPlayers[uActiveCharacter];
+  pClassType = activePlayer->classType;
+  currClassMaxMastery = byte_4ED970_skill_learn_ability_by_class_table[pClassType][skillBeingTaught];
+  masteryLevelBeingTaught = teacherLevel + 2;
+  dword_F8B1B0_MasteryBeingTaught = masteryLevelBeingTaught;
+  if ( currClassMaxMastery < masteryLevelBeingTaught )
   {
-    //v8 = v33;
-    
-    v10 = pClassType - pClassType % 4;
-    v11 = &byte_4ED970_skill_learn_ability_by_class_table[pClassType - pClassType % 4][v3];
-    for ( v9 = 0; v9 < 4; ++v9 )
-    {
-      v28[4 * v9] = 0;
-      if ( (unsigned __int8)*v11 < v34 )
-      {
-        v14 = 1;
-      }
-      else
-      {
-        v14 = 1;
-        v28[4 * v9] = 1;
-      }
-      v11 += 37;
-    }
-    __debugbreak(); // warning C4700: uninitialized local variable 'v29' used
-    if ( v29 == v14 )
-    {
-      v25 = pClassNames[v10 + 1];
-    }
+    classBaseId = pClassType - pClassType % 4;
+    if (byte_4ED970_skill_learn_ability_by_class_table[classBaseId + 1][skillBeingTaught] >= masteryLevelBeingTaught)
+      sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[633], pClassNames[classBaseId + 1]);//    %s     . You have to be promoted to %s to learn this skill level.
+    else if (byte_4ED970_skill_learn_ability_by_class_table[classBaseId + 2][skillBeingTaught] >= masteryLevelBeingTaught
+      && byte_4ED970_skill_learn_ability_by_class_table[classBaseId + 3][skillBeingTaught] >= masteryLevelBeingTaught)
+      sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[634], pClassNames[classBaseId + 2], pClassNames[classBaseId + 3]);//    %s  %s     . You have to be promoted to %s or %s to learn this skill level.
+    else if (byte_4ED970_skill_learn_ability_by_class_table[classBaseId + 2][skillBeingTaught] >= masteryLevelBeingTaught)
+      sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[633], pClassNames[classBaseId + 2]);//    %s     . You have to be promoted to %s to learn this skill level.
+    else if (byte_4ED970_skill_learn_ability_by_class_table[classBaseId + 3][skillBeingTaught] >= masteryLevelBeingTaught)
+      sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[633], pClassNames[classBaseId + 3]);//    %s     . You have to be promoted to %s to learn this skill level.
     else
-    {
-      __debugbreak(); // warning C4700: uninitialized local variable 'v30' used
-      if ( v30 == v14 )//crash
-      {
-        __debugbreak(); // warning C4700: uninitialized local variable 'v31' used
-        if ( v31 == v14 )
-        {
-          sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[634], pClassNames[v10 + 2], pClassNames[v10 + 3]);//    %s  %s     .
-          return pTmpBuf.data();
-        }
-        v25 = pClassNames[v10 + 2];
-      }
-      else
-      {
-        if ( v31 != v14 )
-        {
-          sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[632], pClassNames[pClassType]);//        %s.
-          return pTmpBuf.data();
-        }
-        v25 = pClassNames[v10 + 3];
-      }
-    }
-    sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[633], v25);//    %s     .
+      sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[632], pClassNames[pClassType]);//        %s. This skill level can not be learned by the %s class.
     return pTmpBuf.data();
   }
-  if ( !pPlayers[uActiveCharacter]->CanAct() )
-    return (char *)pNPCTopics[122].pText;
-  if ( !v7 )
-    return (char *)pNPCTopics[131].pText;
-  v16 = SkillToMastery(a1[0]);
-  if ( (signed int)v16 > v4 + 1 )
-    return (char *)pNPCTopics[v4 + 128].pText;
-  if ( v34 != 2 )
+  if ( !activePlayer->CanAct() )
+    return pNPCTopics[122].pText; //Not in your condition!
+  pointsInSkill = activePlayer->pActiveSkills[skillBeingTaught];
+  pointsInSkillWOutMastery = pointsInSkill & 0x3F;
+  if ( !pointsInSkillWOutMastery )
+    return pNPCTopics[131].pText; //You must know the skill before you can become an expert in it!
+  skillMastery = SkillToMastery(pointsInSkill);
+  if ( (signed int)skillMastery > teacherLevel + 1 )  
+    return pNPCTopics[teacherLevel + 128].pText;    // You are already an SKILLLEVEL in this skill.	
+  dword_F8B1AC_award_bit_number = skillBeingTaught;
+  if ( masteryLevelBeingTaught == 2 && pointsInSkillWOutMastery < 4 
+    || masteryLevelBeingTaught == 3 && pointsInSkillWOutMastery < 7
+    || masteryLevelBeingTaught == 4 && pointsInSkillWOutMastery < 10
+    )
+    return pNPCTopics[127].pText;  //"You don't meet the requirements, and cannot be taught until you do."
+  switch (dword_F8B1AC_award_bit_number)
   {
-    if ( v34 == 3 )
-    {
-      if ( (signed int)v16 >= 2 && v7 >= 7 )
+    case PLAYER_SKILL_STAFF:
+    case PLAYER_SKILL_SWORD:
+    case PLAYER_SKILL_DAGGER:
+    case PLAYER_SKILL_AXE:
+    case PLAYER_SKILL_SPEAR:
+    case PLAYER_SKILL_BOW:
+    case PLAYER_SKILL_MACE:
+    case PLAYER_SKILL_ARMSMASTER:
+      switch (masteryLevelBeingTaught)
+      {
+      case 2:
+        gold_transaction_amount = 2000;
+        break;
+      case 3:
+        gold_transaction_amount = 5000;
+        break;
+      case 4:
+        gold_transaction_amount = 8000;
+        break;
+      }
+      break;
+    case PLAYER_SKILL_BLASTER:
+      switch (masteryLevelBeingTaught)
       {
-        switch ( dword_F8B1AC_award_bit_number )
-        {
-          case 12:
-          case 13:
-          case 14:
-          case 15:
-          case 16:
-          case 17:
-          case 18:
-            gold_transaction_amount = 4000;
-            goto LABEL_42;
-          case 19:
-            v19 = 114;
-            if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v19) )
-              return v35;
-            if ( !gold_transaction_amount )
-              goto LABEL_79;
-            goto LABEL_42;
-          case 20:
-            v19 = 110;
-            if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v19) )
-              return v35;
-            if ( !gold_transaction_amount )
-              goto LABEL_79;
-            goto LABEL_42;
-          case 22:
-            v20 = pPlayers[uActiveCharacter]->GetBaseWillpower();
-            if ( v20 < 50 )
-              return v35;
-            if ( !gold_transaction_amount )
-              goto LABEL_79;
-            goto LABEL_42;
-          case 24:
-            gold_transaction_amount = 2500;
-            v20 = pPlayers[uActiveCharacter]->GetBaseEndurance();
-            if ( v20 < 50 )
-              return v35;
-            if ( !gold_transaction_amount )
-              goto LABEL_79;
-            goto LABEL_42;
-          case 36:
-            v20 = pPlayers[uActiveCharacter]->GetBaseIntelligence();
-            if ( v20 < 50 )
-              return v35;
-            if ( !gold_transaction_amount )
-              goto LABEL_79;
-            goto LABEL_42;
-          case 21:
-          case 23:
-          case 25:
-          case 26:
-          case 29:
-          case 32:
-          case 34:
-          case 35:
-            gold_transaction_amount = 2500;
-            goto LABEL_42;
-          case 8:
-          case 9:
-          case 10:
-          case 11:
-            gold_transaction_amount = 3000;
-            goto LABEL_42;
-          case 7:
-            gold_transaction_amount = 0;
-            if ( !gold_transaction_amount )
-              goto LABEL_79;
-            goto LABEL_42;
-          default:
-            if ( !gold_transaction_amount )
-              goto LABEL_79;
-            goto LABEL_42;
-        }
+      case 2:
+        gold_transaction_amount = 0;
+        break;
+      case 3:
+        gold_transaction_amount = 0;
+        break;
+      case 4:
         gold_transaction_amount = 0;
-        if ( !gold_transaction_amount )
-          goto LABEL_79;
-        goto LABEL_42;
+        break;
+      }
+      break;
+    case PLAYER_SKILL_SHIELD:
+    case PLAYER_SKILL_LEATHER:
+    case PLAYER_SKILL_CHAIN:
+    case PLAYER_SKILL_PLATE:
+      switch (masteryLevelBeingTaught)
+      {
+      case 2:
+        gold_transaction_amount = 1000;
+        break;
+      case 3:
+        gold_transaction_amount = 3000;
+        break;
+      case 4:
+        gold_transaction_amount = 7000;
+        break;
       }
-    }
-    else
-    {
-      if ( v34 != 4 )
+      break;
+    case PLAYER_SKILL_FIRE:
+    case PLAYER_SKILL_AIR:
+    case PLAYER_SKILL_WATER:
+    case PLAYER_SKILL_EARTH:
+    case PLAYER_SKILL_SPIRIT:
+    case PLAYER_SKILL_MIND:
+    case PLAYER_SKILL_BODY:
+      switch (masteryLevelBeingTaught)
       {
-        if ( !gold_transaction_amount )
-          goto LABEL_79;
-        goto LABEL_42;
+      case 2:
+        gold_transaction_amount = 1000;
+        break;
+      case 3:
+        gold_transaction_amount = 4000;
+        break;
+      case 4:
+        gold_transaction_amount = 8000;
+        break;
       }
-      if ( (signed int)v16 >= 3 && v7 >= 10 )
+      break;
+    case PLAYER_SKILL_LIGHT:
+      switch (masteryLevelBeingTaught)
+      {
+      case 2:
+        gold_transaction_amount = 2000;
+        break;
+      case 3:
+        if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 114) )
+          return pNPCTopics[127].pText;
+        gold_transaction_amount = 5000;
+        break;
+      case 4:
+        if ( !activePlayer->ProfessionOrGuildFlagsCorrect(0x22u, 1) ||
+          !activePlayer->ProfessionOrGuildFlagsCorrect(0x1Au, 1))
+          return pNPCTopics[127].pText;
+        gold_transaction_amount = 8000;
+        break;
+      }
+      break;
+    case PLAYER_SKILL_DARK:
+      switch (masteryLevelBeingTaught)
       {
-        switch ( dword_F8B1AC_award_bit_number )
-        {
-          case 19:
-            if ( pPlayers[uActiveCharacter]->ProfessionOrGuildFlagsCorrect(0x22u, 1) == 1 )
-            {
-              if ( !gold_transaction_amount )
-                goto LABEL_79;
-              goto LABEL_42;
-            }
-            if ( pPlayers[uActiveCharacter]->ProfessionOrGuildFlagsCorrect(0x1Au, 1) == 1 )
-            {
-              if ( !gold_transaction_amount )
-                goto LABEL_79;
-              goto LABEL_42;
-            }
-            return v35;
-          case 20:
-            if ( pPlayers[uActiveCharacter]->ProfessionOrGuildFlagsCorrect(0x23u, 1) == 1 )
-            {
-              if ( !gold_transaction_amount )
-                goto LABEL_79;
-              goto LABEL_42;
-            }
-            if ( pPlayers[uActiveCharacter]->ProfessionOrGuildFlagsCorrect(0x1Bu, 1) == 1 )
-            {
-              if ( !gold_transaction_amount )
-                goto LABEL_79;
-              goto LABEL_42;
-            }
-            return v35;
-          case 30:
-            v18 = LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[PLAYER_SKILL_UNARMED]);
-            if ( (v18 & 0x3Fu) < 0xA )
-              return v35;
-            if ( !gold_transaction_amount )
-              goto LABEL_79;
-            goto LABEL_42;
-          case 31:
-            v18 = LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[PLAYER_SKILL_DODGE]);
-            if ( (v18 & 0x3Fu) < 0xA )
-              return v35;
-            if ( !gold_transaction_amount )
-              goto LABEL_79;
-            goto LABEL_42;
-          case 21:
-          case 23:
-          case 24:
-          case 25:
-          case 26:
-          case 29:
-          case 32:
-          case 34:
-          case 35:
-            gold_transaction_amount = 6000;
-            goto LABEL_42;
-          case 8:
-          case 9:
-          case 10:
-          case 11:
-            gold_transaction_amount = 7000;
-            goto LABEL_42;
-          case 7:
-            break;
-          default:
-            if ( !gold_transaction_amount )
-              goto LABEL_79;
-            goto LABEL_42;
-        }
-        gold_transaction_amount = 0;
-        if ( !gold_transaction_amount )
-          goto LABEL_79;
-        goto LABEL_42;
+      case 2:
+        gold_transaction_amount = 2000;
+        break;
+      case 3:
+        if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 110) )
+          return pNPCTopics[127].pText;
+        gold_transaction_amount = 5000;
+        break;
+      case 4:
+        if ( !activePlayer->ProfessionOrGuildFlagsCorrect(0x23u, 1) 
+          || !activePlayer->ProfessionOrGuildFlagsCorrect(0x1Bu, 1))
+          return pNPCTopics[127].pText;
+        gold_transaction_amount = 8000;
+        break;
+      }
+      break;
+    case PLAYER_SKILL_ITEM_ID:
+    case PLAYER_SKILL_REPAIR:
+    case PLAYER_SKILL_MEDITATION:
+    case PLAYER_SKILL_PERCEPTION:
+    case PLAYER_SKILL_TRAP_DISARM:
+    case PLAYER_SKILL_MONSTER_ID:
+    case PLAYER_SKILL_STEALING:
+    case PLAYER_SKILL_ALCHEMY:
+      switch (masteryLevelBeingTaught)
+      {
+      case 2:
+        gold_transaction_amount = 500;
+        break;
+      case 3:
+        gold_transaction_amount = 2500;
+        break;
+      case 4:
+        gold_transaction_amount = 6000;
+        break;
+      }
+      break;
+    case PLAYER_SKILL_MERCHANT:
+      switch (masteryLevelBeingTaught)
+      {
+      case 2:
+        gold_transaction_amount = 2000;
+        break;
+      case 3:
+        if ( activePlayer->GetBaseWillpower() < 50 )
+          return pNPCTopics[127].pText;
+        gold_transaction_amount = 5000;
+        break;
+      case 4:
+        gold_transaction_amount = 8000;
+        break;
       }
-    }
-    return v35;
-  }
-  if ( v7 < 4 )
-    return v35;
-  if ( dword_F8B1AC_award_bit_number > 27 )
-  {
-    if ( dword_F8B1AC_award_bit_number != 29
-      && dword_F8B1AC_award_bit_number != 32
-      && (dword_F8B1AC_award_bit_number <= 33 || dword_F8B1AC_award_bit_number > 35) )
-    {
-      if ( !gold_transaction_amount )
-        goto LABEL_79;
-      goto LABEL_42;
-    }
-    gold_transaction_amount = 500;
-    if ( !gold_transaction_amount )
-      goto LABEL_79;
-    goto LABEL_42;
-  }
-  if ( dword_F8B1AC_award_bit_number >= 23 )
-  {
-    gold_transaction_amount = 500;
-    if ( !gold_transaction_amount )
-      goto LABEL_79;
-    goto LABEL_42;
+      break;
+    case PLAYER_SKILL_BODYBUILDING:
+      switch (masteryLevelBeingTaught)
+      {
+      case 2:
+        gold_transaction_amount = 500;
+        break;
+      case 3:
+        if ( activePlayer->GetBaseEndurance() < 50 )
+          return pNPCTopics[127].pText;
+        gold_transaction_amount = 2500;
+        break;
+      case 4:
+        gold_transaction_amount = 6000;
+        break;
+      }
+      break;
+    case PLAYER_SKILL_DIPLOMACY:
+      Error("Diplomacy not used");
+      break;
+    case PLAYER_SKILL_TIEVERY:
+      Error("Thievery not used");
+      break;
+    case PLAYER_SKILL_DODGE:
+      switch (masteryLevelBeingTaught)
+      {
+      case 2:
+        gold_transaction_amount = 2000;
+        break;
+      case 3:
+        gold_transaction_amount = 5000;
+        break;
+      case 4:
+        if ( (activePlayer->pActiveSkills[PLAYER_SKILL_UNARMED] & 63) < 0xA )
+          return pNPCTopics[127].pText;
+        gold_transaction_amount = 8000;
+        break;
+      }
+      break;
+    case PLAYER_SKILL_UNARMED:
+      switch (masteryLevelBeingTaught)
+      {
+      case 2:
+        gold_transaction_amount = 2000;
+        break;
+      case 3:
+        gold_transaction_amount = 5000;
+        break;
+      case 4:
+        if ( (activePlayer->pActiveSkills[PLAYER_SKILL_DODGE] & 63) < 0xA )
+          return pNPCTopics[127].pText;
+        gold_transaction_amount = 8000;
+        break;
+      }
+      break;
+    case PLAYER_SKILL_LEARNING:
+      switch (masteryLevelBeingTaught)
+      {
+      case 2:
+        gold_transaction_amount = 2000;
+        break;
+      case 3:
+        if ( activePlayer->GetBaseIntelligence() < 50 )
+          return pNPCTopics[127].pText;
+        gold_transaction_amount = 5000;
+        break;
+      case 4:
+        gold_transaction_amount = 8000;
+        break;
+      }
+      break;
+    default:
+      Error("Unknown skill");
   }
-  if ( dword_F8B1AC_award_bit_number == 7 )
-  {
-    gold_transaction_amount = 0;
-    goto LABEL_79;
-  }
-  if ( dword_F8B1AC_award_bit_number <= 7 )
-  {
-    if ( !gold_transaction_amount )
-      goto LABEL_79;
-    goto LABEL_42;
-  }
-  if ( dword_F8B1AC_award_bit_number > 18 )
-  {
-    if ( dword_F8B1AC_award_bit_number != 21 )
-    {
-      if ( !gold_transaction_amount )
-        goto LABEL_79;
-      goto LABEL_42;
-    }
-    gold_transaction_amount = 500;
-    if ( !gold_transaction_amount )
-      goto LABEL_79;
-    goto LABEL_42;
-  }
-  gold_transaction_amount = 1000;
-LABEL_42:
   if ( gold_transaction_amount > pParty->uNumGold )
-    return (char *)pNPCTopics[124].pText;
-LABEL_79:
+    return pNPCTopics[124].pText;  //You don't have enough gold!
   contract_approved = 1;
-  if ( v34 == 2 )
+  if ( masteryLevelBeingTaught == 2 )
   {
     sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534],//  ^Pr[%s]   ^Pr[%s]  ^I[%lu] ^L[;;]
               pGlobalTXT_LocalizationStrings[433], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);//
-    return pTmpBuf2.data();
   }
-  if ( v34 == 3 )
+  if ( masteryLevelBeingTaught == 3 )
   {
     sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534],
               pGlobalTXT_LocalizationStrings[432], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);//
-    return pTmpBuf2.data();
   }
-  if ( v34 == 4 )
+  if ( masteryLevelBeingTaught == 4 )
     sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534],
               pGlobalTXT_LocalizationStrings[225], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);// 
   return pTmpBuf2.data();
@@ -2218,14 +2139,14 @@
 
 
 //----- (004B3FE5) --------------------------------------------------------
-void __fastcall _4B3FE5_training_dialogue(int a4)
+void _4B3FE5_training_dialogue(int a4)
 {
   const char *v2; // edi@1
 
   __debugbreak();
-  uDialogueType = 78;
+  uDialogueType = DIALOGUE_SKILL_TRAINER;
   current_npc_text = (char *)pNPCTopics[a4 + 168].pText;
-  _4B254D_SkillMasteryTeacher(a4);
+  _4B254D_SkillMasteryTeacher(a4);  //might be needed because of contract_approved ?
   pDialogueWindow->Release();
   pDialogueWindow = GUIWindow::Create(0, 0, window->GetWidth(), 350, WINDOW_MainMenu, a4, 0);
   pBtn_ExitCancel = pDialogueWindow->CreateButton( 471, 445, 169,  35,   1,  0, UIMSG_Escape, 0,   0,
--- a/mm7_data.cpp	Mon Feb 24 16:19:01 2014 +0600
+++ b/mm7_data.cpp	Mon Feb 24 16:19:09 2014 +0600
@@ -1114,7 +1114,7 @@
 const char *bountyHunting_text; // word_F8B1A4
 int contract_approved; // weak
 int dword_F8B1AC_award_bit_number; // idb
-int dword_F8B1B0; // weak
+int dword_F8B1B0_MasteryBeingTaught; // weak
 int gold_transaction_amount; // F8B1B4
 std::array<char *, 4> pShopOptions;
 int dword_F8B1D8; // weak
--- a/mm7_data.h	Mon Feb 24 16:19:01 2014 +0600
+++ b/mm7_data.h	Mon Feb 24 16:19:09 2014 +0600
@@ -764,7 +764,7 @@
 extern const char *bountyHunting_text; // idb
 extern int contract_approved; // weak
 extern int dword_F8B1AC_award_bit_number; // idb
-extern int dword_F8B1B0; // weak
+extern int dword_F8B1B0_MasteryBeingTaught; // weak
 extern int gold_transaction_amount; // F8B1B4
 extern std::array<char *, 4> pShopOptions;
 extern int dword_F8B1D8; // weak
--- a/mm7_unsorted_subs.h	Mon Feb 24 16:19:01 2014 +0600
+++ b/mm7_unsorted_subs.h	Mon Feb 24 16:19:09 2014 +0600
@@ -156,14 +156,14 @@
 char __fastcall DoInteractionWithTopmostZObject(int a1, int a2);
 void OracleDialogue();
 void __fastcall ClickNPCTopic(signed int uMessageParam);
-char * _4B254D_SkillMasteryTeacher(int _this);
+const char * _4B254D_SkillMasteryTeacher(int trainerInfo);
 const char *ContractSelectText(int pEventCode);
 void SimpleHouseDialog();
 void CreateButtonInColumn(int a1, unsigned int a2);
 void FillAviableSkillsToTeach(int _this);
 void sub_4B3E1E();
 void DrawJoinGuildWindow(int pEventCode);
-void __fastcall _4B3FE5_training_dialogue(int a4);
+void _4B3FE5_training_dialogue(int a4);
 void NPCHireableDialogPrepare();
 void _4B4224_UpdateNPCTopics(int _this);
 void __fastcall DrawTextAtStatusBar(const char *Str, int a5);