changeset 1661:e1d1fe32c194

NPCTopics
author Ritor1
date Wed, 18 Sep 2013 14:19:37 +0600
parents d11b5669f089
children 620b6ba3e6b8
files NPC.cpp UI/UIGuilds.cpp UI/UIHouses.cpp UI/UiGame.cpp
diffstat 4 files changed, 126 insertions(+), 167 deletions(-) [+]
line wrap: on
line diff
--- a/NPC.cpp	Wed Sep 18 11:05:06 2013 +0600
+++ b/NPC.cpp	Wed Sep 18 14:19:37 2013 +0600
@@ -290,7 +290,7 @@
 	pNPCTopicTXT_Raw = (char *)pEvents_LOD->LoadRaw("npctopic.txt", 0);
 	strtok(pNPCTopicTXT_Raw, "\r");
 
-	for (i=0; i<579; ++i)
+	for ( i = 1; i <= 579; ++i )//NPC topics count limit
 		{
 		test_string = strtok(NULL, "\r") + 1;
 		break_loop = false;
--- a/UI/UIGuilds.cpp	Wed Sep 18 11:05:06 2013 +0600
+++ b/UI/UIGuilds.cpp	Wed Sep 18 14:19:37 2013 +0600
@@ -26,28 +26,21 @@
   const char *statusbar_string; // ecx@26
   POINT *v12; // esi@30
   int v13; // ecx@30
-  void *v14; // ST1C_4@31
+  //void *v14; // ST1C_4@31
   ItemGen *v15; // ST18_4@31
-  int v16; // ST10_4@31
+  //int v16; // ST10_4@31
   int v17; // eax@31
   char *v18; // edx@31
-  int v19; // eax@32
   int pActiveItem; // esi@35
-  int v22; // eax@35
-  unsigned int v23; // eax@36
   int v24; // eax@39
   int v25; // eax@40
   int v26; // ecx@47
   GUIButton *pButton; // eax@49
-  unsigned int v29; // eax@49
   int pTextHeight; // eax@55
-  unsigned int v32; // ecx@55
-  int v33; // eax@55
   unsigned __int16 pTextColor; // ax@55
   int v35; // eax@58
   const char *v36; // ST20_4@61
   unsigned __int16 v37; // ST1C_2@61
-  int v38; // eax@61
   int v40; // [sp-14h] [bp-300h]@31
   int v41; // [sp-10h] [bp-2FCh]@31
   unsigned __int16 v42; // [sp-Ch] [bp-2F8h]@31
@@ -66,13 +59,11 @@
   int pColorWhite; // [sp+2CCh] [bp-20h]@1
   int pColorYellow; // [sp+2D0h] [bp-1Ch]@1
   int v58; // [sp+2D4h] [bp-18h]@1
-  unsigned __int8 uPlayerID; // [sp+2DBh] [bp-11h]@31
+  //unsigned __int8 uPlayerID; // [sp+2DBh] [bp-11h]@31
   bool pSkillFlag; // [sp+2DCh] [bp-10h]@35
   int v61; // [sp+2E0h] [bp-Ch]@35
-  int pItemNum;
   unsigned int v62; // [sp+2E4h] [bp-8h]@13
   int pPrice; // [sp+2E8h] [bp-4h]@1
-  int pNumActivItem;
   int all_text_height;
   int pX;
 
@@ -91,35 +82,110 @@
   strcpy(v47, "");
   strcpy(v48, "");
   strcpy(v49, "");
-  if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN )
+  if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN )
   {
-    if ( dialog_menu_id != HOUSE_DIALOGUE_GUILD_BUY_BOOKS ) //buy skill
+    if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_achieved_awards_bits,
+            guild_mambership_flags[(unsigned int)window_SpeakInHouse->ptr_1C-139]) )
+    { //you must me member
+      pTextHeight = pFontArrus->CalcTextHeight(pNPCTopics[121].pText, &working_window, 0, 0);
+      working_window.DrawTitleText(pFontArrus, 0, (212 - pTextHeight) / 2 + 101, pColorYellow, pNPCTopics[121].pText, 3);
+      pDialogueWindow->pNumPresenceButton = 0;
+      return;
+    }
+    if ( !HouseUI_CheckIfPlayerCanInteract() )
+      return;
+    if ( pDialogueWindow->pStartingPosActiveItem >= pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton )
     {
-      if ( HouseUI_CheckIfPlayerCanInteract() )
+      sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s"	
+      strcat(pTmpBuf.data(), "\n \n");
+      strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further."
+      pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &working_window, 0, 0);
+      working_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorYellow, pTmpBuf.data(), 3);
+      return;
+    }
+    v61 = 0;
+    pSkillFlag = false;
+    all_text_height = 0;
+    for ( int i = pDialogueWindow->pStartingPosActiveItem;
+          i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i )
+    {
+      if ( pDialogueWindow->GetControl(i)->msg_param == 18 )
+      {
+        all_text_height += pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[400], &working_window, 0, 0); //"Buy Spells"
+        v61++;
+      }
+      else
       {
-        if ( pPlayers[uActiveCharacter]->pActiveSkills[dialog_menu_id-36] )
+        if( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(i)->msg_param - 36] 
+            && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] )
         {
-          sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[403], pClassNames[dialog_menu_id - 16]); //"You already know the %s skill"
-          ShowStatusBarString(pTmpBuf.data(), 2);
-          pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
+          all_text_height += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &working_window, 0, 0);
+          v61++;
+          pSkillFlag = true;
+        }
+      }
+    }
+    if ( !v61 )
+    {
+      sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s"	
+      strcat(pTmpBuf.data(), "\n \n");
+      strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further."
+      pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &working_window, 0, 0);
+      working_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorYellow, pTmpBuf.data(), 3);
+      return;
+    }
+    if ( pSkillFlag )
+    {
+      sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice); //"Skill Cost: %lu"
+      working_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3);
+    }
+    v58 = (149 - all_text_height) / v61;
+    if ( v58 > 32 )
+      v58 = 32;
+    v26 = (149 - v61 * v58 - all_text_height) / 2 - v58 / 2 + 162;
+    for ( int i = pDialogueWindow->pStartingPosActiveItem;
+          i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i )
+    {
+      pButton = pDialogueWindow->GetControl(i);
+      if ( pButton->msg_param == 18 )
+      {
+        pButton->uY = v58 + v26;
+        pTextHeight = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[400], &working_window, 0, 0);
+        pButton->uHeight = pTextHeight;
+        v26 = pButton->uY + pTextHeight - 1;
+        pButton->uW = v26;
+        pTextColor = pColorYellow;
+        if ( pDialogueWindow->pCurrentPosActiveItem != i )
+          pTextColor = pColorWhite;
+        working_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pGlobalTXT_LocalizationStrings[400], 3);//"Buy Spells"
+      }
+      else
+      {
+        if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36] 
+             && !pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] )
+        {
+          pButton->uY = v58 + v26;
+          pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &working_window, 0, 0);
+          pButton->uHeight = pTextHeight;
+          v26 = pButton->uY + pTextHeight - 1;
+          pButton->uW = v26;
+          pTextColor = pColorYellow;
+          if ( pDialogueWindow->pCurrentPosActiveItem != i )
+            pTextColor = pColorWhite;
+          working_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pSkillNames[pButton->msg_param - 36], 3);
         }
         else
         {
-          if ( pParty->uNumGold < pPrice )
-          {
-            ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); //"You don't have enough gold"
-            PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
-          }
-          else
-          {
-            Party::TakeGold(pPrice);
-            pPlayers[uActiveCharacter]->pActiveSkills[dialog_menu_id-36] = 1;
-          }
+          pButton->uW = 0;
+          pButton->uHeight = 0;
+          pButton->uY = 0;
         }
       }
-      pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
-      return;
     }
+    return;
+  }
+  if ( dialog_menu_id == HOUSE_DIALOGUE_GUILD_BUY_BOOKS ) //buy skill
+  {
     pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
     v6 = 0;
     v62 = 0;
@@ -168,134 +234,43 @@
       v13 = pRenderer->pActiveZBuffer[result] & 0xFFFF;
       if ( pRenderer->pActiveZBuffer[result] & 0xFFFF )
       {
-        v14 = window_SpeakInHouse->ptr_1C;
-        v15 = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v13 + 12 * (int)v14));
-        v16 = (int)window_SpeakInHouse->ptr_1C;
-        uPlayerID = uActiveCharacter - 1;
-        v17 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction( (ItemGen *)&pParty->pPlayers[1].uExpressionTimeLength + v13 + 12 * (int)v14, BuildingType_MagicShop, v16,  2);
-        v18 = BuildDialogueString((char *)pMerchantsBuyPhrases[v17], uPlayerID, v15, (char *)v14, 2, 0);
-        v19 = pFontArrus->CalcTextHeight(v18, &working_window, 0, 0);
-        working_window.DrawTitleText(pFontArrus, 0, (174 - v19) / 2 + 138,  pColorWhite, v18, 3);
+        v15 = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v13 + 12 * (int)window_SpeakInHouse->ptr_1C));
+        v17 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction( (ItemGen *)&pParty->pPlayers[1].uExpressionTimeLength + v13 + 12 * (int)window_SpeakInHouse->ptr_1C, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C,  2);
+        v18 = BuildDialogueString((char *)pMerchantsBuyPhrases[v17], uActiveCharacter - 1, v15, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
+        pTextHeight = pFontArrus->CalcTextHeight(v18, &working_window, 0, 0);
+        working_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138,  pColorWhite, v18, 3);
         return;
       }
     }
     return;
   }
-  if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_achieved_awards_bits,
-            guild_mambership_flags[(unsigned int)window_SpeakInHouse->ptr_1C-139]) )
-  { //you must me member
-    v38 = pFontArrus->CalcTextHeight(pNPCTopics[121].pText, &working_window, 0, 0);
-    working_window.DrawTitleText(pFontArrus, 0, (212 - v38) / 2 + 101, pColorYellow, pNPCTopics[121].pText, 3);
-    pDialogueWindow->pNumPresenceButton = 0;
-    return;
-  }
-  if ( !HouseUI_CheckIfPlayerCanInteract() )
-    return;
-  v61 = 0;
-  pSkillFlag = false;
-  pActiveItem = pDialogueWindow->pStartingPosActiveItem;
-  v22 = pActiveItem + pDialogueWindow->pNumPresenceButton;
-  pItemNum = 0;
-  if ( pDialogueWindow->pStartingPosActiveItem >= pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton )
+  if ( dialog_menu_id == HOUSE_DIALOGUE_GUILD_LEARN_SKILL )
   {
-    sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s"	
-    strcat(pTmpBuf.data(), "\n \n");
-    strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further."
-    v19 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &working_window, 0, 0);
-    working_window.DrawTitleText(pFontArrus, 0, (174 - v19) / 2 + 138, pColorYellow, pTmpBuf.data(), 3);
-    return;
-  }
-  all_text_height = 0;
-  do
-  {
-    v23 = pDialogueWindow->GetControl(pActiveItem)->msg_param;
-    if ( v23 == 18 )
+    if ( HouseUI_CheckIfPlayerCanInteract() )
     {
-      all_text_height += pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[400], &working_window, 0, 0); //"Buy Spells"
-      v61++;
-    }
-    else
-    {
-      if( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v23 - 36] 
-          && !pPlayers[uActiveCharacter]->pActiveSkills[v23 - 36] )
+      if ( pPlayers[uActiveCharacter]->pActiveSkills[dialog_menu_id-36] )
       {
-        all_text_height += pFontArrus->CalcTextHeight(pSkillNames[v23 - 36], &working_window, 0, 0);
-        v61++;
-        pSkillFlag = true;
-      }
-    }
-    ++pActiveItem;
-  }
-  while ( pActiveItem < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
-  if ( !v61 )
-  {
-    sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s"	
-    strcat(pTmpBuf.data(), "\n \n");
-    strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further."
-    v19 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &working_window, 0, 0);
-    working_window.DrawTitleText(pFontArrus, 0, (174 - v19) / 2 + 138, pColorYellow, pTmpBuf.data(), 3);
-    return;
-  }
-  if ( pSkillFlag )
-  {
-    sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice); //"Skill Cost: %lu"
-    working_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3);
-  }
-  v58 = (149 - all_text_height) / v61;
-  if ( v58 > 32 )
-    v58 = 32;
-  v26 = (149 - v61 * v58 - all_text_height) / 2 - v58 / 2 + 162;
-  pNumActivItem = pDialogueWindow->pStartingPosActiveItem;
-  if (pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton )
-  {
-    pItemNum = 2;
-    do
-    {
-      pButton = pDialogueWindow->GetControl(pItemNum);
-      v29 = pButton->msg_param;
-      if ( v29 == 18 )
-      {
-        pButton->uY = v58 + v26;
-        pTextHeight = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[400], &working_window, 0, 0);
-        v32 = pButton->uY;
-        pButton->uHeight = pTextHeight;
-        v33 = v32 + pTextHeight - 1;
-        pButton->uW = v33;
-        v26 = v33;
-        pTextColor = pColorYellow;
-        if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
-          pTextColor = pColorWhite;
-        working_window.DrawTitleText(pFontArrus, 0, v32, pTextColor, pGlobalTXT_LocalizationStrings[400], 3);//"Buy Spells"
+        sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[403], pClassNames[dialog_menu_id - 16]); //"You already know the %s skill"
+        ShowStatusBarString(pTmpBuf.data(), 2);
+        pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
       }
       else
       {
-        if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v29 - 36] 
-             && !pPlayers[uActiveCharacter]->pActiveSkills[v29 - 36] )
+        if ( pParty->uNumGold < pPrice )
         {
-          pButton->uY = v58 + v26;
-          pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v29 - 36], &working_window, 0, 0);
-          v32 = pButton->uY;
-          pButton->uHeight = pTextHeight;
-          v33 = v32 + pTextHeight - 1;
-          pButton->uW = v33;
-          v26 = v33;
-          pTextColor = pColorYellow;
-          if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
-            pTextColor = pColorWhite;
-          working_window.DrawTitleText(pFontArrus, 0, v32, pTextColor, pSkillNames[v29 - 36], 3);
+          ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); //"You don't have enough gold"
+          PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
         }
         else
         {
-          pButton->uW = 0;
-          pButton->uHeight = 0;
-          pButton->uY = 0;
+          Party::TakeGold(pPrice);
+          pPlayers[uActiveCharacter]->pActiveSkills[dialog_menu_id-36] = 1;
         }
       }
-      ++pItemNum;
     }
-    while ( pItemNum < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
+    pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
+    return;
   }
-  return;
 }
 //----- (004BC8D5) --------------------------------------------------------
 void SpellBookGenerator()//for GuildDialogs
--- a/UI/UIHouses.cpp	Wed Sep 18 11:05:06 2013 +0600
+++ b/UI/UIHouses.cpp	Wed Sep 18 14:19:37 2013 +0600
@@ -2984,20 +2984,8 @@
   signed int v10; // esi@6
   int pPrice; // ecx@6
   signed int v14; // esi@14
-  //unsigned int v15; // esi@16
   int v16; // eax@16
-  //unsigned int v17; // eax@17
   int v19; // ecx@24
-  //GUIButton *v20; // eax@26
-  //GUIButton *v21; // esi@26
-  //int v22; // eax@26
-  //const char *v23; // eax@28
-  //int v24; // eax@28
-  //unsigned int v25; // ecx@28
-  //int v26; // eax@28
-  //unsigned __int16 v27; // ax@28
-  //unsigned __int16 v29; // ST14_2@34
-  //int v30; // eax@34
   int v33; // eax@36
   unsigned int v36; // eax@38
   unsigned int v42; // eax@46
@@ -3008,7 +2996,6 @@
   int pTextHeight; // eax@71
   unsigned __int16 pTextColor; // ax@71
   GUIWindow training_dialog_window; // [sp+Ch] [bp-78h]@1
-  //int v68; // [sp+6Ch] [bp-18h]@3
   int v69; // [sp+70h] [bp-14h]@6
   int v73; // [sp+80h] [bp-4h]@14
 
@@ -3065,7 +3052,6 @@
         v49 = (2 * (87 - (174 - all_text_height) / 2) - all_text_height) / 2 - (174 - all_text_height) / 2 / 2 + 138;
         if (pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton)
         {
-          //int pCurrentItem = 2;
           index = 0;
           for ( int i = pDialogueWindow->pStartingPosActiveItem;
                 i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++i )
@@ -3080,7 +3066,6 @@
             if ( pDialogueWindow->pCurrentPosActiveItem != i )
               pTextColor = TargetColor(255, 255, 255);
             training_dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[index], 3);
-            //++pCurrentItem;
             ++index;
           }
         }
@@ -3096,7 +3081,6 @@
         pDialogueWindow->pNumPresenceButton = 0;
         return;
       }
-      //v34 = pPlayers[uActiveCharacter]->uLevel;
       if ( pPlayers[uActiveCharacter]->uLevel < pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_TRAINING_HALL_EMERALD_ISLE] )
       {
         if ( (signed __int64)pPlayers[uActiveCharacter]->uExperience >= v5 )
@@ -3443,7 +3427,7 @@
     switch ( pButton->msg_param )
     {
       case 19://evt_A
-        v15 = (char *)pNPCTopics[pNPC->evt_A-1].pTopic;
+        v15 = (char *)pNPCTopics[pNPC->evt_A].pTopic;
         if ( !v15 )
         {
           pButton->msg_param = 0;
@@ -3452,7 +3436,7 @@
         strcpy(pButton->pButtonName, v15);
         continue;
       case 20://evt_B
-        v15 = (char *)pNPCTopics[pNPC->evt_B-1].pTopic;
+        v15 = (char *)pNPCTopics[pNPC->evt_B].pTopic;
         if ( !v15 )
         {
           pButton->msg_param = 0;
@@ -3469,7 +3453,7 @@
         strcpy(pButton->pButtonName, v15);
         continue;
       case 21://evt_C
-        v15 = (char *)pNPCTopics[pNPC->evt_C-1].pTopic;
+        v15 = (char *)pNPCTopics[pNPC->evt_C].pTopic;
         if ( !v15 )
         {
           pButton->msg_param = 0;
@@ -3478,7 +3462,7 @@
         strcpy(pButton->pButtonName, v15);
         continue;
       case 22://evt_D
-        v15 = (char *)pNPCTopics[pNPC->evt_D-1].pTopic;
+        v15 = (char *)pNPCTopics[pNPC->evt_D].pTopic;
         if ( !v15 )
         {
           pButton->msg_param = 0;
@@ -3487,7 +3471,7 @@
         strcpy(pButton->pButtonName, v15);
         continue;
       case 23://evt_E
-        v15 = (char *)pNPCTopics[pNPC->evt_E-1].pTopic;
+        v15 = (char *)pNPCTopics[pNPC->evt_E].pTopic;
         if ( !v15 )
         {
           pButton->msg_param = 0;
@@ -3496,7 +3480,7 @@
         strcpy(pButton->pButtonName, v15);
         continue;
       case 24://evt_F
-        v15 = (char *)pNPCTopics[pNPC->evt_F-1].pTopic;
+        v15 = (char *)pNPCTopics[pNPC->evt_F].pTopic;
         if ( !v15 )
         {
           pButton->msg_param = 0;
--- a/UI/UiGame.cpp	Wed Sep 18 11:05:06 2013 +0600
+++ b/UI/UiGame.cpp	Wed Sep 18 14:19:37 2013 +0600
@@ -395,14 +395,14 @@
 
     case DIALOGUE_PROFESSION_DETAILS:
     {
-      auto prof = pNPCStats->pProfessions + pNPC->uProfession - 1;
+      //auto prof = pNPCStats->pProfessions[pNPC->uProfession];
 
       if (dialogue_show_profession_details)
-        pInString = BuildDialogueString(prof->pBenefits, uActiveCharacter - 1, 0, 0, 0, 0);
+        pInString = BuildDialogueString(pNPCStats->pProfessions[pNPC->uProfession].pBenefits, uActiveCharacter - 1, 0, 0, 0, 0);
       else if (pNPC->Hired())
-        pInString = BuildDialogueString(prof->pDismissText, uActiveCharacter - 1, 0, 0, 0, 0);
+        pInString = BuildDialogueString(pNPCStats->pProfessions[pNPC->uProfession].pDismissText, uActiveCharacter - 1, 0, 0, 0, 0);
       else
-        pInString = BuildDialogueString(prof->pJoinText, uActiveCharacter - 1, 0, 0, 0, 0);
+        pInString = BuildDialogueString(pNPCStats->pProfessions[pNPC->uProfession].pJoinText, uActiveCharacter - 1, 0, 0, 0, 0);
     }
     break;