30941 {
30943 {
30945 }
30946 bool flag = false;
30947 bool flag2 =
false;
30948 bool flag3 =
false;
30949 bool flag4 =
false;
30950 bool flag5 =
false;
30951 bool flag6 =
false;
30952 bool flag7 =
false;
30953 bool flag8 =
false;
30954 bool flag9 =
false;
30956 int num = 15;
30958 {
30959 num *= 3;
30960 }
30961 for (
int k =
j;
k < Main.maxTilesY - 10;
k++)
30962 {
30965 if (Main.tile[i,
k].shimmer())
30966 {
30967 return false;
30968 }
30969 if (
trySlope && Main.tile[i,
k].active() && Main.tileSolid[Main.tile[i,
k].type] && !Main.tileSolidTop[Main.tile[i,
k].type])
30970 {
30971 if (Style == 17)
30972 {
30975 {
30977 {
30979 {
30980 return false;
30981 }
30982 if (Main.tile[
l,
m].active() && (Main.tile[
l,
m].type == 21 || Main.tile[
l,
m].type == 467))
30983 {
30984 return false;
30985 }
30986 }
30987 }
30988 }
30989 if (Main.tile[i - 1,
k].topSlope())
30990 {
30991 num2 = Main.tile[
i - 1,
k].slope();
30992 Main.tile[
i - 1,
k].slope(0);
30993 }
30994 if (Main.tile[i,
k].topSlope())
30995 {
30996 num3 = Main.tile[
i,
k].slope();
30997 Main.tile[
i,
k].slope(0);
30998 }
30999 }
31000 if (
remixWorldGen && (
double)i > (
double)Main.maxTilesX * 0.37 && (
double)i < (
double)Main.maxTilesX * 0.63 &&
k > Main.maxTilesY - 250)
31001 {
31002 return false;
31003 }
31006 {
31008 {
31010 {
31011 return false;
31012 }
31013 }
31014 }
31016 {
31017 continue;
31018 }
31023 bool flag12 = (double)
num7 >= Main.worldSurface + 25.0;
31025 {
31027 }
31029 {
31031 }
31032 if (Style >= 0)
31033 {
31035 }
31037 {
31041 contain = ((
num7 <= (GenVars.desertHiveHigh * 3 + GenVars.desertHiveLow * 4) / 7) ? Utils.SelectRandom(
genRand,
new short[4] { 4056, 4055, 4262, 4263 }) : Utils.SelectRandom(
genRand,
new short[3] { 4061, 4062, 4276 }));
31043 {
31045 }
31046 }
31047 if (
chestTileType == 21 && (
num9 == 11 || (
contain == 0 && (
double)
num7 >= Main.worldSurface + 25.0 &&
num7 <= Main.maxTilesY - 205 && (Main.tile[i,
k].type == 147 || Main.tile[i,
k].type == 161 || Main.tile[i,
k].type == 162))))
31048 {
31049 flag = true;
31052 {
31053 0 => 670,
31054 1 => 724,
31055 2 => 950,
31057 4 => 987,
31059 };
31061 {
31063 }
31065 {
31067 }
31069 {
31071 }
31072 }
31074 {
31078 {
31080 }
31081 }
31083 {
31089 {
31091 }
31092 }
31094 {
31097 {
31099 }
31100 }
31102 {
31105 {
31107 }
31108 }
31110 {
31113 {
31115 }
31116 }
31118 {
31120 }
31122 {
31124 }
31126 {
31129 {
31131 {
31133 }
31134 else
31135 {
31138 }
31139 }
31140 }
31142 {
31145 }
31148 {
31150 {
31153 {
31154 GenVars.hellChest = 0;
31155 }
31156 }
31157 Chest chest = Main.chest[
num8];
31160 {
31161 bool flag13 = (double)
num7 < Main.worldSurface + 25.0;
31163 {
31164 flag13 = (double)
num7 >= (Main.rockLayer + (
double)((Main.maxTilesY - 350) * 2)) / 3.0;
31165 }
31167 {
31169 {
31171 chest.item[
num10].Prefix(-1);
31174 {
31175 case 848:
31176 chest.item[
num10].SetDefaults(866);
31178 break;
31179 case 832:
31180 chest.item[
num10].SetDefaults(933);
31183 {
31186 {
31187 case 0:
31189 break;
31190 case 1:
31192 break;
31193 }
31196 }
31197 break;
31198 }
31199 if (Main.tenthAnniversaryWorld &&
flag9)
31200 {
31201 chest.item[
num10++].SetDefaults(848);
31202 chest.item[
num10++].SetDefaults(866);
31203 }
31204 }
31205 else
31206 {
31209 {
31210 chest.item[
num10].SetDefaults(280);
31211 chest.item[
num10].Prefix(-1);
31212 }
31214 {
31215 chest.item[
num10].SetDefaults(281);
31216 chest.item[
num10].Prefix(-1);
31217 }
31219 {
31220 chest.item[
num10].SetDefaults(284);
31221 chest.item[
num10].Prefix(-1);
31222 }
31224 {
31225 chest.item[
num10].SetDefaults(285);
31226 chest.item[
num10].Prefix(-1);
31227 }
31229 {
31230 chest.item[
num10].SetDefaults(953);
31231 chest.item[
num10].Prefix(-1);
31232 }
31234 {
31235 chest.item[
num10].SetDefaults(946);
31236 chest.item[
num10].Prefix(-1);
31237 }
31239 {
31240 chest.item[
num10].SetDefaults(3068);
31241 chest.item[
num10].Prefix(-1);
31242 }
31244 {
31246 {
31247 chest.item[
num10].SetDefaults(517);
31248 chest.item[
num10].Prefix(-1);
31249 }
31250 else
31251 {
31252 chest.item[
num10].SetDefaults(3069);
31253 chest.item[
num10].Prefix(-1);
31254 }
31255 }
31257 {
31258 chest.item[
num10].SetDefaults(3084);
31259 chest.item[
num10].Prefix(-1);
31260 }
31262 {
31263 chest.item[
num10].SetDefaults(4341);
31264 chest.item[
num10].Prefix(-1);
31265 }
31267 }
31269 {
31270 int stack =
genRand.Next(40, 76);
31271 chest.item[
num10].SetDefaults(282);
31272 chest.item[
num10].stack = stack;
31274 }
31276 {
31278 chest.item[
num10].SetDefaults(279);
31281 }
31283 {
31284 chest.item[
num10].SetDefaults(3093);
31285 chest.item[
num10].stack = 1;
31287 {
31289 }
31291 {
31293 }
31295 }
31297 {
31298 chest.item[
num10].SetDefaults(4345);
31299 chest.item[
num10].stack = 1;
31301 {
31303 }
31305 {
31307 }
31309 }
31311 {
31312 chest.item[
num10].SetDefaults(168);
31315 }
31317 {
31321 {
31323 }
31325 {
31327 }
31330 }
31332 {
31334 chest.item[
num10].SetDefaults(965);
31337 }
31339 {
31343 {
31344 chest.item[
num10].SetDefaults(40);
31345 }
31347 {
31348 chest.item[
num10].SetDefaults(42);
31349 }
31352 }
31354 {
31356 chest.item[
num10].SetDefaults(28);
31359 }
31361 {
31362 chest.item[
num10].SetDefaults(2350);
31365 }
31367 {
31371 {
31372 chest.item[
num10].SetDefaults(292);
31373 }
31375 {
31376 chest.item[
num10].SetDefaults(298);
31377 }
31379 {
31380 chest.item[
num10].SetDefaults(299);
31381 }
31383 {
31384 chest.item[
num10].SetDefaults(290);
31385 }
31387 {
31388 chest.item[
num10].SetDefaults(2322);
31389 }
31391 {
31392 chest.item[
num10].SetDefaults(2325);
31393 }
31396 }
31398 {
31402 {
31403 chest.item[
num10].SetDefaults(8);
31404 }
31406 {
31407 chest.item[
num10].SetDefaults(31);
31408 }
31411 }
31413 {
31414 chest.item[
num10].SetDefaults(72);
31417 }
31419 {
31420 chest.item[
num10].SetDefaults(9);
31423 }
31424 }
31426 {
31428 {
31430 {
31431 chest.item[
num10].SetDefaults(933);
31433 }
31435 chest.item[
num10].Prefix(-1);
31438 {
31440 {
31441 chest.item[
num10++].SetDefaults(4425);
31442 }
31444 {
31445 chest.item[
num10++].SetDefaults(4460);
31446 }
31447 }
31449 {
31450 chest.item[
num10++].SetDefaults(4978);
31451 }
31453 {
31456 {
31457 case 0:
31459 break;
31460 case 1:
31462 break;
31463 }
31466 }
31468 {
31469 GenVars.generatedShadowKey = true;
31470 chest.item[
num10].SetDefaults(329);
31472 }
31473 }
31474 else
31475 {
31477 {
31478 case 0:
31479 chest.item[
num10].SetDefaults(49);
31480 chest.item[
num10].Prefix(-1);
31481 break;
31482 case 1:
31483 chest.item[
num10].SetDefaults(50);
31484 chest.item[
num10].Prefix(-1);
31485 break;
31486 case 2:
31487 chest.item[
num10].SetDefaults(53);
31488 chest.item[
num10].Prefix(-1);
31489 break;
31490 case 3:
31491 chest.item[
num10].SetDefaults(54);
31492 chest.item[
num10].Prefix(-1);
31493 break;
31494 case 4:
31495 chest.item[
num10].SetDefaults(5011);
31496 chest.item[
num10].Prefix(-1);
31497 break;
31498 default:
31499 chest.item[
num10].SetDefaults(975);
31500 chest.item[
num10].Prefix(-1);
31501 break;
31502 }
31505 {
31506 chest.item[
num10].SetDefaults(997);
31507 chest.item[
num10].Prefix(-1);
31509 }
31510 else if (
genRand.Next(20) == 0)
31511 {
31512 chest.item[
num10].SetDefaults(930);
31513 chest.item[
num10].Prefix(-1);
31515 chest.item[
num10].SetDefaults(931);
31518 }
31520 {
31521 chest.item[
num10].SetDefaults(4450);
31523 }
31525 {
31526 chest.item[
num10].SetDefaults(4779);
31528 chest.item[
num10].SetDefaults(4780);
31530 chest.item[
num10].SetDefaults(4781);
31532 }
31533 }
31535 {
31537 {
31538 chest.item[
num10].SetDefaults(4423);
31541 }
31542 }
31543 else if (
genRand.Next(3) == 0)
31544 {
31545 chest.item[
num10].SetDefaults(166);
31548 }
31550 {
31551 chest.item[
num10].SetDefaults(52);
31553 }
31555 {
31557 chest.item[
num10].SetDefaults(965);
31560 }
31562 {
31566 {
31568 }
31570 {
31572 }
31575 }
31577 {
31581 {
31582 chest.item[
num10].SetDefaults(40);
31583 }
31585 {
31586 chest.item[
num10].SetDefaults(42);
31587 }
31590 }
31592 {
31594 chest.item[
num10].SetDefaults(28);
31597 }
31599 {
31603 {
31604 chest.item[
num10].SetDefaults(289);
31605 }
31607 {
31608 chest.item[
num10].SetDefaults(298);
31609 }
31611 {
31612 chest.item[
num10].SetDefaults(299);
31613 }
31615 {
31616 chest.item[
num10].SetDefaults(290);
31617 }
31619 {
31620 chest.item[
num10].SetDefaults(303);
31621 }
31623 {
31624 chest.item[
num10].SetDefaults(291);
31625 }
31627 {
31628 chest.item[
num10].SetDefaults(304);
31629 }
31631 {
31632 chest.item[
num10].SetDefaults(2322);
31633 }
31635 {
31636 chest.item[
num10].SetDefaults(2329);
31637 }
31640 }
31642 {
31644 chest.item[
num10].SetDefaults(2350);
31647 }
31649 {
31652 {
31653 chest.item[
num10].SetDefaults(974);
31654 }
31655 else
31656 {
31657 chest.item[
num10].SetDefaults(8);
31658 }
31661 }
31663 {
31664 chest.item[
num10].SetDefaults(72);
31667 }
31668 }
31669 else if (
num7 < Main.maxTilesY - 250 || (
remixWorldGen && (Style == 7 || Style == 14)))
31670 {
31672 {
31674 chest.item[
num10].Prefix(-1);
31676 if (flag &&
genRand.Next(5) == 0)
31677 {
31678 chest.item[
num10].SetDefaults(3199);
31680 }
31682 {
31684 {
31685 chest.item[
num10].SetDefaults(4346);
31687 }
31689 {
31690 chest.item[
num10].SetDefaults(4066);
31692 }
31693 }
31695 {
31696 chest.item[
num10++].SetDefaults(3360);
31697 chest.item[
num10++].SetDefaults(3361);
31698 }
31700 {
31701 chest.item[
num10++].SetDefaults(4426);
31702 }
31704 {
31706 {
31707 chest.item[
num10++].SetDefaults(4425);
31708 }
31710 {
31711 chest.item[
num10++].SetDefaults(4460);
31712 }
31713 }
31715 {
31716 GenVars.generatedShadowKey = true;
31717 chest.item[
num10].SetDefaults(329);
31719 }
31720 }
31721 else
31722 {
31726 {
31727 flag14 = (double)
num7 > Main.worldSurface && (
double)
num7 < Main.rockLayer;
31728 }
31731 {
31733 }
31735 {
31736 chest.item[
num10].SetDefaults(906);
31737 chest.item[
num10].Prefix(-1);
31738 }
31739 else if (
genRand.Next(15) == 0)
31740 {
31741 chest.item[
num10].SetDefaults(997);
31742 chest.item[
num10].Prefix(-1);
31743 }
31744 else
31745 {
31747 {
31748 chest.item[
num10].SetDefaults(49);
31749 chest.item[
num10].Prefix(-1);
31750 }
31752 {
31753 chest.item[
num10].SetDefaults(50);
31754 chest.item[
num10].Prefix(-1);
31755 }
31757 {
31758 chest.item[
num10].SetDefaults(53);
31759 chest.item[
num10].Prefix(-1);
31760 }
31762 {
31763 chest.item[
num10].SetDefaults(54);
31764 chest.item[
num10].Prefix(-1);
31765 }
31767 {
31768 chest.item[
num10].SetDefaults(5011);
31769 chest.item[
num10].Prefix(-1);
31770 }
31772 {
31773 chest.item[
num10].SetDefaults(975);
31774 chest.item[
num10].Prefix(-1);
31775 }
31777 {
31778 chest.item[
num10].SetDefaults(930);
31779 chest.item[
num10].Prefix(-1);
31781 chest.item[
num10].SetDefaults(931);
31783 }
31784 }
31787 {
31789 {
31790 chest.item[
num10].SetDefaults(4450);
31792 }
31793 else
31794 {
31795 chest.item[
num10].SetDefaults(4779);
31797 chest.item[
num10].SetDefaults(4780);
31799 chest.item[
num10].SetDefaults(4781);
31801 }
31802 }
31803 }
31805 {
31806 chest.item[
num10].SetDefaults(43);
31808 }
31810 {
31811 chest.item[
num10].SetDefaults(167);
31813 }
31815 {
31816 chest.item[
num10].SetDefaults(51);
31819 }
31821 {
31825 {
31827 }
31829 {
31831 }
31834 }
31836 {
31840 {
31841 chest.item[
num10].SetDefaults(41);
31842 }
31844 {
31845 chest.item[
num10].SetDefaults(279);
31846 }
31849 }
31851 {
31853 chest.item[
num10].SetDefaults(188);
31856 }
31858 {
31862 {
31863 chest.item[
num10].SetDefaults(296);
31864 }
31866 {
31867 chest.item[
num10].SetDefaults(295);
31868 }
31870 {
31871 chest.item[
num10].SetDefaults(299);
31872 }
31874 {
31875 chest.item[
num10].SetDefaults(302);
31876 }
31878 {
31879 chest.item[
num10].SetDefaults(303);
31880 }
31882 {
31883 chest.item[
num10].SetDefaults(305);
31884 }
31887 }
31889 {
31893 {
31894 chest.item[
num10].SetDefaults(301);
31895 }
31897 {
31898 chest.item[
num10].SetDefaults(297);
31899 }
31901 {
31902 chest.item[
num10].SetDefaults(304);
31903 }
31905 {
31906 chest.item[
num10].SetDefaults(2329);
31907 }
31909 {
31910 chest.item[
num10].SetDefaults(2351);
31911 }
31913 {
31914 chest.item[
num10].SetDefaults(2326);
31915 }
31918 }
31920 {
31922 chest.item[
num10].SetDefaults(2350);
31925 }
31927 {
31931 {
31933 {
31934 chest.item[
num10].SetDefaults(974);
31935 }
31936 else
31937 {
31938 chest.item[
num10].SetDefaults(8);
31939 }
31940 }
31942 {
31943 chest.item[
num10].SetDefaults(282);
31944 }
31947 }
31949 {
31950 chest.item[
num10].SetDefaults(73);
31953 }
31954 }
31955 else
31956 {
31958 {
31960 chest.item[
num10].Prefix(-1);
31963 {
31964 chest.item[
num10].SetDefaults(5010);
31966 }
31968 {
31969 chest.item[
num10].SetDefaults(4443);
31971 }
31973 {
31974 chest.item[
num10].SetDefaults(4737);
31976 }
31978 {
31979 chest.item[
num10].SetDefaults(4551);
31981 }
31982 }
31983 else
31984 {
31987 {
31988 chest.item[
num10].SetDefaults(49);
31989 chest.item[
num10].Prefix(-1);
31990 }
31992 {
31993 chest.item[
num10].SetDefaults(50);
31994 chest.item[
num10].Prefix(-1);
31995 }
31997 {
31998 chest.item[
num10].SetDefaults(53);
31999 chest.item[
num10].Prefix(-1);
32000 }
32002 {
32003 chest.item[
num10].SetDefaults(54);
32004 chest.item[
num10].Prefix(-1);
32005 }
32007 }
32009 {
32010 chest.item[
num10].SetDefaults(167);
32012 }
32014 {
32018 {
32019 chest.item[
num10].SetDefaults(117);
32020 }
32022 {
32024 }
32027 }
32029 {
32033 {
32034 chest.item[
num10].SetDefaults(265);
32035 }
32037 {
32038 if (SavedOreTiers.Silver == 168)
32039 {
32040 chest.item[
num10].SetDefaults(4915);
32041 }
32042 else
32043 {
32044 chest.item[
num10].SetDefaults(278);
32045 }
32046 }
32049 }
32051 {
32053 chest.item[
num10].SetDefaults(227);
32056 }
32058 {
32062 {
32063 chest.item[
num10].SetDefaults(296);
32064 }
32066 {
32067 chest.item[
num10].SetDefaults(295);
32068 }
32070 {
32071 chest.item[
num10].SetDefaults(293);
32072 }
32074 {
32075 chest.item[
num10].SetDefaults(288);
32076 }
32078 {
32079 chest.item[
num10].SetDefaults(294);
32080 }
32082 {
32083 chest.item[
num10].SetDefaults(297);
32084 }
32086 {
32087 chest.item[
num10].SetDefaults(304);
32088 }
32090 {
32091 chest.item[
num10].SetDefaults(2323);
32092 }
32095 }
32097 {
32101 {
32102 chest.item[
num10].SetDefaults(305);
32103 }
32105 {
32106 chest.item[
num10].SetDefaults(301);
32107 }
32109 {
32110 chest.item[
num10].SetDefaults(302);
32111 }
32113 {
32114 chest.item[
num10].SetDefaults(288);
32115 }
32117 {
32118 chest.item[
num10].SetDefaults(300);
32119 }
32121 {
32122 chest.item[
num10].SetDefaults(2351);
32123 }
32125 {
32126 chest.item[
num10].SetDefaults(2348);
32127 }
32129 {
32130 chest.item[
num10].SetDefaults(2345);
32131 }
32134 }
32136 {
32139 {
32140 chest.item[
num10].SetDefaults(2350);
32141 }
32142 else
32143 {
32144 chest.item[
num10].SetDefaults(4870);
32145 }
32148 }
32150 {
32154 {
32155 chest.item[
num10].SetDefaults(8);
32156 }
32158 {
32159 chest.item[
num10].SetDefaults(282);
32160 }
32163 }
32165 {
32166 chest.item[
num10].SetDefaults(73);
32169 }
32170 }
32172 {
32174 {
32175 chest.item[
num10].SetDefaults(2204);
32177 }
32179 {
32180 chest.item[
num10].SetDefaults(2198);
32182 }
32184 {
32185 chest.item[
num10].SetDefaults(2197);
32187 }
32189 {
32192 {
32193 chest.item[
num10].SetDefaults(5258);
32194 }
32196 {
32197 chest.item[
num10].SetDefaults(5226);
32198 }
32200 {
32201 chest.item[
num10].SetDefaults(5254);
32202 }
32204 {
32205 chest.item[
num10].SetDefaults(5238);
32206 }
32208 {
32209 chest.item[
num10].SetDefaults(5255);
32210 }
32212 {
32213 chest.item[
num10].SetDefaults(5388);
32214 }
32216 }
32218 {
32219 chest.item[
num10].SetDefaults(751);
32222 }
32224 {
32225 chest.item[
num10].SetDefaults(2195);
32227 }
32228 if (Main.wallDungeon[Main.tile[i,
k].wall] &&
genRand.Next(8) == 0)
32229 {
32230 chest.item[
num10].SetDefaults(2192);
32232 }
32234 {
32235 chest.item[
num10].SetDefaults(5234);
32237 }
32239 {
32241 {
32242 chest.item[
num10].SetDefaults(2767);
32244 }
32245 else
32246 {
32247 chest.item[
num10].SetDefaults(2766);
32250 }
32251 }
32252 }
32254 {
32255 continue;
32256 }
32258 {
32259 chest.item[
num10].SetDefaults(2197);
32261 }
32263 {
32266 {
32267 chest.item[
num10].SetDefaults(5258);
32268 }
32270 {
32271 chest.item[
num10].SetDefaults(5226);
32272 }
32274 {
32275 chest.item[
num10].SetDefaults(5254);
32276 }
32278 {
32279 chest.item[
num10].SetDefaults(5238);
32280 }
32282 {
32283 chest.item[
num10].SetDefaults(5255);
32284 }
32286 }
32288 {
32289 chest.item[
num10].SetDefaults(751);
32292 }
32294 {
32295 chest.item[
num10].SetDefaults(5234);
32297 }
32298 }
32299 return true;
32300 }
32302 {
32304 {
32305 Main.tile[
i - 1,
k].slope((
byte)
num2);
32306 }
32308 {
32309 Main.tile[
i,
k].slope((
byte)
num3);
32310 }
32311 }
32312 return false;
32313 }
32314 return false;
32315 }
static bool generatedShadowKey
static int[] hellChestItem
static bool remixWorldGen
static bool noTrapsWorldGen
static bool tenthAnniversaryWorldGen
static UnifiedRandom genRand
static bool IsDungeon(int x, int y)
static bool IsUndergroundDesert(int x, int y)
static bool InWorld(int x, int y, int fluff=0)
static bool getGoodWorldGen
static int PlaceChest(int x, int y, ushort type=21, bool notNearOtherChests=false, int style=0)