public override void step() { if (chase()) { NailTrapAreaEffect areaEffect = new NailTrapAreaEffect(ownerTower.board.player, targetPosition,slowAmount,dmgPerSecond); Messages.OutgoingMessages.Game.GAddNailTrapAreaEffect.sendMessage(ownerTower.board.player.game.players, areaEffect); targetBoard.player.game.addAreaEffect(areaEffect); destroyable = true; } }
public static void sendMessage(ICollection<Player> receiverPlayers, NailTrapAreaEffect areaEffect) { if (receiverPlayers != null && receiverPlayers.Count != 0) { RawMessage msg = new RawMessage(); msg.putInt("id", TypeIdGenerator.getMessageId(typeof(GAddNailTrapAreaEffect))); msg.putInt("iid", areaEffect.instanceId); msg.putInt("tid", TypeIdGenerator.getAreaEffectId(areaEffect.GetType())); msg.putInt("uid", areaEffect.ownerPlayer.user.id); msg.putFloat("dps", areaEffect.dmgPerSecond); msg.putFloat("sa", areaEffect.slowAmount); Vector3 position = areaEffect.getWorldPosition(); msg.putFloatArray("pos", new float[] { position.x, position.y, position.z }); foreach (var receiverPlayer in receiverPlayers) receiverPlayer.user.session.client.SendMessage(msg); } }