changeset 2115:90cc547a7927

Fixing hireling prices
author Grumpy7
date Mon, 23 Dec 2013 15:17:50 +0100
parents 4fae5a167a05
children 18dee3152c52
files NPC.cpp UI/UiGame.cpp mm7_4.cpp
diffstat 3 files changed, 27 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/NPC.cpp	Fri Dec 20 01:46:23 2013 +0100
+++ b/NPC.cpp	Mon Dec 23 15:17:50 2013 +0100
@@ -1386,10 +1386,11 @@
     if ( uMessageParam == 77 )
     {
       //v16 = pCurrentNPCInfo->uProfession;
+    __debugbreak();  // probably hirelings found in buildings, not present in MM7, changed "pCurrentNPCInfo->uProfession - 1" to "pCurrentNPCInfo->uProfession", have to check in other versions whether it's ok
       if (dialogue_show_profession_details)
-        v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText;
+        v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].pJoinText;
       else
-        v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pBenefits;
+        v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].pBenefits;
       current_npc_text = v17;
       v18 = BuildDialogueString(v17, uActiveCharacter - 1, 0, 0, 0, 0);
       dialogue_show_profession_details = ~dialogue_show_profession_details;
@@ -1502,15 +1503,16 @@
     ShowStatusBarString(pGlobalTXT_LocalizationStrings[533], 2);// ""I cannot join you, you're party is full""
     goto _return;
   }
-  if ( pCurrentNPCInfo->uProfession != 51 )
+  if ( pCurrentNPCInfo->uProfession != 51 ) //burglars have no hiring price
   {
-    pPrice = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].uHirePrice;
+    __debugbreak();  // probably hirelings found in buildings, not present in MM7, changed "pCurrentNPCInfo->uProfession - 1" to "pCurrentNPCInfo->uProfession", have to check in other versions whether it's ok
+    pPrice = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].uHirePrice;
     if ( pParty->uNumGold < pPrice )
     {
       ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);
       dialogue_show_profession_details = false;
       uDialogueType = 13;
-      current_npc_text = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText;
+      current_npc_text = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].pJoinText;
       current_npc_text = BuildDialogueString(current_npc_text, uActiveCharacter - 1, 0, 0, 0, 0);
       if ( uActiveCharacter )
         pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0);
--- a/UI/UiGame.cpp	Fri Dec 20 01:46:23 2013 +0100
+++ b/UI/UiGame.cpp	Mon Dec 23 15:17:50 2013 +0100
@@ -310,20 +310,24 @@
   }
   if (sDialogue_SpeakingActorNPC_ID < 0)
     v9 = 4;
-  pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Dialogue, v9, 0);//pNumberContacts = 1, v9 = 0; pNumberContacts = 2, v9 = 3;
-  if (pNPCInfo->Hired())
+  pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Dialogue, 3, 0);//pNumberContacts = 1, v9 = 0; pNumberContacts = 2, v9 = 3;
+  if (pNPCInfo->Hired() && !pNPCInfo->bHasUsedTheAbility)
   {
-    if ( !pNPCInfo->bHasUsedTheAbility )
+    if (pNPCInfo->uProfession == 10 ||    //Healer
+        pNPCInfo->uProfession == 11 ||    //Expert Healer
+        pNPCInfo->uProfession == 12 ||    //Master Healer
+        pNPCInfo->uProfession == 33 ||    //Cook
+        pNPCInfo->uProfession == 34 ||    //Chef
+        pNPCInfo->uProfession == 39 ||    //Wind Master
+        pNPCInfo->uProfession == 40 ||    //Water Master
+        pNPCInfo->uProfession == 41 ||    //Gate Master
+        pNPCInfo->uProfession == 42 ||    //Chaplain
+        pNPCInfo->uProfession == 43 ||    //Piper
+        pNPCInfo->uProfession == 52       //Fallen Wizard
+      )
     {
-      if ( pNPCInfo->uProfession >= 10 )
-      {
-        if ( pNPCInfo->uProfession <= 12 || pNPCInfo->uProfession > 32 && (pNPCInfo->uProfession <= 34 
-             || pNPCInfo->uProfession > 38 && (pNPCInfo->uProfession <= 43 || pNPCInfo->uProfession == 52)) )
-        {
-          pDialogueWindow->CreateButton(480, 250, 140, LOBYTE(pFontArrus->uFontHeight) - 3, 1, 0, UIMSG_SelectNPCDialogueOption, 9, 0, "", 0);
-          pDialogueWindow->_41D08F_set_keyboard_control_group(4, 1, 0, 1);
-        }
-      }
+      pDialogueWindow->CreateButton(480, 250, 140, LOBYTE(pFontArrus->uFontHeight) - 3, 1, 0, UIMSG_SelectNPCDialogueOption, 9, 0, "", 0);
+      pDialogueWindow->_41D08F_set_keyboard_control_group(4, 1, 0, 1);
     }
   }
 
--- a/mm7_4.cpp	Fri Dec 20 01:46:23 2013 +0100
+++ b/mm7_4.cpp	Mon Dec 23 15:17:50 2013 +0100
@@ -1539,7 +1539,7 @@
           break;
         case 17://òåêñò íà¸ìíîãî ÍÏÑ
         {
-          uint pay_percentage = pNPCStats->pProfessions[npc->uProfession - 1].uHirePrice / 100;
+          uint pay_percentage = pNPCStats->pProfessions[npc->uProfession].uHirePrice / 100;
           if ( !pay_percentage )
             pay_percentage = 1;
           sprintf(a1, "%lu", pay_percentage);
@@ -2781,9 +2781,9 @@
       ShowStatusBarString(pGlobalTXT_LocalizationStrings[533], 2);// ""I cannot join you, you're party is full""
     else
     {
-      if ( speakingNPC->uProfession != 51 )
+      if ( speakingNPC->uProfession != 51 ) //burglars have no hiring price
       {
-        if ( pParty->uNumGold < pNPCStats->pProfessions[speakingNPC->uProfession - 1].uHirePrice )
+        if ( pParty->uNumGold < pNPCStats->pProfessions[speakingNPC->uProfession].uHirePrice )
         {
           ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold"
           dialogue_show_profession_details = false;
@@ -2795,7 +2795,7 @@
           dword_7241C8 = 0;
           return;
         }
-        Party::TakeGold(pNPCStats->pProfessions[speakingNPC->uProfession - 1].uHirePrice);
+        Party::TakeGold(pNPCStats->pProfessions[speakingNPC->uProfession].uHirePrice);
       }
       LOBYTE(speakingNPC->uFlags) |= 0x80u;
       if ( pParty->pHirelings[0].pName )