70 for (i = 0; i < 2; ++i) {
115 *npc_indx = npcid - 5000;
119 *npc_indx = npcid - 5000;
130 for (
int i = 0; i < 2; ++i) {
163 unsigned int temp_str_len;
171 for (i = 0; i < 789; ++i) {
172 test_string = strtok(NULL,
"\r") + 1;
176 c = *(
unsigned char *)test_string;
178 while ((
c !=
'\t') && (
c > 0)) {
180 c = test_string[temp_str_len];
182 tmp_pos = test_string + temp_str_len;
183 if (*tmp_pos == 0) break_loop =
true;
186 if (decode_step == 1)
192 test_string = tmp_pos + 1;
193 }
while ((decode_step < 2) && !break_loop);
199 for (i = 1; i <= 579; ++i) {
200 test_string = strtok(NULL,
"\r") + 1;
204 c = *(
unsigned char *)test_string;
206 while ((
c !=
'\t') && (
c > 0)) {
208 c = test_string[temp_str_len];
210 tmp_pos = test_string + temp_str_len;
211 if (*tmp_pos == 0) break_loop =
true;
214 if (decode_step == 1)
220 test_string = tmp_pos + 1;
221 }
while ((decode_step < 2) && !break_loop);
229 for (i = 1; i < 59; ++i) {
230 test_string = strtok(NULL,
"\r") + 1;
234 c = *(
unsigned char *)test_string;
236 while ((
c !=
'\t') && (
c > 0)) {
238 c = test_string[temp_str_len];
240 tmp_pos = test_string + temp_str_len;
241 if (*tmp_pos == 0) break_loop =
true;
244 if ((decode_step > 0) && (decode_step < 77)) {
247 }
else if (decode_step == 0) {
254 test_string = tmp_pos + 1;
255 }
while ((decode_step < 78) && !break_loop);
258 for (i = 0; i < 77; ++i) {
260 for (
int ii = 1; ii < 59; ++ii) {
289 unsigned int temp_str_len;
297 for (i = 0; i < 500; ++i) {
298 test_string = strtok(NULL,
"\r") + 1;
302 c = *(
unsigned char *)test_string;
304 while ((
c !=
'\t') && (
c > 0)) {
306 c = test_string[temp_str_len];
308 tmp_pos = test_string + temp_str_len;
309 if (*tmp_pos == 0) break_loop =
true;
312 switch (decode_step) {
353 test_string = tmp_pos + 1;
354 }
while ((decode_step < 16) && !break_loop);
359 for (i = 1; i <= 205; ++i) {
360 test_string = strtok(NULL,
"\r") + 1;
364 c = *(
unsigned char *)test_string;
366 while ((
c !=
'\t') && (
c > 0)) {
368 c = test_string[temp_str_len];
370 tmp_pos = test_string + temp_str_len;
371 if (*tmp_pos == 0) break_loop =
true;
374 switch (decode_step) {
386 test_string = tmp_pos + 1;
387 }
while ((decode_step < 3) && !break_loop);
393 for (i = 0; i < 51; ++i) {
394 test_string = strtok(NULL,
"\r") + 1;
398 c = *(
unsigned char *)test_string;
400 while ((
c !=
'\t') && (
c > 0)) {
402 c = test_string[temp_str_len];
404 tmp_pos = test_string + temp_str_len;
405 if (*tmp_pos == 0) break_loop =
true;
408 if (decode_step == 1) {
409 pGroups[i] = atoi(test_string);
413 test_string = tmp_pos + 1;
414 }
while ((decode_step < 2) && !break_loop);
420 for (i = 0; i < 51; ++i) {
421 test_string = strtok(NULL,
"\r") + 1;
425 c = *(
unsigned char *)test_string;
427 while ((
c !=
'\t') && (
c > 0)) {
429 c = test_string[temp_str_len];
431 tmp_pos = test_string + temp_str_len;
432 if (*tmp_pos == 0) break_loop =
true;
435 if (decode_step == 1)
439 test_string = tmp_pos + 1;
440 }
while ((decode_step < 2) && !break_loop);
450 unsigned int temp_str_len;
468 for (i = 0; i < 540; ++i) {
469 test_string = strtok(NULL,
"\r") + 1;
473 c = *(
unsigned char *)test_string;
479 while ((
c !=
'\n') && (
c !=
'\t') && (
c > 0)) {
481 c = test_string[temp_str_len];
483 tmp_pos = test_string + temp_str_len;
484 if (*tmp_pos == 0) break_loop =
true;
488 if (decode_step == 0)
490 else if (decode_step == 1)
498 test_string = tmp_pos + 1;
499 }
while ((decode_step < 2) && !break_loop);
509 for (i = 1; i < 59; ++i) {
510 test_string = strtok(NULL,
"\r") + 1;
518 c = *(
unsigned char *)test_string;
520 while ((
c !=
'\t') && (
c > 0)) {
522 c = test_string[temp_str_len];
524 tmp_pos = test_string + temp_str_len;
525 if (*tmp_pos == 0) break_loop =
true;
528 switch (decode_step) {
546 if (!decode_step) break_loop =
true;
549 test_string = tmp_pos + 1;
550 }
while ((decode_step < 7) && !break_loop);
583 int uLocation2D,
int uMapId) {
586 int uGeneratedPortret;
593 signed int gen_attempts;
597 static const unsigned __int8 NPCSexGenTable[86] = {
598 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
599 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0,
600 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0,
601 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0};
602 static const unsigned __int8 NPCRaceGenTable[86] = {
603 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0,
604 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3,
605 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
606 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 0};
608 unsigned __int8 seed = (
unsigned __int8)((
double)(npc_uid - 1) / 3.0);
609 uNPCSex = NPCSexGenTable[seed];
610 uRace = NPCRaceGenTable[seed];
611 pNPCDataBuff->
uSex = uNPCSex;
658 uPortretMin + rand() % (uPortretMax - uPortretMin + 1);
662 if (gen_attempts >= 4) {
663 uGeneratedPortret = uPortretMin;
666 }
while (!break_gen);
670 pNPCDataBuff->
fame = 0;
672 rep_gen = rand() % 100 + 1;
678 pNPCDataBuff->
rep = -600;
680 pNPCDataBuff->
rep = 400;
682 pNPCDataBuff->
rep = -300;
685 pNPCDataBuff->
rep = 200;
688 pNPCDataBuff->
rep = 0;
695 if (max_prof_cap > 0) {
699 while (test_prof_summ < max_prof_cap);
704 pNPCDataBuff->
joins = 1;
705 pNPCDataBuff->
evt_A = 0;
706 pNPCDataBuff->
evt_B = 0;
707 pNPCDataBuff->
evt_C = 0;
708 pNPCDataBuff->
evt_D = 0;
709 pNPCDataBuff->
evt_E = 0;
710 pNPCDataBuff->
evt_F = 0;
715 unsigned __int8 genderId) {
732 if (tolower(this->
pNPCNames[i][genderId][0])) {
740 pickedName = rangeBottom + rand() % (rangeTop - rangeBottom);
742 pickedName = rand() % this->uNumNPCNames[genderId];
746 return this->
pNPCNames[pickedName][genderId];
776 unsigned int temp_str_len;
784 for (i = 1; i < 105; ++i) {
785 test_string = strtok(NULL,
"\r") + 1;
789 c = *(
unsigned char *)test_string;
791 while ((
c !=
'\t') && (
c > 0)) {
793 c = test_string[temp_str_len];
795 tmp_pos = test_string + temp_str_len;
796 if (*tmp_pos == 0) break_loop =
true;
799 if (decode_step == 1)
801 else if (decode_step == 2)
802 pAwards[i].uPriority = atoi(test_string);
807 test_string = tmp_pos + 1;
808 }
while ((decode_step < 3) && !break_loop);
819 unsigned int temp_str_len;
826 for (i = 0; i < 82; ++i) {
827 test_string = strtok(NULL,
"\r") + 1;
831 c = *(
unsigned char *)test_string;
833 while ((
c !=
'\t') && (
c > 0)) {
835 c = test_string[temp_str_len];
837 tmp_pos = test_string + temp_str_len;
838 if (*tmp_pos == 0) break_loop =
true;
846 test_string = tmp_pos + 1;
847 }
while ((decode_step < 2) && !break_loop);
857 unsigned int temp_str_len;
865 for (i = 0; i < 7; ++i) {
866 test_string = strtok(NULL,
"\r") + 1;
870 c = *(
unsigned char *)test_string;
872 while ((
c !=
'\t') && (
c > 0)) {
874 c = test_string[temp_str_len];
876 tmp_pos = test_string + temp_str_len;
877 if (*tmp_pos == 0) break_loop =
true;
880 switch (decode_step) {
899 test_string = tmp_pos + 1;
900 }
while ((decode_step < 5) && !break_loop);
910 unsigned int temp_str_len;
918 for (i = 0; i < 464; ++i) {
919 test_string = strtok(NULL,
"\r") + 1;
923 c = *(
unsigned char *)test_string;
925 while ((
c !=
'\t') && (
c > 0)) {
927 c = test_string[temp_str_len];
929 tmp_pos = test_string + temp_str_len;
930 if (*tmp_pos == 0) break_loop =
true;
933 if (decode_step == 1)
939 test_string = tmp_pos + 1;
940 }
while ((decode_step < 2) && !break_loop);
950 unsigned int temp_str_len;
958 for (i = 0; i < 195; ++i) {
959 test_string = strtok(NULL,
"\r") + 1;
963 c = *(
unsigned char *)test_string;
965 while ((
c !=
'\t') && (
c > 0)) {
967 c = test_string[temp_str_len];
969 tmp_pos = test_string + temp_str_len;
970 if (*tmp_pos == 0) break_loop =
true;
973 switch (decode_step) {
978 if (!_stricmp(test_string,
"potion")) {
982 if (!_stricmp(test_string,
"stat")) {
986 if (!_stricmp(test_string,
"seer")) {
990 if (!_stricmp(test_string,
"obelisk")) {
994 if (!_stricmp(test_string,
"teacher")) {
1006 test_string = tmp_pos + 1;
1007 }
while ((decode_step < 3) && !break_loop);
1017 unsigned int temp_str_len;
1025 for (i = 0; i < 512; ++i) {
1026 test_string = strtok(NULL,
"\r") + 1;
1030 c = *(
unsigned char *)test_string;
1032 while ((
c !=
'\t') && (
c > 0)) {
1034 c = test_string[temp_str_len];
1036 tmp_pos = test_string + temp_str_len;
1037 if (*tmp_pos == 0) break_loop =
true;
1040 if (decode_step == 1)
1046 test_string = tmp_pos + 1;
1047 }
while ((decode_step < 2) && !break_loop);
1053 static const int dialogue_base = 110;
1064 ->_achieved_awards_bits,
1068 if (gold_transaction_amount <= pParty->GetGold()) {
1070 return pNPCTopics[pEventCode + dialogue_base].pText;
1092 {{ui_exit_cancel_button_background}});
1111 int num_menu_buttons;
1122 num_menu_buttons = 0;
1134 486, 445, 75, 33, 1, 0,
UIMSG_BF, 1,
'Y',
1153 {{ui_exit_cancel_button_background}});
1160 num_menu_buttons = 1;
1165 if (num_menu_buttons < 4) {
1167 if (v6 == 1 || v6 == 2)
1169 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1,
1174 if (num_menu_buttons < 4) {
1176 if (v8 == 1 || v8 == 2)
1178 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1,
1183 if (num_menu_buttons < 4) {
1185 if (v10 == 1 || v10 == 2)
1187 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1,
1193 if (num_menu_buttons < 4) {
1195 if (v12 == 1 || v12 == 2)
1197 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu,
1202 if (num_menu_buttons < 4) {
1204 if (v14 == 1 || v14 == 2)
1206 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu,
1211 if (num_menu_buttons < 4) {
1213 if (v16 == 1 || v16 == 2)
1215 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu,
1220 num_menu_buttons, 1, 0, 2);
1228 signed int event_index;
1231 signed int npc_activity;
1235 if (!npc_event_id)
return 0;
1236 evt_seq_num = entry_line;
1242 ready_to_exit =
false;
1250 .uEventOffsetInEVT];
1255 result = npc_activity != 0;
1261 ready_to_exit =
true;
1265 for (
int i = 0; i < 4; ++i) {
1272 EVT_DWORD(_evt->
v7))) {
1275 EVT_BYTE(_evt->
v11) -
1284 result = npc_activity != 0;
1290 ready_to_exit =
true;
1301 EVT_BYTE(_evt->
v5), EVT_DWORD(_evt->
v6),
1302 EVT_BYTE(_evt->
v10))) {
1306 EVT_BYTE(_evt->
v11) -
1316 result = npc_activity != 0;
1332 if (SpeakingNPC_ID >= 0) {
1333 if (SpeakingNPC_ID < 5000)
return 1;
1337 if (SpeakingNPC_ID >= 5000)
return 2;
1365 return ((
unsigned __int8)
buf[
v3] < 2) + 1;
1370 if (a1 == 10 || a1 == 11 || a1 == 12 || a1 == 33 || a1 == 34 || a1 == 39 ||
1371 a1 == 40 || a1 == 41 || a1 == 42 || a1 == 43 || a1 == 52)
1379 switch (profession) {
1381 for (
int i = 0; i < 4; ++i)
1387 for (
int i = 0; i < 4; ++i) {
1391 for (
int j = 0; j < 14; ++j)
1398 for (
int i = 0; i < 4; ++i) {
1404 int v5 = HEXRAYS_LODWORD(
1406 int v6 = HEXRAYS_HIDWORD(
1513 assert(
false &&
"Invalid enum value");