public override void CopyCustomBiomesTo(Player other) { ArchaeaPlayer modOther = other.GetModPlayer <ArchaeaPlayer>(mod); modOther.MagnoZone = MagnoZone; }
public override void PreUpdate() { if (!init) { button = new Button("Connect", new Rectangle(Main.screenWidth - 400, Main.screenHeight - 100, 10 * 10, 24)); mute = new Button("Mute", new Rectangle(Main.screenWidth - 295, Main.screenHeight - 100, 5 * 10 + 5, 24)); host = new Button("Host", new Rectangle(Main.screenWidth - 295, Main.screenHeight - 130, 5 * 10 + 5, 24)); lobbyButton = new Button("Chat Lobby", new Rectangle(20, 256, 10 * 10, 24)); details = new TextBox[] { new TextBox(new Rectangle(Main.screenWidth - 400, Main.screenHeight - 70, 16 * 10, 24)), new TextBox(new Rectangle(Main.screenWidth - 400, Main.screenHeight - 40, 16 * 10, 24)), }; details[0].text = "IP Address"; details[1].text = "Port"; oldWidth = Main.screenWidth; oldHeight = Main.screenHeight; init = true; } if (Main.playerInventory) { if (lobbyButton.LeftClick()) { showLobbyConnect = !showLobbyConnect; } } string text = Main.chatText; if (writer != null && text.Length > 0 && ArchaeaPlayer.KeyPress(Keys.RightShift) && !muted) { writer.Write((byte)4); writer.Write(hash); writer.Write(text); writer.Flush(); Main.NewText("[!] <" + player.name + "> " + text, new Color(150, 150, 150)); text = string.Empty; Main.chatRelease = false; Main.drawingPlayerChat = false; } if (!showLobbyConnect) { return; } foreach (var t in details) { if (t.active && (t.text == "IP Address" || t.text == "Port")) { t.text = ""; } if (t.LeftClick() && t.HoverOver()) { t.active = !t.active; foreach (var o in details) { if (o != t) { o.active = false; } } break; } t.UpdateInput(); } if (button.LeftClick()) { foreach (var t in details) { t.active = false; } if (!connected) { connected = ChatLobbyConnect(); } else { connected = false; writer.Write((byte)3); writer.Flush(); writer.Close(); timer.Close(); } button.text = connected ? "Disconnect" : "Connect"; } if (mute.LeftClick() && connected) { muted = !muted; Main.NewText("Remote chat " + (muted ? "muted" : "not muted"), new Color(200, 200, 200)); } if (oldWidth != Main.screenWidth || oldHeight != Main.screenHeight) { button.box = new Rectangle(Main.screenWidth - 400, Main.screenHeight - 100, 10 * 10, 24); mute.box = new Rectangle(Main.screenWidth - 295, Main.screenHeight - 100, 5 * 10 + 5, 24); host.box = new Rectangle(Main.screenWidth - 295, Main.screenHeight - 130, 5 * 10 + 5, 24); details[0].box = new Rectangle(Main.screenWidth - 400, Main.screenHeight - 70, 16 * 10, 24); details[1].box = new Rectangle(Main.screenWidth - 400, Main.screenHeight - 40, 16 * 10, 24); oldWidth = Main.screenWidth; oldHeight = Main.screenHeight; } if (host.LeftClick()) { if (!Lobby.LobbyServer.hosting) { if (details[1].text.Length > 3) { int num = 0; if (!int.TryParse(details[1].text, out num)) { if (!hint) { Main.NewText("Try a port number above 1000 (a number might help)"); hint = true; } return; } Lobby.LobbyServer.Main(new string[] { details[1].text }); ChatLobbyConnect("127.0.0.1"); //Main.NewText("To join the lobby just hosted locally, connect using 127.0.0.1 (localhost) in the IP field"); } } else { Main.NewText("Lobby closed"); Lobby.LobbyServer.hosting = false; Lobby.LobbyServer.Disconnect(); } } }
public override bool CustomBiomesMatch(Player other) { ArchaeaPlayer modOther = other.GetModPlayer <ArchaeaPlayer>(mod); return(MagnoZone == modOther.MagnoZone); }