Guest User

Untitled

a guest
Nov 19th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 46.12 KB | None | 0 0
  1. // public bools (none for now)
  2.  
  3. // public ints (none for now)
  4.  
  5. public static bool hadronDefeated=false;
  6. public static bool alphaDefeated=false;
  7. public static bool GammaSwordDropped=false;
  8. public static bool ArmSpawned=false;
  9.  
  10. public static int HadronDefeated;
  11. public static int AlphaArmDefeated;
  12.  
  13. //-----------------------------------------------------------------
  14.  
  15. // things for alpha's arm
  16.  
  17. public static void DrawChain(Vector2 start, Vector2 end, string name, SpriteBatch spriteBatch){
  18. start -= Main.screenPosition;
  19. end -= Main.screenPosition;
  20.  
  21. int linklength=Main.goreTexture[Config.goreID[name]].Height;
  22. Vector2 chain = end - start;
  23.  
  24. float length = (float)chain.Length();
  25. int numlinks = (int)Math.Ceiling(length/linklength);
  26. Vector2[] links = new Vector2[numlinks];
  27. float rotation = (float)Math.Atan2(chain.Y, chain.X);
  28.  
  29. for (int i = 0; i < numlinks; i++){
  30. links[i] =start + chain/numlinks * i;
  31. }
  32.  
  33. for (int i = 0; i < numlinks; i++){
  34. Color color = Lighting.GetColor((int)((links[i].X+Main.screenPosition.X)/16), (int)((links[i].Y+Main.screenPosition.Y)/16));
  35. spriteBatch.Draw(Main.goreTexture[Config.goreID[name]],
  36. new Rectangle((int)links[i].X, (int)links[i].Y, Main.goreTexture[Config.goreID[name]].Width, linklength), null,
  37. color, rotation+1.57f, new Vector2(Main.goreTexture[Config.goreID[name]].Width/2f, linklength), SpriteEffects.None, 1f);
  38. }
  39. }
  40. // -------------------------------------------------
  41. public void Initialize() // wool things
  42. {
  43. for (int i = 0; i < Recipe.maxRecipes; i++)
  44. {
  45. if (Main.recipe[i].createItem.type == 149)
  46. {
  47. Main.recipe[i].requiredItem[0].SetDefaults("Wool");
  48. Main.recipe[i].requiredItem[0].stack = 50;
  49. }
  50. }
  51. }
  52. // --------------------------------------------------
  53. public static void AlphaCastleGen() { // alpha's castle (just read the strings for info)
  54. byte whiteRock = (byte)Config.tileDefs.ID["White Rock"];
  55. byte NullBlock = (byte)Config.tileDefs.ID["Null Block"];
  56. byte OrganicMat = (byte)Config.tileDefs.ID["Organic Material"];
  57. byte Gate = (byte)Config.tileDefs.ID["Gate"];
  58. int xoff = WorldGen.genRand.Next(150, (int)(Main.maxTilesX / 3));
  59. int yoff = Main.maxTilesY - 150;
  60. NetMessage.SendData(23, -1, -1, "Generating Alpha's Castle, Frame", 0, 255f, 50f, 175f, 0);
  61. for (int x = xoff - 50; x <= xoff + 50; x++)
  62. {
  63. for (int y = yoff - 37; y <= yoff + 37; y++)
  64. {
  65. Main.tile[x, y].active = false;
  66. if (x <= xoff - 45 || x >= xoff + 45 || y <= yoff - 32 || y >= yoff + 32) Main.tile[x, y].active = true;
  67. Main.tile[x, y].liquid = 0;
  68. Main.tile[x, y].lava = false;
  69. Main.tile[x, y].wall = 0;
  70. Main.tile[x, y].type = NullBlock;
  71. if (((x <= xoff - 45 && x >= xoff - 50) || (x <= xoff + 50 && x >= xoff + 45)) && (y <= yoff - 26 && y >= yoff - 31))
  72. {
  73. Main.tile[x, y].type = Gate;
  74. }
  75. }
  76. }
  77. bool hasMadeOpening = false;
  78. bool hasMadeOpeningLeftSide = false;
  79. for(int y = 0; y < 73; y++)
  80. {
  81. if (!(Main.tile[xoff + 51, yoff - y].active) && !hasMadeOpening)
  82. {
  83. Main.tile[xoff + 50, yoff - y].type = Gate;
  84. Main.tile[xoff + 50, yoff - y - 1].type = Gate;
  85. Main.tile[xoff + 50, yoff - y + 1].type = Gate;
  86. for (int opening = 49; opening >= 45; opening--)
  87. {
  88. Main.tile[xoff + opening, yoff - y].active = false;
  89. Main.tile[xoff + opening, yoff - y - 1].active = false;
  90. Main.tile[xoff + opening, yoff - y + 1].active = false;
  91. hasMadeOpening = true;
  92. }
  93. }
  94. if (!(Main.tile[xoff + 51, yoff + y].active) && !hasMadeOpening)
  95. {
  96. Main.tile[xoff + 50, yoff - y].type = Gate;
  97. Main.tile[xoff + 50, yoff - y - 1].type = Gate;
  98. Main.tile[xoff + 50, yoff - y + 1].type = Gate;
  99. for (int opening = 49; opening >= 45; opening--)
  100. {
  101. Main.tile[xoff + opening, yoff - y].active = false;
  102. Main.tile[xoff + opening, yoff - y - 1].active = false;
  103. Main.tile[xoff + opening, yoff - y + 1].active = false;
  104. hasMadeOpening = true;
  105. }
  106. }
  107. if (!(Main.tile[xoff - 51, yoff - y].active) && !hasMadeOpeningLeftSide)
  108. {
  109. Main.tile[xoff - 50, yoff - y].type = Gate;
  110. Main.tile[xoff - 50, yoff - y - 1].type = Gate;
  111. Main.tile[xoff - 50, yoff - y + 1].type = Gate;
  112. for (int opening = 49; opening >= 45; opening--)
  113. {
  114. Main.tile[xoff - opening, yoff - y].active = false;
  115. Main.tile[xoff - opening, yoff - y - 1].active = false;
  116. Main.tile[xoff - opening, yoff - y + 1].active = false;
  117. hasMadeOpeningLeftSide = true;
  118. }
  119. }
  120. if (!(Main.tile[xoff - 51, yoff + y].active) && !hasMadeOpeningLeftSide)
  121. {
  122. Main.tile[xoff - 50, yoff - y].type = Gate;
  123. Main.tile[xoff - 50, yoff - y - 1].type = Gate;
  124. Main.tile[xoff - 50, yoff - y + 1].type = Gate;
  125. for (int opening = 49; opening >= 45; opening--)
  126. {
  127. Main.tile[xoff - opening, yoff - y].active = false;
  128. Main.tile[xoff - opening, yoff - y - 1].active = false;
  129. Main.tile[xoff - opening, yoff - y + 1].active = false;
  130. hasMadeOpeningLeftSide = true;
  131. }
  132. }
  133. }
  134. NetMessage.SendData(23, -1, -1, "Generatign Alpha's Castle, Gates", 1, 255f, 50f, 175f, 0);
  135. if (!hasMadeOpening)
  136. {
  137. Main.tile[xoff + 50, yoff].type = Gate;
  138. Main.tile[xoff + 50, yoff - 1].type = Gate;
  139. Main.tile[xoff + 50, yoff + 1].type = Gate;
  140. for (int opening = 49; opening >= 45; opening--)
  141. {
  142. Main.tile[xoff + opening, yoff].active = false;
  143. Main.tile[xoff + opening, yoff - 1].active = false;
  144. Main.tile[xoff + opening, yoff + 1].active = false;
  145. }
  146. }
  147. if (!hasMadeOpeningLeftSide)
  148. {
  149. Main.tile[xoff - 50, yoff].type = Gate;
  150. Main.tile[xoff - 50, yoff - 1].type = Gate;
  151. Main.tile[xoff - 50, yoff + 1].type = Gate;
  152. for (int opening = 49; opening >= 45; opening--)
  153. {
  154. Main.tile[xoff - opening, yoff].active = false;
  155. Main.tile[xoff - opening, yoff - 1].active = false;
  156. Main.tile[xoff - opening, yoff + 1].active = false;
  157. }
  158. }
  159. NetMessage.SendData(23, -1, -1, "Generating Alpha's Castle, Frame 2", 1, 255f, 50f, 175f, 0);
  160. for (int x2 = xoff - 45; x2 <= xoff + 45; x2++)
  161. {
  162. for (int y2 = yoff - 25; y2 <= yoff - 20; y2++)
  163. {
  164. Main.tile[x2, y2].active = true;
  165. Main.tile[x2, y2].wall = 0;
  166. Main.tile[x2, y2].liquid = 0;
  167. Main.tile[x2, y2].type = NullBlock;
  168. if ((x2 <= xoff - 25 && x2 >= xoff - 30) || (x2 <= xoff + 30 && x2 >= xoff + 25))
  169. {
  170. if (y2 == yoff - 25 || y2 == yoff - 20)
  171. {
  172. Main.tile[x2, y2].type = 19;
  173. }
  174. else Main.tile[x2, y2].active = false;
  175. }
  176. }
  177. }
  178. NetMessage.SendData(23, -1, -1, "Generating Alpha's Castle, Frame 3", 1, 255f, 50f, 175f, 0);
  179. for (int x4 = xoff - 45; x4 <= xoff + 45; x4++)
  180. {
  181. for (int y4 = yoff + 2; y4 <= yoff + 7; y4++)
  182. {
  183. Main.tile[x4, y4].active = true;
  184. Main.tile[x4, y4].wall = 0;
  185. Main.tile[x4, y4].liquid = 0;
  186. Main.tile[x4, y4].type = NullBlock;
  187. if ((x4 <= xoff - 25 && x4 >= xoff - 30) || (x4 <= xoff + 30 && x4 >= xoff + 25))
  188. {
  189. if (y4 == yoff + 2 || y4 == yoff + 7)
  190. {
  191. Main.tile[x4, y4].type = 19;
  192. }
  193. else Main.tile[x4, y4].active = false;
  194. }
  195. }
  196. }
  197. NetMessage.SendData(23, -1, -1, "Generating Alpha's Castle, Frame 4", 1, 255f, 50f, 175f, 0);
  198. for (int x5 = xoff - 45; x5 <= xoff + 45; x5++)
  199. {
  200. for (int y5 = yoff + 15; y5 <= yoff + 20; y5++)
  201. {
  202. Main.tile[x5, y5].active = true;
  203. Main.tile[x5, y5].wall = 0;
  204. Main.tile[x5, y5].liquid = 0;
  205. Main.tile[x5, y5].type = NullBlock;
  206. if ((x5 <= xoff - 25 && x5 >= xoff - 30) || (x5 <= xoff + 30 && x5 >= xoff + 25))
  207. {
  208. if (y5 == yoff + 15 || y5 == yoff + 20)
  209. {
  210. Main.tile[x5, y5].type = 19;
  211. }
  212. else if (y5 >= yoff + 16 && y5 <= yoff + 19)
  213. {
  214. Main.tile[x5, y5].active = false;
  215. }
  216. }
  217. }
  218. }
  219. NetMessage.SendData(23, -1, -1, "Generating Alpha's Castle, White Rock", 0, 255f, 50f, 175f, 0);
  220. for (int whiteRockX = xoff - 45; whiteRockX <= xoff + 45; whiteRockX++)
  221. {
  222. for (int whiteRockY = yoff + 21; whiteRockY <= yoff + 31; whiteRockY++)
  223. {
  224. Main.tile[whiteRockX, whiteRockY].liquid = 0;
  225. Main.tile[whiteRockX, whiteRockY].wall = 0;
  226. Main.tile[whiteRockX, whiteRockY].active = true;
  227. Main.tile[whiteRockX, whiteRockY].type = whiteRock;
  228. if (WorldGen.genRand.Next(5) == 0)
  229. {
  230. Main.tile[whiteRockX, whiteRockY].type = OrganicMat;
  231. }
  232. }
  233. }
  234. NetMessage.SendData(23, -1, -1, "Generating Alpha's Castle, Lighting 1", 0, 255f, 50f, 175f, 0);
  235. for (int lanternX = xoff - 45; lanternX <= xoff + 45; lanternX++)
  236. {
  237. for (int lanternY = yoff - 32; lanternY <= yoff + 14; lanternY++)
  238. {
  239. if (((lanternX == xoff - 40 || lanternX == xoff - 28 || lanternX == xoff - 15 || lanternX == xoff || lanternX == xoff + 15 || lanternX == xoff + 28 || lanternX == xoff + 40) && lanternY == yoff - 31))
  240. {
  241. WorldGen.Place1x2Top(lanternX, lanternY, 22);
  242. }
  243. if (((lanternX == xoff - 40 || lanternX == xoff - 15 || lanternX == xoff || lanternX == xoff + 15 || lanternX == xoff + 40) && lanternY == yoff - 19))
  244. {
  245. WorldGen.Place1x2Top(lanternX, lanternY, 22);
  246. }
  247. if (((lanternX == xoff - 40 || lanternX == xoff - 15 || lanternX == xoff || lanternX == xoff + 15 || lanternX == xoff + 40) && lanternY == yoff + 8))
  248. {
  249. WorldGen.Place1x2Top(lanternX, lanternY, 22);
  250. }
  251. if (((lanternX == xoff - 40 || lanternX == xoff - 15 || lanternX == xoff || lanternX == xoff + 15 || lanternX == xoff + 40) && lanternY == yoff + 1))
  252. {
  253. WorldGen.PlaceTile(lanternX, lanternY, 129, true, true, -1, 8);
  254. }
  255. }
  256. }
  257. NetMessage.SendData(23, -1, -1, "Generating Alpha's Castle, Lighting 2", 0, 255f, 50f, 175f, 0);
  258. for (int torchX = xoff - 45; torchX <= xoff + 45; torchX++)
  259. {
  260. for (int torchY = yoff - 32; torchY <= yoff + 20; torchY++)
  261. {
  262. if ((torchX == xoff - 30 || torchX == xoff - 25 || torchX == xoff + 25 || torchX == xoff + 30) && torchY == yoff - 23)
  263. {
  264. WorldGen.PlaceTile(torchX, torchY, 129, true, true, -1, 8);
  265. }
  266. if ((torchX == xoff - 30 || torchX == xoff - 25 || torchX == xoff + 25 || torchX == xoff + 30) && torchY == yoff + 4)
  267. {
  268. WorldGen.PlaceTile(torchX, torchY, 129, true, true, -1, 8);
  269. }
  270. if ((torchX == xoff - 30 || torchX == xoff - 25 || torchX == xoff + 25 || torchX == xoff + 30) && torchY == yoff + 17)
  271. {
  272. WorldGen.PlaceTile(torchX, torchY, 129, true, true, -1, 8);
  273. }
  274. }
  275. }
  276. NetMessage.SendData(23, -1, -1, "Generating Alpha's Castle, Lighting 3", 0, 255f, 50f, 175f, 0);
  277. for (int platx = xoff - 2; platx <= xoff + 2; platx++)
  278. {
  279. for (int platy = yoff + 32; platy <= yoff + 37; platy++)
  280. {
  281. Main.tile[platx, platy].active = false;
  282. if (platy == yoff + 32 || platy == yoff + 37)
  283. {
  284. Main.tile[platx, platy].active = true;
  285. Main.tile[platx, platy].type = 19;
  286. }
  287. if ((platx == xoff + 2 || platx == xoff - 2) && platy == yoff + 34)
  288. {
  289. WorldGen.PlaceTile(platx, platy, 4, true, true, -1, 8);
  290. }
  291. }
  292. }
  293. NetMessage.SendData(23, -1, -1, "Generating Alpha's Castle, Lighting 4, Chests 1", 0, 255f, 50f, 175f, 0);
  294. for (int chestBoxX = xoff - 17; chestBoxX <= xoff + 16; chestBoxX++)
  295. {
  296. for (int chestBoxY = yoff + 38; chestBoxY <= yoff + 55; chestBoxY++)
  297. {
  298. if (((chestBoxX <= xoff - 12 && chestBoxX >= xoff - 17) || (chestBoxX <= xoff + 16 && chestBoxX >= xoff + 11)) && (chestBoxY <= yoff + 55 && chestBoxY >= yoff + 38))
  299. {
  300. Main.tile[chestBoxX, chestBoxY].active = true;
  301. Main.tile[chestBoxX, chestBoxY].wall = 0;
  302. Main.tile[chestBoxX, chestBoxY].liquid = 0;
  303. Main.tile[chestBoxX, chestBoxY].lava = false;
  304. Main.tile[chestBoxX, chestBoxY].type = NullBlock;
  305. }
  306. if ((chestBoxX >= xoff - 11 && chestBoxX <= xoff + 10) && (chestBoxY >= yoff + 38 && chestBoxY <= yoff + 50))
  307. {
  308. Main.tile[chestBoxX, chestBoxY].active = false;
  309. Main.tile[chestBoxX, chestBoxY].wall = 0;
  310. Main.tile[chestBoxX, chestBoxY].liquid = 0;
  311. Main.tile[chestBoxX, chestBoxY].lava = false;
  312. }
  313. if ((chestBoxX <= xoff + 10 && chestBoxX >= xoff - 11) && (chestBoxY >= yoff + 51 && chestBoxY <= yoff + 55))
  314. {
  315. Main.tile[chestBoxX, chestBoxY].active = true;
  316. Main.tile[chestBoxX, chestBoxY].liquid = 0;
  317. Main.tile[chestBoxX, chestBoxY].lava = false;
  318. Main.tile[chestBoxX, chestBoxY].wall = 0;
  319. Main.tile[chestBoxX, chestBoxY].type = NullBlock;
  320. }
  321. if ((chestBoxX >= xoff - 2 && chestBoxX <= xoff + 1) && (chestBoxY >= yoff + 47 && chestBoxY <= yoff + 50))
  322. {
  323. Main.tile[chestBoxX, chestBoxY].active = true;
  324. Main.tile[chestBoxX, chestBoxY].type = Gate;
  325. if ((chestBoxX == xoff - 1 || chestBoxX == xoff) && (chestBoxY == yoff + 48 || chestBoxY == yoff + 49))
  326. {
  327. Main.tile[chestBoxX, chestBoxY].active = false;
  328. }
  329. }
  330. if (AddHellfireChest(xoff, yoff + 49, Config.itemDefs.byName["Beta"].type, false, 1))
  331. {
  332. }
  333. }
  334. }
  335. NetMessage.SendData(23, -1, -1, "Generating Alpha's Castle, Frame 5", 0, 255f, 50f, 175f, 0);
  336. for (int leftSideX = xoff - 65; leftSideX <= xoff - 51; leftSideX++)
  337. {
  338. for (int leftSideY = yoff - 37; leftSideY <= yoff + 37; leftSideY++)
  339. {
  340. if ((leftSideX <= xoff - 51 && leftSideX >= xoff - 65) && (leftSideY <= yoff + 37 && leftSideY >= yoff - 37))
  341. {
  342. Main.tile[leftSideX, leftSideY].active = true;
  343. Main.tile[leftSideX, leftSideY].liquid = 0;
  344. Main.tile[leftSideX, leftSideY].wall = 0;
  345. Main.tile[leftSideX, leftSideY].lava = false;
  346. Main.tile[leftSideX, leftSideY].type = NullBlock;
  347. }
  348. if ((leftSideX >= xoff - 60 && leftSideX <= xoff - 51) && ((leftSideY <= yoff - 26 && leftSideY >= yoff - 31) || (leftSideY <= yoff + 31 && leftSideY >= yoff + 26)))
  349. {
  350. Main.tile[leftSideX, leftSideY].active = false;
  351. }
  352. if (leftSideX == xoff - 65 && (leftSideY == yoff - 1 || leftSideY == yoff || leftSideY == yoff + 1))
  353. {
  354. Main.tile[leftSideX, leftSideY].type = Gate;
  355. }
  356. if ((leftSideX >= xoff - 64 && leftSideX <= xoff - 51) && (leftSideY == yoff - 1 || leftSideY == yoff || leftSideY == yoff + 1))
  357. {
  358. Main.tile[leftSideX, leftSideY].active = false;
  359. }
  360. if ((leftSideX >= xoff - 60 && leftSideX <= xoff - 55) && ((leftSideY <= yoff + 26 && leftSideY >= yoff + 5) || (leftSideY <= yoff - 5 && leftSideY >= yoff - 26)))
  361. {
  362. Main.tile[leftSideX, leftSideY].active = false;
  363. if (leftSideX == xoff - 60 && (leftSideY == yoff + 18 || leftSideY == yoff - 18))
  364. {
  365. WorldGen.PlaceTile(leftSideX, leftSideY, 4, true, true, -1, 8);
  366. }
  367. }
  368. if ((leftSideX <= xoff - 54 && leftSideX >= xoff - 59) && (leftSideY == yoff + 5 || leftSideY == yoff - 5))
  369. {
  370. Main.tile[leftSideX, leftSideY].active = false;
  371. }
  372. if ((leftSideX <= xoff - 53 && leftSideX >= xoff - 58) && (leftSideY == yoff + 4 || leftSideY == yoff - 4))
  373. {
  374. Main.tile[leftSideX, leftSideY].active = false;
  375. }
  376. if ((leftSideX <= xoff - 52 && leftSideX >= xoff - 57) && (leftSideY == yoff + 3 || leftSideY == yoff - 3))
  377. {
  378. Main.tile[leftSideX, leftSideY].active = false;
  379. }
  380. if ((leftSideX <= xoff - 51 && leftSideX >= xoff - 56) && (leftSideY == yoff + 2 || leftSideY == yoff - 2))
  381. {
  382. Main.tile[leftSideX, leftSideY].active = true;
  383. Main.tile[leftSideX, leftSideY].type = 19;
  384. }
  385. if (leftSideX == xoff - 60 && (leftSideY == yoff - 5 || leftSideY == yoff + 5))
  386. {
  387. Main.tile[leftSideX, leftSideY].active = true;
  388. }
  389. if (leftSideX == xoff - 55 && leftSideY == yoff + 31)
  390. {
  391. Main.tile[leftSideX, leftSideY].active = true;
  392. Main.tile[leftSideX, leftSideY].type = 4;
  393. Main.tile[leftSideX, leftSideY].frameX = (short)0;
  394. Main.tile[leftSideX, leftSideY].frameY = (short)176;
  395. }
  396. }
  397. }
  398. NetMessage.SendData(23, -1, -1, "Generating Alpha's Castle, Frame 6", 0, 255f, 50f, 175f, 0);
  399. for (int rightSideX = xoff + 51; rightSideX <= xoff + 65; rightSideX++)
  400. {
  401. for (int rightSideY = yoff - 37; rightSideY <= yoff + 37; rightSideY++)
  402. {
  403. if ((rightSideX >= xoff + 51 && rightSideX <= xoff + 65) && (rightSideY <= yoff + 37 && rightSideY >= yoff - 37))
  404. {
  405. Main.tile[rightSideX, rightSideY].active = true;
  406. Main.tile[rightSideX, rightSideY].liquid = 0;
  407. Main.tile[rightSideX, rightSideY].wall = 0;
  408. Main.tile[rightSideX, rightSideY].lava = false;
  409. Main.tile[rightSideX, rightSideY].type = NullBlock;
  410. }
  411. if ((rightSideX <= xoff + 60 && rightSideX >= xoff + 51) && ((rightSideY <= yoff - 26 && rightSideY >= yoff - 31) || (rightSideY <= yoff + 31 && rightSideY >= yoff + 26)))
  412. {
  413. Main.tile[rightSideX, rightSideY].active = false;
  414. }
  415. if (rightSideX == xoff + 65 && (rightSideY == yoff - 1 || rightSideY == yoff || rightSideY == yoff + 1))
  416. {
  417. Main.tile[rightSideX, rightSideY].type = Gate;
  418. }
  419. if ((rightSideX <= xoff + 64 && rightSideX >= xoff + 51) && (rightSideY == yoff - 1 || rightSideY == yoff || rightSideY == yoff + 1))
  420. {
  421. Main.tile[rightSideX, rightSideY].active = false;
  422. }
  423. if ((rightSideX <= xoff + 60 && rightSideX >= xoff + 55) && ((rightSideY <= yoff + 26 && rightSideY >= yoff + 5) || (rightSideY <= yoff - 5 && rightSideY >= yoff - 26)))
  424. {
  425. Main.tile[rightSideX, rightSideY].active = false;
  426. if (rightSideX == xoff + 60 && (rightSideY == yoff + 18 || rightSideY == yoff - 18))
  427. {
  428. Main.tile[rightSideX, rightSideY].active = true;
  429. Main.tile[rightSideX, rightSideY].type = 4;
  430. Main.tile[rightSideX, rightSideY].frameX = (short)44;
  431. Main.tile[rightSideX, rightSideY].frameY = (short)176;
  432. }
  433. }
  434. if ((rightSideX >= xoff + 54 && rightSideX <= xoff + 59) && (rightSideY == yoff + 5 || rightSideY == yoff - 5))
  435. {
  436. Main.tile[rightSideX, rightSideY].active = false;
  437. }
  438. if ((rightSideX >= xoff + 53 && rightSideX <= xoff + 58) && (rightSideY == yoff + 4 || rightSideY == yoff - 4))
  439. {
  440. Main.tile[rightSideX, rightSideY].active = false;
  441. }
  442. if ((rightSideX >= xoff + 52 && rightSideX <= xoff + 57) && (rightSideY == yoff + 3 || rightSideY == yoff - 3))
  443. {
  444. Main.tile[rightSideX, rightSideY].active = false;
  445. }
  446. if ((rightSideX >= xoff + 51 && rightSideX <= xoff + 56) && (rightSideY == yoff + 2 || rightSideY == yoff - 2))
  447. {
  448. Main.tile[rightSideX, rightSideY].active = true;
  449. Main.tile[rightSideX, rightSideY].type = 19;
  450. }
  451. if (rightSideX == xoff + 60 && (rightSideY == yoff - 5 || rightSideY == yoff + 5))
  452. {
  453. Main.tile[rightSideX, rightSideY].active = true;
  454. }
  455. if (rightSideX == xoff + 55 && rightSideY == yoff + 31)
  456. {
  457. Main.tile[rightSideX, rightSideY].active = true;
  458. Main.tile[rightSideX, rightSideY].type = 4;
  459. Main.tile[rightSideX, rightSideY].frameX = (short)0;
  460. Main.tile[rightSideX, rightSideY].frameY = (short)176;
  461. }
  462. }
  463. }
  464. NetMessage.SendData(23, -1, -1, "Generating Alpha's Castle, Books 1", 0, 255f, 50f, 175f, 0);
  465. for (int shelfX = xoff - 65; shelfX <= xoff + 65; shelfX++)
  466. {
  467. for (int shelfY = yoff - 37; shelfY <= yoff + 55; shelfY++)
  468. {
  469. if (((shelfX == xoff - 59 || shelfX == xoff - 60) || (shelfX == xoff + 60 || shelfX == xoff + 59)) && (shelfY == yoff - 10 || shelfY == yoff + 10))
  470. {
  471. Main.tile[shelfX, shelfY].active = true;
  472. Main.tile[shelfX, shelfY].type = 19;
  473. Main.tile[shelfX, shelfY - 1].active = true;
  474. Main.tile[shelfX, shelfY - 1].type = 50;
  475. int randomBook = WorldGen.genRand.Next(5);
  476. if (randomBook == 0)
  477. {
  478. if (WorldGen.genRand.Next(25) == 0)
  479. {
  480. Main.tile[shelfX, shelfY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
  481. Main.tile[shelfX, shelfY - 1].frameX = (short)0;
  482. Main.tile[shelfX, shelfY - 1].frameY = (short)0;
  483. }
  484. else Main.tile[shelfX, shelfY - 1].frameX = (short)0;
  485. }
  486. else if (randomBook == 1)
  487. {
  488. if (WorldGen.genRand.Next(25) == 0)
  489. {
  490. Main.tile[shelfX, shelfY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
  491. Main.tile[shelfX, shelfY - 1].frameX = (short)0;
  492. Main.tile[shelfX, shelfY - 1].frameY = (short)0;
  493. }
  494. else Main.tile[shelfX, shelfY - 1].frameX = (short)18;
  495. }
  496. else if (randomBook == 2)
  497. {
  498. if (WorldGen.genRand.Next(25) == 0)
  499. {
  500. Main.tile[shelfX, shelfY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
  501. Main.tile[shelfX, shelfY - 1].frameX = (short)0;
  502. Main.tile[shelfX, shelfY - 1].frameY = (short)0;
  503. }
  504. else Main.tile[shelfX, shelfY - 1].frameX = (short)36;
  505. }
  506. else if (randomBook == 3)
  507. {
  508. if (WorldGen.genRand.Next(25) == 0)
  509. {
  510. Main.tile[shelfX, shelfY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
  511. Main.tile[shelfX, shelfY - 1].frameX = (short)0;
  512. Main.tile[shelfX, shelfY - 1].frameY = (short)0;
  513. }
  514. else Main.tile[shelfX, shelfY - 1].frameX = (short)54;
  515. }
  516. else if (randomBook == 4)
  517. {
  518. if (WorldGen.genRand.Next(25) == 0)
  519. {
  520. Main.tile[shelfX, shelfY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
  521. Main.tile[shelfX, shelfY - 1].frameX = (short)0;
  522. Main.tile[shelfX, shelfY - 1].frameY = (short)0;
  523. }
  524. else Main.tile[shelfX, shelfY - 1].frameX = (short)72;
  525. }
  526. }
  527. if (((shelfX == xoff - 55 || shelfX == xoff - 56) || (shelfX == xoff + 56 || shelfX == xoff + 55)) && (shelfY == yoff - 20 || shelfY == yoff + 20))
  528. {
  529. Main.tile[shelfX, shelfY].active = true;
  530. Main.tile[shelfX, shelfY].type = 19;
  531. Main.tile[shelfX, shelfY - 1].active = true;
  532. Main.tile[shelfX, shelfY - 1].type = 50;
  533. int randomBook2 = WorldGen.genRand.Next(5);
  534. if (randomBook2 == 0)
  535. {
  536. if (WorldGen.genRand.Next(25) == 0)
  537. {
  538. Main.tile[shelfX, shelfY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
  539. Main.tile[shelfX, shelfY - 1].frameX = (short)0;
  540. Main.tile[shelfX, shelfY - 1].frameY = (short)0;
  541. }
  542. else Main.tile[shelfX, shelfY - 1].frameX = (short)0;
  543. }
  544. else if (randomBook2 == 1)
  545. {
  546. if (WorldGen.genRand.Next(25) == 0)
  547. {
  548. Main.tile[shelfX, shelfY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
  549. Main.tile[shelfX, shelfY - 1].frameX = (short)0;
  550. Main.tile[shelfX, shelfY - 1].frameY = (short)0;
  551. }
  552. else Main.tile[shelfX, shelfY - 1].frameX = (short)18;
  553. }
  554. else if (randomBook2 == 2)
  555. {
  556. if (WorldGen.genRand.Next(25) == 0)
  557. {
  558. Main.tile[shelfX, shelfY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
  559. Main.tile[shelfX, shelfY - 1].frameX = (short)0;
  560. Main.tile[shelfX, shelfY - 1].frameY = (short)0;
  561. }
  562. else Main.tile[shelfX, shelfY - 1].frameX = (short)36;
  563. }
  564. else if (randomBook2 == 3)
  565. {
  566. if (WorldGen.genRand.Next(25) == 0)
  567. {
  568. Main.tile[shelfX, shelfY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
  569. Main.tile[shelfX, shelfY - 1].frameX = (short)0;
  570. Main.tile[shelfX, shelfY - 1].frameY = (short)0;
  571. }
  572. else Main.tile[shelfX, shelfY - 1].frameX = (short)54;
  573. }
  574. else if (randomBook2 == 4)
  575. {
  576. if (WorldGen.genRand.Next(25) == 0)
  577. {
  578. Main.tile[shelfX, shelfY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
  579. Main.tile[shelfX, shelfY - 1].frameX = (short)0;
  580. Main.tile[shelfX, shelfY - 1].frameY = (short)0;
  581. }
  582. else Main.tile[shelfX, shelfY - 1].frameX = (short)72;
  583. }
  584. }
  585. Main.tile[xoff - 44, yoff + 11].active = true;
  586. Main.tile[xoff - 44, yoff + 11].type = 19;
  587. Main.tile[xoff + 44, yoff + 11].active = true;
  588. Main.tile[xoff + 44, yoff + 11].type = 19;
  589. if (((shelfX >= xoff - 43 && shelfX <= xoff - 41) || (shelfX >= xoff + 41 && shelfX <= xoff + 43)) && shelfY == yoff + 11)
  590. {
  591. Main.tile[shelfX, shelfY].active = true;
  592. Main.tile[shelfX, shelfY].type = 19;
  593. Main.tile[shelfX, shelfY - 1].active = true;
  594. Main.tile[shelfX, shelfY - 1].type = 50;
  595. int randomBook3 = WorldGen.genRand.Next(5);
  596. if (randomBook3 == 0)
  597. {
  598. if (WorldGen.genRand.Next(25) == 0)
  599. {
  600. Main.tile[shelfX, shelfY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
  601. Main.tile[shelfX, shelfY - 1].frameX = (short)0;
  602. Main.tile[shelfX, shelfY - 1].frameY = (short)0;
  603. }
  604. else Main.tile[shelfX, shelfY - 1].frameX = (short)0;
  605. }
  606. else if (randomBook3 == 1)
  607. {
  608. if (WorldGen.genRand.Next(25) == 0)
  609. {
  610. Main.tile[shelfX, shelfY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
  611. Main.tile[shelfX, shelfY - 1].frameX = (short)0;
  612. Main.tile[shelfX, shelfY - 1].frameY = (short)0;
  613. }
  614. else Main.tile[shelfX, shelfY - 1].frameX = (short)18;
  615. }
  616. else if (randomBook3 == 2)
  617. {
  618. if (WorldGen.genRand.Next(25) == 0)
  619. {
  620. Main.tile[shelfX, shelfY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
  621. Main.tile[shelfX, shelfY - 1].frameX = (short)0;
  622. Main.tile[shelfX, shelfY - 1].frameY = (short)0;
  623. }
  624. else Main.tile[shelfX, shelfY - 1].frameX = (short)36;
  625. }
  626. else if (randomBook3 == 3)
  627. {
  628. if (WorldGen.genRand.Next(25) == 0)
  629. {
  630. Main.tile[shelfX, shelfY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
  631. Main.tile[shelfX, shelfY - 1].frameX = (short)0;
  632. Main.tile[shelfX, shelfY - 1].frameY = (short)0;
  633. }
  634. else Main.tile[shelfX, shelfY - 1].frameX = (short)54;
  635. }
  636. else if (randomBook3 == 4)
  637. {
  638. if (WorldGen.genRand.Next(25) == 0)
  639. {
  640. Main.tile[shelfX, shelfY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
  641. Main.tile[shelfX, shelfY - 1].frameX = (short)0;
  642. Main.tile[shelfX, shelfY - 1].frameY = (short)0;
  643. }
  644. else Main.tile[shelfX, shelfY - 1].frameX = (short)72;
  645. }
  646. }
  647. if (((shelfX >= xoff - 11 && shelfX <= xoff - 10) || (shelfX >= xoff + 9 && shelfX <= xoff + 10)) && shelfY == yoff + 43)
  648. {
  649. Main.tile[shelfX, shelfY].active = true;
  650. Main.tile[shelfX, shelfY].type = 19;
  651. Main.tile[shelfX, shelfY - 1].active = true;
  652. Main.tile[shelfX, shelfY - 1].type = 50;
  653. int randomBook4 = WorldGen.genRand.Next(5);
  654. if (randomBook4 == 0)
  655. {
  656. if (WorldGen.genRand.Next(25) == 0)
  657. {
  658. Main.tile[shelfX, shelfY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
  659. Main.tile[shelfX, shelfY - 1].frameX = (short)0;
  660. Main.tile[shelfX, shelfY - 1].frameY = (short)0;
  661. }
  662. else Main.tile[shelfX, shelfY - 1].frameX = (short)0;
  663. }
  664. else if (randomBook4 == 1)
  665. {
  666. if (WorldGen.genRand.Next(25) == 0)
  667. {
  668. Main.tile[shelfX, shelfY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
  669. Main.tile[shelfX, shelfY - 1].frameX = (short)0;
  670. Main.tile[shelfX, shelfY - 1].frameY = (short)0;
  671. }
  672. else Main.tile[shelfX, shelfY - 1].frameX = (short)18;
  673. }
  674. else if (randomBook4 == 2)
  675. {
  676. if (WorldGen.genRand.Next(25) == 0)
  677. {
  678. Main.tile[shelfX, shelfY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
  679. Main.tile[shelfX, shelfY - 1].frameX = (short)0;
  680. Main.tile[shelfX, shelfY - 1].frameY = (short)0;
  681. }
  682. else Main.tile[shelfX, shelfY - 1].frameX = (short)36;
  683. }
  684. else if (randomBook4 == 3)
  685. {
  686. if (WorldGen.genRand.Next(25) == 0)
  687. {
  688. Main.tile[shelfX, shelfY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
  689. Main.tile[shelfX, shelfY - 1].frameX = (short)0;
  690. Main.tile[shelfX, shelfY - 1].frameY = (short)0;
  691. }
  692. else Main.tile[shelfX, shelfY - 1].frameX = (short)54;
  693. }
  694. else if (randomBook4 == 4)
  695. {
  696. if (WorldGen.genRand.Next(25) == 0)
  697. {
  698. Main.tile[shelfX, shelfY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
  699. Main.tile[shelfX, shelfY - 1].frameX = (short)0;
  700. Main.tile[shelfX, shelfY - 1].frameY = (short)0;
  701. }
  702. else Main.tile[shelfX, shelfY - 1].frameX = (short)72;
  703. }
  704. }
  705. }
  706. }
  707. NetMessage.SendData(23, -1, -1, "Generating Alpha's Castle, Books 2, Traps 1", 0, 255f, 50f, 175f, 0);
  708. for (int trapX = xoff - 50; trapX <= xoff + 50; trapX++)
  709. {
  710. for (int trapY = yoff - 37; trapY <= yoff + 37; trapY++)
  711. {
  712. if ((trapX == xoff - 12 || trapX == xoff - 11 || trapX == xoff + 11 || trapX == xoff + 12) && (trapY >= yoff - 19 && trapY <= yoff - 12))
  713. {
  714. Main.tile[trapX, trapY].active = true;
  715. Main.tile[trapX, trapY].type = NullBlock;
  716. }
  717. if ((trapX == xoff - 10 || trapX == xoff + 10) && trapY == yoff - 15)
  718. {
  719. Main.tile[trapX, trapY].active = true;
  720. Main.tile[trapX, trapY].type = 4;
  721. Main.tile[trapX, trapY].frameX = (short)0;
  722. Main.tile[trapX, trapY].frameY = (short)176;
  723. }
  724. if (((trapX >= xoff - 10 && trapX <= xoff - 8) || (trapX <= xoff + 10 && trapX >= xoff + 8)) && (trapY == yoff - 13 && trapY == yoff - 17))
  725. {
  726. Main.tile[trapX, trapY].active = true;
  727. Main.tile[trapX, trapY].type = 19;
  728. Main.tile[trapX, trapY - 1].active = true;
  729. Main.tile[trapX, trapY - 1].type = 50;
  730. int randomBook5 = WorldGen.genRand.Next(5);
  731. if (randomBook5 == 0)
  732. {
  733. if (WorldGen.genRand.Next(25) == 0)
  734. {
  735. Main.tile[trapX, trapY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
  736. Main.tile[trapX, trapY - 1].frameX = (short)0;
  737. Main.tile[trapX, trapY - 1].frameY = (short)0;
  738. }
  739. else Main.tile[trapX, trapY - 1].frameX = (short)0;
  740. }
  741. else if (randomBook5 == 1)
  742. {
  743. if (WorldGen.genRand.Next(25) == 0)
  744. {
  745. Main.tile[trapX, trapY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
  746. Main.tile[trapX, trapY - 1].frameX = (short)0;
  747. Main.tile[trapX, trapY - 1].frameY = (short)0;
  748. }
  749. else Main.tile[trapX, trapY - 1].frameX = (short)18;
  750. }
  751. else if (randomBook5 == 2)
  752. {
  753. if (WorldGen.genRand.Next(25) == 0)
  754. {
  755. Main.tile[trapX, trapY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
  756. Main.tile[trapX, trapY - 1].frameX = (short)0;
  757. Main.tile[trapX, trapY - 1].frameY = (short)0;
  758. }
  759. else Main.tile[trapX, trapY - 1].frameX = (short)36;
  760. }
  761. else if (randomBook5 == 3)
  762. {
  763. if (WorldGen.genRand.Next(25) == 0)
  764. {
  765. Main.tile[trapX, trapY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
  766. Main.tile[trapX, trapY - 1].frameX = (short)0;
  767. Main.tile[trapX, trapY - 1].frameY = (short)0;
  768. }
  769. else Main.tile[trapX, trapY - 1].frameX = (short)54;
  770. }
  771. else if (randomBook5 == 4)
  772. {
  773. if (WorldGen.genRand.Next(25) == 0)
  774. {
  775. Main.tile[trapX, trapY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
  776. Main.tile[trapX, trapY - 1].frameX = (short)0;
  777. Main.tile[trapX, trapY - 1].frameY = (short)0;
  778. }
  779. else Main.tile[trapX, trapY - 1].frameX = (short)72;
  780. }
  781. }
  782. if ((trapX == xoff - 45 || trapX == xoff + 45) && trapY == yoff - 8)
  783. {
  784. Main.tile[trapX, trapY].active = true;
  785. if (trapX == xoff - 45)
  786. {
  787. WorldGen.PlaceTile(trapX, trapY, 137, true, true, -1, 1);
  788. }
  789. else WorldGen.PlaceTile(trapX, trapY, 137, true, true, -1, -1);
  790. }
  791. if (((trapX >= xoff - 44 && trapX <= xoff - 30) || (trapX <= xoff + 44 && trapX >= xoff + 30) || (trapX >= xoff - 12 && trapX <= xoff + 12)) && (trapY == yoff - 7 || trapY == yoff - 6))
  792. {
  793. Main.tile[trapX, trapY].active = true;
  794. Main.tile[trapX, trapY].type = NullBlock;
  795. if ((trapX == xoff - 8 || trapX == xoff + 8) && trapY == yoff - 7)
  796. {
  797. WorldGen.PlaceTile(trapX, trapY, 4, true, true, -1, 8);
  798. }
  799. }
  800. if (trapX == xoff && trapY == yoff - 8)
  801. {
  802. Main.tile[trapX, trapY].active = true;
  803. Main.tile[trapX, trapY].type = 135;
  804. Main.tile[trapX, trapY].frameX = (short)0;
  805. Main.tile[trapX, trapY].frameY = (short)36;
  806. }
  807. if ((trapX >= xoff - 45 && trapX <= xoff + 45) && trapY == yoff - 8)
  808. {
  809. Main.tile[trapX, trapY].wire = true;
  810. }
  811. }
  812. }
  813. NetMessage.SendData(23, -1, -1, "Generating Alpha's Castle, Lighting 3", 0, 255f, 50f, 175f, 0);
  814. for (int lanternX2 = xoff - 65; lanternX2 <= xoff + 65; lanternX2++)
  815. {
  816. for (int lanternY2 = yoff - 32; lanternY2 <= yoff + 55; lanternY2++)
  817. {
  818. if ((lanternX2 == xoff - 55 || lanternX2 == xoff + 55) && lanternY2 == yoff - 31)
  819. {
  820. WorldGen.Place1x2Top(lanternX2, lanternY2, 42);
  821. }
  822. if ((lanternX2 == xoff - 7 || lanternX2 == xoff + 7) && lanternY2 == yoff + 38)
  823. {
  824. WorldGen.Place1x2Top(lanternX2, lanternY2, 42);
  825. }
  826. if ((lanternX2 == xoff - 7 || lanternX2 == xoff + 7) && lanternY2 == yoff + 50)
  827. {
  828. Main.tile[lanternX2, lanternY2].active = true;
  829. Main.tile[lanternX2, lanternY2].type = 4;
  830. Main.tile[lanternX2, lanternY2].frameX = (short)0;
  831. Main.tile[lanternX2, lanternY2].frameY = (short)176;
  832. }
  833. }
  834. }
  835. NetMessage.SendData(23, -1, -1, "Generating Alpha's Castle, Traps 2", 0, 255f, 50f, 175f, 0);
  836. for (int trap2X = xoff - 17; trap2X <= xoff + 16; trap2X++)
  837. {
  838. for (int trap2Y = yoff + 38; trap2Y <= yoff + 55; trap2Y++)
  839. {
  840. if ((trap2X == xoff || trap2X == xoff - 1) && trap2Y == yoff + 46)
  841. {
  842. Main.tile[trap2X, trap2Y].active = true;
  843. Main.tile[trap2X, trap2Y].type = 135;
  844. Main.tile[trap2X, trap2Y].frameX = (short)0;
  845. Main.tile[trap2X, trap2Y].frameY = (short)36;
  846. }
  847. if ((trap2X == xoff - 12 || trap2X == xoff + 11) && trap2Y == yoff + 46)
  848. {
  849. if (trap2X == xoff - 12)
  850. {
  851. WorldGen.PlaceTile(trap2X, trap2Y, 137, true, true, -1, 1);
  852. }
  853. else WorldGen.PlaceTile(trap2X, trap2Y, 137, true, true, -1, -1);
  854. }
  855. if ((trap2X >= xoff - 12 && trap2X <= xoff + 11) && trap2Y == yoff + 46)
  856. {
  857. Main.tile[trap2X, trap2Y].wire = true;
  858. }
  859. }
  860. }
  861. NetMessage.SendData(23, -1, -1, "Generating Alpha's Castle, Statues 1", 0, 255f, 50f, 175f, 0);
  862. for (int statueX = xoff - 65; statueX <= xoff + 65; statueX++)
  863. {
  864. for (int statueY = yoff - 37; statueY <= yoff + 55; statueY++)
  865. {
  866. if ((statueX == xoff - 9 || statueX == xoff + 8) && statueY == yoff + 50)
  867. {
  868. WorldGen.PlaceTile(statueX, statueY, 105, true, true, -1, 13);
  869. }
  870. if ((statueX == xoff - 52 || statueX == xoff + 51) && statueY == yoff - 26)
  871. {
  872. WorldGen.PlaceTile(statueX, statueY, 105, true, true, -1, 14);
  873. }
  874. if ((statueX == xoff - 52 || statueX == xoff + 51) && statueY == yoff + 31)
  875. {
  876. WorldGen.PlaceTile(statueX, statueY, 105, true, true, -1, 36);
  877. }
  878. }
  879. }
  880. NetMessage.SendData(23, -1, -1, "Generating Alpha's Castle, Traps 3", 0, 255f, 50f, 175f, 0);
  881. for (int trap3X = xoff - 65; trap3X <= xoff + 65; trap3X++)
  882. {
  883. for (int trap3Y = yoff - 37; trap3Y <= yoff - 10; trap3Y++)
  884. {
  885. if ((trap3X == xoff - 54 || trap3X == xoff + 54) && trap3Y == yoff - 26)
  886. {
  887. Main.tile[trap3X, trap3Y].active = true;
  888. Main.tile[trap3X, trap3Y].type = 135;
  889. Main.tile[trap3X, trap3Y].frameX = (short)0;
  890. Main.tile[trap3X, trap3Y].frameY = (short)36;
  891. }
  892. if ((trap3X == xoff - 61 || trap3X == xoff + 61) && trap3Y == yoff - 26)
  893. {
  894. if (trap3X == xoff - 61)
  895. {
  896. WorldGen.PlaceTile(trap3X, trap3Y, 137, true, true, -1, 1);
  897. }
  898. else WorldGen.PlaceTile(trap3X, trap3Y, 137, true, true, -1, -1);
  899. }
  900. if (((trap3X >= xoff - 61 && trap3X <= xoff - 54) || (trap3X >= xoff + 54 && trap3X <= xoff + 61)) && trap3Y == yoff - 26)
  901. {
  902. Main.tile[trap3X, trap3Y].wire = true;
  903. }
  904. }
  905. }
  906. NetMessage.SendData(23, -1, -1, "Finishing Generation of Alpha's Castle", 0, 255f, 50f, 175f, 0);
  907. Main.tile[xoff - 44, yoff - 12].active = true;
  908. Main.tile[xoff - 44, yoff - 12].type = 4;
  909. Main.tile[xoff - 44, yoff - 12].frameX = (short)24;
  910. Main.tile[xoff - 44, yoff - 12].frameY = (short)176;
  911. Main.tile[xoff + 44, yoff - 12].active = true;
  912. Main.tile[xoff + 44, yoff - 12].type = 4;
  913. Main.tile[xoff + 44, yoff - 12].frameX = (short)44;
  914. Main.tile[xoff + 44, yoff - 12].frameY = (short)176;
  915. Main.tile[xoff - 62, yoff + 1].active = true;
  916. Main.tile[xoff - 62, yoff + 1].type = 4;
  917. Main.tile[xoff - 62, yoff + 1].frameX = (short)0;
  918. Main.tile[xoff - 62, yoff + 1].frameY = (short)176;
  919. Main.tile[xoff + 62, yoff + 1].active = true;
  920. Main.tile[xoff + 62, yoff + 1].type = 4;
  921. Main.tile[xoff + 62, yoff + 1].frameX = (short)0;
  922. Main.tile[xoff + 62, yoff + 1].frameY = (short)176;
  923. }
  924. public static bool AddHellfireChest(int i, int j, int contain = 0, bool notNearOtherChests = false, int Style = -1) // the chest
  925. {
  926. NetMessage.SendData(23, -1, -1, "Setting Chests", 0, 255f, 50f, 175f, 0);
  927. if (WorldGen.genRand == null)
  928. {
  929. WorldGen.genRand = new Random((int)DateTime.Now.Ticks);
  930. }
  931. int k = j;
  932. while (k < Main.maxTilesY)
  933. {
  934. if (Main.tile[i, k].active && Main.tileSolid[(int)Main.tile[i, k].type])
  935. {
  936. int num = k;
  937. int num2 = WorldGen.PlaceChest(i - 1, num - 1, 21, notNearOtherChests, 4);
  938. if (num2 >= 0)
  939. {
  940. int num3 = 0;
  941. while (num3 == 0)
  942. {
  943. if (contain > 0)
  944. {
  945. Main.chest[num2].item[num3].SetDefaults(contain, false);
  946. Main.chest[num2].item[num3].Prefix(-1);
  947. num3++;
  948. }
  949. int randomNum = WorldGen.genRand.Next(7);
  950. if (randomNum == 0)
  951. {
  952. Main.chest[num2].item[num3].SetDefaults(Config.itemDefs.byName["Wooden Sword"].type, false);
  953. Main.chest[num2].item[num3].Prefix(-1);
  954. num3++;
  955. }
  956. else if (randomNum == 1)
  957. {
  958. Main.chest[num2].item[num3].SetDefaults(Config.itemDefs.byName["Wooden Sword"].type, false);
  959. Main.chest[num2].item[num3].Prefix(-1);
  960. num3++;
  961. }
  962. else if (randomNum == 2)
  963. {
  964. Main.chest[num2].item[num3].SetDefaults(489, false);
  965. Main.chest[num2].item[num3].Prefix(-1);
  966. num3++;
  967. }
  968. else if (randomNum == 3)
  969. {
  970. Main.chest[num2].item[num3].SetDefaults(490, false);
  971. Main.chest[num2].item[num3].Prefix(-1);
  972. num3++;
  973. }
  974. else if (randomNum == 4)
  975. {
  976. Main.chest[num2].item[num3].SetDefaults(353, false);
  977. int numOfAles = WorldGen.genRand.Next(3) + 1;
  978. Main.chest[num2].item[num3].stack = numOfAles;
  979. num3++;
  980. }
  981. else if (randomNum == 5)
  982. {
  983. Main.chest[num2].item[num3].SetDefaults(Config.itemDefs.byName["Dirt Block"].type, false);
  984. int numOfGRPotions = WorldGen.genRand.Next(12, 23);
  985. Main.chest[num2].item[num3].stack = numOfGRPotions;
  986. num3++;
  987. }
  988. else
  989. {
  990. Main.chest[num2].item[num3].SetDefaults(491, false);
  991. Main.chest[num2].item[num3].Prefix(-1);
  992. num3++;
  993. }
  994. Main.chest[num2].item[num3].SetDefaults(Config.itemDefs.byName["Dirt Block"].type, false);
  995. int numOfBars = WorldGen.genRand.Next(22, 37);
  996. Main.chest[num2].item[num3].stack = numOfBars;
  997. Main.chest[num2].item[3].SetDefaults(Config.itemDefs.byName["Dirt Block"].type, false);
  998. int numOfBricks = WorldGen.genRand.Next(11, 55);
  999. Main.chest[num2].item[3].stack = numOfBricks;
  1000. Main.chest[num2].item[4].SetDefaults(73, false);
  1001. int numOfCoins = WorldGen.genRand.Next(45, 110);
  1002. Main.chest[num2].item[4].stack = numOfCoins;
  1003. int randomNum2 = WorldGen.genRand.Next(11);
  1004. if (randomNum2 == 0)
  1005. {
  1006. Main.chest[num2].item[5].SetDefaults(391, false);
  1007. int numOfBars2 = WorldGen.genRand.Next(10, 30);
  1008. Main.chest[num2].item[5].stack = numOfBars2;
  1009. }
  1010. else if (randomNum2 == 1)
  1011. {
  1012. Main.chest[num2].item[5].SetDefaults(522, false);
  1013. int numOfCF = WorldGen.genRand.Next(10, 30);
  1014. Main.chest[num2].item[5].stack = numOfCF;
  1015. }
  1016. else if (randomNum2 == 2)
  1017. {
  1018. Main.chest[num2].item[5].SetDefaults(Config.itemDefs.byName["Dirt Block"].type, false);
  1019. int numOfSD = WorldGen.genRand.Next(3, 8);
  1020. Main.chest[num2].item[5].stack = numOfSD;
  1021. }
  1022. else if (randomNum2 == 3)
  1023. {
  1024. Main.chest[num2].item[5].SetDefaults(Config.itemDefs.byName["Dirt Block"].type, false);
  1025. int numOfSP = WorldGen.genRand.Next(3, 8);
  1026. Main.chest[num2].item[5].stack = numOfSP;
  1027. }
  1028. else if (randomNum2 == 4)
  1029. {
  1030. Main.chest[num2].item[5].SetDefaults(575, false);
  1031. int numOfSoFl = WorldGen.genRand.Next(5, 7);
  1032. Main.chest[num2].item[5].stack = numOfSoFl;
  1033. }
  1034. else if (randomNum2 == 5)
  1035. {
  1036. Main.chest[num2].item[5].SetDefaults(547, false);
  1037. int numOfSoFr = WorldGen.genRand.Next(5, 7);
  1038. Main.chest[num2].item[5].stack = numOfSoFr;
  1039. }
  1040. else if (randomNum2 == 6)
  1041. {
  1042. Main.chest[num2].item[5].SetDefaults(548, false);
  1043. int numOfSoM = WorldGen.genRand.Next(5, 7);
  1044. Main.chest[num2].item[5].stack = numOfSoM;
  1045. }
  1046. else if (randomNum2 == 7)
  1047. {
  1048. Main.chest[num2].item[5].SetDefaults(549, false);
  1049. int numOfSoS = WorldGen.genRand.Next(5, 7);
  1050. Main.chest[num2].item[5].stack = numOfSoS;
  1051. }
  1052. else if (randomNum2 == 8)
  1053. {
  1054. Main.chest[num2].item[5].SetDefaults(520, false);
  1055. int numOfSoL = WorldGen.genRand.Next(5, 7);
  1056. Main.chest[num2].item[5].stack = numOfSoL;
  1057. }
  1058. else if (randomNum2 == 9)
  1059. {
  1060. Main.chest[num2].item[5].SetDefaults(521, false);
  1061. int numOfSoN = WorldGen.genRand.Next(5, 7);
  1062. Main.chest[num2].item[5].stack = numOfSoN;
  1063. }
  1064. else
  1065. {
  1066. Main.chest[num2].item[5].SetDefaults(Config.itemDefs.byName["WDirt Block"].type, false);
  1067. int numOfSH = WorldGen.genRand.Next(3, 8);
  1068. Main.chest[num2].item[5].stack = numOfSH;
  1069. }
  1070. int randomNum3 = WorldGen.genRand.Next(4);
  1071. if (randomNum3 == 0)
  1072. {
  1073. Main.chest[num2].item[6].SetDefaults(Config.itemDefs.byName["Dirt Block"].type, false);
  1074. int numOfAPotions = WorldGen.genRand.Next(2, 4);
  1075. Main.chest[num2].item[6].stack = numOfAPotions;
  1076. }
  1077. else if (randomNum3 == 1)
  1078. {
  1079. Main.chest[num2].item[6].SetDefaults(Config.itemDefs.byName["Dirt Block"].type, false);
  1080. int numOfIPotions = WorldGen.genRand.Next(1, 4);
  1081. Main.chest[num2].item[6].stack = numOfIPotions;
  1082. }
  1083. else if (randomNum == 2)
  1084. {
  1085. Main.chest[num2].item[6].SetDefaults(Config.itemDefs.byName["Dirt Block"].type, false);
  1086. int numOfSPotions = WorldGen.genRand.Next(3, 5);
  1087. Main.chest[num2].item[6].stack = numOfSPotions;
  1088. }
  1089. else
  1090. {
  1091. Main.chest[num2].item[6].SetDefaults(437, false);
  1092. }
  1093. Main.chest[num2].item[7].SetDefaults(Config.itemDefs.byName["Wooden Sword"].type, false);
  1094. Main.chest[num2].item[7].stack = (WorldGen.genRand.Next(2) + 1);
  1095. }
  1096. return true;
  1097. }
  1098. return false;
  1099. }
  1100. else
  1101. {
  1102. k++;
  1103. }
  1104. }
  1105. return false;
  1106. }
  1107. public static void dropAlienMat()
  1108. {
  1109. NetMessage.SendData(23, -1, -1, "Generating Alien Material", 0, 255f, 50f, 175f, 0);
  1110. int tileType=Config.tileDefs.ID["Alien Materials"];
  1111. bool flag = true;
  1112. int num = 0;
  1113. if (Main.netMode == 1)
  1114. {
  1115. return;
  1116. }
  1117. for (int i = 0; i < 255; i++)
  1118. {
  1119. if (Main.player[i].active)
  1120. {
  1121. flag = false;
  1122. break;
  1123. }
  1124. }
  1125. int num2 = 0;
  1126. float num3 = (float)(Main.maxTilesX / 4200);
  1127. int num4 = (int)(400f * num3);
  1128. for (int j = 5; j < Main.maxTilesX - 5; j++)
  1129. {
  1130. int num5 = 5;
  1131. while ((double)num5 < Main.worldSurface)
  1132. {
  1133. if (Main.tile[j, num5].active && Main.tile[j, num5].type == tileType)
  1134. {
  1135. num2++;
  1136. if (num2 > num4)
  1137. {
  1138. return;
  1139. }
  1140. }
  1141. num5++;
  1142. }
  1143. }
  1144. while (!flag)
  1145. {
  1146. float num6 = (float)Main.maxTilesX * 0.08f;
  1147. int num7 = Main.rand.Next(50, Main.maxTilesX - 50);
  1148. while ((float)num7 > (float)Main.spawnTileX - num6 && (float)num7 < (float)Main.spawnTileX + num6)
  1149. {
  1150. num7 = Main.rand.Next(50, Main.maxTilesX - 50);
  1151. }
  1152. for (int k = Main.rand.Next(100); k < Main.maxTilesY; k++)
  1153. {
  1154. if (Main.tile[num7, k].active && Main.tileSolid[(int)Main.tile[num7, k].type])
  1155. {
  1156. flag = WorldGen.AlienMat(num7, k);
  1157. break;
  1158. }
  1159. }
  1160. num++;
  1161. if (num >= 100)
  1162. {
  1163. return;
  1164. }
  1165. }
  1166. }
  1167. public static bool AlienMat(int i, int j)
  1168. {
  1169. NetMessage.SendData(23, -1, -1, "Generating Alien Material 2", 0, 255f, 50f, 175f, 0);
  1170. int tileType=Config.tileDefs.ID["Alien Materials"];
  1171. if (i < 50 || i > Main.maxTilesX - 50)
  1172. {
  1173. return false;
  1174. }
  1175. if (j < 50 || j > Main.maxTilesY - 50)
  1176. {
  1177. return false;
  1178. }
  1179. int num = 25;
  1180. Rectangle rectangle = new Rectangle((i - num) * 16, (j - num) * 16, num * 2 * 16, num * 2 * 16);
  1181. for (int k = 0; k < 255; k++)
  1182. {
  1183. if (Main.player[k].active)
  1184. {
  1185. Rectangle value = new Rectangle((int)(Main.player[k].position.X + (float)(Main.player[k].width / 2) - (float)(NPC.sWidth / 2) - (float)NPC.safeRangeX), (int)(Main.player[k].position.Y + (float)(Main.player[k].height / 2) - (float)(NPC.sHeight / 2) - (float)NPC.safeRangeY), NPC.sWidth + NPC.safeRangeX * 2, NPC.sHeight + NPC.safeRangeY * 2);
  1186. if (rectangle.Intersects(value))
  1187. {
  1188. return false;
  1189. }
  1190. }
  1191. }
  1192. for (int l = 0; l < 200; l++)
  1193. {
  1194. if (Main.npc[l].active)
  1195. {
  1196. Rectangle value2 = new Rectangle((int)Main.npc[l].position.X, (int)Main.npc[l].position.Y, Main.npc[l].width, Main.npc[l].height);
  1197. if (rectangle.Intersects(value2))
  1198. {
  1199. return false;
  1200. }
  1201. }
  1202. }
  1203. for (int m = i - num; m < i + num; m++)
  1204. {
  1205. for (int n = j - num; n < j + num; n++)
  1206. {
  1207. if (Main.tile[m, n].active && Main.tile[m, n].type == 21)
  1208. {
  1209. return false;
  1210. }
  1211. }
  1212. }
  1213. WorldGen.stopDrops = true;
  1214. num = 15;
  1215. for (int num2 = i - num; num2 < i + num; num2++)
  1216. {
  1217. for (int num3 = j - num; num3 < j + num; num3++)
  1218. {
  1219. if (num3 > j + Main.rand.Next(-2, 3) - 5 && (double)(Math.Abs(i - num2) + Math.Abs(j - num3)) < (double)num * 1.5 + (double)Main.rand.Next(-5, 5))
  1220. {
  1221. if (!Main.tileSolid[(int)Main.tile[num2, num3].type])
  1222. {
  1223. Main.tile[num2, num3].active = false;
  1224. }
  1225. Main.tile[num2, num3].type = tileType;
  1226. }
  1227. }
  1228. }
  1229. num = 10;
  1230. for (int num4 = i - num; num4 < i + num; num4++)
  1231. {
  1232. for (int num5 = j - num; num5 < j + num; num5++)
  1233. {
  1234. if (num5 > j + Main.rand.Next(-2, 3) - 5 && Math.Abs(i - num4) + Math.Abs(j - num5) < num + Main.rand.Next(-3, 4))
  1235. {
  1236. Main.tile[num4, num5].active = false;
  1237. }
  1238. }
  1239. }
  1240. num = 16;
  1241. for (int num6 = i - num; num6 < i + num; num6++)
  1242. {
  1243. for (int num7 = j - num; num7 < j + num; num7++)
  1244. {
  1245. if (Main.tile[num6, num7].type == 5 || Main.tile[num6, num7].type == 32)
  1246. {
  1247. WorldGen.KillTile(num6, num7, false, false, false, null);
  1248. }
  1249. WorldGen.SquareTileFrame(num6, num7, true);
  1250. WorldGen.SquareWallFrame(num6, num7, true);
  1251. }
  1252. }
  1253. num = 23;
  1254. for (int num8 = i - num; num8 < i + num; num8++)
  1255. {
  1256. for (int num9 = j - num; num9 < j + num; num9++)
  1257. {
  1258. if (Main.tile[num8, num9].active && Main.rand.Next(10) == 0 && (double)(Math.Abs(i - num8) + Math.Abs(j - num9)) < (double)num * 1.3)
  1259. {
  1260. if (Main.tile[num8, num9].type == 5 || Main.tile[num8, num9].type == 32)
  1261. {
  1262. WorldGen.KillTile(num8, num9, false, false, false, null);
  1263. }
  1264. Main.tile[num8, num9].type = tileType;
  1265. WorldGen.SquareTileFrame(num8, num9, true);
  1266. }
  1267. }
  1268. }
  1269. WorldGen.stopDrops = false;
  1270. return true;
  1271. }
Add Comment
Please, Sign In to add comment