changeset 2239:699bd6ee5ad0

dword_F8B1B0 to dword_F8B1B0_MasteryBeingTaught, some final touches to _4B254D_SkillMasteryTeacher
author Grumpy7
date Sun, 23 Feb 2014 15:54:00 +0100
parents f66d8be6ad5b
children 1fc4223bddf6
files NPC.cpp mm7_4.cpp mm7_data.cpp mm7_data.h mm7_unsorted_subs.h
diffstat 5 files changed, 21 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/NPC.cpp	Sun Feb 23 15:42:15 2014 +0100
+++ b/NPC.cpp	Sun Feb 23 15:54:00 2014 +0100
@@ -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	Sun Feb 23 15:42:15 2014 +0100
+++ b/mm7_4.cpp	Sun Feb 23 15:54:00 2014 +0100
@@ -1823,7 +1823,7 @@
 }
 
 //----- (004B254D) --------------------------------------------------------
-const char * _4B254D_SkillMasteryTeacher(int _this)
+const char * _4B254D_SkillMasteryTeacher(int trainerInfo)
 {
   int teacherLevel; // edx@1
   int skillBeingTaught; // ecx@1
@@ -1836,12 +1836,13 @@
   int masteryLevelBeingTaught; // [sp+24h] [bp-8h]@7
 
   contract_approved = 0;
-  teacherLevel = (_this - 200) % 3;
-  skillBeingTaught = (_this - 200) / 3;
-  pClassType = pPlayers[uActiveCharacter]->classType;
+  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 = masteryLevelBeingTaught;
+  dword_F8B1B0_MasteryBeingTaught = masteryLevelBeingTaught;
   if ( currClassMaxMastery < masteryLevelBeingTaught )
   {
     classBaseId = pClassType - pClassType % 4;
@@ -1858,9 +1859,9 @@
       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() )
+  if ( !activePlayer->CanAct() )
     return pNPCTopics[122].pText; //Not in your condition!
-  pointsInSkill = pPlayers[uActiveCharacter]->pActiveSkills[skillBeingTaught];
+  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!
@@ -2153,8 +2154,8 @@
         gold_transaction_amount = 5000;
         break;
       case 4:
-        if ( !pPlayers[uActiveCharacter]->ProfessionOrGuildFlagsCorrect(0x22u, 1) ||
-          !pPlayers[uActiveCharacter]->ProfessionOrGuildFlagsCorrect(0x1Au, 1))
+        if ( !activePlayer->ProfessionOrGuildFlagsCorrect(0x22u, 1) ||
+          !activePlayer->ProfessionOrGuildFlagsCorrect(0x1Au, 1))
           return pNPCTopics[127].pText;
         gold_transaction_amount = 8000;
         break;
@@ -2172,8 +2173,8 @@
         gold_transaction_amount = 5000;
         break;
       case 4:
-        if ( !pPlayers[uActiveCharacter]->ProfessionOrGuildFlagsCorrect(0x23u, 1) 
-          || !pPlayers[uActiveCharacter]->ProfessionOrGuildFlagsCorrect(0x1Bu, 1))
+        if ( !activePlayer->ProfessionOrGuildFlagsCorrect(0x23u, 1) 
+          || !activePlayer->ProfessionOrGuildFlagsCorrect(0x1Bu, 1))
           return pNPCTopics[127].pText;
         gold_transaction_amount = 8000;
         break;
@@ -2200,7 +2201,7 @@
         gold_transaction_amount = 2000;
         break;
       case 3:
-        if ( pPlayers[uActiveCharacter]->GetBaseWillpower() < 50 )
+        if ( activePlayer->GetBaseWillpower() < 50 )
           return pNPCTopics[127].pText;
         gold_transaction_amount = 5000;
         break;
@@ -2230,7 +2231,7 @@
         gold_transaction_amount = 500;
         break;
       case 3:
-        if ( pPlayers[uActiveCharacter]->GetBaseEndurance() < 50 )
+        if ( activePlayer->GetBaseEndurance() < 50 )
           return pNPCTopics[127].pText;
         gold_transaction_amount = 2500;
         break;
@@ -2297,7 +2298,7 @@
         gold_transaction_amount = 5000;
         break;
       case 4:
-        if ( (pPlayers[uActiveCharacter]->pActiveSkills[PLAYER_SKILL_UNARMED] & 63) < 0xA )
+        if ( (activePlayer->pActiveSkills[PLAYER_SKILL_UNARMED] & 63) < 0xA )
           return pNPCTopics[127].pText;
         gold_transaction_amount = 8000;
         break;
@@ -2313,7 +2314,7 @@
         gold_transaction_amount = 5000;
         break;
       case 4:
-        if ( (pPlayers[uActiveCharacter]->pActiveSkills[PLAYER_SKILL_DODGE] & 63) < 0xA )
+        if ( (activePlayer->pActiveSkills[PLAYER_SKILL_DODGE] & 63) < 0xA )
           return pNPCTopics[127].pText;
         gold_transaction_amount = 8000;
         break;
@@ -2382,7 +2383,7 @@
         gold_transaction_amount = 2000;
         break;
       case 3:
-        if ( pPlayers[uActiveCharacter]->GetBaseIntelligence() < 50 )
+        if ( activePlayer->GetBaseIntelligence() < 50 )
           return pNPCTopics[127].pText;
         gold_transaction_amount = 5000;
         break;
--- a/mm7_data.cpp	Sun Feb 23 15:42:15 2014 +0100
+++ b/mm7_data.cpp	Sun Feb 23 15:54:00 2014 +0100
@@ -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	Sun Feb 23 15:42:15 2014 +0100
+++ b/mm7_data.h	Sun Feb 23 15:54:00 2014 +0100
@@ -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	Sun Feb 23 15:42:15 2014 +0100
+++ b/mm7_unsorted_subs.h	Sun Feb 23 15:54:00 2014 +0100
@@ -156,7 +156,7 @@
 char __fastcall DoInteractionWithTopmostZObject(int a1, int a2);
 void OracleDialogue();
 void __fastcall ClickNPCTopic(signed int uMessageParam);
-const 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);