comparison UI/UIHouses.cpp @ 1748:19684d4bbe9a

Merge
author Grumpy7
date Mon, 30 Sep 2013 05:59:06 +0200
parents cecb080929c4 1776d4f033a7
children 421c29d4ab3e
comparison
equal deleted inserted replaced
1747:cecb080929c4 1748:19684d4bbe9a
986 986
987 //----- (004BCACC) -------------------------------------------------------- 987 //----- (004BCACC) --------------------------------------------------------
988 void __fastcall OnSelectShopDialogueOption(signed int uMessageParam) 988 void __fastcall OnSelectShopDialogueOption(signed int uMessageParam)
989 { 989 {
990 int experience_for_next_level; // eax@5 990 int experience_for_next_level; // eax@5
991 GUIWindow *v8; // esi@10
992 int v16; // eax@32 991 int v16; // eax@32
993 int v17; // eax@33
994 int v18; // eax@34
995 int v19; // eax@35
996 __int16 v20; // ax@37
997 __int16 v21; // ax@76
998 __int16 v22; // ax@107
999 __int16 v23; // ax@132
1000 __int16 v24; // ax@163 992 __int16 v24; // ax@163
1001 unsigned int v34; // eax@211
1002 signed int v36; // esi@227 993 signed int v36; // esi@227
1003 int v37; // ecx@227 994 int pPrice; // ecx@227
1004 int v38; // esi@230
1005 int v39; // edx@235
1006 int v40; // edi@243
1007 unsigned __int64 v41; // qax@243
1008 signed int v43; // edi@244
1009 int v44; // edx@244
1010 int v45; // eax@246
1011 unsigned int v46; // eax@247
1012 void *v47; // eax@250
1013 signed int v48; // edi@250
1014 int v49; // eax@252
1015 int v50; // eax@256
1016 unsigned int v51; // eax@257
1017 void *v52; // eax@260
1018 signed int v53; // edi@260
1019 int v54; // eax@262
1020 995
1021 if ( !pDialogueWindow->pNumPresenceButton ) 996 if ( !pDialogueWindow->pNumPresenceButton )
1022 return; 997 return;
1023 pRenderer->ClearZBuffer(0, 479); 998 pRenderer->ClearZBuffer(0, 479);
1024 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN)
1025 v8 = window_SpeakInHouse;
1026 if (dialog_menu_id == HOUSE_DIALOGUE_MAIN) 999 if (dialog_menu_id == HOUSE_DIALOGUE_MAIN)
1027 { 1000 {
1028 if ( in_current_building_type == BuildingType_Training ) 1001 if ( in_current_building_type == BuildingType_Training )
1029 { 1002 {
1030 if ( uMessageParam == HOUSE_DIALOGUE_TRAININGHALL_TRAIN ) 1003 if ( uMessageParam == HOUSE_DIALOGUE_TRAININGHALL_TRAIN )
1042 pDialogueWindow->Release(); 1015 pDialogueWindow->Release();
1043 pDialogueWindow = GUIWindow::Create(0, 0, 640, 345, WINDOW_MainMenu, 0, 0); 1016 pDialogueWindow = GUIWindow::Create(0, 0, 640, 345, WINDOW_MainMenu, 0, 0);
1044 pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation" 1017 pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation"
1045 pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); 1018 pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);
1046 pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", nullptr); 1019 pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", nullptr);
1047 v8 = window_SpeakInHouse;
1048 } 1020 }
1049 if ( in_current_building_type != BuildingType_Training ) 1021 if ( in_current_building_type != BuildingType_Training )
1050 { 1022 {
1051 v8 = window_SpeakInHouse;
1052 if ((in_current_building_type == BuildingType_Stables || in_current_building_type == BuildingType_Boats) && 1023 if ((in_current_building_type == BuildingType_Stables || in_current_building_type == BuildingType_Boats) &&
1053 transport_schedule[transport_routes[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_STABLES_HARMONDALE][uMessageParam - HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1]].pSchedule[pParty->uDaysPlayed % 7] 1024 transport_schedule[transport_routes[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_STABLES_HARMONDALE][uMessageParam - HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1]].pSchedule[pParty->uDaysPlayed % 7]
1054 || in_current_building_type != BuildingType_Temple || uMessageParam != BuildingType_MindGuild ) 1025 || in_current_building_type != BuildingType_Temple || uMessageParam != BuildingType_MindGuild )
1055 { 1026 {
1056 pDialogueWindow->Release(); 1027 pDialogueWindow->Release();
1057 pDialogueWindow = GUIWindow::Create(0, 0, 640, 345, WINDOW_MainMenu, 0, 0); 1028 pDialogueWindow = GUIWindow::Create(0, 0, 640, 345, WINDOW_MainMenu, 0, 0);
1058 pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation" 1029 pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation"
1059 pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); 1030 pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);
1060 pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", nullptr); 1031 pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", nullptr);
1061 v8 = window_SpeakInHouse;
1062 } 1032 }
1063 else if (uActiveCharacter) 1033 else if (uActiveCharacter)
1064 { 1034 {
1065 if ( !pPlayers[uActiveCharacter]->IsPlayerHealableByTemple() ) 1035 if ( !pPlayers[uActiveCharacter]->IsPlayerHealableByTemple() )
1066 return; 1036 return;
1067 v8 = window_SpeakInHouse;
1068 } 1037 }
1069 } 1038 }
1070 dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam; 1039 dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam;
1071 if ( in_current_building_type < BuildingType_19 ) 1040 if ( in_current_building_type < BuildingType_19 )
1072 {
1073 ShopTexture = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(off_4F03B8[(int)in_current_building_type], TEXTURE_16BIT_PALETTE)]; 1041 ShopTexture = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(off_4F03B8[(int)in_current_building_type], TEXTURE_16BIT_PALETTE)];
1074 v8 = window_SpeakInHouse;
1075 }
1076 } 1042 }
1077 1043
1078 //NEW 1044 //NEW
1079 switch (in_current_building_type) 1045 switch (in_current_building_type)
1080 { 1046 {
1093 { 1059 {
1094 if ( pParty->PartyTimes.Shops_next_generation_time[window_SpeakInHouse->par1C] >= (signed __int64)pParty->uTimePlayed ) 1060 if ( pParty->PartyTimes.Shops_next_generation_time[window_SpeakInHouse->par1C] >= (signed __int64)pParty->uTimePlayed )
1095 { 1061 {
1096 for ( uint i = 0; i < 12; ++i ) 1062 for ( uint i = 0; i < 12; ++i )
1097 { 1063 {
1098 if ( pParty->SpellBooksInGuilds[v8->par1C-139][i].uItemID ) 1064 if ( pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C - 139][i].uItemID )
1099 { 1065 ItemsInShopTexture[i] = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C - 139][i].GetIconName(), TEXTURE_16BIT_PALETTE)];
1100 v34 = pIcons_LOD->LoadTexture(pParty->SpellBooksInGuilds[v8->par1C-139][i].GetIconName(), TEXTURE_16BIT_PALETTE);
1101 v8 = window_SpeakInHouse;
1102 ItemsInShopTexture[i] = &pIcons_LOD->pTextures[v34];
1103 }
1104 } 1066 }
1105 } 1067 }
1106 else//generation new books 1068 else//generation new books
1107 { 1069 {
1108 SpellBookGenerator(); 1070 SpellBookGenerator();
1113 } 1075 }
1114 case BuildingType_TownHall: 1076 case BuildingType_TownHall:
1115 { 1077 {
1116 if ( uMessageParam == HOUSE_DIALOGUE_TOWNHALL_MESSAGE ) 1078 if ( uMessageParam == HOUSE_DIALOGUE_TOWNHALL_MESSAGE )
1117 { 1079 {
1118 if ( pParty->PartyTimes.bountyHunting_next_generation_time[(int)((char *)v8->ptr_1C - 102)] < (signed __int64)pParty->uTimePlayed )//new generation 1080 if ( pParty->PartyTimes.bountyHunting_next_generation_time[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] < (signed __int64)pParty->uTimePlayed )//new generation
1119 { 1081 {
1120 pParty->monster_for_hunting_killed[(int)((char *)v8->ptr_1C - 102)] = false; 1082 pParty->monster_for_hunting_killed[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = false;
1121 pParty->PartyTimes.bountyHunting_next_generation_time[(int)((char *)v8->ptr_1C - 102)] = (signed __int64)((double)(309657600 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) * 0.033333335); 1083 pParty->PartyTimes.bountyHunting_next_generation_time[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = (signed __int64)((double)(309657600 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) * 0.033333335);
1122 pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)] = rand() % 258 + 1; 1084 pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand() % 258 + 1;
1123 v16 = (int)((char *)window_SpeakInHouse->ptr_1C - 102); 1085 v16 = (int)((char *)window_SpeakInHouse->ptr_1C - 102);
1124 if ( !v16 ) 1086 if ( !v16 )
1125 { 1087 {
1126 while ( 1 ) 1088 while ( 1 )
1127 { 1089 {
1128 v24 = pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)]; 1090 v24 = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)];
1129 if ( (unsigned __int16)v24 < 115 || (unsigned __int16)v24 > 132 ) 1091 if ( (unsigned __int16)v24 < 115 || (unsigned __int16)v24 > 132 )
1130 { 1092 {
1131 if ( ((unsigned __int16)v24 < 235 || (unsigned __int16)v24 > 252) 1093 if ( ((unsigned __int16)v24 < 235 || (unsigned __int16)v24 > 252)
1132 && ((unsigned __int16)v24 < 133 || (unsigned __int16)v24 > 150) 1094 && ((unsigned __int16)v24 < 133 || (unsigned __int16)v24 > 150)
1133 && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu) 1095 && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu)
1139 && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu) 1101 && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu)
1140 && ((unsigned __int16)v24 < 0x6Du || (unsigned __int16)v24 > 0x6Fu) 1102 && ((unsigned __int16)v24 < 0x6Du || (unsigned __int16)v24 > 0x6Fu)
1141 && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) ) 1103 && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) )
1142 break; 1104 break;
1143 } 1105 }
1144 pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)] = rand() % 258 + 1; 1106 pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand() % 258 + 1;
1145 } 1107 }
1146 } 1108 }
1147 if ( v16 == 1 ) 1109 if ( v16 == 1 )
1148 { 1110 {
1149 while ( 1 ) 1111 while ( 1 )
1150 { 1112 {
1151 v23 = pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)]; 1113 v24 = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)];
1152 if ( (unsigned __int16)v23 < 115 || (unsigned __int16)v23 > 132 ) 1114 if ( (unsigned __int16)v24 < 115 || (unsigned __int16)v24 > 132 )
1153 { 1115 {
1154 if ( ((unsigned __int16)v23 < 0xE8u || (unsigned __int16)v23 > 0xF9u) 1116 if ( ((unsigned __int16)v24 < 0xE8u || (unsigned __int16)v24 > 0xF9u)
1155 && ((unsigned __int16)v23 < 0x85u || (unsigned __int16)v23 > 0x96u) 1117 && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u)
1156 && ((unsigned __int16)v23 < 0x97u || (unsigned __int16)v23 > 0xBAu) 1118 && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu)
1157 && ((unsigned __int16)v23 < 0xBEu || (unsigned __int16)v23 > 0xC0u) 1119 && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u)
1158 && ((unsigned __int16)v23 < 0xC4u || (unsigned __int16)v23 > 0xC6u) 1120 && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u)
1159 && ((unsigned __int16)v23 < 0x2Bu || (unsigned __int16)v23 > 0x2Du) 1121 && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du)
1160 && ((unsigned __int16)v23 < 0x52u || (unsigned __int16)v23 > 0x54u) 1122 && ((unsigned __int16)v24 < 0x52u || (unsigned __int16)v24 > 0x54u)
1161 && ((unsigned __int16)v23 < 4 || (unsigned __int16)v23 > 6) 1123 && ((unsigned __int16)v24 < 4 || (unsigned __int16)v24 > 6)
1162 && ((unsigned __int16)v23 < 0x37u || (unsigned __int16)v23 > 0x39u) 1124 && ((unsigned __int16)v24 < 0x37u || (unsigned __int16)v24 > 0x39u)
1163 && ((unsigned __int16)v23 < 0x3Au || (unsigned __int16)v23 > 0x3Cu) 1125 && ((unsigned __int16)v24 < 0x3Au || (unsigned __int16)v24 > 0x3Cu)
1164 && ((unsigned __int16)v23 < 0x3Du || (unsigned __int16)v23 > 0x3Fu) 1126 && ((unsigned __int16)v24 < 0x3Du || (unsigned __int16)v24 > 0x3Fu)
1165 && ((unsigned __int16)v23 < 0xFDu || (unsigned __int16)v23 > 0xFFu) 1127 && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu)
1166 && ((unsigned __int16)v23 < 0x61u || (unsigned __int16)v23 > 0x63u) 1128 && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u)
1167 && ((unsigned __int16)v23 < 0xCDu || (unsigned __int16)v23 > 0xCFu) ) 1129 && ((unsigned __int16)v24 < 0xCDu || (unsigned __int16)v24 > 0xCFu) )
1168 break; 1130 break;
1169 } 1131 }
1170 pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)] = rand() % 258 + 1; 1132 pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand() % 258 + 1;
1171 } 1133 }
1172 } 1134 }
1173 if ( v16 == 2 ) 1135 if ( v16 == 2 )
1174 { 1136 {
1175 while ( 1 ) 1137 while ( 1 )
1176 { 1138 {
1177 v22 = pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)]; 1139 v24 = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)];
1178 if ( (unsigned __int16)v22 < 0x73u || (unsigned __int16)v22 > 0x84u ) 1140 if ( (unsigned __int16)v24 < 0x73u || (unsigned __int16)v24 > 0x84u )
1179 { 1141 {
1180 if ( ((unsigned __int16)v22 < 0xE8u || (unsigned __int16)v22 > 0xF9u) 1142 if ( ((unsigned __int16)v24 < 0xE8u || (unsigned __int16)v24 > 0xF9u)
1181 && ((unsigned __int16)v22 < 0x85u || (unsigned __int16)v22 > 0x96u) 1143 && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u)
1182 && ((unsigned __int16)v22 < 0x97u || (unsigned __int16)v22 > 0xBAu) 1144 && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu)
1183 && ((unsigned __int16)v22 < 0xBEu || (unsigned __int16)v22 > 0xC0u) 1145 && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u)
1184 && ((unsigned __int16)v22 < 0xC4u || (unsigned __int16)v22 > 0xC6u) 1146 && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u)
1185 && ((unsigned __int16)v22 < 0x2Bu || (unsigned __int16)v22 > 0x2Du) 1147 && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du)
1186 && ((unsigned __int16)v22 < 0x31u || (unsigned __int16)v22 > 0x33u) 1148 && ((unsigned __int16)v24 < 0x31u || (unsigned __int16)v24 > 0x33u)
1187 && ((unsigned __int16)v22 < 0x34u || (unsigned __int16)v22 > 0x36u) 1149 && ((unsigned __int16)v24 < 0x34u || (unsigned __int16)v24 > 0x36u)
1188 && ((unsigned __int16)v22 < 0xFDu || (unsigned __int16)v22 > 0xFFu) 1150 && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu)
1189 && ((unsigned __int16)v22 < 0x61u || (unsigned __int16)v22 > 0x63u) 1151 && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u)
1190 && ((unsigned __int16)v22 < 0x1Cu || (unsigned __int16)v22 > 0x1Eu) ) 1152 && ((unsigned __int16)v24 < 0x1Cu || (unsigned __int16)v24 > 0x1Eu) )
1191 break; 1153 break;
1192 } 1154 }
1193 pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)] = rand() % 258 + 1; 1155 pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand() % 258 + 1;
1194 } 1156 }
1195 } 1157 }
1196 if ( v16 == 3 ) 1158 if ( v16 == 3 )
1197 { 1159 {
1198 while ( 1 ) 1160 while ( 1 )
1199 { 1161 {
1200 v21 = pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)]; 1162 v24 = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)];
1201 if ( (unsigned __int16)v21 < 0x73u || (unsigned __int16)v21 > 0x84u ) 1163 if ( (unsigned __int16)v24 < 0x73u || (unsigned __int16)v24 > 0x84u )
1202 { 1164 {
1203 if ( ((unsigned __int16)v21 < 0xE8u || (unsigned __int16)v21 > 0xF9u) 1165 if ( ((unsigned __int16)v24 < 0xE8u || (unsigned __int16)v24 > 0xF9u)
1204 && ((unsigned __int16)v21 < 0x85u || (unsigned __int16)v21 > 0x96u) 1166 && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u)
1205 && ((unsigned __int16)v21 < 0x97u || (unsigned __int16)v21 > 0xBAu) 1167 && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu)
1206 && ((unsigned __int16)v21 < 0xBEu || (unsigned __int16)v21 > 0xC0u) 1168 && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u)
1207 && ((unsigned __int16)v21 < 0xC4u || (unsigned __int16)v21 > 0xC6u) 1169 && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u)
1208 && ((unsigned __int16)v21 < 0x2Bu || (unsigned __int16)v21 > 0x2Du) 1170 && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du)
1209 && ((unsigned __int16)v21 < 0x5Eu || (unsigned __int16)v21 > 0x60u) 1171 && ((unsigned __int16)v24 < 0x5Eu || (unsigned __int16)v24 > 0x60u)
1210 && ((unsigned __int16)v21 < 0x43u || (unsigned __int16)v21 > 0x45u) 1172 && ((unsigned __int16)v24 < 0x43u || (unsigned __int16)v24 > 0x45u)
1211 && ((unsigned __int16)v21 < 0x4Fu || (unsigned __int16)v21 > 0x51u) 1173 && ((unsigned __int16)v24 < 0x4Fu || (unsigned __int16)v24 > 0x51u)
1212 && ((unsigned __int16)v21 < 0xC1u || (unsigned __int16)v21 > 0xC3u) 1174 && ((unsigned __int16)v24 < 0xC1u || (unsigned __int16)v24 > 0xC3u)
1213 && ((unsigned __int16)v21 < 0x13u || (unsigned __int16)v21 > 0x15u) 1175 && ((unsigned __int16)v24 < 0x13u || (unsigned __int16)v24 > 0x15u)
1214 && ((unsigned __int16)v21 < 0xFDu || (unsigned __int16)v21 > 0xFFu) 1176 && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu)
1215 && ((unsigned __int16)v21 < 0x61u || (unsigned __int16)v21 > 0x63u) 1177 && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u)
1216 && ((unsigned __int16)v21 < 0x6Au || (unsigned __int16)v21 > 0x6Cu) ) 1178 && ((unsigned __int16)v24 < 0x6Au || (unsigned __int16)v24 > 0x6Cu) )
1217 break; 1179 break;
1218 } 1180 }
1219 pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)] = rand() % 258 + 1; 1181 pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand() % 258 + 1;
1220 } 1182 }
1221 } 1183 }
1222 if ( v16 == 4 ) 1184 if ( v16 == 4 )
1223 { 1185 {
1224 while ( 1 ) 1186 while ( 1 )
1225 { 1187 {
1226 v20 = pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)]; 1188 v24 = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)];
1227 if ( (unsigned __int16)v20 < 0x73u || (unsigned __int16)v20 > 0x84u ) 1189 if ( (unsigned __int16)v24 < 0x73u || (unsigned __int16)v24 > 0x84u )
1228 { 1190 {
1229 if ( ((unsigned __int16)v20 < 0xE8u || (unsigned __int16)v20 > 0xF9u) 1191 if ( ((unsigned __int16)v24 < 0xE8u || (unsigned __int16)v24 > 0xF9u)
1230 && ((unsigned __int16)v20 < 0x85u || (unsigned __int16)v20 > 0x96u) 1192 && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u)
1231 && ((unsigned __int16)v20 < 0x97u || (unsigned __int16)v20 > 0xBAu) 1193 && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu)
1232 && ((unsigned __int16)v20 < 0xBEu || (unsigned __int16)v20 > 0xC0u) 1194 && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u)
1233 && ((unsigned __int16)v20 < 0xC4u || (unsigned __int16)v20 > 0xC6u) 1195 && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u)
1234 && ((unsigned __int16)v20 < 0x2Bu || (unsigned __int16)v20 > 0x2Du) 1196 && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du)
1235 && ((unsigned __int16)v20 < 0x6Du || (unsigned __int16)v20 > 0x6Fu) 1197 && ((unsigned __int16)v24 < 0x6Du || (unsigned __int16)v24 > 0x6Fu)
1236 && ((unsigned __int16)v20 < 0x46u || (unsigned __int16)v20 > 0x48u) 1198 && ((unsigned __int16)v24 < 0x46u || (unsigned __int16)v24 > 0x48u)
1237 && ((unsigned __int16)v20 < 0x100u || (unsigned __int16)v20 > 0x102u) 1199 && ((unsigned __int16)v24 < 0x100u || (unsigned __int16)v24 > 0x102u)
1238 && ((unsigned __int16)v20 < 0xD9u || (unsigned __int16)v20 > 0xDBu) 1200 && ((unsigned __int16)v24 < 0xD9u || (unsigned __int16)v24 > 0xDBu)
1239 && ((unsigned __int16)v20 < 0xC7u || (unsigned __int16)v20 > 0xC9u) 1201 && ((unsigned __int16)v24 < 0xC7u || (unsigned __int16)v24 > 0xC9u)
1240 && ((unsigned __int16)v20 < 0xE5u || (unsigned __int16)v20 > 0xE7u) 1202 && ((unsigned __int16)v24 < 0xE5u || (unsigned __int16)v24 > 0xE7u)
1241 && ((unsigned __int16)v20 < 0xDFu || (unsigned __int16)v20 > 0xE1u) 1203 && ((unsigned __int16)v24 < 0xDFu || (unsigned __int16)v24 > 0xE1u)
1242 && ((unsigned __int16)v20 < 0x5Bu || (unsigned __int16)v20 > 0x5Du) 1204 && ((unsigned __int16)v24 < 0x5Bu || (unsigned __int16)v24 > 0x5Du)
1243 && ((unsigned __int16)v20 < 0x49u || (unsigned __int16)v20 > 0x4Bu) 1205 && ((unsigned __int16)v24 < 0x49u || (unsigned __int16)v24 > 0x4Bu)
1244 && ((unsigned __int16)v20 < 0xFDu || (unsigned __int16)v20 > 0xFFu) 1206 && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu)
1245 && ((unsigned __int16)v20 < 0x61u || (unsigned __int16)v20 > 0x63u) 1207 && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u)
1246 && ((unsigned __int16)v20 < 0x10u || (unsigned __int16)v20 > 0x12u) ) 1208 && ((unsigned __int16)v24 < 0x10u || (unsigned __int16)v24 > 0x12u) )
1247 break; 1209 break;
1248 } 1210 }
1249 pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)] = rand() % 258 + 1; 1211 pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand() % 258 + 1;
1250 } 1212 }
1251 } 1213 }
1252 } 1214 }
1253 bountyHunting_monster_id_for_hunting = pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)]; 1215 bountyHunting_monster_id_for_hunting = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)];
1254 if ( !pParty->monster_for_hunting_killed[(int)((char *)v8->ptr_1C - 102)] ) 1216 if ( !pParty->monster_for_hunting_killed[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] )
1255 { 1217 {
1256 bountyHunting_text = pNPCTopics[351].pText;//" ýòîì ìåñÿöó íàçíà÷åíà íàãðàäà çà ãîëîâó %s..." 1218 bountyHunting_text = pNPCTopics[351].pText;//" ýòîì ìåñÿöó íàçíà÷åíà íàãðàäà çà ãîëîâó %s..."
1257 if ( !pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)] ) 1219 if ( !pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] )
1258 bountyHunting_text = pNPCTopics[353].pText;//"Êîå êòî óæå ïðèõîäèë â ýòîì ìåñÿöå çà íàãðàäîé" 1220 bountyHunting_text = pNPCTopics[353].pText;//"Êîå êòî óæå ïðèõîäèë â ýòîì ìåñÿöå çà íàãðàäîé"
1259 } 1221 }
1260 else 1222 else
1261 { 1223 {
1262 if ( pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)] > 0 )//get prize 1224 if ( pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] > 0 )//get prize
1263 { 1225 {
1264 party_finds_gold(100 * pMonsterStats->pInfos[(unsigned __int16)pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)]].uLevel, 0); 1226 party_finds_gold(100 * pMonsterStats->pInfos[(unsigned __int16)pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]].uLevel, 0);
1265 for ( uint i = 0; i < 4; ++i ) 1227 for ( uint i = 0; i < 4; ++i )
1266 pParty->pPlayers[i].SetVariable(VAR_Award, 86); 1228 pParty->pPlayers[i].SetVariable(VAR_Award, 86);
1267 pParty->uNumBountiesCollected += 100 * pMonsterStats->pInfos[pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)]].uLevel; 1229 pParty->uNumBountiesCollected += 100 * pMonsterStats->pInfos[pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]].uLevel;
1268 pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)] = 0; 1230 pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = 0;
1269 pParty->monster_for_hunting_killed[(int)((char *)v8->ptr_1C - 102)] = false; 1231 pParty->monster_for_hunting_killed[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = false;
1270 } 1232 }
1271 bountyHunting_text = pNPCTopics[352].pText;//"Ïîçäðàâëÿþ! Âû óñïåøíî..." 1233 bountyHunting_text = pNPCTopics[352].pText;//"Ïîçäðàâëÿþ! Âû óñïåøíî..."
1272 } 1234 }
1273 } 1235 }
1274 else if ( uMessageParam == HOUSE_DIALOGUE_TOWNHALL_PAY_FINE ) 1236 else if ( uMessageParam == HOUSE_DIALOGUE_TOWNHALL_PAY_FINE )
1275 pKeyActionMap->EnterText(1, 10, v8); 1237 pKeyActionMap->EnterText(1, 10, window_SpeakInHouse);
1276 break; 1238 break;
1277 } 1239 }
1278 case BuildingType_Bank: 1240 case BuildingType_Bank:
1279 { 1241 {
1280 if ( dialog_menu_id >= 7 && dialog_menu_id <= 8 ) 1242 if ( dialog_menu_id >= 7 && dialog_menu_id <= 8 )
1281 pKeyActionMap->EnterText(1, 10, v8); 1243 pKeyActionMap->EnterText(1, 10, window_SpeakInHouse);
1282 return; 1244 return;
1283 break; 1245 break;
1284 } 1246 }
1285 case BuildingType_WeaponShop: 1247 case BuildingType_WeaponShop:
1286 case BuildingType_ArmorShop: 1248 case BuildingType_ArmorShop:
1297 return; 1259 return;
1298 break; 1260 break;
1299 } 1261 }
1300 } 1262 }
1301 1263
1302 /*
1303 if ( in_current_building_type > BuildingType_Tavern )
1304 {
1305 if ( in_current_building_type == BuildingType_Bank )
1306 {
1307 if ( dialog_menu_id >= 7 && dialog_menu_id <= 8 )
1308 pKeyActionMap->EnterText(1, 10, v8);
1309 return;
1310 }
1311 if ( in_current_building_type != BuildingType_Temple && in_current_building_type != BuildingType_Training )
1312 return;
1313 }
1314 //else
1315 if ( in_current_building_type < BuildingType_Tavern )
1316 {
1317 if (in_current_building_type <= 0)
1318 return;
1319 if ( in_current_building_type > BuildingType_AlchemistShop )
1320 {
1321 if ( in_current_building_type <= BuildingType_16 )
1322 {
1323 if ( (signed __int64)__PAIR__(
1324 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44472],
1325 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44468]) >= (signed __int64)pParty->uTimePlayed )
1326 {
1327 v32 = 0;
1328 do
1329 {
1330 //v33 = *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v32 + 12 * (unsigned int)v8->ptr_1C));
1331 v33 = pParty->SpellBooksInGuilds[v8->par1C-139][v32].uItemID;
1332 if ( v33 )
1333 {
1334 v34 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v33].pIconName, TEXTURE_16BIT_PALETTE);
1335 v8 = window_SpeakInHouse;
1336 ItemsInShopTexture[v32] = &pIcons_LOD->pTextures[v34];
1337 }
1338 ++v32;
1339 }
1340 while ( v32 < 12 );
1341 }
1342 else
1343 {
1344 SpellBookGenerator();
1345 v30 = window_SpeakInHouse->ptr_1C;
1346 v31 = pParty->uTimePlayed
1347 + (signed __int64)((double)(0xA8C000
1348 //* (signed int)p2DEvents_minus1[26 * (unsigned int)ptr_507BC0->ptr_1C])
1349 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C)
1350 * 0.033333335);
1351 *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44468] = v31;
1352 *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44472] = HIDWORD(v31);
1353 }
1354 return;
1355 }
1356 if ( in_current_building_type != BuildingType_TownHall )
1357 return;
1358 if ( in_current_building_type == BuildingType_TownHall )
1359 {
1360 if ( uMessageParam == 99 )
1361 {
1362 v10 = (int)((char *)v8->ptr_1C - 102);
1363 v56 = v10;
1364 v11 = 8 * v10 + 11325428;
1365 if ( (signed __int64)__PAIR__(pParty->field_3C.field_0[2 * v10 + 1], pParty->field_3C.field_0[2 * v10]) >= (signed __int64)pParty->uTimePlayed )
1366 {
1367 v13 = 0;
1368 }
1369 else
1370 {
1371 v12 = v10;
1372 v13 = 0;
1373 pParty->field_75A[v12] = 0;
1374 *(_QWORD *)v11 = (signed __int64)((double)(309657600 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) * 0.033333335);
1375 v14 = rand() % 258;
1376 v15 = window_SpeakInHouse;
1377 pParty->field_750[v12] = v14 + 1;
1378 v16 = (int)((char *)v15->ptr_1C - 102);
1379 if ( v16 )
1380 {
1381 v17 = v16 - 1;
1382 if ( v17 )
1383 {
1384 v18 = v17 - 1;
1385 if ( v18 )
1386 {
1387 v19 = v18 - 1;
1388 if ( v19 )
1389 {
1390 if ( v19 == 1 )
1391 {
1392 while ( 1 )
1393 {
1394 v20 = pParty->field_750[v12];
1395 if ( (unsigned __int16)v20 < 0x73u || (unsigned __int16)v20 > 0x84u )
1396 {
1397 if ( ((unsigned __int16)v20 < 0xE8u || (unsigned __int16)v20 > 0xF9u)
1398 && ((unsigned __int16)v20 < 0x85u || (unsigned __int16)v20 > 0x96u)
1399 && ((unsigned __int16)v20 < 0x97u || (unsigned __int16)v20 > 0xBAu)
1400 && ((unsigned __int16)v20 < 0xBEu || (unsigned __int16)v20 > 0xC0u)
1401 && ((unsigned __int16)v20 < 0xC4u || (unsigned __int16)v20 > 0xC6u)
1402 && ((unsigned __int16)v20 < 0x2Bu || (unsigned __int16)v20 > 0x2Du)
1403 && ((unsigned __int16)v20 < 0x6Du || (unsigned __int16)v20 > 0x6Fu)
1404 && ((unsigned __int16)v20 < 0x46u || (unsigned __int16)v20 > 0x48u)
1405 && ((unsigned __int16)v20 < 0x100u || (unsigned __int16)v20 > 0x102u)
1406 && ((unsigned __int16)v20 < 0xD9u || (unsigned __int16)v20 > 0xDBu)
1407 && ((unsigned __int16)v20 < 0xC7u || (unsigned __int16)v20 > 0xC9u)
1408 && ((unsigned __int16)v20 < 0xE5u || (unsigned __int16)v20 > 0xE7u)
1409 && ((unsigned __int16)v20 < 0xDFu || (unsigned __int16)v20 > 0xE1u)
1410 && ((unsigned __int16)v20 < 0x5Bu || (unsigned __int16)v20 > 0x5Du)
1411 && ((unsigned __int16)v20 < 0x49u || (unsigned __int16)v20 > 0x4Bu)
1412 && ((unsigned __int16)v20 < 0xFDu || (unsigned __int16)v20 > 0xFFu)
1413 && ((unsigned __int16)v20 < 0x61u || (unsigned __int16)v20 > 0x63u)
1414 && ((unsigned __int16)v20 < 0x10u || (unsigned __int16)v20 > 0x12u) )
1415 break;
1416 }
1417 pParty->field_750[v12] = rand() % 258 + 1;
1418 }
1419 }
1420 }
1421 else
1422 {
1423 while ( 1 )
1424 {
1425 v21 = pParty->field_750[v12];
1426 if ( (unsigned __int16)v21 < 0x73u || (unsigned __int16)v21 > 0x84u )
1427 {
1428 if ( ((unsigned __int16)v21 < 0xE8u || (unsigned __int16)v21 > 0xF9u)
1429 && ((unsigned __int16)v21 < 0x85u || (unsigned __int16)v21 > 0x96u)
1430 && ((unsigned __int16)v21 < 0x97u || (unsigned __int16)v21 > 0xBAu)
1431 && ((unsigned __int16)v21 < 0xBEu || (unsigned __int16)v21 > 0xC0u)
1432 && ((unsigned __int16)v21 < 0xC4u || (unsigned __int16)v21 > 0xC6u)
1433 && ((unsigned __int16)v21 < 0x2Bu || (unsigned __int16)v21 > 0x2Du)
1434 && ((unsigned __int16)v21 < 0x5Eu || (unsigned __int16)v21 > 0x60u)
1435 && ((unsigned __int16)v21 < 0x43u || (unsigned __int16)v21 > 0x45u)
1436 && ((unsigned __int16)v21 < 0x4Fu || (unsigned __int16)v21 > 0x51u)
1437 && ((unsigned __int16)v21 < 0xC1u || (unsigned __int16)v21 > 0xC3u)
1438 && ((unsigned __int16)v21 < 0x13u || (unsigned __int16)v21 > 0x15u)
1439 && ((unsigned __int16)v21 < 0xFDu || (unsigned __int16)v21 > 0xFFu)
1440 && ((unsigned __int16)v21 < 0x61u || (unsigned __int16)v21 > 0x63u)
1441 && ((unsigned __int16)v21 < 0x6Au || (unsigned __int16)v21 > 0x6Cu) )
1442 break;
1443 }
1444 pParty->field_750[v12] = rand() % 258 + 1;
1445 }
1446 }
1447 }
1448 else
1449 {
1450 while ( 1 )
1451 {
1452 v22 = pParty->field_750[v12];
1453 if ( (unsigned __int16)v22 < 0x73u || (unsigned __int16)v22 > 0x84u )
1454 {
1455 if ( ((unsigned __int16)v22 < 0xE8u || (unsigned __int16)v22 > 0xF9u)
1456 && ((unsigned __int16)v22 < 0x85u || (unsigned __int16)v22 > 0x96u)
1457 && ((unsigned __int16)v22 < 0x97u || (unsigned __int16)v22 > 0xBAu)
1458 && ((unsigned __int16)v22 < 0xBEu || (unsigned __int16)v22 > 0xC0u)
1459 && ((unsigned __int16)v22 < 0xC4u || (unsigned __int16)v22 > 0xC6u)
1460 && ((unsigned __int16)v22 < 0x2Bu || (unsigned __int16)v22 > 0x2Du)
1461 && ((unsigned __int16)v22 < 0x31u || (unsigned __int16)v22 > 0x33u)
1462 && ((unsigned __int16)v22 < 0x34u || (unsigned __int16)v22 > 0x36u)
1463 && ((unsigned __int16)v22 < 0xFDu || (unsigned __int16)v22 > 0xFFu)
1464 && ((unsigned __int16)v22 < 0x61u || (unsigned __int16)v22 > 0x63u)
1465 && ((unsigned __int16)v22 < 0x1Cu || (unsigned __int16)v22 > 0x1Eu) )
1466 break;
1467 }
1468 pParty->field_750[v12] = rand() % 258 + 1;
1469 }
1470 }
1471 }
1472 else
1473 {
1474 while ( 1 )
1475 {
1476 v23 = pParty->field_750[v12];
1477 if ( (unsigned __int16)v23 < 0x73u || (unsigned __int16)v23 > 0x84u )
1478 {
1479 if ( ((unsigned __int16)v23 < 0xE8u || (unsigned __int16)v23 > 0xF9u)
1480 && ((unsigned __int16)v23 < 0x85u || (unsigned __int16)v23 > 0x96u)
1481 && ((unsigned __int16)v23 < 0x97u || (unsigned __int16)v23 > 0xBAu)
1482 && ((unsigned __int16)v23 < 0xBEu || (unsigned __int16)v23 > 0xC0u)
1483 && ((unsigned __int16)v23 < 0xC4u || (unsigned __int16)v23 > 0xC6u)
1484 && ((unsigned __int16)v23 < 0x2Bu || (unsigned __int16)v23 > 0x2Du)
1485 && ((unsigned __int16)v23 < 0x52u || (unsigned __int16)v23 > 0x54u)
1486 && ((unsigned __int16)v23 < 4u || (unsigned __int16)v23 > 6u)
1487 && ((unsigned __int16)v23 < 0x37u || (unsigned __int16)v23 > 0x39u)
1488 && ((unsigned __int16)v23 < 0x3Au || (unsigned __int16)v23 > 0x3Cu)
1489 && ((unsigned __int16)v23 < 0x3Du || (unsigned __int16)v23 > 0x3Fu)
1490 && ((unsigned __int16)v23 < 0xFDu || (unsigned __int16)v23 > 0xFFu)
1491 && ((unsigned __int16)v23 < 0x61u || (unsigned __int16)v23 > 0x63u)
1492 && ((unsigned __int16)v23 < 0xCDu || (unsigned __int16)v23 > 0xCFu) )
1493 break;
1494 }
1495 pParty->field_750[v12] = rand() % 258 + 1;
1496 }
1497 }
1498 }
1499 else
1500 {
1501 while ( 1 )
1502 {
1503 v24 = pParty->field_750[v12];
1504 if ( (unsigned __int16)v24 < 0x73u || (unsigned __int16)v24 > 0x84u )
1505 {
1506 if ( ((unsigned __int16)v24 < 0xEBu || (unsigned __int16)v24 > 0xFCu)
1507 && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u)
1508 && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu)
1509 && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u)
1510 && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u)
1511 && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du)
1512 && ((unsigned __int16)v24 < 0xCDu || (unsigned __int16)v24 > 0xCFu)
1513 && ((unsigned __int16)v24 < 0x5Eu || (unsigned __int16)v24 > 0x60u)
1514 && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu)
1515 && ((unsigned __int16)v24 < 0x6Du || (unsigned __int16)v24 > 0x6Fu)
1516 && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) )
1517 break;
1518 }
1519 pParty->field_750[v12] = rand() % 258 + 1;
1520 }
1521 }
1522 v10 = v56;
1523 }
1524 v25 = v10;
1525 v26 = pParty->field_750[v25];
1526 v27 = pParty->field_75A[v25] == v13;
1527 bountyHunting_monster_id_for_hunting = pParty->field_750[v25];
1528 if ( v27 )
1529 {
1530 //v1 = 0;
1531 v27 = v26 == v13;
1532 v29 = (int)pNPCTopics[351].pText;
1533 if ( v27 )
1534 v29 = (int)pNPCTopics[353].pText;
1535 bountyHunting_text = (char *)v29;
1536 }
1537 else
1538 {
1539 if ( v26 != v13 )
1540 {
1541 party_finds_gold(100 * pMonsterStats->pInfos[(unsigned __int16)v26].uLevel, 0);
1542 v28 = pParty->pPlayers;
1543 do
1544 {
1545 v28->SetVariable(VAR_Award, 86);
1546 ++v28;
1547 }
1548 while ( (signed int)v28 < (signed int)pParty->pHirelings );
1549 pParty->uNumBountiesCollected += 100 * pMonsterStats->pInfos[pParty->field_750[v25]].uLevel;
1550 pParty->field_750[v25] = v13;
1551 pParty->field_75A[v25] = v13;
1552 }
1553 //v1 = 0;
1554 bountyHunting_text = pNPCTopics[352].pText;
1555 }
1556 }
1557 else if ( uMessageParam == 100 )
1558 {
1559 pKeyActionMap->EnterText(1, 10, v8);
1560 }
1561 }
1562 }
1563 }
1564 */
1565
1566
1567 //LABEL_196:
1568 switch ( uMessageParam ) 1264 switch ( uMessageParam )
1569 { 1265 {
1570 case HOUSE_DIALOGUE_LEARN_SKILLS: 1266 case HOUSE_DIALOGUE_LEARN_SKILLS:
1571 { 1267 {
1572 pDialogueWindow->eWindowType = WINDOW_MainMenu; 1268 pDialogueWindow->eWindowType = WINDOW_MainMenu;
1587 dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam; 1283 dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam;
1588 break; 1284 break;
1589 } 1285 }
1590 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT: 1286 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT:
1591 { 1287 {
1592 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
1593 {
1594 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_PlayArcomage;
1595 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v1;
1596 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = v1;
1597 ++pMessageQueue_50CBD0->uNumMessages;
1598 }*/
1599 pMessageQueue_50CBD0->AddMessage(UIMSG_PlayArcomage, 0, 0); 1288 pMessageQueue_50CBD0->AddMessage(UIMSG_PlayArcomage, 0, 0);
1600 dialog_menu_id = HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT; 1289 dialog_menu_id = HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT;
1601 break; 1290 break;
1602 } 1291 }
1603 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: 1292 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD:
1604 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: 1293 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL:
1605 { 1294 {
1606 if ( pParty->PartyTimes.Shops_next_generation_time[(unsigned int)v8->ptr_1C] < (signed __int64)pParty->uTimePlayed ) 1295 if ( pParty->PartyTimes.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] < (signed __int64)pParty->uTimePlayed )
1607 { 1296 {
1608 GenerateStandartShopItems(); 1297 GenerateStandartShopItems();
1609 GenerateSpecialShopItems(); 1298 GenerateSpecialShopItems();
1610 pParty->PartyTimes.Shops_next_generation_time[window_SpeakInHouse->par1C] = pParty->uTimePlayed + (signed __int64)((double)(11059200 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C) * 0.033333335); 1299 pParty->PartyTimes.Shops_next_generation_time[window_SpeakInHouse->par1C] = pParty->uTimePlayed + (signed __int64)((double)(11059200 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C) * 0.033333335);
1611 } 1300 }
1612 if ( uMessageParam == HOUSE_DIALOGUE_SHOP_BUY_STANDARD ) 1301 if ( uMessageParam == HOUSE_DIALOGUE_SHOP_BUY_STANDARD )
1613 { 1302 {
1614 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) 1303 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] )
1615 { 1304 {
1616 for ( v43 = 0; v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType]; ++v43 ) 1305 for ( uint i = 0; i < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType]; ++i )
1617 { 1306 {
1618 if ( pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v43].uItemID ) 1307 if ( pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][i].uItemID )
1308 ItemsInShopTexture[i] = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][i].GetIconName(), TEXTURE_16BIT_PALETTE)];
1309 }
1310 }
1311 if ( in_current_building_type == BuildingType_WeaponShop )
1312 {
1313 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] )
1314 {
1315 for ( uint i = 0; i < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType]; ++i )
1619 { 1316 {
1620 v46 = pIcons_LOD->LoadTexture(pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v43].GetIconName(), TEXTURE_16BIT_PALETTE); 1317 if ( pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][i].uItemID)
1621 ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v46]; 1318 weapons_Ypos[i] = rand() % (300 - ItemsInShopTexture[i]->uTextureHeight);
1622 } 1319 }
1623 } 1320 }
1624 } 1321 }
1322 }
1323 if ( uMessageParam == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL )
1324 {
1325 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] )
1326 {
1327 for ( uint i = 0; i < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType]; ++i )
1328 {
1329 if ( pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID )
1330 ItemsInShopTexture[i] = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].GetIconName(), TEXTURE_16BIT_PALETTE)];
1331 }
1332 }
1625 if ( in_current_building_type == BuildingType_WeaponShop ) 1333 if ( in_current_building_type == BuildingType_WeaponShop )
1626 { 1334 {
1627 v48 = 0;
1628 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) 1335 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] )
1629 { 1336 {
1630 do 1337 for ( uint i = 0; i < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType]; ++i )
1631 { 1338 {
1632 if ( pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v48].uItemID) 1339 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID)
1633 word_F8B158[v48] = rand() % (300 - ItemsInShopTexture[v48]->uTextureHeight); 1340 weapons_Ypos[i] = rand() % (300 - ItemsInShopTexture[i]->uTextureHeight);
1634 ++v48;
1635 }
1636 while ( v48 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] );
1637 } 1341 }
1638 } 1342 }
1639 } 1343 }
1640 if ( uMessageParam == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL ) 1344 }
1641 { 1345 break;
1642 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] )
1643 {
1644 for ( v43 = 0; v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType]; ++v43 )
1645 {
1646 if ( pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v43].uItemID )
1647 {
1648 v51 = pIcons_LOD->LoadTexture(pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v43].GetIconName(), TEXTURE_16BIT_PALETTE);
1649 ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v51];
1650 }
1651 }
1652 }
1653 if ( in_current_building_type == BuildingType_WeaponShop )
1654 {
1655 v53 = 0;
1656 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] )
1657 {
1658 do
1659 {
1660 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v53].uItemID)
1661 word_F8B158[v53] = rand() % (300 - ItemsInShopTexture[v53]->uTextureHeight);
1662 ++v53;
1663 }
1664 while ( v53 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType ] );
1665 }
1666 }
1667 }
1668 break;
1669 } 1346 }
1670 case HOUSE_DIALOGUE_SHOP_SELL: 1347 case HOUSE_DIALOGUE_SHOP_SELL:
1671 case HOUSE_DIALOGUE_SHOP_IDENTIFY: 1348 case HOUSE_DIALOGUE_SHOP_IDENTIFY:
1672 case HOUSE_DIALOGUE_SHOP_REPAIR: 1349 case HOUSE_DIALOGUE_SHOP_REPAIR:
1673 { 1350 {
1684 } 1361 }
1685 default: 1362 default:
1686 { 1363 {
1687 if( uMessageParam >= HOUSE_DIALOGUE_36 && uMessageParam <= HOUSE_DIALOGUE_GUILD_LEARN_SKILL ) 1364 if( uMessageParam >= HOUSE_DIALOGUE_36 && uMessageParam <= HOUSE_DIALOGUE_GUILD_LEARN_SKILL )
1688 { 1365 {
1689 v36 = (signed __int64)(p2DEvents[(unsigned int)v8->ptr_1C - 1].flt_24 * 500.0); 1366 v36 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
1690 v37 = v36 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; 1367 pPrice = v36 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
1691 if ( v37 < v36 / 3 ) 1368 if ( pPrice < v36 / 3 )
1692 v37 = v36 / 3; 1369 pPrice = v36 / 3;
1693 //if (false) 1370 if(byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][uMessageParam - 36])
1694 if(byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][uMessageParam-36]) 1371 {
1695 //if ( *(&byte_4ED94C[37 * v35->uClass] + v55) )
1696 {
1697 //v38 = (int)(&pPlayers[uActiveCharacter]->uIntelligence + uMessageParam);
1698 if ( !pPlayers[uActiveCharacter]->pActiveSkills[uMessageParam - 36] ) 1372 if ( !pPlayers[uActiveCharacter]->pActiveSkills[uMessageParam - 36] )
1699 { 1373 {
1700 if ( pParty->uNumGold < v37 ) 1374 if ( pParty->uNumGold < pPrice )
1701 { 1375 {
1702 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); 1376 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);
1703 if ( in_current_building_type == BuildingType_Training || in_current_building_type == BuildingType_Tavern ) 1377 if ( in_current_building_type == BuildingType_Training || in_current_building_type == BuildingType_Tavern )
1704 v39 = 4; 1378 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Goodbye);
1705 else 1379 else
1706 v39 = 2; 1380 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
1707 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v39);
1708 } 1381 }
1709 else 1382 else
1710 { 1383 {
1711 Party::TakeGold(v37); 1384 Party::TakeGold(pPrice);
1712 dword_F8B1E4 = 1; 1385 dword_F8B1E4 = 1;
1713 pPlayers[uActiveCharacter]->pActiveSkills[uMessageParam - 36] = 1; 1386 pPlayers[uActiveCharacter]->pActiveSkills[uMessageParam - 36] = 1;
1714 pPlayers[uActiveCharacter]->PlaySound(SPEECH_78, 0); 1387 pPlayers[uActiveCharacter]->PlaySound(SPEECH_78, 0);
1715 } 1388 }
1716 } 1389 }
1717 } 1390 }
1718 } 1391 }
1719 break; 1392 break;
1720 } 1393 }
1721 } 1394 }
1722 /*
1723 if ( uMessageParam != 95 && uMessageParam != 2 )
1724 {
1725 if ( uMessageParam == 3 )
1726 {
1727 dialog_menu_id = 3;
1728 }
1729 else
1730 {
1731 if ( uMessageParam == 4 )
1732 {
1733 dialog_menu_id = 4;
1734 }
1735 else
1736 {
1737 if ( uMessageParam != 5 )
1738 {
1739 if ( uMessageParam > 35 )
1740 {
1741 if ( uMessageParam <= 72 )
1742 {
1743 v35 = pPlayers[uActiveCharacter];
1744 //v36 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)v8->ptr_1C] * 500.0);
1745 v36 = (signed __int64)(p2DEvents[(unsigned int)v8->ptr_1C - 1].flt_24 * 500.0);
1746 v37 = v36 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
1747 if ( v37 < v36 / 3 )
1748 v37 = v36 / 3;
1749
1750 __debugbreak();
1751 //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23]
1752 // or
1753 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36]
1754 // or
1755 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1]
1756
1757 if (false)
1758 //if ( *(&byte_4ED94C[37 * v35->uClass] + v55) )
1759 {
1760 v38 = (int)(&v35->uIntelligence + uMessageParam);
1761 if ( !*(short *)v38 )
1762 {
1763 if ( pParty->uNumGold < v37 )
1764 {
1765 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
1766 if ( in_current_building_type == BuildingType_Training || in_current_building_type == BuildingType_Tavern )
1767 v39 = 4;
1768 else
1769 v39 = 2;
1770 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, v39);
1771 }
1772 else
1773 {
1774 Party::TakeGold(v37);
1775 dword_F8B1E4 = 1;
1776 *(short *)v38 = 1;
1777 v35->PlaySound(SPEECH_78, 0);
1778 }
1779 }
1780 }
1781 }
1782 else
1783 {
1784 if ( uMessageParam == 94 )
1785 {
1786 pDialogueWindow->eWindowType = WINDOW_MainMenu;
1787 UI_CreateEndConversationButton();
1788 InitializaDialogueOptions_Shops(in_current_building_type);
1789 }
1790 }
1791 }
1792 return;
1793 }
1794 dialog_menu_id = 5;
1795 }
1796 }
1797 sub_421B2C_PlaceInInventory_or_DropPickedItem();
1798 return;
1799 }
1800 if ( pParty->field_3C.Shops_next_generation_time[(unsigned int)v8->ptr_1C] < (signed __int64)pParty->uTimePlayed )
1801 {
1802 GenerateStandartShopItems();
1803 GenerateSpecialShopItems();
1804 v8 = window_SpeakInHouse;
1805 v40 = window_SpeakInHouse->par1C;
1806 //v3 = dword_F8B198;
1807 v41 = pParty->uTimePlayed
1808 //+ (signed __int64)((double)(11059200 * (signed int)p2DEvents_minus1[26 * (unsigned int)ptr_507BC0->ptr_1C])
1809 + (signed __int64)((double)(11059200 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C)
1810 * 0.033333335);
1811 pParty->field_3C.Shops_next_generation_time[v40] = v41;
1812
1813 }
1814 v42 = v8->ptr_1C;
1815 v43 = 0;
1816 //v44 = p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C];
1817 v44 = p2DEvents[(unsigned int)v8->ptr_1C - 1].uType;
1818 if ( uMessageParam == 2 )
1819 {
1820 if ( uItemsAmountPerShopType[v44] )
1821 {
1822 do
1823 {
1824 v45 = pParty->StandartItemsInShops[(int)v42][v43].uItemID;
1825 if ( v45 )
1826 {
1827 v46 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v45].pIconName, TEXTURE_16BIT_PALETTE);
1828 //v3 = dword_F8B198;
1829 v8 = window_SpeakInHouse;
1830 ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v46];
1831 }
1832 v42 = v8->ptr_1C;
1833 ++v43;
1834 }
1835 //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] );
1836 while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] );
1837 }
1838 if ( in_current_building_type == BuildingType_WeaponShop )
1839 {
1840 v47 = v8->ptr_1C;
1841 v48 = 0;
1842 //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] )
1843 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] )
1844 {
1845 do
1846 {
1847 // if ( pParty->field_777C[9 * (v48 + 12 * (int)v47)] )
1848 if ( pParty->StandartItemsInShops[(int)v47][v48].uItemID);
1849 {
1850 v49 = rand();
1851 v8 = window_SpeakInHouse;
1852 word_F8B158[v48] = v49 % (300 - ItemsInShopTexture[v48]->uTextureHeight);
1853 }
1854 v47 = v8->ptr_1C;
1855 ++v48;
1856 }
1857 //while ( v48 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] );
1858 while ( v48 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] );
1859 }
1860 }
1861 }
1862 if ( uMessageParam == 95 )
1863 {
1864 if ( uItemsAmountPerShopType[v44] )
1865 {
1866 do
1867 {
1868 //v50 = pParty->field_C59C[9 * (v43 + 12 * (int)v42) + 724];
1869 v50=pParty->SpecialItemsInShops[(unsigned int)v42][(signed int)v43].uItemID;
1870 if ( v50 )
1871 {
1872 v51 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v50].pIconName, TEXTURE_16BIT_PALETTE);
1873 //v3 = dword_F8B198;
1874 v8 = window_SpeakInHouse;
1875 ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v51];
1876 }
1877 v42 = v8->ptr_1C;
1878 ++v43;
1879 }
1880 //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] );
1881 while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] );
1882 }
1883 if ( in_current_building_type == BuildingType_WeaponShop )
1884 {
1885 v52 = v8->ptr_1C;
1886 v53 = 0;
1887 //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] )
1888 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] )
1889 {
1890 do
1891 {
1892 // if ( pParty->field_C59C[9 * (v53 + 12 * (int)v52) + 724] )
1893 if (pParty->SpecialItemsInShops[(unsigned int)v52][v53].uItemID)
1894 {
1895 v54 = rand();
1896 v8 = window_SpeakInHouse;
1897 word_F8B158[v53] = v54 % (300 - ItemsInShopTexture[v53]->uTextureHeight);
1898 }
1899 v52 = v8->ptr_1C;
1900 ++v53;
1901 }
1902 //while ( v53 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] );
1903 while ( v53 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType ] );
1904 }
1905 }
1906 }
1907 */
1908 } 1395 }
1909 //----- (004B6943) -------------------------------------------------------- 1396 //----- (004B6943) --------------------------------------------------------
1910 void TravelByTransport() 1397 void TravelByTransport()
1911 { 1398 {
1912 signed int v4; // ebx@1 1399 signed int v4; // ebx@1