private static void AddObstacleInfo(RawMessage message, Arena arena) { int obstacleCount = arena.obstacles.Count; int[] obstacleTypeIds = new int[obstacleCount]; int[] obstacleIds = new int[obstacleCount]; Vector3[] obstaclePositions = new Vector3[obstacleCount]; float[] obstacleHealths = new float[obstacleCount]; float[] obstacleRadiuses = new float[obstacleCount]; int[] obstacleSkinIds = new int[obstacleCount]; for (int i = 0; i < obstacleCount; i++) { Obstacle o = arena.obstacles[i]; obstacleTypeIds[i] = TypeIdGenerator.idsOfObstacles[o.GetType()]; obstacleIds[i] = o.id; obstaclePositions[i] = o.position; obstacleHealths[i] = o.health; obstacleRadiuses[i] = o.radius; obstacleSkinIds[i] = o.skinId; } message.putIntArray("obsTypes", obstacleTypeIds); message.putIntArray("obsIds", obstacleIds); message.PutVector3Array("obsPositions", obstaclePositions); message.putFloatArray("obsHealths", obstacleHealths); message.putFloatArray("obsRadiuses", obstacleRadiuses); message.putIntArray("obsSkins", obstacleSkinIds); }
public static void sendMessage(ICollection <Player> recievers, StatTracker statTracker) { RawMessage bigMsg = new RawMessage(); bigMsg.putInt("id", TypeIdGenerator.getMessageId(typeof(GEndGameStatisticsResult))); bigMsg.putInt("c", statTracker.playerStatsList.Count); int[] playerIDs = new int[statTracker.playerStatsList.Count]; int [] minionsKilled = new int[statTracker.playerStatsList.Count]; int[] minionsSend = new int[statTracker.playerStatsList.Count]; int[] towersBuilt = new int[statTracker.playerStatsList.Count]; int[] missilesFired = new int[statTracker.playerStatsList.Count]; int[] minionsPassed = new int[statTracker.playerStatsList.Count]; float[] moneyEarned = new float[statTracker.playerStatsList.Count]; float[] moneySpend = new float[statTracker.playerStatsList.Count]; int[] cashs = new int[statTracker.playerStatsList.Count]; int[] incomes = new int[statTracker.playerStatsList.Count]; for (int i = 0; i < statTracker.playerStatsList.Count; i++) { playerIDs[i] = statTracker.playerStatsList[i].ownerPlayer.id; minionsKilled[i] = statTracker.playerStatsList[i].minionsKilled; minionsSend[i] = statTracker.playerStatsList[i].minionsSend; towersBuilt[i] = statTracker.playerStatsList[i].towersBuilt; missilesFired[i] = statTracker.playerStatsList[i].missilesFired; minionsPassed[i] = statTracker.playerStatsList[i].minionsPassed; moneyEarned[i] = statTracker.playerStatsList[i].moneyEarned; moneySpend[i] = statTracker.playerStatsList[i].moneySpend; cashs[i] = statTracker.playerStatsList[i].cash; incomes[i] = statTracker.playerStatsList[i].income; } bigMsg.putIntArray("pids", playerIDs); bigMsg.putIntArray("mk", minionsKilled); bigMsg.putIntArray("ms", minionsSend); bigMsg.putIntArray("tb", towersBuilt); bigMsg.putIntArray("mf", missilesFired); bigMsg.putIntArray("mp", minionsPassed); bigMsg.putFloatArray("mme", moneyEarned); bigMsg.putFloatArray("mms", moneySpend); bigMsg.putIntArray("cs", cashs); bigMsg.putIntArray("inc", incomes); foreach (Player p in recievers) { p.user.session.client.SendMessage(bigMsg); } }
public static void sendMessage(ICollection<Player> recievers , StatTracker statTracker) { RawMessage bigMsg = new RawMessage(); bigMsg.putInt("id", TypeIdGenerator.getMessageId(typeof(GEndGameStatisticsResult))); bigMsg.putInt("c",statTracker.playerStatsList.Count); int[] playerIDs = new int[statTracker.playerStatsList.Count]; int [] minionsKilled = new int[statTracker.playerStatsList.Count]; int[] minionsSend = new int[statTracker.playerStatsList.Count]; int[] towersBuilt = new int[statTracker.playerStatsList.Count]; int[] missilesFired = new int[statTracker.playerStatsList.Count]; int[] minionsPassed = new int[statTracker.playerStatsList.Count]; float[] moneyEarned = new float[statTracker.playerStatsList.Count]; float[] moneySpend = new float[statTracker.playerStatsList.Count]; int[] cashs = new int[statTracker.playerStatsList.Count]; int[] incomes = new int[statTracker.playerStatsList.Count]; for(int i = 0; i < statTracker.playerStatsList.Count; i++) { playerIDs[i] = statTracker.playerStatsList[i].ownerPlayer.id; minionsKilled[i] = statTracker.playerStatsList[i].minionsKilled; minionsSend[i] = statTracker.playerStatsList[i].minionsSend; towersBuilt[i] = statTracker.playerStatsList[i].towersBuilt; missilesFired[i] = statTracker.playerStatsList[i].missilesFired; minionsPassed[i] = statTracker.playerStatsList[i].minionsPassed; moneyEarned[i] = statTracker.playerStatsList[i].moneyEarned; moneySpend[i] = statTracker.playerStatsList[i].moneySpend; cashs[i] = statTracker.playerStatsList[i].cash; incomes[i] = statTracker.playerStatsList[i].income; } bigMsg.putIntArray("pids", playerIDs); bigMsg.putIntArray("mk",minionsKilled); bigMsg.putIntArray("ms", minionsSend); bigMsg.putIntArray("tb", towersBuilt); bigMsg.putIntArray("mf", missilesFired); bigMsg.putIntArray("mp", minionsPassed); bigMsg.putFloatArray("mme", moneyEarned); bigMsg.putFloatArray("mms", moneySpend); bigMsg.putIntArray("cs", cashs); bigMsg.putIntArray("inc",incomes); foreach (Player p in recievers) { p.user.session.client.SendMessage(bigMsg); } }
public static void sendMessage(ICollection<Player> receiverPlayers, AreaEffect areaEffect) { if (receiverPlayers != null && receiverPlayers.Count != 0) { RawMessage msg = new RawMessage(); msg.putInt("id", TypeIdGenerator.getMessageId(typeof(GAddAreaEffect))); msg.putInt("iid", areaEffect.instanceId); msg.putInt("tid", TypeIdGenerator.getAreaEffectId(areaEffect.GetType())); msg.putInt("uid", areaEffect.ownerPlayer.user.id); 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); } }
public static void sendMessage(ICollection <Player> receiverPlayers, AreaEffect areaEffect) { if (receiverPlayers != null && receiverPlayers.Count != 0) { RawMessage msg = new RawMessage(); msg.putInt("id", TypeIdGenerator.getMessageId(typeof(GAddAreaEffect))); msg.putInt("iid", areaEffect.instanceId); msg.putInt("tid", TypeIdGenerator.getAreaEffectId(areaEffect.GetType())); msg.putInt("uid", areaEffect.ownerPlayer.user.id); 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); } } }
public static void SendMessage(Arena arena) { RawMessage message = PrepareMessageFor(typeof(OM_LoadingStateStarted)); int[] userIds = new int[arena.players.Count]; string[] usernames = new string[userIds.Length]; int[] playerIds = new int[userIds.Length]; Vector3[] positions = new Vector3[playerIds.Length]; for (int i = 0; i < arena.players.Count; i++) { userIds[i] = arena.players[i].user.id; usernames[i] = arena.players[i].user.username; playerIds[i] = arena.players[i].id; positions[i] = arena.players[i].position; } int height = arena.land.blocks.GetLength(0), width = arena.land.blocks.GetLength(1); int[] blockIds = new int[width * height]; int[] blockSkinIds = new int[width * height]; for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { blockIds[i * width + j] = (arena.land.blocks[i, j] == null?-1:TypeIdGenerator.idsOfBlocks[arena.land.blocks[i, j].GetType()]); blockSkinIds[i * width + j] = (arena.land.blocks[i, j] == null?0:arena.land.blocks[i, j].skinId); } } int obstacleCount = arena.obstacles.Count; int[] obstacleTypeIds = new int[obstacleCount]; int[] obstacleIds = new int[obstacleCount]; Vector3[] obstaclePositions = new Vector3[obstacleCount]; float[] obstacleHealths = new float[obstacleCount]; float[] obstacleRadiuses = new float[obstacleCount]; int[] obstacleSkinIds = new int[obstacleCount]; for (int i = 0; i < obstacleCount; i++) { Obstacle o = arena.obstacles[i]; obstacleTypeIds[i] = TypeIdGenerator.idsOfObstacles[o.GetType()]; obstacleIds[i] = o.id; obstaclePositions[i] = o.position; obstacleHealths[i] = o.health; obstacleRadiuses[i] = o.radius; obstacleSkinIds[i] = o.skinId; } message.putIntArray("userIds", userIds); message.putUTF8StringArray("usernames", usernames); message.putIntArray("playerIds", playerIds); message.PutVector3Array("positions", positions); message.putFloat("landWidth", arena.land.width); message.putFloat("landHeight", arena.land.height); message.putFloat("blockSize", arena.land.blockSize); message.putIntArray("blockTypeIds", blockIds); message.putIntArray("blockSkinIds", blockSkinIds); message.putIntArray("obsTypes", obstacleTypeIds); message.putIntArray("obsIds", obstacleIds); message.PutVector3Array("obsPositions", obstaclePositions); message.putFloatArray("obsHealths", obstacleHealths); message.putFloatArray("obsRadiuses", obstacleRadiuses); message.putIntArray("obsSkins", obstacleSkinIds); foreach (var p in arena.players) { p.user.client.SendMessage(message); } }