コード例 #1
0
        public static void sendMessage(ICollection <Player> receiverPlayers, Minion minion)
        {
            RawMessage msg = new RawMessage();

            msg.putInt("id", TypeIdGenerator.getMessageId(typeof(GCopyMinionResult)));

            if (receiverPlayers != null && receiverPlayers.Count != 0)
            {
                msg.putInt("iid", minion.instanceId);
                if (minion.ownerPlayer != null)
                {
                    msg.putInt("uid", minion.ownerPlayer.id);
                }
                else
                {
                    msg.putInt("uid", -1);
                }
                msg.putInt("tid", TypeIdGenerator.getMinionId(minion.GetType()));
                msg.putInt("bid", minion.position.board.instanceId);
                msg.putInt("cid", minion.position.pathPosition.pointIndex);
                msg.putFloat("t", minion.position.pathPosition.ratio);

                foreach (var receiverPlayer in receiverPlayers)
                {
                    receiverPlayer.user.session.client.SendMessage(msg);
                }
            }
        }
コード例 #2
0
        public static void sendMessage(ICollection <Player> receiverPlayers, FrankenScientistMinion parentMinion, ScrapGolemMinion spawnedMinion)
        {
            RawMessage msg = new RawMessage();

            msg.putInt("id", TypeIdGenerator.getMessageId(typeof(GMinion_FrankenScientist_spawn)));

            if (receiverPlayers != null && receiverPlayers.Count != 0)
            {
                msg.putInt("iid", parentMinion.instanceId);
                if (spawnedMinion.ownerPlayer != null)
                {
                    msg.putInt("uid", spawnedMinion.ownerPlayer.id);
                }
                else
                {
                    msg.putInt("uid", -1);
                }
                msg.putInt("sid", spawnedMinion.instanceId);
                msg.putInt("bid", spawnedMinion.position.board.instanceId);
                msg.putInt("cid", spawnedMinion.position.pathPosition.pointIndex);
                msg.putFloat("t", spawnedMinion.position.pathPosition.ratio);

                foreach (var receiverPlayer in receiverPlayers)
                {
                    receiverPlayer.user.session.client.SendMessage(msg);
                }
            }
        }
コード例 #3
0
        public static void sendMessage(ICollection <Player> receiverPlayers, Minion minion, ICollection <Minion> otherMinions)
        {
            RawMessage msg = new RawMessage();

            msg.putInt("id", TypeIdGenerator.getMessageId(typeof(GMinion_QuantumSoldier_teleport)));


            if (receiverPlayers != null && receiverPlayers.Count != 0)
            {
                msg.putInt("iid", minion.instanceId);
                msg.putFloat("ds", 1.3f);

                int [] minionInstanceIDs = new int[otherMinions.Count];

                int index = 0;
                foreach (var minionTarget in otherMinions)
                {
                    minionInstanceIDs[index++] = minionTarget.instanceId;
                }

                msg.putIntArray("mids", minionInstanceIDs);

                foreach (var receiverPlayer in receiverPlayers)
                {
                    receiverPlayer.user.session.client.SendMessage(msg);
                }
            }
        }
        public static void sendMessage(ICollection<Player> receiverPlayers, SeedTowerPlantMissile missile)
        {
            RawMessage msg = new RawMessage();
            msg.putInt("id", TypeIdGenerator.getMessageId(typeof(GAreaEffect_SeedTowerAreaEffect_createMissile)));

            if (receiverPlayers != null && receiverPlayers.Count != 0)
            {
                msg.putInt("iid", missile.instanceId);
                msg.putFloat("x", missile.startWorldPosition.x);
                msg.putFloat("y", missile.startWorldPosition.y);
                msg.putFloat("z", missile.startWorldPosition.z);
                msg.putInt("tid", TypeIdGenerator.getMissileId(missile.GetType()));
                msg.putInt("mid", missile.targetMinion.instanceId);

                foreach (var receiverPlayer in receiverPlayers)
                    receiverPlayer.user.session.client.SendMessage(msg);
            }
        }
コード例 #5
0
        public static void sendMessage( ICollection<Player> receiverPlayers, float seconds)
        {
            RawMessage msg = new RawMessage();
            msg.putInt("id", TypeIdGenerator.getMessageId(typeof(GEnterStartCountdown)));
            msg.putFloat("s", seconds);

            foreach (var player in receiverPlayers)
                player.user.session.client.SendMessage(msg);
        }
コード例 #6
0
        public static void sendMessage(ICollection<Player> recievers)
        {
            RawMessage msg = new RawMessage();

            msg.putInt("id", TypeIdGenerator.getMessageId(typeof(GReadyStateRequest)));

            msg.putFloat("s", Science_Wars_Server.Game.READY_STATE_END_TIME_DEFAULT);

            foreach (Player p in recievers)
                p.user.session.client.SendMessage(msg);
        }
コード例 #7
0
        public static void sendMessage(ICollection<Player> receiverPlayers, float nextPaymentTime)
        {
            if (receiverPlayers != null && receiverPlayers.Count != 0)
            {
                RawMessage msg = new RawMessage();
                msg.putInt("id", TypeIdGenerator.getMessageId(typeof(GPaymentTimeInfo)));
                msg.putFloat("s", nextPaymentTime);

                foreach (var receiverPlayer in receiverPlayers)
                    receiverPlayer.user.session.client.SendMessage(msg);
            }
        }
        public static void sendMessage(ICollection <Player> receiverPlayers, SeedTowerPlantMissile missile)
        {
            RawMessage msg = new RawMessage();

            msg.putInt("id", TypeIdGenerator.getMessageId(typeof(GAreaEffect_SeedTowerAreaEffect_createMissile)));

            if (receiverPlayers != null && receiverPlayers.Count != 0)
            {
                msg.putInt("iid", missile.instanceId);
                msg.putFloat("x", missile.startWorldPosition.x);
                msg.putFloat("y", missile.startWorldPosition.y);
                msg.putFloat("z", missile.startWorldPosition.z);
                msg.putInt("tid", TypeIdGenerator.getMissileId(missile.GetType()));
                msg.putInt("mid", missile.targetMinion.instanceId);

                foreach (var receiverPlayer in receiverPlayers)
                {
                    receiverPlayer.user.session.client.SendMessage(msg);
                }
            }
        }
コード例 #9
0
        public static void SendMessage(Arena arena, Player p)
        {
            RawMessage message = PrepareMessageFor(typeof(OM_PlayerHealthInfo));

            message.putInt("playerId", p.id);
            message.putFloat("health", p.health);

            foreach (var player in arena.players)
            {
                player.user.client.SendMessage(message);
            }
        }
コード例 #10
0
        public static void sendMessage(ICollection <Player> receiverPlayers, float seconds)
        {
            RawMessage msg = new RawMessage();

            msg.putInt("id", TypeIdGenerator.getMessageId(typeof(GEnterStartCountdown)));
            msg.putFloat("s", seconds);

            foreach (var player in receiverPlayers)
            {
                player.user.session.client.SendMessage(msg);
            }
        }
コード例 #11
0
        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);
            }
        }
コード例 #12
0
        private static void AddLandInfo(RawMessage message, Arena arena)
        {
            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);
                }
            }

            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);
        }
コード例 #13
0
        public static void sendMessage(ICollection <Player> recievers)
        {
            RawMessage msg = new RawMessage();

            msg.putInt("id", TypeIdGenerator.getMessageId(typeof(GReadyStateRequest)));

            msg.putFloat("s", Science_Wars_Server.Game.READY_STATE_END_TIME_DEFAULT);

            foreach (Player p in recievers)
            {
                p.user.session.client.SendMessage(msg);
            }
        }
コード例 #14
0
        public static void SendMessage(Arena arena, Obstacle obstacle, Vector3 impactPosition)
        {
            RawMessage message = PrepareMessageFor(typeof(OM_ObstacleHealthInfo));

            message.putInt("obstacleId", obstacle.id);
            message.putFloat("health", obstacle.health);
            message.PutVector3("impactPosition", impactPosition);

            foreach (var p in arena.players)
            {
                p.user.client.SendMessage(message);
            }
        }
コード例 #15
0
        public static void SendMessage(Arena arena, float duration)
        {
            RawMessage message = PrepareMessageFor(typeof(OM_StartCountdown));

            message.putFloat("duration", duration);
            message.putInt("round", arena.currentRound);
            message.putInt("totalRounds", arena.totalRounds);

            foreach (var p in arena.players)
            {
                p.user.client.SendMessage(message);
            }
        }
コード例 #16
0
        public static void SendMessage(Arena arena, Player player)
        {
            RawMessage message = PrepareMessageFor(typeof(OM_PlayerFly));

            message.putInt("playerId", player.id);
            message.putFloat("flySpeed", player.flySpeed);
            message.PutVector3("flyTarget", player.flyTarget);

            foreach (var p in arena.players)
            {
                p.user.client.SendMessage(message);
            }
        }
コード例 #17
0
        public static void sendMessage(ICollection<Player> receiverPlayers)
        {
            RawMessage msg = new RawMessage();
            msg.putInt("id", TypeIdGenerator.getMessageId(typeof(GRandomMinionTimeInfo)));

            if (receiverPlayers != null && receiverPlayers.Count != 0)
            {
                msg.putFloat("s", receiverPlayers.ElementAt(0).game.nextRandomMinionTime);

                foreach (var receiverPlayer in receiverPlayers)
                    receiverPlayer.user.session.client.SendMessage(msg);
            }
        }
コード例 #18
0
        public static void sendMessage(ICollection<Player> receiverPlayers, Minion minion)
        {
            RawMessage msg = new RawMessage();
            msg.putInt("id", TypeIdGenerator.getMessageId(typeof(GMinionHealthInfo)));

            if (receiverPlayers != null && receiverPlayers.Count != 0)
            {
                msg.putInt("iid", minion.instanceId);
                msg.putFloat("h", minion.stats.health);

                foreach (var receiverPlayer in receiverPlayers)
                    receiverPlayer.user.session.client.SendMessage(msg);
            }
        }
コード例 #19
0
        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);
                }
            }
        }
コード例 #20
0
        public static void sendMessage(ICollection<Player> receiverPlayers, Minion minion, float runBackTime)
        {
            RawMessage msg = new RawMessage();
            msg.putInt("id", TypeIdGenerator.getMessageId(typeof(GMinion_Trypanophobia_addEffect)));

            if (receiverPlayers != null && receiverPlayers.Count != 0)
            {
                msg.putInt("iid", minion.instanceId);
                msg.putFloat("t", runBackTime);

                foreach (var receiverPlayer in receiverPlayers)
                    receiverPlayer.user.session.client.SendMessage(msg);
            }
        }
コード例 #21
0
        public static void SendMessage(Arena arena, Player player)
        {
            RawMessage message = PrepareMessageFor(typeof(OM_PlayerWalk));

            message.putInt("playerId", player.id);
            message.putFloat("walkSpeed", player.walkSpeed);
            message.PutVector3("walkTarget", player.walkTarget);
            message.PutVector3("currentPosition", player.position);

            foreach (var p in arena.players)
            {
                p.user.client.SendMessage(message);
            }
        }
コード例 #22
0
        public static void sendMessage(ICollection <Player> receiverPlayers, float nextPaymentTime)
        {
            if (receiverPlayers != null && receiverPlayers.Count != 0)
            {
                RawMessage msg = new RawMessage();
                msg.putInt("id", TypeIdGenerator.getMessageId(typeof(GPaymentTimeInfo)));
                msg.putFloat("s", nextPaymentTime);

                foreach (var receiverPlayer in receiverPlayers)
                {
                    receiverPlayer.user.session.client.SendMessage(msg);
                }
            }
        }
コード例 #23
0
        public static void sendMessage(ICollection<Player> receiverPlayers, Minion minion, NailTrapSlowEffect effect)
        {
            RawMessage msg = new RawMessage();
            msg.putInt("id", TypeIdGenerator.getMessageId(typeof(GAddEffectOnMinionNailTrapSlow)));

            if (receiverPlayers != null && receiverPlayers.Count != 0)
            {
                msg.putInt("iid", minion.instanceId);
                msg.putInt("tid", TypeIdGenerator.getMinionEffectId(effect.GetType()));
                msg.putFloat("sa", effect.slowAmount);

                foreach (var receiverPlayer in receiverPlayers)
                    receiverPlayer.user.session.client.SendMessage(msg);
            }
        }
コード例 #24
0
        public static void sendMessage(ICollection <Player> receiverPlayers)
        {
            RawMessage msg = new RawMessage();

            msg.putInt("id", TypeIdGenerator.getMessageId(typeof(GRandomMinionTimeInfo)));

            if (receiverPlayers != null && receiverPlayers.Count != 0)
            {
                msg.putFloat("s", receiverPlayers.ElementAt(0).game.nextRandomMinionTime);

                foreach (var receiverPlayer in receiverPlayers)
                {
                    receiverPlayer.user.session.client.SendMessage(msg);
                }
            }
        }
コード例 #25
0
        public static void sendMessage(ICollection<Player> receiverPlayers, Minion minion)
        {
            RawMessage msg = new RawMessage();
            msg.putInt("id", TypeIdGenerator.getMessageId(typeof(GMinionPositionInfo)));

            if (receiverPlayers != null && receiverPlayers.Count != 0)
            {
                msg.putInt("iid", minion.instanceId);
                msg.putInt("bid", minion.position.board.instanceId);
                msg.putInt("cid", minion.position.pathPosition.pointIndex);
                msg.putFloat("t", minion.position.pathPosition.ratio);

                foreach (var receiverPlayer in receiverPlayers)
                    receiverPlayer.user.session.client.SendMessage(msg);
            }
        }
コード例 #26
0
        public static void sendMessage(ICollection <Player> receiverPlayers, Minion minion, float runBackTime)
        {
            RawMessage msg = new RawMessage();

            msg.putInt("id", TypeIdGenerator.getMessageId(typeof(GMinion_Trypanophobia_addEffect)));


            if (receiverPlayers != null && receiverPlayers.Count != 0)
            {
                msg.putInt("iid", minion.instanceId);
                msg.putFloat("t", runBackTime);

                foreach (var receiverPlayer in receiverPlayers)
                {
                    receiverPlayer.user.session.client.SendMessage(msg);
                }
            }
        }
コード例 #27
0
        public static void sendMessage(ICollection <Player> receiverPlayers, Minion minion, NailTrapSlowEffect effect)
        {
            RawMessage msg = new RawMessage();

            msg.putInt("id", TypeIdGenerator.getMessageId(typeof(GAddEffectOnMinionNailTrapSlow)));

            if (receiverPlayers != null && receiverPlayers.Count != 0)
            {
                msg.putInt("iid", minion.instanceId);
                msg.putInt("tid", TypeIdGenerator.getMinionEffectId(effect.GetType()));
                msg.putFloat("sa", effect.slowAmount);

                foreach (var receiverPlayer in receiverPlayers)
                {
                    receiverPlayer.user.session.client.SendMessage(msg);
                }
            }
        }
コード例 #28
0
        public static void sendMessage(ICollection <Player> receiverPlayers, Minion minion)
        {
            RawMessage msg = new RawMessage();

            msg.putInt("id", TypeIdGenerator.getMessageId(typeof(GMinionHealthInfo)));


            if (receiverPlayers != null && receiverPlayers.Count != 0)
            {
                msg.putInt("iid", minion.instanceId);
                msg.putFloat("h", minion.stats.health);

                foreach (var receiverPlayer in receiverPlayers)
                {
                    receiverPlayer.user.session.client.SendMessage(msg);
                }
            }
        }
コード例 #29
0
        public static void sendMessage(ICollection<Player> receiverPlayers, FrankenScientistMinion parentMinion, ScrapGolemMinion spawnedMinion)
        {
            RawMessage msg = new RawMessage();
            msg.putInt("id", TypeIdGenerator.getMessageId(typeof(GMinion_FrankenScientist_spawn)));

            if (receiverPlayers != null && receiverPlayers.Count != 0)
            {
                msg.putInt("iid", parentMinion.instanceId);
                if(spawnedMinion.ownerPlayer != null)
                    msg.putInt("uid", spawnedMinion.ownerPlayer.id);
                else
                    msg.putInt("uid", -1);
                msg.putInt("sid", spawnedMinion.instanceId);
                msg.putInt("bid", spawnedMinion.position.board.instanceId);
                msg.putInt("cid", spawnedMinion.position.pathPosition.pointIndex);
                msg.putFloat("t", spawnedMinion.position.pathPosition.ratio);

                foreach (var receiverPlayer in receiverPlayers)
                    receiverPlayer.user.session.client.SendMessage(msg);
            }
        }
コード例 #30
0
        public static void sendMessage(ICollection<Player> receiverPlayers, Minion minion, ICollection<Minion> otherMinions)
        {
            RawMessage msg = new RawMessage();
            msg.putInt("id", TypeIdGenerator.getMessageId(typeof(GMinion_QuantumSoldier_teleport)));

            if (receiverPlayers != null && receiverPlayers.Count != 0)
            {
                msg.putInt("iid", minion.instanceId);
                msg.putFloat("ds", 1.3f);

                int [] minionInstanceIDs = new int[otherMinions.Count];

                int index = 0;
                foreach (var minionTarget in otherMinions)
                {
                    minionInstanceIDs[index++] = minionTarget.instanceId;
                }

                msg.putIntArray("mids", minionInstanceIDs);

                foreach (var receiverPlayer in receiverPlayers)
                    receiverPlayer.user.session.client.SendMessage(msg);
            }
        }
コード例 #31
0
        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);
            }
        }