public static void PutBallInCup_Actual( Point hitLocation, int plr, int numberOfHits, int projid) { if (numberOfHits == 0) { return; } Wiring.HitSwitch(hitLocation.X, hitLocation.Y); NetMessage.SendData(59, -1, -1, (NetworkText)null, hitLocation.X, (float)hitLocation.Y, 0.0f, 0.0f, 0, 0, 0); GolfHelper.ContactListener.EmitGolfballExplosion(hitLocation.ToWorldCoordinates(8f, 0.0f)); string key = "Game.BallBounceResultGolf_Single"; if (numberOfHits != 1) { key = "Game.BallBounceResultGolf_Plural"; } NetworkText text = NetworkText.FromKey(key, (object)Main.player[plr].name, (object)NetworkText.FromKey(Lang.GetProjectileName(projid).Key), (object)numberOfHits); switch (Main.netMode) { case 0: case 1: Main.NewText(text.ToString(), byte.MaxValue, (byte)240, (byte)20); break; case 2: ChatHelper.BroadcastChatMessage(text, new Color((int)byte.MaxValue, 240, 20), -1); break; } }
/// <summary> /// Intercept all other messages from Terraria. E.g. blood moon, death notifications, and player join/leaves. /// </summary> private void NetMessage_BroadcastChatMessage(On.Terraria.NetMessage.orig_BroadcastChatMessage orig, NetworkText text, Color color, int excludedPlayer) { if (Global.Config.ShowGameEvents && !text.ToString().EndsWith(PlayerJoinEndingString) && !text.ToString().EndsWith(PlayerLeaveEndingString)) { Core.RaiseTerrariaMessageReceived(this, (excludedPlayer > 0 ? Main.player[excludedPlayer].ToTCRPlayer(excludedPlayer) : TCRPlayer.Server), text.ToString()); } orig(text, color, excludedPlayer); }
public static void DisplayMessage(NetworkText text, Color color, byte messageAuthor) { string str = text.ToString(); if (messageAuthor < byte.MaxValue) { Main.player[(int)messageAuthor].chatOverhead.NewMessage(str, Main.PlayerOverheadChatMessageDisplayTime); Main.player[(int)messageAuthor].chatOverhead.color = color; str = NameTagHandler.GenerateTag(Main.player[(int)messageAuthor].name) + " " + str; } if (ChatHelper.ShouldCacheMessage()) { ChatHelper.CacheMessage(str, color); } else { Main.NewTextMultiline(str, false, color, -1); } }
public static void DisplayMessage(NetworkText text, Color color, byte messageAuthor) { string text2 = text.ToString(); if (messageAuthor < byte.MaxValue) { Main.player[messageAuthor].chatOverhead.NewMessage(text2, Main.PlayerOverheadChatMessageDisplayTime); Main.player[messageAuthor].chatOverhead.color = color; text2 = NameTagHandler.GenerateTag(Main.player[messageAuthor].name) + " " + text2; } if (ShouldCacheMessage()) { CacheMessage(text2, color); } else { Main.NewTextMultiline(text2, force: false, color); } }
public static void PutBallInCup_TextAndEffects(Point hitLocation, int plr, int numberOfHits, int projid) { if (numberOfHits != 0) { EmitGolfballExplosion(hitLocation.ToWorldCoordinates(8f, 0f)); string key = "Game.BallBounceResultGolf_Single"; if (numberOfHits != 1) { key = "Game.BallBounceResultGolf_Plural"; } NetworkText networkText = NetworkText.FromKey(key, Main.player[plr].name, NetworkText.FromKey(Lang.GetProjectileName(projid).Key), numberOfHits); if (Main.netMode == 0 || Main.netMode == 1) { Main.NewText(networkText.ToString(), byte.MaxValue, 240, 20); } else if (Main.netMode == 2) { ChatHelper.BroadcastChatMessage(networkText, new Color(255, 240, 20)); } } }
public override void PostUpdate() { // Event Ending Messages if (Main.bloodMoon) { isBloodMoon = true; } if (Main.snowMoon) { isFrostMoon = true; } if (Main.pumpkinMoon) { isPumpkinMoon = true; } if (Main.eclipse) { isEclipse = true; } if (!Main.bloodMoon && isBloodMoon) { isBloodMoon = false; EventKey = "Mods.BossChecklist.EventEnd.BloodMoon"; if (!downedBloodMoon) { downedBloodMoon = true; if (Main.netMode == NetmodeID.Server) { NetMessage.SendData(MessageID.WorldData); } } } else if (!Main.snowMoon && isFrostMoon) { isFrostMoon = false; EventKey = "Mods.BossChecklist.EventEnd.FrostMoon"; if (!downedFrostMoon) { downedFrostMoon = true; if (Main.netMode == NetmodeID.Server) { NetMessage.SendData(MessageID.WorldData); } } } else if (!Main.pumpkinMoon && isPumpkinMoon) { isPumpkinMoon = false; EventKey = "Mods.BossChecklist.EventEnd.PumpkinMoon"; if (!downedPumpkinMoon) { downedPumpkinMoon = true; if (Main.netMode == NetmodeID.Server) { NetMessage.SendData(MessageID.WorldData); } } } else if (!Main.eclipse && isEclipse) { isEclipse = false; EventKey = "Mods.BossChecklist.EventEnd.SolarEclipse"; if (!downedSolarEclipse) { downedSolarEclipse = true; if (Main.netMode == NetmodeID.Server) { NetMessage.SendData(MessageID.WorldData); } } } if (EventKey != "") { NetworkText message = NetworkText.FromKey(EventKey); if (Main.netMode == NetmodeID.SinglePlayer) { Main.NewText(message.ToString(), Colors.RarityGreen); } else { NetMessage.BroadcastChatMessage(message, Colors.RarityGreen); } EventKey = ""; } }