private void uxProxySendClientTest_Click(object sender, EventArgs e) { AnimatedTextPacket p = new AnimatedTextPacket(client); p.Message = "Testing"; p.Location = client.PlayerLocation; p.Color = TextColor.Platinum; MarkButton((Button)sender, p.Send(Packet.SendMethod.Proxy)); }
public void SendAnimatedText(Location location, string text, TextColor color) { NetworkMessage outMessage = new NetworkMessage(); AnimatedTextPacket.Add( outMessage, location, color, text ); Send(outMessage); }
public void AnimatedTextPacket_Initialization() { const OutgoingPacketType ExpectedPacketType = OutgoingPacketType.AnimatedText; const TextColor ExpectedTextColor = TextColor.Green; const string ExpectedText = "this is a test!"; Location expectedLocation = new Location() { X = 100, Y = 150, Z = 7 }; var packet = new AnimatedTextPacket(expectedLocation, ExpectedTextColor, ExpectedText); Assert.AreEqual(ExpectedPacketType, packet.PacketType, $"Expected {nameof(packet.PacketType)} to match {ExpectedPacketType}."); Assert.AreEqual(expectedLocation, packet.Location, $"Expected {nameof(packet.Location)} to match {expectedLocation}."); Assert.AreEqual(ExpectedTextColor, packet.Color, $"Expected {nameof(packet.Color)} to match {ExpectedTextColor}."); Assert.AreEqual(ExpectedText, packet.Text, $"Expected {nameof(packet.Text)} to match {ExpectedText}."); }
public void Execute() { EffectT resultEffect; bool wasShielded; bool wasArmorBlocked; TextColor textColor; var inflicted = InternalExecute(out resultEffect, out wasShielded, out wasArmorBlocked, out textColor); AnimatedTextPacket animTextPacket = null; var effectPacket = new MagicEffectPacket { Effect = resultEffect, Location = Target.Location }; if (inflicted == 0) { if (wasArmorBlocked) { effectPacket.Effect = EffectT.SparkYellow; } else if (wasShielded) { effectPacket.Effect = EffectT.Puff; } } else if (inflicted > 0) { animTextPacket = new AnimatedTextPacket { Text = inflicted.ToString(), Location = Target.Location, Color = textColor }; if (wasShielded) // magic shield { animTextPacket.Color = TextColor.Blue; effectPacket.Effect = EffectT.RingsBlue; } else { switch (Target.Blood) { case BloodType.Blood: animTextPacket.Color = TextColor.Red; break; case BloodType.Bones: animTextPacket.Color = TextColor.LightGrey; break; case BloodType.Fire: animTextPacket.Color = TextColor.Orange; break; case BloodType.Slime: animTextPacket.Color = TextColor.Green; break; } } } else { animTextPacket = new AnimatedTextPacket { Text = inflicted.ToString(), Location = Target.Location, Color = TextColor.LightBlue }; effectPacket.Effect = EffectT.GlitterBlue; } if (animTextPacket == null) { Game.Instance.NotifySpectatingPlayers(conn => new GenericNotification(conn, effectPacket), Target.Location); } else { Game.Instance.NotifySpectatingPlayers(conn => new GenericNotification(conn, effectPacket, animTextPacket), Target.Location); } Attacker.UpdateLastAttack(ExhaustionCost); }