Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // public bools (none for now)
- // public ints (none for now)
- public static bool hadronDefeated=false;
- public static bool alphaDefeated=false;
- public static bool GammaSwordDropped=false;
- public static bool ArmSpawned=false;
- public static int HadronDefeated;
- public static int AlphaArmDefeated;
- //-----------------------------------------------------------------
- // things for alpha's arm
- public static void DrawChain(Vector2 start, Vector2 end, string name, SpriteBatch spriteBatch){
- start -= Main.screenPosition;
- end -= Main.screenPosition;
- int linklength=Main.goreTexture[Config.goreID[name]].Height;
- Vector2 chain = end - start;
- float length = (float)chain.Length();
- int numlinks = (int)Math.Ceiling(length/linklength);
- Vector2[] links = new Vector2[numlinks];
- float rotation = (float)Math.Atan2(chain.Y, chain.X);
- for (int i = 0; i < numlinks; i++){
- links[i] =start + chain/numlinks * i;
- }
- for (int i = 0; i < numlinks; i++){
- Color color = Lighting.GetColor((int)((links[i].X+Main.screenPosition.X)/16), (int)((links[i].Y+Main.screenPosition.Y)/16));
- spriteBatch.Draw(Main.goreTexture[Config.goreID[name]],
- new Rectangle((int)links[i].X, (int)links[i].Y, Main.goreTexture[Config.goreID[name]].Width, linklength), null,
- color, rotation+1.57f, new Vector2(Main.goreTexture[Config.goreID[name]].Width/2f, linklength), SpriteEffects.None, 1f);
- }
- }
- // -------------------------------------------------
- public void Initialize() // wool things
- {
- for (int i = 0; i < Recipe.maxRecipes; i++)
- {
- if (Main.recipe[i].createItem.type == 149)
- {
- Main.recipe[i].requiredItem[0].SetDefaults("Wool");
- Main.recipe[i].requiredItem[0].stack = 50;
- }
- }
- }
- // --------------------------------------------------
- public static void AlphaCastleGen() { // alpha's castle (just read the strings for info)
- byte whiteRock = (byte)Config.tileDefs.ID["White Rock"];
- byte NullBlock = (byte)Config.tileDefs.ID["Null Block"];
- byte OrganicMat = (byte)Config.tileDefs.ID["Organic Material"];
- byte Gate = (byte)Config.tileDefs.ID["Gate"];
- int xoff = WorldGen.genRand.Next(150, (int)(Main.maxTilesX / 3));
- int yoff = Main.maxTilesY - 150;
- NetMessage.SendData(23, -1, -1, "Generating Alpha's Castle, Frame", 0, 255f, 50f, 175f, 0);
- for (int x = xoff - 50; x <= xoff + 50; x++)
- {
- for (int y = yoff - 37; y <= yoff + 37; y++)
- {
- Main.tile[x, y].active = false;
- if (x <= xoff - 45 || x >= xoff + 45 || y <= yoff - 32 || y >= yoff + 32) Main.tile[x, y].active = true;
- Main.tile[x, y].liquid = 0;
- Main.tile[x, y].lava = false;
- Main.tile[x, y].wall = 0;
- Main.tile[x, y].type = NullBlock;
- if (((x <= xoff - 45 && x >= xoff - 50) || (x <= xoff + 50 && x >= xoff + 45)) && (y <= yoff - 26 && y >= yoff - 31))
- {
- Main.tile[x, y].type = Gate;
- }
- }
- }
- bool hasMadeOpening = false;
- bool hasMadeOpeningLeftSide = false;
- for(int y = 0; y < 73; y++)
- {
- if (!(Main.tile[xoff + 51, yoff - y].active) && !hasMadeOpening)
- {
- Main.tile[xoff + 50, yoff - y].type = Gate;
- Main.tile[xoff + 50, yoff - y - 1].type = Gate;
- Main.tile[xoff + 50, yoff - y + 1].type = Gate;
- for (int opening = 49; opening >= 45; opening--)
- {
- Main.tile[xoff + opening, yoff - y].active = false;
- Main.tile[xoff + opening, yoff - y - 1].active = false;
- Main.tile[xoff + opening, yoff - y + 1].active = false;
- hasMadeOpening = true;
- }
- }
- if (!(Main.tile[xoff + 51, yoff + y].active) && !hasMadeOpening)
- {
- Main.tile[xoff + 50, yoff - y].type = Gate;
- Main.tile[xoff + 50, yoff - y - 1].type = Gate;
- Main.tile[xoff + 50, yoff - y + 1].type = Gate;
- for (int opening = 49; opening >= 45; opening--)
- {
- Main.tile[xoff + opening, yoff - y].active = false;
- Main.tile[xoff + opening, yoff - y - 1].active = false;
- Main.tile[xoff + opening, yoff - y + 1].active = false;
- hasMadeOpening = true;
- }
- }
- if (!(Main.tile[xoff - 51, yoff - y].active) && !hasMadeOpeningLeftSide)
- {
- Main.tile[xoff - 50, yoff - y].type = Gate;
- Main.tile[xoff - 50, yoff - y - 1].type = Gate;
- Main.tile[xoff - 50, yoff - y + 1].type = Gate;
- for (int opening = 49; opening >= 45; opening--)
- {
- Main.tile[xoff - opening, yoff - y].active = false;
- Main.tile[xoff - opening, yoff - y - 1].active = false;
- Main.tile[xoff - opening, yoff - y + 1].active = false;
- hasMadeOpeningLeftSide = true;
- }
- }
- if (!(Main.tile[xoff - 51, yoff + y].active) && !hasMadeOpeningLeftSide)
- {
- Main.tile[xoff - 50, yoff - y].type = Gate;
- Main.tile[xoff - 50, yoff - y - 1].type = Gate;
- Main.tile[xoff - 50, yoff - y + 1].type = Gate;
- for (int opening = 49; opening >= 45; opening--)
- {
- Main.tile[xoff - opening, yoff - y].active = false;
- Main.tile[xoff - opening, yoff - y - 1].active = false;
- Main.tile[xoff - opening, yoff - y + 1].active = false;
- hasMadeOpeningLeftSide = true;
- }
- }
- }
- NetMessage.SendData(23, -1, -1, "Generatign Alpha's Castle, Gates", 1, 255f, 50f, 175f, 0);
- if (!hasMadeOpening)
- {
- Main.tile[xoff + 50, yoff].type = Gate;
- Main.tile[xoff + 50, yoff - 1].type = Gate;
- Main.tile[xoff + 50, yoff + 1].type = Gate;
- for (int opening = 49; opening >= 45; opening--)
- {
- Main.tile[xoff + opening, yoff].active = false;
- Main.tile[xoff + opening, yoff - 1].active = false;
- Main.tile[xoff + opening, yoff + 1].active = false;
- }
- }
- if (!hasMadeOpeningLeftSide)
- {
- Main.tile[xoff - 50, yoff].type = Gate;
- Main.tile[xoff - 50, yoff - 1].type = Gate;
- Main.tile[xoff - 50, yoff + 1].type = Gate;
- for (int opening = 49; opening >= 45; opening--)
- {
- Main.tile[xoff - opening, yoff].active = false;
- Main.tile[xoff - opening, yoff - 1].active = false;
- Main.tile[xoff - opening, yoff + 1].active = false;
- }
- }
- NetMessage.SendData(23, -1, -1, "Generating Alpha's Castle, Frame 2", 1, 255f, 50f, 175f, 0);
- for (int x2 = xoff - 45; x2 <= xoff + 45; x2++)
- {
- for (int y2 = yoff - 25; y2 <= yoff - 20; y2++)
- {
- Main.tile[x2, y2].active = true;
- Main.tile[x2, y2].wall = 0;
- Main.tile[x2, y2].liquid = 0;
- Main.tile[x2, y2].type = NullBlock;
- if ((x2 <= xoff - 25 && x2 >= xoff - 30) || (x2 <= xoff + 30 && x2 >= xoff + 25))
- {
- if (y2 == yoff - 25 || y2 == yoff - 20)
- {
- Main.tile[x2, y2].type = 19;
- }
- else Main.tile[x2, y2].active = false;
- }
- }
- }
- NetMessage.SendData(23, -1, -1, "Generating Alpha's Castle, Frame 3", 1, 255f, 50f, 175f, 0);
- for (int x4 = xoff - 45; x4 <= xoff + 45; x4++)
- {
- for (int y4 = yoff + 2; y4 <= yoff + 7; y4++)
- {
- Main.tile[x4, y4].active = true;
- Main.tile[x4, y4].wall = 0;
- Main.tile[x4, y4].liquid = 0;
- Main.tile[x4, y4].type = NullBlock;
- if ((x4 <= xoff - 25 && x4 >= xoff - 30) || (x4 <= xoff + 30 && x4 >= xoff + 25))
- {
- if (y4 == yoff + 2 || y4 == yoff + 7)
- {
- Main.tile[x4, y4].type = 19;
- }
- else Main.tile[x4, y4].active = false;
- }
- }
- }
- NetMessage.SendData(23, -1, -1, "Generating Alpha's Castle, Frame 4", 1, 255f, 50f, 175f, 0);
- for (int x5 = xoff - 45; x5 <= xoff + 45; x5++)
- {
- for (int y5 = yoff + 15; y5 <= yoff + 20; y5++)
- {
- Main.tile[x5, y5].active = true;
- Main.tile[x5, y5].wall = 0;
- Main.tile[x5, y5].liquid = 0;
- Main.tile[x5, y5].type = NullBlock;
- if ((x5 <= xoff - 25 && x5 >= xoff - 30) || (x5 <= xoff + 30 && x5 >= xoff + 25))
- {
- if (y5 == yoff + 15 || y5 == yoff + 20)
- {
- Main.tile[x5, y5].type = 19;
- }
- else if (y5 >= yoff + 16 && y5 <= yoff + 19)
- {
- Main.tile[x5, y5].active = false;
- }
- }
- }
- }
- NetMessage.SendData(23, -1, -1, "Generating Alpha's Castle, White Rock", 0, 255f, 50f, 175f, 0);
- for (int whiteRockX = xoff - 45; whiteRockX <= xoff + 45; whiteRockX++)
- {
- for (int whiteRockY = yoff + 21; whiteRockY <= yoff + 31; whiteRockY++)
- {
- Main.tile[whiteRockX, whiteRockY].liquid = 0;
- Main.tile[whiteRockX, whiteRockY].wall = 0;
- Main.tile[whiteRockX, whiteRockY].active = true;
- Main.tile[whiteRockX, whiteRockY].type = whiteRock;
- if (WorldGen.genRand.Next(5) == 0)
- {
- Main.tile[whiteRockX, whiteRockY].type = OrganicMat;
- }
- }
- }
- NetMessage.SendData(23, -1, -1, "Generating Alpha's Castle, Lighting 1", 0, 255f, 50f, 175f, 0);
- for (int lanternX = xoff - 45; lanternX <= xoff + 45; lanternX++)
- {
- for (int lanternY = yoff - 32; lanternY <= yoff + 14; lanternY++)
- {
- if (((lanternX == xoff - 40 || lanternX == xoff - 28 || lanternX == xoff - 15 || lanternX == xoff || lanternX == xoff + 15 || lanternX == xoff + 28 || lanternX == xoff + 40) && lanternY == yoff - 31))
- {
- WorldGen.Place1x2Top(lanternX, lanternY, 22);
- }
- if (((lanternX == xoff - 40 || lanternX == xoff - 15 || lanternX == xoff || lanternX == xoff + 15 || lanternX == xoff + 40) && lanternY == yoff - 19))
- {
- WorldGen.Place1x2Top(lanternX, lanternY, 22);
- }
- if (((lanternX == xoff - 40 || lanternX == xoff - 15 || lanternX == xoff || lanternX == xoff + 15 || lanternX == xoff + 40) && lanternY == yoff + 8))
- {
- WorldGen.Place1x2Top(lanternX, lanternY, 22);
- }
- if (((lanternX == xoff - 40 || lanternX == xoff - 15 || lanternX == xoff || lanternX == xoff + 15 || lanternX == xoff + 40) && lanternY == yoff + 1))
- {
- WorldGen.PlaceTile(lanternX, lanternY, 129, true, true, -1, 8);
- }
- }
- }
- NetMessage.SendData(23, -1, -1, "Generating Alpha's Castle, Lighting 2", 0, 255f, 50f, 175f, 0);
- for (int torchX = xoff - 45; torchX <= xoff + 45; torchX++)
- {
- for (int torchY = yoff - 32; torchY <= yoff + 20; torchY++)
- {
- if ((torchX == xoff - 30 || torchX == xoff - 25 || torchX == xoff + 25 || torchX == xoff + 30) && torchY == yoff - 23)
- {
- WorldGen.PlaceTile(torchX, torchY, 129, true, true, -1, 8);
- }
- if ((torchX == xoff - 30 || torchX == xoff - 25 || torchX == xoff + 25 || torchX == xoff + 30) && torchY == yoff + 4)
- {
- WorldGen.PlaceTile(torchX, torchY, 129, true, true, -1, 8);
- }
- if ((torchX == xoff - 30 || torchX == xoff - 25 || torchX == xoff + 25 || torchX == xoff + 30) && torchY == yoff + 17)
- {
- WorldGen.PlaceTile(torchX, torchY, 129, true, true, -1, 8);
- }
- }
- }
- NetMessage.SendData(23, -1, -1, "Generating Alpha's Castle, Lighting 3", 0, 255f, 50f, 175f, 0);
- for (int platx = xoff - 2; platx <= xoff + 2; platx++)
- {
- for (int platy = yoff + 32; platy <= yoff + 37; platy++)
- {
- Main.tile[platx, platy].active = false;
- if (platy == yoff + 32 || platy == yoff + 37)
- {
- Main.tile[platx, platy].active = true;
- Main.tile[platx, platy].type = 19;
- }
- if ((platx == xoff + 2 || platx == xoff - 2) && platy == yoff + 34)
- {
- WorldGen.PlaceTile(platx, platy, 4, true, true, -1, 8);
- }
- }
- }
- NetMessage.SendData(23, -1, -1, "Generating Alpha's Castle, Lighting 4, Chests 1", 0, 255f, 50f, 175f, 0);
- for (int chestBoxX = xoff - 17; chestBoxX <= xoff + 16; chestBoxX++)
- {
- for (int chestBoxY = yoff + 38; chestBoxY <= yoff + 55; chestBoxY++)
- {
- if (((chestBoxX <= xoff - 12 && chestBoxX >= xoff - 17) || (chestBoxX <= xoff + 16 && chestBoxX >= xoff + 11)) && (chestBoxY <= yoff + 55 && chestBoxY >= yoff + 38))
- {
- Main.tile[chestBoxX, chestBoxY].active = true;
- Main.tile[chestBoxX, chestBoxY].wall = 0;
- Main.tile[chestBoxX, chestBoxY].liquid = 0;
- Main.tile[chestBoxX, chestBoxY].lava = false;
- Main.tile[chestBoxX, chestBoxY].type = NullBlock;
- }
- if ((chestBoxX >= xoff - 11 && chestBoxX <= xoff + 10) && (chestBoxY >= yoff + 38 && chestBoxY <= yoff + 50))
- {
- Main.tile[chestBoxX, chestBoxY].active = false;
- Main.tile[chestBoxX, chestBoxY].wall = 0;
- Main.tile[chestBoxX, chestBoxY].liquid = 0;
- Main.tile[chestBoxX, chestBoxY].lava = false;
- }
- if ((chestBoxX <= xoff + 10 && chestBoxX >= xoff - 11) && (chestBoxY >= yoff + 51 && chestBoxY <= yoff + 55))
- {
- Main.tile[chestBoxX, chestBoxY].active = true;
- Main.tile[chestBoxX, chestBoxY].liquid = 0;
- Main.tile[chestBoxX, chestBoxY].lava = false;
- Main.tile[chestBoxX, chestBoxY].wall = 0;
- Main.tile[chestBoxX, chestBoxY].type = NullBlock;
- }
- if ((chestBoxX >= xoff - 2 && chestBoxX <= xoff + 1) && (chestBoxY >= yoff + 47 && chestBoxY <= yoff + 50))
- {
- Main.tile[chestBoxX, chestBoxY].active = true;
- Main.tile[chestBoxX, chestBoxY].type = Gate;
- if ((chestBoxX == xoff - 1 || chestBoxX == xoff) && (chestBoxY == yoff + 48 || chestBoxY == yoff + 49))
- {
- Main.tile[chestBoxX, chestBoxY].active = false;
- }
- }
- if (AddHellfireChest(xoff, yoff + 49, Config.itemDefs.byName["Beta"].type, false, 1))
- {
- }
- }
- }
- NetMessage.SendData(23, -1, -1, "Generating Alpha's Castle, Frame 5", 0, 255f, 50f, 175f, 0);
- for (int leftSideX = xoff - 65; leftSideX <= xoff - 51; leftSideX++)
- {
- for (int leftSideY = yoff - 37; leftSideY <= yoff + 37; leftSideY++)
- {
- if ((leftSideX <= xoff - 51 && leftSideX >= xoff - 65) && (leftSideY <= yoff + 37 && leftSideY >= yoff - 37))
- {
- Main.tile[leftSideX, leftSideY].active = true;
- Main.tile[leftSideX, leftSideY].liquid = 0;
- Main.tile[leftSideX, leftSideY].wall = 0;
- Main.tile[leftSideX, leftSideY].lava = false;
- Main.tile[leftSideX, leftSideY].type = NullBlock;
- }
- if ((leftSideX >= xoff - 60 && leftSideX <= xoff - 51) && ((leftSideY <= yoff - 26 && leftSideY >= yoff - 31) || (leftSideY <= yoff + 31 && leftSideY >= yoff + 26)))
- {
- Main.tile[leftSideX, leftSideY].active = false;
- }
- if (leftSideX == xoff - 65 && (leftSideY == yoff - 1 || leftSideY == yoff || leftSideY == yoff + 1))
- {
- Main.tile[leftSideX, leftSideY].type = Gate;
- }
- if ((leftSideX >= xoff - 64 && leftSideX <= xoff - 51) && (leftSideY == yoff - 1 || leftSideY == yoff || leftSideY == yoff + 1))
- {
- Main.tile[leftSideX, leftSideY].active = false;
- }
- if ((leftSideX >= xoff - 60 && leftSideX <= xoff - 55) && ((leftSideY <= yoff + 26 && leftSideY >= yoff + 5) || (leftSideY <= yoff - 5 && leftSideY >= yoff - 26)))
- {
- Main.tile[leftSideX, leftSideY].active = false;
- if (leftSideX == xoff - 60 && (leftSideY == yoff + 18 || leftSideY == yoff - 18))
- {
- WorldGen.PlaceTile(leftSideX, leftSideY, 4, true, true, -1, 8);
- }
- }
- if ((leftSideX <= xoff - 54 && leftSideX >= xoff - 59) && (leftSideY == yoff + 5 || leftSideY == yoff - 5))
- {
- Main.tile[leftSideX, leftSideY].active = false;
- }
- if ((leftSideX <= xoff - 53 && leftSideX >= xoff - 58) && (leftSideY == yoff + 4 || leftSideY == yoff - 4))
- {
- Main.tile[leftSideX, leftSideY].active = false;
- }
- if ((leftSideX <= xoff - 52 && leftSideX >= xoff - 57) && (leftSideY == yoff + 3 || leftSideY == yoff - 3))
- {
- Main.tile[leftSideX, leftSideY].active = false;
- }
- if ((leftSideX <= xoff - 51 && leftSideX >= xoff - 56) && (leftSideY == yoff + 2 || leftSideY == yoff - 2))
- {
- Main.tile[leftSideX, leftSideY].active = true;
- Main.tile[leftSideX, leftSideY].type = 19;
- }
- if (leftSideX == xoff - 60 && (leftSideY == yoff - 5 || leftSideY == yoff + 5))
- {
- Main.tile[leftSideX, leftSideY].active = true;
- }
- if (leftSideX == xoff - 55 && leftSideY == yoff + 31)
- {
- Main.tile[leftSideX, leftSideY].active = true;
- Main.tile[leftSideX, leftSideY].type = 4;
- Main.tile[leftSideX, leftSideY].frameX = (short)0;
- Main.tile[leftSideX, leftSideY].frameY = (short)176;
- }
- }
- }
- NetMessage.SendData(23, -1, -1, "Generating Alpha's Castle, Frame 6", 0, 255f, 50f, 175f, 0);
- for (int rightSideX = xoff + 51; rightSideX <= xoff + 65; rightSideX++)
- {
- for (int rightSideY = yoff - 37; rightSideY <= yoff + 37; rightSideY++)
- {
- if ((rightSideX >= xoff + 51 && rightSideX <= xoff + 65) && (rightSideY <= yoff + 37 && rightSideY >= yoff - 37))
- {
- Main.tile[rightSideX, rightSideY].active = true;
- Main.tile[rightSideX, rightSideY].liquid = 0;
- Main.tile[rightSideX, rightSideY].wall = 0;
- Main.tile[rightSideX, rightSideY].lava = false;
- Main.tile[rightSideX, rightSideY].type = NullBlock;
- }
- if ((rightSideX <= xoff + 60 && rightSideX >= xoff + 51) && ((rightSideY <= yoff - 26 && rightSideY >= yoff - 31) || (rightSideY <= yoff + 31 && rightSideY >= yoff + 26)))
- {
- Main.tile[rightSideX, rightSideY].active = false;
- }
- if (rightSideX == xoff + 65 && (rightSideY == yoff - 1 || rightSideY == yoff || rightSideY == yoff + 1))
- {
- Main.tile[rightSideX, rightSideY].type = Gate;
- }
- if ((rightSideX <= xoff + 64 && rightSideX >= xoff + 51) && (rightSideY == yoff - 1 || rightSideY == yoff || rightSideY == yoff + 1))
- {
- Main.tile[rightSideX, rightSideY].active = false;
- }
- if ((rightSideX <= xoff + 60 && rightSideX >= xoff + 55) && ((rightSideY <= yoff + 26 && rightSideY >= yoff + 5) || (rightSideY <= yoff - 5 && rightSideY >= yoff - 26)))
- {
- Main.tile[rightSideX, rightSideY].active = false;
- if (rightSideX == xoff + 60 && (rightSideY == yoff + 18 || rightSideY == yoff - 18))
- {
- Main.tile[rightSideX, rightSideY].active = true;
- Main.tile[rightSideX, rightSideY].type = 4;
- Main.tile[rightSideX, rightSideY].frameX = (short)44;
- Main.tile[rightSideX, rightSideY].frameY = (short)176;
- }
- }
- if ((rightSideX >= xoff + 54 && rightSideX <= xoff + 59) && (rightSideY == yoff + 5 || rightSideY == yoff - 5))
- {
- Main.tile[rightSideX, rightSideY].active = false;
- }
- if ((rightSideX >= xoff + 53 && rightSideX <= xoff + 58) && (rightSideY == yoff + 4 || rightSideY == yoff - 4))
- {
- Main.tile[rightSideX, rightSideY].active = false;
- }
- if ((rightSideX >= xoff + 52 && rightSideX <= xoff + 57) && (rightSideY == yoff + 3 || rightSideY == yoff - 3))
- {
- Main.tile[rightSideX, rightSideY].active = false;
- }
- if ((rightSideX >= xoff + 51 && rightSideX <= xoff + 56) && (rightSideY == yoff + 2 || rightSideY == yoff - 2))
- {
- Main.tile[rightSideX, rightSideY].active = true;
- Main.tile[rightSideX, rightSideY].type = 19;
- }
- if (rightSideX == xoff + 60 && (rightSideY == yoff - 5 || rightSideY == yoff + 5))
- {
- Main.tile[rightSideX, rightSideY].active = true;
- }
- if (rightSideX == xoff + 55 && rightSideY == yoff + 31)
- {
- Main.tile[rightSideX, rightSideY].active = true;
- Main.tile[rightSideX, rightSideY].type = 4;
- Main.tile[rightSideX, rightSideY].frameX = (short)0;
- Main.tile[rightSideX, rightSideY].frameY = (short)176;
- }
- }
- }
- NetMessage.SendData(23, -1, -1, "Generating Alpha's Castle, Books 1", 0, 255f, 50f, 175f, 0);
- for (int shelfX = xoff - 65; shelfX <= xoff + 65; shelfX++)
- {
- for (int shelfY = yoff - 37; shelfY <= yoff + 55; shelfY++)
- {
- if (((shelfX == xoff - 59 || shelfX == xoff - 60) || (shelfX == xoff + 60 || shelfX == xoff + 59)) && (shelfY == yoff - 10 || shelfY == yoff + 10))
- {
- Main.tile[shelfX, shelfY].active = true;
- Main.tile[shelfX, shelfY].type = 19;
- Main.tile[shelfX, shelfY - 1].active = true;
- Main.tile[shelfX, shelfY - 1].type = 50;
- int randomBook = WorldGen.genRand.Next(5);
- if (randomBook == 0)
- {
- if (WorldGen.genRand.Next(25) == 0)
- {
- Main.tile[shelfX, shelfY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
- Main.tile[shelfX, shelfY - 1].frameX = (short)0;
- Main.tile[shelfX, shelfY - 1].frameY = (short)0;
- }
- else Main.tile[shelfX, shelfY - 1].frameX = (short)0;
- }
- else if (randomBook == 1)
- {
- if (WorldGen.genRand.Next(25) == 0)
- {
- Main.tile[shelfX, shelfY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
- Main.tile[shelfX, shelfY - 1].frameX = (short)0;
- Main.tile[shelfX, shelfY - 1].frameY = (short)0;
- }
- else Main.tile[shelfX, shelfY - 1].frameX = (short)18;
- }
- else if (randomBook == 2)
- {
- if (WorldGen.genRand.Next(25) == 0)
- {
- Main.tile[shelfX, shelfY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
- Main.tile[shelfX, shelfY - 1].frameX = (short)0;
- Main.tile[shelfX, shelfY - 1].frameY = (short)0;
- }
- else Main.tile[shelfX, shelfY - 1].frameX = (short)36;
- }
- else if (randomBook == 3)
- {
- if (WorldGen.genRand.Next(25) == 0)
- {
- Main.tile[shelfX, shelfY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
- Main.tile[shelfX, shelfY - 1].frameX = (short)0;
- Main.tile[shelfX, shelfY - 1].frameY = (short)0;
- }
- else Main.tile[shelfX, shelfY - 1].frameX = (short)54;
- }
- else if (randomBook == 4)
- {
- if (WorldGen.genRand.Next(25) == 0)
- {
- Main.tile[shelfX, shelfY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
- Main.tile[shelfX, shelfY - 1].frameX = (short)0;
- Main.tile[shelfX, shelfY - 1].frameY = (short)0;
- }
- else Main.tile[shelfX, shelfY - 1].frameX = (short)72;
- }
- }
- if (((shelfX == xoff - 55 || shelfX == xoff - 56) || (shelfX == xoff + 56 || shelfX == xoff + 55)) && (shelfY == yoff - 20 || shelfY == yoff + 20))
- {
- Main.tile[shelfX, shelfY].active = true;
- Main.tile[shelfX, shelfY].type = 19;
- Main.tile[shelfX, shelfY - 1].active = true;
- Main.tile[shelfX, shelfY - 1].type = 50;
- int randomBook2 = WorldGen.genRand.Next(5);
- if (randomBook2 == 0)
- {
- if (WorldGen.genRand.Next(25) == 0)
- {
- Main.tile[shelfX, shelfY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
- Main.tile[shelfX, shelfY - 1].frameX = (short)0;
- Main.tile[shelfX, shelfY - 1].frameY = (short)0;
- }
- else Main.tile[shelfX, shelfY - 1].frameX = (short)0;
- }
- else if (randomBook2 == 1)
- {
- if (WorldGen.genRand.Next(25) == 0)
- {
- Main.tile[shelfX, shelfY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
- Main.tile[shelfX, shelfY - 1].frameX = (short)0;
- Main.tile[shelfX, shelfY - 1].frameY = (short)0;
- }
- else Main.tile[shelfX, shelfY - 1].frameX = (short)18;
- }
- else if (randomBook2 == 2)
- {
- if (WorldGen.genRand.Next(25) == 0)
- {
- Main.tile[shelfX, shelfY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
- Main.tile[shelfX, shelfY - 1].frameX = (short)0;
- Main.tile[shelfX, shelfY - 1].frameY = (short)0;
- }
- else Main.tile[shelfX, shelfY - 1].frameX = (short)36;
- }
- else if (randomBook2 == 3)
- {
- if (WorldGen.genRand.Next(25) == 0)
- {
- Main.tile[shelfX, shelfY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
- Main.tile[shelfX, shelfY - 1].frameX = (short)0;
- Main.tile[shelfX, shelfY - 1].frameY = (short)0;
- }
- else Main.tile[shelfX, shelfY - 1].frameX = (short)54;
- }
- else if (randomBook2 == 4)
- {
- if (WorldGen.genRand.Next(25) == 0)
- {
- Main.tile[shelfX, shelfY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
- Main.tile[shelfX, shelfY - 1].frameX = (short)0;
- Main.tile[shelfX, shelfY - 1].frameY = (short)0;
- }
- else Main.tile[shelfX, shelfY - 1].frameX = (short)72;
- }
- }
- Main.tile[xoff - 44, yoff + 11].active = true;
- Main.tile[xoff - 44, yoff + 11].type = 19;
- Main.tile[xoff + 44, yoff + 11].active = true;
- Main.tile[xoff + 44, yoff + 11].type = 19;
- if (((shelfX >= xoff - 43 && shelfX <= xoff - 41) || (shelfX >= xoff + 41 && shelfX <= xoff + 43)) && shelfY == yoff + 11)
- {
- Main.tile[shelfX, shelfY].active = true;
- Main.tile[shelfX, shelfY].type = 19;
- Main.tile[shelfX, shelfY - 1].active = true;
- Main.tile[shelfX, shelfY - 1].type = 50;
- int randomBook3 = WorldGen.genRand.Next(5);
- if (randomBook3 == 0)
- {
- if (WorldGen.genRand.Next(25) == 0)
- {
- Main.tile[shelfX, shelfY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
- Main.tile[shelfX, shelfY - 1].frameX = (short)0;
- Main.tile[shelfX, shelfY - 1].frameY = (short)0;
- }
- else Main.tile[shelfX, shelfY - 1].frameX = (short)0;
- }
- else if (randomBook3 == 1)
- {
- if (WorldGen.genRand.Next(25) == 0)
- {
- Main.tile[shelfX, shelfY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
- Main.tile[shelfX, shelfY - 1].frameX = (short)0;
- Main.tile[shelfX, shelfY - 1].frameY = (short)0;
- }
- else Main.tile[shelfX, shelfY - 1].frameX = (short)18;
- }
- else if (randomBook3 == 2)
- {
- if (WorldGen.genRand.Next(25) == 0)
- {
- Main.tile[shelfX, shelfY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
- Main.tile[shelfX, shelfY - 1].frameX = (short)0;
- Main.tile[shelfX, shelfY - 1].frameY = (short)0;
- }
- else Main.tile[shelfX, shelfY - 1].frameX = (short)36;
- }
- else if (randomBook3 == 3)
- {
- if (WorldGen.genRand.Next(25) == 0)
- {
- Main.tile[shelfX, shelfY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
- Main.tile[shelfX, shelfY - 1].frameX = (short)0;
- Main.tile[shelfX, shelfY - 1].frameY = (short)0;
- }
- else Main.tile[shelfX, shelfY - 1].frameX = (short)54;
- }
- else if (randomBook3 == 4)
- {
- if (WorldGen.genRand.Next(25) == 0)
- {
- Main.tile[shelfX, shelfY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
- Main.tile[shelfX, shelfY - 1].frameX = (short)0;
- Main.tile[shelfX, shelfY - 1].frameY = (short)0;
- }
- else Main.tile[shelfX, shelfY - 1].frameX = (short)72;
- }
- }
- if (((shelfX >= xoff - 11 && shelfX <= xoff - 10) || (shelfX >= xoff + 9 && shelfX <= xoff + 10)) && shelfY == yoff + 43)
- {
- Main.tile[shelfX, shelfY].active = true;
- Main.tile[shelfX, shelfY].type = 19;
- Main.tile[shelfX, shelfY - 1].active = true;
- Main.tile[shelfX, shelfY - 1].type = 50;
- int randomBook4 = WorldGen.genRand.Next(5);
- if (randomBook4 == 0)
- {
- if (WorldGen.genRand.Next(25) == 0)
- {
- Main.tile[shelfX, shelfY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
- Main.tile[shelfX, shelfY - 1].frameX = (short)0;
- Main.tile[shelfX, shelfY - 1].frameY = (short)0;
- }
- else Main.tile[shelfX, shelfY - 1].frameX = (short)0;
- }
- else if (randomBook4 == 1)
- {
- if (WorldGen.genRand.Next(25) == 0)
- {
- Main.tile[shelfX, shelfY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
- Main.tile[shelfX, shelfY - 1].frameX = (short)0;
- Main.tile[shelfX, shelfY - 1].frameY = (short)0;
- }
- else Main.tile[shelfX, shelfY - 1].frameX = (short)18;
- }
- else if (randomBook4 == 2)
- {
- if (WorldGen.genRand.Next(25) == 0)
- {
- Main.tile[shelfX, shelfY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
- Main.tile[shelfX, shelfY - 1].frameX = (short)0;
- Main.tile[shelfX, shelfY - 1].frameY = (short)0;
- }
- else Main.tile[shelfX, shelfY - 1].frameX = (short)36;
- }
- else if (randomBook4 == 3)
- {
- if (WorldGen.genRand.Next(25) == 0)
- {
- Main.tile[shelfX, shelfY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
- Main.tile[shelfX, shelfY - 1].frameX = (short)0;
- Main.tile[shelfX, shelfY - 1].frameY = (short)0;
- }
- else Main.tile[shelfX, shelfY - 1].frameX = (short)54;
- }
- else if (randomBook4 == 4)
- {
- if (WorldGen.genRand.Next(25) == 0)
- {
- Main.tile[shelfX, shelfY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
- Main.tile[shelfX, shelfY - 1].frameX = (short)0;
- Main.tile[shelfX, shelfY - 1].frameY = (short)0;
- }
- else Main.tile[shelfX, shelfY - 1].frameX = (short)72;
- }
- }
- }
- }
- NetMessage.SendData(23, -1, -1, "Generating Alpha's Castle, Books 2, Traps 1", 0, 255f, 50f, 175f, 0);
- for (int trapX = xoff - 50; trapX <= xoff + 50; trapX++)
- {
- for (int trapY = yoff - 37; trapY <= yoff + 37; trapY++)
- {
- if ((trapX == xoff - 12 || trapX == xoff - 11 || trapX == xoff + 11 || trapX == xoff + 12) && (trapY >= yoff - 19 && trapY <= yoff - 12))
- {
- Main.tile[trapX, trapY].active = true;
- Main.tile[trapX, trapY].type = NullBlock;
- }
- if ((trapX == xoff - 10 || trapX == xoff + 10) && trapY == yoff - 15)
- {
- Main.tile[trapX, trapY].active = true;
- Main.tile[trapX, trapY].type = 4;
- Main.tile[trapX, trapY].frameX = (short)0;
- Main.tile[trapX, trapY].frameY = (short)176;
- }
- if (((trapX >= xoff - 10 && trapX <= xoff - 8) || (trapX <= xoff + 10 && trapX >= xoff + 8)) && (trapY == yoff - 13 && trapY == yoff - 17))
- {
- Main.tile[trapX, trapY].active = true;
- Main.tile[trapX, trapY].type = 19;
- Main.tile[trapX, trapY - 1].active = true;
- Main.tile[trapX, trapY - 1].type = 50;
- int randomBook5 = WorldGen.genRand.Next(5);
- if (randomBook5 == 0)
- {
- if (WorldGen.genRand.Next(25) == 0)
- {
- Main.tile[trapX, trapY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
- Main.tile[trapX, trapY - 1].frameX = (short)0;
- Main.tile[trapX, trapY - 1].frameY = (short)0;
- }
- else Main.tile[trapX, trapY - 1].frameX = (short)0;
- }
- else if (randomBook5 == 1)
- {
- if (WorldGen.genRand.Next(25) == 0)
- {
- Main.tile[trapX, trapY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
- Main.tile[trapX, trapY - 1].frameX = (short)0;
- Main.tile[trapX, trapY - 1].frameY = (short)0;
- }
- else Main.tile[trapX, trapY - 1].frameX = (short)18;
- }
- else if (randomBook5 == 2)
- {
- if (WorldGen.genRand.Next(25) == 0)
- {
- Main.tile[trapX, trapY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
- Main.tile[trapX, trapY - 1].frameX = (short)0;
- Main.tile[trapX, trapY - 1].frameY = (short)0;
- }
- else Main.tile[trapX, trapY - 1].frameX = (short)36;
- }
- else if (randomBook5 == 3)
- {
- if (WorldGen.genRand.Next(25) == 0)
- {
- Main.tile[trapX, trapY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
- Main.tile[trapX, trapY - 1].frameX = (short)0;
- Main.tile[trapX, trapY - 1].frameY = (short)0;
- }
- else Main.tile[trapX, trapY - 1].frameX = (short)54;
- }
- else if (randomBook5 == 4)
- {
- if (WorldGen.genRand.Next(25) == 0)
- {
- Main.tile[trapX, trapY - 1].type = (byte)Config.tileDefs.ID["GammaBook"];
- Main.tile[trapX, trapY - 1].frameX = (short)0;
- Main.tile[trapX, trapY - 1].frameY = (short)0;
- }
- else Main.tile[trapX, trapY - 1].frameX = (short)72;
- }
- }
- if ((trapX == xoff - 45 || trapX == xoff + 45) && trapY == yoff - 8)
- {
- Main.tile[trapX, trapY].active = true;
- if (trapX == xoff - 45)
- {
- WorldGen.PlaceTile(trapX, trapY, 137, true, true, -1, 1);
- }
- else WorldGen.PlaceTile(trapX, trapY, 137, true, true, -1, -1);
- }
- 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))
- {
- Main.tile[trapX, trapY].active = true;
- Main.tile[trapX, trapY].type = NullBlock;
- if ((trapX == xoff - 8 || trapX == xoff + 8) && trapY == yoff - 7)
- {
- WorldGen.PlaceTile(trapX, trapY, 4, true, true, -1, 8);
- }
- }
- if (trapX == xoff && trapY == yoff - 8)
- {
- Main.tile[trapX, trapY].active = true;
- Main.tile[trapX, trapY].type = 135;
- Main.tile[trapX, trapY].frameX = (short)0;
- Main.tile[trapX, trapY].frameY = (short)36;
- }
- if ((trapX >= xoff - 45 && trapX <= xoff + 45) && trapY == yoff - 8)
- {
- Main.tile[trapX, trapY].wire = true;
- }
- }
- }
- NetMessage.SendData(23, -1, -1, "Generating Alpha's Castle, Lighting 3", 0, 255f, 50f, 175f, 0);
- for (int lanternX2 = xoff - 65; lanternX2 <= xoff + 65; lanternX2++)
- {
- for (int lanternY2 = yoff - 32; lanternY2 <= yoff + 55; lanternY2++)
- {
- if ((lanternX2 == xoff - 55 || lanternX2 == xoff + 55) && lanternY2 == yoff - 31)
- {
- WorldGen.Place1x2Top(lanternX2, lanternY2, 42);
- }
- if ((lanternX2 == xoff - 7 || lanternX2 == xoff + 7) && lanternY2 == yoff + 38)
- {
- WorldGen.Place1x2Top(lanternX2, lanternY2, 42);
- }
- if ((lanternX2 == xoff - 7 || lanternX2 == xoff + 7) && lanternY2 == yoff + 50)
- {
- Main.tile[lanternX2, lanternY2].active = true;
- Main.tile[lanternX2, lanternY2].type = 4;
- Main.tile[lanternX2, lanternY2].frameX = (short)0;
- Main.tile[lanternX2, lanternY2].frameY = (short)176;
- }
- }
- }
- NetMessage.SendData(23, -1, -1, "Generating Alpha's Castle, Traps 2", 0, 255f, 50f, 175f, 0);
- for (int trap2X = xoff - 17; trap2X <= xoff + 16; trap2X++)
- {
- for (int trap2Y = yoff + 38; trap2Y <= yoff + 55; trap2Y++)
- {
- if ((trap2X == xoff || trap2X == xoff - 1) && trap2Y == yoff + 46)
- {
- Main.tile[trap2X, trap2Y].active = true;
- Main.tile[trap2X, trap2Y].type = 135;
- Main.tile[trap2X, trap2Y].frameX = (short)0;
- Main.tile[trap2X, trap2Y].frameY = (short)36;
- }
- if ((trap2X == xoff - 12 || trap2X == xoff + 11) && trap2Y == yoff + 46)
- {
- if (trap2X == xoff - 12)
- {
- WorldGen.PlaceTile(trap2X, trap2Y, 137, true, true, -1, 1);
- }
- else WorldGen.PlaceTile(trap2X, trap2Y, 137, true, true, -1, -1);
- }
- if ((trap2X >= xoff - 12 && trap2X <= xoff + 11) && trap2Y == yoff + 46)
- {
- Main.tile[trap2X, trap2Y].wire = true;
- }
- }
- }
- NetMessage.SendData(23, -1, -1, "Generating Alpha's Castle, Statues 1", 0, 255f, 50f, 175f, 0);
- for (int statueX = xoff - 65; statueX <= xoff + 65; statueX++)
- {
- for (int statueY = yoff - 37; statueY <= yoff + 55; statueY++)
- {
- if ((statueX == xoff - 9 || statueX == xoff + 8) && statueY == yoff + 50)
- {
- WorldGen.PlaceTile(statueX, statueY, 105, true, true, -1, 13);
- }
- if ((statueX == xoff - 52 || statueX == xoff + 51) && statueY == yoff - 26)
- {
- WorldGen.PlaceTile(statueX, statueY, 105, true, true, -1, 14);
- }
- if ((statueX == xoff - 52 || statueX == xoff + 51) && statueY == yoff + 31)
- {
- WorldGen.PlaceTile(statueX, statueY, 105, true, true, -1, 36);
- }
- }
- }
- NetMessage.SendData(23, -1, -1, "Generating Alpha's Castle, Traps 3", 0, 255f, 50f, 175f, 0);
- for (int trap3X = xoff - 65; trap3X <= xoff + 65; trap3X++)
- {
- for (int trap3Y = yoff - 37; trap3Y <= yoff - 10; trap3Y++)
- {
- if ((trap3X == xoff - 54 || trap3X == xoff + 54) && trap3Y == yoff - 26)
- {
- Main.tile[trap3X, trap3Y].active = true;
- Main.tile[trap3X, trap3Y].type = 135;
- Main.tile[trap3X, trap3Y].frameX = (short)0;
- Main.tile[trap3X, trap3Y].frameY = (short)36;
- }
- if ((trap3X == xoff - 61 || trap3X == xoff + 61) && trap3Y == yoff - 26)
- {
- if (trap3X == xoff - 61)
- {
- WorldGen.PlaceTile(trap3X, trap3Y, 137, true, true, -1, 1);
- }
- else WorldGen.PlaceTile(trap3X, trap3Y, 137, true, true, -1, -1);
- }
- if (((trap3X >= xoff - 61 && trap3X <= xoff - 54) || (trap3X >= xoff + 54 && trap3X <= xoff + 61)) && trap3Y == yoff - 26)
- {
- Main.tile[trap3X, trap3Y].wire = true;
- }
- }
- }
- NetMessage.SendData(23, -1, -1, "Finishing Generation of Alpha's Castle", 0, 255f, 50f, 175f, 0);
- Main.tile[xoff - 44, yoff - 12].active = true;
- Main.tile[xoff - 44, yoff - 12].type = 4;
- Main.tile[xoff - 44, yoff - 12].frameX = (short)24;
- Main.tile[xoff - 44, yoff - 12].frameY = (short)176;
- Main.tile[xoff + 44, yoff - 12].active = true;
- Main.tile[xoff + 44, yoff - 12].type = 4;
- Main.tile[xoff + 44, yoff - 12].frameX = (short)44;
- Main.tile[xoff + 44, yoff - 12].frameY = (short)176;
- Main.tile[xoff - 62, yoff + 1].active = true;
- Main.tile[xoff - 62, yoff + 1].type = 4;
- Main.tile[xoff - 62, yoff + 1].frameX = (short)0;
- Main.tile[xoff - 62, yoff + 1].frameY = (short)176;
- Main.tile[xoff + 62, yoff + 1].active = true;
- Main.tile[xoff + 62, yoff + 1].type = 4;
- Main.tile[xoff + 62, yoff + 1].frameX = (short)0;
- Main.tile[xoff + 62, yoff + 1].frameY = (short)176;
- }
- public static bool AddHellfireChest(int i, int j, int contain = 0, bool notNearOtherChests = false, int Style = -1) // the chest
- {
- NetMessage.SendData(23, -1, -1, "Setting Chests", 0, 255f, 50f, 175f, 0);
- if (WorldGen.genRand == null)
- {
- WorldGen.genRand = new Random((int)DateTime.Now.Ticks);
- }
- int k = j;
- while (k < Main.maxTilesY)
- {
- if (Main.tile[i, k].active && Main.tileSolid[(int)Main.tile[i, k].type])
- {
- int num = k;
- int num2 = WorldGen.PlaceChest(i - 1, num - 1, 21, notNearOtherChests, 4);
- if (num2 >= 0)
- {
- int num3 = 0;
- while (num3 == 0)
- {
- if (contain > 0)
- {
- Main.chest[num2].item[num3].SetDefaults(contain, false);
- Main.chest[num2].item[num3].Prefix(-1);
- num3++;
- }
- int randomNum = WorldGen.genRand.Next(7);
- if (randomNum == 0)
- {
- Main.chest[num2].item[num3].SetDefaults(Config.itemDefs.byName["Wooden Sword"].type, false);
- Main.chest[num2].item[num3].Prefix(-1);
- num3++;
- }
- else if (randomNum == 1)
- {
- Main.chest[num2].item[num3].SetDefaults(Config.itemDefs.byName["Wooden Sword"].type, false);
- Main.chest[num2].item[num3].Prefix(-1);
- num3++;
- }
- else if (randomNum == 2)
- {
- Main.chest[num2].item[num3].SetDefaults(489, false);
- Main.chest[num2].item[num3].Prefix(-1);
- num3++;
- }
- else if (randomNum == 3)
- {
- Main.chest[num2].item[num3].SetDefaults(490, false);
- Main.chest[num2].item[num3].Prefix(-1);
- num3++;
- }
- else if (randomNum == 4)
- {
- Main.chest[num2].item[num3].SetDefaults(353, false);
- int numOfAles = WorldGen.genRand.Next(3) + 1;
- Main.chest[num2].item[num3].stack = numOfAles;
- num3++;
- }
- else if (randomNum == 5)
- {
- Main.chest[num2].item[num3].SetDefaults(Config.itemDefs.byName["Dirt Block"].type, false);
- int numOfGRPotions = WorldGen.genRand.Next(12, 23);
- Main.chest[num2].item[num3].stack = numOfGRPotions;
- num3++;
- }
- else
- {
- Main.chest[num2].item[num3].SetDefaults(491, false);
- Main.chest[num2].item[num3].Prefix(-1);
- num3++;
- }
- Main.chest[num2].item[num3].SetDefaults(Config.itemDefs.byName["Dirt Block"].type, false);
- int numOfBars = WorldGen.genRand.Next(22, 37);
- Main.chest[num2].item[num3].stack = numOfBars;
- Main.chest[num2].item[3].SetDefaults(Config.itemDefs.byName["Dirt Block"].type, false);
- int numOfBricks = WorldGen.genRand.Next(11, 55);
- Main.chest[num2].item[3].stack = numOfBricks;
- Main.chest[num2].item[4].SetDefaults(73, false);
- int numOfCoins = WorldGen.genRand.Next(45, 110);
- Main.chest[num2].item[4].stack = numOfCoins;
- int randomNum2 = WorldGen.genRand.Next(11);
- if (randomNum2 == 0)
- {
- Main.chest[num2].item[5].SetDefaults(391, false);
- int numOfBars2 = WorldGen.genRand.Next(10, 30);
- Main.chest[num2].item[5].stack = numOfBars2;
- }
- else if (randomNum2 == 1)
- {
- Main.chest[num2].item[5].SetDefaults(522, false);
- int numOfCF = WorldGen.genRand.Next(10, 30);
- Main.chest[num2].item[5].stack = numOfCF;
- }
- else if (randomNum2 == 2)
- {
- Main.chest[num2].item[5].SetDefaults(Config.itemDefs.byName["Dirt Block"].type, false);
- int numOfSD = WorldGen.genRand.Next(3, 8);
- Main.chest[num2].item[5].stack = numOfSD;
- }
- else if (randomNum2 == 3)
- {
- Main.chest[num2].item[5].SetDefaults(Config.itemDefs.byName["Dirt Block"].type, false);
- int numOfSP = WorldGen.genRand.Next(3, 8);
- Main.chest[num2].item[5].stack = numOfSP;
- }
- else if (randomNum2 == 4)
- {
- Main.chest[num2].item[5].SetDefaults(575, false);
- int numOfSoFl = WorldGen.genRand.Next(5, 7);
- Main.chest[num2].item[5].stack = numOfSoFl;
- }
- else if (randomNum2 == 5)
- {
- Main.chest[num2].item[5].SetDefaults(547, false);
- int numOfSoFr = WorldGen.genRand.Next(5, 7);
- Main.chest[num2].item[5].stack = numOfSoFr;
- }
- else if (randomNum2 == 6)
- {
- Main.chest[num2].item[5].SetDefaults(548, false);
- int numOfSoM = WorldGen.genRand.Next(5, 7);
- Main.chest[num2].item[5].stack = numOfSoM;
- }
- else if (randomNum2 == 7)
- {
- Main.chest[num2].item[5].SetDefaults(549, false);
- int numOfSoS = WorldGen.genRand.Next(5, 7);
- Main.chest[num2].item[5].stack = numOfSoS;
- }
- else if (randomNum2 == 8)
- {
- Main.chest[num2].item[5].SetDefaults(520, false);
- int numOfSoL = WorldGen.genRand.Next(5, 7);
- Main.chest[num2].item[5].stack = numOfSoL;
- }
- else if (randomNum2 == 9)
- {
- Main.chest[num2].item[5].SetDefaults(521, false);
- int numOfSoN = WorldGen.genRand.Next(5, 7);
- Main.chest[num2].item[5].stack = numOfSoN;
- }
- else
- {
- Main.chest[num2].item[5].SetDefaults(Config.itemDefs.byName["WDirt Block"].type, false);
- int numOfSH = WorldGen.genRand.Next(3, 8);
- Main.chest[num2].item[5].stack = numOfSH;
- }
- int randomNum3 = WorldGen.genRand.Next(4);
- if (randomNum3 == 0)
- {
- Main.chest[num2].item[6].SetDefaults(Config.itemDefs.byName["Dirt Block"].type, false);
- int numOfAPotions = WorldGen.genRand.Next(2, 4);
- Main.chest[num2].item[6].stack = numOfAPotions;
- }
- else if (randomNum3 == 1)
- {
- Main.chest[num2].item[6].SetDefaults(Config.itemDefs.byName["Dirt Block"].type, false);
- int numOfIPotions = WorldGen.genRand.Next(1, 4);
- Main.chest[num2].item[6].stack = numOfIPotions;
- }
- else if (randomNum == 2)
- {
- Main.chest[num2].item[6].SetDefaults(Config.itemDefs.byName["Dirt Block"].type, false);
- int numOfSPotions = WorldGen.genRand.Next(3, 5);
- Main.chest[num2].item[6].stack = numOfSPotions;
- }
- else
- {
- Main.chest[num2].item[6].SetDefaults(437, false);
- }
- Main.chest[num2].item[7].SetDefaults(Config.itemDefs.byName["Wooden Sword"].type, false);
- Main.chest[num2].item[7].stack = (WorldGen.genRand.Next(2) + 1);
- }
- return true;
- }
- return false;
- }
- else
- {
- k++;
- }
- }
- return false;
- }
- public static void dropAlienMat()
- {
- NetMessage.SendData(23, -1, -1, "Generating Alien Material", 0, 255f, 50f, 175f, 0);
- int tileType=Config.tileDefs.ID["Alien Materials"];
- bool flag = true;
- int num = 0;
- if (Main.netMode == 1)
- {
- return;
- }
- for (int i = 0; i < 255; i++)
- {
- if (Main.player[i].active)
- {
- flag = false;
- break;
- }
- }
- int num2 = 0;
- float num3 = (float)(Main.maxTilesX / 4200);
- int num4 = (int)(400f * num3);
- for (int j = 5; j < Main.maxTilesX - 5; j++)
- {
- int num5 = 5;
- while ((double)num5 < Main.worldSurface)
- {
- if (Main.tile[j, num5].active && Main.tile[j, num5].type == tileType)
- {
- num2++;
- if (num2 > num4)
- {
- return;
- }
- }
- num5++;
- }
- }
- while (!flag)
- {
- float num6 = (float)Main.maxTilesX * 0.08f;
- int num7 = Main.rand.Next(50, Main.maxTilesX - 50);
- while ((float)num7 > (float)Main.spawnTileX - num6 && (float)num7 < (float)Main.spawnTileX + num6)
- {
- num7 = Main.rand.Next(50, Main.maxTilesX - 50);
- }
- for (int k = Main.rand.Next(100); k < Main.maxTilesY; k++)
- {
- if (Main.tile[num7, k].active && Main.tileSolid[(int)Main.tile[num7, k].type])
- {
- flag = WorldGen.AlienMat(num7, k);
- break;
- }
- }
- num++;
- if (num >= 100)
- {
- return;
- }
- }
- }
- public static bool AlienMat(int i, int j)
- {
- NetMessage.SendData(23, -1, -1, "Generating Alien Material 2", 0, 255f, 50f, 175f, 0);
- int tileType=Config.tileDefs.ID["Alien Materials"];
- if (i < 50 || i > Main.maxTilesX - 50)
- {
- return false;
- }
- if (j < 50 || j > Main.maxTilesY - 50)
- {
- return false;
- }
- int num = 25;
- Rectangle rectangle = new Rectangle((i - num) * 16, (j - num) * 16, num * 2 * 16, num * 2 * 16);
- for (int k = 0; k < 255; k++)
- {
- if (Main.player[k].active)
- {
- 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);
- if (rectangle.Intersects(value))
- {
- return false;
- }
- }
- }
- for (int l = 0; l < 200; l++)
- {
- if (Main.npc[l].active)
- {
- Rectangle value2 = new Rectangle((int)Main.npc[l].position.X, (int)Main.npc[l].position.Y, Main.npc[l].width, Main.npc[l].height);
- if (rectangle.Intersects(value2))
- {
- return false;
- }
- }
- }
- for (int m = i - num; m < i + num; m++)
- {
- for (int n = j - num; n < j + num; n++)
- {
- if (Main.tile[m, n].active && Main.tile[m, n].type == 21)
- {
- return false;
- }
- }
- }
- WorldGen.stopDrops = true;
- num = 15;
- for (int num2 = i - num; num2 < i + num; num2++)
- {
- for (int num3 = j - num; num3 < j + num; num3++)
- {
- 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))
- {
- if (!Main.tileSolid[(int)Main.tile[num2, num3].type])
- {
- Main.tile[num2, num3].active = false;
- }
- Main.tile[num2, num3].type = tileType;
- }
- }
- }
- num = 10;
- for (int num4 = i - num; num4 < i + num; num4++)
- {
- for (int num5 = j - num; num5 < j + num; num5++)
- {
- if (num5 > j + Main.rand.Next(-2, 3) - 5 && Math.Abs(i - num4) + Math.Abs(j - num5) < num + Main.rand.Next(-3, 4))
- {
- Main.tile[num4, num5].active = false;
- }
- }
- }
- num = 16;
- for (int num6 = i - num; num6 < i + num; num6++)
- {
- for (int num7 = j - num; num7 < j + num; num7++)
- {
- if (Main.tile[num6, num7].type == 5 || Main.tile[num6, num7].type == 32)
- {
- WorldGen.KillTile(num6, num7, false, false, false, null);
- }
- WorldGen.SquareTileFrame(num6, num7, true);
- WorldGen.SquareWallFrame(num6, num7, true);
- }
- }
- num = 23;
- for (int num8 = i - num; num8 < i + num; num8++)
- {
- for (int num9 = j - num; num9 < j + num; num9++)
- {
- if (Main.tile[num8, num9].active && Main.rand.Next(10) == 0 && (double)(Math.Abs(i - num8) + Math.Abs(j - num9)) < (double)num * 1.3)
- {
- if (Main.tile[num8, num9].type == 5 || Main.tile[num8, num9].type == 32)
- {
- WorldGen.KillTile(num8, num9, false, false, false, null);
- }
- Main.tile[num8, num9].type = tileType;
- WorldGen.SquareTileFrame(num8, num9, true);
- }
- }
- }
- WorldGen.stopDrops = false;
- return true;
- }
Add Comment
Please, Sign In to add comment